diff mbox

[v2,07/11] soc/fsl/qbman: Rework ioremap() calls for ARM/PPC

Message ID 1492634930-10765-8-git-send-email-roy.pledge@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roy Pledge April 19, 2017, 8:48 p.m. UTC
Rework ioremap() for PPC and ARM. The PPC devices require a
non-coherent mapping while ARM will work with a non-cachable/write
combine mapping.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
---
 drivers/soc/fsl/qbman/bman_portal.c | 16 +++++++++++++---
 drivers/soc/fsl/qbman/qman_portal.c | 16 +++++++++++++---
 2 files changed, 26 insertions(+), 6 deletions(-)

Comments

Crystal Wood April 24, 2017, 1:47 a.m. UTC | #1
On Wed, 2017-04-19 at 16:48 -0400, Roy Pledge wrote:
> Rework ioremap() for PPC and ARM. The PPC devices require a
> non-coherent mapping while ARM will work with a non-cachable/write
> combine mapping.
> 
> Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
> ---
>  drivers/soc/fsl/qbman/bman_portal.c | 16 +++++++++++++---
>  drivers/soc/fsl/qbman/qman_portal.c | 16 +++++++++++++---
>  2 files changed, 26 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qbman/bman_portal.c
> b/drivers/soc/fsl/qbman/bman_portal.c
> index 8354d4d..a661f30 100644
> --- a/drivers/soc/fsl/qbman/bman_portal.c
> +++ b/drivers/soc/fsl/qbman/bman_portal.c
> @@ -125,7 +125,18 @@ static int bman_portal_probe(struct platform_device
> *pdev)
>  	}
>  	pcfg->irq = irq;
>  
> -	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]),
> 0);
> +#ifdef CONFIG_PPC
> +	/* PPC requires a cacheable/non-coherent mapping of the portal */
> +	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]),
> +			  (pgprot_val(PAGE_KERNEL) & ~_PAGE_COHERENT));
> +#else
> +	/*
> +	 * For ARM we can use write combine mapping.  A cacheable/non
> shareable
> +	 * mapping will perform better but equires additional platform
> +	 * support which is not currently available
> +	 */

s/equires/requires/

Would be nice to describe the platform support that is required.

-Scott
Roy Pledge May 1, 2017, 7 p.m. UTC | #2
On 4/23/2017 9:47 PM, Scott Wood wrote:
> On Wed, 2017-04-19 at 16:48 -0400, Roy Pledge wrote:
>> Rework ioremap() for PPC and ARM. The PPC devices require a
>> non-coherent mapping while ARM will work with a non-cachable/write
>> combine mapping.
>>
>> Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
>> ---
>>  drivers/soc/fsl/qbman/bman_portal.c | 16 +++++++++++++---
>>  drivers/soc/fsl/qbman/qman_portal.c | 16 +++++++++++++---
>>  2 files changed, 26 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/soc/fsl/qbman/bman_portal.c
>> b/drivers/soc/fsl/qbman/bman_portal.c
>> index 8354d4d..a661f30 100644
>> --- a/drivers/soc/fsl/qbman/bman_portal.c
>> +++ b/drivers/soc/fsl/qbman/bman_portal.c
>> @@ -125,7 +125,18 @@ static int bman_portal_probe(struct platform_device
>> *pdev)
>>  	}
>>  	pcfg->irq = irq;
>>  
>> -	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]),
>> 0);
>> +#ifdef CONFIG_PPC
>> +	/* PPC requires a cacheable/non-coherent mapping of the portal */
>> +	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]),
>> +			  (pgprot_val(PAGE_KERNEL) & ~_PAGE_COHERENT));
>> +#else
>> +	/*
>> +	 * For ARM we can use write combine mapping.  A cacheable/non
>> shareable
>> +	 * mapping will perform better but equires additional platform
>> +	 * support which is not currently available
>> +	 */
> s/equires/requires/
>
> Would be nice to describe the platform support that is required.
Thanks for your feedback Scott, going to try to get a v3 of this set
ASAP. I think I will remove the
above statement for now.  We did send patches for do non-shareable
support on DPAA2 and there was significant feedback so I'm in the
process of discussing the issue with SOC architects here.  We will
follow up with ARM folks on this eventually but I'd like to get the
basic DPAA1 support in before adding the more advanced features.

Roy
>
> -Scott
>
>
diff mbox

Patch

diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c
index 8354d4d..a661f30 100644
--- a/drivers/soc/fsl/qbman/bman_portal.c
+++ b/drivers/soc/fsl/qbman/bman_portal.c
@@ -125,7 +125,18 @@  static int bman_portal_probe(struct platform_device *pdev)
 	}
 	pcfg->irq = irq;
 
-	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
+#ifdef CONFIG_PPC
+	/* PPC requires a cacheable/non-coherent mapping of the portal */
+	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]),
+			  (pgprot_val(PAGE_KERNEL) & ~_PAGE_COHERENT));
+#else
+	/*
+	 * For ARM we can use write combine mapping.  A cacheable/non shareable
+	 * mapping will perform better but equires additional platform
+	 * support which is not currently available
+	 */
+	va = ioremap_wc(addr_phys[0]->start, resource_size(addr_phys[0]));
+#endif
 	if (!va) {
 		dev_err(dev, "ioremap::CE failed\n");
 		goto err_ioremap1;
@@ -133,8 +144,7 @@  static int bman_portal_probe(struct platform_device *pdev)
 
 	pcfg->addr_virt[DPAA_PORTAL_CE] = va;
 
-	va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
-			  _PAGE_GUARDED | _PAGE_NO_CACHE);
+	va = ioremap(addr_phys[1]->start, resource_size(addr_phys[1]));
 	if (!va) {
 		dev_err(dev, "ioremap::CI failed\n");
 		goto err_ioremap2;
diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c
index adbaa30..e7a9eef 100644
--- a/drivers/soc/fsl/qbman/qman_portal.c
+++ b/drivers/soc/fsl/qbman/qman_portal.c
@@ -265,7 +265,18 @@  static int qman_portal_probe(struct platform_device *pdev)
 	}
 	pcfg->irq = irq;
 
-	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
+#ifdef CONFIG_PPC
+	/* PPC requires a cacheable/non-coherent mapping of the portal */
+	va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]),
+			  (pgprot_val(PAGE_KERNEL) & ~_PAGE_COHERENT));
+#else
+	/*
+	 * For ARM we can use write combine mapping.  A cacheable/non shareable
+	 * mapping will perform better but equires additional platform
+	 * support which is not currently available
+	 */
+	va = ioremap_wc(addr_phys[0]->start, resource_size(addr_phys[0]));
+#endif
 	if (!va) {
 		dev_err(dev, "ioremap::CE failed\n");
 		goto err_ioremap1;
@@ -273,8 +284,7 @@  static int qman_portal_probe(struct platform_device *pdev)
 
 	pcfg->addr_virt[DPAA_PORTAL_CE] = va;
 
-	va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
-			  _PAGE_GUARDED | _PAGE_NO_CACHE);
+	va = ioremap(addr_phys[1]->start, resource_size(addr_phys[1]));
 	if (!va) {
 		dev_err(dev, "ioremap::CI failed\n");
 		goto err_ioremap2;