]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI: dwc: Add common iATU register support
authorKunihiko Hayashi <hayashi.kunihiko@socionext.com>
Wed, 30 Sep 2020 05:36:06 +0000 (14:36 +0900)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 13 Oct 2020 08:52:49 +0000 (09:52 +0100)
This gets iATU register area from reg property that has reg-names "atu".
In Synopsys DWC version 4.80 or later, since iATU register area is
separated from core register area, this area is necessary to get from
DT independently.

Suggested-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/1601444167-11316-4-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
drivers/pci/controller/dwc/pcie-designware.c

index 3c1f17c78241363122fcfa28f51bb3a48e29f692..c2dea8fc97c8fba7d0a1e933674ec3d819068f1c 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/delay.h>
 #include <linux/of.h>
+#include <linux/of_platform.h>
 #include <linux/types.h>
 
 #include "../../pci.h"
@@ -548,11 +549,15 @@ void dw_pcie_setup(struct dw_pcie *pci)
        u32 val;
        struct device *dev = pci->dev;
        struct device_node *np = dev->of_node;
+       struct platform_device *pdev = to_platform_device(dev);
 
        if (pci->version >= 0x480A || (!pci->version &&
                                       dw_pcie_iatu_unroll_enabled(pci))) {
                pci->iatu_unroll_enabled = true;
                if (!pci->atu_base)
+                       pci->atu_base =
+                           devm_platform_ioremap_resource_byname(pdev, "atu");
+               if (IS_ERR(pci->atu_base))
                        pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET;
        }
        dev_dbg(pci->dev, "iATU unroll: %s\n", pci->iatu_unroll_enabled ?