]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pci: fsl: Do not access PCI BAR0 register of PCIe Root Port
authorPali Rohár <pali@kernel.org>
Tue, 2 May 2023 17:53:57 +0000 (19:53 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 3 May 2023 22:30:46 +0000 (18:30 -0400)
Freescale PCIe Root Port has PEXCSRBAR register at position of PCI BAR0.
PCIe Root Port does not have any PCIe memory, so returns zero when trying
to read from PCIe Root Port BAR0 and ignore any writes.

Signed-off-by: Pali Rohár <pali@kernel.org>
drivers/pci/pcie_fsl.c

index 4600652f2b1b4f5e988d1f9b7f0811a47f11124c..8d89a1e5919ca139314361642fae10b01f8c39bf 100644 (file)
@@ -58,6 +58,14 @@ static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
                return 0;
        }
 
+       /* Skip Freescale PCIe controller's PEXCSRBAR register */
+       if (PCI_BUS(bdf) - dev_seq(bus) == 0 &&
+           PCI_DEV(bdf) == 0 && PCI_FUNC(bdf) == 0 &&
+           (offset & ~3) == PCI_BASE_ADDRESS_0) {
+               *valuep = 0;
+               return 0;
+       }
+
        val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus),
                                    PCI_DEV(bdf), PCI_FUNC(bdf),
                                    offset);
@@ -95,6 +103,12 @@ static int fsl_pcie_write_config(struct udevice *bus, pci_dev_t bdf,
        if (fsl_pcie_addr_valid(pcie, bdf))
                return 0;
 
+       /* Skip Freescale PCIe controller's PEXCSRBAR register */
+       if (PCI_BUS(bdf) - dev_seq(bus) == 0 &&
+           PCI_DEV(bdf) == 0 && PCI_FUNC(bdf) == 0 &&
+           (offset & ~3) == PCI_BASE_ADDRESS_0)
+               return 0;
+
        val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus),
                                    PCI_DEV(bdf), PCI_FUNC(bdf),
                                    offset);