clock-pxa2xx.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/sysdev.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(struct sys_device *d, pm_message_t state)
  29. {
  30. saved_cken = CKEN;
  31. return 0;
  32. }
  33. static int pxa2xx_clock_resume(struct sys_device *d)
  34. {
  35. CKEN = saved_cken;
  36. return 0;
  37. }
  38. #else
  39. #define pxa2xx_clock_suspend NULL
  40. #define pxa2xx_clock_resume NULL
  41. #endif
  42. struct sysdev_class pxa2xx_clock_sysclass = {
  43. .name = "pxa2xx-clock",
  44. .suspend = pxa2xx_clock_suspend,
  45. .resume = pxa2xx_clock_resume,
  46. };
  47. static int __init pxa2xx_clock_init(void)
  48. {
  49. if (cpu_is_pxa2xx())
  50. return sysdev_class_register(&pxa2xx_clock_sysclass);
  51. return 0;
  52. }
  53. postcore_initcall(pxa2xx_clock_init);