public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fdt: pci: Permit use of reg property for setting device address
@ 2015-01-20  3:19 Simon Glass
  2015-01-20 12:59 ` Bin Meng
  2015-01-21  9:33 ` Sjoerd Simons
  0 siblings, 2 replies; 8+ messages in thread
From: Simon Glass @ 2015-01-20  3:19 UTC (permalink / raw)
  To: u-boot

In commit a62e84d the old functionality of obtaining a PCI address from the
'reg' property was lost. Add it back, so we can support both a compatible
string list and a 'reg' property.

This patch fixes PCIe ethernet on Tegra boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/fdtdec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 89dac4c..0488607 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -219,8 +219,14 @@ int fdtdec_get_pci_bdf(const void *blob, int node,
 
 	/* get vendor id & device id from the compatible string */
 	ret = fdtdec_get_pci_vendev(blob, node, &dt_vendor, &dt_device);
-	if (ret)
-		return ret;
+	if (ret) {
+		/* Fall back to using the 'reg' property */
+		ret = fdtdec_get_int(blob, node, "reg", -1);
+		if (ret == -1)
+			return -ENOENT;
+		*bdf = ret & 0xffffff;
+		return 0;
+	}
 
 	/* extract the bdf from fdt_pci_addr */
 	*bdf = addr->phys_hi & 0xffff00;
-- 
2.2.0.rc0.207.ga3a616c

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

end of thread, other threads:[~2015-01-21  9:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20  3:19 [U-Boot] [PATCH] fdt: pci: Permit use of reg property for setting device address Simon Glass
2015-01-20 12:59 ` Bin Meng
2015-01-20 14:31   ` Simon Glass
2015-01-21  2:00     ` Bin Meng
2015-01-21  8:05       ` Thierry Reding
2015-01-21  8:46         ` Bin Meng
2015-01-21  9:33           ` Thierry Reding
2015-01-21  9:33 ` Sjoerd Simons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox