devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework
@ 2020-09-30  5:36 Kunihiko Hayashi
  2020-09-30  5:36 ` [PATCH v3 1/4] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-30  5:36 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han,
	Gustavo Pimentel, Murali Karicheri
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel,
	Masami Hiramatsu, Jassi Brar, Kunihiko Hayashi

This moves iATU register mapping in the Keystone driver to common
framework. And this adds "iatu" property description to the dt-bindings
for UniPhier PCIe host and endpoint controller.

This series is split from the previous patches:
https://www.spinics.net/lists/linux-pci/msg97608.html
"[PATCH v6 0/6] PCI: uniphier: Add features for UniPhier PCIe host controller"

This has been confirmed with PCIe version 4.80 controller on UniPhier platform.
Please comfirm this series on Keystone platform if necessary.

Changes since v2:
- dt-bindings: Fix errors from dt_binding_check

Changes since v1:
- Use to_platform_device() instead of of_find_device_by_node()
- Add Reviewed-by: line to 4th patch for keystone
- dt-bindings: Add description for uniphier-ep

Kunihiko Hayashi (4):
  dt-bindings: PCI: uniphier: Add iATU register description
  dt-bindings: PCI: uniphier-ep: Add iATU register description
  PCI: dwc: Add common iATU register support
  PCI: keystone: Remove iATU register mapping

 .../bindings/pci/socionext,uniphier-pcie-ep.yaml     | 20 ++++++++++++++------
 .../devicetree/bindings/pci/uniphier-pcie.txt        |  1 +
 drivers/pci/controller/dwc/pci-keystone.c            | 20 ++++----------------
 drivers/pci/controller/dwc/pcie-designware.c         |  5 +++++
 4 files changed, 24 insertions(+), 22 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/4] dt-bindings: PCI: uniphier: Add iATU register description
  2020-09-30  5:36 [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
@ 2020-09-30  5:36 ` Kunihiko Hayashi
  2020-09-30  5:36 ` [PATCH v3 2/4] dt-bindings: PCI: uniphier-ep: " Kunihiko Hayashi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-30  5:36 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han,
	Gustavo Pimentel, Murali Karicheri
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel,
	Masami Hiramatsu, Jassi Brar, Kunihiko Hayashi

In the dt-bindings, "atu" reg-names is required to get the register space
for iATU in Synopsys DWC version 4.80 or later.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/pci/uniphier-pcie.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/uniphier-pcie.txt b/Documentation/devicetree/bindings/pci/uniphier-pcie.txt
index 1fa2c59..c4b7381 100644
--- a/Documentation/devicetree/bindings/pci/uniphier-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/uniphier-pcie.txt
@@ -16,6 +16,7 @@ Required properties:
     "dbi"    - controller configuration registers
     "link"   - SoC-specific glue layer registers
     "config" - PCIe configuration space
+    "atu"    - iATU registers for DWC version 4.80 or later
 - clocks: A phandle to the clock gate for PCIe glue layer including
 	the host controller.
 - resets: A phandle to the reset line for PCIe glue layer including
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/4] dt-bindings: PCI: uniphier-ep: Add iATU register description
  2020-09-30  5:36 [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
  2020-09-30  5:36 ` [PATCH v3 1/4] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
