* [PATCH] pci: make sure to activate devices on the root bus
@ 2015-04-03 12:27 Lucas Stach
2015-04-10 8:22 ` Sebastian Hesselbarth
2015-04-13 6:35 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Lucas Stach @ 2015-04-03 12:27 UTC (permalink / raw)
To: barebox
Commit b8a1bb1dd215 (pci: defer device registration until after bridge setup)
changed the activation order of devices, so that bridges above the devices could
be configured properly before activating the devices below. This commit failed
to acknowledge that there may be devices located directly on the root bus without
any bridge in between and so those devices would never get enabled.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
drivers/pci/pci.c | 7 +++++++
include/linux/pci.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1f5dc78..2762511 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -348,6 +348,12 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
dev->rom_address = (l == 0xffffffff) ? 0 : l;
setup_device(dev, 6);
+ /*
+ * If this device is on the root bus, there is no bridge
+ * to configure, so we can activate it right away.
+ */
+ if (!bus->parent_bus)
+ pci_register_device(dev);
break;
case PCI_HEADER_TYPE_BRIDGE:
setup_device(dev, 2);
@@ -356,6 +362,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
/* inherit parent properties */
child_bus->host = bus->host;
child_bus->ops = bus->host->pci_ops;
+ child_bus->parent_bus = bus;
child_bus->resource[PCI_BUS_RESOURCE_MEM] =
bus->resource[PCI_BUS_RESOURCE_MEM];
child_bus->resource[PCI_BUS_RESOURCE_MEM_PREF] =
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3d0e73b..e422055 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -123,6 +123,7 @@ enum {
struct pci_bus {
struct pci_controller *host; /* associated host controller */
struct device_d *parent;
+ struct pci_bus *parent_bus; /* parent bus */
struct list_head node; /* node in list of buses */
struct list_head children; /* list of child buses */
struct list_head devices; /* list of devices on this bus */
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pci: make sure to activate devices on the root bus
2015-04-03 12:27 [PATCH] pci: make sure to activate devices on the root bus Lucas Stach
@ 2015-04-10 8:22 ` Sebastian Hesselbarth
2015-04-13 6:35 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Hesselbarth @ 2015-04-10 8:22 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On 03.04.2015 14:27, Lucas Stach wrote:
> Commit b8a1bb1dd215 (pci: defer device registration until after bridge setup)
> changed the activation order of devices, so that bridges above the devices could
> be configured properly before activating the devices below. This commit failed
> to acknowledge that there may be devices located directly on the root bus without
> any bridge in between and so those devices would never get enabled.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
The patch properly fixes registration for root bus attached devices, so
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Thanks.
> ---
> drivers/pci/pci.c | 7 +++++++
> include/linux/pci.h | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 1f5dc78..2762511 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -348,6 +348,12 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
> dev->rom_address = (l == 0xffffffff) ? 0 : l;
>
> setup_device(dev, 6);
> + /*
> + * If this device is on the root bus, there is no bridge
> + * to configure, so we can activate it right away.
> + */
> + if (!bus->parent_bus)
> + pci_register_device(dev);
> break;
> case PCI_HEADER_TYPE_BRIDGE:
> setup_device(dev, 2);
> @@ -356,6 +362,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
> /* inherit parent properties */
> child_bus->host = bus->host;
> child_bus->ops = bus->host->pci_ops;
> + child_bus->parent_bus = bus;
> child_bus->resource[PCI_BUS_RESOURCE_MEM] =
> bus->resource[PCI_BUS_RESOURCE_MEM];
> child_bus->resource[PCI_BUS_RESOURCE_MEM_PREF] =
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 3d0e73b..e422055 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -123,6 +123,7 @@ enum {
> struct pci_bus {
> struct pci_controller *host; /* associated host controller */
> struct device_d *parent;
> + struct pci_bus *parent_bus; /* parent bus */
> struct list_head node; /* node in list of buses */
> struct list_head children; /* list of child buses */
> struct list_head devices; /* list of devices on this bus */
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pci: make sure to activate devices on the root bus
2015-04-03 12:27 [PATCH] pci: make sure to activate devices on the root bus Lucas Stach
2015-04-10 8:22 ` Sebastian Hesselbarth
@ 2015-04-13 6:35 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2015-04-13 6:35 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Fri, Apr 03, 2015 at 02:27:30PM +0200, Lucas Stach wrote:
> Commit b8a1bb1dd215 (pci: defer device registration until after bridge setup)
> changed the activation order of devices, so that bridges above the devices could
> be configured properly before activating the devices below. This commit failed
> to acknowledge that there may be devices located directly on the root bus without
> any bridge in between and so those devices would never get enabled.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> drivers/pci/pci.c | 7 +++++++
> include/linux/pci.h | 1 +
> 2 files changed, 8 insertions(+)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-13 6:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03 12:27 [PATCH] pci: make sure to activate devices on the root bus Lucas Stach
2015-04-10 8:22 ` Sebastian Hesselbarth
2015-04-13 6:35 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox