blob: b64d51153a7862b6d9fb67696367c433e36222dc [file] [log] [blame]
Viresh Kumar0b928af2012-04-19 22:23:13 +05301/*
2 * arch/arm/mach-spear13xx/spear1310_clock.c
3 *
4 * SPEAr1310 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/* PLL related registers and bit values */
24#define SPEAR1310_PLL_CFG (VA_MISC_BASE + 0x210)
25 /* PLL_CFG bit values */
26 #define SPEAR1310_CLCD_SYNT_CLK_MASK 1
27 #define SPEAR1310_CLCD_SYNT_CLK_SHIFT 31
28 #define SPEAR1310_RAS_SYNT2_3_CLK_MASK 2
29 #define SPEAR1310_RAS_SYNT2_3_CLK_SHIFT 29
30 #define SPEAR1310_RAS_SYNT_CLK_MASK 2
31 #define SPEAR1310_RAS_SYNT0_1_CLK_SHIFT 27
32 #define SPEAR1310_PLL_CLK_MASK 2
33 #define SPEAR1310_PLL3_CLK_SHIFT 24
34 #define SPEAR1310_PLL2_CLK_SHIFT 22
35 #define SPEAR1310_PLL1_CLK_SHIFT 20
36
37#define SPEAR1310_PLL1_CTR (VA_MISC_BASE + 0x214)
38#define SPEAR1310_PLL1_FRQ (VA_MISC_BASE + 0x218)
39#define SPEAR1310_PLL2_CTR (VA_MISC_BASE + 0x220)
40#define SPEAR1310_PLL2_FRQ (VA_MISC_BASE + 0x224)
41#define SPEAR1310_PLL3_CTR (VA_MISC_BASE + 0x22C)
42#define SPEAR1310_PLL3_FRQ (VA_MISC_BASE + 0x230)
43#define SPEAR1310_PLL4_CTR (VA_MISC_BASE + 0x238)
44#define SPEAR1310_PLL4_FRQ (VA_MISC_BASE + 0x23C)
45#define SPEAR1310_PERIP_CLK_CFG (VA_MISC_BASE + 0x244)
46 /* PERIP_CLK_CFG bit values */
47 #define SPEAR1310_GPT_OSC24_VAL 0
48 #define SPEAR1310_GPT_APB_VAL 1
49 #define SPEAR1310_GPT_CLK_MASK 1
50 #define SPEAR1310_GPT3_CLK_SHIFT 11
51 #define SPEAR1310_GPT2_CLK_SHIFT 10
52 #define SPEAR1310_GPT1_CLK_SHIFT 9
53 #define SPEAR1310_GPT0_CLK_SHIFT 8
54 #define SPEAR1310_UART_CLK_PLL5_VAL 0
55 #define SPEAR1310_UART_CLK_OSC24_VAL 1
56 #define SPEAR1310_UART_CLK_SYNT_VAL 2
57 #define SPEAR1310_UART_CLK_MASK 2
58 #define SPEAR1310_UART_CLK_SHIFT 4
59
60 #define SPEAR1310_AUX_CLK_PLL5_VAL 0
61 #define SPEAR1310_AUX_CLK_SYNT_VAL 1
62 #define SPEAR1310_CLCD_CLK_MASK 2
63 #define SPEAR1310_CLCD_CLK_SHIFT 2
64 #define SPEAR1310_C3_CLK_MASK 1
65 #define SPEAR1310_C3_CLK_SHIFT 1
66
67#define SPEAR1310_GMAC_CLK_CFG (VA_MISC_BASE + 0x248)
68 #define SPEAR1310_GMAC_PHY_IF_SEL_MASK 3
69 #define SPEAR1310_GMAC_PHY_IF_SEL_SHIFT 4
70 #define SPEAR1310_GMAC_PHY_CLK_MASK 1
71 #define SPEAR1310_GMAC_PHY_CLK_SHIFT 3
72 #define SPEAR1310_GMAC_PHY_INPUT_CLK_MASK 2
73 #define SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT 1
74
75#define SPEAR1310_I2S_CLK_CFG (VA_MISC_BASE + 0x24C)
76 /* I2S_CLK_CFG register mask */
77 #define SPEAR1310_I2S_SCLK_X_MASK 0x1F
78 #define SPEAR1310_I2S_SCLK_X_SHIFT 27
79 #define SPEAR1310_I2S_SCLK_Y_MASK 0x1F
80 #define SPEAR1310_I2S_SCLK_Y_SHIFT 22
81 #define SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT 21
82 #define SPEAR1310_I2S_SCLK_SYNTH_ENB 20
83 #define SPEAR1310_I2S_PRS1_CLK_X_MASK 0xFF
84 #define SPEAR1310_I2S_PRS1_CLK_X_SHIFT 12
85 #define SPEAR1310_I2S_PRS1_CLK_Y_MASK 0xFF
86 #define SPEAR1310_I2S_PRS1_CLK_Y_SHIFT 4
87 #define SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT 3
88 #define SPEAR1310_I2S_REF_SEL_MASK 1
89 #define SPEAR1310_I2S_REF_SHIFT 2
90 #define SPEAR1310_I2S_SRC_CLK_MASK 2
91 #define SPEAR1310_I2S_SRC_CLK_SHIFT 0
92
93#define SPEAR1310_C3_CLK_SYNT (VA_MISC_BASE + 0x250)
94#define SPEAR1310_UART_CLK_SYNT (VA_MISC_BASE + 0x254)
95#define SPEAR1310_GMAC_CLK_SYNT (VA_MISC_BASE + 0x258)
96#define SPEAR1310_SDHCI_CLK_SYNT (VA_MISC_BASE + 0x25C)
97#define SPEAR1310_CFXD_CLK_SYNT (VA_MISC_BASE + 0x260)
98#define SPEAR1310_ADC_CLK_SYNT (VA_MISC_BASE + 0x264)
99#define SPEAR1310_AMBA_CLK_SYNT (VA_MISC_BASE + 0x268)
100#define SPEAR1310_CLCD_CLK_SYNT (VA_MISC_BASE + 0x270)
101#define SPEAR1310_RAS_CLK_SYNT0 (VA_MISC_BASE + 0x280)
102#define SPEAR1310_RAS_CLK_SYNT1 (VA_MISC_BASE + 0x288)
103#define SPEAR1310_RAS_CLK_SYNT2 (VA_MISC_BASE + 0x290)
104#define SPEAR1310_RAS_CLK_SYNT3 (VA_MISC_BASE + 0x298)
105 /* Check Fractional synthesizer reg masks */
106
107#define SPEAR1310_PERIP1_CLK_ENB (VA_MISC_BASE + 0x300)
108 /* PERIP1_CLK_ENB register masks */
109 #define SPEAR1310_RTC_CLK_ENB 31
110 #define SPEAR1310_ADC_CLK_ENB 30
111 #define SPEAR1310_C3_CLK_ENB 29
112 #define SPEAR1310_JPEG_CLK_ENB 28
113 #define SPEAR1310_CLCD_CLK_ENB 27
114 #define SPEAR1310_DMA_CLK_ENB 25
115 #define SPEAR1310_GPIO1_CLK_ENB 24
116 #define SPEAR1310_GPIO0_CLK_ENB 23
117 #define SPEAR1310_GPT1_CLK_ENB 22
118 #define SPEAR1310_GPT0_CLK_ENB 21
119 #define SPEAR1310_I2S0_CLK_ENB 20
120 #define SPEAR1310_I2S1_CLK_ENB 19
121 #define SPEAR1310_I2C0_CLK_ENB 18
122 #define SPEAR1310_SSP_CLK_ENB 17
123 #define SPEAR1310_UART_CLK_ENB 15
124 #define SPEAR1310_PCIE_SATA_2_CLK_ENB 14
125 #define SPEAR1310_PCIE_SATA_1_CLK_ENB 13
126 #define SPEAR1310_PCIE_SATA_0_CLK_ENB 12
127 #define SPEAR1310_UOC_CLK_ENB 11
128 #define SPEAR1310_UHC1_CLK_ENB 10
129 #define SPEAR1310_UHC0_CLK_ENB 9
130 #define SPEAR1310_GMAC_CLK_ENB 8
131 #define SPEAR1310_CFXD_CLK_ENB 7
132 #define SPEAR1310_SDHCI_CLK_ENB 6
133 #define SPEAR1310_SMI_CLK_ENB 5
134 #define SPEAR1310_FSMC_CLK_ENB 4
135 #define SPEAR1310_SYSRAM0_CLK_ENB 3
136 #define SPEAR1310_SYSRAM1_CLK_ENB 2
137 #define SPEAR1310_SYSROM_CLK_ENB 1
138 #define SPEAR1310_BUS_CLK_ENB 0
139
140#define SPEAR1310_PERIP2_CLK_ENB (VA_MISC_BASE + 0x304)
141 /* PERIP2_CLK_ENB register masks */
142 #define SPEAR1310_THSENS_CLK_ENB 8
143 #define SPEAR1310_I2S_REF_PAD_CLK_ENB 7
144 #define SPEAR1310_ACP_CLK_ENB 6
145 #define SPEAR1310_GPT3_CLK_ENB 5
146 #define SPEAR1310_GPT2_CLK_ENB 4
147 #define SPEAR1310_KBD_CLK_ENB 3
148 #define SPEAR1310_CPU_DBG_CLK_ENB 2
149 #define SPEAR1310_DDR_CORE_CLK_ENB 1
150 #define SPEAR1310_DDR_CTRL_CLK_ENB 0
151
152#define SPEAR1310_RAS_CLK_ENB (VA_MISC_BASE + 0x310)
153 /* RAS_CLK_ENB register masks */
154 #define SPEAR1310_SYNT3_CLK_ENB 17
155 #define SPEAR1310_SYNT2_CLK_ENB 16
156 #define SPEAR1310_SYNT1_CLK_ENB 15
157 #define SPEAR1310_SYNT0_CLK_ENB 14
158 #define SPEAR1310_PCLK3_CLK_ENB 13
159 #define SPEAR1310_PCLK2_CLK_ENB 12
160 #define SPEAR1310_PCLK1_CLK_ENB 11
161 #define SPEAR1310_PCLK0_CLK_ENB 10
162 #define SPEAR1310_PLL3_CLK_ENB 9
163 #define SPEAR1310_PLL2_CLK_ENB 8
164 #define SPEAR1310_C125M_PAD_CLK_ENB 7
165 #define SPEAR1310_C30M_CLK_ENB 6
166 #define SPEAR1310_C48M_CLK_ENB 5
167 #define SPEAR1310_OSC_25M_CLK_ENB 4
168 #define SPEAR1310_OSC_32K_CLK_ENB 3
169 #define SPEAR1310_OSC_24M_CLK_ENB 2
170 #define SPEAR1310_PCLK_CLK_ENB 1
171 #define SPEAR1310_ACLK_CLK_ENB 0
172
173/* RAS Area Control Register */
174#define SPEAR1310_RAS_CTRL_REG0 (VA_SPEAR1310_RAS_BASE + 0x000)
175 #define SPEAR1310_SSP1_CLK_MASK 3
176 #define SPEAR1310_SSP1_CLK_SHIFT 26
177 #define SPEAR1310_TDM_CLK_MASK 1
178 #define SPEAR1310_TDM2_CLK_SHIFT 24
179 #define SPEAR1310_TDM1_CLK_SHIFT 23
180 #define SPEAR1310_I2C_CLK_MASK 1
181 #define SPEAR1310_I2C7_CLK_SHIFT 22
182 #define SPEAR1310_I2C6_CLK_SHIFT 21
183 #define SPEAR1310_I2C5_CLK_SHIFT 20
184 #define SPEAR1310_I2C4_CLK_SHIFT 19
185 #define SPEAR1310_I2C3_CLK_SHIFT 18
186 #define SPEAR1310_I2C2_CLK_SHIFT 17
187 #define SPEAR1310_I2C1_CLK_SHIFT 16
188 #define SPEAR1310_GPT64_CLK_MASK 1
189 #define SPEAR1310_GPT64_CLK_SHIFT 15
190 #define SPEAR1310_RAS_UART_CLK_MASK 1
191 #define SPEAR1310_UART5_CLK_SHIFT 14
192 #define SPEAR1310_UART4_CLK_SHIFT 13
193 #define SPEAR1310_UART3_CLK_SHIFT 12
194 #define SPEAR1310_UART2_CLK_SHIFT 11
195 #define SPEAR1310_UART1_CLK_SHIFT 10
196 #define SPEAR1310_PCI_CLK_MASK 1
197 #define SPEAR1310_PCI_CLK_SHIFT 0
198
199#define SPEAR1310_RAS_CTRL_REG1 (VA_SPEAR1310_RAS_BASE + 0x004)
200 #define SPEAR1310_PHY_CLK_MASK 0x3
201 #define SPEAR1310_RMII_PHY_CLK_SHIFT 0
202 #define SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT 2
203
204#define SPEAR1310_RAS_SW_CLK_CTRL (VA_SPEAR1310_RAS_BASE + 0x0148)
205 #define SPEAR1310_CAN1_CLK_ENB 25
206 #define SPEAR1310_CAN0_CLK_ENB 24
207 #define SPEAR1310_GPT64_CLK_ENB 23
208 #define SPEAR1310_SSP1_CLK_ENB 22
209 #define SPEAR1310_I2C7_CLK_ENB 21
210 #define SPEAR1310_I2C6_CLK_ENB 20
211 #define SPEAR1310_I2C5_CLK_ENB 19
212 #define SPEAR1310_I2C4_CLK_ENB 18
213 #define SPEAR1310_I2C3_CLK_ENB 17
214 #define SPEAR1310_I2C2_CLK_ENB 16
215 #define SPEAR1310_I2C1_CLK_ENB 15
216 #define SPEAR1310_UART5_CLK_ENB 14
217 #define SPEAR1310_UART4_CLK_ENB 13
218 #define SPEAR1310_UART3_CLK_ENB 12
219 #define SPEAR1310_UART2_CLK_ENB 11
220 #define SPEAR1310_UART1_CLK_ENB 10
221 #define SPEAR1310_RS485_1_CLK_ENB 9
222 #define SPEAR1310_RS485_0_CLK_ENB 8
223 #define SPEAR1310_TDM2_CLK_ENB 7
224 #define SPEAR1310_TDM1_CLK_ENB 6
225 #define SPEAR1310_PCI_CLK_ENB 5
226 #define SPEAR1310_GMII_CLK_ENB 4
227 #define SPEAR1310_MII2_CLK_ENB 3
228 #define SPEAR1310_MII1_CLK_ENB 2
229 #define SPEAR1310_MII0_CLK_ENB 1
230 #define SPEAR1310_ESRAM_CLK_ENB 0
231
232static DEFINE_SPINLOCK(_lock);
233
234/* pll rate configuration table, in ascending order of rates */
235static struct pll_rate_tbl pll_rtbl[] = {
236 /* PCLK 24MHz */
237 {.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
238 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
239 {.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
240 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
241 {.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
242 {.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
243 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
244};
245
246/* vco-pll4 rate configuration table, in ascending order of rates */
247static struct pll_rate_tbl pll4_rtbl[] = {
248 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
249 {.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
250 {.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
251 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
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 = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
282 {.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
283 {.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
284 {.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
285 {.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
286};
287
288/* i2s prescaler1 masks */
289static struct aux_clk_masks i2s_prs1_masks = {
290 .eq_sel_mask = AUX_EQ_SEL_MASK,
291 .eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
292 .eq1_mask = AUX_EQ1_SEL,
293 .eq2_mask = AUX_EQ2_SEL,
294 .xscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_X_MASK,
295 .xscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_X_SHIFT,
296 .yscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_Y_MASK,
297 .yscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_Y_SHIFT,
298};
299
300/* i2s sclk (bit clock) syynthesizers masks */
301static struct aux_clk_masks i2s_sclk_masks = {
302 .eq_sel_mask = AUX_EQ_SEL_MASK,
303 .eq_sel_shift = SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT,
304 .eq1_mask = AUX_EQ1_SEL,
305 .eq2_mask = AUX_EQ2_SEL,
306 .xscale_sel_mask = SPEAR1310_I2S_SCLK_X_MASK,
307 .xscale_sel_shift = SPEAR1310_I2S_SCLK_X_SHIFT,
308 .yscale_sel_mask = SPEAR1310_I2S_SCLK_Y_MASK,
309 .yscale_sel_shift = SPEAR1310_I2S_SCLK_Y_SHIFT,
310 .enable_bit = SPEAR1310_I2S_SCLK_SYNTH_ENB,
311};
312
313/* i2s prs1 aux rate configuration table, in ascending order of rates */
314static struct aux_rate_tbl i2s_prs1_rtbl[] = {
315 /* For parent clk = 49.152 MHz */
316 {.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz */
317};
318
319/* i2s sclk aux rate configuration table, in ascending order of rates */
320static struct aux_rate_tbl i2s_sclk_rtbl[] = {
321 /* For i2s_ref_clk = 12.288MHz */
322 {.xscale = 1, .yscale = 4, .eq = 0}, /* 1.53 MHz */
323 {.xscale = 1, .yscale = 2, .eq = 0}, /* 3.07 Mhz */
324};
325
326/* adc rate configuration table, in ascending order of rates */
327/* possible adc range is 2.5 MHz to 20 MHz. */
328static struct aux_rate_tbl adc_rtbl[] = {
329 /* For ahb = 166.67 MHz */
330 {.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
331 {.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
332 {.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
333 {.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
334};
335
336/* General synth rate configuration table, in ascending order of rates */
337static struct frac_rate_tbl gen_rtbl[] = {
338 /* For vco1div4 = 250 MHz */
339 {.div = 0x14000}, /* 25 MHz */
340 {.div = 0x0A000}, /* 50 MHz */
341 {.div = 0x05000}, /* 100 MHz */
342 {.div = 0x02000}, /* 250 MHz */
343};
344
345/* clock parents */
346static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
347static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530348static const char *uart0_parents[] = { "pll5_clk", "uart_syn_gclk", };
349static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", };
350static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530351 "osc_25m_clk", };
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530352static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530353static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530354static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530355static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk",
356 "i2s_src_pad_clk", };
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530357static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530358static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
359 "pll3_clk", };
360static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk",
361 "pll2_clk", };
362static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none",
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530363 "ras_pll2_clk", "ras_syn0_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530364static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk",
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530365 "ras_pll2_clk", "ras_syn0_clk", };
366static const char *uart_parents[] = { "ras_apb_clk", "gen_syn3_clk", };
367static const char *i2c_parents[] = { "ras_apb_clk", "gen_syn1_clk", };
368static const char *ssp1_parents[] = { "ras_apb_clk", "gen_syn1_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530369 "ras_plclk0_clk", };
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530370static const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", };
371static const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530372
373void __init spear1310_clk_init(void)
374{
375 struct clk *clk, *clk1;
376
377 clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 0);
378 clk_register_clkdev(clk, "apb_pclk", NULL);
379
380 clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT,
381 32000);
382 clk_register_clkdev(clk, "osc_32k_clk", NULL);
383
384 clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, CLK_IS_ROOT,
385 24000000);
386 clk_register_clkdev(clk, "osc_24m_clk", NULL);
387
388 clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, CLK_IS_ROOT,
389 25000000);
390 clk_register_clkdev(clk, "osc_25m_clk", NULL);
391
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530392 clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT,
393 125000000);
394 clk_register_clkdev(clk, "gmii_pad_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530395
396 clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL,
397 CLK_IS_ROOT, 12288000);
398 clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
399
400 /* clock derived from 32 KHz osc clk */
401 clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
402 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_RTC_CLK_ENB, 0,
403 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530404 clk_register_clkdev(clk, NULL, "e0580000.rtc");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530405
406 /* clock derived from 24 or 25 MHz osc clk */
407 /* vco-pll */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530408 clk = clk_register_mux(NULL, "vco1_mclk", vco_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530409 ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG,
410 SPEAR1310_PLL1_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0,
411 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530412 clk_register_clkdev(clk, "vco1_mclk", NULL);
413 clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530414 0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl,
415 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
416 clk_register_clkdev(clk, "vco1_clk", NULL);
417 clk_register_clkdev(clk1, "pll1_clk", NULL);
418
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530419 clk = clk_register_mux(NULL, "vco2_mclk", vco_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530420 ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG,
421 SPEAR1310_PLL2_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0,
422 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530423 clk_register_clkdev(clk, "vco2_mclk", NULL);
424 clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530425 0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl,
426 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
427 clk_register_clkdev(clk, "vco2_clk", NULL);
428 clk_register_clkdev(clk1, "pll2_clk", NULL);
429
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530430 clk = clk_register_mux(NULL, "vco3_mclk", vco_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530431 ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG,
432 SPEAR1310_PLL3_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0,
433 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530434 clk_register_clkdev(clk, "vco3_mclk", NULL);
435 clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530436 0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl,
437 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
438 clk_register_clkdev(clk, "vco3_clk", NULL);
439 clk_register_clkdev(clk1, "pll3_clk", NULL);
440
441 clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
442 0, SPEAR1310_PLL4_CTR, SPEAR1310_PLL4_FRQ, pll4_rtbl,
443 ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
444 clk_register_clkdev(clk, "vco4_clk", NULL);
445 clk_register_clkdev(clk1, "pll4_clk", NULL);
446
447 clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
448 48000000);
449 clk_register_clkdev(clk, "pll5_clk", NULL);
450
451 clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
452 25000000);
453 clk_register_clkdev(clk, "pll6_clk", NULL);
454
455 /* vco div n clocks */
456 clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
457 2);
458 clk_register_clkdev(clk, "vco1div2_clk", NULL);
459
460 clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
461 4);
462 clk_register_clkdev(clk, "vco1div4_clk", NULL);
463
464 clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
465 2);
466 clk_register_clkdev(clk, "vco2div2_clk", NULL);
467
468 clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
469 2);
470 clk_register_clkdev(clk, "vco3div2_clk", NULL);
471
472 /* peripherals */
473 clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
474 128);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530475 clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530476 SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0,
477 &_lock);
478 clk_register_clkdev(clk, NULL, "spear_thermal");
479
480 /* clock derived from pll4 clk */
481 clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
482 1);
483 clk_register_clkdev(clk, "ddr_clk", NULL);
484
485 /* clock derived from pll1 clk */
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530486 clk = clk_register_fixed_factor(NULL, "cpu_clk", "pll1_clk",
487 CLK_SET_RATE_PARENT, 1, 2);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530488 clk_register_clkdev(clk, "cpu_clk", NULL);
489
490 clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
491 2);
492 clk_register_clkdev(clk, NULL, "ec800620.wdt");
493
Vipul Kumar Samarcd4b5192012-11-10 12:13:44 +0530494 clk = clk_register_fixed_factor(NULL, "smp_twd_clk", "cpu_clk", 0, 1,
495 2);
496 clk_register_clkdev(clk, NULL, "smp_twd");
497
Viresh Kumar0b928af2012-04-19 22:23:13 +0530498 clk = clk_register_fixed_factor(NULL, "ahb_clk", "pll1_clk", 0, 1,
499 6);
500 clk_register_clkdev(clk, "ahb_clk", NULL);
501
502 clk = clk_register_fixed_factor(NULL, "apb_clk", "pll1_clk", 0, 1,
503 12);
504 clk_register_clkdev(clk, "apb_clk", NULL);
505
506 /* gpt clocks */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530507 clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530508 ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
509 SPEAR1310_GPT0_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
510 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530511 clk_register_clkdev(clk, "gpt0_mclk", NULL);
512 clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530513 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0,
514 &_lock);
515 clk_register_clkdev(clk, NULL, "gpt0");
516
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530517 clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530518 ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
519 SPEAR1310_GPT1_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
520 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530521 clk_register_clkdev(clk, "gpt1_mclk", NULL);
522 clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530523 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0,
524 &_lock);
525 clk_register_clkdev(clk, NULL, "gpt1");
526
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530527 clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530528 ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
529 SPEAR1310_GPT2_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
530 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530531 clk_register_clkdev(clk, "gpt2_mclk", NULL);
532 clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530533 SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0,
534 &_lock);
535 clk_register_clkdev(clk, NULL, "gpt2");
536
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530537 clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530538 ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
539 SPEAR1310_GPT3_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
540 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530541 clk_register_clkdev(clk, "gpt3_mclk", NULL);
542 clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530543 SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0,
544 &_lock);
545 clk_register_clkdev(clk, NULL, "gpt3");
546
547 /* others */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530548 clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "vco1div2_clk",
549 0, SPEAR1310_UART_CLK_SYNT, NULL, aux_rtbl,
550 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
551 clk_register_clkdev(clk, "uart_syn_clk", NULL);
552 clk_register_clkdev(clk1, "uart_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530553
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530554 clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530555 ARRAY_SIZE(uart0_parents), CLK_SET_RATE_PARENT,
556 SPEAR1310_PERIP_CLK_CFG, SPEAR1310_UART_CLK_SHIFT,
557 SPEAR1310_UART_CLK_MASK, 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530558 clk_register_clkdev(clk, "uart0_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530559
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530560 clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk",
561 CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
562 SPEAR1310_UART_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530563 clk_register_clkdev(clk, NULL, "e0000000.serial");
564
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530565 clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530566 "vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL,
567 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530568 clk_register_clkdev(clk, "sdhci_syn_clk", NULL);
569 clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530570
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530571 clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk",
572 CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
573 SPEAR1310_SDHCI_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530574 clk_register_clkdev(clk, NULL, "b3000000.sdhci");
575
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530576 clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk",
577 0, SPEAR1310_CFXD_CLK_SYNT, NULL, aux_rtbl,
578 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
579 clk_register_clkdev(clk, "cfxd_syn_clk", NULL);
580 clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530581
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530582 clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk",
583 CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
584 SPEAR1310_CFXD_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530585 clk_register_clkdev(clk, NULL, "b2800000.cf");
586 clk_register_clkdev(clk, NULL, "arasan_xd");
587
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530588 clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk",
589 0, SPEAR1310_C3_CLK_SYNT, NULL, aux_rtbl,
590 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
591 clk_register_clkdev(clk, "c3_syn_clk", NULL);
592 clk_register_clkdev(clk1, "c3_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530593
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530594 clk = clk_register_mux(NULL, "c3_mclk", c3_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530595 ARRAY_SIZE(c3_parents), CLK_SET_RATE_PARENT,
596 SPEAR1310_PERIP_CLK_CFG, SPEAR1310_C3_CLK_SHIFT,
597 SPEAR1310_C3_CLK_MASK, 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530598 clk_register_clkdev(clk, "c3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530599
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530600 clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530601 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0,
602 &_lock);
603 clk_register_clkdev(clk, NULL, "c3");
604
605 /* gmac */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530606 clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530607 ARRAY_SIZE(gmac_phy_input_parents), 0,
608 SPEAR1310_GMAC_CLK_CFG,
609 SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT,
610 SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530611 clk_register_clkdev(clk, "phy_input_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530612
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530613 clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk",
614 0, SPEAR1310_GMAC_CLK_SYNT, NULL, gmac_rtbl,
615 ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
616 clk_register_clkdev(clk, "phy_syn_clk", NULL);
617 clk_register_clkdev(clk1, "phy_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530618
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530619 clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530620 ARRAY_SIZE(gmac_phy_parents), 0,
621 SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT,
622 SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530623 clk_register_clkdev(clk, "stmmacphy.0", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530624
625 /* clcd */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530626 clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530627 ARRAY_SIZE(clcd_synth_parents), 0,
628 SPEAR1310_CLCD_CLK_SYNT, SPEAR1310_CLCD_SYNT_CLK_SHIFT,
629 SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530630 clk_register_clkdev(clk, "clcd_syn_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530631
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530632 clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530633 SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl,
634 ARRAY_SIZE(clcd_rtbl), &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530635 clk_register_clkdev(clk, "clcd_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530636
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530637 clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530638 ARRAY_SIZE(clcd_pixel_parents), CLK_SET_RATE_PARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530639 SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT,
640 SPEAR1310_CLCD_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530641 clk_register_clkdev(clk, "clcd_pixel_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530642
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530643 clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530644 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0,
645 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530646 clk_register_clkdev(clk, NULL, "e1000000.clcd");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530647
648 /* i2s */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530649 clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530650 ARRAY_SIZE(i2s_src_parents), 0, SPEAR1310_I2S_CLK_CFG,
651 SPEAR1310_I2S_SRC_CLK_SHIFT, SPEAR1310_I2S_SRC_CLK_MASK,
652 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530653 clk_register_clkdev(clk, "i2s_src_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530654
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530655 clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530656 SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl,
657 ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
658 clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
659
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530660 clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530661 ARRAY_SIZE(i2s_ref_parents), CLK_SET_RATE_PARENT,
662 SPEAR1310_I2S_CLK_CFG, SPEAR1310_I2S_REF_SHIFT,
663 SPEAR1310_I2S_REF_SEL_MASK, 0, &_lock);
664 clk_register_clkdev(clk, "i2s_ref_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530665
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530666 clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530667 SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB,
668 0, &_lock);
669 clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
670
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530671 clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk",
Shiraz Hashim463f9e22012-11-10 12:13:42 +0530672 "i2s_ref_mclk", 0, SPEAR1310_I2S_CLK_CFG,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530673 &i2s_sclk_masks, i2s_sclk_rtbl,
674 ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1);
675 clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530676 clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530677
678 /* clock derived from ahb clk */
679 clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
680 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2C0_CLK_ENB, 0,
681 &_lock);
682 clk_register_clkdev(clk, NULL, "e0280000.i2c");
683
684 clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
685 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_DMA_CLK_ENB, 0,
686 &_lock);
687 clk_register_clkdev(clk, NULL, "ea800000.dma");
688 clk_register_clkdev(clk, NULL, "eb000000.dma");
689
690 clk = clk_register_gate(NULL, "jpeg_clk", "ahb_clk", 0,
691 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_JPEG_CLK_ENB, 0,
692 &_lock);
693 clk_register_clkdev(clk, NULL, "b2000000.jpeg");
694
695 clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
696 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GMAC_CLK_ENB, 0,
697 &_lock);
698 clk_register_clkdev(clk, NULL, "e2000000.eth");
699
700 clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
701 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_FSMC_CLK_ENB, 0,
702 &_lock);
703 clk_register_clkdev(clk, NULL, "b0000000.flash");
704
705 clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
706 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SMI_CLK_ENB, 0,
707 &_lock);
708 clk_register_clkdev(clk, NULL, "ea000000.flash");
709
710 clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
711 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC0_CLK_ENB, 0,
712 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530713 clk_register_clkdev(clk, NULL, "e4000000.ohci");
714 clk_register_clkdev(clk, NULL, "e4800000.ehci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530715
716 clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
717 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC1_CLK_ENB, 0,
718 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530719 clk_register_clkdev(clk, NULL, "e5000000.ohci");
720 clk_register_clkdev(clk, NULL, "e5800000.ehci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530721
722 clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
723 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UOC_CLK_ENB, 0,
724 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530725 clk_register_clkdev(clk, NULL, "e3800000.otg");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530726
727 clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
728 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
729 0, &_lock);
730 clk_register_clkdev(clk, NULL, "dw_pcie.0");
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530731 clk_register_clkdev(clk, NULL, "b1000000.ahci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530732
733 clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
734 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
735 0, &_lock);
736 clk_register_clkdev(clk, NULL, "dw_pcie.1");
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530737 clk_register_clkdev(clk, NULL, "b1800000.ahci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530738
739 clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
740 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
741 0, &_lock);
742 clk_register_clkdev(clk, NULL, "dw_pcie.2");
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530743 clk_register_clkdev(clk, NULL, "b4000000.ahci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530744
745 clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
746 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM0_CLK_ENB, 0,
747 &_lock);
748 clk_register_clkdev(clk, "sysram0_clk", NULL);
749
750 clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
751 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM1_CLK_ENB, 0,
752 &_lock);
753 clk_register_clkdev(clk, "sysram1_clk", NULL);
754
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530755 clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530756 0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl,
757 ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530758 clk_register_clkdev(clk, "adc_syn_clk", NULL);
759 clk_register_clkdev(clk1, "adc_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530760
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530761 clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk",
762 CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
763 SPEAR1310_ADC_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530764 clk_register_clkdev(clk, NULL, "e0080000.adc");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530765
766 /* clock derived from apb clk */
767 clk = clk_register_gate(NULL, "ssp0_clk", "apb_clk", 0,
768 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SSP_CLK_ENB, 0,
769 &_lock);
770 clk_register_clkdev(clk, NULL, "e0100000.spi");
771
772 clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
773 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO0_CLK_ENB, 0,
774 &_lock);
775 clk_register_clkdev(clk, NULL, "e0600000.gpio");
776
777 clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
778 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO1_CLK_ENB, 0,
779 &_lock);
780 clk_register_clkdev(clk, NULL, "e0680000.gpio");
781
782 clk = clk_register_gate(NULL, "i2s0_clk", "apb_clk", 0,
783 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S0_CLK_ENB, 0,
784 &_lock);
785 clk_register_clkdev(clk, NULL, "e0180000.i2s");
786
787 clk = clk_register_gate(NULL, "i2s1_clk", "apb_clk", 0,
788 SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S1_CLK_ENB, 0,
789 &_lock);
790 clk_register_clkdev(clk, NULL, "e0200000.i2s");
791
792 clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
793 SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_KBD_CLK_ENB, 0,
794 &_lock);
795 clk_register_clkdev(clk, NULL, "e0300000.kbd");
796
797 /* RAS clks */
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530798 clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents,
799 ARRAY_SIZE(gen_synth0_1_parents), 0, SPEAR1310_PLL_CFG,
800 SPEAR1310_RAS_SYNT0_1_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530801 SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530802 clk_register_clkdev(clk, "gen_syn0_1_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530803
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530804 clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents,
805 ARRAY_SIZE(gen_synth2_3_parents), 0, SPEAR1310_PLL_CFG,
806 SPEAR1310_RAS_SYNT2_3_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530807 SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530808 clk_register_clkdev(clk, "gen_syn2_3_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530809
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530810 clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530811 SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
812 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530813 clk_register_clkdev(clk, "gen_syn0_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530814
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530815 clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530816 SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
817 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530818 clk_register_clkdev(clk, "gen_syn1_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530819
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530820 clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530821 SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
822 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530823 clk_register_clkdev(clk, "gen_syn2_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530824
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530825 clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530826 SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
827 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530828 clk_register_clkdev(clk, "gen_syn3_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530829
830 clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0,
831 SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0,
832 &_lock);
833 clk_register_clkdev(clk, "ras_osc_24m_clk", NULL);
834
835 clk = clk_register_gate(NULL, "ras_osc_25m_clk", "osc_25m_clk", 0,
836 SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_25M_CLK_ENB, 0,
837 &_lock);
838 clk_register_clkdev(clk, "ras_osc_25m_clk", NULL);
839
840 clk = clk_register_gate(NULL, "ras_osc_32k_clk", "osc_32k_clk", 0,
841 SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_32K_CLK_ENB, 0,
842 &_lock);
843 clk_register_clkdev(clk, "ras_osc_32k_clk", NULL);
844
845 clk = clk_register_gate(NULL, "ras_pll2_clk", "pll2_clk", 0,
846 SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL2_CLK_ENB, 0,
847 &_lock);
848 clk_register_clkdev(clk, "ras_pll2_clk", NULL);
849
850 clk = clk_register_gate(NULL, "ras_pll3_clk", "pll3_clk", 0,
851 SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL3_CLK_ENB, 0,
852 &_lock);
853 clk_register_clkdev(clk, "ras_pll3_clk", NULL);
854
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530855 clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_pad_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530856 SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0,
857 &_lock);
858 clk_register_clkdev(clk, "ras_tx125_clk", NULL);
859
860 clk = clk_register_fixed_rate(NULL, "ras_30m_fixed_clk", "pll5_clk", 0,
861 30000000);
862 clk = clk_register_gate(NULL, "ras_30m_clk", "ras_30m_fixed_clk", 0,
863 SPEAR1310_RAS_CLK_ENB, SPEAR1310_C30M_CLK_ENB, 0,
864 &_lock);
865 clk_register_clkdev(clk, "ras_30m_clk", NULL);
866
867 clk = clk_register_fixed_rate(NULL, "ras_48m_fixed_clk", "pll5_clk", 0,
868 48000000);
869 clk = clk_register_gate(NULL, "ras_48m_clk", "ras_48m_fixed_clk", 0,
870 SPEAR1310_RAS_CLK_ENB, SPEAR1310_C48M_CLK_ENB, 0,
871 &_lock);
872 clk_register_clkdev(clk, "ras_48m_clk", NULL);
873
874 clk = clk_register_gate(NULL, "ras_ahb_clk", "ahb_clk", 0,
875 SPEAR1310_RAS_CLK_ENB, SPEAR1310_ACLK_CLK_ENB, 0,
876 &_lock);
877 clk_register_clkdev(clk, "ras_ahb_clk", NULL);
878
879 clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0,
880 SPEAR1310_RAS_CLK_ENB, SPEAR1310_PCLK_CLK_ENB, 0,
881 &_lock);
882 clk_register_clkdev(clk, "ras_apb_clk", NULL);
883
884 clk = clk_register_fixed_rate(NULL, "ras_plclk0_clk", NULL, CLK_IS_ROOT,
885 50000000);
886
887 clk = clk_register_fixed_rate(NULL, "ras_tx50_clk", NULL, CLK_IS_ROOT,
888 50000000);
889
890 clk = clk_register_gate(NULL, "can0_clk", "apb_clk", 0,
891 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN0_CLK_ENB, 0,
892 &_lock);
893 clk_register_clkdev(clk, NULL, "c_can_platform.0");
894
895 clk = clk_register_gate(NULL, "can1_clk", "apb_clk", 0,
896 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN1_CLK_ENB, 0,
897 &_lock);
898 clk_register_clkdev(clk, NULL, "c_can_platform.1");
899
900 clk = clk_register_gate(NULL, "ras_smii0_clk", "ras_ahb_clk", 0,
901 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII0_CLK_ENB, 0,
902 &_lock);
903 clk_register_clkdev(clk, NULL, "5c400000.eth");
904
905 clk = clk_register_gate(NULL, "ras_smii1_clk", "ras_ahb_clk", 0,
906 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII1_CLK_ENB, 0,
907 &_lock);
908 clk_register_clkdev(clk, NULL, "5c500000.eth");
909
910 clk = clk_register_gate(NULL, "ras_smii2_clk", "ras_ahb_clk", 0,
911 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII2_CLK_ENB, 0,
912 &_lock);
913 clk_register_clkdev(clk, NULL, "5c600000.eth");
914
915 clk = clk_register_gate(NULL, "ras_rgmii_clk", "ras_ahb_clk", 0,
916 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_GMII_CLK_ENB, 0,
917 &_lock);
918 clk_register_clkdev(clk, NULL, "5c700000.eth");
919
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530920 clk = clk_register_mux(NULL, "smii_rgmii_phy_mclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530921 smii_rgmii_phy_parents,
922 ARRAY_SIZE(smii_rgmii_phy_parents), 0,
923 SPEAR1310_RAS_CTRL_REG1,
924 SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT,
925 SPEAR1310_PHY_CLK_MASK, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530926 clk_register_clkdev(clk, "stmmacphy.1", NULL);
927 clk_register_clkdev(clk, "stmmacphy.2", NULL);
928 clk_register_clkdev(clk, "stmmacphy.4", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530929
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530930 clk = clk_register_mux(NULL, "rmii_phy_mclk", rmii_phy_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530931 ARRAY_SIZE(rmii_phy_parents), 0,
932 SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT,
933 SPEAR1310_PHY_CLK_MASK, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530934 clk_register_clkdev(clk, "stmmacphy.3", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530935
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530936 clk = clk_register_mux(NULL, "uart1_mclk", uart_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530937 ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
938 SPEAR1310_UART1_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
939 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530940 clk_register_clkdev(clk, "uart1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530941
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530942 clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530943 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0,
944 &_lock);
945 clk_register_clkdev(clk, NULL, "5c800000.serial");
946
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530947 clk = clk_register_mux(NULL, "uart2_mclk", uart_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530948 ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
949 SPEAR1310_UART2_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
950 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530951 clk_register_clkdev(clk, "uart2_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530952
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530953 clk = clk_register_gate(NULL, "uart2_clk", "uart2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530954 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0,
955 &_lock);
956 clk_register_clkdev(clk, NULL, "5c900000.serial");
957
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530958 clk = clk_register_mux(NULL, "uart3_mclk", uart_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530959 ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
960 SPEAR1310_UART3_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
961 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530962 clk_register_clkdev(clk, "uart3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530963
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530964 clk = clk_register_gate(NULL, "uart3_clk", "uart3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530965 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0,
966 &_lock);
967 clk_register_clkdev(clk, NULL, "5ca00000.serial");
968
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530969 clk = clk_register_mux(NULL, "uart4_mclk", uart_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530970 ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
971 SPEAR1310_UART4_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
972 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530973 clk_register_clkdev(clk, "uart4_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530974
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530975 clk = clk_register_gate(NULL, "uart4_clk", "uart4_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530976 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0,
977 &_lock);
978 clk_register_clkdev(clk, NULL, "5cb00000.serial");
979
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530980 clk = clk_register_mux(NULL, "uart5_mclk", uart_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530981 ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
982 SPEAR1310_UART5_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
983 0, &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530984 clk_register_clkdev(clk, "uart5_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530985
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530986 clk = clk_register_gate(NULL, "uart5_clk", "uart5_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530987 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0,
988 &_lock);
989 clk_register_clkdev(clk, NULL, "5cc00000.serial");
990
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530991 clk = clk_register_mux(NULL, "i2c1_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530992 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
993 SPEAR1310_I2C1_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
994 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530995 clk_register_clkdev(clk, "i2c1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530996
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +0530997 clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530998 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0,
999 &_lock);
1000 clk_register_clkdev(clk, NULL, "5cd00000.i2c");
1001
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301002 clk = clk_register_mux(NULL, "i2c2_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301003 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1004 SPEAR1310_I2C2_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
1005 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301006 clk_register_clkdev(clk, "i2c2_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301007
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301008 clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301009 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0,
1010 &_lock);
1011 clk_register_clkdev(clk, NULL, "5ce00000.i2c");
1012
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301013 clk = clk_register_mux(NULL, "i2c3_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301014 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1015 SPEAR1310_I2C3_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
1016 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301017 clk_register_clkdev(clk, "i2c3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301018
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301019 clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301020 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0,
1021 &_lock);
1022 clk_register_clkdev(clk, NULL, "5cf00000.i2c");
1023
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301024 clk = clk_register_mux(NULL, "i2c4_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301025 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1026 SPEAR1310_I2C4_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
1027 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301028 clk_register_clkdev(clk, "i2c4_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301029
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301030 clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301031 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0,
1032 &_lock);
1033 clk_register_clkdev(clk, NULL, "5d000000.i2c");
1034
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301035 clk = clk_register_mux(NULL, "i2c5_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301036 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1037 SPEAR1310_I2C5_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
1038 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301039 clk_register_clkdev(clk, "i2c5_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301040
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301041 clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301042 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0,
1043 &_lock);
1044 clk_register_clkdev(clk, NULL, "5d100000.i2c");
1045
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301046 clk = clk_register_mux(NULL, "i2c6_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301047 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1048 SPEAR1310_I2C6_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
1049 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301050 clk_register_clkdev(clk, "i2c6_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301051
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301052 clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301053 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0,
1054 &_lock);
1055 clk_register_clkdev(clk, NULL, "5d200000.i2c");
1056
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301057 clk = clk_register_mux(NULL, "i2c7_mclk", i2c_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301058 ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1059 SPEAR1310_I2C7_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
1060 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301061 clk_register_clkdev(clk, "i2c7_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301062
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301063 clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301064 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0,
1065 &_lock);
1066 clk_register_clkdev(clk, NULL, "5d300000.i2c");
1067
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301068 clk = clk_register_mux(NULL, "ssp1_mclk", ssp1_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301069 ARRAY_SIZE(ssp1_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1070 SPEAR1310_SSP1_CLK_SHIFT, SPEAR1310_SSP1_CLK_MASK, 0,
1071 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301072 clk_register_clkdev(clk, "ssp1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301073
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301074 clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301075 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0,
1076 &_lock);
1077 clk_register_clkdev(clk, NULL, "5d400000.spi");
1078
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301079 clk = clk_register_mux(NULL, "pci_mclk", pci_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301080 ARRAY_SIZE(pci_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1081 SPEAR1310_PCI_CLK_SHIFT, SPEAR1310_PCI_CLK_MASK, 0,
1082 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301083 clk_register_clkdev(clk, "pci_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301084
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301085 clk = clk_register_gate(NULL, "pci_clk", "pci_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301086 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0,
1087 &_lock);
1088 clk_register_clkdev(clk, NULL, "pci");
1089
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301090 clk = clk_register_mux(NULL, "tdm1_mclk", tdm_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301091 ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1092 SPEAR1310_TDM1_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0,
1093 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301094 clk_register_clkdev(clk, "tdm1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301095
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301096 clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301097 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0,
1098 &_lock);
1099 clk_register_clkdev(clk, NULL, "tdm_hdlc.0");
1100
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301101 clk = clk_register_mux(NULL, "tdm2_mclk", tdm_parents,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301102 ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0,
1103 SPEAR1310_TDM2_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0,
1104 &_lock);
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301105 clk_register_clkdev(clk, "tdm2_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +05301106
Vipul Kumar Samare28f1aa2012-07-10 17:12:44 +05301107 clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301108 SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0,
1109 &_lock);
1110 clk_register_clkdev(clk, NULL, "tdm_hdlc.1");
1111}