reset.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License as published by the
  4. * Free Software Foundation; either version 2 of the License, or (at your
  5. * option) any later version.
  6. *
  7. * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
  8. * Author: Fuxin Zhang, zhangfx@lemote.com
  9. * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
  10. * Author: Zhangjin Wu, wuzj@lemote.com
  11. */
  12. #include <linux/init.h>
  13. #include <linux/pm.h>
  14. #include <asm/reboot.h>
  15. #include <loongson.h>
  16. static void loongson_restart(char *command)
  17. {
  18. /* do preparation for reboot */
  19. mach_prepare_reboot();
  20. /* reboot via jumping to boot base address */
  21. ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
  22. }
  23. static void loongson_halt(void)
  24. {
  25. mach_prepare_shutdown();
  26. while (1)
  27. ;
  28. }
  29. static int __init mips_reboot_setup(void)
  30. {
  31. _machine_restart = loongson_restart;
  32. _machine_halt = loongson_halt;
  33. pm_power_off = loongson_halt;
  34. return 0;
  35. }
  36. arch_initcall(mips_reboot_setup);