@ 2020-09-30  5:36 ` Kunihiko Hayashi
  2020-09-30 12:48   ` Rob Herring
  2020-09-30  5:36 ` [PATCH v3 3/4] PCI: dwc: Add common iATU register support Kunihiko Hayashi
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-30  5:36 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han,
	Gustavo Pimentel, Murali Karicheri
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel,
	Masami Hiramatsu, Jassi Brar, Kunihiko Hayashi

In the dt-bindings, "atu" reg-names is required to get the register space
for iATU in Synopsis DWC version 4.80 or later.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 .../bindings/pci/socionext,uniphier-pcie-ep.yaml     | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/socionext,uniphier-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/socionext,uniphier-pcie-ep.yaml
index f0558b9..f4292d2 100644
--- a/Documentation/devicetree/bindings/pci/socionext,uniphier-pcie-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/socionext,uniphier-pcie-ep.yaml
@@ -23,14 +23,22 @@ properties:
     const: socionext,uniphier-pro5-pcie-ep
 
   reg:
-    maxItems: 4
+    minItems: 4
+    maxItems: 5
 
   reg-names:
-    items:
-      - const: dbi
-      - const: dbi2
-      - const: link
-      - const: addr_space
+    oneOf:
+      - items:
+        - const: dbi
+        - const: dbi2
+        - const: link
+        - const: addr_space
+      - items:
+        - const: dbi
+        - const: dbi2
+        - const: link
+        - const: addr_space
+        - const: atu
 
   clocks:
     maxItems: 2
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/4] PCI: dwc: Add common iATU register support
  2020-09-30  5:36 [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
  2020-09-30  5:36 ` [PATCH v3 1/4] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
  2020-09-30  5:36 ` [PATCH v3 2/4] dt-bindings: PCI: uniphier-ep: " Kunihiko Hayashi
@ 2020-09-30  5:36 ` Kunihiko Hayashi
  2020-09-30 12:49   ` Rob Herring
  2020-09-30  5:36 ` [PATCH v3 4/4] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
  2020-10-08 11:23 ` [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Lorenzo Pieralisi
  4 siblings, 1 reply; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-30  5:36 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han,
	Gustavo Pimentel, Murali Karicheri
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel,
	Masami Hiramatsu, Jassi Brar, Kunihiko Hayashi

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.

Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/pci/controller/dwc/pcie-designware.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index 3fe859f..b6b39af 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -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 ?
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 4/4] PCI: keystone: Remove iATU register mapping
  2020-09-30  5:36 [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
                   ` (2 preceding siblings ...)
  2020-09-30  5:36 ` [PATCH v3 3/4] PCI: dwc: Add common iATU register support Kunihiko Hayashi
@ 2020-09-30  5:36 ` Kunihiko Hayashi
  2020-10-08 11:23 ` [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-30  5:36 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han,
	Gustavo Pimentel, Murali Karicheri
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel,
	Masami Hiramatsu, Jassi Brar, Kunihiko Hayashi

After applying "PCI: dwc: Add common iATU register support",
there is no need to set own iATU in the Keystone driver itself.

Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 drivers/pci/controller/dwc/pci-keystone.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index b554812..a222728 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1154,7 +1154,6 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 	struct keystone_pcie *ks_pcie;
 	struct device_link **link;
 	struct gpio_desc *gpiod;
-	void __iomem *atu_base;
 	struct resource *res;
 	unsigned int version;
 	void __iomem *base;
@@ -1275,23 +1274,12 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 		goto err_get_sync;
 	}
 
-	if (pci->version >= 0x480A) {
-		atu_base = devm_platform_ioremap_resource_byname(pdev, "atu");
-		if (IS_ERR(atu_base)) {
-			ret = PTR_ERR(atu_base);
-			goto err_get_sync;
-		}
-
-		pci->atu_base = atu_base;
-
+	if (pci->version >= 0x480A)
 		ret = ks_pcie_am654_set_mode(dev, mode);
-		if (ret < 0)
-			goto err_get_sync;
-	} else {
+	else
 		ret = ks_pcie_set_mode(dev);
-		if (ret < 0)
-			goto err_get_sync;
-	}
+	if (ret < 0)
+		goto err_get_sync;
 
 	switch (mode) {
 	case DW_PCIE_RC_TYPE:
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 2/4] dt-bindings: PCI: uniphier-ep: Add iATU register description
  2020-09-30  5:36 ` [PATCH v3 2/4] dt-bindings: PCI: uniphier-ep: " Kunihiko Hayashi
@ 2020-09-30 12:48   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-09-30 12:48 UTC (permalink / raw)
  To: Kunihiko Hayashi
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, PCI, devicetree, linux-arm-kernel,
	linux-kernel, Masami Hiramatsu, Jassi Brar

