aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-07-23 11:25:17 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-07-30 16:54:38 -0400
commita49297e8fc8a9a835ac4ec124aa83028abdcc7d5 (patch)
tree04b9c04589033206888789122d436e287953480c /arch
parent455cc256eb23915100e203fb33ee143afd127954 (diff)
[MIPS] TXx9: Cleanup restart/halt/power_off
Unify machine_restart/machine_halt/pm_power_off and add fallback machine_halt routine. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/txx9/generic/setup.c26
-rw-r--r--arch/mips/txx9/jmr3927/setup.c29
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c33
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c26
4 files changed, 34 insertions, 80 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 4fbd7baa7037..82272e85a042 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -22,6 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
24#include <asm/time.h> 24#include <asm/time.h>
25#include <asm/reboot.h>
25#include <asm/txx9/generic.h> 26#include <asm/txx9/generic.h>
26#include <asm/txx9/pci.h> 27#include <asm/txx9/pci.h>
27#ifdef CONFIG_CPU_TX49XX 28#ifdef CONFIG_CPU_TX49XX
@@ -188,6 +189,25 @@ char * __init prom_getcmdline(void)
188 return &(arcs_cmdline[0]); 189 return &(arcs_cmdline[0]);
189} 190}
190 191
192static void __noreturn txx9_machine_halt(void)
193{
194 local_irq_disable();
195 clear_c0_status(ST0_IM);
196 while (1) {
197 if (cpu_wait) {
198 (*cpu_wait)();
199 if (cpu_has_counter) {
200 /*
201 * Clear counter interrupt while it
202 * breaks WAIT instruction even if
203 * masked.
204 */
205 write_c0_compare(0);
206 }
207 }
208 }
209}
210
191/* wrappers */ 211/* wrappers */
192void __init plat_mem_setup(void) 212void __init plat_mem_setup(void)
193{ 213{
@@ -195,6 +215,12 @@ void __init plat_mem_setup(void)
195 ioport_resource.end = ~0UL; /* no limit */ 215 ioport_resource.end = ~0UL; /* no limit */
196 iomem_resource.start = 0; 216 iomem_resource.start = 0;
197 iomem_resource.end = ~0UL; /* no limit */ 217 iomem_resource.end = ~0UL; /* no limit */
218
219 /* fallback restart/halt routines */
220 _machine_restart = (void (*)(char *))txx9_machine_halt;
221 _machine_halt = txx9_machine_halt;
222 pm_power_off = txx9_machine_halt;
223
198#ifdef CONFIG_PCI 224#ifdef CONFIG_PCI
199 pcibios_plat_setup = txx9_pcibios_setup; 225 pcibios_plat_setup = txx9_pcibios_setup;
200#endif 226#endif
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index 7c16c402ff60..fa0503efc840 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -32,7 +32,6 @@
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/pm.h>
36#include <linux/platform_device.h> 35#include <linux/platform_device.h>
37#include <linux/gpio.h> 36#include <linux/gpio.h>
38#ifdef CONFIG_SERIAL_TXX9 37#ifdef CONFIG_SERIAL_TXX9
@@ -46,13 +45,12 @@
46#include <asm/txx9/jmr3927.h> 45#include <asm/txx9/jmr3927.h>
47#include <asm/mipsregs.h> 46#include <asm/mipsregs.h>
48 47
49extern void puts(const char *cp);
50
51/* don't enable - see errata */ 48/* don't enable - see errata */
52static int jmr3927_ccfg_toeon; 49static int jmr3927_ccfg_toeon;
53 50
54static inline void do_reset(void) 51static void jmr3927_machine_restart(char *command)
55{ 52{
53 local_irq_disable();
56#if 1 /* Resetting PCI bus */ 54#if 1 /* Resetting PCI bus */
57 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); 55 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
58 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR); 56 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR);
@@ -61,25 +59,8 @@ static inline void do_reset(void)
61 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); 59 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
62#endif 60#endif
63 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR); 61 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR);
64} 62 /* fallback */
65 63 (*_machine_halt)();
66static void jmr3927_machine_restart(char *command)
67{
68 local_irq_disable();
69 puts("Rebooting...");
70 do_reset();
71}
72
73static void jmr3927_machine_halt(void)
74{
75 puts("JMR-TX3927 halted.\n");
76 while (1);
77}
78
79static void jmr3927_machine_power_off(void)
80{
81 puts("JMR-TX3927 halted. Please turn off the power.\n");
82 while (1);
83} 64}
84 65
85static void __init jmr3927_time_init(void) 66static void __init jmr3927_time_init(void)
@@ -102,8 +83,6 @@ static void __init jmr3927_mem_setup(void)
102 set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO); 83 set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
103 84
104 _machine_restart = jmr3927_machine_restart; 85 _machine_restart = jmr3927_machine_restart;
105 _machine_halt = jmr3927_machine_halt;
106 pm_power_off = jmr3927_machine_power_off;
107 86
108 /* Reboot on panic */ 87 /* Reboot on panic */
109 panic_timeout = 180; 88 panic_timeout = 180;
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 65b72247d320..54c33c3e9f7d 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -47,11 +47,9 @@
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/ioport.h> 48#include <linux/ioport.h>
49#include <linux/interrupt.h> 49#include <linux/interrupt.h>
50#include <linux/pm.h>
51#include <linux/platform_device.h> 50#include <linux/platform_device.h>
52#include <linux/delay.h> 51#include <linux/delay.h>
53#include <asm/io.h> 52#include <asm/io.h>
54#include <asm/processor.h>
55#include <asm/reboot.h> 53#include <asm/reboot.h>
56#include <asm/txx9/generic.h> 54#include <asm/txx9/generic.h>
57#include <asm/txx9/pci.h> 55#include <asm/txx9/pci.h>
@@ -167,17 +165,8 @@ static void __init rbtx4937_arch_init(void)
167#define rbtx4937_arch_init NULL 165#define rbtx4937_arch_init NULL
168#endif /* CONFIG_PCI */ 166#endif /* CONFIG_PCI */
169 167
170static void __noreturn wait_forever(void)
171{
172 while (1)
173 if (cpu_wait)
174 (*cpu_wait)();
175}
176
177static void toshiba_rbtx4927_restart(char *command) 168static void toshiba_rbtx4927_restart(char *command)
178{ 169{
179 printk(KERN_NOTICE "System Rebooting...\n");
180
181 /* enable the s/w reset register */ 170 /* enable the s/w reset register */
182 writeb(1, rbtx4927_softresetlock_addr); 171 writeb(1, rbtx4927_softresetlock_addr);
183 172
@@ -188,24 +177,8 @@ static void toshiba_rbtx4927_restart(char *command)
188 /* do a s/w reset */ 177 /* do a s/w reset */
189 writeb(1, rbtx4927_softreset_addr); 178 writeb(1, rbtx4927_softreset_addr);
190 179
191 /* do something passive while waiting for reset */ 180 /* fallback */
192 local_irq_disable(); 181 (*_machine_halt)();
193 wait_forever();
194 /* no return */
195}
196
197static void toshiba_rbtx4927_halt(void)
198{
199 printk(KERN_NOTICE "System Halted\n");
200 local_irq_disable();
201 wait_forever();
202 /* no return */
203}
204
205static void toshiba_rbtx4927_power_off(void)
206{
207 toshiba_rbtx4927_halt();
208 /* no return */
209} 182}
210 183
211static void __init rbtx4927_clock_init(void); 184static void __init rbtx4927_clock_init(void);
@@ -233,8 +206,6 @@ static void __init rbtx4927_mem_setup(void)
233 } 206 }
234 207
235 _machine_restart = toshiba_rbtx4927_restart; 208 _machine_restart = toshiba_rbtx4927_restart;
236 _machine_halt = toshiba_rbtx4927_halt;
237 pm_power_off = toshiba_rbtx4927_power_off;
238 209
239#ifdef CONFIG_PCI 210#ifdef CONFIG_PCI
240 txx9_alloc_pci_controller(&txx9_primary_pcic, 211 txx9_alloc_pci_controller(&txx9_primary_pcic,
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 4454b7901cd3..e1177b3b9103 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -15,7 +15,6 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/console.h> 17#include <linux/console.h>
18#include <linux/pm.h>
19#include <linux/platform_device.h> 18#include <linux/platform_device.h>
20#include <linux/gpio.h> 19#include <linux/gpio.h>
21 20
@@ -28,33 +27,14 @@
28#include <asm/txx9/spi.h> 27#include <asm/txx9/spi.h>
29#include <asm/txx9pio.h> 28#include <asm/txx9pio.h>
30 29
31static void rbtx4938_machine_halt(void)
32{
33 printk(KERN_NOTICE "System Halted\n");
34 local_irq_disable();
35
36 while (1)
37 __asm__(".set\tmips3\n\t"
38 "wait\n\t"
39 ".set\tmips0");
40}
41
42static void rbtx4938_machine_power_off(void)
43{
44 rbtx4938_machine_halt();
45 /* no return */
46}
47
48static void rbtx4938_machine_restart(char *command) 30static void rbtx4938_machine_restart(char *command)
49{ 31{
50 local_irq_disable(); 32 local_irq_disable();
51
52 printk("Rebooting...");
53 writeb(1, rbtx4938_softresetlock_addr); 33 writeb(1, rbtx4938_softresetlock_addr);
54 writeb(1, rbtx4938_sfvol_addr); 34 writeb(1, rbtx4938_sfvol_addr);
55 writeb(1, rbtx4938_softreset_addr); 35 writeb(1, rbtx4938_softreset_addr);
56 while(1) 36 /* fallback */
57 ; 37 (*_machine_halt)();
58} 38}
59 39
60static void __init rbtx4938_pci_setup(void) 40static void __init rbtx4938_pci_setup(void)
@@ -263,8 +243,6 @@ static void __init rbtx4938_mem_setup(void)
263 printk("request resource for fpga failed\n"); 243 printk("request resource for fpga failed\n");
264 244
265 _machine_restart = rbtx4938_machine_restart; 245 _machine_restart = rbtx4938_machine_restart;
266 _machine_halt = rbtx4938_machine_halt;
267 pm_power_off = rbtx4938_machine_power_off;
268 246
269 writeb(0xff, rbtx4938_led_addr); 247 writeb(0xff, rbtx4938_led_addr);
270 printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", 248 printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",