blob: a7cd0d55828e3726fb465a1c62914bd765c02d65 [file] [log] [blame]
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +01001/*
2 * Copyright (C) 2009 ST-Ericsson
Rabin Vincent1df20af2010-03-01 05:07:47 +01003 * Copyright (C) 2009 STMicroelectronics
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +01004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9#include <linux/module.h>
10#include <linux/kernel.h>
11#include <linux/list.h>
12#include <linux/errno.h>
13#include <linux/err.h>
14#include <linux/clk.h>
Rabin Vincent1df20af2010-03-01 05:07:47 +010015#include <linux/io.h>
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +010016
17#include <asm/clkdev.h>
18
Linus Walleijba327b12010-05-26 07:38:54 +010019#include <plat/mtu.h>
Rabin Vincent1df20af2010-03-01 05:07:47 +010020#include <mach/hardware.h>
21#include "clock.h"
22
23#define PRCC_PCKEN 0x00
24#define PRCC_PCKDIS 0x04
25#define PRCC_KCKEN 0x08
26#define PRCC_KCKDIS 0x0C
27
28#define PRCM_YYCLKEN0_MGT_SET 0x510
29#define PRCM_YYCLKEN1_MGT_SET 0x514
30#define PRCM_YYCLKEN0_MGT_CLR 0x518
31#define PRCM_YYCLKEN1_MGT_CLR 0x51C
32#define PRCM_YYCLKEN0_MGT_VAL 0x520
33#define PRCM_YYCLKEN1_MGT_VAL 0x524
34
35#define PRCM_SVAMMDSPCLK_MGT 0x008
36#define PRCM_SIAMMDSPCLK_MGT 0x00C
37#define PRCM_SGACLK_MGT 0x014
38#define PRCM_UARTCLK_MGT 0x018
39#define PRCM_MSP02CLK_MGT 0x01C
40#define PRCM_MSP1CLK_MGT 0x288
41#define PRCM_I2CCLK_MGT 0x020
42#define PRCM_SDMMCCLK_MGT 0x024
43#define PRCM_SLIMCLK_MGT 0x028
44#define PRCM_PER1CLK_MGT 0x02C
45#define PRCM_PER2CLK_MGT 0x030
46#define PRCM_PER3CLK_MGT 0x034
47#define PRCM_PER5CLK_MGT 0x038
48#define PRCM_PER6CLK_MGT 0x03C
49#define PRCM_PER7CLK_MGT 0x040
50#define PRCM_LCDCLK_MGT 0x044
51#define PRCM_BMLCLK_MGT 0x04C
52#define PRCM_HSITXCLK_MGT 0x050
53#define PRCM_HSIRXCLK_MGT 0x054
54#define PRCM_HDMICLK_MGT 0x058
55#define PRCM_APEATCLK_MGT 0x05C
56#define PRCM_APETRACECLK_MGT 0x060
57#define PRCM_MCDECLK_MGT 0x064
58#define PRCM_IPI2CCLK_MGT 0x068
59#define PRCM_DSIALTCLK_MGT 0x06C
60#define PRCM_DMACLK_MGT 0x074
61#define PRCM_B2R2CLK_MGT 0x078
62#define PRCM_TVCLK_MGT 0x07C
Linus Walleijba327b12010-05-26 07:38:54 +010063#define PRCM_TCR 0x1C8
64#define PRCM_TCR_STOPPED (1 << 16)
65#define PRCM_TCR_DOZE_MODE (1 << 17)
Rabin Vincent1df20af2010-03-01 05:07:47 +010066#define PRCM_UNIPROCLK_MGT 0x278
67#define PRCM_SSPCLK_MGT 0x280
68#define PRCM_RNGCLK_MGT 0x284
69#define PRCM_UICCCLK_MGT 0x27C
70
71#define PRCM_MGT_ENABLE (1 << 8)
72
73static DEFINE_SPINLOCK(clocks_lock);
74
75static void __clk_enable(struct clk *clk)
76{
77 if (clk->enabled++ == 0) {
78 if (clk->parent_cluster)
79 __clk_enable(clk->parent_cluster);
80
81 if (clk->parent_periph)
82 __clk_enable(clk->parent_periph);
83
84 if (clk->ops && clk->ops->enable)
85 clk->ops->enable(clk);
86 }
87}
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +010088
89int clk_enable(struct clk *clk)
90{
Rabin Vincent1df20af2010-03-01 05:07:47 +010091 unsigned long flags;
92
93 spin_lock_irqsave(&clocks_lock, flags);
94 __clk_enable(clk);
95 spin_unlock_irqrestore(&clocks_lock, flags);
96
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +010097 return 0;
98}
99EXPORT_SYMBOL(clk_enable);
100
Rabin Vincent1df20af2010-03-01 05:07:47 +0100101static void __clk_disable(struct clk *clk)
102{
103 if (--clk->enabled == 0) {
104 if (clk->ops && clk->ops->disable)
105 clk->ops->disable(clk);
106
107 if (clk->parent_periph)
108 __clk_disable(clk->parent_periph);
109
110 if (clk->parent_cluster)
111 __clk_disable(clk->parent_cluster);
112 }
113}
114
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100115void clk_disable(struct clk *clk)
116{
Rabin Vincent1df20af2010-03-01 05:07:47 +0100117 unsigned long flags;
118
119 WARN_ON(!clk->enabled);
120
121 spin_lock_irqsave(&clocks_lock, flags);
122 __clk_disable(clk);
123 spin_unlock_irqrestore(&clocks_lock, flags);
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100124}
125EXPORT_SYMBOL(clk_disable);
126
Linus Walleijba327b12010-05-26 07:38:54 +0100127/*
128 * The MTU has a separate, rather complex muxing setup
129 * with alternative parents (peripheral cluster or
130 * ULP or fixed 32768 Hz) depending on settings
131 */
132static unsigned long clk_mtu_get_rate(struct clk *clk)
133{
Linus Walleijd9e38042010-06-23 07:59:48 +0100134 void __iomem *addr = __io_address(UX500_PRCMU_BASE)
Linus Walleijba327b12010-05-26 07:38:54 +0100135 + PRCM_TCR;
Sundar Iyerf3069542010-12-03 20:35:51 +0530136 u32 tcr;
Linus Walleijba327b12010-05-26 07:38:54 +0100137 int mtu = (int) clk->data;
138 /*
139 * One of these is selected eventually
140 * TODO: Replace the constant with a reference
141 * to the ULP source once this is modeled.
142 */
143 unsigned long clk32k = 32768;
144 unsigned long mturate;
145 unsigned long retclk;
146
Sundar Iyerf3069542010-12-03 20:35:51 +0530147 /*
148 * On a startup, always conifgure the TCR to the doze mode;
149 * bootloaders do it for us. Do this in the kernel too.
150 */
151 writel(PRCM_TCR_DOZE_MODE, addr);
152
153 tcr = readl(addr);
154
Linus Walleijba327b12010-05-26 07:38:54 +0100155 /* Get the rate from the parent as a default */
156 if (clk->parent_periph)
157 mturate = clk_get_rate(clk->parent_periph);
158 else if (clk->parent_cluster)
159 mturate = clk_get_rate(clk->parent_cluster);
160 else
161 /* We need to be connected SOMEWHERE */
162 BUG();
163
Linus Walleijba327b12010-05-26 07:38:54 +0100164 /* Return the clock selected for this MTU */
165 if (tcr & (1 << mtu))
166 retclk = clk32k;
167 else
168 retclk = mturate;
169
170 pr_info("MTU%d clock rate: %lu Hz\n", mtu, retclk);
171 return retclk;
172}
173
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100174unsigned long clk_get_rate(struct clk *clk)
175{
Rabin Vincent1df20af2010-03-01 05:07:47 +0100176 unsigned long rate;
177
Linus Walleijba327b12010-05-26 07:38:54 +0100178 /*
179 * If there is a custom getrate callback for this clock,
180 * it will take precedence.
181 */
182 if (clk->get_rate)
183 return clk->get_rate(clk);
184
Rabin Vincent1df20af2010-03-01 05:07:47 +0100185 if (clk->ops && clk->ops->get_rate)
186 return clk->ops->get_rate(clk);
187
188 rate = clk->rate;
189 if (!rate) {
190 if (clk->parent_periph)
191 rate = clk_get_rate(clk->parent_periph);
192 else if (clk->parent_cluster)
193 rate = clk_get_rate(clk->parent_cluster);
194 }
195
196 return rate;
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100197}
198EXPORT_SYMBOL(clk_get_rate);
199
200long clk_round_rate(struct clk *clk, unsigned long rate)
201{
202 /*TODO*/
203 return rate;
204}
205EXPORT_SYMBOL(clk_round_rate);
206
207int clk_set_rate(struct clk *clk, unsigned long rate)
208{
209 clk->rate = rate;
210 return 0;
211}
212EXPORT_SYMBOL(clk_set_rate);
213
Rabin Vincent1df20af2010-03-01 05:07:47 +0100214static void clk_prcmu_enable(struct clk *clk)
215{
216 void __iomem *cg_set_reg = __io_address(U8500_PRCMU_BASE)
217 + PRCM_YYCLKEN0_MGT_SET + clk->prcmu_cg_off;
218
219 writel(1 << clk->prcmu_cg_bit, cg_set_reg);
220}
221
222static void clk_prcmu_disable(struct clk *clk)
223{
224 void __iomem *cg_clr_reg = __io_address(U8500_PRCMU_BASE)
225 + PRCM_YYCLKEN0_MGT_CLR + clk->prcmu_cg_off;
226
227 writel(1 << clk->prcmu_cg_bit, cg_clr_reg);
228}
229
230/* ED doesn't have the combined set/clr registers */
231static void clk_prcmu_ed_enable(struct clk *clk)
232{
233 void __iomem *addr = __io_address(U8500_PRCMU_BASE)
234 + clk->prcmu_cg_mgt;
235
236 writel(readl(addr) | PRCM_MGT_ENABLE, addr);
237}
238
239static void clk_prcmu_ed_disable(struct clk *clk)
240{
241 void __iomem *addr = __io_address(U8500_PRCMU_BASE)
242 + clk->prcmu_cg_mgt;
243
244 writel(readl(addr) & ~PRCM_MGT_ENABLE, addr);
245}
246
247static struct clkops clk_prcmu_ops = {
248 .enable = clk_prcmu_enable,
249 .disable = clk_prcmu_disable,
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100250};
251
Rabin Vincent1df20af2010-03-01 05:07:47 +0100252static unsigned int clkrst_base[] = {
253 [1] = U8500_CLKRST1_BASE,
254 [2] = U8500_CLKRST2_BASE,
255 [3] = U8500_CLKRST3_BASE,
256 [5] = U8500_CLKRST5_BASE,
257 [6] = U8500_CLKRST6_BASE,
258 [7] = U8500_CLKRST7_BASE_ED,
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100259};
260
Rabin Vincent1df20af2010-03-01 05:07:47 +0100261static void clk_prcc_enable(struct clk *clk)
262{
263 void __iomem *addr = __io_address(clkrst_base[clk->cluster]);
264
265 if (clk->prcc_kernel != -1)
266 writel(1 << clk->prcc_kernel, addr + PRCC_KCKEN);
267
268 if (clk->prcc_bus != -1)
269 writel(1 << clk->prcc_bus, addr + PRCC_PCKEN);
270}
271
272static void clk_prcc_disable(struct clk *clk)
273{
274 void __iomem *addr = __io_address(clkrst_base[clk->cluster]);
275
276 if (clk->prcc_bus != -1)
277 writel(1 << clk->prcc_bus, addr + PRCC_PCKDIS);
278
279 if (clk->prcc_kernel != -1)
280 writel(1 << clk->prcc_kernel, addr + PRCC_KCKDIS);
281}
282
283static struct clkops clk_prcc_ops = {
284 .enable = clk_prcc_enable,
285 .disable = clk_prcc_disable,
286};
287
288static struct clk clk_32khz = {
289 .rate = 32000,
290};
291
292/*
293 * PRCMU level clock gating
294 */
295
296/* Bank 0 */
297static DEFINE_PRCMU_CLK(svaclk, 0x0, 2, SVAMMDSPCLK);
298static DEFINE_PRCMU_CLK(siaclk, 0x0, 3, SIAMMDSPCLK);
299static DEFINE_PRCMU_CLK(sgaclk, 0x0, 4, SGACLK);
300static DEFINE_PRCMU_CLK_RATE(uartclk, 0x0, 5, UARTCLK, 38400000);
301static DEFINE_PRCMU_CLK(msp02clk, 0x0, 6, MSP02CLK);
302static DEFINE_PRCMU_CLK(msp1clk, 0x0, 7, MSP1CLK); /* v1 */
303static DEFINE_PRCMU_CLK_RATE(i2cclk, 0x0, 8, I2CCLK, 48000000);
304static DEFINE_PRCMU_CLK_RATE(sdmmcclk, 0x0, 9, SDMMCCLK, 50000000);
305static DEFINE_PRCMU_CLK(slimclk, 0x0, 10, SLIMCLK);
306static DEFINE_PRCMU_CLK(per1clk, 0x0, 11, PER1CLK);
307static DEFINE_PRCMU_CLK(per2clk, 0x0, 12, PER2CLK);
308static DEFINE_PRCMU_CLK(per3clk, 0x0, 13, PER3CLK);
309static DEFINE_PRCMU_CLK(per5clk, 0x0, 14, PER5CLK);
310static DEFINE_PRCMU_CLK_RATE(per6clk, 0x0, 15, PER6CLK, 133330000);
311static DEFINE_PRCMU_CLK_RATE(per7clk, 0x0, 16, PER7CLK, 100000000);
312static DEFINE_PRCMU_CLK(lcdclk, 0x0, 17, LCDCLK);
313static DEFINE_PRCMU_CLK(bmlclk, 0x0, 18, BMLCLK);
314static DEFINE_PRCMU_CLK(hsitxclk, 0x0, 19, HSITXCLK);
315static DEFINE_PRCMU_CLK(hsirxclk, 0x0, 20, HSIRXCLK);
316static DEFINE_PRCMU_CLK(hdmiclk, 0x0, 21, HDMICLK);
317static DEFINE_PRCMU_CLK(apeatclk, 0x0, 22, APEATCLK);
318static DEFINE_PRCMU_CLK(apetraceclk, 0x0, 23, APETRACECLK);
319static DEFINE_PRCMU_CLK(mcdeclk, 0x0, 24, MCDECLK);
320static DEFINE_PRCMU_CLK(ipi2clk, 0x0, 25, IPI2CCLK);
321static DEFINE_PRCMU_CLK(dsialtclk, 0x0, 26, DSIALTCLK); /* v1 */
322static DEFINE_PRCMU_CLK(dmaclk, 0x0, 27, DMACLK);
323static DEFINE_PRCMU_CLK(b2r2clk, 0x0, 28, B2R2CLK);
324static DEFINE_PRCMU_CLK(tvclk, 0x0, 29, TVCLK);
325static DEFINE_PRCMU_CLK(uniproclk, 0x0, 30, UNIPROCLK); /* v1 */
326static DEFINE_PRCMU_CLK_RATE(sspclk, 0x0, 31, SSPCLK, 48000000); /* v1 */
327
328/* Bank 1 */
329static DEFINE_PRCMU_CLK(rngclk, 0x4, 0, RNGCLK); /* v1 */
330static DEFINE_PRCMU_CLK(uiccclk, 0x4, 1, UICCCLK); /* v1 */
331
332/*
333 * PRCC level clock gating
334 * Format: per#, clk, PCKEN bit, KCKEN bit, parent
335 */
336
337/* Peripheral Cluster #1 */
338static DEFINE_PRCC_CLK(1, i2c4, 10, 9, &clk_i2cclk);
339static DEFINE_PRCC_CLK(1, gpio0, 9, -1, NULL);
340static DEFINE_PRCC_CLK(1, slimbus0, 8, 8, &clk_slimclk);
341static DEFINE_PRCC_CLK(1, spi3_ed, 7, 7, NULL);
342static DEFINE_PRCC_CLK(1, spi3_v1, 7, -1, NULL);
343static DEFINE_PRCC_CLK(1, i2c2, 6, 6, &clk_i2cclk);
344static DEFINE_PRCC_CLK(1, sdi0, 5, 5, &clk_sdmmcclk);
345static DEFINE_PRCC_CLK(1, msp1_ed, 4, 4, &clk_msp02clk);
346static DEFINE_PRCC_CLK(1, msp1_v1, 4, 4, &clk_msp1clk);
347static DEFINE_PRCC_CLK(1, msp0, 3, 3, &clk_msp02clk);
348static DEFINE_PRCC_CLK(1, i2c1, 2, 2, &clk_i2cclk);
349static DEFINE_PRCC_CLK(1, uart1, 1, 1, &clk_uartclk);
350static DEFINE_PRCC_CLK(1, uart0, 0, 0, &clk_uartclk);
351
352/* Peripheral Cluster #2 */
353
354static DEFINE_PRCC_CLK(2, gpio1_ed, 12, -1, NULL);
355static DEFINE_PRCC_CLK(2, ssitx_ed, 11, -1, NULL);
356static DEFINE_PRCC_CLK(2, ssirx_ed, 10, -1, NULL);
357static DEFINE_PRCC_CLK(2, spi0_ed, 9, -1, NULL);
358static DEFINE_PRCC_CLK(2, sdi3_ed, 8, 6, &clk_sdmmcclk);
359static DEFINE_PRCC_CLK(2, sdi1_ed, 7, 5, &clk_sdmmcclk);
360static DEFINE_PRCC_CLK(2, msp2_ed, 6, 4, &clk_msp02clk);
361static DEFINE_PRCC_CLK(2, sdi4_ed, 4, 2, &clk_sdmmcclk);
362static DEFINE_PRCC_CLK(2, pwl_ed, 3, 1, NULL);
363static DEFINE_PRCC_CLK(2, spi1_ed, 2, -1, NULL);
364static DEFINE_PRCC_CLK(2, spi2_ed, 1, -1, NULL);
365static DEFINE_PRCC_CLK(2, i2c3_ed, 0, 0, &clk_i2cclk);
366
367static DEFINE_PRCC_CLK(2, gpio1_v1, 11, -1, NULL);
368static DEFINE_PRCC_CLK(2, ssitx_v1, 10, 7, NULL);
369static DEFINE_PRCC_CLK(2, ssirx_v1, 9, 6, NULL);
370static DEFINE_PRCC_CLK(2, spi0_v1, 8, -1, NULL);
371static DEFINE_PRCC_CLK(2, sdi3_v1, 7, 5, &clk_sdmmcclk);
372static DEFINE_PRCC_CLK(2, sdi1_v1, 6, 4, &clk_sdmmcclk);
373static DEFINE_PRCC_CLK(2, msp2_v1, 5, 3, &clk_msp02clk);
374static DEFINE_PRCC_CLK(2, sdi4_v1, 4, 2, &clk_sdmmcclk);
375static DEFINE_PRCC_CLK(2, pwl_v1, 3, 1, NULL);
376static DEFINE_PRCC_CLK(2, spi1_v1, 2, -1, NULL);
377static DEFINE_PRCC_CLK(2, spi2_v1, 1, -1, NULL);
378static DEFINE_PRCC_CLK(2, i2c3_v1, 0, 0, &clk_i2cclk);
379
380/* Peripheral Cluster #3 */
381static DEFINE_PRCC_CLK(3, gpio2, 8, -1, NULL);
382static DEFINE_PRCC_CLK(3, sdi5, 7, 7, &clk_sdmmcclk);
383static DEFINE_PRCC_CLK(3, uart2, 6, 6, &clk_uartclk);
384static DEFINE_PRCC_CLK(3, ske, 5, 5, &clk_32khz);
385static DEFINE_PRCC_CLK(3, sdi2, 4, 4, &clk_sdmmcclk);
386static DEFINE_PRCC_CLK(3, i2c0, 3, 3, &clk_i2cclk);
387static DEFINE_PRCC_CLK(3, ssp1_ed, 2, 2, &clk_i2cclk);
388static DEFINE_PRCC_CLK(3, ssp0_ed, 1, 1, &clk_i2cclk);
389static DEFINE_PRCC_CLK(3, ssp1_v1, 2, 2, &clk_sspclk);
390static DEFINE_PRCC_CLK(3, ssp0_v1, 1, 1, &clk_sspclk);
391static DEFINE_PRCC_CLK(3, fsmc, 0, -1, NULL);
392
393/* Peripheral Cluster #4 is in the always on domain */
394
395/* Peripheral Cluster #5 */
396static DEFINE_PRCC_CLK(5, gpio3, 1, -1, NULL);
397static DEFINE_PRCC_CLK(5, usb_ed, 0, 0, &clk_i2cclk);
398static DEFINE_PRCC_CLK(5, usb_v1, 0, 0, NULL);
399
400/* Peripheral Cluster #6 */
401
Linus Walleijba327b12010-05-26 07:38:54 +0100402/* MTU ID in data */
403static DEFINE_PRCC_CLK_CUSTOM(6, mtu1_v1, 8, -1, NULL, clk_mtu_get_rate, 1);
404static DEFINE_PRCC_CLK_CUSTOM(6, mtu0_v1, 7, -1, NULL, clk_mtu_get_rate, 0);
Rabin Vincent1df20af2010-03-01 05:07:47 +0100405static DEFINE_PRCC_CLK(6, cfgreg_v1, 6, 6, NULL);
406static DEFINE_PRCC_CLK(6, dmc_ed, 6, 6, NULL);
407static DEFINE_PRCC_CLK(6, hash1, 5, -1, NULL);
408static DEFINE_PRCC_CLK(6, unipro_v1, 4, 1, &clk_uniproclk);
409static DEFINE_PRCC_CLK(6, cryp1_ed, 4, -1, NULL);
410static DEFINE_PRCC_CLK(6, pka, 3, -1, NULL);
411static DEFINE_PRCC_CLK(6, hash0, 2, -1, NULL);
412static DEFINE_PRCC_CLK(6, cryp0, 1, -1, NULL);
413static DEFINE_PRCC_CLK(6, rng_ed, 0, 0, &clk_i2cclk);
414static DEFINE_PRCC_CLK(6, rng_v1, 0, 0, &clk_rngclk);
415
416/* Peripheral Cluster #7 */
417
418static DEFINE_PRCC_CLK(7, tzpc0_ed, 4, -1, NULL);
Linus Walleijba327b12010-05-26 07:38:54 +0100419/* MTU ID in data */
420static DEFINE_PRCC_CLK_CUSTOM(7, mtu1_ed, 3, -1, NULL, clk_mtu_get_rate, 1);
421static DEFINE_PRCC_CLK_CUSTOM(7, mtu0_ed, 2, -1, NULL, clk_mtu_get_rate, 0);
Rabin Vincent1df20af2010-03-01 05:07:47 +0100422static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL);
423static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL);
424
Russell King3126c7b2010-07-15 11:01:17 +0100425static struct clk clk_dummy_apb_pclk;
426
Rabin Vincent1df20af2010-03-01 05:07:47 +0100427static struct clk_lookup u8500_common_clks[] = {
Russell King3126c7b2010-07-15 11:01:17 +0100428 CLK(dummy_apb_pclk, NULL, "apb_pclk"),
429
Rabin Vincent1df20af2010-03-01 05:07:47 +0100430 /* Peripheral Cluster #1 */
Rabin Vincentaf7dc222010-05-06 11:14:17 +0100431 CLK(gpio0, "gpio.0", NULL),
432 CLK(gpio0, "gpio.1", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100433 CLK(slimbus0, "slimbus0", NULL),
434 CLK(i2c2, "nmk-i2c.2", NULL),
435 CLK(sdi0, "sdi0", NULL),
436 CLK(msp0, "msp0", NULL),
437 CLK(i2c1, "nmk-i2c.1", NULL),
438 CLK(uart1, "uart1", NULL),
439 CLK(uart0, "uart0", NULL),
440
441 /* Peripheral Cluster #3 */
Rabin Vincentaf7dc222010-05-06 11:14:17 +0100442 CLK(gpio2, "gpio.2", NULL),
443 CLK(gpio2, "gpio.3", NULL),
444 CLK(gpio2, "gpio.4", NULL),
445 CLK(gpio2, "gpio.5", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100446 CLK(sdi5, "sdi5", NULL),
447 CLK(uart2, "uart2", NULL),
448 CLK(ske, "ske", NULL),
Sundar Iyer4c61c842010-09-29 19:43:09 -0700449 CLK(ske, "nmk-ske-keypad", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100450 CLK(sdi2, "sdi2", NULL),
451 CLK(i2c0, "nmk-i2c.0", NULL),
452 CLK(fsmc, "fsmc", NULL),
453
454 /* Peripheral Cluster #5 */
Rabin Vincentaf7dc222010-05-06 11:14:17 +0100455 CLK(gpio3, "gpio.8", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100456
457 /* Peripheral Cluster #6 */
458 CLK(hash1, "hash1", NULL),
459 CLK(pka, "pka", NULL),
460 CLK(hash0, "hash0", NULL),
461 CLK(cryp0, "cryp0", NULL),
462
463 /* PRCMU level clock gating */
464
465 /* Bank 0 */
466 CLK(svaclk, "sva", NULL),
467 CLK(siaclk, "sia", NULL),
468 CLK(sgaclk, "sga", NULL),
469 CLK(slimclk, "slim", NULL),
470 CLK(lcdclk, "lcd", NULL),
471 CLK(bmlclk, "bml", NULL),
472 CLK(hsitxclk, "stm-hsi.0", NULL),
473 CLK(hsirxclk, "stm-hsi.1", NULL),
474 CLK(hdmiclk, "hdmi", NULL),
475 CLK(apeatclk, "apeat", NULL),
476 CLK(apetraceclk, "apetrace", NULL),
477 CLK(mcdeclk, "mcde", NULL),
478 CLK(ipi2clk, "ipi2", NULL),
Linus Walleij7b8ddb02010-05-27 15:21:26 -0700479 CLK(dmaclk, "dma40.0", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100480 CLK(b2r2clk, "b2r2", NULL),
481 CLK(tvclk, "tv", NULL),
482};
483
484static struct clk_lookup u8500_ed_clks[] = {
485 /* Peripheral Cluster #1 */
486 CLK(spi3_ed, "spi3", NULL),
487 CLK(msp1_ed, "msp1", NULL),
488
489 /* Peripheral Cluster #2 */
Rabin Vincentaf7dc222010-05-06 11:14:17 +0100490 CLK(gpio1_ed, "gpio.6", NULL),
491 CLK(gpio1_ed, "gpio.7", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100492 CLK(ssitx_ed, "ssitx", NULL),
493 CLK(ssirx_ed, "ssirx", NULL),
494 CLK(spi0_ed, "spi0", NULL),
495 CLK(sdi3_ed, "sdi3", NULL),
496 CLK(sdi1_ed, "sdi1", NULL),
497 CLK(msp2_ed, "msp2", NULL),
498 CLK(sdi4_ed, "sdi4", NULL),
499 CLK(pwl_ed, "pwl", NULL),
500 CLK(spi1_ed, "spi1", NULL),
501 CLK(spi2_ed, "spi2", NULL),
502 CLK(i2c3_ed, "nmk-i2c.3", NULL),
503
504 /* Peripheral Cluster #3 */
505 CLK(ssp1_ed, "ssp1", NULL),
506 CLK(ssp0_ed, "ssp0", NULL),
507
508 /* Peripheral Cluster #5 */
509 CLK(usb_ed, "musb_hdrc.0", "usb"),
510
511 /* Peripheral Cluster #6 */
512 CLK(dmc_ed, "dmc", NULL),
513 CLK(cryp1_ed, "cryp1", NULL),
514 CLK(rng_ed, "rng", NULL),
515
516 /* Peripheral Cluster #7 */
517 CLK(tzpc0_ed, "tzpc0", NULL),
518 CLK(mtu1_ed, "mtu1", NULL),
519 CLK(mtu0_ed, "mtu0", NULL),
520 CLK(wdg_ed, "wdg", NULL),
521 CLK(cfgreg_ed, "cfgreg", NULL),
522};
523
524static struct clk_lookup u8500_v1_clks[] = {
525 /* Peripheral Cluster #1 */
526 CLK(i2c4, "nmk-i2c.4", NULL),
527 CLK(spi3_v1, "spi3", NULL),
528 CLK(msp1_v1, "msp1", NULL),
529
530 /* Peripheral Cluster #2 */
Rabin Vincentaf7dc222010-05-06 11:14:17 +0100531 CLK(gpio1_v1, "gpio.6", NULL),
532 CLK(gpio1_v1, "gpio.7", NULL),
Rabin Vincent1df20af2010-03-01 05:07:47 +0100533 CLK(ssitx_v1, "ssitx", NULL),
534 CLK(ssirx_v1, "ssirx", NULL),
535 CLK(spi0_v1, "spi0", NULL),
536 CLK(sdi3_v1, "sdi3", NULL),
537 CLK(sdi1_v1, "sdi1", NULL),
538 CLK(msp2_v1, "msp2", NULL),
539 CLK(sdi4_v1, "sdi4", NULL),
540 CLK(pwl_v1, "pwl", NULL),
541 CLK(spi1_v1, "spi1", NULL),
542 CLK(spi2_v1, "spi2", NULL),
543 CLK(i2c3_v1, "nmk-i2c.3", NULL),
544
545 /* Peripheral Cluster #3 */
546 CLK(ssp1_v1, "ssp1", NULL),
547 CLK(ssp0_v1, "ssp0", NULL),
548
549 /* Peripheral Cluster #5 */
550 CLK(usb_v1, "musb_hdrc.0", "usb"),
551
552 /* Peripheral Cluster #6 */
553 CLK(mtu1_v1, "mtu1", NULL),
554 CLK(mtu0_v1, "mtu0", NULL),
555 CLK(cfgreg_v1, "cfgreg", NULL),
556 CLK(hash1, "hash1", NULL),
557 CLK(unipro_v1, "unipro", NULL),
558 CLK(rng_v1, "rng", NULL),
559
560 /* PRCMU level clock gating */
561
562 /* Bank 0 */
563 CLK(uniproclk, "uniproclk", NULL),
564 CLK(dsialtclk, "dsialt", NULL),
565
566 /* Bank 1 */
567 CLK(rngclk, "rng", NULL),
568 CLK(uiccclk, "uicc", NULL),
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100569};
570
Linus Walleijba327b12010-05-26 07:38:54 +0100571int __init clk_init(void)
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100572{
Rabin Vincent1df20af2010-03-01 05:07:47 +0100573 if (cpu_is_u8500ed()) {
574 clk_prcmu_ops.enable = clk_prcmu_ed_enable;
575 clk_prcmu_ops.disable = clk_prcmu_ed_disable;
Linus Walleijba327b12010-05-26 07:38:54 +0100576 clk_per6clk.rate = 100000000;
Rabin Vincent591d8dd2010-05-03 08:46:51 +0100577 } else if (cpu_is_u5500()) {
578 /* Clock tree for U5500 not implemented yet */
579 clk_prcc_ops.enable = clk_prcc_ops.disable = NULL;
580 clk_prcmu_ops.enable = clk_prcmu_ops.disable = NULL;
Linus Walleijba327b12010-05-26 07:38:54 +0100581 clk_per6clk.rate = 26000000;
Rabin Vincent1df20af2010-03-01 05:07:47 +0100582 }
583
584 clkdev_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks));
585 if (cpu_is_u8500ed())
586 clkdev_add_table(u8500_ed_clks, ARRAY_SIZE(u8500_ed_clks));
587 else
588 clkdev_add_table(u8500_v1_clks, ARRAY_SIZE(u8500_v1_clks));
589
Srinidhi Kasagarc6b503c2009-11-28 08:15:01 +0100590 return 0;
591}