blob: 8f00533959a50c20076b5d0c0310748180a23945 [file] [log] [blame]
Viresh Kumar0b928af2012-04-19 22:23:13 +05301/*
2 * arch/arm/mach-spear13xx/spear1340_clock.c
3 *
4 * SPEAr1340 machine clock framework source file
5 *
6 * Copyright (C) 2012 ST Microelectronics
Viresh Kumar10d89352012-06-20 12:53:02 -07007 * Viresh Kumar <viresh.linux@gmail.com>
Viresh Kumar0b928af2012-04-19 22:23:13 +05308 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/clk.h>
15#include <linux/clkdev.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/of_platform.h>
19#include <linux/spinlock_types.h>
20#include <mach/spear.h>
21#include "clk.h"
22
23/* Clock Configuration Registers */
24#define SPEAR1340_SYS_CLK_CTRL (VA_MISC_BASE + 0x200)
25 #define SPEAR1340_HCLK_SRC_SEL_SHIFT 27
26 #define SPEAR1340_HCLK_SRC_SEL_MASK 1
27 #define SPEAR1340_SCLK_SRC_SEL_SHIFT 23
28 #define SPEAR1340_SCLK_SRC_SEL_MASK 3
29
30/* PLL related registers and bit values */
31#define SPEAR1340_PLL_CFG (VA_MISC_BASE + 0x210)
32 /* PLL_CFG bit values */
33 #define SPEAR1340_CLCD_SYNT_CLK_MASK 1
34 #define SPEAR1340_CLCD_SYNT_CLK_SHIFT 31
35 #define SPEAR1340_GEN_SYNT2_3_CLK_SHIFT 29
36 #define SPEAR1340_GEN_SYNT_CLK_MASK 2
37 #define SPEAR1340_GEN_SYNT0_1_CLK_SHIFT 27
38 #define SPEAR1340_PLL_CLK_MASK 2
39 #define SPEAR1340_PLL3_CLK_SHIFT 24
40 #define SPEAR1340_PLL2_CLK_SHIFT 22
41 #define SPEAR1340_PLL1_CLK_SHIFT 20
42
43#define SPEAR1340_PLL1_CTR (VA_MISC_BASE + 0x214)
44#define SPEAR1340_PLL1_FRQ (VA_MISC_BASE + 0x218)
45#define SPEAR1340_PLL2_CTR (VA_MISC_BASE + 0x220)
46#define SPEAR1340_PLL2_FRQ (VA_MISC_BASE + 0x224)
47#define SPEAR1340_PLL3_CTR (VA_MISC_BASE + 0x22C)
48#define SPEAR1340_PLL3_FRQ (VA_MISC_BASE + 0x230)
49#define SPEAR1340_PLL4_CTR (VA_MISC_BASE + 0x238)
50#define SPEAR1340_PLL4_FRQ (VA_MISC_BASE + 0x23C)
51#define SPEAR1340_PERIP_CLK_CFG (VA_MISC_BASE + 0x244)
52 /* PERIP_CLK_CFG bit values */
53 #define SPEAR1340_SPDIF_CLK_MASK 1
54 #define SPEAR1340_SPDIF_OUT_CLK_SHIFT 15
55 #define SPEAR1340_SPDIF_IN_CLK_SHIFT 14
56 #define SPEAR1340_GPT3_CLK_SHIFT 13
57 #define SPEAR1340_GPT2_CLK_SHIFT 12
58 #define SPEAR1340_GPT_CLK_MASK 1
59 #define SPEAR1340_GPT1_CLK_SHIFT 9
60 #define SPEAR1340_GPT0_CLK_SHIFT 8
61 #define SPEAR1340_UART_CLK_MASK 2
62 #define SPEAR1340_UART1_CLK_SHIFT 6
63 #define SPEAR1340_UART0_CLK_SHIFT 4
64 #define SPEAR1340_CLCD_CLK_MASK 2
65 #define SPEAR1340_CLCD_CLK_SHIFT 2
66 #define SPEAR1340_C3_CLK_MASK 1
67 #define SPEAR1340_C3_CLK_SHIFT 1
68
69#define SPEAR1340_GMAC_CLK_CFG (VA_MISC_BASE + 0x248)
70 #define SPEAR1340_GMAC_PHY_CLK_MASK 1
71 #define SPEAR1340_GMAC_PHY_CLK_SHIFT 2
72 #define SPEAR1340_GMAC_PHY_INPUT_CLK_MASK 2
73 #define SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT 0
74
75#define SPEAR1340_I2S_CLK_CFG (VA_MISC_BASE + 0x24C)
76 /* I2S_CLK_CFG register mask */
77 #define SPEAR1340_I2S_SCLK_X_MASK 0x1F
78 #define SPEAR1340_I2S_SCLK_X_SHIFT 27
79 #define SPEAR1340_I2S_SCLK_Y_MASK 0x1F
80 #define SPEAR1340_I2S_SCLK_Y_SHIFT 22
81 #define SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT 21
82 #define SPEAR1340_I2S_SCLK_SYNTH_ENB 20
83 #define SPEAR1340_I2S_PRS1_CLK_X_MASK 0xFF
84 #define SPEAR1340_I2S_PRS1_CLK_X_SHIFT 12
85 #define SPEAR1340_I2S_PRS1_CLK_Y_MASK 0xFF
86 #define SPEAR1340_I2S_PRS1_CLK_Y_SHIFT 4
87 #define SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT 3
88 #define SPEAR1340_I2S_REF_SEL_MASK 1
89 #define SPEAR1340_I2S_REF_SHIFT 2
90 #define SPEAR1340_I2S_SRC_CLK_MASK 2
91 #define SPEAR1340_I2S_SRC_CLK_SHIFT 0
92
93#define SPEAR1340_C3_CLK_SYNT (VA_MISC_BASE + 0x250)
94#define SPEAR1340_UART0_CLK_SYNT (VA_MISC_BASE + 0x254)
95#define SPEAR1340_UART1_CLK_SYNT (VA_MISC_BASE + 0x258)
96#define SPEAR1340_GMAC_CLK_SYNT (VA_MISC_BASE + 0x25C)
97#define SPEAR1340_SDHCI_CLK_SYNT (VA_MISC_BASE + 0x260)
98#define SPEAR1340_CFXD_CLK_SYNT (VA_MISC_BASE + 0x264)
99#define SPEAR1340_ADC_CLK_SYNT (VA_MISC_BASE + 0x270)
100#define SPEAR1340_AMBA_CLK_SYNT (VA_MISC_BASE + 0x274)
101#define SPEAR1340_CLCD_CLK_SYNT (VA_MISC_BASE + 0x27C)
102#define SPEAR1340_SYS_CLK_SYNT (VA_MISC_BASE + 0x284)
103#define SPEAR1340_GEN_CLK_SYNT0 (VA_MISC_BASE + 0x28C)
104#define SPEAR1340_GEN_CLK_SYNT1 (VA_MISC_BASE + 0x294)
105#define SPEAR1340_GEN_CLK_SYNT2 (VA_MISC_BASE + 0x29C)
106#define SPEAR1340_GEN_CLK_SYNT3 (VA_MISC_BASE + 0x304)
107#define SPEAR1340_PERIP1_CLK_ENB (VA_MISC_BASE + 0x30C)
108 #define SPEAR1340_RTC_CLK_ENB 31
109 #define SPEAR1340_ADC_CLK_ENB 30
110 #define SPEAR1340_C3_CLK_ENB 29
111 #define SPEAR1340_CLCD_CLK_ENB 27
112 #define SPEAR1340_DMA_CLK_ENB 25
113 #define SPEAR1340_GPIO1_CLK_ENB 24
114 #define SPEAR1340_GPIO0_CLK_ENB 23
115 #define SPEAR1340_GPT1_CLK_ENB 22
116 #define SPEAR1340_GPT0_CLK_ENB 21
117 #define SPEAR1340_I2S_PLAY_CLK_ENB 20
118 #define SPEAR1340_I2S_REC_CLK_ENB 19
119 #define SPEAR1340_I2C0_CLK_ENB 18
120 #define SPEAR1340_SSP_CLK_ENB 17
121 #define SPEAR1340_UART0_CLK_ENB 15
122 #define SPEAR1340_PCIE_SATA_CLK_ENB 12
123 #define SPEAR1340_UOC_CLK_ENB 11
124 #define SPEAR1340_UHC1_CLK_ENB 10
125 #define SPEAR1340_UHC0_CLK_ENB 9
126 #define SPEAR1340_GMAC_CLK_ENB 8
127 #define SPEAR1340_CFXD_CLK_ENB 7
128 #define SPEAR1340_SDHCI_CLK_ENB 6
129 #define SPEAR1340_SMI_CLK_ENB 5
130 #define SPEAR1340_FSMC_CLK_ENB 4
131 #define SPEAR1340_SYSRAM0_CLK_ENB 3
132 #define SPEAR1340_SYSRAM1_CLK_ENB 2
133 #define SPEAR1340_SYSROM_CLK_ENB 1
134 #define SPEAR1340_BUS_CLK_ENB 0
135
136#define SPEAR1340_PERIP2_CLK_ENB (VA_MISC_BASE + 0x310)
137 #define SPEAR1340_THSENS_CLK_ENB 8
138 #define SPEAR1340_I2S_REF_PAD_CLK_ENB 7
139 #define SPEAR1340_ACP_CLK_ENB 6
140 #define SPEAR1340_GPT3_CLK_ENB 5
141 #define SPEAR1340_GPT2_CLK_ENB 4
142 #define SPEAR1340_KBD_CLK_ENB 3
143 #define SPEAR1340_CPU_DBG_CLK_ENB 2
144 #define SPEAR1340_DDR_CORE_CLK_ENB 1
145 #define SPEAR1340_DDR_CTRL_CLK_ENB 0
146
147#define SPEAR1340_PERIP3_CLK_ENB (VA_MISC_BASE + 0x314)
148 #define SPEAR1340_PLGPIO_CLK_ENB 18
149 #define SPEAR1340_VIDEO_DEC_CLK_ENB 16
150 #define SPEAR1340_VIDEO_ENC_CLK_ENB 15
151 #define SPEAR1340_SPDIF_OUT_CLK_ENB 13
152 #define SPEAR1340_SPDIF_IN_CLK_ENB 12
153 #define SPEAR1340_VIDEO_IN_CLK_ENB 11
154 #define SPEAR1340_CAM0_CLK_ENB 10
155 #define SPEAR1340_CAM1_CLK_ENB 9
156 #define SPEAR1340_CAM2_CLK_ENB 8
157 #define SPEAR1340_CAM3_CLK_ENB 7
158 #define SPEAR1340_MALI_CLK_ENB 6
159 #define SPEAR1340_CEC0_CLK_ENB 5
160 #define SPEAR1340_CEC1_CLK_ENB 4
161 #define SPEAR1340_PWM_CLK_ENB 3
162 #define SPEAR1340_I2C1_CLK_ENB 2
163 #define SPEAR1340_UART1_CLK_ENB 1
164
165static DEFINE_SPINLOCK(_lock);
166
167/* pll rate configuration table, in ascending order of rates */
168static struct pll_rate_tbl pll_rtbl[] = {
169 /* PCLK 24MHz */
170 {.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
171 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
172 {.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
173 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
174 {.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
175 {.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
176 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
177 {.mode = 0, .m = 0x96, .n = 0x06, .p = 0x0}, /* vco 1200, pll 1200 MHz */
178};
179
180/* vco-pll4 rate configuration table, in ascending order of rates */
181static struct pll_rate_tbl pll4_rtbl[] = {
182 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
183 {.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
184 {.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
185 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
186};
187
188/*
189 * All below entries generate 166 MHz for
190 * different values of vco1div2
191 */
192static struct frac_rate_tbl amba_synth_rtbl[] = {
193 {.div = 0x06062}, /* for vco1div2 = 500 MHz */
194 {.div = 0x04D1B}, /* for vco1div2 = 400 MHz */
195 {.div = 0x04000}, /* for vco1div2 = 332 MHz */
196 {.div = 0x03031}, /* for vco1div2 = 250 MHz */
197 {.div = 0x0268D}, /* for vco1div2 = 200 MHz */
198};
199
200/*
201 * Synthesizer Clock derived from vcodiv2. This clock is one of the
202 * possible clocks to feed cpu directly.
203 * We can program this synthesizer to make cpu run on different clock
204 * frequencies.
205 * Following table provides configuration values to let cpu run on 200,
206 * 250, 332, 400 or 500 MHz considering different possibilites of input
207 * (vco1div2) clock.
208 *
209 * --------------------------------------------------------------------
210 * vco1div2(Mhz) fout(Mhz) cpuclk = fout/2 div
211 * --------------------------------------------------------------------
212 * 400 200 100 0x04000
213 * 400 250 125 0x03333
214 * 400 332 166 0x0268D
215 * 400 400 200 0x02000
216 * --------------------------------------------------------------------
217 * 500 200 100 0x05000
218 * 500 250 125 0x04000
219 * 500 332 166 0x03031
220 * 500 400 200 0x02800
221 * 500 500 250 0x02000
222 * --------------------------------------------------------------------
223 * 664 200 100 0x06a38
224 * 664 250 125 0x054FD
225 * 664 332 166 0x04000
226 * 664 400 200 0x0351E
227 * 664 500 250 0x02A7E
228 * --------------------------------------------------------------------
229 * 800 200 100 0x08000
230 * 800 250 125 0x06666
231 * 800 332 166 0x04D18
232 * 800 400 200 0x04000
233 * 800 500 250 0x03333
234 * --------------------------------------------------------------------
235 * sys rate configuration table is in descending order of divisor.
236 */
237static struct frac_rate_tbl sys_synth_rtbl[] = {
238 {.div = 0x08000},
239 {.div = 0x06a38},
240 {.div = 0x06666},
241 {.div = 0x054FD},
242 {.div = 0x05000},
243 {.div = 0x04D18},
244 {.div = 0x04000},
245 {.div = 0x0351E},
246 {.div = 0x03333},
247 {.div = 0x03031},
248 {.div = 0x02A7E},
249 {.div = 0x02800},
250 {.div = 0x0268D},
251 {.div = 0x02000},
252};
253
254/* aux rate configuration table, in ascending order of rates */
255static struct aux_rate_tbl aux_rtbl[] = {
256 /* For VCO1div2 = 500 MHz */
257 {.xscale = 10, .yscale = 204, .eq = 0}, /* 12.29 MHz */
258 {.xscale = 4, .yscale = 21, .eq = 0}, /* 48 MHz */
259 {.xscale = 2, .yscale = 6, .eq = 0}, /* 83 MHz */
260 {.xscale = 2, .yscale = 4, .eq = 0}, /* 125 MHz */
261 {.xscale = 1, .yscale = 3, .eq = 1}, /* 166 MHz */
262 {.xscale = 1, .yscale = 2, .eq = 1}, /* 250 MHz */
263};
264
265/* gmac rate configuration table, in ascending order of rates */
266static struct aux_rate_tbl gmac_rtbl[] = {
267 /* For gmac phy input clk */
268 {.xscale = 2, .yscale = 6, .eq = 0}, /* divided by 6 */
269 {.xscale = 2, .yscale = 4, .eq = 0}, /* divided by 4 */
270 {.xscale = 1, .yscale = 3, .eq = 1}, /* divided by 3 */
271 {.xscale = 1, .yscale = 2, .eq = 1}, /* divided by 2 */
272};
273
274/* clcd rate configuration table, in ascending order of rates */
275static struct frac_rate_tbl clcd_rtbl[] = {
276 {.div = 0x14000}, /* 25 Mhz , for vc01div4 = 250 MHz*/
277 {.div = 0x1284B}, /* 27 Mhz , for vc01div4 = 250 MHz*/
278 {.div = 0x0D8D3}, /* 58 Mhz , for vco1div4 = 393 MHz */
279 {.div = 0x0B72C}, /* 58 Mhz , for vco1div4 = 332 MHz */
280 {.div = 0x089EE}, /* 58 Mhz , for vc01div4 = 250 MHz*/
281 {.div = 0x07BA0}, /* 65 Mhz , for vc01div4 = 250 MHz*/
282 {.div = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
283 {.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
284 {.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
285 {.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
286 {.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
287 {.div = 0x0360D}, /* 148 Mhz , for vc01div4 = 250 MHz*/
288 {.div = 0x035E0}, /* 148.5 MHz, for vc01div4 = 250 MHz*/
289};
290
291/* i2s prescaler1 masks */
292static struct aux_clk_masks i2s_prs1_masks = {
293 .eq_sel_mask = AUX_EQ_SEL_MASK,
294 .eq_sel_shift = SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT,
295 .eq1_mask = AUX_EQ1_SEL,
296 .eq2_mask = AUX_EQ2_SEL,
297 .xscale_sel_mask = SPEAR1340_I2S_PRS1_CLK_X_MASK,
298 .xscale_sel_shift = SPEAR1340_I2S_PRS1_CLK_X_SHIFT,
299 .yscale_sel_mask = SPEAR1340_I2S_PRS1_CLK_Y_MASK,
300 .yscale_sel_shift = SPEAR1340_I2S_PRS1_CLK_Y_SHIFT,
301};
302
303/* i2s sclk (bit clock) syynthesizers masks */
304static struct aux_clk_masks i2s_sclk_masks = {
305 .eq_sel_mask = AUX_EQ_SEL_MASK,
306 .eq_sel_shift = SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT,
307 .eq1_mask = AUX_EQ1_SEL,
308 .eq2_mask = AUX_EQ2_SEL,
309 .xscale_sel_mask = SPEAR1340_I2S_SCLK_X_MASK,
310 .xscale_sel_shift = SPEAR1340_I2S_SCLK_X_SHIFT,
311 .yscale_sel_mask = SPEAR1340_I2S_SCLK_Y_MASK,
312 .yscale_sel_shift = SPEAR1340_I2S_SCLK_Y_SHIFT,
313 .enable_bit = SPEAR1340_I2S_SCLK_SYNTH_ENB,
314};
315
316/* i2s prs1 aux rate configuration table, in ascending order of rates */
317static struct aux_rate_tbl i2s_prs1_rtbl[] = {
318 /* For parent clk = 49.152 MHz */
319 {.xscale = 1, .yscale = 12, .eq = 0}, /* 2.048 MHz, smp freq = 8Khz */
320 {.xscale = 11, .yscale = 96, .eq = 0}, /* 2.816 MHz, smp freq = 11Khz */
321 {.xscale = 1, .yscale = 6, .eq = 0}, /* 4.096 MHz, smp freq = 16Khz */
322 {.xscale = 11, .yscale = 48, .eq = 0}, /* 5.632 MHz, smp freq = 22Khz */
323
324 /*
325 * with parent clk = 49.152, freq gen is 8.192 MHz, smp freq = 32Khz
326 * with parent clk = 12.288, freq gen is 2.048 MHz, smp freq = 8Khz
327 */
328 {.xscale = 1, .yscale = 3, .eq = 0},
329
330 /* For parent clk = 49.152 MHz */
331 {.xscale = 17, .yscale = 37, .eq = 0}, /* 11.289 MHz, smp freq = 44Khz*/
332 {.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz, smp freq = 48Khz*/
333};
334
335/* i2s sclk aux rate configuration table, in ascending order of rates */
336static struct aux_rate_tbl i2s_sclk_rtbl[] = {
337 /* For sclk = ref_clk * x/2/y */
338 {.xscale = 1, .yscale = 4, .eq = 0},
339 {.xscale = 1, .yscale = 2, .eq = 0},
340};
341
342/* adc rate configuration table, in ascending order of rates */
343/* possible adc range is 2.5 MHz to 20 MHz. */
344static struct aux_rate_tbl adc_rtbl[] = {
345 /* For ahb = 166.67 MHz */
346 {.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
347 {.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
348 {.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
349 {.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
350};
351
352/* General synth rate configuration table, in ascending order of rates */
353static struct frac_rate_tbl gen_rtbl[] = {
354 /* For vco1div4 = 250 MHz */
355 {.div = 0x1624E}, /* 22.5792 MHz */
356 {.div = 0x14585}, /* 24.576 MHz */
357 {.div = 0x14000}, /* 25 MHz */
358 {.div = 0x0B127}, /* 45.1584 MHz */
359 {.div = 0x0A000}, /* 50 MHz */
360 {.div = 0x061A8}, /* 81.92 MHz */
361 {.div = 0x05000}, /* 100 MHz */
362 {.div = 0x02800}, /* 200 MHz */
363 {.div = 0x02620}, /* 210 MHz */
364 {.div = 0x02460}, /* 220 MHz */
365 {.div = 0x022C0}, /* 230 MHz */
366 {.div = 0x02160}, /* 240 MHz */
367 {.div = 0x02000}, /* 250 MHz */
368};
369
370/* clock parents */
371static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
Vipul Kumar Samard4f513f2012-07-06 15:52:36 +0530372static const char *sys_parents[] = { "pll1_clk", "pll1_clk", "pll1_clk",
Shiraz Hashim463f9e22012-11-10 12:13:42 +0530373 "pll1_clk", "sys_syn_clk", "sys_syn_clk", "pll2_clk", "pll3_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530374static const char *ahb_parents[] = { "cpu_div3_clk", "amba_syn_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530375static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
376static const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk",
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530377 "uart0_syn_gclk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530378static const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk",
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530379 "uart1_syn_gclk", };
380static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", };
381static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530382 "osc_25m_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530383static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530384static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530385static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530386static const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk",
387 "i2s_src_pad_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530388static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", };
389static const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_syn2_clk", };
390static const char *spdif_in_parents[] = { "pll2_clk", "gen_syn3_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530391
392static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
393 "pll3_clk", };
Shiraz Hashim463f9e22012-11-10 12:13:42 +0530394static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco2div2_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530395 "pll2_clk", };
396
397void __init spear1340_clk_init(void)
398{
399 struct clk *clk, *clk1;
400
401 clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 0);
402 clk_register_clkdev(clk, "apb_pclk", NULL);
403
404 clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT,
405 32000);
406 clk_register_clkdev(clk, "osc_32k_clk", NULL);
407
408 clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, CLK_IS_ROOT,
409 24000000);
410 clk_register_clkdev(clk, "osc_24m_clk", NULL);
411
412 clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, CLK_IS_ROOT,
413 25000000);
414 clk_register_clkdev(clk, "osc_25m_clk", NULL);
415
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530416 clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT,
417 125000000);
418 clk_register_clkdev(clk, "gmii_pad_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530419
420 clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL,
421 CLK_IS_ROOT, 12288000);
422 clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
423
424 /* clock derived from 32 KHz osc clk */
425 clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
426 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_RTC_CLK_ENB, 0,
427 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530428 clk_register_clkdev(clk, NULL, "e0580000.rtc");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530429
430 /* clock derived from 24 or 25 MHz osc clk */
431 /* vco-pll */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530432 clk = clk_register_mux(NULL, "vco1_mclk", vco_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530433 ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG,
434 SPEAR1340_PLL1_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0,
435 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530436 clk_register_clkdev(clk, "vco1_mclk", NULL);
437 clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", 0,
438 SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530439 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
440 clk_register_clkdev(clk, "vco1_clk", NULL);
441 clk_register_clkdev(clk1, "pll1_clk", NULL);
442
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530443 clk = clk_register_mux(NULL, "vco2_mclk", vco_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530444 ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG,
445 SPEAR1340_PLL2_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0,
446 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530447 clk_register_clkdev(clk, "vco2_mclk", NULL);
448 clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", 0,
449 SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530450 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
451 clk_register_clkdev(clk, "vco2_clk", NULL);
452 clk_register_clkdev(clk1, "pll2_clk", NULL);
453
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530454 clk = clk_register_mux(NULL, "vco3_mclk", vco_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530455 ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG,
456 SPEAR1340_PLL3_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0,
457 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530458 clk_register_clkdev(clk, "vco3_mclk", NULL);
459 clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", 0,
460 SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530461 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
462 clk_register_clkdev(clk, "vco3_clk", NULL);
463 clk_register_clkdev(clk1, "pll3_clk", NULL);
464
465 clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
466 0, SPEAR1340_PLL4_CTR, SPEAR1340_PLL4_FRQ, pll4_rtbl,
467 ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
468 clk_register_clkdev(clk, "vco4_clk", NULL);
469 clk_register_clkdev(clk1, "pll4_clk", NULL);
470
471 clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
472 48000000);
473 clk_register_clkdev(clk, "pll5_clk", NULL);
474
475 clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
476 25000000);
477 clk_register_clkdev(clk, "pll6_clk", NULL);
478
479 /* vco div n clocks */
480 clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
481 2);
482 clk_register_clkdev(clk, "vco1div2_clk", NULL);
483
484 clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
485 4);
486 clk_register_clkdev(clk, "vco1div4_clk", NULL);
487
488 clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
489 2);
490 clk_register_clkdev(clk, "vco2div2_clk", NULL);
491
492 clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
493 2);
494 clk_register_clkdev(clk, "vco3div2_clk", NULL);
495
496 /* peripherals */
497 clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
498 128);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530499 clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530500 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0,
501 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530502 clk_register_clkdev(clk, NULL, "e07008c4.thermal");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530503
504 /* clock derived from pll4 clk */
505 clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
506 1);
507 clk_register_clkdev(clk, "ddr_clk", NULL);
508
509 /* clock derived from pll1 clk */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530510 clk = clk_register_frac("sys_syn_clk", "vco1div2_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530511 SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl,
512 ARRAY_SIZE(sys_synth_rtbl), &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530513 clk_register_clkdev(clk, "sys_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530514
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530515 clk = clk_register_frac("amba_syn_clk", "vco1div2_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530516 SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl,
517 ARRAY_SIZE(amba_synth_rtbl), &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530518 clk_register_clkdev(clk, "amba_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530519
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530520 clk = clk_register_mux(NULL, "sys_mclk", sys_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530521 ARRAY_SIZE(sys_parents), 0, SPEAR1340_SYS_CLK_CTRL,
522 SPEAR1340_SCLK_SRC_SEL_SHIFT,
523 SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530524 clk_register_clkdev(clk, "sys_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530525
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530526 clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mclk", 0, 1,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530527 2);
528 clk_register_clkdev(clk, "cpu_clk", NULL);
529
530 clk = clk_register_fixed_factor(NULL, "cpu_div3_clk", "cpu_clk", 0, 1,
531 3);
532 clk_register_clkdev(clk, "cpu_div3_clk", NULL);
533
534 clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
535 2);
536 clk_register_clkdev(clk, NULL, "ec800620.wdt");
537
Vipul Kumar Samarcd4b5192012-11-10 12:13:44 +0530538 clk = clk_register_fixed_factor(NULL, "smp_twd_clk", "cpu_clk", 0, 1,
539 2);
540 clk_register_clkdev(clk, NULL, "smp_twd");
541
Viresh Kumar0b928af2012-04-19 22:23:13 +0530542 clk = clk_register_mux(NULL, "ahb_clk", ahb_parents,
543 ARRAY_SIZE(ahb_parents), 0, SPEAR1340_SYS_CLK_CTRL,
544 SPEAR1340_HCLK_SRC_SEL_SHIFT,
545 SPEAR1340_HCLK_SRC_SEL_MASK, 0, &_lock);
546 clk_register_clkdev(clk, "ahb_clk", NULL);
547
548 clk = clk_register_fixed_factor(NULL, "apb_clk", "ahb_clk", 0, 1,
549 2);
550 clk_register_clkdev(clk, "apb_clk", NULL);
551
552 /* gpt clocks */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530553 clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530554 ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG,
555 SPEAR1340_GPT0_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0,
556 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530557 clk_register_clkdev(clk, "gpt0_mclk", NULL);
558 clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530559 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0,
560 &_lock);
561 clk_register_clkdev(clk, NULL, "gpt0");
562
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530563 clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530564 ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG,
565 SPEAR1340_GPT1_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0,
566 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530567 clk_register_clkdev(clk, "gpt1_mclk", NULL);
568 clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530569 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0,
570 &_lock);
571 clk_register_clkdev(clk, NULL, "gpt1");
572
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530573 clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530574 ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG,
575 SPEAR1340_GPT2_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0,
576 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530577 clk_register_clkdev(clk, "gpt2_mclk", NULL);
578 clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530579 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0,
580 &_lock);
581 clk_register_clkdev(clk, NULL, "gpt2");
582
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530583 clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530584 ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG,
585 SPEAR1340_GPT3_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0,
586 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530587 clk_register_clkdev(clk, "gpt3_mclk", NULL);
588 clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530589 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0,
590 &_lock);
591 clk_register_clkdev(clk, NULL, "gpt3");
592
593 /* others */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530594 clk = clk_register_aux("uart0_syn_clk", "uart0_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530595 "vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL,
596 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530597 clk_register_clkdev(clk, "uart0_syn_clk", NULL);
598 clk_register_clkdev(clk1, "uart0_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530599
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530600 clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530601 ARRAY_SIZE(uart0_parents), CLK_SET_RATE_PARENT,
602 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_UART0_CLK_SHIFT,
603 SPEAR1340_UART_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530604 clk_register_clkdev(clk, "uart0_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530605
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530606 clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk",
607 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
608 SPEAR1340_UART0_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530609 clk_register_clkdev(clk, NULL, "e0000000.serial");
610
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530611 clk = clk_register_aux("uart1_syn_clk", "uart1_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530612 "vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL,
613 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530614 clk_register_clkdev(clk, "uart1_syn_clk", NULL);
615 clk_register_clkdev(clk1, "uart1_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530616
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530617 clk = clk_register_mux(NULL, "uart1_mclk", uart1_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530618 ARRAY_SIZE(uart1_parents), 0, SPEAR1340_PERIP_CLK_CFG,
619 SPEAR1340_UART1_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0,
620 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530621 clk_register_clkdev(clk, "uart1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530622
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530623 clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0,
Vipul Kumar Samard9ba8db2012-07-04 18:52:19 +0800624 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530625 &_lock);
626 clk_register_clkdev(clk, NULL, "b4100000.serial");
627
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530628 clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530629 "vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL,
630 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530631 clk_register_clkdev(clk, "sdhci_syn_clk", NULL);
632 clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530633
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530634 clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk",
635 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
636 SPEAR1340_SDHCI_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530637 clk_register_clkdev(clk, NULL, "b3000000.sdhci");
638
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530639 clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk",
640 0, SPEAR1340_CFXD_CLK_SYNT, NULL, aux_rtbl,
641 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
642 clk_register_clkdev(clk, "cfxd_syn_clk", NULL);
643 clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530644
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530645 clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk",
646 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
647 SPEAR1340_CFXD_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530648 clk_register_clkdev(clk, NULL, "b2800000.cf");
649 clk_register_clkdev(clk, NULL, "arasan_xd");
650
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530651 clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", 0,
652 SPEAR1340_C3_CLK_SYNT, NULL, aux_rtbl,
653 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
654 clk_register_clkdev(clk, "c3_syn_clk", NULL);
655 clk_register_clkdev(clk1, "c3_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530656
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530657 clk = clk_register_mux(NULL, "c3_mclk", c3_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530658 ARRAY_SIZE(c3_parents), CLK_SET_RATE_PARENT,
659 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_C3_CLK_SHIFT,
660 SPEAR1340_C3_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530661 clk_register_clkdev(clk, "c3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530662
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530663 clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", CLK_SET_RATE_PARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530664 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0,
665 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530666 clk_register_clkdev(clk, NULL, "e1800000.c3");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530667
668 /* gmac */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530669 clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530670 ARRAY_SIZE(gmac_phy_input_parents), 0,
671 SPEAR1340_GMAC_CLK_CFG,
672 SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT,
673 SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530674 clk_register_clkdev(clk, "phy_input_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530675
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530676 clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk",
677 0, SPEAR1340_GMAC_CLK_SYNT, NULL, gmac_rtbl,
678 ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
679 clk_register_clkdev(clk, "phy_syn_clk", NULL);
680 clk_register_clkdev(clk1, "phy_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530681
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530682 clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530683 ARRAY_SIZE(gmac_phy_parents), 0,
684 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT,
685 SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530686 clk_register_clkdev(clk, "stmmacphy.0", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530687
688 /* clcd */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530689 clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530690 ARRAY_SIZE(clcd_synth_parents), 0,
691 SPEAR1340_CLCD_CLK_SYNT, SPEAR1340_CLCD_SYNT_CLK_SHIFT,
692 SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530693 clk_register_clkdev(clk, "clcd_syn_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530694
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530695 clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530696 SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl,
697 ARRAY_SIZE(clcd_rtbl), &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530698 clk_register_clkdev(clk, "clcd_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530699
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530700 clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530701 ARRAY_SIZE(clcd_pixel_parents), CLK_SET_RATE_PARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530702 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT,
703 SPEAR1340_CLCD_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530704 clk_register_clkdev(clk, "clcd_pixel_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530705
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530706 clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530707 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0,
708 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530709 clk_register_clkdev(clk, NULL, "e1000000.clcd");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530710
711 /* i2s */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530712 clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530713 ARRAY_SIZE(i2s_src_parents), 0, SPEAR1340_I2S_CLK_CFG,
714 SPEAR1340_I2S_SRC_CLK_SHIFT, SPEAR1340_I2S_SRC_CLK_MASK,
715 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530716 clk_register_clkdev(clk, "i2s_src_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530717
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530718 clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk",
719 CLK_SET_RATE_PARENT, SPEAR1340_I2S_CLK_CFG,
720 &i2s_prs1_masks, i2s_prs1_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530721 ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
722 clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
723
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530724 clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530725 ARRAY_SIZE(i2s_ref_parents), CLK_SET_RATE_PARENT,
726 SPEAR1340_I2S_CLK_CFG, SPEAR1340_I2S_REF_SHIFT,
727 SPEAR1340_I2S_REF_SEL_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530728 clk_register_clkdev(clk, "i2s_ref_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530729
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530730 clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530731 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB,
732 0, &_lock);
733 clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
734
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530735 clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", "i2s_ref_mclk",
736 0, SPEAR1340_I2S_CLK_CFG, &i2s_sclk_masks,
737 i2s_sclk_rtbl, ARRAY_SIZE(i2s_sclk_rtbl), &_lock,
738 &clk1);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530739 clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530740 clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530741
742 /* clock derived from ahb clk */
743 clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
744 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2C0_CLK_ENB, 0,
745 &_lock);
746 clk_register_clkdev(clk, NULL, "e0280000.i2c");
747
748 clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0,
Vipul Kumar Samard9ba8db2012-07-04 18:52:19 +0800749 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530750 &_lock);
751 clk_register_clkdev(clk, NULL, "b4000000.i2c");
752
753 clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
754 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_DMA_CLK_ENB, 0,
755 &_lock);
756 clk_register_clkdev(clk, NULL, "ea800000.dma");
757 clk_register_clkdev(clk, NULL, "eb000000.dma");
758
759 clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
760 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GMAC_CLK_ENB, 0,
761 &_lock);
762 clk_register_clkdev(clk, NULL, "e2000000.eth");
763
764 clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
765 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_FSMC_CLK_ENB, 0,
766 &_lock);
767 clk_register_clkdev(clk, NULL, "b0000000.flash");
768
769 clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
770 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SMI_CLK_ENB, 0,
771 &_lock);
772 clk_register_clkdev(clk, NULL, "ea000000.flash");
773
774 clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
775 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UHC0_CLK_ENB, 0,
776 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530777 clk_register_clkdev(clk, NULL, "e4000000.ohci");
778 clk_register_clkdev(clk, NULL, "e4800000.ehci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530779
780 clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
781 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UHC1_CLK_ENB, 0,
782 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530783 clk_register_clkdev(clk, NULL, "e5000000.ohci");
784 clk_register_clkdev(clk, NULL, "e5800000.ehci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530785
786 clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
787 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UOC_CLK_ENB, 0,
788 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530789 clk_register_clkdev(clk, NULL, "e3800000.otg");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530790
791 clk = clk_register_gate(NULL, "pcie_sata_clk", "ahb_clk", 0,
792 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_PCIE_SATA_CLK_ENB,
793 0, &_lock);
794 clk_register_clkdev(clk, NULL, "dw_pcie");
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530795 clk_register_clkdev(clk, NULL, "b1000000.ahci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530796
797 clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
798 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SYSRAM0_CLK_ENB, 0,
799 &_lock);
800 clk_register_clkdev(clk, "sysram0_clk", NULL);
801
802 clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
803 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SYSRAM1_CLK_ENB, 0,
804 &_lock);
805 clk_register_clkdev(clk, "sysram1_clk", NULL);
806
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530807 clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530808 0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl,
809 ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530810 clk_register_clkdev(clk, "adc_syn_clk", NULL);
811 clk_register_clkdev(clk1, "adc_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530812
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530813 clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk",
814 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
815 SPEAR1340_ADC_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530816 clk_register_clkdev(clk, NULL, "e0080000.adc");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530817
818 /* clock derived from apb clk */
819 clk = clk_register_gate(NULL, "ssp_clk", "apb_clk", 0,
820 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SSP_CLK_ENB, 0,
821 &_lock);
822 clk_register_clkdev(clk, NULL, "e0100000.spi");
823
824 clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
825 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPIO0_CLK_ENB, 0,
826 &_lock);
827 clk_register_clkdev(clk, NULL, "e0600000.gpio");
828
829 clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
830 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPIO1_CLK_ENB, 0,
831 &_lock);
832 clk_register_clkdev(clk, NULL, "e0680000.gpio");
833
834 clk = clk_register_gate(NULL, "i2s_play_clk", "apb_clk", 0,
835 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2S_PLAY_CLK_ENB, 0,
836 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530837 clk_register_clkdev(clk, NULL, "b2400000.i2s-play");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530838
839 clk = clk_register_gate(NULL, "i2s_rec_clk", "apb_clk", 0,
840 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2S_REC_CLK_ENB, 0,
841 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530842 clk_register_clkdev(clk, NULL, "b2000000.i2s-rec");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530843
844 clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
845 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_KBD_CLK_ENB, 0,
846 &_lock);
847 clk_register_clkdev(clk, NULL, "e0300000.kbd");
848
849 /* RAS clks */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530850 clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents,
851 ARRAY_SIZE(gen_synth0_1_parents), 0, SPEAR1340_PLL_CFG,
852 SPEAR1340_GEN_SYNT0_1_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530853 SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530854 clk_register_clkdev(clk, "gen_syn0_1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530855
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530856 clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents,
857 ARRAY_SIZE(gen_synth2_3_parents), 0, SPEAR1340_PLL_CFG,
858 SPEAR1340_GEN_SYNT2_3_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530859 SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530860 clk_register_clkdev(clk, "gen_syn2_3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530861
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530862 clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530863 SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
864 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530865 clk_register_clkdev(clk, "gen_syn0_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530866
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530867 clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530868 SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
869 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530870 clk_register_clkdev(clk, "gen_syn1_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530871
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530872 clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530873 SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
874 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530875 clk_register_clkdev(clk, "gen_syn2_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530876
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530877 clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530878 SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
879 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530880 clk_register_clkdev(clk, "gen_syn3_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530881
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530882 clk = clk_register_gate(NULL, "mali_clk", "gen_syn3_clk",
883 CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
884 SPEAR1340_MALI_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530885 clk_register_clkdev(clk, NULL, "mali");
886
887 clk = clk_register_gate(NULL, "cec0_clk", "ahb_clk", 0,
888 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CEC0_CLK_ENB, 0,
889 &_lock);
890 clk_register_clkdev(clk, NULL, "spear_cec.0");
891
892 clk = clk_register_gate(NULL, "cec1_clk", "ahb_clk", 0,
893 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CEC1_CLK_ENB, 0,
894 &_lock);
895 clk_register_clkdev(clk, NULL, "spear_cec.1");
896
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530897 clk = clk_register_mux(NULL, "spdif_out_mclk", spdif_out_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530898 ARRAY_SIZE(spdif_out_parents), CLK_SET_RATE_PARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530899 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT,
900 SPEAR1340_SPDIF_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530901 clk_register_clkdev(clk, "spdif_out_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530902
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530903 clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mclk",
904 CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
905 SPEAR1340_SPDIF_OUT_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530906 clk_register_clkdev(clk, NULL, "d0000000.spdif-out");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530907
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530908 clk = clk_register_mux(NULL, "spdif_in_mclk", spdif_in_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530909 ARRAY_SIZE(spdif_in_parents), CLK_SET_RATE_PARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530910 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT,
911 SPEAR1340_SPDIF_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530912 clk_register_clkdev(clk, "spdif_in_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530913
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530914 clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mclk",
915 CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
916 SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530917 clk_register_clkdev(clk, NULL, "d0100000.spdif-in");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530918
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530919 clk = clk_register_gate(NULL, "acp_clk", "acp_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530920 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0,
921 &_lock);
922 clk_register_clkdev(clk, NULL, "acp_clk");
923
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530924 clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530925 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0,
926 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530927 clk_register_clkdev(clk, NULL, "e2800000.gpio");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530928
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530929 clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530930 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB,
931 0, &_lock);
932 clk_register_clkdev(clk, NULL, "video_dec");
933
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530934 clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530935 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB,
936 0, &_lock);
937 clk_register_clkdev(clk, NULL, "video_enc");
938
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530939 clk = clk_register_gate(NULL, "video_in_clk", "video_in_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530940 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0,
941 &_lock);
942 clk_register_clkdev(clk, NULL, "spear_vip");
943
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530944 clk = clk_register_gate(NULL, "cam0_clk", "cam0_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530945 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0,
946 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530947 clk_register_clkdev(clk, NULL, "d0200000.cam0");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530948
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530949 clk = clk_register_gate(NULL, "cam1_clk", "cam1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530950 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0,
951 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530952 clk_register_clkdev(clk, NULL, "d0300000.cam1");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530953
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530954 clk = clk_register_gate(NULL, "cam2_clk", "cam2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530955 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0,
956 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530957 clk_register_clkdev(clk, NULL, "d0400000.cam2");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530958
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530959 clk = clk_register_gate(NULL, "cam3_clk", "cam3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530960 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0,
961 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530962 clk_register_clkdev(clk, NULL, "d0500000.cam3");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530963
Shiraz Hashim463f9e22012-11-10 12:13:42 +0530964 clk = clk_register_gate(NULL, "pwm_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530965 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0,
966 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530967 clk_register_clkdev(clk, NULL, "e0180000.pwm");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530968}