reset.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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);