aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/jazz/reset.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/jazz/reset.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/jazz/reset.c')
-rw-r--r--arch/mips/jazz/reset.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/arch/mips/jazz/reset.c b/arch/mips/jazz/reset.c
new file mode 100644
index 000000000000..2a9754750bc8
--- /dev/null
+++ b/arch/mips/jazz/reset.c
@@ -0,0 +1,69 @@
1/*
2 * Reset a Jazz machine.
3 *
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>
13
14#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
15
16static void jazz_write_output(unsigned char val)
17{
18 int status;
19
20 do {
21 status = jazz_kh->command;
22 } while (status & KBD_STAT_IBF);
23 jazz_kh->data = val;
24}
25
26static void jazz_write_command(unsigned char val)
27{
28 int status;
29
30 do {
31 status = jazz_kh->command;
32 } while (status & KBD_STAT_IBF);
33 jazz_kh->command = val;
34}
35
36static unsigned char jazz_read_status(void)
37{
38 return jazz_kh->command;
39}
40
41static inline void kb_wait(void)
42{
43 unsigned long start = jiffies;
44 unsigned long timeout = start + HZ/2;
45
46 do {
47 if (! (jazz_read_status() & 0x02))
48 return;
49 } while (time_before_eq(jiffies, timeout));
50}
51
52void jazz_machine_restart(char *command)
53{
54 while(1) {
55 kb_wait();
56 jazz_write_command (0xd1);
57 kb_wait();
58 jazz_write_output (0x00);
59 }
60}
61
62void jazz_machine_halt(void)
63{
64}
65
66void jazz_machine_power_off(void)
67{
68 /* Jazz machines don't have a software power switch */
69}