All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes
@ 2018-08-24 18:27 Marek Vasut
  2018-08-24 18:27 ` [U-Boot] [PATCH V2 2/2] pci: Update documentation to make 'compatible' string optional Marek Vasut
  2018-08-29 14:21 ` [U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes Marek Vasut
  0 siblings, 2 replies; 34+ messages in thread
From: Marek Vasut @ 2018-08-24 18:27 UTC (permalink / raw)
  To: u-boot

The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Move the whole machinery to pci_bind_bus_devices(), right after
    the driver instance platform data are updated. This reduces the
    number of times the DT is traversed and works for both DT nodes
    with and without compat string.
---
 drivers/pci/pci-uclass.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index e9671d9b76..cf3e38a6f2 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -733,6 +733,7 @@ int pci_bind_bus_devices(struct udevice *bus)
 	ulong vendor, device;
 	ulong header_type;
 	pci_dev_t bdf, end;
+	ofnode node;
 	bool found_multi;
 	int ret;
 
@@ -803,6 +804,20 @@ int pci_bind_bus_devices(struct udevice *bus)
 		pplat->vendor = vendor;
 		pplat->device = device;
 		pplat->class = class;
+
+		/* Associate potention OF node */
+		dev_for_each_subnode(node, bus) {
+			phys_addr_t df, size;
+			df = ofnode_get_addr_size(node, "reg", &size);
+			if (df == FDT_ADDR_T_NONE)
+				continue;
+
+			if (PCI_FUNC(df) == PCI_FUNC(bdf) &&
+			    PCI_DEV(df) == PCI_DEV(bdf)) {
+				dev->node = node;
+				break;
+			}
+		}
 	}
 
 	return 0;
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2018-09-26 15:03 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-24 18:27 [U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes Marek Vasut
2018-08-24 18:27 ` [U-Boot] [PATCH V2 2/2] pci: Update documentation to make 'compatible' string optional Marek Vasut
2018-08-30  0:29   ` Simon Glass
2018-08-30 10:20     ` Marek Vasut
2018-09-01 21:45       ` Simon Glass
2018-09-01 22:41         ` Marek Vasut
2018-09-02  1:07           ` Simon Glass
2018-09-02 18:26             ` Marek Vasut
2018-09-02 23:34               ` Simon Glass
2018-08-29 14:21 ` [U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes Marek Vasut
2018-08-29 15:15   ` Bin Meng
2018-08-29 17:07     ` Marek Vasut
2018-08-29 21:56       ` Alexander Graf
2018-08-30 13:32       ` Bin Meng
2018-08-30 13:42         ` Marek Vasut
2018-09-01 21:50           ` Simon Glass
2018-09-01 22:45             ` Marek Vasut
2018-09-02  1:07               ` Simon Glass
2018-09-09 23:38                 ` Marek Vasut
2018-09-14  4:41                   ` Simon Glass
2018-09-18 11:36                     ` Marek Vasut
2018-09-18 13:52                       ` Bin Meng
2018-09-19  8:19                         ` Marek Vasut
2018-09-19  9:25                           ` Bin Meng
2018-09-18 13:52                       ` Simon Glass
2018-09-19  8:21                         ` Marek Vasut
2018-09-19  9:26                           ` Bin Meng
2018-09-19  9:34                             ` Marek Vasut
2018-09-19  9:41                               ` Bin Meng
2018-09-19 13:23                                 ` Marek Vasut
2018-09-20  1:47                                   ` Bin Meng
2018-09-20 23:56                                     ` Marek Vasut
2018-09-26  5:42                                       ` Simon Glass
2018-09-26 15:03                                         ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.