blob: bd7ec87c264c657f27c8bd58645739be6c6a8803 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/err.h>
17#include <linux/ctype.h>
18#include <linux/bitops.h>
19#include <linux/io.h>
20#include <linux/spinlock.h>
21#include <linux/delay.h>
22#include <linux/clk.h>
23#include <linux/clkdev.h>
24#include <linux/string.h>
25
26#include <mach/msm_iomap.h>
27#include <mach/clk.h>
28
29#include "clock.h"
30#include "clock-local.h"
31#include "clock-pcom.h"
32#include "clock-voter.h"
33#include "proc_comm.h"
34
35#define REG_BASE(off) (MSM_CLK_CTL_BASE + (off))
36#define REG(off) (MSM_CLK_CTL_SH2_BASE + (off))
37
38/* Shadow-region 2 (SH2) registers. */
39#define QUP_I2C_NS_REG REG(0x04F0)
40#define CAM_NS_REG REG(0x0374)
41#define CAM_VFE_NS_REG REG(0x0044)
42#define CLK_HALT_STATEA_REG REG(0x0108)
43#define CLK_HALT_STATEB_REG REG(0x010C)
44#define CLK_HALT_STATEC_REG REG(0x02D4)
45#define CSI_NS_REG REG(0x0174)
46#define EMDH_NS_REG REG(0x0050)
47#define GLBL_CLK_ENA_2_SC_REG REG(0x03C0)
48#define GLBL_CLK_ENA_SC_REG REG(0x03BC)
49#define GLBL_CLK_STATE_2_REG REG(0x037C)
50#define GLBL_CLK_STATE_REG REG(0x0004)
51#define GRP_2D_NS_REG REG(0x0034)
52#define GRP_NS_REG REG(0x0084)
53#define HDMI_NS_REG REG(0x0484)
54#define I2C_2_NS_REG REG(0x02D8)
55#define I2C_NS_REG REG(0x0068)
56#define JPEG_NS_REG REG(0x0164)
57#define LPA_CORE_CLK_MA0_REG REG(0x04F4)
58#define LPA_CORE_CLK_MA2_REG REG(0x04FC)
59#define LPA_NS_REG REG(0x02E8)
60#define MDC_NS_REG REG(0x007C)
61#define MDP_LCDC_NS_REG REG(0x0390)
62#define MDP_NS_REG REG(0x014C)
63#define MDP_VSYNC_REG REG(0x0460)
64#define MFC_NS_REG REG(0x0154)
65#define MI2S_CODEC_RX_DIV_REG REG(0x02EC)
66#define MI2S_CODEC_TX_DIV_REG REG(0x02F0)
67#define MI2S_DIV_REG REG(0x02E4)
68#define MI2S_NS_REG REG(0x02E0)
69#define MI2S_RX_NS_REG REG(0x0070)
70#define MI2S_TX_NS_REG REG(0x0078)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#define PLL_ENA_REG REG(0x0264)
72#define PMDH_NS_REG REG(0x008C)
73#define SDAC_NS_REG REG(0x009C)
74#define SDCn_NS_REG(n) REG(0x00A4+(0x8*((n)-1)))
75#define SPI_NS_REG REG(0x02C8)
76#define TSIF_NS_REG REG(0x00C4)
77#define TV_NS_REG REG(0x00CC)
78#define UART1DM_NS_REG REG(0x00D4)
79#define UART2DM_NS_REG REG(0x00DC)
80#define UART2_NS_REG REG(0x0464)
81#define UART_NS_REG REG(0x00E0)
82#define USBH2_NS_REG REG(0x046C)
83#define USBH3_NS_REG REG(0x0470)
84#define USBH_MD_REG REG(0x02BC)
85#define USBH_NS_REG REG(0x02C0)
86#define VPE_NS_REG REG(0x015C)
87
88/* Registers in the base (non-shadow) region. */
89#define CLK_TEST_BASE_REG REG_BASE(0x011C)
90#define CLK_TEST_2_BASE_REG REG_BASE(0x0384)
91#define MISC_CLK_CTL_BASE_REG REG_BASE(0x0110)
92#define PRPH_WEB_NS_BASE_REG REG_BASE(0x0080)
93#define PLL0_STATUS_BASE_REG REG_BASE(0x0318)
94#define PLL1_STATUS_BASE_REG REG_BASE(0x0334)
95#define PLL2_STATUS_BASE_REG REG_BASE(0x0350)
96#define PLL3_STATUS_BASE_REG REG_BASE(0x036C)
97#define PLL4_STATUS_BASE_REG REG_BASE(0x0254)
98#define PLL5_STATUS_BASE_REG REG_BASE(0x0258)
99#define PLL6_STATUS_BASE_REG REG_BASE(0x04EC)
100#define RINGOSC_CNT_BASE_REG REG_BASE(0x00FC)
101#define SH2_OWN_APPS1_BASE_REG REG_BASE(0x040C)
102#define SH2_OWN_APPS2_BASE_REG REG_BASE(0x0414)
103#define SH2_OWN_APPS3_BASE_REG REG_BASE(0x0444)
104#define SH2_OWN_GLBL_BASE_REG REG_BASE(0x0404)
105#define SH2_OWN_ROW1_BASE_REG REG_BASE(0x041C)
106#define SH2_OWN_ROW2_BASE_REG REG_BASE(0x0424)
107#define TCXO_CNT_BASE_REG REG_BASE(0x00F8)
108#define TCXO_CNT_DONE_BASE_REG REG_BASE(0x00F8)
109
110
111/* MUX source input identifiers. */
112#define SRC_SEL_pll0 4 /* Modem PLL */
113#define SRC_SEL_pll1 1 /* Global PLL */
114#define SRC_SEL_pll3 3 /* Multimedia/Peripheral PLL or Backup PLL1 */
115#define SRC_SEL_pll4 2 /* Display PLL */
116#define SRC_SEL_SDAC_lpxo 5 /* Low-power XO for SDAC */
117#define SRC_SEL_lpxo 6 /* Low-power XO */
118#define SRC_SEL_tcxo 0 /* Used for rates from TCXO */
119#define SRC_SEL_axi 0 /* Used for rates that sync to AXI */
120#define SRC_SEL_gnd 7 /* No clock */
121
122/* Clock declaration macros. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700123#define N8(msb, lsb, m, n) (BVAL(msb, lsb, ~(n-m)) | BVAL(6, 5, \
124 (MN_MODE_DUAL_EDGE * !!(n))))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700125#define N16(m, n) (BVAL(31, 16, ~(n-m)) | BVAL(6, 5, \
126 (MN_MODE_DUAL_EDGE * !!(n))))
127#define SPDIV(s, d) (BVAL(4, 3, d-1) | BVAL(2, 0, s))
128#define SDIV(s, d) (BVAL(6, 3, d-1) | BVAL(2, 0, s))
129#define F_MASK_BASIC (BM(6, 3)|BM(2, 0))
130#define F_MASK_MND16 (BM(31, 16)|BM(6, 5)|BM(4, 3)|BM(2, 0))
131#define F_MASK_MND8(m, l) (BM(m, l)|BM(6, 5)|BM(4, 3)|BM(2, 0))
132
133/*
134 * Clock frequency definitions and macros
135 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700136#define F_BASIC(f, s, div) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700137 { \
138 .freq_hz = f, \
139 .src_clk = &s##_clk.c, \
140 .ns_val = SDIV(SRC_SEL_##s, div), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700141 }
142
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700143#define F_MND16(f, s, div, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700144 { \
145 .freq_hz = f, \
146 .src_clk = &s##_clk.c, \
147 .md_val = MD16(m, n), \
148 .ns_val = N16(m, n) | SPDIV(SRC_SEL_##s, div), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 }
150
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700151#define F_MND8(f, nmsb, nlsb, s, div, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700152 { \
153 .freq_hz = f, \
154 .src_clk = &s##_clk.c, \
Stephen Boydd10d2642012-01-23 18:09:00 -0800155 .md_val = MD8(8, m, 0, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700156 .ns_val = N8(nmsb, nlsb, m, n) | SPDIV(SRC_SEL_##s, div), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700157 }
158
Matt Wagantall84f43fd2011-08-16 23:28:38 -0700159static struct clk_ops clk_ops_rcg_7x30;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700160
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700161enum vdd_dig_levels {
162 VDD_DIG_NONE,
163 VDD_DIG_LOW,
164 VDD_DIG_NOMINAL,
165 VDD_DIG_HIGH
166};
167
168static int set_vdd_dig(struct clk_vdd_class *vdd_class, int level)
169{
170 int rc, target_mv;
171
172 static const int mv[] = {
173 [VDD_DIG_NONE] = 1000,
174 [VDD_DIG_LOW] = 1000,
175 [VDD_DIG_NOMINAL] = 1100,
176 [VDD_DIG_HIGH] = 1200
177 };
178
179 target_mv = mv[level];
180 rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_MSMC1, &target_mv, NULL);
181 if (rc)
182 return rc;
183 if (target_mv)
184 rc = -EINVAL;
185
186 return rc;
187}
188
189static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig);
190
191#define VDD_DIG_FMAX_MAP1(l1, f1) \
192 .vdd_class = &vdd_dig, \
193 .fmax[VDD_DIG_##l1] = (f1)
194#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
195 .vdd_class = &vdd_dig, \
196 .fmax[VDD_DIG_##l1] = (f1), \
197 .fmax[VDD_DIG_##l2] = (f2)
198
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199#define PCOM_XO_DISABLE 0
200#define PCOM_XO_ENABLE 1
201#define PCOM_XO_TCXO 0
202#define PCOM_XO_LPXO 1
203
204static bool pcom_is_local(struct clk *clk)
205{
206 return false;
207}
208
209static int pcom_xo_enable(unsigned pcom_id, unsigned enable)
210{
211 /* TODO: Check return code in pcom_id */
212 return msm_proc_comm(PCOM_CLKCTL_RPC_SRC_REQUEST, &pcom_id, &enable);
213}
214
215static int tcxo_clk_enable(struct clk *clk)
216{
217 return pcom_xo_enable(PCOM_XO_TCXO, PCOM_XO_ENABLE);
218}
219
220static void tcxo_clk_disable(struct clk *clk)
221{
222 pcom_xo_enable(PCOM_XO_TCXO, PCOM_XO_DISABLE);
223}
224
225static struct clk_ops clk_ops_tcxo = {
226 .enable = tcxo_clk_enable,
227 .disable = tcxo_clk_disable,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 .is_local = pcom_is_local,
229};
230
231static struct fixed_clk tcxo_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700232 .c = {
233 .dbg_name = "tcxo_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800234 .rate = 19200000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700235 .ops = &clk_ops_tcxo,
236 CLK_INIT(tcxo_clk.c),
237 },
238};
239
240static int lpxo_clk_enable(struct clk *clk)
241{
242 return pcom_xo_enable(PCOM_XO_LPXO, PCOM_XO_ENABLE);
243}
244
245static void lpxo_clk_disable(struct clk *clk)
246{
247 pcom_xo_enable(PCOM_XO_LPXO, PCOM_XO_DISABLE);
248}
249
250static struct clk_ops clk_ops_lpxo = {
251 .enable = lpxo_clk_enable,
252 .disable = lpxo_clk_disable,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700253 .is_local = pcom_is_local,
254};
255
256static struct fixed_clk lpxo_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700257 .c = {
258 .dbg_name = "lpxo_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800259 .rate = 24576000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260 .ops = &clk_ops_lpxo,
261 CLK_INIT(lpxo_clk.c),
262 },
263};
264
265static struct pll_vote_clk pll1_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700266 .en_reg = PLL_ENA_REG,
267 .en_mask = BIT(1),
268 .status_reg = PLL1_STATUS_BASE_REG,
269 .parent = &tcxo_clk.c,
270 .c = {
271 .dbg_name = "pll1_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800272 .rate = 768000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273 .ops = &clk_ops_pll_vote,
274 CLK_INIT(pll1_clk.c),
275 },
276};
277
278static struct pll_vote_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279 .en_reg = PLL_ENA_REG,
280 .en_mask = BIT(2),
281 .status_reg = PLL2_STATUS_BASE_REG,
282 .parent = &tcxo_clk.c,
283 .c = {
284 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800285 .rate = 806400000, /* TODO: Support scaling */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286 .ops = &clk_ops_pll_vote,
287 CLK_INIT(pll2_clk.c),
288 },
289};
290
291static struct pll_vote_clk pll3_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700292 .en_reg = PLL_ENA_REG,
293 .en_mask = BIT(3),
294 .status_reg = PLL3_STATUS_BASE_REG,
295 .parent = &lpxo_clk.c,
296 .c = {
297 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800298 .rate = 737280000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700299 .ops = &clk_ops_pll_vote,
300 CLK_INIT(pll3_clk.c),
301 },
302};
303
304static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700305 .en_reg = PLL_ENA_REG,
306 .en_mask = BIT(4),
307 .status_reg = PLL4_STATUS_BASE_REG,
308 .parent = &lpxo_clk.c,
309 .c = {
310 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800311 .rate = 891000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700312 .ops = &clk_ops_pll_vote,
313 CLK_INIT(pll4_clk.c),
314 },
315};
316
317static struct clk_ops clk_ops_branch;
318
319static struct clk_freq_tbl clk_tbl_axi[] = {
Matt Wagantall07c45472012-02-10 23:27:24 -0800320 F_RAW(1, &lpxo_clk.c, 0, 0, 0, NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700321 F_END,
322};
323
324/* For global clocks to be on we must have GLBL_ROOT_ENA set */
325static struct rcg_clk glbl_root_clk = {
326 .b = {
327 .ctl_reg = GLBL_CLK_ENA_SC_REG,
328 .en_mask = BIT(29),
329 .halt_check = NOCHECK,
330 },
331 .freq_tbl = clk_tbl_axi,
332 .set_rate = set_rate_nop,
Matt Wagantall84f43fd2011-08-16 23:28:38 -0700333 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334 .set_rate = set_rate_nop,
335 .c = {
336 .dbg_name = "glbl_root_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -0700337 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700338 VDD_DIG_FMAX_MAP1(NOMINAL, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700339 CLK_INIT(glbl_root_clk.c),
340 },
341};
342
343/* AXI bridge clocks. */
344static struct branch_clk axi_li_apps_clk = {
345 .b = {
346 .ctl_reg = GLBL_CLK_ENA_SC_REG,
347 .en_mask = BIT(2),
348 .halt_reg = GLBL_CLK_STATE_REG,
349 .halt_check = HALT_VOTED,
350 .halt_bit = 2,
351 },
352 .parent = &glbl_root_clk.c,
353 .c = {
354 .dbg_name = "axi_li_apps_clk",
355 .ops = &clk_ops_branch,
356 CLK_INIT(axi_li_apps_clk.c),
357 },
358};
359
360static struct branch_clk axi_li_adsp_a_clk = {
361 .b = {
362 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
363 .en_mask = BIT(14),
364 .halt_reg = GLBL_CLK_STATE_2_REG,
365 .halt_check = HALT_VOTED,
366 .halt_bit = 14,
367 },
368 .parent = &axi_li_apps_clk.c,
369 .c = {
370 .dbg_name = "axi_li_adsp_a_clk",
371 .ops = &clk_ops_branch,
372 CLK_INIT(axi_li_adsp_a_clk.c),
373 },
374};
375
376static struct branch_clk axi_li_jpeg_clk = {
377 .b = {
378 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
379 .en_mask = BIT(19),
380 .halt_reg = GLBL_CLK_STATE_2_REG,
381 .halt_check = HALT_VOTED,
382 .halt_bit = 19,
383 },
384 .parent = &axi_li_apps_clk.c,
385 .c = {
386 .dbg_name = "axi_li_jpeg_clk",
387 .ops = &clk_ops_branch,
388 CLK_INIT(axi_li_jpeg_clk.c),
389 },
390};
391
392static struct branch_clk axi_li_vfe_clk = {
393 .b = {
394 .ctl_reg = GLBL_CLK_ENA_SC_REG,
395 .en_mask = BIT(23),
396 .halt_reg = GLBL_CLK_STATE_REG,
397 .halt_check = HALT_VOTED,
398 .halt_bit = 23,
399 },
400 .parent = &axi_li_apps_clk.c,
401 .c = {
402 .dbg_name = "axi_li_vfe_clk",
403 .ops = &clk_ops_branch,
404 CLK_INIT(axi_li_vfe_clk.c),
405 },
406};
407
408static struct branch_clk axi_mdp_clk = {
409 .b = {
410 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
411 .en_mask = BIT(29),
412 .halt_reg = GLBL_CLK_STATE_2_REG,
413 .halt_check = HALT_VOTED,
414 .halt_bit = 29,
415 },
416 .parent = &axi_li_apps_clk.c,
417 .c = {
418 .dbg_name = "axi_mdp_clk",
419 .ops = &clk_ops_branch,
420 CLK_INIT(axi_mdp_clk.c),
421 },
422};
423
424static struct branch_clk axi_li_vg_clk = {
425 .b = {
426 .ctl_reg = GLBL_CLK_ENA_SC_REG,
427 .en_mask = BIT(3),
428 .halt_reg = GLBL_CLK_STATE_REG,
429 .halt_check = HALT_VOTED,
430 .halt_bit = 3,
431 },
432 .parent = &glbl_root_clk.c,
433 .c = {
434 .dbg_name = "axi_li_vg_clk",
435 .ops = &clk_ops_branch,
436 CLK_INIT(axi_li_vg_clk.c),
437 },
438};
439
440static struct branch_clk axi_grp_2d_clk = {
441 .b = {
442 .ctl_reg = GLBL_CLK_ENA_SC_REG,
443 .en_mask = BIT(21),
444 .halt_reg = GLBL_CLK_STATE_REG,
445 .halt_check = HALT_VOTED,
446 .halt_bit = 21,
447 },
448 .parent = &axi_li_vg_clk.c,
449 .c = {
450 .dbg_name = "axi_grp_2d_clk",
451 .ops = &clk_ops_branch,
452 CLK_INIT(axi_grp_2d_clk.c),
453 },
454};
455
456static struct branch_clk axi_li_grp_clk = {
457 .b = {
458 .ctl_reg = GLBL_CLK_ENA_SC_REG,
459 .en_mask = BIT(22),
460 .halt_reg = GLBL_CLK_STATE_REG,
461 .halt_check = HALT_VOTED,
462 .halt_bit = 22,
463 },
464 .parent = &axi_li_vg_clk.c,
465 .c = {
466 .dbg_name = "axi_li_grp_clk",
467 .ops = &clk_ops_branch,
468 CLK_INIT(axi_li_grp_clk.c),
469 },
470};
471
472static struct branch_clk axi_mfc_clk = {
473 .b = {
474 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
475 .en_mask = BIT(20),
476 .halt_reg = GLBL_CLK_STATE_2_REG,
477 .halt_check = HALT_VOTED,
478 .halt_bit = 20,
479 },
480 .parent = &axi_li_vg_clk.c,
481 .c = {
482 .dbg_name = "axi_mfc_clk",
483 .ops = &clk_ops_branch,
484 CLK_INIT(axi_mfc_clk.c),
485 },
486};
487
488static struct branch_clk axi_rotator_clk = {
489 .b = {
490 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
491 .en_mask = BIT(22),
492 .halt_reg = GLBL_CLK_STATE_2_REG,
493 .halt_check = HALT_VOTED,
494 .halt_bit = 22,
495 .reset_mask = P_AXI_ROTATOR_CLK,
496 },
497 .parent = &axi_li_vg_clk.c,
498 .c = {
499 .dbg_name = "axi_rotator_clk",
500 .ops = &clk_ops_branch,
501 CLK_INIT(axi_rotator_clk.c),
502 },
503};
504
505static struct branch_clk axi_vpe_clk = {
506 .b = {
507 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
508 .en_mask = BIT(21),
509 .halt_reg = GLBL_CLK_STATE_2_REG,
510 .halt_check = HALT_VOTED,
511 .halt_bit = 21,
512 },
513 .parent = &axi_li_vg_clk.c,
514 .c = {
515 .dbg_name = "axi_vpe_clk",
516 .ops = &clk_ops_branch,
517 CLK_INIT(axi_vpe_clk.c),
518 },
519};
520
521/* Peripheral bus clocks. */
522static struct branch_clk adm_clk = {
523 .b = {
524 .ctl_reg = GLBL_CLK_ENA_SC_REG,
525 .en_mask = BIT(5),
526 .halt_reg = GLBL_CLK_STATE_REG,
527 .halt_check = HALT_VOTED,
528 .halt_bit = 5,
529 .reset_mask = P_ADM_CLK,
530 },
531 .parent = &axi_li_apps_clk.c,
532 .c = {
533 .dbg_name = "adm_clk",
534 .ops = &clk_ops_branch,
535 CLK_INIT(adm_clk.c),
536 },
537};
538
539static struct branch_clk adm_p_clk = {
540 .b = {
541 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
542 .en_mask = BIT(15),
543 .halt_reg = GLBL_CLK_STATE_2_REG,
544 .halt_check = HALT_VOTED,
545 .halt_bit = 15,
546 },
547 .parent = &glbl_root_clk.c,
548 .c = {
549 .dbg_name = "adm_p_clk",
550 .ops = &clk_ops_branch,
551 CLK_INIT(adm_p_clk.c),
552 },
553};
554
555static struct branch_clk ce_clk = {
556 .b = {
557 .ctl_reg = GLBL_CLK_ENA_SC_REG,
558 .en_mask = BIT(6),
559 .halt_reg = GLBL_CLK_STATE_REG,
560 .halt_check = HALT_VOTED,
561 .halt_bit = 6,
562 .reset_mask = P_CE_CLK,
563 },
564 .parent = &glbl_root_clk.c,
565 .c = {
566 .dbg_name = "ce_clk",
567 .ops = &clk_ops_branch,
568 CLK_INIT(ce_clk.c),
569 },
570};
571
572static struct branch_clk camif_pad_p_clk = {
573 .b = {
574 .ctl_reg = GLBL_CLK_ENA_SC_REG,
575 .en_mask = BIT(9),
576 .halt_reg = GLBL_CLK_STATE_REG,
577 .halt_check = HALT_VOTED,
578 .halt_bit = 9,
579 .reset_mask = P_CAMIF_PAD_P_CLK,
580 },
581 .parent = &glbl_root_clk.c,
582 .c = {
583 .dbg_name = "camif_pad_p_clk",
584 .ops = &clk_ops_branch,
585 CLK_INIT(camif_pad_p_clk.c),
586 },
587};
588
589static struct branch_clk csi0_p_clk = {
590 .b = {
591 .ctl_reg = GLBL_CLK_ENA_SC_REG,
592 .en_mask = BIT(30),
593 .halt_reg = GLBL_CLK_STATE_REG,
594 .halt_check = HALT_VOTED,
595 .halt_bit = 30,
596 .reset_mask = P_CSI0_P_CLK,
597 },
598 .parent = &glbl_root_clk.c,
599 .c = {
600 .dbg_name = "csi0_p_clk",
601 .ops = &clk_ops_branch,
602 CLK_INIT(csi0_p_clk.c),
603 },
604};
605
606static struct branch_clk emdh_p_clk = {
607 .b = {
608 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
609 .en_mask = BIT(3),
610 .halt_reg = GLBL_CLK_STATE_2_REG,
611 .halt_check = HALT_VOTED,
612 .halt_bit = 3,
613 .reset_mask = P_EMDH_P_CLK,
614 },
615 .parent = &glbl_root_clk.c,
616 .c = {
617 .dbg_name = "emdh_p_clk",
618 .ops = &clk_ops_branch,
619 CLK_INIT(emdh_p_clk.c),
620 },
621};
622
623static struct branch_clk grp_2d_p_clk = {
624 .b = {
625 .ctl_reg = GLBL_CLK_ENA_SC_REG,
626 .en_mask = BIT(24),
627 .halt_reg = GLBL_CLK_STATE_REG,
628 .halt_check = HALT_VOTED,
629 .halt_bit = 24,
630 .reset_mask = P_GRP_2D_P_CLK,
631 },
632 .parent = &glbl_root_clk.c,
633 .c = {
634 .dbg_name = "grp_2d_p_clk",
635 .ops = &clk_ops_branch,
636 CLK_INIT(grp_2d_p_clk.c),
637 },
638};
639
640static struct branch_clk grp_3d_p_clk = {
641 .b = {
642 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
643 .en_mask = BIT(17),
644 .halt_reg = GLBL_CLK_STATE_2_REG,
645 .halt_check = HALT_VOTED,
646 .halt_bit = 17,
647 .reset_mask = P_GRP_3D_P_CLK,
648 },
649 .parent = &glbl_root_clk.c,
650 .c = {
651 .dbg_name = "grp_3d_p_clk",
652 .ops = &clk_ops_branch,
653 CLK_INIT(grp_3d_p_clk.c),
654 },
655};
656
657static struct branch_clk jpeg_p_clk = {
658 .b = {
659 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
660 .en_mask = BIT(24),
661 .halt_reg = GLBL_CLK_STATE_2_REG,
662 .halt_check = HALT_VOTED,
663 .halt_bit = 24,
664 .reset_mask = P_JPEG_P_CLK,
665 },
666 .parent = &glbl_root_clk.c,
667 .c = {
668 .dbg_name = "jpeg_p_clk",
669 .ops = &clk_ops_branch,
670 CLK_INIT(jpeg_p_clk.c),
671 },
672};
673
674static struct branch_clk lpa_p_clk = {
675 .b = {
676 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
677 .en_mask = BIT(7),
678 .halt_reg = GLBL_CLK_STATE_2_REG,
679 .halt_check = HALT_VOTED,
680 .halt_bit = 7,
681 .reset_mask = P_LPA_P_CLK,
682 },
683 .parent = &glbl_root_clk.c,
684 .c = {
685 .dbg_name = "lpa_p_clk",
686 .ops = &clk_ops_branch,
687 CLK_INIT(lpa_p_clk.c),
688 },
689};
690
691static struct branch_clk mdp_p_clk = {
692 .b = {
693 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
694 .en_mask = BIT(6),
695 .halt_reg = GLBL_CLK_STATE_2_REG,
696 .halt_check = HALT_VOTED,
697 .halt_bit = 6,
698 .reset_mask = P_MDP_P_CLK,
699 },
700 .parent = &glbl_root_clk.c,
701 .c = {
702 .dbg_name = "mdp_p_clk",
703 .ops = &clk_ops_branch,
704 CLK_INIT(mdp_p_clk.c),
705 },
706};
707
708static struct branch_clk mfc_p_clk = {
709 .b = {
710 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
711 .en_mask = BIT(26),
712 .halt_reg = GLBL_CLK_STATE_2_REG,
713 .halt_check = HALT_VOTED,
714 .halt_bit = 26,
715 .reset_mask = P_MFC_P_CLK,
716 },
717 .parent = &glbl_root_clk.c,
718 .c = {
719 .dbg_name = "mfc_p_clk",
720 .ops = &clk_ops_branch,
721 CLK_INIT(mfc_p_clk.c),
722 },
723};
724
725static struct branch_clk pmdh_p_clk = {
726 .b = {
727 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
728 .en_mask = BIT(4),
729 .halt_reg = GLBL_CLK_STATE_2_REG,
730 .halt_check = HALT_VOTED,
731 .halt_bit = 4,
732 .reset_mask = P_PMDH_P_CLK,
733 },
734 .parent = &glbl_root_clk.c,
735 .c = {
736 .dbg_name = "pmdh_p_clk",
737 .ops = &clk_ops_branch,
738 CLK_INIT(pmdh_p_clk.c),
739 },
740};
741
742static struct branch_clk rotator_imem_clk = {
743 .b = {
744 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
745 .en_mask = BIT(23),
746 .halt_reg = GLBL_CLK_STATE_2_REG,
747 .halt_check = HALT_VOTED,
748 .halt_bit = 23,
749 .reset_mask = P_ROTATOR_IMEM_CLK,
750 },
751 .parent = &glbl_root_clk.c,
752 .c = {
753 .dbg_name = "rotator_imem_clk",
754 .ops = &clk_ops_branch,
755 CLK_INIT(rotator_imem_clk.c),
756 },
757};
758
759static struct branch_clk rotator_p_clk = {
760 .b = {
761 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
762 .en_mask = BIT(25),
763 .halt_reg = GLBL_CLK_STATE_2_REG,
764 .halt_check = HALT_VOTED,
765 .halt_bit = 25,
766 .reset_mask = P_ROTATOR_P_CLK,
767 },
768 .parent = &glbl_root_clk.c,
769 .c = {
770 .dbg_name = "rotator_p_clk",
771 .ops = &clk_ops_branch,
772 CLK_INIT(rotator_p_clk.c),
773 },
774};
775
776static struct branch_clk sdc1_p_clk = {
777 .b = {
778 .ctl_reg = GLBL_CLK_ENA_SC_REG,
779 .en_mask = BIT(7),
780 .halt_reg = GLBL_CLK_STATE_REG,
781 .halt_check = HALT_VOTED,
782 .halt_bit = 7,
783 .reset_mask = P_SDC1_P_CLK,
784 },
785 .parent = &glbl_root_clk.c,
786 .c = {
787 .dbg_name = "sdc1_p_clk",
788 .ops = &clk_ops_branch,
789 CLK_INIT(sdc1_p_clk.c),
790 },
791};
792
793static struct branch_clk sdc2_p_clk = {
794 .b = {
795 .ctl_reg = GLBL_CLK_ENA_SC_REG,
796 .en_mask = BIT(8),
797 .halt_reg = GLBL_CLK_STATE_REG,
798 .halt_check = HALT_VOTED,
799 .halt_bit = 8,
800 .reset_mask = P_SDC2_P_CLK,
801 },
802 .parent = &glbl_root_clk.c,
803 .c = {
804 .dbg_name = "sdc2_p_clk",
805 .ops = &clk_ops_branch,
806 CLK_INIT(sdc2_p_clk.c),
807 },
808};
809
810static struct branch_clk sdc3_p_clk = {
811 .b = {
812 .ctl_reg = GLBL_CLK_ENA_SC_REG,
813 .en_mask = BIT(27),
814 .halt_reg = GLBL_CLK_STATE_REG,
815 .halt_check = HALT_VOTED,
816 .halt_bit = 27,
817 .reset_mask = P_SDC3_P_CLK,
818 },
819 .parent = &glbl_root_clk.c,
820 .c = {
821 .dbg_name = "sdc3_p_clk",
822 .ops = &clk_ops_branch,
823 CLK_INIT(sdc3_p_clk.c),
824 },
825};
826
827static struct branch_clk sdc4_p_clk = {
828 .b = {
829 .ctl_reg = GLBL_CLK_ENA_SC_REG,
830 .en_mask = BIT(28),
831 .halt_reg = GLBL_CLK_STATE_REG,
832 .halt_check = HALT_VOTED,
833 .halt_bit = 28,
834 .reset_mask = P_SDC4_P_CLK,
835 },
836 .parent = &glbl_root_clk.c,
837 .c = {
838 .dbg_name = "sdc4_p_clk",
839 .ops = &clk_ops_branch,
840 CLK_INIT(sdc4_p_clk.c),
841 },
842};
843
844static struct branch_clk spi_p_clk = {
845 .b = {
846 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
847 .en_mask = BIT(10),
848 .halt_reg = GLBL_CLK_STATE_2_REG,
849 .halt_check = HALT_VOTED,
850 .halt_bit = 10,
851 .reset_mask = P_SPI_P_CLK,
852 },
853 .parent = &glbl_root_clk.c,
854 .c = {
855 .dbg_name = "spi_p_clk",
856 .ops = &clk_ops_branch,
857 CLK_INIT(spi_p_clk.c),
858 },
859};
860
861static struct branch_clk tsif_p_clk = {
862 .b = {
863 .ctl_reg = GLBL_CLK_ENA_SC_REG,
864 .en_mask = BIT(18),
865 .halt_reg = GLBL_CLK_STATE_REG,
866 .halt_check = HALT_VOTED,
867 .halt_bit = 18,
868 .reset_mask = P_TSIF_P_CLK,
869 },
870 .parent = &glbl_root_clk.c,
871 .c = {
872 .dbg_name = "tsif_p_clk",
873 .ops = &clk_ops_branch,
874 CLK_INIT(tsif_p_clk.c),
875 },
876};
877
878static struct branch_clk uart1dm_p_clk = {
879 .b = {
880 .ctl_reg = GLBL_CLK_ENA_SC_REG,
881 .en_mask = BIT(17),
882 .halt_reg = GLBL_CLK_STATE_REG,
883 .halt_check = HALT_VOTED,
884 .halt_bit = 17,
885 },
886 .parent = &glbl_root_clk.c,
887 .c = {
888 .dbg_name = "uart1dm_p_clk",
889 .ops = &clk_ops_branch,
890 CLK_INIT(uart1dm_p_clk.c),
891 },
892};
893
894static struct branch_clk uart2dm_p_clk = {
895 .b = {
896 .ctl_reg = GLBL_CLK_ENA_SC_REG,
897 .en_mask = BIT(26),
898 .halt_reg = GLBL_CLK_STATE_REG,
899 .halt_check = HALT_VOTED,
900 .halt_bit = 26,
901 },
902 .parent = &glbl_root_clk.c,
903 .c = {
904 .dbg_name = "uart2dm_p_clk",
905 .ops = &clk_ops_branch,
906 CLK_INIT(uart2dm_p_clk.c),
907 },
908};
909
910static struct branch_clk usb_hs2_p_clk = {
911 .b = {
912 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
913 .en_mask = BIT(8),
914 .halt_reg = GLBL_CLK_STATE_2_REG,
915 .halt_check = HALT_VOTED,
916 .halt_bit = 8,
917 .reset_mask = P_USB_HS2_P_CLK,
918 },
919 .parent = &glbl_root_clk.c,
920 .c = {
921 .dbg_name = "usb_hs2_p_clk",
922 .ops = &clk_ops_branch,
923 CLK_INIT(usb_hs2_p_clk.c),
924 },
925};
926
927static struct branch_clk usb_hs3_p_clk = {
928 .b = {
929 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
930 .en_mask = BIT(9),
931 .halt_reg = GLBL_CLK_STATE_2_REG,
932 .halt_check = HALT_VOTED,
933 .halt_bit = 9,
934 .reset_mask = P_USB_HS3_P_CLK,
935 },
936 .parent = &glbl_root_clk.c,
937 .c = {
938 .dbg_name = "usb_hs3_p_clk",
939 .ops = &clk_ops_branch,
940 CLK_INIT(usb_hs3_p_clk.c),
941 },
942};
943
944static struct branch_clk usb_hs_p_clk = {
945 .b = {
946 .ctl_reg = GLBL_CLK_ENA_SC_REG,
947 .en_mask = BIT(25),
948 .halt_reg = GLBL_CLK_STATE_REG,
949 .halt_check = HALT_VOTED,
950 .halt_bit = 25,
951 .reset_mask = P_USB_HS_P_CLK,
952 },
953 .parent = &glbl_root_clk.c,
954 .c = {
955 .dbg_name = "usb_hs_p_clk",
956 .ops = &clk_ops_branch,
957 CLK_INIT(usb_hs_p_clk.c),
958 },
959};
960
961static struct branch_clk vfe_p_clk = {
962 .b = {
963 .ctl_reg = GLBL_CLK_ENA_2_SC_REG,
964 .en_mask = BIT(27),
965 .halt_reg = GLBL_CLK_STATE_2_REG,
966 .halt_check = HALT_VOTED,
967 .halt_bit = 27,
968 .reset_mask = P_VFE_P_CLK,
969 },
970 .parent = &glbl_root_clk.c,
971 .c = {
972 .dbg_name = "vfe_p_clk",
973 .ops = &clk_ops_branch,
974 CLK_INIT(vfe_p_clk.c),
975 },
976};
977
978static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700979 F_MND8( 0, 0, 0, gnd, 1, 0, 0),
980 F_MND8(153600000, 24, 17, pll1, 2, 2, 5),
981 F_MND8(192000000, 24, 17, pll1, 4, 0, 0),
982 F_MND8(384000000, 24, 17, pll1, 2, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983 F_END,
984};
985
986static struct rcg_clk csi0_clk = {
987 .b = {
988 .ctl_reg = CSI_NS_REG,
989 .en_mask = BIT(9),
990 .halt_reg = CLK_HALT_STATEC_REG,
991 .halt_bit = 17,
992 .reset_mask = P_CSI0_CLK,
993 },
994 .ns_reg = CSI_NS_REG,
995 .md_reg = CSI_NS_REG - 4,
996 .ns_mask = F_MASK_MND8(24, 17),
Matt Wagantall07c45472012-02-10 23:27:24 -0800997 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998 .root_en_mask = BIT(11),
999 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001000 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001001 .set_rate = set_rate_mnd,
1002 .c = {
1003 .dbg_name = "csi0_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001004 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001005 VDD_DIG_FMAX_MAP1(NOMINAL, 384000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001006 CLK_INIT(csi0_clk.c),
1007 },
1008};
1009
1010static struct clk_freq_tbl clk_tbl_tcxo[] = {
Matt Wagantall07c45472012-02-10 23:27:24 -08001011 F_RAW(19200000, &tcxo_clk.c, 0, 0, 0, NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012 F_END,
1013};
1014
1015static struct rcg_clk i2c_clk = {
1016 .b = {
1017 .ctl_reg = I2C_NS_REG,
1018 .en_mask = BIT(9),
1019 .halt_reg = CLK_HALT_STATEA_REG,
1020 .halt_bit = 15,
1021 .reset_mask = P_I2C_CLK,
1022 },
1023 .set_rate = set_rate_nop,
1024 .freq_tbl = clk_tbl_tcxo,
1025 .root_en_mask = BIT(11),
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001026 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001027 .c = {
1028 .dbg_name = "i2c_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001029 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001030 VDD_DIG_FMAX_MAP1(NOMINAL, 19200000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001031 CLK_INIT(i2c_clk.c),
1032 },
1033};
1034
1035static struct rcg_clk i2c_2_clk = {
1036 .b = {
1037 .ctl_reg = I2C_2_NS_REG,
1038 .en_mask = BIT(0),
1039 .halt_reg = CLK_HALT_STATEC_REG,
1040 .halt_bit = 2,
1041 .reset_mask = P_I2C_2_CLK,
1042 },
1043 .root_en_mask = BIT(2),
1044 .freq_tbl = clk_tbl_tcxo,
1045 .set_rate = set_rate_nop,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001046 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001047 .c = {
1048 .dbg_name = "i2c_2_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001049 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001050 VDD_DIG_FMAX_MAP1(NOMINAL, 19200000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001051 CLK_INIT(i2c_2_clk.c),
1052 },
1053};
1054
1055static struct rcg_clk qup_i2c_clk = {
1056 .b = {
1057 .ctl_reg = QUP_I2C_NS_REG,
1058 .en_mask = BIT(0),
1059 .halt_reg = CLK_HALT_STATEB_REG,
1060 .halt_bit = 31,
1061 .reset_mask = P_QUP_I2C_CLK,
1062 },
1063 .root_en_mask = BIT(2),
1064 .freq_tbl = clk_tbl_tcxo,
1065 .set_rate = set_rate_nop,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001066 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001067 .c = {
1068 .dbg_name = "qup_i2c_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001069 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001070 VDD_DIG_FMAX_MAP1(NOMINAL, 19200000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001071 CLK_INIT(qup_i2c_clk.c),
1072 },
1073};
1074
1075static struct rcg_clk uart1_clk = {
1076 .b = {
1077 .ctl_reg = UART_NS_REG,
1078 .en_mask = BIT(5),
1079 .halt_reg = CLK_HALT_STATEB_REG,
1080 .halt_bit = 7,
1081 .reset_mask = P_UART1_CLK,
1082 },
1083 .root_en_mask = BIT(4),
1084 .freq_tbl = clk_tbl_tcxo,
1085 .set_rate = set_rate_nop,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001086 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001087 .c = {
1088 .dbg_name = "uart1_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001089 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001090 VDD_DIG_FMAX_MAP1(NOMINAL, 19200000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091 CLK_INIT(uart1_clk.c),
1092 },
1093};
1094
1095static struct rcg_clk uart2_clk = {
1096 .b = {
1097 .ctl_reg = UART2_NS_REG,
1098 .en_mask = BIT(5),
1099 .halt_reg = CLK_HALT_STATEB_REG,
1100 .halt_bit = 5,
1101 .reset_mask = P_UART2_CLK,
1102 },
1103 .root_en_mask = BIT(4),
1104 .freq_tbl = clk_tbl_tcxo,
1105 .set_rate = set_rate_nop,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001106 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001107 .c = {
1108 .dbg_name = "uart2_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001109 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001110 VDD_DIG_FMAX_MAP1(NOMINAL, 19200000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001111 CLK_INIT(uart2_clk.c),
1112 },
1113};
1114
1115static struct clk_freq_tbl clk_tbl_uartdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001116 F_MND16( 0, gnd, 1, 0, 0),
1117 F_MND16( 3686400, pll3, 3, 3, 200),
1118 F_MND16( 7372800, pll3, 3, 3, 100),
1119 F_MND16(14745600, pll3, 3, 3, 50),
1120 F_MND16(32000000, pll3, 3, 25, 192),
1121 F_MND16(40000000, pll3, 3, 125, 768),
1122 F_MND16(46400000, pll3, 3, 145, 768),
1123 F_MND16(48000000, pll3, 3, 25, 128),
1124 F_MND16(51200000, pll3, 3, 5, 24),
1125 F_MND16(56000000, pll3, 3, 175, 768),
1126 F_MND16(58982400, pll3, 3, 6, 25),
1127 F_MND16(64000000, pll1, 4, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001128 F_END,
1129};
1130
1131static struct rcg_clk uart1dm_clk = {
1132 .b = {
1133 .ctl_reg = UART1DM_NS_REG,
1134 .en_mask = BIT(9),
1135 .halt_reg = CLK_HALT_STATEB_REG,
1136 .halt_bit = 6,
1137 .reset_mask = P_UART1DM_CLK,
1138 },
1139 .ns_reg = UART1DM_NS_REG,
1140 .md_reg = UART1DM_NS_REG - 4,
1141 .root_en_mask = BIT(11),
Matt Wagantall07c45472012-02-10 23:27:24 -08001142 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001143 .freq_tbl = clk_tbl_uartdm,
1144 .ns_mask = F_MASK_MND16,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001145 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001146 .set_rate = set_rate_mnd,
1147 .c = {
1148 .dbg_name = "uart1dm_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001149 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001150 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001151 CLK_INIT(uart1dm_clk.c),
1152 },
1153};
1154
1155static struct rcg_clk uart2dm_clk = {
1156 .b = {
1157 .ctl_reg = UART2DM_NS_REG,
1158 .en_mask = BIT(9),
1159 .halt_reg = CLK_HALT_STATEB_REG,
1160 .halt_bit = 23,
1161 .reset_mask = P_UART2DM_CLK,
1162 },
1163 .ns_reg = UART2DM_NS_REG,
1164 .md_reg = UART2DM_NS_REG - 4,
1165 .root_en_mask = BIT(11),
1166 .freq_tbl = clk_tbl_uartdm,
1167 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08001168 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001169 .set_rate = set_rate_mnd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001170 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001171 .c = {
1172 .dbg_name = "uart2dm_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001173 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001174 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001175 CLK_INIT(uart2dm_clk.c),
1176 },
1177};
1178
1179static struct clk_freq_tbl clk_tbl_mdh[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001180 F_BASIC( 0, gnd, 1),
1181 F_BASIC( 49150000, pll3, 15),
1182 F_BASIC( 92160000, pll3, 8),
1183 F_BASIC(122880000, pll3, 6),
1184 F_BASIC(184320000, pll3, 4),
1185 F_BASIC(245760000, pll3, 3),
1186 F_BASIC(368640000, pll3, 2),
1187 F_BASIC(384000000, pll1, 2),
1188 F_BASIC(445500000, pll4, 2),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189 F_END,
1190};
1191
1192static struct rcg_clk emdh_clk = {
1193 .b = {
1194 .ctl_reg = EMDH_NS_REG,
1195 .halt_check = DELAY,
1196 .reset_mask = P_EMDH_CLK,
1197 },
1198 .root_en_mask = BIT(11),
1199 .ns_reg = EMDH_NS_REG,
1200 .ns_mask = F_MASK_BASIC,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001201 .set_rate = set_rate_nop,
1202 .freq_tbl = clk_tbl_mdh,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001203 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001204 .c = {
1205 .dbg_name = "emdh_clk",
1206 .flags = CLKFLAG_MIN | CLKFLAG_MAX,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001207 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001208 VDD_DIG_FMAX_MAP1(NOMINAL, 445500000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001209 CLK_INIT(emdh_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07001210 .depends = &axi_li_adsp_a_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001211 },
1212};
1213
1214static struct rcg_clk pmdh_clk = {
1215 .b = {
1216 .ctl_reg = PMDH_NS_REG,
1217 .halt_check = DELAY,
1218 .reset_mask = P_PMDH_CLK,
1219 },
1220 .root_en_mask = BIT(11),
1221 .ns_reg = PMDH_NS_REG,
1222 .ns_mask = F_MASK_BASIC,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001223 .set_rate = set_rate_nop,
1224 .freq_tbl = clk_tbl_mdh,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001225 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001226 .c = {
1227 .dbg_name = "pmdh_clk",
1228 .flags = CLKFLAG_MIN | CLKFLAG_MAX,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001229 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001230 VDD_DIG_FMAX_MAP1(NOMINAL, 445500000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001231 CLK_INIT(pmdh_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07001232 .depends = &axi_li_adsp_a_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001233 },
1234};
1235
1236static struct clk_freq_tbl clk_tbl_grp[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001237 F_BASIC( 24576000, lpxo, 1),
1238 F_BASIC( 46080000, pll3, 16),
1239 F_BASIC( 49152000, pll3, 15),
1240 F_BASIC( 52662875, pll3, 14),
1241 F_BASIC( 56713846, pll3, 13),
1242 F_BASIC( 61440000, pll3, 12),
1243 F_BASIC( 67025454, pll3, 11),
1244 F_BASIC( 73728000, pll3, 10),
1245 F_BASIC( 81920000, pll3, 9),
1246 F_BASIC( 92160000, pll3, 8),
1247 F_BASIC(105325714, pll3, 7),
1248 F_BASIC(122880000, pll3, 6),
1249 F_BASIC(147456000, pll3, 5),
1250 F_BASIC(184320000, pll3, 4),
1251 F_BASIC(192000000, pll1, 4),
1252 F_BASIC(245760000, pll3, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001253 /* Sync to AXI. Hence this "rate" is not fixed. */
Matt Wagantall07c45472012-02-10 23:27:24 -08001254 F_RAW(1, &lpxo_clk.c, 0, BIT(14), 0, NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001255 F_END,
1256};
1257
1258static struct rcg_clk grp_2d_clk = {
1259 .b = {
1260 .ctl_reg = GRP_2D_NS_REG,
1261 .en_mask = BIT(7),
1262 .halt_reg = CLK_HALT_STATEA_REG,
1263 .halt_bit = 31,
1264 .reset_mask = P_GRP_2D_CLK,
1265 },
1266 .ns_reg = GRP_2D_NS_REG,
1267 .root_en_mask = BIT(11),
1268 .ns_mask = F_MASK_BASIC | (7 << 12),
1269 .set_rate = set_rate_nop,
1270 .freq_tbl = clk_tbl_grp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001271 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001272 .c = {
1273 .dbg_name = "grp_2d_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001274 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001275 VDD_DIG_FMAX_MAP2(NOMINAL, 192000000, HIGH, 245760000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276 CLK_INIT(grp_2d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07001277 .depends = &axi_grp_2d_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278 },
1279};
1280
1281static struct rcg_clk grp_3d_src_clk = {
1282 .ns_reg = GRP_NS_REG,
1283 .b = {
1284 .ctl_reg = GRP_NS_REG,
1285 .halt_check = NOCHECK,
1286 },
1287 .root_en_mask = BIT(11),
1288 .ns_mask = F_MASK_BASIC | (7 << 12),
1289 .set_rate = set_rate_nop,
1290 .freq_tbl = clk_tbl_grp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001291 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292 .c = {
1293 .dbg_name = "grp_3d_src_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001294 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001295 VDD_DIG_FMAX_MAP2(NOMINAL, 192000000, HIGH, 245760000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296 CLK_INIT(grp_3d_src_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07001297 .depends = &axi_li_grp_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001298 },
1299};
1300
1301static struct branch_clk grp_3d_clk = {
1302 .b = {
1303 .ctl_reg = GRP_NS_REG,
1304 .en_mask = BIT(7),
1305 .halt_reg = CLK_HALT_STATEB_REG,
1306 .halt_bit = 18,
1307 .reset_mask = P_GRP_3D_CLK,
1308 },
1309 .parent = &grp_3d_src_clk.c,
1310 .c = {
1311 .dbg_name = "grp_3d_clk",
1312 .ops = &clk_ops_branch,
1313 CLK_INIT(grp_3d_clk.c),
1314 },
1315};
1316
1317static struct branch_clk imem_clk = {
1318 .b = {
1319 .ctl_reg = GRP_NS_REG,
1320 .en_mask = BIT(9),
1321 .halt_reg = CLK_HALT_STATEB_REG,
1322 .halt_bit = 19,
1323 .reset_mask = P_IMEM_CLK,
1324 },
1325 .parent = &grp_3d_src_clk.c,
1326 .c = {
1327 .dbg_name = "imem_clk",
1328 .ops = &clk_ops_branch,
1329 CLK_INIT(imem_clk.c),
1330 },
1331};
1332
1333static struct clk_freq_tbl clk_tbl_sdc1_3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001334 F_MND8( 0, 0, 0, gnd, 1, 0, 0),
1335 F_MND8( 144000, 19, 12, lpxo, 1, 1, 171),
1336 F_MND8( 400000, 19, 12, lpxo, 1, 2, 123),
1337 F_MND8(16027000, 19, 12, pll3, 3, 14, 215),
1338 F_MND8(17000000, 19, 12, pll3, 4, 19, 206),
1339 F_MND8(20480000, 19, 12, pll3, 4, 23, 212),
1340 F_MND8(24576000, 19, 12, lpxo, 1, 0, 0),
1341 F_MND8(49152000, 19, 12, pll3, 3, 1, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001342 F_END,
1343};
1344
1345static struct rcg_clk sdc1_clk = {
1346 .b = {
1347 .ctl_reg = SDCn_NS_REG(1),
1348 .en_mask = BIT(9),
1349 .halt_reg = CLK_HALT_STATEA_REG,
1350 .halt_bit = 1,
1351 .reset_mask = P_SDC1_CLK,
1352 },
1353 .ns_reg = SDCn_NS_REG(1),
1354 .md_reg = SDCn_NS_REG(1) - 4,
1355 .ns_mask = F_MASK_MND8(19, 12),
Matt Wagantall07c45472012-02-10 23:27:24 -08001356 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357 .root_en_mask = BIT(11),
1358 .freq_tbl = clk_tbl_sdc1_3,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001359 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360 .set_rate = set_rate_mnd,
1361 .c = {
1362 .dbg_name = "sdc1_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001363 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001364 VDD_DIG_FMAX_MAP1(NOMINAL, 49152000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001365 CLK_INIT(sdc1_clk.c),
1366 },
1367};
1368
1369static struct rcg_clk sdc3_clk = {
1370 .b = {
1371 .ctl_reg = SDCn_NS_REG(3),
1372 .en_mask = BIT(9),
1373 .halt_reg = CLK_HALT_STATEB_REG,
1374 .halt_bit = 24,
1375 .reset_mask = P_SDC3_CLK,
1376 },
1377 .ns_reg = SDCn_NS_REG(3),
1378 .md_reg = SDCn_NS_REG(3) - 4,
1379 .ns_mask = F_MASK_MND8(19, 12),
Matt Wagantall07c45472012-02-10 23:27:24 -08001380 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001381 .root_en_mask = BIT(11),
1382 .freq_tbl = clk_tbl_sdc1_3,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001383 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001384 .set_rate = set_rate_mnd,
1385 .c = {
1386 .dbg_name = "sdc3_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001387 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001388 VDD_DIG_FMAX_MAP1(NOMINAL, 49152000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001389 CLK_INIT(sdc3_clk.c),
1390 },
1391};
1392
1393static struct clk_freq_tbl clk_tbl_sdc2_4[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001394 F_MND8( 0, 0, 0, gnd, 1, 0, 0),
1395 F_MND8( 144000, 20, 13, lpxo, 1, 1, 171),
1396 F_MND8( 400000, 20, 13, lpxo, 1, 2, 123),
1397 F_MND8(16027000, 20, 13, pll3, 3, 14, 215),
1398 F_MND8(17000000, 20, 13, pll3, 4, 19, 206),
1399 F_MND8(20480000, 20, 13, pll3, 4, 23, 212),
1400 F_MND8(24576000, 20, 13, lpxo, 1, 0, 0),
1401 F_MND8(49152000, 20, 13, pll3, 3, 1, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001402 F_END,
1403};
1404
1405static struct rcg_clk sdc2_clk = {
1406 .b = {
1407 .ctl_reg = SDCn_NS_REG(2),
1408 .en_mask = BIT(9),
1409 .halt_reg = CLK_HALT_STATEA_REG,
1410 .halt_bit = 0,
1411 .reset_mask = P_SDC2_CLK,
1412 },
1413 .ns_reg = SDCn_NS_REG(2),
1414 .md_reg = SDCn_NS_REG(2) - 4,
1415 .ns_mask = F_MASK_MND8(20, 13),
Matt Wagantall07c45472012-02-10 23:27:24 -08001416 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001417 .root_en_mask = BIT(11),
1418 .freq_tbl = clk_tbl_sdc2_4,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001419 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001420 .set_rate = set_rate_mnd,
1421 .c = {
1422 .dbg_name = "sdc2_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001423 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001424 VDD_DIG_FMAX_MAP1(NOMINAL, 49152000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001425 CLK_INIT(sdc2_clk.c),
1426 },
1427};
1428
1429static struct rcg_clk sdc4_clk = {
1430 .b = {
1431 .ctl_reg = SDCn_NS_REG(4),
1432 .en_mask = BIT(9),
1433 .halt_reg = CLK_HALT_STATEB_REG,
1434 .halt_bit = 25,
1435 .reset_mask = P_SDC4_CLK,
1436 },
1437 .ns_reg = SDCn_NS_REG(4),
1438 .md_reg = SDCn_NS_REG(4) - 4,
1439 .ns_mask = F_MASK_MND8(20, 13),
Matt Wagantall07c45472012-02-10 23:27:24 -08001440 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441 .root_en_mask = BIT(11),
1442 .freq_tbl = clk_tbl_sdc2_4,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001443 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001444 .set_rate = set_rate_mnd,
1445 .c = {
1446 .dbg_name = "sdc4_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001447 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001448 VDD_DIG_FMAX_MAP1(NOMINAL, 49152000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449 CLK_INIT(sdc4_clk.c),
1450 },
1451};
1452
1453static struct clk_freq_tbl clk_tbl_mdp_core[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001454 F_BASIC( 24576000, lpxo, 1),
1455 F_BASIC( 46080000, pll3, 16),
1456 F_BASIC( 49152000, pll3, 15),
1457 F_BASIC( 52663000, pll3, 14),
1458 F_BASIC( 92160000, pll3, 8),
1459 F_BASIC(122880000, pll3, 6),
1460 F_BASIC(147456000, pll3, 5),
1461 F_BASIC(153600000, pll1, 5),
1462 F_BASIC(192000000, pll1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001463 F_END,
1464};
1465
1466static struct rcg_clk mdp_clk = {
1467 .b = {
1468 .ctl_reg = MDP_NS_REG,
1469 .en_mask = BIT(9),
1470 .halt_reg = CLK_HALT_STATEB_REG,
1471 .halt_bit = 16,
1472 .reset_mask = P_MDP_CLK,
1473 },
1474 .ns_reg = MDP_NS_REG,
1475 .root_en_mask = BIT(11),
1476 .ns_mask = F_MASK_BASIC,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477 .set_rate = set_rate_nop,
1478 .freq_tbl = clk_tbl_mdp_core,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001479 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480 .c = {
1481 .dbg_name = "mdp_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001482 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001483 VDD_DIG_FMAX_MAP2(NOMINAL, 153600000, HIGH, 192000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001484 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07001485 .depends = &axi_mdp_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 },
1487};
1488
1489static struct clk_freq_tbl clk_tbl_mdp_lcdc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001490 F_MND16( 0, gnd, 1, 0, 0),
1491 F_MND16(24576000, lpxo, 1, 0, 0),
1492 F_MND16(30720000, pll3, 4, 1, 6),
1493 F_MND16(32768000, pll3, 3, 2, 15),
1494 F_MND16(40960000, pll3, 2, 1, 9),
1495 F_MND16(73728000, pll3, 2, 1, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001496 F_END,
1497};
1498
1499static struct rcg_clk mdp_lcdc_pclk_clk = {
1500 .b = {
1501 .ctl_reg = MDP_LCDC_NS_REG,
1502 .en_mask = BIT(9),
1503 .halt_reg = CLK_HALT_STATEB_REG,
1504 .halt_bit = 28,
1505 .reset_mask = P_MDP_LCDC_PCLK_CLK,
1506 },
1507 .ns_reg = MDP_LCDC_NS_REG,
1508 .md_reg = MDP_LCDC_NS_REG - 4,
1509 .root_en_mask = BIT(11),
1510 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08001511 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001512 .set_rate = set_rate_mnd,
1513 .freq_tbl = clk_tbl_mdp_lcdc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001514 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001515 .c = {
1516 .dbg_name = "mdp_lcdc_pclk_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001517 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001518 VDD_DIG_FMAX_MAP1(NOMINAL, 73728000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001519 CLK_INIT(mdp_lcdc_pclk_clk.c),
1520 },
1521};
1522
1523static struct branch_clk mdp_lcdc_pad_pclk_clk = {
1524 .b = {
1525 .ctl_reg = MDP_LCDC_NS_REG,
1526 .en_mask = BIT(12),
1527 .halt_reg = CLK_HALT_STATEB_REG,
1528 .halt_bit = 29,
1529 .reset_mask = P_MDP_LCDC_PAD_PCLK_CLK,
1530 },
1531 .parent = &mdp_lcdc_pclk_clk.c,
1532 .c = {
1533 .dbg_name = "mdp_lcdc_pad_pclk_clk",
1534 .ops = &clk_ops_branch,
1535 CLK_INIT(mdp_lcdc_pad_pclk_clk.c),
1536 },
1537};
1538
1539static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantall07c45472012-02-10 23:27:24 -08001540 F_RAW( 0, &gnd_clk.c, 0, (0x3<<2), 0, NULL),
1541 F_RAW(24576000, &lpxo_clk.c, 0, (0x1<<2), 0, NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 F_END,
1543};
1544
1545static struct rcg_clk mdp_vsync_clk = {
1546 .b = {
1547 .ctl_reg = MDP_VSYNC_REG,
1548 .en_mask = BIT(0),
1549 .halt_reg = CLK_HALT_STATEB_REG,
1550 .halt_bit = 30,
1551 .reset_mask = P_MDP_VSYNC_CLK,
1552 },
1553 .ns_reg = MDP_VSYNC_REG,
1554 .ns_mask = BM(3, 2),
1555 .freq_tbl = clk_tbl_mdp_vsync,
1556 .set_rate = set_rate_nop,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001557 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 .c = {
1559 .dbg_name = "mdp_vsync_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001560 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001561 VDD_DIG_FMAX_MAP1(NOMINAL, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001562 CLK_INIT(mdp_vsync_clk.c),
1563 },
1564};
1565
1566static struct clk_freq_tbl clk_tbl_mi2s_codec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001567 F_MND16( 0, gnd, 1, 0, 0),
1568 F_MND16( 2048000, lpxo, 4, 1, 3),
1569 F_MND16(12288000, lpxo, 2, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570 F_END,
1571};
1572
1573static struct rcg_clk mi2s_codec_rx_m_clk = {
1574 .b = {
1575 .ctl_reg = MI2S_RX_NS_REG,
1576 .en_mask = BIT(12),
1577 .halt_reg = CLK_HALT_STATEA_REG,
1578 .halt_bit = 12,
1579 .reset_mask = P_MI2S_CODEC_RX_M_CLK,
1580 },
1581 .ns_reg = MI2S_RX_NS_REG,
1582 .md_reg = MI2S_RX_NS_REG - 4,
1583 .root_en_mask = BIT(11),
1584 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08001585 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001586 .set_rate = set_rate_mnd,
1587 .freq_tbl = clk_tbl_mi2s_codec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001588 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001589 .c = {
1590 .dbg_name = "mi2s_codec_rx_m_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001591 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001592 VDD_DIG_FMAX_MAP1(NOMINAL, 12288000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001593 CLK_INIT(mi2s_codec_rx_m_clk.c),
1594 },
1595};
1596
1597static struct branch_clk mi2s_codec_rx_s_clk = {
1598 .b = {
1599 .ctl_reg = MI2S_RX_NS_REG,
1600 .en_mask = BIT(9),
1601 .halt_reg = CLK_HALT_STATEA_REG,
1602 .halt_bit = 13,
1603 .reset_mask = P_MI2S_CODEC_RX_S_CLK,
1604 },
1605 .parent = &mi2s_codec_rx_m_clk.c,
1606 .c = {
1607 .dbg_name = "mi2s_codec_rx_s_clk",
1608 .ops = &clk_ops_branch,
1609 CLK_INIT(mi2s_codec_rx_s_clk.c),
1610 },
1611};
1612
1613static struct rcg_clk mi2s_codec_tx_m_clk = {
1614 .b = {
1615 .ctl_reg = MI2S_TX_NS_REG,
1616 .en_mask = BIT(12),
1617 .halt_reg = CLK_HALT_STATEC_REG,
1618 .halt_bit = 8,
1619 .reset_mask = P_MI2S_CODEC_TX_M_CLK,
1620 },
1621 .ns_reg = MI2S_TX_NS_REG,
1622 .md_reg = MI2S_TX_NS_REG - 4,
1623 .root_en_mask = BIT(11),
1624 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08001625 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001626 .set_rate = set_rate_mnd,
1627 .freq_tbl = clk_tbl_mi2s_codec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001628 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001629 .c = {
1630 .dbg_name = "mi2s_codec_tx_m_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001631 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001632 VDD_DIG_FMAX_MAP1(NOMINAL, 12288000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001633 CLK_INIT(mi2s_codec_tx_m_clk.c),
1634 },
1635};
1636
1637static struct branch_clk mi2s_codec_tx_s_clk = {
1638 .b = {
1639 .ctl_reg = MI2S_TX_NS_REG,
1640 .en_mask = BIT(9),
1641 .halt_reg = CLK_HALT_STATEA_REG,
1642 .halt_bit = 11,
1643 .reset_mask = P_MI2S_CODEC_TX_S_CLK,
1644 },
1645 .parent = &mi2s_codec_tx_m_clk.c,
1646 .c = {
1647 .dbg_name = "mi2s_codec_tx_s_clk",
1648 .ops = &clk_ops_branch,
1649 CLK_INIT(mi2s_codec_tx_s_clk.c),
1650 },
1651};
1652
1653static struct clk_freq_tbl clk_tbl_mi2s[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001654 F_MND16( 0, gnd, 1, 0, 0),
1655 F_MND16(12288000, lpxo, 2, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656 F_END,
1657};
1658
1659static struct rcg_clk mi2s_m_clk = {
1660 .b = {
1661 .ctl_reg = MI2S_NS_REG,
1662 .en_mask = BIT(12),
1663 .halt_reg = CLK_HALT_STATEC_REG,
1664 .halt_bit = 4,
1665 .reset_mask = P_MI2S_M_CLK,
1666 },
1667 .ns_reg = MI2S_NS_REG,
1668 .md_reg = MI2S_NS_REG - 4,
1669 .root_en_mask = BIT(11),
1670 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08001671 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001672 .set_rate = set_rate_mnd,
1673 .freq_tbl = clk_tbl_mi2s,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001674 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675 .c = {
1676 .dbg_name = "mi2s_m_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001677 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001678 VDD_DIG_FMAX_MAP1(NOMINAL, 12288000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001679 CLK_INIT(mi2s_m_clk.c),
1680 },
1681};
1682
1683static struct branch_clk mi2s_s_clk = {
1684 .b = {
1685 .ctl_reg = MI2S_NS_REG,
1686 .en_mask = BIT(9),
1687 .halt_reg = CLK_HALT_STATEC_REG,
1688 .halt_bit = 3,
1689 .reset_mask = P_MI2S_S_CLK,
1690 },
1691 .parent = &mi2s_m_clk.c,
1692 .c = {
1693 .dbg_name = "mi2s_s_clk",
1694 .ops = &clk_ops_branch,
1695 CLK_INIT(mi2s_s_clk.c),
1696 },
1697};
1698
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001699#define F_SDAC(f, s, div, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 { \
1701 .freq_hz = f, \
1702 .md_val = MD16(m, n), \
1703 .ns_val = N16(m, n) | SPDIV(SRC_SEL_SDAC_##s, div), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704 .src_clk = &s##_clk.c, \
1705 }
1706
1707static struct clk_freq_tbl clk_tbl_sdac[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001708 F_SDAC( 256000, lpxo, 4, 1, 24),
1709 F_SDAC( 352800, lpxo, 1, 147, 10240),
1710 F_SDAC( 384000, lpxo, 4, 1, 16),
1711 F_SDAC( 512000, lpxo, 4, 1, 12),
1712 F_SDAC( 705600, lpxo, 1, 147, 5120),
1713 F_SDAC( 768000, lpxo, 4, 1, 8),
1714 F_SDAC(1024000, lpxo, 4, 1, 6),
1715 F_SDAC(1411200, lpxo, 1, 147, 2560),
1716 F_SDAC(1536000, lpxo, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001717 F_END,
1718};
1719
1720static struct rcg_clk sdac_clk = {
1721 .b = {
1722 .ctl_reg = SDAC_NS_REG,
1723 .en_mask = BIT(9),
1724 .halt_reg = CLK_HALT_STATEA_REG,
1725 .halt_bit = 2,
1726 .reset_mask = P_SDAC_CLK,
1727 },
1728 .ns_reg = SDAC_NS_REG,
1729 .md_reg = SDAC_NS_REG - 4,
1730 .root_en_mask = BIT(11),
Matt Wagantall07c45472012-02-10 23:27:24 -08001731 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732 .freq_tbl = clk_tbl_sdac,
1733 .ns_mask = F_MASK_MND16,
1734 .set_rate = set_rate_mnd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001735 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001736 .c = {
1737 .dbg_name = "sdac_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001738 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001739 VDD_DIG_FMAX_MAP1(NOMINAL, 1536000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001740 CLK_INIT(sdac_clk.c),
1741 },
1742};
1743
1744static struct branch_clk sdac_m_clk = {
1745 .b = {
1746 .ctl_reg = SDAC_NS_REG,
1747 .en_mask = BIT(12),
1748 .halt_reg = CLK_HALT_STATEB_REG,
1749 .halt_bit = 17,
1750 .reset_mask = P_SDAC_M_CLK,
1751 },
1752 .parent = &sdac_clk.c,
1753 .c = {
1754 .dbg_name = "sdac_m_clk",
1755 .ops = &clk_ops_branch,
1756 CLK_INIT(sdac_m_clk.c),
1757 },
1758};
1759
1760static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001761 F_MND8( 0, 0, 0, gnd, 1, 0, 0),
1762 F_MND8(27000000, 23, 16, pll4, 2, 2, 33),
1763 F_MND8(74250000, 23, 16, pll4, 2, 1, 6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 F_END,
1765};
1766
1767static struct rcg_clk tv_clk = {
1768 .ns_reg = TV_NS_REG,
1769 .b = {
1770 .ctl_reg = TV_NS_REG,
1771 .halt_check = NOCHECK,
1772 },
1773 .md_reg = TV_NS_REG - 4,
1774 .ns_mask = F_MASK_MND8(23, 16),
Matt Wagantall07c45472012-02-10 23:27:24 -08001775 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001776 .root_en_mask = BIT(11),
1777 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001778 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001779 .set_rate = set_rate_mnd,
1780 .c = {
1781 .dbg_name = "tv_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001782 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001783 VDD_DIG_FMAX_MAP1(NOMINAL, 74250000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001784 CLK_INIT(tv_clk.c),
1785 },
1786};
1787
1788static struct branch_clk hdmi_clk = {
1789 .b = {
1790 .ctl_reg = HDMI_NS_REG,
1791 .en_mask = BIT(9),
1792 .halt_reg = CLK_HALT_STATEC_REG,
1793 .halt_bit = 7,
1794 .reset_mask = P_HDMI_CLK,
1795 },
1796 .parent = &tv_clk.c,
1797 .c = {
1798 .dbg_name = "hdmi_clk",
1799 .ops = &clk_ops_branch,
1800 CLK_INIT(hdmi_clk.c),
1801 },
1802};
1803
1804static struct branch_clk tv_dac_clk = {
1805 .b = {
1806 .ctl_reg = TV_NS_REG,
1807 .en_mask = BIT(12),
1808 .halt_reg = CLK_HALT_STATEB_REG,
1809 .halt_bit = 27,
1810 .reset_mask = P_TV_DAC_CLK,
1811 },
1812 .parent = &tv_clk.c,
1813 .c = {
1814 .dbg_name = "tv_dac_clk",
1815 .ops = &clk_ops_branch,
1816 CLK_INIT(tv_dac_clk.c),
1817 },
1818};
1819
1820static struct branch_clk tv_enc_clk = {
1821 .b = {
1822 .ctl_reg = TV_NS_REG,
1823 .en_mask = BIT(9),
1824 .halt_reg = CLK_HALT_STATEB_REG,
1825 .halt_bit = 10,
1826 .reset_mask = P_TV_ENC_CLK,
1827 },
1828 .parent = &tv_clk.c,
1829 .c = {
1830 .dbg_name = "tv_enc_clk",
1831 .ops = &clk_ops_branch,
1832 CLK_INIT(tv_enc_clk.c),
1833 },
1834};
1835
1836/* Hacking root & branch into one param. */
1837static struct branch_clk tsif_ref_clk = {
1838 .b = {
1839 .ctl_reg = TSIF_NS_REG,
1840 .en_mask = BIT(9)|BIT(11),
1841 .halt_reg = CLK_HALT_STATEB_REG,
1842 .halt_bit = 11,
1843 .reset_mask = P_TSIF_REF_CLK,
1844 },
1845 .parent = &tv_clk.c,
1846 .c = {
1847 .dbg_name = "tsif_ref_clk",
1848 .ops = &clk_ops_branch,
1849 CLK_INIT(tsif_ref_clk.c),
1850 },
1851};
1852
1853static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001854 F_MND8( 0, 0, 0, gnd, 1, 0, 0),
1855 F_MND8(60000000, 23, 16, pll1, 2, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001856 F_END,
1857};
1858
1859static struct rcg_clk usb_hs_src_clk = {
1860 .ns_reg = USBH_NS_REG,
1861 .b = {
1862 .ctl_reg = USBH_NS_REG,
1863 .halt_check = NOCHECK,
1864 },
1865 .md_reg = USBH_NS_REG - 4,
1866 .ns_mask = F_MASK_MND8(23, 16),
Matt Wagantall07c45472012-02-10 23:27:24 -08001867 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001868 .root_en_mask = BIT(11),
1869 .freq_tbl = clk_tbl_usb,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001870 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001871 .set_rate = set_rate_mnd,
1872 .c = {
1873 .dbg_name = "usb_hs_src_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001874 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001875 VDD_DIG_FMAX_MAP1(NOMINAL, 60000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001876 CLK_INIT(usb_hs_src_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07001877 .depends = &axi_li_adsp_a_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001878 },
1879};
1880
1881static struct branch_clk usb_hs_clk = {
1882 .b = {
1883 .ctl_reg = USBH_NS_REG,
1884 .en_mask = BIT(9),
1885 .halt_reg = CLK_HALT_STATEB_REG,
1886 .halt_bit = 26,
1887 .reset_mask = P_USB_HS_CLK,
1888 },
1889 .c = {
1890 .dbg_name = "usb_hs_clk",
1891 .ops = &clk_ops_branch,
1892 CLK_INIT(usb_hs_clk.c),
1893 },
1894};
1895
1896static struct branch_clk usb_hs_core_clk = {
1897 .b = {
1898 .ctl_reg = USBH_NS_REG,
1899 .en_mask = BIT(13),
1900 .halt_reg = CLK_HALT_STATEA_REG,
1901 .halt_bit = 27,
1902 .reset_mask = P_USB_HS_CORE_CLK,
1903 },
1904 .parent = &usb_hs_src_clk.c,
1905 .c = {
1906 .dbg_name = "usb_hs_core_clk",
1907 .ops = &clk_ops_branch,
1908 CLK_INIT(usb_hs_core_clk.c),
1909 },
1910};
1911
1912static struct branch_clk usb_hs2_clk = {
1913 .b = {
1914 .ctl_reg = USBH2_NS_REG,
1915 .en_mask = BIT(9),
1916 .halt_reg = CLK_HALT_STATEB_REG,
1917 .halt_bit = 3,
1918 .reset_mask = P_USB_HS2_CLK,
1919 },
1920 .parent = &usb_hs_src_clk.c,
1921 .c = {
1922 .dbg_name = "usb_hs2_clk",
1923 .ops = &clk_ops_branch,
1924 CLK_INIT(usb_hs2_clk.c),
1925 },
1926};
1927
1928static struct branch_clk usb_hs2_core_clk = {
1929 .b = {
1930 .ctl_reg = USBH2_NS_REG,
1931 .en_mask = BIT(4),
1932 .halt_reg = CLK_HALT_STATEA_REG,
1933 .halt_bit = 28,
1934 .reset_mask = P_USB_HS2_CORE_CLK,
1935 },
1936 .parent = &usb_hs_src_clk.c,
1937 .c = {
1938 .dbg_name = "usb_hs2_core_clk",
1939 .ops = &clk_ops_branch,
1940 CLK_INIT(usb_hs2_core_clk.c),
1941 },
1942};
1943
1944static struct branch_clk usb_hs3_clk = {
1945 .b = {
1946 .ctl_reg = USBH3_NS_REG,
1947 .en_mask = BIT(9),
1948 .halt_reg = CLK_HALT_STATEB_REG,
1949 .halt_bit = 2,
1950 .reset_mask = P_USB_HS3_CLK,
1951 },
1952 .parent = &usb_hs_src_clk.c,
1953 .c = {
1954 .dbg_name = "usb_hs3_clk",
1955 .ops = &clk_ops_branch,
1956 CLK_INIT(usb_hs3_clk.c),
1957 },
1958};
1959
1960static struct branch_clk usb_hs3_core_clk = {
1961 .b = {
1962 .ctl_reg = USBH3_NS_REG,
1963 .en_mask = BIT(4),
1964 .halt_reg = CLK_HALT_STATEA_REG,
1965 .halt_bit = 29,
1966 .reset_mask = P_USB_HS3_CORE_CLK,
1967 },
1968 .parent = &usb_hs_src_clk.c,
1969 .c = {
1970 .dbg_name = "usb_hs3_core_clk",
1971 .ops = &clk_ops_branch,
1972 CLK_INIT(usb_hs3_core_clk.c),
1973 },
1974};
1975
1976static struct clk_freq_tbl clk_tbl_vfe_jpeg[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001977 F_MND16( 24576000, lpxo, 1, 0, 0),
1978 F_MND16( 36864000, pll3, 4, 1, 5),
1979 F_MND16( 46080000, pll3, 4, 1, 4),
1980 F_MND16( 61440000, pll3, 4, 1, 3),
1981 F_MND16( 73728000, pll3, 2, 1, 5),
1982 F_MND16( 81920000, pll3, 3, 1, 3),
1983 F_MND16( 92160000, pll3, 4, 1, 2),
1984 F_MND16( 98304000, pll3, 3, 2, 5),
1985 F_MND16(105326000, pll3, 2, 2, 7),
1986 F_MND16(122880000, pll3, 2, 1, 3),
1987 F_MND16(147456000, pll3, 2, 2, 5),
1988 F_MND16(153600000, pll1, 2, 2, 5),
1989 F_MND16(192000000, pll1, 4, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001990 F_END,
1991};
1992
1993static struct rcg_clk jpeg_clk = {
1994 .b = {
1995 .ctl_reg = JPEG_NS_REG,
1996 .en_mask = BIT(9),
1997 .halt_reg = CLK_HALT_STATEB_REG,
1998 .halt_bit = 1,
1999 .reset_mask = P_JPEG_CLK,
2000 },
2001 .ns_reg = JPEG_NS_REG,
2002 .md_reg = JPEG_NS_REG - 4,
2003 .root_en_mask = BIT(11),
2004 .freq_tbl = clk_tbl_vfe_jpeg,
2005 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08002006 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002007 .set_rate = set_rate_mnd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002008 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002009 .c = {
2010 .dbg_name = "jpeg_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002011 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002012 VDD_DIG_FMAX_MAP2(NOMINAL, 153600000, HIGH, 192000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002013 CLK_INIT(jpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07002014 .depends = &axi_li_jpeg_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002015 },
2016};
2017
2018static struct rcg_clk vfe_clk = {
2019 .b = {
2020 .ctl_reg = CAM_VFE_NS_REG,
2021 .en_mask = BIT(9),
2022 .halt_reg = CLK_HALT_STATEB_REG,
2023 .halt_bit = 0,
2024 .reset_mask = P_VFE_CLK,
2025 },
2026 .ns_reg = CAM_VFE_NS_REG,
2027 .md_reg = CAM_VFE_NS_REG - 4,
2028 .root_en_mask = BIT(13),
2029 .freq_tbl = clk_tbl_vfe_jpeg,
2030 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08002031 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002032 .set_rate = set_rate_mnd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002033 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002034 .c = {
2035 .dbg_name = "vfe_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002036 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002037 VDD_DIG_FMAX_MAP2(NOMINAL, 153600000, HIGH, 192000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002038 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07002039 .depends = &axi_li_vfe_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002040 },
2041};
2042
2043static struct branch_clk vfe_mdc_clk = {
2044 .b = {
2045 .ctl_reg = CAM_VFE_NS_REG,
2046 .en_mask = BIT(11),
2047 .halt_reg = CLK_HALT_STATEA_REG,
2048 .halt_bit = 9,
2049 .reset_mask = P_VFE_MDC_CLK,
2050 },
2051 .parent = &vfe_clk.c,
2052 .c = {
2053 .dbg_name = "vfe_mdc_clk",
2054 .ops = &clk_ops_branch,
2055 CLK_INIT(vfe_mdc_clk.c),
2056 },
2057};
2058
2059static struct branch_clk vfe_camif_clk = {
2060 .b = {
2061 .ctl_reg = CAM_VFE_NS_REG,
2062 .en_mask = BIT(15),
2063 .halt_reg = CLK_HALT_STATEC_REG,
2064 .halt_bit = 13,
2065 .reset_mask = P_VFE_CAMIF_CLK,
2066 },
2067 .parent = &vfe_clk.c,
2068 .c = {
2069 .dbg_name = "vfe_camif_clk",
2070 .ops = &clk_ops_branch,
2071 CLK_INIT(vfe_camif_clk.c),
2072 },
2073};
2074
2075static struct branch_clk csi0_vfe_clk = {
2076 .b = {
2077 .ctl_reg = CSI_NS_REG,
2078 .en_mask = BIT(15),
2079 .halt_reg = CLK_HALT_STATEC_REG,
2080 .halt_bit = 16,
2081 .reset_mask = P_CSI0_VFE_CLK,
2082 },
2083 .parent = &vfe_clk.c,
2084 .c = {
2085 .dbg_name = "csi0_vfe_clk",
2086 .ops = &clk_ops_branch,
2087 CLK_INIT(csi0_vfe_clk.c),
2088 },
2089};
2090
2091static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002092 F_MND16( 0, gnd, 1, 0, 0),
2093 F_MND16( 6000000, pll1, 4, 1, 32),
2094 F_MND16( 8000000, pll1, 4, 1, 24),
2095 F_MND16(12000000, pll1, 4, 1, 16),
2096 F_MND16(16000000, pll1, 4, 1, 12),
2097 F_MND16(19200000, pll1, 4, 1, 10),
2098 F_MND16(24000000, pll1, 4, 1, 8),
2099 F_MND16(32000000, pll1, 4, 1, 6),
2100 F_MND16(48000000, pll1, 4, 1, 4),
2101 F_MND16(64000000, pll1, 4, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002102 F_END,
2103};
2104
2105static struct rcg_clk cam_m_clk = {
2106 .b = {
2107 .ctl_reg = CAM_NS_REG,
2108 .halt_check = DELAY,
2109 .reset_mask = P_CAM_M_CLK,
2110 },
2111 .ns_reg = CAM_NS_REG,
2112 .md_reg = CAM_NS_REG - 4,
2113 .root_en_mask = BIT(9),
2114 .freq_tbl = clk_tbl_cam,
2115 .ns_mask = F_MASK_MND16,
Matt Wagantall07c45472012-02-10 23:27:24 -08002116 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002117 .set_rate = set_rate_mnd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002118 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002119 .c = {
2120 .dbg_name = "cam_m_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002121 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002122 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002123 CLK_INIT(cam_m_clk.c),
2124 },
2125};
2126
2127static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002128 F_MND8( 24576000, 22, 15, lpxo, 1, 0, 0),
2129 F_MND8( 30720000, 22, 15, pll3, 4, 1, 6),
2130 F_MND8( 61440000, 22, 15, pll3, 4, 1, 3),
2131 F_MND8( 81920000, 22, 15, pll3, 3, 1, 3),
2132 F_MND8(122880000, 22, 15, pll3, 3, 1, 2),
2133 F_MND8(147456000, 22, 15, pll3, 1, 1, 5),
2134 F_MND8(153600000, 22, 15, pll1, 1, 1, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002135 F_END,
2136};
2137
2138static struct rcg_clk vpe_clk = {
2139 .b = {
2140 .ctl_reg = VPE_NS_REG,
2141 .en_mask = BIT(9),
2142 .halt_reg = CLK_HALT_STATEC_REG,
2143 .halt_bit = 10,
2144 .reset_mask = P_VPE_CLK,
2145 },
2146 .ns_reg = VPE_NS_REG,
2147 .md_reg = VPE_NS_REG - 4,
2148 .ns_mask = F_MASK_MND8(22, 15),
Matt Wagantall07c45472012-02-10 23:27:24 -08002149 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002150 .root_en_mask = BIT(11),
2151 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002152 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002153 .set_rate = set_rate_mnd,
2154 .c = {
2155 .dbg_name = "vpe_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002156 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002157 VDD_DIG_FMAX_MAP1(NOMINAL, 153600000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002158 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07002159 .depends = &axi_vpe_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002160 },
2161};
2162
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002163static struct clk_freq_tbl clk_tbl_mfc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002164 F_MND8( 24576000, 24, 17, lpxo, 1, 0, 0),
2165 F_MND8( 30720000, 24, 17, pll3, 4, 1, 6),
2166 F_MND8( 61440000, 24, 17, pll3, 4, 1, 3),
2167 F_MND8( 81920000, 24, 17, pll3, 3, 1, 3),
2168 F_MND8(122880000, 24, 17, pll3, 3, 1, 2),
2169 F_MND8(147456000, 24, 17, pll3, 1, 1, 5),
2170 F_MND8(153600000, 24, 17, pll1, 1, 1, 5),
2171 F_MND8(170667000, 24, 17, pll1, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002172 F_END,
2173};
2174
2175static struct rcg_clk mfc_clk = {
2176 .b = {
2177 .ctl_reg = MFC_NS_REG,
2178 .en_mask = BIT(9),
2179 .halt_reg = CLK_HALT_STATEC_REG,
2180 .halt_bit = 12,
2181 .reset_mask = P_MFC_CLK,
2182 },
2183 .ns_reg = MFC_NS_REG,
2184 .md_reg = MFC_NS_REG - 4,
2185 .ns_mask = F_MASK_MND8(24, 17),
Matt Wagantall07c45472012-02-10 23:27:24 -08002186 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187 .root_en_mask = BIT(11),
2188 .freq_tbl = clk_tbl_mfc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002189 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002190 .set_rate = set_rate_mnd,
2191 .c = {
2192 .dbg_name = "mfc_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002193 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002194 VDD_DIG_FMAX_MAP1(NOMINAL, 170667000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002195 CLK_INIT(mfc_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07002196 .depends = &axi_mfc_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002197 },
2198};
2199
2200static struct branch_clk mfc_div2_clk = {
2201 .b = {
2202 .ctl_reg = MFC_NS_REG,
2203 .en_mask = BIT(15),
2204 .halt_reg = CLK_HALT_STATEC_REG,
2205 .halt_bit = 11,
2206 .reset_mask = P_MFC_DIV2_CLK,
2207 },
2208 .parent = &mfc_clk.c,
2209 .c = {
2210 .dbg_name = "mfc_div2_clk",
2211 .ops = &clk_ops_branch,
2212 CLK_INIT(mfc_div2_clk.c),
2213 },
2214};
2215
2216static struct clk_freq_tbl clk_tbl_spi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002217 F_MND8( 0, 0, 0, gnd, 1, 0, 0),
2218 F_MND8( 9963243, 19, 12, pll3, 4, 2, 37),
Matt Wagantalla7df37f2011-11-11 11:28:11 -08002219 F_MND8(24576000, 19, 12, lpxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002220 F_MND8(26331429, 19, 12, pll3, 4, 1, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002221 F_END,
2222};
2223
2224static struct rcg_clk spi_clk = {
2225 .b = {
2226 .ctl_reg = SPI_NS_REG,
2227 .en_mask = BIT(9),
2228 .halt_reg = CLK_HALT_STATEC_REG,
2229 .halt_bit = 0,
2230 .reset_mask = P_SPI_CLK,
2231 },
2232 .ns_reg = SPI_NS_REG,
2233 .md_reg = SPI_NS_REG - 4,
2234 .ns_mask = F_MASK_MND8(19, 12),
Matt Wagantall07c45472012-02-10 23:27:24 -08002235 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002236 .root_en_mask = BIT(11),
2237 .freq_tbl = clk_tbl_spi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002238 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239 .set_rate = set_rate_mnd,
2240 .c = {
2241 .dbg_name = "spi_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002242 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002243 VDD_DIG_FMAX_MAP1(NOMINAL, 26331429),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002244 CLK_INIT(spi_clk.c),
2245 },
2246};
2247
2248static struct clk_freq_tbl clk_tbl_lpa_codec[] = {
Matt Wagantall07c45472012-02-10 23:27:24 -08002249 F_RAW(1, NULL, 0, 0, 0, NULL), /* src MI2S_CODEC_RX */
2250 F_RAW(2, NULL, 0, 1, 0, NULL), /* src ECODEC_CIF */
2251 F_RAW(3, NULL, 0, 2, 0, NULL), /* src MI2S */
2252 F_RAW(4, NULL, 0, 3, 0, NULL), /* src SDAC */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002253 F_END,
2254};
2255
2256static struct rcg_clk lpa_codec_clk = {
2257 .b = {
2258 .ctl_reg = LPA_NS_REG,
2259 .en_mask = BIT(9),
2260 .halt_reg = CLK_HALT_STATEC_REG,
2261 .halt_bit = 6,
2262 .reset_mask = P_LPA_CODEC_CLK,
2263 },
2264 .ns_reg = LPA_NS_REG,
2265 .ns_mask = BM(1, 0),
2266 .set_rate = set_rate_nop,
2267 .freq_tbl = clk_tbl_lpa_codec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002268 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002269 .c = {
2270 .dbg_name = "lpa_codec_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002271 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002272 VDD_DIG_FMAX_MAP1(LOW, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 CLK_INIT(lpa_codec_clk.c),
2274 },
2275};
2276
2277static struct clk_freq_tbl clk_tbl_mdc[] = {
Matt Wagantall07c45472012-02-10 23:27:24 -08002278 F_RAW(1, NULL, 0, 0, 0, NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002279 F_END
2280};
2281
2282static struct rcg_clk mdc_clk = {
2283 .b = {
2284 .ctl_reg = MDC_NS_REG,
2285 .en_mask = BIT(9),
2286 .halt_reg = CLK_HALT_STATEA_REG,
2287 .halt_bit = 10,
2288 .reset_mask = P_MDC_CLK,
2289 },
2290 .ns_reg = MDC_NS_REG,
2291 .root_en_mask = BIT(11),
2292 .freq_tbl = clk_tbl_mdc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002293 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294 .set_rate = set_rate_nop,
2295 .c = {
2296 .dbg_name = "mdc_clk",
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002297 .ops = &clk_ops_rcg_7x30,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002298 VDD_DIG_FMAX_MAP1(LOW, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002299 CLK_INIT(mdc_clk.c),
2300 },
2301};
2302
2303static struct branch_clk lpa_core_clk = {
2304 .b = {
2305 .ctl_reg = LPA_NS_REG,
2306 .en_mask = BIT(5),
2307 .halt_reg = CLK_HALT_STATEC_REG,
2308 .halt_bit = 5,
2309 .reset_mask = P_LPA_CORE_CLK,
2310 },
2311 .c = {
2312 .dbg_name = "lpa_core_clk",
2313 .ops = &clk_ops_branch,
2314 CLK_INIT(lpa_core_clk.c),
2315 },
2316};
2317
2318static DEFINE_CLK_PCOM(adsp_clk, ADSP_CLK, CLKFLAG_SKIP_AUTO_OFF);
2319static DEFINE_CLK_PCOM(codec_ssbi_clk, CODEC_SSBI_CLK, CLKFLAG_SKIP_AUTO_OFF);
2320static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN);
2321static DEFINE_CLK_PCOM(ebi1_fixed_clk, EBI1_FIXED_CLK, CLKFLAG_MIN |
2322 CLKFLAG_SKIP_AUTO_OFF);
2323static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2324static DEFINE_CLK_PCOM(gp_clk, GP_CLK, CLKFLAG_SKIP_AUTO_OFF);
2325static DEFINE_CLK_PCOM(uart3_clk, UART3_CLK, 0);
2326static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLKFLAG_MIN);
2327
2328static DEFINE_CLK_PCOM(p_grp_2d_clk, GRP_2D_CLK, CLKFLAG_SKIP_AUTO_OFF);
2329static DEFINE_CLK_PCOM(p_grp_2d_p_clk, GRP_2D_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2330static DEFINE_CLK_PCOM(p_hdmi_clk, HDMI_CLK, CLKFLAG_SKIP_AUTO_OFF);
Matt Wagantall2eedd222011-11-16 12:55:21 -08002331static DEFINE_CLK_PCOM(p_jpeg_clk, JPEG_CLK, CLKFLAG_MIN);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002332static DEFINE_CLK_PCOM(p_jpeg_p_clk, JPEG_P_CLK, 0);
2333static DEFINE_CLK_PCOM(p_lpa_codec_clk, LPA_CODEC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2334static DEFINE_CLK_PCOM(p_lpa_core_clk, LPA_CORE_CLK, CLKFLAG_SKIP_AUTO_OFF);
2335static DEFINE_CLK_PCOM(p_lpa_p_clk, LPA_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2336static DEFINE_CLK_PCOM(p_mi2s_m_clk, MI2S_M_CLK, CLKFLAG_SKIP_AUTO_OFF);
2337static DEFINE_CLK_PCOM(p_mi2s_s_clk, MI2S_S_CLK, CLKFLAG_SKIP_AUTO_OFF);
2338static DEFINE_CLK_PCOM(p_mi2s_codec_rx_m_clk, MI2S_CODEC_RX_M_CLK,
2339 CLKFLAG_SKIP_AUTO_OFF);
2340static DEFINE_CLK_PCOM(p_mi2s_codec_rx_s_clk, MI2S_CODEC_RX_S_CLK,
2341 CLKFLAG_SKIP_AUTO_OFF);
2342static DEFINE_CLK_PCOM(p_mi2s_codec_tx_m_clk, MI2S_CODEC_TX_M_CLK,
2343 CLKFLAG_SKIP_AUTO_OFF);
2344static DEFINE_CLK_PCOM(p_mi2s_codec_tx_s_clk, MI2S_CODEC_TX_S_CLK,
2345 CLKFLAG_SKIP_AUTO_OFF);
2346static DEFINE_CLK_PCOM(p_sdac_clk, SDAC_CLK, 0);
2347static DEFINE_CLK_PCOM(p_sdac_m_clk, SDAC_M_CLK, 0);
2348static DEFINE_CLK_PCOM(p_vfe_clk, VFE_CLK, CLKFLAG_SKIP_AUTO_OFF);
2349static DEFINE_CLK_PCOM(p_vfe_camif_clk, VFE_CAMIF_CLK, CLKFLAG_SKIP_AUTO_OFF);
2350static DEFINE_CLK_PCOM(p_vfe_mdc_clk, VFE_MDC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2351static DEFINE_CLK_PCOM(p_vfe_p_clk, VFE_P_CLK, 0);
2352static DEFINE_CLK_PCOM(p_grp_3d_clk, GRP_3D_CLK, CLKFLAG_SKIP_AUTO_OFF);
2353static DEFINE_CLK_PCOM(p_grp_3d_p_clk, GRP_3D_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2354static DEFINE_CLK_PCOM(p_imem_clk, IMEM_CLK, 0);
2355static DEFINE_CLK_PCOM(p_mdp_lcdc_pad_pclk_clk, MDP_LCDC_PAD_PCLK_CLK,
2356 CLKFLAG_SKIP_AUTO_OFF);
2357static DEFINE_CLK_PCOM(p_mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK,
2358 CLKFLAG_SKIP_AUTO_OFF);
2359static DEFINE_CLK_PCOM(p_mdp_p_clk, MDP_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2360static DEFINE_CLK_PCOM(p_mdp_vsync_clk, MDP_VSYNC_CLK, 0);
2361static DEFINE_CLK_PCOM(p_tsif_ref_clk, TSIF_REF_CLK, CLKFLAG_SKIP_AUTO_OFF);
2362static DEFINE_CLK_PCOM(p_tsif_p_clk, TSIF_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2363static DEFINE_CLK_PCOM(p_tv_dac_clk, TV_DAC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2364static DEFINE_CLK_PCOM(p_tv_enc_clk, TV_ENC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2365static DEFINE_CLK_PCOM(p_emdh_clk, EMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX);
2366static DEFINE_CLK_PCOM(p_emdh_p_clk, EMDH_P_CLK, 0);
2367static DEFINE_CLK_PCOM(p_i2c_clk, I2C_CLK, CLKFLAG_SKIP_AUTO_OFF);
2368static DEFINE_CLK_PCOM(p_i2c_2_clk, I2C_2_CLK, CLKFLAG_SKIP_AUTO_OFF);
2369static DEFINE_CLK_PCOM(p_mdc_clk, MDC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2370static DEFINE_CLK_PCOM(p_pmdh_clk, PMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX);
2371static DEFINE_CLK_PCOM(p_pmdh_p_clk, PMDH_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2372static DEFINE_CLK_PCOM(p_sdc1_clk, SDC1_CLK, 0);
2373static DEFINE_CLK_PCOM(p_sdc1_p_clk, SDC1_P_CLK, 0);
2374static DEFINE_CLK_PCOM(p_sdc2_clk, SDC2_CLK, 0);
2375static DEFINE_CLK_PCOM(p_sdc2_p_clk, SDC2_P_CLK, 0);
2376static DEFINE_CLK_PCOM(p_sdc3_clk, SDC3_CLK, 0);
2377static DEFINE_CLK_PCOM(p_sdc3_p_clk, SDC3_P_CLK, 0);
2378static DEFINE_CLK_PCOM(p_sdc4_clk, SDC4_CLK, 0);
2379static DEFINE_CLK_PCOM(p_sdc4_p_clk, SDC4_P_CLK, 0);
2380static DEFINE_CLK_PCOM(p_uart2_clk, UART2_CLK, CLKFLAG_SKIP_AUTO_OFF);
2381static DEFINE_CLK_PCOM(p_usb_hs2_clk, USB_HS2_CLK, 0);
2382static DEFINE_CLK_PCOM(p_usb_hs2_core_clk, USB_HS2_CORE_CLK, 0);
2383static DEFINE_CLK_PCOM(p_usb_hs2_p_clk, USB_HS2_P_CLK, 0);
2384static DEFINE_CLK_PCOM(p_usb_hs3_clk, USB_HS3_CLK, 0);
2385static DEFINE_CLK_PCOM(p_usb_hs3_core_clk, USB_HS3_CORE_CLK, 0);
2386static DEFINE_CLK_PCOM(p_usb_hs3_p_clk, USB_HS3_P_CLK, 0);
2387static DEFINE_CLK_PCOM(p_qup_i2c_clk, QUP_I2C_CLK, CLKFLAG_SKIP_AUTO_OFF);
2388static DEFINE_CLK_PCOM(p_spi_clk, SPI_CLK, CLKFLAG_SKIP_AUTO_OFF);
2389static DEFINE_CLK_PCOM(p_spi_p_clk, SPI_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2390static DEFINE_CLK_PCOM(p_uart1_clk, UART1_CLK, 0);
2391static DEFINE_CLK_PCOM(p_uart1dm_clk, UART1DM_CLK, 0);
2392static DEFINE_CLK_PCOM(p_uart2dm_clk, UART2DM_CLK, CLKFLAG_SKIP_AUTO_OFF);
2393static DEFINE_CLK_PCOM(p_usb_hs_clk, USB_HS_CLK, 0);
2394static DEFINE_CLK_PCOM(p_usb_hs_core_clk, USB_HS_CORE_CLK, 0);
2395static DEFINE_CLK_PCOM(p_usb_hs_p_clk, USB_HS_P_CLK, 0);
2396static DEFINE_CLK_PCOM(p_cam_m_clk, CAM_M_CLK, CLKFLAG_SKIP_AUTO_OFF);
2397static DEFINE_CLK_PCOM(p_camif_pad_p_clk, CAMIF_PAD_P_CLK, 0);
2398static DEFINE_CLK_PCOM(p_csi0_clk, CSI0_CLK, CLKFLAG_SKIP_AUTO_OFF);
2399static DEFINE_CLK_PCOM(p_csi0_vfe_clk, CSI0_VFE_CLK, CLKFLAG_SKIP_AUTO_OFF);
2400static DEFINE_CLK_PCOM(p_csi0_p_clk, CSI0_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
Matt Wagantalla12cc952011-11-08 18:14:50 -08002401static DEFINE_CLK_PCOM(p_mdp_clk, MDP_CLK, CLKFLAG_MIN);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002402static DEFINE_CLK_PCOM(p_mfc_clk, MFC_CLK, CLKFLAG_SKIP_AUTO_OFF);
2403static DEFINE_CLK_PCOM(p_mfc_div2_clk, MFC_DIV2_CLK, CLKFLAG_SKIP_AUTO_OFF);
2404static DEFINE_CLK_PCOM(p_mfc_p_clk, MFC_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
2405static DEFINE_CLK_PCOM(p_vpe_clk, VPE_CLK, CLKFLAG_SKIP_AUTO_OFF);
2406static DEFINE_CLK_PCOM(p_adm_clk, ADM_CLK, CLKFLAG_SKIP_AUTO_OFF);
2407static DEFINE_CLK_PCOM(p_ce_clk, CE_CLK, CLKFLAG_SKIP_AUTO_OFF);
2408static DEFINE_CLK_PCOM(p_axi_rotator_clk, AXI_ROTATOR_CLK,
2409 CLKFLAG_SKIP_AUTO_OFF);
2410static DEFINE_CLK_PCOM(p_rotator_imem_clk, ROTATOR_IMEM_CLK, 0);
2411static DEFINE_CLK_PCOM(p_rotator_p_clk, ROTATOR_P_CLK, 0);
2412
2413static DEFINE_CLK_VOTER(ebi_dtv_clk, &ebi1_fixed_clk.c);
Matt Wagantall9dc01632011-08-17 18:55:04 -07002414static DEFINE_CLK_VOTER(ebi_grp_3d_clk, &ebi1_fixed_clk.c);
2415static DEFINE_CLK_VOTER(ebi_grp_2d_clk, &ebi1_fixed_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002416static DEFINE_CLK_VOTER(ebi_lcdc_clk, &ebi1_fixed_clk.c);
2417static DEFINE_CLK_VOTER(ebi_mddi_clk, &ebi1_fixed_clk.c);
2418static DEFINE_CLK_VOTER(ebi_tv_clk, &ebi1_fixed_clk.c);
2419static DEFINE_CLK_VOTER(ebi_vcd_clk, &ebi1_fixed_clk.c);
2420static DEFINE_CLK_VOTER(ebi_vfe_clk, &ebi1_fixed_clk.c);
2421static DEFINE_CLK_VOTER(ebi_adm_clk, &ebi1_fixed_clk.c);
2422
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002423#ifdef CONFIG_DEBUG_FS
2424
2425#define CLK_TEST_2(s) (s)
2426#define CLK_TEST_HS(s) (0x4000 | ((s) << 8))
2427#define CLK_TEST_LS(s) (0x4D40 | (s))
2428
2429struct measure_sel {
2430 u32 test_vector;
2431 struct clk *clk;
2432};
2433
2434static struct measure_sel measure_mux[] = {
2435 { CLK_TEST_2(0x03), &emdh_p_clk.c },
2436 { CLK_TEST_2(0x04), &pmdh_p_clk.c },
2437 { CLK_TEST_2(0x06), &mdp_p_clk.c },
2438 { CLK_TEST_2(0x07), &lpa_p_clk.c },
2439 { CLK_TEST_2(0x08), &usb_hs2_p_clk.c },
2440 { CLK_TEST_2(0x09), &spi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002441 { CLK_TEST_2(0x0B), &i2c_2_clk.c },
2442 { CLK_TEST_2(0x0D), &mi2s_m_clk.c },
2443 { CLK_TEST_2(0x0E), &lpa_core_clk.c },
2444 { CLK_TEST_2(0x0F), &lpa_codec_clk.c },
2445 { CLK_TEST_2(0x10), &usb_hs3_p_clk.c },
2446 { CLK_TEST_2(0x11), &adm_p_clk.c },
2447 { CLK_TEST_2(0x13), &hdmi_clk.c },
2448 { CLK_TEST_2(0x14), &usb_hs_core_clk.c },
2449 { CLK_TEST_2(0x15), &usb_hs2_core_clk.c },
2450 { CLK_TEST_2(0x16), &usb_hs3_core_clk.c },
2451 { CLK_TEST_2(0x17), &mi2s_codec_tx_s_clk.c },
2452 { CLK_TEST_2(0x18), &spi_p_clk.c },
2453 { CLK_TEST_2(0x1A), &camif_pad_p_clk.c },
2454 { CLK_TEST_2(0x1C), &qup_i2c_clk.c },
2455 { CLK_TEST_2(0x1F), &mfc_div2_clk.c },
2456 { CLK_TEST_2(0x38), &mfc_clk.c },
2457
2458 { CLK_TEST_HS(0x00), &adm_clk.c },
2459 { CLK_TEST_HS(0x01), &mdp_lcdc_pad_pclk_clk.c },
2460 { CLK_TEST_HS(0x02), &mdp_lcdc_pclk_clk.c },
2461 { CLK_TEST_HS(0x03), &axi_rotator_clk.c },
2462 { CLK_TEST_HS(0x07), &axi_li_vg_clk.c },
2463 { CLK_TEST_HS(0x09), &axi_li_apps_clk.c },
2464 { CLK_TEST_HS(0x0E), &axi_li_jpeg_clk.c },
2465 { CLK_TEST_HS(0x0F), &emdh_clk.c },
2466 { CLK_TEST_HS(0x14), &mdp_clk.c },
2467 { CLK_TEST_HS(0x15), &pmdh_clk.c },
2468 { CLK_TEST_HS(0x19), &axi_grp_2d_clk.c },
2469 { CLK_TEST_HS(0x1A), &axi_li_grp_clk.c },
2470 { CLK_TEST_HS(0x1B), &axi_li_vfe_clk.c },
2471 { CLK_TEST_HS(0x1C), &grp_2d_clk.c },
2472 { CLK_TEST_HS(0x1E), &grp_3d_clk.c },
2473 { CLK_TEST_HS(0x1F), &imem_clk.c },
2474 { CLK_TEST_HS(0x20), &jpeg_clk.c },
2475 { CLK_TEST_HS(0x24), &axi_li_adsp_a_clk.c },
2476 { CLK_TEST_HS(0x26), &rotator_imem_clk.c },
2477 { CLK_TEST_HS(0x27), &axi_vpe_clk.c },
2478 { CLK_TEST_HS(0x2A), &axi_mfc_clk.c },
2479 { CLK_TEST_HS(0x2B), &axi_mdp_clk.c },
2480 { CLK_TEST_HS(0x2C), &vpe_clk.c },
2481 { CLK_TEST_HS(0x30), &vfe_camif_clk.c },
2482 { CLK_TEST_HS(0x31), &csi0_clk.c },
2483 { CLK_TEST_HS(0x32), &csi0_vfe_clk.c },
2484 { CLK_TEST_HS(0x33), &csi0_p_clk.c },
2485
2486 { CLK_TEST_LS(0x03), &ce_clk.c },
2487 { CLK_TEST_LS(0x04), &cam_m_clk.c },
2488 { CLK_TEST_LS(0x0C), &grp_2d_p_clk.c },
2489 { CLK_TEST_LS(0x0D), &i2c_clk.c },
2490 { CLK_TEST_LS(0x0E), &mi2s_codec_rx_m_clk.c },
2491 { CLK_TEST_LS(0x0F), &mi2s_codec_rx_s_clk.c },
2492 { CLK_TEST_LS(0x10), &mi2s_codec_tx_m_clk.c },
2493 { CLK_TEST_LS(0x13), &mdp_vsync_clk.c },
2494 { CLK_TEST_LS(0x15), &vfe_p_clk.c },
2495 { CLK_TEST_LS(0x16), &mdc_clk.c },
2496 { CLK_TEST_LS(0x17), &vfe_mdc_clk.c },
2497 { CLK_TEST_LS(0x18), &usb_hs_p_clk.c },
2498 { CLK_TEST_LS(0x1C), &uart1dm_p_clk.c },
2499 { CLK_TEST_LS(0x1E), &jpeg_p_clk.c },
2500 { CLK_TEST_LS(0x20), &sdac_clk.c },
2501 { CLK_TEST_LS(0x21), &sdc1_p_clk.c },
2502 { CLK_TEST_LS(0x22), &sdc1_clk.c },
2503 { CLK_TEST_LS(0x23), &sdc2_p_clk.c },
2504 { CLK_TEST_LS(0x24), &sdc2_clk.c },
2505 { CLK_TEST_LS(0x25), &tsif_p_clk.c },
2506 { CLK_TEST_LS(0x26), &sdac_m_clk.c },
2507 { CLK_TEST_LS(0x27), &grp_3d_p_clk.c },
2508 { CLK_TEST_LS(0x2A), &tsif_ref_clk.c },
2509 { CLK_TEST_LS(0x2B), &tv_enc_clk.c },
2510 { CLK_TEST_LS(0x2C), &tv_dac_clk.c },
2511 { CLK_TEST_LS(0x2D), &rotator_p_clk.c },
2512 { CLK_TEST_LS(0x2F), &uart1_clk.c },
2513 { CLK_TEST_LS(0x30), &uart1dm_clk.c },
2514 { CLK_TEST_LS(0x31), &uart2_clk.c },
2515 { CLK_TEST_LS(0x33), &usb_hs2_clk.c },
2516 { CLK_TEST_LS(0x34), &usb_hs3_clk.c },
2517 { CLK_TEST_LS(0x35), &mfc_p_clk.c },
2518 { CLK_TEST_LS(0x36), &vfe_clk.c },
2519 { CLK_TEST_LS(0x39), &sdc3_p_clk.c },
2520 { CLK_TEST_LS(0x3A), &sdc3_clk.c },
2521 { CLK_TEST_LS(0x3B), &sdc4_p_clk.c },
2522 { CLK_TEST_LS(0x3C), &sdc4_clk.c },
2523 { CLK_TEST_LS(0x3D), &uart2dm_clk.c },
2524 { CLK_TEST_LS(0x3E), &uart2dm_p_clk.c },
2525 { CLK_TEST_LS(0x3F), &usb_hs_clk.c },
2526};
2527
2528static struct measure_sel *find_measure_sel(struct clk *clk)
2529{
2530 int i;
2531
2532 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
2533 if (measure_mux[i].clk == clk)
2534 return &measure_mux[i];
2535 return NULL;
2536}
2537
2538static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
2539{
2540 struct measure_sel *p;
2541 unsigned long flags;
2542
2543 if (!parent)
2544 return -EINVAL;
2545
2546 p = find_measure_sel(parent);
2547 if (!p)
2548 return -EINVAL;
2549
2550 spin_lock_irqsave(&local_clock_reg_lock, flags);
2551
2552 /* Program test vector. */
2553 if (p->test_vector <= 0xFF) {
2554 /* Select CLK_TEST_2 */
2555 writel_relaxed(0x4D40, CLK_TEST_BASE_REG);
2556 writel_relaxed(p->test_vector, CLK_TEST_2_BASE_REG);
2557 } else
2558 writel_relaxed(p->test_vector, CLK_TEST_BASE_REG);
2559
2560 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2561
2562 return 0;
2563}
2564
2565/* Sample clock for 'tcxo4_ticks' reference clock ticks. */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002566static unsigned long run_measurement(unsigned tcxo4_ticks)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002567{
2568 /* TCXO4_CNT_EN and RINGOSC_CNT_EN register values. */
2569 u32 reg_val_enable = readl_relaxed(MISC_CLK_CTL_BASE_REG) | 0x3;
2570 u32 reg_val_disable = reg_val_enable & ~0x3;
2571
2572 /* Stop counters and set the TCXO4 counter start value. */
2573 writel_relaxed(reg_val_disable, MISC_CLK_CTL_BASE_REG);
2574 writel_relaxed(tcxo4_ticks, TCXO_CNT_BASE_REG);
2575
2576 /* Run measurement and wait for completion. */
2577 writel_relaxed(reg_val_enable, MISC_CLK_CTL_BASE_REG);
2578 while (readl_relaxed(TCXO_CNT_DONE_BASE_REG) == 0)
2579 cpu_relax();
2580
2581 /* Stop counters. */
2582 writel_relaxed(reg_val_disable, MISC_CLK_CTL_BASE_REG);
2583
2584 return readl_relaxed(RINGOSC_CNT_BASE_REG);
2585}
2586
2587/* Perform a hardware rate measurement for a given clock.
2588 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002589static unsigned long measure_clk_get_rate(struct clk *clk)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002590{
2591 unsigned long flags;
2592 u32 regval, prph_web_reg_old;
2593 u64 raw_count_short, raw_count_full;
2594 unsigned ret;
2595
2596 clk_enable(&tcxo_clk.c);
2597
2598 spin_lock_irqsave(&local_clock_reg_lock, flags);
2599
2600 /* Enable TCXO4 clock branch and root. */
2601 prph_web_reg_old = readl_relaxed(PRPH_WEB_NS_BASE_REG);
2602 regval = prph_web_reg_old | BIT(9) | BIT(11);
2603 writel_relaxed(regval, PRPH_WEB_NS_BASE_REG);
2604
2605 /*
2606 * The ring oscillator counter will not reset if the measured clock
2607 * is not running. To detect this, run a short measurement before
2608 * the full measurement. If the raw results of the two are the same
2609 * then the clock must be off.
2610 */
2611
2612 /* Run a short measurement. (~1 ms) */
2613 raw_count_short = run_measurement(0x1000);
2614 /* Run a full measurement. (~14 ms) */
2615 raw_count_full = run_measurement(0x10000);
2616
2617 /* Disable TCXO4 clock branch and root. */
2618 writel_relaxed(prph_web_reg_old, PRPH_WEB_NS_BASE_REG);
2619
2620 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2621
2622 /* Return 0 if the clock is off. */
2623 if (raw_count_full == raw_count_short)
2624 ret = 0;
2625 else {
2626 /* Compute rate in Hz. */
2627 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
2628 do_div(raw_count_full, ((0x10000 * 10) + 35));
2629 ret = raw_count_full;
2630 }
2631
2632 clk_disable(&tcxo_clk.c);
2633
2634 return ret;
2635}
2636#else /* !CONFIG_DEBUG_FS */
2637static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
2638{
2639 return -EINVAL;
2640}
2641
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002642static unsigned long measure_clk_get_rate(struct clk *clk)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002643{
2644 return 0;
2645}
2646#endif /* CONFIG_DEBUG_FS */
2647
2648static struct clk_ops measure_clk_ops = {
2649 .set_parent = measure_clk_set_parent,
2650 .get_rate = measure_clk_get_rate,
2651 .is_local = local_clk_is_local,
2652};
2653
2654static struct clk measure_clk = {
2655 .dbg_name = "measure_clk",
2656 .ops = &measure_clk_ops,
2657 CLK_INIT(measure_clk),
2658};
2659
2660/* Implementation for clk_set_flags(). */
2661int soc_clk_set_flags(struct clk *clk, unsigned clk_flags)
2662{
2663 uint32_t regval, ret = 0;
2664 unsigned long flags;
2665
2666 spin_lock_irqsave(&local_clock_reg_lock, flags);
2667
2668 if (clk == &vfe_clk.c) {
2669 regval = readl_relaxed(CAM_VFE_NS_REG);
2670 /* Flag values chosen for backward compatibility
2671 * with proc_comm remote clock control. */
2672 if (clk_flags == 0x00000100) {
2673 /* Select external source. */
2674 regval |= BIT(14);
2675 } else if (clk_flags == 0x00000200) {
2676 /* Select internal source. */
2677 regval &= ~BIT(14);
2678 } else
2679 ret = -EINVAL;
2680
2681 writel_relaxed(regval, CAM_VFE_NS_REG);
2682 /* Make sure write is issued before returning. */
2683 mb();
2684 } else
2685 ret = -EPERM;
2686
2687 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2688
2689 return ret;
2690}
2691
2692static int msm7x30_clk_reset(struct clk *clk, enum clk_reset_action action)
2693{
2694 /* reset_mask is actually a proc_comm id */
2695 unsigned id = to_rcg_clk(clk)->b.reset_mask;
2696 return pc_clk_reset(id, action);
2697}
2698
2699static int soc_branch_clk_reset(struct clk *clk, enum clk_reset_action action)
2700{
2701 unsigned id = to_branch_clk(clk)->b.reset_mask;
2702 return pc_clk_reset(id, action);
2703}
2704
2705/*
2706 * Clock ownership detection code
2707 */
2708
2709enum {
2710 SH2_OWN_GLBL,
2711 SH2_OWN_APPS1,
2712 SH2_OWN_APPS2,
2713 SH2_OWN_ROW1,
2714 SH2_OWN_ROW2,
2715 SH2_OWN_APPS3,
2716 NUM_OWNERSHIP
2717};
2718static __initdata uint32_t ownership_regs[NUM_OWNERSHIP];
2719
2720static void __init cache_ownership(void)
2721{
2722 ownership_regs[SH2_OWN_GLBL] = readl_relaxed(SH2_OWN_GLBL_BASE_REG);
2723 ownership_regs[SH2_OWN_APPS1] = readl_relaxed(SH2_OWN_APPS1_BASE_REG);
2724 ownership_regs[SH2_OWN_APPS2] = readl_relaxed(SH2_OWN_APPS2_BASE_REG);
2725 ownership_regs[SH2_OWN_ROW1] = readl_relaxed(SH2_OWN_ROW1_BASE_REG);
2726 ownership_regs[SH2_OWN_ROW2] = readl_relaxed(SH2_OWN_ROW2_BASE_REG);
2727 ownership_regs[SH2_OWN_APPS3] = readl_relaxed(SH2_OWN_APPS3_BASE_REG);
2728}
2729
2730static void __init print_ownership(void)
2731{
2732 pr_info("Clock ownership\n");
2733 pr_info(" GLBL : %08x\n", ownership_regs[SH2_OWN_GLBL]);
2734 pr_info(" APPS : %08x %08x %08x\n", ownership_regs[SH2_OWN_APPS1],
2735 ownership_regs[SH2_OWN_APPS2], ownership_regs[SH2_OWN_APPS3]);
2736 pr_info(" ROW : %08x %08x\n", ownership_regs[SH2_OWN_ROW1],
2737 ownership_regs[SH2_OWN_ROW2]);
2738}
2739
2740#define O(x) (&ownership_regs[(SH2_OWN_##x)])
2741#define OWN(r, b, name, clk, dev) \
2742 { \
2743 .lk = CLK_LOOKUP(name, clk.c, dev), \
2744 .remote = &p_##clk.c, \
2745 .reg = O(r), \
2746 .bit = BIT(b), \
2747 }
2748
2749static struct clk_local_ownership {
2750 struct clk_lookup lk;
2751 const u32 *reg;
2752 const u32 bit;
2753 struct clk *remote;
2754} ownership_map[] __initdata = {
2755 /* Sources */
2756 { CLK_LOOKUP("pll1_clk", pll1_clk.c, "acpu") },
2757 { CLK_LOOKUP("pll2_clk", pll2_clk.c, "acpu") },
2758 { CLK_LOOKUP("pll3_clk", pll3_clk.c, "acpu") },
2759 { CLK_LOOKUP("measure", measure_clk, "debug") },
2760
2761 /* PCOM */
2762 { CLK_LOOKUP("adsp_clk", adsp_clk.c, NULL) },
2763 { CLK_LOOKUP("codec_ssbi_clk", codec_ssbi_clk.c, NULL) },
2764 { CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL) },
2765 { CLK_LOOKUP("ebi1_fixed_clk", ebi1_fixed_clk.c, NULL) },
2766 { CLK_LOOKUP("ecodec_clk", ecodec_clk.c, NULL) },
Matt Wagantallc00f95d2012-01-05 14:22:45 -08002767 { CLK_LOOKUP("core_clk", gp_clk.c, "") },
Matt Wagantalle2522372011-08-17 14:52:21 -07002768 { CLK_LOOKUP("core_clk", uart3_clk.c, "msm_serial.2") },
Manu Gautam5143b252012-01-05 19:25:23 -08002769 { CLK_LOOKUP("phy_clk", usb_phy_clk.c, "msm_otg") },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002770
2771 /* Voters */
2772 { CLK_LOOKUP("ebi1_dtv_clk", ebi_dtv_clk.c, NULL) },
Matt Wagantall9dc01632011-08-17 18:55:04 -07002773 { CLK_LOOKUP("bus_clk", ebi_grp_2d_clk.c, "kgsl-2d0.0") },
2774 { CLK_LOOKUP("bus_clk", ebi_grp_3d_clk.c, "kgsl-3d0.0") },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775 { CLK_LOOKUP("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL) },
2776 { CLK_LOOKUP("ebi1_mddi_clk", ebi_mddi_clk.c, NULL) },
2777 { CLK_LOOKUP("ebi1_tv_clk", ebi_tv_clk.c, NULL) },
Matt Wagantall3f7660b2011-08-17 21:25:13 -07002778 { CLK_LOOKUP("mem_clk", ebi_vcd_clk.c, "msm_vidc.0") },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 { CLK_LOOKUP("ebi1_vfe_clk", ebi_vfe_clk.c, NULL) },
Matt Wagantalle1a86062011-08-18 17:46:10 -07002780 { CLK_LOOKUP("mem_clk", ebi_adm_clk.c, "msm_dmov") },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002781
2782 /*
2783 * This is a many-to-one mapping because we don't know how the remote
2784 * clock code has decided to handle the dependencies between clocks for
2785 * a particular hardware block. We determine the ownership for all the
2786 * clocks going into a block by checking the ownership bit of one
2787 * register (usually the ns register).
2788 */
Matt Wagantall9dc01632011-08-17 18:55:04 -07002789 OWN(APPS1, 6, "core_clk", grp_2d_clk, "kgsl-2d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002790 OWN(APPS1, 6, "core_clk", grp_2d_clk, "footswitch-pcom.0"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07002791 OWN(APPS1, 6, "iface_clk", grp_2d_p_clk, "kgsl-2d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002792 OWN(APPS1, 6, "iface_clk", grp_2d_p_clk, "footswitch-pcom.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002793 OWN(APPS1, 31, "hdmi_clk", hdmi_clk, NULL),
2794 OWN(APPS1, 0, "jpeg_clk", jpeg_clk, NULL),
2795 OWN(APPS1, 0, "jpeg_pclk", jpeg_p_clk, NULL),
2796 OWN(APPS1, 23, "lpa_codec_clk", lpa_codec_clk, NULL),
2797 OWN(APPS1, 23, "lpa_core_clk", lpa_core_clk, NULL),
2798 OWN(APPS1, 23, "lpa_pclk", lpa_p_clk, NULL),
2799 OWN(APPS1, 28, "mi2s_m_clk", mi2s_m_clk, NULL),
2800 OWN(APPS1, 28, "mi2s_s_clk", mi2s_s_clk, NULL),
2801 OWN(APPS1, 12, "mi2s_codec_rx_m_clk", mi2s_codec_rx_m_clk, NULL),
2802 OWN(APPS1, 12, "mi2s_codec_rx_s_clk", mi2s_codec_rx_s_clk, NULL),
2803 OWN(APPS1, 14, "mi2s_codec_tx_m_clk", mi2s_codec_tx_m_clk, NULL),
2804 OWN(APPS1, 14, "mi2s_codec_tx_s_clk", mi2s_codec_tx_s_clk, NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002805 OWN(APPS1, 26, "sdac_clk", sdac_clk, NULL),
2806 OWN(APPS1, 26, "sdac_m_clk", sdac_m_clk, NULL),
2807 OWN(APPS1, 8, "vfe_clk", vfe_clk, NULL),
Matt Wagantall49722712011-08-17 18:50:53 -07002808 OWN(APPS1, 8, "core_clk", vfe_clk, "footswitch-pcom.8"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002809 OWN(APPS1, 8, "vfe_camif_clk", vfe_camif_clk, NULL),
2810 OWN(APPS1, 8, "vfe_mdc_clk", vfe_mdc_clk, NULL),
2811 OWN(APPS1, 8, "vfe_pclk", vfe_p_clk, NULL),
Matt Wagantall49722712011-08-17 18:50:53 -07002812 OWN(APPS1, 8, "iface_clk", vfe_p_clk, "footswitch-pcom.8"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002813
Matt Wagantall9dc01632011-08-17 18:55:04 -07002814 OWN(APPS2, 0, "core_clk", grp_3d_clk, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002815 OWN(APPS2, 0, "core_clk", grp_3d_clk, "footswitch-pcom.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07002816 OWN(APPS2, 0, "iface_clk", grp_3d_p_clk, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002817 OWN(APPS2, 0, "iface_clk", grp_3d_p_clk, "footswitch-pcom.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07002818 { CLK_LOOKUP("src_clk", grp_3d_src_clk.c, "kgsl-3d0.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002819 O(APPS2), BIT(0), &p_grp_3d_clk.c },
Matt Wagantall49722712011-08-17 18:50:53 -07002820 { CLK_LOOKUP("src_clk", grp_3d_src_clk.c, "footswitch-pcom.2"),
2821 O(APPS2), BIT(0), &p_grp_3d_clk.c },
Matt Wagantall9dc01632011-08-17 18:55:04 -07002822 OWN(APPS2, 0, "mem_clk", imem_clk, "kgsl-3d0.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002823 OWN(APPS2, 4, "mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk, NULL),
2824 OWN(APPS2, 4, "mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk, NULL),
2825 OWN(APPS2, 4, "mdp_pclk", mdp_p_clk, NULL),
Matt Wagantall49722712011-08-17 18:50:53 -07002826 OWN(APPS2, 4, "iface_clk", mdp_p_clk, "footswitch-pcom.4"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002827 OWN(APPS2, 28, "mdp_vsync_clk", mdp_vsync_clk, NULL),
Matt Wagantall640e5fd2011-08-17 16:08:53 -07002828 OWN(APPS2, 5, "ref_clk", tsif_ref_clk, "msm_tsif.0"),
2829 OWN(APPS2, 5, "iface_clk", tsif_p_clk, "msm_tsif.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002830 { CLK_LOOKUP("tv_src_clk", tv_clk.c, NULL),
2831 O(APPS2), BIT(2), &p_tv_enc_clk.c },
2832 OWN(APPS2, 2, "tv_dac_clk", tv_dac_clk, NULL),
2833 OWN(APPS2, 2, "tv_enc_clk", tv_enc_clk, NULL),
2834
2835 OWN(ROW1, 7, "emdh_clk", emdh_clk, "msm_mddi.1"),
2836 OWN(ROW1, 7, "emdh_pclk", emdh_p_clk, "msm_mddi.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07002837 OWN(ROW1, 11, "core_clk", i2c_clk, "msm_i2c.0"),
2838 OWN(ROW1, 12, "core_clk", i2c_2_clk, "msm_i2c.2"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002839 OWN(ROW1, 17, "mdc_clk", mdc_clk, NULL),
2840 OWN(ROW1, 19, "mddi_clk", pmdh_clk, NULL),
2841 OWN(ROW1, 19, "mddi_pclk", pmdh_p_clk, NULL),
Matt Wagantall37ce3842011-08-17 16:00:36 -07002842 OWN(ROW1, 23, "core_clk", sdc1_clk, "msm_sdcc.1"),
2843 OWN(ROW1, 23, "iface_clk", sdc1_p_clk, "msm_sdcc.1"),
2844 OWN(ROW1, 25, "core_clk", sdc2_clk, "msm_sdcc.2"),
2845 OWN(ROW1, 25, "iface_clk", sdc2_p_clk, "msm_sdcc.2"),
2846 OWN(ROW1, 27, "core_clk", sdc3_clk, "msm_sdcc.3"),
2847 OWN(ROW1, 27, "iface_clk", sdc3_p_clk, "msm_sdcc.3"),
2848 OWN(ROW1, 29, "core_clk", sdc4_clk, "msm_sdcc.4"),
2849 OWN(ROW1, 29, "iface_clk", sdc4_p_clk, "msm_sdcc.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07002850 OWN(ROW1, 0, "core_clk", uart2_clk, "msm_serial.1"),
Manu Gautam5143b252012-01-05 19:25:23 -08002851 OWN(ROW1, 2, "alt_core_clk", usb_hs2_clk, "msm_hsusb_host.0"),
2852 OWN(ROW1, 2, "core_clk", usb_hs2_core_clk, "msm_hsusb_host.0"),
2853 OWN(ROW1, 2, "iface_clk", usb_hs2_p_clk, "msm_hsusb_host.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08002854 OWN(ROW1, 4, "alt_core_clk", usb_hs3_clk, ""),
2855 OWN(ROW1, 4, "core_clk", usb_hs3_core_clk, ""),
2856 OWN(ROW1, 4, "iface_clk", usb_hs3_p_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002857
Matt Wagantallac294852011-08-17 15:44:58 -07002858 OWN(ROW2, 3, "core_clk", qup_i2c_clk, "qup_i2c.4"),
2859 OWN(ROW2, 1, "core_clk", spi_clk, "spi_qsd.0"),
2860 OWN(ROW2, 1, "iface_clk", spi_p_clk, "spi_qsd.0"),
Matt Wagantalle2522372011-08-17 14:52:21 -07002861 OWN(ROW2, 9, "core_clk", uart1_clk, "msm_serial.0"),
2862 OWN(ROW2, 6, "core_clk", uart1dm_clk, "msm_serial_hs.0"),
2863 OWN(ROW2, 8, "core_clk", uart2dm_clk, "msm_serial_hs.1"),
Manu Gautam5143b252012-01-05 19:25:23 -08002864 OWN(ROW2, 11, "alt_core_clk", usb_hs_clk, "msm_otg"),
2865 OWN(ROW2, 11, "core_clk", usb_hs_core_clk, "msm_otg"),
2866 OWN(ROW2, 11, "iface_clk", usb_hs_p_clk, "msm_otg"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867
2868 OWN(APPS3, 6, "cam_m_clk", cam_m_clk, NULL),
2869 OWN(APPS3, 6, "camif_pad_pclk", camif_pad_p_clk, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07002870 OWN(APPS3, 6, "iface_clk", camif_pad_p_clk, "qup_i2c.4"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002871 OWN(APPS3, 11, "csi_clk", csi0_clk, NULL),
2872 OWN(APPS3, 11, "csi_vfe_clk", csi0_vfe_clk, NULL),
2873 OWN(APPS3, 11, "csi_pclk", csi0_p_clk, NULL),
2874 OWN(APPS3, 0, "mdp_clk", mdp_clk, NULL),
Matt Wagantall49722712011-08-17 18:50:53 -07002875 OWN(APPS3, 0, "core_clk", mdp_clk, "footswitch-pcom.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07002876 OWN(APPS3, 2, "core_clk", mfc_clk, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002877 OWN(APPS3, 2, "core_clk", mfc_clk, "footswitch-pcom.5"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07002878 OWN(APPS3, 2, "core_div2_clk", mfc_div2_clk, "msm_vidc.0"),
2879 OWN(APPS3, 2, "iface_clk", mfc_p_clk, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002880 OWN(APPS3, 2, "iface_clk", mfc_p_clk, "footswitch-pcom.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002881 OWN(APPS3, 4, "vpe_clk", vpe_clk, NULL),
Matt Wagantall49722712011-08-17 18:50:53 -07002882 OWN(APPS3, 4, "core_clk", vpe_clk, "footswitch-pcom.9"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883
Matt Wagantalle1a86062011-08-18 17:46:10 -07002884 OWN(GLBL, 8, "core_clk", adm_clk, "msm_dmov"),
2885 { CLK_LOOKUP("iface_clk", adm_p_clk.c, "msm_dmov"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002886 O(GLBL), BIT(13), &dummy_clk },
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07002887 OWN(GLBL, 8, "core_clk", ce_clk, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07002888 OWN(GLBL, 8, "core_clk", ce_clk, "crypto.0"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07002889 OWN(GLBL, 13, "core_clk", axi_rotator_clk, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002890 OWN(GLBL, 13, "core_clk", axi_rotator_clk, "footswitch-pcom.6"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07002891 OWN(GLBL, 13, "mem_clk", rotator_imem_clk, "msm_rotator.0"),
2892 OWN(GLBL, 13, "iface_clk", rotator_p_clk, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07002893 OWN(GLBL, 13, "iface_clk", rotator_p_clk, "footswitch-pcom.6"),
Matt Wagantalle2522372011-08-17 14:52:21 -07002894 { CLK_LOOKUP("iface_clk", uart1dm_p_clk.c, "msm_serial_hs.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895 O(GLBL), BIT(8), &dummy_clk },
Matt Wagantalle2522372011-08-17 14:52:21 -07002896 { CLK_LOOKUP("iface_clk", uart2dm_p_clk.c, "msm_serial_hs.1"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002897 O(GLBL), BIT(8), &dummy_clk },
2898};
2899
2900static struct clk_lookup msm_clocks_7x30[ARRAY_SIZE(ownership_map)];
2901
2902static void __init set_clock_ownership(void)
2903{
2904 unsigned i;
2905 struct clk_lookup *lk;
2906
2907 for (i = 0; i < ARRAY_SIZE(ownership_map); i++) {
2908 const u32 *reg = ownership_map[i].reg;
2909 u32 bit = ownership_map[i].bit;
2910 struct clk *remote = ownership_map[i].remote;
2911
2912 lk = &ownership_map[i].lk;
2913 memcpy(&msm_clocks_7x30[i], lk, sizeof(*lk));
2914
2915 if (reg && !(*reg & bit))
2916 msm_clocks_7x30[i].clk = remote;
2917 }
2918}
2919
2920/*
2921 * Miscellaneous clock register initializations
2922 */
2923static const struct reg_init {
2924 const void __iomem *reg;
2925 uint32_t mask;
2926 uint32_t val;
2927} ri_list[] __initconst = {
2928 /* Enable UMDX_P clock. Known to causes issues, so never turn off. */
2929 {GLBL_CLK_ENA_2_SC_REG, BIT(2), BIT(2)},
2930
2931 /* Disable all the child clocks of USB_HS_SRC. */
2932 { USBH_NS_REG, BIT(13) | BIT(9), 0 },
2933 { USBH2_NS_REG, BIT(9) | BIT(4), 0 },
2934 { USBH3_NS_REG, BIT(9) | BIT(4), 0 },
2935
2936 {EMDH_NS_REG, BM(18, 17) , BVAL(18, 17, 0x3)}, /* RX div = div-4. */
2937 {PMDH_NS_REG, BM(18, 17), BVAL(18, 17, 0x3)}, /* RX div = div-4. */
2938 /* MI2S_CODEC_RX_S src = MI2S_CODEC_RX_M. */
2939 {MI2S_RX_NS_REG, BIT(14), 0x0},
2940 /* MI2S_CODEC_TX_S src = MI2S_CODEC_TX_M. */
2941 {MI2S_TX_NS_REG, BIT(14), 0x0},
2942 {MI2S_NS_REG, BIT(14), 0x0}, /* MI2S_S src = MI2S_M. */
2943 /* Allow DSP to decide the LPA CORE src. */
2944 {LPA_CORE_CLK_MA0_REG, BIT(0), BIT(0)},
2945 {LPA_CORE_CLK_MA2_REG, BIT(0), BIT(0)},
2946 {MI2S_CODEC_RX_DIV_REG, 0xF, 0xD}, /* MI2S_CODEC_RX_S div = div-8. */
2947 {MI2S_CODEC_TX_DIV_REG, 0xF, 0xD}, /* MI2S_CODEC_TX_S div = div-8. */
2948 {MI2S_DIV_REG, 0xF, 0x7}, /* MI2S_S div = div-8. */
2949 {MDC_NS_REG, 0x3, 0x3}, /* MDC src = external MDH src. */
2950 {SDAC_NS_REG, BM(15, 14), 0x0}, /* SDAC div = div-1. */
2951 /* Disable sources TCXO/5 & TCXO/6. UART1 src = TCXO*/
2952 {UART_NS_REG, BM(26, 25) | BM(2, 0), 0x0},
2953 /* HDMI div = div-1, non-inverted. tv_enc_src = tv_clk_src */
2954 {HDMI_NS_REG, 0x7, 0x0},
2955 {TV_NS_REG, BM(15, 14), 0x0}, /* tv_clk_src_div2 = div-1 */
2956
2957 /* USBH core clocks src = USB_HS_SRC. */
2958 {USBH_NS_REG, BIT(15), BIT(15)},
2959 {USBH2_NS_REG, BIT(6), BIT(6)},
2960 {USBH3_NS_REG, BIT(6), BIT(6)},
2961};
2962
2963/* Local clock driver initialization. */
Stephen Boydbb600ae2011-08-02 20:11:40 -07002964static void __init msm7x30_clock_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002965{
2966 int i;
2967 uint32_t val;
2968
2969 cache_ownership();
2970 print_ownership();
2971 set_clock_ownership();
2972
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002973 /* When we have no local clock control, the rest of the code in this
2974 * function is a NOP since writes to shadow regions that we don't own
2975 * are ignored. */
2976
2977 clk_set_rate(&usb_hs_src_clk.c, clk_tbl_usb[1].freq_hz);
2978
2979 for (i = 0; i < ARRAY_SIZE(ri_list); i++) {
2980 val = readl_relaxed(ri_list[i].reg);
2981 val &= ~ri_list[i].mask;
2982 val |= ri_list[i].val;
2983 writel_relaxed(val, ri_list[i].reg);
2984 }
2985
2986 clk_set_rate(&i2c_clk.c, 19200000);
2987 clk_set_rate(&i2c_2_clk.c, 19200000);
2988 clk_set_rate(&qup_i2c_clk.c, 19200000);
2989 clk_set_rate(&uart1_clk.c, 19200000);
2990 clk_set_rate(&uart2_clk.c, 19200000);
2991 clk_set_rate(&mi2s_m_clk.c, 12288000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002992 clk_set_rate(&mdp_vsync_clk.c, 24576000);
2993 clk_set_rate(&glbl_root_clk.c, 1);
2994 clk_set_rate(&mdc_clk.c, 1);
2995 /* Sync the LPA_CODEC clock to MI2S_CODEC_RX */
2996 clk_set_rate(&lpa_codec_clk.c, 1);
2997 /* Sync the GRP2D clock to AXI */
2998 clk_set_rate(&grp_2d_clk.c, 1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002999}
3000
Stephen Boydbb600ae2011-08-02 20:11:40 -07003001struct clock_init_data msm7x30_clock_init_data __initdata = {
3002 .table = msm_clocks_7x30,
3003 .size = ARRAY_SIZE(msm_clocks_7x30),
3004 .init = msm7x30_clock_init,
3005};
3006
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003007/*
3008 * Clock operation handler registration
3009 */
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003010static struct clk_ops clk_ops_rcg_7x30 = {
Matt Wagantall0625ea02011-07-13 18:51:56 -07003011 .enable = rcg_clk_enable,
3012 .disable = rcg_clk_disable,
Matt Wagantall41af0772011-09-17 12:21:39 -07003013 .auto_off = rcg_clk_disable,
Matt Wagantall0625ea02011-07-13 18:51:56 -07003014 .set_rate = rcg_clk_set_rate,
Matt Wagantall0625ea02011-07-13 18:51:56 -07003015 .get_rate = rcg_clk_get_rate,
3016 .list_rate = rcg_clk_list_rate,
3017 .is_enabled = rcg_clk_is_enabled,
3018 .round_rate = rcg_clk_round_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003019 .reset = msm7x30_clk_reset,
3020 .set_flags = soc_clk_set_flags,
3021 .is_local = local_clk_is_local,
Matt Wagantall0625ea02011-07-13 18:51:56 -07003022 .get_parent = rcg_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003023};
3024
3025static struct clk_ops clk_ops_branch = {
3026 .enable = branch_clk_enable,
3027 .disable = branch_clk_disable,
Matt Wagantall41af0772011-09-17 12:21:39 -07003028 .auto_off = branch_clk_disable,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003029 .is_enabled = branch_clk_is_enabled,
3030 .reset = soc_branch_clk_reset,
3031 .set_flags = soc_clk_set_flags,
3032 .is_local = local_clk_is_local,
3033 .get_parent = branch_clk_get_parent,
3034 .set_parent = branch_clk_set_parent,
3035};