system.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* arch/arm/mach-s3c2410/include/mach/system.h
  2. *
  3. * Copyright (c) 2003 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 - System function defines and includes
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/io.h>
  13. #include <mach/hardware.h>
  14. #include <mach/map.h>
  15. #include <mach/idle.h>
  16. #include <mach/reset.h>
  17. #include <mach/regs-clock.h>
  18. void (*s3c24xx_idle)(void);
  19. void (*s3c24xx_reset_hook)(void);
  20. void s3c24xx_default_idle(void)
  21. {
  22. unsigned long tmp;
  23. int i;
  24. /* idle the system by using the idle mode which will wait for an
  25. * interrupt to happen before restarting the system.
  26. */
  27. /* Warning: going into idle state upsets jtag scanning */
  28. __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
  29. S3C2410_CLKCON);
  30. /* the samsung port seems to do a loop and then unset idle.. */
  31. for (i = 0; i < 50; i++) {
  32. tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
  33. }
  34. /* this bit is not cleared on re-start... */
  35. __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
  36. S3C2410_CLKCON);
  37. }
  38. static void arch_idle(void)
  39. {
  40. if (s3c24xx_idle != NULL)
  41. (s3c24xx_idle)();
  42. else
  43. s3c24xx_default_idle();
  44. }
  45. #include <mach/system-reset.h>