reset.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Thomas Horsten <thh@lasat.com>
  3. * Copyright (C) 2000 LASAT Networks A/S.
  4. *
  5. * This program is free software; you can distribute it and/or modify it
  6. * under the terms of the GNU General Public License (Version 2) as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  17. *
  18. * Reset the LASAT board.
  19. */
  20. #include <linux/config.h>
  21. #include <linux/kernel.h>
  22. #include <asm/reboot.h>
  23. #include <asm/system.h>
  24. #include <asm/lasat/lasat.h>
  25. #include "picvue.h"
  26. #include "prom.h"
  27. static void lasat_machine_restart(char *command);
  28. static void lasat_machine_halt(void);
  29. /* Used to set machine to boot in service mode via /proc interface */
  30. int lasat_boot_to_service = 0;
  31. static void lasat_machine_restart(char *command)
  32. {
  33. local_irq_disable();
  34. if (lasat_boot_to_service) {
  35. printk("machine_restart: Rebooting to service mode\n");
  36. *(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
  37. *(volatile unsigned int *)0xa00000fc = 0xfedeabba;
  38. }
  39. *lasat_misc->reset_reg = 0xbedead;
  40. for (;;) ;
  41. }
  42. #define MESSAGE "System halted"
  43. static void lasat_machine_halt(void)
  44. {
  45. local_irq_disable();
  46. /* Disable interrupts and loop forever */
  47. printk(KERN_NOTICE MESSAGE "\n");
  48. #ifdef CONFIG_PICVUE
  49. pvc_clear();
  50. pvc_write_string(MESSAGE, 0, 0);
  51. #endif
  52. prom_monitor();
  53. for (;;) ;
  54. }
  55. void lasat_reboot_setup(void)
  56. {
  57. _machine_restart = lasat_machine_restart;
  58. _machine_halt = lasat_machine_halt;
  59. _machine_power_off = lasat_machine_halt;
  60. }