2 * TI DaVinci DM644x chip specific setup
4 * Author: Kevin Hilman, Deep Root Systems, LLC
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/clk.h>
14 #include <linux/platform_device.h>
16 #include <mach/dm644x.h>
17 #include <mach/clock.h>
18 #include <mach/cputype.h>
19 #include <mach/edma.h>
20 #include <mach/irqs.h>
28 * Device specific clocks
30 #define DM644X_REF_FREQ 27000000
32 static struct pll_data pll1_data = {
34 .phys_base = DAVINCI_PLL1_BASE,
37 static struct pll_data pll2_data = {
39 .phys_base = DAVINCI_PLL2_BASE,
42 static struct clk ref_clk = {
44 .rate = DM644X_REF_FREQ,
47 static struct clk pll1_clk = {
50 .pll_data = &pll1_data,
54 static struct clk pll1_sysclk1 = {
55 .name = "pll1_sysclk1",
61 static struct clk pll1_sysclk2 = {
62 .name = "pll1_sysclk2",
68 static struct clk pll1_sysclk3 = {
69 .name = "pll1_sysclk3",
75 static struct clk pll1_sysclk5 = {
76 .name = "pll1_sysclk5",
82 static struct clk pll1_aux_clk = {
83 .name = "pll1_aux_clk",
85 .flags = CLK_PLL | PRE_PLL,
88 static struct clk pll1_sysclkbp = {
89 .name = "pll1_sysclkbp",
91 .flags = CLK_PLL | PRE_PLL,
95 static struct clk pll2_clk = {
98 .pll_data = &pll2_data,
102 static struct clk pll2_sysclk1 = {
103 .name = "pll2_sysclk1",
109 static struct clk pll2_sysclk2 = {
110 .name = "pll2_sysclk2",
116 static struct clk pll2_sysclkbp = {
117 .name = "pll2_sysclkbp",
119 .flags = CLK_PLL | PRE_PLL,
123 static struct clk dsp_clk = {
125 .parent = &pll1_sysclk1,
126 .lpsc = DAVINCI_LPSC_GEM,
128 .usecount = 1, /* REVISIT how to disable? */
131 static struct clk arm_clk = {
133 .parent = &pll1_sysclk2,
134 .lpsc = DAVINCI_LPSC_ARM,
135 .flags = ALWAYS_ENABLED,
138 static struct clk vicp_clk = {
140 .parent = &pll1_sysclk2,
141 .lpsc = DAVINCI_LPSC_IMCOP,
143 .usecount = 1, /* REVISIT how to disable? */
146 static struct clk vpss_master_clk = {
147 .name = "vpss_master",
148 .parent = &pll1_sysclk3,
149 .lpsc = DAVINCI_LPSC_VPSSMSTR,
153 static struct clk vpss_slave_clk = {
154 .name = "vpss_slave",
155 .parent = &pll1_sysclk3,
156 .lpsc = DAVINCI_LPSC_VPSSSLV,
159 static struct clk uart0_clk = {
161 .parent = &pll1_aux_clk,
162 .lpsc = DAVINCI_LPSC_UART0,
165 static struct clk uart1_clk = {
167 .parent = &pll1_aux_clk,
168 .lpsc = DAVINCI_LPSC_UART1,
171 static struct clk uart2_clk = {
173 .parent = &pll1_aux_clk,
174 .lpsc = DAVINCI_LPSC_UART2,
177 static struct clk emac_clk = {
179 .parent = &pll1_sysclk5,
180 .lpsc = DAVINCI_LPSC_EMAC_WRAPPER,
183 static struct clk i2c_clk = {
185 .parent = &pll1_aux_clk,
186 .lpsc = DAVINCI_LPSC_I2C,
189 static struct clk ide_clk = {
191 .parent = &pll1_sysclk5,
192 .lpsc = DAVINCI_LPSC_ATA,
195 static struct clk asp_clk = {
197 .parent = &pll1_sysclk5,
198 .lpsc = DAVINCI_LPSC_McBSP,
201 static struct clk mmcsd_clk = {
203 .parent = &pll1_sysclk5,
204 .lpsc = DAVINCI_LPSC_MMC_SD,
207 static struct clk spi_clk = {
209 .parent = &pll1_sysclk5,
210 .lpsc = DAVINCI_LPSC_SPI,
213 static struct clk gpio_clk = {
215 .parent = &pll1_sysclk5,
216 .lpsc = DAVINCI_LPSC_GPIO,
219 static struct clk usb_clk = {
221 .parent = &pll1_sysclk5,
222 .lpsc = DAVINCI_LPSC_USB,
225 static struct clk vlynq_clk = {
227 .parent = &pll1_sysclk5,
228 .lpsc = DAVINCI_LPSC_VLYNQ,
231 static struct clk aemif_clk = {
233 .parent = &pll1_sysclk5,
234 .lpsc = DAVINCI_LPSC_AEMIF,
237 static struct clk pwm0_clk = {
239 .parent = &pll1_aux_clk,
240 .lpsc = DAVINCI_LPSC_PWM0,
243 static struct clk pwm1_clk = {
245 .parent = &pll1_aux_clk,
246 .lpsc = DAVINCI_LPSC_PWM1,
249 static struct clk pwm2_clk = {
251 .parent = &pll1_aux_clk,
252 .lpsc = DAVINCI_LPSC_PWM2,
255 static struct clk timer0_clk = {
257 .parent = &pll1_aux_clk,
258 .lpsc = DAVINCI_LPSC_TIMER0,
261 static struct clk timer1_clk = {
263 .parent = &pll1_aux_clk,
264 .lpsc = DAVINCI_LPSC_TIMER1,
267 static struct clk timer2_clk = {
269 .parent = &pll1_aux_clk,
270 .lpsc = DAVINCI_LPSC_TIMER2,
271 .usecount = 1, /* REVISIT: why cant' this be disabled? */
274 struct davinci_clk dm644x_clks[] = {
275 CLK(NULL, "ref", &ref_clk),
276 CLK(NULL, "pll1", &pll1_clk),
277 CLK(NULL, "pll1_sysclk1", &pll1_sysclk1),
278 CLK(NULL, "pll1_sysclk2", &pll1_sysclk2),
279 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3),
280 CLK(NULL, "pll1_sysclk5", &pll1_sysclk5),
281 CLK(NULL, "pll1_aux", &pll1_aux_clk),
282 CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp),
283 CLK(NULL, "pll2", &pll2_clk),
284 CLK(NULL, "pll2_sysclk1", &pll2_sysclk1),
285 CLK(NULL, "pll2_sysclk2", &pll2_sysclk2),
286 CLK(NULL, "pll2_sysclkbp", &pll2_sysclkbp),
287 CLK(NULL, "dsp", &dsp_clk),
288 CLK(NULL, "arm", &arm_clk),
289 CLK(NULL, "vicp", &vicp_clk),
290 CLK(NULL, "vpss_master", &vpss_master_clk),
291 CLK(NULL, "vpss_slave", &vpss_slave_clk),
292 CLK(NULL, "arm", &arm_clk),
293 CLK(NULL, "uart0", &uart0_clk),
294 CLK(NULL, "uart1", &uart1_clk),
295 CLK(NULL, "uart2", &uart2_clk),
296 CLK("davinci_emac.1", NULL, &emac_clk),
297 CLK("i2c_davinci.1", NULL, &i2c_clk),
298 CLK("palm_bk3710", NULL, &ide_clk),
299 CLK("soc-audio.0", NULL, &asp_clk),
300 CLK("davinci_mmc.0", NULL, &mmcsd_clk),
301 CLK(NULL, "spi", &spi_clk),
302 CLK(NULL, "gpio", &gpio_clk),
303 CLK(NULL, "usb", &usb_clk),
304 CLK(NULL, "vlynq", &vlynq_clk),
305 CLK(NULL, "aemif", &aemif_clk),
306 CLK(NULL, "pwm0", &pwm0_clk),
307 CLK(NULL, "pwm1", &pwm1_clk),
308 CLK(NULL, "pwm2", &pwm2_clk),
309 CLK(NULL, "timer0", &timer0_clk),
310 CLK(NULL, "timer1", &timer1_clk),
311 CLK("watchdog", NULL, &timer2_clk),
312 CLK(NULL, NULL, NULL),
315 #if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
317 static struct resource dm644x_emac_resources[] = {
319 .start = DM644X_EMAC_BASE,
320 .end = DM644X_EMAC_BASE + 0x47ff,
321 .flags = IORESOURCE_MEM,
324 .start = IRQ_EMACINT,
326 .flags = IORESOURCE_IRQ,
330 static struct platform_device dm644x_emac_device = {
331 .name = "davinci_emac",
333 .num_resources = ARRAY_SIZE(dm644x_emac_resources),
334 .resource = dm644x_emac_resources,
340 * Device specific mux setup
342 * soc description mux mode mode mux dbg
343 * reg offset mask mode
345 static const struct mux_config dm644x_pins[] = {
346 MUX_CFG(DM644X, HDIREN, 0, 16, 1, 1, true)
347 MUX_CFG(DM644X, ATAEN, 0, 17, 1, 1, true)
348 MUX_CFG(DM644X, ATAEN_DISABLE, 0, 17, 1, 0, true)
350 MUX_CFG(DM644X, HPIEN_DISABLE, 0, 29, 1, 0, true)
352 MUX_CFG(DM644X, AEAW, 0, 0, 31, 31, true)
354 MUX_CFG(DM644X, MSTK, 1, 9, 1, 0, false)
356 MUX_CFG(DM644X, I2C, 1, 7, 1, 1, false)
358 MUX_CFG(DM644X, MCBSP, 1, 10, 1, 1, false)
360 MUX_CFG(DM644X, UART1, 1, 1, 1, 1, true)
361 MUX_CFG(DM644X, UART2, 1, 2, 1, 1, true)
363 MUX_CFG(DM644X, PWM0, 1, 4, 1, 1, false)
365 MUX_CFG(DM644X, PWM1, 1, 5, 1, 1, false)
367 MUX_CFG(DM644X, PWM2, 1, 6, 1, 1, false)
369 MUX_CFG(DM644X, VLYNQEN, 0, 15, 1, 1, false)
370 MUX_CFG(DM644X, VLSCREN, 0, 14, 1, 1, false)
371 MUX_CFG(DM644X, VLYNQWD, 0, 12, 3, 3, false)
373 MUX_CFG(DM644X, EMACEN, 0, 31, 1, 1, true)
375 MUX_CFG(DM644X, GPIO3V, 0, 31, 1, 0, true)
377 MUX_CFG(DM644X, GPIO0, 0, 24, 1, 0, true)
378 MUX_CFG(DM644X, GPIO3, 0, 25, 1, 0, false)
379 MUX_CFG(DM644X, GPIO43_44, 1, 7, 1, 0, false)
380 MUX_CFG(DM644X, GPIO46_47, 0, 22, 1, 0, true)
382 MUX_CFG(DM644X, RGB666, 0, 22, 1, 1, true)
384 MUX_CFG(DM644X, LOEEN, 0, 24, 1, 1, true)
385 MUX_CFG(DM644X, LFLDEN, 0, 25, 1, 1, false)
389 /*----------------------------------------------------------------------*/
391 static const s8 dma_chan_dm644x_no_event[] = {
400 static struct edma_soc_info dm644x_edma_info = {
405 .noevent = dma_chan_dm644x_no_event,
408 static struct resource edma_resources[] = {
412 .end = 0x01c00000 + SZ_64K - 1,
413 .flags = IORESOURCE_MEM,
418 .end = 0x01c10000 + SZ_1K - 1,
419 .flags = IORESOURCE_MEM,
424 .end = 0x01c10400 + SZ_1K - 1,
425 .flags = IORESOURCE_MEM,
429 .flags = IORESOURCE_IRQ,
432 .start = IRQ_CCERRINT,
433 .flags = IORESOURCE_IRQ,
435 /* not using TC*_ERR */
438 static struct platform_device dm644x_edma_device = {
441 .dev.platform_data = &dm644x_edma_info,
442 .num_resources = ARRAY_SIZE(edma_resources),
443 .resource = edma_resources,
446 /*----------------------------------------------------------------------*/
447 void __init dm644x_init(void)
449 davinci_clk_init(dm644x_clks);
450 davinci_mux_register(dm644x_pins, ARRAY_SIZE(dm644x_pins));
453 static int __init dm644x_init_devices(void)
455 if (!cpu_is_davinci_dm644x())
458 platform_device_register(&dm644x_edma_device);
461 postcore_initcall(dm644x_init_devices);