clock34xx.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * OMAP3-specific clock framework functions
  3. *
  4. * Copyright (C) 2007-2008 Texas Instruments, Inc.
  5. * Copyright (C) 2007-2010 Nokia Corporation
  6. *
  7. * Paul Walmsley
  8. * Jouni Högander
  9. *
  10. * Parts of this code are based on code written by
  11. * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu,
  12. * Russell King
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. */
  18. #undef DEBUG
  19. #include <linux/kernel.h>
  20. #include <linux/clk.h>
  21. #include <linux/io.h>
  22. #include <plat/clock.h>
  23. #include "clock.h"
  24. #include "clock34xx.h"
  25. #include "cm.h"
  26. #include "cm-regbits-34xx.h"
  27. /**
  28. * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
  29. * @clk: struct clk * being enabled
  30. * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
  31. * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
  32. * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
  33. *
  34. * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift
  35. * from the CM_{I,F}CLKEN bit. Pass back the correct info via
  36. * @idlest_reg and @idlest_bit. No return value.
  37. */
  38. static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
  39. void __iomem **idlest_reg,
  40. u8 *idlest_bit,
  41. u8 *idlest_val)
  42. {
  43. u32 r;
  44. r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
  45. *idlest_reg = (__force void __iomem *)r;
  46. *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
  47. *idlest_val = OMAP34XX_CM_IDLEST_VAL;
  48. }
  49. const struct clkops clkops_omap3430es2_ssi_wait = {
  50. .enable = omap2_dflt_clk_enable,
  51. .disable = omap2_dflt_clk_disable,
  52. .find_idlest = omap3430es2_clk_ssi_find_idlest,
  53. .find_companion = omap2_clk_dflt_find_companion,
  54. };
  55. /**
  56. * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
  57. * @clk: struct clk * being enabled
  58. * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
  59. * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
  60. * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
  61. *
  62. * Some OMAP modules on OMAP3 ES2+ chips have both initiator and
  63. * target IDLEST bits. For our purposes, we are concerned with the
  64. * target IDLEST bits, which exist at a different bit position than
  65. * the *CLKEN bit position for these modules (DSS and USBHOST) (The
  66. * default find_idlest code assumes that they are at the same
  67. * position.) No return value.
  68. */
  69. static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
  70. void __iomem **idlest_reg,
  71. u8 *idlest_bit,
  72. u8 *idlest_val)
  73. {
  74. u32 r;
  75. r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
  76. *idlest_reg = (__force void __iomem *)r;
  77. /* USBHOST_IDLE has same shift */
  78. *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
  79. *idlest_val = OMAP34XX_CM_IDLEST_VAL;
  80. }
  81. const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
  82. .enable = omap2_dflt_clk_enable,
  83. .disable = omap2_dflt_clk_disable,
  84. .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
  85. .find_companion = omap2_clk_dflt_find_companion,
  86. };
  87. /**
  88. * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
  89. * @clk: struct clk * being enabled
  90. * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
  91. * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
  92. * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
  93. *
  94. * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different
  95. * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
  96. * @idlest_reg and @idlest_bit. No return value.
  97. */
  98. static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
  99. void __iomem **idlest_reg,
  100. u8 *idlest_bit,
  101. u8 *idlest_val)
  102. {
  103. u32 r;
  104. r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
  105. *idlest_reg = (__force void __iomem *)r;
  106. *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
  107. *idlest_val = OMAP34XX_CM_IDLEST_VAL;
  108. }
  109. const struct clkops clkops_omap3430es2_hsotgusb_wait = {
  110. .enable = omap2_dflt_clk_enable,
  111. .disable = omap2_dflt_clk_disable,
  112. .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
  113. .find_companion = omap2_clk_dflt_find_companion,
  114. };