clkt2xxx_dpll.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * OMAP2-specific DPLL control functions
  3. *
  4. * Copyright (C) 2011 Nokia Corporation
  5. * Paul Walmsley
  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 version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/errno.h>
  13. #include <linux/clk.h>
  14. #include <linux/io.h>
  15. #include "clock.h"
  16. #include "cm2xxx.h"
  17. #include "cm-regbits-24xx.h"
  18. /* Private functions */
  19. /**
  20. * _allow_idle - enable DPLL autoidle bits
  21. * @clk: struct clk * of the DPLL to operate on
  22. *
  23. * Enable DPLL automatic idle control. The DPLL will enter low-power
  24. * stop when its downstream clocks are gated. No return value.
  25. * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
  26. * instead. Add some mechanism to optionally enter this mode.
  27. */
  28. #ifdef CONFIG_COMMON_CLK
  29. static void _allow_idle(struct clk_hw_omap *clk)
  30. #else
  31. static void _allow_idle(struct clk *clk)
  32. #endif
  33. {
  34. if (!clk || !clk->dpll_data)
  35. return;
  36. omap2xxx_cm_set_dpll_auto_low_power_stop();
  37. }
  38. /**
  39. * _deny_idle - prevent DPLL from automatically idling
  40. * @clk: struct clk * of the DPLL to operate on
  41. *
  42. * Disable DPLL automatic idle control. No return value.
  43. */
  44. #ifdef CONFIG_COMMON_CLK
  45. static void _deny_idle(struct clk_hw_omap *clk)
  46. #else
  47. static void _deny_idle(struct clk *clk)
  48. #endif
  49. {
  50. if (!clk || !clk->dpll_data)
  51. return;
  52. omap2xxx_cm_set_dpll_disable_autoidle();
  53. }
  54. /* Public data */
  55. #ifdef CONFIG_COMMON_CLK
  56. const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
  57. .allow_idle = _allow_idle,
  58. .deny_idle = _deny_idle,
  59. };
  60. #else
  61. const struct clkops clkops_omap2xxx_dpll_ops = {
  62. .allow_idle = _allow_idle,
  63. .deny_idle = _deny_idle,
  64. };
  65. #endif