Blame view

arch/mips/sni/reset.c 950 Bytes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  /*
   *  linux/arch/mips/sni/process.c
   *
   *  Reset a SNI machine.
   */
  #include <asm/io.h>
  #include <asm/reboot.h>
  #include <asm/system.h>
  #include <asm/sni.h>
  
  /*
   * This routine reboots the machine by asking the keyboard
   * controller to pulse the reset-line low. We try that for a while,
   * and if it doesn't work, we do some other stupid things.
   */
c066a32a8   Thomas Bogendoerfer   [MIPS] Support fo...
16
  static inline void kb_wait(void)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
  {
  	int i;
c066a32a8   Thomas Bogendoerfer   [MIPS] Support fo...
19
  	for (i = 0; i < 0x10000; i++)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
30
31
32
  		if ((inb_p(0x64) & 0x02) == 0)
  			break;
  }
  
  /* XXX This ends up at the ARC firmware prompt ...  */
  void sni_machine_restart(char *command)
  {
  	int i, j;
  
  	/* This does a normal via the keyboard controller like a PC.
  	   We can do that easier ...  */
  	local_irq_disable();
  	for (;;) {
c066a32a8   Thomas Bogendoerfer   [MIPS] Support fo...
33
  		for (i = 0; i < 100; i++) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34
  			kb_wait();
c066a32a8   Thomas Bogendoerfer   [MIPS] Support fo...
35
  			for (j = 0; j < 100000 ; j++)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36
  				/* nothing */;
21a151d8c   Ralf Baechle   [MIPS] checkfiles...
37
  			outb_p(0xfe, 0x64);	 /* pulse reset low */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
39
40
  		}
  	}
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
44
  void sni_machine_power_off(void)
  {
  	*(volatile unsigned char *)PCIMT_CSWCSM = 0xfd;
  }