blob: 5a5c6648308dbc6f8009e6d5702dce3d95572532 [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>
Viresh Kumar0b928af2012-04-19 22:23:13 +053020#include "clk.h"
21
22/* Clock Configuration Registers */
Arnd Bergmannd9909eb2012-12-02 17:59:57 +010023#define SPEAR1340_SYS_CLK_CTRL (misc_base + 0x200)
Viresh Kumar0b928af2012-04-19 22:23:13 +053024 #define SPEAR1340_HCLK_SRC_SEL_SHIFT 27
25 #define SPEAR1340_HCLK_SRC_SEL_MASK 1
26 #define SPEAR1340_SCLK_SRC_SEL_SHIFT 23
27 #define SPEAR1340_SCLK_SRC_SEL_MASK 3
28
29/* PLL related registers and bit values */
Arnd Bergmannd9909eb2012-12-02 17:59:57 +010030#define SPEAR1340_PLL_CFG (misc_base + 0x210)
Viresh Kumar0b928af2012-04-19 22:23:13 +053031 /* PLL_CFG bit values */
32 #define SPEAR1340_CLCD_SYNT_CLK_MASK 1
33 #define SPEAR1340_CLCD_SYNT_CLK_SHIFT 31
34 #define SPEAR1340_GEN_SYNT2_3_CLK_SHIFT 29
35 #define SPEAR1340_GEN_SYNT_CLK_MASK 2
36 #define SPEAR1340_GEN_SYNT0_1_CLK_SHIFT 27
37 #define SPEAR1340_PLL_CLK_MASK 2
38 #define SPEAR1340_PLL3_CLK_SHIFT 24
39 #define SPEAR1340_PLL2_CLK_SHIFT 22
40 #define SPEAR1340_PLL1_CLK_SHIFT 20
41
Arnd Bergmannd9909eb2012-12-02 17:59:57 +010042#define SPEAR1340_PLL1_CTR (misc_base + 0x214)
43#define SPEAR1340_PLL1_FRQ (misc_base + 0x218)
44#define SPEAR1340_PLL2_CTR (misc_base + 0x220)
45#define SPEAR1340_PLL2_FRQ (misc_base + 0x224)
46#define SPEAR1340_PLL3_CTR (misc_base + 0x22C)
47#define SPEAR1340_PLL3_FRQ (misc_base + 0x230)
48#define SPEAR1340_PLL4_CTR (misc_base + 0x238)
49#define SPEAR1340_PLL4_FRQ (misc_base + 0x23C)
50#define SPEAR1340_PERIP_CLK_CFG (misc_base + 0x244)
Viresh Kumar0b928af2012-04-19 22:23:13 +053051 /* PERIP_CLK_CFG bit values */
52 #define SPEAR1340_SPDIF_CLK_MASK 1
53 #define SPEAR1340_SPDIF_OUT_CLK_SHIFT 15
54 #define SPEAR1340_SPDIF_IN_CLK_SHIFT 14
55 #define SPEAR1340_GPT3_CLK_SHIFT 13
56 #define SPEAR1340_GPT2_CLK_SHIFT 12
57 #define SPEAR1340_GPT_CLK_MASK 1
58 #define SPEAR1340_GPT1_CLK_SHIFT 9
59 #define SPEAR1340_GPT0_CLK_SHIFT 8
60 #define SPEAR1340_UART_CLK_MASK 2
61 #define SPEAR1340_UART1_CLK_SHIFT 6
62 #define SPEAR1340_UART0_CLK_SHIFT 4
63 #define SPEAR1340_CLCD_CLK_MASK 2
64 #define SPEAR1340_CLCD_CLK_SHIFT 2
65 #define SPEAR1340_C3_CLK_MASK 1
66 #define SPEAR1340_C3_CLK_SHIFT 1
67
Arnd Bergmannd9909eb2012-12-02 17:59:57 +010068#define SPEAR1340_GMAC_CLK_CFG (misc_base + 0x248)
Viresh Kumar0b928af2012-04-19 22:23:13 +053069 #define SPEAR1340_GMAC_PHY_CLK_MASK 1
70 #define SPEAR1340_GMAC_PHY_CLK_SHIFT 2
71 #define SPEAR1340_GMAC_PHY_INPUT_CLK_MASK 2
72 #define SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT 0
73
Arnd Bergmannd9909eb2012-12-02 17:59:57 +010074#define SPEAR1340_I2S_CLK_CFG (misc_base + 0x24C)
Viresh Kumar0b928af2012-04-19 22:23:13 +053075 /* I2S_CLK_CFG register mask */
76 #define SPEAR1340_I2S_SCLK_X_MASK 0x1F
77 #define SPEAR1340_I2S_SCLK_X_SHIFT 27
78 #define SPEAR1340_I2S_SCLK_Y_MASK 0x1F
79 #define SPEAR1340_I2S_SCLK_Y_SHIFT 22
80 #define SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT 21
81 #define SPEAR1340_I2S_SCLK_SYNTH_ENB 20
82 #define SPEAR1340_I2S_PRS1_CLK_X_MASK 0xFF
83 #define SPEAR1340_I2S_PRS1_CLK_X_SHIFT 12
84 #define SPEAR1340_I2S_PRS1_CLK_Y_MASK 0xFF
85 #define SPEAR1340_I2S_PRS1_CLK_Y_SHIFT 4
86 #define SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT 3
87 #define SPEAR1340_I2S_REF_SEL_MASK 1
88 #define SPEAR1340_I2S_REF_SHIFT 2
89 #define SPEAR1340_I2S_SRC_CLK_MASK 2
90 #define SPEAR1340_I2S_SRC_CLK_SHIFT 0
91
Arnd Bergmannd9909eb2012-12-02 17:59:57 +010092#define SPEAR1340_C3_CLK_SYNT (misc_base + 0x250)
93#define SPEAR1340_UART0_CLK_SYNT (misc_base + 0x254)
94#define SPEAR1340_UART1_CLK_SYNT (misc_base + 0x258)
95#define SPEAR1340_GMAC_CLK_SYNT (misc_base + 0x25C)
96#define SPEAR1340_SDHCI_CLK_SYNT (misc_base + 0x260)
97#define SPEAR1340_CFXD_CLK_SYNT (misc_base + 0x264)
98#define SPEAR1340_ADC_CLK_SYNT (misc_base + 0x270)
99#define SPEAR1340_AMBA_CLK_SYNT (misc_base + 0x274)
100#define SPEAR1340_CLCD_CLK_SYNT (misc_base + 0x27C)
101#define SPEAR1340_SYS_CLK_SYNT (misc_base + 0x284)
102#define SPEAR1340_GEN_CLK_SYNT0 (misc_base + 0x28C)
103#define SPEAR1340_GEN_CLK_SYNT1 (misc_base + 0x294)
104#define SPEAR1340_GEN_CLK_SYNT2 (misc_base + 0x29C)
105#define SPEAR1340_GEN_CLK_SYNT3 (misc_base + 0x304)
106#define SPEAR1340_PERIP1_CLK_ENB (misc_base + 0x30C)
Viresh Kumar0b928af2012-04-19 22:23:13 +0530107 #define SPEAR1340_RTC_CLK_ENB 31
108 #define SPEAR1340_ADC_CLK_ENB 30
109 #define SPEAR1340_C3_CLK_ENB 29
110 #define SPEAR1340_CLCD_CLK_ENB 27
111 #define SPEAR1340_DMA_CLK_ENB 25
112 #define SPEAR1340_GPIO1_CLK_ENB 24
113 #define SPEAR1340_GPIO0_CLK_ENB 23
114 #define SPEAR1340_GPT1_CLK_ENB 22
115 #define SPEAR1340_GPT0_CLK_ENB 21
116 #define SPEAR1340_I2S_PLAY_CLK_ENB 20
117 #define SPEAR1340_I2S_REC_CLK_ENB 19
118 #define SPEAR1340_I2C0_CLK_ENB 18
119 #define SPEAR1340_SSP_CLK_ENB 17
120 #define SPEAR1340_UART0_CLK_ENB 15
121 #define SPEAR1340_PCIE_SATA_CLK_ENB 12
122 #define SPEAR1340_UOC_CLK_ENB 11
123 #define SPEAR1340_UHC1_CLK_ENB 10
124 #define SPEAR1340_UHC0_CLK_ENB 9
125 #define SPEAR1340_GMAC_CLK_ENB 8
126 #define SPEAR1340_CFXD_CLK_ENB 7
127 #define SPEAR1340_SDHCI_CLK_ENB 6
128 #define SPEAR1340_SMI_CLK_ENB 5
129 #define SPEAR1340_FSMC_CLK_ENB 4
130 #define SPEAR1340_SYSRAM0_CLK_ENB 3
131 #define SPEAR1340_SYSRAM1_CLK_ENB 2
132 #define SPEAR1340_SYSROM_CLK_ENB 1
133 #define SPEAR1340_BUS_CLK_ENB 0
134
Arnd Bergmannd9909eb2012-12-02 17:59:57 +0100135#define SPEAR1340_PERIP2_CLK_ENB (misc_base + 0x310)
Viresh Kumar0b928af2012-04-19 22:23:13 +0530136 #define SPEAR1340_THSENS_CLK_ENB 8
137 #define SPEAR1340_I2S_REF_PAD_CLK_ENB 7
138 #define SPEAR1340_ACP_CLK_ENB 6
139 #define SPEAR1340_GPT3_CLK_ENB 5
140 #define SPEAR1340_GPT2_CLK_ENB 4
141 #define SPEAR1340_KBD_CLK_ENB 3
142 #define SPEAR1340_CPU_DBG_CLK_ENB 2
143 #define SPEAR1340_DDR_CORE_CLK_ENB 1
144 #define SPEAR1340_DDR_CTRL_CLK_ENB 0
145
Arnd Bergmannd9909eb2012-12-02 17:59:57 +0100146#define SPEAR1340_PERIP3_CLK_ENB (misc_base + 0x314)
Viresh Kumar0b928af2012-04-19 22:23:13 +0530147 #define SPEAR1340_PLGPIO_CLK_ENB 18
148 #define SPEAR1340_VIDEO_DEC_CLK_ENB 16
149 #define SPEAR1340_VIDEO_ENC_CLK_ENB 15
150 #define SPEAR1340_SPDIF_OUT_CLK_ENB 13
151 #define SPEAR1340_SPDIF_IN_CLK_ENB 12
152 #define SPEAR1340_VIDEO_IN_CLK_ENB 11
153 #define SPEAR1340_CAM0_CLK_ENB 10
154 #define SPEAR1340_CAM1_CLK_ENB 9
155 #define SPEAR1340_CAM2_CLK_ENB 8
156 #define SPEAR1340_CAM3_CLK_ENB 7
157 #define SPEAR1340_MALI_CLK_ENB 6
158 #define SPEAR1340_CEC0_CLK_ENB 5
159 #define SPEAR1340_CEC1_CLK_ENB 4
160 #define SPEAR1340_PWM_CLK_ENB 3
161 #define SPEAR1340_I2C1_CLK_ENB 2
162 #define SPEAR1340_UART1_CLK_ENB 1
163
164static DEFINE_SPINLOCK(_lock);
165
166/* pll rate configuration table, in ascending order of rates */
167static struct pll_rate_tbl pll_rtbl[] = {
168 /* PCLK 24MHz */
169 {.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
170 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
171 {.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
172 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
173 {.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
174 {.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
175 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
176 {.mode = 0, .m = 0x96, .n = 0x06, .p = 0x0}, /* vco 1200, pll 1200 MHz */
177};
178
179/* vco-pll4 rate configuration table, in ascending order of rates */
180static struct pll_rate_tbl pll4_rtbl[] = {
181 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
182 {.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
183 {.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
184 {.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
185};
186
187/*
188 * All below entries generate 166 MHz for
189 * different values of vco1div2
190 */
191static struct frac_rate_tbl amba_synth_rtbl[] = {
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530192 {.div = 0x073A8}, /* for vco1div2 = 600 MHz */
Viresh Kumar0b928af2012-04-19 22:23:13 +0530193 {.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 * --------------------------------------------------------------------
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530223 * 600 200 100 0x06000
224 * 600 250 125 0x04CCE
225 * 600 332 166 0x039D5
226 * 600 400 200 0x03000
227 * 600 500 250 0x02666
228 * --------------------------------------------------------------------
Viresh Kumar0b928af2012-04-19 22:23:13 +0530229 * 664 200 100 0x06a38
230 * 664 250 125 0x054FD
231 * 664 332 166 0x04000
232 * 664 400 200 0x0351E
233 * 664 500 250 0x02A7E
234 * --------------------------------------------------------------------
235 * 800 200 100 0x08000
236 * 800 250 125 0x06666
237 * 800 332 166 0x04D18
238 * 800 400 200 0x04000
239 * 800 500 250 0x03333
240 * --------------------------------------------------------------------
241 * sys rate configuration table is in descending order of divisor.
242 */
243static struct frac_rate_tbl sys_synth_rtbl[] = {
244 {.div = 0x08000},
245 {.div = 0x06a38},
246 {.div = 0x06666},
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530247 {.div = 0x06000},
Viresh Kumar0b928af2012-04-19 22:23:13 +0530248 {.div = 0x054FD},
249 {.div = 0x05000},
250 {.div = 0x04D18},
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530251 {.div = 0x04CCE},
Viresh Kumar0b928af2012-04-19 22:23:13 +0530252 {.div = 0x04000},
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530253 {.div = 0x039D5},
Viresh Kumar0b928af2012-04-19 22:23:13 +0530254 {.div = 0x0351E},
255 {.div = 0x03333},
256 {.div = 0x03031},
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530257 {.div = 0x03000},
Viresh Kumar0b928af2012-04-19 22:23:13 +0530258 {.div = 0x02A7E},
259 {.div = 0x02800},
260 {.div = 0x0268D},
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530261 {.div = 0x02666},
Viresh Kumar0b928af2012-04-19 22:23:13 +0530262 {.div = 0x02000},
263};
264
265/* aux rate configuration table, in ascending order of rates */
266static struct aux_rate_tbl aux_rtbl[] = {
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530267 /* 12.29MHz for vic1div2=600MHz and 10.24MHz for VCO1div2=500MHz */
268 {.xscale = 5, .yscale = 122, .eq = 0},
269 /* 14.70MHz for vic1div2=600MHz and 12.29MHz for VCO1div2=500MHz */
270 {.xscale = 10, .yscale = 204, .eq = 0},
271 /* 48MHz for vic1div2=600MHz and 40 MHz for VCO1div2=500MHz */
272 {.xscale = 4, .yscale = 25, .eq = 0},
273 /* 57.14MHz for vic1div2=600MHz and 48 MHz for VCO1div2=500MHz */
274 {.xscale = 4, .yscale = 21, .eq = 0},
275 /* 83.33MHz for vic1div2=600MHz and 69.44MHz for VCO1div2=500MHz */
276 {.xscale = 5, .yscale = 18, .eq = 0},
277 /* 100MHz for vic1div2=600MHz and 83.33 MHz for VCO1div2=500MHz */
278 {.xscale = 2, .yscale = 6, .eq = 0},
279 /* 125MHz for vic1div2=600MHz and 104.1MHz for VCO1div2=500MHz */
280 {.xscale = 5, .yscale = 12, .eq = 0},
281 /* 150MHz for vic1div2=600MHz and 125MHz for VCO1div2=500MHz */
282 {.xscale = 2, .yscale = 4, .eq = 0},
283 /* 166MHz for vic1div2=600MHz and 138.88MHz for VCO1div2=500MHz */
284 {.xscale = 5, .yscale = 18, .eq = 1},
285 /* 200MHz for vic1div2=600MHz and 166MHz for VCO1div2=500MHz */
286 {.xscale = 1, .yscale = 3, .eq = 1},
287 /* 250MHz for vic1div2=600MHz and 208.33MHz for VCO1div2=500MHz */
288 {.xscale = 5, .yscale = 12, .eq = 1},
289 /* 300MHz for vic1div2=600MHz and 250MHz for VCO1div2=500MHz */
290 {.xscale = 1, .yscale = 2, .eq = 1},
Viresh Kumar0b928af2012-04-19 22:23:13 +0530291};
292
293/* gmac rate configuration table, in ascending order of rates */
294static struct aux_rate_tbl gmac_rtbl[] = {
295 /* For gmac phy input clk */
296 {.xscale = 2, .yscale = 6, .eq = 0}, /* divided by 6 */
297 {.xscale = 2, .yscale = 4, .eq = 0}, /* divided by 4 */
298 {.xscale = 1, .yscale = 3, .eq = 1}, /* divided by 3 */
299 {.xscale = 1, .yscale = 2, .eq = 1}, /* divided by 2 */
300};
301
302/* clcd rate configuration table, in ascending order of rates */
303static struct frac_rate_tbl clcd_rtbl[] = {
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530304 {.div = 0x18000}, /* 25 Mhz , for vc01div4 = 300 MHz*/
305 {.div = 0x1638E}, /* 27 Mhz , for vc01div4 = 300 MHz*/
Viresh Kumar0b928af2012-04-19 22:23:13 +0530306 {.div = 0x14000}, /* 25 Mhz , for vc01div4 = 250 MHz*/
307 {.div = 0x1284B}, /* 27 Mhz , for vc01div4 = 250 MHz*/
308 {.div = 0x0D8D3}, /* 58 Mhz , for vco1div4 = 393 MHz */
309 {.div = 0x0B72C}, /* 58 Mhz , for vco1div4 = 332 MHz */
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530310 {.div = 0x0A584}, /* 58 Mhz , for vco1div4 = 300 MHz */
311 {.div = 0x093B1}, /* 65 Mhz , for vc01div4 = 300 MHz*/
Viresh Kumar0b928af2012-04-19 22:23:13 +0530312 {.div = 0x089EE}, /* 58 Mhz , for vc01div4 = 250 MHz*/
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530313 {.div = 0x081BA}, /* 74 Mhz , for vc01div4 = 300 MHz*/
Viresh Kumar0b928af2012-04-19 22:23:13 +0530314 {.div = 0x07BA0}, /* 65 Mhz , for vc01div4 = 250 MHz*/
315 {.div = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
316 {.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
317 {.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530318 {.div = 0x058E3}, /* 108 Mhz , for vc01div4 = 300 MHz*/
Viresh Kumar0b928af2012-04-19 22:23:13 +0530319 {.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530320 {.div = 0x040A5}, /* 148.5 Mhz , for vc01div4 = 300 MHz*/
Viresh Kumar0b928af2012-04-19 22:23:13 +0530321 {.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
322 {.div = 0x0360D}, /* 148 Mhz , for vc01div4 = 250 MHz*/
323 {.div = 0x035E0}, /* 148.5 MHz, for vc01div4 = 250 MHz*/
324};
325
326/* i2s prescaler1 masks */
327static struct aux_clk_masks i2s_prs1_masks = {
328 .eq_sel_mask = AUX_EQ_SEL_MASK,
329 .eq_sel_shift = SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT,
330 .eq1_mask = AUX_EQ1_SEL,
331 .eq2_mask = AUX_EQ2_SEL,
332 .xscale_sel_mask = SPEAR1340_I2S_PRS1_CLK_X_MASK,
333 .xscale_sel_shift = SPEAR1340_I2S_PRS1_CLK_X_SHIFT,
334 .yscale_sel_mask = SPEAR1340_I2S_PRS1_CLK_Y_MASK,
335 .yscale_sel_shift = SPEAR1340_I2S_PRS1_CLK_Y_SHIFT,
336};
337
338/* i2s sclk (bit clock) syynthesizers masks */
339static struct aux_clk_masks i2s_sclk_masks = {
340 .eq_sel_mask = AUX_EQ_SEL_MASK,
341 .eq_sel_shift = SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT,
342 .eq1_mask = AUX_EQ1_SEL,
343 .eq2_mask = AUX_EQ2_SEL,
344 .xscale_sel_mask = SPEAR1340_I2S_SCLK_X_MASK,
345 .xscale_sel_shift = SPEAR1340_I2S_SCLK_X_SHIFT,
346 .yscale_sel_mask = SPEAR1340_I2S_SCLK_Y_MASK,
347 .yscale_sel_shift = SPEAR1340_I2S_SCLK_Y_SHIFT,
348 .enable_bit = SPEAR1340_I2S_SCLK_SYNTH_ENB,
349};
350
351/* i2s prs1 aux rate configuration table, in ascending order of rates */
352static struct aux_rate_tbl i2s_prs1_rtbl[] = {
353 /* For parent clk = 49.152 MHz */
354 {.xscale = 1, .yscale = 12, .eq = 0}, /* 2.048 MHz, smp freq = 8Khz */
355 {.xscale = 11, .yscale = 96, .eq = 0}, /* 2.816 MHz, smp freq = 11Khz */
356 {.xscale = 1, .yscale = 6, .eq = 0}, /* 4.096 MHz, smp freq = 16Khz */
357 {.xscale = 11, .yscale = 48, .eq = 0}, /* 5.632 MHz, smp freq = 22Khz */
358
359 /*
360 * with parent clk = 49.152, freq gen is 8.192 MHz, smp freq = 32Khz
361 * with parent clk = 12.288, freq gen is 2.048 MHz, smp freq = 8Khz
362 */
363 {.xscale = 1, .yscale = 3, .eq = 0},
364
365 /* For parent clk = 49.152 MHz */
366 {.xscale = 17, .yscale = 37, .eq = 0}, /* 11.289 MHz, smp freq = 44Khz*/
367 {.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz, smp freq = 48Khz*/
368};
369
370/* i2s sclk aux rate configuration table, in ascending order of rates */
371static struct aux_rate_tbl i2s_sclk_rtbl[] = {
372 /* For sclk = ref_clk * x/2/y */
373 {.xscale = 1, .yscale = 4, .eq = 0},
374 {.xscale = 1, .yscale = 2, .eq = 0},
375};
376
377/* adc rate configuration table, in ascending order of rates */
378/* possible adc range is 2.5 MHz to 20 MHz. */
379static struct aux_rate_tbl adc_rtbl[] = {
380 /* For ahb = 166.67 MHz */
381 {.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
382 {.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
383 {.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
384 {.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
385};
386
387/* General synth rate configuration table, in ascending order of rates */
388static struct frac_rate_tbl gen_rtbl[] = {
Deepak Sikrief0fd0a2012-11-10 12:13:45 +0530389 {.div = 0x1A92B}, /* 22.5792 MHz for vco1div4=300 MHz*/
390 {.div = 0x186A0}, /* 24.576 MHz for vco1div4=300 MHz*/
391 {.div = 0x18000}, /* 25 MHz for vco1div4=300 MHz*/
392 {.div = 0x1624E}, /* 22.5792 MHz for vco1div4=250 MHz*/
393 {.div = 0x14585}, /* 24.576 MHz for vco1div4=250 MHz*/
394 {.div = 0x14000}, /* 25 MHz for vco1div4=250 MHz*/
395 {.div = 0x0D495}, /* 45.1584 MHz for vco1div4=300 MHz*/
396 {.div = 0x0C000}, /* 50 MHz for vco1div4=300 MHz*/
397 {.div = 0x0B127}, /* 45.1584 MHz for vco1div4=250 MHz*/
398 {.div = 0x0A000}, /* 50 MHz for vco1div4=250 MHz*/
399 {.div = 0x07530}, /* 81.92 MHz for vco1div4=300 MHz*/
400 {.div = 0x061A8}, /* 81.92 MHz for vco1div4=250 MHz*/
401 {.div = 0x06000}, /* 100 MHz for vco1div4=300 MHz*/
402 {.div = 0x05000}, /* 100 MHz for vco1div4=250 MHz*/
403 {.div = 0x03000}, /* 200 MHz for vco1div4=300 MHz*/
404 {.div = 0x02DB6}, /* 210 MHz for vco1div4=300 MHz*/
405 {.div = 0x02BA2}, /* 220 MHz for vco1div4=300 MHz*/
406 {.div = 0x029BD}, /* 230 MHz for vco1div4=300 MHz*/
407 {.div = 0x02800}, /* 200 MHz for vco1div4=250 MHz*/
408 {.div = 0x02666}, /* 250 MHz for vco1div4=300 MHz*/
409 {.div = 0x02620}, /* 210 MHz for vco1div4=250 MHz*/
410 {.div = 0x02460}, /* 220 MHz for vco1div4=250 MHz*/
411 {.div = 0x022C0}, /* 230 MHz for vco1div4=250 MHz*/
412 {.div = 0x02160}, /* 240 MHz for vco1div4=250 MHz*/
413 {.div = 0x02000}, /* 250 MHz for vco1div4=250 MHz*/
Viresh Kumar0b928af2012-04-19 22:23:13 +0530414};
415
416/* clock parents */
417static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
Vipul Kumar Samard4f513f2012-07-06 15:52:36 +0530418static const char *sys_parents[] = { "pll1_clk", "pll1_clk", "pll1_clk",
Shiraz Hashim463f9e22012-11-10 12:13:42 +0530419 "pll1_clk", "sys_syn_clk", "sys_syn_clk", "pll2_clk", "pll3_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530420static const char *ahb_parents[] = { "cpu_div3_clk", "amba_syn_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530421static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
422static const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk",
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530423 "uart0_syn_gclk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530424static const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk",
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530425 "uart1_syn_gclk", };
426static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", };
427static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530428 "osc_25m_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530429static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530430static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530431static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530432static const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk",
433 "i2s_src_pad_clk", };
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530434static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", };
435static const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_syn2_clk", };
436static const char *spdif_in_parents[] = { "pll2_clk", "gen_syn3_clk", };
Viresh Kumar0b928af2012-04-19 22:23:13 +0530437
438static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
439 "pll3_clk", };
Shiraz Hashim463f9e22012-11-10 12:13:42 +0530440static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco2div2_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530441 "pll2_clk", };
442
Arnd Bergmannd9909eb2012-12-02 17:59:57 +0100443void __init spear1340_clk_init(void __iomem *misc_base)
Viresh Kumar0b928af2012-04-19 22:23:13 +0530444{
445 struct clk *clk, *clk1;
446
Viresh Kumar0b928af2012-04-19 22:23:13 +0530447 clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT,
448 32000);
449 clk_register_clkdev(clk, "osc_32k_clk", NULL);
450
451 clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, CLK_IS_ROOT,
452 24000000);
453 clk_register_clkdev(clk, "osc_24m_clk", NULL);
454
455 clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, CLK_IS_ROOT,
456 25000000);
457 clk_register_clkdev(clk, "osc_25m_clk", NULL);
458
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530459 clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT,
460 125000000);
461 clk_register_clkdev(clk, "gmii_pad_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530462
463 clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL,
464 CLK_IS_ROOT, 12288000);
465 clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
466
467 /* clock derived from 32 KHz osc clk */
468 clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
469 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_RTC_CLK_ENB, 0,
470 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530471 clk_register_clkdev(clk, NULL, "e0580000.rtc");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530472
473 /* clock derived from 24 or 25 MHz osc clk */
474 /* vco-pll */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530475 clk = clk_register_mux(NULL, "vco1_mclk", vco_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100476 ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
477 SPEAR1340_PLL_CFG, SPEAR1340_PLL1_CLK_SHIFT,
478 SPEAR1340_PLL_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530479 clk_register_clkdev(clk, "vco1_mclk", NULL);
480 clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", 0,
481 SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530482 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
483 clk_register_clkdev(clk, "vco1_clk", NULL);
484 clk_register_clkdev(clk1, "pll1_clk", NULL);
485
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530486 clk = clk_register_mux(NULL, "vco2_mclk", vco_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100487 ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
488 SPEAR1340_PLL_CFG, SPEAR1340_PLL2_CLK_SHIFT,
489 SPEAR1340_PLL_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530490 clk_register_clkdev(clk, "vco2_mclk", NULL);
491 clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", 0,
492 SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530493 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
494 clk_register_clkdev(clk, "vco2_clk", NULL);
495 clk_register_clkdev(clk1, "pll2_clk", NULL);
496
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530497 clk = clk_register_mux(NULL, "vco3_mclk", vco_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100498 ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
499 SPEAR1340_PLL_CFG, SPEAR1340_PLL3_CLK_SHIFT,
500 SPEAR1340_PLL_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530501 clk_register_clkdev(clk, "vco3_mclk", NULL);
502 clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", 0,
503 SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530504 ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
505 clk_register_clkdev(clk, "vco3_clk", NULL);
506 clk_register_clkdev(clk1, "pll3_clk", NULL);
507
508 clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
509 0, SPEAR1340_PLL4_CTR, SPEAR1340_PLL4_FRQ, pll4_rtbl,
510 ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
511 clk_register_clkdev(clk, "vco4_clk", NULL);
512 clk_register_clkdev(clk1, "pll4_clk", NULL);
513
514 clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
515 48000000);
516 clk_register_clkdev(clk, "pll5_clk", NULL);
517
518 clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
519 25000000);
520 clk_register_clkdev(clk, "pll6_clk", NULL);
521
522 /* vco div n clocks */
523 clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
524 2);
525 clk_register_clkdev(clk, "vco1div2_clk", NULL);
526
527 clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
528 4);
529 clk_register_clkdev(clk, "vco1div4_clk", NULL);
530
531 clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
532 2);
533 clk_register_clkdev(clk, "vco2div2_clk", NULL);
534
535 clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
536 2);
537 clk_register_clkdev(clk, "vco3div2_clk", NULL);
538
539 /* peripherals */
540 clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
541 128);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530542 clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530543 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0,
544 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530545 clk_register_clkdev(clk, NULL, "e07008c4.thermal");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530546
547 /* clock derived from pll4 clk */
548 clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
549 1);
550 clk_register_clkdev(clk, "ddr_clk", NULL);
551
552 /* clock derived from pll1 clk */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530553 clk = clk_register_frac("sys_syn_clk", "vco1div2_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530554 SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl,
555 ARRAY_SIZE(sys_synth_rtbl), &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530556 clk_register_clkdev(clk, "sys_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530557
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530558 clk = clk_register_frac("amba_syn_clk", "vco1div2_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530559 SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl,
560 ARRAY_SIZE(amba_synth_rtbl), &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530561 clk_register_clkdev(clk, "amba_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530562
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530563 clk = clk_register_mux(NULL, "sys_mclk", sys_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100564 ARRAY_SIZE(sys_parents), CLK_SET_RATE_NO_REPARENT,
565 SPEAR1340_SYS_CLK_CTRL, SPEAR1340_SCLK_SRC_SEL_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530566 SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530567 clk_register_clkdev(clk, "sys_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530568
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530569 clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mclk", 0, 1,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530570 2);
571 clk_register_clkdev(clk, "cpu_clk", NULL);
572
573 clk = clk_register_fixed_factor(NULL, "cpu_div3_clk", "cpu_clk", 0, 1,
574 3);
575 clk_register_clkdev(clk, "cpu_div3_clk", NULL);
576
577 clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
578 2);
579 clk_register_clkdev(clk, NULL, "ec800620.wdt");
580
Vipul Kumar Samarcd4b5192012-11-10 12:13:44 +0530581 clk = clk_register_fixed_factor(NULL, "smp_twd_clk", "cpu_clk", 0, 1,
582 2);
583 clk_register_clkdev(clk, NULL, "smp_twd");
584
Viresh Kumar0b928af2012-04-19 22:23:13 +0530585 clk = clk_register_mux(NULL, "ahb_clk", ahb_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100586 ARRAY_SIZE(ahb_parents), CLK_SET_RATE_NO_REPARENT,
587 SPEAR1340_SYS_CLK_CTRL, SPEAR1340_HCLK_SRC_SEL_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530588 SPEAR1340_HCLK_SRC_SEL_MASK, 0, &_lock);
589 clk_register_clkdev(clk, "ahb_clk", NULL);
590
591 clk = clk_register_fixed_factor(NULL, "apb_clk", "ahb_clk", 0, 1,
592 2);
593 clk_register_clkdev(clk, "apb_clk", NULL);
594
595 /* gpt clocks */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530596 clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100597 ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
598 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT0_CLK_SHIFT,
599 SPEAR1340_GPT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530600 clk_register_clkdev(clk, "gpt0_mclk", NULL);
601 clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530602 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0,
603 &_lock);
604 clk_register_clkdev(clk, NULL, "gpt0");
605
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530606 clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100607 ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
608 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT1_CLK_SHIFT,
609 SPEAR1340_GPT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530610 clk_register_clkdev(clk, "gpt1_mclk", NULL);
611 clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530612 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0,
613 &_lock);
614 clk_register_clkdev(clk, NULL, "gpt1");
615
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530616 clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100617 ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
618 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT2_CLK_SHIFT,
619 SPEAR1340_GPT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530620 clk_register_clkdev(clk, "gpt2_mclk", NULL);
621 clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530622 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0,
623 &_lock);
624 clk_register_clkdev(clk, NULL, "gpt2");
625
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530626 clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100627 ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
628 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT3_CLK_SHIFT,
629 SPEAR1340_GPT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530630 clk_register_clkdev(clk, "gpt3_mclk", NULL);
631 clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530632 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0,
633 &_lock);
634 clk_register_clkdev(clk, NULL, "gpt3");
635
636 /* others */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530637 clk = clk_register_aux("uart0_syn_clk", "uart0_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530638 "vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL,
639 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530640 clk_register_clkdev(clk, "uart0_syn_clk", NULL);
641 clk_register_clkdev(clk1, "uart0_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530642
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530643 clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100644 ARRAY_SIZE(uart0_parents),
645 CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530646 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_UART0_CLK_SHIFT,
647 SPEAR1340_UART_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530648 clk_register_clkdev(clk, "uart0_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530649
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530650 clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk",
651 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
652 SPEAR1340_UART0_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530653 clk_register_clkdev(clk, NULL, "e0000000.serial");
654
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530655 clk = clk_register_aux("uart1_syn_clk", "uart1_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530656 "vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL,
657 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530658 clk_register_clkdev(clk, "uart1_syn_clk", NULL);
659 clk_register_clkdev(clk1, "uart1_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530660
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530661 clk = clk_register_mux(NULL, "uart1_mclk", uart1_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100662 ARRAY_SIZE(uart1_parents), CLK_SET_RATE_NO_REPARENT,
663 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_UART1_CLK_SHIFT,
664 SPEAR1340_UART_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530665 clk_register_clkdev(clk, "uart1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530666
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530667 clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0,
Vipul Kumar Samard9ba8db2012-07-04 18:52:19 +0800668 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530669 &_lock);
670 clk_register_clkdev(clk, NULL, "b4100000.serial");
671
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530672 clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530673 "vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL,
674 aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530675 clk_register_clkdev(clk, "sdhci_syn_clk", NULL);
676 clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530677
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530678 clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk",
679 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
680 SPEAR1340_SDHCI_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530681 clk_register_clkdev(clk, NULL, "b3000000.sdhci");
682
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530683 clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk",
684 0, SPEAR1340_CFXD_CLK_SYNT, NULL, aux_rtbl,
685 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
686 clk_register_clkdev(clk, "cfxd_syn_clk", NULL);
687 clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530688
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530689 clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk",
690 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
691 SPEAR1340_CFXD_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530692 clk_register_clkdev(clk, NULL, "b2800000.cf");
693 clk_register_clkdev(clk, NULL, "arasan_xd");
694
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530695 clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", 0,
696 SPEAR1340_C3_CLK_SYNT, NULL, aux_rtbl,
697 ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
698 clk_register_clkdev(clk, "c3_syn_clk", NULL);
699 clk_register_clkdev(clk1, "c3_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530700
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530701 clk = clk_register_mux(NULL, "c3_mclk", c3_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100702 ARRAY_SIZE(c3_parents),
703 CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530704 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_C3_CLK_SHIFT,
705 SPEAR1340_C3_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530706 clk_register_clkdev(clk, "c3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530707
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530708 clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", CLK_SET_RATE_PARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530709 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0,
710 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530711 clk_register_clkdev(clk, NULL, "e1800000.c3");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530712
713 /* gmac */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530714 clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100715 ARRAY_SIZE(gmac_phy_input_parents),
716 CLK_SET_RATE_NO_REPARENT, SPEAR1340_GMAC_CLK_CFG,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530717 SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT,
718 SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530719 clk_register_clkdev(clk, "phy_input_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530720
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530721 clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk",
722 0, SPEAR1340_GMAC_CLK_SYNT, NULL, gmac_rtbl,
723 ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
724 clk_register_clkdev(clk, "phy_syn_clk", NULL);
725 clk_register_clkdev(clk1, "phy_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530726
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530727 clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100728 ARRAY_SIZE(gmac_phy_parents), CLK_SET_RATE_NO_REPARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530729 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT,
730 SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530731 clk_register_clkdev(clk, "stmmacphy.0", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530732
733 /* clcd */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530734 clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100735 ARRAY_SIZE(clcd_synth_parents),
736 CLK_SET_RATE_NO_REPARENT, SPEAR1340_CLCD_CLK_SYNT,
737 SPEAR1340_CLCD_SYNT_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530738 SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530739 clk_register_clkdev(clk, "clcd_syn_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530740
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530741 clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530742 SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl,
743 ARRAY_SIZE(clcd_rtbl), &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530744 clk_register_clkdev(clk, "clcd_syn_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530745
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530746 clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100747 ARRAY_SIZE(clcd_pixel_parents),
748 CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530749 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT,
750 SPEAR1340_CLCD_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530751 clk_register_clkdev(clk, "clcd_pixel_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530752
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530753 clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530754 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0,
755 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530756 clk_register_clkdev(clk, NULL, "e1000000.clcd");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530757
758 /* i2s */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530759 clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100760 ARRAY_SIZE(i2s_src_parents), CLK_SET_RATE_NO_REPARENT,
761 SPEAR1340_I2S_CLK_CFG, SPEAR1340_I2S_SRC_CLK_SHIFT,
762 SPEAR1340_I2S_SRC_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530763 clk_register_clkdev(clk, "i2s_src_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530764
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530765 clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk",
766 CLK_SET_RATE_PARENT, SPEAR1340_I2S_CLK_CFG,
767 &i2s_prs1_masks, i2s_prs1_rtbl,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530768 ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
769 clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
770
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530771 clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100772 ARRAY_SIZE(i2s_ref_parents),
773 CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530774 SPEAR1340_I2S_CLK_CFG, SPEAR1340_I2S_REF_SHIFT,
775 SPEAR1340_I2S_REF_SEL_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530776 clk_register_clkdev(clk, "i2s_ref_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530777
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530778 clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530779 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB,
780 0, &_lock);
781 clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
782
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530783 clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", "i2s_ref_mclk",
784 0, SPEAR1340_I2S_CLK_CFG, &i2s_sclk_masks,
785 i2s_sclk_rtbl, ARRAY_SIZE(i2s_sclk_rtbl), &_lock,
786 &clk1);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530787 clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530788 clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530789
790 /* clock derived from ahb clk */
791 clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
792 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2C0_CLK_ENB, 0,
793 &_lock);
794 clk_register_clkdev(clk, NULL, "e0280000.i2c");
795
796 clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0,
Vipul Kumar Samard9ba8db2012-07-04 18:52:19 +0800797 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530798 &_lock);
799 clk_register_clkdev(clk, NULL, "b4000000.i2c");
800
801 clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
802 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_DMA_CLK_ENB, 0,
803 &_lock);
804 clk_register_clkdev(clk, NULL, "ea800000.dma");
805 clk_register_clkdev(clk, NULL, "eb000000.dma");
806
807 clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
808 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GMAC_CLK_ENB, 0,
809 &_lock);
810 clk_register_clkdev(clk, NULL, "e2000000.eth");
811
812 clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
813 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_FSMC_CLK_ENB, 0,
814 &_lock);
815 clk_register_clkdev(clk, NULL, "b0000000.flash");
816
817 clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
818 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SMI_CLK_ENB, 0,
819 &_lock);
820 clk_register_clkdev(clk, NULL, "ea000000.flash");
821
822 clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
823 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UHC0_CLK_ENB, 0,
824 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530825 clk_register_clkdev(clk, NULL, "e4000000.ohci");
826 clk_register_clkdev(clk, NULL, "e4800000.ehci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530827
828 clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
829 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UHC1_CLK_ENB, 0,
830 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530831 clk_register_clkdev(clk, NULL, "e5000000.ohci");
832 clk_register_clkdev(clk, NULL, "e5800000.ehci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530833
834 clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
835 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UOC_CLK_ENB, 0,
836 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530837 clk_register_clkdev(clk, NULL, "e3800000.otg");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530838
839 clk = clk_register_gate(NULL, "pcie_sata_clk", "ahb_clk", 0,
840 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_PCIE_SATA_CLK_ENB,
841 0, &_lock);
Pratyush Anand22a69232014-07-10 12:56:34 +0530842 clk_register_clkdev(clk, NULL, "b1000000.pcie");
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530843 clk_register_clkdev(clk, NULL, "b1000000.ahci");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530844
845 clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
846 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SYSRAM0_CLK_ENB, 0,
847 &_lock);
848 clk_register_clkdev(clk, "sysram0_clk", NULL);
849
850 clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
851 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SYSRAM1_CLK_ENB, 0,
852 &_lock);
853 clk_register_clkdev(clk, "sysram1_clk", NULL);
854
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530855 clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk",
Viresh Kumar0b928af2012-04-19 22:23:13 +0530856 0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl,
857 ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530858 clk_register_clkdev(clk, "adc_syn_clk", NULL);
859 clk_register_clkdev(clk1, "adc_syn_gclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530860
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530861 clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk",
862 CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
863 SPEAR1340_ADC_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530864 clk_register_clkdev(clk, NULL, "e0080000.adc");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530865
866 /* clock derived from apb clk */
867 clk = clk_register_gate(NULL, "ssp_clk", "apb_clk", 0,
868 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SSP_CLK_ENB, 0,
869 &_lock);
870 clk_register_clkdev(clk, NULL, "e0100000.spi");
871
872 clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
873 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPIO0_CLK_ENB, 0,
874 &_lock);
875 clk_register_clkdev(clk, NULL, "e0600000.gpio");
876
877 clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
878 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPIO1_CLK_ENB, 0,
879 &_lock);
880 clk_register_clkdev(clk, NULL, "e0680000.gpio");
881
882 clk = clk_register_gate(NULL, "i2s_play_clk", "apb_clk", 0,
883 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2S_PLAY_CLK_ENB, 0,
884 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530885 clk_register_clkdev(clk, NULL, "b2400000.i2s-play");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530886
887 clk = clk_register_gate(NULL, "i2s_rec_clk", "apb_clk", 0,
888 SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2S_REC_CLK_ENB, 0,
889 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530890 clk_register_clkdev(clk, NULL, "b2000000.i2s-rec");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530891
892 clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
893 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_KBD_CLK_ENB, 0,
894 &_lock);
895 clk_register_clkdev(clk, NULL, "e0300000.kbd");
896
897 /* RAS clks */
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530898 clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100899 ARRAY_SIZE(gen_synth0_1_parents),
900 CLK_SET_RATE_NO_REPARENT, SPEAR1340_PLL_CFG,
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530901 SPEAR1340_GEN_SYNT0_1_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530902 SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530903 clk_register_clkdev(clk, "gen_syn0_1_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530904
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530905 clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100906 ARRAY_SIZE(gen_synth2_3_parents),
907 CLK_SET_RATE_NO_REPARENT, SPEAR1340_PLL_CFG,
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530908 SPEAR1340_GEN_SYNT2_3_CLK_SHIFT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530909 SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock);
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530910 clk_register_clkdev(clk, "gen_syn2_3_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530911
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530912 clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530913 SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
914 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530915 clk_register_clkdev(clk, "gen_syn0_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530916
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530917 clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530918 SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
919 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530920 clk_register_clkdev(clk, "gen_syn1_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530921
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530922 clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530923 SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
924 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530925 clk_register_clkdev(clk, "gen_syn2_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530926
Shiraz Hashime0b9c212012-11-10 12:13:41 +0530927 clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_mclk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530928 SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
929 &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530930 clk_register_clkdev(clk, "gen_syn3_clk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530931
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530932 clk = clk_register_gate(NULL, "mali_clk", "gen_syn3_clk",
933 CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
934 SPEAR1340_MALI_CLK_ENB, 0, &_lock);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530935 clk_register_clkdev(clk, NULL, "mali");
936
937 clk = clk_register_gate(NULL, "cec0_clk", "ahb_clk", 0,
938 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CEC0_CLK_ENB, 0,
939 &_lock);
940 clk_register_clkdev(clk, NULL, "spear_cec.0");
941
942 clk = clk_register_gate(NULL, "cec1_clk", "ahb_clk", 0,
943 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CEC1_CLK_ENB, 0,
944 &_lock);
945 clk_register_clkdev(clk, NULL, "spear_cec.1");
946
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530947 clk = clk_register_mux(NULL, "spdif_out_mclk", spdif_out_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100948 ARRAY_SIZE(spdif_out_parents),
949 CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530950 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT,
951 SPEAR1340_SPDIF_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530952 clk_register_clkdev(clk, "spdif_out_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530953
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530954 clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mclk",
955 CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
956 SPEAR1340_SPDIF_OUT_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530957 clk_register_clkdev(clk, NULL, "d0000000.spdif-out");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530958
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530959 clk = clk_register_mux(NULL, "spdif_in_mclk", spdif_in_parents,
James Hogan819c1de2013-07-29 12:25:01 +0100960 ARRAY_SIZE(spdif_in_parents),
961 CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530962 SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT,
963 SPEAR1340_SPDIF_CLK_MASK, 0, &_lock);
Vipul Kumar Samar5cb6a9b2012-07-10 17:12:43 +0530964 clk_register_clkdev(clk, "spdif_in_mclk", NULL);
Viresh Kumar0b928af2012-04-19 22:23:13 +0530965
Vipul Kumar Samar12499792012-11-10 12:13:43 +0530966 clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mclk",
967 CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
968 SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530969 clk_register_clkdev(clk, NULL, "d0100000.spdif-in");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530970
Vipul Kumar Samar04981722013-03-07 12:35:24 +0530971 clk = clk_register_gate(NULL, "acp_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530972 SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0,
973 &_lock);
974 clk_register_clkdev(clk, NULL, "acp_clk");
975
Vipul Kumar Samar04981722013-03-07 12:35:24 +0530976 clk = clk_register_gate(NULL, "plgpio_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530977 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0,
978 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530979 clk_register_clkdev(clk, NULL, "e2800000.gpio");
Viresh Kumar0b928af2012-04-19 22:23:13 +0530980
Vipul Kumar Samar04981722013-03-07 12:35:24 +0530981 clk = clk_register_gate(NULL, "video_dec_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530982 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB,
983 0, &_lock);
984 clk_register_clkdev(clk, NULL, "video_dec");
985
Vipul Kumar Samar04981722013-03-07 12:35:24 +0530986 clk = clk_register_gate(NULL, "video_enc_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530987 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB,
988 0, &_lock);
989 clk_register_clkdev(clk, NULL, "video_enc");
990
Vipul Kumar Samar04981722013-03-07 12:35:24 +0530991 clk = clk_register_gate(NULL, "video_in_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530992 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0,
993 &_lock);
994 clk_register_clkdev(clk, NULL, "spear_vip");
995
Vipul Kumar Samar04981722013-03-07 12:35:24 +0530996 clk = clk_register_gate(NULL, "cam0_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +0530997 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0,
998 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +0530999 clk_register_clkdev(clk, NULL, "d0200000.cam0");
Viresh Kumar0b928af2012-04-19 22:23:13 +05301000
Vipul Kumar Samar04981722013-03-07 12:35:24 +05301001 clk = clk_register_gate(NULL, "cam1_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301002 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0,
1003 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +05301004 clk_register_clkdev(clk, NULL, "d0300000.cam1");
Viresh Kumar0b928af2012-04-19 22:23:13 +05301005
Vipul Kumar Samar04981722013-03-07 12:35:24 +05301006 clk = clk_register_gate(NULL, "cam2_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301007 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0,
1008 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +05301009 clk_register_clkdev(clk, NULL, "d0400000.cam2");
Viresh Kumar0b928af2012-04-19 22:23:13 +05301010
Vipul Kumar Samar04981722013-03-07 12:35:24 +05301011 clk = clk_register_gate(NULL, "cam3_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301012 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0,
1013 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +05301014 clk_register_clkdev(clk, NULL, "d0500000.cam3");
Viresh Kumar0b928af2012-04-19 22:23:13 +05301015
Shiraz Hashim463f9e22012-11-10 12:13:42 +05301016 clk = clk_register_gate(NULL, "pwm_clk", "ahb_clk", 0,
Viresh Kumar0b928af2012-04-19 22:23:13 +05301017 SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0,
1018 &_lock);
Rajeev Kumardf2449a2012-11-10 12:13:40 +05301019 clk_register_clkdev(clk, NULL, "e0180000.pwm");
Viresh Kumar0b928af2012-04-19 22:23:13 +05301020}