reset.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * reset.c -- common ColdFire SoC reset support
  3. *
  4. * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org>
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file COPYING in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/io.h>
  13. #include <asm/machdep.h>
  14. #include <asm/coldfire.h>
  15. #include <asm/mcfsim.h>
  16. /*
  17. * There are 2 common methods amongst the ColdFure parts for reseting
  18. * the CPU. But there are couple of exceptions, the 5272 and the 547x
  19. * have something completely special to them, and we let their specific
  20. * subarch code handle them.
  21. */
  22. #ifdef MCFSIM_SYPCR
  23. static void mcf_cpu_reset(void)
  24. {
  25. local_irq_disable();
  26. /* Set watchdog to soft reset, and enabled */
  27. __raw_writeb(0xc0, MCFSIM_SYPCR);
  28. for (;;)
  29. /* wait for watchdog to timeout */;
  30. }
  31. #endif
  32. #ifdef MCF_RCR
  33. static void mcf_cpu_reset(void)
  34. {
  35. local_irq_disable();
  36. __raw_writeb(MCF_RCR_SWRESET, MCF_RCR);
  37. }
  38. #endif
  39. static int __init mcf_setup_reset(void)
  40. {
  41. mach_reset = mcf_cpu_reset;
  42. return 0;
  43. }
  44. arch_initcall(mcf_setup_reset);