aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2006-06-19 14:57:12 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-06-19 14:57:12 -0400
commit74617fb6b825ea370ae72565f7543306bc08ef6e (patch)
treeac6032e0b476f1bf61bf03aba44240e448739d57 /arch/arm
parentb7408aff2d325581dcafffa5dbcc09c42ae64b5d (diff)
[ARM] 3593/1: Add reboot and shutdown handlers for Zaurus handhelds
Patch from Richard Purdie Add functionality to allow machine specific reboot handlers on ARM. Add machine specific reboot and poweroff handlers for all PXA Zaurus models. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/kernel/process.c61
-rw-r--r--arch/arm/mach-pxa/corgi.c25
-rw-r--r--arch/arm/mach-pxa/poodle.c17
-rw-r--r--arch/arm/mach-pxa/spitz.c25
-rw-r--r--arch/arm/mach-pxa/tosa.c25
5 files changed, 127 insertions, 26 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 7df6e1aaa323..17c38dbf2f3c 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30#include <linux/elfcore.h> 30#include <linux/elfcore.h>
31#include <linux/pm.h>
31 32
32#include <asm/leds.h> 33#include <asm/leds.h>
33#include <asm/processor.h> 34#include <asm/processor.h>
@@ -71,8 +72,36 @@ static int __init hlt_setup(char *__unused)
71__setup("nohlt", nohlt_setup); 72__setup("nohlt", nohlt_setup);
72__setup("hlt", hlt_setup); 73__setup("hlt", hlt_setup);
73 74
75void arm_machine_restart(char mode)
76{
77 /*
78 * Clean and disable cache, and turn off interrupts
79 */
80 cpu_proc_fin();
81
82 /*
83 * Tell the mm system that we are going to reboot -
84 * we may need it to insert some 1:1 mappings so that
85 * soft boot works.
86 */
87 setup_mm_for_reboot(mode);
88
89 /*
90 * Now call the architecture specific reboot code.
91 */
92 arch_reset(mode);
93
94 /*
95 * Whoops - the architecture was unable to reboot.
96 * Tell the user!
97 */
98 mdelay(1000);
99 printk("Reboot failed -- System halted\n");
100 while (1);
101}
102
74/* 103/*
75 * The following aren't currently used. 104 * Function pointers to optional machine specific functions
76 */ 105 */
77void (*pm_idle)(void); 106void (*pm_idle)(void);
78EXPORT_SYMBOL(pm_idle); 107EXPORT_SYMBOL(pm_idle);
@@ -80,6 +109,10 @@ EXPORT_SYMBOL(pm_idle);
80void (*pm_power_off)(void); 109void (*pm_power_off)(void);
81EXPORT_SYMBOL(pm_power_off); 110EXPORT_SYMBOL(pm_power_off);
82 111
112void (*arm_pm_restart)(char str) = arm_machine_restart;
113EXPORT_SYMBOL_GPL(arm_pm_restart);
114
115
83/* 116/*
84 * This is our default idle handler. We need to disable 117 * This is our default idle handler. We need to disable
85 * interrupts here to ensure we don't miss a wakeup call. 118 * interrupts here to ensure we don't miss a wakeup call.
@@ -151,33 +184,9 @@ void machine_power_off(void)
151 pm_power_off(); 184 pm_power_off();
152} 185}
153 186
154
155void machine_restart(char * __unused) 187void machine_restart(char * __unused)
156{ 188{
157 /* 189 arm_pm_restart(reboot_mode);
158 * Clean and disable cache, and turn off interrupts
159 */
160 cpu_proc_fin();
161
162 /*
163 * Tell the mm system that we are going to reboot -
164 * we may need it to insert some 1:1 mappings so that
165 * soft boot works.
166 */
167 setup_mm_for_reboot(reboot_mode);
168
169 /*
170 * Now call the architecture specific reboot code.
171 */
172 arch_reset(reboot_mode);
173
174 /*
175 * Whoops - the architecture was unable to reboot.
176 * Tell the user!
177 */
178 mdelay(1000);
179 printk("Reboot failed -- System halted\n");
180 while (1);
181} 190}
182 191
183void __show_regs(struct pt_regs *regs) 192void __show_regs(struct pt_regs *regs)
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index d6d726036361..bf6648a83901 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -19,6 +19,7 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/mmc/host.h> 21#include <linux/mmc/host.h>
22#include <linux/pm.h>
22 23
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/memory.h> 25#include <asm/memory.h>
@@ -26,6 +27,7 @@
26#include <asm/hardware.h> 27#include <asm/hardware.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
28#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/system.h>
29 31
30#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 33#include <asm/mach/map.h>
@@ -310,8 +312,31 @@ static struct platform_device *devices[] __initdata = {
310 &corgiled_device, 312 &corgiled_device,
311}; 313};
312 314
315static void corgi_poweroff(void)
316{
317 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
318
319 if (!machine_is_corgi())
320 /* Green LED off tells the bootloader to halt */
321 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
322 arm_machine_restart('h');
323}
324
325static void corgi_restart(char mode)
326{
327 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
328
329 if (!machine_is_corgi())
330 /* Green LED on tells the bootloader to reboot */
331 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
332 arm_machine_restart('h');
333}
334
313static void __init corgi_init(void) 335static void __init corgi_init(void)
314{ 336{
337 pm_power_off = corgi_poweroff;
338 arm_pm_restart = corgi_restart;
339
315 /* setup sleep mode values */ 340 /* setup sleep mode values */
316 PWER = 0x00000002; 341 PWER = 0x00000002;
317 PFER = 0x00000000; 342 PFER = 0x00000000;
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index a042473deedd..1d516d317e89 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -18,11 +18,13 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <linux/pm.h>
21 22
22#include <asm/hardware.h> 23#include <asm/hardware.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
25#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/system.h>
26 28
27#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 30#include <asm/mach/map.h>
@@ -247,10 +249,25 @@ static struct platform_device *devices[] __initdata = {
247 &poodle_scoop_device, 249 &poodle_scoop_device,
248}; 250};
249 251
252static void poodle_poweroff(void)
253{
254 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
255 arm_machine_restart('h');
256}
257
258static void poodle_restart(char mode)
259{
260 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
261 arm_machine_restart('h');
262}
263
250static void __init poodle_init(void) 264static void __init poodle_init(void)
251{ 265{
252 int ret = 0; 266 int ret = 0;
253 267
268 pm_power_off = poodle_poweroff;
269 arm_pm_restart = poodle_restart;
270
254 /* setup sleep mode values */ 271 /* setup sleep mode values */
255 PWER = 0x00000002; 272 PWER = 0x00000002;
256 PFER = 0x00000000; 273 PFER = 0x00000000;
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 44bcb8097c7a..eb9937f6f5cd 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -20,6 +20,7 @@
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/mmc/host.h> 22#include <linux/mmc/host.h>
23#include <linux/pm.h>
23 24
24#include <asm/setup.h> 25#include <asm/setup.h>
25#include <asm/memory.h> 26#include <asm/memory.h>
@@ -27,6 +28,7 @@
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/irq.h> 29#include <asm/irq.h>
29#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/system.h>
30 32
31#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 34#include <asm/mach/map.h>
@@ -432,8 +434,31 @@ static struct platform_device *devices[] __initdata = {
432 &spitzled_device, 434 &spitzled_device,
433}; 435};
434 436
437static void spitz_poweroff(void)
438{
439 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
440
441 pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT);
442 GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET);
443
444 mdelay(1000);
445 arm_machine_restart('h');
446}
447
448static void spitz_restart(char mode)
449{
450 /* Bootloader magic for a reboot */
451 if((MSC0 & 0xffff0000) == 0x7ff00000)
452 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
453
454 spitz_poweroff();
455}
456
435static void __init common_init(void) 457static void __init common_init(void)
436{ 458{
459 pm_power_off = spitz_poweroff;
460 arm_pm_restart = spitz_restart;
461
437 PMCR = 0x00; 462 PMCR = 0x00;
438 463
439 /* setup sleep mode values */ 464 /* setup sleep mode values */
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 76c0e7f0a219..afa223b9e7a2 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -19,12 +19,14 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/mmc/host.h> 21#include <linux/mmc/host.h>
22#include <linux/pm.h>
22 23
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/memory.h> 25#include <asm/memory.h>
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
26#include <asm/hardware.h> 27#include <asm/hardware.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/system.h>
28#include <asm/arch/irda.h> 30#include <asm/arch/irda.h>
29#include <asm/arch/mmc.h> 31#include <asm/arch/mmc.h>
30#include <asm/arch/udc.h> 32#include <asm/arch/udc.h>
@@ -266,8 +268,31 @@ static struct platform_device *devices[] __initdata = {
266 &tosaled_device, 268 &tosaled_device,
267}; 269};
268 270
271static void tosa_poweroff(void)
272{
273 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
274
275 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT);
276 GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET);
277
278 mdelay(1000);
279 arm_machine_restart('h');
280}
281
282static void tosa_restart(char mode)
283{
284 /* Bootloader magic for a reboot */
285 if((MSC0 & 0xffff0000) == 0x7ff00000)
286 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
287
288 tosa_poweroff();
289}
290
269static void __init tosa_init(void) 291static void __init tosa_init(void)
270{ 292{
293 pm_power_off = tosa_poweroff;
294 arm_pm_restart = tosa_restart;
295
271 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); 296 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN);
272 pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); 297 pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN);
273 pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN); 298 pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN);