clock-pxa2xx.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * linux/arch/arm/mach-pxa/clock-pxa2xx.c
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/module.h>
  9. #include <linux/kernel.h>
  10. #include <linux/init.h>
  11. #include <linux/syscore_ops.h>
  12. #include <mach/pxa2xx-regs.h>
  13. #include "clock.h"
  14. void clk_pxa2xx_cken_enable(struct clk *clk)
  15. {
  16. CKEN |= 1 << clk->cken;
  17. }
  18. void clk_pxa2xx_cken_disable(struct clk *clk)
  19. {
  20. CKEN &= ~(1 << clk->cken);
  21. }
  22. const struct clkops clk_pxa2xx_cken_ops = {
  23. .enable = clk_pxa2xx_cken_enable,
  24. .disable = clk_pxa2xx_cken_disable,
  25. };
  26. #ifdef CONFIG_PM
  27. static uint32_t saved_cken;
  28. static int pxa2xx_clock_suspend(void)
  29. {
  30. saved_cken = CKEN;
  31. return 0;
  32. }
  33. static void pxa2xx_clock_resume(void)
  34. {
  35. CKEN = saved_cken;
  36. }
  37. #else
  38. #define pxa2xx_clock_suspend NULL
  39. #define pxa2xx_clock_resume NULL
  40. #endif
  41. struct syscore_ops pxa2xx_clock_syscore_ops = {
  42. .suspend = pxa2xx_clock_suspend,
  43. .resume = pxa2xx_clock_resume,
  44. };