blob: 58879f0b79499f63225a83cb5d728109f56b3a15 [file] [log] [blame]
Tero Kristoaafd9002013-08-02 14:04:19 +03001/*
2 * OMAP3 Clock init
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc
5 * Tero Kristo (t-kristo@ti.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-provider.h>
20#include <linux/clk/ti.h>
21
Tero Kristoa5aa8a62015-03-03 10:51:01 +020022#include "clock.h"
Tero Kristoaafd9002013-08-02 14:04:19 +030023
Tero Kristo0565fb12015-03-03 13:27:48 +020024/*
25 * DPLL5_FREQ_FOR_USBHOST: USBHOST and USBTLL are the only clocks
26 * that are sourced by DPLL5, and both of these require this clock
27 * to be at 120 MHz for proper operation.
28 */
29#define DPLL5_FREQ_FOR_USBHOST 120000000
30
Tero Kristof2671d52015-03-03 17:28:12 +020031#define OMAP3430ES2_ST_DSS_IDLE_SHIFT 1
32#define OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT 5
33#define OMAP3430ES2_ST_SSI_IDLE_SHIFT 8
34
35#define OMAP34XX_CM_IDLEST_VAL 1
36
37/**
38 * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
39 * @clk: struct clk * being enabled
40 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
41 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
42 * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
43 *
44 * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift
45 * from the CM_{I,F}CLKEN bit. Pass back the correct info via
46 * @idlest_reg and @idlest_bit. No return value.
47 */
48static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
49 void __iomem **idlest_reg,
50 u8 *idlest_bit,
51 u8 *idlest_val)
52{
53 u32 r;
54
55 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
56 *idlest_reg = (__force void __iomem *)r;
57 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
58 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
59}
60
61const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
62 .find_idlest = omap3430es2_clk_ssi_find_idlest,
63 .find_companion = omap2_clk_dflt_find_companion,
64};
65
66const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
67 .allow_idle = omap2_clkt_iclk_allow_idle,
68 .deny_idle = omap2_clkt_iclk_deny_idle,
69 .find_idlest = omap3430es2_clk_ssi_find_idlest,
70 .find_companion = omap2_clk_dflt_find_companion,
71};
72
73/**
74 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
75 * @clk: struct clk * being enabled
76 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
77 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
78 * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
79 *
80 * Some OMAP modules on OMAP3 ES2+ chips have both initiator and
81 * target IDLEST bits. For our purposes, we are concerned with the
82 * target IDLEST bits, which exist at a different bit position than
83 * the *CLKEN bit position for these modules (DSS and USBHOST) (The
84 * default find_idlest code assumes that they are at the same
85 * position.) No return value.
86 */
87static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
88 void __iomem **idlest_reg,
89 u8 *idlest_bit,
90 u8 *idlest_val)
91{
92 u32 r;
93
94 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
95 *idlest_reg = (__force void __iomem *)r;
96 /* USBHOST_IDLE has same shift */
97 *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
98 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
99}
100
101const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
102 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
103 .find_companion = omap2_clk_dflt_find_companion,
104};
105
106const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
107 .allow_idle = omap2_clkt_iclk_allow_idle,
108 .deny_idle = omap2_clkt_iclk_deny_idle,
109 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
110 .find_companion = omap2_clk_dflt_find_companion,
111};
112
113/**
114 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
115 * @clk: struct clk * being enabled
116 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
117 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
118 * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
119 *
120 * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different
121 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
122 * @idlest_reg and @idlest_bit. No return value.
123 */
124static void omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
125 void __iomem **idlest_reg,
126 u8 *idlest_bit,
127 u8 *idlest_val)
128{
129 u32 r;
130
131 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
132 *idlest_reg = (__force void __iomem *)r;
133 *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
134 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
135}
136
137const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
138 .allow_idle = omap2_clkt_iclk_allow_idle,
139 .deny_idle = omap2_clkt_iclk_deny_idle,
140 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
141 .find_companion = omap2_clk_dflt_find_companion,
142};
143
144const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
145 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
146 .find_companion = omap2_clk_dflt_find_companion,
147};
148
Tero Kristoaafd9002013-08-02 14:04:19 +0300149static struct ti_dt_clk omap3xxx_clks[] = {
150 DT_CLK(NULL, "apb_pclk", "dummy_apb_pclk"),
151 DT_CLK(NULL, "omap_32k_fck", "omap_32k_fck"),
152 DT_CLK(NULL, "virt_12m_ck", "virt_12m_ck"),
153 DT_CLK(NULL, "virt_13m_ck", "virt_13m_ck"),
154 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
155 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
156 DT_CLK(NULL, "virt_38_4m_ck", "virt_38_4m_ck"),
157 DT_CLK(NULL, "osc_sys_ck", "osc_sys_ck"),
158 DT_CLK("twl", "fck", "osc_sys_ck"),
159 DT_CLK(NULL, "sys_ck", "sys_ck"),
160 DT_CLK(NULL, "omap_96m_alwon_fck", "omap_96m_alwon_fck"),
161 DT_CLK("etb", "emu_core_alwon_ck", "emu_core_alwon_ck"),
162 DT_CLK(NULL, "sys_altclk", "sys_altclk"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300163 DT_CLK(NULL, "sys_clkout1", "sys_clkout1"),
164 DT_CLK(NULL, "dpll1_ck", "dpll1_ck"),
165 DT_CLK(NULL, "dpll1_x2_ck", "dpll1_x2_ck"),
166 DT_CLK(NULL, "dpll1_x2m2_ck", "dpll1_x2m2_ck"),
167 DT_CLK(NULL, "dpll3_ck", "dpll3_ck"),
168 DT_CLK(NULL, "core_ck", "core_ck"),
169 DT_CLK(NULL, "dpll3_x2_ck", "dpll3_x2_ck"),
170 DT_CLK(NULL, "dpll3_m2_ck", "dpll3_m2_ck"),
171 DT_CLK(NULL, "dpll3_m2x2_ck", "dpll3_m2x2_ck"),
172 DT_CLK(NULL, "dpll3_m3_ck", "dpll3_m3_ck"),
173 DT_CLK(NULL, "dpll3_m3x2_ck", "dpll3_m3x2_ck"),
174 DT_CLK(NULL, "dpll4_ck", "dpll4_ck"),
175 DT_CLK(NULL, "dpll4_x2_ck", "dpll4_x2_ck"),
176 DT_CLK(NULL, "omap_96m_fck", "omap_96m_fck"),
177 DT_CLK(NULL, "cm_96m_fck", "cm_96m_fck"),
178 DT_CLK(NULL, "omap_54m_fck", "omap_54m_fck"),
179 DT_CLK(NULL, "omap_48m_fck", "omap_48m_fck"),
180 DT_CLK(NULL, "omap_12m_fck", "omap_12m_fck"),
181 DT_CLK(NULL, "dpll4_m2_ck", "dpll4_m2_ck"),
182 DT_CLK(NULL, "dpll4_m2x2_ck", "dpll4_m2x2_ck"),
183 DT_CLK(NULL, "dpll4_m3_ck", "dpll4_m3_ck"),
184 DT_CLK(NULL, "dpll4_m3x2_ck", "dpll4_m3x2_ck"),
185 DT_CLK(NULL, "dpll4_m4_ck", "dpll4_m4_ck"),
186 DT_CLK(NULL, "dpll4_m4x2_ck", "dpll4_m4x2_ck"),
187 DT_CLK(NULL, "dpll4_m5_ck", "dpll4_m5_ck"),
188 DT_CLK(NULL, "dpll4_m5x2_ck", "dpll4_m5x2_ck"),
189 DT_CLK(NULL, "dpll4_m6_ck", "dpll4_m6_ck"),
190 DT_CLK(NULL, "dpll4_m6x2_ck", "dpll4_m6x2_ck"),
191 DT_CLK("etb", "emu_per_alwon_ck", "emu_per_alwon_ck"),
192 DT_CLK(NULL, "clkout2_src_ck", "clkout2_src_ck"),
193 DT_CLK(NULL, "sys_clkout2", "sys_clkout2"),
194 DT_CLK(NULL, "corex2_fck", "corex2_fck"),
195 DT_CLK(NULL, "dpll1_fck", "dpll1_fck"),
196 DT_CLK(NULL, "mpu_ck", "mpu_ck"),
197 DT_CLK(NULL, "arm_fck", "arm_fck"),
198 DT_CLK("etb", "emu_mpu_alwon_ck", "emu_mpu_alwon_ck"),
199 DT_CLK(NULL, "l3_ick", "l3_ick"),
200 DT_CLK(NULL, "l4_ick", "l4_ick"),
201 DT_CLK(NULL, "rm_ick", "rm_ick"),
202 DT_CLK(NULL, "gpt10_fck", "gpt10_fck"),
203 DT_CLK(NULL, "gpt11_fck", "gpt11_fck"),
204 DT_CLK(NULL, "core_96m_fck", "core_96m_fck"),
205 DT_CLK(NULL, "mmchs2_fck", "mmchs2_fck"),
206 DT_CLK(NULL, "mmchs1_fck", "mmchs1_fck"),
207 DT_CLK(NULL, "i2c3_fck", "i2c3_fck"),
208 DT_CLK(NULL, "i2c2_fck", "i2c2_fck"),
209 DT_CLK(NULL, "i2c1_fck", "i2c1_fck"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300210 DT_CLK(NULL, "core_48m_fck", "core_48m_fck"),
211 DT_CLK(NULL, "mcspi4_fck", "mcspi4_fck"),
212 DT_CLK(NULL, "mcspi3_fck", "mcspi3_fck"),
213 DT_CLK(NULL, "mcspi2_fck", "mcspi2_fck"),
214 DT_CLK(NULL, "mcspi1_fck", "mcspi1_fck"),
215 DT_CLK(NULL, "uart2_fck", "uart2_fck"),
216 DT_CLK(NULL, "uart1_fck", "uart1_fck"),
217 DT_CLK(NULL, "core_12m_fck", "core_12m_fck"),
218 DT_CLK("omap_hdq.0", "fck", "hdq_fck"),
219 DT_CLK(NULL, "hdq_fck", "hdq_fck"),
220 DT_CLK(NULL, "core_l3_ick", "core_l3_ick"),
221 DT_CLK(NULL, "sdrc_ick", "sdrc_ick"),
222 DT_CLK(NULL, "gpmc_fck", "gpmc_fck"),
223 DT_CLK(NULL, "core_l4_ick", "core_l4_ick"),
224 DT_CLK("omap_hsmmc.1", "ick", "mmchs2_ick"),
225 DT_CLK("omap_hsmmc.0", "ick", "mmchs1_ick"),
226 DT_CLK(NULL, "mmchs2_ick", "mmchs2_ick"),
227 DT_CLK(NULL, "mmchs1_ick", "mmchs1_ick"),
228 DT_CLK("omap_hdq.0", "ick", "hdq_ick"),
229 DT_CLK(NULL, "hdq_ick", "hdq_ick"),
230 DT_CLK("omap2_mcspi.4", "ick", "mcspi4_ick"),
231 DT_CLK("omap2_mcspi.3", "ick", "mcspi3_ick"),
232 DT_CLK("omap2_mcspi.2", "ick", "mcspi2_ick"),
233 DT_CLK("omap2_mcspi.1", "ick", "mcspi1_ick"),
234 DT_CLK(NULL, "mcspi4_ick", "mcspi4_ick"),
235 DT_CLK(NULL, "mcspi3_ick", "mcspi3_ick"),
236 DT_CLK(NULL, "mcspi2_ick", "mcspi2_ick"),
237 DT_CLK(NULL, "mcspi1_ick", "mcspi1_ick"),
238 DT_CLK("omap_i2c.3", "ick", "i2c3_ick"),
239 DT_CLK("omap_i2c.2", "ick", "i2c2_ick"),
240 DT_CLK("omap_i2c.1", "ick", "i2c1_ick"),
241 DT_CLK(NULL, "i2c3_ick", "i2c3_ick"),
242 DT_CLK(NULL, "i2c2_ick", "i2c2_ick"),
243 DT_CLK(NULL, "i2c1_ick", "i2c1_ick"),
244 DT_CLK(NULL, "uart2_ick", "uart2_ick"),
245 DT_CLK(NULL, "uart1_ick", "uart1_ick"),
246 DT_CLK(NULL, "gpt11_ick", "gpt11_ick"),
247 DT_CLK(NULL, "gpt10_ick", "gpt10_ick"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300248 DT_CLK(NULL, "omapctrl_ick", "omapctrl_ick"),
249 DT_CLK(NULL, "dss_tv_fck", "dss_tv_fck"),
250 DT_CLK(NULL, "dss_96m_fck", "dss_96m_fck"),
251 DT_CLK(NULL, "dss2_alwon_fck", "dss2_alwon_fck"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300252 DT_CLK(NULL, "init_60m_fclk", "dummy_ck"),
253 DT_CLK(NULL, "gpt1_fck", "gpt1_fck"),
254 DT_CLK(NULL, "aes2_ick", "aes2_ick"),
255 DT_CLK(NULL, "wkup_32k_fck", "wkup_32k_fck"),
256 DT_CLK(NULL, "gpio1_dbck", "gpio1_dbck"),
257 DT_CLK(NULL, "sha12_ick", "sha12_ick"),
258 DT_CLK(NULL, "wdt2_fck", "wdt2_fck"),
259 DT_CLK("omap_wdt", "ick", "wdt2_ick"),
260 DT_CLK(NULL, "wdt2_ick", "wdt2_ick"),
261 DT_CLK(NULL, "wdt1_ick", "wdt1_ick"),
262 DT_CLK(NULL, "gpio1_ick", "gpio1_ick"),
263 DT_CLK(NULL, "omap_32ksync_ick", "omap_32ksync_ick"),
264 DT_CLK(NULL, "gpt12_ick", "gpt12_ick"),
265 DT_CLK(NULL, "gpt1_ick", "gpt1_ick"),
266 DT_CLK(NULL, "per_96m_fck", "per_96m_fck"),
267 DT_CLK(NULL, "per_48m_fck", "per_48m_fck"),
268 DT_CLK(NULL, "uart3_fck", "uart3_fck"),
269 DT_CLK(NULL, "gpt2_fck", "gpt2_fck"),
270 DT_CLK(NULL, "gpt3_fck", "gpt3_fck"),
271 DT_CLK(NULL, "gpt4_fck", "gpt4_fck"),
272 DT_CLK(NULL, "gpt5_fck", "gpt5_fck"),
273 DT_CLK(NULL, "gpt6_fck", "gpt6_fck"),
274 DT_CLK(NULL, "gpt7_fck", "gpt7_fck"),
275 DT_CLK(NULL, "gpt8_fck", "gpt8_fck"),
276 DT_CLK(NULL, "gpt9_fck", "gpt9_fck"),
277 DT_CLK(NULL, "per_32k_alwon_fck", "per_32k_alwon_fck"),
278 DT_CLK(NULL, "gpio6_dbck", "gpio6_dbck"),
279 DT_CLK(NULL, "gpio5_dbck", "gpio5_dbck"),
280 DT_CLK(NULL, "gpio4_dbck", "gpio4_dbck"),
281 DT_CLK(NULL, "gpio3_dbck", "gpio3_dbck"),
282 DT_CLK(NULL, "gpio2_dbck", "gpio2_dbck"),
283 DT_CLK(NULL, "wdt3_fck", "wdt3_fck"),
284 DT_CLK(NULL, "per_l4_ick", "per_l4_ick"),
285 DT_CLK(NULL, "gpio6_ick", "gpio6_ick"),
286 DT_CLK(NULL, "gpio5_ick", "gpio5_ick"),
287 DT_CLK(NULL, "gpio4_ick", "gpio4_ick"),
288 DT_CLK(NULL, "gpio3_ick", "gpio3_ick"),
289 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"),
290 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"),
291 DT_CLK(NULL, "uart3_ick", "uart3_ick"),
292 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
293 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"),
294 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"),
295 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"),
296 DT_CLK(NULL, "gpt6_ick", "gpt6_ick"),
297 DT_CLK(NULL, "gpt5_ick", "gpt5_ick"),
298 DT_CLK(NULL, "gpt4_ick", "gpt4_ick"),
299 DT_CLK(NULL, "gpt3_ick", "gpt3_ick"),
300 DT_CLK(NULL, "gpt2_ick", "gpt2_ick"),
Peter Ujfalusif757d1b2015-03-16 12:40:57 +0200301 DT_CLK(NULL, "mcbsp_clks", "mcbsp_clks"),
302 DT_CLK(NULL, "mcbsp1_ick", "mcbsp1_ick"),
303 DT_CLK(NULL, "mcbsp2_ick", "mcbsp2_ick"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300304 DT_CLK(NULL, "mcbsp3_ick", "mcbsp3_ick"),
Peter Ujfalusif757d1b2015-03-16 12:40:57 +0200305 DT_CLK(NULL, "mcbsp4_ick", "mcbsp4_ick"),
306 DT_CLK(NULL, "mcbsp5_ick", "mcbsp5_ick"),
307 DT_CLK(NULL, "mcbsp1_fck", "mcbsp1_fck"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300308 DT_CLK(NULL, "mcbsp2_fck", "mcbsp2_fck"),
309 DT_CLK(NULL, "mcbsp3_fck", "mcbsp3_fck"),
310 DT_CLK(NULL, "mcbsp4_fck", "mcbsp4_fck"),
Peter Ujfalusif757d1b2015-03-16 12:40:57 +0200311 DT_CLK(NULL, "mcbsp5_fck", "mcbsp5_fck"),
Tero Kristoaafd9002013-08-02 14:04:19 +0300312 DT_CLK("etb", "emu_src_ck", "emu_src_ck"),
313 DT_CLK(NULL, "emu_src_ck", "emu_src_ck"),
314 DT_CLK(NULL, "pclk_fck", "pclk_fck"),
315 DT_CLK(NULL, "pclkx2_fck", "pclkx2_fck"),
316 DT_CLK(NULL, "atclk_fck", "atclk_fck"),
317 DT_CLK(NULL, "traceclk_src_fck", "traceclk_src_fck"),
318 DT_CLK(NULL, "traceclk_fck", "traceclk_fck"),
319 DT_CLK(NULL, "secure_32k_fck", "secure_32k_fck"),
320 DT_CLK(NULL, "gpt12_fck", "gpt12_fck"),
321 DT_CLK(NULL, "wdt1_fck", "wdt1_fck"),
322 DT_CLK(NULL, "timer_32k_ck", "omap_32k_fck"),
323 DT_CLK(NULL, "timer_sys_ck", "sys_ck"),
324 DT_CLK(NULL, "cpufreq_ck", "dpll1_ck"),
325 { .node_name = NULL },
326};
327
328static struct ti_dt_clk omap34xx_omap36xx_clks[] = {
329 DT_CLK(NULL, "aes1_ick", "aes1_ick"),
330 DT_CLK("omap_rng", "ick", "rng_ick"),
331 DT_CLK("omap3-rom-rng", "ick", "rng_ick"),
332 DT_CLK(NULL, "sha11_ick", "sha11_ick"),
333 DT_CLK(NULL, "des1_ick", "des1_ick"),
334 DT_CLK(NULL, "cam_mclk", "cam_mclk"),
335 DT_CLK(NULL, "cam_ick", "cam_ick"),
336 DT_CLK(NULL, "csi2_96m_fck", "csi2_96m_fck"),
337 DT_CLK(NULL, "security_l3_ick", "security_l3_ick"),
338 DT_CLK(NULL, "pka_ick", "pka_ick"),
339 DT_CLK(NULL, "icr_ick", "icr_ick"),
340 DT_CLK("omap-aes", "ick", "aes2_ick"),
341 DT_CLK("omap-sham", "ick", "sha12_ick"),
342 DT_CLK(NULL, "des2_ick", "des2_ick"),
343 DT_CLK(NULL, "mspro_ick", "mspro_ick"),
344 DT_CLK(NULL, "mailboxes_ick", "mailboxes_ick"),
345 DT_CLK(NULL, "ssi_l4_ick", "ssi_l4_ick"),
346 DT_CLK(NULL, "sr1_fck", "sr1_fck"),
347 DT_CLK(NULL, "sr2_fck", "sr2_fck"),
348 DT_CLK(NULL, "sr_l4_ick", "sr_l4_ick"),
349 DT_CLK(NULL, "security_l4_ick2", "security_l4_ick2"),
350 DT_CLK(NULL, "wkup_l4_ick", "wkup_l4_ick"),
351 DT_CLK(NULL, "dpll2_fck", "dpll2_fck"),
352 DT_CLK(NULL, "iva2_ck", "iva2_ck"),
353 DT_CLK(NULL, "modem_fck", "modem_fck"),
354 DT_CLK(NULL, "sad2d_ick", "sad2d_ick"),
355 DT_CLK(NULL, "mad2d_ick", "mad2d_ick"),
356 DT_CLK(NULL, "mspro_fck", "mspro_fck"),
357 DT_CLK(NULL, "dpll2_ck", "dpll2_ck"),
358 DT_CLK(NULL, "dpll2_m2_ck", "dpll2_m2_ck"),
359 { .node_name = NULL },
360};
361
362static struct ti_dt_clk omap36xx_omap3430es2plus_clks[] = {
363 DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es2"),
364 DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es2"),
365 DT_CLK("musb-omap2430", "ick", "hsotgusb_ick_3430es2"),
366 DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es2"),
367 DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es2"),
368 DT_CLK(NULL, "usim_fck", "usim_fck"),
369 DT_CLK(NULL, "usim_ick", "usim_ick"),
370 { .node_name = NULL },
371};
372
373static struct ti_dt_clk omap3430es1_clks[] = {
374 DT_CLK(NULL, "gfx_l3_ck", "gfx_l3_ck"),
375 DT_CLK(NULL, "gfx_l3_fck", "gfx_l3_fck"),
376 DT_CLK(NULL, "gfx_l3_ick", "gfx_l3_ick"),
377 DT_CLK(NULL, "gfx_cg1_ck", "gfx_cg1_ck"),
378 DT_CLK(NULL, "gfx_cg2_ck", "gfx_cg2_ck"),
379 DT_CLK(NULL, "d2d_26m_fck", "d2d_26m_fck"),
380 DT_CLK(NULL, "fshostusb_fck", "fshostusb_fck"),
381 DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es1"),
382 DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es1"),
383 DT_CLK("musb-omap2430", "ick", "hsotgusb_ick_3430es1"),
384 DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es1"),
385 DT_CLK(NULL, "fac_ick", "fac_ick"),
386 DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es1"),
387 DT_CLK(NULL, "usb_l4_ick", "usb_l4_ick"),
388 DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es1"),
389 DT_CLK("omapdss_dss", "ick", "dss_ick_3430es1"),
390 DT_CLK(NULL, "dss_ick", "dss_ick_3430es1"),
391 { .node_name = NULL },
392};
393
394static struct ti_dt_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
395 DT_CLK(NULL, "virt_16_8m_ck", "virt_16_8m_ck"),
396 DT_CLK(NULL, "dpll5_ck", "dpll5_ck"),
397 DT_CLK(NULL, "dpll5_m2_ck", "dpll5_m2_ck"),
398 DT_CLK(NULL, "sgx_fck", "sgx_fck"),
399 DT_CLK(NULL, "sgx_ick", "sgx_ick"),
400 DT_CLK(NULL, "cpefuse_fck", "cpefuse_fck"),
401 DT_CLK(NULL, "ts_fck", "ts_fck"),
402 DT_CLK(NULL, "usbtll_fck", "usbtll_fck"),
403 DT_CLK(NULL, "usbtll_ick", "usbtll_ick"),
404 DT_CLK("omap_hsmmc.2", "ick", "mmchs3_ick"),
405 DT_CLK(NULL, "mmchs3_ick", "mmchs3_ick"),
406 DT_CLK(NULL, "mmchs3_fck", "mmchs3_fck"),
407 DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es2"),
408 DT_CLK("omapdss_dss", "ick", "dss_ick_3430es2"),
409 DT_CLK(NULL, "dss_ick", "dss_ick_3430es2"),
410 DT_CLK(NULL, "usbhost_120m_fck", "usbhost_120m_fck"),
411 DT_CLK(NULL, "usbhost_48m_fck", "usbhost_48m_fck"),
412 DT_CLK(NULL, "usbhost_ick", "usbhost_ick"),
413 { .node_name = NULL },
414};
415
416static struct ti_dt_clk am35xx_clks[] = {
417 DT_CLK(NULL, "ipss_ick", "ipss_ick"),
418 DT_CLK(NULL, "rmii_ck", "rmii_ck"),
419 DT_CLK(NULL, "pclk_ck", "pclk_ck"),
420 DT_CLK(NULL, "emac_ick", "emac_ick"),
421 DT_CLK(NULL, "emac_fck", "emac_fck"),
422 DT_CLK("davinci_emac.0", NULL, "emac_ick"),
423 DT_CLK("davinci_mdio.0", NULL, "emac_fck"),
424 DT_CLK("vpfe-capture", "master", "vpfe_ick"),
425 DT_CLK("vpfe-capture", "slave", "vpfe_fck"),
426 DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_am35xx"),
427 DT_CLK(NULL, "hsotgusb_fck", "hsotgusb_fck_am35xx"),
428 DT_CLK(NULL, "hecc_ck", "hecc_ck"),
429 DT_CLK(NULL, "uart4_ick", "uart4_ick_am35xx"),
430 DT_CLK(NULL, "uart4_fck", "uart4_fck_am35xx"),
431 { .node_name = NULL },
432};
433
434static struct ti_dt_clk omap36xx_clks[] = {
435 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"),
436 DT_CLK(NULL, "uart4_fck", "uart4_fck"),
437 { .node_name = NULL },
438};
439
440static const char *enable_init_clks[] = {
441 "sdrc_ick",
442 "gpmc_fck",
443 "omapctrl_ick",
444};
445
446enum {
447 OMAP3_SOC_AM35XX,
448 OMAP3_SOC_OMAP3430_ES1,
449 OMAP3_SOC_OMAP3430_ES2_PLUS,
450 OMAP3_SOC_OMAP3630,
Tero Kristoaafd9002013-08-02 14:04:19 +0300451};
452
Tero Kristo0565fb12015-03-03 13:27:48 +0200453/**
454 * omap3_clk_lock_dpll5 - locks DPLL5
455 *
456 * Locks DPLL5 to a pre-defined frequency. This is required for proper
457 * operation of USB.
458 */
459void __init omap3_clk_lock_dpll5(void)
460{
461 struct clk *dpll5_clk;
462 struct clk *dpll5_m2_clk;
463
464 dpll5_clk = clk_get(NULL, "dpll5_ck");
465 clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST);
466 clk_prepare_enable(dpll5_clk);
467
468 /* Program dpll5_m2_clk divider for no division */
469 dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
470 clk_prepare_enable(dpll5_m2_clk);
471 clk_set_rate(dpll5_m2_clk, DPLL5_FREQ_FOR_USBHOST);
472
473 clk_disable_unprepare(dpll5_m2_clk);
474 clk_disable_unprepare(dpll5_clk);
475}
476
Tero Kristoaafd9002013-08-02 14:04:19 +0300477static int __init omap3xxx_dt_clk_init(int soc_type)
478{
479 if (soc_type == OMAP3_SOC_AM35XX || soc_type == OMAP3_SOC_OMAP3630 ||
480 soc_type == OMAP3_SOC_OMAP3430_ES1 ||
481 soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
482 ti_dt_clocks_register(omap3xxx_clks);
483
484 if (soc_type == OMAP3_SOC_AM35XX)
485 ti_dt_clocks_register(am35xx_clks);
486
487 if (soc_type == OMAP3_SOC_OMAP3630 || soc_type == OMAP3_SOC_AM35XX ||
488 soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
489 ti_dt_clocks_register(omap36xx_am35xx_omap3430es2plus_clks);
490
491 if (soc_type == OMAP3_SOC_OMAP3430_ES1)
492 ti_dt_clocks_register(omap3430es1_clks);
493
494 if (soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS ||
495 soc_type == OMAP3_SOC_OMAP3630)
496 ti_dt_clocks_register(omap36xx_omap3430es2plus_clks);
497
498 if (soc_type == OMAP3_SOC_OMAP3430_ES1 ||
499 soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS ||
500 soc_type == OMAP3_SOC_OMAP3630)
501 ti_dt_clocks_register(omap34xx_omap36xx_clks);
502
503 if (soc_type == OMAP3_SOC_OMAP3630)
504 ti_dt_clocks_register(omap36xx_clks);
505
506 omap2_clk_disable_autoidle_all();
507
508 omap2_clk_enable_init_clocks(enable_init_clks,
509 ARRAY_SIZE(enable_init_clks));
510
511 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
512 (clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 1000000),
513 (clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 100000) % 10,
514 (clk_get_rate(clk_get_sys(NULL, "core_ck")) / 1000000),
515 (clk_get_rate(clk_get_sys(NULL, "arm_fck")) / 1000000));
516
Tony Lindgren1a342752015-01-13 14:51:28 -0800517 if (soc_type != OMAP3_SOC_OMAP3430_ES1)
Tero Kristoaafd9002013-08-02 14:04:19 +0300518 omap3_clk_lock_dpll5();
519
520 return 0;
521}
522
523int __init omap3430_dt_clk_init(void)
524{
525 return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3430_ES2_PLUS);
526}
527
528int __init omap3630_dt_clk_init(void)
529{
530 return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3630);
531}
532
533int __init am35xx_dt_clk_init(void)
534{
535 return omap3xxx_dt_clk_init(OMAP3_SOC_AM35XX);
536}