]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pci: renesas: Add root bus handling on Gen3
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Fri, 15 Jan 2021 23:28:18 +0000 (00:28 +0100)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Sat, 20 Feb 2021 21:38:28 +0000 (22:38 +0100)
Add code to access the PCIe root bus space and configure it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
drivers/pci/pci-rcar-gen3.c

index 0d5b01f9f813039b4087794f8b0879eebab85057..cd116a536e5d69482dfd2f71f5990dd01cb3d0f0 100644 (file)
@@ -151,6 +151,16 @@ static int rcar_pcie_config_access(const struct udevice *udev,
        struct rcar_gen3_pcie_priv *priv = dev_get_plat(udev);
        u32 reg = where & ~3;
 
+       /* Root bus */
+       if (PCI_DEV(bdf) == 0) {
+               if (access_type == RCAR_PCI_ACCESS_READ)
+                       *data = readl(priv->regs + PCICONF(where / 4));
+               else
+                       writel(*data, priv->regs + PCICONF(where / 4));
+
+               return 0;
+       }
+
        /* Clear errors */
        clrbits_le32(priv->regs + PCIEERRFR, 0);
 
@@ -187,11 +197,14 @@ static int rcar_gen3_pcie_addr_valid(pci_dev_t d, uint where)
 {
        u32 slot;
 
+       if (PCI_BUS(d))
+               return -EINVAL;
+
        if (PCI_FUNC(d))
                return -EINVAL;
 
        slot = PCI_DEV(d);
-       if (slot != 1)
+       if (slot > 1)
                return -EINVAL;
 
        return 0;