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

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 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 controller.

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

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

 .../devicetree/bindings/pci/uniphier-pcie.txt        |  1 +
 drivers/pci/controller/dwc/pci-keystone.c            | 20 ++++----------------
 drivers/pci/controller/dwc/pcie-designware.c         |  8 +++++++-
 3 files changed, 12 insertions(+), 17 deletions(-)

-- 
2.7.4


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

* [PATCH 1/3] dt-bindings: PCI: uniphier: Add iATU register description
  2020-09-11  8:50 [PATCH 0/3] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
@ 2020-09-11  8:50 ` Kunihiko Hayashi
  2020-09-11  8:50 ` [PATCH 2/3] PCI: dwc: Add common iATU register support Kunihiko Hayashi
  2020-09-11  8:50 ` [PATCH 3/3] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
  2 siblings, 0 replies; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-11  8:50 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, Rob Herring
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel, 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 2/3] PCI: dwc: Add common iATU register support
  2020-09-11  8:50 [PATCH 0/3] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
  2020-09-11  8:50 ` [PATCH 1/3] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
@ 2020-09-11  8:50 ` Kunihiko Hayashi
  2020-09-23 15:57   ` Rob Herring
  2020-09-11  8:50 ` [PATCH 3/3] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
  2 siblings, 1 reply; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-11  8:50 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, Rob Herring
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel, 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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index 4d105ef..4a360bc 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"
@@ -526,11 +527,16 @@ 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;
 
 	if (pci->version >= 0x480A || (!pci->version &&
 				       dw_pcie_iatu_unroll_enabled(pci))) {
 		pci->iatu_unroll_enabled = true;
-		if (!pci->atu_base)
+		pdev = of_find_device_by_node(np);
+		if (!pci->atu_base && pdev)
+			pci->atu_base =
+			    devm_platform_ioremap_resource_byname(pdev, "atu");
+		if (IS_ERR_OR_NULL(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 3/3] PCI: keystone: Remove iATU register mapping
  2020-09-11  8:50 [PATCH 0/3] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
  2020-09-11  8:50 ` [PATCH 1/3] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
  2020-09-11  8:50 ` [PATCH 2/3] PCI: dwc: Add common iATU register support Kunihiko Hayashi
@ 2020-09-11  8:50 ` Kunihiko Hayashi
  2020-09-23 15:57   ` Rob Herring
  2 siblings, 1 reply; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-11  8:50 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, Rob Herring
  Cc: linux-pci, devicetree, linux-arm-kernel, linux-kernel, 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>
---
 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 2/3] PCI: dwc: Add common iATU register support
  2020-09-11  8:50 ` [PATCH 2/3] PCI: dwc: Add common iATU register support Kunihiko Hayashi
@ 2020-09-23 15:57   ` Rob Herring
  2020-09-25  9:10     ` Kunihiko Hayashi
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2020-09-23 15:57 UTC (permalink / raw)
  To: Kunihiko Hayashi
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, linux-pci, linux-kernel, linux-arm-kernel,
	devicetree

