summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2014-07-30 10:39:38 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-31 07:29:17 +0200
commit916ca9472fb322f79e9814aa9fc04e504ab0e792 (patch)
tree09d0263e18bd55bdf7f343fe14f24f3c5b4a2adf /drivers/pci
parente5a91ee5443c05a2b484f78335d5d7d1d629f623 (diff)
downloadbarebox-916ca9472fb322f79e9814aa9fc04e504ab0e792.tar.gz
barebox-916ca9472fb322f79e9814aa9fc04e504ab0e792.tar.xz
pci: set auto-incremented bus number
When using more than one PCI bus, we have to assign unique numbers to each bus. Use an auto-incremented bus index and assign it to each registered bus. Also, allow the PCI host controller to update internal registers by calling set_busno with assigned bus number. While at it, add pci_controller struct to set_busno callback, add a back reference to pci_controller to pci_bus, and clean up unused left-overs from Linux import. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b64f25d132..a1b7680254 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -11,6 +11,7 @@ static struct pci_controller *hose_head, **hose_tail = &hose_head;
LIST_HEAD(pci_root_buses);
EXPORT_SYMBOL(pci_root_buses);
+static u8 bus_index;
static struct pci_bus *pci_alloc_bus(void)
{
@@ -36,10 +37,14 @@ void register_pci_controller(struct pci_controller *hose)
bus = pci_alloc_bus();
hose->bus = bus;
+ bus->host = hose;
bus->ops = hose->pci_ops;
bus->resource[0] = hose->mem_resource;
bus->resource[1] = hose->io_resource;
+ bus->number = bus_index++;
+ if (hose->set_busno)
+ hose->set_busno(hose, bus->number);
pci_scan_bus(bus);
list_add_tail(&bus->node, &pci_root_buses);