blob: 0b73ac936c3d60254c21cdbdfc732948fb48b9bb [file] [log] [blame]
Pushkar Joshie0e8a7e2012-12-15 18:27:04 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Tianyi Gou389ba432012-10-01 13:58:38 -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#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/err.h>
16#include <linux/ctype.h>
17#include <linux/io.h>
18#include <linux/spinlock.h>
19#include <linux/delay.h>
20#include <linux/clk.h>
21#include <linux/regulator/consumer.h>
22#include <linux/iopoll.h>
23
24#include <mach/clk.h>
25#include <mach/rpm-regulator-smd.h>
26#include <mach/socinfo.h>
27
28#include "clock-local2.h"
29#include "clock-pll.h"
30#include "clock-rpm.h"
31#include "clock-voter.h"
32#include "clock.h"
33
34enum {
35 GCC_BASE,
Tianyi Gou389ba432012-10-01 13:58:38 -070036 APCS_BASE,
37 APCS_PLL_BASE,
38 N_BASES,
39};
40
41static void __iomem *virt_bases[N_BASES];
42
43#define GCC_REG_BASE(x) (void __iomem *)(virt_bases[GCC_BASE] + (x))
Tianyi Gou389ba432012-10-01 13:58:38 -070044#define APCS_REG_BASE(x) (void __iomem *)(virt_bases[APCS_BASE] + (x))
45#define APCS_PLL_REG_BASE(x) (void __iomem *)(virt_bases[APCS_PLL_BASE] + (x))
46
47/* GCC registers */
48#define GPLL0_MODE_REG 0x0000
49#define GPLL0_L_REG 0x0004
50#define GPLL0_M_REG 0x0008
51#define GPLL0_N_REG 0x000C
52#define GPLL0_USER_CTL_REG 0x0010
53#define GPLL0_CONFIG_CTL_REG 0x0014
54#define GPLL0_TEST_CTL_REG 0x0018
55#define GPLL0_STATUS_REG 0x001C
56
57#define GPLL1_MODE_REG 0x0040
58#define GPLL1_L_REG 0x0044
59#define GPLL1_M_REG 0x0048
60#define GPLL1_N_REG 0x004C
61#define GPLL1_USER_CTL_REG 0x0050
62#define GPLL1_CONFIG_CTL_REG 0x0054
63#define GPLL1_TEST_CTL_REG 0x0058
64#define GPLL1_STATUS_REG 0x005C
65
66#define GCC_DEBUG_CLK_CTL_REG 0x1880
67#define CLOCK_FRQ_MEASURE_CTL_REG 0x1884
68#define CLOCK_FRQ_MEASURE_STATUS_REG 0x1888
69#define GCC_PLLTEST_PAD_CFG_REG 0x188C
70#define GCC_XO_DIV4_CBCR_REG 0x10C8
71#define APCS_GPLL_ENA_VOTE_REG 0x1480
72#define APCS_CLOCK_BRANCH_ENA_VOTE 0x1484
73#define APCS_CLOCK_SLEEP_ENA_VOTE 0x1488
74
75#define APCS_CLK_DIAG_REG 0x001C
76
77#define APCS_CPU_PLL_MODE_REG 0x0000
78#define APCS_CPU_PLL_L_REG 0x0004
79#define APCS_CPU_PLL_M_REG 0x0008
80#define APCS_CPU_PLL_N_REG 0x000C
81#define APCS_CPU_PLL_USER_CTL_REG 0x0010
82#define APCS_CPU_PLL_CONFIG_CTL_REG 0x0014
83#define APCS_CPU_PLL_TEST_CTL_REG 0x0018
84#define APCS_CPU_PLL_STATUS_REG 0x001C
85
86#define USB_HSIC_SYSTEM_CMD_RCGR 0x041C
87#define USB_HSIC_XCVR_FS_CMD_RCGR 0x0424
88#define USB_HSIC_CMD_RCGR 0x0440
89#define USB_HSIC_IO_CAL_CMD_RCGR 0x0458
90#define USB_HS_SYSTEM_CMD_RCGR 0x0490
91#define SDCC2_APPS_CMD_RCGR 0x0510
92#define SDCC3_APPS_CMD_RCGR 0x0550
93#define BLSP1_QUP1_SPI_APPS_CMD_RCGR 0x064C
Tianyi Goub1d13972013-01-23 22:55:22 -080094#define BLSP1_QUP1_I2C_APPS_CMD_RCGR 0x0660
Tianyi Gou389ba432012-10-01 13:58:38 -070095#define BLSP1_UART1_APPS_CMD_RCGR 0x068C
96#define BLSP1_QUP2_SPI_APPS_CMD_RCGR 0x06CC
Tianyi Goub1d13972013-01-23 22:55:22 -080097#define BLSP1_QUP2_I2C_APPS_CMD_RCGR 0x06E0
Tianyi Gou389ba432012-10-01 13:58:38 -070098#define BLSP1_UART2_APPS_CMD_RCGR 0x070C
99#define BLSP1_QUP3_SPI_APPS_CMD_RCGR 0x074C
Tianyi Goub1d13972013-01-23 22:55:22 -0800100#define BLSP1_QUP3_I2C_APPS_CMD_RCGR 0x0760
Tianyi Gou389ba432012-10-01 13:58:38 -0700101#define BLSP1_UART3_APPS_CMD_RCGR 0x078C
102#define BLSP1_QUP4_SPI_APPS_CMD_RCGR 0x07CC
Tianyi Goub1d13972013-01-23 22:55:22 -0800103#define BLSP1_QUP4_I2C_APPS_CMD_RCGR 0x07E0
Tianyi Gou389ba432012-10-01 13:58:38 -0700104#define BLSP1_UART4_APPS_CMD_RCGR 0x080C
105#define BLSP1_QUP5_SPI_APPS_CMD_RCGR 0x084C
Tianyi Goub1d13972013-01-23 22:55:22 -0800106#define BLSP1_QUP5_I2C_APPS_CMD_RCGR 0x0860
Tianyi Gou389ba432012-10-01 13:58:38 -0700107#define BLSP1_UART5_APPS_CMD_RCGR 0x088C
108#define BLSP1_QUP6_SPI_APPS_CMD_RCGR 0x08CC
Tianyi Goub1d13972013-01-23 22:55:22 -0800109#define BLSP1_QUP6_I2C_APPS_CMD_RCGR 0x08E0
Tianyi Gou389ba432012-10-01 13:58:38 -0700110#define BLSP1_UART6_APPS_CMD_RCGR 0x090C
111#define PDM2_CMD_RCGR 0x0CD0
112#define CE1_CMD_RCGR 0x1050
113#define GP1_CMD_RCGR 0x1904
114#define GP2_CMD_RCGR 0x1944
115#define GP3_CMD_RCGR 0x1984
116#define QPIC_CMD_RCGR 0x1A50
117#define IPA_CMD_RCGR 0x1A90
118
119#define USB_HS_HSIC_BCR 0x0400
120#define USB_HS_BCR 0x0480
121#define SDCC2_BCR 0x0500
122#define SDCC3_BCR 0x0540
123#define BLSP1_BCR 0x05C0
124#define BLSP1_QUP1_BCR 0x0640
125#define BLSP1_UART1_BCR 0x0680
126#define BLSP1_QUP2_BCR 0x06C0
127#define BLSP1_UART2_BCR 0x0700
128#define BLSP1_QUP3_BCR 0x0740
129#define BLSP1_UART3_BCR 0x0780
130#define BLSP1_QUP4_BCR 0x07C0
131#define BLSP1_UART4_BCR 0x0800
132#define BLSP1_QUP5_BCR 0x0840
133#define BLSP1_UART5_BCR 0x0880
134#define BLSP1_QUP6_BCR 0x08C0
135#define BLSP1_UART6_BCR 0x0900
136#define PDM_BCR 0x0CC0
137#define PRNG_BCR 0x0D00
138#define BAM_DMA_BCR 0x0D40
139#define BOOT_ROM_BCR 0x0E00
140#define CE1_BCR 0x1040
141#define QPIC_BCR 0x1040
142#define IPA_BCR 0x1A80
143
144
145#define SYS_NOC_IPA_AXI_CBCR 0x0128
146#define USB_HSIC_AHB_CBCR 0x0408
147#define USB_HSIC_SYSTEM_CBCR 0x040C
148#define USB_HSIC_CBCR 0x0410
149#define USB_HSIC_IO_CAL_CBCR 0x0414
Tianyi Gou55b805b2013-02-28 21:46:03 -0800150#define USB_HSIC_IO_CAL_SLEEP_CBCR 0x0418
Tianyi Gou389ba432012-10-01 13:58:38 -0700151#define USB_HSIC_XCVR_FS_CBCR 0x042C
152#define USB_HS_SYSTEM_CBCR 0x0484
153#define USB_HS_AHB_CBCR 0x0488
154#define SDCC2_APPS_CBCR 0x0504
155#define SDCC2_AHB_CBCR 0x0508
156#define SDCC3_APPS_CBCR 0x0544
157#define SDCC3_AHB_CBCR 0x0548
158#define BLSP1_AHB_CBCR 0x05C4
159#define BLSP1_QUP1_SPI_APPS_CBCR 0x0644
160#define BLSP1_QUP1_I2C_APPS_CBCR 0x0648
161#define BLSP1_UART1_APPS_CBCR 0x0684
162#define BLSP1_UART1_SIM_CBCR 0x0688
163#define BLSP1_QUP2_SPI_APPS_CBCR 0x06C4
164#define BLSP1_QUP2_I2C_APPS_CBCR 0x06C8
165#define BLSP1_UART2_APPS_CBCR 0x0704
166#define BLSP1_UART2_SIM_CBCR 0x0708
167#define BLSP1_QUP3_SPI_APPS_CBCR 0x0744
168#define BLSP1_QUP3_I2C_APPS_CBCR 0x0748
169#define BLSP1_UART3_APPS_CBCR 0x0784
170#define BLSP1_UART3_SIM_CBCR 0x0788
171#define BLSP1_QUP4_SPI_APPS_CBCR 0x07C4
172#define BLSP1_QUP4_I2C_APPS_CBCR 0x07C8
173#define BLSP1_UART4_APPS_CBCR 0x0804
174#define BLSP1_UART4_SIM_CBCR 0x0808
175#define BLSP1_QUP5_SPI_APPS_CBCR 0x0844
176#define BLSP1_QUP5_I2C_APPS_CBCR 0x0848
177#define BLSP1_UART5_APPS_CBCR 0x0884
178#define BLSP1_UART5_SIM_CBCR 0x0888
179#define BLSP1_QUP6_SPI_APPS_CBCR 0x08C4
180#define BLSP1_QUP6_I2C_APPS_CBCR 0x08C8
181#define BLSP1_UART6_APPS_CBCR 0x0904
182#define BLSP1_UART6_SIM_CBCR 0x0908
183#define BOOT_ROM_AHB_CBCR 0x0E04
184#define PDM_AHB_CBCR 0x0CC4
185#define PDM_XO4_CBCR 0x0CC8
186#define PDM_AHB_CBCR 0x0CC4
187#define PDM_XO4_CBCR 0x0CC8
188#define PDM2_CBCR 0x0CCC
189#define PRNG_AHB_CBCR 0x0D04
190#define BAM_DMA_AHB_CBCR 0x0D44
Tianyi Gou55b805b2013-02-28 21:46:03 -0800191#define BAM_DMA_INACTIVITY_TIMERS_CBCR 0x0D48
Tianyi Gou389ba432012-10-01 13:58:38 -0700192#define MSG_RAM_AHB_CBCR 0x0E44
193#define CE1_CBCR 0x1044
194#define CE1_AXI_CBCR 0x1048
195#define CE1_AHB_CBCR 0x104C
196#define GCC_AHB_CBCR 0x10C0
197#define GP1_CBCR 0x1900
198#define GP2_CBCR 0x1940
199#define GP3_CBCR 0x1980
200#define QPIC_CBCR 0x1A44
201#define QPIC_AHB_CBCR 0x1A48
202#define IPA_CBCR 0x1A84
203#define IPA_CNOC_CBCR 0x1A88
204#define IPA_SLEEP_CBCR 0x1A8C
205
Tianyi Gou389ba432012-10-01 13:58:38 -0700206/* Mux source select values */
207#define cxo_source_val 0
208#define gpll0_source_val 1
209#define gpll1_hsic_source_val 4
210#define gnd_source_val 5
Tianyi Gou389ba432012-10-01 13:58:38 -0700211
Vikram Mulukutlad3dca652012-11-19 11:04:13 -0800212#define F_GCC_GND \
213 { \
214 .freq_hz = 0, \
215 .m_val = 0, \
216 .n_val = 0, \
217 .div_src_val = BVAL(4, 0, 1) | BVAL(10, 8, gnd_source_val), \
218 }
219
Tianyi Gou389ba432012-10-01 13:58:38 -0700220#define F(f, s, div, m, n) \
221 { \
222 .freq_hz = (f), \
223 .src_clk = &s##_clk_src.c, \
224 .m_val = (m), \
225 .n_val = ~((n)-(m)) * !!(n), \
226 .d_val = ~(n),\
227 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
228 | BVAL(10, 8, s##_source_val), \
229 }
230
231#define F_HSIC(f, s, div, m, n) \
232 { \
233 .freq_hz = (f), \
234 .src_clk = &s##_clk_src.c, \
235 .m_val = (m), \
236 .n_val = ~((n)-(m)) * !!(n), \
237 .d_val = ~(n),\
238 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
239 | BVAL(10, 8, s##_hsic_source_val), \
240 }
241
Tianyi Goua717ddd2012-10-05 17:06:24 -0700242#define F_APCS_PLL(f, l, m, n, pre_div, post_div, vco) \
243 { \
244 .freq_hz = (f), \
245 .l_val = (l), \
246 .m_val = (m), \
247 .n_val = (n), \
248 .pre_div_val = BVAL(14, 12, (pre_div)), \
249 .post_div_val = BVAL(9, 8, (post_div)), \
250 .vco_val = BVAL(21, 20, (vco)), \
251 }
Tianyi Gou389ba432012-10-01 13:58:38 -0700252
253#define VDD_DIG_FMAX_MAP1(l1, f1) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700254 .vdd_class = &vdd_dig, \
255 .fmax = (unsigned long[VDD_DIG_NUM]) { \
256 [VDD_DIG_##l1] = (f1), \
257 }, \
258 .num_fmax = VDD_DIG_NUM
Tianyi Gou389ba432012-10-01 13:58:38 -0700259#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700260 .vdd_class = &vdd_dig, \
261 .fmax = (unsigned long[VDD_DIG_NUM]) { \
262 [VDD_DIG_##l1] = (f1), \
263 [VDD_DIG_##l2] = (f2), \
264 }, \
265 .num_fmax = VDD_DIG_NUM
Tianyi Gou389ba432012-10-01 13:58:38 -0700266#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700267 .vdd_class = &vdd_dig, \
268 .fmax = (unsigned long[VDD_DIG_NUM]) { \
269 [VDD_DIG_##l1] = (f1), \
270 [VDD_DIG_##l2] = (f2), \
271 [VDD_DIG_##l3] = (f3), \
272 }, \
273 .num_fmax = VDD_DIG_NUM
Tianyi Gou389ba432012-10-01 13:58:38 -0700274
275enum vdd_dig_levels {
276 VDD_DIG_NONE,
277 VDD_DIG_LOW,
278 VDD_DIG_NOMINAL,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700279 VDD_DIG_HIGH,
280 VDD_DIG_NUM
Tianyi Gou389ba432012-10-01 13:58:38 -0700281};
282
Junjie Wubb5a79e2013-05-15 13:12:39 -0700283static int vdd_corner[] = {
284 RPM_REGULATOR_CORNER_NONE, /* VDD_DIG_NONE */
285 RPM_REGULATOR_CORNER_SVS_SOC, /* VDD_DIG_LOW */
286 RPM_REGULATOR_CORNER_NORMAL, /* VDD_DIG_NOMINAL */
287 RPM_REGULATOR_CORNER_SUPER_TURBO, /* VDD_DIG_HIGH */
Tianyi Gou389ba432012-10-01 13:58:38 -0700288};
289
Patrick Daly653c0b52013-04-16 17:18:28 -0700290static DEFINE_VDD_REGULATORS(vdd_dig, VDD_DIG_NUM, 1, vdd_corner, NULL);
Tianyi Gou389ba432012-10-01 13:58:38 -0700291
Tianyi Gou389ba432012-10-01 13:58:38 -0700292#define RPM_MISC_CLK_TYPE 0x306b6c63
293#define RPM_BUS_CLK_TYPE 0x316b6c63
294#define RPM_MEM_CLK_TYPE 0x326b6c63
Tianyi Gouc2a71bc2013-04-24 18:24:06 -0700295#define RPM_QPIC_CLK_TYPE 0x63697071
Tianyi Gou389ba432012-10-01 13:58:38 -0700296
297#define RPM_SMD_KEY_ENABLE 0x62616E45
298
299#define CXO_ID 0x0
300#define QDSS_ID 0x1
301
302#define PNOC_ID 0x0
303#define SNOC_ID 0x1
304#define CNOC_ID 0x2
305
306#define BIMC_ID 0x0
307
Tianyi Gouc2a71bc2013-04-24 18:24:06 -0700308#define QPIC_ID 0x0
309
Tianyi Gou389ba432012-10-01 13:58:38 -0700310#define D0_ID 1
311#define D1_ID 2
312#define A0_ID 3
313#define A1_ID 4
314#define A2_ID 5
315
316DEFINE_CLK_RPM_SMD_BRANCH(cxo_clk_src, cxo_a_clk_src,
317 RPM_MISC_CLK_TYPE, CXO_ID, 19200000);
318
319DEFINE_CLK_RPM_SMD(cnoc_clk, cnoc_a_clk, RPM_BUS_CLK_TYPE, CNOC_ID, NULL);
320DEFINE_CLK_RPM_SMD(pnoc_clk, pnoc_a_clk, RPM_BUS_CLK_TYPE, PNOC_ID, NULL);
321DEFINE_CLK_RPM_SMD(snoc_clk, snoc_a_clk, RPM_BUS_CLK_TYPE, SNOC_ID, NULL);
322
323DEFINE_CLK_RPM_SMD(bimc_clk, bimc_a_clk, RPM_MEM_CLK_TYPE, BIMC_ID, NULL);
324
Tianyi Gouc2a71bc2013-04-24 18:24:06 -0700325DEFINE_CLK_RPM_SMD(qpic_clk, qpic_a_clk, RPM_QPIC_CLK_TYPE, QPIC_ID, NULL);
326
Tianyi Gou389ba432012-10-01 13:58:38 -0700327DEFINE_CLK_RPM_SMD_QDSS(qdss_clk, qdss_a_clk, RPM_MISC_CLK_TYPE, QDSS_ID);
328
329DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d0, cxo_d0_a, D0_ID);
330DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d1, cxo_d1_a, D1_ID);
331DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a0, cxo_a0_a, A0_ID);
332DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a1, cxo_a1_a, A1_ID);
333DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a2, cxo_a2_a, A2_ID);
334
335DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d0_pin, cxo_d0_a_pin, D0_ID);
336DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d1_pin, cxo_d1_a_pin, D1_ID);
337DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a0_pin, cxo_a0_a_pin, A0_ID);
338DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a1_pin, cxo_a1_a_pin, A1_ID);
339DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a2_pin, cxo_a2_a_pin, A2_ID);
340
Tianyi Gou27df1bb2012-10-11 14:44:01 -0700341static unsigned int soft_vote_gpll0;
342
Tianyi Gou389ba432012-10-01 13:58:38 -0700343static struct pll_vote_clk gpll0_clk_src = {
344 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE_REG,
Tianyi Gou2aee4652013-03-11 19:15:22 -0700345 .en_mask = BIT(0),
Tianyi Gou389ba432012-10-01 13:58:38 -0700346 .status_reg = (void __iomem *)GPLL0_STATUS_REG,
347 .status_mask = BIT(17),
Tianyi Gou27df1bb2012-10-11 14:44:01 -0700348 .soft_vote = &soft_vote_gpll0,
349 .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY,
Tianyi Gou389ba432012-10-01 13:58:38 -0700350 .base = &virt_bases[GCC_BASE],
351 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700352 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -0700353 .rate = 600000000,
354 .dbg_name = "gpll0_clk_src",
Tianyi Gou27df1bb2012-10-11 14:44:01 -0700355 .ops = &clk_ops_pll_acpu_vote,
Tianyi Gou389ba432012-10-01 13:58:38 -0700356 CLK_INIT(gpll0_clk_src.c),
357 },
358};
359
Tianyi Gou27df1bb2012-10-11 14:44:01 -0700360static struct pll_vote_clk gpll0_activeonly_clk_src = {
361 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE_REG,
Tianyi Gou2aee4652013-03-11 19:15:22 -0700362 .en_mask = BIT(0),
Tianyi Gou27df1bb2012-10-11 14:44:01 -0700363 .status_reg = (void __iomem *)GPLL0_STATUS_REG,
364 .status_mask = BIT(17),
365 .soft_vote = &soft_vote_gpll0,
366 .soft_vote_mask = PLL_SOFT_VOTE_ACPU,
367 .base = &virt_bases[GCC_BASE],
368 .c = {
369 .rate = 600000000,
370 .dbg_name = "gpll0_activeonly_clk_src",
371 .ops = &clk_ops_pll_acpu_vote,
372 CLK_INIT(gpll0_activeonly_clk_src.c),
373 },
374};
375
Tianyi Gou389ba432012-10-01 13:58:38 -0700376static struct pll_vote_clk gpll1_clk_src = {
377 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE_REG,
378 .en_mask = BIT(1),
379 .status_reg = (void __iomem *)GPLL1_STATUS_REG,
380 .status_mask = BIT(17),
Tianyi Gou389ba432012-10-01 13:58:38 -0700381 .base = &virt_bases[GCC_BASE],
382 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700383 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -0700384 .rate = 480000000,
385 .dbg_name = "gpll1_clk_src",
386 .ops = &clk_ops_pll_vote,
387 CLK_INIT(gpll1_clk_src.c),
388 },
389};
390
Tianyi Goua717ddd2012-10-05 17:06:24 -0700391static struct pll_freq_tbl apcs_pll_freq[] = {
392 F_APCS_PLL(748800000, 0x27, 0x0, 0x1, 0x0, 0x0, 0x0),
393 F_APCS_PLL(998400000, 0x34, 0x0, 0x1, 0x0, 0x0, 0x0),
394 PLL_F_END
395};
396
Tianyi Gou389ba432012-10-01 13:58:38 -0700397static struct pll_clk apcspll_clk_src = {
398 .mode_reg = (void __iomem *)APCS_CPU_PLL_MODE_REG,
Tianyi Goua717ddd2012-10-05 17:06:24 -0700399 .l_reg = (void __iomem *)APCS_CPU_PLL_L_REG,
400 .m_reg = (void __iomem *)APCS_CPU_PLL_M_REG,
401 .n_reg = (void __iomem *)APCS_CPU_PLL_N_REG,
402 .config_reg = (void __iomem *)APCS_CPU_PLL_USER_CTL_REG,
Tianyi Gou389ba432012-10-01 13:58:38 -0700403 .status_reg = (void __iomem *)APCS_CPU_PLL_STATUS_REG,
Tianyi Goua717ddd2012-10-05 17:06:24 -0700404 .freq_tbl = apcs_pll_freq,
405 .masks = {
406 .vco_mask = BM(21, 20),
407 .pre_div_mask = BM(14, 12),
408 .post_div_mask = BM(9, 8),
409 .mn_en_mask = BIT(24),
410 .main_output_mask = BIT(0),
411 },
Tianyi Gou389ba432012-10-01 13:58:38 -0700412 .base = &virt_bases[APCS_PLL_BASE],
413 .c = {
Patrick Daly9bdc8a52013-03-21 19:12:40 -0700414 .parent = &cxo_a_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -0700415 .dbg_name = "apcspll_clk_src",
416 .ops = &clk_ops_local_pll,
417 CLK_INIT(apcspll_clk_src.c),
Tianyi Gou389ba432012-10-01 13:58:38 -0700418 },
419};
420
421static DEFINE_CLK_VOTER(pnoc_msmbus_clk, &pnoc_clk.c, LONG_MAX);
422static DEFINE_CLK_VOTER(snoc_msmbus_clk, &snoc_clk.c, LONG_MAX);
423static DEFINE_CLK_VOTER(cnoc_msmbus_clk, &cnoc_clk.c, LONG_MAX);
424static DEFINE_CLK_VOTER(pnoc_msmbus_a_clk, &pnoc_a_clk.c, LONG_MAX);
425static DEFINE_CLK_VOTER(snoc_msmbus_a_clk, &snoc_a_clk.c, LONG_MAX);
426static DEFINE_CLK_VOTER(cnoc_msmbus_a_clk, &cnoc_a_clk.c, LONG_MAX);
427
428static DEFINE_CLK_VOTER(bimc_msmbus_clk, &bimc_clk.c, LONG_MAX);
429static DEFINE_CLK_VOTER(bimc_msmbus_a_clk, &bimc_a_clk.c, LONG_MAX);
430
431static DEFINE_CLK_VOTER(pnoc_sdcc2_clk, &pnoc_clk.c, LONG_MAX);
432static DEFINE_CLK_VOTER(pnoc_sdcc3_clk, &pnoc_clk.c, LONG_MAX);
Tianyi Gou389ba432012-10-01 13:58:38 -0700433static DEFINE_CLK_VOTER(pnoc_sps_clk, &pnoc_clk.c, LONG_MAX);
434
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -0700435static DEFINE_CLK_BRANCH_VOTER(cxo_lpm_clk, &cxo_clk_src.c);
436
Tianyi Gou389ba432012-10-01 13:58:38 -0700437static struct clk_freq_tbl ftbl_gcc_ipa_clk[] = {
438 F( 50000000, gpll0, 12, 0, 0),
439 F( 92310000, gpll0, 6.5, 0, 0),
440 F(100000000, gpll0, 6, 0, 0),
441 F_END
442};
443
444static struct rcg_clk ipa_clk_src = {
445 .cmd_rcgr_reg = IPA_CMD_RCGR,
446 .set_rate = set_rate_mnd,
447 .freq_tbl = ftbl_gcc_ipa_clk,
448 .current_freq = &rcg_dummy_freq,
449 .base = &virt_bases[GCC_BASE],
450 .c = {
451 .dbg_name = "ipa_clk_src",
452 .ops = &clk_ops_rcg_mnd,
453 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
454 CLK_INIT(ipa_clk_src.c)
455 },
456};
457
Tianyi Goub1d13972013-01-23 22:55:22 -0800458static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_i2c_apps_clk[] = {
459 F(19200000, cxo, 1, 0, 0),
460 F(50000000, gpll0, 12, 0, 0),
461 F_END
462};
463
464static struct rcg_clk blsp1_qup1_i2c_apps_clk_src = {
465 .cmd_rcgr_reg = BLSP1_QUP1_I2C_APPS_CMD_RCGR,
466 .set_rate = set_rate_hid,
467 .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk,
468 .current_freq = &rcg_dummy_freq,
469 .base = &virt_bases[GCC_BASE],
470 .c = {
471 .dbg_name = "blsp1_qup1_i2c_apps_clk_src",
472 .ops = &clk_ops_rcg,
473 VDD_DIG_FMAX_MAP1(LOW, 50000000),
474 CLK_INIT(blsp1_qup1_i2c_apps_clk_src.c),
475 },
476};
477
478static struct rcg_clk blsp1_qup2_i2c_apps_clk_src = {
479 .cmd_rcgr_reg = BLSP1_QUP2_I2C_APPS_CMD_RCGR,
480 .set_rate = set_rate_hid,
481 .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk,
482 .current_freq = &rcg_dummy_freq,
483 .base = &virt_bases[GCC_BASE],
484 .c = {
485 .dbg_name = "blsp1_qup2_i2c_apps_clk_src",
486 .ops = &clk_ops_rcg,
487 VDD_DIG_FMAX_MAP1(LOW, 50000000),
488 CLK_INIT(blsp1_qup2_i2c_apps_clk_src.c),
489 },
490};
491
492static struct rcg_clk blsp1_qup3_i2c_apps_clk_src = {
493 .cmd_rcgr_reg = BLSP1_QUP3_I2C_APPS_CMD_RCGR,
494 .set_rate = set_rate_hid,
495 .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk,
496 .current_freq = &rcg_dummy_freq,
497 .base = &virt_bases[GCC_BASE],
498 .c = {
499 .dbg_name = "blsp1_qup3_i2c_apps_clk_src",
500 .ops = &clk_ops_rcg,
501 VDD_DIG_FMAX_MAP1(LOW, 50000000),
502 CLK_INIT(blsp1_qup3_i2c_apps_clk_src.c),
503 },
504};
505
506static struct rcg_clk blsp1_qup4_i2c_apps_clk_src = {
507 .cmd_rcgr_reg = BLSP1_QUP4_I2C_APPS_CMD_RCGR,
508 .set_rate = set_rate_hid,
509 .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk,
510 .current_freq = &rcg_dummy_freq,
511 .base = &virt_bases[GCC_BASE],
512 .c = {
513 .dbg_name = "blsp1_qup4_i2c_apps_clk_src",
514 .ops = &clk_ops_rcg,
515 VDD_DIG_FMAX_MAP1(LOW, 50000000),
516 CLK_INIT(blsp1_qup4_i2c_apps_clk_src.c),
517 },
518};
519
520static struct rcg_clk blsp1_qup5_i2c_apps_clk_src = {
521 .cmd_rcgr_reg = BLSP1_QUP5_I2C_APPS_CMD_RCGR,
522 .set_rate = set_rate_hid,
523 .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk,
524 .current_freq = &rcg_dummy_freq,
525 .base = &virt_bases[GCC_BASE],
526 .c = {
527 .dbg_name = "blsp1_qup5_i2c_apps_clk_src",
528 .ops = &clk_ops_rcg,
529 VDD_DIG_FMAX_MAP1(LOW, 50000000),
530 CLK_INIT(blsp1_qup5_i2c_apps_clk_src.c),
531 },
532};
533
534static struct rcg_clk blsp1_qup6_i2c_apps_clk_src = {
535 .cmd_rcgr_reg = BLSP1_QUP6_I2C_APPS_CMD_RCGR,
536 .set_rate = set_rate_hid,
537 .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk,
538 .current_freq = &rcg_dummy_freq,
539 .base = &virt_bases[GCC_BASE],
540 .c = {
541 .dbg_name = "blsp1_qup6_i2c_apps_clk_src",
542 .ops = &clk_ops_rcg,
543 VDD_DIG_FMAX_MAP1(LOW, 50000000),
544 CLK_INIT(blsp1_qup6_i2c_apps_clk_src.c),
545 },
546};
547
Tianyi Gou389ba432012-10-01 13:58:38 -0700548static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = {
549 F( 960000, cxo, 10, 1, 2),
550 F( 4800000, cxo, 4, 0, 0),
551 F( 9600000, cxo, 2, 0, 0),
552 F(15000000, gpll0, 10, 1, 4),
553 F(19200000, cxo, 1, 0, 0),
554 F(25000000, gpll0, 12, 1, 2),
555 F(50000000, gpll0, 12, 0, 0),
556 F_END
557};
558
559static struct rcg_clk blsp1_qup1_spi_apps_clk_src = {
560 .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR,
561 .set_rate = set_rate_mnd,
562 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
563 .current_freq = &rcg_dummy_freq,
564 .base = &virt_bases[GCC_BASE],
565 .c = {
566 .dbg_name = "blsp1_qup1_spi_apps_clk_src",
567 .ops = &clk_ops_rcg_mnd,
568 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
569 CLK_INIT(blsp1_qup1_spi_apps_clk_src.c)
570 },
571};
572
573static struct rcg_clk blsp1_qup2_spi_apps_clk_src = {
574 .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR,
575 .set_rate = set_rate_mnd,
576 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
577 .current_freq = &rcg_dummy_freq,
578 .base = &virt_bases[GCC_BASE],
579 .c = {
580 .dbg_name = "blsp1_qup2_spi_apps_clk_src",
581 .ops = &clk_ops_rcg_mnd,
582 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
583 CLK_INIT(blsp1_qup2_spi_apps_clk_src.c)
584 },
585};
586
587static struct rcg_clk blsp1_qup3_spi_apps_clk_src = {
588 .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR,
589 .set_rate = set_rate_mnd,
590 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
591 .current_freq = &rcg_dummy_freq,
592 .base = &virt_bases[GCC_BASE],
593 .c = {
594 .dbg_name = "blsp1_qup3_spi_apps_clk_src",
595 .ops = &clk_ops_rcg_mnd,
596 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
597 CLK_INIT(blsp1_qup3_spi_apps_clk_src.c)
598 },
599};
600
601static struct rcg_clk blsp1_qup4_spi_apps_clk_src = {
602 .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR,
603 .set_rate = set_rate_mnd,
604 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
605 .current_freq = &rcg_dummy_freq,
606 .base = &virt_bases[GCC_BASE],
607 .c = {
608 .dbg_name = "blsp1_qup4_spi_apps_clk_src",
609 .ops = &clk_ops_rcg_mnd,
610 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
611 CLK_INIT(blsp1_qup4_spi_apps_clk_src.c)
612 },
613};
614
615static struct rcg_clk blsp1_qup5_spi_apps_clk_src = {
616 .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR,
617 .set_rate = set_rate_mnd,
618 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
619 .current_freq = &rcg_dummy_freq,
620 .base = &virt_bases[GCC_BASE],
621 .c = {
622 .dbg_name = "blsp1_qup5_spi_apps_clk_src",
623 .ops = &clk_ops_rcg_mnd,
624 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
625 CLK_INIT(blsp1_qup5_spi_apps_clk_src.c)
626 },
627};
628
629static struct rcg_clk blsp1_qup6_spi_apps_clk_src = {
630 .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR,
631 .set_rate = set_rate_mnd,
632 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
633 .current_freq = &rcg_dummy_freq,
634 .base = &virt_bases[GCC_BASE],
635 .c = {
636 .dbg_name = "blsp1_qup6_spi_apps_clk_src",
637 .ops = &clk_ops_rcg_mnd,
638 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
639 CLK_INIT(blsp1_qup6_spi_apps_clk_src.c)
640 },
641};
642
643static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = {
Vikram Mulukutlad3dca652012-11-19 11:04:13 -0800644 F_GCC_GND,
Tianyi Gou389ba432012-10-01 13:58:38 -0700645 F( 3686400, gpll0, 1, 96, 15625),
646 F( 7372800, gpll0, 1, 192, 15625),
647 F(14745600, gpll0, 1, 384, 15625),
648 F(16000000, gpll0, 5, 2, 15),
649 F(19200000, cxo, 1, 0, 0),
650 F(24000000, gpll0, 5, 1, 5),
651 F(32000000, gpll0, 1, 4, 75),
652 F(40000000, gpll0, 15, 0, 0),
653 F(46400000, gpll0, 1, 29, 375),
654 F(48000000, gpll0, 12.5, 0, 0),
655 F(51200000, gpll0, 1, 32, 375),
656 F(56000000, gpll0, 1, 7, 75),
657 F(58982400, gpll0, 1, 1536, 15625),
658 F(60000000, gpll0, 10, 0, 0),
659 F_END
660};
661
662static struct rcg_clk blsp1_uart1_apps_clk_src = {
663 .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR,
664 .set_rate = set_rate_mnd,
665 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
666 .current_freq = &rcg_dummy_freq,
667 .base = &virt_bases[GCC_BASE],
668 .c = {
669 .dbg_name = "blsp1_uart1_apps_clk_src",
670 .ops = &clk_ops_rcg_mnd,
671 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
672 CLK_INIT(blsp1_uart1_apps_clk_src.c)
673 },
674};
675
676static struct rcg_clk blsp1_uart2_apps_clk_src = {
677 .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR,
678 .set_rate = set_rate_mnd,
679 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
680 .current_freq = &rcg_dummy_freq,
681 .base = &virt_bases[GCC_BASE],
682 .c = {
683 .dbg_name = "blsp1_uart2_apps_clk_src",
684 .ops = &clk_ops_rcg_mnd,
685 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
686 CLK_INIT(blsp1_uart2_apps_clk_src.c)
687 },
688};
689
690static struct rcg_clk blsp1_uart3_apps_clk_src = {
691 .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR,
692 .set_rate = set_rate_mnd,
693 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
694 .current_freq = &rcg_dummy_freq,
695 .base = &virt_bases[GCC_BASE],
696 .c = {
697 .dbg_name = "blsp1_uart3_apps_clk_src",
698 .ops = &clk_ops_rcg_mnd,
699 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
700 CLK_INIT(blsp1_uart3_apps_clk_src.c)
701 },
702};
703
704static struct rcg_clk blsp1_uart4_apps_clk_src = {
705 .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR,
706 .set_rate = set_rate_mnd,
707 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
708 .current_freq = &rcg_dummy_freq,
709 .base = &virt_bases[GCC_BASE],
710 .c = {
711 .dbg_name = "blsp1_uart4_apps_clk_src",
712 .ops = &clk_ops_rcg_mnd,
713 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
714 CLK_INIT(blsp1_uart4_apps_clk_src.c)
715 },
716};
717
718static struct rcg_clk blsp1_uart5_apps_clk_src = {
719 .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR,
720 .set_rate = set_rate_mnd,
721 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
722 .current_freq = &rcg_dummy_freq,
723 .base = &virt_bases[GCC_BASE],
724 .c = {
725 .dbg_name = "blsp1_uart5_apps_clk_src",
726 .ops = &clk_ops_rcg_mnd,
727 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
728 CLK_INIT(blsp1_uart5_apps_clk_src.c)
729 },
730};
731
732static struct rcg_clk blsp1_uart6_apps_clk_src = {
733 .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR,
734 .set_rate = set_rate_mnd,
735 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
736 .current_freq = &rcg_dummy_freq,
737 .base = &virt_bases[GCC_BASE],
738 .c = {
739 .dbg_name = "blsp1_uart6_apps_clk_src",
740 .ops = &clk_ops_rcg_mnd,
741 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
742 CLK_INIT(blsp1_uart6_apps_clk_src.c)
743 },
744};
745
746static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = {
747 F( 50000000, gpll0, 12, 0, 0),
748 F(100000000, gpll0, 6, 0, 0),
749 F_END
750};
751
752static struct rcg_clk ce1_clk_src = {
753 .cmd_rcgr_reg = CE1_CMD_RCGR,
754 .set_rate = set_rate_hid,
755 .freq_tbl = ftbl_gcc_ce1_clk,
756 .current_freq = &rcg_dummy_freq,
757 .base = &virt_bases[GCC_BASE],
758 .c = {
759 .dbg_name = "ce1_clk_src",
760 .ops = &clk_ops_rcg,
761 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
762 CLK_INIT(ce1_clk_src.c),
763 },
764};
765
766static struct clk_freq_tbl ftbl_gcc_gp_clk[] = {
767 F(19200000, cxo, 1, 0, 0),
768 F_END
769};
770
771static struct rcg_clk gp1_clk_src = {
772 .cmd_rcgr_reg = GP1_CMD_RCGR,
773 .set_rate = set_rate_mnd,
774 .freq_tbl = ftbl_gcc_gp_clk,
775 .current_freq = &rcg_dummy_freq,
776 .base = &virt_bases[GCC_BASE],
777 .c = {
778 .dbg_name = "gp1_clk_src",
779 .ops = &clk_ops_rcg_mnd,
780 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
781 CLK_INIT(gp1_clk_src.c)
782 },
783};
784
785static struct rcg_clk gp2_clk_src = {
786 .cmd_rcgr_reg = GP2_CMD_RCGR,
787 .set_rate = set_rate_mnd,
788 .freq_tbl = ftbl_gcc_gp_clk,
789 .current_freq = &rcg_dummy_freq,
790 .base = &virt_bases[GCC_BASE],
791 .c = {
792 .dbg_name = "gp2_clk_src",
793 .ops = &clk_ops_rcg_mnd,
794 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
795 CLK_INIT(gp2_clk_src.c)
796 },
797};
798
799static struct rcg_clk gp3_clk_src = {
800 .cmd_rcgr_reg = GP3_CMD_RCGR,
801 .set_rate = set_rate_mnd,
802 .freq_tbl = ftbl_gcc_gp_clk,
803 .current_freq = &rcg_dummy_freq,
804 .base = &virt_bases[GCC_BASE],
805 .c = {
806 .dbg_name = "gp3_clk_src",
807 .ops = &clk_ops_rcg_mnd,
808 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
809 CLK_INIT(gp3_clk_src.c)
810 },
811};
812
813static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = {
814 F(60000000, gpll0, 10, 0, 0),
815 F_END
816};
817
818static struct rcg_clk pdm2_clk_src = {
819 .cmd_rcgr_reg = PDM2_CMD_RCGR,
820 .set_rate = set_rate_hid,
821 .freq_tbl = ftbl_gcc_pdm2_clk,
822 .current_freq = &rcg_dummy_freq,
823 .base = &virt_bases[GCC_BASE],
824 .c = {
825 .dbg_name = "pdm2_clk_src",
826 .ops = &clk_ops_rcg,
827 VDD_DIG_FMAX_MAP1(LOW, 60000000),
828 CLK_INIT(pdm2_clk_src.c),
829 },
830};
831
Tianyi Gou389ba432012-10-01 13:58:38 -0700832static struct clk_freq_tbl ftbl_gcc_sdcc2_apps_clk[] = {
833 F( 144000, cxo, 16, 3, 25),
834 F( 400000, cxo, 12, 1, 4),
835 F( 20000000, gpll0, 15, 1, 2),
836 F( 25000000, gpll0, 12, 1, 2),
837 F( 50000000, gpll0, 12, 0, 0),
838 F(100000000, gpll0, 6, 0, 0),
839 F(200000000, gpll0, 3, 0, 0),
840 F_END
841};
842
843static struct clk_freq_tbl ftbl_gcc_sdcc3_apps_clk[] = {
844 F( 144000, cxo, 16, 3, 25),
845 F( 400000, cxo, 12, 1, 4),
846 F( 20000000, gpll0, 15, 1, 2),
847 F( 25000000, gpll0, 12, 1, 2),
848 F( 50000000, gpll0, 12, 0, 0),
849 F(100000000, gpll0, 6, 0, 0),
850 F_END
851};
852
853static struct rcg_clk sdcc2_apps_clk_src = {
854 .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR,
855 .set_rate = set_rate_mnd,
856 .freq_tbl = ftbl_gcc_sdcc2_apps_clk,
857 .current_freq = &rcg_dummy_freq,
858 .base = &virt_bases[GCC_BASE],
859 .c = {
860 .dbg_name = "sdcc2_apps_clk_src",
861 .ops = &clk_ops_rcg_mnd,
862 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
863 CLK_INIT(sdcc2_apps_clk_src.c)
864 },
865};
866
867static struct rcg_clk sdcc3_apps_clk_src = {
868 .cmd_rcgr_reg = SDCC3_APPS_CMD_RCGR,
869 .set_rate = set_rate_mnd,
870 .freq_tbl = ftbl_gcc_sdcc3_apps_clk,
871 .current_freq = &rcg_dummy_freq,
872 .base = &virt_bases[GCC_BASE],
873 .c = {
874 .dbg_name = "sdcc3_apps_clk_src",
875 .ops = &clk_ops_rcg_mnd,
876 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
877 CLK_INIT(sdcc3_apps_clk_src.c)
878 },
879};
880
881static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = {
882 F(75000000, gpll0, 8, 0, 0),
883 F_END
884};
885
886static struct rcg_clk usb_hs_system_clk_src = {
887 .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR,
888 .set_rate = set_rate_hid,
889 .freq_tbl = ftbl_gcc_usb_hs_system_clk,
890 .current_freq = &rcg_dummy_freq,
891 .base = &virt_bases[GCC_BASE],
892 .c = {
893 .dbg_name = "usb_hs_system_clk_src",
894 .ops = &clk_ops_rcg,
895 VDD_DIG_FMAX_MAP2(LOW, 37500000, NOMINAL, 75000000),
896 CLK_INIT(usb_hs_system_clk_src.c),
897 },
898};
899
900static struct clk_freq_tbl ftbl_gcc_usb_hsic_clk[] = {
901 F_HSIC(480000000, gpll1, 1, 0, 0),
902 F_END
903};
904
905static struct rcg_clk usb_hsic_clk_src = {
906 .cmd_rcgr_reg = USB_HSIC_CMD_RCGR,
907 .set_rate = set_rate_hid,
908 .freq_tbl = ftbl_gcc_usb_hsic_clk,
909 .current_freq = &rcg_dummy_freq,
910 .base = &virt_bases[GCC_BASE],
911 .c = {
912 .dbg_name = "usb_hsic_clk_src",
913 .ops = &clk_ops_rcg,
914 VDD_DIG_FMAX_MAP1(LOW, 480000000),
915 CLK_INIT(usb_hsic_clk_src.c),
916 },
917};
918
919static struct clk_freq_tbl ftbl_gcc_usb_hsic_io_cal_clk[] = {
920 F(9600000, cxo, 2, 0, 0),
921 F_END
922};
923
924static struct rcg_clk usb_hsic_io_cal_clk_src = {
925 .cmd_rcgr_reg = USB_HSIC_IO_CAL_CMD_RCGR,
926 .set_rate = set_rate_hid,
927 .freq_tbl = ftbl_gcc_usb_hsic_io_cal_clk,
928 .current_freq = &rcg_dummy_freq,
929 .base = &virt_bases[GCC_BASE],
930 .c = {
931 .dbg_name = "usb_hsic_io_cal_clk_src",
932 .ops = &clk_ops_rcg,
933 VDD_DIG_FMAX_MAP1(LOW, 9600000),
934 CLK_INIT(usb_hsic_io_cal_clk_src.c),
935 },
936};
937
938static struct clk_freq_tbl ftbl_gcc_usb_hsic_system_clk[] = {
939 F(75000000, gpll0, 8, 0, 0),
940 F_END
941};
942
943static struct rcg_clk usb_hsic_system_clk_src = {
944 .cmd_rcgr_reg = USB_HSIC_SYSTEM_CMD_RCGR,
945 .set_rate = set_rate_hid,
946 .freq_tbl = ftbl_gcc_usb_hsic_system_clk,
947 .current_freq = &rcg_dummy_freq,
948 .base = &virt_bases[GCC_BASE],
949 .c = {
950 .dbg_name = "usb_hsic_system_clk_src",
951 .ops = &clk_ops_rcg,
952 VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 75000000),
953 CLK_INIT(usb_hsic_system_clk_src.c),
954 },
955};
956
957static struct clk_freq_tbl ftbl_gcc_usb_hsic_xcvr_fs_clk[] = {
958 F(60000000, gpll0, 10, 0, 0),
959 F_END
960};
961
962static struct rcg_clk usb_hsic_xcvr_fs_clk_src = {
963 .cmd_rcgr_reg = USB_HSIC_XCVR_FS_CMD_RCGR,
964 .set_rate = set_rate_hid,
965 .freq_tbl = ftbl_gcc_usb_hsic_xcvr_fs_clk,
966 .current_freq = &rcg_dummy_freq,
967 .base = &virt_bases[GCC_BASE],
968 .c = {
969 .dbg_name = "usb_hsic_xcvr_fs_clk_src",
970 .ops = &clk_ops_rcg,
971 VDD_DIG_FMAX_MAP1(LOW, 60000000),
972 CLK_INIT(usb_hsic_xcvr_fs_clk_src.c),
973 },
974};
975
976static struct local_vote_clk gcc_bam_dma_ahb_clk = {
977 .cbcr_reg = BAM_DMA_AHB_CBCR,
978 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
979 .en_mask = BIT(12),
980 .base = &virt_bases[GCC_BASE],
981 .c = {
982 .dbg_name = "gcc_bam_dma_ahb_clk",
983 .ops = &clk_ops_vote,
984 CLK_INIT(gcc_bam_dma_ahb_clk.c),
985 },
986};
987
Tianyi Gou55b805b2013-02-28 21:46:03 -0800988static struct local_vote_clk gcc_bam_dma_inactivity_timers_clk = {
989 .cbcr_reg = BAM_DMA_INACTIVITY_TIMERS_CBCR,
990 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
991 .en_mask = BIT(11),
992 .base = &virt_bases[GCC_BASE],
993 .c = {
994 .dbg_name = "gcc_bam_dma_inactivity_timers_clk",
995 .ops = &clk_ops_vote,
996 CLK_INIT(gcc_bam_dma_inactivity_timers_clk.c),
997 },
998};
999
Tianyi Gou389ba432012-10-01 13:58:38 -07001000static struct local_vote_clk gcc_blsp1_ahb_clk = {
1001 .cbcr_reg = BLSP1_AHB_CBCR,
1002 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1003 .en_mask = BIT(17),
1004 .base = &virt_bases[GCC_BASE],
1005 .c = {
1006 .dbg_name = "gcc_blsp1_ahb_clk",
1007 .ops = &clk_ops_vote,
1008 CLK_INIT(gcc_blsp1_ahb_clk.c),
1009 },
1010};
1011
1012static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = {
1013 .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001014 .base = &virt_bases[GCC_BASE],
1015 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001016 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001017 .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk",
1018 .ops = &clk_ops_branch,
1019 CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c),
1020 },
1021};
1022
1023static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = {
1024 .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001025 .has_sibling = 0,
1026 .base = &virt_bases[GCC_BASE],
1027 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001028 .parent = &blsp1_qup1_spi_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001029 .dbg_name = "gcc_blsp1_qup1_spi_apps_clk",
1030 .ops = &clk_ops_branch,
1031 CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c),
1032 },
1033};
1034
1035static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = {
1036 .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001037 .base = &virt_bases[GCC_BASE],
1038 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001039 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001040 .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk",
1041 .ops = &clk_ops_branch,
1042 CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c),
1043 },
1044};
1045
1046static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = {
1047 .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001048 .has_sibling = 0,
1049 .base = &virt_bases[GCC_BASE],
1050 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001051 .parent = &blsp1_qup2_spi_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001052 .dbg_name = "gcc_blsp1_qup2_spi_apps_clk",
1053 .ops = &clk_ops_branch,
1054 CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c),
1055 },
1056};
1057
1058static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = {
1059 .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001060 .base = &virt_bases[GCC_BASE],
1061 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001062 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001063 .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk",
1064 .ops = &clk_ops_branch,
1065 CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c),
1066 },
1067};
1068
1069static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = {
1070 .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001071 .has_sibling = 0,
1072 .base = &virt_bases[GCC_BASE],
1073 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001074 .parent = &blsp1_qup3_spi_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001075 .dbg_name = "gcc_blsp1_qup3_spi_apps_clk",
1076 .ops = &clk_ops_branch,
1077 CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c),
1078 },
1079};
1080
1081static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = {
1082 .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001083 .base = &virt_bases[GCC_BASE],
1084 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001085 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001086 .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk",
1087 .ops = &clk_ops_branch,
1088 CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c),
1089 },
1090};
1091
1092static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = {
1093 .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001094 .has_sibling = 0,
1095 .base = &virt_bases[GCC_BASE],
1096 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001097 .parent = &blsp1_qup4_spi_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001098 .dbg_name = "gcc_blsp1_qup4_spi_apps_clk",
1099 .ops = &clk_ops_branch,
1100 CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c),
1101 },
1102};
1103
1104static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = {
1105 .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001106 .base = &virt_bases[GCC_BASE],
1107 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001108 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001109 .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk",
1110 .ops = &clk_ops_branch,
1111 CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c),
1112 },
1113};
1114
1115static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = {
1116 .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001117 .has_sibling = 0,
1118 .base = &virt_bases[GCC_BASE],
1119 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001120 .parent = &blsp1_qup5_spi_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001121 .dbg_name = "gcc_blsp1_qup5_spi_apps_clk",
1122 .ops = &clk_ops_branch,
1123 CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c),
1124 },
1125};
1126
1127static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = {
1128 .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001129 .base = &virt_bases[GCC_BASE],
1130 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001131 .parent = &cxo_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001132 .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk",
1133 .ops = &clk_ops_branch,
1134 CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c),
1135 },
1136};
1137
1138static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = {
1139 .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001140 .has_sibling = 0,
1141 .base = &virt_bases[GCC_BASE],
1142 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001143 .parent = &blsp1_qup6_spi_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001144 .dbg_name = "gcc_blsp1_qup6_spi_apps_clk",
1145 .ops = &clk_ops_branch,
1146 CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c),
1147 },
1148};
1149
1150static struct branch_clk gcc_blsp1_uart1_apps_clk = {
1151 .cbcr_reg = BLSP1_UART1_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001152 .has_sibling = 0,
1153 .base = &virt_bases[GCC_BASE],
1154 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001155 .parent = &blsp1_uart1_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001156 .dbg_name = "gcc_blsp1_uart1_apps_clk",
1157 .ops = &clk_ops_branch,
1158 CLK_INIT(gcc_blsp1_uart1_apps_clk.c),
1159 },
1160};
1161
1162static struct branch_clk gcc_blsp1_uart2_apps_clk = {
1163 .cbcr_reg = BLSP1_UART2_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001164 .has_sibling = 0,
1165 .base = &virt_bases[GCC_BASE],
1166 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001167 .parent = &blsp1_uart2_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001168 .dbg_name = "gcc_blsp1_uart2_apps_clk",
1169 .ops = &clk_ops_branch,
1170 CLK_INIT(gcc_blsp1_uart2_apps_clk.c),
1171 },
1172};
1173
1174static struct branch_clk gcc_blsp1_uart3_apps_clk = {
1175 .cbcr_reg = BLSP1_UART3_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001176 .has_sibling = 0,
1177 .base = &virt_bases[GCC_BASE],
1178 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001179 .parent = &blsp1_uart3_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001180 .dbg_name = "gcc_blsp1_uart3_apps_clk",
1181 .ops = &clk_ops_branch,
1182 CLK_INIT(gcc_blsp1_uart3_apps_clk.c),
1183 },
1184};
1185
1186static struct branch_clk gcc_blsp1_uart4_apps_clk = {
1187 .cbcr_reg = BLSP1_UART4_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001188 .has_sibling = 0,
1189 .base = &virt_bases[GCC_BASE],
1190 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001191 .parent = &blsp1_uart4_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001192 .dbg_name = "gcc_blsp1_uart4_apps_clk",
1193 .ops = &clk_ops_branch,
1194 CLK_INIT(gcc_blsp1_uart4_apps_clk.c),
1195 },
1196};
1197
1198static struct branch_clk gcc_blsp1_uart5_apps_clk = {
1199 .cbcr_reg = BLSP1_UART5_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001200 .has_sibling = 0,
1201 .base = &virt_bases[GCC_BASE],
1202 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001203 .parent = &blsp1_uart5_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001204 .dbg_name = "gcc_blsp1_uart5_apps_clk",
1205 .ops = &clk_ops_branch,
1206 CLK_INIT(gcc_blsp1_uart5_apps_clk.c),
1207 },
1208};
1209
1210static struct branch_clk gcc_blsp1_uart6_apps_clk = {
1211 .cbcr_reg = BLSP1_UART6_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001212 .has_sibling = 0,
1213 .base = &virt_bases[GCC_BASE],
1214 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001215 .parent = &blsp1_uart6_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001216 .dbg_name = "gcc_blsp1_uart6_apps_clk",
1217 .ops = &clk_ops_branch,
1218 CLK_INIT(gcc_blsp1_uart6_apps_clk.c),
1219 },
1220};
1221
1222static struct local_vote_clk gcc_boot_rom_ahb_clk = {
1223 .cbcr_reg = BOOT_ROM_AHB_CBCR,
1224 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1225 .en_mask = BIT(10),
1226 .base = &virt_bases[GCC_BASE],
1227 .c = {
1228 .dbg_name = "gcc_boot_rom_ahb_clk",
1229 .ops = &clk_ops_vote,
1230 CLK_INIT(gcc_boot_rom_ahb_clk.c),
1231 },
1232};
1233
1234static struct local_vote_clk gcc_ce1_ahb_clk = {
1235 .cbcr_reg = CE1_AHB_CBCR,
1236 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1237 .en_mask = BIT(3),
1238 .base = &virt_bases[GCC_BASE],
1239 .c = {
1240 .dbg_name = "gcc_ce1_ahb_clk",
1241 .ops = &clk_ops_vote,
1242 CLK_INIT(gcc_ce1_ahb_clk.c),
1243 },
1244};
1245
1246static struct local_vote_clk gcc_ce1_axi_clk = {
1247 .cbcr_reg = CE1_AXI_CBCR,
1248 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1249 .en_mask = BIT(4),
1250 .base = &virt_bases[GCC_BASE],
1251 .c = {
1252 .dbg_name = "gcc_ce1_axi_clk",
1253 .ops = &clk_ops_vote,
1254 CLK_INIT(gcc_ce1_axi_clk.c),
1255 },
1256};
1257
1258static struct local_vote_clk gcc_ce1_clk = {
1259 .cbcr_reg = CE1_CBCR,
1260 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1261 .en_mask = BIT(5),
1262 .base = &virt_bases[GCC_BASE],
1263 .c = {
1264 .dbg_name = "gcc_ce1_clk",
1265 .ops = &clk_ops_vote,
1266 CLK_INIT(gcc_ce1_clk.c),
1267 },
1268};
1269
1270static struct branch_clk gcc_gp1_clk = {
1271 .cbcr_reg = GP1_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001272 .has_sibling = 0,
1273 .base = &virt_bases[GCC_BASE],
1274 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001275 .parent = &gp1_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001276 .dbg_name = "gcc_gp1_clk",
1277 .ops = &clk_ops_branch,
1278 CLK_INIT(gcc_gp1_clk.c),
1279 },
1280};
1281
1282static struct branch_clk gcc_gp2_clk = {
1283 .cbcr_reg = GP2_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001284 .has_sibling = 0,
1285 .base = &virt_bases[GCC_BASE],
1286 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001287 .parent = &gp2_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001288 .dbg_name = "gcc_gp2_clk",
1289 .ops = &clk_ops_branch,
1290 CLK_INIT(gcc_gp2_clk.c),
1291 },
1292};
1293
1294static struct branch_clk gcc_gp3_clk = {
1295 .cbcr_reg = GP3_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001296 .has_sibling = 0,
1297 .base = &virt_bases[GCC_BASE],
1298 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001299 .parent = &gp3_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001300 .dbg_name = "gcc_gp3_clk",
1301 .ops = &clk_ops_branch,
1302 CLK_INIT(gcc_gp3_clk.c),
1303 },
1304};
1305
1306static struct branch_clk gcc_ipa_clk = {
1307 .cbcr_reg = IPA_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001308 .has_sibling = 1,
1309 .base = &virt_bases[GCC_BASE],
1310 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001311 .parent = &ipa_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001312 .dbg_name = "gcc_ipa_clk",
1313 .ops = &clk_ops_branch,
1314 CLK_INIT(gcc_ipa_clk.c),
1315 },
1316};
1317
1318static struct branch_clk gcc_ipa_cnoc_clk = {
1319 .cbcr_reg = IPA_CNOC_CBCR,
1320 .has_sibling = 1,
1321 .base = &virt_bases[GCC_BASE],
1322 .c = {
1323 .dbg_name = "gcc_ipa_cnoc_clk",
1324 .ops = &clk_ops_branch,
1325 CLK_INIT(gcc_ipa_cnoc_clk.c),
1326 },
1327};
1328
Tianyi Gou0e10e792012-11-29 18:28:32 -08001329static struct branch_clk gcc_ipa_sleep_clk = {
1330 .cbcr_reg = IPA_SLEEP_CBCR,
1331 .has_sibling = 1,
1332 .base = &virt_bases[GCC_BASE],
1333 .c = {
1334 .dbg_name = "gcc_ipa_sleep_clk",
1335 .ops = &clk_ops_branch,
1336 CLK_INIT(gcc_ipa_sleep_clk.c),
1337 },
1338};
1339
Tianyi Gou389ba432012-10-01 13:58:38 -07001340static struct branch_clk gcc_pdm2_clk = {
1341 .cbcr_reg = PDM2_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001342 .has_sibling = 0,
1343 .base = &virt_bases[GCC_BASE],
1344 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001345 .parent = &pdm2_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001346 .dbg_name = "gcc_pdm2_clk",
1347 .ops = &clk_ops_branch,
1348 CLK_INIT(gcc_pdm2_clk.c),
1349 },
1350};
1351
1352static struct branch_clk gcc_pdm_ahb_clk = {
1353 .cbcr_reg = PDM_AHB_CBCR,
1354 .has_sibling = 1,
1355 .base = &virt_bases[GCC_BASE],
1356 .c = {
1357 .dbg_name = "gcc_pdm_ahb_clk",
1358 .ops = &clk_ops_branch,
1359 CLK_INIT(gcc_pdm_ahb_clk.c),
1360 },
1361};
1362
1363static struct local_vote_clk gcc_prng_ahb_clk = {
1364 .cbcr_reg = PRNG_AHB_CBCR,
1365 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1366 .en_mask = BIT(13),
1367 .base = &virt_bases[GCC_BASE],
1368 .c = {
1369 .dbg_name = "gcc_prng_ahb_clk",
1370 .ops = &clk_ops_vote,
1371 CLK_INIT(gcc_prng_ahb_clk.c),
1372 },
1373};
1374
Tianyi Gou389ba432012-10-01 13:58:38 -07001375static struct branch_clk gcc_sdcc2_ahb_clk = {
1376 .cbcr_reg = SDCC2_AHB_CBCR,
1377 .has_sibling = 1,
1378 .base = &virt_bases[GCC_BASE],
1379 .c = {
1380 .dbg_name = "gcc_sdcc2_ahb_clk",
1381 .ops = &clk_ops_branch,
1382 CLK_INIT(gcc_sdcc2_ahb_clk.c),
1383 },
1384};
1385
1386static struct branch_clk gcc_sdcc2_apps_clk = {
1387 .cbcr_reg = SDCC2_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001388 .has_sibling = 0,
1389 .base = &virt_bases[GCC_BASE],
1390 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001391 .parent = &sdcc2_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001392 .dbg_name = "gcc_sdcc2_apps_clk",
1393 .ops = &clk_ops_branch,
1394 CLK_INIT(gcc_sdcc2_apps_clk.c),
1395 },
1396};
1397
1398static struct branch_clk gcc_sdcc3_ahb_clk = {
1399 .cbcr_reg = SDCC3_AHB_CBCR,
1400 .has_sibling = 1,
1401 .base = &virt_bases[GCC_BASE],
1402 .c = {
1403 .dbg_name = "gcc_sdcc3_ahb_clk",
1404 .ops = &clk_ops_branch,
1405 CLK_INIT(gcc_sdcc3_ahb_clk.c),
1406 },
1407};
1408
1409static struct branch_clk gcc_sdcc3_apps_clk = {
1410 .cbcr_reg = SDCC3_APPS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001411 .has_sibling = 0,
1412 .base = &virt_bases[GCC_BASE],
1413 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001414 .parent = &sdcc3_apps_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001415 .dbg_name = "gcc_sdcc3_apps_clk",
1416 .ops = &clk_ops_branch,
1417 CLK_INIT(gcc_sdcc3_apps_clk.c),
1418 },
1419};
1420
1421static struct branch_clk gcc_sys_noc_ipa_axi_clk = {
1422 .cbcr_reg = SYS_NOC_IPA_AXI_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001423 .has_sibling = 1,
1424 .base = &virt_bases[GCC_BASE],
1425 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001426 .parent = &ipa_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001427 .dbg_name = "gcc_sys_noc_ipa_axi_clk",
1428 .ops = &clk_ops_branch,
1429 CLK_INIT(gcc_sys_noc_ipa_axi_clk.c),
1430 },
1431};
1432
1433static struct branch_clk gcc_usb_hs_ahb_clk = {
1434 .cbcr_reg = USB_HS_AHB_CBCR,
1435 .has_sibling = 1,
1436 .base = &virt_bases[GCC_BASE],
1437 .c = {
1438 .dbg_name = "gcc_usb_hs_ahb_clk",
1439 .ops = &clk_ops_branch,
1440 CLK_INIT(gcc_usb_hs_ahb_clk.c),
1441 },
1442};
1443
1444static struct branch_clk gcc_usb_hs_system_clk = {
1445 .cbcr_reg = USB_HS_SYSTEM_CBCR,
1446 .bcr_reg = USB_HS_BCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001447 .has_sibling = 0,
1448 .base = &virt_bases[GCC_BASE],
1449 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001450 .parent = &usb_hs_system_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001451 .dbg_name = "gcc_usb_hs_system_clk",
1452 .ops = &clk_ops_branch,
1453 CLK_INIT(gcc_usb_hs_system_clk.c),
1454 },
1455};
1456
1457static struct branch_clk gcc_usb_hsic_ahb_clk = {
1458 .cbcr_reg = USB_HSIC_AHB_CBCR,
1459 .has_sibling = 1,
1460 .base = &virt_bases[GCC_BASE],
1461 .c = {
1462 .dbg_name = "gcc_usb_hsic_ahb_clk",
1463 .ops = &clk_ops_branch,
1464 CLK_INIT(gcc_usb_hsic_ahb_clk.c),
1465 },
1466};
1467
1468static struct branch_clk gcc_usb_hsic_clk = {
1469 .cbcr_reg = USB_HSIC_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001470 .has_sibling = 0,
1471 .base = &virt_bases[GCC_BASE],
1472 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001473 .parent = &usb_hsic_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001474 .dbg_name = "gcc_usb_hsic_clk",
1475 .ops = &clk_ops_branch,
1476 CLK_INIT(gcc_usb_hsic_clk.c),
1477 },
1478};
1479
1480static struct branch_clk gcc_usb_hsic_io_cal_clk = {
1481 .cbcr_reg = USB_HSIC_IO_CAL_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001482 .has_sibling = 0,
1483 .base = &virt_bases[GCC_BASE],
1484 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001485 .parent = &usb_hsic_io_cal_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001486 .dbg_name = "gcc_usb_hsic_io_cal_clk",
1487 .ops = &clk_ops_branch,
1488 CLK_INIT(gcc_usb_hsic_io_cal_clk.c),
1489 },
1490};
1491
Tianyi Gou55b805b2013-02-28 21:46:03 -08001492static struct branch_clk gcc_usb_hsic_io_cal_sleep_clk = {
1493 .cbcr_reg = USB_HSIC_IO_CAL_SLEEP_CBCR,
1494 .has_sibling = 1,
1495 .base = &virt_bases[GCC_BASE],
1496 .c = {
1497 .dbg_name = "gcc_usb_hsic_io_cal_sleep_clk",
1498 .ops = &clk_ops_branch,
1499 CLK_INIT(gcc_usb_hsic_io_cal_sleep_clk.c),
1500 },
1501};
1502
Tianyi Gou389ba432012-10-01 13:58:38 -07001503static struct branch_clk gcc_usb_hsic_system_clk = {
1504 .cbcr_reg = USB_HSIC_SYSTEM_CBCR,
1505 .bcr_reg = USB_HS_HSIC_BCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001506 .has_sibling = 0,
1507 .base = &virt_bases[GCC_BASE],
1508 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001509 .parent = &usb_hsic_system_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001510 .dbg_name = "gcc_usb_hsic_system_clk",
1511 .ops = &clk_ops_branch,
1512 CLK_INIT(gcc_usb_hsic_system_clk.c),
1513 },
1514};
1515
1516static struct branch_clk gcc_usb_hsic_xcvr_fs_clk = {
1517 .cbcr_reg = USB_HSIC_XCVR_FS_CBCR,
Tianyi Gou389ba432012-10-01 13:58:38 -07001518 .has_sibling = 0,
1519 .base = &virt_bases[GCC_BASE],
1520 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001521 .parent = &usb_hsic_xcvr_fs_clk_src.c,
Tianyi Gou389ba432012-10-01 13:58:38 -07001522 .dbg_name = "gcc_usb_hsic_xcvr_fs_clk",
1523 .ops = &clk_ops_branch,
1524 CLK_INIT(gcc_usb_hsic_xcvr_fs_clk.c),
1525 },
1526};
1527
Tianyi Gou389ba432012-10-01 13:58:38 -07001528static DEFINE_CLK_MEASURE(a5_m_clk);
1529
1530#ifdef CONFIG_DEBUG_FS
1531
1532struct measure_mux_entry {
1533 struct clk *c;
1534 int base;
1535 u32 debug_mux;
1536};
1537
Tianyi Gouabcddb72013-02-23 18:10:11 -08001538struct measure_mux_entry measure_mux_common[] __initdata = {
Tianyi Goub067da02013-03-25 11:50:49 -07001539 {&snoc_clk.c, GCC_BASE, 0x0000},
1540 {&cnoc_clk.c, GCC_BASE, 0x0008},
1541 {&pnoc_clk.c, GCC_BASE, 0x0010},
1542 {&bimc_clk.c, GCC_BASE, 0x0155},
Tianyi Gou389ba432012-10-01 13:58:38 -07001543 {&gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0},
Tianyi Gou55b805b2013-02-28 21:46:03 -08001544 {&gcc_usb_hsic_io_cal_sleep_clk.c, GCC_BASE, 0x005c},
Tianyi Gou389ba432012-10-01 13:58:38 -07001545 {&gcc_usb_hsic_xcvr_fs_clk.c, GCC_BASE, 0x005d},
1546 {&gcc_usb_hsic_system_clk.c, GCC_BASE, 0x0059},
1547 {&gcc_usb_hsic_io_cal_clk.c, GCC_BASE, 0x005b},
1548 {&gcc_sdcc3_ahb_clk.c, GCC_BASE, 0x0079},
1549 {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d},
1550 {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a},
1551 {&gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091},
1552 {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098},
1553 {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093},
1554 {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2},
1555 {&gcc_bam_dma_ahb_clk.c, GCC_BASE, 0x00e0},
1556 {&gcc_sdcc3_apps_clk.c, GCC_BASE, 0x0078},
1557 {&gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060},
1558 {&gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088},
1559 {&gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a},
1560 {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e},
1561 {&gcc_usb_hsic_ahb_clk.c, GCC_BASE, 0x0058},
1562 {&gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095},
1563 {&gcc_ce1_axi_clk.c, GCC_BASE, 0x0139},
1564 {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c},
1565 {&gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061},
1566 {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1},
1567 {&gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8},
1568 {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094},
1569 {&gcc_usb_hsic_clk.c, GCC_BASE, 0x005a},
1570 {&gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3},
1571 {&gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070},
1572 {&gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c},
1573 {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099},
Tianyi Gou55b805b2013-02-28 21:46:03 -08001574 {&gcc_bam_dma_inactivity_timers_clk.c, GCC_BASE, 0x00E1},
Tianyi Gou389ba432012-10-01 13:58:38 -07001575 {&gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8},
1576 {&gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a},
1577 {&gcc_pdm2_clk.c, GCC_BASE, 0x00d2},
1578 {&gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e},
1579 {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090},
1580 {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b},
1581 {&gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071},
1582 {&gcc_ce1_clk.c, GCC_BASE, 0x0138},
1583 {&gcc_sys_noc_ipa_axi_clk.c, GCC_BASE, 0x0007},
1584
Tianyi Gou389ba432012-10-01 13:58:38 -07001585 {&a5_m_clk, APCS_BASE, 0x3},
1586
1587 {&dummy_clk, N_BASES, 0x0000},
1588};
1589
Tianyi Gouabcddb72013-02-23 18:10:11 -08001590struct measure_mux_entry measure_mux_v2_only[] __initdata = {
1591 {&gcc_ipa_clk.c, GCC_BASE, 0x01E0},
1592 {&gcc_ipa_cnoc_clk.c, GCC_BASE, 0x01E1},
1593 {&gcc_ipa_sleep_clk.c, GCC_BASE, 0x01E2},
Tianyi Gouc2a71bc2013-04-24 18:24:06 -07001594 {&qpic_clk.c, GCC_BASE, 0x01D8},
Tianyi Gouabcddb72013-02-23 18:10:11 -08001595};
1596
1597struct measure_mux_entry measure_mux[ARRAY_SIZE(measure_mux_common)
1598 + ARRAY_SIZE(measure_mux_v2_only)];
1599
Tianyi Gou389ba432012-10-01 13:58:38 -07001600static int measure_clk_set_parent(struct clk *c, struct clk *parent)
1601{
1602 struct measure_clk *clk = to_measure_clk(c);
1603 unsigned long flags;
1604 u32 regval, clk_sel, i;
1605
1606 if (!parent)
1607 return -EINVAL;
1608
1609 for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++)
1610 if (measure_mux[i].c == parent)
1611 break;
1612
1613 if (measure_mux[i].c == &dummy_clk)
1614 return -EINVAL;
1615
1616 spin_lock_irqsave(&local_clock_reg_lock, flags);
1617 /*
1618 * Program the test vector, measurement period (sample_ticks)
1619 * and scaling multiplier.
1620 */
1621 clk->sample_ticks = 0x10000;
1622 clk->multiplier = 1;
1623
Tianyi Gou389ba432012-10-01 13:58:38 -07001624 writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL_REG));
1625
1626 switch (measure_mux[i].base) {
1627
1628 case GCC_BASE:
1629 clk_sel = measure_mux[i].debug_mux;
1630 break;
1631
Tianyi Gou389ba432012-10-01 13:58:38 -07001632 case APCS_BASE:
1633 clk_sel = 0x16A;
1634 regval = BVAL(5, 3, measure_mux[i].debug_mux);
1635 writel_relaxed(regval, APCS_REG_BASE(APCS_CLK_DIAG_REG));
1636
1637 /* Activate debug clock output */
1638 regval |= BIT(7);
1639 writel_relaxed(regval, APCS_REG_BASE(APCS_CLK_DIAG_REG));
1640 break;
1641
1642 default:
1643 return -EINVAL;
1644 }
1645
1646 /* Set debug mux clock index */
1647 regval = BVAL(8, 0, clk_sel);
1648 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL_REG));
1649
1650 /* Activate debug clock output */
1651 regval |= BIT(16);
1652 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL_REG));
1653
1654 /* Make sure test vector is set before starting measurements. */
1655 mb();
1656 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
1657
1658 return 0;
1659}
1660
1661/* Sample clock for 'ticks' reference clock ticks. */
1662static u32 run_measurement(unsigned ticks)
1663{
1664 /* Stop counters and set the XO4 counter start value. */
1665 writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL_REG));
1666
1667 /* Wait for timer to become ready. */
1668 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS_REG)) &
1669 BIT(25)) != 0)
1670 cpu_relax();
1671
1672 /* Run measurement and wait for completion. */
1673 writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL_REG));
1674 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS_REG)) &
1675 BIT(25)) == 0)
1676 cpu_relax();
1677
1678 /* Return measured ticks. */
1679 return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS_REG)) &
1680 BM(24, 0);
1681}
1682
1683/*
1684 * Perform a hardware rate measurement for a given clock.
1685 * FOR DEBUG USE ONLY: Measurements take ~15 ms!
1686 */
1687static unsigned long measure_clk_get_rate(struct clk *c)
1688{
1689 unsigned long flags;
1690 u32 gcc_xo4_reg_backup;
1691 u64 raw_count_short, raw_count_full;
1692 struct measure_clk *clk = to_measure_clk(c);
1693 unsigned ret;
1694
1695 ret = clk_prepare_enable(&cxo_clk_src.c);
1696 if (ret) {
1697 pr_warning("CXO clock failed to enable. Can't measure\n");
1698 return 0;
1699 }
1700
1701 spin_lock_irqsave(&local_clock_reg_lock, flags);
1702
1703 /* Enable CXO/4 and RINGOSC branch. */
1704 gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR_REG));
1705 writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR_REG));
1706
1707 /*
1708 * The ring oscillator counter will not reset if the measured clock
1709 * is not running. To detect this, run a short measurement before
1710 * the full measurement. If the raw results of the two are the same
1711 * then the clock must be off.
1712 */
1713
1714 /* Run a short measurement. (~1 ms) */
1715 raw_count_short = run_measurement(0x1000);
1716 /* Run a full measurement. (~14 ms) */
1717 raw_count_full = run_measurement(clk->sample_ticks);
1718
1719 writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR_REG));
1720
1721 /* Return 0 if the clock is off. */
1722 if (raw_count_full == raw_count_short) {
1723 ret = 0;
1724 } else {
1725 /* Compute rate in Hz. */
1726 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
1727 do_div(raw_count_full, ((clk->sample_ticks * 10) + 35));
1728 ret = (raw_count_full * clk->multiplier);
1729 }
1730
1731 writel_relaxed(0x51A00, GCC_REG_BASE(GCC_PLLTEST_PAD_CFG_REG));
1732 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
1733
1734 clk_disable_unprepare(&cxo_clk_src.c);
1735
1736 return ret;
1737}
1738#else /* !CONFIG_DEBUG_FS */
1739static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
1740{
1741 return -EINVAL;
1742}
1743
1744static unsigned long measure_clk_get_rate(struct clk *clk)
1745{
1746 return 0;
1747}
1748#endif /* CONFIG_DEBUG_FS */
1749
1750static struct clk_ops clk_ops_measure = {
1751 .set_parent = measure_clk_set_parent,
1752 .get_rate = measure_clk_get_rate,
1753};
1754
1755static struct measure_clk measure_clk = {
1756 .c = {
1757 .dbg_name = "measure_clk",
1758 .ops = &clk_ops_measure,
1759 CLK_INIT(measure_clk.c),
1760 },
1761 .multiplier = 1,
1762};
1763
1764static struct clk_lookup msm_clocks_9625[] = {
1765 CLK_LOOKUP("xo", cxo_clk_src.c, ""),
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07001766 CLK_LOOKUP("xo", cxo_lpm_clk.c, "fc4281d0.qcom,mpm"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001767 CLK_LOOKUP("measure", measure_clk.c, "debug"),
1768
Tianyi Gou27df1bb2012-10-11 14:44:01 -07001769 CLK_LOOKUP("pll0", gpll0_activeonly_clk_src.c, "f9010008.qcom,acpuclk"),
1770 CLK_LOOKUP("pll14", apcspll_clk_src.c, "f9010008.qcom,acpuclk"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001771
1772 CLK_LOOKUP("dma_bam_pclk", gcc_bam_dma_ahb_clk.c, "msm_sps"),
Tianyi Gou55b805b2013-02-28 21:46:03 -08001773 CLK_LOOKUP("inactivity_clk", gcc_bam_dma_inactivity_timers_clk.c,
1774 "msm_sps"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001775 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "msm_serial_hsl.0"),
Gilad Avidov09c78ec2012-10-18 09:34:35 -06001776 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9924000.spi"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001777 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"),
Saket Saurabhd72ee922013-01-22 16:56:52 +05301778 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991d000.uart"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001779 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, ""),
Gilad Avidov09c78ec2012-10-18 09:34:35 -06001780 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""),
Tianyi Gou389ba432012-10-01 13:58:38 -07001781 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, ""),
Gilad Avidov09c78ec2012-10-18 09:34:35 -06001782 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, "f9924000.spi"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001783 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"),
1784 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""),
1785 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""),
1786 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""),
1787 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, ""),
1788 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""),
1789 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, ""),
1790 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""),
Saket Saurabhd72ee922013-01-22 16:56:52 +05301791 CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, "f991d000.uart"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001792 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""),
1793 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "msm_serial_hsl.0"),
1794 CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""),
1795 CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""),
1796 CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""),
1797
1798 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""),
1799 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""),
1800 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""),
1801 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, ""),
1802
1803 CLK_LOOKUP("core_clk", gcc_gp1_clk.c, ""),
1804 CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""),
1805 CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""),
1806
Hariprasad Dhalinarasimha9abfe782012-11-07 19:40:14 -08001807 CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001808 CLK_LOOKUP("core_src_clk", ipa_clk_src.c, "fd4c0000.qcom,ipa"),
1809 CLK_LOOKUP("core_clk", gcc_ipa_clk.c, "fd4c0000.qcom,ipa"),
1810 CLK_LOOKUP("bus_clk", gcc_sys_noc_ipa_axi_clk.c, "fd4c0000.qcom,ipa"),
1811 CLK_LOOKUP("iface_clk", gcc_ipa_cnoc_clk.c, "fd4c0000.qcom,ipa"),
Tianyi Gou0e10e792012-11-29 18:28:32 -08001812 CLK_LOOKUP("inactivity_clk", gcc_ipa_sleep_clk.c, "fd4c0000.qcom,ipa"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001813
1814 CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""),
1815 CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""),
1816
Oluwafemi Adeyemi61df1182012-10-12 18:51:11 -07001817 CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"),
1818 CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"),
1819 CLK_LOOKUP("bus_clk", pnoc_sdcc2_clk.c, "msm_sdcc.2"),
1820 CLK_LOOKUP("iface_clk", gcc_sdcc3_ahb_clk.c, "msm_sdcc.3"),
1821 CLK_LOOKUP("core_clk", gcc_sdcc3_apps_clk.c, "msm_sdcc.3"),
1822 CLK_LOOKUP("bus_clk", pnoc_sdcc3_clk.c, "msm_sdcc.3"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001823
1824 CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"),
1825 CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"),
Ido Shayevitzd2b722b2013-01-09 13:08:54 +02001826 CLK_LOOKUP("iface_clk", gcc_usb_hsic_ahb_clk.c, "msm_hsic_host"),
1827 CLK_LOOKUP("phy_clk", gcc_usb_hsic_clk.c, "msm_hsic_host"),
1828 CLK_LOOKUP("cal_clk", gcc_usb_hsic_io_cal_clk.c, "msm_hsic_host"),
1829 CLK_LOOKUP("core_clk", gcc_usb_hsic_system_clk.c, "msm_hsic_host"),
Ofir Cohenb512a5f2012-12-13 09:46:34 +02001830 CLK_LOOKUP("alt_core_clk", gcc_usb_hsic_xcvr_fs_clk.c, ""),
Tianyi Gou55b805b2013-02-28 21:46:03 -08001831 CLK_LOOKUP("inactivity_clk", gcc_usb_hsic_io_cal_sleep_clk.c,
1832 "msm_hsic_host"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001833
Hariprasad Dhalinarasimha96252de2012-11-21 17:52:36 -08001834 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcedev"),
1835 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcedev"),
1836 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcedev"),
1837 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcedev"),
1838
1839 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcrypto"),
1840 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcrypto"),
1841 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcrypto"),
1842 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcrypto"),
1843
Tianyi Gou389ba432012-10-01 13:58:38 -07001844 /* RPM and voter clocks */
1845 CLK_LOOKUP("bus_clk", snoc_clk.c, ""),
1846 CLK_LOOKUP("bus_clk", pnoc_clk.c, ""),
1847 CLK_LOOKUP("bus_clk", cnoc_clk.c, ""),
1848 CLK_LOOKUP("mem_clk", bimc_clk.c, ""),
1849 CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""),
1850 CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""),
1851 CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""),
1852 CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""),
Tianyi Gouc2a71bc2013-04-24 18:24:06 -07001853 CLK_LOOKUP("core_clk", qpic_clk.c, ""),
1854 CLK_LOOKUP("core_clk", qpic_a_clk.c, ""),
Tianyi Gou389ba432012-10-01 13:58:38 -07001855
1856 CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"),
1857 CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"),
1858 CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"),
1859 CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"),
1860 CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"),
1861 CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"),
1862 CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"),
1863 CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"),
1864
1865 CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"),
1866
1867 CLK_LOOKUP("a5_m_clk", a5_m_clk, ""),
Pushkar Joshi4e483042012-10-29 18:10:08 -07001868
Pratik Patel2d15d562013-02-07 19:10:35 -08001869 /* CoreSight clocks */
Pushkar Joshi4e483042012-10-29 18:10:08 -07001870 CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.tmc"),
1871 CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.tpiu"),
1872 CLK_LOOKUP("core_clk", qdss_clk.c, "fc31c000.replicator"),
1873 CLK_LOOKUP("core_clk", qdss_clk.c, "fc307000.tmc"),
1874 CLK_LOOKUP("core_clk", qdss_clk.c, "fc31b000.funnel"),
1875 CLK_LOOKUP("core_clk", qdss_clk.c, "fc319000.funnel"),
1876 CLK_LOOKUP("core_clk", qdss_clk.c, "fc31a000.funnel"),
1877 CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.stm"),
Pushkar Joshi2a51a122012-12-06 10:49:07 -08001878 CLK_LOOKUP("core_clk", qdss_clk.c, "fc332000.etm"),
Pushkar Joshie0e8a7e2012-12-15 18:27:04 -08001879 CLK_LOOKUP("core_clk", qdss_clk.c, "fc332000.jtagmm"),
Pratik Patel9332c382013-02-08 11:54:28 -08001880 CLK_LOOKUP("core_clk", qdss_clk.c, "fc308000.cti"),
1881 CLK_LOOKUP("core_clk", qdss_clk.c, "fc309000.cti"),
1882 CLK_LOOKUP("core_clk", qdss_clk.c, "fc30a000.cti"),
1883 CLK_LOOKUP("core_clk", qdss_clk.c, "fc30b000.cti"),
1884 CLK_LOOKUP("core_clk", qdss_clk.c, "fc30c000.cti"),
1885 CLK_LOOKUP("core_clk", qdss_clk.c, "fc30d000.cti"),
1886 CLK_LOOKUP("core_clk", qdss_clk.c, "fc30e000.cti"),
1887 CLK_LOOKUP("core_clk", qdss_clk.c, "fc30f000.cti"),
1888 CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"),
1889 CLK_LOOKUP("core_clk", qdss_clk.c, "fc333000.cti"),
Pratik Patel27423052013-10-04 16:09:59 -07001890 CLK_LOOKUP("core_clk", qdss_clk.c, "fc350000.cti"),
1891 CLK_LOOKUP("core_clk", qdss_clk.c, "fc354000.cti"),
1892 CLK_LOOKUP("core_clk", qdss_clk.c, "fc358000.cti"),
Aparna Das6527ed22013-04-02 16:20:24 -07001893 CLK_LOOKUP("core_clk", qdss_clk.c, "f9011038.hwevent"),
Pushkar Joshi4e483042012-10-29 18:10:08 -07001894
Pratik Patel2d15d562013-02-07 19:10:35 -08001895 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.tmc"),
1896 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.tpiu"),
1897 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc31c000.replicator"),
1898 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc307000.tmc"),
1899 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc31b000.funnel"),
1900 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc319000.funnel"),
1901 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc31a000.funnel"),
1902 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.stm"),
1903 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc332000.etm"),
1904 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc332000.jtagmm"),
Pratik Patel9332c382013-02-08 11:54:28 -08001905 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc308000.cti"),
1906 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc309000.cti"),
1907 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30a000.cti"),
1908 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30b000.cti"),
1909 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30c000.cti"),
1910 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30d000.cti"),
1911 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30e000.cti"),
1912 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30f000.cti"),
1913 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"),
1914 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc333000.cti"),
Pratik Patel27423052013-10-04 16:09:59 -07001915 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc350000.cti"),
1916 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc354000.cti"),
1917 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc358000.cti"),
Aparna Das6527ed22013-04-02 16:20:24 -07001918 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "f9011038.hwevent"),
Tianyi Gou389ba432012-10-01 13:58:38 -07001919};
1920
Tianyi Gou389ba432012-10-01 13:58:38 -07001921#define PLL_AUX_OUTPUT_BIT 1
1922#define PLL_AUX2_OUTPUT_BIT 2
1923
1924/*
1925 * TODO: Need to remove this function when the v2 hardware
1926 * fix the broken lock status bit.
1927 */
1928#define PLL_OUTCTRL BIT(0)
1929#define PLL_BYPASSNL BIT(1)
1930#define PLL_RESET_N BIT(2)
1931
1932static DEFINE_SPINLOCK(sr_pll_reg_lock);
1933
1934static int sr_pll_clk_enable_9625(struct clk *c)
1935{
1936 unsigned long flags;
1937 struct pll_clk *pll = to_pll_clk(c);
1938 u32 mode;
1939 void __iomem *mode_reg = *pll->base + (u32)pll->mode_reg;
1940
1941 spin_lock_irqsave(&sr_pll_reg_lock, flags);
1942
1943 /* Disable PLL bypass mode and de-assert reset. */
1944 mode = readl_relaxed(mode_reg);
1945 mode |= PLL_BYPASSNL | PLL_RESET_N;
1946 writel_relaxed(mode, mode_reg);
1947
1948 /* Wait for pll to lock. */
1949 udelay(100);
1950
1951 /* Enable PLL output. */
1952 mode |= PLL_OUTCTRL;
1953 writel_relaxed(mode, mode_reg);
1954
1955 /* Ensure the write above goes through before returning. */
1956 mb();
1957
1958 spin_unlock_irqrestore(&sr_pll_reg_lock, flags);
1959 return 0;
1960}
1961
Tianyi Gou389ba432012-10-01 13:58:38 -07001962static void __init reg_init(void)
1963{
Tianyi Gou781ff672013-02-21 15:29:40 -08001964 u32 regval;
Tianyi Gou389ba432012-10-01 13:58:38 -07001965
Tianyi Gou389ba432012-10-01 13:58:38 -07001966 /* Vote for GPLL0 to turn on. Needed by acpuclock. */
1967 regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE_REG));
1968 regval |= BIT(0);
1969 writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE_REG));
Tianyi Gou389ba432012-10-01 13:58:38 -07001970}
1971
1972static void __init msm9625_clock_post_init(void)
1973{
1974 /*
1975 * Hold an active set vote for CXO; this is because CXO is expected
1976 * to remain on whenever CPUs aren't power collapsed.
1977 */
1978 clk_prepare_enable(&cxo_a_clk_src.c);
1979
Tianyi Gou389ba432012-10-01 13:58:38 -07001980 /* Set rates for single-rate clocks. */
1981 clk_set_rate(&usb_hs_system_clk_src.c,
1982 usb_hs_system_clk_src.freq_tbl[0].freq_hz);
1983 clk_set_rate(&usb_hsic_clk_src.c,
1984 usb_hsic_clk_src.freq_tbl[0].freq_hz);
1985 clk_set_rate(&usb_hsic_io_cal_clk_src.c,
1986 usb_hsic_io_cal_clk_src.freq_tbl[0].freq_hz);
1987 clk_set_rate(&usb_hsic_system_clk_src.c,
1988 usb_hsic_system_clk_src.freq_tbl[0].freq_hz);
1989 clk_set_rate(&usb_hsic_xcvr_fs_clk_src.c,
1990 usb_hsic_xcvr_fs_clk_src.freq_tbl[0].freq_hz);
1991 clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz);
Tianyi Goub1d13972013-01-23 22:55:22 -08001992 /*
1993 * TODO: set rate on behalf of the i2c driver until the i2c driver
1994 * distinguish v1/v2 and call set rate accordingly.
1995 */
1996 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2)
1997 clk_set_rate(&blsp1_qup3_i2c_apps_clk_src.c,
1998 blsp1_qup3_i2c_apps_clk_src.freq_tbl[0].freq_hz);
Tianyi Gou389ba432012-10-01 13:58:38 -07001999}
2000
2001#define GCC_CC_PHYS 0xFC400000
2002#define GCC_CC_SIZE SZ_16K
2003
Tianyi Gou389ba432012-10-01 13:58:38 -07002004#define APCS_GCC_CC_PHYS 0xF9011000
2005#define APCS_GCC_CC_SIZE SZ_4K
2006
2007#define APCS_PLL_PHYS 0xF9008018
2008#define APCS_PLL_SIZE 0x18
2009
Tianyi Goub1d13972013-01-23 22:55:22 -08002010static struct clk *i2c_apps_clks[][2] __initdata = {
2011 {&gcc_blsp1_qup1_i2c_apps_clk.c, &blsp1_qup1_i2c_apps_clk_src.c},
2012 {&gcc_blsp1_qup2_i2c_apps_clk.c, &blsp1_qup2_i2c_apps_clk_src.c},
2013 {&gcc_blsp1_qup3_i2c_apps_clk.c, &blsp1_qup3_i2c_apps_clk_src.c},
2014 {&gcc_blsp1_qup4_i2c_apps_clk.c, &blsp1_qup4_i2c_apps_clk_src.c},
2015 {&gcc_blsp1_qup5_i2c_apps_clk.c, &blsp1_qup5_i2c_apps_clk_src.c},
2016 {&gcc_blsp1_qup6_i2c_apps_clk.c, &blsp1_qup6_i2c_apps_clk_src.c},
2017};
2018
Tianyi Gou389ba432012-10-01 13:58:38 -07002019static void __init msm9625_clock_pre_init(void)
2020{
2021 virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE);
2022 if (!virt_bases[GCC_BASE])
2023 panic("clock-9625: Unable to ioremap GCC memory!");
2024
Tianyi Gou389ba432012-10-01 13:58:38 -07002025 virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE);
2026 if (!virt_bases[APCS_BASE])
2027 panic("clock-9625: Unable to ioremap APCS_GCC_CC memory!");
2028
2029 virt_bases[APCS_PLL_BASE] = ioremap(APCS_PLL_PHYS, APCS_PLL_SIZE);
2030 if (!virt_bases[APCS_PLL_BASE])
2031 panic("clock-9625: Unable to ioremap APCS_PLL memory!");
2032
Tianyi Goub1d13972013-01-23 22:55:22 -08002033 /* The parent of each of the QUP I2C APPS clocks is an RCG on v2 */
2034 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) {
2035 int i, num_cores = ARRAY_SIZE(i2c_apps_clks);
2036 for (i = 0; i < num_cores; i++)
2037 i2c_apps_clks[i][0]->parent = i2c_apps_clks[i][1];
2038 }
2039
Tianyi Gou389ba432012-10-01 13:58:38 -07002040 clk_ops_local_pll.enable = sr_pll_clk_enable_9625;
2041
Patrick Dalyebc26bc2013-02-05 11:49:07 -08002042 vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig");
2043 if (IS_ERR(vdd_dig.regulator[0]))
Tianyi Gou389ba432012-10-01 13:58:38 -07002044 panic("clock-9625: Unable to get the vdd_dig regulator!");
2045
Tianyi Gou389ba432012-10-01 13:58:38 -07002046 enable_rpm_scaling();
2047
2048 reg_init();
Tianyi Gouabcddb72013-02-23 18:10:11 -08002049
2050 /* Construct measurement mux array */
2051 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) {
2052 memcpy(measure_mux,
2053 measure_mux_v2_only, sizeof(measure_mux_v2_only));
2054 memcpy(measure_mux + ARRAY_SIZE(measure_mux_v2_only),
2055 measure_mux_common, sizeof(measure_mux_common));
2056 } else
2057 memcpy(measure_mux,
2058 measure_mux_common, sizeof(measure_mux_common));
Tianyi Gou389ba432012-10-01 13:58:38 -07002059}
2060
Tianyi Gou389ba432012-10-01 13:58:38 -07002061struct clock_init_data msm9625_clock_init_data __initdata = {
2062 .table = msm_clocks_9625,
2063 .size = ARRAY_SIZE(msm_clocks_9625),
2064 .pre_init = msm9625_clock_pre_init,
2065 .post_init = msm9625_clock_post_init,
Tianyi Gou389ba432012-10-01 13:58:38 -07002066};