blob: 665c0401e4961a71d7631a41afe6078d06f15628 [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);
530
531#define APCS_SH_PLL_MODE 0x000
532#define APCS_SH_PLL_L_VAL 0x004
533#define APCS_SH_PLL_M_VAL 0x008
534#define APCS_SH_PLL_N_VAL 0x00C
535#define APCS_SH_PLL_USER_CTL 0x010
536#define APCS_SH_PLL_CONFIG_CTL 0x014
537#define APCS_SH_PLL_STATUS 0x01C
538
539enum vdd_sr2_pll_levels {
540 VDD_SR2_PLL_OFF,
Patrick Daly6fb589a2013-03-29 17:55:55 -0700541 VDD_SR2_PLL_SVS,
542 VDD_SR2_PLL_NOM,
543 VDD_SR2_PLL_TUR,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800544 VDD_SR2_PLL_NUM
545};
546
Junjie Wubb5a79e2013-05-15 13:12:39 -0700547static int vdd_sr2_levels[] = {
548 0, RPM_REGULATOR_CORNER_NONE, /* VDD_SR2_PLL_OFF */
549 1800000, RPM_REGULATOR_CORNER_SVS_SOC, /* VDD_SR2_PLL_SVS */
550 1800000, RPM_REGULATOR_CORNER_NORMAL, /* VDD_SR2_PLL_NOM */
551 1800000, RPM_REGULATOR_CORNER_SUPER_TURBO, /* VDD_SR2_PLL_TUR */
Patrick Dalyebc26bc2013-02-05 11:49:07 -0800552};
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800553
Patrick Daly653c0b52013-04-16 17:18:28 -0700554static DEFINE_VDD_REGULATORS(vdd_sr2_pll, VDD_SR2_PLL_NUM, 2,
555 vdd_sr2_levels, NULL);
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800556
557static struct pll_freq_tbl apcs_pll_freq[] = {
Patrick Daly83806032013-03-25 15:18:24 -0700558 F_APCS_PLL( 768000000, 40, 0x0, 0x1, 0x0, 0x0, 0x0),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800559 F_APCS_PLL( 787200000, 41, 0x0, 0x1, 0x0, 0x0, 0x0),
560 F_APCS_PLL( 998400000, 52, 0x0, 0x1, 0x0, 0x0, 0x0),
561 F_APCS_PLL(1190400000, 62, 0x0, 0x1, 0x0, 0x0, 0x0),
562 PLL_F_END
563};
564
565static struct pll_clk a7sspll = {
566 .mode_reg = (void __iomem *)APCS_SH_PLL_MODE,
567 .l_reg = (void __iomem *)APCS_SH_PLL_L_VAL,
568 .m_reg = (void __iomem *)APCS_SH_PLL_M_VAL,
569 .n_reg = (void __iomem *)APCS_SH_PLL_N_VAL,
570 .config_reg = (void __iomem *)APCS_SH_PLL_USER_CTL,
571 .status_reg = (void __iomem *)APCS_SH_PLL_STATUS,
572 .freq_tbl = apcs_pll_freq,
573 .masks = {
574 .vco_mask = BM(29, 28),
575 .pre_div_mask = BIT(12),
576 .post_div_mask = BM(9, 8),
577 .mn_en_mask = BIT(24),
578 .main_output_mask = BIT(0),
579 },
580 .base = &virt_bases[APCS_PLL_BASE],
581 .c = {
Patrick Daly9bdc8a52013-03-21 19:12:40 -0700582 .parent = &gcc_xo_a_clk_src.c,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800583 .dbg_name = "a7sspll",
584 .ops = &clk_ops_sr2_pll,
585 .vdd_class = &vdd_sr2_pll,
586 .fmax = (unsigned long [VDD_SR2_PLL_NUM]) {
Patrick Daly6fb589a2013-03-29 17:55:55 -0700587 [VDD_SR2_PLL_SVS] = 1000000000,
588 [VDD_SR2_PLL_NOM] = 1900000000,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800589 },
590 .num_fmax = VDD_SR2_PLL_NUM,
591 CLK_INIT(a7sspll.c),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800592 },
593};
594
595static unsigned int soft_vote_gpll0;
596
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700597static struct pll_vote_clk gpll0_clk_src = {
598 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
599 .en_mask = BIT(0),
600 .status_reg = (void __iomem *)GPLL0_STATUS,
601 .status_mask = BIT(17),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800602 .soft_vote = &soft_vote_gpll0,
603 .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700604 .base = &virt_bases[GCC_BASE],
605 .c = {
606 .parent = &gcc_xo_clk_src.c,
607 .rate = 600000000,
608 .dbg_name = "gpll0_clk_src",
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800609 .ops = &clk_ops_pll_acpu_vote,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700610 CLK_INIT(gpll0_clk_src.c),
611 },
612};
613
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800614static struct pll_vote_clk gpll0_ao_clk_src = {
615 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
616 .en_mask = BIT(0),
617 .status_reg = (void __iomem *)GPLL0_STATUS,
618 .status_mask = BIT(17),
619 .soft_vote = &soft_vote_gpll0,
620 .soft_vote_mask = PLL_SOFT_VOTE_ACPU,
621 .base = &virt_bases[GCC_BASE],
622 .c = {
623 .rate = 600000000,
624 .dbg_name = "gpll0_ao_clk_src",
625 .ops = &clk_ops_pll_acpu_vote,
626 CLK_INIT(gpll0_ao_clk_src.c),
627 },
628};
629
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700630static struct pll_vote_clk mmpll0_clk_src = {
631 .en_reg = (void __iomem *)MMSS_PLL_VOTE_APCS_REG,
632 .en_mask = BIT(0),
633 .status_reg = (void __iomem *)MMPLL0_PLL_STATUS,
634 .status_mask = BIT(17),
635 .base = &virt_bases[MMSS_BASE],
636 .c = {
637 .parent = &gcc_xo_clk_src.c,
638 .dbg_name = "mmpll0_clk_src",
639 .rate = 800000000,
640 .ops = &clk_ops_pll_vote,
641 CLK_INIT(mmpll0_clk_src.c),
642 },
643};
644
645static struct pll_config_regs mmpll0_regs __initdata = {
646 .l_reg = (void __iomem *)MMPLL0_PLL_L_VAL,
647 .m_reg = (void __iomem *)MMPLL0_PLL_M_VAL,
648 .n_reg = (void __iomem *)MMPLL0_PLL_N_VAL,
649 .config_reg = (void __iomem *)MMPLL0_PLL_USER_CTL,
650 .mode_reg = (void __iomem *)MMPLL0_PLL_MODE,
651 .base = &virt_bases[MMSS_BASE],
652};
653
654static struct pll_clk mmpll1_clk_src = {
655 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
656 .status_reg = (void __iomem *)MMPLL1_PLL_STATUS,
657 .base = &virt_bases[MMSS_BASE],
658 .c = {
659 .parent = &gcc_xo_clk_src.c,
660 .dbg_name = "mmpll1_clk_src",
661 .rate = 1200000000,
662 .ops = &clk_ops_local_pll,
663 CLK_INIT(mmpll1_clk_src.c),
664 },
665};
666
667static struct pll_config_regs mmpll1_regs __initdata = {
668 .l_reg = (void __iomem *)MMPLL1_PLL_L_VAL,
669 .m_reg = (void __iomem *)MMPLL1_PLL_M_VAL,
670 .n_reg = (void __iomem *)MMPLL1_PLL_N_VAL,
671 .config_reg = (void __iomem *)MMPLL1_PLL_USER_CTL,
672 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
673 .base = &virt_bases[MMSS_BASE],
674};
675
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700676static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = {
677 F( 960000, gcc_xo, 10, 1, 2),
678 F( 4800000, gcc_xo, 4, 0, 0),
679 F( 9600000, gcc_xo, 2, 0, 0),
680 F(15000000, gpll0, 10, 1, 4),
681 F(19200000, gcc_xo, 1, 0, 0),
682 F(25000000, gpll0, 12, 1, 2),
683 F(50000000, gpll0, 12, 0, 0),
684 F_END,
685};
686
687static struct rcg_clk blsp1_qup1_spi_apps_clk_src = {
688 .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR,
689 .set_rate = set_rate_mnd,
690 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
691 .current_freq = &rcg_dummy_freq,
692 .base = &virt_bases[GCC_BASE],
693 .c = {
694 .dbg_name = "blsp1_qup1_spi_apps_clk_src",
695 .ops = &clk_ops_rcg_mnd,
696 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
697 CLK_INIT(blsp1_qup1_spi_apps_clk_src.c),
698 },
699};
700
701static struct rcg_clk blsp1_qup2_spi_apps_clk_src = {
702 .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR,
703 .set_rate = set_rate_mnd,
704 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
705 .current_freq = &rcg_dummy_freq,
706 .base = &virt_bases[GCC_BASE],
707 .c = {
708 .dbg_name = "blsp1_qup2_spi_apps_clk_src",
709 .ops = &clk_ops_rcg_mnd,
710 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
711 CLK_INIT(blsp1_qup2_spi_apps_clk_src.c),
712 },
713};
714
715static struct rcg_clk blsp1_qup3_spi_apps_clk_src = {
716 .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR,
717 .set_rate = set_rate_mnd,
718 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
719 .current_freq = &rcg_dummy_freq,
720 .base = &virt_bases[GCC_BASE],
721 .c = {
722 .dbg_name = "blsp1_qup3_spi_apps_clk_src",
723 .ops = &clk_ops_rcg_mnd,
724 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
725 CLK_INIT(blsp1_qup3_spi_apps_clk_src.c),
726 },
727};
728
729static struct rcg_clk blsp1_qup4_spi_apps_clk_src = {
730 .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR,
731 .set_rate = set_rate_mnd,
732 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
733 .current_freq = &rcg_dummy_freq,
734 .base = &virt_bases[GCC_BASE],
735 .c = {
736 .dbg_name = "blsp1_qup4_spi_apps_clk_src",
737 .ops = &clk_ops_rcg_mnd,
738 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
739 CLK_INIT(blsp1_qup4_spi_apps_clk_src.c),
740 },
741};
742
743static struct rcg_clk blsp1_qup5_spi_apps_clk_src = {
744 .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR,
745 .set_rate = set_rate_mnd,
746 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
747 .current_freq = &rcg_dummy_freq,
748 .base = &virt_bases[GCC_BASE],
749 .c = {
750 .dbg_name = "blsp1_qup5_spi_apps_clk_src",
751 .ops = &clk_ops_rcg_mnd,
752 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
753 CLK_INIT(blsp1_qup5_spi_apps_clk_src.c),
754 },
755};
756
757static struct rcg_clk blsp1_qup6_spi_apps_clk_src = {
758 .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR,
759 .set_rate = set_rate_mnd,
760 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
761 .current_freq = &rcg_dummy_freq,
762 .base = &virt_bases[GCC_BASE],
763 .c = {
764 .dbg_name = "blsp1_qup6_spi_apps_clk_src",
765 .ops = &clk_ops_rcg_mnd,
766 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
767 CLK_INIT(blsp1_qup6_spi_apps_clk_src.c),
768 },
769};
770
771static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = {
772 F( 3686400, gpll0, 1, 96, 15625),
773 F( 7372800, gpll0, 1, 192, 15625),
774 F(14745600, gpll0, 1, 384, 15625),
775 F(16000000, gpll0, 5, 2, 15),
776 F(19200000, gcc_xo, 1, 0, 0),
777 F(24000000, gpll0, 5, 1, 5),
778 F(32000000, gpll0, 1, 4, 75),
779 F(40000000, gpll0, 15, 0, 0),
780 F(46400000, gpll0, 1, 29, 375),
781 F(48000000, gpll0, 12.5, 0, 0),
782 F(51200000, gpll0, 1, 32, 375),
783 F(56000000, gpll0, 1, 7, 75),
784 F(58982400, gpll0, 1, 1536, 15625),
785 F(60000000, gpll0, 10, 0, 0),
786 F_END,
787};
788
789static struct rcg_clk blsp1_uart1_apps_clk_src = {
790 .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR,
791 .set_rate = set_rate_mnd,
792 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
793 .current_freq = &rcg_dummy_freq,
794 .base = &virt_bases[GCC_BASE],
795 .c = {
796 .dbg_name = "blsp1_uart1_apps_clk_src",
797 .ops = &clk_ops_rcg_mnd,
798 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
799 CLK_INIT(blsp1_uart1_apps_clk_src.c),
800 },
801};
802
803static struct rcg_clk blsp1_uart2_apps_clk_src = {
804 .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR,
805 .set_rate = set_rate_mnd,
806 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
807 .current_freq = &rcg_dummy_freq,
808 .base = &virt_bases[GCC_BASE],
809 .c = {
810 .dbg_name = "blsp1_uart2_apps_clk_src",
811 .ops = &clk_ops_rcg_mnd,
812 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
813 CLK_INIT(blsp1_uart2_apps_clk_src.c),
814 },
815};
816
817static struct rcg_clk blsp1_uart3_apps_clk_src = {
818 .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR,
819 .set_rate = set_rate_mnd,
820 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
821 .current_freq = &rcg_dummy_freq,
822 .base = &virt_bases[GCC_BASE],
823 .c = {
824 .dbg_name = "blsp1_uart3_apps_clk_src",
825 .ops = &clk_ops_rcg_mnd,
826 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
827 CLK_INIT(blsp1_uart3_apps_clk_src.c),
828 },
829};
830
831static struct rcg_clk blsp1_uart4_apps_clk_src = {
832 .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR,
833 .set_rate = set_rate_mnd,
834 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
835 .current_freq = &rcg_dummy_freq,
836 .base = &virt_bases[GCC_BASE],
837 .c = {
838 .dbg_name = "blsp1_uart4_apps_clk_src",
839 .ops = &clk_ops_rcg_mnd,
840 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
841 CLK_INIT(blsp1_uart4_apps_clk_src.c),
842 },
843};
844
845static struct rcg_clk blsp1_uart5_apps_clk_src = {
846 .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR,
847 .set_rate = set_rate_mnd,
848 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
849 .current_freq = &rcg_dummy_freq,
850 .base = &virt_bases[GCC_BASE],
851 .c = {
852 .dbg_name = "blsp1_uart5_apps_clk_src",
853 .ops = &clk_ops_rcg_mnd,
854 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
855 CLK_INIT(blsp1_uart5_apps_clk_src.c),
856 },
857};
858
859static struct rcg_clk blsp1_uart6_apps_clk_src = {
860 .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR,
861 .set_rate = set_rate_mnd,
862 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
863 .current_freq = &rcg_dummy_freq,
864 .base = &virt_bases[GCC_BASE],
865 .c = {
866 .dbg_name = "blsp1_uart6_apps_clk_src",
867 .ops = &clk_ops_rcg_mnd,
868 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
869 CLK_INIT(blsp1_uart6_apps_clk_src.c),
870 },
871};
872
873static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = {
874 F(50000000, gpll0, 12, 0, 0),
875 F(100000000, gpll0, 6, 0, 0),
876 F_END,
877};
878
879static struct rcg_clk ce1_clk_src = {
880 .cmd_rcgr_reg = CE1_CMD_RCGR,
881 .set_rate = set_rate_hid,
882 .freq_tbl = ftbl_gcc_ce1_clk,
883 .current_freq = &rcg_dummy_freq,
884 .base = &virt_bases[GCC_BASE],
885 .c = {
886 .dbg_name = "ce1_clk_src",
887 .ops = &clk_ops_rcg,
888 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
889 CLK_INIT(ce1_clk_src.c),
890 },
891};
892
893static struct clk_freq_tbl ftbl_gcc_gp1_3_clk[] = {
894 F(19200000, gcc_xo, 1, 0, 0),
895 F_END,
896};
897
898static struct rcg_clk gp1_clk_src = {
899 .cmd_rcgr_reg = GP1_CMD_RCGR,
900 .set_rate = set_rate_mnd,
901 .freq_tbl = ftbl_gcc_gp1_3_clk,
902 .current_freq = &rcg_dummy_freq,
903 .base = &virt_bases[GCC_BASE],
904 .c = {
905 .dbg_name = "gp1_clk_src",
906 .ops = &clk_ops_rcg_mnd,
907 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
908 CLK_INIT(gp1_clk_src.c),
909 },
910};
911
912static struct rcg_clk gp2_clk_src = {
913 .cmd_rcgr_reg = GP2_CMD_RCGR,
914 .set_rate = set_rate_mnd,
915 .freq_tbl = ftbl_gcc_gp1_3_clk,
916 .current_freq = &rcg_dummy_freq,
917 .base = &virt_bases[GCC_BASE],
918 .c = {
919 .dbg_name = "gp2_clk_src",
920 .ops = &clk_ops_rcg_mnd,
921 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
922 CLK_INIT(gp2_clk_src.c),
923 },
924};
925
926static struct rcg_clk gp3_clk_src = {
927 .cmd_rcgr_reg = GP3_CMD_RCGR,
928 .set_rate = set_rate_mnd,
929 .freq_tbl = ftbl_gcc_gp1_3_clk,
930 .current_freq = &rcg_dummy_freq,
931 .base = &virt_bases[GCC_BASE],
932 .c = {
933 .dbg_name = "gp3_clk_src",
934 .ops = &clk_ops_rcg_mnd,
935 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
936 CLK_INIT(gp3_clk_src.c),
937 },
938};
939
940static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = {
941 F(60000000, gpll0, 10, 0, 0),
942 F_END,
943};
944
945static struct rcg_clk pdm2_clk_src = {
946 .cmd_rcgr_reg = PDM2_CMD_RCGR,
947 .set_rate = set_rate_hid,
948 .freq_tbl = ftbl_gcc_pdm2_clk,
949 .current_freq = &rcg_dummy_freq,
950 .base = &virt_bases[GCC_BASE],
951 .c = {
952 .dbg_name = "pdm2_clk_src",
953 .ops = &clk_ops_rcg,
954 VDD_DIG_FMAX_MAP1(LOW, 120000000),
955 CLK_INIT(pdm2_clk_src.c),
956 },
957};
958
959static struct clk_freq_tbl ftbl_gcc_sdcc1_2_apps_clk[] = {
960 F( 144000, gcc_xo, 16, 3, 25),
961 F( 400000, gcc_xo, 12, 1, 4),
962 F( 20000000, gpll0, 15, 1, 2),
963 F( 25000000, gpll0, 12, 1, 2),
964 F( 50000000, gpll0, 12, 0, 0),
965 F(100000000, gpll0, 6, 0, 0),
966 F(200000000, gpll0, 3, 0, 0),
967 F_END,
968};
969
970static struct rcg_clk sdcc1_apps_clk_src = {
971 .cmd_rcgr_reg = SDCC1_APPS_CMD_RCGR,
972 .set_rate = set_rate_mnd,
973 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
974 .current_freq = &rcg_dummy_freq,
975 .base = &virt_bases[GCC_BASE],
976 .c = {
977 .dbg_name = "sdcc1_apps_clk_src",
978 .ops = &clk_ops_rcg_mnd,
979 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
980 CLK_INIT(sdcc1_apps_clk_src.c),
981 },
982};
983
984static struct rcg_clk sdcc2_apps_clk_src = {
985 .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR,
986 .set_rate = set_rate_mnd,
987 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
988 .current_freq = &rcg_dummy_freq,
989 .base = &virt_bases[GCC_BASE],
990 .c = {
991 .dbg_name = "sdcc2_apps_clk_src",
992 .ops = &clk_ops_rcg_mnd,
993 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
994 CLK_INIT(sdcc2_apps_clk_src.c),
995 },
996};
997
998static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = {
999 F(75000000, gpll0, 8, 0, 0),
1000 F_END,
1001};
1002
1003static struct rcg_clk usb_hs_system_clk_src = {
1004 .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR,
1005 .set_rate = set_rate_hid,
1006 .freq_tbl = ftbl_gcc_usb_hs_system_clk,
1007 .current_freq = &rcg_dummy_freq,
1008 .base = &virt_bases[GCC_BASE],
1009 .c = {
1010 .dbg_name = "usb_hs_system_clk_src",
1011 .ops = &clk_ops_rcg,
1012 VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 100000000),
1013 CLK_INIT(usb_hs_system_clk_src.c),
1014 },
1015};
1016
1017static struct local_vote_clk gcc_blsp1_ahb_clk = {
1018 .cbcr_reg = BLSP1_AHB_CBCR,
1019 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1020 .en_mask = BIT(17),
1021 .base = &virt_bases[GCC_BASE],
1022 .c = {
1023 .dbg_name = "gcc_blsp1_ahb_clk",
1024 .ops = &clk_ops_vote,
1025 CLK_INIT(gcc_blsp1_ahb_clk.c),
1026 },
1027};
1028
1029static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = {
1030 .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR,
1031 .has_sibling = 1,
1032 .base = &virt_bases[GCC_BASE],
1033 .c = {
1034 .parent = &gcc_xo_clk_src.c,
1035 .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk",
1036 .ops = &clk_ops_branch,
1037 CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c),
1038 },
1039};
1040
1041static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = {
1042 .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR,
1043 .has_sibling = 0,
1044 .base = &virt_bases[GCC_BASE],
1045 .c = {
1046 .parent = &blsp1_qup1_spi_apps_clk_src.c,
1047 .dbg_name = "gcc_blsp1_qup1_spi_apps_clk",
1048 .ops = &clk_ops_branch,
1049 CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c),
1050 },
1051};
1052
1053static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = {
1054 .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR,
1055 .has_sibling = 1,
1056 .base = &virt_bases[GCC_BASE],
1057 .c = {
1058 .parent = &gcc_xo_clk_src.c,
1059 .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk",
1060 .ops = &clk_ops_branch,
1061 CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c),
1062 },
1063};
1064
1065static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = {
1066 .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR,
1067 .has_sibling = 0,
1068 .base = &virt_bases[GCC_BASE],
1069 .c = {
1070 .parent = &blsp1_qup2_spi_apps_clk_src.c,
1071 .dbg_name = "gcc_blsp1_qup2_spi_apps_clk",
1072 .ops = &clk_ops_branch,
1073 CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c),
1074 },
1075};
1076
1077static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = {
1078 .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR,
1079 .has_sibling = 1,
1080 .base = &virt_bases[GCC_BASE],
1081 .c = {
1082 .parent = &gcc_xo_clk_src.c,
1083 .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk",
1084 .ops = &clk_ops_branch,
1085 CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c),
1086 },
1087};
1088
1089static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = {
1090 .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR,
1091 .has_sibling = 0,
1092 .base = &virt_bases[GCC_BASE],
1093 .c = {
1094 .parent = &blsp1_qup3_spi_apps_clk_src.c,
1095 .dbg_name = "gcc_blsp1_qup3_spi_apps_clk",
1096 .ops = &clk_ops_branch,
1097 CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c),
1098 },
1099};
1100
1101static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = {
1102 .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR,
1103 .has_sibling = 1,
1104 .base = &virt_bases[GCC_BASE],
1105 .c = {
1106 .parent = &gcc_xo_clk_src.c,
1107 .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk",
1108 .ops = &clk_ops_branch,
1109 CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c),
1110 },
1111};
1112
1113static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = {
1114 .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR,
1115 .has_sibling = 0,
1116 .base = &virt_bases[GCC_BASE],
1117 .c = {
1118 .parent = &blsp1_qup4_spi_apps_clk_src.c,
1119 .dbg_name = "gcc_blsp1_qup4_spi_apps_clk",
1120 .ops = &clk_ops_branch,
1121 CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c),
1122 },
1123};
1124
1125static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = {
1126 .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR,
1127 .has_sibling = 1,
1128 .base = &virt_bases[GCC_BASE],
1129 .c = {
1130 .parent = &gcc_xo_clk_src.c,
1131 .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk",
1132 .ops = &clk_ops_branch,
1133 CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c),
1134 },
1135};
1136
1137static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = {
1138 .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR,
1139 .has_sibling = 0,
1140 .base = &virt_bases[GCC_BASE],
1141 .c = {
1142 .parent = &blsp1_qup5_spi_apps_clk_src.c,
1143 .dbg_name = "gcc_blsp1_qup5_spi_apps_clk",
1144 .ops = &clk_ops_branch,
1145 CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c),
1146 },
1147};
1148
1149static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = {
1150 .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR,
1151 .has_sibling = 1,
1152 .base = &virt_bases[GCC_BASE],
1153 .c = {
1154 .parent = &gcc_xo_clk_src.c,
1155 .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk",
1156 .ops = &clk_ops_branch,
1157 CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c),
1158 },
1159};
1160
1161static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = {
1162 .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR,
1163 .has_sibling = 0,
1164 .base = &virt_bases[GCC_BASE],
1165 .c = {
1166 .parent = &blsp1_qup6_spi_apps_clk_src.c,
1167 .dbg_name = "gcc_blsp1_qup6_spi_apps_clk",
1168 .ops = &clk_ops_branch,
1169 CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c),
1170 },
1171};
1172
1173static struct branch_clk gcc_blsp1_uart1_apps_clk = {
1174 .cbcr_reg = BLSP1_UART1_APPS_CBCR,
1175 .has_sibling = 0,
1176 .base = &virt_bases[GCC_BASE],
1177 .c = {
1178 .parent = &blsp1_uart1_apps_clk_src.c,
1179 .dbg_name = "gcc_blsp1_uart1_apps_clk",
1180 .ops = &clk_ops_branch,
1181 CLK_INIT(gcc_blsp1_uart1_apps_clk.c),
1182 },
1183};
1184
1185static struct branch_clk gcc_blsp1_uart2_apps_clk = {
1186 .cbcr_reg = BLSP1_UART2_APPS_CBCR,
1187 .has_sibling = 0,
1188 .base = &virt_bases[GCC_BASE],
1189 .c = {
1190 .parent = &blsp1_uart2_apps_clk_src.c,
1191 .dbg_name = "gcc_blsp1_uart2_apps_clk",
1192 .ops = &clk_ops_branch,
1193 CLK_INIT(gcc_blsp1_uart2_apps_clk.c),
1194 },
1195};
1196
1197static struct branch_clk gcc_blsp1_uart3_apps_clk = {
1198 .cbcr_reg = BLSP1_UART3_APPS_CBCR,
1199 .has_sibling = 0,
1200 .base = &virt_bases[GCC_BASE],
1201 .c = {
1202 .parent = &blsp1_uart3_apps_clk_src.c,
1203 .dbg_name = "gcc_blsp1_uart3_apps_clk",
1204 .ops = &clk_ops_branch,
1205 CLK_INIT(gcc_blsp1_uart3_apps_clk.c),
1206 },
1207};
1208
1209static struct branch_clk gcc_blsp1_uart4_apps_clk = {
1210 .cbcr_reg = BLSP1_UART4_APPS_CBCR,
1211 .has_sibling = 0,
1212 .base = &virt_bases[GCC_BASE],
1213 .c = {
1214 .parent = &blsp1_uart4_apps_clk_src.c,
1215 .dbg_name = "gcc_blsp1_uart4_apps_clk",
1216 .ops = &clk_ops_branch,
1217 CLK_INIT(gcc_blsp1_uart4_apps_clk.c),
1218 },
1219};
1220
1221static struct branch_clk gcc_blsp1_uart5_apps_clk = {
1222 .cbcr_reg = BLSP1_UART5_APPS_CBCR,
1223 .has_sibling = 0,
1224 .base = &virt_bases[GCC_BASE],
1225 .c = {
1226 .parent = &blsp1_uart5_apps_clk_src.c,
1227 .dbg_name = "gcc_blsp1_uart5_apps_clk",
1228 .ops = &clk_ops_branch,
1229 CLK_INIT(gcc_blsp1_uart5_apps_clk.c),
1230 },
1231};
1232
1233static struct branch_clk gcc_blsp1_uart6_apps_clk = {
1234 .cbcr_reg = BLSP1_UART6_APPS_CBCR,
1235 .has_sibling = 0,
1236 .base = &virt_bases[GCC_BASE],
1237 .c = {
1238 .parent = &blsp1_uart6_apps_clk_src.c,
1239 .dbg_name = "gcc_blsp1_uart6_apps_clk",
1240 .ops = &clk_ops_branch,
1241 CLK_INIT(gcc_blsp1_uart6_apps_clk.c),
1242 },
1243};
1244
1245static struct local_vote_clk gcc_boot_rom_ahb_clk = {
1246 .cbcr_reg = BOOT_ROM_AHB_CBCR,
1247 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1248 .en_mask = BIT(10),
1249 .base = &virt_bases[GCC_BASE],
1250 .c = {
1251 .dbg_name = "gcc_boot_rom_ahb_clk",
1252 .ops = &clk_ops_vote,
1253 CLK_INIT(gcc_boot_rom_ahb_clk.c),
1254 },
1255};
1256
1257static struct local_vote_clk gcc_ce1_ahb_clk = {
1258 .cbcr_reg = CE1_AHB_CBCR,
1259 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1260 .en_mask = BIT(3),
1261 .base = &virt_bases[GCC_BASE],
1262 .c = {
1263 .dbg_name = "gcc_ce1_ahb_clk",
1264 .ops = &clk_ops_vote,
1265 CLK_INIT(gcc_ce1_ahb_clk.c),
1266 },
1267};
1268
1269static struct local_vote_clk gcc_ce1_axi_clk = {
1270 .cbcr_reg = CE1_AXI_CBCR,
1271 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1272 .en_mask = BIT(4),
1273 .base = &virt_bases[GCC_BASE],
1274 .c = {
1275 .dbg_name = "gcc_ce1_axi_clk",
1276 .ops = &clk_ops_vote,
1277 CLK_INIT(gcc_ce1_axi_clk.c),
1278 },
1279};
1280
1281static struct local_vote_clk gcc_ce1_clk = {
1282 .cbcr_reg = CE1_CBCR,
1283 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1284 .en_mask = BIT(5),
1285 .base = &virt_bases[GCC_BASE],
1286 .c = {
1287 .dbg_name = "gcc_ce1_clk",
1288 .ops = &clk_ops_vote,
1289 CLK_INIT(gcc_ce1_clk.c),
1290 },
1291};
1292
1293static struct branch_clk gcc_copss_smmu_ahb_clk = {
1294 .cbcr_reg = COPSS_SMMU_AHB_CBCR,
1295 .has_sibling = 1,
1296 .base = &virt_bases[GCC_BASE],
1297 .c = {
1298 .dbg_name = "gcc_copss_smmu_ahb_clk",
1299 .ops = &clk_ops_branch,
1300 CLK_INIT(gcc_copss_smmu_ahb_clk.c),
1301 },
1302};
1303
1304static struct branch_clk gcc_lpss_smmu_ahb_clk = {
1305 .cbcr_reg = LPSS_SMMU_AHB_CBCR,
1306 .has_sibling = 1,
1307 .base = &virt_bases[GCC_BASE],
1308 .c = {
1309 .dbg_name = "gcc_lpss_smmu_ahb_clk",
1310 .ops = &clk_ops_branch,
1311 CLK_INIT(gcc_lpss_smmu_ahb_clk.c),
1312 },
1313};
1314
1315static struct branch_clk gcc_gp1_clk = {
1316 .cbcr_reg = GP1_CBCR,
1317 .has_sibling = 0,
1318 .base = &virt_bases[GCC_BASE],
1319 .c = {
1320 .parent = &gp1_clk_src.c,
1321 .dbg_name = "gcc_gp1_clk",
1322 .ops = &clk_ops_branch,
1323 CLK_INIT(gcc_gp1_clk.c),
1324 },
1325};
1326
1327static struct branch_clk gcc_gp2_clk = {
1328 .cbcr_reg = GP2_CBCR,
1329 .has_sibling = 0,
1330 .base = &virt_bases[GCC_BASE],
1331 .c = {
1332 .parent = &gp2_clk_src.c,
1333 .dbg_name = "gcc_gp2_clk",
1334 .ops = &clk_ops_branch,
1335 CLK_INIT(gcc_gp2_clk.c),
1336 },
1337};
1338
1339static struct branch_clk gcc_gp3_clk = {
1340 .cbcr_reg = GP3_CBCR,
1341 .has_sibling = 0,
1342 .base = &virt_bases[GCC_BASE],
1343 .c = {
1344 .parent = &gp3_clk_src.c,
1345 .dbg_name = "gcc_gp3_clk",
1346 .ops = &clk_ops_branch,
1347 CLK_INIT(gcc_gp3_clk.c),
1348 },
1349};
1350
1351static struct branch_clk gcc_lpass_q6_axi_clk = {
1352 .cbcr_reg = LPASS_Q6_AXI_CBCR,
1353 .has_sibling = 1,
1354 .base = &virt_bases[GCC_BASE],
1355 .c = {
1356 .dbg_name = "gcc_lpass_q6_axi_clk",
1357 .ops = &clk_ops_branch,
1358 CLK_INIT(gcc_lpass_q6_axi_clk.c),
1359 },
1360};
1361
1362static struct branch_clk gcc_mmss_noc_cfg_ahb_clk = {
1363 .cbcr_reg = MMSS_NOC_CFG_AHB_CBCR,
1364 .has_sibling = 1,
1365 .base = &virt_bases[GCC_BASE],
1366 .c = {
1367 .dbg_name = "gcc_mmss_noc_cfg_ahb_clk",
1368 .ops = &clk_ops_branch,
1369 CLK_INIT(gcc_mmss_noc_cfg_ahb_clk.c),
1370 },
1371};
1372
1373static struct branch_clk gcc_mss_cfg_ahb_clk = {
1374 .cbcr_reg = MSS_CFG_AHB_CBCR,
1375 .has_sibling = 1,
1376 .base = &virt_bases[GCC_BASE],
1377 .c = {
1378 .dbg_name = "gcc_mss_cfg_ahb_clk",
1379 .ops = &clk_ops_branch,
1380 CLK_INIT(gcc_mss_cfg_ahb_clk.c),
1381 },
1382};
1383
1384static struct branch_clk gcc_mss_q6_bimc_axi_clk = {
1385 .cbcr_reg = MSS_Q6_BIMC_AXI_CBCR,
1386 .has_sibling = 1,
1387 .base = &virt_bases[GCC_BASE],
1388 .c = {
1389 .dbg_name = "gcc_mss_q6_bimc_axi_clk",
1390 .ops = &clk_ops_branch,
1391 CLK_INIT(gcc_mss_q6_bimc_axi_clk.c),
1392 },
1393};
1394
1395static struct branch_clk gcc_pdm2_clk = {
1396 .cbcr_reg = PDM2_CBCR,
1397 .has_sibling = 0,
1398 .base = &virt_bases[GCC_BASE],
1399 .c = {
1400 .parent = &pdm2_clk_src.c,
1401 .dbg_name = "gcc_pdm2_clk",
1402 .ops = &clk_ops_branch,
1403 CLK_INIT(gcc_pdm2_clk.c),
1404 },
1405};
1406
1407static struct branch_clk gcc_pdm_ahb_clk = {
1408 .cbcr_reg = PDM_AHB_CBCR,
1409 .has_sibling = 1,
1410 .base = &virt_bases[GCC_BASE],
1411 .c = {
1412 .dbg_name = "gcc_pdm_ahb_clk",
1413 .ops = &clk_ops_branch,
1414 CLK_INIT(gcc_pdm_ahb_clk.c),
1415 },
1416};
1417
1418static struct local_vote_clk gcc_prng_ahb_clk = {
1419 .cbcr_reg = PRNG_AHB_CBCR,
1420 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1421 .en_mask = BIT(13),
1422 .base = &virt_bases[GCC_BASE],
1423 .c = {
1424 .dbg_name = "gcc_prng_ahb_clk",
1425 .ops = &clk_ops_vote,
1426 CLK_INIT(gcc_prng_ahb_clk.c),
1427 },
1428};
1429
1430static struct branch_clk gcc_sdcc1_ahb_clk = {
1431 .cbcr_reg = SDCC1_AHB_CBCR,
1432 .has_sibling = 1,
1433 .base = &virt_bases[GCC_BASE],
1434 .c = {
1435 .dbg_name = "gcc_sdcc1_ahb_clk",
1436 .ops = &clk_ops_branch,
1437 CLK_INIT(gcc_sdcc1_ahb_clk.c),
1438 },
1439};
1440
1441static struct branch_clk gcc_sdcc1_apps_clk = {
1442 .cbcr_reg = SDCC1_APPS_CBCR,
1443 .has_sibling = 0,
1444 .base = &virt_bases[GCC_BASE],
1445 .c = {
1446 .parent = &sdcc1_apps_clk_src.c,
1447 .dbg_name = "gcc_sdcc1_apps_clk",
1448 .ops = &clk_ops_branch,
1449 CLK_INIT(gcc_sdcc1_apps_clk.c),
1450 },
1451};
1452
1453static struct branch_clk gcc_sdcc2_ahb_clk = {
1454 .cbcr_reg = SDCC2_AHB_CBCR,
1455 .has_sibling = 1,
1456 .base = &virt_bases[GCC_BASE],
1457 .c = {
1458 .dbg_name = "gcc_sdcc2_ahb_clk",
1459 .ops = &clk_ops_branch,
1460 CLK_INIT(gcc_sdcc2_ahb_clk.c),
1461 },
1462};
1463
1464static struct branch_clk gcc_sdcc2_apps_clk = {
1465 .cbcr_reg = SDCC2_APPS_CBCR,
1466 .has_sibling = 0,
1467 .base = &virt_bases[GCC_BASE],
1468 .c = {
1469 .parent = &sdcc2_apps_clk_src.c,
1470 .dbg_name = "gcc_sdcc2_apps_clk",
1471 .ops = &clk_ops_branch,
1472 CLK_INIT(gcc_sdcc2_apps_clk.c),
1473 },
1474};
1475
1476static struct branch_clk gcc_usb2a_phy_sleep_clk = {
1477 .cbcr_reg = USB2A_PHY_SLEEP_CBCR,
1478 .has_sibling = 1,
1479 .base = &virt_bases[GCC_BASE],
1480 .c = {
1481 .dbg_name = "gcc_usb2a_phy_sleep_clk",
1482 .ops = &clk_ops_branch,
1483 CLK_INIT(gcc_usb2a_phy_sleep_clk.c),
1484 },
1485};
1486
1487static struct branch_clk gcc_usb_hs_ahb_clk = {
1488 .cbcr_reg = USB_HS_AHB_CBCR,
1489 .has_sibling = 1,
1490 .base = &virt_bases[GCC_BASE],
1491 .c = {
1492 .dbg_name = "gcc_usb_hs_ahb_clk",
1493 .ops = &clk_ops_branch,
1494 CLK_INIT(gcc_usb_hs_ahb_clk.c),
1495 },
1496};
1497
1498static struct branch_clk gcc_usb_hs_system_clk = {
1499 .cbcr_reg = USB_HS_SYSTEM_CBCR,
1500 .has_sibling = 0,
1501 .bcr_reg = USB_HS_BCR,
1502 .base = &virt_bases[GCC_BASE],
1503 .c = {
1504 .parent = &usb_hs_system_clk_src.c,
1505 .dbg_name = "gcc_usb_hs_system_clk",
1506 .ops = &clk_ops_branch,
1507 CLK_INIT(gcc_usb_hs_system_clk.c),
1508 },
1509};
1510
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07001511static struct branch_clk gcc_bimc_smmu_clk = {
1512 .cbcr_reg = BIMC_SMMU_CBCR,
1513 .has_sibling = 0,
1514 .base = &virt_bases[GCC_BASE],
1515 .c = {
1516 .dbg_name = "gcc_bimc_smmu_clk",
1517 .ops = &clk_ops_branch,
1518 CLK_INIT(gcc_bimc_smmu_clk.c),
1519 },
1520};
1521
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001522static struct clk_freq_tbl ftbl_csi0_1_clk[] = {
1523 F_MM(100000000, gpll0, 6, 0, 0),
1524 F_MM(200000000, mmpll0, 4, 0, 0),
1525 F_END,
1526};
1527
1528static struct rcg_clk csi0_clk_src = {
1529 .cmd_rcgr_reg = CSI0_CMD_RCGR,
1530 .set_rate = set_rate_hid,
1531 .freq_tbl = ftbl_csi0_1_clk,
1532 .current_freq = &rcg_dummy_freq,
1533 .base = &virt_bases[MMSS_BASE],
1534 .c = {
1535 .dbg_name = "csi0_clk_src",
1536 .ops = &clk_ops_rcg,
1537 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1538 CLK_INIT(csi0_clk_src.c),
1539 },
1540};
1541
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001542static struct clk_freq_tbl ftbl_mmss_mmssnoc_axi_clk[] = {
1543 F_MM( 19200000, gcc_xo, 1, 0, 0),
1544 F_MM( 37500000, gpll0, 16, 0, 0),
1545 F_MM( 50000000, gpll0, 12, 0, 0),
1546 F_MM( 75000000, gpll0, 8, 0, 0),
1547 F_MM(100000000, gpll0, 6, 0, 0),
1548 F_MM(150000000, gpll0, 4, 0, 0),
1549 F_MM(200000000, mmpll0, 4, 0, 0),
1550 F_END,
1551};
1552
1553static struct rcg_clk axi_clk_src = {
1554 .cmd_rcgr_reg = AXI_CMD_RCGR,
1555 .set_rate = set_rate_hid,
1556 .freq_tbl = ftbl_mmss_mmssnoc_axi_clk,
1557 .current_freq = &rcg_dummy_freq,
1558 .base = &virt_bases[MMSS_BASE],
1559 .c = {
1560 .dbg_name = "axi_clk_src",
1561 .ops = &clk_ops_rcg,
1562 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1563 CLK_INIT(axi_clk_src.c),
1564 },
1565};
1566
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08001567static DEFINE_CLK_VOTER(mdp_axi_clk_src, &axi_clk_src.c, 200000000);
1568static DEFINE_CLK_VOTER(mmssnoc_axi_clk_src, &axi_clk_src.c, 200000000);
1569
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001570static struct clk_ops dsi_byte_clk_src_ops;
1571static struct clk_ops dsi_pixel_clk_src_ops;
1572static struct clk_ops dsi_dsi_clk_src_ops;
1573
1574static struct dsi_pll_vco_clk dsi_vco = {
1575 .vco_clk_min = 600000000,
1576 .vco_clk_max = 1200000000,
1577 .pref_div_ratio = 26,
1578 .c = {
1579 .parent = &gcc_xo_clk_src.c,
1580 .dbg_name = "dsi_vco",
1581 .ops = &clk_ops_dsi_vco,
1582 CLK_INIT(dsi_vco.c),
1583 },
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001584};
1585
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001586static struct clk dsi_pll_byte = {
1587 .parent = &dsi_vco.c,
1588 .dbg_name = "dsi_pll_byte",
1589 .ops = &clk_ops_dsi_byteclk,
1590 CLK_INIT(dsi_pll_byte),
1591};
1592
1593static struct clk dsi_pll_pixel = {
1594 .parent = &dsi_vco.c,
1595 .dbg_name = "dsi_pll_pixel",
1596 .ops = &clk_ops_dsi_dsiclk,
1597 CLK_INIT(dsi_pll_pixel),
1598};
1599
1600static struct clk_freq_tbl pixel_freq_tbl[] = {
1601 {
1602 .src_clk = &dsi_pll_pixel,
1603 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1604 },
1605 F_END
1606};
1607
1608#define CFG_RCGR_DIV_MASK BM(4, 0)
1609
1610static int set_rate_pixel_byte_clk(struct clk *clk, unsigned long rate)
1611{
1612 struct rcg_clk *rcg = to_rcg_clk(clk);
1613 struct clk *pll = clk->parent;
1614 unsigned long source_rate, div;
1615 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1616 int rc;
1617
1618 if (rate == 0)
1619 return clk_set_rate(pll, 0);
1620
1621 source_rate = clk_round_rate(pll, rate);
1622 if (!source_rate || ((2 * source_rate) % rate))
1623 return -EINVAL;
1624
1625 div = ((2 * source_rate)/rate) - 1;
1626 if (div > CFG_RCGR_DIV_MASK)
1627 return -EINVAL;
1628
1629 rc = clk_set_rate(pll, source_rate);
1630 if (rc)
1631 return rc;
1632
1633 cur_freq->div_src_val &= ~CFG_RCGR_DIV_MASK;
1634 cur_freq->div_src_val |= BVAL(4, 0, div);
1635 rcg->set_rate(rcg, cur_freq);
1636
1637 return 0;
1638}
1639
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001640static struct rcg_clk dsi_pclk_clk_src = {
1641 .cmd_rcgr_reg = DSI_PCLK_CMD_RCGR,
1642 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001643 .current_freq = pixel_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001644 .base = &virt_bases[MMSS_BASE],
1645 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001646 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001647 .dbg_name = "dsi_pclk_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001648 .ops = &dsi_pixel_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001649 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 103330000),
1650 CLK_INIT(dsi_pclk_clk_src.c),
1651 },
1652};
1653
1654static struct clk_freq_tbl ftbl_oxili_gfx3d_clk[] = {
1655 F_MM( 19200000, gcc_xo, 1, 0, 0),
1656 F_MM( 37500000, gpll0, 16, 0, 0),
1657 F_MM( 50000000, gpll0, 12, 0, 0),
1658 F_MM( 75000000, gpll0, 8, 0, 0),
1659 F_MM(100000000, gpll0, 6, 0, 0),
1660 F_MM(150000000, gpll0, 4, 0, 0),
1661 F_MM(200000000, gpll0, 3, 0, 0),
1662 F_MM(300000000, gpll0, 2, 0, 0),
1663 F_MM(400000000, mmpll1, 3, 0, 0),
1664 F_END,
1665};
1666
1667static struct rcg_clk gfx3d_clk_src = {
1668 .cmd_rcgr_reg = GFX3D_CMD_RCGR,
1669 .set_rate = set_rate_hid,
1670 .freq_tbl = ftbl_oxili_gfx3d_clk,
1671 .current_freq = &rcg_dummy_freq,
1672 .base = &virt_bases[MMSS_BASE],
1673 .c = {
1674 .dbg_name = "gfx3d_clk_src",
1675 .ops = &clk_ops_rcg,
1676 VDD_DIG_FMAX_MAP3(LOW, 150000000, NOMINAL, 300000000, HIGH,
1677 400000000),
1678 CLK_INIT(gfx3d_clk_src.c),
1679 },
1680};
1681
1682static struct clk_freq_tbl ftbl_vfe_clk[] = {
1683 F_MM( 37500000, gpll0, 16, 0, 0),
1684 F_MM( 50000000, gpll0, 12, 0, 0),
1685 F_MM( 60000000, gpll0, 10, 0, 0),
1686 F_MM( 80000000, gpll0, 7.5, 0, 0),
1687 F_MM(100000000, gpll0, 6, 0, 0),
1688 F_MM(109090000, gpll0, 5.5, 0, 0),
1689 F_MM(133330000, gpll0, 4.5, 0, 0),
1690 F_MM(200000000, gpll0, 3, 0, 0),
1691 F_MM(228570000, mmpll0, 3.5, 0, 0),
1692 F_MM(266670000, mmpll0, 3, 0, 0),
1693 F_MM(320000000, mmpll0, 2.5, 0, 0),
1694 F_END,
1695};
1696
1697static struct rcg_clk vfe_clk_src = {
1698 .cmd_rcgr_reg = VFE_CMD_RCGR,
1699 .set_rate = set_rate_hid,
1700 .freq_tbl = ftbl_vfe_clk,
1701 .current_freq = &rcg_dummy_freq,
1702 .base = &virt_bases[MMSS_BASE],
1703 .c = {
1704 .dbg_name = "vfe_clk_src",
1705 .ops = &clk_ops_rcg,
1706 VDD_DIG_FMAX_MAP3(LOW, 133330000, NOMINAL, 266670000, HIGH,
1707 320000000),
1708 CLK_INIT(vfe_clk_src.c),
1709 },
1710};
1711
1712static struct rcg_clk csi1_clk_src = {
1713 .cmd_rcgr_reg = CSI1_CMD_RCGR,
1714 .set_rate = set_rate_hid,
1715 .freq_tbl = ftbl_csi0_1_clk,
1716 .current_freq = &rcg_dummy_freq,
1717 .base = &virt_bases[MMSS_BASE],
1718 .c = {
1719 .dbg_name = "csi1_clk_src",
1720 .ops = &clk_ops_rcg,
1721 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1722 CLK_INIT(csi1_clk_src.c),
1723 },
1724};
1725
1726static struct clk_freq_tbl ftbl_csi0_1phytimer_clk[] = {
1727 F_MM(100000000, gpll0, 6, 0, 0),
1728 F_MM(200000000, mmpll0, 4, 0, 0),
1729 F_END,
1730};
1731
1732static struct rcg_clk csi0phytimer_clk_src = {
1733 .cmd_rcgr_reg = CSI0PHYTIMER_CMD_RCGR,
1734 .set_rate = set_rate_hid,
1735 .freq_tbl = ftbl_csi0_1phytimer_clk,
1736 .current_freq = &rcg_dummy_freq,
1737 .base = &virt_bases[MMSS_BASE],
1738 .c = {
1739 .dbg_name = "csi0phytimer_clk_src",
1740 .ops = &clk_ops_rcg,
1741 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1742 CLK_INIT(csi0phytimer_clk_src.c),
1743 },
1744};
1745
1746static struct rcg_clk csi1phytimer_clk_src = {
1747 .cmd_rcgr_reg = CSI1PHYTIMER_CMD_RCGR,
1748 .set_rate = set_rate_hid,
1749 .freq_tbl = ftbl_csi0_1phytimer_clk,
1750 .current_freq = &rcg_dummy_freq,
1751 .base = &virt_bases[MMSS_BASE],
1752 .c = {
1753 .dbg_name = "csi1phytimer_clk_src",
1754 .ops = &clk_ops_rcg,
1755 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1756 CLK_INIT(csi1phytimer_clk_src.c),
1757 },
1758};
1759
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001760/*
1761 * The DSI clock will always use a divider of 1. However, we still
1762 * need to set the right voltage and source.
1763 */
1764static int set_rate_dsi_clk(struct clk *clk, unsigned long rate)
1765{
1766 struct rcg_clk *rcg = to_rcg_clk(clk);
1767 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1768
1769 rcg->set_rate(rcg, cur_freq);
1770
1771 return 0;
1772}
1773
1774static struct clk_freq_tbl dsi_freq_tbl[] = {
1775 {
1776 .src_clk = &dsi_pll_pixel,
1777 .div_src_val = BVAL(4, 0, 0) |
1778 BVAL(10, 8, dsipll_mm_source_val),
1779 },
1780 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001781};
1782
1783static struct rcg_clk dsi_clk_src = {
1784 .cmd_rcgr_reg = DSI_CMD_RCGR,
1785 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001786 .current_freq = dsi_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001787 .base = &virt_bases[MMSS_BASE],
1788 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001789 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001790 .dbg_name = "dsi_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001791 .ops = &dsi_dsi_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001792 VDD_DIG_FMAX_MAP2(LOW, 155000000, NOMINAL, 310000000),
1793 CLK_INIT(dsi_clk_src.c),
1794 },
1795};
1796
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001797static struct clk_freq_tbl byte_freq_tbl[] = {
1798 {
1799 .src_clk = &dsi_pll_byte,
1800 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1801 },
1802 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001803};
1804
1805static struct rcg_clk dsi_byte_clk_src = {
1806 .cmd_rcgr_reg = DSI_BYTE_CMD_RCGR,
1807 .set_rate = set_rate_hid,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001808 .current_freq = byte_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001809 .base = &virt_bases[MMSS_BASE],
1810 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001811 .parent = &dsi_pll_byte,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001812 .dbg_name = "dsi_byte_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001813 .ops = &dsi_byte_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001814 VDD_DIG_FMAX_MAP2(LOW, 62500000, NOMINAL, 125000000),
1815 CLK_INIT(dsi_byte_clk_src.c),
1816 },
1817};
1818
1819static struct clk_freq_tbl ftbl_dsi_esc_clk[] = {
1820 F_MM(19200000, gcc_xo, 1, 0, 0),
1821 F_END,
1822};
1823
1824static struct rcg_clk dsi_esc_clk_src = {
1825 .cmd_rcgr_reg = DSI_ESC_CMD_RCGR,
1826 .set_rate = set_rate_hid,
1827 .freq_tbl = ftbl_dsi_esc_clk,
1828 .current_freq = &rcg_dummy_freq,
1829 .base = &virt_bases[MMSS_BASE],
1830 .c = {
1831 .dbg_name = "dsi_esc_clk_src",
1832 .ops = &clk_ops_rcg,
1833 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1834 CLK_INIT(dsi_esc_clk_src.c),
1835 },
1836};
1837
1838static struct clk_freq_tbl ftbl_mclk0_1_clk[] = {
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07001839 F_MM(24000000, gpll0, 5, 1, 5),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001840 F_MM(66670000, gpll0, 9, 0, 0),
1841 F_END,
1842};
1843
1844static struct rcg_clk mclk0_clk_src = {
1845 .cmd_rcgr_reg = MCLK0_CMD_RCGR,
1846 .set_rate = set_rate_mnd,
1847 .freq_tbl = ftbl_mclk0_1_clk,
1848 .current_freq = &rcg_dummy_freq,
1849 .base = &virt_bases[MMSS_BASE],
1850 .c = {
1851 .dbg_name = "mclk0_clk_src",
1852 .ops = &clk_ops_rcg_mnd,
1853 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1854 CLK_INIT(mclk0_clk_src.c),
1855 },
1856};
1857
1858static struct rcg_clk mclk1_clk_src = {
1859 .cmd_rcgr_reg = MCLK1_CMD_RCGR,
1860 .set_rate = set_rate_mnd,
1861 .freq_tbl = ftbl_mclk0_1_clk,
1862 .current_freq = &rcg_dummy_freq,
1863 .base = &virt_bases[MMSS_BASE],
1864 .c = {
1865 .dbg_name = "mclk1_clk_src",
1866 .ops = &clk_ops_rcg_mnd,
1867 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1868 CLK_INIT(mclk1_clk_src.c),
1869 },
1870};
1871
1872static struct clk_freq_tbl ftbl_mdp_vsync_clk[] = {
1873 F_MM(19200000, gcc_xo, 1, 0, 0),
1874 F_END,
1875};
1876
1877static struct rcg_clk mdp_vsync_clk_src = {
1878 .cmd_rcgr_reg = MDP_VSYNC_CMD_RCGR,
1879 .set_rate = set_rate_hid,
1880 .freq_tbl = ftbl_mdp_vsync_clk,
1881 .current_freq = &rcg_dummy_freq,
1882 .base = &virt_bases[MMSS_BASE],
1883 .c = {
1884 .dbg_name = "mdp_vsync_clk_src",
1885 .ops = &clk_ops_rcg,
1886 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1887 CLK_INIT(mdp_vsync_clk_src.c),
1888 },
1889};
1890
1891static struct branch_clk bimc_gfx_clk = {
1892 .cbcr_reg = BIMC_GFX_CBCR,
1893 .has_sibling = 1,
1894 .base = &virt_bases[MMSS_BASE],
1895 .c = {
1896 .dbg_name = "bimc_gfx_clk",
1897 .ops = &clk_ops_branch,
1898 CLK_INIT(bimc_gfx_clk.c),
1899 },
1900};
1901
1902static struct branch_clk csi0_clk = {
1903 .cbcr_reg = CSI0_CBCR,
1904 .has_sibling = 1,
1905 .base = &virt_bases[MMSS_BASE],
1906 .c = {
1907 .parent = &csi0_clk_src.c,
1908 .dbg_name = "csi0_clk",
1909 .ops = &clk_ops_branch,
1910 CLK_INIT(csi0_clk.c),
1911 },
1912};
1913
1914static struct branch_clk csi0phy_clk = {
1915 .cbcr_reg = CSI0PHY_CBCR,
1916 .has_sibling = 1,
1917 .base = &virt_bases[MMSS_BASE],
1918 .c = {
1919 .parent = &csi0_clk_src.c,
1920 .dbg_name = "csi0phy_clk",
1921 .ops = &clk_ops_branch,
1922 CLK_INIT(csi0phy_clk.c),
1923 },
1924};
1925
1926static struct branch_clk csi0phytimer_clk = {
1927 .cbcr_reg = CSI0PHYTIMER_CBCR,
1928 .has_sibling = 0,
1929 .base = &virt_bases[MMSS_BASE],
1930 .c = {
1931 .parent = &csi0phytimer_clk_src.c,
1932 .dbg_name = "csi0phytimer_clk",
1933 .ops = &clk_ops_branch,
1934 CLK_INIT(csi0phytimer_clk.c),
1935 },
1936};
1937
1938static struct branch_clk csi0pix_clk = {
1939 .cbcr_reg = CSI0PIX_CBCR,
1940 .has_sibling = 1,
1941 .base = &virt_bases[MMSS_BASE],
1942 .c = {
1943 .parent = &csi0_clk_src.c,
1944 .dbg_name = "csi0pix_clk",
1945 .ops = &clk_ops_branch,
1946 CLK_INIT(csi0pix_clk.c),
1947 },
1948};
1949
1950static struct branch_clk csi0rdi_clk = {
1951 .cbcr_reg = CSI0RDI_CBCR,
1952 .has_sibling = 1,
1953 .base = &virt_bases[MMSS_BASE],
1954 .c = {
1955 .parent = &csi0_clk_src.c,
1956 .dbg_name = "csi0rdi_clk",
1957 .ops = &clk_ops_branch,
1958 CLK_INIT(csi0rdi_clk.c),
1959 },
1960};
1961
1962static struct branch_clk csi1_clk = {
1963 .cbcr_reg = CSI1_CBCR,
1964 .has_sibling = 1,
1965 .base = &virt_bases[MMSS_BASE],
1966 .c = {
1967 .parent = &csi1_clk_src.c,
1968 .dbg_name = "csi1_clk",
1969 .ops = &clk_ops_branch,
1970 CLK_INIT(csi1_clk.c),
1971 },
1972};
1973
1974static struct branch_clk csi1phy_clk = {
1975 .cbcr_reg = CSI1PHY_CBCR,
1976 .has_sibling = 1,
1977 .base = &virt_bases[MMSS_BASE],
1978 .c = {
1979 .parent = &csi1_clk_src.c,
1980 .dbg_name = "csi1phy_clk",
1981 .ops = &clk_ops_branch,
1982 CLK_INIT(csi1phy_clk.c),
1983 },
1984};
1985
1986static struct branch_clk csi1phytimer_clk = {
1987 .cbcr_reg = CSI1PHYTIMER_CBCR,
1988 .has_sibling = 0,
1989 .base = &virt_bases[MMSS_BASE],
1990 .c = {
1991 .parent = &csi1phytimer_clk_src.c,
1992 .dbg_name = "csi1phytimer_clk",
1993 .ops = &clk_ops_branch,
1994 CLK_INIT(csi1phytimer_clk.c),
1995 },
1996};
1997
1998static struct branch_clk csi1pix_clk = {
1999 .cbcr_reg = CSI1PIX_CBCR,
2000 .has_sibling = 1,
2001 .base = &virt_bases[MMSS_BASE],
2002 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002003 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002004 .dbg_name = "csi1pix_clk",
2005 .ops = &clk_ops_branch,
2006 CLK_INIT(csi1pix_clk.c),
2007 },
2008};
2009
2010static struct branch_clk csi1rdi_clk = {
2011 .cbcr_reg = CSI1RDI_CBCR,
2012 .has_sibling = 1,
2013 .base = &virt_bases[MMSS_BASE],
2014 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002015 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002016 .dbg_name = "csi1rdi_clk",
2017 .ops = &clk_ops_branch,
2018 CLK_INIT(csi1rdi_clk.c),
2019 },
2020};
2021
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002022static struct mux_clk csi0phy_cam_mux_clk = {
2023 .ops = &mux_reg_ops,
2024 .en_mask = BIT(11),
2025 .mask = 0x1,
2026 .shift = 9,
2027 .offset = MMSS_CAMSS_MISC,
2028 MUX_SRC_LIST(
2029 { &csi0phy_clk.c, 0 },
2030 { &csi1phy_clk.c, 1 },
2031 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002032 .base = &virt_bases[MMSS_BASE],
2033 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002034 .dbg_name = "csi0phy_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002035 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002036 CLK_INIT(csi0phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002037 },
2038};
2039
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002040static struct mux_clk csi1phy_cam_mux_clk = {
2041 .ops = &mux_reg_ops,
2042 .en_mask = BIT(10),
2043 .mask = 0x1,
2044 .shift = 8,
2045 .offset = MMSS_CAMSS_MISC,
2046 MUX_SRC_LIST(
2047 { &csi0phy_clk.c, 0 },
2048 { &csi1phy_clk.c, 1 },
2049 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002050 .base = &virt_bases[MMSS_BASE],
2051 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002052 .dbg_name = "csi1phy_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002053 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002054 CLK_INIT(csi1phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002055 },
2056};
2057
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002058static struct mux_clk csi0pix_cam_mux_clk = {
2059 .ops = &mux_reg_ops,
2060 .en_mask = BIT(7),
2061 .mask = 0x1,
2062 .shift = 3,
2063 .offset = MMSS_CAMSS_MISC,
2064 MUX_SRC_LIST(
2065 { &csi0pix_clk.c, 0 },
2066 { &csi1pix_clk.c, 1 },
2067 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002068 .base = &virt_bases[MMSS_BASE],
2069 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002070 .dbg_name = "csi0pix_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002071 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002072 CLK_INIT(csi0pix_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002073 },
2074};
2075
2076
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002077static struct mux_clk rdi2_cam_mux_clk = {
2078 .ops = &mux_reg_ops,
2079 .en_mask = BIT(6),
2080 .mask = 0x1,
2081 .shift = 2,
2082 .offset = MMSS_CAMSS_MISC,
2083 MUX_SRC_LIST(
2084 { &csi0rdi_clk.c, 0 },
2085 { &csi1rdi_clk.c, 1 },
2086 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002087 .base = &virt_bases[MMSS_BASE],
2088 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002089 .dbg_name = "rdi2_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002090 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002091 CLK_INIT(rdi2_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002092 },
2093};
2094
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002095static struct mux_clk rdi1_cam_mux_clk = {
2096 .ops = &mux_reg_ops,
2097 .en_mask = BIT(5),
2098 .mask = 0x1,
2099 .shift = 1,
2100 .offset = MMSS_CAMSS_MISC,
2101 MUX_SRC_LIST(
2102 { &csi0rdi_clk.c, 0 },
2103 { &csi1rdi_clk.c, 1 },
2104 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002105 .base = &virt_bases[MMSS_BASE],
2106 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002107 .dbg_name = "rdi1_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002108 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002109 CLK_INIT(rdi1_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002110 },
2111};
2112
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002113static struct mux_clk rdi0_cam_mux_clk = {
2114 .ops = &mux_reg_ops,
2115 .en_mask = BIT(4),
2116 .mask = 0x1,
2117 .shift = 0,
2118 .offset = MMSS_CAMSS_MISC,
2119 MUX_SRC_LIST(
2120 { &csi0rdi_clk.c, 0 },
2121 { &csi1rdi_clk.c, 1 },
2122 ),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002123 .base = &virt_bases[MMSS_BASE],
2124 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002125 .dbg_name = "rdi0_cam_mux_clk",
Vikram Mulukutla4a1728f2013-07-24 14:14:08 -07002126 .ops = &clk_ops_gen_mux,
Vikram Mulukutla49423392013-05-02 09:03:02 -07002127 CLK_INIT(rdi0_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002128 },
2129};
2130
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002131static struct branch_clk csi_ahb_clk = {
2132 .cbcr_reg = CSI_AHB_CBCR,
2133 .has_sibling = 1,
2134 .base = &virt_bases[MMSS_BASE],
2135 .c = {
2136 .dbg_name = "csi_ahb_clk",
2137 .ops = &clk_ops_branch,
2138 CLK_INIT(csi_ahb_clk.c),
2139 },
2140};
2141
2142static struct branch_clk csi_vfe_clk = {
2143 .cbcr_reg = CSI_VFE_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002144 .bcr_reg = CSI_VFE_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002145 .has_sibling = 1,
2146 .base = &virt_bases[MMSS_BASE],
2147 .c = {
2148 .parent = &vfe_clk_src.c,
2149 .dbg_name = "csi_vfe_clk",
2150 .ops = &clk_ops_branch,
2151 CLK_INIT(csi_vfe_clk.c),
2152 },
2153};
2154
2155static struct branch_clk dsi_clk = {
2156 .cbcr_reg = DSI_CBCR,
2157 .has_sibling = 0,
2158 .base = &virt_bases[MMSS_BASE],
2159 .c = {
2160 .parent = &dsi_clk_src.c,
2161 .dbg_name = "dsi_clk",
2162 .ops = &clk_ops_branch,
2163 CLK_INIT(dsi_clk.c),
2164 },
2165};
2166
2167static struct branch_clk dsi_ahb_clk = {
2168 .cbcr_reg = DSI_AHB_CBCR,
2169 .has_sibling = 1,
2170 .base = &virt_bases[MMSS_BASE],
2171 .c = {
2172 .dbg_name = "dsi_ahb_clk",
2173 .ops = &clk_ops_branch,
2174 CLK_INIT(dsi_ahb_clk.c),
2175 },
2176};
2177
2178static struct branch_clk dsi_byte_clk = {
2179 .cbcr_reg = DSI_BYTE_CBCR,
2180 .has_sibling = 0,
2181 .base = &virt_bases[MMSS_BASE],
2182 .c = {
2183 .parent = &dsi_byte_clk_src.c,
2184 .dbg_name = "dsi_byte_clk",
2185 .ops = &clk_ops_branch,
2186 CLK_INIT(dsi_byte_clk.c),
2187 },
2188};
2189
2190static struct branch_clk dsi_esc_clk = {
2191 .cbcr_reg = DSI_ESC_CBCR,
2192 .has_sibling = 0,
2193 .base = &virt_bases[MMSS_BASE],
2194 .c = {
2195 .parent = &dsi_esc_clk_src.c,
2196 .dbg_name = "dsi_esc_clk",
2197 .ops = &clk_ops_branch,
2198 CLK_INIT(dsi_esc_clk.c),
2199 },
2200};
2201
2202static struct branch_clk dsi_pclk_clk = {
2203 .cbcr_reg = DSI_PCLK_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002204 .base = &virt_bases[MMSS_BASE],
2205 .c = {
2206 .parent = &dsi_pclk_clk_src.c,
2207 .dbg_name = "dsi_pclk_clk",
2208 .ops = &clk_ops_branch,
2209 CLK_INIT(dsi_pclk_clk.c),
2210 },
2211};
2212
2213static struct branch_clk gmem_gfx3d_clk = {
2214 .cbcr_reg = GMEM_GFX3D_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002215 .bcr_reg = GMEM_GFX3D_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002216 .has_sibling = 1,
2217 .base = &virt_bases[MMSS_BASE],
2218 .c = {
2219 .parent = &gfx3d_clk_src.c,
2220 .dbg_name = "gmem_gfx3d_clk",
2221 .ops = &clk_ops_branch,
2222 CLK_INIT(gmem_gfx3d_clk.c),
2223 },
2224};
2225
2226static struct branch_clk mclk0_clk = {
2227 .cbcr_reg = MCLK0_CBCR,
2228 .has_sibling = 0,
2229 .base = &virt_bases[MMSS_BASE],
2230 .c = {
2231 .parent = &mclk0_clk_src.c,
2232 .dbg_name = "mclk0_clk",
2233 .ops = &clk_ops_branch,
2234 CLK_INIT(mclk0_clk.c),
2235 },
2236};
2237
2238static struct branch_clk mclk1_clk = {
2239 .cbcr_reg = MCLK1_CBCR,
2240 .has_sibling = 0,
2241 .base = &virt_bases[MMSS_BASE],
2242 .c = {
2243 .parent = &mclk1_clk_src.c,
2244 .dbg_name = "mclk1_clk",
2245 .ops = &clk_ops_branch,
2246 CLK_INIT(mclk1_clk.c),
2247 },
2248};
2249
2250static struct branch_clk mdp_ahb_clk = {
2251 .cbcr_reg = MDP_AHB_CBCR,
2252 .has_sibling = 1,
2253 .base = &virt_bases[MMSS_BASE],
2254 .c = {
2255 .dbg_name = "mdp_ahb_clk",
2256 .ops = &clk_ops_branch,
2257 CLK_INIT(mdp_ahb_clk.c),
2258 },
2259};
2260
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002261static struct branch_clk mmss_mmssnoc_axi_clk;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002262static struct branch_clk mdp_axi_clk = {
2263 .cbcr_reg = MDP_AXI_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002264 .base = &virt_bases[MMSS_BASE],
2265 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002266 .parent = &mdp_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002267 .dbg_name = "mdp_axi_clk",
2268 .ops = &clk_ops_branch,
2269 CLK_INIT(mdp_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002270 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002271 },
2272};
2273
2274static struct branch_clk mdp_dsi_clk = {
2275 .cbcr_reg = MDP_DSI_CBCR,
2276 .has_sibling = 1,
2277 .base = &virt_bases[MMSS_BASE],
2278 .c = {
2279 .parent = &dsi_pclk_clk_src.c,
2280 .dbg_name = "mdp_dsi_clk",
2281 .ops = &clk_ops_branch,
2282 CLK_INIT(mdp_dsi_clk.c),
2283 },
2284};
2285
2286static struct branch_clk mdp_lcdc_clk = {
2287 .cbcr_reg = MDP_LCDC_CBCR,
2288 .has_sibling = 1,
2289 .base = &virt_bases[MMSS_BASE],
2290 .c = {
2291 .parent = &dsi_pclk_clk_src.c,
2292 .dbg_name = "mdp_lcdc_clk",
2293 .ops = &clk_ops_branch,
2294 CLK_INIT(mdp_lcdc_clk.c),
2295 },
2296};
2297
2298static struct branch_clk mdp_vsync_clk = {
2299 .cbcr_reg = MDP_VSYNC_CBCR,
2300 .has_sibling = 0,
2301 .base = &virt_bases[MMSS_BASE],
2302 .c = {
2303 .parent = &mdp_vsync_clk_src.c,
2304 .dbg_name = "mdp_vsync_clk",
2305 .ops = &clk_ops_branch,
2306 CLK_INIT(mdp_vsync_clk.c),
2307 },
2308};
2309
2310static struct branch_clk mmss_misc_ahb_clk = {
2311 .cbcr_reg = MMSS_MISC_AHB_CBCR,
2312 .has_sibling = 1,
2313 .base = &virt_bases[MMSS_BASE],
2314 .c = {
2315 .dbg_name = "mmss_misc_ahb_clk",
2316 .ops = &clk_ops_branch,
2317 CLK_INIT(mmss_misc_ahb_clk.c),
2318 },
2319};
2320
2321static struct branch_clk mmss_mmssnoc_axi_clk = {
2322 .cbcr_reg = MMSS_MMSSNOC_AXI_CBCR,
2323 .has_sibling = 1,
2324 .base = &virt_bases[MMSS_BASE],
2325 .c = {
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002326 .parent = &axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002327 .dbg_name = "mmss_mmssnoc_axi_clk",
2328 .ops = &clk_ops_branch,
2329 CLK_INIT(mmss_mmssnoc_axi_clk.c),
2330 },
2331};
2332
2333static struct branch_clk mmss_s0_axi_clk = {
2334 .cbcr_reg = MMSS_S0_AXI_CBCR,
2335 .has_sibling = 0,
2336 .base = &virt_bases[MMSS_BASE],
2337 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002338 .parent = &mmssnoc_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002339 .dbg_name = "mmss_s0_axi_clk",
2340 .ops = &clk_ops_branch,
2341 CLK_INIT(mmss_s0_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002342 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002343 },
2344};
2345
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002346static struct branch_clk mmss_mmssnoc_bto_ahb_clk = {
2347 .cbcr_reg = MMSS_MMSSNOC_BTO_AHB_CBCR,
2348 .has_sibling = 1,
2349 .base = &virt_bases[MMSS_BASE],
2350 .c = {
2351 .dbg_name = "mmss_mmssnoc_bto_ahb_clk",
2352 .ops = &clk_ops_branch,
2353 CLK_INIT(mmss_mmssnoc_bto_ahb_clk.c),
2354 },
2355};
2356
2357static struct branch_clk oxili_ahb_clk = {
2358 .cbcr_reg = OXILI_AHB_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002359 .bcr_reg = OXILI_AHB_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002360 .has_sibling = 1,
2361 .base = &virt_bases[MMSS_BASE],
2362 .c = {
2363 .dbg_name = "oxili_ahb_clk",
2364 .ops = &clk_ops_branch,
2365 CLK_INIT(oxili_ahb_clk.c),
2366 },
2367};
2368
2369static struct branch_clk oxili_gfx3d_clk = {
2370 .cbcr_reg = OXILI_GFX3D_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002371 .bcr_reg = OXILI_GFX3D_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002372 .has_sibling = 0,
2373 .base = &virt_bases[MMSS_BASE],
2374 .c = {
2375 .parent = &gfx3d_clk_src.c,
2376 .dbg_name = "oxili_gfx3d_clk",
2377 .ops = &clk_ops_branch,
2378 CLK_INIT(oxili_gfx3d_clk.c),
2379 },
2380};
2381
2382static struct branch_clk vfe_clk = {
2383 .cbcr_reg = VFE_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002384 .bcr_reg = VFE_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002385 .has_sibling = 1,
2386 .base = &virt_bases[MMSS_BASE],
2387 .c = {
2388 .parent = &vfe_clk_src.c,
2389 .dbg_name = "vfe_clk",
2390 .ops = &clk_ops_branch,
2391 CLK_INIT(vfe_clk.c),
2392 },
2393};
2394
2395static struct branch_clk vfe_ahb_clk = {
2396 .cbcr_reg = VFE_AHB_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002397 .bcr_reg = VFE_AHB_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002398 .has_sibling = 1,
2399 .base = &virt_bases[MMSS_BASE],
2400 .c = {
2401 .dbg_name = "vfe_ahb_clk",
2402 .ops = &clk_ops_branch,
2403 CLK_INIT(vfe_ahb_clk.c),
2404 },
2405};
2406
2407static struct branch_clk vfe_axi_clk = {
2408 .cbcr_reg = VFE_AXI_CBCR,
Matt Wagantall8ce3c462013-07-03 19:24:53 -07002409 .bcr_reg = VFE_AXI_BCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002410 .has_sibling = 1,
2411 .base = &virt_bases[MMSS_BASE],
2412 .c = {
2413 .parent = &axi_clk_src.c,
2414 .dbg_name = "vfe_axi_clk",
2415 .ops = &clk_ops_branch,
2416 CLK_INIT(vfe_axi_clk.c),
Vikram Mulukutlac32edfb2013-08-19 12:17:02 -07002417 .depends = &mmss_mmssnoc_axi_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002418 },
2419};
2420
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002421static struct branch_clk q6ss_ahb_lfabif_clk = {
2422 .cbcr_reg = Q6SS_AHB_LFABIF_CBCR,
2423 .has_sibling = 1,
2424 .base = &virt_bases[LPASS_BASE],
2425 .c = {
2426 .dbg_name = "q6ss_ahb_lfabif_clk",
2427 .ops = &clk_ops_branch,
2428 CLK_INIT(q6ss_ahb_lfabif_clk.c),
2429 },
2430};
2431
2432static struct branch_clk q6ss_ahbm_clk = {
2433 .cbcr_reg = Q6SS_AHBM_CBCR,
2434 .has_sibling = 1,
2435 .base = &virt_bases[LPASS_BASE],
2436 .c = {
2437 .dbg_name = "q6ss_ahbm_clk",
2438 .ops = &clk_ops_branch,
2439 CLK_INIT(q6ss_ahbm_clk.c),
2440 },
2441};
2442
2443static struct branch_clk q6ss_xo_clk = {
2444 .cbcr_reg = Q6SS_XO_CBCR,
2445 .has_sibling = 1,
2446 .bcr_reg = LPASS_Q6SS_BCR,
2447 .base = &virt_bases[LPASS_BASE],
2448 .c = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002449 .dbg_name = "q6ss_xo_clk",
2450 .ops = &clk_ops_branch,
2451 CLK_INIT(q6ss_xo_clk.c),
2452 },
2453};
2454
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002455#ifdef CONFIG_DEBUG_FS
2456
2457struct measure_mux_entry {
2458 struct clk *c;
2459 int base;
2460 u32 debug_mux;
2461};
2462
2463static struct measure_mux_entry measure_mux[] = {
2464 { &snoc_clk.c, GCC_BASE, 0x0000},
2465 { &cnoc_clk.c, GCC_BASE, 0x0008},
2466 { &gcc_copss_smmu_ahb_clk.c, GCC_BASE, 0x000c},
2467 { &gcc_lpss_smmu_ahb_clk.c, GCC_BASE, 0x000d},
2468 { &pnoc_clk.c, GCC_BASE, 0x0010},
2469 { &gcc_mmss_noc_cfg_ahb_clk.c, GCC_BASE, 0x002a},
2470 { &gcc_mss_cfg_ahb_clk.c, GCC_BASE, 0x0030},
2471 { &gcc_mss_q6_bimc_axi_clk.c, GCC_BASE, 0x0031},
2472 { &gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060},
2473 { &gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061},
2474 { &gcc_usb2a_phy_sleep_clk.c, GCC_BASE, 0x0063},
2475 { &gcc_sdcc1_apps_clk.c, GCC_BASE, 0x0068},
2476 { &gcc_sdcc1_ahb_clk.c, GCC_BASE, 0x0069},
2477 { &gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070},
2478 { &gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071},
2479 { &gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088},
2480 {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a},
2481 {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b},
2482 { &gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c},
2483 {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e},
2484 {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090},
2485 { &gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091},
2486 {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093},
2487 {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094},
2488 { &gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095},
2489 {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098},
2490 {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099},
2491 { &gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a},
2492 {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c},
2493 {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d},
2494 { &gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e},
2495 {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1},
2496 {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2},
2497 { &gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3},
2498 { &gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0},
2499 { &gcc_pdm2_clk.c, GCC_BASE, 0x00d2},
2500 { &gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8},
2501 { &gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8},
2502 { &gcc_ce1_clk.c, GCC_BASE, 0x0138},
2503 { &gcc_ce1_axi_clk.c, GCC_BASE, 0x0139},
2504 { &gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a},
2505 { &gcc_xo_clk_src.c, GCC_BASE, 0x0149},
Vikram Mulukutlad3854052013-06-13 12:47:19 -07002506 { &bimc_clk.c, GCC_BASE, 0x0155},
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07002507 { &gcc_bimc_smmu_clk.c, GCC_BASE, 0x015e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002508 { &gcc_lpass_q6_axi_clk.c, GCC_BASE, 0x0160},
2509
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08002510 { &mmssnoc_ahb_clk.c, MMSS_BASE, 0x0001},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002511 { &mmss_misc_ahb_clk.c, MMSS_BASE, 0x0003},
2512 {&mmss_mmssnoc_axi_clk.c, MMSS_BASE, 0x0004},
2513 { &mmss_s0_axi_clk.c, MMSS_BASE, 0x0005},
2514 { &oxili_ahb_clk.c, MMSS_BASE, 0x0007},
2515 { &oxili_gfx3d_clk.c, MMSS_BASE, 0x0008},
2516 { &gmem_gfx3d_clk.c, MMSS_BASE, 0x0009},
2517 { &mdp_axi_clk.c, MMSS_BASE, 0x000a},
2518 { &mdp_vsync_clk.c, MMSS_BASE, 0x000b},
2519 { &mdp_ahb_clk.c, MMSS_BASE, 0x000c},
2520 { &dsi_pclk_clk.c, MMSS_BASE, 0x000d},
2521 { &mdp_dsi_clk.c, MMSS_BASE, 0x000e},
2522 { &mdp_lcdc_clk.c, MMSS_BASE, 0x000f},
2523 { &dsi_clk.c, MMSS_BASE, 0x0010},
2524 { &dsi_byte_clk.c, MMSS_BASE, 0x0011},
2525 { &dsi_esc_clk.c, MMSS_BASE, 0x0012},
2526 { &dsi_ahb_clk.c, MMSS_BASE, 0x0013},
2527 { &mclk0_clk.c, MMSS_BASE, 0x0015},
2528 { &mclk1_clk.c, MMSS_BASE, 0x0016},
2529 { &csi0phytimer_clk.c, MMSS_BASE, 0x0017},
2530 { &csi1phytimer_clk.c, MMSS_BASE, 0x0018},
2531 { &vfe_clk.c, MMSS_BASE, 0x0019},
2532 { &vfe_ahb_clk.c, MMSS_BASE, 0x001a},
2533 { &vfe_axi_clk.c, MMSS_BASE, 0x001b},
2534 { &csi_vfe_clk.c, MMSS_BASE, 0x001c},
2535 { &csi0_clk.c, MMSS_BASE, 0x001d},
2536 { &csi_ahb_clk.c, MMSS_BASE, 0x001e},
2537 { &csi0phy_clk.c, MMSS_BASE, 0x001f},
2538 { &csi0rdi_clk.c, MMSS_BASE, 0x0020},
2539 { &csi0pix_clk.c, MMSS_BASE, 0x0021},
2540 { &csi1_clk.c, MMSS_BASE, 0x0022},
2541 { &csi1phy_clk.c, MMSS_BASE, 0x0023},
2542 { &csi1rdi_clk.c, MMSS_BASE, 0x0024},
2543 { &csi1pix_clk.c, MMSS_BASE, 0x0025},
2544 { &bimc_gfx_clk.c, MMSS_BASE, 0x0032},
2545
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002546 { &q6ss_ahbm_clk.c, LPASS_BASE, 0x001d},
2547 { &q6ss_ahb_lfabif_clk.c, LPASS_BASE, 0x001e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002548 { &q6ss_xo_clk.c, LPASS_BASE, 0x002b},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002549
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002550 {&apc0_m_clk, APCS_BASE, 0x00010},
2551 {&apc1_m_clk, APCS_BASE, 0x00114},
2552 {&apc2_m_clk, APCS_BASE, 0x00220},
2553 {&apc3_m_clk, APCS_BASE, 0x00324},
2554 {&l2_m_clk, APCS_BASE, 0x01000},
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08002555
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002556 {&dummy_clk, N_BASES, 0x0000},
2557};
2558
2559#define GCC_DEBUG_CLK_CTL 0x1880
2560#define MMSS_DEBUG_CLK_CTL 0x0900
2561#define LPASS_DEBUG_CLK_CTL 0x29000
2562#define GLB_CLK_DIAG 0x001C
2563
2564static int measure_clk_set_parent(struct clk *c, struct clk *parent)
2565{
2566 struct measure_clk *clk = to_measure_clk(c);
2567 unsigned long flags;
2568 u32 regval, clk_sel, i;
2569
2570 if (!parent)
2571 return -EINVAL;
2572
2573 for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++)
2574 if (measure_mux[i].c == parent)
2575 break;
2576
2577 if (measure_mux[i].c == &dummy_clk)
2578 return -EINVAL;
2579
2580 spin_lock_irqsave(&local_clock_reg_lock, flags);
2581 /*
2582 * Program the test vector, measurement period (sample_ticks)
2583 * and scaling multiplier.
2584 */
2585 clk->sample_ticks = 0x10000;
2586 clk->multiplier = 1;
2587
2588 switch (measure_mux[i].base) {
2589
2590 case GCC_BASE:
2591 writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2592 clk_sel = measure_mux[i].debug_mux;
2593 break;
2594
2595 case MMSS_BASE:
2596 writel_relaxed(0, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2597 clk_sel = 0x02C;
2598 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2599 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2600
2601 /* Activate debug clock output */
2602 regval |= BIT(16);
2603 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2604 break;
2605
2606 case LPASS_BASE:
2607 writel_relaxed(0, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2608 clk_sel = 0x161;
2609 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2610 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2611
2612 /* Activate debug clock output */
2613 regval |= BIT(20);
2614 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2615 break;
2616
2617 case APCS_BASE:
2618 clk->multiplier = 4;
2619 clk_sel = 0x16A;
2620 regval = measure_mux[i].debug_mux;
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002621 /* Use a divider value of 4. */
2622 regval |= BVAL(31, 30, 0x3);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002623 writel_relaxed(regval, APCS_REG_BASE(GLB_CLK_DIAG));
2624 break;
2625
2626 default:
2627 return -EINVAL;
2628 }
2629
2630 /* Set debug mux clock index */
2631 regval = BVAL(8, 0, clk_sel);
2632 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2633
2634 /* Activate debug clock output */
2635 regval |= BIT(16);
2636 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2637
2638 /* Make sure test vector is set before starting measurements. */
2639 mb();
2640 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2641
2642 return 0;
2643}
2644
2645#define CLOCK_FRQ_MEASURE_CTL 0x1884
2646#define CLOCK_FRQ_MEASURE_STATUS 0x1888
2647
2648/* Sample clock for 'ticks' reference clock ticks. */
2649static u32 run_measurement(unsigned ticks)
2650{
2651 /* Stop counters and set the XO4 counter start value. */
2652 writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2653
2654 /* Wait for timer to become ready. */
2655 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2656 BIT(25)) != 0)
2657 cpu_relax();
2658
2659 /* Run measurement and wait for completion. */
2660 writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2661 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2662 BIT(25)) == 0)
2663 cpu_relax();
2664
2665 /* Return measured ticks. */
2666 return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2667 BM(24, 0);
2668}
2669
2670#define GCC_XO_DIV4_CBCR 0x10C8
2671#define PLLTEST_PAD_CFG 0x188C
2672
2673/*
2674 * Perform a hardware rate measurement for a given clock.
2675 * FOR DEBUG USE ONLY: Measurements take ~15 ms!
2676 */
2677static unsigned long measure_clk_get_rate(struct clk *c)
2678{
2679 unsigned long flags;
2680 u32 gcc_xo4_reg_backup;
2681 u64 raw_count_short, raw_count_full;
2682 struct measure_clk *clk = to_measure_clk(c);
2683 unsigned ret;
2684
2685 ret = clk_prepare_enable(&gcc_xo_clk_src.c);
2686 if (ret) {
2687 pr_warning("CXO clock failed to enable. Can't measure\n");
2688 return 0;
2689 }
2690
2691 spin_lock_irqsave(&local_clock_reg_lock, flags);
2692
2693 /* Enable CXO/4 and RINGOSC branch. */
2694 gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2695 writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2696
2697 /*
2698 * The ring oscillator counter will not reset if the measured clock
2699 * is not running. To detect this, run a short measurement before
2700 * the full measurement. If the raw results of the two are the same
2701 * then the clock must be off.
2702 */
2703
2704 /* Run a short measurement. (~1 ms) */
2705 raw_count_short = run_measurement(0x1000);
2706 /* Run a full measurement. (~14 ms) */
2707 raw_count_full = run_measurement(clk->sample_ticks);
2708
2709 writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2710
2711 /* Return 0 if the clock is off. */
2712 if (raw_count_full == raw_count_short) {
2713 ret = 0;
2714 } else {
2715 /* Compute rate in Hz. */
2716 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
2717 do_div(raw_count_full, ((clk->sample_ticks * 10) + 35));
2718 ret = (raw_count_full * clk->multiplier);
2719 }
2720
2721 writel_relaxed(0x51A00, GCC_REG_BASE(PLLTEST_PAD_CFG));
2722 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2723
2724 clk_disable_unprepare(&gcc_xo_clk_src.c);
2725
2726 return ret;
2727}
2728#else /* !CONFIG_DEBUG_FS */
2729static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
2730{
2731 return -EINVAL;
2732}
2733
2734static unsigned long measure_clk_get_rate(struct clk *clk)
2735{
2736 return 0;
2737}
2738#endif /* CONFIG_DEBUG_FS */
2739
2740static struct clk_ops clk_ops_measure = {
2741 .set_parent = measure_clk_set_parent,
2742 .get_rate = measure_clk_get_rate,
2743};
2744
2745static struct measure_clk measure_clk = {
2746 .c = {
2747 .dbg_name = "measure_clk",
2748 .ops = &clk_ops_measure,
2749 CLK_INIT(measure_clk.c),
2750 },
2751 .multiplier = 1,
2752};
2753
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08002754static struct clk_lookup msm_clocks_8610[] = {
Mayank Rana05754c92013-07-24 17:12:37 +05302755 CLK_LOOKUP("xo", cxo_otg_clk.c, "f9a55000.usb"),
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002756 CLK_LOOKUP("xo", cxo_lpass_pil_clk.c, "fe200000.qcom,lpass"),
2757 CLK_LOOKUP("xo", cxo_lpm_clk.c, "fc4281d0.qcom,mpm"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002758
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002759 CLK_LOOKUP("xo", cxo_mss_pil_clk.c, "fc880000.qcom,mss"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002760 CLK_LOOKUP("bus_clk", gcc_mss_q6_bimc_axi_clk.c, "fc880000.qcom,mss"),
2761 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, "fc880000.qcom,mss"),
2762 CLK_LOOKUP("mem_clk", gcc_boot_rom_ahb_clk.c, "fc880000.qcom,mss"),
2763
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07002764 CLK_LOOKUP("xo", cxo_pil_mba_clk.c, "pil-mba"),
2765 CLK_LOOKUP("xo", cxo_wlan_clk.c, "fb000000.qcom,wcnss-wlan"),
2766 CLK_LOOKUP("xo", cxo_pil_pronto_clk.c, "fb21b000.qcom,pronto"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002767 CLK_LOOKUP("measure", measure_clk.c, "debug"),
2768
2769 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991f000.serial"),
2770 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "f991f000.serial"),
Hanumant Singhbbf01da2013-04-09 16:27:28 -07002771 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991e000.serial"),
2772 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, "f991e000.serial"),
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -07002773 CLK_LOOKUP("bus_clk", pnoc_keepalive_a_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002774 CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002775
2776 CLK_LOOKUP("bus_clk", snoc_clk.c, ""),
2777 CLK_LOOKUP("bus_clk", pnoc_clk.c, ""),
2778 CLK_LOOKUP("bus_clk", cnoc_clk.c, ""),
2779 CLK_LOOKUP("mem_clk", bimc_clk.c, ""),
2780 CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""),
2781 CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""),
2782 CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""),
2783 CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""),
2784
2785 CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"),
2786 CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"),
2787 CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"),
2788 CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"),
2789 CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"),
2790 CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"),
2791 CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"),
2792 CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"),
2793 CLK_LOOKUP("mem_clk", bimc_acpu_a_clk.c, ""),
Gagan Mac125029b2013-03-07 17:24:27 -07002794 CLK_LOOKUP("bus_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
2795 CLK_LOOKUP("bus_a_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002796
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002797 /* CoreSight clocks */
2798 CLK_LOOKUP("core_clk", qdss_clk.c, "fc326000.tmc"),
2799 CLK_LOOKUP("core_clk", qdss_clk.c, "fc320000.tpiu"),
2800 CLK_LOOKUP("core_clk", qdss_clk.c, "fc324000.replicator"),
2801 CLK_LOOKUP("core_clk", qdss_clk.c, "fc325000.tmc"),
2802 CLK_LOOKUP("core_clk", qdss_clk.c, "fc323000.funnel"),
2803 CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.funnel"),
2804 CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.funnel"),
2805 CLK_LOOKUP("core_clk", qdss_clk.c, "fc355000.funnel"),
2806 CLK_LOOKUP("core_clk", qdss_clk.c, "fc302000.stm"),
2807 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.etm"),
2808 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.etm"),
2809 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.etm"),
2810 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.etm"),
2811 CLK_LOOKUP("core_clk", qdss_clk.c, "fc301000.csr"),
2812 CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"),
2813 CLK_LOOKUP("core_clk", qdss_clk.c, "fc311000.cti"),
2814 CLK_LOOKUP("core_clk", qdss_clk.c, "fc312000.cti"),
2815 CLK_LOOKUP("core_clk", qdss_clk.c, "fc313000.cti"),
2816 CLK_LOOKUP("core_clk", qdss_clk.c, "fc314000.cti"),
2817 CLK_LOOKUP("core_clk", qdss_clk.c, "fc315000.cti"),
2818 CLK_LOOKUP("core_clk", qdss_clk.c, "fc316000.cti"),
2819 CLK_LOOKUP("core_clk", qdss_clk.c, "fc317000.cti"),
2820 CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.cti"),
2821 CLK_LOOKUP("core_clk", qdss_clk.c, "fc351000.cti"),
2822 CLK_LOOKUP("core_clk", qdss_clk.c, "fc352000.cti"),
2823 CLK_LOOKUP("core_clk", qdss_clk.c, "fc353000.cti"),
2824 CLK_LOOKUP("core_clk", qdss_clk.c, "fc354000.cti"),
Pratik Patel85419772013-10-04 16:09:59 -07002825 CLK_LOOKUP("core_clk", qdss_clk.c, "fc335000.cti"),
2826 CLK_LOOKUP("core_clk", qdss_clk.c, "fc338000.cti"),
2827 CLK_LOOKUP("core_clk", qdss_clk.c, "fc33c000.cti"),
2828 CLK_LOOKUP("core_clk", qdss_clk.c, "fc360000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002829 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.jtagmm"),
2830 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.jtagmm"),
2831 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.jtagmm"),
2832 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002833 CLK_LOOKUP("core_clk", qdss_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002834
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002835
2836 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc326000.tmc"),
2837 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc320000.tpiu"),
2838 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc324000.replicator"),
2839 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc325000.tmc"),
2840 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc323000.funnel"),
2841 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.funnel"),
2842 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.funnel"),
2843 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc355000.funnel"),
2844 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc302000.stm"),
2845 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.etm"),
2846 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.etm"),
2847 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.etm"),
2848 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.etm"),
2849 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc301000.csr"),
2850 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"),
2851 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc311000.cti"),
2852 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc312000.cti"),
2853 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc313000.cti"),
2854 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc314000.cti"),
2855 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc315000.cti"),
2856 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc316000.cti"),
2857 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc317000.cti"),
2858 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.cti"),
2859 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc351000.cti"),
2860 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc352000.cti"),
2861 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc353000.cti"),
2862 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc354000.cti"),
Pratik Patel85419772013-10-04 16:09:59 -07002863 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc335000.cti"),
2864 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc338000.cti"),
2865 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc33c000.cti"),
2866 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc360000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002867 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.jtagmm"),
2868 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.jtagmm"),
2869 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.jtagmm"),
2870 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002871 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fd820018.hwevent"),
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002872
Aparna Das05172f22013-05-13 15:06:44 -07002873 CLK_LOOKUP("core_mmss_clk", mmss_misc_ahb_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002874
2875 CLK_LOOKUP("core_clk_src", blsp1_qup1_spi_apps_clk_src.c, ""),
2876 CLK_LOOKUP("core_clk_src", blsp1_qup2_spi_apps_clk_src.c, ""),
2877 CLK_LOOKUP("core_clk_src", blsp1_qup3_spi_apps_clk_src.c, ""),
2878 CLK_LOOKUP("core_clk_src", blsp1_qup4_spi_apps_clk_src.c, ""),
2879 CLK_LOOKUP("core_clk_src", blsp1_qup5_spi_apps_clk_src.c, ""),
2880 CLK_LOOKUP("core_clk_src", blsp1_qup6_spi_apps_clk_src.c, ""),
2881 CLK_LOOKUP("core_clk_src", blsp1_uart1_apps_clk_src.c, ""),
2882 CLK_LOOKUP("core_clk_src", blsp1_uart2_apps_clk_src.c, ""),
2883 CLK_LOOKUP("core_clk_src", blsp1_uart3_apps_clk_src.c, ""),
2884 CLK_LOOKUP("core_clk_src", blsp1_uart4_apps_clk_src.c, ""),
2885 CLK_LOOKUP("core_clk_src", blsp1_uart5_apps_clk_src.c, ""),
2886 CLK_LOOKUP("core_clk_src", blsp1_uart6_apps_clk_src.c, ""),
2887 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""),
2888 CLK_LOOKUP("core_clk_src", gp1_clk_src.c, ""),
2889 CLK_LOOKUP("core_clk_src", gp2_clk_src.c, ""),
2890 CLK_LOOKUP("core_clk_src", gp3_clk_src.c, ""),
2891 CLK_LOOKUP("core_clk_src", pdm2_clk_src.c, ""),
2892 CLK_LOOKUP("core_clk_src", sdcc1_apps_clk_src.c, ""),
2893 CLK_LOOKUP("core_clk_src", sdcc2_apps_clk_src.c, ""),
2894 CLK_LOOKUP("core_clk_src", usb_hs_system_clk_src.c, ""),
Chun Zhangf39a0652013-05-01 15:57:54 -07002895 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9923000.i2c"),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002896 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002897 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9927000.i2c"),
Gilad Avidova460c472013-04-12 16:23:32 -06002898 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9926000.spi"),
Chun Zhangf39a0652013-05-01 15:57:54 -07002899 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, "f9923000.i2c"),
2900 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002901 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, ""),
2902 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, ""),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002903 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002904 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""),
2905 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""),
Gilad Avidova460c472013-04-12 16:23:32 -06002906 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, "f9926000.spi"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002907 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002908 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, "f9927000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002909 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""),
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -06002910 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9928000.i2c"),
2911 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, "f9928000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002912 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""),
2913 CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, ""),
2914 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""),
2915 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, ""),
2916 CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""),
2917 CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""),
2918 CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""),
2919 CLK_LOOKUP("iface_clk", gcc_boot_rom_ahb_clk.c, ""),
2920 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""),
2921 CLK_LOOKUP("core_clk", gcc_ce1_axi_clk.c, ""),
2922 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""),
2923 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c, ""),
2924 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, ""),
Bansidhar Gopalachari148c7252013-09-25 19:55:41 +01002925 CLK_LOOKUP("core_clk", gcc_gp1_clk.c, "0-000e"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002926 CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""),
2927 CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""),
2928 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, ""),
2929 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, ""),
2930 CLK_LOOKUP("core_clk", gcc_mss_q6_bimc_axi_clk.c, ""),
2931 CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""),
2932 CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""),
Hariprasad Dhalinarasimha2cced7d2013-04-13 17:25:58 -07002933 CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002934 CLK_LOOKUP("iface_clk", gcc_sdcc1_ahb_clk.c, "msm_sdcc.1"),
2935 CLK_LOOKUP("core_clk", gcc_sdcc1_apps_clk.c, "msm_sdcc.1"),
2936 CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"),
2937 CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"),
Mayank Rana05754c92013-07-24 17:12:37 +05302938 CLK_LOOKUP("sleep_clk", gcc_usb2a_phy_sleep_clk.c, "f9a55000.usb"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002939 CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"),
2940 CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"),
2941
2942 CLK_LOOKUP("core_clk_src", csi0_clk_src.c, ""),
2943 CLK_LOOKUP("core_clk_src", axi_clk_src.c, ""),
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002944 CLK_LOOKUP("", mdp_axi_clk_src.c, ""),
2945 CLK_LOOKUP("", mmssnoc_axi_clk_src.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002946 CLK_LOOKUP("core_clk_src", dsi_pclk_clk_src.c, ""),
2947 CLK_LOOKUP("core_clk_src", gfx3d_clk_src.c, ""),
2948 CLK_LOOKUP("core_clk_src", vfe_clk_src.c, ""),
2949 CLK_LOOKUP("core_clk_src", csi1_clk_src.c, ""),
2950 CLK_LOOKUP("core_clk_src", csi0phytimer_clk_src.c, ""),
2951 CLK_LOOKUP("core_clk_src", csi1phytimer_clk_src.c, ""),
2952 CLK_LOOKUP("core_clk_src", dsi_clk_src.c, ""),
2953 CLK_LOOKUP("core_clk_src", dsi_byte_clk_src.c, ""),
2954 CLK_LOOKUP("core_clk_src", dsi_esc_clk_src.c, ""),
2955 CLK_LOOKUP("core_clk_src", mclk0_clk_src.c, ""),
2956 CLK_LOOKUP("core_clk_src", mclk1_clk_src.c, ""),
2957 CLK_LOOKUP("core_clk_src", mdp_vsync_clk_src.c, ""),
2958
2959 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, ""),
2960 CLK_LOOKUP("core_clk", csi0_clk.c, ""),
2961 CLK_LOOKUP("core_clk", csi0phy_clk.c, ""),
2962 CLK_LOOKUP("core_clk", csi0phytimer_clk.c, ""),
2963 CLK_LOOKUP("core_clk", csi0pix_clk.c, ""),
2964 CLK_LOOKUP("core_clk", csi0rdi_clk.c, ""),
2965 CLK_LOOKUP("core_clk", csi1_clk.c, ""),
2966 CLK_LOOKUP("core_clk", csi1phy_clk.c, ""),
2967 CLK_LOOKUP("core_clk", csi1phytimer_clk.c, ""),
2968 CLK_LOOKUP("core_clk", csi1pix_clk.c, ""),
2969 CLK_LOOKUP("core_clk", csi1rdi_clk.c, ""),
2970 CLK_LOOKUP("core_clk", csi_ahb_clk.c, ""),
2971 CLK_LOOKUP("core_clk", csi_vfe_clk.c, ""),
2972 CLK_LOOKUP("core_clk", dsi_clk.c, ""),
2973 CLK_LOOKUP("core_clk", dsi_ahb_clk.c, ""),
2974 CLK_LOOKUP("core_clk", dsi_byte_clk.c, ""),
2975 CLK_LOOKUP("core_clk", dsi_esc_clk.c, ""),
2976 CLK_LOOKUP("core_clk", dsi_pclk_clk.c, ""),
2977 CLK_LOOKUP("core_clk", gmem_gfx3d_clk.c, ""),
2978 CLK_LOOKUP("core_clk", mclk0_clk.c, ""),
2979 CLK_LOOKUP("core_clk", mclk1_clk.c, ""),
2980 CLK_LOOKUP("core_clk", mdp_ahb_clk.c, ""),
2981 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
2982 CLK_LOOKUP("core_clk", mdp_dsi_clk.c, ""),
2983 CLK_LOOKUP("core_clk", mdp_lcdc_clk.c, ""),
2984 CLK_LOOKUP("core_clk", mdp_vsync_clk.c, ""),
2985 CLK_LOOKUP("core_clk", mmss_misc_ahb_clk.c, ""),
2986 CLK_LOOKUP("core_clk", mmss_s0_axi_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002987 CLK_LOOKUP("core_clk", mmss_mmssnoc_bto_ahb_clk.c, ""),
2988 CLK_LOOKUP("core_clk", mmss_mmssnoc_axi_clk.c, ""),
2989 CLK_LOOKUP("core_clk", vfe_clk.c, ""),
2990 CLK_LOOKUP("core_clk", vfe_ahb_clk.c, ""),
2991 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
2992
Vikram Mulukutla49423392013-05-02 09:03:02 -07002993 CLK_LOOKUP("core_clk", csi0pix_cam_mux_clk.c, ""),
2994 CLK_LOOKUP("core_clk", csi0phy_cam_mux_clk.c, ""),
2995 CLK_LOOKUP("core_clk", csi1phy_cam_mux_clk.c, ""),
2996 CLK_LOOKUP("core_clk", rdi2_cam_mux_clk.c, ""),
2997 CLK_LOOKUP("core_clk", rdi1_cam_mux_clk.c, ""),
2998 CLK_LOOKUP("core_clk", rdi0_cam_mux_clk.c, ""),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002999
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003000 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
3001 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fdc00000.qcom,kgsl-3d0"),
3002 CLK_LOOKUP("mem_iface_clk", bimc_gfx_clk.c, "fdc00000.qcom,kgsl-3d0"),
3003 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07003004 CLK_LOOKUP("alt_mem_iface_clk", gcc_bimc_smmu_clk.c,
3005 "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003006
3007 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd890000.qcom,iommu"),
3008 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "fd890000.qcom,iommu"),
3009 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd860000.qcom,iommu"),
3010 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd860000.qcom,iommu"),
3011 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd870000.qcom,iommu"),
3012 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd870000.qcom,iommu"),
3013 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd880000.qcom,iommu"),
3014 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07003015 CLK_LOOKUP("alt_core_clk", gcc_bimc_smmu_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003016 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, "fd000000.qcom,iommu"),
3017 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, "fd000000.qcom,iommu"),
3018 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c,
3019 "fd010000.qcom,iommu"),
3020 CLK_LOOKUP("core_clk", pnoc_iommu_clk.c, "fd010000.qcom,iommu"),
3021
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003022 /* MM sensor clocks */
3023 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006f"),
Aditya Jonnalagadda3057ba52013-09-20 19:59:41 +05303024 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0034"),
Li Sun3eb82a62013-06-14 15:14:22 +08003025 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-007d"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003026 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006d"),
Ju He543b5802013-06-07 16:03:34 -07003027 CLK_LOOKUP("cam_src_clk", mclk1_clk_src.c, "6-0078"),
Yu Yang8744be82013-06-18 14:39:37 +08003028 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0020"),
Wei Ding7d2f73d2013-09-10 09:41:10 +08003029 CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006a"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003030 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006f"),
Aditya Jonnalagadda3057ba52013-09-20 19:59:41 +05303031 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0034"),
Li Sun3eb82a62013-06-14 15:14:22 +08003032 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-007d"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003033 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006d"),
Ju He543b5802013-06-07 16:03:34 -07003034 CLK_LOOKUP("cam_clk", mclk1_clk.c, "6-0078"),
Yu Yang8744be82013-06-18 14:39:37 +08003035 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0020"),
Wei Ding7d2f73d2013-09-10 09:41:10 +08003036 CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006a"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003037
3038
3039 /* CSIPHY clocks */
3040 CLK_LOOKUP("csiphy_timer_src_clk", csi0phytimer_clk_src.c,
3041 "fda00c00.qcom,csiphy"),
3042 CLK_LOOKUP("csiphy_timer_clk", csi0phytimer_clk.c,
3043 "fda00c00.qcom,csiphy"),
Chandan Gera30c93082013-10-24 14:10:13 +05303044 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00c00.qcom,csiphy"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003045 CLK_LOOKUP("csiphy_timer_src_clk", csi1phytimer_clk_src.c,
3046 "fda01000.qcom,csiphy"),
3047 CLK_LOOKUP("csiphy_timer_clk", csi1phytimer_clk.c,
3048 "fda01000.qcom,csiphy"),
Chandan Gera30c93082013-10-24 14:10:13 +05303049 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda01000.qcom,csiphy"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003050
3051 /* CSID clocks */
juhe85f33272013-05-10 15:21:08 +08003052 CLK_LOOKUP("csi_clk", csi0_clk.c, "fda00000.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003053 CLK_LOOKUP("csi_src_clk", csi0_clk_src.c, "fda00000.qcom,csid"),
juhe85f33272013-05-10 15:21:08 +08003054 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00000.qcom,csid"),
3055 CLK_LOOKUP("csi0phy_mux_clk", csi0phy_cam_mux_clk.c,
3056 "fda00000.qcom,csid"),
3057 CLK_LOOKUP("csi1phy_mux_clk", csi1phy_cam_mux_clk.c,
3058 "fda00000.qcom,csid"),
3059 CLK_LOOKUP("csi0pix_mux_clk", csi0pix_cam_mux_clk.c,
3060 "fda00000.qcom,csid"),
3061 CLK_LOOKUP("csi0rdi_mux_clk", rdi0_cam_mux_clk.c,
3062 "fda00000.qcom,csid"),
3063 CLK_LOOKUP("csi1rdi_mux_clk", rdi1_cam_mux_clk.c,
3064 "fda00000.qcom,csid"),
3065 CLK_LOOKUP("csi2rdi_mux_clk", rdi2_cam_mux_clk.c,
3066 "fda00000.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003067
juhe85f33272013-05-10 15:21:08 +08003068 CLK_LOOKUP("csi_clk", csi1_clk.c, "fda00400.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003069 CLK_LOOKUP("csi_src_clk", csi1_clk_src.c, "fda00400.qcom,csid"),
juhe85f33272013-05-10 15:21:08 +08003070 CLK_LOOKUP("csi_ahb_clk", csi_ahb_clk.c, "fda00400.qcom,csid"),
3071 CLK_LOOKUP("csi0phy_mux_clk", csi0phy_cam_mux_clk.c,
3072 "fda00400.qcom,csid"),
3073 CLK_LOOKUP("csi1phy_mux_clk", csi1phy_cam_mux_clk.c,
3074 "fda00400.qcom,csid"),
3075 CLK_LOOKUP("csi0pix_mux_clk", csi0pix_cam_mux_clk.c,
3076 "fda00400.qcom,csid"),
3077 CLK_LOOKUP("csi0rdi_mux_clk", rdi0_cam_mux_clk.c,
3078 "fda00400.qcom,csid"),
3079 CLK_LOOKUP("csi1rdi_mux_clk", rdi1_cam_mux_clk.c,
3080 "fda00400.qcom,csid"),
3081 CLK_LOOKUP("csi2rdi_mux_clk", rdi2_cam_mux_clk.c,
3082 "fda00400.qcom,csid"),
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003083
juhe85f33272013-05-10 15:21:08 +08003084 CLK_LOOKUP("csi_phy_src_clk", csi0phy_clk.c, "fda00000.qcom,csid"),
3085 CLK_LOOKUP("csi_phy_src_clk", csi1phy_clk.c, "fda00400.qcom,csid"),
3086 CLK_LOOKUP("csi_pix_src_clk", csi0pix_clk.c, "fda00000.qcom,csid"),
3087 CLK_LOOKUP("csi_pix_src_clk", csi1pix_clk.c, "fda00400.qcom,csid"),
3088 CLK_LOOKUP("csi_rdi_src_clk", csi0rdi_clk.c, "fda00000.qcom,csid"),
3089 CLK_LOOKUP("csi_rdi_src_clk", csi1rdi_clk.c, "fda00400.qcom,csid"),
3090 /* ISPIF need no clock */
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -07003091
3092 CLK_LOOKUP("vfe_clk_src", vfe_clk_src.c, "fde00000.qcom,vfe"),
3093 CLK_LOOKUP("vfe_clk", vfe_clk.c, "fde00000.qcom,vfe"),
3094
3095 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "fde00000.qcom,vfe"),
3096 CLK_LOOKUP("vfe_ahb_clk", vfe_ahb_clk.c, "fde00000.qcom,vfe"),
3097
3098 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "fde00000.qcom,vfe"),
3099
3100
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003101 CLK_LOOKUP("core_clk", q6ss_xo_clk.c, "fe200000.qcom,lpass"),
3102 CLK_LOOKUP("bus_clk", gcc_lpass_q6_axi_clk.c, "fe200000.qcom,lpass"),
3103 CLK_LOOKUP("iface_clk", q6ss_ahb_lfabif_clk.c, "fe200000.qcom,lpass"),
3104 CLK_LOOKUP("reg_clk", q6ss_ahbm_clk.c, "fe200000.qcom,lpass"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003105
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07003106 CLK_LOOKUP("xo", cxo_acpu_clk.c, "f9011050.qcom,acpuclk"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003107 CLK_LOOKUP("gpll0", gpll0_ao_clk_src.c, "f9011050.qcom,acpuclk"),
3108 CLK_LOOKUP("a7sspll", a7sspll.c, "f9011050.qcom,acpuclk"),
3109
3110 CLK_LOOKUP("measure_clk", apc0_m_clk, ""),
3111 CLK_LOOKUP("measure_clk", apc1_m_clk, ""),
3112 CLK_LOOKUP("measure_clk", apc2_m_clk, ""),
3113 CLK_LOOKUP("measure_clk", apc3_m_clk, ""),
3114 CLK_LOOKUP("measure_clk", l2_m_clk, ""),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003115
Vikram Mulukutlaae4ae302013-04-24 12:00:28 -07003116 CLK_LOOKUP("xo", cxo_wlan_clk.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutla7e5b3112013-04-15 16:32:40 -07003117 CLK_LOOKUP("rf_clk", cxo_a1.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutlaed078512013-04-09 14:15:33 -07003118
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003119 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd900000.qcom,mdss_mdp"),
3120 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd900000.qcom,mdss_mdp"),
3121 CLK_LOOKUP("lcdc_clk", mdp_lcdc_clk.c, "fd900000.qcom,mdss_mdp"),
3122 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003123 CLK_LOOKUP("dsi_clk", mdp_dsi_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003124 CLK_LOOKUP("iface_clk", dsi_ahb_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003125 CLK_LOOKUP("dsi_clk", dsi_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003126 CLK_LOOKUP("byte_clk", dsi_byte_clk.c, "fdd00000.qcom,mdss_dsi"),
3127 CLK_LOOKUP("esc_clk", dsi_esc_clk.c, "fdd00000.qcom,mdss_dsi"),
3128 CLK_LOOKUP("pixel_clk", dsi_pclk_clk.c, "fdd00000.qcom,mdss_dsi"),
Hariprasad Dhalinarasimhad9ede5a2013-04-14 16:30:09 -07003129
3130 /* QSEECOM Clocks */
3131 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "qseecom"),
3132 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "qseecom"),
3133 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "qseecom"),
3134 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "qseecom"),
Vikram Mulukutlafd6833c2013-04-18 12:46:48 -07003135
3136 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "scm"),
3137 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "scm"),
3138 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "scm"),
3139 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "scm"),
Hariprasad Dhalinarasimha315b9bd2013-05-14 12:31:56 -07003140
3141 /* Add QCEDEV clocks */
3142 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcedev"),
3143 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcedev"),
3144 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcedev"),
3145 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcedev"),
3146
3147 /* Add QCRYPTO clocks */
3148 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd404000.qcom,qcrypto"),
3149 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd404000.qcom,qcrypto"),
3150 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd404000.qcom,qcrypto"),
3151 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd404000.qcom,qcrypto"),
Matt Wagantall8ce3c462013-07-03 19:24:53 -07003152
3153 /* GDSC clocks */
3154 CLK_LOOKUP("core_clk", vfe_clk.c, "fd8c36a4.qcom,gdsc"),
3155 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd8c36a4.qcom,gdsc"),
3156 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "fd8c36a4.qcom,gdsc"),
Matt Wagantall8ce3c462013-07-03 19:24:53 -07003157 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fd8c4034.qcom,gdsc"),
3158 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd8c4034.qcom,gdsc"),
3159 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fd8c4034.qcom,gdsc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003160};
3161
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003162static struct clk_lookup msm_clocks_8610_rumi[] = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003163 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3164 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3165 CLK_DUMMY("iface_clk", HSUSB_IFACE_CLK, "f9a55000.usb", OFF),
3166 CLK_DUMMY("core_clk", HSUSB_CORE_CLK, "f9a55000.usb", OFF),
3167 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.1", OFF),
3168 CLK_DUMMY("core_clk", NULL, "msm_sdcc.1", OFF),
3169 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.1", OFF),
3170 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.2", OFF),
3171 CLK_DUMMY("core_clk", NULL, "msm_sdcc.2", OFF),
3172 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.2", OFF),
3173 CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
3174 CLK_DUMMY("iface_clk", NULL, "fd890000.qcom,iommu", OFF),
3175 CLK_DUMMY("core_clk", NULL, "fd890000.qcom,iommu", OFF),
3176 CLK_DUMMY("iface_clk", NULL, "fd860000.qcom,iommu", OFF),
3177 CLK_DUMMY("core_clk", NULL, "fd860000.qcom,iommu", OFF),
3178 CLK_DUMMY("iface_clk", NULL, "fd870000.qcom,iommu", OFF),
3179 CLK_DUMMY("core_clk", NULL, "fd870000.qcom,iommu", OFF),
3180 CLK_DUMMY("iface_clk", NULL, "fd880000.qcom,iommu", OFF),
3181 CLK_DUMMY("core_clk", NULL, "fd880000.qcom,iommu", OFF),
Olav Haugan3431b4c2013-04-30 14:09:08 -07003182 CLK_DUMMY("alt_core_clk", NULL, "fd880000.qcom,iommu", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003183 CLK_DUMMY("iface_clk", NULL, "fd000000.qcom,iommu", OFF),
3184 CLK_DUMMY("core_clk", NULL, "fd000000.qcom,iommu", OFF),
3185 CLK_DUMMY("iface_clk", NULL, "fd010000.qcom,iommu", OFF),
3186 CLK_DUMMY("core_clk", NULL, "fd010000.qcom,iommu", OFF),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003187 CLK_DUMMY("xo", NULL, "f9011050.qcom,acpuclk", OFF),
3188 CLK_DUMMY("gpll0", NULL, "f9011050.qcom,acpuclk", OFF),
3189 CLK_DUMMY("a7sspll", NULL, "f9011050.qcom,acpuclk", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003190};
3191
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003192struct clock_init_data msm8610_rumi_clock_init_data __initdata = {
3193 .table = msm_clocks_8610_rumi,
3194 .size = ARRAY_SIZE(msm_clocks_8610_rumi),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003195};
3196
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003197/* MMPLL0 at 800 MHz, main output enabled. */
3198static struct pll_config mmpll0_config __initdata = {
3199 .l = 0x29,
3200 .m = 0x2,
3201 .n = 0x3,
3202 .vco_val = 0x0,
3203 .vco_mask = BM(21, 20),
3204 .pre_div_val = 0x0,
3205 .pre_div_mask = BM(14, 12),
3206 .post_div_val = 0x0,
3207 .post_div_mask = BM(9, 8),
3208 .mn_ena_val = BIT(24),
3209 .mn_ena_mask = BIT(24),
3210 .main_output_val = BIT(0),
3211 .main_output_mask = BIT(0),
3212};
3213
3214/* MMPLL1 at 1200 MHz, main output enabled. */
3215static struct pll_config mmpll1_config __initdata = {
3216 .l = 0x3E,
3217 .m = 0x1,
3218 .n = 0x2,
3219 .vco_val = 0x0,
3220 .vco_mask = BM(21, 20),
3221 .pre_div_val = 0x0,
3222 .pre_div_mask = BM(14, 12),
3223 .post_div_val = 0x0,
3224 .post_div_mask = BM(9, 8),
3225 .mn_ena_val = BIT(24),
3226 .mn_ena_mask = BIT(24),
3227 .main_output_val = BIT(0),
3228 .main_output_mask = BIT(0),
3229};
3230
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003231static void __init reg_init(void)
3232{
Vikram Mulukutla81577ab2013-03-25 10:55:36 -07003233 u32 regval;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003234
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003235 configure_sr_hpm_lp_pll(&mmpll0_config, &mmpll0_regs, 1);
3236 configure_sr_hpm_lp_pll(&mmpll1_config, &mmpll1_regs, 1);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003237
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003238 /* Vote for GPLL0 to turn on. Needed by acpuclock. */
3239 regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3240 regval |= BIT(0);
3241 writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3242
3243 /*
3244 * TODO: Confirm that no clocks need to be voted on in this sleep vote
3245 * register.
3246 */
3247 writel_relaxed(0x0, GCC_REG_BASE(APCS_CLOCK_SLEEP_ENA_VOTE));
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003248}
3249
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003250static void __init msm8610_clock_post_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003251{
3252 /*
3253 * Hold an active set vote for CXO; this is because CXO is expected
3254 * to remain on whenever CPUs aren't power collapsed.
3255 */
3256 clk_prepare_enable(&gcc_xo_a_clk_src.c);
Chandra Ramachandranc7c6e382013-07-31 16:34:10 -07003257 /*
3258 * Hold an active set vote for the PNOC AHB source. Sleep set vote is 0.
3259 */
3260 clk_set_rate(&pnoc_keepalive_a_clk.c, 19200000);
3261 clk_prepare_enable(&pnoc_keepalive_a_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003262 /* Set rates for single-rate clocks. */
3263 clk_set_rate(&usb_hs_system_clk_src.c,
3264 usb_hs_system_clk_src.freq_tbl[0].freq_hz);
3265 clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz);
3266 clk_set_rate(&mclk0_clk_src.c, mclk0_clk_src.freq_tbl[0].freq_hz);
3267 clk_set_rate(&mclk1_clk_src.c, mclk1_clk_src.freq_tbl[0].freq_hz);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003268}
3269
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003270static void dsi_init(void)
3271{
3272 dsi_byte_clk_src_ops = clk_ops_rcg;
3273 dsi_byte_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3274 dsi_byte_clk_src_ops.handoff = byte_rcg_handoff;
3275 dsi_byte_clk_src_ops.get_parent = NULL;
3276
3277 dsi_dsi_clk_src_ops = clk_ops_rcg_mnd;
3278 dsi_dsi_clk_src_ops.set_rate = set_rate_dsi_clk;
3279 dsi_dsi_clk_src_ops.handoff = pixel_rcg_handoff;
3280 dsi_dsi_clk_src_ops.get_parent = NULL;
3281
3282 dsi_pixel_clk_src_ops = clk_ops_rcg_mnd;
3283 dsi_pixel_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3284 dsi_pixel_clk_src_ops.handoff = pixel_rcg_handoff;
3285 dsi_pixel_clk_src_ops.get_parent = NULL;
3286
3287 dsi_clk_ctrl_init(&dsi_ahb_clk.c);
3288}
3289
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003290#define GCC_CC_PHYS 0xFC400000
3291#define GCC_CC_SIZE SZ_16K
3292
3293#define MMSS_CC_PHYS 0xFD8C0000
3294#define MMSS_CC_SIZE SZ_256K
3295
3296#define LPASS_CC_PHYS 0xFE000000
3297#define LPASS_CC_SIZE SZ_256K
3298
3299#define APCS_GCC_CC_PHYS 0xF9011000
3300#define APCS_GCC_CC_SIZE SZ_4K
3301
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003302#define APCS_KPSS_SH_PLL_PHYS 0xF9016000
3303#define APCS_KPSS_SH_PLL_SIZE SZ_64
3304
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003305static void __init msm8610_clock_pre_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003306{
3307 virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE);
3308 if (!virt_bases[GCC_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003309 panic("clock-8610: Unable to ioremap GCC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003310
3311 virt_bases[MMSS_BASE] = ioremap(MMSS_CC_PHYS, MMSS_CC_SIZE);
3312 if (!virt_bases[MMSS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003313 panic("clock-8610: Unable to ioremap MMSS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003314
3315 virt_bases[LPASS_BASE] = ioremap(LPASS_CC_PHYS, LPASS_CC_SIZE);
3316 if (!virt_bases[LPASS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003317 panic("clock-8610: Unable to ioremap LPASS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003318
3319 virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE);
3320 if (!virt_bases[APCS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003321 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003322
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003323 virt_bases[APCS_PLL_BASE] = ioremap(APCS_KPSS_SH_PLL_PHYS,
3324 APCS_KPSS_SH_PLL_SIZE);
3325 if (!virt_bases[APCS_PLL_BASE])
3326 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
3327
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003328 clk_ops_local_pll.enable = sr_hpm_lp_pll_clk_enable;
3329
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003330 vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig");
3331 if (IS_ERR(vdd_dig.regulator[0]))
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003332 panic("clock-8610: Unable to get the vdd_dig regulator!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003333
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003334 vdd_sr2_pll.regulator[0] = regulator_get(NULL, "vdd_sr2_pll");
3335 if (IS_ERR(vdd_sr2_pll.regulator[0]))
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003336 panic("clock-8610: Unable to get the vdd_sr2_pll regulator!");
3337
Patrick Daly6fb589a2013-03-29 17:55:55 -07003338 vdd_sr2_pll.regulator[1] = regulator_get(NULL, "vdd_sr2_dig");
3339 if (IS_ERR(vdd_sr2_pll.regulator[1]))
3340 panic("clock-8610: Unable to get the vdd_sr2_dig regulator!");
3341
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003342 enable_rpm_scaling();
3343
3344 /* Enable a clock to allow access to MMSS clock registers */
3345 clk_prepare_enable(&gcc_mmss_noc_cfg_ahb_clk.c),
3346
3347 reg_init();
3348
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003349 dsi_init();
3350
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08003351 /* Maintain the max nominal frequency on the MMSSNOC AHB bus. */
3352 clk_set_rate(&mmssnoc_ahb_a_clk.c, 40000000);
3353 clk_prepare_enable(&mmssnoc_ahb_a_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003354}
3355
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003356struct clock_init_data msm8610_clock_init_data __initdata = {
3357 .table = msm_clocks_8610,
3358 .size = ARRAY_SIZE(msm_clocks_8610),
3359 .pre_init = msm8610_clock_pre_init,
3360 .post_init = msm8610_clock_post_init,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003361};