reset.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Cobalt Reset operations
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1995, 1996, 1997 by Ralf Baechle
  9. * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv)
  10. */
  11. #include <linux/sched.h>
  12. #include <linux/mm.h>
  13. #include <asm/cacheflush.h>
  14. #include <asm/io.h>
  15. #include <asm/processor.h>
  16. #include <asm/reboot.h>
  17. #include <asm/system.h>
  18. #include <asm/mipsregs.h>
  19. void cobalt_machine_restart(char *command)
  20. {
  21. *(volatile char *)0xbc000000 = 0x0f;
  22. /*
  23. * Ouch, we're still alive ... This time we take the silver bullet ...
  24. * ... and find that we leave the hardware in a state in which the
  25. * kernel in the flush locks up somewhen during of after the PCI
  26. * detection stuff.
  27. */
  28. set_c0_status(ST0_BEV | ST0_ERL);
  29. change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
  30. flush_cache_all();
  31. write_c0_wired(0);
  32. __asm__ __volatile__(
  33. "jr\t%0"
  34. :
  35. : "r" (0xbfc00000));
  36. }
  37. extern int led_state;
  38. #define kLED 0xBC000000
  39. #define LEDSet(x) (*(volatile unsigned char *) kLED) = (( unsigned char)x)
  40. void cobalt_machine_halt(void)
  41. {
  42. int mark;
  43. /* Blink our cute? little LED (number 3)... */
  44. while (1) {
  45. led_state = led_state | ( 1 << 3 );
  46. LEDSet(led_state);
  47. mark = jiffies;
  48. while (jiffies<(mark+HZ));
  49. led_state = led_state & ~( 1 << 3 );
  50. LEDSet(led_state);
  51. mark = jiffies;
  52. while (jiffies<(mark+HZ));
  53. }
  54. }
  55. /*
  56. * This triggers the luser mode device driver for the power switch ;-)
  57. */
  58. void cobalt_machine_power_off(void)
  59. {
  60. printk("You can switch the machine off now.\n");
  61. cobalt_machine_halt();
  62. }