memoryCall.c 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*
  2. * linux/arch/arm/mach-omap1/clock_data.c
  3. *
  4. * Copyright (C) 2004 - 2005, 2009-2010 Nokia Corporation
  5. * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
  6. * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
  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. * To do:
  13. * - Clocks that are only available on some chips should be marked with the
  14. * chips that they are present on.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/io.h>
  18. #include <linux/clk.h>
  19. #include <linux/cpufreq.h>
  20. #include <linux/delay.h>
  21. #include <asm/mach-types.h> /* for machine_is_* */
  22. #include "soc.h"
  23. #include <mach/hardware.h>
  24. #include <mach/usb.h> /* for OTG_BASE */
  25. #include "iomap.h"
  26. #include "clock.h"
  27. #include "sram.h"
  28. /* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
  29. #define IDL_CLKOUT_ARM_SHIFT 12
  30. #define IDLTIM_ARM_SHIFT 9
  31. #define IDLAPI_ARM_SHIFT 8
  32. #define IDLIF_ARM_SHIFT 6
  33. #define IDLLB_ARM_SHIFT 4 /* undocumented? */
  34. #define OMAP1510_IDLLCD_ARM_SHIFT 3 /* undocumented? */
  35. #define IDLPER_ARM_SHIFT 2
  36. #define IDLXORP_ARM_SHIFT 1
  37. #define IDLWDT_ARM_SHIFT 0
  38. /* Some MOD_CONF_CTRL_0 bit shifts - used in struct clk.enable_bit */
  39. #define CONF_MOD_UART3_CLK_MODE_R 31
  40. #define CONF_MOD_UART2_CLK_MODE_R 30
  41. #define CONF_MOD_UART1_CLK_MODE_R 29
  42. #define CONF_MOD_MMC_SD_CLK_REQ_R 23
  43. #define CONF_MOD_MCBSP3_AUXON 20
  44. /* Some MOD_CONF_CTRL_1 bit shifts - used in struct clk.enable_bit */
  45. #define CONF_MOD_SOSSI_CLK_EN_R 16
  46. /* Some OTG_SYSCON_2-specific bit fields */
  47. #define OTG_SYSCON_2_UHOST_EN_SHIFT 8
  48. /* Some SOFT_REQ_REG bit fields - used in struct clk.enable_bit */
  49. #define SOFT_MMC2_DPLL_REQ_SHIFT 13
  50. #define SOFT_MMC_DPLL_REQ_SHIFT 12
  51. #define SOFT_UART3_DPLL_REQ_SHIFT 11
  52. #define SOFT_UART2_DPLL_REQ_SHIFT 10
  53. #define SOFT_UART1_DPLL_REQ_SHIFT 9
  54. #define SOFT_USB_OTG_DPLL_REQ_SHIFT 8
  55. #define SOFT_CAM_DPLL_REQ_SHIFT 7
  56. #define SOFT_COM_MCKO_REQ_SHIFT 6
  57. #define SOFT_PERIPH_REQ_SHIFT 5 /* sys_ck gate for UART2 ? */
  58. #define USB_REQ_EN_SHIFT 4
  59. #define SOFT_USB_REQ_SHIFT 3 /* sys_ck gate for USB host? */
  60. #define SOFT_SDW_REQ_SHIFT 2 /* sys_ck gate for Bluetooth? */
  61. #define SOFT_COM_REQ_SHIFT 1 /* sys_ck gate for com proc? */
  62. #define SOFT_DPLL_REQ_SHIFT 0
  63. /*
  64. * Omap1 clocks
  65. */
  66. static struct clk ck_ref = {
  67. .name = "ck_ref",
  68. .ops = &clkops_null,
  69. .rate = 12000000,
  70. };
  71. static struct clk ck_dpll1 = {
  72. .name = "ck_dpll1",
  73. .ops = &clkops_null,
  74. .parent = &ck_ref,
  75. };
  76. /*
  77. * FIXME: This clock seems to be necessary but no-one has asked for its
  78. * activation. [ FIX: SoSSI, SSR ]
  79. */
  80. static struct arm_idlect1_clk ck_dpll1out = {
  81. .clk = {
  82. .name = "ck_dpll1out",
  83. .ops = &clkops_generic,
  84. .parent = &ck_dpll1,
  85. .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
  86. ENABLE_ON_INIT,
  87. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  88. .enable_bit = EN_CKOUT_ARM,
  89. .recalc = &followparent_recalc,
  90. },
  91. .idlect_shift = IDL_CLKOUT_ARM_SHIFT,
  92. };
  93. static struct clk sossi_ck = {
  94. .name = "ck_sossi",
  95. .ops = &clkops_generic,
  96. .parent = &ck_dpll1out.clk,
  97. .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
  98. .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
  99. .enable_bit = CONF_MOD_SOSSI_CLK_EN_R,
  100. .recalc = &omap1_sossi_recalc,
  101. .set_rate = &omap1_set_sossi_rate,
  102. };
  103. static struct clk arm_ck = {
  104. .name = "arm_ck",
  105. .ops = &clkops_null,
  106. .parent = &ck_dpll1,
  107. .rate_offset = CKCTL_ARMDIV_OFFSET,
  108. .recalc = &omap1_ckctl_recalc,
  109. .round_rate = omap1_clk_round_rate_ckctl_arm,
  110. .set_rate = omap1_clk_set_rate_ckctl_arm,
  111. };
  112. static struct arm_idlect1_clk armper_ck = {
  113. .clk = {
  114. .name = "armper_ck",
  115. .ops = &clkops_generic,
  116. .parent = &ck_dpll1,
  117. .flags = CLOCK_IDLE_CONTROL,
  118. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  119. .enable_bit = EN_PERCK,
  120. .rate_offset = CKCTL_PERDIV_OFFSET,
  121. .recalc = &omap1_ckctl_recalc,
  122. .round_rate = omap1_clk_round_rate_ckctl_arm,
  123. .set_rate = omap1_clk_set_rate_ckctl_arm,
  124. },
  125. .idlect_shift = IDLPER_ARM_SHIFT,
  126. };
  127. /*
  128. * FIXME: This clock seems to be necessary but no-one has asked for its
  129. * activation. [ GPIO code for 1510 ]
  130. */
  131. static struct clk arm_gpio_ck = {
  132. .name = "ick",
  133. .ops = &clkops_generic,
  134. .parent = &ck_dpll1,
  135. .flags = ENABLE_ON_INIT,
  136. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  137. .enable_bit = EN_GPIOCK,
  138. .recalc = &followparent_recalc,
  139. };
  140. static struct arm_idlect1_clk armxor_ck = {
  141. .clk = {
  142. .name = "armxor_ck",
  143. .ops = &clkops_generic,
  144. .parent = &ck_ref,
  145. .flags = CLOCK_IDLE_CONTROL,
  146. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  147. .enable_bit = EN_XORPCK,
  148. .recalc = &followparent_recalc,
  149. },
  150. .idlect_shift = IDLXORP_ARM_SHIFT,
  151. };
  152. static struct arm_idlect1_clk armtim_ck = {
  153. .clk = {
  154. .name = "armtim_ck",
  155. .ops = &clkops_generic,
  156. .parent = &ck_ref,
  157. .flags = CLOCK_IDLE_CONTROL,
  158. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  159. .enable_bit = EN_TIMCK,
  160. .recalc = &followparent_recalc,
  161. },
  162. .idlect_shift = IDLTIM_ARM_SHIFT,
  163. };
  164. static struct arm_idlect1_clk armwdt_ck = {
  165. .clk = {
  166. .name = "armwdt_ck",
  167. .ops = &clkops_generic,
  168. .parent = &ck_ref,
  169. .flags = CLOCK_IDLE_CONTROL,
  170. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  171. .enable_bit = EN_WDTCK,
  172. .fixed_div = 14,
  173. .recalc = &omap_fixed_divisor_recalc,
  174. },
  175. .idlect_shift = IDLWDT_ARM_SHIFT,
  176. };
  177. static struct clk arminth_ck16xx = {
  178. .name = "arminth_ck",
  179. .ops = &clkops_null,
  180. .parent = &arm_ck,
  181. .recalc = &followparent_recalc,
  182. /* Note: On 16xx the frequency can be divided by 2 by programming
  183. * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
  184. *
  185. * 1510 version is in TC clocks.
  186. */
  187. };
  188. static struct clk dsp_ck = {
  189. .name = "dsp_ck",
  190. .ops = &clkops_generic,
  191. .parent = &ck_dpll1,
  192. .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL),
  193. .enable_bit = EN_DSPCK,
  194. .rate_offset = CKCTL_DSPDIV_OFFSET,
  195. .recalc = &omap1_ckctl_recalc,
  196. .round_rate = omap1_clk_round_rate_ckctl_arm,
  197. .set_rate = omap1_clk_set_rate_ckctl_arm,
  198. };
  199. static struct clk dspmmu_ck = {
  200. .name = "dspmmu_ck",
  201. .ops = &clkops_null,
  202. .parent = &ck_dpll1,
  203. .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
  204. .recalc = &omap1_ckctl_recalc,
  205. .round_rate = omap1_clk_round_rate_ckctl_arm,
  206. .set_rate = omap1_clk_set_rate_ckctl_arm,
  207. };
  208. static struct clk dspper_ck = {
  209. .name = "dspper_ck",
  210. .ops = &clkops_dspck,
  211. .parent = &ck_dpll1,
  212. .enable_reg = DSP_IDLECT2,
  213. .enable_bit = EN_PERCK,
  214. .rate_offset = CKCTL_PERDIV_OFFSET,
  215. .recalc = &omap1_ckctl_recalc_dsp_domain,
  216. .round_rate = omap1_clk_round_rate_ckctl_arm,
  217. .set_rate = &omap1_clk_set_rate_dsp_domain,
  218. };
  219. static struct clk dspxor_ck = {
  220. .name = "dspxor_ck",
  221. .ops = &clkops_dspck,
  222. .parent = &ck_ref,
  223. .enable_reg = DSP_IDLECT2,
  224. .enable_bit = EN_XORPCK,
  225. .recalc = &followparent_recalc,
  226. };
  227. static struct clk dsptim_ck = {
  228. .name = "dsptim_ck",
  229. .ops = &clkops_dspck,
  230. .parent = &ck_ref,
  231. .enable_reg = DSP_IDLECT2,
  232. .enable_bit = EN_DSPTIMCK,
  233. .recalc = &followparent_recalc,
  234. };
  235. static struct arm_idlect1_clk tc_ck = {
  236. .clk = {
  237. .name = "tc_ck",
  238. .ops = &clkops_null,
  239. .parent = &ck_dpll1,
  240. .flags = CLOCK_IDLE_CONTROL,
  241. .rate_offset = CKCTL_TCDIV_OFFSET,
  242. .recalc = &omap1_ckctl_recalc,
  243. .round_rate = omap1_clk_round_rate_ckctl_arm,
  244. .set_rate = omap1_clk_set_rate_ckctl_arm,
  245. },
  246. .idlect_shift = IDLIF_ARM_SHIFT,
  247. };
  248. static struct clk arminth_ck1510 = {
  249. .name = "arminth_ck",
  250. .ops = &clkops_null,
  251. .parent = &tc_ck.clk,
  252. .recalc = &followparent_recalc,
  253. /* Note: On 1510 the frequency follows TC_CK
  254. *
  255. * 16xx version is in MPU clocks.
  256. */
  257. };