]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pci: plda: Get correct ECAM offset in multiple PCIe RC case
authorMinda Chen <minda.chen@starfivetech.com>
Mon, 7 Aug 2023 08:53:35 +0000 (16:53 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Thu, 10 Aug 2023 02:58:01 +0000 (10:58 +0800)
Get the correct ECAM offset and record the secondary bus
number in Multiple RC case.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
drivers/pci/pcie_plda_common.c

index 005b92616a7e03c9e4b32d15b62345c8fd6802a9..cd74bb471163be6667c7b9d3bdb8578d660d6c24 100644 (file)
@@ -36,8 +36,8 @@ static int plda_pcie_conf_address(const struct udevice *udev, pci_dev_t bdf,
                                  uint offset, void **paddr)
 {
        struct pcie_plda *priv = dev_get_priv(udev);
-       int where = PCIE_ECAM_OFFSET(PCI_BUS(bdf), PCI_DEV(bdf),
-                                    PCI_FUNC(bdf), offset);
+       int where = PCIE_ECAM_OFFSET(PCI_BUS(bdf) - dev_seq(udev),
+                                    PCI_DEV(bdf), PCI_FUNC(bdf), offset);
 
        if (!plda_pcie_addr_valid(priv, bdf))
                return -ENODEV;
@@ -71,6 +71,7 @@ int plda_pcie_config_write(struct udevice *udev, pci_dev_t bdf,
            (offset == PCI_PRIMARY_BUS && size != PCI_SIZE_8))) {
                priv->sec_busno =
                        ((offset == PCI_PRIMARY_BUS) ? (value >> 8) : value) & 0xff;
+               priv->sec_busno += dev_seq(udev);
                debug("Secondary bus number was changed to %d\n",
                      priv->sec_busno);
        }