
On Tue, Jan 20, 2015 at 12:05:40PM -0700, Simon Glass wrote:
Hi Sjoerd,
On 20 January 2015 at 10:06, Sjoerd Simons sjoerd.simons@collabora.co.uk wrote:
commit a62e84d7b1824a202dd incorrectly changed the tegra pci code to the new fdtdec pci helpers. To get the device index of the root port, the "reg" property should be parsed from the dtb (as was previously the case).
With this patch i can successfully network boot my jetson tk1
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk
drivers/pci/pci_tegra.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Can you also please take a look at this patch?
http://patchwork.ozlabs.org/patch/430815/
It tries to support both options.
Only that patch isn't sufficient because tegra_pcie_parse_port_info() then never calls fdtdec_get_pci_addr() so the index returned will be undefined (as in whatever happened to be on the stack - 1).
I use the below patch to fix networking on Jetson TK1. It's kind of a mix between both 430815 and this one, so I didn't feel like making it a proper patch because I assume you'll want to fix this in fdtdec and the Tegra bits in a follow-up patch?
Thierry
diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c index d344673cc549..0ad959e598c6 100644 --- a/drivers/pci/pci_tegra.c +++ b/drivers/pci/pci_tegra.c @@ -479,6 +479,12 @@ static int tegra_pcie_parse_port_info(const void *fdt, int node, pci_dev_t bdf; int err;
+ err = fdtdec_get_pci_addr(fdt, node, 0, "reg", &addr); + if (err < 0) { + error("failed to parse "reg" property"); + return err; + } + err = fdtdec_get_int(fdt, node, "nvidia,num-lanes", 0); if (err < 0) { error("failed to parse "nvidia,num-lanes" property"); diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 487122eebcf6..77e694d6f53f 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -224,13 +224,13 @@ int fdtdec_get_pci_bdf(const void *blob, int node, u16 dt_vendor, dt_device, vendor, device; int ret;
+ /* extract the bdf from fdt_pci_addr */ + *bdf = addr->phys_hi & 0xffff00; + /* get vendor id & device id from the compatible string */ ret = fdtdec_get_pci_vendev(blob, node, &dt_vendor, &dt_device); if (ret) - return ret; - - /* extract the bdf from fdt_pci_addr */ - *bdf = addr->phys_hi & 0xffff00; + return 0;
/* read vendor id & device id based on bdf */ pci_read_config_word(*bdf, PCI_VENDOR_ID, &vendor);