]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pcie/layerscape: fix bug in bus number computation when setting msi-map
authorBogdan Purcareata <bogdan.purcareata@nxp.com>
Tue, 17 May 2016 07:18:40 +0000 (07:18 +0000)
committerYork Sun <york.sun@nxp.com>
Fri, 3 Jun 2016 21:12:10 +0000 (14:12 -0700)
When multiple PCI cards are present in an ls2080a board, the second
card does not get its msi-map set up properly due to a bug in
computing the bus number.

The bus number returned by PCI_BDF() is not the actual PCI bus
number, but instead represents a global u-boot PCI bus number. A
given bus number is relative to hose->first_busno, so that has to be
subtracted from the PCI device id.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Stuart Yoder <stuart.yoder@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
drivers/pci/pcie_layerscape.c

index 0ba960e248072de6932aa0917ef28afbec5c3526..2e6b986dbce169a997984c37601b7ebce5a731e6 100644 (file)
@@ -569,7 +569,7 @@ static void fdt_fixup_pcie(void *blob)
        unsigned char header_type;
        int index;
        u32 streamid;
-       pci_dev_t dev;
+       pci_dev_t dev, bdf;
        int bus;
        unsigned short id;
        struct pci_controller *hose;
@@ -611,12 +611,15 @@ static void fdt_fixup_pcie(void *blob)
                                        continue;
                                }
 
+                               /* the DT fixup must be relative to the hose first_busno */
+                               bdf = dev - PCI_BDF(hose->first_busno, 0, 0);
+
                                /* map PCI b.d.f to streamID in LUT */
-                               ls_pcie_lut_set_mapping(pcie, index, dev >> 8,
+                               ls_pcie_lut_set_mapping(pcie, index, bdf >> 8,
                                                        streamid);
 
                                /* update msi-map in device tree */
-                               fdt_pcie_set_msi_map_entry(blob, pcie, dev >> 8,
+                               fdt_pcie_set_msi_map_entry(blob, pcie, bdf >> 8,
                                                           streamid);
                        }
                }