diff mbox series

[v2,4/5] PCI: uniphier: Add iATU register support

Message ID 1589536743-6684-5-git-send-email-hayashi.kunihiko@socionext.com
State New
Headers show
Series PCI: uniphier: Add features for UniPhier PCIe host controller | expand

Commit Message

Kunihiko Hayashi May 15, 2020, 9:59 a.m. UTC
This gets iATU register area from reg property. In Synopsis 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.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/pci/controller/dwc/pcie-uniphier.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Gustavo Pimentel May 15, 2020, 1:16 p.m. UTC | #1
Hi Kunihiko,

On Fri, May 15, 2020 at 10:59:2, Kunihiko Hayashi 
<hayashi.kunihiko@socionext.com> wrote:

> This gets iATU register area from reg property. In Synopsis DWC version

s/Synopsis/Synopsys
in all patches

> 4.80 or later, since iATU register area is separated from core register
> area, this area is necessary to get from DT independently.
> 
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  drivers/pci/controller/dwc/pcie-uniphier.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c
> index a8dda39..493f105 100644
> --- a/drivers/pci/controller/dwc/pcie-uniphier.c
> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c
> @@ -447,6 +447,13 @@ static int uniphier_pcie_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->pci.dbi_base))
>  		return PTR_ERR(priv->pci.dbi_base);
>  
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
> +	if (res) {
> +		priv->pci.atu_base = devm_pci_remap_cfg_resource(dev, res);
> +		if (IS_ERR(priv->pci.atu_base))
> +			priv->pci.atu_base = NULL;
> +	}
> +
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link");
>  	priv->base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(priv->base))
> -- 
> 2.7.4
Kunihiko Hayashi May 18, 2020, 10:05 a.m. UTC | #2
Hi Gustavo,

On 2020/05/15 22:16, Gustavo Pimentel wrote:
> Hi Kunihiko,
> 
> On Fri, May 15, 2020 at 10:59:2, Kunihiko Hayashi
> <hayashi.kunihiko@socionext.com> wrote:
> 
>> This gets iATU register area from reg property. In Synopsis DWC version
> 
> s/Synopsis/Synopsys
> in all patches
Thank you for pointing out.
I'll fix and be careful about this.

Thank you,

---
Best Regards
Kunihiko Hayashi
Rob Herring June 1, 2020, 9:32 p.m. UTC | #3
On Fri, May 15, 2020 at 06:59:02PM +0900, Kunihiko Hayashi wrote:
> This gets iATU register area from reg property. In Synopsis 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.
> 
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  drivers/pci/controller/dwc/pcie-uniphier.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c
> index a8dda39..493f105 100644
> --- a/drivers/pci/controller/dwc/pcie-uniphier.c
> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c
> @@ -447,6 +447,13 @@ static int uniphier_pcie_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->pci.dbi_base))
>  		return PTR_ERR(priv->pci.dbi_base);
>  
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
> +	if (res) {
> +		priv->pci.atu_base = devm_pci_remap_cfg_resource(dev, res);

This isn't config space, so this function shouldn't be used.

Use devm_platform_ioremap_resource_byname().

> +		if (IS_ERR(priv->pci.atu_base))
> +			priv->pci.atu_base = NULL;
> +	}
> +
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link");
>  	priv->base = devm_ioremap_resource(dev, res);

Feel free to convert this one too.

>  	if (IS_ERR(priv->base))
> -- 
> 2.7.4
>
Kunihiko Hayashi June 2, 2020, 9:07 a.m. UTC | #4
Hi Rob,

On 2020/06/02 6:32, Rob Herring wrote:
> On Fri, May 15, 2020 at 06:59:02PM +0900, Kunihiko Hayashi wrote:
>> This gets iATU register area from reg property. In Synopsis 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.
>>
>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
>> ---
>>   drivers/pci/controller/dwc/pcie-uniphier.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c
>> index a8dda39..493f105 100644
>> --- a/drivers/pci/controller/dwc/pcie-uniphier.c
>> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c
>> @@ -447,6 +447,13 @@ static int uniphier_pcie_probe(struct platform_device *pdev)
>>   	if (IS_ERR(priv->pci.dbi_base))
>>   		return PTR_ERR(priv->pci.dbi_base);
>>   
>> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
>> +	if (res) {
>> +		priv->pci.atu_base = devm_pci_remap_cfg_resource(dev, res);
> 
> This isn't config space, so this function shouldn't be used.
> 
> Use devm_platform_ioremap_resource_byname().

Indeed. I'll replace with it.

>> +		if (IS_ERR(priv->pci.atu_base))
>> +			priv->pci.atu_base = NULL;
>> +	}
>> +
>>   	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link");
>>   	priv->base = devm_ioremap_resource(dev, res);
> 
> Feel free to convert this one too.

This should be replaced as well.

Thank you,
  
---
Best Regards
Kunihiko Hayashi
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c
index a8dda39..493f105 100644
--- a/drivers/pci/controller/dwc/pcie-uniphier.c
+++ b/drivers/pci/controller/dwc/pcie-uniphier.c
@@ -447,6 +447,13 @@  static int uniphier_pcie_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->pci.dbi_base))
 		return PTR_ERR(priv->pci.dbi_base);
 
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
+	if (res) {
+		priv->pci.atu_base = devm_pci_remap_cfg_resource(dev, res);
+		if (IS_ERR(priv->pci.atu_base))
+			priv->pci.atu_base = NULL;
+	}
+
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link");
 	priv->base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(priv->base))