diff options
author | Hisashi Nakamura <hisashi.nakamura.ak@renesas.com> | 2014-10-24 04:33:08 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-11-03 19:31:23 -0500 |
commit | a8d2ff39c7c4a5ce50df2a47d5f8523810dd4c29 (patch) | |
tree | b2c270f882f383662889efc0d6bfc9d70a4d70b6 | |
parent | 3794705aeb318c431c07072f04380c78cc5a84ac (diff) |
ARM: shmobile: Separate APMU resource data into CPU dependant part
APMU resources are not common to all R-Car SoCs so don't share this data.
A subsequent patch will correct the CPU cores for the r8a7791.
Signed-off-by: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/common.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/platsmp-apmu.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/platsmp-apmu.h | 32 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/smp-r8a7790.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/smp-r8a7791.c | 16 |
5 files changed, 71 insertions, 25 deletions
diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h index 72087c79ad7b..309025efd4cf 100644 --- a/arch/arm/mach-shmobile/common.h +++ b/arch/arm/mach-shmobile/common.h | |||
@@ -19,11 +19,6 @@ extern void shmobile_boot_scu(void); | |||
19 | extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus); | 19 | extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus); |
20 | extern void shmobile_smp_scu_cpu_die(unsigned int cpu); | 20 | extern void shmobile_smp_scu_cpu_die(unsigned int cpu); |
21 | extern int shmobile_smp_scu_cpu_kill(unsigned int cpu); | 21 | extern int shmobile_smp_scu_cpu_kill(unsigned int cpu); |
22 | extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus); | ||
23 | extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu, | ||
24 | struct task_struct *idle); | ||
25 | extern void shmobile_smp_apmu_cpu_die(unsigned int cpu); | ||
26 | extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu); | ||
27 | struct clk; | 22 | struct clk; |
28 | extern int shmobile_clk_init(void); | 23 | extern int shmobile_clk_init(void); |
29 | extern void shmobile_handle_irq_intc(struct pt_regs *); | 24 | extern void shmobile_handle_irq_intc(struct pt_regs *); |
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index 2c06810d3a70..f483b560b066 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SMP support for SoCs with APMU | 2 | * SMP support for SoCs with APMU |
3 | * | 3 | * |
4 | * Copyright (C) 2014 Renesas Electronics Corporation | ||
4 | * Copyright (C) 2013 Magnus Damm | 5 | * Copyright (C) 2013 Magnus Damm |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -22,6 +23,7 @@ | |||
22 | #include <asm/smp_plat.h> | 23 | #include <asm/smp_plat.h> |
23 | #include <asm/suspend.h> | 24 | #include <asm/suspend.h> |
24 | #include "common.h" | 25 | #include "common.h" |
26 | #include "platsmp-apmu.h" | ||
25 | 27 | ||
26 | static struct { | 28 | static struct { |
27 | void __iomem *iomem; | 29 | void __iomem *iomem; |
@@ -83,28 +85,15 @@ static void apmu_init_cpu(struct resource *res, int cpu, int bit) | |||
83 | pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res); | 85 | pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res); |
84 | } | 86 | } |
85 | 87 | ||
86 | static struct { | 88 | static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit), |
87 | struct resource iomem; | 89 | struct rcar_apmu_config *apmu_config, int num) |
88 | int cpus[4]; | ||
89 | } apmu_config[] = { | ||
90 | { | ||
91 | .iomem = DEFINE_RES_MEM(0xe6152000, 0x88), | ||
92 | .cpus = { 0, 1, 2, 3 }, | ||
93 | }, | ||
94 | { | ||
95 | .iomem = DEFINE_RES_MEM(0xe6151000, 0x88), | ||
96 | .cpus = { 0x100, 0x101, 0x102, 0x103 }, | ||
97 | } | ||
98 | }; | ||
99 | |||
100 | static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit)) | ||
101 | { | 90 | { |
102 | u32 id; | 91 | u32 id; |
103 | int k; | 92 | int k; |
104 | int bit, index; | 93 | int bit, index; |
105 | bool is_allowed; | 94 | bool is_allowed; |
106 | 95 | ||
107 | for (k = 0; k < ARRAY_SIZE(apmu_config); k++) { | 96 | for (k = 0; k < num; k++) { |
108 | /* only enable the cluster that includes the boot CPU */ | 97 | /* only enable the cluster that includes the boot CPU */ |
109 | is_allowed = false; | 98 | is_allowed = false; |
110 | for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) { | 99 | for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) { |
@@ -128,14 +117,16 @@ static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit)) | |||
128 | } | 117 | } |
129 | } | 118 | } |
130 | 119 | ||
131 | void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus) | 120 | void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus, |
121 | struct rcar_apmu_config *apmu_config, | ||
122 | int num) | ||
132 | { | 123 | { |
133 | /* install boot code shared by all CPUs */ | 124 | /* install boot code shared by all CPUs */ |
134 | shmobile_boot_fn = virt_to_phys(shmobile_smp_boot); | 125 | shmobile_boot_fn = virt_to_phys(shmobile_smp_boot); |
135 | shmobile_boot_arg = MPIDR_HWID_BITMASK; | 126 | shmobile_boot_arg = MPIDR_HWID_BITMASK; |
136 | 127 | ||
137 | /* perform per-cpu setup */ | 128 | /* perform per-cpu setup */ |
138 | apmu_parse_cfg(apmu_init_cpu); | 129 | apmu_parse_cfg(apmu_init_cpu, apmu_config, num); |
139 | } | 130 | } |
140 | 131 | ||
141 | #ifdef CONFIG_SMP | 132 | #ifdef CONFIG_SMP |
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.h b/arch/arm/mach-shmobile/platsmp-apmu.h new file mode 100644 index 000000000000..76512c9a2545 --- /dev/null +++ b/arch/arm/mach-shmobile/platsmp-apmu.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * rmobile apmu definition | ||
3 | * | ||
4 | * Copyright (C) 2014 Renesas Electronics Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef PLATSMP_APMU_H | ||
17 | #define PLATSMP_APMU_H | ||
18 | |||
19 | struct rcar_apmu_config { | ||
20 | struct resource iomem; | ||
21 | int cpus[4]; | ||
22 | }; | ||
23 | |||
24 | extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus, | ||
25 | struct rcar_apmu_config *apmu_config, | ||
26 | int num); | ||
27 | extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu, | ||
28 | struct task_struct *idle); | ||
29 | extern void shmobile_smp_apmu_cpu_die(unsigned int cpu); | ||
30 | extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu); | ||
31 | |||
32 | #endif /* PLATSMP_APMU_H */ | ||
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c index 2311694636e1..9c3da1345b8b 100644 --- a/arch/arm/mach-shmobile/smp-r8a7790.c +++ b/arch/arm/mach-shmobile/smp-r8a7790.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/smp_plat.h> | 21 | #include <asm/smp_plat.h> |
22 | 22 | ||
23 | #include "common.h" | 23 | #include "common.h" |
24 | #include "platsmp-apmu.h" | ||
24 | #include "pm-rcar.h" | 25 | #include "pm-rcar.h" |
25 | #include "r8a7790.h" | 26 | #include "r8a7790.h" |
26 | 27 | ||
@@ -34,10 +35,23 @@ static struct rcar_sysc_ch r8a7790_ca7_scu = { | |||
34 | .isr_bit = 21, /* CA7-SCU */ | 35 | .isr_bit = 21, /* CA7-SCU */ |
35 | }; | 36 | }; |
36 | 37 | ||
38 | static struct rcar_apmu_config r8a7790_apmu_config[] = { | ||
39 | { | ||
40 | .iomem = DEFINE_RES_MEM(0xe6152000, 0x88), | ||
41 | .cpus = { 0, 1, 2, 3 }, | ||
42 | }, | ||
43 | { | ||
44 | .iomem = DEFINE_RES_MEM(0xe6151000, 0x88), | ||
45 | .cpus = { 0x100, 0x0101, 0x102, 0x103 }, | ||
46 | } | ||
47 | }; | ||
48 | |||
37 | static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) | 49 | static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) |
38 | { | 50 | { |
39 | /* let APMU code install data related to shmobile_boot_vector */ | 51 | /* let APMU code install data related to shmobile_boot_vector */ |
40 | shmobile_smp_apmu_prepare_cpus(max_cpus); | 52 | shmobile_smp_apmu_prepare_cpus(max_cpus, |
53 | r8a7790_apmu_config, | ||
54 | ARRAY_SIZE(r8a7790_apmu_config)); | ||
41 | 55 | ||
42 | /* turn on power to SCU */ | 56 | /* turn on power to SCU */ |
43 | r8a7790_pm_init(); | 57 | r8a7790_pm_init(); |
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c index f743386166fb..96e392c2573c 100644 --- a/arch/arm/mach-shmobile/smp-r8a7791.c +++ b/arch/arm/mach-shmobile/smp-r8a7791.c | |||
@@ -21,13 +21,27 @@ | |||
21 | #include <asm/smp_plat.h> | 21 | #include <asm/smp_plat.h> |
22 | 22 | ||
23 | #include "common.h" | 23 | #include "common.h" |
24 | #include "platsmp-apmu.h" | ||
24 | #include "r8a7791.h" | 25 | #include "r8a7791.h" |
25 | #include "rcar-gen2.h" | 26 | #include "rcar-gen2.h" |
26 | 27 | ||
28 | static struct rcar_apmu_config r8a7791_apmu_config[] = { | ||
29 | { | ||
30 | .iomem = DEFINE_RES_MEM(0xe6152000, 0x88), | ||
31 | .cpus = { 0, 1, 2, 3 }, | ||
32 | }, | ||
33 | { | ||
34 | .iomem = DEFINE_RES_MEM(0xe6151000, 0x88), | ||
35 | .cpus = { 0x100, 0x0101, 0x102, 0x103 }, | ||
36 | } | ||
37 | }; | ||
38 | |||
27 | static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) | 39 | static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) |
28 | { | 40 | { |
29 | /* let APMU code install data related to shmobile_boot_vector */ | 41 | /* let APMU code install data related to shmobile_boot_vector */ |
30 | shmobile_smp_apmu_prepare_cpus(max_cpus); | 42 | shmobile_smp_apmu_prepare_cpus(max_cpus, |
43 | r8a7791_apmu_config, | ||
44 | ARRAY_SIZE(r8a7791_apmu_config)); | ||
31 | 45 | ||
32 | r8a7791_pm_init(); | 46 | r8a7791_pm_init(); |
33 | } | 47 | } |