On Fri, Sep 11, 2020 at 05:50:02PM +0900, Kunihiko Hayashi 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 | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index 4d105ef..4a360bc 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"
> @@ -526,11 +527,16 @@ 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;
>  
>  	if (pci->version >= 0x480A || (!pci->version &&
>  				       dw_pcie_iatu_unroll_enabled(pci))) {
>  		pci->iatu_unroll_enabled = true;
> -		if (!pci->atu_base)
> +		pdev = of_find_device_by_node(np);

Use to_platform_device(dev) instead. Put that at the beginning as I'm 
going to move 'dbi' in here too.

> +		if (!pci->atu_base && pdev)
> +			pci->atu_base =
> +			    devm_platform_ioremap_resource_byname(pdev, "atu");
> +		if (IS_ERR_OR_NULL(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
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] PCI: keystone: Remove iATU register mapping
  2020-09-11  8:50 ` [PATCH 3/3] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
@ 2020-09-23 15:57   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-09-23 15:57 UTC (permalink / raw)
  To: Kunihiko Hayashi
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, linux-pci, linux-kernel, linux-arm-kernel,
	devicetree

On Fri, Sep 11, 2020 at 05:50:03PM +0900, Kunihiko Hayashi wrote:
> 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>
> ---
>  drivers/pci/controller/dwc/pci-keystone.c | 20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)

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

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

* Re: [PATCH 2/3] PCI: dwc: Add common iATU register support
  2020-09-23 15:57   ` Rob Herring
@ 2020-09-25  9:10     ` Kunihiko Hayashi
  2020-09-28  0:55       ` Kunihiko Hayashi
  0 siblings, 1 reply; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-25  9:10 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
	Murali Karicheri, linux-pci, linux-kernel, linux-arm-kernel,
	devicetree

Hi Rob,

On 2020/09/24 0:57, Rob Herring wrote:
> On Fri, Sep 11, 2020 at 05:50:02PM +0900, Kunihiko Hayashi 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 | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
>> index 4d105ef..4a360bc 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"
>> @@ -526,11 +527,16 @@ 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;
>>   
>>   	if (pci->version >= 0x480A || (!pci->version &&
>>   				       dw_pcie_iatu_unroll_enabled(pci))) {
>>   		pci->iatu_unroll_enabled = true;
>> -		if (!pci->atu_base)
>> +		pdev = of_find_device_by_node(np);
> 
> Use to_platform_device(dev) instead. Put that at the beginning as I'm
> going to move 'dbi' in here too.

Okay, I'll rewrite it with to_platform_device(dev).
Should I refer somewhere to rebase to your change?

Thank you,

---
Best Regards
Kunihiko Hayashi

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

* Re: [PATCH 2/3] PCI: dwc: Add common iATU register support
  2020-09-25  9:10     ` Kunihiko Hayashi
@ 2020-09-28  0:55       ` Kunihiko Hayashi
  0 siblings, 0 replies; 8+ messages in thread
From: Kunihiko Hayashi @ 2020-09-28  0:55 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, Lorenzo Pieralisi, Jingoo Han, linux-kernel,
	Murali Karicheri, linux-pci, Bjorn Helgaas, Gustavo Pimentel,
	linux-arm-kernel

On 2020/09/25 18:10, Kunihiko Hayashi wrote:
> Hi Rob,
> 
> On 2020/09/24 0:57, Rob Herring wrote:
>> On Fri, Sep 11, 2020 at 05:50:02PM +0900, Kunihiko Hayashi 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 | 8 +++++++-
>>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
>>> index 4d105ef..4a360bc 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"
>>> @@ -526,11 +527,16 @@ 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;
>>>       if (pci->version >= 0x480A || (!pci->version &&
>>>                          dw_pcie_iatu_unroll_enabled(pci))) {
>>>           pci->iatu_unroll_enabled = true;
>>> -        if (!pci->atu_base)
>>> +        pdev = of_find_device_by_node(np);
>>
>> Use to_platform_device(dev) instead. Put that at the beginning as I'm
>> going to move 'dbi' in here too.
> 
> Okay, I'll rewrite it with to_platform_device(dev).
> Should I refer somewhere to rebase to your change?
It seems there is no dbi patch yet, so I'm going to send v2 in advance
for now. I can rebase it if necessary.

Thank you,

---
Best Regards
Kunihiko Hayashi

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

end of thread, other threads:[~2020-09-28  0:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11  8:50 [PATCH 0/3] PCI: dwc: Move iATU register mapping to common framework Kunihiko Hayashi
2020-09-11  8:50 ` [PATCH 1/3] dt-bindings: PCI: uniphier: Add iATU register description Kunihiko Hayashi
2020-09-11  8:50 ` [PATCH 2/3] PCI: dwc: Add common iATU register support Kunihiko Hayashi
2020-09-23 15:57   ` Rob Herring
2020-09-25  9:10     ` Kunihiko Hayashi
2020-09-28  0:55       ` Kunihiko Hayashi
2020-09-11  8:50 ` [PATCH 3/3] PCI: keystone: Remove iATU register mapping Kunihiko Hayashi
2020-09-23 15:57   ` Rob Herring

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).