reset.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <linux/io.h>
  15. #include <asm/reboot.h>
  16. #include <asm/mips-boards/bonito64.h>
  17. static void loongson2e_restart(char *command)
  18. {
  19. /* do preparation for reboot */
  20. BONITO_BONGENCFG &= ~(1 << 2);
  21. BONITO_BONGENCFG |= (1 << 2);
  22. /* reboot via jumping to boot base address */
  23. ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
  24. }
  25. static void loongson2e_halt(void)
  26. {
  27. while (1) ;
  28. }
  29. static int __init mips_reboot_setup(void)
  30. {
  31. _machine_restart = loongson2e_restart;
  32. _machine_halt = loongson2e_halt;
  33. pm_power_off = loongson2e_halt;
  34. return 0;
  35. }
  36. arch_initcall(mips_reboot_setup);