diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2011-01-27 19:39:45 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-01-27 19:39:48 -0500 |
commit | ee54dba9c360944b34e06478c05c6f283bf64eda (patch) | |
tree | 78b52c057f5adb414582456217836ca14cd0b0d9 | |
parent | 277a28567fe928bd94e9953a187002f5041c34a4 (diff) |
ARM: OMAP: Allow platforms to hook reset cleanly
This adds a clean method to allow platforms to hook into the reset
code if they require to.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap1/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-voiceblue.c | 106 | ||||
-rw-r--r-- | arch/arm/mach-omap1/reset.c | 25 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prcm.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/prcm.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/system.h | 38 |
6 files changed, 91 insertions, 86 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index ba6009f27677..af98117043d2 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o | 6 | obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o |
7 | obj-y += clock.o clock_data.o opp_data.o | 7 | obj-y += clock.o clock_data.o opp_data.o reset.o |
8 | 8 | ||
9 | obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o | 9 | obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o |
10 | 10 | ||
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c index 815a69ce821d..671281714099 100644 --- a/arch/arm/mach-omap1/board-voiceblue.c +++ b/arch/arm/mach-omap1/board-voiceblue.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/smc91x.h> | 26 | #include <linux/smc91x.h> |
27 | 27 | ||
28 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
29 | #include <mach/system.h> | ||
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
31 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
@@ -163,52 +164,6 @@ static void __init voiceblue_init_irq(void) | |||
163 | omap_init_irq(); | 164 | omap_init_irq(); |
164 | } | 165 | } |
165 | 166 | ||
166 | static void __init voiceblue_init(void) | ||
167 | { | ||
168 | /* mux pins for uarts */ | ||
169 | omap_cfg_reg(UART1_TX); | ||
170 | omap_cfg_reg(UART1_RTS); | ||
171 | omap_cfg_reg(UART2_TX); | ||
172 | omap_cfg_reg(UART2_RTS); | ||
173 | omap_cfg_reg(UART3_TX); | ||
174 | omap_cfg_reg(UART3_RX); | ||
175 | |||
176 | /* Watchdog */ | ||
177 | gpio_request(0, "Watchdog"); | ||
178 | /* smc91x reset */ | ||
179 | gpio_request(7, "SMC91x reset"); | ||
180 | gpio_direction_output(7, 1); | ||
181 | udelay(2); /* wait at least 100ns */ | ||
182 | gpio_set_value(7, 0); | ||
183 | mdelay(50); /* 50ms until PHY ready */ | ||
184 | /* smc91x interrupt pin */ | ||
185 | gpio_request(8, "SMC91x irq"); | ||
186 | /* 16C554 reset*/ | ||
187 | gpio_request(6, "16C554 reset"); | ||
188 | gpio_direction_output(6, 0); | ||
189 | /* 16C554 interrupt pins */ | ||
190 | gpio_request(12, "16C554 irq"); | ||
191 | gpio_request(13, "16C554 irq"); | ||
192 | gpio_request(14, "16C554 irq"); | ||
193 | gpio_request(15, "16C554 irq"); | ||
194 | set_irq_type(gpio_to_irq(12), IRQ_TYPE_EDGE_RISING); | ||
195 | set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING); | ||
196 | set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING); | ||
197 | set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING); | ||
198 | |||
199 | platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); | ||
200 | omap_board_config = voiceblue_config; | ||
201 | omap_board_config_size = ARRAY_SIZE(voiceblue_config); | ||
202 | omap_serial_init(); | ||
203 | omap1_usb_init(&voiceblue_usb_config); | ||
204 | omap_register_i2c_bus(1, 100, NULL, 0); | ||
205 | |||
206 | /* There is a good chance board is going up, so enable power LED | ||
207 | * (it is connected through invertor) */ | ||
208 | omap_writeb(0x00, OMAP_LPG1_LCR); | ||
209 | omap_writeb(0x00, OMAP_LPG1_PMR); /* Disable clock */ | ||
210 | } | ||
211 | |||
212 | static void __init voiceblue_map_io(void) | 167 | static void __init voiceblue_map_io(void) |
213 | { | 168 | { |
214 | omap1_map_common_io(); | 169 | omap1_map_common_io(); |
@@ -275,8 +230,17 @@ void voiceblue_wdt_ping(void) | |||
275 | gpio_set_value(0, wdt_gpio_state); | 230 | gpio_set_value(0, wdt_gpio_state); |
276 | } | 231 | } |
277 | 232 | ||
278 | void voiceblue_reset(void) | 233 | static void voiceblue_reset(char mode, const char *cmd) |
279 | { | 234 | { |
235 | /* | ||
236 | * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 | ||
237 | * "Global Software Reset Affects Traffic Controller Frequency". | ||
238 | */ | ||
239 | if (cpu_is_omap5912()) { | ||
240 | omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4), DPLL_CTL); | ||
241 | omap_writew(0x8, ARM_RSTCT1); | ||
242 | } | ||
243 | |||
280 | set_bit(MACHINE_REBOOT, &machine_state); | 244 | set_bit(MACHINE_REBOOT, &machine_state); |
281 | voiceblue_wdt_enable(); | 245 | voiceblue_wdt_enable(); |
282 | while (1) ; | 246 | while (1) ; |
@@ -286,6 +250,54 @@ EXPORT_SYMBOL(voiceblue_wdt_enable); | |||
286 | EXPORT_SYMBOL(voiceblue_wdt_disable); | 250 | EXPORT_SYMBOL(voiceblue_wdt_disable); |
287 | EXPORT_SYMBOL(voiceblue_wdt_ping); | 251 | EXPORT_SYMBOL(voiceblue_wdt_ping); |
288 | 252 | ||
253 | static void __init voiceblue_init(void) | ||
254 | { | ||
255 | /* mux pins for uarts */ | ||
256 | omap_cfg_reg(UART1_TX); | ||
257 | omap_cfg_reg(UART1_RTS); | ||
258 | omap_cfg_reg(UART2_TX); | ||
259 | omap_cfg_reg(UART2_RTS); | ||
260 | omap_cfg_reg(UART3_TX); | ||
261 | omap_cfg_reg(UART3_RX); | ||
262 | |||
263 | /* Watchdog */ | ||
264 | gpio_request(0, "Watchdog"); | ||
265 | /* smc91x reset */ | ||
266 | gpio_request(7, "SMC91x reset"); | ||
267 | gpio_direction_output(7, 1); | ||
268 | udelay(2); /* wait at least 100ns */ | ||
269 | gpio_set_value(7, 0); | ||
270 | mdelay(50); /* 50ms until PHY ready */ | ||
271 | /* smc91x interrupt pin */ | ||
272 | gpio_request(8, "SMC91x irq"); | ||
273 | /* 16C554 reset*/ | ||
274 | gpio_request(6, "16C554 reset"); | ||
275 | gpio_direction_output(6, 0); | ||
276 | /* 16C554 interrupt pins */ | ||
277 | gpio_request(12, "16C554 irq"); | ||
278 | gpio_request(13, "16C554 irq"); | ||
279 | gpio_request(14, "16C554 irq"); | ||
280 | gpio_request(15, "16C554 irq"); | ||
281 | set_irq_type(gpio_to_irq(12), IRQ_TYPE_EDGE_RISING); | ||
282 | set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING); | ||
283 | set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING); | ||
284 | set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING); | ||
285 | |||
286 | platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); | ||
287 | omap_board_config = voiceblue_config; | ||
288 | omap_board_config_size = ARRAY_SIZE(voiceblue_config); | ||
289 | omap_serial_init(); | ||
290 | omap1_usb_init(&voiceblue_usb_config); | ||
291 | omap_register_i2c_bus(1, 100, NULL, 0); | ||
292 | |||
293 | /* There is a good chance board is going up, so enable power LED | ||
294 | * (it is connected through invertor) */ | ||
295 | omap_writeb(0x00, OMAP_LPG1_LCR); | ||
296 | omap_writeb(0x00, OMAP_LPG1_PMR); /* Disable clock */ | ||
297 | |||
298 | arch_reset = voiceblue_reset; | ||
299 | } | ||
300 | |||
289 | MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") | 301 | MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") |
290 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ | 302 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ |
291 | .boot_params = 0x10000100, | 303 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c new file mode 100644 index 000000000000..ad951ee69205 --- /dev/null +++ b/arch/arm/mach-omap1/reset.c | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * OMAP1 reset support | ||
3 | */ | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/io.h> | ||
6 | |||
7 | #include <mach/hardware.h> | ||
8 | #include <mach/system.h> | ||
9 | #include <plat/prcm.h> | ||
10 | |||
11 | void omap1_arch_reset(char mode, const char *cmd) | ||
12 | { | ||
13 | /* | ||
14 | * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 | ||
15 | * "Global Software Reset Affects Traffic Controller Frequency". | ||
16 | */ | ||
17 | if (cpu_is_omap5912()) { | ||
18 | omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4), DPLL_CTL); | ||
19 | omap_writew(0x8, ARM_RSTCT1); | ||
20 | } | ||
21 | |||
22 | omap_writew(1, ARM_RSTCT1); | ||
23 | } | ||
24 | |||
25 | void (*arch_reset)(char, const char *) = omap1_arch_reset; | ||
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index 679bcd28576e..6be14389e4f3 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | 26 | ||
27 | #include <mach/system.h> | ||
27 | #include <plat/common.h> | 28 | #include <plat/common.h> |
28 | #include <plat/prcm.h> | 29 | #include <plat/prcm.h> |
29 | #include <plat/irqs.h> | 30 | #include <plat/irqs.h> |
@@ -57,7 +58,7 @@ u32 omap_prcm_get_reset_sources(void) | |||
57 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); | 58 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); |
58 | 59 | ||
59 | /* Resets clock rates and reboots the system. Only called from system.h */ | 60 | /* Resets clock rates and reboots the system. Only called from system.h */ |
60 | void omap_prcm_arch_reset(char mode, const char *cmd) | 61 | static void omap_prcm_arch_reset(char mode, const char *cmd) |
61 | { | 62 | { |
62 | s16 prcm_offs = 0; | 63 | s16 prcm_offs = 0; |
63 | 64 | ||
@@ -108,6 +109,8 @@ void omap_prcm_arch_reset(char mode, const char *cmd) | |||
108 | omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */ | 109 | omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */ |
109 | } | 110 | } |
110 | 111 | ||
112 | void (*arch_reset)(char, const char *) = omap_prcm_arch_reset; | ||
113 | |||
111 | /** | 114 | /** |
112 | * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness | 115 | * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness |
113 | * @reg: physical address of module IDLEST register | 116 | * @reg: physical address of module IDLEST register |
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h index 2fdf8c80d390..267f43bb2a4e 100644 --- a/arch/arm/plat-omap/include/plat/prcm.h +++ b/arch/arm/plat-omap/include/plat/prcm.h | |||
@@ -28,7 +28,6 @@ | |||
28 | #define __ASM_ARM_ARCH_OMAP_PRCM_H | 28 | #define __ASM_ARM_ARCH_OMAP_PRCM_H |
29 | 29 | ||
30 | u32 omap_prcm_get_reset_sources(void); | 30 | u32 omap_prcm_get_reset_sources(void); |
31 | void omap_prcm_arch_reset(char mode, const char *cmd); | ||
32 | int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest, | 31 | int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest, |
33 | const char *name); | 32 | const char *name); |
34 | 33 | ||
diff --git a/arch/arm/plat-omap/include/plat/system.h b/arch/arm/plat-omap/include/plat/system.h index d0a119f735b4..c5fa9e929009 100644 --- a/arch/arm/plat-omap/include/plat/system.h +++ b/arch/arm/plat-omap/include/plat/system.h | |||
@@ -4,48 +4,14 @@ | |||
4 | */ | 4 | */ |
5 | #ifndef __ASM_ARCH_SYSTEM_H | 5 | #ifndef __ASM_ARCH_SYSTEM_H |
6 | #define __ASM_ARCH_SYSTEM_H | 6 | #define __ASM_ARCH_SYSTEM_H |
7 | #include <linux/clk.h> | ||
8 | 7 | ||
9 | #include <asm/mach-types.h> | 8 | #include <asm/proc-fns.h> |
10 | #include <mach/hardware.h> | ||
11 | |||
12 | #include <plat/prcm.h> | ||
13 | |||
14 | #ifndef CONFIG_MACH_VOICEBLUE | ||
15 | #define voiceblue_reset() do {} while (0) | ||
16 | #else | ||
17 | extern void voiceblue_reset(void); | ||
18 | #endif | ||
19 | 9 | ||
20 | static inline void arch_idle(void) | 10 | static inline void arch_idle(void) |
21 | { | 11 | { |
22 | cpu_do_idle(); | 12 | cpu_do_idle(); |
23 | } | 13 | } |
24 | 14 | ||
25 | static inline void omap1_arch_reset(char mode, const char *cmd) | 15 | extern void (*arch_reset)(char, const char *); |
26 | { | ||
27 | /* | ||
28 | * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 | ||
29 | * "Global Software Reset Affects Traffic Controller Frequency". | ||
30 | */ | ||
31 | if (cpu_is_omap5912()) { | ||
32 | omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4), | ||
33 | DPLL_CTL); | ||
34 | omap_writew(0x8, ARM_RSTCT1); | ||
35 | } | ||
36 | |||
37 | if (machine_is_voiceblue()) | ||
38 | voiceblue_reset(); | ||
39 | else | ||
40 | omap_writew(1, ARM_RSTCT1); | ||
41 | } | ||
42 | |||
43 | static inline void arch_reset(char mode, const char *cmd) | ||
44 | { | ||
45 | if (!cpu_class_is_omap2()) | ||
46 | omap1_arch_reset(mode, cmd); | ||
47 | else | ||
48 | omap_prcm_arch_reset(mode, cmd); | ||
49 | } | ||
50 | 16 | ||
51 | #endif | 17 | #endif |