diff options
author | Rob Herring <rob.herring@calxeda.com> | 2013-09-26 21:02:51 -0400 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2013-10-01 17:34:16 -0400 |
commit | dd68eb02e4598d81e9e42400ccbd2cc42f012bfa (patch) | |
tree | 4d66a3da8725f9216feb945821c42fa99bce1d83 /arch/arm/mach-highbank | |
parent | 97fc4de3d93fea934b0ec8332465b9f1899a9adb (diff) |
ARM: highbank: adapt to use ARM PSCI calls
This adapts highbank to use psci for smp_ops and the cpu_suspend function
for suspend/resume.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'arch/arm/mach-highbank')
-rw-r--r-- | arch/arm/mach-highbank/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-highbank/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-highbank/core.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-highbank/highbank.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-highbank/hotplug.c | 37 | ||||
-rw-r--r-- | arch/arm/mach-highbank/platsmp.c | 68 | ||||
-rw-r--r-- | arch/arm/mach-highbank/pm.c | 27 |
7 files changed, 11 insertions, 144 deletions
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig index 8e8437dea3ce..965623de354f 100644 --- a/arch/arm/mach-highbank/Kconfig +++ b/arch/arm/mach-highbank/Kconfig | |||
@@ -10,6 +10,7 @@ config ARCH_HIGHBANK | |||
10 | select ARM_ERRATA_775420 | 10 | select ARM_ERRATA_775420 |
11 | select ARM_ERRATA_798181 | 11 | select ARM_ERRATA_798181 |
12 | select ARM_GIC | 12 | select ARM_GIC |
13 | select ARM_PSCI | ||
13 | select ARM_TIMER_SP804 | 14 | select ARM_TIMER_SP804 |
14 | select CACHE_L2X0 | 15 | select CACHE_L2X0 |
15 | select CLKDEV_LOOKUP | 16 | select CLKDEV_LOOKUP |
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile index 8a1ef576d79f..55840f414d3e 100644 --- a/arch/arm/mach-highbank/Makefile +++ b/arch/arm/mach-highbank/Makefile | |||
@@ -3,6 +3,4 @@ obj-y := highbank.o system.o smc.o | |||
3 | plus_sec := $(call as-instr,.arch_extension sec,+sec) | 3 | plus_sec := $(call as-instr,.arch_extension sec,+sec) |
4 | AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) | 4 | AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) |
5 | 5 | ||
6 | obj-$(CONFIG_SMP) += platsmp.o | ||
7 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | ||
8 | obj-$(CONFIG_PM_SLEEP) += pm.o | 6 | obj-$(CONFIG_PM_SLEEP) += pm.o |
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h index aea1ec5ab6f8..7ec5edcd1336 100644 --- a/arch/arm/mach-highbank/core.h +++ b/arch/arm/mach-highbank/core.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/reboot.h> | 4 | #include <linux/reboot.h> |
5 | 5 | ||
6 | extern void highbank_set_cpu_jump(int cpu, void *jump_addr); | ||
7 | extern void highbank_restart(enum reboot_mode, const char *); | 6 | extern void highbank_restart(enum reboot_mode, const char *); |
8 | extern void __iomem *scu_base_addr; | 7 | extern void __iomem *scu_base_addr; |
9 | 8 | ||
@@ -14,8 +13,5 @@ static inline void highbank_pm_init(void) {} | |||
14 | #endif | 13 | #endif |
15 | 14 | ||
16 | extern void highbank_smc1(int fn, int arg); | 15 | extern void highbank_smc1(int fn, int arg); |
17 | extern void highbank_cpu_die(unsigned int cpu); | ||
18 | |||
19 | extern struct smp_operations highbank_smp_ops; | ||
20 | 16 | ||
21 | #endif | 17 | #endif |
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 53d05bc904f9..0c49beb37cee 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
@@ -27,9 +27,7 @@ | |||
27 | #include <linux/clk-provider.h> | 27 | #include <linux/clk-provider.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | 29 | ||
30 | #include <asm/cacheflush.h> | 30 | #include <asm/psci.h> |
31 | #include <asm/cputype.h> | ||
32 | #include <asm/smp_plat.h> | ||
33 | #include <asm/hardware/cache-l2x0.h> | 31 | #include <asm/hardware/cache-l2x0.h> |
34 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
35 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
@@ -50,17 +48,6 @@ static void __init highbank_scu_map_io(void) | |||
50 | scu_base_addr = ioremap(base, SZ_4K); | 48 | scu_base_addr = ioremap(base, SZ_4K); |
51 | } | 49 | } |
52 | 50 | ||
53 | #define HB_JUMP_TABLE_PHYS(cpu) (0x40 + (0x10 * (cpu))) | ||
54 | #define HB_JUMP_TABLE_VIRT(cpu) phys_to_virt(HB_JUMP_TABLE_PHYS(cpu)) | ||
55 | |||
56 | void highbank_set_cpu_jump(int cpu, void *jump_addr) | ||
57 | { | ||
58 | cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0); | ||
59 | writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu)); | ||
60 | __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16); | ||
61 | outer_clean_range(HB_JUMP_TABLE_PHYS(cpu), | ||
62 | HB_JUMP_TABLE_PHYS(cpu) + 15); | ||
63 | } | ||
64 | 51 | ||
65 | static void highbank_l2x0_disable(void) | 52 | static void highbank_l2x0_disable(void) |
66 | { | 53 | { |
@@ -182,7 +169,6 @@ DT_MACHINE_START(HIGHBANK, "Highbank") | |||
182 | #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE) | 169 | #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE) |
183 | .dma_zone_size = (4ULL * SZ_1G), | 170 | .dma_zone_size = (4ULL * SZ_1G), |
184 | #endif | 171 | #endif |
185 | .smp = smp_ops(highbank_smp_ops), | ||
186 | .init_irq = highbank_init_irq, | 172 | .init_irq = highbank_init_irq, |
187 | .init_time = highbank_timer_init, | 173 | .init_time = highbank_timer_init, |
188 | .init_machine = highbank_init, | 174 | .init_machine = highbank_init, |
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c deleted file mode 100644 index a019e4e86e51..000000000000 --- a/arch/arm/mach-highbank/hotplug.c +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Calxeda, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include <linux/kernel.h> | ||
17 | #include <asm/cacheflush.h> | ||
18 | |||
19 | #include "core.h" | ||
20 | #include "sysregs.h" | ||
21 | |||
22 | extern void secondary_startup(void); | ||
23 | |||
24 | /* | ||
25 | * platform-specific code to shutdown a CPU | ||
26 | * | ||
27 | */ | ||
28 | void __ref highbank_cpu_die(unsigned int cpu) | ||
29 | { | ||
30 | highbank_set_cpu_jump(cpu, phys_to_virt(0)); | ||
31 | |||
32 | flush_cache_louis(); | ||
33 | highbank_set_core_pwr(); | ||
34 | |||
35 | while (1) | ||
36 | cpu_do_idle(); | ||
37 | } | ||
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c deleted file mode 100644 index 32d75cf55cbc..000000000000 --- a/arch/arm/mach-highbank/platsmp.c +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2010-2011 Calxeda, Inc. | ||
3 | * Based on platsmp.c, Copyright (C) 2002 ARM Ltd. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/smp.h> | ||
19 | #include <linux/io.h> | ||
20 | |||
21 | #include <asm/smp_scu.h> | ||
22 | |||
23 | #include "core.h" | ||
24 | |||
25 | extern void secondary_startup(void); | ||
26 | |||
27 | static int highbank_boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
28 | { | ||
29 | highbank_set_cpu_jump(cpu, secondary_startup); | ||
30 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * Initialise the CPU possible map early - this describes the CPUs | ||
36 | * which may be present or become present in the system. | ||
37 | */ | ||
38 | static void __init highbank_smp_init_cpus(void) | ||
39 | { | ||
40 | unsigned int i, ncores = 4; | ||
41 | |||
42 | /* sanity check */ | ||
43 | if (ncores > NR_CPUS) { | ||
44 | printk(KERN_WARNING | ||
45 | "highbank: no. of cores (%d) greater than configured " | ||
46 | "maximum of %d - clipping\n", | ||
47 | ncores, NR_CPUS); | ||
48 | ncores = NR_CPUS; | ||
49 | } | ||
50 | |||
51 | for (i = 0; i < ncores; i++) | ||
52 | set_cpu_possible(i, true); | ||
53 | } | ||
54 | |||
55 | static void __init highbank_smp_prepare_cpus(unsigned int max_cpus) | ||
56 | { | ||
57 | if (scu_base_addr) | ||
58 | scu_enable(scu_base_addr); | ||
59 | } | ||
60 | |||
61 | struct smp_operations highbank_smp_ops __initdata = { | ||
62 | .smp_init_cpus = highbank_smp_init_cpus, | ||
63 | .smp_prepare_cpus = highbank_smp_prepare_cpus, | ||
64 | .smp_boot_secondary = highbank_boot_secondary, | ||
65 | #ifdef CONFIG_HOTPLUG_CPU | ||
66 | .cpu_die = highbank_cpu_die, | ||
67 | #endif | ||
68 | }; | ||
diff --git a/arch/arm/mach-highbank/pm.c b/arch/arm/mach-highbank/pm.c index 04eddb4f4380..7f2bd85eb935 100644 --- a/arch/arm/mach-highbank/pm.c +++ b/arch/arm/mach-highbank/pm.c | |||
@@ -16,27 +16,19 @@ | |||
16 | 16 | ||
17 | #include <linux/cpu_pm.h> | 17 | #include <linux/cpu_pm.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/io.h> | ||
20 | #include <linux/suspend.h> | 19 | #include <linux/suspend.h> |
21 | 20 | ||
22 | #include <asm/cacheflush.h> | ||
23 | #include <asm/proc-fns.h> | ||
24 | #include <asm/suspend.h> | 21 | #include <asm/suspend.h> |
25 | 22 | #include <asm/psci.h> | |
26 | #include "core.h" | ||
27 | #include "sysregs.h" | ||
28 | 23 | ||
29 | static int highbank_suspend_finish(unsigned long val) | 24 | static int highbank_suspend_finish(unsigned long val) |
30 | { | 25 | { |
31 | outer_flush_all(); | 26 | const struct psci_power_state ps = { |
32 | outer_disable(); | 27 | .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, |
33 | 28 | .affinity_level = 1, | |
34 | highbank_set_pwr_suspend(); | 29 | }; |
35 | |||
36 | cpu_do_idle(); | ||
37 | 30 | ||
38 | highbank_clear_pwr_request(); | 31 | return psci_ops.cpu_suspend(ps, __pa(cpu_resume)); |
39 | return 0; | ||
40 | } | 32 | } |
41 | 33 | ||
42 | static int highbank_pm_enter(suspend_state_t state) | 34 | static int highbank_pm_enter(suspend_state_t state) |
@@ -44,15 +36,11 @@ static int highbank_pm_enter(suspend_state_t state) | |||
44 | cpu_pm_enter(); | 36 | cpu_pm_enter(); |
45 | cpu_cluster_pm_enter(); | 37 | cpu_cluster_pm_enter(); |
46 | 38 | ||
47 | highbank_set_cpu_jump(0, cpu_resume); | ||
48 | cpu_suspend(0, highbank_suspend_finish); | 39 | cpu_suspend(0, highbank_suspend_finish); |
49 | 40 | ||
50 | cpu_cluster_pm_exit(); | 41 | cpu_cluster_pm_exit(); |
51 | cpu_pm_exit(); | 42 | cpu_pm_exit(); |
52 | 43 | ||
53 | highbank_smc1(0x102, 0x1); | ||
54 | if (scu_base_addr) | ||
55 | scu_enable(scu_base_addr); | ||
56 | return 0; | 44 | return 0; |
57 | } | 45 | } |
58 | 46 | ||
@@ -63,5 +51,8 @@ static const struct platform_suspend_ops highbank_pm_ops = { | |||
63 | 51 | ||
64 | void __init highbank_pm_init(void) | 52 | void __init highbank_pm_init(void) |
65 | { | 53 | { |
54 | if (!psci_ops.cpu_suspend) | ||
55 | return; | ||
56 | |||
66 | suspend_set_ops(&highbank_pm_ops); | 57 | suspend_set_ops(&highbank_pm_ops); |
67 | } | 58 | } |