reset.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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) 1997, 2001 Ralf Baechle
  8. * Copyright 2001 MontaVista Software Inc.
  9. * Author: jsun@mvista.com or jsun@junsun.net
  10. */
  11. #include <linux/sched.h>
  12. #include <linux/mm.h>
  13. #include <asm/io.h>
  14. #include <asm/pgtable.h>
  15. #include <asm/processor.h>
  16. #include <asm/reboot.h>
  17. #include <asm/system.h>
  18. #include <linux/delay.h>
  19. void momenco_ocelot_restart(char *command)
  20. {
  21. void *nvram = ioremap_nocache(0x2c807000, 0x1000);
  22. if (!nvram) {
  23. printk(KERN_NOTICE "ioremap of reset register failed\n");
  24. return;
  25. }
  26. writeb(0x84, nvram + 0xff7); /* Ask the NVRAM/RTC/watchdog chip to
  27. assert reset in 1/16 second */
  28. mdelay(10+(1000/16));
  29. iounmap(nvram);
  30. printk(KERN_NOTICE "Watchdog reset failed\n");
  31. }
  32. void momenco_ocelot_halt(void)
  33. {
  34. printk(KERN_NOTICE "\n** You can safely turn off the power\n");
  35. while (1)
  36. __asm__(".set\tmips3\n\t"
  37. "wait\n\t"
  38. ".set\tmips0");
  39. }
  40. void momenco_ocelot_power_off(void)
  41. {
  42. momenco_ocelot_halt();
  43. }