Linux 2.6.17.7
[linux/fpc-iii.git] / arch / mips / jazz / reset.c
blob2a9754750bc87859a8349630efdf4d8ccef63115
1 /*
2 * Reset a Jazz machine.
4 * We don't trust the firmware so we do it the classic way by poking and
5 * stabbing at the keyboard controller ...
6 */
7 #include <linux/jiffies.h>
8 #include <asm/jazz.h>
9 #include <asm/io.h>
10 #include <asm/system.h>
11 #include <asm/reboot.h>
12 #include <asm/delay.h>
14 #define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
16 static void jazz_write_output(unsigned char val)
18 int status;
20 do {
21 status = jazz_kh->command;
22 } while (status & KBD_STAT_IBF);
23 jazz_kh->data = val;
26 static void jazz_write_command(unsigned char val)
28 int status;
30 do {
31 status = jazz_kh->command;
32 } while (status & KBD_STAT_IBF);
33 jazz_kh->command = val;
36 static unsigned char jazz_read_status(void)
38 return jazz_kh->command;
41 static inline void kb_wait(void)
43 unsigned long start = jiffies;
44 unsigned long timeout = start + HZ/2;
46 do {
47 if (! (jazz_read_status() & 0x02))
48 return;
49 } while (time_before_eq(jiffies, timeout));
52 void jazz_machine_restart(char *command)
54 while(1) {
55 kb_wait();
56 jazz_write_command (0xd1);
57 kb_wait();
58 jazz_write_output (0x00);
62 void jazz_machine_halt(void)
66 void jazz_machine_power_off(void)
68 /* Jazz machines don't have a software power switch */