blob: 672c51268fb372800b37faa3bd361d8f550d494f [file] [log] [blame]
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08001/* Copyright (c) 2012-2013, 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),
562 F_APCS_PLL(1190400000, 62, 0x0, 0x1, 0x0, 0x0, 0x0),
563 PLL_F_END
564};
565
566static struct pll_clk a7sspll = {
567 .mode_reg = (void __iomem *)APCS_SH_PLL_MODE,
568 .l_reg = (void __iomem *)APCS_SH_PLL_L_VAL,
569 .m_reg = (void __iomem *)APCS_SH_PLL_M_VAL,
570 .n_reg = (void __iomem *)APCS_SH_PLL_N_VAL,
571 .config_reg = (void __iomem *)APCS_SH_PLL_USER_CTL,
572 .status_reg = (void __iomem *)APCS_SH_PLL_STATUS,
573 .freq_tbl = apcs_pll_freq,
574 .masks = {
575 .vco_mask = BM(29, 28),
576 .pre_div_mask = BIT(12),
577 .post_div_mask = BM(9, 8),
578 .mn_en_mask = BIT(24),
579 .main_output_mask = BIT(0),
580 },
581 .base = &virt_bases[APCS_PLL_BASE],
582 .c = {
Patrick Daly9bdc8a52013-03-21 19:12:40 -0700583 .parent = &gcc_xo_a_clk_src.c,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800584 .dbg_name = "a7sspll",
585 .ops = &clk_ops_sr2_pll,
586 .vdd_class = &vdd_sr2_pll,
587 .fmax = (unsigned long [VDD_SR2_PLL_NUM]) {
Patrick Daly6fb589a2013-03-29 17:55:55 -0700588 [VDD_SR2_PLL_SVS] = 1000000000,
589 [VDD_SR2_PLL_NOM] = 1900000000,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800590 },
591 .num_fmax = VDD_SR2_PLL_NUM,
592 CLK_INIT(a7sspll.c),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800593 },
594};
595
596static unsigned int soft_vote_gpll0;
597
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700598static struct pll_vote_clk gpll0_clk_src = {
599 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
600 .en_mask = BIT(0),
601 .status_reg = (void __iomem *)GPLL0_STATUS,
602 .status_mask = BIT(17),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800603 .soft_vote = &soft_vote_gpll0,
604 .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700605 .base = &virt_bases[GCC_BASE],
606 .c = {
607 .parent = &gcc_xo_clk_src.c,
608 .rate = 600000000,
609 .dbg_name = "gpll0_clk_src",
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800610 .ops = &clk_ops_pll_acpu_vote,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700611 CLK_INIT(gpll0_clk_src.c),
612 },
613};
614
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800615static struct pll_vote_clk gpll0_ao_clk_src = {
616 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
617 .en_mask = BIT(0),
618 .status_reg = (void __iomem *)GPLL0_STATUS,
619 .status_mask = BIT(17),
620 .soft_vote = &soft_vote_gpll0,
621 .soft_vote_mask = PLL_SOFT_VOTE_ACPU,
622 .base = &virt_bases[GCC_BASE],
623 .c = {
624 .rate = 600000000,
625 .dbg_name = "gpll0_ao_clk_src",
626 .ops = &clk_ops_pll_acpu_vote,
627 CLK_INIT(gpll0_ao_clk_src.c),
628 },
629};
630
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700631static struct pll_vote_clk mmpll0_clk_src = {
632 .en_reg = (void __iomem *)MMSS_PLL_VOTE_APCS_REG,
633 .en_mask = BIT(0),
634 .status_reg = (void __iomem *)MMPLL0_PLL_STATUS,
635 .status_mask = BIT(17),
636 .base = &virt_bases[MMSS_BASE],
637 .c = {
638 .parent = &gcc_xo_clk_src.c,
639 .dbg_name = "mmpll0_clk_src",
640 .rate = 800000000,
641 .ops = &clk_ops_pll_vote,
642 CLK_INIT(mmpll0_clk_src.c),
643 },
644};
645
646static struct pll_config_regs mmpll0_regs __initdata = {
647 .l_reg = (void __iomem *)MMPLL0_PLL_L_VAL,
648 .m_reg = (void __iomem *)MMPLL0_PLL_M_VAL,
649 .n_reg = (void __iomem *)MMPLL0_PLL_N_VAL,
650 .config_reg = (void __iomem *)MMPLL0_PLL_USER_CTL,
651 .mode_reg = (void __iomem *)MMPLL0_PLL_MODE,
652 .base = &virt_bases[MMSS_BASE],
653};
654
655static struct pll_clk mmpll1_clk_src = {
656 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
657 .status_reg = (void __iomem *)MMPLL1_PLL_STATUS,
658 .base = &virt_bases[MMSS_BASE],
659 .c = {
660 .parent = &gcc_xo_clk_src.c,
661 .dbg_name = "mmpll1_clk_src",
662 .rate = 1200000000,
663 .ops = &clk_ops_local_pll,
664 CLK_INIT(mmpll1_clk_src.c),
665 },
666};
667
668static struct pll_config_regs mmpll1_regs __initdata = {
669 .l_reg = (void __iomem *)MMPLL1_PLL_L_VAL,
670 .m_reg = (void __iomem *)MMPLL1_PLL_M_VAL,
671 .n_reg = (void __iomem *)MMPLL1_PLL_N_VAL,
672 .config_reg = (void __iomem *)MMPLL1_PLL_USER_CTL,
673 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
674 .base = &virt_bases[MMSS_BASE],
675};
676
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700677static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = {
678 F( 960000, gcc_xo, 10, 1, 2),
679 F( 4800000, gcc_xo, 4, 0, 0),
680 F( 9600000, gcc_xo, 2, 0, 0),
Patrick Dalye408bb32013-11-08 17:35:27 -0800681 F(12000000, gpll0, 10, 1, 5),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700682 F(15000000, gpll0, 10, 1, 4),
683 F(19200000, gcc_xo, 1, 0, 0),
684 F(25000000, gpll0, 12, 1, 2),
685 F(50000000, gpll0, 12, 0, 0),
686 F_END,
687};
688
689static struct rcg_clk blsp1_qup1_spi_apps_clk_src = {
690 .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR,
691 .set_rate = set_rate_mnd,
692 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
693 .current_freq = &rcg_dummy_freq,
694 .base = &virt_bases[GCC_BASE],
695 .c = {
696 .dbg_name = "blsp1_qup1_spi_apps_clk_src",
697 .ops = &clk_ops_rcg_mnd,
698 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
699 CLK_INIT(blsp1_qup1_spi_apps_clk_src.c),
700 },
701};
702
703static struct rcg_clk blsp1_qup2_spi_apps_clk_src = {
704 .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR,
705 .set_rate = set_rate_mnd,
706 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
707 .current_freq = &rcg_dummy_freq,
708 .base = &virt_bases[GCC_BASE],
709 .c = {
710 .dbg_name = "blsp1_qup2_spi_apps_clk_src",
711 .ops = &clk_ops_rcg_mnd,
712 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
713 CLK_INIT(blsp1_qup2_spi_apps_clk_src.c),
714 },
715};
716
717static struct rcg_clk blsp1_qup3_spi_apps_clk_src = {
718 .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR,
719 .set_rate = set_rate_mnd,
720 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
721 .current_freq = &rcg_dummy_freq,
722 .base = &virt_bases[GCC_BASE],
723 .c = {
724 .dbg_name = "blsp1_qup3_spi_apps_clk_src",
725 .ops = &clk_ops_rcg_mnd,
726 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
727 CLK_INIT(blsp1_qup3_spi_apps_clk_src.c),
728 },
729};
730
731static struct rcg_clk blsp1_qup4_spi_apps_clk_src = {
732 .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR,
733 .set_rate = set_rate_mnd,
734 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
735 .current_freq = &rcg_dummy_freq,
736 .base = &virt_bases[GCC_BASE],
737 .c = {
738 .dbg_name = "blsp1_qup4_spi_apps_clk_src",
739 .ops = &clk_ops_rcg_mnd,
740 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
741 CLK_INIT(blsp1_qup4_spi_apps_clk_src.c),
742 },
743};
744
745static struct rcg_clk blsp1_qup5_spi_apps_clk_src = {
746 .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR,
747 .set_rate = set_rate_mnd,
748 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
749 .current_freq = &rcg_dummy_freq,
750 .base = &virt_bases[GCC_BASE],
751 .c = {
752 .dbg_name = "blsp1_qup5_spi_apps_clk_src",
753 .ops = &clk_ops_rcg_mnd,
754 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
755 CLK_INIT(blsp1_qup5_spi_apps_clk_src.c),
756 },
757};
758
759static struct rcg_clk blsp1_qup6_spi_apps_clk_src = {
760 .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR,
761 .set_rate = set_rate_mnd,
762 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
763 .current_freq = &rcg_dummy_freq,
764 .base = &virt_bases[GCC_BASE],
765 .c = {
766 .dbg_name = "blsp1_qup6_spi_apps_clk_src",
767 .ops = &clk_ops_rcg_mnd,
768 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
769 CLK_INIT(blsp1_qup6_spi_apps_clk_src.c),
770 },
771};
772
773static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = {
774 F( 3686400, gpll0, 1, 96, 15625),
775 F( 7372800, gpll0, 1, 192, 15625),
776 F(14745600, gpll0, 1, 384, 15625),
777 F(16000000, gpll0, 5, 2, 15),
778 F(19200000, gcc_xo, 1, 0, 0),
779 F(24000000, gpll0, 5, 1, 5),
780 F(32000000, gpll0, 1, 4, 75),
781 F(40000000, gpll0, 15, 0, 0),
782 F(46400000, gpll0, 1, 29, 375),
783 F(48000000, gpll0, 12.5, 0, 0),
784 F(51200000, gpll0, 1, 32, 375),
785 F(56000000, gpll0, 1, 7, 75),
786 F(58982400, gpll0, 1, 1536, 15625),
787 F(60000000, gpll0, 10, 0, 0),
Vikram Mulukutla0caccf92013-11-18 14:55:42 -0800788 F(63160000, gpll0, 9.5, 0, 0),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700789 F_END,
790};
791
792static struct rcg_clk blsp1_uart1_apps_clk_src = {
793 .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR,
794 .set_rate = set_rate_mnd,
795 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
796 .current_freq = &rcg_dummy_freq,
797 .base = &virt_bases[GCC_BASE],
798 .c = {
799 .dbg_name = "blsp1_uart1_apps_clk_src",
800 .ops = &clk_ops_rcg_mnd,
801 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
802 CLK_INIT(blsp1_uart1_apps_clk_src.c),
803 },
804};
805
806static struct rcg_clk blsp1_uart2_apps_clk_src = {
807 .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR,
808 .set_rate = set_rate_mnd,
809 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
810 .current_freq = &rcg_dummy_freq,
811 .base = &virt_bases[GCC_BASE],
812 .c = {
813 .dbg_name = "blsp1_uart2_apps_clk_src",
814 .ops = &clk_ops_rcg_mnd,
815 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
816 CLK_INIT(blsp1_uart2_apps_clk_src.c),
817 },
818};
819
820static struct rcg_clk blsp1_uart3_apps_clk_src = {
821 .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR,
822 .set_rate = set_rate_mnd,
823 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
824 .current_freq = &rcg_dummy_freq,
825 .base = &virt_bases[GCC_BASE],
826 .c = {
827 .dbg_name = "blsp1_uart3_apps_clk_src",
828 .ops = &clk_ops_rcg_mnd,
829 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
830 CLK_INIT(blsp1_uart3_apps_clk_src.c),
831 },
832};
833
834static struct rcg_clk blsp1_uart4_apps_clk_src = {
835 .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR,
836 .set_rate = set_rate_mnd,
837 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
838 .current_freq = &rcg_dummy_freq,
839 .base = &virt_bases[GCC_BASE],
840 .c = {
841 .dbg_name = "blsp1_uart4_apps_clk_src",
842 .ops = &clk_ops_rcg_mnd,
843 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
844 CLK_INIT(blsp1_uart4_apps_clk_src.c),
845 },
846};
847
848static struct rcg_clk blsp1_uart5_apps_clk_src = {
849 .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR,
850 .set_rate = set_rate_mnd,
851 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
852 .current_freq = &rcg_dummy_freq,
853 .base = &virt_bases[GCC_BASE],
854 .c = {
855 .dbg_name = "blsp1_uart5_apps_clk_src",
856 .ops = &clk_ops_rcg_mnd,
857 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
858 CLK_INIT(blsp1_uart5_apps_clk_src.c),
859 },
860};
861
862static struct rcg_clk blsp1_uart6_apps_clk_src = {
863 .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR,
864 .set_rate = set_rate_mnd,
865 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
866 .current_freq = &rcg_dummy_freq,
867 .base = &virt_bases[GCC_BASE],
868 .c = {
869 .dbg_name = "blsp1_uart6_apps_clk_src",
870 .ops = &clk_ops_rcg_mnd,
871 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
872 CLK_INIT(blsp1_uart6_apps_clk_src.c),
873 },
874};
875
876static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = {
877 F(50000000, gpll0, 12, 0, 0),
878 F(100000000, gpll0, 6, 0, 0),
879 F_END,
880};
881
882static struct rcg_clk ce1_clk_src = {
883 .cmd_rcgr_reg = CE1_CMD_RCGR,
884 .set_rate = set_rate_hid,
885 .freq_tbl = ftbl_gcc_ce1_clk,
886 .current_freq = &rcg_dummy_freq,
887 .base = &virt_bases[GCC_BASE],
888 .c = {
889 .dbg_name = "ce1_clk_src",
890 .ops = &clk_ops_rcg,
891 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
892 CLK_INIT(ce1_clk_src.c),
893 },
894};
895
896static struct clk_freq_tbl ftbl_gcc_gp1_3_clk[] = {
897 F(19200000, gcc_xo, 1, 0, 0),
898 F_END,
899};
900
901static struct rcg_clk gp1_clk_src = {
902 .cmd_rcgr_reg = GP1_CMD_RCGR,
903 .set_rate = set_rate_mnd,
904 .freq_tbl = ftbl_gcc_gp1_3_clk,
905 .current_freq = &rcg_dummy_freq,
906 .base = &virt_bases[GCC_BASE],
907 .c = {
908 .dbg_name = "gp1_clk_src",
909 .ops = &clk_ops_rcg_mnd,
910 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
911 CLK_INIT(gp1_clk_src.c),
912 },
913};
914
915static struct rcg_clk gp2_clk_src = {
916 .cmd_rcgr_reg = GP2_CMD_RCGR,
917 .set_rate = set_rate_mnd,
918 .freq_tbl = ftbl_gcc_gp1_3_clk,
919 .current_freq = &rcg_dummy_freq,
920 .base = &virt_bases[GCC_BASE],
921 .c = {
922 .dbg_name = "gp2_clk_src",
923 .ops = &clk_ops_rcg_mnd,
924 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
925 CLK_INIT(gp2_clk_src.c),
926 },
927};
928
929static struct rcg_clk gp3_clk_src = {
930 .cmd_rcgr_reg = GP3_CMD_RCGR,
931 .set_rate = set_rate_mnd,
932 .freq_tbl = ftbl_gcc_gp1_3_clk,
933 .current_freq = &rcg_dummy_freq,
934 .base = &virt_bases[GCC_BASE],
935 .c = {
936 .dbg_name = "gp3_clk_src",
937 .ops = &clk_ops_rcg_mnd,
938 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
939 CLK_INIT(gp3_clk_src.c),
940 },
941};
942
943static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = {
944 F(60000000, gpll0, 10, 0, 0),
945 F_END,
946};
947
948static struct rcg_clk pdm2_clk_src = {
949 .cmd_rcgr_reg = PDM2_CMD_RCGR,
950 .set_rate = set_rate_hid,
951 .freq_tbl = ftbl_gcc_pdm2_clk,
952 .current_freq = &rcg_dummy_freq,
953 .base = &virt_bases[GCC_BASE],
954 .c = {
955 .dbg_name = "pdm2_clk_src",
956 .ops = &clk_ops_rcg,
957 VDD_DIG_FMAX_MAP1(LOW, 120000000),
958 CLK_INIT(pdm2_clk_src.c),
959 },
960};
961
962static struct clk_freq_tbl ftbl_gcc_sdcc1_2_apps_clk[] = {
963 F( 144000, gcc_xo, 16, 3, 25),
964 F( 400000, gcc_xo, 12, 1, 4),
965 F( 20000000, gpll0, 15, 1, 2),
966 F( 25000000, gpll0, 12, 1, 2),
967 F( 50000000, gpll0, 12, 0, 0),
968 F(100000000, gpll0, 6, 0, 0),
969 F(200000000, gpll0, 3, 0, 0),
970 F_END,
971};
972
973static struct rcg_clk sdcc1_apps_clk_src = {
974 .cmd_rcgr_reg = SDCC1_APPS_CMD_RCGR,
975 .set_rate = set_rate_mnd,
976 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
977 .current_freq = &rcg_dummy_freq,
978 .base = &virt_bases[GCC_BASE],
979 .c = {
980 .dbg_name = "sdcc1_apps_clk_src",
981 .ops = &clk_ops_rcg_mnd,
982 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
983 CLK_INIT(sdcc1_apps_clk_src.c),
984 },
985};
986
987static struct rcg_clk sdcc2_apps_clk_src = {
988 .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR,
989 .set_rate = set_rate_mnd,
990 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
991 .current_freq = &rcg_dummy_freq,
992 .base = &virt_bases[GCC_BASE],
993 .c = {
994 .dbg_name = "sdcc2_apps_clk_src",
995 .ops = &clk_ops_rcg_mnd,
996 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
997 CLK_INIT(sdcc2_apps_clk_src.c),
998 },
999};
1000
1001static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = {
1002 F(75000000, gpll0, 8, 0, 0),
1003 F_END,
1004};
1005
1006static struct rcg_clk usb_hs_system_clk_src = {
1007 .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR,
1008 .set_rate = set_rate_hid,
1009 .freq_tbl = ftbl_gcc_usb_hs_system_clk,
1010 .current_freq = &rcg_dummy_freq,
1011 .base = &virt_bases[GCC_BASE],
1012 .c = {
1013 .dbg_name = "usb_hs_system_clk_src",
1014 .ops = &clk_ops_rcg,
1015 VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 100000000),
1016 CLK_INIT(usb_hs_system_clk_src.c),
1017 },
1018};
1019
1020static struct local_vote_clk gcc_blsp1_ahb_clk = {
1021 .cbcr_reg = BLSP1_AHB_CBCR,
1022 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1023 .en_mask = BIT(17),
1024 .base = &virt_bases[GCC_BASE],
1025 .c = {
1026 .dbg_name = "gcc_blsp1_ahb_clk",
1027 .ops = &clk_ops_vote,
1028 CLK_INIT(gcc_blsp1_ahb_clk.c),
1029 },
1030};
1031
1032static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = {
1033 .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR,
1034 .has_sibling = 1,
1035 .base = &virt_bases[GCC_BASE],
1036 .c = {
1037 .parent = &gcc_xo_clk_src.c,
1038 .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk",
1039 .ops = &clk_ops_branch,
1040 CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c),
1041 },
1042};
1043
1044static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = {
1045 .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR,
1046 .has_sibling = 0,
1047 .base = &virt_bases[GCC_BASE],
1048 .c = {
1049 .parent = &blsp1_qup1_spi_apps_clk_src.c,
1050 .dbg_name = "gcc_blsp1_qup1_spi_apps_clk",
1051 .ops = &clk_ops_branch,
1052 CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c),
1053 },
1054};
1055
1056static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = {
1057 .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR,
1058 .has_sibling = 1,
1059 .base = &virt_bases[GCC_BASE],
1060 .c = {
1061 .parent = &gcc_xo_clk_src.c,
1062 .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk",
1063 .ops = &clk_ops_branch,
1064 CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c),
1065 },
1066};
1067
1068static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = {
1069 .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR,
1070 .has_sibling = 0,
1071 .base = &virt_bases[GCC_BASE],
1072 .c = {
1073 .parent = &blsp1_qup2_spi_apps_clk_src.c,
1074 .dbg_name = "gcc_blsp1_qup2_spi_apps_clk",
1075 .ops = &clk_ops_branch,
1076 CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c),
1077 },
1078};
1079
1080static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = {
1081 .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR,
1082 .has_sibling = 1,
1083 .base = &virt_bases[GCC_BASE],
1084 .c = {
1085 .parent = &gcc_xo_clk_src.c,
1086 .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk",
1087 .ops = &clk_ops_branch,
1088 CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c),
1089 },
1090};
1091
1092static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = {
1093 .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR,
1094 .has_sibling = 0,
1095 .base = &virt_bases[GCC_BASE],
1096 .c = {
1097 .parent = &blsp1_qup3_spi_apps_clk_src.c,
1098 .dbg_name = "gcc_blsp1_qup3_spi_apps_clk",
1099 .ops = &clk_ops_branch,
1100 CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c),
1101 },
1102};
1103
1104static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = {
1105 .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR,
1106 .has_sibling = 1,
1107 .base = &virt_bases[GCC_BASE],
1108 .c = {
1109 .parent = &gcc_xo_clk_src.c,
1110 .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk",
1111 .ops = &clk_ops_branch,
1112 CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c),
1113 },
1114};
1115
1116static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = {
1117 .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR,
1118 .has_sibling = 0,
1119 .base = &virt_bases[GCC_BASE],
1120 .c = {
1121 .parent = &blsp1_qup4_spi_apps_clk_src.c,
1122 .dbg_name = "gcc_blsp1_qup4_spi_apps_clk",
1123 .ops = &clk_ops_branch,
1124 CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c),
1125 },
1126};
1127
1128static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = {
1129 .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR,
1130 .has_sibling = 1,
1131 .base = &virt_bases[GCC_BASE],
1132 .c = {
1133 .parent = &gcc_xo_clk_src.c,
1134 .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk",
1135 .ops = &clk_ops_branch,
1136 CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c),
1137 },
1138};
1139
1140static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = {
1141 .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR,
1142 .has_sibling = 0,
1143 .base = &virt_bases[GCC_BASE],
1144 .c = {
1145 .parent = &blsp1_qup5_spi_apps_clk_src.c,
1146 .dbg_name = "gcc_blsp1_qup5_spi_apps_clk",
1147 .ops = &clk_ops_branch,
1148 CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c),
1149 },
1150};
1151
1152static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = {
1153 .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR,
1154 .has_sibling = 1,
1155 .base = &virt_bases[GCC_BASE],
1156 .c = {
1157 .parent = &gcc_xo_clk_src.c,
1158 .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk",
1159 .ops = &clk_ops_branch,
1160 CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c),
1161 },
1162};
1163
1164static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = {
1165 .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR,
1166 .has_sibling = 0,
1167 .base = &virt_bases[GCC_BASE],
1168 .c = {
1169 .parent = &blsp1_qup6_spi_apps_clk_src.c,
1170 .dbg_name = "gcc_blsp1_qup6_spi_apps_clk",
1171 .ops = &clk_ops_branch,
1172 CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c),
1173 },
1174};
1175
1176static struct branch_clk gcc_blsp1_uart1_apps_clk = {
1177 .cbcr_reg = BLSP1_UART1_APPS_CBCR,
1178 .has_sibling = 0,
1179 .base = &virt_bases[GCC_BASE],
1180 .c = {
1181 .parent = &blsp1_uart1_apps_clk_src.c,
1182 .dbg_name = "gcc_blsp1_uart1_apps_clk",
1183 .ops = &clk_ops_branch,
1184 CLK_INIT(gcc_blsp1_uart1_apps_clk.c),
1185 },
1186};
1187
1188static struct branch_clk gcc_blsp1_uart2_apps_clk = {
1189 .cbcr_reg = BLSP1_UART2_APPS_CBCR,
1190 .has_sibling = 0,
1191 .base = &virt_bases[GCC_BASE],
1192 .c = {
1193 .parent = &blsp1_uart2_apps_clk_src.c,
1194 .dbg_name = "gcc_blsp1_uart2_apps_clk",
1195 .ops = &clk_ops_branch,
1196 CLK_INIT(gcc_blsp1_uart2_apps_clk.c),
1197 },
1198};
1199
1200static struct branch_clk gcc_blsp1_uart3_apps_clk = {
1201 .cbcr_reg = BLSP1_UART3_APPS_CBCR,
1202 .has_sibling = 0,
1203 .base = &virt_bases[GCC_BASE],
1204 .c = {
1205 .parent = &blsp1_uart3_apps_clk_src.c,
1206 .dbg_name = "gcc_blsp1_uart3_apps_clk",
1207 .ops = &clk_ops_branch,
1208 CLK_INIT(gcc_blsp1_uart3_apps_clk.c),
1209 },
1210};
1211
1212static struct branch_clk gcc_blsp1_uart4_apps_clk = {
1213 .cbcr_reg = BLSP1_UART4_APPS_CBCR,
1214 .has_sibling = 0,
1215 .base = &virt_bases[GCC_BASE],
1216 .c = {
1217 .parent = &blsp1_uart4_apps_clk_src.c,
1218 .dbg_name = "gcc_blsp1_uart4_apps_clk",
1219 .ops = &clk_ops_branch,
1220 CLK_INIT(gcc_blsp1_uart4_apps_clk.c),
1221 },
1222};
1223
1224static struct branch_clk gcc_blsp1_uart5_apps_clk = {
1225 .cbcr_reg = BLSP1_UART5_APPS_CBCR,
1226 .has_sibling = 0,
1227 .base = &virt_bases[GCC_BASE],
1228 .c = {
1229 .parent = &blsp1_uart5_apps_clk_src.c,
1230 .dbg_name = "gcc_blsp1_uart5_apps_clk",
1231 .ops = &clk_ops_branch,
1232 CLK_INIT(gcc_blsp1_uart5_apps_clk.c),
1233 },
1234};
1235
1236static struct branch_clk gcc_blsp1_uart6_apps_clk = {
1237 .cbcr_reg = BLSP1_UART6_APPS_CBCR,
1238 .has_sibling = 0,
1239 .base = &virt_bases[GCC_BASE],
1240 .c = {
1241 .parent = &blsp1_uart6_apps_clk_src.c,
1242 .dbg_name = "gcc_blsp1_uart6_apps_clk",
1243 .ops = &clk_ops_branch,
1244 CLK_INIT(gcc_blsp1_uart6_apps_clk.c),
1245 },
1246};
1247
1248static struct local_vote_clk gcc_boot_rom_ahb_clk = {
1249 .cbcr_reg = BOOT_ROM_AHB_CBCR,
1250 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1251 .en_mask = BIT(10),
1252 .base = &virt_bases[GCC_BASE],
1253 .c = {
1254 .dbg_name = "gcc_boot_rom_ahb_clk",
1255 .ops = &clk_ops_vote,
1256 CLK_INIT(gcc_boot_rom_ahb_clk.c),
1257 },
1258};
1259
1260static struct local_vote_clk gcc_ce1_ahb_clk = {
1261 .cbcr_reg = CE1_AHB_CBCR,
1262 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1263 .en_mask = BIT(3),
1264 .base = &virt_bases[GCC_BASE],
1265 .c = {
1266 .dbg_name = "gcc_ce1_ahb_clk",
1267 .ops = &clk_ops_vote,
1268 CLK_INIT(gcc_ce1_ahb_clk.c),
1269 },
1270};
1271
1272static struct local_vote_clk gcc_ce1_axi_clk = {
1273 .cbcr_reg = CE1_AXI_CBCR,
1274 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1275 .en_mask = BIT(4),
1276 .base = &virt_bases[GCC_BASE],
1277 .c = {
1278 .dbg_name = "gcc_ce1_axi_clk",
1279 .ops = &clk_ops_vote,
1280 CLK_INIT(gcc_ce1_axi_clk.c),
1281 },
1282};
1283
1284static struct local_vote_clk gcc_ce1_clk = {
1285 .cbcr_reg = CE1_CBCR,
1286 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1287 .en_mask = BIT(5),
1288 .base = &virt_bases[GCC_BASE],
1289 .c = {
Vikram Mulukutla1ed9e112013-11-01 18:36:13 -07001290 .parent = &ce1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001291 .dbg_name = "gcc_ce1_clk",
1292 .ops = &clk_ops_vote,
1293 CLK_INIT(gcc_ce1_clk.c),
1294 },
1295};
1296
1297static struct branch_clk gcc_copss_smmu_ahb_clk = {
1298 .cbcr_reg = COPSS_SMMU_AHB_CBCR,
1299 .has_sibling = 1,
1300 .base = &virt_bases[GCC_BASE],
1301 .c = {
1302 .dbg_name = "gcc_copss_smmu_ahb_clk",
1303 .ops = &clk_ops_branch,
1304 CLK_INIT(gcc_copss_smmu_ahb_clk.c),
1305 },
1306};
1307
1308static struct branch_clk gcc_lpss_smmu_ahb_clk = {
1309 .cbcr_reg = LPSS_SMMU_AHB_CBCR,
1310 .has_sibling = 1,
1311 .base = &virt_bases[GCC_BASE],
1312 .c = {
1313 .dbg_name = "gcc_lpss_smmu_ahb_clk",
1314 .ops = &clk_ops_branch,
1315 CLK_INIT(gcc_lpss_smmu_ahb_clk.c),
1316 },
1317};
1318
1319static struct branch_clk gcc_gp1_clk = {
1320 .cbcr_reg = GP1_CBCR,
1321 .has_sibling = 0,
1322 .base = &virt_bases[GCC_BASE],
1323 .c = {
1324 .parent = &gp1_clk_src.c,
1325 .dbg_name = "gcc_gp1_clk",
1326 .ops = &clk_ops_branch,
1327 CLK_INIT(gcc_gp1_clk.c),
1328 },
1329};
1330
1331static struct branch_clk gcc_gp2_clk = {
1332 .cbcr_reg = GP2_CBCR,
1333 .has_sibling = 0,
1334 .base = &virt_bases[GCC_BASE],
1335 .c = {
1336 .parent = &gp2_clk_src.c,
1337 .dbg_name = "gcc_gp2_clk",
1338 .ops = &clk_ops_branch,
1339 CLK_INIT(gcc_gp2_clk.c),
1340 },
1341};
1342
1343static struct branch_clk gcc_gp3_clk = {
1344 .cbcr_reg = GP3_CBCR,
1345 .has_sibling = 0,
1346 .base = &virt_bases[GCC_BASE],
1347 .c = {
1348 .parent = &gp3_clk_src.c,
1349 .dbg_name = "gcc_gp3_clk",
1350 .ops = &clk_ops_branch,
1351 CLK_INIT(gcc_gp3_clk.c),
1352 },
1353};
1354
1355static struct branch_clk gcc_lpass_q6_axi_clk = {
1356 .cbcr_reg = LPASS_Q6_AXI_CBCR,
1357 .has_sibling = 1,
1358 .base = &virt_bases[GCC_BASE],
1359 .c = {
1360 .dbg_name = "gcc_lpass_q6_axi_clk",
1361 .ops = &clk_ops_branch,
1362 CLK_INIT(gcc_lpass_q6_axi_clk.c),
1363 },
1364};
1365
1366static struct branch_clk gcc_mmss_noc_cfg_ahb_clk = {
1367 .cbcr_reg = MMSS_NOC_CFG_AHB_CBCR,
1368 .has_sibling = 1,
1369 .base = &virt_bases[GCC_BASE],
1370 .c = {
1371 .dbg_name = "gcc_mmss_noc_cfg_ahb_clk",
1372 .ops = &clk_ops_branch,
1373 CLK_INIT(gcc_mmss_noc_cfg_ahb_clk.c),
1374 },
1375};
1376
1377static struct branch_clk gcc_mss_cfg_ahb_clk = {
1378 .cbcr_reg = MSS_CFG_AHB_CBCR,
1379 .has_sibling = 1,
1380 .base = &virt_bases[GCC_BASE],
1381 .c = {
1382 .dbg_name = "gcc_mss_cfg_ahb_clk",
1383 .ops = &clk_ops_branch,
1384 CLK_INIT(gcc_mss_cfg_ahb_clk.c),
1385 },
1386};
1387
1388static struct branch_clk gcc_mss_q6_bimc_axi_clk = {
1389 .cbcr_reg = MSS_Q6_BIMC_AXI_CBCR,
1390 .has_sibling = 1,
1391 .base = &virt_bases[GCC_BASE],
1392 .c = {
1393 .dbg_name = "gcc_mss_q6_bimc_axi_clk",
1394 .ops = &clk_ops_branch,
1395 CLK_INIT(gcc_mss_q6_bimc_axi_clk.c),
1396 },
1397};
1398
1399static struct branch_clk gcc_pdm2_clk = {
1400 .cbcr_reg = PDM2_CBCR,
1401 .has_sibling = 0,
1402 .base = &virt_bases[GCC_BASE],
1403 .c = {
1404 .parent = &pdm2_clk_src.c,
1405 .dbg_name = "gcc_pdm2_clk",
1406 .ops = &clk_ops_branch,
1407 CLK_INIT(gcc_pdm2_clk.c),
1408 },
1409};
1410
1411static struct branch_clk gcc_pdm_ahb_clk = {
1412 .cbcr_reg = PDM_AHB_CBCR,
1413 .has_sibling = 1,
1414 .base = &virt_bases[GCC_BASE],
1415 .c = {
1416 .dbg_name = "gcc_pdm_ahb_clk",
1417 .ops = &clk_ops_branch,
1418 CLK_INIT(gcc_pdm_ahb_clk.c),
1419 },
1420};
1421
1422static struct local_vote_clk gcc_prng_ahb_clk = {
1423 .cbcr_reg = PRNG_AHB_CBCR,
1424 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1425 .en_mask = BIT(13),
1426 .base = &virt_bases[GCC_BASE],
1427 .c = {
1428 .dbg_name = "gcc_prng_ahb_clk",
1429 .ops = &clk_ops_vote,
1430 CLK_INIT(gcc_prng_ahb_clk.c),
1431 },
1432};
1433
1434static struct branch_clk gcc_sdcc1_ahb_clk = {
1435 .cbcr_reg = SDCC1_AHB_CBCR,
1436 .has_sibling = 1,
1437 .base = &virt_bases[GCC_BASE],
1438 .c = {
1439 .dbg_name = "gcc_sdcc1_ahb_clk",
1440 .ops = &clk_ops_branch,
1441 CLK_INIT(gcc_sdcc1_ahb_clk.c),
1442 },
1443};
1444
1445static struct branch_clk gcc_sdcc1_apps_clk = {
1446 .cbcr_reg = SDCC1_APPS_CBCR,
1447 .has_sibling = 0,
1448 .base = &virt_bases[GCC_BASE],
1449 .c = {
1450 .parent = &sdcc1_apps_clk_src.c,
1451 .dbg_name = "gcc_sdcc1_apps_clk",
1452 .ops = &clk_ops_branch,
1453 CLK_INIT(gcc_sdcc1_apps_clk.c),
1454 },
1455};
1456
1457static struct branch_clk gcc_sdcc2_ahb_clk = {
1458 .cbcr_reg = SDCC2_AHB_CBCR,
1459 .has_sibling = 1,
1460 .base = &virt_bases[GCC_BASE],
1461 .c = {
1462 .dbg_name = "gcc_sdcc2_ahb_clk",
1463 .ops = &clk_ops_branch,
1464 CLK_INIT(gcc_sdcc2_ahb_clk.c),
1465 },
1466};
1467
1468static struct branch_clk gcc_sdcc2_apps_clk = {
1469 .cbcr_reg = SDCC2_APPS_CBCR,
1470 .has_sibling = 0,
1471 .base = &virt_bases[GCC_BASE],
1472 .c = {
1473 .parent = &sdcc2_apps_clk_src.c,
1474 .dbg_name = "gcc_sdcc2_apps_clk",
1475 .ops = &clk_ops_branch,
1476 CLK_INIT(gcc_sdcc2_apps_clk.c),
1477 },
1478};
1479
1480static struct branch_clk gcc_usb2a_phy_sleep_clk = {
1481 .cbcr_reg = USB2A_PHY_SLEEP_CBCR,
1482 .has_sibling = 1,
1483 .base = &virt_bases[GCC_BASE],
1484 .c = {
1485 .dbg_name = "gcc_usb2a_phy_sleep_clk",
1486 .ops = &clk_ops_branch,
1487 CLK_INIT(gcc_usb2a_phy_sleep_clk.c),
1488 },
1489};
1490
1491static struct branch_clk gcc_usb_hs_ahb_clk = {
1492 .cbcr_reg = USB_HS_AHB_CBCR,
1493 .has_sibling = 1,
1494 .base = &virt_bases[GCC_BASE],
1495 .c = {
1496 .dbg_name = "gcc_usb_hs_ahb_clk",
1497 .ops = &clk_ops_branch,
1498 CLK_INIT(gcc_usb_hs_ahb_clk.c),
1499 },
1500};
1501
1502static struct branch_clk gcc_usb_hs_system_clk = {
1503 .cbcr_reg = USB_HS_SYSTEM_CBCR,
1504 .has_sibling = 0,
1505 .bcr_reg = USB_HS_BCR,
1506 .base = &virt_bases[GCC_BASE],
1507 .c = {
1508 .parent = &usb_hs_system_clk_src.c,
1509 .dbg_name = "gcc_usb_hs_system_clk",
1510 .ops = &clk_ops_branch,
1511 CLK_INIT(gcc_usb_hs_system_clk.c),
1512 },
1513};
1514
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07001515static struct branch_clk gcc_bimc_smmu_clk = {
1516 .cbcr_reg = BIMC_SMMU_CBCR,
1517 .has_sibling = 0,
1518 .base = &virt_bases[GCC_BASE],
1519 .c = {
1520 .dbg_name = "gcc_bimc_smmu_clk",
1521 .ops = &clk_ops_branch,
1522 CLK_INIT(gcc_bimc_smmu_clk.c),
1523 },
1524};
1525
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001526static struct clk_freq_tbl ftbl_csi0_1_clk[] = {
1527 F_MM(100000000, gpll0, 6, 0, 0),
1528 F_MM(200000000, mmpll0, 4, 0, 0),
1529 F_END,
1530};
1531
1532static struct rcg_clk csi0_clk_src = {
1533 .cmd_rcgr_reg = CSI0_CMD_RCGR,
1534 .set_rate = set_rate_hid,
1535 .freq_tbl = ftbl_csi0_1_clk,
1536 .current_freq = &rcg_dummy_freq,
1537 .base = &virt_bases[MMSS_BASE],
1538 .c = {
1539 .dbg_name = "csi0_clk_src",
1540 .ops = &clk_ops_rcg,
1541 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1542 CLK_INIT(csi0_clk_src.c),
1543 },
1544};
1545
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001546static struct clk_freq_tbl ftbl_mmss_mmssnoc_axi_clk[] = {
1547 F_MM( 19200000, gcc_xo, 1, 0, 0),
1548 F_MM( 37500000, gpll0, 16, 0, 0),
1549 F_MM( 50000000, gpll0, 12, 0, 0),
1550 F_MM( 75000000, gpll0, 8, 0, 0),
1551 F_MM(100000000, gpll0, 6, 0, 0),
1552 F_MM(150000000, gpll0, 4, 0, 0),
1553 F_MM(200000000, mmpll0, 4, 0, 0),
1554 F_END,
1555};
1556
1557static struct rcg_clk axi_clk_src = {
1558 .cmd_rcgr_reg = AXI_CMD_RCGR,
1559 .set_rate = set_rate_hid,
1560 .freq_tbl = ftbl_mmss_mmssnoc_axi_clk,
1561 .current_freq = &rcg_dummy_freq,
1562 .base = &virt_bases[MMSS_BASE],
1563 .c = {
1564 .dbg_name = "axi_clk_src",
1565 .ops = &clk_ops_rcg,
1566 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1567 CLK_INIT(axi_clk_src.c),
1568 },
1569};
1570
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08001571static DEFINE_CLK_VOTER(mdp_axi_clk_src, &axi_clk_src.c, 200000000);
1572static DEFINE_CLK_VOTER(mmssnoc_axi_clk_src, &axi_clk_src.c, 200000000);
1573
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001574static struct clk_ops dsi_byte_clk_src_ops;
1575static struct clk_ops dsi_pixel_clk_src_ops;
1576static struct clk_ops dsi_dsi_clk_src_ops;
1577
1578static struct dsi_pll_vco_clk dsi_vco = {
1579 .vco_clk_min = 600000000,
1580 .vco_clk_max = 1200000000,
1581 .pref_div_ratio = 26,
1582 .c = {
1583 .parent = &gcc_xo_clk_src.c,
1584 .dbg_name = "dsi_vco",
1585 .ops = &clk_ops_dsi_vco,
1586 CLK_INIT(dsi_vco.c),
1587 },
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001588};
1589
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001590static struct clk dsi_pll_byte = {
1591 .parent = &dsi_vco.c,
1592 .dbg_name = "dsi_pll_byte",
1593 .ops = &clk_ops_dsi_byteclk,
1594 CLK_INIT(dsi_pll_byte),
1595};
1596
1597static struct clk dsi_pll_pixel = {
1598 .parent = &dsi_vco.c,
1599 .dbg_name = "dsi_pll_pixel",
1600 .ops = &clk_ops_dsi_dsiclk,
1601 CLK_INIT(dsi_pll_pixel),
1602};
1603
1604static struct clk_freq_tbl pixel_freq_tbl[] = {
1605 {
1606 .src_clk = &dsi_pll_pixel,
1607 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1608 },
1609 F_END
1610};
1611
1612#define CFG_RCGR_DIV_MASK BM(4, 0)
1613
1614static int set_rate_pixel_byte_clk(struct clk *clk, unsigned long rate)
1615{
1616 struct rcg_clk *rcg = to_rcg_clk(clk);
1617 struct clk *pll = clk->parent;
1618 unsigned long source_rate, div;
1619 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1620 int rc;
1621
1622 if (rate == 0)
1623 return clk_set_rate(pll, 0);
1624
1625 source_rate = clk_round_rate(pll, rate);
1626 if (!source_rate || ((2 * source_rate) % rate))
1627 return -EINVAL;
1628
1629 div = ((2 * source_rate)/rate) - 1;
1630 if (div > CFG_RCGR_DIV_MASK)
1631 return -EINVAL;
1632
1633 rc = clk_set_rate(pll, source_rate);
1634 if (rc)
1635 return rc;
1636
1637 cur_freq->div_src_val &= ~CFG_RCGR_DIV_MASK;
1638 cur_freq->div_src_val |= BVAL(4, 0, div);
1639 rcg->set_rate(rcg, cur_freq);
1640
1641 return 0;
1642}
1643
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001644static struct rcg_clk dsi_pclk_clk_src = {
1645 .cmd_rcgr_reg = DSI_PCLK_CMD_RCGR,
1646 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001647 .current_freq = pixel_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001648 .base = &virt_bases[MMSS_BASE],
1649 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001650 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001651 .dbg_name = "dsi_pclk_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001652 .ops = &dsi_pixel_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001653 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 103330000),
1654 CLK_INIT(dsi_pclk_clk_src.c),
1655 },
1656};
1657
1658static struct clk_freq_tbl ftbl_oxili_gfx3d_clk[] = {
1659 F_MM( 19200000, gcc_xo, 1, 0, 0),
1660 F_MM( 37500000, gpll0, 16, 0, 0),
1661 F_MM( 50000000, gpll0, 12, 0, 0),
1662 F_MM( 75000000, gpll0, 8, 0, 0),
1663 F_MM(100000000, gpll0, 6, 0, 0),
1664 F_MM(150000000, gpll0, 4, 0, 0),
1665 F_MM(200000000, gpll0, 3, 0, 0),
1666 F_MM(300000000, gpll0, 2, 0, 0),
1667 F_MM(400000000, mmpll1, 3, 0, 0),
1668 F_END,
1669};
1670
1671static struct rcg_clk gfx3d_clk_src = {
1672 .cmd_rcgr_reg = GFX3D_CMD_RCGR,
1673 .set_rate = set_rate_hid,
1674 .freq_tbl = ftbl_oxili_gfx3d_clk,
1675 .current_freq = &rcg_dummy_freq,
1676 .base = &virt_bases[MMSS_BASE],
1677 .c = {
1678 .dbg_name = "gfx3d_clk_src",
1679 .ops = &clk_ops_rcg,
1680 VDD_DIG_FMAX_MAP3(LOW, 150000000, NOMINAL, 300000000, HIGH,
1681 400000000),
1682 CLK_INIT(gfx3d_clk_src.c),
1683 },
1684};
1685
1686static struct clk_freq_tbl ftbl_vfe_clk[] = {
1687 F_MM( 37500000, gpll0, 16, 0, 0),
1688 F_MM( 50000000, gpll0, 12, 0, 0),
1689 F_MM( 60000000, gpll0, 10, 0, 0),
1690 F_MM( 80000000, gpll0, 7.5, 0, 0),
1691 F_MM(100000000, gpll0, 6, 0, 0),
1692 F_MM(109090000, gpll0, 5.5, 0, 0),
1693 F_MM(133330000, gpll0, 4.5, 0, 0),
1694 F_MM(200000000, gpll0, 3, 0, 0),
1695 F_MM(228570000, mmpll0, 3.5, 0, 0),
1696 F_MM(266670000, mmpll0, 3, 0, 0),
1697 F_MM(320000000, mmpll0, 2.5, 0, 0),
1698 F_END,
1699};
1700
1701static struct rcg_clk vfe_clk_src = {
1702 .cmd_rcgr_reg = VFE_CMD_RCGR,
1703 .set_rate = set_rate_hid,
1704 .freq_tbl = ftbl_vfe_clk,
1705 .current_freq = &rcg_dummy_freq,
1706 .base = &virt_bases[MMSS_BASE],
1707 .c = {
1708 .dbg_name = "vfe_clk_src",
1709 .ops = &clk_ops_rcg,
1710 VDD_DIG_FMAX_MAP3(LOW, 133330000, NOMINAL, 266670000, HIGH,
1711 320000000),
1712 CLK_INIT(vfe_clk_src.c),
1713 },
1714};
1715
1716static struct rcg_clk csi1_clk_src = {
1717 .cmd_rcgr_reg = CSI1_CMD_RCGR,
1718 .set_rate = set_rate_hid,
1719 .freq_tbl = ftbl_csi0_1_clk,
1720 .current_freq = &rcg_dummy_freq,
1721 .base = &virt_bases[MMSS_BASE],
1722 .c = {
1723 .dbg_name = "csi1_clk_src",
1724 .ops = &clk_ops_rcg,
1725 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1726 CLK_INIT(csi1_clk_src.c),
1727 },
1728};
1729
1730static struct clk_freq_tbl ftbl_csi0_1phytimer_clk[] = {
1731 F_MM(100000000, gpll0, 6, 0, 0),
1732 F_MM(200000000, mmpll0, 4, 0, 0),
1733 F_END,
1734};
1735
1736static struct rcg_clk csi0phytimer_clk_src = {
1737 .cmd_rcgr_reg = CSI0PHYTIMER_CMD_RCGR,
1738 .set_rate = set_rate_hid,
1739 .freq_tbl = ftbl_csi0_1phytimer_clk,
1740 .current_freq = &rcg_dummy_freq,
1741 .base = &virt_bases[MMSS_BASE],
1742 .c = {
1743 .dbg_name = "csi0phytimer_clk_src",
1744 .ops = &clk_ops_rcg,
1745 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1746 CLK_INIT(csi0phytimer_clk_src.c),
1747 },
1748};
1749
1750static struct rcg_clk csi1phytimer_clk_src = {
1751 .cmd_rcgr_reg = CSI1PHYTIMER_CMD_RCGR,
1752 .set_rate = set_rate_hid,
1753 .freq_tbl = ftbl_csi0_1phytimer_clk,
1754 .current_freq = &rcg_dummy_freq,
1755 .base = &virt_bases[MMSS_BASE],
1756 .c = {
1757 .dbg_name = "csi1phytimer_clk_src",
1758 .ops = &clk_ops_rcg,
1759 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1760 CLK_INIT(csi1phytimer_clk_src.c),
1761 },
1762};
1763
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001764/*
1765 * The DSI clock will always use a divider of 1. However, we still
1766 * need to set the right voltage and source.
1767 */
1768static int set_rate_dsi_clk(struct clk *clk, unsigned long rate)
1769{
1770 struct rcg_clk *rcg = to_rcg_clk(clk);
1771 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1772
1773 rcg->set_rate(rcg, cur_freq);
1774
1775 return 0;
1776}
1777
1778static struct clk_freq_tbl dsi_freq_tbl[] = {
1779 {
1780 .src_clk = &dsi_pll_pixel,
1781 .div_src_val = BVAL(4, 0, 0) |
1782 BVAL(10, 8, dsipll_mm_source_val),
1783 },
1784 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001785};
1786
1787static struct rcg_clk dsi_clk_src = {
1788 .cmd_rcgr_reg = DSI_CMD_RCGR,
1789 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001790 .current_freq = dsi_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001791 .base = &virt_bases[MMSS_BASE],
1792 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001793 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001794 .dbg_name = "dsi_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001795 .ops = &dsi_dsi_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001796 VDD_DIG_FMAX_MAP2(LOW, 155000000, NOMINAL, 310000000),
1797 CLK_INIT(dsi_clk_src.c),
1798 },
1799};
1800
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001801static struct clk_freq_tbl byte_freq_tbl[] = {
1802 {
1803 .src_clk = &dsi_pll_byte,
1804 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1805 },
1806 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001807};
1808
1809static struct rcg_clk dsi_byte_clk_src = {
1810 .cmd_rcgr_reg = DSI_BYTE_CMD_RCGR,
1811 .set_rate = set_rate_hid,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001812 .current_freq = byte_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001813 .base = &virt_bases[MMSS_BASE],
1814 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001815 .parent = &dsi_pll_byte,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001816 .dbg_name = "dsi_byte_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001817 .ops = &dsi_byte_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001818 VDD_DIG_FMAX_MAP2(LOW, 62500000, NOMINAL, 125000000),
1819 CLK_INIT(dsi_byte_clk_src.c),
1820 },
1821};
1822
1823static struct clk_freq_tbl ftbl_dsi_esc_clk[] = {
1824 F_MM(19200000, gcc_xo, 1, 0, 0),
1825 F_END,
1826};
1827
1828static struct rcg_clk dsi_esc_clk_src = {
1829 .cmd_rcgr_reg = DSI_ESC_CMD_RCGR,
1830 .set_rate = set_rate_hid,
1831 .freq_tbl = ftbl_dsi_esc_clk,
1832 .current_freq = &rcg_dummy_freq,
1833 .base = &virt_bases[MMSS_BASE],
1834 .c = {
1835 .dbg_name = "dsi_esc_clk_src",
1836 .ops = &clk_ops_rcg,
1837 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1838 CLK_INIT(dsi_esc_clk_src.c),
1839 },
1840};
1841
1842static struct clk_freq_tbl ftbl_mclk0_1_clk[] = {
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07001843 F_MM(24000000, gpll0, 5, 1, 5),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001844 F_MM(66670000, gpll0, 9, 0, 0),
1845 F_END,
1846};
1847
1848static struct rcg_clk mclk0_clk_src = {
1849 .cmd_rcgr_reg = MCLK0_CMD_RCGR,
1850 .set_rate = set_rate_mnd,
1851 .freq_tbl = ftbl_mclk0_1_clk,
1852 .current_freq = &rcg_dummy_freq,
1853 .base = &virt_bases[MMSS_BASE],
1854 .c = {
1855 .dbg_name = "mclk0_clk_src",
1856 .ops = &clk_ops_rcg_mnd,
1857 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1858 CLK_INIT(mclk0_clk_src.c),
1859 },
1860};
1861
1862static struct rcg_clk mclk1_clk_src = {
1863 .cmd_rcgr_reg = MCLK1_CMD_RCGR,
1864 .set_rate = set_rate_mnd,
1865 .freq_tbl = ftbl_mclk0_1_clk,
1866 .current_freq = &rcg_dummy_freq,
1867 .base = &virt_bases[MMSS_BASE],
1868 .c = {
1869 .dbg_name = "mclk1_clk_src",
1870 .ops = &clk_ops_rcg_mnd,
1871 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1872 CLK_INIT(mclk1_clk_src.c),
1873 },
1874};
1875
1876static struct clk_freq_tbl ftbl_mdp_vsync_clk[] = {
1877 F_MM(19200000, gcc_xo, 1, 0, 0),
1878 F_END,
1879};
1880
1881static struct rcg_clk mdp_vsync_clk_src = {
1882 .cmd_rcgr_reg = MDP_VSYNC_CMD_RCGR,
1883 .set_rate = set_rate_hid,
1884 .freq_tbl = ftbl_mdp_vsync_clk,
1885 .current_freq = &rcg_dummy_freq,
1886 .base = &virt_bases[MMSS_BASE],
1887 .c = {
1888 .dbg_name = "mdp_vsync_clk_src",
1889 .ops = &clk_ops_rcg,
1890 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1891 CLK_INIT(mdp_vsync_clk_src.c),
1892 },
1893};
1894
1895static struct branch_clk bimc_gfx_clk = {
1896 .cbcr_reg = BIMC_GFX_CBCR,
1897 .has_sibling = 1,
1898 .base = &virt_bases[MMSS_BASE],
1899 .c = {
1900 .dbg_name = "bimc_gfx_clk",
1901 .ops = &clk_ops_branch,
1902 CLK_INIT(bimc_gfx_clk.c),
1903 },
1904};
1905
1906static struct branch_clk csi0_clk = {
1907 .cbcr_reg = CSI0_CBCR,
1908 .has_sibling = 1,
1909 .base = &virt_bases[MMSS_BASE],
1910 .c = {
1911 .parent = &csi0_clk_src.c,
1912 .dbg_name = "csi0_clk",
1913 .ops = &clk_ops_branch,
1914 CLK_INIT(csi0_clk.c),
1915 },
1916};
1917
1918static struct branch_clk csi0phy_clk = {
1919 .cbcr_reg = CSI0PHY_CBCR,
1920 .has_sibling = 1,
1921 .base = &virt_bases[MMSS_BASE],
1922 .c = {
1923 .parent = &csi0_clk_src.c,
1924 .dbg_name = "csi0phy_clk",
1925 .ops = &clk_ops_branch,
1926 CLK_INIT(csi0phy_clk.c),
1927 },
1928};
1929
1930static struct branch_clk csi0phytimer_clk = {
1931 .cbcr_reg = CSI0PHYTIMER_CBCR,
1932 .has_sibling = 0,
1933 .base = &virt_bases[MMSS_BASE],
1934 .c = {
1935 .parent = &csi0phytimer_clk_src.c,
1936 .dbg_name = "csi0phytimer_clk",
1937 .ops = &clk_ops_branch,
1938 CLK_INIT(csi0phytimer_clk.c),
1939 },
1940};
1941
1942static struct branch_clk csi0pix_clk = {
1943 .cbcr_reg = CSI0PIX_CBCR,
1944 .has_sibling = 1,
1945 .base = &virt_bases[MMSS_BASE],
1946 .c = {
1947 .parent = &csi0_clk_src.c,
1948 .dbg_name = "csi0pix_clk",
1949 .ops = &clk_ops_branch,
1950 CLK_INIT(csi0pix_clk.c),
1951 },
1952};
1953
1954static struct branch_clk csi0rdi_clk = {
1955 .cbcr_reg = CSI0RDI_CBCR,
1956 .has_sibling = 1,
1957 .base = &virt_bases[MMSS_BASE],
1958 .c = {
1959 .parent = &csi0_clk_src.c,
1960 .dbg_name = "csi0rdi_clk",
1961 .ops = &clk_ops_branch,
1962 CLK_INIT(csi0rdi_clk.c),
1963 },
1964};
1965
1966static struct branch_clk csi1_clk = {
1967 .cbcr_reg = CSI1_CBCR,
1968 .has_sibling = 1,
1969 .base = &virt_bases[MMSS_BASE],
1970 .c = {
1971 .parent = &csi1_clk_src.c,
1972 .dbg_name = "csi1_clk",
1973 .ops = &clk_ops_branch,
1974 CLK_INIT(csi1_clk.c),
1975 },
1976};
1977
1978static struct branch_clk csi1phy_clk = {
1979 .cbcr_reg = CSI1PHY_CBCR,
1980 .has_sibling = 1,
1981 .base = &virt_bases[MMSS_BASE],
1982 .c = {
1983 .parent = &csi1_clk_src.c,
1984 .dbg_name = "csi1phy_clk",
1985 .ops = &clk_ops_branch,
1986 CLK_INIT(csi1phy_clk.c),
1987 },
1988};
1989
1990static struct branch_clk csi1phytimer_clk = {
1991 .cbcr_reg = CSI1PHYTIMER_CBCR,
1992 .has_sibling = 0,
1993 .base = &virt_bases[MMSS_BASE],
1994 .c = {
1995 .parent = &csi1phytimer_clk_src.c,
1996 .dbg_name = "csi1phytimer_clk",
1997 .ops = &clk_ops_branch,
1998 CLK_INIT(csi1phytimer_clk.c),
1999 },
2000};
2001
2002static struct branch_clk csi1pix_clk = {
2003 .cbcr_reg = CSI1PIX_CBCR,
2004 .has_sibling = 1,
2005 .base = &virt_bases[MMSS_BASE],
2006 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002007 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002008 .dbg_name = "csi1pix_clk",
2009 .ops = &clk_ops_branch,
2010 CLK_INIT(csi1pix_clk.c),
2011 },
2012};
2013
2014static struct branch_clk csi1rdi_clk = {
2015 .cbcr_reg = CSI1RDI_CBCR,
2016 .has_sibling = 1,
2017 .base = &virt_bases[MMSS_BASE],
2018 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002019 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002020 .dbg_name = "csi1rdi_clk",
2021 .ops = &clk_ops_branch,
2022 CLK_INIT(csi1rdi_clk.c),
2023 },
2024};
2025
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002026static struct mux_clk csi0phy_cam_mux_clk = {
2027 .ops = &mux_reg_ops,
2028 .en_mask = BIT(11),
2029 .mask = 0x1,
2030 .shift = 9,
2031 .offset = MMSS_CAMSS_MISC,
2032 MUX_SRC_LIST(
2033 { &csi0phy_clk.c, 0 },
2034 { &csi1phy_clk.c, 1 },
2035 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002036 .base = &virt_bases[MMSS_BASE],
2037 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002038 .dbg_name = "csi0phy_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002039 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002040 CLK_INIT(csi0phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002041 },
2042};
2043
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002044static struct mux_clk csi1phy_cam_mux_clk = {
2045 .ops = &mux_reg_ops,
2046 .en_mask = BIT(10),
2047 .mask = 0x1,
2048 .shift = 8,
2049 .offset = MMSS_CAMSS_MISC,
2050 MUX_SRC_LIST(
2051 { &csi0phy_clk.c, 0 },
2052 { &csi1phy_clk.c, 1 },
2053 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002054 .base = &virt_bases[MMSS_BASE],
2055 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002056 .dbg_name = "csi1phy_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002057 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002058 CLK_INIT(csi1phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002059 },
2060};
2061
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002062static struct mux_clk csi0pix_cam_mux_clk = {
2063 .ops = &mux_reg_ops,
2064 .en_mask = BIT(7),
2065 .mask = 0x1,
2066 .shift = 3,
2067 .offset = MMSS_CAMSS_MISC,
2068 MUX_SRC_LIST(
2069 { &csi0pix_clk.c, 0 },
2070 { &csi1pix_clk.c, 1 },
2071 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002072 .base = &virt_bases[MMSS_BASE],
2073 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002074 .dbg_name = "csi0pix_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002075 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002076 CLK_INIT(csi0pix_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002077 },
2078};
2079
2080
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002081static struct mux_clk rdi2_cam_mux_clk = {
2082 .ops = &mux_reg_ops,
2083 .en_mask = BIT(6),
2084 .mask = 0x1,
2085 .shift = 2,
2086 .offset = MMSS_CAMSS_MISC,
2087 MUX_SRC_LIST(
2088 { &csi0rdi_clk.c, 0 },
2089 { &csi1rdi_clk.c, 1 },
2090 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002091 .base = &virt_bases[MMSS_BASE],
2092 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002093 .dbg_name = "rdi2_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002094 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002095 CLK_INIT(rdi2_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002096 },
2097};
2098
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002099static struct mux_clk rdi1_cam_mux_clk = {
2100 .ops = &mux_reg_ops,
2101 .en_mask = BIT(5),
2102 .mask = 0x1,
2103 .shift = 1,
2104 .offset = MMSS_CAMSS_MISC,
2105 MUX_SRC_LIST(
2106 { &csi0rdi_clk.c, 0 },
2107 { &csi1rdi_clk.c, 1 },
2108 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002109 .base = &virt_bases[MMSS_BASE],
2110 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002111 .dbg_name = "rdi1_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002112 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002113 CLK_INIT(rdi1_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002114 },
2115};
2116
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002117static struct mux_clk rdi0_cam_mux_clk = {
2118 .ops = &mux_reg_ops,
2119 .en_mask = BIT(4),
2120 .mask = 0x1,
2121 .shift = 0,
2122 .offset = MMSS_CAMSS_MISC,
2123 MUX_SRC_LIST(
2124 { &csi0rdi_clk.c, 0 },
2125 { &csi1rdi_clk.c, 1 },
2126 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002127 .base = &virt_bases[MMSS_BASE],
2128 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002129 .dbg_name = "rdi0_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002130 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002131 CLK_INIT(rdi0_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002132 },
2133};
2134
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002135static struct branch_clk csi_ahb_clk = {
2136 .cbcr_reg = CSI_AHB_CBCR,
2137 .has_sibling = 1,
2138 .base = &virt_bases[MMSS_BASE],
2139 .c = {
2140 .dbg_name = "csi_ahb_clk",
2141 .ops = &clk_ops_branch,
2142 CLK_INIT(csi_ahb_clk.c),
2143 },
2144};
2145
2146static struct branch_clk csi_vfe_clk = {
2147 .cbcr_reg = CSI_VFE_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002148 .bcr_reg = CSI_VFE_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002149 .has_sibling = 1,
2150 .base = &virt_bases[MMSS_BASE],
2151 .c = {
2152 .parent = &vfe_clk_src.c,
2153 .dbg_name = "csi_vfe_clk",
2154 .ops = &clk_ops_branch,
2155 CLK_INIT(csi_vfe_clk.c),
2156 },
2157};
2158
2159static struct branch_clk dsi_clk = {
2160 .cbcr_reg = DSI_CBCR,
2161 .has_sibling = 0,
2162 .base = &virt_bases[MMSS_BASE],
2163 .c = {
2164 .parent = &dsi_clk_src.c,
2165 .dbg_name = "dsi_clk",
2166 .ops = &clk_ops_branch,
2167 CLK_INIT(dsi_clk.c),
2168 },
2169};
2170
2171static struct branch_clk dsi_ahb_clk = {
2172 .cbcr_reg = DSI_AHB_CBCR,
2173 .has_sibling = 1,
2174 .base = &virt_bases[MMSS_BASE],
2175 .c = {
2176 .dbg_name = "dsi_ahb_clk",
2177 .ops = &clk_ops_branch,
2178 CLK_INIT(dsi_ahb_clk.c),
2179 },
2180};
2181
2182static struct branch_clk dsi_byte_clk = {
2183 .cbcr_reg = DSI_BYTE_CBCR,
2184 .has_sibling = 0,
2185 .base = &virt_bases[MMSS_BASE],
2186 .c = {
2187 .parent = &dsi_byte_clk_src.c,
2188 .dbg_name = "dsi_byte_clk",
2189 .ops = &clk_ops_branch,
2190 CLK_INIT(dsi_byte_clk.c),
2191 },
2192};
2193
2194static struct branch_clk dsi_esc_clk = {
2195 .cbcr_reg = DSI_ESC_CBCR,
2196 .has_sibling = 0,
2197 .base = &virt_bases[MMSS_BASE],
2198 .c = {
2199 .parent = &dsi_esc_clk_src.c,
2200 .dbg_name = "dsi_esc_clk",
2201 .ops = &clk_ops_branch,
2202 CLK_INIT(dsi_esc_clk.c),
2203 },
2204};
2205
2206static struct branch_clk dsi_pclk_clk = {
2207 .cbcr_reg = DSI_PCLK_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002208 .base = &virt_bases[MMSS_BASE],
2209 .c = {
2210 .parent = &dsi_pclk_clk_src.c,
2211 .dbg_name = "dsi_pclk_clk",
2212 .ops = &clk_ops_branch,
2213 CLK_INIT(dsi_pclk_clk.c),
2214 },
2215};
2216
2217static struct branch_clk gmem_gfx3d_clk = {
2218 .cbcr_reg = GMEM_GFX3D_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002219 .bcr_reg = GMEM_GFX3D_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002220 .has_sibling = 1,
2221 .base = &virt_bases[MMSS_BASE],
2222 .c = {
2223 .parent = &gfx3d_clk_src.c,
2224 .dbg_name = "gmem_gfx3d_clk",
2225 .ops = &clk_ops_branch,
2226 CLK_INIT(gmem_gfx3d_clk.c),
2227 },
2228};
2229
2230static struct branch_clk mclk0_clk = {
2231 .cbcr_reg = MCLK0_CBCR,
2232 .has_sibling = 0,
2233 .base = &virt_bases[MMSS_BASE],
2234 .c = {
2235 .parent = &mclk0_clk_src.c,
2236 .dbg_name = "mclk0_clk",
2237 .ops = &clk_ops_branch,
2238 CLK_INIT(mclk0_clk.c),
2239 },
2240};
2241
2242static struct branch_clk mclk1_clk = {
2243 .cbcr_reg = MCLK1_CBCR,
2244 .has_sibling = 0,
2245 .base = &virt_bases[MMSS_BASE],
2246 .c = {
2247 .parent = &mclk1_clk_src.c,
2248 .dbg_name = "mclk1_clk",
2249 .ops = &clk_ops_branch,
2250 CLK_INIT(mclk1_clk.c),
2251 },
2252};
2253
2254static struct branch_clk mdp_ahb_clk = {
2255 .cbcr_reg = MDP_AHB_CBCR,
2256 .has_sibling = 1,
2257 .base = &virt_bases[MMSS_BASE],
2258 .c = {
2259 .dbg_name = "mdp_ahb_clk",
2260 .ops = &clk_ops_branch,
2261 CLK_INIT(mdp_ahb_clk.c),
2262 },
2263};
2264
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002265static struct branch_clk mmss_mmssnoc_axi_clk;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002266static struct branch_clk mdp_axi_clk = {
2267 .cbcr_reg = MDP_AXI_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002268 .base = &virt_bases[MMSS_BASE],
2269 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002270 .parent = &mdp_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002271 .dbg_name = "mdp_axi_clk",
2272 .ops = &clk_ops_branch,
2273 CLK_INIT(mdp_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002274 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002275 },
2276};
2277
2278static struct branch_clk mdp_dsi_clk = {
2279 .cbcr_reg = MDP_DSI_CBCR,
2280 .has_sibling = 1,
2281 .base = &virt_bases[MMSS_BASE],
2282 .c = {
2283 .parent = &dsi_pclk_clk_src.c,
2284 .dbg_name = "mdp_dsi_clk",
2285 .ops = &clk_ops_branch,
2286 CLK_INIT(mdp_dsi_clk.c),
2287 },
2288};
2289
2290static struct branch_clk mdp_lcdc_clk = {
2291 .cbcr_reg = MDP_LCDC_CBCR,
2292 .has_sibling = 1,
2293 .base = &virt_bases[MMSS_BASE],
2294 .c = {
2295 .parent = &dsi_pclk_clk_src.c,
2296 .dbg_name = "mdp_lcdc_clk",
2297 .ops = &clk_ops_branch,
2298 CLK_INIT(mdp_lcdc_clk.c),
2299 },
2300};
2301
2302static struct branch_clk mdp_vsync_clk = {
2303 .cbcr_reg = MDP_VSYNC_CBCR,
2304 .has_sibling = 0,
2305 .base = &virt_bases[MMSS_BASE],
2306 .c = {
2307 .parent = &mdp_vsync_clk_src.c,
2308 .dbg_name = "mdp_vsync_clk",
2309 .ops = &clk_ops_branch,
2310 CLK_INIT(mdp_vsync_clk.c),
2311 },
2312};
2313
2314static struct branch_clk mmss_misc_ahb_clk = {
2315 .cbcr_reg = MMSS_MISC_AHB_CBCR,
2316 .has_sibling = 1,
2317 .base = &virt_bases[MMSS_BASE],
2318 .c = {
2319 .dbg_name = "mmss_misc_ahb_clk",
2320 .ops = &clk_ops_branch,
2321 CLK_INIT(mmss_misc_ahb_clk.c),
2322 },
2323};
2324
2325static struct branch_clk mmss_mmssnoc_axi_clk = {
2326 .cbcr_reg = MMSS_MMSSNOC_AXI_CBCR,
2327 .has_sibling = 1,
2328 .base = &virt_bases[MMSS_BASE],
2329 .c = {
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002330 .parent = &axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002331 .dbg_name = "mmss_mmssnoc_axi_clk",
2332 .ops = &clk_ops_branch,
2333 CLK_INIT(mmss_mmssnoc_axi_clk.c),
2334 },
2335};
2336
2337static struct branch_clk mmss_s0_axi_clk = {
2338 .cbcr_reg = MMSS_S0_AXI_CBCR,
2339 .has_sibling = 0,
2340 .base = &virt_bases[MMSS_BASE],
2341 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002342 .parent = &mmssnoc_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002343 .dbg_name = "mmss_s0_axi_clk",
2344 .ops = &clk_ops_branch,
2345 CLK_INIT(mmss_s0_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002346 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002347 },
2348};
2349
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002350static struct branch_clk mmss_mmssnoc_bto_ahb_clk = {
2351 .cbcr_reg = MMSS_MMSSNOC_BTO_AHB_CBCR,
2352 .has_sibling = 1,
2353 .base = &virt_bases[MMSS_BASE],
2354 .c = {
2355 .dbg_name = "mmss_mmssnoc_bto_ahb_clk",
2356 .ops = &clk_ops_branch,
2357 CLK_INIT(mmss_mmssnoc_bto_ahb_clk.c),
2358 },
2359};
2360
2361static struct branch_clk oxili_ahb_clk = {
2362 .cbcr_reg = OXILI_AHB_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002363 .bcr_reg = OXILI_AHB_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002364 .has_sibling = 1,
2365 .base = &virt_bases[MMSS_BASE],
2366 .c = {
2367 .dbg_name = "oxili_ahb_clk",
2368 .ops = &clk_ops_branch,
2369 CLK_INIT(oxili_ahb_clk.c),
2370 },
2371};
2372
2373static struct branch_clk oxili_gfx3d_clk = {
2374 .cbcr_reg = OXILI_GFX3D_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002375 .bcr_reg = OXILI_GFX3D_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002376 .has_sibling = 0,
2377 .base = &virt_bases[MMSS_BASE],
2378 .c = {
2379 .parent = &gfx3d_clk_src.c,
2380 .dbg_name = "oxili_gfx3d_clk",
2381 .ops = &clk_ops_branch,
2382 CLK_INIT(oxili_gfx3d_clk.c),
2383 },
2384};
2385
2386static struct branch_clk vfe_clk = {
2387 .cbcr_reg = VFE_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002388 .bcr_reg = VFE_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002389 .has_sibling = 1,
2390 .base = &virt_bases[MMSS_BASE],
2391 .c = {
2392 .parent = &vfe_clk_src.c,
2393 .dbg_name = "vfe_clk",
2394 .ops = &clk_ops_branch,
2395 CLK_INIT(vfe_clk.c),
2396 },
2397};
2398
2399static struct branch_clk vfe_ahb_clk = {
2400 .cbcr_reg = VFE_AHB_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002401 .bcr_reg = VFE_AHB_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002402 .has_sibling = 1,
2403 .base = &virt_bases[MMSS_BASE],
2404 .c = {
2405 .dbg_name = "vfe_ahb_clk",
2406 .ops = &clk_ops_branch,
2407 CLK_INIT(vfe_ahb_clk.c),
2408 },
2409};
2410
2411static struct branch_clk vfe_axi_clk = {
2412 .cbcr_reg = VFE_AXI_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002413 .bcr_reg = VFE_AXI_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002414 .has_sibling = 1,
2415 .base = &virt_bases[MMSS_BASE],
2416 .c = {
2417 .parent = &axi_clk_src.c,
2418 .dbg_name = "vfe_axi_clk",
2419 .ops = &clk_ops_branch,
2420 CLK_INIT(vfe_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002421 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002422 },
2423};
2424
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002425static struct branch_clk q6ss_ahb_lfabif_clk = {
2426 .cbcr_reg = Q6SS_AHB_LFABIF_CBCR,
2427 .has_sibling = 1,
2428 .base = &virt_bases[LPASS_BASE],
2429 .c = {
2430 .dbg_name = "q6ss_ahb_lfabif_clk",
2431 .ops = &clk_ops_branch,
2432 CLK_INIT(q6ss_ahb_lfabif_clk.c),
2433 },
2434};
2435
2436static struct branch_clk q6ss_ahbm_clk = {
2437 .cbcr_reg = Q6SS_AHBM_CBCR,
2438 .has_sibling = 1,
2439 .base = &virt_bases[LPASS_BASE],
2440 .c = {
2441 .dbg_name = "q6ss_ahbm_clk",
2442 .ops = &clk_ops_branch,
2443 CLK_INIT(q6ss_ahbm_clk.c),
2444 },
2445};
2446
2447static struct branch_clk q6ss_xo_clk = {
2448 .cbcr_reg = Q6SS_XO_CBCR,
2449 .has_sibling = 1,
2450 .bcr_reg = LPASS_Q6SS_BCR,
2451 .base = &virt_bases[LPASS_BASE],
2452 .c = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002453 .dbg_name = "q6ss_xo_clk",
2454 .ops = &clk_ops_branch,
2455 CLK_INIT(q6ss_xo_clk.c),
2456 },
2457};
2458
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002459#ifdef CONFIG_DEBUG_FS
2460
2461struct measure_mux_entry {
2462 struct clk *c;
2463 int base;
2464 u32 debug_mux;
2465};
2466
2467static struct measure_mux_entry measure_mux[] = {
2468 { &snoc_clk.c, GCC_BASE, 0x0000},
2469 { &cnoc_clk.c, GCC_BASE, 0x0008},
2470 { &gcc_copss_smmu_ahb_clk.c, GCC_BASE, 0x000c},
2471 { &gcc_lpss_smmu_ahb_clk.c, GCC_BASE, 0x000d},
2472 { &pnoc_clk.c, GCC_BASE, 0x0010},
2473 { &gcc_mmss_noc_cfg_ahb_clk.c, GCC_BASE, 0x002a},
2474 { &gcc_mss_cfg_ahb_clk.c, GCC_BASE, 0x0030},
2475 { &gcc_mss_q6_bimc_axi_clk.c, GCC_BASE, 0x0031},
2476 { &gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060},
2477 { &gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061},
2478 { &gcc_usb2a_phy_sleep_clk.c, GCC_BASE, 0x0063},
2479 { &gcc_sdcc1_apps_clk.c, GCC_BASE, 0x0068},
2480 { &gcc_sdcc1_ahb_clk.c, GCC_BASE, 0x0069},
2481 { &gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070},
2482 { &gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071},
2483 { &gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088},
2484 {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a},
2485 {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b},
2486 { &gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c},
2487 {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e},
2488 {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090},
2489 { &gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091},
2490 {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093},
2491 {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094},
2492 { &gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095},
2493 {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098},
2494 {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099},
2495 { &gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a},
2496 {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c},
2497 {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d},
2498 { &gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e},
2499 {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1},
2500 {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2},
2501 { &gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3},
2502 { &gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0},
2503 { &gcc_pdm2_clk.c, GCC_BASE, 0x00d2},
2504 { &gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8},
2505 { &gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8},
2506 { &gcc_ce1_clk.c, GCC_BASE, 0x0138},
2507 { &gcc_ce1_axi_clk.c, GCC_BASE, 0x0139},
2508 { &gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a},
2509 { &gcc_xo_clk_src.c, GCC_BASE, 0x0149},
Vikram Mulukutlad3854052013-06-13 12:47:19 -07002510 { &bimc_clk.c, GCC_BASE, 0x0155},
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07002511 { &gcc_bimc_smmu_clk.c, GCC_BASE, 0x015e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002512 { &gcc_lpass_q6_axi_clk.c, GCC_BASE, 0x0160},
Vikram Mulukutla69680bb2013-12-17 15:58:46 -08002513 { &wcnss_m_clk, GCC_BASE, 0x0198},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002514
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08002515 { &mmssnoc_ahb_clk.c, MMSS_BASE, 0x0001},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002516 { &mmss_misc_ahb_clk.c, MMSS_BASE, 0x0003},
2517 {&mmss_mmssnoc_axi_clk.c, MMSS_BASE, 0x0004},
2518 { &mmss_s0_axi_clk.c, MMSS_BASE, 0x0005},
2519 { &oxili_ahb_clk.c, MMSS_BASE, 0x0007},
2520 { &oxili_gfx3d_clk.c, MMSS_BASE, 0x0008},
2521 { &gmem_gfx3d_clk.c, MMSS_BASE, 0x0009},
2522 { &mdp_axi_clk.c, MMSS_BASE, 0x000a},
2523 { &mdp_vsync_clk.c, MMSS_BASE, 0x000b},
2524 { &mdp_ahb_clk.c, MMSS_BASE, 0x000c},
2525 { &dsi_pclk_clk.c, MMSS_BASE, 0x000d},
2526 { &mdp_dsi_clk.c, MMSS_BASE, 0x000e},
2527 { &mdp_lcdc_clk.c, MMSS_BASE, 0x000f},
2528 { &dsi_clk.c, MMSS_BASE, 0x0010},
2529 { &dsi_byte_clk.c, MMSS_BASE, 0x0011},
2530 { &dsi_esc_clk.c, MMSS_BASE, 0x0012},
2531 { &dsi_ahb_clk.c, MMSS_BASE, 0x0013},
2532 { &mclk0_clk.c, MMSS_BASE, 0x0015},
2533 { &mclk1_clk.c, MMSS_BASE, 0x0016},
2534 { &csi0phytimer_clk.c, MMSS_BASE, 0x0017},
2535 { &csi1phytimer_clk.c, MMSS_BASE, 0x0018},
2536 { &vfe_clk.c, MMSS_BASE, 0x0019},
2537 { &vfe_ahb_clk.c, MMSS_BASE, 0x001a},
2538 { &vfe_axi_clk.c, MMSS_BASE, 0x001b},
2539 { &csi_vfe_clk.c, MMSS_BASE, 0x001c},
2540 { &csi0_clk.c, MMSS_BASE, 0x001d},
2541 { &csi_ahb_clk.c, MMSS_BASE, 0x001e},
2542 { &csi0phy_clk.c, MMSS_BASE, 0x001f},
2543 { &csi0rdi_clk.c, MMSS_BASE, 0x0020},
2544 { &csi0pix_clk.c, MMSS_BASE, 0x0021},
2545 { &csi1_clk.c, MMSS_BASE, 0x0022},
2546 { &csi1phy_clk.c, MMSS_BASE, 0x0023},
2547 { &csi1rdi_clk.c, MMSS_BASE, 0x0024},
2548 { &csi1pix_clk.c, MMSS_BASE, 0x0025},
2549 { &bimc_gfx_clk.c, MMSS_BASE, 0x0032},
2550
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002551 { &q6ss_ahbm_clk.c, LPASS_BASE, 0x001d},
2552 { &q6ss_ahb_lfabif_clk.c, LPASS_BASE, 0x001e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002553 { &q6ss_xo_clk.c, LPASS_BASE, 0x002b},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002554
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002555 {&apc0_m_clk, APCS_BASE, 0x00010},
2556 {&apc1_m_clk, APCS_BASE, 0x00114},
2557 {&apc2_m_clk, APCS_BASE, 0x00220},
2558 {&apc3_m_clk, APCS_BASE, 0x00324},
2559 {&l2_m_clk, APCS_BASE, 0x01000},
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08002560
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002561 {&dummy_clk, N_BASES, 0x0000},
2562};
2563
2564#define GCC_DEBUG_CLK_CTL 0x1880
2565#define MMSS_DEBUG_CLK_CTL 0x0900
2566#define LPASS_DEBUG_CLK_CTL 0x29000
2567#define GLB_CLK_DIAG 0x001C
2568
2569static int measure_clk_set_parent(struct clk *c, struct clk *parent)
2570{
2571 struct measure_clk *clk = to_measure_clk(c);
2572 unsigned long flags;
2573 u32 regval, clk_sel, i;
2574
2575 if (!parent)
2576 return -EINVAL;
2577
2578 for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++)
2579 if (measure_mux[i].c == parent)
2580 break;
2581
2582 if (measure_mux[i].c == &dummy_clk)
2583 return -EINVAL;
2584
2585 spin_lock_irqsave(&local_clock_reg_lock, flags);
2586 /*
2587 * Program the test vector, measurement period (sample_ticks)
2588 * and scaling multiplier.
2589 */
2590 clk->sample_ticks = 0x10000;
2591 clk->multiplier = 1;
2592
2593 switch (measure_mux[i].base) {
2594
2595 case GCC_BASE:
2596 writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2597 clk_sel = measure_mux[i].debug_mux;
2598 break;
2599
2600 case MMSS_BASE:
2601 writel_relaxed(0, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2602 clk_sel = 0x02C;
2603 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2604 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2605
2606 /* Activate debug clock output */
2607 regval |= BIT(16);
2608 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2609 break;
2610
2611 case LPASS_BASE:
2612 writel_relaxed(0, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2613 clk_sel = 0x161;
2614 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2615 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2616
2617 /* Activate debug clock output */
2618 regval |= BIT(20);
2619 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2620 break;
2621
2622 case APCS_BASE:
2623 clk->multiplier = 4;
2624 clk_sel = 0x16A;
2625 regval = measure_mux[i].debug_mux;
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002626 /* Use a divider value of 4. */
2627 regval |= BVAL(31, 30, 0x3);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002628 writel_relaxed(regval, APCS_REG_BASE(GLB_CLK_DIAG));
2629 break;
2630
2631 default:
2632 return -EINVAL;
2633 }
2634
2635 /* Set debug mux clock index */
2636 regval = BVAL(8, 0, clk_sel);
2637 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2638
2639 /* Activate debug clock output */
2640 regval |= BIT(16);
2641 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2642
2643 /* Make sure test vector is set before starting measurements. */
2644 mb();
2645 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2646
2647 return 0;
2648}
2649
2650#define CLOCK_FRQ_MEASURE_CTL 0x1884
2651#define CLOCK_FRQ_MEASURE_STATUS 0x1888
2652
2653/* Sample clock for 'ticks' reference clock ticks. */
2654static u32 run_measurement(unsigned ticks)
2655{
2656 /* Stop counters and set the XO4 counter start value. */
2657 writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2658
2659 /* Wait for timer to become ready. */
2660 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2661 BIT(25)) != 0)
2662 cpu_relax();
2663
2664 /* Run measurement and wait for completion. */
2665 writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2666 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2667 BIT(25)) == 0)
2668 cpu_relax();
2669
2670 /* Return measured ticks. */
2671 return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2672 BM(24, 0);
2673}
2674
2675#define GCC_XO_DIV4_CBCR 0x10C8
2676#define PLLTEST_PAD_CFG 0x188C
2677
2678/*
2679 * Perform a hardware rate measurement for a given clock.
2680 * FOR DEBUG USE ONLY: Measurements take ~15 ms!
2681 */
2682static unsigned long measure_clk_get_rate(struct clk *c)
2683{
2684 unsigned long flags;
2685 u32 gcc_xo4_reg_backup;
2686 u64 raw_count_short, raw_count_full;
2687 struct measure_clk *clk = to_measure_clk(c);
2688 unsigned ret;
2689
2690 ret = clk_prepare_enable(&gcc_xo_clk_src.c);
2691 if (ret) {
2692 pr_warning("CXO clock failed to enable. Can't measure\n");
2693 return 0;
2694 }
2695
2696 spin_lock_irqsave(&local_clock_reg_lock, flags);
2697
2698 /* Enable CXO/4 and RINGOSC branch. */
2699 gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2700 writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2701
2702 /*
2703 * The ring oscillator counter will not reset if the measured clock
2704 * is not running. To detect this, run a short measurement before
2705 * the full measurement. If the raw results of the two are the same
2706 * then the clock must be off.
2707 */
2708
2709 /* Run a short measurement. (~1 ms) */
2710 raw_count_short = run_measurement(0x1000);
2711 /* Run a full measurement. (~14 ms) */
2712 raw_count_full = run_measurement(clk->sample_ticks);
2713
2714 writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2715
2716 /* Return 0 if the clock is off. */
2717 if (raw_count_full == raw_count_short) {
2718 ret = 0;
2719 } else {
2720 /* Compute rate in Hz. */
2721 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
2722 do_div(raw_count_full, ((clk->sample_ticks * 10) + 35));
2723 ret = (raw_count_full * clk->multiplier);
2724 }
2725
2726 writel_relaxed(0x51A00, GCC_REG_BASE(PLLTEST_PAD_CFG));
2727 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2728
2729 clk_disable_unprepare(&gcc_xo_clk_src.c);
2730
2731 return ret;
2732}
2733#else /* !CONFIG_DEBUG_FS */
2734static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
2735{
2736 return -EINVAL;
2737}
2738
2739static unsigned long measure_clk_get_rate(struct clk *clk)
2740{
2741 return 0;
2742}
2743#endif /* CONFIG_DEBUG_FS */
2744
2745static struct clk_ops clk_ops_measure = {
2746 .set_parent = measure_clk_set_parent,
2747 .get_rate = measure_clk_get_rate,
2748};
2749
2750static struct measure_clk measure_clk = {
2751 .c = {
2752 .dbg_name = "measure_clk",
2753 .ops = &clk_ops_measure,
2754 CLK_INIT(measure_clk.c),
2755 },
2756 .multiplier = 1,
2757};
2758
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08002759static struct clk_lookup msm_clocks_8610[] = {
Mayank Rana05754c92013-07-24 17:12:37 +05302760 CLK_LOOKUP("xo", cxo_otg_clk.c, "f9a55000.usb"),
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002761 CLK_LOOKUP("xo", cxo_lpass_pil_clk.c, "fe200000.qcom,lpass"),
2762 CLK_LOOKUP("xo", cxo_lpm_clk.c, "fc4281d0.qcom,mpm"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002763
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002764 CLK_LOOKUP("xo", cxo_mss_pil_clk.c, "fc880000.qcom,mss"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002765 CLK_LOOKUP("bus_clk", gcc_mss_q6_bimc_axi_clk.c, "fc880000.qcom,mss"),
2766 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, "fc880000.qcom,mss"),
2767 CLK_LOOKUP("mem_clk", gcc_boot_rom_ahb_clk.c, "fc880000.qcom,mss"),
2768
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002769 CLK_LOOKUP("xo", cxo_pil_mba_clk.c, "pil-mba"),
2770 CLK_LOOKUP("xo", cxo_wlan_clk.c, "fb000000.qcom,wcnss-wlan"),
2771 CLK_LOOKUP("xo", cxo_pil_pronto_clk.c, "fb21b000.qcom,pronto"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002772 CLK_LOOKUP("measure", measure_clk.c, "debug"),
2773
2774 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991f000.serial"),
2775 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "f991f000.serial"),
Hanumant Singhbbf01da2013-04-09 16:27:28 -07002776 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991e000.serial"),
2777 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, "f991e000.serial"),
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -07002778 CLK_LOOKUP("bus_clk", pnoc_keepalive_a_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002779 CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002780
2781 CLK_LOOKUP("bus_clk", snoc_clk.c, ""),
2782 CLK_LOOKUP("bus_clk", pnoc_clk.c, ""),
2783 CLK_LOOKUP("bus_clk", cnoc_clk.c, ""),
2784 CLK_LOOKUP("mem_clk", bimc_clk.c, ""),
2785 CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""),
2786 CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""),
2787 CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""),
2788 CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""),
2789
2790 CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"),
2791 CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"),
2792 CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"),
2793 CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"),
2794 CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"),
2795 CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"),
2796 CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"),
2797 CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"),
2798 CLK_LOOKUP("mem_clk", bimc_acpu_a_clk.c, ""),
Gagan Mac125029b2013-03-07 17:24:27 -07002799 CLK_LOOKUP("bus_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
2800 CLK_LOOKUP("bus_a_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002801
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002802 /* CoreSight clocks */
2803 CLK_LOOKUP("core_clk", qdss_clk.c, "fc326000.tmc"),
2804 CLK_LOOKUP("core_clk", qdss_clk.c, "fc320000.tpiu"),
2805 CLK_LOOKUP("core_clk", qdss_clk.c, "fc324000.replicator"),
2806 CLK_LOOKUP("core_clk", qdss_clk.c, "fc325000.tmc"),
2807 CLK_LOOKUP("core_clk", qdss_clk.c, "fc323000.funnel"),
2808 CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.funnel"),
2809 CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.funnel"),
2810 CLK_LOOKUP("core_clk", qdss_clk.c, "fc355000.funnel"),
2811 CLK_LOOKUP("core_clk", qdss_clk.c, "fc302000.stm"),
2812 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.etm"),
2813 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.etm"),
2814 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.etm"),
2815 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.etm"),
2816 CLK_LOOKUP("core_clk", qdss_clk.c, "fc301000.csr"),
2817 CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"),
2818 CLK_LOOKUP("core_clk", qdss_clk.c, "fc311000.cti"),
2819 CLK_LOOKUP("core_clk", qdss_clk.c, "fc312000.cti"),
2820 CLK_LOOKUP("core_clk", qdss_clk.c, "fc313000.cti"),
2821 CLK_LOOKUP("core_clk", qdss_clk.c, "fc314000.cti"),
2822 CLK_LOOKUP("core_clk", qdss_clk.c, "fc315000.cti"),
2823 CLK_LOOKUP("core_clk", qdss_clk.c, "fc316000.cti"),
2824 CLK_LOOKUP("core_clk", qdss_clk.c, "fc317000.cti"),
2825 CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.cti"),
2826 CLK_LOOKUP("core_clk", qdss_clk.c, "fc351000.cti"),
2827 CLK_LOOKUP("core_clk", qdss_clk.c, "fc352000.cti"),
2828 CLK_LOOKUP("core_clk", qdss_clk.c, "fc353000.cti"),
2829 CLK_LOOKUP("core_clk", qdss_clk.c, "fc354000.cti"),
Pratik Patel85419772013-10-04 16:09:59 -07002830 CLK_LOOKUP("core_clk", qdss_clk.c, "fc335000.cti"),
2831 CLK_LOOKUP("core_clk", qdss_clk.c, "fc338000.cti"),
2832 CLK_LOOKUP("core_clk", qdss_clk.c, "fc33c000.cti"),
2833 CLK_LOOKUP("core_clk", qdss_clk.c, "fc360000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002834 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.jtagmm"),
2835 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.jtagmm"),
2836 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.jtagmm"),
2837 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002838 CLK_LOOKUP("core_clk", qdss_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002839
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002840
2841 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc326000.tmc"),
2842 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc320000.tpiu"),
2843 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc324000.replicator"),
2844 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc325000.tmc"),
2845 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc323000.funnel"),
2846 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.funnel"),
2847 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.funnel"),
2848 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc355000.funnel"),
2849 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc302000.stm"),
2850 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.etm"),
2851 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.etm"),
2852 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.etm"),
2853 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.etm"),
2854 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc301000.csr"),
2855 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"),
2856 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc311000.cti"),
2857 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc312000.cti"),
2858 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc313000.cti"),
2859 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc314000.cti"),
2860 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc315000.cti"),
2861 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc316000.cti"),
2862 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc317000.cti"),
2863 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.cti"),
2864 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc351000.cti"),
2865 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc352000.cti"),
2866 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc353000.cti"),
2867 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc354000.cti"),
Pratik Patel85419772013-10-04 16:09:59 -07002868 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc335000.cti"),
2869 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc338000.cti"),
2870 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc33c000.cti"),
2871 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc360000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002872 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.jtagmm"),
2873 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.jtagmm"),
2874 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.jtagmm"),
2875 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002876 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fd820018.hwevent"),
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002877
Aparna Das05172f22013-05-13 15:06:44 -07002878 CLK_LOOKUP("core_mmss_clk", mmss_misc_ahb_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002879
2880 CLK_LOOKUP("core_clk_src", blsp1_qup1_spi_apps_clk_src.c, ""),
2881 CLK_LOOKUP("core_clk_src", blsp1_qup2_spi_apps_clk_src.c, ""),
2882 CLK_LOOKUP("core_clk_src", blsp1_qup3_spi_apps_clk_src.c, ""),
2883 CLK_LOOKUP("core_clk_src", blsp1_qup4_spi_apps_clk_src.c, ""),
2884 CLK_LOOKUP("core_clk_src", blsp1_qup5_spi_apps_clk_src.c, ""),
2885 CLK_LOOKUP("core_clk_src", blsp1_qup6_spi_apps_clk_src.c, ""),
2886 CLK_LOOKUP("core_clk_src", blsp1_uart1_apps_clk_src.c, ""),
2887 CLK_LOOKUP("core_clk_src", blsp1_uart2_apps_clk_src.c, ""),
2888 CLK_LOOKUP("core_clk_src", blsp1_uart3_apps_clk_src.c, ""),
2889 CLK_LOOKUP("core_clk_src", blsp1_uart4_apps_clk_src.c, ""),
2890 CLK_LOOKUP("core_clk_src", blsp1_uart5_apps_clk_src.c, ""),
2891 CLK_LOOKUP("core_clk_src", blsp1_uart6_apps_clk_src.c, ""),
2892 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""),
2893 CLK_LOOKUP("core_clk_src", gp1_clk_src.c, ""),
2894 CLK_LOOKUP("core_clk_src", gp2_clk_src.c, ""),
2895 CLK_LOOKUP("core_clk_src", gp3_clk_src.c, ""),
2896 CLK_LOOKUP("core_clk_src", pdm2_clk_src.c, ""),
2897 CLK_LOOKUP("core_clk_src", sdcc1_apps_clk_src.c, ""),
2898 CLK_LOOKUP("core_clk_src", sdcc2_apps_clk_src.c, ""),
2899 CLK_LOOKUP("core_clk_src", usb_hs_system_clk_src.c, ""),
Chun Zhangf39a0652013-05-01 15:57:54 -07002900 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9923000.i2c"),
Houston Hoffman8fc417b2013-11-14 02:25:59 -08002901 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9924000.i2c"),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002902 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002903 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9927000.i2c"),
Gilad Avidova460c472013-04-12 16:23:32 -06002904 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9926000.spi"),
Chun Zhangf39a0652013-05-01 15:57:54 -07002905 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, "f9923000.i2c"),
2906 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""),
Houston Hoffman8fc417b2013-11-14 02:25:59 -08002907 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, "f9924000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002908 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, ""),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002909 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002910 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""),
2911 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""),
Gilad Avidova460c472013-04-12 16:23:32 -06002912 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, "f9926000.spi"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002913 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002914 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, "f9927000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002915 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""),
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -06002916 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9928000.i2c"),
2917 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, "f9928000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002918 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""),
2919 CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, ""),
2920 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""),
2921 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, ""),
2922 CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""),
2923 CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""),
2924 CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""),
2925 CLK_LOOKUP("iface_clk", gcc_boot_rom_ahb_clk.c, ""),
2926 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""),
2927 CLK_LOOKUP("core_clk", gcc_ce1_axi_clk.c, ""),
2928 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""),
2929 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c, ""),
2930 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, ""),
Bansidhar Gopalachari148c7252013-09-25 19:55:41 +01002931 CLK_LOOKUP("core_clk", gcc_gp1_clk.c, "0-000e"),
Houston Hoffman8fc417b2013-11-14 02:25:59 -08002932 CLK_LOOKUP("core_clk_pvt", gcc_gp1_clk.c, "2-000e"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002933 CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""),
2934 CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""),
2935 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, ""),
2936 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, ""),
2937 CLK_LOOKUP("core_clk", gcc_mss_q6_bimc_axi_clk.c, ""),
2938 CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""),
2939 CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""),
Hariprasad Dhalinarasimha2cced7d2013-04-13 17:25:58 -07002940 CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002941 CLK_LOOKUP("iface_clk", gcc_sdcc1_ahb_clk.c, "msm_sdcc.1"),
2942 CLK_LOOKUP("core_clk", gcc_sdcc1_apps_clk.c, "msm_sdcc.1"),
2943 CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"),
2944 CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"),
Mayank Rana05754c92013-07-24 17:12:37 +05302945 CLK_LOOKUP("sleep_clk", gcc_usb2a_phy_sleep_clk.c, "f9a55000.usb"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002946 CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"),
2947 CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"),
2948
2949 CLK_LOOKUP("core_clk_src", csi0_clk_src.c, ""),
2950 CLK_LOOKUP("core_clk_src", axi_clk_src.c, ""),
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002951 CLK_LOOKUP("", mdp_axi_clk_src.c, ""),
2952 CLK_LOOKUP("", mmssnoc_axi_clk_src.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002953 CLK_LOOKUP("core_clk_src", dsi_pclk_clk_src.c, ""),
2954 CLK_LOOKUP("core_clk_src", gfx3d_clk_src.c, ""),
2955 CLK_LOOKUP("core_clk_src", vfe_clk_src.c, ""),
2956 CLK_LOOKUP("core_clk_src", csi1_clk_src.c, ""),
2957 CLK_LOOKUP("core_clk_src", csi0phytimer_clk_src.c, ""),
2958 CLK_LOOKUP("core_clk_src", csi1phytimer_clk_src.c, ""),
2959 CLK_LOOKUP("core_clk_src", dsi_clk_src.c, ""),
2960 CLK_LOOKUP("core_clk_src", dsi_byte_clk_src.c, ""),
2961 CLK_LOOKUP("core_clk_src", dsi_esc_clk_src.c, ""),
2962 CLK_LOOKUP("core_clk_src", mclk0_clk_src.c, ""),
2963 CLK_LOOKUP("core_clk_src", mclk1_clk_src.c, ""),
2964 CLK_LOOKUP("core_clk_src", mdp_vsync_clk_src.c, ""),
2965
2966 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, ""),
2967 CLK_LOOKUP("core_clk", csi0_clk.c, ""),
2968 CLK_LOOKUP("core_clk", csi0phy_clk.c, ""),
2969 CLK_LOOKUP("core_clk", csi0phytimer_clk.c, ""),
2970 CLK_LOOKUP("core_clk", csi0pix_clk.c, ""),
2971 CLK_LOOKUP("core_clk", csi0rdi_clk.c, ""),
2972 CLK_LOOKUP("core_clk", csi1_clk.c, ""),
2973 CLK_LOOKUP("core_clk", csi1phy_clk.c, ""),
2974 CLK_LOOKUP("core_clk", csi1phytimer_clk.c, ""),
2975 CLK_LOOKUP("core_clk", csi1pix_clk.c, ""),
2976 CLK_LOOKUP("core_clk", csi1rdi_clk.c, ""),
2977 CLK_LOOKUP("core_clk", csi_ahb_clk.c, ""),
2978 CLK_LOOKUP("core_clk", csi_vfe_clk.c, ""),
2979 CLK_LOOKUP("core_clk", dsi_clk.c, ""),
2980 CLK_LOOKUP("core_clk", dsi_ahb_clk.c, ""),
2981 CLK_LOOKUP("core_clk", dsi_byte_clk.c, ""),
2982 CLK_LOOKUP("core_clk", dsi_esc_clk.c, ""),
2983 CLK_LOOKUP("core_clk", dsi_pclk_clk.c, ""),
2984 CLK_LOOKUP("core_clk", gmem_gfx3d_clk.c, ""),
2985 CLK_LOOKUP("core_clk", mclk0_clk.c, ""),
2986 CLK_LOOKUP("core_clk", mclk1_clk.c, ""),
2987 CLK_LOOKUP("core_clk", mdp_ahb_clk.c, ""),
2988 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
2989 CLK_LOOKUP("core_clk", mdp_dsi_clk.c, ""),
2990 CLK_LOOKUP("core_clk", mdp_lcdc_clk.c, ""),
2991 CLK_LOOKUP("core_clk", mdp_vsync_clk.c, ""),
2992 CLK_LOOKUP("core_clk", mmss_misc_ahb_clk.c, ""),
2993 CLK_LOOKUP("core_clk", mmss_s0_axi_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002994 CLK_LOOKUP("core_clk", mmss_mmssnoc_bto_ahb_clk.c, ""),
2995 CLK_LOOKUP("core_clk", mmss_mmssnoc_axi_clk.c, ""),
2996 CLK_LOOKUP("core_clk", vfe_clk.c, ""),
2997 CLK_LOOKUP("core_clk", vfe_ahb_clk.c, ""),
2998 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
2999
Vikram Mulukutla49423392013-05-02 09:03:02 -07003000 CLK_LOOKUP("core_clk", csi0pix_cam_mux_clk.c, ""),
3001 CLK_LOOKUP("core_clk", csi0phy_cam_mux_clk.c, ""),
3002 CLK_LOOKUP("core_clk", csi1phy_cam_mux_clk.c, ""),
3003 CLK_LOOKUP("core_clk", rdi2_cam_mux_clk.c, ""),
3004 CLK_LOOKUP("core_clk", rdi1_cam_mux_clk.c, ""),
3005 CLK_LOOKUP("core_clk", rdi0_cam_mux_clk.c, ""),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07003006
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003007 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
3008 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fdc00000.qcom,kgsl-3d0"),
3009 CLK_LOOKUP("mem_iface_clk", bimc_gfx_clk.c, "fdc00000.qcom,kgsl-3d0"),
3010 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07003011 CLK_LOOKUP("alt_mem_iface_clk", gcc_bimc_smmu_clk.c,
3012 "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003013
3014 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd890000.qcom,iommu"),
3015 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "fd890000.qcom,iommu"),
3016 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd860000.qcom,iommu"),
3017 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd860000.qcom,iommu"),
3018 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd870000.qcom,iommu"),
3019 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd870000.qcom,iommu"),
3020 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd880000.qcom,iommu"),
3021 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07003022 CLK_LOOKUP("alt_core_clk", gcc_bimc_smmu_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003023 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, "fd000000.qcom,iommu"),
3024 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, "fd000000.qcom,iommu"),
3025 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c,
3026 "fd010000.qcom,iommu"),
3027 CLK_LOOKUP("core_clk", pnoc_iommu_clk.c, "fd010000.qcom,iommu"),
3028
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003029 /* MM sensor clocks */
3030 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006f"),
Aditya Jonnalagadda3057ba52013-09-20 19:59:41 +05303031 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0034"),
Li Sun3eb82a62013-06-14 15:14:22 +08003032 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-007d"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003033 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006d"),
Ju He543b5802013-06-07 16:03:34 -07003034 CLK_LOOKUP("cam_src_clk", mclk1_clk_src.c, "6-0078"),
Yu Yang8744be82013-06-18 14:39:37 +08003035 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0020"),
Wei Ding7d2f73d2013-09-10 09:41:10 +08003036 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006a"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003037 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006f"),
Aditya Jonnalagadda3057ba52013-09-20 19:59:41 +05303038 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0034"),
Li Sun3eb82a62013-06-14 15:14:22 +08003039 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-007d"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003040 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006d"),
Ju He543b5802013-06-07 16:03:34 -07003041 CLK_LOOKUP("cam_clk", mclk1_clk.c, "6-0078"),
Yu Yang8744be82013-06-18 14:39:37 +08003042 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0020"),
Wei Ding7d2f73d2013-09-10 09:41:10 +08003043 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006a"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003044
3045
3046 /* CSIPHY clocks */
3047 CLK_LOOKUP("csiphy_timer_src_clk", csi0phytimer_clk_src.c,
3048 "fda00c00.qcom,csiphy"),
3049 CLK_LOOKUP("csiphy_timer_clk", csi0phytimer_clk.c,
3050 "fda00c00.qcom,csiphy"),
Chandan Gera30c93082013-10-24 14:10:13 +05303051 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00c00.qcom,csiphy"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003052 CLK_LOOKUP("csiphy_timer_src_clk", csi1phytimer_clk_src.c,
3053 "fda01000.qcom,csiphy"),
3054 CLK_LOOKUP("csiphy_timer_clk", csi1phytimer_clk.c,
3055 "fda01000.qcom,csiphy"),
Chandan Gera30c93082013-10-24 14:10:13 +05303056 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda01000.qcom,csiphy"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003057
3058 /* CSID clocks */
juhe85f33272013-05-10 15:21:08 +08003059 CLK_LOOKUP("csi_clk", csi0_clk.c, "fda00000.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003060 CLK_LOOKUP("csi_src_clk", csi0_clk_src.c, "fda00000.qcom,csid"),
juhe85f33272013-05-10 15:21:08 +08003061 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00000.qcom,csid"),
3062 CLK_LOOKUP("csi0phy_mux_clk", csi0phy_cam_mux_clk.c,
3063 "fda00000.qcom,csid"),
3064 CLK_LOOKUP("csi1phy_mux_clk", csi1phy_cam_mux_clk.c,
3065 "fda00000.qcom,csid"),
3066 CLK_LOOKUP("csi0pix_mux_clk", csi0pix_cam_mux_clk.c,
3067 "fda00000.qcom,csid"),
3068 CLK_LOOKUP("csi0rdi_mux_clk", rdi0_cam_mux_clk.c,
3069 "fda00000.qcom,csid"),
3070 CLK_LOOKUP("csi1rdi_mux_clk", rdi1_cam_mux_clk.c,
3071 "fda00000.qcom,csid"),
3072 CLK_LOOKUP("csi2rdi_mux_clk", rdi2_cam_mux_clk.c,
3073 "fda00000.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003074
juhe85f33272013-05-10 15:21:08 +08003075 CLK_LOOKUP("csi_clk", csi1_clk.c, "fda00400.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003076 CLK_LOOKUP("csi_src_clk", csi1_clk_src.c, "fda00400.qcom,csid"),
juhe85f33272013-05-10 15:21:08 +08003077 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00400.qcom,csid"),
3078 CLK_LOOKUP("csi0phy_mux_clk", csi0phy_cam_mux_clk.c,
3079 "fda00400.qcom,csid"),
3080 CLK_LOOKUP("csi1phy_mux_clk", csi1phy_cam_mux_clk.c,
3081 "fda00400.qcom,csid"),
3082 CLK_LOOKUP("csi0pix_mux_clk", csi0pix_cam_mux_clk.c,
3083 "fda00400.qcom,csid"),
3084 CLK_LOOKUP("csi0rdi_mux_clk", rdi0_cam_mux_clk.c,
3085 "fda00400.qcom,csid"),
3086 CLK_LOOKUP("csi1rdi_mux_clk", rdi1_cam_mux_clk.c,
3087 "fda00400.qcom,csid"),
3088 CLK_LOOKUP("csi2rdi_mux_clk", rdi2_cam_mux_clk.c,
3089 "fda00400.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003090
juhe85f33272013-05-10 15:21:08 +08003091 CLK_LOOKUP("csi_phy_src_clk", csi0phy_clk.c, "fda00000.qcom,csid"),
3092 CLK_LOOKUP("csi_phy_src_clk", csi1phy_clk.c, "fda00400.qcom,csid"),
3093 CLK_LOOKUP("csi_pix_src_clk", csi0pix_clk.c, "fda00000.qcom,csid"),
3094 CLK_LOOKUP("csi_pix_src_clk", csi1pix_clk.c, "fda00400.qcom,csid"),
3095 CLK_LOOKUP("csi_rdi_src_clk", csi0rdi_clk.c, "fda00000.qcom,csid"),
3096 CLK_LOOKUP("csi_rdi_src_clk", csi1rdi_clk.c, "fda00400.qcom,csid"),
3097 /* ISPIF need no clock */
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003098
3099 CLK_LOOKUP("vfe_clk_src", vfe_clk_src.c, "fde00000.qcom,vfe"),
3100 CLK_LOOKUP("vfe_clk", vfe_clk.c, "fde00000.qcom,vfe"),
3101
3102 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "fde00000.qcom,vfe"),
3103 CLK_LOOKUP("vfe_ahb_clk", vfe_ahb_clk.c, "fde00000.qcom,vfe"),
3104
3105 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "fde00000.qcom,vfe"),
3106
3107
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003108 CLK_LOOKUP("core_clk", q6ss_xo_clk.c, "fe200000.qcom,lpass"),
3109 CLK_LOOKUP("bus_clk", gcc_lpass_q6_axi_clk.c, "fe200000.qcom,lpass"),
3110 CLK_LOOKUP("iface_clk", q6ss_ahb_lfabif_clk.c, "fe200000.qcom,lpass"),
3111 CLK_LOOKUP("reg_clk", q6ss_ahbm_clk.c, "fe200000.qcom,lpass"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003112
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07003113 CLK_LOOKUP("xo", cxo_acpu_clk.c, "f9011050.qcom,acpuclk"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003114 CLK_LOOKUP("gpll0", gpll0_ao_clk_src.c, "f9011050.qcom,acpuclk"),
3115 CLK_LOOKUP("a7sspll", a7sspll.c, "f9011050.qcom,acpuclk"),
Patrick Daly5be83262013-11-05 14:15:10 -08003116 CLK_LOOKUP("clk-4", gpll0_ao_clk_src.c, "f9011050.qcom,clock-a7"),
3117 CLK_LOOKUP("clk-5", a7sspll.c, "f9011050.qcom,clock-a7"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003118
3119 CLK_LOOKUP("measure_clk", apc0_m_clk, ""),
3120 CLK_LOOKUP("measure_clk", apc1_m_clk, ""),
3121 CLK_LOOKUP("measure_clk", apc2_m_clk, ""),
3122 CLK_LOOKUP("measure_clk", apc3_m_clk, ""),
3123 CLK_LOOKUP("measure_clk", l2_m_clk, ""),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003124
Vikram Mulukutla69680bb2013-12-17 15:58:46 -08003125 CLK_LOOKUP("measure", measure_clk.c, "fb000000.qcom,wcnss-wlan"),
3126 CLK_LOOKUP("wcnss_debug", wcnss_m_clk, "fb000000.qcom,wcnss-wlan"),
3127
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07003128 CLK_LOOKUP("xo", cxo_wlan_clk.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutla7e5b3112013-04-15 16:32:40 -07003129 CLK_LOOKUP("rf_clk", cxo_a1.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutlaed078512013-04-09 14:15:33 -07003130
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003131 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd900000.qcom,mdss_mdp"),
3132 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd900000.qcom,mdss_mdp"),
3133 CLK_LOOKUP("lcdc_clk", mdp_lcdc_clk.c, "fd900000.qcom,mdss_mdp"),
3134 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003135 CLK_LOOKUP("dsi_clk", mdp_dsi_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003136 CLK_LOOKUP("iface_clk", dsi_ahb_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003137 CLK_LOOKUP("dsi_clk", dsi_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003138 CLK_LOOKUP("byte_clk", dsi_byte_clk.c, "fdd00000.qcom,mdss_dsi"),
3139 CLK_LOOKUP("esc_clk", dsi_esc_clk.c, "fdd00000.qcom,mdss_dsi"),
3140 CLK_LOOKUP("pixel_clk", dsi_pclk_clk.c, "fdd00000.qcom,mdss_dsi"),
Hariprasad Dhalinarasimhad9ede5a2013-04-14 16:30:09 -07003141
3142 /* QSEECOM Clocks */
3143 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "qseecom"),
3144 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "qseecom"),
3145 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "qseecom"),
3146 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "qseecom"),
Vikram Mulukutlafd6833c2013-04-18 12:46:48 -07003147
3148 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "scm"),
3149 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "scm"),
3150 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "scm"),
3151 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "scm"),
Hariprasad Dhalinarasimha315b9bd2013-05-14 12:31:56 -07003152
3153 /* Add QCEDEV clocks */
3154 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcedev"),
3155 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcedev"),
3156 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcedev"),
3157 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcedev"),
3158
3159 /* Add QCRYPTO clocks */
3160 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd404000.qcom,qcrypto"),
3161 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd404000.qcom,qcrypto"),
3162 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd404000.qcom,qcrypto"),
3163 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd404000.qcom,qcrypto"),
Matt Wagantall8ce3c462013-07-03 19:24:53 -07003164
3165 /* GDSC clocks */
3166 CLK_LOOKUP("core_clk", vfe_clk.c, "fd8c36a4.qcom,gdsc"),
3167 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd8c36a4.qcom,gdsc"),
3168 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "fd8c36a4.qcom,gdsc"),
Matt Wagantall8ce3c462013-07-03 19:24:53 -07003169 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fd8c4034.qcom,gdsc"),
3170 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd8c4034.qcom,gdsc"),
3171 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fd8c4034.qcom,gdsc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003172};
3173
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003174static struct clk_lookup msm_clocks_8610_rumi[] = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003175 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3176 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3177 CLK_DUMMY("iface_clk", HSUSB_IFACE_CLK, "f9a55000.usb", OFF),
3178 CLK_DUMMY("core_clk", HSUSB_CORE_CLK, "f9a55000.usb", OFF),
3179 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.1", OFF),
3180 CLK_DUMMY("core_clk", NULL, "msm_sdcc.1", OFF),
3181 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.1", OFF),
3182 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.2", OFF),
3183 CLK_DUMMY("core_clk", NULL, "msm_sdcc.2", OFF),
3184 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.2", OFF),
3185 CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
3186 CLK_DUMMY("iface_clk", NULL, "fd890000.qcom,iommu", OFF),
3187 CLK_DUMMY("core_clk", NULL, "fd890000.qcom,iommu", OFF),
3188 CLK_DUMMY("iface_clk", NULL, "fd860000.qcom,iommu", OFF),
3189 CLK_DUMMY("core_clk", NULL, "fd860000.qcom,iommu", OFF),
3190 CLK_DUMMY("iface_clk", NULL, "fd870000.qcom,iommu", OFF),
3191 CLK_DUMMY("core_clk", NULL, "fd870000.qcom,iommu", OFF),
3192 CLK_DUMMY("iface_clk", NULL, "fd880000.qcom,iommu", OFF),
3193 CLK_DUMMY("core_clk", NULL, "fd880000.qcom,iommu", OFF),
Olav Haugan3431b4c2013-04-30 14:09:08 -07003194 CLK_DUMMY("alt_core_clk", NULL, "fd880000.qcom,iommu", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003195 CLK_DUMMY("iface_clk", NULL, "fd000000.qcom,iommu", OFF),
3196 CLK_DUMMY("core_clk", NULL, "fd000000.qcom,iommu", OFF),
3197 CLK_DUMMY("iface_clk", NULL, "fd010000.qcom,iommu", OFF),
3198 CLK_DUMMY("core_clk", NULL, "fd010000.qcom,iommu", OFF),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003199 CLK_DUMMY("xo", NULL, "f9011050.qcom,acpuclk", OFF),
3200 CLK_DUMMY("gpll0", NULL, "f9011050.qcom,acpuclk", OFF),
3201 CLK_DUMMY("a7sspll", NULL, "f9011050.qcom,acpuclk", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003202};
3203
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003204struct clock_init_data msm8610_rumi_clock_init_data __initdata = {
3205 .table = msm_clocks_8610_rumi,
3206 .size = ARRAY_SIZE(msm_clocks_8610_rumi),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003207};
3208
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003209/* MMPLL0 at 800 MHz, main output enabled. */
3210static struct pll_config mmpll0_config __initdata = {
3211 .l = 0x29,
3212 .m = 0x2,
3213 .n = 0x3,
3214 .vco_val = 0x0,
3215 .vco_mask = BM(21, 20),
3216 .pre_div_val = 0x0,
3217 .pre_div_mask = BM(14, 12),
3218 .post_div_val = 0x0,
3219 .post_div_mask = BM(9, 8),
3220 .mn_ena_val = BIT(24),
3221 .mn_ena_mask = BIT(24),
3222 .main_output_val = BIT(0),
3223 .main_output_mask = BIT(0),
3224};
3225
3226/* MMPLL1 at 1200 MHz, main output enabled. */
3227static struct pll_config mmpll1_config __initdata = {
3228 .l = 0x3E,
3229 .m = 0x1,
3230 .n = 0x2,
3231 .vco_val = 0x0,
3232 .vco_mask = BM(21, 20),
3233 .pre_div_val = 0x0,
3234 .pre_div_mask = BM(14, 12),
3235 .post_div_val = 0x0,
3236 .post_div_mask = BM(9, 8),
3237 .mn_ena_val = BIT(24),
3238 .mn_ena_mask = BIT(24),
3239 .main_output_val = BIT(0),
3240 .main_output_mask = BIT(0),
3241};
3242
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003243static void __init reg_init(void)
3244{
Vikram Mulukutla81577ab2013-03-25 10:55:36 -07003245 u32 regval;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003246
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003247 configure_sr_hpm_lp_pll(&mmpll0_config, &mmpll0_regs, 1);
3248 configure_sr_hpm_lp_pll(&mmpll1_config, &mmpll1_regs, 1);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003249
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003250 /* Vote for GPLL0 to turn on. Needed by acpuclock. */
3251 regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3252 regval |= BIT(0);
3253 writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3254
3255 /*
3256 * TODO: Confirm that no clocks need to be voted on in this sleep vote
3257 * register.
3258 */
3259 writel_relaxed(0x0, GCC_REG_BASE(APCS_CLOCK_SLEEP_ENA_VOTE));
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003260}
3261
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003262static void __init msm8610_clock_post_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003263{
3264 /*
3265 * Hold an active set vote for CXO; this is because CXO is expected
3266 * to remain on whenever CPUs aren't power collapsed.
3267 */
3268 clk_prepare_enable(&gcc_xo_a_clk_src.c);
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -07003269 /*
3270 * Hold an active set vote for the PNOC AHB source. Sleep set vote is 0.
3271 */
3272 clk_set_rate(&pnoc_keepalive_a_clk.c, 19200000);
3273 clk_prepare_enable(&pnoc_keepalive_a_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003274 /* Set rates for single-rate clocks. */
3275 clk_set_rate(&usb_hs_system_clk_src.c,
3276 usb_hs_system_clk_src.freq_tbl[0].freq_hz);
3277 clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz);
3278 clk_set_rate(&mclk0_clk_src.c, mclk0_clk_src.freq_tbl[0].freq_hz);
3279 clk_set_rate(&mclk1_clk_src.c, mclk1_clk_src.freq_tbl[0].freq_hz);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003280}
3281
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003282static void dsi_init(void)
3283{
3284 dsi_byte_clk_src_ops = clk_ops_rcg;
3285 dsi_byte_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3286 dsi_byte_clk_src_ops.handoff = byte_rcg_handoff;
3287 dsi_byte_clk_src_ops.get_parent = NULL;
3288
3289 dsi_dsi_clk_src_ops = clk_ops_rcg_mnd;
3290 dsi_dsi_clk_src_ops.set_rate = set_rate_dsi_clk;
3291 dsi_dsi_clk_src_ops.handoff = pixel_rcg_handoff;
3292 dsi_dsi_clk_src_ops.get_parent = NULL;
3293
3294 dsi_pixel_clk_src_ops = clk_ops_rcg_mnd;
3295 dsi_pixel_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3296 dsi_pixel_clk_src_ops.handoff = pixel_rcg_handoff;
3297 dsi_pixel_clk_src_ops.get_parent = NULL;
3298
3299 dsi_clk_ctrl_init(&dsi_ahb_clk.c);
3300}
3301
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003302#define GCC_CC_PHYS 0xFC400000
3303#define GCC_CC_SIZE SZ_16K
3304
3305#define MMSS_CC_PHYS 0xFD8C0000
3306#define MMSS_CC_SIZE SZ_256K
3307
3308#define LPASS_CC_PHYS 0xFE000000
3309#define LPASS_CC_SIZE SZ_256K
3310
3311#define APCS_GCC_CC_PHYS 0xF9011000
3312#define APCS_GCC_CC_SIZE SZ_4K
3313
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003314#define APCS_KPSS_SH_PLL_PHYS 0xF9016000
3315#define APCS_KPSS_SH_PLL_SIZE SZ_64
3316
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003317static void __init msm8610_clock_pre_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003318{
3319 virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE);
3320 if (!virt_bases[GCC_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003321 panic("clock-8610: Unable to ioremap GCC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003322
3323 virt_bases[MMSS_BASE] = ioremap(MMSS_CC_PHYS, MMSS_CC_SIZE);
3324 if (!virt_bases[MMSS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003325 panic("clock-8610: Unable to ioremap MMSS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003326
3327 virt_bases[LPASS_BASE] = ioremap(LPASS_CC_PHYS, LPASS_CC_SIZE);
3328 if (!virt_bases[LPASS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003329 panic("clock-8610: Unable to ioremap LPASS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003330
3331 virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE);
3332 if (!virt_bases[APCS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003333 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003334
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003335 virt_bases[APCS_PLL_BASE] = ioremap(APCS_KPSS_SH_PLL_PHYS,
3336 APCS_KPSS_SH_PLL_SIZE);
3337 if (!virt_bases[APCS_PLL_BASE])
3338 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
3339
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003340 clk_ops_local_pll.enable = sr_hpm_lp_pll_clk_enable;
3341
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003342 vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig");
3343 if (IS_ERR(vdd_dig.regulator[0]))
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003344 panic("clock-8610: Unable to get the vdd_dig regulator!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003345
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003346 vdd_sr2_pll.regulator[0] = regulator_get(NULL, "vdd_sr2_pll");
3347 if (IS_ERR(vdd_sr2_pll.regulator[0]))
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003348 panic("clock-8610: Unable to get the vdd_sr2_pll regulator!");
3349
Patrick Daly6fb589a2013-03-29 17:55:55 -07003350 vdd_sr2_pll.regulator[1] = regulator_get(NULL, "vdd_sr2_dig");
3351 if (IS_ERR(vdd_sr2_pll.regulator[1]))
3352 panic("clock-8610: Unable to get the vdd_sr2_dig regulator!");
3353
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003354 enable_rpm_scaling();
3355
3356 /* Enable a clock to allow access to MMSS clock registers */
3357 clk_prepare_enable(&gcc_mmss_noc_cfg_ahb_clk.c),
3358
3359 reg_init();
3360
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003361 dsi_init();
3362
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08003363 /* Maintain the max nominal frequency on the MMSSNOC AHB bus. */
3364 clk_set_rate(&mmssnoc_ahb_a_clk.c, 40000000);
3365 clk_prepare_enable(&mmssnoc_ahb_a_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003366}
3367
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003368struct clock_init_data msm8610_clock_init_data __initdata = {
3369 .table = msm_clocks_8610,
3370 .size = ARRAY_SIZE(msm_clocks_8610),
3371 .pre_init = msm8610_clock_pre_init,
3372 .post_init = msm8610_clock_post_init,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003373};