system.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/regs-clock.h>
  17. void (*s3c24xx_idle)(void);
  18. void s3c24xx_default_idle(void)
  19. {
  20. unsigned long tmp;
  21. int i;
  22. /* idle the system by using the idle mode which will wait for an
  23. * interrupt to happen before restarting the system.
  24. */
  25. /* Warning: going into idle state upsets jtag scanning */
  26. __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
  27. S3C2410_CLKCON);
  28. /* the samsung port seems to do a loop and then unset idle.. */
  29. for (i = 0; i < 50; i++) {
  30. tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
  31. }
  32. /* this bit is not cleared on re-start... */
  33. __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
  34. S3C2410_CLKCON);
  35. }
  36. static void arch_idle(void)
  37. {
  38. if (s3c24xx_idle != NULL)
  39. (s3c24xx_idle)();
  40. else
  41. s3c24xx_default_idle();
  42. }