diff options
author | Kevin Hilman <khilman@linaro.org> | 2013-08-20 18:04:47 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2013-08-20 18:05:31 -0400 |
commit | c454194612e2e88d470f10b959db8ca0045c99bb (patch) | |
tree | 04ed22d8791f369a5b130d26f327de7acec24cf8 /arch/arm/mach-zynq | |
parent | 47aad66c2659b8985512b66f87bb5fe7bdc88dff (diff) | |
parent | b522877b53cf3f26d7f072616a45e10fe579cd19 (diff) |
Merge tag 'zynq-cleanup-for-3.12' of git://git.xilinx.com/linux-xlnx into next/cleanup
From: Michal Simek:
arm: Xilinx Zynq cleanup patches for v3.12
This branch contains these fixes:
- SLCR cleanup
- Hotplug cleanup
* tag 'zynq-cleanup-for-3.12' of git://git.xilinx.com/linux-xlnx:
arm: zynq: hotplug: Remove unreachable code
arm: zynq: slcr: Use read-modify-write for register writes
arm: zynq: slcr: Clean up #defines
arm: zynq: slcr: Remove redundant header #includes
Signed-off-by: Kevin Hilman <khilman@linaro.org>
Diffstat (limited to 'arch/arm/mach-zynq')
-rw-r--r-- | arch/arm/mach-zynq/hotplug.c | 55 | ||||
-rw-r--r-- | arch/arm/mach-zynq/slcr.c | 45 |
2 files changed, 22 insertions, 78 deletions
diff --git a/arch/arm/mach-zynq/hotplug.c b/arch/arm/mach-zynq/hotplug.c index c89672bd1de2..5052c70326e4 100644 --- a/arch/arm/mach-zynq/hotplug.c +++ b/arch/arm/mach-zynq/hotplug.c | |||
@@ -40,44 +40,6 @@ static inline void zynq_cpu_enter_lowpower(void) | |||
40 | : "cc"); | 40 | : "cc"); |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline void zynq_cpu_leave_lowpower(void) | ||
44 | { | ||
45 | unsigned int v; | ||
46 | |||
47 | asm volatile( | ||
48 | " mrc p15, 0, %0, c1, c0, 0\n" | ||
49 | " orr %0, %0, %1\n" | ||
50 | " mcr p15, 0, %0, c1, c0, 0\n" | ||
51 | " mrc p15, 0, %0, c1, c0, 1\n" | ||
52 | " orr %0, %0, #0x40\n" | ||
53 | " mcr p15, 0, %0, c1, c0, 1\n" | ||
54 | : "=&r" (v) | ||
55 | : "Ir" (CR_C) | ||
56 | : "cc"); | ||
57 | } | ||
58 | |||
59 | static inline void zynq_platform_do_lowpower(unsigned int cpu, int *spurious) | ||
60 | { | ||
61 | /* | ||
62 | * there is no power-control hardware on this platform, so all | ||
63 | * we can do is put the core into WFI; this is safe as the calling | ||
64 | * code will have already disabled interrupts | ||
65 | */ | ||
66 | for (;;) { | ||
67 | dsb(); | ||
68 | wfi(); | ||
69 | |||
70 | /* | ||
71 | * Getting here, means that we have come out of WFI without | ||
72 | * having been woken up - this shouldn't happen | ||
73 | * | ||
74 | * Just note it happening - when we're woken, we can report | ||
75 | * its occurrence. | ||
76 | */ | ||
77 | (*spurious)++; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /* | 43 | /* |
82 | * platform-specific code to shutdown a CPU | 44 | * platform-specific code to shutdown a CPU |
83 | * | 45 | * |
@@ -85,20 +47,13 @@ static inline void zynq_platform_do_lowpower(unsigned int cpu, int *spurious) | |||
85 | */ | 47 | */ |
86 | void zynq_platform_cpu_die(unsigned int cpu) | 48 | void zynq_platform_cpu_die(unsigned int cpu) |
87 | { | 49 | { |
88 | int spurious = 0; | ||
89 | |||
90 | /* | ||
91 | * we're ready for shutdown now, so do it | ||
92 | */ | ||
93 | zynq_cpu_enter_lowpower(); | 50 | zynq_cpu_enter_lowpower(); |
94 | zynq_platform_do_lowpower(cpu, &spurious); | ||
95 | 51 | ||
96 | /* | 52 | /* |
97 | * bring this CPU back into the world of cache | 53 | * there is no power-control hardware on this platform, so all |
98 | * coherency, and then restore interrupts | 54 | * we can do is put the core into WFI; this is safe as the calling |
55 | * code will have already disabled interrupts | ||
99 | */ | 56 | */ |
100 | zynq_cpu_leave_lowpower(); | 57 | for (;;) |
101 | 58 | cpu_do_idle(); | |
102 | if (spurious) | ||
103 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); | ||
104 | } | 59 | } |
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c index 50d008d8f87f..1836d5a34606 100644 --- a/arch/arm/mach-zynq/slcr.c +++ b/arch/arm/mach-zynq/slcr.c | |||
@@ -14,32 +14,21 @@ | |||
14 | * 02139, USA. | 14 | * 02139, USA. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/export.h> | ||
18 | #include <linux/io.h> | 17 | #include <linux/io.h> |
19 | #include <linux/fs.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/of_address.h> | 18 | #include <linux/of_address.h> |
25 | #include <linux/uaccess.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/string.h> | ||
29 | #include <linux/clk/zynq.h> | 19 | #include <linux/clk/zynq.h> |
30 | #include "common.h" | 20 | #include "common.h" |
31 | 21 | ||
32 | #define SLCR_UNLOCK_MAGIC 0xDF0D | 22 | /* register offsets */ |
33 | #define SLCR_UNLOCK 0x8 /* SCLR unlock register */ | 23 | #define SLCR_UNLOCK_OFFSET 0x8 /* SCLR unlock register */ |
34 | |||
35 | #define SLCR_PS_RST_CTRL_OFFSET 0x200 /* PS Software Reset Control */ | 24 | #define SLCR_PS_RST_CTRL_OFFSET 0x200 /* PS Software Reset Control */ |
25 | #define SLCR_A9_CPU_RST_CTRL_OFFSET 0x244 /* CPU Software Reset Control */ | ||
26 | #define SLCR_REBOOT_STATUS_OFFSET 0x258 /* PS Reboot Status */ | ||
36 | 27 | ||
28 | #define SLCR_UNLOCK_MAGIC 0xDF0D | ||
37 | #define SLCR_A9_CPU_CLKSTOP 0x10 | 29 | #define SLCR_A9_CPU_CLKSTOP 0x10 |
38 | #define SLCR_A9_CPU_RST 0x1 | 30 | #define SLCR_A9_CPU_RST 0x1 |
39 | 31 | ||
40 | #define SLCR_A9_CPU_RST_CTRL 0x244 /* CPU Software Reset Control */ | ||
41 | #define SLCR_REBOOT_STATUS 0x258 /* PS Reboot Status */ | ||
42 | |||
43 | void __iomem *zynq_slcr_base; | 32 | void __iomem *zynq_slcr_base; |
44 | 33 | ||
45 | /** | 34 | /** |
@@ -54,15 +43,15 @@ void zynq_slcr_system_reset(void) | |||
54 | * Note that this seems to require raw i/o | 43 | * Note that this seems to require raw i/o |
55 | * functions or there's a lockup? | 44 | * functions or there's a lockup? |
56 | */ | 45 | */ |
57 | writel(SLCR_UNLOCK_MAGIC, zynq_slcr_base + SLCR_UNLOCK); | 46 | writel(SLCR_UNLOCK_MAGIC, zynq_slcr_base + SLCR_UNLOCK_OFFSET); |
58 | 47 | ||
59 | /* | 48 | /* |
60 | * Clear 0x0F000000 bits of reboot status register to workaround | 49 | * Clear 0x0F000000 bits of reboot status register to workaround |
61 | * the FSBL not loading the bitstream after soft-reboot | 50 | * the FSBL not loading the bitstream after soft-reboot |
62 | * This is a temporary solution until we know more. | 51 | * This is a temporary solution until we know more. |
63 | */ | 52 | */ |
64 | reboot = readl(zynq_slcr_base + SLCR_REBOOT_STATUS); | 53 | reboot = readl(zynq_slcr_base + SLCR_REBOOT_STATUS_OFFSET); |
65 | writel(reboot & 0xF0FFFFFF, zynq_slcr_base + SLCR_REBOOT_STATUS); | 54 | writel(reboot & 0xF0FFFFFF, zynq_slcr_base + SLCR_REBOOT_STATUS_OFFSET); |
66 | writel(1, zynq_slcr_base + SLCR_PS_RST_CTRL_OFFSET); | 55 | writel(1, zynq_slcr_base + SLCR_PS_RST_CTRL_OFFSET); |
67 | } | 56 | } |
68 | 57 | ||
@@ -72,11 +61,11 @@ void zynq_slcr_system_reset(void) | |||
72 | */ | 61 | */ |
73 | void zynq_slcr_cpu_start(int cpu) | 62 | void zynq_slcr_cpu_start(int cpu) |
74 | { | 63 | { |
75 | /* enable CPUn */ | 64 | u32 reg = readl(zynq_slcr_base + SLCR_A9_CPU_RST_CTRL_OFFSET); |
76 | writel(SLCR_A9_CPU_CLKSTOP << cpu, | 65 | reg &= ~(SLCR_A9_CPU_RST << cpu); |
77 | zynq_slcr_base + SLCR_A9_CPU_RST_CTRL); | 66 | writel(reg, zynq_slcr_base + SLCR_A9_CPU_RST_CTRL_OFFSET); |
78 | /* enable CLK for CPUn */ | 67 | reg &= ~(SLCR_A9_CPU_CLKSTOP << cpu); |
79 | writel(0x0 << cpu, zynq_slcr_base + SLCR_A9_CPU_RST_CTRL); | 68 | writel(reg, zynq_slcr_base + SLCR_A9_CPU_RST_CTRL_OFFSET); |
80 | } | 69 | } |
81 | 70 | ||
82 | /** | 71 | /** |
@@ -85,9 +74,9 @@ void zynq_slcr_cpu_start(int cpu) | |||
85 | */ | 74 | */ |
86 | void zynq_slcr_cpu_stop(int cpu) | 75 | void zynq_slcr_cpu_stop(int cpu) |
87 | { | 76 | { |
88 | /* stop CLK and reset CPUn */ | 77 | u32 reg = readl(zynq_slcr_base + SLCR_A9_CPU_RST_CTRL_OFFSET); |
89 | writel((SLCR_A9_CPU_CLKSTOP | SLCR_A9_CPU_RST) << cpu, | 78 | reg |= (SLCR_A9_CPU_CLKSTOP | SLCR_A9_CPU_RST) << cpu; |
90 | zynq_slcr_base + SLCR_A9_CPU_RST_CTRL); | 79 | writel(reg, zynq_slcr_base + SLCR_A9_CPU_RST_CTRL_OFFSET); |
91 | } | 80 | } |
92 | 81 | ||
93 | /** | 82 | /** |
@@ -113,7 +102,7 @@ int __init zynq_slcr_init(void) | |||
113 | } | 102 | } |
114 | 103 | ||
115 | /* unlock the SLCR so that registers can be changed */ | 104 | /* unlock the SLCR so that registers can be changed */ |
116 | writel(SLCR_UNLOCK_MAGIC, zynq_slcr_base + SLCR_UNLOCK); | 105 | writel(SLCR_UNLOCK_MAGIC, zynq_slcr_base + SLCR_UNLOCK_OFFSET); |
117 | 106 | ||
118 | pr_info("%s mapped to %p\n", np->name, zynq_slcr_base); | 107 | pr_info("%s mapped to %p\n", np->name, zynq_slcr_base); |
119 | 108 | ||