system.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 1999 ARM Limited
  3. * Copyright (C) 2000 Deep Blue Solutions Ltd
  4. * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  5. * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/clk.h>
  23. #include <linux/io.h>
  24. #include <mach/hardware.h>
  25. #include <asm/proc-fns.h>
  26. #include <asm/system.h>
  27. /*
  28. * Put the CPU into idle mode. It is called by default_idle()
  29. * in process.c file.
  30. */
  31. void arch_idle(void)
  32. {
  33. /*
  34. * This should do all the clock switching
  35. * and wait for interrupt tricks.
  36. */
  37. cpu_do_idle();
  38. }
  39. #define WDOG_WCR_REG IO_ADDRESS(WDOG_BASE_ADDR)
  40. #define WDOG_WCR_SRS (1 << 4)
  41. /*
  42. * Reset the system. It is called by machine_restart().
  43. */
  44. void arch_reset(char mode)
  45. {
  46. struct clk *clk;
  47. clk = clk_get(NULL, "wdog_clk");
  48. if (!clk) {
  49. printk(KERN_ERR"Cannot activate the watchdog. Giving up\n");
  50. return;
  51. }
  52. clk_enable(clk);
  53. /* Assert SRS signal */
  54. __raw_writew(__raw_readw(WDOG_WCR_REG) & ~WDOG_WCR_SRS, WDOG_WCR_REG);
  55. }