blob: 17468d23b54ccfc8a489c21c7e2bc5d767e5dfb6 [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>
27
28#include "clock-local2.h"
29#include "clock-pll.h"
30#include "clock-rpm.h"
31#include "clock-voter.h"
32#include "clock.h"
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -070033#include "clock-dsi-8610.h"
Vikram Mulukutlab13abe42012-10-03 11:38:48 -070034
35enum {
36 GCC_BASE,
37 MMSS_BASE,
38 LPASS_BASE,
39 APCS_BASE,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -080040 APCS_PLL_BASE,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -070041 N_BASES,
42};
43
44static void __iomem *virt_bases[N_BASES];
45
46#define GCC_REG_BASE(x) (void __iomem *)(virt_bases[GCC_BASE] + (x))
47#define MMSS_REG_BASE(x) (void __iomem *)(virt_bases[MMSS_BASE] + (x))
48#define LPASS_REG_BASE(x) (void __iomem *)(virt_bases[LPASS_BASE] + (x))
49#define APCS_REG_BASE(x) (void __iomem *)(virt_bases[APCS_BASE] + (x))
50
51#define GPLL0_MODE 0x0000
52#define GPLL0_L_VAL 0x0004
53#define GPLL0_M_VAL 0x0008
54#define GPLL0_N_VAL 0x000C
55#define GPLL0_USER_CTL 0x0010
56#define GPLL0_STATUS 0x001C
57#define GPLL2_MODE 0x0080
58#define GPLL2_L_VAL 0x0084
59#define GPLL2_M_VAL 0x0088
60#define GPLL2_N_VAL 0x008C
61#define GPLL2_USER_CTL 0x0090
62#define GPLL2_STATUS 0x009C
63#define CONFIG_NOC_BCR 0x0140
64#define MMSS_BCR 0x0240
65#define MMSS_NOC_CFG_AHB_CBCR 0x024C
66#define MSS_CFG_AHB_CBCR 0x0280
67#define MSS_Q6_BIMC_AXI_CBCR 0x0284
68#define USB_HS_BCR 0x0480
69#define USB_HS_SYSTEM_CBCR 0x0484
70#define USB_HS_AHB_CBCR 0x0488
71#define USB_HS_SYSTEM_CMD_RCGR 0x0490
72#define USB2A_PHY_BCR 0x04A8
73#define USB2A_PHY_SLEEP_CBCR 0x04AC
74#define SDCC1_BCR 0x04C0
75#define SDCC1_APPS_CMD_RCGR 0x04D0
76#define SDCC1_APPS_CBCR 0x04C4
77#define SDCC1_AHB_CBCR 0x04C8
78#define SDCC2_BCR 0x0500
79#define SDCC2_APPS_CMD_RCGR 0x0510
80#define SDCC2_APPS_CBCR 0x0504
81#define SDCC2_AHB_CBCR 0x0508
82#define BLSP1_BCR 0x05C0
83#define BLSP1_AHB_CBCR 0x05C4
84#define BLSP1_QUP1_BCR 0x0640
85#define BLSP1_QUP1_SPI_APPS_CBCR 0x0644
86#define BLSP1_QUP1_I2C_APPS_CBCR 0x0648
87#define BLSP1_QUP1_SPI_APPS_CMD_RCGR 0x064C
88#define BLSP1_UART1_BCR 0x0680
89#define BLSP1_UART1_APPS_CBCR 0x0684
90#define BLSP1_UART1_SIM_CBCR 0x0688
91#define BLSP1_UART1_APPS_CMD_RCGR 0x068C
92#define BLSP1_QUP2_BCR 0x06C0
93#define BLSP1_QUP2_SPI_APPS_CBCR 0x06C4
94#define BLSP1_QUP2_I2C_APPS_CBCR 0x06C8
95#define BLSP1_QUP2_SPI_APPS_CMD_RCGR 0x06CC
96#define BLSP1_UART2_BCR 0x0700
97#define BLSP1_UART2_APPS_CBCR 0x0704
98#define BLSP1_UART2_SIM_CBCR 0x0708
99#define BLSP1_UART2_APPS_CMD_RCGR 0x070C
100#define BLSP1_QUP3_BCR 0x0740
101#define BLSP1_QUP3_SPI_APPS_CBCR 0x0744
102#define BLSP1_QUP3_I2C_APPS_CBCR 0x0748
103#define BLSP1_QUP3_SPI_APPS_CMD_RCGR 0x074C
104#define BLSP1_UART3_BCR 0x0780
105#define BLSP1_UART3_APPS_CBCR 0x0784
106#define BLSP1_UART3_SIM_CBCR 0x0788
107#define BLSP1_UART3_APPS_CMD_RCGR 0x078C
108#define BLSP1_QUP4_BCR 0x07C0
109#define BLSP1_QUP4_SPI_APPS_CBCR 0x07C4
110#define BLSP1_QUP4_I2C_APPS_CBCR 0x07C8
111#define BLSP1_QUP4_SPI_APPS_CMD_RCGR 0x07CC
112#define BLSP1_UART4_BCR 0x0800
113#define BLSP1_UART4_APPS_CBCR 0x0804
114#define BLSP1_UART4_SIM_CBCR 0x0808
115#define BLSP1_UART4_APPS_CMD_RCGR 0x080C
116#define BLSP1_QUP5_BCR 0x0840
117#define BLSP1_QUP5_SPI_APPS_CBCR 0x0844
118#define BLSP1_QUP5_I2C_APPS_CBCR 0x0848
119#define BLSP1_QUP5_SPI_APPS_CMD_RCGR 0x084C
120#define BLSP1_UART5_BCR 0x0880
121#define BLSP1_UART5_APPS_CBCR 0x0884
122#define BLSP1_UART5_SIM_CBCR 0x0888
123#define BLSP1_UART5_APPS_CMD_RCGR 0x088C
124#define BLSP1_QUP6_BCR 0x08C0
125#define BLSP1_QUP6_SPI_APPS_CBCR 0x08C4
126#define BLSP1_QUP6_I2C_APPS_CBCR 0x08C8
127#define BLSP1_QUP6_SPI_APPS_CMD_RCGR 0x08CC
128#define BLSP1_UART6_BCR 0x0900
129#define BLSP1_UART6_APPS_CBCR 0x0904
130#define BLSP1_UART6_SIM_CBCR 0x0908
131#define BLSP1_UART6_APPS_CMD_RCGR 0x090C
132#define PDM_BCR 0x0CC0
133#define PDM_AHB_CBCR 0x0CC4
134#define PDM2_CBCR 0x0CCC
135#define PDM2_CMD_RCGR 0x0CD0
136#define PRNG_BCR 0x0D00
137#define PRNG_AHB_CBCR 0x0D04
138#define BOOT_ROM_BCR 0x0E00
139#define BOOT_ROM_AHB_CBCR 0x0E04
140#define CE1_BCR 0x1040
141#define CE1_CMD_RCGR 0x1050
142#define CE1_CBCR 0x1044
143#define CE1_AXI_CBCR 0x1048
144#define CE1_AHB_CBCR 0x104C
145#define COPSS_SMMU_AHB_CBCR 0x015C
146#define LPSS_SMMU_AHB_CBCR 0x0158
Vikram Mulukutla55318acb2013-04-15 17:47:34 -0700147#define BIMC_SMMU_CBCR 0x1120
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700148#define LPASS_Q6_AXI_CBCR 0x11C0
149#define APCS_GPLL_ENA_VOTE 0x1480
150#define APCS_CLOCK_BRANCH_ENA_VOTE 0x1484
151#define APCS_CLOCK_SLEEP_ENA_VOTE 0x1488
152#define GP1_CBCR 0x1900
153#define GP1_CMD_RCGR 0x1904
154#define GP2_CBCR 0x1940
155#define GP2_CMD_RCGR 0x1944
156#define GP3_CBCR 0x1980
157#define GP3_CMD_RCGR 0x1984
158#define XO_CBCR 0x0034
159
160#define MMPLL0_PLL_MODE 0x0000
161#define MMPLL0_PLL_L_VAL 0x0004
162#define MMPLL0_PLL_M_VAL 0x0008
163#define MMPLL0_PLL_N_VAL 0x000C
164#define MMPLL0_PLL_USER_CTL 0x0010
165#define MMPLL0_PLL_STATUS 0x001C
166#define MMSS_PLL_VOTE_APCS_REG 0x0100
167#define MMPLL1_PLL_MODE 0x4100
168#define MMPLL1_PLL_L_VAL 0x4104
169#define MMPLL1_PLL_M_VAL 0x4108
170#define MMPLL1_PLL_N_VAL 0x410C
171#define MMPLL1_PLL_USER_CTL 0x4110
172#define MMPLL1_PLL_STATUS 0x411C
173#define DSI_PCLK_CMD_RCGR 0x2000
174#define DSI_CMD_RCGR 0x2020
175#define MDP_VSYNC_CMD_RCGR 0x2080
176#define DSI_BYTE_CMD_RCGR 0x2120
177#define DSI_ESC_CMD_RCGR 0x2160
178#define DSI_BCR 0x2200
179#define DSI_BYTE_BCR 0x2204
180#define DSI_ESC_BCR 0x2208
181#define DSI_AHB_BCR 0x220C
182#define DSI_PCLK_BCR 0x2214
183#define MDP_LCDC_BCR 0x2218
184#define MDP_DSI_BCR 0x221C
185#define MDP_VSYNC_BCR 0x2220
186#define MDP_AXI_BCR 0x2224
187#define MDP_AHB_BCR 0x2228
188#define MDP_AXI_CBCR 0x2314
189#define MDP_VSYNC_CBCR 0x231C
190#define MDP_AHB_CBCR 0x2318
191#define DSI_PCLK_CBCR 0x233C
192#define GMEM_GFX3D_CBCR 0x4038
193#define MDP_LCDC_CBCR 0x2340
194#define MDP_DSI_CBCR 0x2320
195#define DSI_CBCR 0x2324
196#define DSI_BYTE_CBCR 0x2328
197#define DSI_ESC_CBCR 0x232C
198#define DSI_AHB_CBCR 0x2330
199#define CSI0PHYTIMER_CMD_RCGR 0x3000
200#define CSI0PHYTIMER_BCR 0x3020
201#define CSI0PHYTIMER_CBCR 0x3024
202#define CSI1PHYTIMER_CMD_RCGR 0x3030
203#define CSI1PHYTIMER_BCR 0x3050
204#define CSI1PHYTIMER_CBCR 0x3054
205#define CSI0_CMD_RCGR 0x3090
206#define CSI0_BCR 0x30B0
207#define CSI0_CBCR 0x30B4
208#define CSI_AHB_BCR 0x30B8
209#define CSI_AHB_CBCR 0x30BC
210#define CSI0PHY_BCR 0x30C0
211#define CSI0PHY_CBCR 0x30C4
212#define CSI0RDI_BCR 0x30D0
213#define CSI0RDI_CBCR 0x30D4
214#define CSI0PIX_BCR 0x30E0
215#define CSI0PIX_CBCR 0x30E4
216#define CSI1_CMD_RCGR 0x3100
217#define CSI1_BCR 0x3120
218#define CSI1_CBCR 0x3124
219#define CSI1PHY_BCR 0x3130
220#define CSI1PHY_CBCR 0x3134
221#define CSI1RDI_BCR 0x3140
222#define CSI1RDI_CBCR 0x3144
223#define CSI1PIX_BCR 0x3150
224#define CSI1PIX_CBCR 0x3154
225#define MCLK0_CMD_RCGR 0x3360
226#define MCLK0_BCR 0x3380
227#define MCLK0_CBCR 0x3384
228#define MCLK1_CMD_RCGR 0x3390
229#define MCLK1_BCR 0x33B0
230#define MCLK1_CBCR 0x33B4
231#define VFE_CMD_RCGR 0x3600
232#define VFE_BCR 0x36A0
233#define VFE_AHB_BCR 0x36AC
234#define VFE_AXI_BCR 0x36B0
235#define VFE_CBCR 0x36A8
236#define VFE_AHB_CBCR 0x36B8
237#define VFE_AXI_CBCR 0x36BC
238#define CSI_VFE_BCR 0x3700
239#define CSI_VFE_CBCR 0x3704
240#define GFX3D_CMD_RCGR 0x4000
241#define OXILI_GFX3D_CBCR 0x4028
242#define OXILI_GFX3D_BCR 0x4030
243#define OXILI_AHB_BCR 0x4044
244#define OXILI_AHB_CBCR 0x403C
245#define AHB_CMD_RCGR 0x5000
246#define MMSSNOCAHB_BCR 0x5020
247#define MMSSNOCAHB_BTO_BCR 0x5030
248#define MMSS_MISC_AHB_BCR 0x5034
249#define MMSS_MMSSNOC_AHB_CBCR 0x5024
250#define MMSS_MMSSNOC_BTO_AHB_CBCR 0x5028
251#define MMSS_MISC_AHB_CBCR 0x502C
252#define AXI_CMD_RCGR 0x5040
253#define MMSSNOCAXI_BCR 0x5060
254#define MMSS_S0_AXI_BCR 0x5068
255#define MMSS_S0_AXI_CBCR 0x5064
256#define MMSS_MMSSNOC_AXI_CBCR 0x506C
257#define BIMC_GFX_BCR 0x5090
258#define BIMC_GFX_CBCR 0x5094
Vikram Mulukutla8964a382013-04-10 14:30:50 -0700259#define MMSS_CAMSS_MISC 0x3718
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700260
261#define AUDIO_CORE_GDSCR 0x7000
262#define SPDM_BCR 0x1000
263#define LPAAUDIO_PLL_MODE 0x0000
264#define LPAAUDIO_PLL_L_VAL 0x0004
265#define LPAAUDIO_PLL_M_VAL 0x0008
266#define LPAAUDIO_PLL_N_VAL 0x000C
267#define LPAAUDIO_PLL_USER_CTL 0x0010
268#define LPAAUDIO_PLL_STATUS 0x001C
269#define LPAQ6_PLL_MODE 0x1000
270#define LPAQ6_PLL_USER_CTL 0x1010
271#define LPAQ6_PLL_STATUS 0x101C
272#define LPA_PLL_VOTE_APPS 0x2000
273#define AUDIO_CORE_BCR_SLP_CBCR 0x4004
274#define Q6SS_BCR_SLP_CBCR 0x6004
275#define AUDIO_CORE_GDSC_XO_CBCR 0x7004
276#define AUDIO_CORE_LPAIF_DMA_CBCR 0x9000
277#define AUDIO_CORE_LPAIF_CSR_CBCR 0x9004
278#define LPAIF_SPKR_CMD_RCGR 0xA000
279#define AUDIO_CORE_LPAIF_CODEC_SPKR_OSR_CBCR 0xA014
280#define AUDIO_CORE_LPAIF_CODEC_SPKR_IBIT_CBCR 0xA018
281#define AUDIO_CORE_LPAIF_CODEC_SPKR_EBIT_CBCR 0xA01C
282#define LPAIF_PRI_CMD_RCGR 0xB000
283#define AUDIO_CORE_LPAIF_PRI_OSR_CBCR 0xB014
284#define AUDIO_CORE_LPAIF_PRI_IBIT_CBCR 0xB018
285#define AUDIO_CORE_LPAIF_PRI_EBIT_CBCR 0xB01C
286#define LPAIF_SEC_CMD_RCGR 0xC000
287#define AUDIO_CORE_LPAIF_SEC_OSR_CBCR 0xC014
288#define AUDIO_CORE_LPAIF_SEC_IBIT_CBCR 0xC018
289#define AUDIO_CORE_LPAIF_SEC_EBIT_CBCR 0xC01C
290#define LPAIF_TER_CMD_RCGR 0xD000
291#define AUDIO_CORE_LPAIF_TER_OSR_CBCR 0xD014
292#define AUDIO_CORE_LPAIF_TER_IBIT_CBCR 0xD018
293#define AUDIO_CORE_LPAIF_TER_EBIT_CBCR 0xD01C
294#define LPAIF_QUAD_CMD_RCGR 0xE000
295#define AUDIO_CORE_LPAIF_QUAD_OSR_CBCR 0xE014
296#define AUDIO_CORE_LPAIF_QUAD_IBIT_CBCR 0xE018
297#define AUDIO_CORE_LPAIF_QUAD_EBIT_CBCR 0xE01C
298#define LPAIF_PCM0_CMD_RCGR 0xF000
299#define AUDIO_CORE_LPAIF_PCM0_IBIT_CBCR 0xF014
300#define AUDIO_CORE_LPAIF_PCM0_EBIT_CBCR 0xF018
301#define LPAIF_PCM1_CMD_RCGR 0x10000
302#define AUDIO_CORE_LPAIF_PCM1_IBIT_CBCR 0x10014
303#define AUDIO_CORE_LPAIF_PCM1_EBIT_CBCR 0x10018
304#define SLIMBUS_CMD_RCGR 0x12000
305#define AUDIO_CORE_SLIMBUS_CORE_CBCR 0x12014
306#define LPAIF_PCMOE_CMD_RCGR 0x13000
307#define AUDIO_CORE_LPAIF_PCM_DATA_OE_CBCR 0x13014
308#define Q6CORE_CMD_RCGR 0x14000
309#define SLEEP_CMD_RCGR 0x15000
310#define SPDM_CMD_RCGR 0x16000
311#define AUDIO_WRAPPER_SPDM_CBCR 0x16014
312#define XO_CMD_RCGR 0x17000
313#define AHBFABRIC_CMD_RCGR 0x18000
314#define AUDIO_CORE_LPM_CBCR 0x19000
315#define AUDIO_CORE_AVSYNC_CSR_CBCR 0x1A000
316#define AUDIO_CORE_AVSYNC_XO_CBCR 0x1A004
317#define AUDIO_CORE_AVSYNC_BT_XO_CBCR 0x1A008
318#define AUDIO_CORE_AVSYNC_FM_XO_CBCR 0x1A00C
319#define AUDIO_CORE_IXFABRIC_CBCR 0x1B000
320#define AUDIO_WRAPPER_EFABRIC_CBCR 0x1B004
321#define AUDIO_CORE_TCM_SLAVE_CBCR 0x1C000
322#define AUDIO_CORE_CSR_CBCR 0x1D000
323#define AUDIO_CORE_DML_CBCR 0x1E000
324#define AUDIO_CORE_SYSNOC_CBCR 0x1F000
325#define AUDIO_WRAPPER_SYSNOC_SWAY_CBCR 0x1F004
326#define AUDIO_CORE_TIMEOUT_CBCR 0x20000
327#define AUDIO_WRAPPER_TIMEOUT_CBCR 0x20004
328#define AUDIO_CORE_SECURITY_CBCR 0x21000
329#define AUDIO_WRAPPER_SECURITY_CBCR 0x21004
330#define Q6SS_AHB_LFABIF_CBCR 0x22000
331#define Q6SS_AHBM_CBCR 0x22004
332#define AUDIO_WRAPPER_LCC_CSR_CBCR 0x23000
333#define AUDIO_WRAPPER_BR_CBCR 0x24000
334#define AUDIO_WRAPPER_SMEM_CBCR 0x25000
335#define Q6SS_XO_CBCR 0x26000
336#define Q6SS_SLP_CBCR 0x26004
337#define LPASS_Q6SS_BCR 0x6000
338#define AUDIO_WRAPPER_STM_XO_CBCR 0x27000
339#define AUDIO_CORE_IXFABRIC_SPDMTM_CSR_CBCR 0x28000
340#define AUDIO_WRAPPER_EFABRIC_SPDMTM_CSR_CBCR 0x28004
341
342/* Mux source select values */
343#define gcc_xo_source_val 0
344#define gpll0_source_val 1
345#define gnd_source_val 5
346#define mmpll0_mm_source_val 1
347#define mmpll1_mm_source_val 2
348#define gpll0_mm_source_val 5
349#define gcc_xo_mm_source_val 0
350#define mm_gnd_source_val 6
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700351#define dsipll_mm_source_val 1
352
353#define F(f, s, div, m, n) \
354 { \
355 .freq_hz = (f), \
356 .src_clk = &s##_clk_src.c, \
357 .m_val = (m), \
358 .n_val = ~((n)-(m)) * !!(n), \
359 .d_val = ~(n),\
360 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
361 | BVAL(10, 8, s##_source_val), \
362 }
363
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800364#define F_APCS_PLL(f, l, m, n, pre_div, post_div, vco) \
365 { \
366 .freq_hz = (f), \
367 .l_val = (l), \
368 .m_val = (m), \
369 .n_val = (n), \
370 .pre_div_val = BVAL(12, 12, (pre_div)), \
371 .post_div_val = BVAL(9, 8, (post_div)), \
372 .vco_val = BVAL(29, 28, (vco)), \
373 }
374
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700375#define F_MM(f, s, div, m, n) \
376 { \
377 .freq_hz = (f), \
378 .src_clk = &s##_clk_src.c, \
379 .m_val = (m), \
380 .n_val = ~((n)-(m)) * !!(n), \
381 .d_val = ~(n),\
382 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
383 | BVAL(10, 8, s##_mm_source_val), \
384 }
385
386#define F_HDMI(f, s, div, m, n) \
387 { \
388 .freq_hz = (f), \
389 .src_clk = &s##_clk_src, \
390 .m_val = (m), \
391 .n_val = ~((n)-(m)) * !!(n), \
392 .d_val = ~(n),\
393 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
394 | BVAL(10, 8, s##_mm_source_val), \
395 }
396
397#define F_MDSS(f, s, div, m, n) \
398 { \
399 .freq_hz = (f), \
400 .m_val = (m), \
401 .n_val = ~((n)-(m)) * !!(n), \
402 .d_val = ~(n),\
403 .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
404 | BVAL(10, 8, s##_mm_source_val), \
405 }
406
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700407#define VDD_DIG_FMAX_MAP1(l1, f1) \
408 .vdd_class = &vdd_dig, \
409 .fmax = (unsigned long[VDD_DIG_NUM]) { \
410 [VDD_DIG_##l1] = (f1), \
411 }, \
412 .num_fmax = VDD_DIG_NUM
413#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
414 .vdd_class = &vdd_dig, \
415 .fmax = (unsigned long[VDD_DIG_NUM]) { \
416 [VDD_DIG_##l1] = (f1), \
417 [VDD_DIG_##l2] = (f2), \
418 }, \
419 .num_fmax = VDD_DIG_NUM
420#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
421 .vdd_class = &vdd_dig, \
422 .fmax = (unsigned long[VDD_DIG_NUM]) { \
423 [VDD_DIG_##l1] = (f1), \
424 [VDD_DIG_##l2] = (f2), \
425 [VDD_DIG_##l3] = (f3), \
426 }, \
427 .num_fmax = VDD_DIG_NUM
428
429enum vdd_dig_levels {
430 VDD_DIG_NONE,
431 VDD_DIG_LOW,
432 VDD_DIG_NOMINAL,
433 VDD_DIG_HIGH,
434 VDD_DIG_NUM
435};
436
Patrick Dalycbdceb72013-04-16 17:02:34 -0700437static int *vdd_corner[] = {
Patrick Dalyebc26bc2013-02-05 11:49:07 -0800438 [VDD_DIG_NONE] = VDD_UV(RPM_REGULATOR_CORNER_NONE),
439 [VDD_DIG_LOW] = VDD_UV(RPM_REGULATOR_CORNER_SVS_SOC),
440 [VDD_DIG_NOMINAL] = VDD_UV(RPM_REGULATOR_CORNER_NORMAL),
441 [VDD_DIG_HIGH] = VDD_UV(RPM_REGULATOR_CORNER_SUPER_TURBO),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700442};
443
Patrick Daly653c0b52013-04-16 17:18:28 -0700444static DEFINE_VDD_REGULATORS(vdd_dig, VDD_DIG_NUM, 1, vdd_corner, NULL);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700445
446#define RPM_MISC_CLK_TYPE 0x306b6c63
447#define RPM_BUS_CLK_TYPE 0x316b6c63
448#define RPM_MEM_CLK_TYPE 0x326b6c63
449
450#define RPM_SMD_KEY_ENABLE 0x62616E45
451
452#define CXO_ID 0x0
453#define QDSS_ID 0x1
454#define RPM_SCALING_ENABLE_ID 0x2
455
456#define PNOC_ID 0x0
457#define SNOC_ID 0x1
458#define CNOC_ID 0x2
459#define MMSSNOC_AHB_ID 0x3
460
461#define BIMC_ID 0x0
462#define OXILI_ID 0x1
463#define OCMEM_ID 0x2
464
465#define D0_ID 1
466#define D1_ID 2
Vikram Mulukutla7e5b3112013-04-15 16:32:40 -0700467#define A0_ID 4
468#define A1_ID 5
469#define A2_ID 6
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700470#define DIFF_CLK_ID 7
471#define DIV_CLK_ID 11
472
473DEFINE_CLK_RPM_SMD(pnoc_clk, pnoc_a_clk, RPM_BUS_CLK_TYPE, PNOC_ID, NULL);
474DEFINE_CLK_RPM_SMD(snoc_clk, snoc_a_clk, RPM_BUS_CLK_TYPE, SNOC_ID, NULL);
475DEFINE_CLK_RPM_SMD(cnoc_clk, cnoc_a_clk, RPM_BUS_CLK_TYPE, CNOC_ID, NULL);
476DEFINE_CLK_RPM_SMD(mmssnoc_ahb_clk, mmssnoc_ahb_a_clk, RPM_BUS_CLK_TYPE,
477 MMSSNOC_AHB_ID, NULL);
478
479DEFINE_CLK_RPM_SMD(bimc_clk, bimc_a_clk, RPM_MEM_CLK_TYPE, BIMC_ID, NULL);
480
481DEFINE_CLK_RPM_SMD_BRANCH(gcc_xo_clk_src, gcc_xo_a_clk_src,
482 RPM_MISC_CLK_TYPE, CXO_ID, 19200000);
483DEFINE_CLK_RPM_SMD_QDSS(qdss_clk, qdss_a_clk, RPM_MISC_CLK_TYPE, QDSS_ID);
484
485DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d0, cxo_d0_a, D0_ID);
486DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d1, cxo_d1_a, D1_ID);
487DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a0, cxo_a0_a, A0_ID);
488DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a1, cxo_a1_a, A1_ID);
489DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a2, cxo_a2_a, A2_ID);
490DEFINE_CLK_RPM_SMD_XO_BUFFER(div_clk, div_a_clk, DIV_CLK_ID);
491DEFINE_CLK_RPM_SMD_XO_BUFFER(diff_clk, diff_a_clk, DIFF_CLK_ID);
492
493DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d0_pin, cxo_d0_a_pin, D0_ID);
494DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d1_pin, cxo_d1_a_pin, D1_ID);
495DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a0_pin, cxo_a0_a_pin, A0_ID);
496DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a1_pin, cxo_a1_a_pin, A1_ID);
497DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a2_pin, cxo_a2_a_pin, A2_ID);
498
499static DEFINE_CLK_VOTER(pnoc_msmbus_clk, &pnoc_clk.c, LONG_MAX);
500static DEFINE_CLK_VOTER(snoc_msmbus_clk, &snoc_clk.c, LONG_MAX);
501static DEFINE_CLK_VOTER(cnoc_msmbus_clk, &cnoc_clk.c, LONG_MAX);
502static DEFINE_CLK_VOTER(pnoc_msmbus_a_clk, &pnoc_a_clk.c, LONG_MAX);
503static DEFINE_CLK_VOTER(snoc_msmbus_a_clk, &snoc_a_clk.c, LONG_MAX);
504static DEFINE_CLK_VOTER(cnoc_msmbus_a_clk, &cnoc_a_clk.c, LONG_MAX);
505
506static DEFINE_CLK_VOTER(bimc_msmbus_clk, &bimc_clk.c, LONG_MAX);
507static DEFINE_CLK_VOTER(bimc_msmbus_a_clk, &bimc_a_clk.c, LONG_MAX);
508static DEFINE_CLK_VOTER(bimc_acpu_a_clk, &bimc_a_clk.c, LONG_MAX);
509
510static DEFINE_CLK_VOTER(pnoc_sps_clk, &pnoc_clk.c, LONG_MAX);
511static DEFINE_CLK_VOTER(pnoc_iommu_clk, &pnoc_clk.c, LONG_MAX);
512static DEFINE_CLK_VOTER(pnoc_qseecom_clk, &pnoc_clk.c, LONG_MAX);
513
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800514static DEFINE_CLK_MEASURE(apc0_m_clk);
515static DEFINE_CLK_MEASURE(apc1_m_clk);
516static DEFINE_CLK_MEASURE(apc2_m_clk);
517static DEFINE_CLK_MEASURE(apc3_m_clk);
518static DEFINE_CLK_MEASURE(l2_m_clk);
519
520#define APCS_SH_PLL_MODE 0x000
521#define APCS_SH_PLL_L_VAL 0x004
522#define APCS_SH_PLL_M_VAL 0x008
523#define APCS_SH_PLL_N_VAL 0x00C
524#define APCS_SH_PLL_USER_CTL 0x010
525#define APCS_SH_PLL_CONFIG_CTL 0x014
526#define APCS_SH_PLL_STATUS 0x01C
527
528enum vdd_sr2_pll_levels {
529 VDD_SR2_PLL_OFF,
Patrick Daly6fb589a2013-03-29 17:55:55 -0700530 VDD_SR2_PLL_SVS,
531 VDD_SR2_PLL_NOM,
532 VDD_SR2_PLL_TUR,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800533 VDD_SR2_PLL_NUM
534};
535
Patrick Dalycbdceb72013-04-16 17:02:34 -0700536static int *vdd_sr2_levels[] = {
Patrick Daly6fb589a2013-03-29 17:55:55 -0700537 [VDD_SR2_PLL_OFF] = VDD_UV(0, RPM_REGULATOR_CORNER_NONE),
538 [VDD_SR2_PLL_SVS] = VDD_UV(1800000, RPM_REGULATOR_CORNER_SVS_SOC),
539 [VDD_SR2_PLL_NOM] = VDD_UV(1800000, RPM_REGULATOR_CORNER_NORMAL),
540 [VDD_SR2_PLL_TUR] = VDD_UV(1800000, RPM_REGULATOR_CORNER_SUPER_TURBO),
Patrick Dalyebc26bc2013-02-05 11:49:07 -0800541};
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800542
Patrick Daly653c0b52013-04-16 17:18:28 -0700543static DEFINE_VDD_REGULATORS(vdd_sr2_pll, VDD_SR2_PLL_NUM, 2,
544 vdd_sr2_levels, NULL);
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800545
546static struct pll_freq_tbl apcs_pll_freq[] = {
547 F_APCS_PLL( 384000000, 20, 0x0, 0x1, 0x0, 0x0, 0x0),
548 F_APCS_PLL( 787200000, 41, 0x0, 0x1, 0x0, 0x0, 0x0),
549 F_APCS_PLL( 998400000, 52, 0x0, 0x1, 0x0, 0x0, 0x0),
550 F_APCS_PLL(1190400000, 62, 0x0, 0x1, 0x0, 0x0, 0x0),
551 PLL_F_END
552};
553
554static struct pll_clk a7sspll = {
555 .mode_reg = (void __iomem *)APCS_SH_PLL_MODE,
556 .l_reg = (void __iomem *)APCS_SH_PLL_L_VAL,
557 .m_reg = (void __iomem *)APCS_SH_PLL_M_VAL,
558 .n_reg = (void __iomem *)APCS_SH_PLL_N_VAL,
559 .config_reg = (void __iomem *)APCS_SH_PLL_USER_CTL,
560 .status_reg = (void __iomem *)APCS_SH_PLL_STATUS,
561 .freq_tbl = apcs_pll_freq,
562 .masks = {
563 .vco_mask = BM(29, 28),
564 .pre_div_mask = BIT(12),
565 .post_div_mask = BM(9, 8),
566 .mn_en_mask = BIT(24),
567 .main_output_mask = BIT(0),
568 },
569 .base = &virt_bases[APCS_PLL_BASE],
570 .c = {
Patrick Daly9bdc8a52013-03-21 19:12:40 -0700571 .parent = &gcc_xo_a_clk_src.c,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800572 .dbg_name = "a7sspll",
573 .ops = &clk_ops_sr2_pll,
574 .vdd_class = &vdd_sr2_pll,
575 .fmax = (unsigned long [VDD_SR2_PLL_NUM]) {
Patrick Daly6fb589a2013-03-29 17:55:55 -0700576 [VDD_SR2_PLL_SVS] = 1000000000,
577 [VDD_SR2_PLL_NOM] = 1900000000,
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800578 },
579 .num_fmax = VDD_SR2_PLL_NUM,
580 CLK_INIT(a7sspll.c),
581 /*
582 * Need to skip handoff of the acpu pll to avoid
583 * turning off the pll when the cpu is using it
584 */
585 .flags = CLKFLAG_SKIP_HANDOFF,
586 },
587};
588
589static unsigned int soft_vote_gpll0;
590
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700591static struct pll_vote_clk gpll0_clk_src = {
592 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
593 .en_mask = BIT(0),
594 .status_reg = (void __iomem *)GPLL0_STATUS,
595 .status_mask = BIT(17),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800596 .soft_vote = &soft_vote_gpll0,
597 .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700598 .base = &virt_bases[GCC_BASE],
599 .c = {
600 .parent = &gcc_xo_clk_src.c,
601 .rate = 600000000,
602 .dbg_name = "gpll0_clk_src",
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800603 .ops = &clk_ops_pll_acpu_vote,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700604 CLK_INIT(gpll0_clk_src.c),
605 },
606};
607
Vikram Mulukutla4157cca2013-01-24 15:42:41 -0800608static struct pll_vote_clk gpll0_ao_clk_src = {
609 .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE,
610 .en_mask = BIT(0),
611 .status_reg = (void __iomem *)GPLL0_STATUS,
612 .status_mask = BIT(17),
613 .soft_vote = &soft_vote_gpll0,
614 .soft_vote_mask = PLL_SOFT_VOTE_ACPU,
615 .base = &virt_bases[GCC_BASE],
616 .c = {
617 .rate = 600000000,
618 .dbg_name = "gpll0_ao_clk_src",
619 .ops = &clk_ops_pll_acpu_vote,
620 CLK_INIT(gpll0_ao_clk_src.c),
621 },
622};
623
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700624static struct pll_vote_clk mmpll0_clk_src = {
625 .en_reg = (void __iomem *)MMSS_PLL_VOTE_APCS_REG,
626 .en_mask = BIT(0),
627 .status_reg = (void __iomem *)MMPLL0_PLL_STATUS,
628 .status_mask = BIT(17),
629 .base = &virt_bases[MMSS_BASE],
630 .c = {
631 .parent = &gcc_xo_clk_src.c,
632 .dbg_name = "mmpll0_clk_src",
633 .rate = 800000000,
634 .ops = &clk_ops_pll_vote,
635 CLK_INIT(mmpll0_clk_src.c),
636 },
637};
638
639static struct pll_config_regs mmpll0_regs __initdata = {
640 .l_reg = (void __iomem *)MMPLL0_PLL_L_VAL,
641 .m_reg = (void __iomem *)MMPLL0_PLL_M_VAL,
642 .n_reg = (void __iomem *)MMPLL0_PLL_N_VAL,
643 .config_reg = (void __iomem *)MMPLL0_PLL_USER_CTL,
644 .mode_reg = (void __iomem *)MMPLL0_PLL_MODE,
645 .base = &virt_bases[MMSS_BASE],
646};
647
648static struct pll_clk mmpll1_clk_src = {
649 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
650 .status_reg = (void __iomem *)MMPLL1_PLL_STATUS,
651 .base = &virt_bases[MMSS_BASE],
652 .c = {
653 .parent = &gcc_xo_clk_src.c,
654 .dbg_name = "mmpll1_clk_src",
655 .rate = 1200000000,
656 .ops = &clk_ops_local_pll,
657 CLK_INIT(mmpll1_clk_src.c),
658 },
659};
660
661static struct pll_config_regs mmpll1_regs __initdata = {
662 .l_reg = (void __iomem *)MMPLL1_PLL_L_VAL,
663 .m_reg = (void __iomem *)MMPLL1_PLL_M_VAL,
664 .n_reg = (void __iomem *)MMPLL1_PLL_N_VAL,
665 .config_reg = (void __iomem *)MMPLL1_PLL_USER_CTL,
666 .mode_reg = (void __iomem *)MMPLL1_PLL_MODE,
667 .base = &virt_bases[MMSS_BASE],
668};
669
Vikram Mulukutlab13abe42012-10-03 11:38:48 -0700670static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = {
671 F( 960000, gcc_xo, 10, 1, 2),
672 F( 4800000, gcc_xo, 4, 0, 0),
673 F( 9600000, gcc_xo, 2, 0, 0),
674 F(15000000, gpll0, 10, 1, 4),
675 F(19200000, gcc_xo, 1, 0, 0),
676 F(25000000, gpll0, 12, 1, 2),
677 F(50000000, gpll0, 12, 0, 0),
678 F_END,
679};
680
681static struct rcg_clk blsp1_qup1_spi_apps_clk_src = {
682 .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR,
683 .set_rate = set_rate_mnd,
684 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
685 .current_freq = &rcg_dummy_freq,
686 .base = &virt_bases[GCC_BASE],
687 .c = {
688 .dbg_name = "blsp1_qup1_spi_apps_clk_src",
689 .ops = &clk_ops_rcg_mnd,
690 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
691 CLK_INIT(blsp1_qup1_spi_apps_clk_src.c),
692 },
693};
694
695static struct rcg_clk blsp1_qup2_spi_apps_clk_src = {
696 .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR,
697 .set_rate = set_rate_mnd,
698 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
699 .current_freq = &rcg_dummy_freq,
700 .base = &virt_bases[GCC_BASE],
701 .c = {
702 .dbg_name = "blsp1_qup2_spi_apps_clk_src",
703 .ops = &clk_ops_rcg_mnd,
704 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
705 CLK_INIT(blsp1_qup2_spi_apps_clk_src.c),
706 },
707};
708
709static struct rcg_clk blsp1_qup3_spi_apps_clk_src = {
710 .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR,
711 .set_rate = set_rate_mnd,
712 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
713 .current_freq = &rcg_dummy_freq,
714 .base = &virt_bases[GCC_BASE],
715 .c = {
716 .dbg_name = "blsp1_qup3_spi_apps_clk_src",
717 .ops = &clk_ops_rcg_mnd,
718 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
719 CLK_INIT(blsp1_qup3_spi_apps_clk_src.c),
720 },
721};
722
723static struct rcg_clk blsp1_qup4_spi_apps_clk_src = {
724 .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR,
725 .set_rate = set_rate_mnd,
726 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
727 .current_freq = &rcg_dummy_freq,
728 .base = &virt_bases[GCC_BASE],
729 .c = {
730 .dbg_name = "blsp1_qup4_spi_apps_clk_src",
731 .ops = &clk_ops_rcg_mnd,
732 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
733 CLK_INIT(blsp1_qup4_spi_apps_clk_src.c),
734 },
735};
736
737static struct rcg_clk blsp1_qup5_spi_apps_clk_src = {
738 .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR,
739 .set_rate = set_rate_mnd,
740 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
741 .current_freq = &rcg_dummy_freq,
742 .base = &virt_bases[GCC_BASE],
743 .c = {
744 .dbg_name = "blsp1_qup5_spi_apps_clk_src",
745 .ops = &clk_ops_rcg_mnd,
746 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
747 CLK_INIT(blsp1_qup5_spi_apps_clk_src.c),
748 },
749};
750
751static struct rcg_clk blsp1_qup6_spi_apps_clk_src = {
752 .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR,
753 .set_rate = set_rate_mnd,
754 .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk,
755 .current_freq = &rcg_dummy_freq,
756 .base = &virt_bases[GCC_BASE],
757 .c = {
758 .dbg_name = "blsp1_qup6_spi_apps_clk_src",
759 .ops = &clk_ops_rcg_mnd,
760 VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000),
761 CLK_INIT(blsp1_qup6_spi_apps_clk_src.c),
762 },
763};
764
765static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = {
766 F( 3686400, gpll0, 1, 96, 15625),
767 F( 7372800, gpll0, 1, 192, 15625),
768 F(14745600, gpll0, 1, 384, 15625),
769 F(16000000, gpll0, 5, 2, 15),
770 F(19200000, gcc_xo, 1, 0, 0),
771 F(24000000, gpll0, 5, 1, 5),
772 F(32000000, gpll0, 1, 4, 75),
773 F(40000000, gpll0, 15, 0, 0),
774 F(46400000, gpll0, 1, 29, 375),
775 F(48000000, gpll0, 12.5, 0, 0),
776 F(51200000, gpll0, 1, 32, 375),
777 F(56000000, gpll0, 1, 7, 75),
778 F(58982400, gpll0, 1, 1536, 15625),
779 F(60000000, gpll0, 10, 0, 0),
780 F_END,
781};
782
783static struct rcg_clk blsp1_uart1_apps_clk_src = {
784 .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR,
785 .set_rate = set_rate_mnd,
786 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
787 .current_freq = &rcg_dummy_freq,
788 .base = &virt_bases[GCC_BASE],
789 .c = {
790 .dbg_name = "blsp1_uart1_apps_clk_src",
791 .ops = &clk_ops_rcg_mnd,
792 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
793 CLK_INIT(blsp1_uart1_apps_clk_src.c),
794 },
795};
796
797static struct rcg_clk blsp1_uart2_apps_clk_src = {
798 .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR,
799 .set_rate = set_rate_mnd,
800 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
801 .current_freq = &rcg_dummy_freq,
802 .base = &virt_bases[GCC_BASE],
803 .c = {
804 .dbg_name = "blsp1_uart2_apps_clk_src",
805 .ops = &clk_ops_rcg_mnd,
806 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
807 CLK_INIT(blsp1_uart2_apps_clk_src.c),
808 },
809};
810
811static struct rcg_clk blsp1_uart3_apps_clk_src = {
812 .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR,
813 .set_rate = set_rate_mnd,
814 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
815 .current_freq = &rcg_dummy_freq,
816 .base = &virt_bases[GCC_BASE],
817 .c = {
818 .dbg_name = "blsp1_uart3_apps_clk_src",
819 .ops = &clk_ops_rcg_mnd,
820 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
821 CLK_INIT(blsp1_uart3_apps_clk_src.c),
822 },
823};
824
825static struct rcg_clk blsp1_uart4_apps_clk_src = {
826 .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR,
827 .set_rate = set_rate_mnd,
828 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
829 .current_freq = &rcg_dummy_freq,
830 .base = &virt_bases[GCC_BASE],
831 .c = {
832 .dbg_name = "blsp1_uart4_apps_clk_src",
833 .ops = &clk_ops_rcg_mnd,
834 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
835 CLK_INIT(blsp1_uart4_apps_clk_src.c),
836 },
837};
838
839static struct rcg_clk blsp1_uart5_apps_clk_src = {
840 .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR,
841 .set_rate = set_rate_mnd,
842 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
843 .current_freq = &rcg_dummy_freq,
844 .base = &virt_bases[GCC_BASE],
845 .c = {
846 .dbg_name = "blsp1_uart5_apps_clk_src",
847 .ops = &clk_ops_rcg_mnd,
848 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
849 CLK_INIT(blsp1_uart5_apps_clk_src.c),
850 },
851};
852
853static struct rcg_clk blsp1_uart6_apps_clk_src = {
854 .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR,
855 .set_rate = set_rate_mnd,
856 .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk,
857 .current_freq = &rcg_dummy_freq,
858 .base = &virt_bases[GCC_BASE],
859 .c = {
860 .dbg_name = "blsp1_uart6_apps_clk_src",
861 .ops = &clk_ops_rcg_mnd,
862 VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000),
863 CLK_INIT(blsp1_uart6_apps_clk_src.c),
864 },
865};
866
867static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = {
868 F(50000000, gpll0, 12, 0, 0),
869 F(100000000, gpll0, 6, 0, 0),
870 F_END,
871};
872
873static struct rcg_clk ce1_clk_src = {
874 .cmd_rcgr_reg = CE1_CMD_RCGR,
875 .set_rate = set_rate_hid,
876 .freq_tbl = ftbl_gcc_ce1_clk,
877 .current_freq = &rcg_dummy_freq,
878 .base = &virt_bases[GCC_BASE],
879 .c = {
880 .dbg_name = "ce1_clk_src",
881 .ops = &clk_ops_rcg,
882 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
883 CLK_INIT(ce1_clk_src.c),
884 },
885};
886
887static struct clk_freq_tbl ftbl_gcc_gp1_3_clk[] = {
888 F(19200000, gcc_xo, 1, 0, 0),
889 F_END,
890};
891
892static struct rcg_clk gp1_clk_src = {
893 .cmd_rcgr_reg = GP1_CMD_RCGR,
894 .set_rate = set_rate_mnd,
895 .freq_tbl = ftbl_gcc_gp1_3_clk,
896 .current_freq = &rcg_dummy_freq,
897 .base = &virt_bases[GCC_BASE],
898 .c = {
899 .dbg_name = "gp1_clk_src",
900 .ops = &clk_ops_rcg_mnd,
901 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
902 CLK_INIT(gp1_clk_src.c),
903 },
904};
905
906static struct rcg_clk gp2_clk_src = {
907 .cmd_rcgr_reg = GP2_CMD_RCGR,
908 .set_rate = set_rate_mnd,
909 .freq_tbl = ftbl_gcc_gp1_3_clk,
910 .current_freq = &rcg_dummy_freq,
911 .base = &virt_bases[GCC_BASE],
912 .c = {
913 .dbg_name = "gp2_clk_src",
914 .ops = &clk_ops_rcg_mnd,
915 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
916 CLK_INIT(gp2_clk_src.c),
917 },
918};
919
920static struct rcg_clk gp3_clk_src = {
921 .cmd_rcgr_reg = GP3_CMD_RCGR,
922 .set_rate = set_rate_mnd,
923 .freq_tbl = ftbl_gcc_gp1_3_clk,
924 .current_freq = &rcg_dummy_freq,
925 .base = &virt_bases[GCC_BASE],
926 .c = {
927 .dbg_name = "gp3_clk_src",
928 .ops = &clk_ops_rcg_mnd,
929 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
930 CLK_INIT(gp3_clk_src.c),
931 },
932};
933
934static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = {
935 F(60000000, gpll0, 10, 0, 0),
936 F_END,
937};
938
939static struct rcg_clk pdm2_clk_src = {
940 .cmd_rcgr_reg = PDM2_CMD_RCGR,
941 .set_rate = set_rate_hid,
942 .freq_tbl = ftbl_gcc_pdm2_clk,
943 .current_freq = &rcg_dummy_freq,
944 .base = &virt_bases[GCC_BASE],
945 .c = {
946 .dbg_name = "pdm2_clk_src",
947 .ops = &clk_ops_rcg,
948 VDD_DIG_FMAX_MAP1(LOW, 120000000),
949 CLK_INIT(pdm2_clk_src.c),
950 },
951};
952
953static struct clk_freq_tbl ftbl_gcc_sdcc1_2_apps_clk[] = {
954 F( 144000, gcc_xo, 16, 3, 25),
955 F( 400000, gcc_xo, 12, 1, 4),
956 F( 20000000, gpll0, 15, 1, 2),
957 F( 25000000, gpll0, 12, 1, 2),
958 F( 50000000, gpll0, 12, 0, 0),
959 F(100000000, gpll0, 6, 0, 0),
960 F(200000000, gpll0, 3, 0, 0),
961 F_END,
962};
963
964static struct rcg_clk sdcc1_apps_clk_src = {
965 .cmd_rcgr_reg = SDCC1_APPS_CMD_RCGR,
966 .set_rate = set_rate_mnd,
967 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
968 .current_freq = &rcg_dummy_freq,
969 .base = &virt_bases[GCC_BASE],
970 .c = {
971 .dbg_name = "sdcc1_apps_clk_src",
972 .ops = &clk_ops_rcg_mnd,
973 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
974 CLK_INIT(sdcc1_apps_clk_src.c),
975 },
976};
977
978static struct rcg_clk sdcc2_apps_clk_src = {
979 .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR,
980 .set_rate = set_rate_mnd,
981 .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk,
982 .current_freq = &rcg_dummy_freq,
983 .base = &virt_bases[GCC_BASE],
984 .c = {
985 .dbg_name = "sdcc2_apps_clk_src",
986 .ops = &clk_ops_rcg_mnd,
987 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
988 CLK_INIT(sdcc2_apps_clk_src.c),
989 },
990};
991
992static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = {
993 F(75000000, gpll0, 8, 0, 0),
994 F_END,
995};
996
997static struct rcg_clk usb_hs_system_clk_src = {
998 .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR,
999 .set_rate = set_rate_hid,
1000 .freq_tbl = ftbl_gcc_usb_hs_system_clk,
1001 .current_freq = &rcg_dummy_freq,
1002 .base = &virt_bases[GCC_BASE],
1003 .c = {
1004 .dbg_name = "usb_hs_system_clk_src",
1005 .ops = &clk_ops_rcg,
1006 VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 100000000),
1007 CLK_INIT(usb_hs_system_clk_src.c),
1008 },
1009};
1010
1011static struct local_vote_clk gcc_blsp1_ahb_clk = {
1012 .cbcr_reg = BLSP1_AHB_CBCR,
1013 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1014 .en_mask = BIT(17),
1015 .base = &virt_bases[GCC_BASE],
1016 .c = {
1017 .dbg_name = "gcc_blsp1_ahb_clk",
1018 .ops = &clk_ops_vote,
1019 CLK_INIT(gcc_blsp1_ahb_clk.c),
1020 },
1021};
1022
1023static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = {
1024 .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR,
1025 .has_sibling = 1,
1026 .base = &virt_bases[GCC_BASE],
1027 .c = {
1028 .parent = &gcc_xo_clk_src.c,
1029 .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk",
1030 .ops = &clk_ops_branch,
1031 CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c),
1032 },
1033};
1034
1035static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = {
1036 .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR,
1037 .has_sibling = 0,
1038 .base = &virt_bases[GCC_BASE],
1039 .c = {
1040 .parent = &blsp1_qup1_spi_apps_clk_src.c,
1041 .dbg_name = "gcc_blsp1_qup1_spi_apps_clk",
1042 .ops = &clk_ops_branch,
1043 CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c),
1044 },
1045};
1046
1047static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = {
1048 .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR,
1049 .has_sibling = 1,
1050 .base = &virt_bases[GCC_BASE],
1051 .c = {
1052 .parent = &gcc_xo_clk_src.c,
1053 .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk",
1054 .ops = &clk_ops_branch,
1055 CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c),
1056 },
1057};
1058
1059static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = {
1060 .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR,
1061 .has_sibling = 0,
1062 .base = &virt_bases[GCC_BASE],
1063 .c = {
1064 .parent = &blsp1_qup2_spi_apps_clk_src.c,
1065 .dbg_name = "gcc_blsp1_qup2_spi_apps_clk",
1066 .ops = &clk_ops_branch,
1067 CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c),
1068 },
1069};
1070
1071static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = {
1072 .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR,
1073 .has_sibling = 1,
1074 .base = &virt_bases[GCC_BASE],
1075 .c = {
1076 .parent = &gcc_xo_clk_src.c,
1077 .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk",
1078 .ops = &clk_ops_branch,
1079 CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c),
1080 },
1081};
1082
1083static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = {
1084 .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR,
1085 .has_sibling = 0,
1086 .base = &virt_bases[GCC_BASE],
1087 .c = {
1088 .parent = &blsp1_qup3_spi_apps_clk_src.c,
1089 .dbg_name = "gcc_blsp1_qup3_spi_apps_clk",
1090 .ops = &clk_ops_branch,
1091 CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c),
1092 },
1093};
1094
1095static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = {
1096 .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR,
1097 .has_sibling = 1,
1098 .base = &virt_bases[GCC_BASE],
1099 .c = {
1100 .parent = &gcc_xo_clk_src.c,
1101 .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk",
1102 .ops = &clk_ops_branch,
1103 CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c),
1104 },
1105};
1106
1107static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = {
1108 .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR,
1109 .has_sibling = 0,
1110 .base = &virt_bases[GCC_BASE],
1111 .c = {
1112 .parent = &blsp1_qup4_spi_apps_clk_src.c,
1113 .dbg_name = "gcc_blsp1_qup4_spi_apps_clk",
1114 .ops = &clk_ops_branch,
1115 CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c),
1116 },
1117};
1118
1119static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = {
1120 .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR,
1121 .has_sibling = 1,
1122 .base = &virt_bases[GCC_BASE],
1123 .c = {
1124 .parent = &gcc_xo_clk_src.c,
1125 .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk",
1126 .ops = &clk_ops_branch,
1127 CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c),
1128 },
1129};
1130
1131static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = {
1132 .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR,
1133 .has_sibling = 0,
1134 .base = &virt_bases[GCC_BASE],
1135 .c = {
1136 .parent = &blsp1_qup5_spi_apps_clk_src.c,
1137 .dbg_name = "gcc_blsp1_qup5_spi_apps_clk",
1138 .ops = &clk_ops_branch,
1139 CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c),
1140 },
1141};
1142
1143static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = {
1144 .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR,
1145 .has_sibling = 1,
1146 .base = &virt_bases[GCC_BASE],
1147 .c = {
1148 .parent = &gcc_xo_clk_src.c,
1149 .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk",
1150 .ops = &clk_ops_branch,
1151 CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c),
1152 },
1153};
1154
1155static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = {
1156 .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR,
1157 .has_sibling = 0,
1158 .base = &virt_bases[GCC_BASE],
1159 .c = {
1160 .parent = &blsp1_qup6_spi_apps_clk_src.c,
1161 .dbg_name = "gcc_blsp1_qup6_spi_apps_clk",
1162 .ops = &clk_ops_branch,
1163 CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c),
1164 },
1165};
1166
1167static struct branch_clk gcc_blsp1_uart1_apps_clk = {
1168 .cbcr_reg = BLSP1_UART1_APPS_CBCR,
1169 .has_sibling = 0,
1170 .base = &virt_bases[GCC_BASE],
1171 .c = {
1172 .parent = &blsp1_uart1_apps_clk_src.c,
1173 .dbg_name = "gcc_blsp1_uart1_apps_clk",
1174 .ops = &clk_ops_branch,
1175 CLK_INIT(gcc_blsp1_uart1_apps_clk.c),
1176 },
1177};
1178
1179static struct branch_clk gcc_blsp1_uart2_apps_clk = {
1180 .cbcr_reg = BLSP1_UART2_APPS_CBCR,
1181 .has_sibling = 0,
1182 .base = &virt_bases[GCC_BASE],
1183 .c = {
1184 .parent = &blsp1_uart2_apps_clk_src.c,
1185 .dbg_name = "gcc_blsp1_uart2_apps_clk",
1186 .ops = &clk_ops_branch,
1187 CLK_INIT(gcc_blsp1_uart2_apps_clk.c),
1188 },
1189};
1190
1191static struct branch_clk gcc_blsp1_uart3_apps_clk = {
1192 .cbcr_reg = BLSP1_UART3_APPS_CBCR,
1193 .has_sibling = 0,
1194 .base = &virt_bases[GCC_BASE],
1195 .c = {
1196 .parent = &blsp1_uart3_apps_clk_src.c,
1197 .dbg_name = "gcc_blsp1_uart3_apps_clk",
1198 .ops = &clk_ops_branch,
1199 CLK_INIT(gcc_blsp1_uart3_apps_clk.c),
1200 },
1201};
1202
1203static struct branch_clk gcc_blsp1_uart4_apps_clk = {
1204 .cbcr_reg = BLSP1_UART4_APPS_CBCR,
1205 .has_sibling = 0,
1206 .base = &virt_bases[GCC_BASE],
1207 .c = {
1208 .parent = &blsp1_uart4_apps_clk_src.c,
1209 .dbg_name = "gcc_blsp1_uart4_apps_clk",
1210 .ops = &clk_ops_branch,
1211 CLK_INIT(gcc_blsp1_uart4_apps_clk.c),
1212 },
1213};
1214
1215static struct branch_clk gcc_blsp1_uart5_apps_clk = {
1216 .cbcr_reg = BLSP1_UART5_APPS_CBCR,
1217 .has_sibling = 0,
1218 .base = &virt_bases[GCC_BASE],
1219 .c = {
1220 .parent = &blsp1_uart5_apps_clk_src.c,
1221 .dbg_name = "gcc_blsp1_uart5_apps_clk",
1222 .ops = &clk_ops_branch,
1223 CLK_INIT(gcc_blsp1_uart5_apps_clk.c),
1224 },
1225};
1226
1227static struct branch_clk gcc_blsp1_uart6_apps_clk = {
1228 .cbcr_reg = BLSP1_UART6_APPS_CBCR,
1229 .has_sibling = 0,
1230 .base = &virt_bases[GCC_BASE],
1231 .c = {
1232 .parent = &blsp1_uart6_apps_clk_src.c,
1233 .dbg_name = "gcc_blsp1_uart6_apps_clk",
1234 .ops = &clk_ops_branch,
1235 CLK_INIT(gcc_blsp1_uart6_apps_clk.c),
1236 },
1237};
1238
1239static struct local_vote_clk gcc_boot_rom_ahb_clk = {
1240 .cbcr_reg = BOOT_ROM_AHB_CBCR,
1241 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1242 .en_mask = BIT(10),
1243 .base = &virt_bases[GCC_BASE],
1244 .c = {
1245 .dbg_name = "gcc_boot_rom_ahb_clk",
1246 .ops = &clk_ops_vote,
1247 CLK_INIT(gcc_boot_rom_ahb_clk.c),
1248 },
1249};
1250
1251static struct local_vote_clk gcc_ce1_ahb_clk = {
1252 .cbcr_reg = CE1_AHB_CBCR,
1253 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1254 .en_mask = BIT(3),
1255 .base = &virt_bases[GCC_BASE],
1256 .c = {
1257 .dbg_name = "gcc_ce1_ahb_clk",
1258 .ops = &clk_ops_vote,
1259 CLK_INIT(gcc_ce1_ahb_clk.c),
1260 },
1261};
1262
1263static struct local_vote_clk gcc_ce1_axi_clk = {
1264 .cbcr_reg = CE1_AXI_CBCR,
1265 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1266 .en_mask = BIT(4),
1267 .base = &virt_bases[GCC_BASE],
1268 .c = {
1269 .dbg_name = "gcc_ce1_axi_clk",
1270 .ops = &clk_ops_vote,
1271 CLK_INIT(gcc_ce1_axi_clk.c),
1272 },
1273};
1274
1275static struct local_vote_clk gcc_ce1_clk = {
1276 .cbcr_reg = CE1_CBCR,
1277 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1278 .en_mask = BIT(5),
1279 .base = &virt_bases[GCC_BASE],
1280 .c = {
1281 .dbg_name = "gcc_ce1_clk",
1282 .ops = &clk_ops_vote,
1283 CLK_INIT(gcc_ce1_clk.c),
1284 },
1285};
1286
1287static struct branch_clk gcc_copss_smmu_ahb_clk = {
1288 .cbcr_reg = COPSS_SMMU_AHB_CBCR,
1289 .has_sibling = 1,
1290 .base = &virt_bases[GCC_BASE],
1291 .c = {
1292 .dbg_name = "gcc_copss_smmu_ahb_clk",
1293 .ops = &clk_ops_branch,
1294 CLK_INIT(gcc_copss_smmu_ahb_clk.c),
1295 },
1296};
1297
1298static struct branch_clk gcc_lpss_smmu_ahb_clk = {
1299 .cbcr_reg = LPSS_SMMU_AHB_CBCR,
1300 .has_sibling = 1,
1301 .base = &virt_bases[GCC_BASE],
1302 .c = {
1303 .dbg_name = "gcc_lpss_smmu_ahb_clk",
1304 .ops = &clk_ops_branch,
1305 CLK_INIT(gcc_lpss_smmu_ahb_clk.c),
1306 },
1307};
1308
1309static struct branch_clk gcc_gp1_clk = {
1310 .cbcr_reg = GP1_CBCR,
1311 .has_sibling = 0,
1312 .base = &virt_bases[GCC_BASE],
1313 .c = {
1314 .parent = &gp1_clk_src.c,
1315 .dbg_name = "gcc_gp1_clk",
1316 .ops = &clk_ops_branch,
1317 CLK_INIT(gcc_gp1_clk.c),
1318 },
1319};
1320
1321static struct branch_clk gcc_gp2_clk = {
1322 .cbcr_reg = GP2_CBCR,
1323 .has_sibling = 0,
1324 .base = &virt_bases[GCC_BASE],
1325 .c = {
1326 .parent = &gp2_clk_src.c,
1327 .dbg_name = "gcc_gp2_clk",
1328 .ops = &clk_ops_branch,
1329 CLK_INIT(gcc_gp2_clk.c),
1330 },
1331};
1332
1333static struct branch_clk gcc_gp3_clk = {
1334 .cbcr_reg = GP3_CBCR,
1335 .has_sibling = 0,
1336 .base = &virt_bases[GCC_BASE],
1337 .c = {
1338 .parent = &gp3_clk_src.c,
1339 .dbg_name = "gcc_gp3_clk",
1340 .ops = &clk_ops_branch,
1341 CLK_INIT(gcc_gp3_clk.c),
1342 },
1343};
1344
1345static struct branch_clk gcc_lpass_q6_axi_clk = {
1346 .cbcr_reg = LPASS_Q6_AXI_CBCR,
1347 .has_sibling = 1,
1348 .base = &virt_bases[GCC_BASE],
Vikram Mulukutla2dfa8b12013-01-15 18:17:10 -08001349 /* FIXME: Remove this once simulation is fixed. */
1350 .halt_check = DELAY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001351 .c = {
1352 .dbg_name = "gcc_lpass_q6_axi_clk",
1353 .ops = &clk_ops_branch,
1354 CLK_INIT(gcc_lpass_q6_axi_clk.c),
1355 },
1356};
1357
1358static struct branch_clk gcc_mmss_noc_cfg_ahb_clk = {
1359 .cbcr_reg = MMSS_NOC_CFG_AHB_CBCR,
1360 .has_sibling = 1,
1361 .base = &virt_bases[GCC_BASE],
1362 .c = {
1363 .dbg_name = "gcc_mmss_noc_cfg_ahb_clk",
1364 .ops = &clk_ops_branch,
1365 CLK_INIT(gcc_mmss_noc_cfg_ahb_clk.c),
1366 },
1367};
1368
1369static struct branch_clk gcc_mss_cfg_ahb_clk = {
1370 .cbcr_reg = MSS_CFG_AHB_CBCR,
1371 .has_sibling = 1,
1372 .base = &virt_bases[GCC_BASE],
1373 .c = {
1374 .dbg_name = "gcc_mss_cfg_ahb_clk",
1375 .ops = &clk_ops_branch,
1376 CLK_INIT(gcc_mss_cfg_ahb_clk.c),
1377 },
1378};
1379
1380static struct branch_clk gcc_mss_q6_bimc_axi_clk = {
1381 .cbcr_reg = MSS_Q6_BIMC_AXI_CBCR,
1382 .has_sibling = 1,
1383 .base = &virt_bases[GCC_BASE],
1384 .c = {
1385 .dbg_name = "gcc_mss_q6_bimc_axi_clk",
1386 .ops = &clk_ops_branch,
1387 CLK_INIT(gcc_mss_q6_bimc_axi_clk.c),
1388 },
1389};
1390
1391static struct branch_clk gcc_pdm2_clk = {
1392 .cbcr_reg = PDM2_CBCR,
1393 .has_sibling = 0,
1394 .base = &virt_bases[GCC_BASE],
1395 .c = {
1396 .parent = &pdm2_clk_src.c,
1397 .dbg_name = "gcc_pdm2_clk",
1398 .ops = &clk_ops_branch,
1399 CLK_INIT(gcc_pdm2_clk.c),
1400 },
1401};
1402
1403static struct branch_clk gcc_pdm_ahb_clk = {
1404 .cbcr_reg = PDM_AHB_CBCR,
1405 .has_sibling = 1,
1406 .base = &virt_bases[GCC_BASE],
1407 .c = {
1408 .dbg_name = "gcc_pdm_ahb_clk",
1409 .ops = &clk_ops_branch,
1410 CLK_INIT(gcc_pdm_ahb_clk.c),
1411 },
1412};
1413
1414static struct local_vote_clk gcc_prng_ahb_clk = {
1415 .cbcr_reg = PRNG_AHB_CBCR,
1416 .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE,
1417 .en_mask = BIT(13),
1418 .base = &virt_bases[GCC_BASE],
1419 .c = {
1420 .dbg_name = "gcc_prng_ahb_clk",
1421 .ops = &clk_ops_vote,
1422 CLK_INIT(gcc_prng_ahb_clk.c),
1423 },
1424};
1425
1426static struct branch_clk gcc_sdcc1_ahb_clk = {
1427 .cbcr_reg = SDCC1_AHB_CBCR,
1428 .has_sibling = 1,
1429 .base = &virt_bases[GCC_BASE],
1430 .c = {
1431 .dbg_name = "gcc_sdcc1_ahb_clk",
1432 .ops = &clk_ops_branch,
1433 CLK_INIT(gcc_sdcc1_ahb_clk.c),
1434 },
1435};
1436
1437static struct branch_clk gcc_sdcc1_apps_clk = {
1438 .cbcr_reg = SDCC1_APPS_CBCR,
1439 .has_sibling = 0,
1440 .base = &virt_bases[GCC_BASE],
1441 .c = {
1442 .parent = &sdcc1_apps_clk_src.c,
1443 .dbg_name = "gcc_sdcc1_apps_clk",
1444 .ops = &clk_ops_branch,
1445 CLK_INIT(gcc_sdcc1_apps_clk.c),
1446 },
1447};
1448
1449static struct branch_clk gcc_sdcc2_ahb_clk = {
1450 .cbcr_reg = SDCC2_AHB_CBCR,
1451 .has_sibling = 1,
1452 .base = &virt_bases[GCC_BASE],
1453 .c = {
1454 .dbg_name = "gcc_sdcc2_ahb_clk",
1455 .ops = &clk_ops_branch,
1456 CLK_INIT(gcc_sdcc2_ahb_clk.c),
1457 },
1458};
1459
1460static struct branch_clk gcc_sdcc2_apps_clk = {
1461 .cbcr_reg = SDCC2_APPS_CBCR,
1462 .has_sibling = 0,
1463 .base = &virt_bases[GCC_BASE],
1464 .c = {
1465 .parent = &sdcc2_apps_clk_src.c,
1466 .dbg_name = "gcc_sdcc2_apps_clk",
1467 .ops = &clk_ops_branch,
1468 CLK_INIT(gcc_sdcc2_apps_clk.c),
1469 },
1470};
1471
1472static struct branch_clk gcc_usb2a_phy_sleep_clk = {
1473 .cbcr_reg = USB2A_PHY_SLEEP_CBCR,
1474 .has_sibling = 1,
1475 .base = &virt_bases[GCC_BASE],
1476 .c = {
1477 .dbg_name = "gcc_usb2a_phy_sleep_clk",
1478 .ops = &clk_ops_branch,
1479 CLK_INIT(gcc_usb2a_phy_sleep_clk.c),
1480 },
1481};
1482
1483static struct branch_clk gcc_usb_hs_ahb_clk = {
1484 .cbcr_reg = USB_HS_AHB_CBCR,
1485 .has_sibling = 1,
1486 .base = &virt_bases[GCC_BASE],
1487 .c = {
1488 .dbg_name = "gcc_usb_hs_ahb_clk",
1489 .ops = &clk_ops_branch,
1490 CLK_INIT(gcc_usb_hs_ahb_clk.c),
1491 },
1492};
1493
1494static struct branch_clk gcc_usb_hs_system_clk = {
1495 .cbcr_reg = USB_HS_SYSTEM_CBCR,
1496 .has_sibling = 0,
1497 .bcr_reg = USB_HS_BCR,
1498 .base = &virt_bases[GCC_BASE],
1499 .c = {
1500 .parent = &usb_hs_system_clk_src.c,
1501 .dbg_name = "gcc_usb_hs_system_clk",
1502 .ops = &clk_ops_branch,
1503 CLK_INIT(gcc_usb_hs_system_clk.c),
1504 },
1505};
1506
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07001507static struct branch_clk gcc_bimc_smmu_clk = {
1508 .cbcr_reg = BIMC_SMMU_CBCR,
1509 .has_sibling = 0,
1510 .base = &virt_bases[GCC_BASE],
1511 .c = {
1512 .dbg_name = "gcc_bimc_smmu_clk",
1513 .ops = &clk_ops_branch,
1514 CLK_INIT(gcc_bimc_smmu_clk.c),
1515 },
1516};
1517
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001518static struct clk_freq_tbl ftbl_csi0_1_clk[] = {
1519 F_MM(100000000, gpll0, 6, 0, 0),
1520 F_MM(200000000, mmpll0, 4, 0, 0),
1521 F_END,
1522};
1523
1524static struct rcg_clk csi0_clk_src = {
1525 .cmd_rcgr_reg = CSI0_CMD_RCGR,
1526 .set_rate = set_rate_hid,
1527 .freq_tbl = ftbl_csi0_1_clk,
1528 .current_freq = &rcg_dummy_freq,
1529 .base = &virt_bases[MMSS_BASE],
1530 .c = {
1531 .dbg_name = "csi0_clk_src",
1532 .ops = &clk_ops_rcg,
1533 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1534 CLK_INIT(csi0_clk_src.c),
1535 },
1536};
1537
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001538static struct clk_freq_tbl ftbl_mmss_mmssnoc_axi_clk[] = {
1539 F_MM( 19200000, gcc_xo, 1, 0, 0),
1540 F_MM( 37500000, gpll0, 16, 0, 0),
1541 F_MM( 50000000, gpll0, 12, 0, 0),
1542 F_MM( 75000000, gpll0, 8, 0, 0),
1543 F_MM(100000000, gpll0, 6, 0, 0),
1544 F_MM(150000000, gpll0, 4, 0, 0),
1545 F_MM(200000000, mmpll0, 4, 0, 0),
1546 F_END,
1547};
1548
1549static struct rcg_clk axi_clk_src = {
1550 .cmd_rcgr_reg = AXI_CMD_RCGR,
1551 .set_rate = set_rate_hid,
1552 .freq_tbl = ftbl_mmss_mmssnoc_axi_clk,
1553 .current_freq = &rcg_dummy_freq,
1554 .base = &virt_bases[MMSS_BASE],
1555 .c = {
1556 .dbg_name = "axi_clk_src",
1557 .ops = &clk_ops_rcg,
1558 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1559 CLK_INIT(axi_clk_src.c),
1560 },
1561};
1562
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08001563static DEFINE_CLK_VOTER(mdp_axi_clk_src, &axi_clk_src.c, 200000000);
1564static DEFINE_CLK_VOTER(mmssnoc_axi_clk_src, &axi_clk_src.c, 200000000);
1565
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001566static struct clk_ops dsi_byte_clk_src_ops;
1567static struct clk_ops dsi_pixel_clk_src_ops;
1568static struct clk_ops dsi_dsi_clk_src_ops;
1569
1570static struct dsi_pll_vco_clk dsi_vco = {
1571 .vco_clk_min = 600000000,
1572 .vco_clk_max = 1200000000,
1573 .pref_div_ratio = 26,
1574 .c = {
1575 .parent = &gcc_xo_clk_src.c,
1576 .dbg_name = "dsi_vco",
1577 .ops = &clk_ops_dsi_vco,
1578 CLK_INIT(dsi_vco.c),
1579 },
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001580};
1581
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001582static struct clk dsi_pll_byte = {
1583 .parent = &dsi_vco.c,
1584 .dbg_name = "dsi_pll_byte",
1585 .ops = &clk_ops_dsi_byteclk,
1586 CLK_INIT(dsi_pll_byte),
1587};
1588
1589static struct clk dsi_pll_pixel = {
1590 .parent = &dsi_vco.c,
1591 .dbg_name = "dsi_pll_pixel",
1592 .ops = &clk_ops_dsi_dsiclk,
1593 CLK_INIT(dsi_pll_pixel),
1594};
1595
1596static struct clk_freq_tbl pixel_freq_tbl[] = {
1597 {
1598 .src_clk = &dsi_pll_pixel,
1599 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1600 },
1601 F_END
1602};
1603
1604#define CFG_RCGR_DIV_MASK BM(4, 0)
1605
1606static int set_rate_pixel_byte_clk(struct clk *clk, unsigned long rate)
1607{
1608 struct rcg_clk *rcg = to_rcg_clk(clk);
1609 struct clk *pll = clk->parent;
1610 unsigned long source_rate, div;
1611 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1612 int rc;
1613
1614 if (rate == 0)
1615 return clk_set_rate(pll, 0);
1616
1617 source_rate = clk_round_rate(pll, rate);
1618 if (!source_rate || ((2 * source_rate) % rate))
1619 return -EINVAL;
1620
1621 div = ((2 * source_rate)/rate) - 1;
1622 if (div > CFG_RCGR_DIV_MASK)
1623 return -EINVAL;
1624
1625 rc = clk_set_rate(pll, source_rate);
1626 if (rc)
1627 return rc;
1628
1629 cur_freq->div_src_val &= ~CFG_RCGR_DIV_MASK;
1630 cur_freq->div_src_val |= BVAL(4, 0, div);
1631 rcg->set_rate(rcg, cur_freq);
1632
1633 return 0;
1634}
1635
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001636static struct rcg_clk dsi_pclk_clk_src = {
1637 .cmd_rcgr_reg = DSI_PCLK_CMD_RCGR,
1638 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001639 .current_freq = pixel_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001640 .base = &virt_bases[MMSS_BASE],
1641 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001642 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001643 .dbg_name = "dsi_pclk_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001644 .ops = &dsi_pixel_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001645 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 103330000),
1646 CLK_INIT(dsi_pclk_clk_src.c),
1647 },
1648};
1649
1650static struct clk_freq_tbl ftbl_oxili_gfx3d_clk[] = {
1651 F_MM( 19200000, gcc_xo, 1, 0, 0),
1652 F_MM( 37500000, gpll0, 16, 0, 0),
1653 F_MM( 50000000, gpll0, 12, 0, 0),
1654 F_MM( 75000000, gpll0, 8, 0, 0),
1655 F_MM(100000000, gpll0, 6, 0, 0),
1656 F_MM(150000000, gpll0, 4, 0, 0),
1657 F_MM(200000000, gpll0, 3, 0, 0),
1658 F_MM(300000000, gpll0, 2, 0, 0),
1659 F_MM(400000000, mmpll1, 3, 0, 0),
1660 F_END,
1661};
1662
1663static struct rcg_clk gfx3d_clk_src = {
1664 .cmd_rcgr_reg = GFX3D_CMD_RCGR,
1665 .set_rate = set_rate_hid,
1666 .freq_tbl = ftbl_oxili_gfx3d_clk,
1667 .current_freq = &rcg_dummy_freq,
1668 .base = &virt_bases[MMSS_BASE],
1669 .c = {
1670 .dbg_name = "gfx3d_clk_src",
1671 .ops = &clk_ops_rcg,
1672 VDD_DIG_FMAX_MAP3(LOW, 150000000, NOMINAL, 300000000, HIGH,
1673 400000000),
1674 CLK_INIT(gfx3d_clk_src.c),
1675 },
1676};
1677
1678static struct clk_freq_tbl ftbl_vfe_clk[] = {
1679 F_MM( 37500000, gpll0, 16, 0, 0),
1680 F_MM( 50000000, gpll0, 12, 0, 0),
1681 F_MM( 60000000, gpll0, 10, 0, 0),
1682 F_MM( 80000000, gpll0, 7.5, 0, 0),
1683 F_MM(100000000, gpll0, 6, 0, 0),
1684 F_MM(109090000, gpll0, 5.5, 0, 0),
1685 F_MM(133330000, gpll0, 4.5, 0, 0),
1686 F_MM(200000000, gpll0, 3, 0, 0),
1687 F_MM(228570000, mmpll0, 3.5, 0, 0),
1688 F_MM(266670000, mmpll0, 3, 0, 0),
1689 F_MM(320000000, mmpll0, 2.5, 0, 0),
1690 F_END,
1691};
1692
1693static struct rcg_clk vfe_clk_src = {
1694 .cmd_rcgr_reg = VFE_CMD_RCGR,
1695 .set_rate = set_rate_hid,
1696 .freq_tbl = ftbl_vfe_clk,
1697 .current_freq = &rcg_dummy_freq,
1698 .base = &virt_bases[MMSS_BASE],
1699 .c = {
1700 .dbg_name = "vfe_clk_src",
1701 .ops = &clk_ops_rcg,
1702 VDD_DIG_FMAX_MAP3(LOW, 133330000, NOMINAL, 266670000, HIGH,
1703 320000000),
1704 CLK_INIT(vfe_clk_src.c),
1705 },
1706};
1707
1708static struct rcg_clk csi1_clk_src = {
1709 .cmd_rcgr_reg = CSI1_CMD_RCGR,
1710 .set_rate = set_rate_hid,
1711 .freq_tbl = ftbl_csi0_1_clk,
1712 .current_freq = &rcg_dummy_freq,
1713 .base = &virt_bases[MMSS_BASE],
1714 .c = {
1715 .dbg_name = "csi1_clk_src",
1716 .ops = &clk_ops_rcg,
1717 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1718 CLK_INIT(csi1_clk_src.c),
1719 },
1720};
1721
1722static struct clk_freq_tbl ftbl_csi0_1phytimer_clk[] = {
1723 F_MM(100000000, gpll0, 6, 0, 0),
1724 F_MM(200000000, mmpll0, 4, 0, 0),
1725 F_END,
1726};
1727
1728static struct rcg_clk csi0phytimer_clk_src = {
1729 .cmd_rcgr_reg = CSI0PHYTIMER_CMD_RCGR,
1730 .set_rate = set_rate_hid,
1731 .freq_tbl = ftbl_csi0_1phytimer_clk,
1732 .current_freq = &rcg_dummy_freq,
1733 .base = &virt_bases[MMSS_BASE],
1734 .c = {
1735 .dbg_name = "csi0phytimer_clk_src",
1736 .ops = &clk_ops_rcg,
1737 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1738 CLK_INIT(csi0phytimer_clk_src.c),
1739 },
1740};
1741
1742static struct rcg_clk csi1phytimer_clk_src = {
1743 .cmd_rcgr_reg = CSI1PHYTIMER_CMD_RCGR,
1744 .set_rate = set_rate_hid,
1745 .freq_tbl = ftbl_csi0_1phytimer_clk,
1746 .current_freq = &rcg_dummy_freq,
1747 .base = &virt_bases[MMSS_BASE],
1748 .c = {
1749 .dbg_name = "csi1phytimer_clk_src",
1750 .ops = &clk_ops_rcg,
1751 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
1752 CLK_INIT(csi1phytimer_clk_src.c),
1753 },
1754};
1755
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001756/*
1757 * The DSI clock will always use a divider of 1. However, we still
1758 * need to set the right voltage and source.
1759 */
1760static int set_rate_dsi_clk(struct clk *clk, unsigned long rate)
1761{
1762 struct rcg_clk *rcg = to_rcg_clk(clk);
1763 struct clk_freq_tbl *cur_freq = rcg->current_freq;
1764
1765 rcg->set_rate(rcg, cur_freq);
1766
1767 return 0;
1768}
1769
1770static struct clk_freq_tbl dsi_freq_tbl[] = {
1771 {
1772 .src_clk = &dsi_pll_pixel,
1773 .div_src_val = BVAL(4, 0, 0) |
1774 BVAL(10, 8, dsipll_mm_source_val),
1775 },
1776 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001777};
1778
1779static struct rcg_clk dsi_clk_src = {
1780 .cmd_rcgr_reg = DSI_CMD_RCGR,
1781 .set_rate = set_rate_mnd,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001782 .current_freq = dsi_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001783 .base = &virt_bases[MMSS_BASE],
1784 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001785 .parent = &dsi_pll_pixel,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001786 .dbg_name = "dsi_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001787 .ops = &dsi_dsi_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001788 VDD_DIG_FMAX_MAP2(LOW, 155000000, NOMINAL, 310000000),
1789 CLK_INIT(dsi_clk_src.c),
1790 },
1791};
1792
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001793static struct clk_freq_tbl byte_freq_tbl[] = {
1794 {
1795 .src_clk = &dsi_pll_byte,
1796 .div_src_val = BVAL(10, 8, dsipll_mm_source_val),
1797 },
1798 F_END
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001799};
1800
1801static struct rcg_clk dsi_byte_clk_src = {
1802 .cmd_rcgr_reg = DSI_BYTE_CMD_RCGR,
1803 .set_rate = set_rate_hid,
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001804 .current_freq = byte_freq_tbl,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001805 .base = &virt_bases[MMSS_BASE],
1806 .c = {
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001807 .parent = &dsi_pll_byte,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001808 .dbg_name = "dsi_byte_clk_src",
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07001809 .ops = &dsi_byte_clk_src_ops,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001810 VDD_DIG_FMAX_MAP2(LOW, 62500000, NOMINAL, 125000000),
1811 CLK_INIT(dsi_byte_clk_src.c),
1812 },
1813};
1814
1815static struct clk_freq_tbl ftbl_dsi_esc_clk[] = {
1816 F_MM(19200000, gcc_xo, 1, 0, 0),
1817 F_END,
1818};
1819
1820static struct rcg_clk dsi_esc_clk_src = {
1821 .cmd_rcgr_reg = DSI_ESC_CMD_RCGR,
1822 .set_rate = set_rate_hid,
1823 .freq_tbl = ftbl_dsi_esc_clk,
1824 .current_freq = &rcg_dummy_freq,
1825 .base = &virt_bases[MMSS_BASE],
1826 .c = {
1827 .dbg_name = "dsi_esc_clk_src",
1828 .ops = &clk_ops_rcg,
1829 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1830 CLK_INIT(dsi_esc_clk_src.c),
1831 },
1832};
1833
1834static struct clk_freq_tbl ftbl_mclk0_1_clk[] = {
1835 F_MM(66670000, gpll0, 9, 0, 0),
1836 F_END,
1837};
1838
1839static struct rcg_clk mclk0_clk_src = {
1840 .cmd_rcgr_reg = MCLK0_CMD_RCGR,
1841 .set_rate = set_rate_mnd,
1842 .freq_tbl = ftbl_mclk0_1_clk,
1843 .current_freq = &rcg_dummy_freq,
1844 .base = &virt_bases[MMSS_BASE],
1845 .c = {
1846 .dbg_name = "mclk0_clk_src",
1847 .ops = &clk_ops_rcg_mnd,
1848 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1849 CLK_INIT(mclk0_clk_src.c),
1850 },
1851};
1852
1853static struct rcg_clk mclk1_clk_src = {
1854 .cmd_rcgr_reg = MCLK1_CMD_RCGR,
1855 .set_rate = set_rate_mnd,
1856 .freq_tbl = ftbl_mclk0_1_clk,
1857 .current_freq = &rcg_dummy_freq,
1858 .base = &virt_bases[MMSS_BASE],
1859 .c = {
1860 .dbg_name = "mclk1_clk_src",
1861 .ops = &clk_ops_rcg_mnd,
1862 VDD_DIG_FMAX_MAP1(LOW, 66670000),
1863 CLK_INIT(mclk1_clk_src.c),
1864 },
1865};
1866
1867static struct clk_freq_tbl ftbl_mdp_vsync_clk[] = {
1868 F_MM(19200000, gcc_xo, 1, 0, 0),
1869 F_END,
1870};
1871
1872static struct rcg_clk mdp_vsync_clk_src = {
1873 .cmd_rcgr_reg = MDP_VSYNC_CMD_RCGR,
1874 .set_rate = set_rate_hid,
1875 .freq_tbl = ftbl_mdp_vsync_clk,
1876 .current_freq = &rcg_dummy_freq,
1877 .base = &virt_bases[MMSS_BASE],
1878 .c = {
1879 .dbg_name = "mdp_vsync_clk_src",
1880 .ops = &clk_ops_rcg,
1881 VDD_DIG_FMAX_MAP1(LOW, 19200000),
1882 CLK_INIT(mdp_vsync_clk_src.c),
1883 },
1884};
1885
1886static struct branch_clk bimc_gfx_clk = {
1887 .cbcr_reg = BIMC_GFX_CBCR,
1888 .has_sibling = 1,
1889 .base = &virt_bases[MMSS_BASE],
Vikram Mulukutla2dfa8b12013-01-15 18:17:10 -08001890 /* FIXME: Remove this once simulation is fixed. */
1891 .halt_check = DELAY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001892 .c = {
1893 .dbg_name = "bimc_gfx_clk",
1894 .ops = &clk_ops_branch,
1895 CLK_INIT(bimc_gfx_clk.c),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07001896 /* FIXME: Remove once kgsl votes on the depends clock. */
1897 .depends = &gcc_bimc_smmu_clk.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07001898 },
1899};
1900
1901static struct branch_clk csi0_clk = {
1902 .cbcr_reg = CSI0_CBCR,
1903 .has_sibling = 1,
1904 .base = &virt_bases[MMSS_BASE],
1905 .c = {
1906 .parent = &csi0_clk_src.c,
1907 .dbg_name = "csi0_clk",
1908 .ops = &clk_ops_branch,
1909 CLK_INIT(csi0_clk.c),
1910 },
1911};
1912
1913static struct branch_clk csi0phy_clk = {
1914 .cbcr_reg = CSI0PHY_CBCR,
1915 .has_sibling = 1,
1916 .base = &virt_bases[MMSS_BASE],
1917 .c = {
1918 .parent = &csi0_clk_src.c,
1919 .dbg_name = "csi0phy_clk",
1920 .ops = &clk_ops_branch,
1921 CLK_INIT(csi0phy_clk.c),
1922 },
1923};
1924
1925static struct branch_clk csi0phytimer_clk = {
1926 .cbcr_reg = CSI0PHYTIMER_CBCR,
1927 .has_sibling = 0,
1928 .base = &virt_bases[MMSS_BASE],
1929 .c = {
1930 .parent = &csi0phytimer_clk_src.c,
1931 .dbg_name = "csi0phytimer_clk",
1932 .ops = &clk_ops_branch,
1933 CLK_INIT(csi0phytimer_clk.c),
1934 },
1935};
1936
1937static struct branch_clk csi0pix_clk = {
1938 .cbcr_reg = CSI0PIX_CBCR,
1939 .has_sibling = 1,
1940 .base = &virt_bases[MMSS_BASE],
1941 .c = {
1942 .parent = &csi0_clk_src.c,
1943 .dbg_name = "csi0pix_clk",
1944 .ops = &clk_ops_branch,
1945 CLK_INIT(csi0pix_clk.c),
1946 },
1947};
1948
1949static struct branch_clk csi0rdi_clk = {
1950 .cbcr_reg = CSI0RDI_CBCR,
1951 .has_sibling = 1,
1952 .base = &virt_bases[MMSS_BASE],
1953 .c = {
1954 .parent = &csi0_clk_src.c,
1955 .dbg_name = "csi0rdi_clk",
1956 .ops = &clk_ops_branch,
1957 CLK_INIT(csi0rdi_clk.c),
1958 },
1959};
1960
1961static struct branch_clk csi1_clk = {
1962 .cbcr_reg = CSI1_CBCR,
1963 .has_sibling = 1,
1964 .base = &virt_bases[MMSS_BASE],
1965 .c = {
1966 .parent = &csi1_clk_src.c,
1967 .dbg_name = "csi1_clk",
1968 .ops = &clk_ops_branch,
1969 CLK_INIT(csi1_clk.c),
1970 },
1971};
1972
1973static struct branch_clk csi1phy_clk = {
1974 .cbcr_reg = CSI1PHY_CBCR,
1975 .has_sibling = 1,
1976 .base = &virt_bases[MMSS_BASE],
1977 .c = {
1978 .parent = &csi1_clk_src.c,
1979 .dbg_name = "csi1phy_clk",
1980 .ops = &clk_ops_branch,
1981 CLK_INIT(csi1phy_clk.c),
1982 },
1983};
1984
1985static struct branch_clk csi1phytimer_clk = {
1986 .cbcr_reg = CSI1PHYTIMER_CBCR,
1987 .has_sibling = 0,
1988 .base = &virt_bases[MMSS_BASE],
1989 .c = {
1990 .parent = &csi1phytimer_clk_src.c,
1991 .dbg_name = "csi1phytimer_clk",
1992 .ops = &clk_ops_branch,
1993 CLK_INIT(csi1phytimer_clk.c),
1994 },
1995};
1996
1997static struct branch_clk csi1pix_clk = {
1998 .cbcr_reg = CSI1PIX_CBCR,
1999 .has_sibling = 1,
2000 .base = &virt_bases[MMSS_BASE],
2001 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002002 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002003 .dbg_name = "csi1pix_clk",
2004 .ops = &clk_ops_branch,
2005 CLK_INIT(csi1pix_clk.c),
2006 },
2007};
2008
2009static struct branch_clk csi1rdi_clk = {
2010 .cbcr_reg = CSI1RDI_CBCR,
2011 .has_sibling = 1,
2012 .base = &virt_bases[MMSS_BASE],
2013 .c = {
Vikram Mulukutlaa1d5c142013-01-16 10:30:12 -08002014 .parent = &csi1_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002015 .dbg_name = "csi1rdi_clk",
2016 .ops = &clk_ops_branch,
2017 CLK_INIT(csi1rdi_clk.c),
2018 },
2019};
2020
Vikram Mulukutla49423392013-05-02 09:03:02 -07002021static struct cam_mux_clk csi0phy_cam_mux_clk = {
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002022 .enable_reg = MMSS_CAMSS_MISC,
2023 .enable_mask = BIT(11),
2024 .select_reg = MMSS_CAMSS_MISC,
2025 .select_mask = BIT(9),
2026 .sources = (struct mux_source[]) {
2027 { &csi0phy_clk.c, 0 },
2028 { &csi1phy_clk.c, BIT(9) },
2029 { 0 },
2030 },
2031 .base = &virt_bases[MMSS_BASE],
2032 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002033 .dbg_name = "csi0phy_cam_mux_clk",
2034 .ops = &clk_ops_cam_mux,
2035 CLK_INIT(csi0phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002036 },
2037};
2038
Vikram Mulukutla49423392013-05-02 09:03:02 -07002039static struct cam_mux_clk csi1phy_cam_mux_clk = {
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002040 .enable_reg = MMSS_CAMSS_MISC,
2041 .enable_mask = BIT(10),
2042 .select_reg = MMSS_CAMSS_MISC,
2043 .select_mask = BIT(8),
2044 .sources = (struct mux_source[]) {
2045 { &csi0phy_clk.c, 0 },
2046 { &csi1phy_clk.c, BIT(8) },
2047 { 0 },
2048 },
2049 .base = &virt_bases[MMSS_BASE],
2050 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002051 .dbg_name = "csi1phy_cam_mux_clk",
2052 .ops = &clk_ops_cam_mux,
2053 CLK_INIT(csi1phy_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002054 },
2055};
2056
Vikram Mulukutla49423392013-05-02 09:03:02 -07002057static struct cam_mux_clk csi0pix_cam_mux_clk = {
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002058 .enable_reg = MMSS_CAMSS_MISC,
2059 .enable_mask = BIT(7),
2060 .select_reg = MMSS_CAMSS_MISC,
2061 .select_mask = BIT(3),
2062 .sources = (struct mux_source[]) {
2063 { &csi0pix_clk.c, 0 },
2064 { &csi1pix_clk.c, BIT(3) },
2065 { 0 },
2066 },
2067 .base = &virt_bases[MMSS_BASE],
2068 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002069 .dbg_name = "csi0pix_cam_mux_clk",
2070 .ops = &clk_ops_cam_mux,
2071 CLK_INIT(csi0pix_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002072 },
2073};
2074
2075
Vikram Mulukutla49423392013-05-02 09:03:02 -07002076static struct cam_mux_clk rdi2_cam_mux_clk = {
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002077 .enable_reg = MMSS_CAMSS_MISC,
2078 .enable_mask = BIT(6),
2079 .select_reg = MMSS_CAMSS_MISC,
2080 .select_mask = BIT(2),
2081 .sources = (struct mux_source[]) {
2082 { &csi0rdi_clk.c, 0 },
2083 { &csi1rdi_clk.c, BIT(2) },
2084 { 0 },
2085 },
2086 .base = &virt_bases[MMSS_BASE],
2087 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002088 .dbg_name = "rdi2_cam_mux_clk",
2089 .ops = &clk_ops_cam_mux,
2090 CLK_INIT(rdi2_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002091 },
2092};
2093
Vikram Mulukutla49423392013-05-02 09:03:02 -07002094static struct cam_mux_clk rdi1_cam_mux_clk = {
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002095 .enable_reg = MMSS_CAMSS_MISC,
2096 .enable_mask = BIT(5),
2097 .select_reg = MMSS_CAMSS_MISC,
2098 .select_mask = BIT(1),
2099 .sources = (struct mux_source[]) {
2100 { &csi0rdi_clk.c, 0 },
2101 { &csi1rdi_clk.c, BIT(1) },
2102 { 0 },
2103 },
2104 .base = &virt_bases[MMSS_BASE],
2105 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002106 .dbg_name = "rdi1_cam_mux_clk",
2107 .ops = &clk_ops_cam_mux,
2108 CLK_INIT(rdi1_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002109 },
2110};
2111
Vikram Mulukutla49423392013-05-02 09:03:02 -07002112static struct cam_mux_clk rdi0_cam_mux_clk = {
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002113 .enable_reg = MMSS_CAMSS_MISC,
2114 .enable_mask = BIT(4),
2115 .select_reg = MMSS_CAMSS_MISC,
2116 .select_mask = BIT(0),
2117 .sources = (struct mux_source[]) {
2118 { &csi0rdi_clk.c, 0 },
2119 { &csi1rdi_clk.c, BIT(0) },
2120 { 0 },
2121 },
2122 .base = &virt_bases[MMSS_BASE],
2123 .c = {
Vikram Mulukutla49423392013-05-02 09:03:02 -07002124 .dbg_name = "rdi0_cam_mux_clk",
2125 .ops = &clk_ops_cam_mux,
2126 CLK_INIT(rdi0_cam_mux_clk.c),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002127 },
2128};
2129
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002130static struct branch_clk csi_ahb_clk = {
2131 .cbcr_reg = CSI_AHB_CBCR,
2132 .has_sibling = 1,
2133 .base = &virt_bases[MMSS_BASE],
2134 .c = {
2135 .dbg_name = "csi_ahb_clk",
2136 .ops = &clk_ops_branch,
2137 CLK_INIT(csi_ahb_clk.c),
2138 },
2139};
2140
2141static struct branch_clk csi_vfe_clk = {
2142 .cbcr_reg = CSI_VFE_CBCR,
2143 .has_sibling = 1,
2144 .base = &virt_bases[MMSS_BASE],
2145 .c = {
2146 .parent = &vfe_clk_src.c,
2147 .dbg_name = "csi_vfe_clk",
2148 .ops = &clk_ops_branch,
2149 CLK_INIT(csi_vfe_clk.c),
2150 },
2151};
2152
2153static struct branch_clk dsi_clk = {
2154 .cbcr_reg = DSI_CBCR,
2155 .has_sibling = 0,
2156 .base = &virt_bases[MMSS_BASE],
2157 .c = {
2158 .parent = &dsi_clk_src.c,
2159 .dbg_name = "dsi_clk",
2160 .ops = &clk_ops_branch,
2161 CLK_INIT(dsi_clk.c),
2162 },
2163};
2164
2165static struct branch_clk dsi_ahb_clk = {
2166 .cbcr_reg = DSI_AHB_CBCR,
2167 .has_sibling = 1,
2168 .base = &virt_bases[MMSS_BASE],
2169 .c = {
2170 .dbg_name = "dsi_ahb_clk",
2171 .ops = &clk_ops_branch,
2172 CLK_INIT(dsi_ahb_clk.c),
2173 },
2174};
2175
2176static struct branch_clk dsi_byte_clk = {
2177 .cbcr_reg = DSI_BYTE_CBCR,
2178 .has_sibling = 0,
2179 .base = &virt_bases[MMSS_BASE],
2180 .c = {
2181 .parent = &dsi_byte_clk_src.c,
2182 .dbg_name = "dsi_byte_clk",
2183 .ops = &clk_ops_branch,
2184 CLK_INIT(dsi_byte_clk.c),
2185 },
2186};
2187
2188static struct branch_clk dsi_esc_clk = {
2189 .cbcr_reg = DSI_ESC_CBCR,
2190 .has_sibling = 0,
2191 .base = &virt_bases[MMSS_BASE],
2192 .c = {
2193 .parent = &dsi_esc_clk_src.c,
2194 .dbg_name = "dsi_esc_clk",
2195 .ops = &clk_ops_branch,
2196 CLK_INIT(dsi_esc_clk.c),
2197 },
2198};
2199
2200static struct branch_clk dsi_pclk_clk = {
2201 .cbcr_reg = DSI_PCLK_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002202 .base = &virt_bases[MMSS_BASE],
2203 .c = {
2204 .parent = &dsi_pclk_clk_src.c,
2205 .dbg_name = "dsi_pclk_clk",
2206 .ops = &clk_ops_branch,
2207 CLK_INIT(dsi_pclk_clk.c),
2208 },
2209};
2210
2211static struct branch_clk gmem_gfx3d_clk = {
2212 .cbcr_reg = GMEM_GFX3D_CBCR,
2213 .has_sibling = 1,
2214 .base = &virt_bases[MMSS_BASE],
2215 .c = {
2216 .parent = &gfx3d_clk_src.c,
2217 .dbg_name = "gmem_gfx3d_clk",
2218 .ops = &clk_ops_branch,
2219 CLK_INIT(gmem_gfx3d_clk.c),
2220 },
2221};
2222
2223static struct branch_clk mclk0_clk = {
2224 .cbcr_reg = MCLK0_CBCR,
2225 .has_sibling = 0,
2226 .base = &virt_bases[MMSS_BASE],
2227 .c = {
2228 .parent = &mclk0_clk_src.c,
2229 .dbg_name = "mclk0_clk",
2230 .ops = &clk_ops_branch,
2231 CLK_INIT(mclk0_clk.c),
2232 },
2233};
2234
2235static struct branch_clk mclk1_clk = {
2236 .cbcr_reg = MCLK1_CBCR,
2237 .has_sibling = 0,
2238 .base = &virt_bases[MMSS_BASE],
2239 .c = {
2240 .parent = &mclk1_clk_src.c,
2241 .dbg_name = "mclk1_clk",
2242 .ops = &clk_ops_branch,
2243 CLK_INIT(mclk1_clk.c),
2244 },
2245};
2246
2247static struct branch_clk mdp_ahb_clk = {
2248 .cbcr_reg = MDP_AHB_CBCR,
2249 .has_sibling = 1,
2250 .base = &virt_bases[MMSS_BASE],
2251 .c = {
2252 .dbg_name = "mdp_ahb_clk",
2253 .ops = &clk_ops_branch,
2254 CLK_INIT(mdp_ahb_clk.c),
2255 },
2256};
2257
2258static struct branch_clk mdp_axi_clk = {
2259 .cbcr_reg = MDP_AXI_CBCR,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002260 .base = &virt_bases[MMSS_BASE],
Vikram Mulukutla2dfa8b12013-01-15 18:17:10 -08002261 /* FIXME: Remove this once simulation is fixed. */
2262 .halt_check = DELAY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002263 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002264 .parent = &mdp_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002265 .dbg_name = "mdp_axi_clk",
2266 .ops = &clk_ops_branch,
2267 CLK_INIT(mdp_axi_clk.c),
2268 },
2269};
2270
2271static struct branch_clk mdp_dsi_clk = {
2272 .cbcr_reg = MDP_DSI_CBCR,
2273 .has_sibling = 1,
2274 .base = &virt_bases[MMSS_BASE],
2275 .c = {
2276 .parent = &dsi_pclk_clk_src.c,
2277 .dbg_name = "mdp_dsi_clk",
2278 .ops = &clk_ops_branch,
2279 CLK_INIT(mdp_dsi_clk.c),
2280 },
2281};
2282
2283static struct branch_clk mdp_lcdc_clk = {
2284 .cbcr_reg = MDP_LCDC_CBCR,
2285 .has_sibling = 1,
2286 .base = &virt_bases[MMSS_BASE],
2287 .c = {
2288 .parent = &dsi_pclk_clk_src.c,
2289 .dbg_name = "mdp_lcdc_clk",
2290 .ops = &clk_ops_branch,
2291 CLK_INIT(mdp_lcdc_clk.c),
2292 },
2293};
2294
2295static struct branch_clk mdp_vsync_clk = {
2296 .cbcr_reg = MDP_VSYNC_CBCR,
2297 .has_sibling = 0,
2298 .base = &virt_bases[MMSS_BASE],
2299 .c = {
2300 .parent = &mdp_vsync_clk_src.c,
2301 .dbg_name = "mdp_vsync_clk",
2302 .ops = &clk_ops_branch,
2303 CLK_INIT(mdp_vsync_clk.c),
2304 },
2305};
2306
2307static struct branch_clk mmss_misc_ahb_clk = {
2308 .cbcr_reg = MMSS_MISC_AHB_CBCR,
2309 .has_sibling = 1,
2310 .base = &virt_bases[MMSS_BASE],
2311 .c = {
2312 .dbg_name = "mmss_misc_ahb_clk",
2313 .ops = &clk_ops_branch,
2314 CLK_INIT(mmss_misc_ahb_clk.c),
2315 },
2316};
2317
2318static struct branch_clk mmss_mmssnoc_axi_clk = {
2319 .cbcr_reg = MMSS_MMSSNOC_AXI_CBCR,
2320 .has_sibling = 1,
2321 .base = &virt_bases[MMSS_BASE],
2322 .c = {
2323 .parent = &axi_clk_src.c,
2324 .dbg_name = "mmss_mmssnoc_axi_clk",
2325 .ops = &clk_ops_branch,
2326 CLK_INIT(mmss_mmssnoc_axi_clk.c),
2327 },
2328};
2329
2330static struct branch_clk mmss_s0_axi_clk = {
2331 .cbcr_reg = MMSS_S0_AXI_CBCR,
2332 .has_sibling = 0,
2333 .base = &virt_bases[MMSS_BASE],
2334 .c = {
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002335 .parent = &mmssnoc_axi_clk_src.c,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002336 .dbg_name = "mmss_s0_axi_clk",
2337 .ops = &clk_ops_branch,
2338 CLK_INIT(mmss_s0_axi_clk.c),
2339 .depends = &mmss_mmssnoc_axi_clk.c,
2340 },
2341};
2342
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002343static struct branch_clk mmss_mmssnoc_bto_ahb_clk = {
2344 .cbcr_reg = MMSS_MMSSNOC_BTO_AHB_CBCR,
2345 .has_sibling = 1,
2346 .base = &virt_bases[MMSS_BASE],
2347 .c = {
2348 .dbg_name = "mmss_mmssnoc_bto_ahb_clk",
2349 .ops = &clk_ops_branch,
2350 CLK_INIT(mmss_mmssnoc_bto_ahb_clk.c),
2351 },
2352};
2353
2354static struct branch_clk oxili_ahb_clk = {
2355 .cbcr_reg = OXILI_AHB_CBCR,
2356 .has_sibling = 1,
2357 .base = &virt_bases[MMSS_BASE],
2358 .c = {
2359 .dbg_name = "oxili_ahb_clk",
2360 .ops = &clk_ops_branch,
2361 CLK_INIT(oxili_ahb_clk.c),
2362 },
2363};
2364
2365static struct branch_clk oxili_gfx3d_clk = {
2366 .cbcr_reg = OXILI_GFX3D_CBCR,
2367 .has_sibling = 0,
2368 .base = &virt_bases[MMSS_BASE],
2369 .c = {
2370 .parent = &gfx3d_clk_src.c,
2371 .dbg_name = "oxili_gfx3d_clk",
2372 .ops = &clk_ops_branch,
2373 CLK_INIT(oxili_gfx3d_clk.c),
2374 },
2375};
2376
2377static struct branch_clk vfe_clk = {
2378 .cbcr_reg = VFE_CBCR,
2379 .has_sibling = 1,
2380 .base = &virt_bases[MMSS_BASE],
2381 .c = {
2382 .parent = &vfe_clk_src.c,
2383 .dbg_name = "vfe_clk",
2384 .ops = &clk_ops_branch,
2385 CLK_INIT(vfe_clk.c),
2386 },
2387};
2388
2389static struct branch_clk vfe_ahb_clk = {
2390 .cbcr_reg = VFE_AHB_CBCR,
2391 .has_sibling = 1,
2392 .base = &virt_bases[MMSS_BASE],
2393 .c = {
2394 .dbg_name = "vfe_ahb_clk",
2395 .ops = &clk_ops_branch,
2396 CLK_INIT(vfe_ahb_clk.c),
2397 },
2398};
2399
2400static struct branch_clk vfe_axi_clk = {
2401 .cbcr_reg = VFE_AXI_CBCR,
2402 .has_sibling = 1,
2403 .base = &virt_bases[MMSS_BASE],
Vikram Mulukutla2dfa8b12013-01-15 18:17:10 -08002404 /* FIXME: Remove this once simulation is fixed. */
2405 .halt_check = DELAY,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002406 .c = {
2407 .parent = &axi_clk_src.c,
2408 .dbg_name = "vfe_axi_clk",
2409 .ops = &clk_ops_branch,
2410 CLK_INIT(vfe_axi_clk.c),
2411 },
2412};
2413
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002414static struct branch_clk q6ss_ahb_lfabif_clk = {
2415 .cbcr_reg = Q6SS_AHB_LFABIF_CBCR,
2416 .has_sibling = 1,
2417 .base = &virt_bases[LPASS_BASE],
2418 .c = {
2419 .dbg_name = "q6ss_ahb_lfabif_clk",
2420 .ops = &clk_ops_branch,
2421 CLK_INIT(q6ss_ahb_lfabif_clk.c),
2422 },
2423};
2424
2425static struct branch_clk q6ss_ahbm_clk = {
2426 .cbcr_reg = Q6SS_AHBM_CBCR,
2427 .has_sibling = 1,
2428 .base = &virt_bases[LPASS_BASE],
2429 .c = {
2430 .dbg_name = "q6ss_ahbm_clk",
2431 .ops = &clk_ops_branch,
2432 CLK_INIT(q6ss_ahbm_clk.c),
2433 },
2434};
2435
2436static struct branch_clk q6ss_xo_clk = {
2437 .cbcr_reg = Q6SS_XO_CBCR,
2438 .has_sibling = 1,
2439 .bcr_reg = LPASS_Q6SS_BCR,
2440 .base = &virt_bases[LPASS_BASE],
2441 .c = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002442 .dbg_name = "q6ss_xo_clk",
2443 .ops = &clk_ops_branch,
2444 CLK_INIT(q6ss_xo_clk.c),
2445 },
2446};
2447
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002448#ifdef CONFIG_DEBUG_FS
2449
2450struct measure_mux_entry {
2451 struct clk *c;
2452 int base;
2453 u32 debug_mux;
2454};
2455
2456static struct measure_mux_entry measure_mux[] = {
2457 { &snoc_clk.c, GCC_BASE, 0x0000},
2458 { &cnoc_clk.c, GCC_BASE, 0x0008},
2459 { &gcc_copss_smmu_ahb_clk.c, GCC_BASE, 0x000c},
2460 { &gcc_lpss_smmu_ahb_clk.c, GCC_BASE, 0x000d},
2461 { &pnoc_clk.c, GCC_BASE, 0x0010},
2462 { &gcc_mmss_noc_cfg_ahb_clk.c, GCC_BASE, 0x002a},
2463 { &gcc_mss_cfg_ahb_clk.c, GCC_BASE, 0x0030},
2464 { &gcc_mss_q6_bimc_axi_clk.c, GCC_BASE, 0x0031},
2465 { &gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060},
2466 { &gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061},
2467 { &gcc_usb2a_phy_sleep_clk.c, GCC_BASE, 0x0063},
2468 { &gcc_sdcc1_apps_clk.c, GCC_BASE, 0x0068},
2469 { &gcc_sdcc1_ahb_clk.c, GCC_BASE, 0x0069},
2470 { &gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070},
2471 { &gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071},
2472 { &gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088},
2473 {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a},
2474 {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b},
2475 { &gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c},
2476 {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e},
2477 {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090},
2478 { &gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091},
2479 {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093},
2480 {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094},
2481 { &gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095},
2482 {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098},
2483 {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099},
2484 { &gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a},
2485 {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c},
2486 {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d},
2487 { &gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e},
2488 {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1},
2489 {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2},
2490 { &gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3},
2491 { &gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0},
2492 { &gcc_pdm2_clk.c, GCC_BASE, 0x00d2},
2493 { &gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8},
2494 { &gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8},
2495 { &gcc_ce1_clk.c, GCC_BASE, 0x0138},
2496 { &gcc_ce1_axi_clk.c, GCC_BASE, 0x0139},
2497 { &gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a},
2498 { &gcc_xo_clk_src.c, GCC_BASE, 0x0149},
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002499 { &bimc_clk.c, GCC_BASE, 0x015d},
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07002500 { &gcc_bimc_smmu_clk.c, GCC_BASE, 0x015e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002501 { &gcc_lpass_q6_axi_clk.c, GCC_BASE, 0x0160},
2502
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08002503 { &mmssnoc_ahb_clk.c, MMSS_BASE, 0x0001},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002504 { &mmss_misc_ahb_clk.c, MMSS_BASE, 0x0003},
2505 {&mmss_mmssnoc_axi_clk.c, MMSS_BASE, 0x0004},
2506 { &mmss_s0_axi_clk.c, MMSS_BASE, 0x0005},
2507 { &oxili_ahb_clk.c, MMSS_BASE, 0x0007},
2508 { &oxili_gfx3d_clk.c, MMSS_BASE, 0x0008},
2509 { &gmem_gfx3d_clk.c, MMSS_BASE, 0x0009},
2510 { &mdp_axi_clk.c, MMSS_BASE, 0x000a},
2511 { &mdp_vsync_clk.c, MMSS_BASE, 0x000b},
2512 { &mdp_ahb_clk.c, MMSS_BASE, 0x000c},
2513 { &dsi_pclk_clk.c, MMSS_BASE, 0x000d},
2514 { &mdp_dsi_clk.c, MMSS_BASE, 0x000e},
2515 { &mdp_lcdc_clk.c, MMSS_BASE, 0x000f},
2516 { &dsi_clk.c, MMSS_BASE, 0x0010},
2517 { &dsi_byte_clk.c, MMSS_BASE, 0x0011},
2518 { &dsi_esc_clk.c, MMSS_BASE, 0x0012},
2519 { &dsi_ahb_clk.c, MMSS_BASE, 0x0013},
2520 { &mclk0_clk.c, MMSS_BASE, 0x0015},
2521 { &mclk1_clk.c, MMSS_BASE, 0x0016},
2522 { &csi0phytimer_clk.c, MMSS_BASE, 0x0017},
2523 { &csi1phytimer_clk.c, MMSS_BASE, 0x0018},
2524 { &vfe_clk.c, MMSS_BASE, 0x0019},
2525 { &vfe_ahb_clk.c, MMSS_BASE, 0x001a},
2526 { &vfe_axi_clk.c, MMSS_BASE, 0x001b},
2527 { &csi_vfe_clk.c, MMSS_BASE, 0x001c},
2528 { &csi0_clk.c, MMSS_BASE, 0x001d},
2529 { &csi_ahb_clk.c, MMSS_BASE, 0x001e},
2530 { &csi0phy_clk.c, MMSS_BASE, 0x001f},
2531 { &csi0rdi_clk.c, MMSS_BASE, 0x0020},
2532 { &csi0pix_clk.c, MMSS_BASE, 0x0021},
2533 { &csi1_clk.c, MMSS_BASE, 0x0022},
2534 { &csi1phy_clk.c, MMSS_BASE, 0x0023},
2535 { &csi1rdi_clk.c, MMSS_BASE, 0x0024},
2536 { &csi1pix_clk.c, MMSS_BASE, 0x0025},
2537 { &bimc_gfx_clk.c, MMSS_BASE, 0x0032},
2538
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002539 { &q6ss_ahbm_clk.c, LPASS_BASE, 0x001d},
2540 { &q6ss_ahb_lfabif_clk.c, LPASS_BASE, 0x001e},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002541 { &q6ss_xo_clk.c, LPASS_BASE, 0x002b},
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002542
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002543 {&apc0_m_clk, APCS_BASE, 0x00010},
2544 {&apc1_m_clk, APCS_BASE, 0x00114},
2545 {&apc2_m_clk, APCS_BASE, 0x00220},
2546 {&apc3_m_clk, APCS_BASE, 0x00324},
2547 {&l2_m_clk, APCS_BASE, 0x01000},
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08002548
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002549 {&dummy_clk, N_BASES, 0x0000},
2550};
2551
2552#define GCC_DEBUG_CLK_CTL 0x1880
2553#define MMSS_DEBUG_CLK_CTL 0x0900
2554#define LPASS_DEBUG_CLK_CTL 0x29000
2555#define GLB_CLK_DIAG 0x001C
2556
2557static int measure_clk_set_parent(struct clk *c, struct clk *parent)
2558{
2559 struct measure_clk *clk = to_measure_clk(c);
2560 unsigned long flags;
2561 u32 regval, clk_sel, i;
2562
2563 if (!parent)
2564 return -EINVAL;
2565
2566 for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++)
2567 if (measure_mux[i].c == parent)
2568 break;
2569
2570 if (measure_mux[i].c == &dummy_clk)
2571 return -EINVAL;
2572
2573 spin_lock_irqsave(&local_clock_reg_lock, flags);
2574 /*
2575 * Program the test vector, measurement period (sample_ticks)
2576 * and scaling multiplier.
2577 */
2578 clk->sample_ticks = 0x10000;
2579 clk->multiplier = 1;
2580
2581 switch (measure_mux[i].base) {
2582
2583 case GCC_BASE:
2584 writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2585 clk_sel = measure_mux[i].debug_mux;
2586 break;
2587
2588 case MMSS_BASE:
2589 writel_relaxed(0, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2590 clk_sel = 0x02C;
2591 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2592 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2593
2594 /* Activate debug clock output */
2595 regval |= BIT(16);
2596 writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL));
2597 break;
2598
2599 case LPASS_BASE:
2600 writel_relaxed(0, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2601 clk_sel = 0x161;
2602 regval = BVAL(11, 0, measure_mux[i].debug_mux);
2603 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2604
2605 /* Activate debug clock output */
2606 regval |= BIT(20);
2607 writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL));
2608 break;
2609
2610 case APCS_BASE:
2611 clk->multiplier = 4;
2612 clk_sel = 0x16A;
2613 regval = measure_mux[i].debug_mux;
Vikram Mulukutlaf0279052013-04-30 14:51:58 -07002614 /* Use a divider value of 4. */
2615 regval |= BVAL(31, 30, 0x3);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002616 writel_relaxed(regval, APCS_REG_BASE(GLB_CLK_DIAG));
2617 break;
2618
2619 default:
2620 return -EINVAL;
2621 }
2622
2623 /* Set debug mux clock index */
2624 regval = BVAL(8, 0, clk_sel);
2625 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2626
2627 /* Activate debug clock output */
2628 regval |= BIT(16);
2629 writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL));
2630
2631 /* Make sure test vector is set before starting measurements. */
2632 mb();
2633 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2634
2635 return 0;
2636}
2637
2638#define CLOCK_FRQ_MEASURE_CTL 0x1884
2639#define CLOCK_FRQ_MEASURE_STATUS 0x1888
2640
2641/* Sample clock for 'ticks' reference clock ticks. */
2642static u32 run_measurement(unsigned ticks)
2643{
2644 /* Stop counters and set the XO4 counter start value. */
2645 writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2646
2647 /* Wait for timer to become ready. */
2648 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2649 BIT(25)) != 0)
2650 cpu_relax();
2651
2652 /* Run measurement and wait for completion. */
2653 writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL));
2654 while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2655 BIT(25)) == 0)
2656 cpu_relax();
2657
2658 /* Return measured ticks. */
2659 return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) &
2660 BM(24, 0);
2661}
2662
2663#define GCC_XO_DIV4_CBCR 0x10C8
2664#define PLLTEST_PAD_CFG 0x188C
2665
2666/*
2667 * Perform a hardware rate measurement for a given clock.
2668 * FOR DEBUG USE ONLY: Measurements take ~15 ms!
2669 */
2670static unsigned long measure_clk_get_rate(struct clk *c)
2671{
2672 unsigned long flags;
2673 u32 gcc_xo4_reg_backup;
2674 u64 raw_count_short, raw_count_full;
2675 struct measure_clk *clk = to_measure_clk(c);
2676 unsigned ret;
2677
2678 ret = clk_prepare_enable(&gcc_xo_clk_src.c);
2679 if (ret) {
2680 pr_warning("CXO clock failed to enable. Can't measure\n");
2681 return 0;
2682 }
2683
2684 spin_lock_irqsave(&local_clock_reg_lock, flags);
2685
2686 /* Enable CXO/4 and RINGOSC branch. */
2687 gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2688 writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2689
2690 /*
2691 * The ring oscillator counter will not reset if the measured clock
2692 * is not running. To detect this, run a short measurement before
2693 * the full measurement. If the raw results of the two are the same
2694 * then the clock must be off.
2695 */
2696
2697 /* Run a short measurement. (~1 ms) */
2698 raw_count_short = run_measurement(0x1000);
2699 /* Run a full measurement. (~14 ms) */
2700 raw_count_full = run_measurement(clk->sample_ticks);
2701
2702 writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR));
2703
2704 /* Return 0 if the clock is off. */
2705 if (raw_count_full == raw_count_short) {
2706 ret = 0;
2707 } else {
2708 /* Compute rate in Hz. */
2709 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
2710 do_div(raw_count_full, ((clk->sample_ticks * 10) + 35));
2711 ret = (raw_count_full * clk->multiplier);
2712 }
2713
2714 writel_relaxed(0x51A00, GCC_REG_BASE(PLLTEST_PAD_CFG));
2715 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2716
2717 clk_disable_unprepare(&gcc_xo_clk_src.c);
2718
2719 return ret;
2720}
2721#else /* !CONFIG_DEBUG_FS */
2722static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
2723{
2724 return -EINVAL;
2725}
2726
2727static unsigned long measure_clk_get_rate(struct clk *clk)
2728{
2729 return 0;
2730}
2731#endif /* CONFIG_DEBUG_FS */
2732
2733static struct clk_ops clk_ops_measure = {
2734 .set_parent = measure_clk_set_parent,
2735 .get_rate = measure_clk_get_rate,
2736};
2737
2738static struct measure_clk measure_clk = {
2739 .c = {
2740 .dbg_name = "measure_clk",
2741 .ops = &clk_ops_measure,
2742 CLK_INIT(measure_clk.c),
2743 },
2744 .multiplier = 1,
2745};
2746
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08002747static struct clk_lookup msm_clocks_8610[] = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002748 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "msm_otg"),
2749 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fe200000.qcom,lpass"),
Vikram Mulukutlacee3bcf2013-03-13 15:55:45 -07002750
2751 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fc880000.qcom,mss"),
2752 CLK_LOOKUP("bus_clk", gcc_mss_q6_bimc_axi_clk.c, "fc880000.qcom,mss"),
2753 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, "fc880000.qcom,mss"),
2754 CLK_LOOKUP("mem_clk", gcc_boot_rom_ahb_clk.c, "fc880000.qcom,mss"),
2755
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002756 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "pil-mba"),
2757 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutla381df182013-01-28 11:39:51 -08002758 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fb21b000.qcom,pronto"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002759 CLK_LOOKUP("measure", measure_clk.c, "debug"),
2760
2761 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991f000.serial"),
2762 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "f991f000.serial"),
Hanumant Singhbbf01da2013-04-09 16:27:28 -07002763 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991e000.serial"),
2764 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, "f991e000.serial"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002765
2766 CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"),
2767 CLK_LOOKUP("bus_clk", pnoc_qseecom_clk.c, "qseecom"),
2768
2769 CLK_LOOKUP("bus_clk", snoc_clk.c, ""),
2770 CLK_LOOKUP("bus_clk", pnoc_clk.c, ""),
2771 CLK_LOOKUP("bus_clk", cnoc_clk.c, ""),
2772 CLK_LOOKUP("mem_clk", bimc_clk.c, ""),
2773 CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""),
2774 CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""),
2775 CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""),
2776 CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""),
2777
2778 CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"),
2779 CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"),
2780 CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"),
2781 CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"),
2782 CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"),
2783 CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"),
2784 CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"),
2785 CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"),
2786 CLK_LOOKUP("mem_clk", bimc_acpu_a_clk.c, ""),
Gagan Mac125029b2013-03-07 17:24:27 -07002787 CLK_LOOKUP("bus_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
2788 CLK_LOOKUP("bus_a_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002789
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002790 /* CoreSight clocks */
2791 CLK_LOOKUP("core_clk", qdss_clk.c, "fc326000.tmc"),
2792 CLK_LOOKUP("core_clk", qdss_clk.c, "fc320000.tpiu"),
2793 CLK_LOOKUP("core_clk", qdss_clk.c, "fc324000.replicator"),
2794 CLK_LOOKUP("core_clk", qdss_clk.c, "fc325000.tmc"),
2795 CLK_LOOKUP("core_clk", qdss_clk.c, "fc323000.funnel"),
2796 CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.funnel"),
2797 CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.funnel"),
2798 CLK_LOOKUP("core_clk", qdss_clk.c, "fc355000.funnel"),
2799 CLK_LOOKUP("core_clk", qdss_clk.c, "fc302000.stm"),
2800 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.etm"),
2801 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.etm"),
2802 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.etm"),
2803 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.etm"),
2804 CLK_LOOKUP("core_clk", qdss_clk.c, "fc301000.csr"),
2805 CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"),
2806 CLK_LOOKUP("core_clk", qdss_clk.c, "fc311000.cti"),
2807 CLK_LOOKUP("core_clk", qdss_clk.c, "fc312000.cti"),
2808 CLK_LOOKUP("core_clk", qdss_clk.c, "fc313000.cti"),
2809 CLK_LOOKUP("core_clk", qdss_clk.c, "fc314000.cti"),
2810 CLK_LOOKUP("core_clk", qdss_clk.c, "fc315000.cti"),
2811 CLK_LOOKUP("core_clk", qdss_clk.c, "fc316000.cti"),
2812 CLK_LOOKUP("core_clk", qdss_clk.c, "fc317000.cti"),
2813 CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.cti"),
2814 CLK_LOOKUP("core_clk", qdss_clk.c, "fc351000.cti"),
2815 CLK_LOOKUP("core_clk", qdss_clk.c, "fc352000.cti"),
2816 CLK_LOOKUP("core_clk", qdss_clk.c, "fc353000.cti"),
2817 CLK_LOOKUP("core_clk", qdss_clk.c, "fc354000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002818 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.jtagmm"),
2819 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.jtagmm"),
2820 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.jtagmm"),
2821 CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002822 CLK_LOOKUP("core_clk", qdss_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002823
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002824
2825 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc326000.tmc"),
2826 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc320000.tpiu"),
2827 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc324000.replicator"),
2828 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc325000.tmc"),
2829 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc323000.funnel"),
2830 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.funnel"),
2831 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.funnel"),
2832 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc355000.funnel"),
2833 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc302000.stm"),
2834 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.etm"),
2835 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.etm"),
2836 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.etm"),
2837 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.etm"),
2838 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc301000.csr"),
2839 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"),
2840 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc311000.cti"),
2841 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc312000.cti"),
2842 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc313000.cti"),
2843 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc314000.cti"),
2844 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc315000.cti"),
2845 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc316000.cti"),
2846 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc317000.cti"),
2847 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.cti"),
2848 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc351000.cti"),
2849 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc352000.cti"),
2850 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc353000.cti"),
2851 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc354000.cti"),
Aparna Das29e23432013-04-16 16:37:39 -07002852 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.jtagmm"),
2853 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.jtagmm"),
2854 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.jtagmm"),
2855 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.jtagmm"),
Aparna Das05172f22013-05-13 15:06:44 -07002856 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fd820018.hwevent"),
Aparna Das0f5a6ea2013-03-06 15:28:08 -08002857
Aparna Das05172f22013-05-13 15:06:44 -07002858 CLK_LOOKUP("core_mmss_clk", mmss_misc_ahb_clk.c, "fd820018.hwevent"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002859
2860 CLK_LOOKUP("core_clk_src", blsp1_qup1_spi_apps_clk_src.c, ""),
2861 CLK_LOOKUP("core_clk_src", blsp1_qup2_spi_apps_clk_src.c, ""),
2862 CLK_LOOKUP("core_clk_src", blsp1_qup3_spi_apps_clk_src.c, ""),
2863 CLK_LOOKUP("core_clk_src", blsp1_qup4_spi_apps_clk_src.c, ""),
2864 CLK_LOOKUP("core_clk_src", blsp1_qup5_spi_apps_clk_src.c, ""),
2865 CLK_LOOKUP("core_clk_src", blsp1_qup6_spi_apps_clk_src.c, ""),
2866 CLK_LOOKUP("core_clk_src", blsp1_uart1_apps_clk_src.c, ""),
2867 CLK_LOOKUP("core_clk_src", blsp1_uart2_apps_clk_src.c, ""),
2868 CLK_LOOKUP("core_clk_src", blsp1_uart3_apps_clk_src.c, ""),
2869 CLK_LOOKUP("core_clk_src", blsp1_uart4_apps_clk_src.c, ""),
2870 CLK_LOOKUP("core_clk_src", blsp1_uart5_apps_clk_src.c, ""),
2871 CLK_LOOKUP("core_clk_src", blsp1_uart6_apps_clk_src.c, ""),
2872 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""),
2873 CLK_LOOKUP("core_clk_src", gp1_clk_src.c, ""),
2874 CLK_LOOKUP("core_clk_src", gp2_clk_src.c, ""),
2875 CLK_LOOKUP("core_clk_src", gp3_clk_src.c, ""),
2876 CLK_LOOKUP("core_clk_src", pdm2_clk_src.c, ""),
2877 CLK_LOOKUP("core_clk_src", sdcc1_apps_clk_src.c, ""),
2878 CLK_LOOKUP("core_clk_src", sdcc2_apps_clk_src.c, ""),
2879 CLK_LOOKUP("core_clk_src", usb_hs_system_clk_src.c, ""),
Chun Zhangf39a0652013-05-01 15:57:54 -07002880 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9923000.i2c"),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002881 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002882 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9927000.i2c"),
Chun Zhangf39a0652013-05-01 15:57:54 -07002883 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, "f9923000.i2c"),
2884 CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002885 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, ""),
2886 CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, ""),
Gilad Avidovf84f2792013-01-31 13:26:39 -07002887 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002888 CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""),
2889 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""),
2890 CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""),
Kuirong Wangc6d072c2013-01-29 10:33:03 -08002891 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, "f9927000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002892 CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""),
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -06002893 CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9928000.i2c"),
2894 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, "f9928000.i2c"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002895 CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""),
2896 CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, ""),
2897 CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""),
2898 CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, ""),
2899 CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""),
2900 CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""),
2901 CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""),
2902 CLK_LOOKUP("iface_clk", gcc_boot_rom_ahb_clk.c, ""),
2903 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""),
2904 CLK_LOOKUP("core_clk", gcc_ce1_axi_clk.c, ""),
2905 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""),
2906 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c, ""),
2907 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, ""),
2908 CLK_LOOKUP("core_clk", gcc_gp1_clk.c, ""),
2909 CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""),
2910 CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""),
2911 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, ""),
2912 CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, ""),
2913 CLK_LOOKUP("core_clk", gcc_mss_q6_bimc_axi_clk.c, ""),
2914 CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""),
2915 CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""),
Hariprasad Dhalinarasimha2cced7d2013-04-13 17:25:58 -07002916 CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002917 CLK_LOOKUP("iface_clk", gcc_sdcc1_ahb_clk.c, "msm_sdcc.1"),
2918 CLK_LOOKUP("core_clk", gcc_sdcc1_apps_clk.c, "msm_sdcc.1"),
2919 CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"),
2920 CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"),
2921 CLK_LOOKUP("core_clk", gcc_usb2a_phy_sleep_clk.c, ""),
2922 CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"),
2923 CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"),
2924
2925 CLK_LOOKUP("core_clk_src", csi0_clk_src.c, ""),
2926 CLK_LOOKUP("core_clk_src", axi_clk_src.c, ""),
Vikram Mulukutlae1e5c482013-01-28 14:43:20 -08002927 CLK_LOOKUP("", mdp_axi_clk_src.c, ""),
2928 CLK_LOOKUP("", mmssnoc_axi_clk_src.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002929 CLK_LOOKUP("core_clk_src", dsi_pclk_clk_src.c, ""),
2930 CLK_LOOKUP("core_clk_src", gfx3d_clk_src.c, ""),
2931 CLK_LOOKUP("core_clk_src", vfe_clk_src.c, ""),
2932 CLK_LOOKUP("core_clk_src", csi1_clk_src.c, ""),
2933 CLK_LOOKUP("core_clk_src", csi0phytimer_clk_src.c, ""),
2934 CLK_LOOKUP("core_clk_src", csi1phytimer_clk_src.c, ""),
2935 CLK_LOOKUP("core_clk_src", dsi_clk_src.c, ""),
2936 CLK_LOOKUP("core_clk_src", dsi_byte_clk_src.c, ""),
2937 CLK_LOOKUP("core_clk_src", dsi_esc_clk_src.c, ""),
2938 CLK_LOOKUP("core_clk_src", mclk0_clk_src.c, ""),
2939 CLK_LOOKUP("core_clk_src", mclk1_clk_src.c, ""),
2940 CLK_LOOKUP("core_clk_src", mdp_vsync_clk_src.c, ""),
2941
2942 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, ""),
2943 CLK_LOOKUP("core_clk", csi0_clk.c, ""),
2944 CLK_LOOKUP("core_clk", csi0phy_clk.c, ""),
2945 CLK_LOOKUP("core_clk", csi0phytimer_clk.c, ""),
2946 CLK_LOOKUP("core_clk", csi0pix_clk.c, ""),
2947 CLK_LOOKUP("core_clk", csi0rdi_clk.c, ""),
2948 CLK_LOOKUP("core_clk", csi1_clk.c, ""),
2949 CLK_LOOKUP("core_clk", csi1phy_clk.c, ""),
2950 CLK_LOOKUP("core_clk", csi1phytimer_clk.c, ""),
2951 CLK_LOOKUP("core_clk", csi1pix_clk.c, ""),
2952 CLK_LOOKUP("core_clk", csi1rdi_clk.c, ""),
2953 CLK_LOOKUP("core_clk", csi_ahb_clk.c, ""),
2954 CLK_LOOKUP("core_clk", csi_vfe_clk.c, ""),
2955 CLK_LOOKUP("core_clk", dsi_clk.c, ""),
2956 CLK_LOOKUP("core_clk", dsi_ahb_clk.c, ""),
2957 CLK_LOOKUP("core_clk", dsi_byte_clk.c, ""),
2958 CLK_LOOKUP("core_clk", dsi_esc_clk.c, ""),
2959 CLK_LOOKUP("core_clk", dsi_pclk_clk.c, ""),
2960 CLK_LOOKUP("core_clk", gmem_gfx3d_clk.c, ""),
2961 CLK_LOOKUP("core_clk", mclk0_clk.c, ""),
2962 CLK_LOOKUP("core_clk", mclk1_clk.c, ""),
2963 CLK_LOOKUP("core_clk", mdp_ahb_clk.c, ""),
2964 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
2965 CLK_LOOKUP("core_clk", mdp_dsi_clk.c, ""),
2966 CLK_LOOKUP("core_clk", mdp_lcdc_clk.c, ""),
2967 CLK_LOOKUP("core_clk", mdp_vsync_clk.c, ""),
2968 CLK_LOOKUP("core_clk", mmss_misc_ahb_clk.c, ""),
2969 CLK_LOOKUP("core_clk", mmss_s0_axi_clk.c, ""),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002970 CLK_LOOKUP("core_clk", mmss_mmssnoc_bto_ahb_clk.c, ""),
2971 CLK_LOOKUP("core_clk", mmss_mmssnoc_axi_clk.c, ""),
2972 CLK_LOOKUP("core_clk", vfe_clk.c, ""),
2973 CLK_LOOKUP("core_clk", vfe_ahb_clk.c, ""),
2974 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
2975
Vikram Mulukutla49423392013-05-02 09:03:02 -07002976 CLK_LOOKUP("core_clk", csi0pix_cam_mux_clk.c, ""),
2977 CLK_LOOKUP("core_clk", csi0phy_cam_mux_clk.c, ""),
2978 CLK_LOOKUP("core_clk", csi1phy_cam_mux_clk.c, ""),
2979 CLK_LOOKUP("core_clk", rdi2_cam_mux_clk.c, ""),
2980 CLK_LOOKUP("core_clk", rdi1_cam_mux_clk.c, ""),
2981 CLK_LOOKUP("core_clk", rdi0_cam_mux_clk.c, ""),
Vikram Mulukutla8964a382013-04-10 14:30:50 -07002982
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002983 CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
2984 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fdc00000.qcom,kgsl-3d0"),
2985 CLK_LOOKUP("mem_iface_clk", bimc_gfx_clk.c, "fdc00000.qcom,kgsl-3d0"),
2986 CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07002987 CLK_LOOKUP("alt_mem_iface_clk", gcc_bimc_smmu_clk.c,
2988 "fdc00000.qcom,kgsl-3d0"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002989
2990 CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd890000.qcom,iommu"),
2991 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "fd890000.qcom,iommu"),
2992 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd860000.qcom,iommu"),
2993 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd860000.qcom,iommu"),
2994 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd870000.qcom,iommu"),
2995 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd870000.qcom,iommu"),
2996 CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd880000.qcom,iommu"),
2997 CLK_LOOKUP("core_clk", bimc_gfx_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutla55318acb2013-04-15 17:47:34 -07002998 CLK_LOOKUP("alt_core_clk", gcc_bimc_smmu_clk.c, "fd880000.qcom,iommu"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07002999 CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, "fd000000.qcom,iommu"),
3000 CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, "fd000000.qcom,iommu"),
3001 CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c,
3002 "fd010000.qcom,iommu"),
3003 CLK_LOOKUP("core_clk", pnoc_iommu_clk.c, "fd010000.qcom,iommu"),
3004
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003005 CLK_LOOKUP("core_clk", q6ss_xo_clk.c, "fe200000.qcom,lpass"),
3006 CLK_LOOKUP("bus_clk", gcc_lpass_q6_axi_clk.c, "fe200000.qcom,lpass"),
3007 CLK_LOOKUP("iface_clk", q6ss_ahb_lfabif_clk.c, "fe200000.qcom,lpass"),
3008 CLK_LOOKUP("reg_clk", q6ss_ahbm_clk.c, "fe200000.qcom,lpass"),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003009
3010 CLK_LOOKUP("xo", gcc_xo_a_clk_src.c, "f9011050.qcom,acpuclk"),
3011 CLK_LOOKUP("gpll0", gpll0_ao_clk_src.c, "f9011050.qcom,acpuclk"),
3012 CLK_LOOKUP("a7sspll", a7sspll.c, "f9011050.qcom,acpuclk"),
3013
3014 CLK_LOOKUP("measure_clk", apc0_m_clk, ""),
3015 CLK_LOOKUP("measure_clk", apc1_m_clk, ""),
3016 CLK_LOOKUP("measure_clk", apc2_m_clk, ""),
3017 CLK_LOOKUP("measure_clk", apc3_m_clk, ""),
3018 CLK_LOOKUP("measure_clk", l2_m_clk, ""),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003019
Vikram Mulukutlaed078512013-04-09 14:15:33 -07003020 CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutla7e5b3112013-04-15 16:32:40 -07003021 CLK_LOOKUP("rf_clk", cxo_a1.c, "fb000000.qcom,wcnss-wlan"),
Vikram Mulukutlaed078512013-04-09 14:15:33 -07003022
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003023 CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd900000.qcom,mdss_mdp"),
3024 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd900000.qcom,mdss_mdp"),
3025 CLK_LOOKUP("lcdc_clk", mdp_lcdc_clk.c, "fd900000.qcom,mdss_mdp"),
3026 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003027 CLK_LOOKUP("dsi_clk", mdp_dsi_clk.c, "fd900000.qcom,mdss_mdp"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003028 CLK_LOOKUP("iface_clk", dsi_ahb_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhoud58589e2013-04-10 22:30:51 -04003029 CLK_LOOKUP("dsi_clk", dsi_clk.c, "fdd00000.qcom,mdss_dsi"),
Xiaoming Zhou8150acf2013-04-04 16:31:17 -04003030 CLK_LOOKUP("byte_clk", dsi_byte_clk.c, "fdd00000.qcom,mdss_dsi"),
3031 CLK_LOOKUP("esc_clk", dsi_esc_clk.c, "fdd00000.qcom,mdss_dsi"),
3032 CLK_LOOKUP("pixel_clk", dsi_pclk_clk.c, "fdd00000.qcom,mdss_dsi"),
Hariprasad Dhalinarasimhad9ede5a2013-04-14 16:30:09 -07003033
3034 /* QSEECOM Clocks */
3035 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "qseecom"),
3036 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "qseecom"),
3037 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "qseecom"),
3038 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "qseecom"),
Vikram Mulukutlafd6833c2013-04-18 12:46:48 -07003039
3040 CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "scm"),
3041 CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "scm"),
3042 CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "scm"),
3043 CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "scm"),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003044};
3045
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003046static struct clk_lookup msm_clocks_8610_rumi[] = {
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003047 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3048 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
3049 CLK_DUMMY("iface_clk", HSUSB_IFACE_CLK, "f9a55000.usb", OFF),
3050 CLK_DUMMY("core_clk", HSUSB_CORE_CLK, "f9a55000.usb", OFF),
3051 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.1", OFF),
3052 CLK_DUMMY("core_clk", NULL, "msm_sdcc.1", OFF),
3053 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.1", OFF),
3054 CLK_DUMMY("iface_clk", NULL, "msm_sdcc.2", OFF),
3055 CLK_DUMMY("core_clk", NULL, "msm_sdcc.2", OFF),
3056 CLK_DUMMY("bus_clk", NULL, "msm_sdcc.2", OFF),
3057 CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
3058 CLK_DUMMY("iface_clk", NULL, "fd890000.qcom,iommu", OFF),
3059 CLK_DUMMY("core_clk", NULL, "fd890000.qcom,iommu", OFF),
3060 CLK_DUMMY("iface_clk", NULL, "fd860000.qcom,iommu", OFF),
3061 CLK_DUMMY("core_clk", NULL, "fd860000.qcom,iommu", OFF),
3062 CLK_DUMMY("iface_clk", NULL, "fd870000.qcom,iommu", OFF),
3063 CLK_DUMMY("core_clk", NULL, "fd870000.qcom,iommu", OFF),
3064 CLK_DUMMY("iface_clk", NULL, "fd880000.qcom,iommu", OFF),
3065 CLK_DUMMY("core_clk", NULL, "fd880000.qcom,iommu", OFF),
Olav Haugan3431b4c2013-04-30 14:09:08 -07003066 CLK_DUMMY("alt_core_clk", NULL, "fd880000.qcom,iommu", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003067 CLK_DUMMY("iface_clk", NULL, "fd000000.qcom,iommu", OFF),
3068 CLK_DUMMY("core_clk", NULL, "fd000000.qcom,iommu", OFF),
3069 CLK_DUMMY("iface_clk", NULL, "fd010000.qcom,iommu", OFF),
3070 CLK_DUMMY("core_clk", NULL, "fd010000.qcom,iommu", OFF),
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003071 CLK_DUMMY("xo", NULL, "f9011050.qcom,acpuclk", OFF),
3072 CLK_DUMMY("gpll0", NULL, "f9011050.qcom,acpuclk", OFF),
3073 CLK_DUMMY("a7sspll", NULL, "f9011050.qcom,acpuclk", OFF),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003074};
3075
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003076struct clock_init_data msm8610_rumi_clock_init_data __initdata = {
3077 .table = msm_clocks_8610_rumi,
3078 .size = ARRAY_SIZE(msm_clocks_8610_rumi),
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003079};
3080
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003081/* MMPLL0 at 800 MHz, main output enabled. */
3082static struct pll_config mmpll0_config __initdata = {
3083 .l = 0x29,
3084 .m = 0x2,
3085 .n = 0x3,
3086 .vco_val = 0x0,
3087 .vco_mask = BM(21, 20),
3088 .pre_div_val = 0x0,
3089 .pre_div_mask = BM(14, 12),
3090 .post_div_val = 0x0,
3091 .post_div_mask = BM(9, 8),
3092 .mn_ena_val = BIT(24),
3093 .mn_ena_mask = BIT(24),
3094 .main_output_val = BIT(0),
3095 .main_output_mask = BIT(0),
3096};
3097
3098/* MMPLL1 at 1200 MHz, main output enabled. */
3099static struct pll_config mmpll1_config __initdata = {
3100 .l = 0x3E,
3101 .m = 0x1,
3102 .n = 0x2,
3103 .vco_val = 0x0,
3104 .vco_mask = BM(21, 20),
3105 .pre_div_val = 0x0,
3106 .pre_div_mask = BM(14, 12),
3107 .post_div_val = 0x0,
3108 .post_div_mask = BM(9, 8),
3109 .mn_ena_val = BIT(24),
3110 .mn_ena_mask = BIT(24),
3111 .main_output_val = BIT(0),
3112 .main_output_mask = BIT(0),
3113};
3114
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003115static void __init reg_init(void)
3116{
Vikram Mulukutla81577ab2013-03-25 10:55:36 -07003117 u32 regval;
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003118
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003119 configure_sr_hpm_lp_pll(&mmpll0_config, &mmpll0_regs, 1);
3120 configure_sr_hpm_lp_pll(&mmpll1_config, &mmpll1_regs, 1);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003121
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003122 /* Vote for GPLL0 to turn on. Needed by acpuclock. */
3123 regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3124 regval |= BIT(0);
3125 writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE));
3126
3127 /*
3128 * TODO: Confirm that no clocks need to be voted on in this sleep vote
3129 * register.
3130 */
3131 writel_relaxed(0x0, GCC_REG_BASE(APCS_CLOCK_SLEEP_ENA_VOTE));
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003132}
3133
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003134static void __init msm8610_clock_post_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003135{
3136 /*
3137 * Hold an active set vote for CXO; this is because CXO is expected
3138 * to remain on whenever CPUs aren't power collapsed.
3139 */
3140 clk_prepare_enable(&gcc_xo_a_clk_src.c);
3141
3142
3143 /* Set rates for single-rate clocks. */
3144 clk_set_rate(&usb_hs_system_clk_src.c,
3145 usb_hs_system_clk_src.freq_tbl[0].freq_hz);
3146 clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz);
3147 clk_set_rate(&mclk0_clk_src.c, mclk0_clk_src.freq_tbl[0].freq_hz);
3148 clk_set_rate(&mclk1_clk_src.c, mclk1_clk_src.freq_tbl[0].freq_hz);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003149}
3150
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003151static void dsi_init(void)
3152{
3153 dsi_byte_clk_src_ops = clk_ops_rcg;
3154 dsi_byte_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3155 dsi_byte_clk_src_ops.handoff = byte_rcg_handoff;
3156 dsi_byte_clk_src_ops.get_parent = NULL;
3157
3158 dsi_dsi_clk_src_ops = clk_ops_rcg_mnd;
3159 dsi_dsi_clk_src_ops.set_rate = set_rate_dsi_clk;
3160 dsi_dsi_clk_src_ops.handoff = pixel_rcg_handoff;
3161 dsi_dsi_clk_src_ops.get_parent = NULL;
3162
3163 dsi_pixel_clk_src_ops = clk_ops_rcg_mnd;
3164 dsi_pixel_clk_src_ops.set_rate = set_rate_pixel_byte_clk;
3165 dsi_pixel_clk_src_ops.handoff = pixel_rcg_handoff;
3166 dsi_pixel_clk_src_ops.get_parent = NULL;
3167
3168 dsi_clk_ctrl_init(&dsi_ahb_clk.c);
3169}
3170
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003171#define GCC_CC_PHYS 0xFC400000
3172#define GCC_CC_SIZE SZ_16K
3173
3174#define MMSS_CC_PHYS 0xFD8C0000
3175#define MMSS_CC_SIZE SZ_256K
3176
3177#define LPASS_CC_PHYS 0xFE000000
3178#define LPASS_CC_SIZE SZ_256K
3179
3180#define APCS_GCC_CC_PHYS 0xF9011000
3181#define APCS_GCC_CC_SIZE SZ_4K
3182
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003183#define APCS_KPSS_SH_PLL_PHYS 0xF9016000
3184#define APCS_KPSS_SH_PLL_SIZE SZ_64
3185
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003186static void __init msm8610_clock_pre_init(void)
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003187{
3188 virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE);
3189 if (!virt_bases[GCC_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003190 panic("clock-8610: Unable to ioremap GCC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003191
3192 virt_bases[MMSS_BASE] = ioremap(MMSS_CC_PHYS, MMSS_CC_SIZE);
3193 if (!virt_bases[MMSS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003194 panic("clock-8610: Unable to ioremap MMSS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003195
3196 virt_bases[LPASS_BASE] = ioremap(LPASS_CC_PHYS, LPASS_CC_SIZE);
3197 if (!virt_bases[LPASS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003198 panic("clock-8610: Unable to ioremap LPASS_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003199
3200 virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE);
3201 if (!virt_bases[APCS_BASE])
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003202 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003203
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003204 virt_bases[APCS_PLL_BASE] = ioremap(APCS_KPSS_SH_PLL_PHYS,
3205 APCS_KPSS_SH_PLL_SIZE);
3206 if (!virt_bases[APCS_PLL_BASE])
3207 panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!");
3208
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003209 clk_ops_local_pll.enable = sr_hpm_lp_pll_clk_enable;
3210
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003211 vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig");
3212 if (IS_ERR(vdd_dig.regulator[0]))
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003213 panic("clock-8610: Unable to get the vdd_dig regulator!");
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003214
Patrick Dalyebc26bc2013-02-05 11:49:07 -08003215 vdd_sr2_pll.regulator[0] = regulator_get(NULL, "vdd_sr2_pll");
3216 if (IS_ERR(vdd_sr2_pll.regulator[0]))
Vikram Mulukutla4157cca2013-01-24 15:42:41 -08003217 panic("clock-8610: Unable to get the vdd_sr2_pll regulator!");
3218
Patrick Daly6fb589a2013-03-29 17:55:55 -07003219 vdd_sr2_pll.regulator[1] = regulator_get(NULL, "vdd_sr2_dig");
3220 if (IS_ERR(vdd_sr2_pll.regulator[1]))
3221 panic("clock-8610: Unable to get the vdd_sr2_dig regulator!");
3222
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003223 enable_rpm_scaling();
3224
3225 /* Enable a clock to allow access to MMSS clock registers */
3226 clk_prepare_enable(&gcc_mmss_noc_cfg_ahb_clk.c),
3227
3228 reg_init();
3229
Vikram Mulukutlae03b4b62013-03-20 17:45:37 -07003230 dsi_init();
3231
Vikram Mulukutla82cb8442013-01-28 13:36:51 -08003232 /* Maintain the max nominal frequency on the MMSSNOC AHB bus. */
3233 clk_set_rate(&mmssnoc_ahb_a_clk.c, 40000000);
3234 clk_prepare_enable(&mmssnoc_ahb_a_clk.c);
3235
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003236 /* TODO: Remove this once the bus driver is in place */
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003237 clk_set_rate(&axi_clk_src.c, 200000000);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003238 clk_prepare_enable(&mmss_s0_axi_clk.c);
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003239}
3240
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08003241struct clock_init_data msm8610_clock_init_data __initdata = {
3242 .table = msm_clocks_8610,
3243 .size = ARRAY_SIZE(msm_clocks_8610),
3244 .pre_init = msm8610_clock_pre_init,
3245 .post_init = msm8610_clock_post_init,
Vikram Mulukutlab13abe42012-10-03 11:38:48 -07003246};