ARM: highbank: Only touch common coherency control register fields

Submitted by Paolo Pisati on July 23, 2013, 4:43 p.m.

Details

Message ID 1374597791-18359-2-git-send-email-paolo.pisati@canonical.com
State New
Headers show

Commit Message

Paolo Pisati July 23, 2013, 4:43 p.m.
From: Rob Herring <rob.herring@calxeda.com>

Midway adds new register fields to the coherency control registers, so
writing absolute values will break on Midway. Change the register
accesses to only modify the necessary and common fields in order to
support both Midway and Highbank.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Olof Johansson <olof@lixom.net>

BugLink: https://bugs.launchpad.net/bugs/1196946

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
 arch/arm/mach-highbank/highbank.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Tim Gardner July 23, 2013, 4:47 p.m.

Brad Figg July 23, 2013, 5:06 p.m.
On 07/23/2013 09:43 AM, Paolo Pisati wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> Midway adds new register fields to the coherency control registers, so
> writing absolute values will break on Midway. Change the register
> accesses to only modify the necessary and common fields in order to
> support both Midway and Highbank.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> 
> BugLink: https://bugs.launchpad.net/bugs/1196946
> 
> Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
> ---
>  arch/arm/mach-highbank/highbank.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
> index e6c0612..a246d2d 100644
> --- a/arch/arm/mach-highbank/highbank.c
> +++ b/arch/arm/mach-highbank/highbank.c
> @@ -147,6 +147,7 @@ static int highbank_platform_notifier(struct notifier_block *nb,
>  {
>  	struct resource *res;
>  	int reg = -1;
> +	u32 val;
>  	struct device *dev = __dev;
>  
>  	if (event != BUS_NOTIFY_ADD_DEVICE)
> @@ -173,10 +174,10 @@ static int highbank_platform_notifier(struct notifier_block *nb,
>  		return NOTIFY_DONE;
>  
>  	if (of_property_read_bool(dev->of_node, "dma-coherent")) {
> -		writel(0xff31, sregs_base + reg);
> +		val = readl(sregs_base + reg);
> +		writel(val | 0xff01, sregs_base + reg);
>  		set_dma_ops(dev, &arm_coherent_dma_ops);
> -	} else
> -		writel(0, sregs_base + reg);
> +	}
>  
>  	return NOTIFY_OK;
>  }
>
Tim Gardner July 23, 2013, 5:13 p.m.

Patch hide | download patch | download mbox

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index e6c0612..a246d2d 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -147,6 +147,7 @@  static int highbank_platform_notifier(struct notifier_block *nb,
 {
 	struct resource *res;
 	int reg = -1;
+	u32 val;
 	struct device *dev = __dev;
 
 	if (event != BUS_NOTIFY_ADD_DEVICE)
@@ -173,10 +174,10 @@  static int highbank_platform_notifier(struct notifier_block *nb,
 		return NOTIFY_DONE;
 
 	if (of_property_read_bool(dev->of_node, "dma-coherent")) {
-		writel(0xff31, sregs_base + reg);
+		val = readl(sregs_base + reg);
+		writel(val | 0xff01, sregs_base + reg);
 		set_dma_ops(dev, &arm_coherent_dma_ops);
-	} else
-		writel(0, sregs_base + reg);
+	}
 
 	return NOTIFY_OK;
 }