blob: 482981c8cfddc86cdb7633c61f201c4073035b26 [file] [log] [blame]
Evgeniy Borisovd9ca9932013-11-05 18:24:19 +02001/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
Vikram Mulukutlab13abe42012-10-03 11:38:48 -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/iopoll.h>
Vikram Mulukutlaf7c52d32013-01-31 11:39:58 -080022#include <linux/regulator/consumer.h>
Vikram Mulukutlab13abe42012-10-03 11:38:48 -070023
24#include <mach/rpm-regulator-smd.h>
25#include <mach/socinfo.h>
26#include <mach/rpm-smd.h>
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -070027#include <mach/clock-generic.h>
Vikram Mulukutlab13abe42012-10-03 11:38:48 -070028
29#include "clock-local2.h"
30#include "clock-pll.h"
31#include "clock-rpm.h"
32#include "clock-voter.h"
33#include "clock.h"
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -070034#include "clock-dsi-8610.h"
Vikram Mulukutlab13abe42012-10-03 11:38:48 -070035
36enum {
37 GCC_BASE,
38 MMSS_BASE,
39 LPASS_BASE,
40 APCS_BASE,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -080041 APCS_PLL_BASE,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -070042 N_BASES,
43};
44
45static void __iomem *virt_bases[N_BASES];
46
47#define GCC_REG_BASE(x) (void __iomem *)(virt_bases[GCC_BASE] + (x))
48#define MMSS_REG_BASE(x) (void __iomem *)(virt_bases[MMSS_BASE] + (x))
49#define LPASS_REG_BASE(x) (void __iomem *)(virt_bases[LPASS_BASE] + (x))
50#define APCS_REG_BASE(x) (void __iomem *)(virt_bases[APCS_BASE] + (x))
51
52#define GPLL0_MODE 0x0000
53#define GPLL0_L_VAL 0x0004
54#define GPLL0_M_VAL 0x0008
55#define GPLL0_N_VAL 0x000C
56#define GPLL0_USER_CTL 0x0010
57#define GPLL0_STATUS 0x001C
58#define GPLL2_MODE 0x0080
59#define GPLL2_L_VAL 0x0084
60#define GPLL2_M_VAL 0x0088
61#define GPLL2_N_VAL 0x008C
62#define GPLL2_USER_CTL 0x0090
63#define GPLL2_STATUS 0x009C
64#define CONFIG_NOC_BCR 0x0140
65#define MMSS_BCR 0x0240
66#define MMSS_NOC_CFG_AHB_CBCR 0x024C
67#define MSS_CFG_AHB_CBCR 0x0280
68#define MSS_Q6_BIMC_AXI_CBCR 0x0284
69#define USB_HS_BCR 0x0480
70#define USB_HS_SYSTEM_CBCR 0x0484
71#define USB_HS_AHB_CBCR 0x0488
72#define USB_HS_SYSTEM_CMD_RCGR 0x0490
73#define USB2A_PHY_BCR 0x04A8
74#define USB2A_PHY_SLEEP_CBCR 0x04AC
75#define SDCC1_BCR 0x04C0
76#define SDCC1_APPS_CMD_RCGR 0x04D0
77#define SDCC1_APPS_CBCR 0x04C4
78#define SDCC1_AHB_CBCR 0x04C8
79#define SDCC2_BCR 0x0500
80#define SDCC2_APPS_CMD_RCGR 0x0510
81#define SDCC2_APPS_CBCR 0x0504
82#define SDCC2_AHB_CBCR 0x0508
83#define BLSP1_BCR 0x05C0
84#define BLSP1_AHB_CBCR 0x05C4
85#define BLSP1_QUP1_BCR 0x0640
86#define BLSP1_QUP1_SPI_APPS_CBCR 0x0644
87#define BLSP1_QUP1_I2C_APPS_CBCR 0x0648
88#define BLSP1_QUP1_SPI_APPS_CMD_RCGR 0x064C
89#define BLSP1_UART1_BCR 0x0680
90#define BLSP1_UART1_APPS_CBCR 0x0684
91#define BLSP1_UART1_SIM_CBCR 0x0688
92#define BLSP1_UART1_APPS_CMD_RCGR 0x068C
93#define BLSP1_QUP2_BCR 0x06C0
94#define BLSP1_QUP2_SPI_APPS_CBCR 0x06C4
95#define BLSP1_QUP2_I2C_APPS_CBCR 0x06C8
96#define BLSP1_QUP2_SPI_APPS_CMD_RCGR 0x06CC
97#define BLSP1_UART2_BCR 0x0700
98#define BLSP1_UART2_APPS_CBCR 0x0704
99#define BLSP1_UART2_SIM_CBCR 0x0708
100#define BLSP1_UART2_APPS_CMD_RCGR 0x070C
101#define BLSP1_QUP3_BCR 0x0740
102#define BLSP1_QUP3_SPI_APPS_CBCR 0x0744
103#define BLSP1_QUP3_I2C_APPS_CBCR 0x0748
104#define BLSP1_QUP3_SPI_APPS_CMD_RCGR 0x074C
105#define BLSP1_UART3_BCR 0x0780
106#define BLSP1_UART3_APPS_CBCR 0x0784
107#define BLSP1_UART3_SIM_CBCR 0x0788
108#define BLSP1_UART3_APPS_CMD_RCGR 0x078C
109#define BLSP1_QUP4_BCR 0x07C0
110#define BLSP1_QUP4_SPI_APPS_CBCR 0x07C4
111#define BLSP1_QUP4_I2C_APPS_CBCR 0x07C8
112#define BLSP1_QUP4_SPI_APPS_CMD_RCGR 0x07CC
113#define BLSP1_UART4_BCR 0x0800
114#define BLSP1_UART4_APPS_CBCR 0x0804
115#define BLSP1_UART4_SIM_CBCR 0x0808
116#define BLSP1_UART4_APPS_CMD_RCGR 0x080C
117#define BLSP1_QUP5_BCR 0x0840
118#define BLSP1_QUP5_SPI_APPS_CBCR 0x0844
119#define BLSP1_QUP5_I2C_APPS_CBCR 0x0848
120#define BLSP1_QUP5_SPI_APPS_CMD_RCGR 0x084C
121#define BLSP1_UART5_BCR 0x0880
122#define BLSP1_UART5_APPS_CBCR 0x0884
123#define BLSP1_UART5_SIM_CBCR 0x0888
124#define BLSP1_UART5_APPS_CMD_RCGR 0x088C
125#define BLSP1_QUP6_BCR 0x08C0
126#define BLSP1_QUP6_SPI_APPS_CBCR 0x08C4
127#define BLSP1_QUP6_I2C_APPS_CBCR 0x08C8
128#define BLSP1_QUP6_SPI_APPS_CMD_RCGR 0x08CC
129#define BLSP1_UART6_BCR 0x0900
130#define BLSP1_UART6_APPS_CBCR 0x0904
131#define BLSP1_UART6_SIM_CBCR 0x0908
132#define BLSP1_UART6_APPS_CMD_RCGR 0x090C
133#define PDM_BCR 0x0CC0
134#define PDM_AHB_CBCR 0x0CC4
135#define PDM2_CBCR 0x0CCC
136#define PDM2_CMD_RCGR 0x0CD0
137#define PRNG_BCR 0x0D00
138#define PRNG_AHB_CBCR 0x0D04
139#define BOOT_ROM_BCR 0x0E00
140#define BOOT_ROM_AHB_CBCR 0x0E04
141#define CE1_BCR 0x1040
142#define CE1_CMD_RCGR 0x1050
143#define CE1_CBCR 0x1044
144#define CE1_AXI_CBCR 0x1048
145#define CE1_AHB_CBCR 0x104C
146#define COPSS_SMMU_AHB_CBCR 0x015C
147#define LPSS_SMMU_AHB_CBCR 0x0158
Vikram Mulukutla55318acb2013-04-15 17:47:34 -0700148#define BIMC_SMMU_CBCR 0x1120
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700149#define LPASS_Q6_AXI_CBCR 0x11C0
150#define APCS_GPLL_ENA_VOTE 0x1480
151#define APCS_CLOCK_BRANCH_ENA_VOTE 0x1484
152#define APCS_CLOCK_SLEEP_ENA_VOTE 0x1488
153#define GP1_CBCR 0x1900
154#define GP1_CMD_RCGR 0x1904
155#define GP2_CBCR 0x1940
156#define GP2_CMD_RCGR 0x1944
157#define GP3_CBCR 0x1980
158#define GP3_CMD_RCGR 0x1984
159#define XO_CBCR 0x0034
160
161#define MMPLL0_PLL_MODE 0x0000
162#define MMPLL0_PLL_L_VAL 0x0004
163#define MMPLL0_PLL_M_VAL 0x0008
164#define MMPLL0_PLL_N_VAL 0x000C
165#define MMPLL0_PLL_USER_CTL 0x0010
166#define MMPLL0_PLL_STATUS 0x001C
167#define MMSS_PLL_VOTE_APCS_REG 0x0100
168#define MMPLL1_PLL_MODE 0x4100
169#define MMPLL1_PLL_L_VAL 0x4104
170#define MMPLL1_PLL_M_VAL 0x4108
171#define MMPLL1_PLL_N_VAL 0x410C
172#define MMPLL1_PLL_USER_CTL 0x4110
173#define MMPLL1_PLL_STATUS 0x411C
174#define DSI_PCLK_CMD_RCGR 0x2000
175#define DSI_CMD_RCGR 0x2020
176#define MDP_VSYNC_CMD_RCGR 0x2080
177#define DSI_BYTE_CMD_RCGR 0x2120
178#define DSI_ESC_CMD_RCGR 0x2160
179#define DSI_BCR 0x2200
180#define DSI_BYTE_BCR 0x2204
181#define DSI_ESC_BCR 0x2208
182#define DSI_AHB_BCR 0x220C
183#define DSI_PCLK_BCR 0x2214
184#define MDP_LCDC_BCR 0x2218
185#define MDP_DSI_BCR 0x221C
186#define MDP_VSYNC_BCR 0x2220
187#define MDP_AXI_BCR 0x2224
188#define MDP_AHB_BCR 0x2228
189#define MDP_AXI_CBCR 0x2314
190#define MDP_VSYNC_CBCR 0x231C
191#define MDP_AHB_CBCR 0x2318
192#define DSI_PCLK_CBCR 0x233C
193#define GMEM_GFX3D_CBCR 0x4038
194#define MDP_LCDC_CBCR 0x2340
195#define MDP_DSI_CBCR 0x2320
196#define DSI_CBCR 0x2324
197#define DSI_BYTE_CBCR 0x2328
198#define DSI_ESC_CBCR 0x232C
199#define DSI_AHB_CBCR 0x2330
200#define CSI0PHYTIMER_CMD_RCGR 0x3000
201#define CSI0PHYTIMER_BCR 0x3020
202#define CSI0PHYTIMER_CBCR 0x3024
203#define CSI1PHYTIMER_CMD_RCGR 0x3030
204#define CSI1PHYTIMER_BCR 0x3050
205#define CSI1PHYTIMER_CBCR 0x3054
206#define CSI0_CMD_RCGR 0x3090
207#define CSI0_BCR 0x30B0
208#define CSI0_CBCR 0x30B4
209#define CSI_AHB_BCR 0x30B8
210#define CSI_AHB_CBCR 0x30BC
211#define CSI0PHY_BCR 0x30C0
212#define CSI0PHY_CBCR 0x30C4
213#define CSI0RDI_BCR 0x30D0
214#define CSI0RDI_CBCR 0x30D4
215#define CSI0PIX_BCR 0x30E0
216#define CSI0PIX_CBCR 0x30E4
217#define CSI1_CMD_RCGR 0x3100
218#define CSI1_BCR 0x3120
219#define CSI1_CBCR 0x3124
220#define CSI1PHY_BCR 0x3130
221#define CSI1PHY_CBCR 0x3134
222#define CSI1RDI_BCR 0x3140
223#define CSI1RDI_CBCR 0x3144
224#define CSI1PIX_BCR 0x3150
225#define CSI1PIX_CBCR 0x3154
226#define MCLK0_CMD_RCGR 0x3360
227#define MCLK0_BCR 0x3380
228#define MCLK0_CBCR 0x3384
229#define MCLK1_CMD_RCGR 0x3390
230#define MCLK1_BCR 0x33B0
231#define MCLK1_CBCR 0x33B4
232#define VFE_CMD_RCGR 0x3600
233#define VFE_BCR 0x36A0
234#define VFE_AHB_BCR 0x36AC
235#define VFE_AXI_BCR 0x36B0
236#define VFE_CBCR 0x36A8
237#define VFE_AHB_CBCR 0x36B8
238#define VFE_AXI_CBCR 0x36BC
239#define CSI_VFE_BCR 0x3700
240#define CSI_VFE_CBCR 0x3704
241#define GFX3D_CMD_RCGR 0x4000
242#define OXILI_GFX3D_CBCR 0x4028
243#define OXILI_GFX3D_BCR 0x4030
Matt Wagantall8ce3c462013-07-03 19:24:53 -0700244#define GMEM_GFX3D_BCR 0x4040
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700245#define OXILI_AHB_BCR 0x4044
246#define OXILI_AHB_CBCR 0x403C
247#define AHB_CMD_RCGR 0x5000
248#define MMSSNOCAHB_BCR 0x5020
249#define MMSSNOCAHB_BTO_BCR 0x5030
250#define MMSS_MISC_AHB_BCR 0x5034
251#define MMSS_MMSSNOC_AHB_CBCR 0x5024
252#define MMSS_MMSSNOC_BTO_AHB_CBCR 0x5028
253#define MMSS_MISC_AHB_CBCR 0x502C
254#define AXI_CMD_RCGR 0x5040
255#define MMSSNOCAXI_BCR 0x5060
256#define MMSS_S0_AXI_BCR 0x5068
257#define MMSS_S0_AXI_CBCR 0x5064
258#define MMSS_MMSSNOC_AXI_CBCR 0x506C
259#define BIMC_GFX_BCR 0x5090
260#define BIMC_GFX_CBCR 0x5094
Vikram Mulukutla8964a382013-04-10 14:30:50 -0700261#define MMSS_CAMSS_MISC 0x3718
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700262
263#define AUDIO_CORE_GDSCR 0x7000
264#define SPDM_BCR 0x1000
265#define LPAAUDIO_PLL_MODE 0x0000
266#define LPAAUDIO_PLL_L_VAL 0x0004
267#define LPAAUDIO_PLL_M_VAL 0x0008
268#define LPAAUDIO_PLL_N_VAL 0x000C
269#define LPAAUDIO_PLL_USER_CTL 0x0010
270#define LPAAUDIO_PLL_STATUS 0x001C
271#define LPAQ6_PLL_MODE 0x1000
272#define LPAQ6_PLL_USER_CTL 0x1010
273#define LPAQ6_PLL_STATUS 0x101C
274#define LPA_PLL_VOTE_APPS 0x2000
275#define AUDIO_CORE_BCR_SLP_CBCR 0x4004
276#define Q6SS_BCR_SLP_CBCR 0x6004
277#define AUDIO_CORE_GDSC_XO_CBCR 0x7004
278#define AUDIO_CORE_LPAIF_DMA_CBCR 0x9000
279#define AUDIO_CORE_LPAIF_CSR_CBCR 0x9004
280#define LPAIF_SPKR_CMD_RCGR 0xA000
281#define AUDIO_CORE_LPAIF_CODEC_SPKR_OSR_CBCR 0xA014
282#define AUDIO_CORE_LPAIF_CODEC_SPKR_IBIT_CBCR 0xA018
283#define AUDIO_CORE_LPAIF_CODEC_SPKR_EBIT_CBCR 0xA01C
284#define LPAIF_PRI_CMD_RCGR 0xB000
285#define AUDIO_CORE_LPAIF_PRI_OSR_CBCR 0xB014
286#define AUDIO_CORE_LPAIF_PRI_IBIT_CBCR 0xB018
287#define AUDIO_CORE_LPAIF_PRI_EBIT_CBCR 0xB01C
288#define LPAIF_SEC_CMD_RCGR 0xC000
289#define AUDIO_CORE_LPAIF_SEC_OSR_CBCR 0xC014
290#define AUDIO_CORE_LPAIF_SEC_IBIT_CBCR 0xC018
291#define AUDIO_CORE_LPAIF_SEC_EBIT_CBCR 0xC01C
292#define LPAIF_TER_CMD_RCGR 0xD000
293#define AUDIO_CORE_LPAIF_TER_OSR_CBCR 0xD014
294#define AUDIO_CORE_LPAIF_TER_IBIT_CBCR 0xD018
295#define AUDIO_CORE_LPAIF_TER_EBIT_CBCR 0xD01C
296#define LPAIF_QUAD_CMD_RCGR 0xE000
297#define AUDIO_CORE_LPAIF_QUAD_OSR_CBCR 0xE014
298#define AUDIO_CORE_LPAIF_QUAD_IBIT_CBCR 0xE018
299#define AUDIO_CORE_LPAIF_QUAD_EBIT_CBCR 0xE01C
300#define LPAIF_PCM0_CMD_RCGR 0xF000
301#define AUDIO_CORE_LPAIF_PCM0_IBIT_CBCR 0xF014
302#define AUDIO_CORE_LPAIF_PCM0_EBIT_CBCR 0xF018
303#define LPAIF_PCM1_CMD_RCGR 0x10000
304#define AUDIO_CORE_LPAIF_PCM1_IBIT_CBCR 0x10014
305#define AUDIO_CORE_LPAIF_PCM1_EBIT_CBCR 0x10018
306#define SLIMBUS_CMD_RCGR 0x12000
307#define AUDIO_CORE_SLIMBUS_CORE_CBCR 0x12014
308#define LPAIF_PCMOE_CMD_RCGR 0x13000
309#define AUDIO_CORE_LPAIF_PCM_DATA_OE_CBCR 0x13014
310#define Q6CORE_CMD_RCGR 0x14000
311#define SLEEP_CMD_RCGR 0x15000
312#define SPDM_CMD_RCGR 0x16000
313#define AUDIO_WRAPPER_SPDM_CBCR 0x16014
314#define XO_CMD_RCGR 0x17000
315#define AHBFABRIC_CMD_RCGR 0x18000
316#define AUDIO_CORE_LPM_CBCR 0x19000
317#define AUDIO_CORE_AVSYNC_CSR_CBCR 0x1A000
318#define AUDIO_CORE_AVSYNC_XO_CBCR 0x1A004
319#define AUDIO_CORE_AVSYNC_BT_XO_CBCR 0x1A008
320#define AUDIO_CORE_AVSYNC_FM_XO_CBCR 0x1A00C
321#define AUDIO_CORE_IXFABRIC_CBCR 0x1B000
322#define AUDIO_WRAPPER_EFABRIC_CBCR 0x1B004
323#define AUDIO_CORE_TCM_SLAVE_CBCR 0x1C000
324#define AUDIO_CORE_CSR_CBCR 0x1D000
325#define AUDIO_CORE_DML_CBCR 0x1E000
326#define AUDIO_CORE_SYSNOC_CBCR 0x1F000
327#define AUDIO_WRAPPER_SYSNOC_SWAY_CBCR 0x1F004
328#define AUDIO_CORE_TIMEOUT_CBCR 0x20000
329#define AUDIO_WRAPPER_TIMEOUT_CBCR 0x20004
330#define AUDIO_CORE_SECURITY_CBCR 0x21000
331#define AUDIO_WRAPPER_SECURITY_CBCR 0x21004
332#define Q6SS_AHB_LFABIF_CBCR 0x22000
333#define Q6SS_AHBM_CBCR 0x22004
334#define AUDIO_WRAPPER_LCC_CSR_CBCR 0x23000
335#define AUDIO_WRAPPER_BR_CBCR 0x24000
336#define AUDIO_WRAPPER_SMEM_CBCR 0x25000
337#define Q6SS_XO_CBCR 0x26000
338#define Q6SS_SLP_CBCR 0x26004
339#define LPASS_Q6SS_BCR 0x6000
340#define AUDIO_WRAPPER_STM_XO_CBCR 0x27000
341#define AUDIO_CORE_IXFABRIC_SPDMTM_CSR_CBCR 0x28000
342#define AUDIO_WRAPPER_EFABRIC_SPDMTM_CSR_CBCR 0x28004
343
344/* Mux source select values */
345#define gcc_xo_source_val 0
346#define gpll0_source_val 1
347#define gnd_source_val 5
348#define mmpll0_mm_source_val 1
349#define mmpll1_mm_source_val 2
350#define gpll0_mm_source_val 5
351#define gcc_xo_mm_source_val 0
352#define mm_gnd_source_val 6
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700353#define dsipll_mm_source_val 1
354
355#define F(f, s, div, m, n) \
356 { \
357 .freq_hz = (f), \
358 .src_clk = &s##_clk_src.c, \
359 .m_val = (m), \
360 .n_val = ~((n)-(m)) * !!(n), \
361 .d_val = ~(n),\
362 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
363 | BVAL(10, 8, s##_source_val), \
364 }
365
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800366#define F_APCS_PLL(f, l, m, n, pre_div, post_div, vco) \
367 { \
368 .freq_hz = (f), \
369 .l_val = (l), \
370 .m_val = (m), \
371 .n_val = (n), \
372 .pre_div_val = BVAL(12, 12, (pre_div)), \
373 .post_div_val = BVAL(9, 8, (post_div)), \
374 .vco_val = BVAL(29, 28, (vco)), \
375 }
376
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700377#define F_MM(f, s, div, m, n) \
378 { \
379 .freq_hz = (f), \
380 .src_clk = &s##_clk_src.c, \
381 .m_val = (m), \
382 .n_val = ~((n)-(m)) * !!(n), \
383 .d_val = ~(n),\
384 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
385 | BVAL(10, 8, s##_mm_source_val), \
386 }
387
388#define F_HDMI(f, s, div, m, n) \
389 { \
390 .freq_hz = (f), \
391 .src_clk = &s##_clk_src, \
392 .m_val = (m), \
393 .n_val = ~((n)-(m)) * !!(n), \
394 .d_val = ~(n),\
395 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
396 | BVAL(10, 8, s##_mm_source_val), \
397 }
398
399#define F_MDSS(f, s, div, m, n) \
400 { \
401 .freq_hz = (f), \
402 .m_val = (m), \
403 .n_val = ~((n)-(m)) * !!(n), \
404 .d_val = ~(n),\
405 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
406 | BVAL(10, 8, s##_mm_source_val), \
407 }
408
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700409#define VDD_DIG_FMAX_MAP1(l1, f1) \
410 .vdd_class = &vdd_dig, \
411 .fmax = (unsigned long[VDD_DIG_NUM]) { \
412 [VDD_DIG_##l1] = (f1), \
413 }, \
414 .num_fmax = VDD_DIG_NUM
415#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
416 .vdd_class = &vdd_dig, \
417 .fmax = (unsigned long[VDD_DIG_NUM]) { \
418 [VDD_DIG_##l1] = (f1), \
419 [VDD_DIG_##l2] = (f2), \
420 }, \
421 .num_fmax = VDD_DIG_NUM
422#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
423 .vdd_class = &vdd_dig, \
424 .fmax = (unsigned long[VDD_DIG_NUM]) { \
425 [VDD_DIG_##l1] = (f1), \
426 [VDD_DIG_##l2] = (f2), \
427 [VDD_DIG_##l3] = (f3), \
428 }, \
429 .num_fmax = VDD_DIG_NUM
430
431enum vdd_dig_levels {
432 VDD_DIG_NONE,
433 VDD_DIG_LOW,
434 VDD_DIG_NOMINAL,
435 VDD_DIG_HIGH,
436 VDD_DIG_NUM
437};
438
Junjie Wubb5a79e2013-05-15 13:12:39 -0700439static int vdd_corner[] = {
440 RPM_REGULATOR_CORNER_NONE, /* VDD_DIG_NONE */
441 RPM_REGULATOR_CORNER_SVS_SOC, /* VDD_DIG_LOW */
442 RPM_REGULATOR_CORNER_NORMAL, /* VDD_DIG_NOMINAL */
443 RPM_REGULATOR_CORNER_SUPER_TURBO, /* VDD_DIG_HIGH */
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700444};
445
Patrick Daly653c0b52013-04-16 17:18:28 -0700446static DEFINE_VDD_REGULATORS(vdd_dig, VDD_DIG_NUM, 1, vdd_corner, NULL);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700447
448#define RPM_MISC_CLK_TYPE 0x306b6c63
449#define RPM_BUS_CLK_TYPE 0x316b6c63
450#define RPM_MEM_CLK_TYPE 0x326b6c63
451
452#define RPM_SMD_KEY_ENABLE 0x62616E45
453
454#define CXO_ID 0x0
455#define QDSS_ID 0x1
456#define RPM_SCALING_ENABLE_ID 0x2
457
458#define PNOC_ID 0x0
459#define SNOC_ID 0x1
460#define CNOC_ID 0x2
461#define MMSSNOC_AHB_ID 0x3
462
463#define BIMC_ID 0x0
464#define OXILI_ID 0x1
465#define OCMEM_ID 0x2
466
467#define D0_ID 1
468#define D1_ID 2
Vikram Mulukutla7e5b3112013-04-15 16:32:40 -0700469#define A0_ID 4
470#define A1_ID 5
471#define A2_ID 6
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700472#define DIFF_CLK_ID 7
473#define DIV_CLK_ID 11
474
475DEFINE_CLK_RPM_SMD(pnoc_clk, pnoc_a_clk, RPM_BUS_CLK_TYPE, PNOC_ID, NULL);
476DEFINE_CLK_RPM_SMD(snoc_clk, snoc_a_clk, RPM_BUS_CLK_TYPE, SNOC_ID, NULL);
477DEFINE_CLK_RPM_SMD(cnoc_clk, cnoc_a_clk, RPM_BUS_CLK_TYPE, CNOC_ID, NULL);
478DEFINE_CLK_RPM_SMD(mmssnoc_ahb_clk, mmssnoc_ahb_a_clk, RPM_BUS_CLK_TYPE,
479 MMSSNOC_AHB_ID, NULL);
480
481DEFINE_CLK_RPM_SMD(bimc_clk, bimc_a_clk, RPM_MEM_CLK_TYPE, BIMC_ID, NULL);
482
483DEFINE_CLK_RPM_SMD_BRANCH(gcc_xo_clk_src, gcc_xo_a_clk_src,
484 RPM_MISC_CLK_TYPE, CXO_ID, 19200000);
485DEFINE_CLK_RPM_SMD_QDSS(qdss_clk, qdss_a_clk, RPM_MISC_CLK_TYPE, QDSS_ID);
486
487DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d0, cxo_d0_a, D0_ID);
488DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d1, cxo_d1_a, D1_ID);
489DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a0, cxo_a0_a, A0_ID);
490DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a1, cxo_a1_a, A1_ID);
491DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a2, cxo_a2_a, A2_ID);
492DEFINE_CLK_RPM_SMD_XO_BUFFER(div_clk, div_a_clk, DIV_CLK_ID);
493DEFINE_CLK_RPM_SMD_XO_BUFFER(diff_clk, diff_a_clk, DIFF_CLK_ID);
494
495DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d0_pin, cxo_d0_a_pin, D0_ID);
496DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d1_pin, cxo_d1_a_pin, D1_ID);
497DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a0_pin, cxo_a0_a_pin, A0_ID);
498DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a1_pin, cxo_a1_a_pin, A1_ID);
499DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a2_pin, cxo_a2_a_pin, A2_ID);
500
501static DEFINE_CLK_VOTER(pnoc_msmbus_clk, &pnoc_clk.c, LONG_MAX);
502static DEFINE_CLK_VOTER(snoc_msmbus_clk, &snoc_clk.c, LONG_MAX);
503static DEFINE_CLK_VOTER(cnoc_msmbus_clk, &cnoc_clk.c, LONG_MAX);
504static DEFINE_CLK_VOTER(pnoc_msmbus_a_clk, &pnoc_a_clk.c, LONG_MAX);
505static DEFINE_CLK_VOTER(snoc_msmbus_a_clk, &snoc_a_clk.c, LONG_MAX);
506static DEFINE_CLK_VOTER(cnoc_msmbus_a_clk, &cnoc_a_clk.c, LONG_MAX);
507
508static DEFINE_CLK_VOTER(bimc_msmbus_clk, &bimc_clk.c, LONG_MAX);
509static DEFINE_CLK_VOTER(bimc_msmbus_a_clk, &bimc_a_clk.c, LONG_MAX);
510static DEFINE_CLK_VOTER(bimc_acpu_a_clk, &bimc_a_clk.c, LONG_MAX);
511
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -0700512static DEFINE_CLK_VOTER(pnoc_keepalive_a_clk, &pnoc_a_clk.c, LONG_MAX);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700513static DEFINE_CLK_VOTER(pnoc_sps_clk, &pnoc_clk.c, LONG_MAX);
514static DEFINE_CLK_VOTER(pnoc_iommu_clk, &pnoc_clk.c, LONG_MAX);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700515
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -0700516static DEFINE_CLK_BRANCH_VOTER(cxo_otg_clk, &gcc_xo_clk_src.c);
517static DEFINE_CLK_BRANCH_VOTER(cxo_lpass_pil_clk, &gcc_xo_clk_src.c);
518static DEFINE_CLK_BRANCH_VOTER(cxo_lpm_clk, &gcc_xo_clk_src.c);
519static DEFINE_CLK_BRANCH_VOTER(cxo_pil_pronto_clk, &gcc_xo_clk_src.c);
520static DEFINE_CLK_BRANCH_VOTER(cxo_mss_pil_clk, &gcc_xo_clk_src.c);
521static DEFINE_CLK_BRANCH_VOTER(cxo_pil_mba_clk, &gcc_xo_clk_src.c);
522static DEFINE_CLK_BRANCH_VOTER(cxo_wlan_clk, &gcc_xo_clk_src.c);
523static DEFINE_CLK_BRANCH_VOTER(cxo_acpu_clk, &gcc_xo_clk_src.c);
524
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800525static DEFINE_CLK_MEASURE(apc0_m_clk);
526static DEFINE_CLK_MEASURE(apc1_m_clk);
527static DEFINE_CLK_MEASURE(apc2_m_clk);
528static DEFINE_CLK_MEASURE(apc3_m_clk);
529static DEFINE_CLK_MEASURE(l2_m_clk);
Vikram Mulukutla69680bb2013-12-17 15:58:46 -0800530static DEFINE_CLK_MEASURE(wcnss_m_clk);
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800531
532#define APCS_SH_PLL_MODE 0x000
533#define APCS_SH_PLL_L_VAL 0x004
534#define APCS_SH_PLL_M_VAL 0x008
535#define APCS_SH_PLL_N_VAL 0x00C
536#define APCS_SH_PLL_USER_CTL 0x010
537#define APCS_SH_PLL_CONFIG_CTL 0x014
538#define APCS_SH_PLL_STATUS 0x01C
539
540enum vdd_sr2_pll_levels {
541 VDD_SR2_PLL_OFF,
Patrick Daly6fb589a2013-03-29 17:55:55 -0700542 VDD_SR2_PLL_SVS,
543 VDD_SR2_PLL_NOM,
544 VDD_SR2_PLL_TUR,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800545 VDD_SR2_PLL_NUM
546};
547
Junjie Wubb5a79e2013-05-15 13:12:39 -0700548static int vdd_sr2_levels[] = {
549 0, RPM_REGULATOR_CORNER_NONE, /* VDD_SR2_PLL_OFF */
550 1800000, RPM_REGULATOR_CORNER_SVS_SOC, /* VDD_SR2_PLL_SVS */
551 1800000, RPM_REGULATOR_CORNER_NORMAL, /* VDD_SR2_PLL_NOM */
552 1800000, RPM_REGULATOR_CORNER_SUPER_TURBO, /* VDD_SR2_PLL_TUR */
Patrick Dalyebc26bc2013-02-05 11:49:07 -0800553};
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800554
Patrick Daly653c0b52013-04-16 17:18:28 -0700555static DEFINE_VDD_REGULATORS(vdd_sr2_pll, VDD_SR2_PLL_NUM, 2,
556 vdd_sr2_levels, NULL);
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800557
558static struct pll_freq_tbl apcs_pll_freq[] = {
Patrick Daly83806032013-03-25 15:18:24 -0700559 F_APCS_PLL( 768000000, 40, 0x0, 0x1, 0x0, 0x0, 0x0),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800560 F_APCS_PLL( 787200000, 41, 0x0, 0x1, 0x0, 0x0, 0x0),
561 F_APCS_PLL( 998400000, 52, 0x0, 0x1, 0x0, 0x0, 0x0),
Taniya Das85f99782014-05-16 12:27:07 +0530562 F_APCS_PLL(1094400000, 57, 0x0, 0x1, 0x0, 0x0, 0x0),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800563 F_APCS_PLL(1190400000, 62, 0x0, 0x1, 0x0, 0x0, 0x0),
564 PLL_F_END
565};
566
567static struct pll_clk a7sspll = {
568 .mode_reg = (void __iomem *)APCS_SH_PLL_MODE,
569 .l_reg = (void __iomem *)APCS_SH_PLL_L_VAL,
570 .m_reg = (void __iomem *)APCS_SH_PLL_M_VAL,
571 .n_reg = (void __iomem *)APCS_SH_PLL_N_VAL,
572 .config_reg = (void __iomem *)APCS_SH_PLL_USER_CTL,
573 .status_reg = (void __iomem *)APCS_SH_PLL_STATUS,
574 .freq_tbl = apcs_pll_freq,
575 .masks = {
576 .vco_mask = BM(29, 28),
577 .pre_div_mask = BIT(12),
578 .post_div_mask = BM(9, 8),
579 .mn_en_mask = BIT(24),
580 .main_output_mask = BIT(0),
581 },
582 .base = &virt_bases[APCS_PLL_BASE],
583 .c = {
Patrick Daly9bdc8a52013-03-21 19:12:40 -0700584 .parent = &gcc_xo_a_clk_src.c,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800585 .dbg_name = "a7sspll",
586 .ops = &clk_ops_sr2_pll,
587 .vdd_class = &vdd_sr2_pll,
588 .fmax = (unsigned long [VDD_SR2_PLL_NUM]) {
Patrick Daly6fb589a2013-03-29 17:55:55 -0700589 [VDD_SR2_PLL_SVS] = 1000000000,
590 [VDD_SR2_PLL_NOM] = 1900000000,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800591 },
592 .num_fmax = VDD_SR2_PLL_NUM,
593 CLK_INIT(a7sspll.c),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800594 },
595};
596
597static unsigned int soft_vote_gpll0;
598
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700599static struct pll_vote_clk gpll0_clk_src = {
600 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
601 .en_mask = BIT(0),
602 .status_reg = (void __iomem *)GPLL0_STATUS,
603 .status_mask = BIT(17),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800604 .soft_vote = &soft_vote_gpll0,
605 .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700606 .base = &virt_bases[GCC_BASE],
607 .c = {
608 .parent = &gcc_xo_clk_src.c,
609 .rate = 600000000,
610 .dbg_name = "gpll0_clk_src",
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800611 .ops = &clk_ops_pll_acpu_vote,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700612 CLK_INIT(gpll0_clk_src.c),
613 },
614};
615
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800616static struct pll_vote_clk gpll0_ao_clk_src = {
617 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
618 .en_mask = BIT(0),
619 .status_reg = (void __iomem *)GPLL0_STATUS,
620 .status_mask = BIT(17),
621 .soft_vote = &soft_vote_gpll0,
622 .soft_vote_mask = PLL_SOFT_VOTE_ACPU,
623 .base = &virt_bases[GCC_BASE],
624 .c = {
625 .rate = 600000000,
626 .dbg_name = "gpll0_ao_clk_src",
627 .ops = &clk_ops_pll_acpu_vote,
628 CLK_INIT(gpll0_ao_clk_src.c),
629 },
630};
631
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700632static struct pll_vote_clk mmpll0_clk_src = {
633 .en_reg = (void __iomem *)MMSS_PLL_VOTE_APCS_REG,
634 .en_mask = BIT(0),
635 .status_reg = (void __iomem *)MMPLL0_PLL_STATUS,
636 .status_mask = BIT(17),
637 .base = &virt_bases[MMSS_BASE],
638 .c = {
639 .parent = &gcc_xo_clk_src.c,
640 .dbg_name = "mmpll0_clk_src",
641 .rate = 800000000,
642 .ops = &clk_ops_pll_vote,
643 CLK_INIT(mmpll0_clk_src.c),
644 },
645};
646
647static struct pll_config_regs mmpll0_regs __initdata = {
648 .l_reg = (void __iomem *)MMPLL0_PLL_L_VAL,
649 .m_reg = (void __iomem *)MMPLL0_PLL_M_VAL,
650 .n_reg = (void __iomem *)MMPLL0_PLL_N_VAL,
651 .config_reg = (void __iomem *)MMPLL0_PLL_USER_CTL,
652 .mode_reg = (void __iomem *)MMPLL0_PLL_MODE,
653 .base = &virt_bases[MMSS_BASE],
654};
655
656static struct pll_clk mmpll1_clk_src = {
657 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
658 .status_reg = (void __iomem *)MMPLL1_PLL_STATUS,
659 .base = &virt_bases[MMSS_BASE],
660 .c = {
661 .parent = &gcc_xo_clk_src.c,
662 .dbg_name = "mmpll1_clk_src",
663 .rate = 1200000000,
664 .ops = &clk_ops_local_pll,
665 CLK_INIT(mmpll1_clk_src.c),
666 },
667};
668
669static struct pll_config_regs mmpll1_regs __initdata = {
670 .l_reg = (void __iomem *)MMPLL1_PLL_L_VAL,
671 .m_reg = (void __iomem *)MMPLL1_PLL_M_VAL,
672 .n_reg = (void __iomem *)MMPLL1_PLL_N_VAL,
673 .config_reg = (void __iomem *)MMPLL1_PLL_USER_CTL,
674 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
675 .base = &virt_bases[MMSS_BASE],
676};
677
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700678static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = {
679 F( 960000, gcc_xo, 10, 1, 2),
680 F( 4800000, gcc_xo, 4, 0, 0),
681 F( 9600000, gcc_xo, 2, 0, 0),
Patrick Dalye408bb32013-11-08 17:35:27 -0800682 F(12000000, gpll0, 10, 1, 5),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700683 F(15000000, gpll0, 10, 1, 4),
684 F(19200000, gcc_xo, 1, 0, 0),
685 F(25000000, gpll0, 12, 1, 2),
686 F(50000000, gpll0, 12, 0, 0),
687 F_END,
688};
689
690static struct rcg_clk blsp1_qup1_spi_apps_clk_src = {
691 .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR,
692 .set_rate = set_rate_mnd,
693 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
694 .current_freq = &rcg_dummy_freq,
695 .base = &virt_bases[GCC_BASE],
696 .c = {
697 .dbg_name = "blsp1_qup1_spi_apps_clk_src",
698 .ops = &clk_ops_rcg_mnd,
699 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
700 CLK_INIT(blsp1_qup1_spi_apps_clk_src.c),
701 },
702};
703
704static struct rcg_clk blsp1_qup2_spi_apps_clk_src = {
705 .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR,
706 .set_rate = set_rate_mnd,
707 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
708 .current_freq = &rcg_dummy_freq,
709 .base = &virt_bases[GCC_BASE],
710 .c = {
711 .dbg_name = "blsp1_qup2_spi_apps_clk_src",
712 .ops = &clk_ops_rcg_mnd,
713 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
714 CLK_INIT(blsp1_qup2_spi_apps_clk_src.c),
715 },
716};
717
718static struct rcg_clk blsp1_qup3_spi_apps_clk_src = {
719 .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR,
720 .set_rate = set_rate_mnd,
721 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
722 .current_freq = &rcg_dummy_freq,
723 .base = &virt_bases[GCC_BASE],
724 .c = {
725 .dbg_name = "blsp1_qup3_spi_apps_clk_src",
726 .ops = &clk_ops_rcg_mnd,
727 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
728 CLK_INIT(blsp1_qup3_spi_apps_clk_src.c),
729 },
730};
731
732static struct rcg_clk blsp1_qup4_spi_apps_clk_src = {
733 .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR,
734 .set_rate = set_rate_mnd,
735 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
736 .current_freq = &rcg_dummy_freq,
737 .base = &virt_bases[GCC_BASE],
738 .c = {
739 .dbg_name = "blsp1_qup4_spi_apps_clk_src",
740 .ops = &clk_ops_rcg_mnd,
741 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
742 CLK_INIT(blsp1_qup4_spi_apps_clk_src.c),
743 },
744};
745
746static struct rcg_clk blsp1_qup5_spi_apps_clk_src = {
747 .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR,
748 .set_rate = set_rate_mnd,
749 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
750 .current_freq = &rcg_dummy_freq,
751 .base = &virt_bases[GCC_BASE],
752 .c = {
753 .dbg_name = "blsp1_qup5_spi_apps_clk_src",
754 .ops = &clk_ops_rcg_mnd,
755 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
756 CLK_INIT(blsp1_qup5_spi_apps_clk_src.c),
757 },
758};
759
760static struct rcg_clk blsp1_qup6_spi_apps_clk_src = {
761 .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR,
762 .set_rate = set_rate_mnd,
763 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
764 .current_freq = &rcg_dummy_freq,
765 .base = &virt_bases[GCC_BASE],
766 .c = {
767 .dbg_name = "blsp1_qup6_spi_apps_clk_src",
768 .ops = &clk_ops_rcg_mnd,
769 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
770 CLK_INIT(blsp1_qup6_spi_apps_clk_src.c),
771 },
772};
773
774static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = {
775 F( 3686400, gpll0, 1, 96, 15625),
776 F( 7372800, gpll0, 1, 192, 15625),
777 F(14745600, gpll0, 1, 384, 15625),
778 F(16000000, gpll0, 5, 2, 15),
779 F(19200000, gcc_xo, 1, 0, 0),
780 F(24000000, gpll0, 5, 1, 5),
781 F(32000000, gpll0, 1, 4, 75),
782 F(40000000, gpll0, 15, 0, 0),
783 F(46400000, gpll0, 1, 29, 375),
784 F(48000000, gpll0, 12.5, 0, 0),
785 F(51200000, gpll0, 1, 32, 375),
786 F(56000000, gpll0, 1, 7, 75),
787 F(58982400, gpll0, 1, 1536, 15625),
788 F(60000000, gpll0, 10, 0, 0),
Vikram Mulukutla0caccf92013-11-18 14:55:42 -0800789 F(63160000, gpll0, 9.5, 0, 0),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700790 F_END,
791};
792
793static struct rcg_clk blsp1_uart1_apps_clk_src = {
794 .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR,
795 .set_rate = set_rate_mnd,
796 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
797 .current_freq = &rcg_dummy_freq,
798 .base = &virt_bases[GCC_BASE],
799 .c = {
800 .dbg_name = "blsp1_uart1_apps_clk_src",
801 .ops = &clk_ops_rcg_mnd,
802 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
803 CLK_INIT(blsp1_uart1_apps_clk_src.c),
804 },
805};
806
807static struct rcg_clk blsp1_uart2_apps_clk_src = {
808 .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR,
809 .set_rate = set_rate_mnd,
810 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
811 .current_freq = &rcg_dummy_freq,
812 .base = &virt_bases[GCC_BASE],
813 .c = {
814 .dbg_name = "blsp1_uart2_apps_clk_src",
815 .ops = &clk_ops_rcg_mnd,
816 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
817 CLK_INIT(blsp1_uart2_apps_clk_src.c),
818 },
819};
820
821static struct rcg_clk blsp1_uart3_apps_clk_src = {
822 .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR,
823 .set_rate = set_rate_mnd,
824 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
825 .current_freq = &rcg_dummy_freq,
826 .base = &virt_bases[GCC_BASE],
827 .c = {
828 .dbg_name = "blsp1_uart3_apps_clk_src",
829 .ops = &clk_ops_rcg_mnd,
830 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
831 CLK_INIT(blsp1_uart3_apps_clk_src.c),
832 },
833};
834
835static struct rcg_clk blsp1_uart4_apps_clk_src = {
836 .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR,
837 .set_rate = set_rate_mnd,
838 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
839 .current_freq = &rcg_dummy_freq,
840 .base = &virt_bases[GCC_BASE],
841 .c = {
842 .dbg_name = "blsp1_uart4_apps_clk_src",
843 .ops = &clk_ops_rcg_mnd,
844 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
845 CLK_INIT(blsp1_uart4_apps_clk_src.c),
846 },
847};
848
849static struct rcg_clk blsp1_uart5_apps_clk_src = {
850 .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR,
851 .set_rate = set_rate_mnd,
852 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
853 .current_freq = &rcg_dummy_freq,
854 .base = &virt_bases[GCC_BASE],
855 .c = {
856 .dbg_name = "blsp1_uart5_apps_clk_src",
857 .ops = &clk_ops_rcg_mnd,
858 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
859 CLK_INIT(blsp1_uart5_apps_clk_src.c),
860 },
861};
862
863static struct rcg_clk blsp1_uart6_apps_clk_src = {
864 .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR,
865 .set_rate = set_rate_mnd,
866 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
867 .current_freq = &rcg_dummy_freq,
868 .base = &virt_bases[GCC_BASE],
869 .c = {
870 .dbg_name = "blsp1_uart6_apps_clk_src",
871 .ops = &clk_ops_rcg_mnd,
872 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
873 CLK_INIT(blsp1_uart6_apps_clk_src.c),
874 },
875};
876
877static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = {
878 F(50000000, gpll0, 12, 0, 0),
879 F(100000000, gpll0, 6, 0, 0),
880 F_END,
881};
882
883static struct rcg_clk ce1_clk_src = {
884 .cmd_rcgr_reg = CE1_CMD_RCGR,
885 .set_rate = set_rate_hid,
886 .freq_tbl = ftbl_gcc_ce1_clk,
887 .current_freq = &rcg_dummy_freq,
888 .base = &virt_bases[GCC_BASE],
889 .c = {
890 .dbg_name = "ce1_clk_src",
891 .ops = &clk_ops_rcg,
892 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
893 CLK_INIT(ce1_clk_src.c),
894 },
895};
896
897static struct clk_freq_tbl ftbl_gcc_gp1_3_clk[] = {
898 F(19200000, gcc_xo, 1, 0, 0),
899 F_END,
900};
901
902static struct rcg_clk gp1_clk_src = {
903 .cmd_rcgr_reg = GP1_CMD_RCGR,
904 .set_rate = set_rate_mnd,
905 .freq_tbl = ftbl_gcc_gp1_3_clk,
906 .current_freq = &rcg_dummy_freq,
907 .base = &virt_bases[GCC_BASE],
908 .c = {
909 .dbg_name = "gp1_clk_src",
910 .ops = &clk_ops_rcg_mnd,
911 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
912 CLK_INIT(gp1_clk_src.c),
913 },
914};
915
916static struct rcg_clk gp2_clk_src = {
917 .cmd_rcgr_reg = GP2_CMD_RCGR,
918 .set_rate = set_rate_mnd,
919 .freq_tbl = ftbl_gcc_gp1_3_clk,
920 .current_freq = &rcg_dummy_freq,
921 .base = &virt_bases[GCC_BASE],
922 .c = {
923 .dbg_name = "gp2_clk_src",
924 .ops = &clk_ops_rcg_mnd,
925 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
926 CLK_INIT(gp2_clk_src.c),
927 },
928};
929
930static struct rcg_clk gp3_clk_src = {
931 .cmd_rcgr_reg = GP3_CMD_RCGR,
932 .set_rate = set_rate_mnd,
933 .freq_tbl = ftbl_gcc_gp1_3_clk,
934 .current_freq = &rcg_dummy_freq,
935 .base = &virt_bases[GCC_BASE],
936 .c = {
937 .dbg_name = "gp3_clk_src",
938 .ops = &clk_ops_rcg_mnd,
939 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
940 CLK_INIT(gp3_clk_src.c),
941 },
942};
943
944static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = {
945 F(60000000, gpll0, 10, 0, 0),
946 F_END,
947};
948
949static struct rcg_clk pdm2_clk_src = {
950 .cmd_rcgr_reg = PDM2_CMD_RCGR,
951 .set_rate = set_rate_hid,
952 .freq_tbl = ftbl_gcc_pdm2_clk,
953 .current_freq = &rcg_dummy_freq,
954 .base = &virt_bases[GCC_BASE],
955 .c = {
956 .dbg_name = "pdm2_clk_src",
957 .ops = &clk_ops_rcg,
958 VDD_DIG_FMAX_MAP1(LOW, 120000000),
959 CLK_INIT(pdm2_clk_src.c),
960 },
961};
962
963static struct clk_freq_tbl ftbl_gcc_sdcc1_2_apps_clk[] = {
964 F( 144000, gcc_xo, 16, 3, 25),
965 F( 400000, gcc_xo, 12, 1, 4),
966 F( 20000000, gpll0, 15, 1, 2),
967 F( 25000000, gpll0, 12, 1, 2),
968 F( 50000000, gpll0, 12, 0, 0),
969 F(100000000, gpll0, 6, 0, 0),
970 F(200000000, gpll0, 3, 0, 0),
971 F_END,
972};
973
974static struct rcg_clk sdcc1_apps_clk_src = {
975 .cmd_rcgr_reg = SDCC1_APPS_CMD_RCGR,
976 .set_rate = set_rate_mnd,
977 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
978 .current_freq = &rcg_dummy_freq,
979 .base = &virt_bases[GCC_BASE],
980 .c = {
981 .dbg_name = "sdcc1_apps_clk_src",
982 .ops = &clk_ops_rcg_mnd,
983 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
984 CLK_INIT(sdcc1_apps_clk_src.c),
985 },
986};
987
988static struct rcg_clk sdcc2_apps_clk_src = {
989 .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR,
990 .set_rate = set_rate_mnd,
991 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
992 .current_freq = &rcg_dummy_freq,
993 .base = &virt_bases[GCC_BASE],
994 .c = {
995 .dbg_name = "sdcc2_apps_clk_src",
996 .ops = &clk_ops_rcg_mnd,
997 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
998 CLK_INIT(sdcc2_apps_clk_src.c),
999 },
1000};
1001
1002static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = {
1003 F(75000000, gpll0, 8, 0, 0),
1004 F_END,
1005};
1006
1007static struct rcg_clk usb_hs_system_clk_src = {
1008 .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR,
1009 .set_rate = set_rate_hid,
1010 .freq_tbl = ftbl_gcc_usb_hs_system_clk,
1011 .current_freq = &rcg_dummy_freq,
1012 .base = &virt_bases[GCC_BASE],
1013 .c = {
1014 .dbg_name = "usb_hs_system_clk_src",
1015 .ops = &clk_ops_rcg,
1016 VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 100000000),
1017 CLK_INIT(usb_hs_system_clk_src.c),
1018 },
1019};
1020
1021static struct local_vote_clk gcc_blsp1_ahb_clk = {
1022 .cbcr_reg = BLSP1_AHB_CBCR,
1023 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1024 .en_mask = BIT(17),
1025 .base = &virt_bases[GCC_BASE],
1026 .c = {
1027 .dbg_name = "gcc_blsp1_ahb_clk",
1028 .ops = &clk_ops_vote,
1029 CLK_INIT(gcc_blsp1_ahb_clk.c),
1030 },
1031};
1032
1033static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = {
1034 .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR,
1035 .has_sibling = 1,
1036 .base = &virt_bases[GCC_BASE],
1037 .c = {
1038 .parent = &gcc_xo_clk_src.c,
1039 .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk",
1040 .ops = &clk_ops_branch,
1041 CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c),
1042 },
1043};
1044
1045static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = {
1046 .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR,
1047 .has_sibling = 0,
1048 .base = &virt_bases[GCC_BASE],
1049 .c = {
1050 .parent = &blsp1_qup1_spi_apps_clk_src.c,
1051 .dbg_name = "gcc_blsp1_qup1_spi_apps_clk",
1052 .ops = &clk_ops_branch,
1053 CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c),
1054 },
1055};
1056
1057static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = {
1058 .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR,
1059 .has_sibling = 1,
1060 .base = &virt_bases[GCC_BASE],
1061 .c = {
1062 .parent = &gcc_xo_clk_src.c,
1063 .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk",
1064 .ops = &clk_ops_branch,
1065 CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c),
1066 },
1067};
1068
1069static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = {
1070 .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR,
1071 .has_sibling = 0,
1072 .base = &virt_bases[GCC_BASE],
1073 .c = {
1074 .parent = &blsp1_qup2_spi_apps_clk_src.c,
1075 .dbg_name = "gcc_blsp1_qup2_spi_apps_clk",
1076 .ops = &clk_ops_branch,
1077 CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c),
1078 },
1079};
1080
1081static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = {
1082 .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR,
1083 .has_sibling = 1,
1084 .base = &virt_bases[GCC_BASE],
1085 .c = {
1086 .parent = &gcc_xo_clk_src.c,
1087 .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk",
1088 .ops = &clk_ops_branch,
1089 CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c),
1090 },
1091};
1092
1093static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = {
1094 .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR,
1095 .has_sibling = 0,
1096 .base = &virt_bases[GCC_BASE],
1097 .c = {
1098 .parent = &blsp1_qup3_spi_apps_clk_src.c,
1099 .dbg_name = "gcc_blsp1_qup3_spi_apps_clk",
1100 .ops = &clk_ops_branch,
1101 CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c),
1102 },
1103};
1104
1105static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = {
1106 .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR,
1107 .has_sibling = 1,
1108 .base = &virt_bases[GCC_BASE],
1109 .c = {
1110 .parent = &gcc_xo_clk_src.c,
1111 .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk",
1112 .ops = &clk_ops_branch,
1113 CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c),
1114 },
1115};
1116
1117static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = {
1118 .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR,
1119 .has_sibling = 0,
1120 .base = &virt_bases[GCC_BASE],
1121 .c = {
1122 .parent = &blsp1_qup4_spi_apps_clk_src.c,
1123 .dbg_name = "gcc_blsp1_qup4_spi_apps_clk",
1124 .ops = &clk_ops_branch,
1125 CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c),
1126 },
1127};
1128
1129static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = {
1130 .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR,
1131 .has_sibling = 1,
1132 .base = &virt_bases[GCC_BASE],
1133 .c = {
1134 .parent = &gcc_xo_clk_src.c,
1135 .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk",
1136 .ops = &clk_ops_branch,
1137 CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c),
1138 },
1139};
1140
1141static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = {
1142 .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR,
1143 .has_sibling = 0,
1144 .base = &virt_bases[GCC_BASE],
1145 .c = {
1146 .parent = &blsp1_qup5_spi_apps_clk_src.c,
1147 .dbg_name = "gcc_blsp1_qup5_spi_apps_clk",
1148 .ops = &clk_ops_branch,
1149 CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c),
1150 },
1151};
1152
1153static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = {
1154 .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR,
1155 .has_sibling = 1,
1156 .base = &virt_bases[GCC_BASE],
1157 .c = {
1158 .parent = &gcc_xo_clk_src.c,
1159 .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk",
1160 .ops = &clk_ops_branch,
1161 CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c),
1162 },
1163};
1164
1165static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = {
1166 .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR,
1167 .has_sibling = 0,
1168 .base = &virt_bases[GCC_BASE],
1169 .c = {
1170 .parent = &blsp1_qup6_spi_apps_clk_src.c,
1171 .dbg_name = "gcc_blsp1_qup6_spi_apps_clk",
1172 .ops = &clk_ops_branch,
1173 CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c),
1174 },
1175};
1176
1177static struct branch_clk gcc_blsp1_uart1_apps_clk = {
1178 .cbcr_reg = BLSP1_UART1_APPS_CBCR,
1179 .has_sibling = 0,
1180 .base = &virt_bases[GCC_BASE],
1181 .c = {
1182 .parent = &blsp1_uart1_apps_clk_src.c,
1183 .dbg_name = "gcc_blsp1_uart1_apps_clk",
1184 .ops = &clk_ops_branch,
1185 CLK_INIT(gcc_blsp1_uart1_apps_clk.c),
1186 },
1187};
1188
1189static struct branch_clk gcc_blsp1_uart2_apps_clk = {
1190 .cbcr_reg = BLSP1_UART2_APPS_CBCR,
1191 .has_sibling = 0,
1192 .base = &virt_bases[GCC_BASE],
1193 .c = {
1194 .parent = &blsp1_uart2_apps_clk_src.c,
1195 .dbg_name = "gcc_blsp1_uart2_apps_clk",
1196 .ops = &clk_ops_branch,
1197 CLK_INIT(gcc_blsp1_uart2_apps_clk.c),
1198 },
1199};
1200
1201static struct branch_clk gcc_blsp1_uart3_apps_clk = {
1202 .cbcr_reg = BLSP1_UART3_APPS_CBCR,
1203 .has_sibling = 0,
1204 .base = &virt_bases[GCC_BASE],
1205 .c = {
1206 .parent = &blsp1_uart3_apps_clk_src.c,
1207 .dbg_name = "gcc_blsp1_uart3_apps_clk",
1208 .ops = &clk_ops_branch,
1209 CLK_INIT(gcc_blsp1_uart3_apps_clk.c),
1210 },
1211};
1212
1213static struct branch_clk gcc_blsp1_uart4_apps_clk = {
1214 .cbcr_reg = BLSP1_UART4_APPS_CBCR,
1215 .has_sibling = 0,
1216 .base = &virt_bases[GCC_BASE],
1217 .c = {
1218 .parent = &blsp1_uart4_apps_clk_src.c,
1219 .dbg_name = "gcc_blsp1_uart4_apps_clk",
1220 .ops = &clk_ops_branch,
1221 CLK_INIT(gcc_blsp1_uart4_apps_clk.c),
1222 },
1223};
1224
1225static struct branch_clk gcc_blsp1_uart5_apps_clk = {
1226 .cbcr_reg = BLSP1_UART5_APPS_CBCR,
1227 .has_sibling = 0,
1228 .base = &virt_bases[GCC_BASE],
1229 .c = {
1230 .parent = &blsp1_uart5_apps_clk_src.c,
1231 .dbg_name = "gcc_blsp1_uart5_apps_clk",
1232 .ops = &clk_ops_branch,
1233 CLK_INIT(gcc_blsp1_uart5_apps_clk.c),
1234 },
1235};
1236
1237static struct branch_clk gcc_blsp1_uart6_apps_clk = {
1238 .cbcr_reg = BLSP1_UART6_APPS_CBCR,
1239 .has_sibling = 0,
1240 .base = &virt_bases[GCC_BASE],
1241 .c = {
1242 .parent = &blsp1_uart6_apps_clk_src.c,
1243 .dbg_name = "gcc_blsp1_uart6_apps_clk",
1244 .ops = &clk_ops_branch,
1245 CLK_INIT(gcc_blsp1_uart6_apps_clk.c),
1246 },
1247};
1248
1249static struct local_vote_clk gcc_boot_rom_ahb_clk = {
1250 .cbcr_reg = BOOT_ROM_AHB_CBCR,
1251 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1252 .en_mask = BIT(10),
1253 .base = &virt_bases[GCC_BASE],
1254 .c = {
1255 .dbg_name = "gcc_boot_rom_ahb_clk",
1256 .ops = &clk_ops_vote,
1257 CLK_INIT(gcc_boot_rom_ahb_clk.c),
1258 },
1259};
1260
1261static struct local_vote_clk gcc_ce1_ahb_clk = {
1262 .cbcr_reg = CE1_AHB_CBCR,
1263 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1264 .en_mask = BIT(3),
1265 .base = &virt_bases[GCC_BASE],
1266 .c = {
1267 .dbg_name = "gcc_ce1_ahb_clk",
1268 .ops = &clk_ops_vote,
1269 CLK_INIT(gcc_ce1_ahb_clk.c),
1270 },
1271};
1272
1273static struct local_vote_clk gcc_ce1_axi_clk = {
1274 .cbcr_reg = CE1_AXI_CBCR,
1275 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1276 .en_mask = BIT(4),
1277 .base = &virt_bases[GCC_BASE],
1278 .c = {
1279 .dbg_name = "gcc_ce1_axi_clk",
1280 .ops = &clk_ops_vote,
1281 CLK_INIT(gcc_ce1_axi_clk.c),
1282 },
1283};
1284
1285static struct local_vote_clk gcc_ce1_clk = {
1286 .cbcr_reg = CE1_CBCR,
1287 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1288 .en_mask = BIT(5),
1289 .base = &virt_bases[GCC_BASE],
1290 .c = {
Vikram Mulukutla1ed9e112013-11-01 18:36:13 -07001291 .parent = &ce1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001292 .dbg_name = "gcc_ce1_clk",
1293 .ops = &clk_ops_vote,
1294 CLK_INIT(gcc_ce1_clk.c),
1295 },
1296};
1297
1298static struct branch_clk gcc_copss_smmu_ahb_clk = {
1299 .cbcr_reg = COPSS_SMMU_AHB_CBCR,
1300 .has_sibling = 1,
1301 .base = &virt_bases[GCC_BASE],
1302 .c = {
1303 .dbg_name = "gcc_copss_smmu_ahb_clk",
1304 .ops = &clk_ops_branch,
1305 CLK_INIT(gcc_copss_smmu_ahb_clk.c),
1306 },
1307};
1308
1309static struct branch_clk gcc_lpss_smmu_ahb_clk = {
1310 .cbcr_reg = LPSS_SMMU_AHB_CBCR,
1311 .has_sibling = 1,
1312 .base = &virt_bases[GCC_BASE],
1313 .c = {
1314 .dbg_name = "gcc_lpss_smmu_ahb_clk",
1315 .ops = &clk_ops_branch,
1316 CLK_INIT(gcc_lpss_smmu_ahb_clk.c),
1317 },
1318};
1319
1320static struct branch_clk gcc_gp1_clk = {
1321 .cbcr_reg = GP1_CBCR,
1322 .has_sibling = 0,
1323 .base = &virt_bases[GCC_BASE],
1324 .c = {
1325 .parent = &gp1_clk_src.c,
1326 .dbg_name = "gcc_gp1_clk",
1327 .ops = &clk_ops_branch,
1328 CLK_INIT(gcc_gp1_clk.c),
1329 },
1330};
1331
1332static struct branch_clk gcc_gp2_clk = {
1333 .cbcr_reg = GP2_CBCR,
1334 .has_sibling = 0,
1335 .base = &virt_bases[GCC_BASE],
1336 .c = {
1337 .parent = &gp2_clk_src.c,
1338 .dbg_name = "gcc_gp2_clk",
1339 .ops = &clk_ops_branch,
1340 CLK_INIT(gcc_gp2_clk.c),
1341 },
1342};
1343
1344static struct branch_clk gcc_gp3_clk = {
1345 .cbcr_reg = GP3_CBCR,
1346 .has_sibling = 0,
1347 .base = &virt_bases[GCC_BASE],
1348 .c = {
1349 .parent = &gp3_clk_src.c,
1350 .dbg_name = "gcc_gp3_clk",
1351 .ops = &clk_ops_branch,
1352 CLK_INIT(gcc_gp3_clk.c),
1353 },
1354};
1355
1356static struct branch_clk gcc_lpass_q6_axi_clk = {
1357 .cbcr_reg = LPASS_Q6_AXI_CBCR,
1358 .has_sibling = 1,
1359 .base = &virt_bases[GCC_BASE],
1360 .c = {
1361 .dbg_name = "gcc_lpass_q6_axi_clk",
1362 .ops = &clk_ops_branch,
1363 CLK_INIT(gcc_lpass_q6_axi_clk.c),
1364 },
1365};
1366
1367static struct branch_clk gcc_mmss_noc_cfg_ahb_clk = {
1368 .cbcr_reg = MMSS_NOC_CFG_AHB_CBCR,
1369 .has_sibling = 1,
1370 .base = &virt_bases[GCC_BASE],
1371 .c = {
1372 .dbg_name = "gcc_mmss_noc_cfg_ahb_clk",
1373 .ops = &clk_ops_branch,
1374 CLK_INIT(gcc_mmss_noc_cfg_ahb_clk.c),
1375 },
1376};
1377
1378static struct branch_clk gcc_mss_cfg_ahb_clk = {
1379 .cbcr_reg = MSS_CFG_AHB_CBCR,
1380 .has_sibling = 1,
1381 .base = &virt_bases[GCC_BASE],
1382 .c = {
1383 .dbg_name = "gcc_mss_cfg_ahb_clk",
1384 .ops = &clk_ops_branch,
1385 CLK_INIT(gcc_mss_cfg_ahb_clk.c),
1386 },
1387};
1388
1389static struct branch_clk gcc_mss_q6_bimc_axi_clk = {
1390 .cbcr_reg = MSS_Q6_BIMC_AXI_CBCR,
1391 .has_sibling = 1,
1392 .base = &virt_bases[GCC_BASE],
1393 .c = {
1394 .dbg_name = "gcc_mss_q6_bimc_axi_clk",
1395 .ops = &clk_ops_branch,
1396 CLK_INIT(gcc_mss_q6_bimc_axi_clk.c),
1397 },
1398};
1399
1400static struct branch_clk gcc_pdm2_clk = {
1401 .cbcr_reg = PDM2_CBCR,
1402 .has_sibling = 0,
1403 .base = &virt_bases[GCC_BASE],
1404 .c = {
1405 .parent = &pdm2_clk_src.c,
1406 .dbg_name = "gcc_pdm2_clk",
1407 .ops = &clk_ops_branch,
1408 CLK_INIT(gcc_pdm2_clk.c),
1409 },
1410};
1411
1412static struct branch_clk gcc_pdm_ahb_clk = {
1413 .cbcr_reg = PDM_AHB_CBCR,
1414 .has_sibling = 1,
1415 .base = &virt_bases[GCC_BASE],
1416 .c = {
1417 .dbg_name = "gcc_pdm_ahb_clk",
1418 .ops = &clk_ops_branch,
1419 CLK_INIT(gcc_pdm_ahb_clk.c),
1420 },
1421};
1422
1423static struct local_vote_clk gcc_prng_ahb_clk = {
1424 .cbcr_reg = PRNG_AHB_CBCR,
1425 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1426 .en_mask = BIT(13),
1427 .base = &virt_bases[GCC_BASE],
1428 .c = {
1429 .dbg_name = "gcc_prng_ahb_clk",
1430 .ops = &clk_ops_vote,
1431 CLK_INIT(gcc_prng_ahb_clk.c),
1432 },
1433};
1434
1435static struct branch_clk gcc_sdcc1_ahb_clk = {
1436 .cbcr_reg = SDCC1_AHB_CBCR,
1437 .has_sibling = 1,
1438 .base = &virt_bases[GCC_BASE],
1439 .c = {
1440 .dbg_name = "gcc_sdcc1_ahb_clk",
1441 .ops = &clk_ops_branch,
1442 CLK_INIT(gcc_sdcc1_ahb_clk.c),
1443 },
1444};
1445
1446static struct branch_clk gcc_sdcc1_apps_clk = {
1447 .cbcr_reg = SDCC1_APPS_CBCR,
1448 .has_sibling = 0,
1449 .base = &virt_bases[GCC_BASE],
1450 .c = {
1451 .parent = &sdcc1_apps_clk_src.c,
1452 .dbg_name = "gcc_sdcc1_apps_clk",
1453 .ops = &clk_ops_branch,
1454 CLK_INIT(gcc_sdcc1_apps_clk.c),
1455 },
1456};
1457
1458static struct branch_clk gcc_sdcc2_ahb_clk = {
1459 .cbcr_reg = SDCC2_AHB_CBCR,
1460 .has_sibling = 1,
1461 .base = &virt_bases[GCC_BASE],
1462 .c = {
1463 .dbg_name = "gcc_sdcc2_ahb_clk",
1464 .ops = &clk_ops_branch,
1465 CLK_INIT(gcc_sdcc2_ahb_clk.c),
1466 },
1467};
1468
1469static struct branch_clk gcc_sdcc2_apps_clk = {
1470 .cbcr_reg = SDCC2_APPS_CBCR,
1471 .has_sibling = 0,
1472 .base = &virt_bases[GCC_BASE],
1473 .c = {
1474 .parent = &sdcc2_apps_clk_src.c,
1475 .dbg_name = "gcc_sdcc2_apps_clk",
1476 .ops = &clk_ops_branch,
1477 CLK_INIT(gcc_sdcc2_apps_clk.c),
1478 },
1479};
1480
1481static struct branch_clk gcc_usb2a_phy_sleep_clk = {
1482 .cbcr_reg = USB2A_PHY_SLEEP_CBCR,
1483 .has_sibling = 1,
1484 .base = &virt_bases[GCC_BASE],
1485 .c = {
1486 .dbg_name = "gcc_usb2a_phy_sleep_clk",
1487 .ops = &clk_ops_branch,
1488 CLK_INIT(gcc_usb2a_phy_sleep_clk.c),
1489 },
1490};
1491
1492static struct branch_clk gcc_usb_hs_ahb_clk = {
1493 .cbcr_reg = USB_HS_AHB_CBCR,
1494 .has_sibling = 1,
1495 .base = &virt_bases[GCC_BASE],
1496 .c = {
1497 .dbg_name = "gcc_usb_hs_ahb_clk",
1498 .ops = &clk_ops_branch,
1499 CLK_INIT(gcc_usb_hs_ahb_clk.c),
1500 },
1501};
1502
1503static struct branch_clk gcc_usb_hs_system_clk = {
1504 .cbcr_reg = USB_HS_SYSTEM_CBCR,
1505 .has_sibling = 0,
1506 .bcr_reg = USB_HS_BCR,
1507 .base = &virt_bases[GCC_BASE],
1508 .c = {
1509 .parent = &usb_hs_system_clk_src.c,
1510 .dbg_name = "gcc_usb_hs_system_clk",
1511 .ops = &clk_ops_branch,
1512 CLK_INIT(gcc_usb_hs_system_clk.c),
1513 },
1514};
1515
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07001516static struct branch_clk gcc_bimc_smmu_clk = {
1517 .cbcr_reg = BIMC_SMMU_CBCR,
1518 .has_sibling = 0,
1519 .base = &virt_bases[GCC_BASE],
1520 .c = {
1521 .dbg_name = "gcc_bimc_smmu_clk",
1522 .ops = &clk_ops_branch,
1523 CLK_INIT(gcc_bimc_smmu_clk.c),
1524 },
1525};
1526
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001527static struct clk_freq_tbl ftbl_csi0_1_clk[] = {
1528 F_MM(100000000, gpll0, 6, 0, 0),
1529 F_MM(200000000, mmpll0, 4, 0, 0),
1530 F_END,
1531};
1532
1533static struct rcg_clk csi0_clk_src = {
1534 .cmd_rcgr_reg = CSI0_CMD_RCGR,
1535 .set_rate = set_rate_hid,
1536 .freq_tbl = ftbl_csi0_1_clk,
1537 .current_freq = &rcg_dummy_freq,
1538 .base = &virt_bases[MMSS_BASE],
1539 .c = {
1540 .dbg_name = "csi0_clk_src",
1541 .ops = &clk_ops_rcg,
1542 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1543 CLK_INIT(csi0_clk_src.c),
1544 },
1545};
1546
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001547static struct clk_freq_tbl ftbl_mmss_mmssnoc_axi_clk[] = {
1548 F_MM( 19200000, gcc_xo, 1, 0, 0),
1549 F_MM( 37500000, gpll0, 16, 0, 0),
1550 F_MM( 50000000, gpll0, 12, 0, 0),
1551 F_MM( 75000000, gpll0, 8, 0, 0),
1552 F_MM(100000000, gpll0, 6, 0, 0),
1553 F_MM(150000000, gpll0, 4, 0, 0),
1554 F_MM(200000000, mmpll0, 4, 0, 0),
1555 F_END,
1556};
1557
1558static struct rcg_clk axi_clk_src = {
1559 .cmd_rcgr_reg = AXI_CMD_RCGR,
1560 .set_rate = set_rate_hid,
1561 .freq_tbl = ftbl_mmss_mmssnoc_axi_clk,
1562 .current_freq = &rcg_dummy_freq,
1563 .base = &virt_bases[MMSS_BASE],
1564 .c = {
1565 .dbg_name = "axi_clk_src",
1566 .ops = &clk_ops_rcg,
1567 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1568 CLK_INIT(axi_clk_src.c),
1569 },
1570};
1571
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08001572static DEFINE_CLK_VOTER(mdp_axi_clk_src, &axi_clk_src.c, 200000000);
1573static DEFINE_CLK_VOTER(mmssnoc_axi_clk_src, &axi_clk_src.c, 200000000);
1574
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001575static struct clk_ops dsi_byte_clk_src_ops;
1576static struct clk_ops dsi_pixel_clk_src_ops;
1577static struct clk_ops dsi_dsi_clk_src_ops;
1578
1579static struct dsi_pll_vco_clk dsi_vco = {
1580 .vco_clk_min = 600000000,
1581 .vco_clk_max = 1200000000,
1582 .pref_div_ratio = 26,
1583 .c = {
1584 .parent = &gcc_xo_clk_src.c,
1585 .dbg_name = "dsi_vco",
1586 .ops = &clk_ops_dsi_vco,
1587 CLK_INIT(dsi_vco.c),
1588 },
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001589};
1590
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001591static struct clk dsi_pll_byte = {
1592 .parent = &dsi_vco.c,
1593 .dbg_name = "dsi_pll_byte",
1594 .ops = &clk_ops_dsi_byteclk,
1595 CLK_INIT(dsi_pll_byte),
1596};
1597
1598static struct clk dsi_pll_pixel = {
1599 .parent = &dsi_vco.c,
1600 .dbg_name = "dsi_pll_pixel",
1601 .ops = &clk_ops_dsi_dsiclk,
1602 CLK_INIT(dsi_pll_pixel),
1603};
1604
1605static struct clk_freq_tbl pixel_freq_tbl[] = {
1606 {
1607 .src_clk = &dsi_pll_pixel,
1608 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1609 },
1610 F_END
1611};
1612
1613#define CFG_RCGR_DIV_MASK BM(4, 0)
1614
1615static int set_rate_pixel_byte_clk(struct clk *clk, unsigned long rate)
1616{
1617 struct rcg_clk *rcg = to_rcg_clk(clk);
1618 struct clk *pll = clk->parent;
1619 unsigned long source_rate, div;
1620 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1621 int rc;
1622
1623 if (rate == 0)
1624 return clk_set_rate(pll, 0);
1625
1626 source_rate = clk_round_rate(pll, rate);
1627 if (!source_rate || ((2 * source_rate) % rate))
1628 return -EINVAL;
1629
1630 div = ((2 * source_rate)/rate) - 1;
1631 if (div > CFG_RCGR_DIV_MASK)
1632 return -EINVAL;
1633
1634 rc = clk_set_rate(pll, source_rate);
1635 if (rc)
1636 return rc;
1637
1638 cur_freq->div_src_val &= ~CFG_RCGR_DIV_MASK;
1639 cur_freq->div_src_val |= BVAL(4, 0, div);
1640 rcg->set_rate(rcg, cur_freq);
1641
1642 return 0;
1643}
1644
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001645static struct rcg_clk dsi_pclk_clk_src = {
1646 .cmd_rcgr_reg = DSI_PCLK_CMD_RCGR,
1647 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001648 .current_freq = pixel_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001649 .base = &virt_bases[MMSS_BASE],
1650 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001651 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001652 .dbg_name = "dsi_pclk_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001653 .ops = &dsi_pixel_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001654 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 103330000),
1655 CLK_INIT(dsi_pclk_clk_src.c),
1656 },
1657};
1658
1659static struct clk_freq_tbl ftbl_oxili_gfx3d_clk[] = {
1660 F_MM( 19200000, gcc_xo, 1, 0, 0),
1661 F_MM( 37500000, gpll0, 16, 0, 0),
1662 F_MM( 50000000, gpll0, 12, 0, 0),
1663 F_MM( 75000000, gpll0, 8, 0, 0),
1664 F_MM(100000000, gpll0, 6, 0, 0),
1665 F_MM(150000000, gpll0, 4, 0, 0),
1666 F_MM(200000000, gpll0, 3, 0, 0),
1667 F_MM(300000000, gpll0, 2, 0, 0),
1668 F_MM(400000000, mmpll1, 3, 0, 0),
1669 F_END,
1670};
1671
1672static struct rcg_clk gfx3d_clk_src = {
1673 .cmd_rcgr_reg = GFX3D_CMD_RCGR,
1674 .set_rate = set_rate_hid,
1675 .freq_tbl = ftbl_oxili_gfx3d_clk,
1676 .current_freq = &rcg_dummy_freq,
1677 .base = &virt_bases[MMSS_BASE],
1678 .c = {
1679 .dbg_name = "gfx3d_clk_src",
1680 .ops = &clk_ops_rcg,
1681 VDD_DIG_FMAX_MAP3(LOW, 150000000, NOMINAL, 300000000, HIGH,
1682 400000000),
1683 CLK_INIT(gfx3d_clk_src.c),
1684 },
1685};
1686
1687static struct clk_freq_tbl ftbl_vfe_clk[] = {
1688 F_MM( 37500000, gpll0, 16, 0, 0),
1689 F_MM( 50000000, gpll0, 12, 0, 0),
1690 F_MM( 60000000, gpll0, 10, 0, 0),
1691 F_MM( 80000000, gpll0, 7.5, 0, 0),
1692 F_MM(100000000, gpll0, 6, 0, 0),
1693 F_MM(109090000, gpll0, 5.5, 0, 0),
1694 F_MM(133330000, gpll0, 4.5, 0, 0),
1695 F_MM(200000000, gpll0, 3, 0, 0),
1696 F_MM(228570000, mmpll0, 3.5, 0, 0),
1697 F_MM(266670000, mmpll0, 3, 0, 0),
1698 F_MM(320000000, mmpll0, 2.5, 0, 0),
1699 F_END,
1700};
1701
1702static struct rcg_clk vfe_clk_src = {
1703 .cmd_rcgr_reg = VFE_CMD_RCGR,
1704 .set_rate = set_rate_hid,
1705 .freq_tbl = ftbl_vfe_clk,
1706 .current_freq = &rcg_dummy_freq,
1707 .base = &virt_bases[MMSS_BASE],
1708 .c = {
1709 .dbg_name = "vfe_clk_src",
1710 .ops = &clk_ops_rcg,
1711 VDD_DIG_FMAX_MAP3(LOW, 133330000, NOMINAL, 266670000, HIGH,
1712 320000000),
1713 CLK_INIT(vfe_clk_src.c),
1714 },
1715};
1716
1717static struct rcg_clk csi1_clk_src = {
1718 .cmd_rcgr_reg = CSI1_CMD_RCGR,
1719 .set_rate = set_rate_hid,
1720 .freq_tbl = ftbl_csi0_1_clk,
1721 .current_freq = &rcg_dummy_freq,
1722 .base = &virt_bases[MMSS_BASE],
1723 .c = {
1724 .dbg_name = "csi1_clk_src",
1725 .ops = &clk_ops_rcg,
1726 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1727 CLK_INIT(csi1_clk_src.c),
1728 },
1729};
1730
1731static struct clk_freq_tbl ftbl_csi0_1phytimer_clk[] = {
1732 F_MM(100000000, gpll0, 6, 0, 0),
1733 F_MM(200000000, mmpll0, 4, 0, 0),
1734 F_END,
1735};
1736
1737static struct rcg_clk csi0phytimer_clk_src = {
1738 .cmd_rcgr_reg = CSI0PHYTIMER_CMD_RCGR,
1739 .set_rate = set_rate_hid,
1740 .freq_tbl = ftbl_csi0_1phytimer_clk,
1741 .current_freq = &rcg_dummy_freq,
1742 .base = &virt_bases[MMSS_BASE],
1743 .c = {
1744 .dbg_name = "csi0phytimer_clk_src",
1745 .ops = &clk_ops_rcg,
1746 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1747 CLK_INIT(csi0phytimer_clk_src.c),
1748 },
1749};
1750
1751static struct rcg_clk csi1phytimer_clk_src = {
1752 .cmd_rcgr_reg = CSI1PHYTIMER_CMD_RCGR,
1753 .set_rate = set_rate_hid,
1754 .freq_tbl = ftbl_csi0_1phytimer_clk,
1755 .current_freq = &rcg_dummy_freq,
1756 .base = &virt_bases[MMSS_BASE],
1757 .c = {
1758 .dbg_name = "csi1phytimer_clk_src",
1759 .ops = &clk_ops_rcg,
1760 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1761 CLK_INIT(csi1phytimer_clk_src.c),
1762 },
1763};
1764
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001765/*
1766 * The DSI clock will always use a divider of 1. However, we still
1767 * need to set the right voltage and source.
1768 */
1769static int set_rate_dsi_clk(struct clk *clk, unsigned long rate)
1770{
1771 struct rcg_clk *rcg = to_rcg_clk(clk);
1772 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1773
1774 rcg->set_rate(rcg, cur_freq);
1775
1776 return 0;
1777}
1778
1779static struct clk_freq_tbl dsi_freq_tbl[] = {
1780 {
1781 .src_clk = &dsi_pll_pixel,
1782 .div_src_val = BVAL(4, 0, 0) |
1783 BVAL(10, 8, dsipll_mm_source_val),
1784 },
1785 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001786};
1787
1788static struct rcg_clk dsi_clk_src = {
1789 .cmd_rcgr_reg = DSI_CMD_RCGR,
1790 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001791 .current_freq = dsi_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001792 .base = &virt_bases[MMSS_BASE],
1793 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001794 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001795 .dbg_name = "dsi_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001796 .ops = &dsi_dsi_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001797 VDD_DIG_FMAX_MAP2(LOW, 155000000, NOMINAL, 310000000),
1798 CLK_INIT(dsi_clk_src.c),
1799 },
1800};
1801
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001802static struct clk_freq_tbl byte_freq_tbl[] = {
1803 {
1804 .src_clk = &dsi_pll_byte,
1805 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1806 },
1807 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001808};
1809
1810static struct rcg_clk dsi_byte_clk_src = {
1811 .cmd_rcgr_reg = DSI_BYTE_CMD_RCGR,
1812 .set_rate = set_rate_hid,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001813 .current_freq = byte_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001814 .base = &virt_bases[MMSS_BASE],
1815 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001816 .parent = &dsi_pll_byte,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001817 .dbg_name = "dsi_byte_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001818 .ops = &dsi_byte_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001819 VDD_DIG_FMAX_MAP2(LOW, 62500000, NOMINAL, 125000000),
1820 CLK_INIT(dsi_byte_clk_src.c),
1821 },
1822};
1823
1824static struct clk_freq_tbl ftbl_dsi_esc_clk[] = {
1825 F_MM(19200000, gcc_xo, 1, 0, 0),
1826 F_END,
1827};
1828
1829static struct rcg_clk dsi_esc_clk_src = {
1830 .cmd_rcgr_reg = DSI_ESC_CMD_RCGR,
1831 .set_rate = set_rate_hid,
1832 .freq_tbl = ftbl_dsi_esc_clk,
1833 .current_freq = &rcg_dummy_freq,
1834 .base = &virt_bases[MMSS_BASE],
1835 .c = {
1836 .dbg_name = "dsi_esc_clk_src",
1837 .ops = &clk_ops_rcg,
1838 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1839 CLK_INIT(dsi_esc_clk_src.c),
1840 },
1841};
1842
1843static struct clk_freq_tbl ftbl_mclk0_1_clk[] = {
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07001844 F_MM(24000000, gpll0, 5, 1, 5),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001845 F_MM(66670000, gpll0, 9, 0, 0),
1846 F_END,
1847};
1848
1849static struct rcg_clk mclk0_clk_src = {
1850 .cmd_rcgr_reg = MCLK0_CMD_RCGR,
1851 .set_rate = set_rate_mnd,
1852 .freq_tbl = ftbl_mclk0_1_clk,
1853 .current_freq = &rcg_dummy_freq,
1854 .base = &virt_bases[MMSS_BASE],
1855 .c = {
1856 .dbg_name = "mclk0_clk_src",
1857 .ops = &clk_ops_rcg_mnd,
1858 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1859 CLK_INIT(mclk0_clk_src.c),
1860 },
1861};
1862
1863static struct rcg_clk mclk1_clk_src = {
1864 .cmd_rcgr_reg = MCLK1_CMD_RCGR,
1865 .set_rate = set_rate_mnd,
1866 .freq_tbl = ftbl_mclk0_1_clk,
1867 .current_freq = &rcg_dummy_freq,
1868 .base = &virt_bases[MMSS_BASE],
1869 .c = {
1870 .dbg_name = "mclk1_clk_src",
1871 .ops = &clk_ops_rcg_mnd,
1872 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1873 CLK_INIT(mclk1_clk_src.c),
1874 },
1875};
1876
1877static struct clk_freq_tbl ftbl_mdp_vsync_clk[] = {
1878 F_MM(19200000, gcc_xo, 1, 0, 0),
1879 F_END,
1880};
1881
1882static struct rcg_clk mdp_vsync_clk_src = {
1883 .cmd_rcgr_reg = MDP_VSYNC_CMD_RCGR,
1884 .set_rate = set_rate_hid,
1885 .freq_tbl = ftbl_mdp_vsync_clk,
1886 .current_freq = &rcg_dummy_freq,
1887 .base = &virt_bases[MMSS_BASE],
1888 .c = {
1889 .dbg_name = "mdp_vsync_clk_src",
1890 .ops = &clk_ops_rcg,
1891 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1892 CLK_INIT(mdp_vsync_clk_src.c),
1893 },
1894};
1895
1896static struct branch_clk bimc_gfx_clk = {
1897 .cbcr_reg = BIMC_GFX_CBCR,
1898 .has_sibling = 1,
1899 .base = &virt_bases[MMSS_BASE],
1900 .c = {
1901 .dbg_name = "bimc_gfx_clk",
1902 .ops = &clk_ops_branch,
1903 CLK_INIT(bimc_gfx_clk.c),
1904 },
1905};
1906
1907static struct branch_clk csi0_clk = {
1908 .cbcr_reg = CSI0_CBCR,
1909 .has_sibling = 1,
1910 .base = &virt_bases[MMSS_BASE],
1911 .c = {
1912 .parent = &csi0_clk_src.c,
1913 .dbg_name = "csi0_clk",
1914 .ops = &clk_ops_branch,
1915 CLK_INIT(csi0_clk.c),
1916 },
1917};
1918
1919static struct branch_clk csi0phy_clk = {
1920 .cbcr_reg = CSI0PHY_CBCR,
1921 .has_sibling = 1,
1922 .base = &virt_bases[MMSS_BASE],
1923 .c = {
1924 .parent = &csi0_clk_src.c,
1925 .dbg_name = "csi0phy_clk",
1926 .ops = &clk_ops_branch,
1927 CLK_INIT(csi0phy_clk.c),
1928 },
1929};
1930
1931static struct branch_clk csi0phytimer_clk = {
1932 .cbcr_reg = CSI0PHYTIMER_CBCR,
1933 .has_sibling = 0,
1934 .base = &virt_bases[MMSS_BASE],
1935 .c = {
1936 .parent = &csi0phytimer_clk_src.c,
1937 .dbg_name = "csi0phytimer_clk",
1938 .ops = &clk_ops_branch,
1939 CLK_INIT(csi0phytimer_clk.c),
1940 },
1941};
1942
1943static struct branch_clk csi0pix_clk = {
1944 .cbcr_reg = CSI0PIX_CBCR,
1945 .has_sibling = 1,
1946 .base = &virt_bases[MMSS_BASE],
1947 .c = {
1948 .parent = &csi0_clk_src.c,
1949 .dbg_name = "csi0pix_clk",
1950 .ops = &clk_ops_branch,
1951 CLK_INIT(csi0pix_clk.c),
1952 },
1953};
1954
1955static struct branch_clk csi0rdi_clk = {
1956 .cbcr_reg = CSI0RDI_CBCR,
1957 .has_sibling = 1,
1958 .base = &virt_bases[MMSS_BASE],
1959 .c = {
1960 .parent = &csi0_clk_src.c,
1961 .dbg_name = "csi0rdi_clk",
1962 .ops = &clk_ops_branch,
1963 CLK_INIT(csi0rdi_clk.c),
1964 },
1965};
1966
1967static struct branch_clk csi1_clk = {
1968 .cbcr_reg = CSI1_CBCR,
1969 .has_sibling = 1,
1970 .base = &virt_bases[MMSS_BASE],
1971 .c = {
1972 .parent = &csi1_clk_src.c,
1973 .dbg_name = "csi1_clk",
1974 .ops = &clk_ops_branch,
1975 CLK_INIT(csi1_clk.c),
1976 },
1977};
1978
1979static struct branch_clk csi1phy_clk = {
1980 .cbcr_reg = CSI1PHY_CBCR,
1981 .has_sibling = 1,
1982 .base = &virt_bases[MMSS_BASE],
1983 .c = {
1984 .parent = &csi1_clk_src.c,
1985 .dbg_name = "csi1phy_clk",
1986 .ops = &clk_ops_branch,
1987 CLK_INIT(csi1phy_clk.c),
1988 },
1989};
1990
1991static struct branch_clk csi1phytimer_clk = {
1992 .cbcr_reg = CSI1PHYTIMER_CBCR,
1993 .has_sibling = 0,
1994 .base = &virt_bases[MMSS_BASE],
1995 .c = {
1996 .parent = &csi1phytimer_clk_src.c,
1997 .dbg_name = "csi1phytimer_clk",
1998 .ops = &clk_ops_branch,
1999 CLK_INIT(csi1phytimer_clk.c),
2000 },
2001};
2002
2003static struct branch_clk csi1pix_clk = {
2004 .cbcr_reg = CSI1PIX_CBCR,
2005 .has_sibling = 1,
2006 .base = &virt_bases[MMSS_BASE],
2007 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002008 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002009 .dbg_name = "csi1pix_clk",
2010 .ops = &clk_ops_branch,
2011 CLK_INIT(csi1pix_clk.c),
2012 },
2013};
2014
2015static struct branch_clk csi1rdi_clk = {
2016 .cbcr_reg = CSI1RDI_CBCR,
2017 .has_sibling = 1,
2018 .base = &virt_bases[MMSS_BASE],
2019 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002020 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002021 .dbg_name = "csi1rdi_clk",
2022 .ops = &clk_ops_branch,
2023 CLK_INIT(csi1rdi_clk.c),
2024 },
2025};
2026
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002027static struct mux_clk csi0phy_cam_mux_clk = {
2028 .ops = &mux_reg_ops,
2029 .en_mask = BIT(11),
2030 .mask = 0x1,
2031 .shift = 9,
2032 .offset = MMSS_CAMSS_MISC,
2033 MUX_SRC_LIST(
2034 { &csi0phy_clk.c, 0 },
2035 { &csi1phy_clk.c, 1 },
2036 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002037 .base = &virt_bases[MMSS_BASE],
2038 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002039 .dbg_name = "csi0phy_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002040 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002041 CLK_INIT(csi0phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002042 },
2043};
2044
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002045static struct mux_clk csi1phy_cam_mux_clk = {
2046 .ops = &mux_reg_ops,
2047 .en_mask = BIT(10),
2048 .mask = 0x1,
2049 .shift = 8,
2050 .offset = MMSS_CAMSS_MISC,
2051 MUX_SRC_LIST(
2052 { &csi0phy_clk.c, 0 },
2053 { &csi1phy_clk.c, 1 },
2054 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002055 .base = &virt_bases[MMSS_BASE],
2056 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002057 .dbg_name = "csi1phy_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002058 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002059 CLK_INIT(csi1phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002060 },
2061};
2062
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002063static struct mux_clk csi0pix_cam_mux_clk = {
2064 .ops = &mux_reg_ops,
2065 .en_mask = BIT(7),
2066 .mask = 0x1,
2067 .shift = 3,
2068 .offset = MMSS_CAMSS_MISC,
2069 MUX_SRC_LIST(
2070 { &csi0pix_clk.c, 0 },
2071 { &csi1pix_clk.c, 1 },
2072 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002073 .base = &virt_bases[MMSS_BASE],
2074 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002075 .dbg_name = "csi0pix_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002076 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002077 CLK_INIT(csi0pix_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002078 },
2079};
2080
2081
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002082static struct mux_clk rdi2_cam_mux_clk = {
2083 .ops = &mux_reg_ops,
2084 .en_mask = BIT(6),
2085 .mask = 0x1,
2086 .shift = 2,
2087 .offset = MMSS_CAMSS_MISC,
2088 MUX_SRC_LIST(
2089 { &csi0rdi_clk.c, 0 },
2090 { &csi1rdi_clk.c, 1 },
2091 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002092 .base = &virt_bases[MMSS_BASE],
2093 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002094 .dbg_name = "rdi2_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002095 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002096 CLK_INIT(rdi2_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002097 },
2098};
2099
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002100static struct mux_clk rdi1_cam_mux_clk = {
2101 .ops = &mux_reg_ops,
2102 .en_mask = BIT(5),
2103 .mask = 0x1,
2104 .shift = 1,
2105 .offset = MMSS_CAMSS_MISC,
2106 MUX_SRC_LIST(
2107 { &csi0rdi_clk.c, 0 },
2108 { &csi1rdi_clk.c, 1 },
2109 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002110 .base = &virt_bases[MMSS_BASE],
2111 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002112 .dbg_name = "rdi1_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002113 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002114 CLK_INIT(rdi1_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002115 },
2116};
2117
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002118static struct mux_clk rdi0_cam_mux_clk = {
2119 .ops = &mux_reg_ops,
2120 .en_mask = BIT(4),
2121 .mask = 0x1,
2122 .shift = 0,
2123 .offset = MMSS_CAMSS_MISC,
2124 MUX_SRC_LIST(
2125 { &csi0rdi_clk.c, 0 },
2126 { &csi1rdi_clk.c, 1 },
2127 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002128 .base = &virt_bases[MMSS_BASE],
2129 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002130 .dbg_name = "rdi0_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002131 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002132 CLK_INIT(rdi0_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002133 },
2134};
2135
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002136static struct branch_clk csi_ahb_clk = {
2137 .cbcr_reg = CSI_AHB_CBCR,
2138 .has_sibling = 1,
2139 .base = &virt_bases[MMSS_BASE],
2140 .c = {
2141 .dbg_name = "csi_ahb_clk",
2142 .ops = &clk_ops_branch,
2143 CLK_INIT(csi_ahb_clk.c),
2144 },
2145};
2146
2147static struct branch_clk csi_vfe_clk = {
2148 .cbcr_reg = CSI_VFE_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002149 .bcr_reg = CSI_VFE_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002150 .has_sibling = 1,
2151 .base = &virt_bases[MMSS_BASE],
2152 .c = {
2153 .parent = &vfe_clk_src.c,
2154 .dbg_name = "csi_vfe_clk",
2155 .ops = &clk_ops_branch,
2156 CLK_INIT(csi_vfe_clk.c),
2157 },
2158};
2159
2160static struct branch_clk dsi_clk = {
2161 .cbcr_reg = DSI_CBCR,
2162 .has_sibling = 0,
2163 .base = &virt_bases[MMSS_BASE],
2164 .c = {
2165 .parent = &dsi_clk_src.c,
2166 .dbg_name = "dsi_clk",
2167 .ops = &clk_ops_branch,
2168 CLK_INIT(dsi_clk.c),
2169 },
2170};
2171
2172static struct branch_clk dsi_ahb_clk = {
2173 .cbcr_reg = DSI_AHB_CBCR,
2174 .has_sibling = 1,
2175 .base = &virt_bases[MMSS_BASE],
2176 .c = {
2177 .dbg_name = "dsi_ahb_clk",
2178 .ops = &clk_ops_branch,
2179 CLK_INIT(dsi_ahb_clk.c),
2180 },
2181};
2182
2183static struct branch_clk dsi_byte_clk = {
2184 .cbcr_reg = DSI_BYTE_CBCR,
2185 .has_sibling = 0,
2186 .base = &virt_bases[MMSS_BASE],
2187 .c = {
2188 .parent = &dsi_byte_clk_src.c,
2189 .dbg_name = "dsi_byte_clk",
2190 .ops = &clk_ops_branch,
2191 CLK_INIT(dsi_byte_clk.c),
2192 },
2193};
2194
2195static struct branch_clk dsi_esc_clk = {
2196 .cbcr_reg = DSI_ESC_CBCR,
2197 .has_sibling = 0,
2198 .base = &virt_bases[MMSS_BASE],
2199 .c = {
2200 .parent = &dsi_esc_clk_src.c,
2201 .dbg_name = "dsi_esc_clk",
2202 .ops = &clk_ops_branch,
2203 CLK_INIT(dsi_esc_clk.c),
2204 },
2205};
2206
2207static struct branch_clk dsi_pclk_clk = {
2208 .cbcr_reg = DSI_PCLK_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002209 .base = &virt_bases[MMSS_BASE],
2210 .c = {
2211 .parent = &dsi_pclk_clk_src.c,
2212 .dbg_name = "dsi_pclk_clk",
2213 .ops = &clk_ops_branch,
2214 CLK_INIT(dsi_pclk_clk.c),
2215 },
2216};
2217
2218static struct branch_clk gmem_gfx3d_clk = {
2219 .cbcr_reg = GMEM_GFX3D_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002220 .bcr_reg = GMEM_GFX3D_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002221 .has_sibling = 1,
2222 .base = &virt_bases[MMSS_BASE],
2223 .c = {
2224 .parent = &gfx3d_clk_src.c,
2225 .dbg_name = "gmem_gfx3d_clk",
2226 .ops = &clk_ops_branch,
2227 CLK_INIT(gmem_gfx3d_clk.c),
2228 },
2229};
2230
2231static struct branch_clk mclk0_clk = {
2232 .cbcr_reg = MCLK0_CBCR,
2233 .has_sibling = 0,
2234 .base = &virt_bases[MMSS_BASE],
2235 .c = {
2236 .parent = &mclk0_clk_src.c,
2237 .dbg_name = "mclk0_clk",
2238 .ops = &clk_ops_branch,
2239 CLK_INIT(mclk0_clk.c),
2240 },
2241};
2242
2243static struct branch_clk mclk1_clk = {
2244 .cbcr_reg = MCLK1_CBCR,
2245 .has_sibling = 0,
2246 .base = &virt_bases[MMSS_BASE],
2247 .c = {
2248 .parent = &mclk1_clk_src.c,
2249 .dbg_name = "mclk1_clk",
2250 .ops = &clk_ops_branch,
2251 CLK_INIT(mclk1_clk.c),
2252 },
2253};
2254
2255static struct branch_clk mdp_ahb_clk = {
2256 .cbcr_reg = MDP_AHB_CBCR,
2257 .has_sibling = 1,
2258 .base = &virt_bases[MMSS_BASE],
2259 .c = {
2260 .dbg_name = "mdp_ahb_clk",
2261 .ops = &clk_ops_branch,
2262 CLK_INIT(mdp_ahb_clk.c),
2263 },
2264};
2265
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002266static struct branch_clk mmss_mmssnoc_axi_clk;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002267static struct branch_clk mdp_axi_clk = {
2268 .cbcr_reg = MDP_AXI_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002269 .base = &virt_bases[MMSS_BASE],
2270 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002271 .parent = &mdp_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002272 .dbg_name = "mdp_axi_clk",
2273 .ops = &clk_ops_branch,
2274 CLK_INIT(mdp_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002275 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002276 },
2277};
2278
2279static struct branch_clk mdp_dsi_clk = {
2280 .cbcr_reg = MDP_DSI_CBCR,
2281 .has_sibling = 1,
2282 .base = &virt_bases[MMSS_BASE],
2283 .c = {
2284 .parent = &dsi_pclk_clk_src.c,
2285 .dbg_name = "mdp_dsi_clk",
2286 .ops = &clk_ops_branch,
2287 CLK_INIT(mdp_dsi_clk.c),
2288 },
2289};
2290
2291static struct branch_clk mdp_lcdc_clk = {
2292 .cbcr_reg = MDP_LCDC_CBCR,
2293 .has_sibling = 1,
2294 .base = &virt_bases[MMSS_BASE],
2295 .c = {
2296 .parent = &dsi_pclk_clk_src.c,
2297 .dbg_name = "mdp_lcdc_clk",
2298 .ops = &clk_ops_branch,
2299 CLK_INIT(mdp_lcdc_clk.c),
2300 },
2301};
2302
2303static struct branch_clk mdp_vsync_clk = {
2304 .cbcr_reg = MDP_VSYNC_CBCR,
2305 .has_sibling = 0,
2306 .base = &virt_bases[MMSS_BASE],
2307 .c = {
2308 .parent = &mdp_vsync_clk_src.c,
2309 .dbg_name = "mdp_vsync_clk",
2310 .ops = &clk_ops_branch,
2311 CLK_INIT(mdp_vsync_clk.c),
2312 },
2313};
2314
2315static struct branch_clk mmss_misc_ahb_clk = {
2316 .cbcr_reg = MMSS_MISC_AHB_CBCR,
2317 .has_sibling = 1,
2318 .base = &virt_bases[MMSS_BASE],
2319 .c = {
2320 .dbg_name = "mmss_misc_ahb_clk",
2321 .ops = &clk_ops_branch,
2322 CLK_INIT(mmss_misc_ahb_clk.c),
2323 },
2324};
2325
2326static struct branch_clk mmss_mmssnoc_axi_clk = {
2327 .cbcr_reg = MMSS_MMSSNOC_AXI_CBCR,
2328 .has_sibling = 1,
2329 .base = &virt_bases[MMSS_BASE],
2330 .c = {
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002331 .parent = &axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002332 .dbg_name = "mmss_mmssnoc_axi_clk",
2333 .ops = &clk_ops_branch,
2334 CLK_INIT(mmss_mmssnoc_axi_clk.c),
2335 },
2336};
2337
2338static struct branch_clk mmss_s0_axi_clk = {
2339 .cbcr_reg = MMSS_S0_AXI_CBCR,
2340 .has_sibling = 0,
2341 .base = &virt_bases[MMSS_BASE],
2342 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002343 .parent = &mmssnoc_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002344 .dbg_name = "mmss_s0_axi_clk",
2345 .ops = &clk_ops_branch,
2346 CLK_INIT(mmss_s0_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002347 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002348 },
2349};
2350
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002351static struct branch_clk oxili_ahb_clk = {
2352 .cbcr_reg = OXILI_AHB_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002353 .bcr_reg = OXILI_AHB_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002354 .has_sibling = 1,
2355 .base = &virt_bases[MMSS_BASE],
2356 .c = {
2357 .dbg_name = "oxili_ahb_clk",
2358 .ops = &clk_ops_branch,
2359 CLK_INIT(oxili_ahb_clk.c),
2360 },
2361};
2362
2363static struct branch_clk oxili_gfx3d_clk = {
2364 .cbcr_reg = OXILI_GFX3D_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002365 .bcr_reg = OXILI_GFX3D_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002366 .has_sibling = 0,
2367 .base = &virt_bases[MMSS_BASE],
2368 .c = {
2369 .parent = &gfx3d_clk_src.c,
2370 .dbg_name = "oxili_gfx3d_clk",
2371 .ops = &clk_ops_branch,
2372 CLK_INIT(oxili_gfx3d_clk.c),
2373 },
2374};
2375
2376static struct branch_clk vfe_clk = {
2377 .cbcr_reg = VFE_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002378 .bcr_reg = VFE_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002379 .has_sibling = 1,
2380 .base = &virt_bases[MMSS_BASE],
2381 .c = {
2382 .parent = &vfe_clk_src.c,
2383 .dbg_name = "vfe_clk",
2384 .ops = &clk_ops_branch,
2385 CLK_INIT(vfe_clk.c),
2386 },
2387};
2388
2389static struct branch_clk vfe_ahb_clk = {
2390 .cbcr_reg = VFE_AHB_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002391 .bcr_reg = VFE_AHB_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002392 .has_sibling = 1,
2393 .base = &virt_bases[MMSS_BASE],
2394 .c = {
2395 .dbg_name = "vfe_ahb_clk",
2396 .ops = &clk_ops_branch,
2397 CLK_INIT(vfe_ahb_clk.c),
2398 },
2399};
2400
2401static struct branch_clk vfe_axi_clk = {
2402 .cbcr_reg = VFE_AXI_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002403 .bcr_reg = VFE_AXI_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002404 .has_sibling = 1,
2405 .base = &virt_bases[MMSS_BASE],
2406 .c = {
2407 .parent = &axi_clk_src.c,
2408 .dbg_name = "vfe_axi_clk",
2409 .ops = &clk_ops_branch,
2410 CLK_INIT(vfe_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002411 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002412 },
2413};
2414
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002415static struct branch_clk q6ss_ahb_lfabif_clk = {
2416 .cbcr_reg = Q6SS_AHB_LFABIF_CBCR,
2417 .has_sibling = 1,
2418 .base = &virt_bases[LPASS_BASE],
2419 .c = {
2420 .dbg_name = "q6ss_ahb_lfabif_clk",
2421 .ops = &clk_ops_branch,
2422 CLK_INIT(q6ss_ahb_lfabif_clk.c),
2423 },
2424};
2425
2426static struct branch_clk q6ss_ahbm_clk = {
2427 .cbcr_reg = Q6SS_AHBM_CBCR,
2428 .has_sibling = 1,
2429 .base = &virt_bases[LPASS_BASE],
2430 .c = {
2431 .dbg_name = "q6ss_ahbm_clk",
2432 .ops = &clk_ops_branch,
2433 CLK_INIT(q6ss_ahbm_clk.c),
2434 },
2435};
2436
2437static struct branch_clk q6ss_xo_clk = {
2438 .cbcr_reg = Q6SS_XO_CBCR,
2439 .has_sibling = 1,
2440 .bcr_reg = LPASS_Q6SS_BCR,
2441 .base = &virt_bases[LPASS_BASE],
2442 .c = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002443 .dbg_name = "q6ss_xo_clk",
2444 .ops = &clk_ops_branch,
2445 CLK_INIT(q6ss_xo_clk.c),
2446 },
2447};
2448
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002449#ifdef CONFIG_DEBUG_FS
2450
2451struct measure_mux_entry {
2452 struct clk *c;
2453 int base;
2454 u32 debug_mux;
2455};
2456
2457static struct measure_mux_entry measure_mux[] = {
2458 { &snoc_clk.c, GCC_BASE, 0x0000},
2459 { &cnoc_clk.c, GCC_BASE, 0x0008},
2460 { &gcc_copss_smmu_ahb_clk.c, GCC_BASE, 0x000c},
2461 { &gcc_lpss_smmu_ahb_clk.c, GCC_BASE, 0x000d},
2462 { &pnoc_clk.c, GCC_BASE, 0x0010},
2463 { &gcc_mmss_noc_cfg_ahb_clk.c, GCC_BASE, 0x002a},
2464 { &gcc_mss_cfg_ahb_clk.c, GCC_BASE, 0x0030},
2465 { &gcc_mss_q6_bimc_axi_clk.c, GCC_BASE, 0x0031},
2466 { &gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060},
2467 { &gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061},
2468 { &gcc_usb2a_phy_sleep_clk.c, GCC_BASE, 0x0063},
2469 { &gcc_sdcc1_apps_clk.c, GCC_BASE, 0x0068},
2470 { &gcc_sdcc1_ahb_clk.c, GCC_BASE, 0x0069},
2471 { &gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070},
2472 { &gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071},
2473 { &gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088},
2474 {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a},
2475 {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b},
2476 { &gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c},
2477 {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e},
2478 {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090},
2479 { &gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091},
2480 {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093},
2481 {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094},
2482 { &gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095},
2483 {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098},
2484 {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099},
2485 { &gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a},
2486 {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c},
2487 {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d},
2488 { &gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e},
2489 {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1},
2490 {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2},
2491 { &gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3},
2492 { &gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0},
2493 { &gcc_pdm2_clk.c, GCC_BASE, 0x00d2},
2494 { &gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8},
2495 { &gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8},
2496 { &gcc_ce1_clk.c, GCC_BASE, 0x0138},
2497 { &gcc_ce1_axi_clk.c, GCC_BASE, 0x0139},
2498 { &gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a},
2499 { &gcc_xo_clk_src.c, GCC_BASE, 0x0149},
Vikram Mulukutlad3854052013-06-13 12:47:19 -07002500 { &bimc_clk.c, GCC_BASE, 0x0155},
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07002501 { &gcc_bimc_smmu_clk.c, GCC_BASE, 0x015e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002502 { &gcc_lpass_q6_axi_clk.c, GCC_BASE, 0x0160},
Vikram Mulukutla69680bb2013-12-17 15:58:46 -08002503 { &wcnss_m_clk, GCC_BASE, 0x0198},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002504
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08002505 { &mmssnoc_ahb_clk.c, MMSS_BASE, 0x0001},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002506 { &mmss_misc_ahb_clk.c, MMSS_BASE, 0x0003},
2507 {&mmss_mmssnoc_axi_clk.c, MMSS_BASE, 0x0004},
2508 { &mmss_s0_axi_clk.c, MMSS_BASE, 0x0005},
2509 { &oxili_ahb_clk.c, MMSS_BASE, 0x0007},
2510 { &oxili_gfx3d_clk.c, MMSS_BASE, 0x0008},
2511 { &gmem_gfx3d_clk.c, MMSS_BASE, 0x0009},
2512 { &mdp_axi_clk.c, MMSS_BASE, 0x000a},
2513 { &mdp_vsync_clk.c, MMSS_BASE, 0x000b},
2514 { &mdp_ahb_clk.c, MMSS_BASE, 0x000c},
2515 { &dsi_pclk_clk.c, MMSS_BASE, 0x000d},
2516 { &mdp_dsi_clk.c, MMSS_BASE, 0x000e},
2517 { &mdp_lcdc_clk.c, MMSS_BASE, 0x000f},
2518 { &dsi_clk.c, MMSS_BASE, 0x0010},
2519 { &dsi_byte_clk.c, MMSS_BASE, 0x0011},
2520 { &dsi_esc_clk.c, MMSS_BASE, 0x0012},
2521 { &dsi_ahb_clk.c, MMSS_BASE, 0x0013},
2522 { &mclk0_clk.c, MMSS_BASE, 0x0015},
2523 { &mclk1_clk.c, MMSS_BASE, 0x0016},
2524 { &csi0phytimer_clk.c, MMSS_BASE, 0x0017},
2525 { &csi1phytimer_clk.c, MMSS_BASE, 0x0018},
2526 { &vfe_clk.c, MMSS_BASE, 0x0019},
2527 { &vfe_ahb_clk.c, MMSS_BASE, 0x001a},
2528 { &vfe_axi_clk.c, MMSS_BASE, 0x001b},
2529 { &csi_vfe_clk.c, MMSS_BASE, 0x001c},
2530 { &csi0_clk.c, MMSS_BASE, 0x001d},
2531 { &csi_ahb_clk.c, MMSS_BASE, 0x001e},
2532 { &csi0phy_clk.c, MMSS_BASE, 0x001f},
2533 { &csi0rdi_clk.c, MMSS_BASE, 0x0020},
2534 { &csi0pix_clk.c, MMSS_BASE, 0x0021},
2535 { &csi1_clk.c, MMSS_BASE, 0x0022},
2536 { &csi1phy_clk.c, MMSS_BASE, 0x0023},
2537 { &csi1rdi_clk.c, MMSS_BASE, 0x0024},
2538 { &csi1pix_clk.c, MMSS_BASE, 0x0025},
2539 { &bimc_gfx_clk.c, MMSS_BASE, 0x0032},
2540
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002541 { &q6ss_ahbm_clk.c, LPASS_BASE, 0x001d},
2542 { &q6ss_ahb_lfabif_clk.c, LPASS_BASE, 0x001e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002543 { &q6ss_xo_clk.c, LPASS_BASE, 0x002b},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002544
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002545 {&apc0_m_clk, APCS_BASE, 0x00010},
2546 {&apc1_m_clk, APCS_BASE, 0x00114},
2547 {&apc2_m_clk, APCS_BASE, 0x00220},
2548 {&apc3_m_clk, APCS_BASE, 0x00324},
2549 {&l2_m_clk, APCS_BASE, 0x01000},
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08002550
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002551 {&dummy_clk, N_BASES, 0x0000},
2552};
2553
2554#define GCC_DEBUG_CLK_CTL 0x1880
2555#define MMSS_DEBUG_CLK_CTL 0x0900
2556#define LPASS_DEBUG_CLK_CTL 0x29000
2557#define GLB_CLK_DIAG 0x001C
2558
2559static int measure_clk_set_parent(struct clk *c, struct clk *parent)
2560{
2561 struct measure_clk *clk = to_measure_clk(c);
2562 unsigned long flags;
2563 u32 regval, clk_sel, i;
2564
2565 if (!parent)
2566 return -EINVAL;
2567
2568 for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++)
2569 if (measure_mux[i].c == parent)
2570 break;
2571
2572 if (measure_mux[i].c == &dummy_clk)
2573 return -EINVAL;
2574
2575 spin_lock_irqsave(&local_clock_reg_lock, flags);
2576 /*
2577 * Program the test vector, measurement period (sample_ticks)
2578 * and scaling multiplier.
2579 */
2580 clk->sample_ticks = 0x10000;
2581 clk->multiplier = 1;
2582
2583 switch (measure_mux[i].base) {
2584
2585 case GCC_BASE:
2586 writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2587 clk_sel = measure_mux[i].debug_mux;
2588 break;
2589
2590 case MMSS_BASE:
2591 writel_relaxed(0, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2592 clk_sel = 0x02C;
2593 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2594 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2595
2596 /* Activate debug clock output */
2597 regval |= BIT(16);
2598 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2599 break;
2600
2601 case LPASS_BASE:
2602 writel_relaxed(0, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2603 clk_sel = 0x161;
2604 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2605 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2606
2607 /* Activate debug clock output */
2608 regval |= BIT(20);
2609 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2610 break;
2611
2612 case APCS_BASE:
2613 clk->multiplier = 4;
2614 clk_sel = 0x16A;
2615 regval = measure_mux[i].debug_mux;
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002616 /* Use a divider value of 4. */
2617 regval |= BVAL(31, 30, 0x3);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002618 writel_relaxed(regval, APCS_REG_BASE(GLB_CLK_DIAG));
2619 break;
2620
2621 default:
2622 return -EINVAL;
2623 }
2624
2625 /* Set debug mux clock index */
2626 regval = BVAL(8, 0, clk_sel);
2627 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2628
2629 /* Activate debug clock output */
2630 regval |= BIT(16);
2631 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2632
2633 /* Make sure test vector is set before starting measurements. */
2634 mb();
2635 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2636
2637 return 0;
2638}
2639
2640#define CLOCK_FRQ_MEASURE_CTL 0x1884
2641#define CLOCK_FRQ_MEASURE_STATUS 0x1888
2642
2643/* Sample clock for 'ticks' reference clock ticks. */
2644static u32 run_measurement(unsigned ticks)
2645{
2646 /* Stop counters and set the XO4 counter start value. */
2647 writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2648
2649 /* Wait for timer to become ready. */
2650 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2651 BIT(25)) != 0)
2652 cpu_relax();
2653
2654 /* Run measurement and wait for completion. */
2655 writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2656 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2657 BIT(25)) == 0)
2658 cpu_relax();
2659
2660 /* Return measured ticks. */
2661 return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2662 BM(24, 0);
2663}
2664
2665#define GCC_XO_DIV4_CBCR 0x10C8
2666#define PLLTEST_PAD_CFG 0x188C
2667
2668/*
2669 * Perform a hardware rate measurement for a given clock.
2670 * FOR DEBUG USE ONLY: Measurements take ~15 ms!
2671 */
2672static unsigned long measure_clk_get_rate(struct clk *c)
2673{
2674 unsigned long flags;
2675 u32 gcc_xo4_reg_backup;
2676 u64 raw_count_short, raw_count_full;
2677 struct measure_clk *clk = to_measure_clk(c);
2678 unsigned ret;
2679
2680 ret = clk_prepare_enable(&gcc_xo_clk_src.c);
2681 if (ret) {
2682 pr_warning("CXO clock failed to enable. Can't measure\n");
2683 return 0;
2684 }
2685
2686 spin_lock_irqsave(&local_clock_reg_lock, flags);
2687
2688 /* Enable CXO/4 and RINGOSC branch. */
2689 gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2690 writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2691
2692 /*
2693 * The ring oscillator counter will not reset if the measured clock
2694 * is not running. To detect this, run a short measurement before
2695 * the full measurement. If the raw results of the two are the same
2696 * then the clock must be off.
2697 */
2698
2699 /* Run a short measurement. (~1 ms) */
2700 raw_count_short = run_measurement(0x1000);
2701 /* Run a full measurement. (~14 ms) */
2702 raw_count_full = run_measurement(clk->sample_ticks);
2703
2704 writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2705
2706 /* Return 0 if the clock is off. */
2707 if (raw_count_full == raw_count_short) {
2708 ret = 0;
2709 } else {
2710 /* Compute rate in Hz. */
2711 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
2712 do_div(raw_count_full, ((clk->sample_ticks * 10) + 35));
2713 ret = (raw_count_full * clk->multiplier);
2714 }
2715
2716 writel_relaxed(0x51A00, GCC_REG_BASE(PLLTEST_PAD_CFG));
2717 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2718
2719 clk_disable_unprepare(&gcc_xo_clk_src.c);
2720
2721 return ret;
2722}
2723#else /* !CONFIG_DEBUG_FS */
2724static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
2725{
2726 return -EINVAL;
2727}
2728
2729static unsigned long measure_clk_get_rate(struct clk *clk)
2730{
2731 return 0;
2732}
2733#endif /* CONFIG_DEBUG_FS */
2734
2735static struct clk_ops clk_ops_measure = {
2736 .set_parent = measure_clk_set_parent,
2737 .get_rate = measure_clk_get_rate,
2738};
2739
2740static struct measure_clk measure_clk = {
2741 .c = {
2742 .dbg_name = "measure_clk",
2743 .ops = &clk_ops_measure,
2744 CLK_INIT(measure_clk.c),
2745 },
2746 .multiplier = 1,
2747};
2748
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08002749static struct clk_lookup msm_clocks_8610[] = {
Mayank Rana05754c92013-07-24 17:12:37 +05302750 CLK_LOOKUP("xo", cxo_otg_clk.c, "f9a55000.usb"),
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002751 CLK_LOOKUP("xo", cxo_lpass_pil_clk.c, "fe200000.qcom,lpass"),
2752 CLK_LOOKUP("xo", cxo_lpm_clk.c, "fc4281d0.qcom,mpm"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002753
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002754 CLK_LOOKUP("xo", cxo_mss_pil_clk.c, "fc880000.qcom,mss"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002755 CLK_LOOKUP("bus_clk", gcc_mss_q6_bimc_axi_clk.c, "fc880000.qcom,mss"),
2756 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, "fc880000.qcom,mss"),
2757 CLK_LOOKUP("mem_clk", gcc_boot_rom_ahb_clk.c, "fc880000.qcom,mss"),
2758
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002759 CLK_LOOKUP("xo", cxo_pil_mba_clk.c, "pil-mba"),
2760 CLK_LOOKUP("xo", cxo_wlan_clk.c, "fb000000.qcom,wcnss-wlan"),
2761 CLK_LOOKUP("xo", cxo_pil_pronto_clk.c, "fb21b000.qcom,pronto"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002762 CLK_LOOKUP("measure", measure_clk.c, "debug"),
2763
2764 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991f000.serial"),
2765 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "f991f000.serial"),
Hanumant Singhbbf01da2013-04-09 16:27:28 -07002766 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991e000.serial"),
2767 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, "f991e000.serial"),
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -07002768 CLK_LOOKUP("bus_clk", pnoc_keepalive_a_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002769 CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002770
2771 CLK_LOOKUP("bus_clk", snoc_clk.c, ""),
2772 CLK_LOOKUP("bus_clk", pnoc_clk.c, ""),
2773 CLK_LOOKUP("bus_clk", cnoc_clk.c, ""),
2774 CLK_LOOKUP("mem_clk", bimc_clk.c, ""),
2775 CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""),
2776 CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""),
2777 CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""),
2778 CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""),
2779
2780 CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"),
2781 CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"),
2782 CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"),
2783 CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"),
2784 CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"),
2785 CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"),
2786 CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"),
2787 CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"),
2788 CLK_LOOKUP("mem_clk", bimc_acpu_a_clk.c, ""),
Gagan Mac125029b2013-03-07 17:24:27 -07002789 CLK_LOOKUP("bus_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
2790 CLK_LOOKUP("bus_a_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002791
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002792 /* CoreSight clocks */
2793 CLK_LOOKUP("core_clk", qdss_clk.c, "fc326000.tmc"),
2794 CLK_LOOKUP("core_clk", qdss_clk.c, "fc320000.tpiu"),
2795 CLK_LOOKUP("core_clk", qdss_clk.c, "fc324000.replicator"),
2796 CLK_LOOKUP("core_clk", qdss_clk.c, "fc325000.tmc"),
2797 CLK_LOOKUP("core_clk", qdss_clk.c, "fc323000.funnel"),
2798 CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.funnel"),
2799 CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.funnel"),
2800 CLK_LOOKUP("core_clk", qdss_clk.c, "fc355000.funnel"),
2801 CLK_LOOKUP("core_clk", qdss_clk.c, "fc302000.stm"),
2802 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.etm"),
2803 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.etm"),
2804 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.etm"),
2805 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.etm"),
2806 CLK_LOOKUP("core_clk", qdss_clk.c, "fc301000.csr"),
2807 CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"),
2808 CLK_LOOKUP("core_clk", qdss_clk.c, "fc311000.cti"),
2809 CLK_LOOKUP("core_clk", qdss_clk.c, "fc312000.cti"),
2810 CLK_LOOKUP("core_clk", qdss_clk.c, "fc313000.cti"),
2811 CLK_LOOKUP("core_clk", qdss_clk.c, "fc314000.cti"),
2812 CLK_LOOKUP("core_clk", qdss_clk.c, "fc315000.cti"),
2813 CLK_LOOKUP("core_clk", qdss_clk.c, "fc316000.cti"),
2814 CLK_LOOKUP("core_clk", qdss_clk.c, "fc317000.cti"),
2815 CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.cti"),
2816 CLK_LOOKUP("core_clk", qdss_clk.c, "fc351000.cti"),
2817 CLK_LOOKUP("core_clk", qdss_clk.c, "fc352000.cti"),
2818 CLK_LOOKUP("core_clk", qdss_clk.c, "fc353000.cti"),
2819 CLK_LOOKUP("core_clk", qdss_clk.c, "fc354000.cti"),
Pratik Patel85419772013-10-04 16:09:59 -07002820 CLK_LOOKUP("core_clk", qdss_clk.c, "fc335000.cti"),
2821 CLK_LOOKUP("core_clk", qdss_clk.c, "fc338000.cti"),
2822 CLK_LOOKUP("core_clk", qdss_clk.c, "fc33c000.cti"),
2823 CLK_LOOKUP("core_clk", qdss_clk.c, "fc360000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002824 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.jtagmm"),
2825 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.jtagmm"),
2826 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.jtagmm"),
2827 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002828 CLK_LOOKUP("core_clk", qdss_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002829
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002830
2831 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc326000.tmc"),
2832 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc320000.tpiu"),
2833 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc324000.replicator"),
2834 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc325000.tmc"),
2835 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc323000.funnel"),
2836 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.funnel"),
2837 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.funnel"),
2838 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc355000.funnel"),
2839 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc302000.stm"),
2840 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.etm"),
2841 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.etm"),
2842 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.etm"),
2843 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.etm"),
2844 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc301000.csr"),
2845 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"),
2846 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc311000.cti"),
2847 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc312000.cti"),
2848 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc313000.cti"),
2849 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc314000.cti"),
2850 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc315000.cti"),
2851 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc316000.cti"),
2852 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc317000.cti"),
2853 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.cti"),
2854 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc351000.cti"),
2855 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc352000.cti"),
2856 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc353000.cti"),
2857 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc354000.cti"),
Pratik Patel85419772013-10-04 16:09:59 -07002858 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc335000.cti"),
2859 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc338000.cti"),
2860 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc33c000.cti"),
2861 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc360000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002862 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.jtagmm"),
2863 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.jtagmm"),
2864 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.jtagmm"),
2865 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002866 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fd820018.hwevent"),
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002867
Aparna Das05172f22013-05-13 15:06:44 -07002868 CLK_LOOKUP("core_mmss_clk", mmss_misc_ahb_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002869
2870 CLK_LOOKUP("core_clk_src", blsp1_qup1_spi_apps_clk_src.c, ""),
2871 CLK_LOOKUP("core_clk_src", blsp1_qup2_spi_apps_clk_src.c, ""),
2872 CLK_LOOKUP("core_clk_src", blsp1_qup3_spi_apps_clk_src.c, ""),
2873 CLK_LOOKUP("core_clk_src", blsp1_qup4_spi_apps_clk_src.c, ""),
2874 CLK_LOOKUP("core_clk_src", blsp1_qup5_spi_apps_clk_src.c, ""),
2875 CLK_LOOKUP("core_clk_src", blsp1_qup6_spi_apps_clk_src.c, ""),
2876 CLK_LOOKUP("core_clk_src", blsp1_uart1_apps_clk_src.c, ""),
2877 CLK_LOOKUP("core_clk_src", blsp1_uart2_apps_clk_src.c, ""),
2878 CLK_LOOKUP("core_clk_src", blsp1_uart3_apps_clk_src.c, ""),
2879 CLK_LOOKUP("core_clk_src", blsp1_uart4_apps_clk_src.c, ""),
2880 CLK_LOOKUP("core_clk_src", blsp1_uart5_apps_clk_src.c, ""),
2881 CLK_LOOKUP("core_clk_src", blsp1_uart6_apps_clk_src.c, ""),
2882 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""),
2883 CLK_LOOKUP("core_clk_src", gp1_clk_src.c, ""),
2884 CLK_LOOKUP("core_clk_src", gp2_clk_src.c, ""),
2885 CLK_LOOKUP("core_clk_src", gp3_clk_src.c, ""),
2886 CLK_LOOKUP("core_clk_src", pdm2_clk_src.c, ""),
2887 CLK_LOOKUP("core_clk_src", sdcc1_apps_clk_src.c, ""),
2888 CLK_LOOKUP("core_clk_src", sdcc2_apps_clk_src.c, ""),
2889 CLK_LOOKUP("core_clk_src", usb_hs_system_clk_src.c, ""),
Chun Zhangf39a0652013-05-01 15:57:54 -07002890 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9923000.i2c"),
Houston Hoffman8fc417b2013-11-14 02:25:59 -08002891 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9924000.i2c"),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002892 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002893 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9927000.i2c"),
Gilad Avidova460c472013-04-12 16:23:32 -06002894 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9926000.spi"),
Chun Zhangf39a0652013-05-01 15:57:54 -07002895 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, "f9923000.i2c"),
2896 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""),
Houston Hoffman8fc417b2013-11-14 02:25:59 -08002897 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, "f9924000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002898 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, ""),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002899 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002900 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""),
2901 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""),
Gilad Avidova460c472013-04-12 16:23:32 -06002902 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, "f9926000.spi"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002903 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002904 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, "f9927000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002905 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""),
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -06002906 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9928000.i2c"),
2907 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, "f9928000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002908 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""),
2909 CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, ""),
2910 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""),
2911 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, ""),
2912 CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""),
2913 CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""),
2914 CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""),
2915 CLK_LOOKUP("iface_clk", gcc_boot_rom_ahb_clk.c, ""),
2916 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""),
2917 CLK_LOOKUP("core_clk", gcc_ce1_axi_clk.c, ""),
2918 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""),
2919 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c, ""),
2920 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, ""),
Bansidhar Gopalachari148c7252013-09-25 19:55:41 +01002921 CLK_LOOKUP("core_clk", gcc_gp1_clk.c, "0-000e"),
Houston Hoffman8fc417b2013-11-14 02:25:59 -08002922 CLK_LOOKUP("core_clk_pvt", gcc_gp1_clk.c, "2-000e"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002923 CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""),
2924 CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""),
2925 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, ""),
2926 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, ""),
2927 CLK_LOOKUP("core_clk", gcc_mss_q6_bimc_axi_clk.c, ""),
2928 CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""),
2929 CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""),
Hariprasad Dhalinarasimha2cced7d2013-04-13 17:25:58 -07002930 CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002931 CLK_LOOKUP("iface_clk", gcc_sdcc1_ahb_clk.c, "msm_sdcc.1"),
2932 CLK_LOOKUP("core_clk", gcc_sdcc1_apps_clk.c, "msm_sdcc.1"),
2933 CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"),
2934 CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"),
Mayank Rana05754c92013-07-24 17:12:37 +05302935 CLK_LOOKUP("sleep_clk", gcc_usb2a_phy_sleep_clk.c, "f9a55000.usb"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002936 CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"),
2937 CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"),
2938
2939 CLK_LOOKUP("core_clk_src", csi0_clk_src.c, ""),
2940 CLK_LOOKUP("core_clk_src", axi_clk_src.c, ""),
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002941 CLK_LOOKUP("", mdp_axi_clk_src.c, ""),
2942 CLK_LOOKUP("", mmssnoc_axi_clk_src.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002943 CLK_LOOKUP("core_clk_src", dsi_pclk_clk_src.c, ""),
2944 CLK_LOOKUP("core_clk_src", gfx3d_clk_src.c, ""),
2945 CLK_LOOKUP("core_clk_src", vfe_clk_src.c, ""),
2946 CLK_LOOKUP("core_clk_src", csi1_clk_src.c, ""),
2947 CLK_LOOKUP("core_clk_src", csi0phytimer_clk_src.c, ""),
2948 CLK_LOOKUP("core_clk_src", csi1phytimer_clk_src.c, ""),
2949 CLK_LOOKUP("core_clk_src", dsi_clk_src.c, ""),
2950 CLK_LOOKUP("core_clk_src", dsi_byte_clk_src.c, ""),
2951 CLK_LOOKUP("core_clk_src", dsi_esc_clk_src.c, ""),
2952 CLK_LOOKUP("core_clk_src", mclk0_clk_src.c, ""),
2953 CLK_LOOKUP("core_clk_src", mclk1_clk_src.c, ""),
2954 CLK_LOOKUP("core_clk_src", mdp_vsync_clk_src.c, ""),
2955
2956 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, ""),
2957 CLK_LOOKUP("core_clk", csi0_clk.c, ""),
2958 CLK_LOOKUP("core_clk", csi0phy_clk.c, ""),
2959 CLK_LOOKUP("core_clk", csi0phytimer_clk.c, ""),
2960 CLK_LOOKUP("core_clk", csi0pix_clk.c, ""),
2961 CLK_LOOKUP("core_clk", csi0rdi_clk.c, ""),
2962 CLK_LOOKUP("core_clk", csi1_clk.c, ""),
2963 CLK_LOOKUP("core_clk", csi1phy_clk.c, ""),
2964 CLK_LOOKUP("core_clk", csi1phytimer_clk.c, ""),
2965 CLK_LOOKUP("core_clk", csi1pix_clk.c, ""),
2966 CLK_LOOKUP("core_clk", csi1rdi_clk.c, ""),
2967 CLK_LOOKUP("core_clk", csi_ahb_clk.c, ""),
2968 CLK_LOOKUP("core_clk", csi_vfe_clk.c, ""),
2969 CLK_LOOKUP("core_clk", dsi_clk.c, ""),
2970 CLK_LOOKUP("core_clk", dsi_ahb_clk.c, ""),
2971 CLK_LOOKUP("core_clk", dsi_byte_clk.c, ""),
2972 CLK_LOOKUP("core_clk", dsi_esc_clk.c, ""),
2973 CLK_LOOKUP("core_clk", dsi_pclk_clk.c, ""),
2974 CLK_LOOKUP("core_clk", gmem_gfx3d_clk.c, ""),
2975 CLK_LOOKUP("core_clk", mclk0_clk.c, ""),
2976 CLK_LOOKUP("core_clk", mclk1_clk.c, ""),
2977 CLK_LOOKUP("core_clk", mdp_ahb_clk.c, ""),
2978 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
2979 CLK_LOOKUP("core_clk", mdp_dsi_clk.c, ""),
2980 CLK_LOOKUP("core_clk", mdp_lcdc_clk.c, ""),
2981 CLK_LOOKUP("core_clk", mdp_vsync_clk.c, ""),
2982 CLK_LOOKUP("core_clk", mmss_misc_ahb_clk.c, ""),
2983 CLK_LOOKUP("core_clk", mmss_s0_axi_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002984 CLK_LOOKUP("core_clk", mmss_mmssnoc_axi_clk.c, ""),
2985 CLK_LOOKUP("core_clk", vfe_clk.c, ""),
2986 CLK_LOOKUP("core_clk", vfe_ahb_clk.c, ""),
2987 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
2988
Vikram Mulukutla49423392013-05-02 09:03:02 -07002989 CLK_LOOKUP("core_clk", csi0pix_cam_mux_clk.c, ""),
2990 CLK_LOOKUP("core_clk", csi0phy_cam_mux_clk.c, ""),
2991 CLK_LOOKUP("core_clk", csi1phy_cam_mux_clk.c, ""),
2992 CLK_LOOKUP("core_clk", rdi2_cam_mux_clk.c, ""),
2993 CLK_LOOKUP("core_clk", rdi1_cam_mux_clk.c, ""),
2994 CLK_LOOKUP("core_clk", rdi0_cam_mux_clk.c, ""),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002995
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002996 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
2997 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fdc00000.qcom,kgsl-3d0"),
2998 CLK_LOOKUP("mem_iface_clk", bimc_gfx_clk.c, "fdc00000.qcom,kgsl-3d0"),
2999 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07003000 CLK_LOOKUP("alt_mem_iface_clk", gcc_bimc_smmu_clk.c,
3001 "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003002
3003 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd890000.qcom,iommu"),
3004 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "fd890000.qcom,iommu"),
3005 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd860000.qcom,iommu"),
3006 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd860000.qcom,iommu"),
3007 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd870000.qcom,iommu"),
3008 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd870000.qcom,iommu"),
3009 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd880000.qcom,iommu"),
3010 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07003011 CLK_LOOKUP("alt_core_clk", gcc_bimc_smmu_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003012 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, "fd000000.qcom,iommu"),
3013 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, "fd000000.qcom,iommu"),
3014 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c,
3015 "fd010000.qcom,iommu"),
3016 CLK_LOOKUP("core_clk", pnoc_iommu_clk.c, "fd010000.qcom,iommu"),
3017
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003018 /* MM sensor clocks */
3019 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006f"),
Aditya Jonnalagadda3057ba52013-09-20 19:59:41 +05303020 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0034"),
Evgeniy Borisovd9ca9932013-11-05 18:24:19 +02003021 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0001"),
Li Sun3eb82a62013-06-14 15:14:22 +08003022 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-007d"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003023 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006d"),
Evgeniy Borisovd9ca9932013-11-05 18:24:19 +02003024 CLK_LOOKUP("cam_src_clk", mclk1_clk_src.c, "6-0002"),
Ju He543b5802013-06-07 16:03:34 -07003025 CLK_LOOKUP("cam_src_clk", mclk1_clk_src.c, "6-0078"),
Yu Yang8744be82013-06-18 14:39:37 +08003026 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0020"),
Wei Ding7d2f73d2013-09-10 09:41:10 +08003027 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006a"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003028 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006f"),
Aditya Jonnalagadda3057ba52013-09-20 19:59:41 +05303029 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0034"),
Evgeniy Borisovd9ca9932013-11-05 18:24:19 +02003030 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0001"),
Li Sun3eb82a62013-06-14 15:14:22 +08003031 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-007d"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003032 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006d"),
Evgeniy Borisovd9ca9932013-11-05 18:24:19 +02003033 CLK_LOOKUP("cam_clk", mclk1_clk.c, "6-0002"),
Ju He543b5802013-06-07 16:03:34 -07003034 CLK_LOOKUP("cam_clk", mclk1_clk.c, "6-0078"),
Yu Yang8744be82013-06-18 14:39:37 +08003035 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0020"),
Wei Ding7d2f73d2013-09-10 09:41:10 +08003036 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006a"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003037
3038
3039 /* CSIPHY clocks */
3040 CLK_LOOKUP("csiphy_timer_src_clk", csi0phytimer_clk_src.c,
3041 "fda00c00.qcom,csiphy"),
3042 CLK_LOOKUP("csiphy_timer_clk", csi0phytimer_clk.c,
3043 "fda00c00.qcom,csiphy"),
Chandan Gera30c93082013-10-24 14:10:13 +05303044 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00c00.qcom,csiphy"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003045 CLK_LOOKUP("csiphy_timer_src_clk", csi1phytimer_clk_src.c,
3046 "fda01000.qcom,csiphy"),
3047 CLK_LOOKUP("csiphy_timer_clk", csi1phytimer_clk.c,
3048 "fda01000.qcom,csiphy"),
Chandan Gera30c93082013-10-24 14:10:13 +05303049 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda01000.qcom,csiphy"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003050
3051 /* CSID clocks */
juhe85f33272013-05-10 15:21:08 +08003052 CLK_LOOKUP("csi_clk", csi0_clk.c, "fda00000.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003053 CLK_LOOKUP("csi_src_clk", csi0_clk_src.c, "fda00000.qcom,csid"),
juhe85f33272013-05-10 15:21:08 +08003054 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00000.qcom,csid"),
3055 CLK_LOOKUP("csi0phy_mux_clk", csi0phy_cam_mux_clk.c,
3056 "fda00000.qcom,csid"),
3057 CLK_LOOKUP("csi1phy_mux_clk", csi1phy_cam_mux_clk.c,
3058 "fda00000.qcom,csid"),
3059 CLK_LOOKUP("csi0pix_mux_clk", csi0pix_cam_mux_clk.c,
3060 "fda00000.qcom,csid"),
3061 CLK_LOOKUP("csi0rdi_mux_clk", rdi0_cam_mux_clk.c,
3062 "fda00000.qcom,csid"),
3063 CLK_LOOKUP("csi1rdi_mux_clk", rdi1_cam_mux_clk.c,
3064 "fda00000.qcom,csid"),
3065 CLK_LOOKUP("csi2rdi_mux_clk", rdi2_cam_mux_clk.c,
3066 "fda00000.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003067
juhe85f33272013-05-10 15:21:08 +08003068 CLK_LOOKUP("csi_clk", csi1_clk.c, "fda00400.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003069 CLK_LOOKUP("csi_src_clk", csi1_clk_src.c, "fda00400.qcom,csid"),
juhe85f33272013-05-10 15:21:08 +08003070 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00400.qcom,csid"),
3071 CLK_LOOKUP("csi0phy_mux_clk", csi0phy_cam_mux_clk.c,
3072 "fda00400.qcom,csid"),
3073 CLK_LOOKUP("csi1phy_mux_clk", csi1phy_cam_mux_clk.c,
3074 "fda00400.qcom,csid"),
3075 CLK_LOOKUP("csi0pix_mux_clk", csi0pix_cam_mux_clk.c,
3076 "fda00400.qcom,csid"),
3077 CLK_LOOKUP("csi0rdi_mux_clk", rdi0_cam_mux_clk.c,
3078 "fda00400.qcom,csid"),
3079 CLK_LOOKUP("csi1rdi_mux_clk", rdi1_cam_mux_clk.c,
3080 "fda00400.qcom,csid"),
3081 CLK_LOOKUP("csi2rdi_mux_clk", rdi2_cam_mux_clk.c,
3082 "fda00400.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003083
juhe85f33272013-05-10 15:21:08 +08003084 CLK_LOOKUP("csi_phy_src_clk", csi0phy_clk.c, "fda00000.qcom,csid"),
3085 CLK_LOOKUP("csi_phy_src_clk", csi1phy_clk.c, "fda00400.qcom,csid"),
3086 CLK_LOOKUP("csi_pix_src_clk", csi0pix_clk.c, "fda00000.qcom,csid"),
3087 CLK_LOOKUP("csi_pix_src_clk", csi1pix_clk.c, "fda00400.qcom,csid"),
3088 CLK_LOOKUP("csi_rdi_src_clk", csi0rdi_clk.c, "fda00000.qcom,csid"),
3089 CLK_LOOKUP("csi_rdi_src_clk", csi1rdi_clk.c, "fda00400.qcom,csid"),
3090 /* ISPIF need no clock */
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003091
3092 CLK_LOOKUP("vfe_clk_src", vfe_clk_src.c, "fde00000.qcom,vfe"),
3093 CLK_LOOKUP("vfe_clk", vfe_clk.c, "fde00000.qcom,vfe"),
3094
3095 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "fde00000.qcom,vfe"),
3096 CLK_LOOKUP("vfe_ahb_clk", vfe_ahb_clk.c, "fde00000.qcom,vfe"),
3097
3098 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "fde00000.qcom,vfe"),
3099
3100
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003101 CLK_LOOKUP("core_clk", q6ss_xo_clk.c, "fe200000.qcom,lpass"),
3102 CLK_LOOKUP("bus_clk", gcc_lpass_q6_axi_clk.c, "fe200000.qcom,lpass"),
3103 CLK_LOOKUP("iface_clk", q6ss_ahb_lfabif_clk.c, "fe200000.qcom,lpass"),
3104 CLK_LOOKUP("reg_clk", q6ss_ahbm_clk.c, "fe200000.qcom,lpass"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003105
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07003106 CLK_LOOKUP("xo", cxo_acpu_clk.c, "f9011050.qcom,acpuclk"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003107 CLK_LOOKUP("gpll0", gpll0_ao_clk_src.c, "f9011050.qcom,acpuclk"),
3108 CLK_LOOKUP("a7sspll", a7sspll.c, "f9011050.qcom,acpuclk"),
Patrick Daly5be83262013-11-05 14:15:10 -08003109 CLK_LOOKUP("clk-4", gpll0_ao_clk_src.c, "f9011050.qcom,clock-a7"),
3110 CLK_LOOKUP("clk-5", a7sspll.c, "f9011050.qcom,clock-a7"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003111
3112 CLK_LOOKUP("measure_clk", apc0_m_clk, ""),
3113 CLK_LOOKUP("measure_clk", apc1_m_clk, ""),
3114 CLK_LOOKUP("measure_clk", apc2_m_clk, ""),
3115 CLK_LOOKUP("measure_clk", apc3_m_clk, ""),
3116 CLK_LOOKUP("measure_clk", l2_m_clk, ""),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003117
Vikram Mulukutla69680bb2013-12-17 15:58:46 -08003118 CLK_LOOKUP("measure", measure_clk.c, "fb000000.qcom,wcnss-wlan"),
3119 CLK_LOOKUP("wcnss_debug", wcnss_m_clk, "fb000000.qcom,wcnss-wlan"),
3120
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07003121 CLK_LOOKUP("xo", cxo_wlan_clk.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutla7e5b3112013-04-15 16:32:40 -07003122 CLK_LOOKUP("rf_clk", cxo_a1.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutlaed078512013-04-09 14:15:33 -07003123
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003124 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd900000.qcom,mdss_mdp"),
3125 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd900000.qcom,mdss_mdp"),
3126 CLK_LOOKUP("lcdc_clk", mdp_lcdc_clk.c, "fd900000.qcom,mdss_mdp"),
3127 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003128 CLK_LOOKUP("dsi_clk", mdp_dsi_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003129 CLK_LOOKUP("iface_clk", dsi_ahb_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003130 CLK_LOOKUP("dsi_clk", dsi_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003131 CLK_LOOKUP("byte_clk", dsi_byte_clk.c, "fdd00000.qcom,mdss_dsi"),
3132 CLK_LOOKUP("esc_clk", dsi_esc_clk.c, "fdd00000.qcom,mdss_dsi"),
3133 CLK_LOOKUP("pixel_clk", dsi_pclk_clk.c, "fdd00000.qcom,mdss_dsi"),
Hariprasad Dhalinarasimhad9ede5a2013-04-14 16:30:09 -07003134
3135 /* QSEECOM Clocks */
3136 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "qseecom"),
3137 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "qseecom"),
3138 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "qseecom"),
3139 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "qseecom"),
Vikram Mulukutlafd6833c2013-04-18 12:46:48 -07003140
3141 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "scm"),
3142 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "scm"),
3143 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "scm"),
3144 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "scm"),
Hariprasad Dhalinarasimha315b9bd2013-05-14 12:31:56 -07003145
Hariprasad Dhalinarasimha8803a472014-01-30 15:41:09 -08003146 /* GUD Clocks */
3147 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "mcd"),
3148 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "mcd"),
3149 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "mcd"),
3150 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "mcd"),
3151
Hariprasad Dhalinarasimha315b9bd2013-05-14 12:31:56 -07003152 /* Add QCEDEV clocks */
3153 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcedev"),
3154 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcedev"),
3155 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcedev"),
3156 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcedev"),
3157
3158 /* Add QCRYPTO clocks */
3159 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd404000.qcom,qcrypto"),
3160 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd404000.qcom,qcrypto"),
3161 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd404000.qcom,qcrypto"),
3162 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd404000.qcom,qcrypto"),
Matt Wagantall8ce3c462013-07-03 19:24:53 -07003163
3164 /* GDSC clocks */
3165 CLK_LOOKUP("core_clk", vfe_clk.c, "fd8c36a4.qcom,gdsc"),
3166 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd8c36a4.qcom,gdsc"),
3167 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "fd8c36a4.qcom,gdsc"),
Matt Wagantall8ce3c462013-07-03 19:24:53 -07003168 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fd8c4034.qcom,gdsc"),
3169 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd8c4034.qcom,gdsc"),
3170 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fd8c4034.qcom,gdsc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003171};
3172
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003173static struct clk_lookup msm_clocks_8610_rumi[] = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003174 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3175 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3176 CLK_DUMMY("iface_clk", HSUSB_IFACE_CLK, "f9a55000.usb", OFF),
3177 CLK_DUMMY("core_clk", HSUSB_CORE_CLK, "f9a55000.usb", OFF),
3178 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.1", OFF),
3179 CLK_DUMMY("core_clk", NULL, "msm_sdcc.1", OFF),
3180 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.1", OFF),
3181 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.2", OFF),
3182 CLK_DUMMY("core_clk", NULL, "msm_sdcc.2", OFF),
3183 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.2", OFF),
3184 CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
3185 CLK_DUMMY("iface_clk", NULL, "fd890000.qcom,iommu", OFF),
3186 CLK_DUMMY("core_clk", NULL, "fd890000.qcom,iommu", OFF),
3187 CLK_DUMMY("iface_clk", NULL, "fd860000.qcom,iommu", OFF),
3188 CLK_DUMMY("core_clk", NULL, "fd860000.qcom,iommu", OFF),
3189 CLK_DUMMY("iface_clk", NULL, "fd870000.qcom,iommu", OFF),
3190 CLK_DUMMY("core_clk", NULL, "fd870000.qcom,iommu", OFF),
3191 CLK_DUMMY("iface_clk", NULL, "fd880000.qcom,iommu", OFF),
3192 CLK_DUMMY("core_clk", NULL, "fd880000.qcom,iommu", OFF),
Olav Haugan3431b4c2013-04-30 14:09:08 -07003193 CLK_DUMMY("alt_core_clk", NULL, "fd880000.qcom,iommu", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003194 CLK_DUMMY("iface_clk", NULL, "fd000000.qcom,iommu", OFF),
3195 CLK_DUMMY("core_clk", NULL, "fd000000.qcom,iommu", OFF),
3196 CLK_DUMMY("iface_clk", NULL, "fd010000.qcom,iommu", OFF),
3197 CLK_DUMMY("core_clk", NULL, "fd010000.qcom,iommu", OFF),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003198 CLK_DUMMY("xo", NULL, "f9011050.qcom,acpuclk", OFF),
3199 CLK_DUMMY("gpll0", NULL, "f9011050.qcom,acpuclk", OFF),
3200 CLK_DUMMY("a7sspll", NULL, "f9011050.qcom,acpuclk", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003201};
3202
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003203struct clock_init_data msm8610_rumi_clock_init_data __initdata = {
3204 .table = msm_clocks_8610_rumi,
3205 .size = ARRAY_SIZE(msm_clocks_8610_rumi),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003206};
3207
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003208/* MMPLL0 at 800 MHz, main output enabled. */
3209static struct pll_config mmpll0_config __initdata = {
3210 .l = 0x29,
3211 .m = 0x2,
3212 .n = 0x3,
3213 .vco_val = 0x0,
3214 .vco_mask = BM(21, 20),
3215 .pre_div_val = 0x0,
3216 .pre_div_mask = BM(14, 12),
3217 .post_div_val = 0x0,
3218 .post_div_mask = BM(9, 8),
3219 .mn_ena_val = BIT(24),
3220 .mn_ena_mask = BIT(24),
3221 .main_output_val = BIT(0),
3222 .main_output_mask = BIT(0),
3223};
3224
3225/* MMPLL1 at 1200 MHz, main output enabled. */
3226static struct pll_config mmpll1_config __initdata = {
3227 .l = 0x3E,
3228 .m = 0x1,
3229 .n = 0x2,
3230 .vco_val = 0x0,
3231 .vco_mask = BM(21, 20),
3232 .pre_div_val = 0x0,
3233 .pre_div_mask = BM(14, 12),
3234 .post_div_val = 0x0,
3235 .post_div_mask = BM(9, 8),
3236 .mn_ena_val = BIT(24),
3237 .mn_ena_mask = BIT(24),
3238 .main_output_val = BIT(0),
3239 .main_output_mask = BIT(0),
3240};
3241
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003242static void __init reg_init(void)
3243{
Vikram Mulukutla81577ab2013-03-25 10:55:36 -07003244 u32 regval;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003245
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003246 configure_sr_hpm_lp_pll(&mmpll0_config, &mmpll0_regs, 1);
3247 configure_sr_hpm_lp_pll(&mmpll1_config, &mmpll1_regs, 1);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003248
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003249 /* Vote for GPLL0 to turn on. Needed by acpuclock. */
3250 regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3251 regval |= BIT(0);
3252 writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3253
3254 /*
3255 * TODO: Confirm that no clocks need to be voted on in this sleep vote
3256 * register.
3257 */
3258 writel_relaxed(0x0, GCC_REG_BASE(APCS_CLOCK_SLEEP_ENA_VOTE));
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003259}
3260
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003261static void __init msm8610_clock_post_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003262{
3263 /*
3264 * Hold an active set vote for CXO; this is because CXO is expected
3265 * to remain on whenever CPUs aren't power collapsed.
3266 */
3267 clk_prepare_enable(&gcc_xo_a_clk_src.c);
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -07003268 /*
3269 * Hold an active set vote for the PNOC AHB source. Sleep set vote is 0.
3270 */
3271 clk_set_rate(&pnoc_keepalive_a_clk.c, 19200000);
3272 clk_prepare_enable(&pnoc_keepalive_a_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003273 /* Set rates for single-rate clocks. */
3274 clk_set_rate(&usb_hs_system_clk_src.c,
3275 usb_hs_system_clk_src.freq_tbl[0].freq_hz);
3276 clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz);
3277 clk_set_rate(&mclk0_clk_src.c, mclk0_clk_src.freq_tbl[0].freq_hz);
3278 clk_set_rate(&mclk1_clk_src.c, mclk1_clk_src.freq_tbl[0].freq_hz);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003279}
3280
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003281static void dsi_init(void)
3282{
3283 dsi_byte_clk_src_ops = clk_ops_rcg;
3284 dsi_byte_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3285 dsi_byte_clk_src_ops.handoff = byte_rcg_handoff;
3286 dsi_byte_clk_src_ops.get_parent = NULL;
3287
3288 dsi_dsi_clk_src_ops = clk_ops_rcg_mnd;
3289 dsi_dsi_clk_src_ops.set_rate = set_rate_dsi_clk;
3290 dsi_dsi_clk_src_ops.handoff = pixel_rcg_handoff;
3291 dsi_dsi_clk_src_ops.get_parent = NULL;
3292
3293 dsi_pixel_clk_src_ops = clk_ops_rcg_mnd;
3294 dsi_pixel_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3295 dsi_pixel_clk_src_ops.handoff = pixel_rcg_handoff;
3296 dsi_pixel_clk_src_ops.get_parent = NULL;
3297
3298 dsi_clk_ctrl_init(&dsi_ahb_clk.c);
3299}
3300
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003301#define GCC_CC_PHYS 0xFC400000
3302#define GCC_CC_SIZE SZ_16K
3303
3304#define MMSS_CC_PHYS 0xFD8C0000
3305#define MMSS_CC_SIZE SZ_256K
3306
3307#define LPASS_CC_PHYS 0xFE000000
3308#define LPASS_CC_SIZE SZ_256K
3309
3310#define APCS_GCC_CC_PHYS 0xF9011000
3311#define APCS_GCC_CC_SIZE SZ_4K
3312
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003313#define APCS_KPSS_SH_PLL_PHYS 0xF9016000
3314#define APCS_KPSS_SH_PLL_SIZE SZ_64
3315
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003316static void __init msm8610_clock_pre_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003317{
3318 virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE);
3319 if (!virt_bases[GCC_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003320 panic("clock-8610: Unable to ioremap GCC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003321
3322 virt_bases[MMSS_BASE] = ioremap(MMSS_CC_PHYS, MMSS_CC_SIZE);
3323 if (!virt_bases[MMSS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003324 panic("clock-8610: Unable to ioremap MMSS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003325
3326 virt_bases[LPASS_BASE] = ioremap(LPASS_CC_PHYS, LPASS_CC_SIZE);
3327 if (!virt_bases[LPASS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003328 panic("clock-8610: Unable to ioremap LPASS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003329
3330 virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE);
3331 if (!virt_bases[APCS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003332 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003333
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003334 virt_bases[APCS_PLL_BASE] = ioremap(APCS_KPSS_SH_PLL_PHYS,
3335 APCS_KPSS_SH_PLL_SIZE);
3336 if (!virt_bases[APCS_PLL_BASE])
3337 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
3338
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003339 clk_ops_local_pll.enable = sr_hpm_lp_pll_clk_enable;
3340
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003341 vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig");
3342 if (IS_ERR(vdd_dig.regulator[0]))
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003343 panic("clock-8610: Unable to get the vdd_dig regulator!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003344
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003345 vdd_sr2_pll.regulator[0] = regulator_get(NULL, "vdd_sr2_pll");
3346 if (IS_ERR(vdd_sr2_pll.regulator[0]))
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003347 panic("clock-8610: Unable to get the vdd_sr2_pll regulator!");
3348
Patrick Daly6fb589a2013-03-29 17:55:55 -07003349 vdd_sr2_pll.regulator[1] = regulator_get(NULL, "vdd_sr2_dig");
3350 if (IS_ERR(vdd_sr2_pll.regulator[1]))
3351 panic("clock-8610: Unable to get the vdd_sr2_dig regulator!");
3352
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003353 enable_rpm_scaling();
3354
3355 /* Enable a clock to allow access to MMSS clock registers */
3356 clk_prepare_enable(&gcc_mmss_noc_cfg_ahb_clk.c),
3357
3358 reg_init();
3359
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003360 dsi_init();
3361
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08003362 /* Maintain the max nominal frequency on the MMSSNOC AHB bus. */
3363 clk_set_rate(&mmssnoc_ahb_a_clk.c, 40000000);
3364 clk_prepare_enable(&mmssnoc_ahb_a_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003365}
3366
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003367struct clock_init_data msm8610_clock_init_data __initdata = {
3368 .table = msm_clocks_8610,
3369 .size = ARRAY_SIZE(msm_clocks_8610),
3370 .pre_init = msm8610_clock_pre_init,
3371 .post_init = msm8610_clock_post_init,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003372};