sead3-reset.c 916 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
  7. */
  8. #include <linux/io.h>
  9. #include <linux/pm.h>
  10. #include <asm/reboot.h>
  11. #define SOFTRES_REG 0x1f000050
  12. #define GORESET 0x4d
  13. static void mips_machine_restart(char *command)
  14. {
  15. unsigned int __iomem *softres_reg =
  16. ioremap(SOFTRES_REG, sizeof(unsigned int));
  17. __raw_writel(GORESET, softres_reg);
  18. }
  19. static void mips_machine_halt(void)
  20. {
  21. unsigned int __iomem *softres_reg =
  22. ioremap(SOFTRES_REG, sizeof(unsigned int));
  23. __raw_writel(GORESET, softres_reg);
  24. }
  25. static int __init mips_reboot_setup(void)
  26. {
  27. _machine_restart = mips_machine_restart;
  28. _machine_halt = mips_machine_halt;
  29. pm_power_off = mips_machine_halt;
  30. return 0;
  31. }
  32. arch_initcall(mips_reboot_setup);