aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2014-04-14 11:10:05 -0400
committerJason Cooper <jason@lakedaemon.net>2014-05-08 12:10:24 -0400
commitccd6a13180193700067bfdac5f7d7b436d757382 (patch)
tree4a65ee228f54af51b80a748ede961a68196a0cc1
parentb4bca24957c990a09dbddde75858b24150faec89 (diff)
ARM: mvebu: remove the address parameter for ll_set_cpu_coherent
In order to be able to deal with the MMU enabled and the MMU disabled cases, the base address of the coherency registers was passed to the function. The address by itself was not interesting as it can't change for a given SoC, the only thing we need is to have a distinction between the physical or the virtual address. This patch add a check of the MMU bit to choose the accurate address, then the calling function doesn't have to pass this information. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Link: https://lkml.kernel.org/r/1397488214-20685-3-git-send-email-gregory.clement@free-electrons.com Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--arch/arm/mach-mvebu/coherency.c6
-rw-r--r--arch/arm/mach-mvebu/coherency_ll.S22
-rw-r--r--arch/arm/mach-mvebu/headsmp.S9
3 files changed, 23 insertions, 14 deletions
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 489edd157cfb..615dc0b6093e 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -35,7 +35,7 @@
35#include "coherency.h" 35#include "coherency.h"
36 36
37unsigned long coherency_phys_base; 37unsigned long coherency_phys_base;
38static void __iomem *coherency_base; 38void __iomem *coherency_base;
39static void __iomem *coherency_cpu_base; 39static void __iomem *coherency_cpu_base;
40 40
41/* Coherency fabric registers */ 41/* Coherency fabric registers */
@@ -61,7 +61,7 @@ static struct of_device_id of_coherency_table[] = {
61}; 61};
62 62
63/* Function defined in coherency_ll.S */ 63/* Function defined in coherency_ll.S */
64int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id); 64int ll_set_cpu_coherent(unsigned int hw_cpu_id);
65 65
66int set_cpu_coherent(unsigned int hw_cpu_id, int smp_group_id) 66int set_cpu_coherent(unsigned int hw_cpu_id, int smp_group_id)
67{ 67{
@@ -71,7 +71,7 @@ int set_cpu_coherent(unsigned int hw_cpu_id, int smp_group_id)
71 return 1; 71 return 1;
72 } 72 }
73 73
74 return ll_set_cpu_coherent(coherency_base, hw_cpu_id); 74 return ll_set_cpu_coherent(hw_cpu_id);
75} 75}
76 76
77/* 77/*
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
index ee7598fe75db..1f2bcd4b5424 100644
--- a/arch/arm/mach-mvebu/coherency_ll.S
+++ b/arch/arm/mach-mvebu/coherency_ll.S
@@ -21,13 +21,27 @@
21#define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4 21#define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4
22 22
23#include <asm/assembler.h> 23#include <asm/assembler.h>
24#include <asm/cp15.h>
24 25
25 .text 26 .text
26/* 27/*
27 * r0: Coherency fabric base register address 28 * r0: HW CPU id
28 * r1: HW CPU id
29 */ 29 */
30ENTRY(ll_set_cpu_coherent) 30ENTRY(ll_set_cpu_coherent)
31 mrc p15, 0, r1, c1, c0, 0
32 tst r1, #CR_M @ Check MMU bit enabled
33 bne 1f
34
35 /* use physical address of the coherency register*/
36 adr r0, 3f
37 ldr r3, [r0]
38 ldr r0, [r0, r3]
39 b 2f
401:
41 /* use virtual address of the coherency register*/
42 ldr r0, =coherency_base
43 ldr r0, [r0]
442:
31 /* Create bit by cpu index */ 45 /* Create bit by cpu index */
32 mov r3, #(1 << 24) 46 mov r3, #(1 << 24)
33 lsl r1, r3, r1 47 lsl r1, r3, r1
@@ -56,3 +70,7 @@ ARM_BE8(rev r1, r1)
56 mov r0, #0 70 mov r0, #0
57 mov pc, lr 71 mov pc, lr
58ENDPROC(ll_set_cpu_coherent) 72ENDPROC(ll_set_cpu_coherent)
73
74 .align 2
753:
76 .long coherency_phys_base - .
diff --git a/arch/arm/mach-mvebu/headsmp.S b/arch/arm/mach-mvebu/headsmp.S
index 3dd80df428f7..f30bc8d78871 100644
--- a/arch/arm/mach-mvebu/headsmp.S
+++ b/arch/arm/mach-mvebu/headsmp.S
@@ -31,11 +31,6 @@
31ENTRY(armada_xp_secondary_startup) 31ENTRY(armada_xp_secondary_startup)
32 ARM_BE8(setend be ) @ go BE8 if entered LE 32 ARM_BE8(setend be ) @ go BE8 if entered LE
33 33
34 /* Get coherency fabric base physical address */
35 adr r0, 1f
36 ldr r1, [r0]
37 ldr r0, [r0, r1]
38
39 /* Read CPU id */ 34 /* Read CPU id */
40 mrc p15, 0, r1, c0, c0, 5 35 mrc p15, 0, r1, c0, c0, 5
41 and r1, r1, #0xF 36 and r1, r1, #0xF
@@ -45,7 +40,3 @@ ENTRY(armada_xp_secondary_startup)
45 b secondary_startup 40 b secondary_startup
46 41
47ENDPROC(armada_xp_secondary_startup) 42ENDPROC(armada_xp_secondary_startup)
48
49 .align 2
501:
51 .long coherency_phys_base - .