reset.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <asm/mach-cobalt/cobalt.h>
  20. void cobalt_machine_halt(void)
  21. {
  22. int state, last, diff;
  23. unsigned long mark;
  24. /*
  25. * turn off bar on Qube, flash power off LED on RaQ (0.5Hz)
  26. *
  27. * restart if ENTER and SELECT are pressed
  28. */
  29. last = COBALT_KEY_PORT;
  30. for (state = 0;;) {
  31. state ^= COBALT_LED_POWER_OFF;
  32. COBALT_LED_PORT = state;
  33. diff = COBALT_KEY_PORT ^ last;
  34. last ^= diff;
  35. if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)))
  36. COBALT_LED_PORT = COBALT_LED_RESET;
  37. for (mark = jiffies; jiffies - mark < HZ;)
  38. ;
  39. }
  40. }
  41. void cobalt_machine_restart(char *command)
  42. {
  43. COBALT_LED_PORT = COBALT_LED_RESET;
  44. /* we should never get here */
  45. cobalt_machine_halt();
  46. }
  47. /*
  48. * This triggers the luser mode device driver for the power switch ;-)
  49. */
  50. void cobalt_machine_power_off(void)
  51. {
  52. printk("You can switch the machine off now.\n");
  53. cobalt_machine_halt();
  54. }