On Wed, Sep 30, 2020 at 12:36 AM Kunihiko Hayashi
<hayashi.kunihiko@socionext.com> wrote:
>
> In the dt-bindings, "atu" reg-names is required to get the register space
> for iATU in Synopsis DWC version 4.80 or later.
>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  .../bindings/pci/socionext,uniphier-pcie-ep.yaml     | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/4] PCI: dwc: Add common iATU register support
  2020-09-30  5:36 ` [PATCH v3 3/4] PCI: dwc: Add common iATU register support Kunihiko Hayashi
@ 2020-09-30 12:49   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-09-30 12:49 UTC (permalink / raw)
  To: Kunihiko Hayashi
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, PCI, devicetree, linux-arm-kernel,
	linux-kernel, Masami Hiramatsu, Jassi Brar

On Wed, Sep 30, 2020 at 12:36 AM Kunihiko Hayashi
<hayashi.kunihiko@socionext.com> wrote:
>
> 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.
>
> Cc: Murali Karicheri <m-karicheri2@ti.com>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  drivers/pci/controller/dwc/pcie-designware.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework
  2020-09-30  5:36 [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
                   ` (3 preceding siblings ...)
  2020-09-30  5:36 ` [PATCH v3 4/4] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
@ 2020-10-08 11:23 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Pieralisi @ 2020-10-08 11:23 UTC (permalink / raw)
  To: Kunihiko Hayashi
  Cc: Rob Herring, Bjorn Helgaas, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, linux-pci, devicetree, linux-arm-kernel,
	linux-kernel, Masami Hiramatsu, Jassi Brar

On Wed, Sep 30, 2020 at 02:36:03PM +0900, Kunihiko Hayashi wrote:
> This moves iATU register mapping in the Keystone driver to common
> framework. And this adds "iatu" property description to the dt-bindings
> for UniPhier PCIe host and endpoint controller.
> 
> This series is split from the previous patches:
> https://www.spinics.net/lists/linux-pci/msg97608.html
> "[PATCH v6 0/6] PCI: uniphier: Add features for UniPhier PCIe host controller"
> 
> This has been confirmed with PCIe version 4.80 controller on UniPhier platform.
> Please comfirm this series on Keystone platform if necessary.
> 
> Changes since v2:
> - dt-bindings: Fix errors from dt_binding_check
> 
> Changes since v1:
> - Use to_platform_device() instead of of_find_device_by_node()
> - Add Reviewed-by: line to 4th patch for keystone
> - dt-bindings: Add description for uniphier-ep
> 
> Kunihiko Hayashi (4):
>   dt-bindings: PCI: uniphier: Add iATU register description
>   dt-bindings: PCI: uniphier-ep: Add iATU register description
>   PCI: dwc: Add common iATU register support
>   PCI: keystone: Remove iATU register mapping
> 
>  .../bindings/pci/socionext,uniphier-pcie-ep.yaml     | 20 ++++++++++++++------
>  .../devicetree/bindings/pci/uniphier-pcie.txt        |  1 +
>  drivers/pci/controller/dwc/pci-keystone.c            | 20 ++++----------------
>  drivers/pci/controller/dwc/pcie-designware.c         |  5 +++++
>  4 files changed, 24 insertions(+), 22 deletions(-)

Applied to pci/dwc, thanks.

Lorenzo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-08 11:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  5:36 [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
2020-09-30  5:36 ` [PATCH v3 1/4] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
2020-09-30  5:36 ` [PATCH v3 2/4] dt-bindings: PCI: uniphier-ep: " Kunihiko Hayashi
2020-09-30 12:48   ` Rob Herring
2020-09-30  5:36 ` [PATCH v3 3/4] PCI: dwc: Add common iATU register support Kunihiko Hayashi
2020-09-30 12:49   ` Rob Herring
2020-09-30  5:36 ` [PATCH v3 4/4] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
2020-10-08 11:23 ` [PATCH v3 0/4] PCI: dwc: Move iATU register mapping to common framework Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).