2 * TI DaVinci DM355 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/init.h>
12 #include <linux/clk.h>
13 #include <linux/serial_8250.h>
14 #include <linux/platform_device.h>
15 #include <linux/dma-mapping.h>
16 #include <linux/dmaengine.h>
17 #include <linux/spi/spi.h>
18 #include <linux/platform_data/edma.h>
19 #include <linux/platform_data/gpio-davinci.h>
20 #include <linux/platform_data/spi-davinci.h>
22 #include <asm/mach/map.h>
24 #include <mach/cputype.h>
27 #include <mach/irqs.h>
28 #include <mach/time.h>
29 #include <mach/serial.h>
30 #include <mach/common.h>
37 #define DM355_UART2_BASE (IO_PHYS + 0x206000)
38 #define DM355_OSD_BASE (IO_PHYS + 0x70200)
39 #define DM355_VENC_BASE (IO_PHYS + 0x70400)
42 * Device specific clocks
44 #define DM355_REF_FREQ 24000000 /* 24 or 36 MHz */
46 static struct pll_data pll1_data
= {
48 .phys_base
= DAVINCI_PLL1_BASE
,
49 .flags
= PLL_HAS_PREDIV
| PLL_HAS_POSTDIV
,
52 static struct pll_data pll2_data
= {
54 .phys_base
= DAVINCI_PLL2_BASE
,
55 .flags
= PLL_HAS_PREDIV
,
58 static struct clk ref_clk
= {
60 /* FIXME -- crystal rate is board-specific */
61 .rate
= DM355_REF_FREQ
,
64 static struct clk pll1_clk
= {
68 .pll_data
= &pll1_data
,
71 static struct clk pll1_aux_clk
= {
72 .name
= "pll1_aux_clk",
74 .flags
= CLK_PLL
| PRE_PLL
,
77 static struct clk pll1_sysclk1
= {
78 .name
= "pll1_sysclk1",
84 static struct clk pll1_sysclk2
= {
85 .name
= "pll1_sysclk2",
91 static struct clk pll1_sysclk3
= {
92 .name
= "pll1_sysclk3",
98 static struct clk pll1_sysclk4
= {
99 .name
= "pll1_sysclk4",
105 static struct clk pll1_sysclkbp
= {
106 .name
= "pll1_sysclkbp",
108 .flags
= CLK_PLL
| PRE_PLL
,
112 static struct clk vpss_dac_clk
= {
114 .parent
= &pll1_sysclk3
,
115 .lpsc
= DM355_LPSC_VPSS_DAC
,
118 static struct clk vpss_master_clk
= {
119 .name
= "vpss_master",
120 .parent
= &pll1_sysclk4
,
121 .lpsc
= DAVINCI_LPSC_VPSSMSTR
,
125 static struct clk vpss_slave_clk
= {
126 .name
= "vpss_slave",
127 .parent
= &pll1_sysclk4
,
128 .lpsc
= DAVINCI_LPSC_VPSSSLV
,
131 static struct clk clkout1_clk
= {
133 .parent
= &pll1_aux_clk
,
134 /* NOTE: clkout1 can be externally gated by muxing GPIO-18 */
137 static struct clk clkout2_clk
= {
139 .parent
= &pll1_sysclkbp
,
142 static struct clk pll2_clk
= {
146 .pll_data
= &pll2_data
,
149 static struct clk pll2_sysclk1
= {
150 .name
= "pll2_sysclk1",
156 static struct clk pll2_sysclkbp
= {
157 .name
= "pll2_sysclkbp",
159 .flags
= CLK_PLL
| PRE_PLL
,
163 static struct clk clkout3_clk
= {
165 .parent
= &pll2_sysclkbp
,
166 /* NOTE: clkout3 can be externally gated by muxing GPIO-16 */
169 static struct clk arm_clk
= {
171 .parent
= &pll1_sysclk1
,
172 .lpsc
= DAVINCI_LPSC_ARM
,
173 .flags
= ALWAYS_ENABLED
,
177 * NOT LISTED below, and not touched by Linux
178 * - in SyncReset state by default
179 * .lpsc = DAVINCI_LPSC_TPCC,
180 * .lpsc = DAVINCI_LPSC_TPTC0,
181 * .lpsc = DAVINCI_LPSC_TPTC1,
182 * .lpsc = DAVINCI_LPSC_DDR_EMIF, .parent = &sysclk2_clk,
183 * .lpsc = DAVINCI_LPSC_MEMSTICK,
184 * - in Enabled state by default
185 * .lpsc = DAVINCI_LPSC_SYSTEM_SUBSYS,
186 * .lpsc = DAVINCI_LPSC_SCR2, // "bus"
187 * .lpsc = DAVINCI_LPSC_SCR3, // "bus"
188 * .lpsc = DAVINCI_LPSC_SCR4, // "bus"
189 * .lpsc = DAVINCI_LPSC_CROSSBAR, // "emulation"
190 * .lpsc = DAVINCI_LPSC_CFG27, // "test"
191 * .lpsc = DAVINCI_LPSC_CFG3, // "test"
192 * .lpsc = DAVINCI_LPSC_CFG5, // "test"
195 static struct clk mjcp_clk
= {
197 .parent
= &pll1_sysclk1
,
198 .lpsc
= DAVINCI_LPSC_IMCOP
,
201 static struct clk uart0_clk
= {
203 .parent
= &pll1_aux_clk
,
204 .lpsc
= DAVINCI_LPSC_UART0
,
207 static struct clk uart1_clk
= {
209 .parent
= &pll1_aux_clk
,
210 .lpsc
= DAVINCI_LPSC_UART1
,
213 static struct clk uart2_clk
= {
215 .parent
= &pll1_sysclk2
,
216 .lpsc
= DAVINCI_LPSC_UART2
,
219 static struct clk i2c_clk
= {
221 .parent
= &pll1_aux_clk
,
222 .lpsc
= DAVINCI_LPSC_I2C
,
225 static struct clk asp0_clk
= {
227 .parent
= &pll1_sysclk2
,
228 .lpsc
= DAVINCI_LPSC_McBSP
,
231 static struct clk asp1_clk
= {
233 .parent
= &pll1_sysclk2
,
234 .lpsc
= DM355_LPSC_McBSP1
,
237 static struct clk mmcsd0_clk
= {
239 .parent
= &pll1_sysclk2
,
240 .lpsc
= DAVINCI_LPSC_MMC_SD
,
243 static struct clk mmcsd1_clk
= {
245 .parent
= &pll1_sysclk2
,
246 .lpsc
= DM355_LPSC_MMC_SD1
,
249 static struct clk spi0_clk
= {
251 .parent
= &pll1_sysclk2
,
252 .lpsc
= DAVINCI_LPSC_SPI
,
255 static struct clk spi1_clk
= {
257 .parent
= &pll1_sysclk2
,
258 .lpsc
= DM355_LPSC_SPI1
,
261 static struct clk spi2_clk
= {
263 .parent
= &pll1_sysclk2
,
264 .lpsc
= DM355_LPSC_SPI2
,
267 static struct clk gpio_clk
= {
269 .parent
= &pll1_sysclk2
,
270 .lpsc
= DAVINCI_LPSC_GPIO
,
273 static struct clk aemif_clk
= {
275 .parent
= &pll1_sysclk2
,
276 .lpsc
= DAVINCI_LPSC_AEMIF
,
279 static struct clk pwm0_clk
= {
281 .parent
= &pll1_aux_clk
,
282 .lpsc
= DAVINCI_LPSC_PWM0
,
285 static struct clk pwm1_clk
= {
287 .parent
= &pll1_aux_clk
,
288 .lpsc
= DAVINCI_LPSC_PWM1
,
291 static struct clk pwm2_clk
= {
293 .parent
= &pll1_aux_clk
,
294 .lpsc
= DAVINCI_LPSC_PWM2
,
297 static struct clk pwm3_clk
= {
299 .parent
= &pll1_aux_clk
,
300 .lpsc
= DM355_LPSC_PWM3
,
303 static struct clk timer0_clk
= {
305 .parent
= &pll1_aux_clk
,
306 .lpsc
= DAVINCI_LPSC_TIMER0
,
309 static struct clk timer1_clk
= {
311 .parent
= &pll1_aux_clk
,
312 .lpsc
= DAVINCI_LPSC_TIMER1
,
315 static struct clk timer2_clk
= {
317 .parent
= &pll1_aux_clk
,
318 .lpsc
= DAVINCI_LPSC_TIMER2
,
319 .usecount
= 1, /* REVISIT: why can't this be disabled? */
322 static struct clk timer3_clk
= {
324 .parent
= &pll1_aux_clk
,
325 .lpsc
= DM355_LPSC_TIMER3
,
328 static struct clk rto_clk
= {
330 .parent
= &pll1_aux_clk
,
331 .lpsc
= DM355_LPSC_RTO
,
334 static struct clk usb_clk
= {
336 .parent
= &pll1_sysclk2
,
337 .lpsc
= DAVINCI_LPSC_USB
,
340 static struct clk_lookup dm355_clks
[] = {
341 CLK(NULL
, "ref", &ref_clk
),
342 CLK(NULL
, "pll1", &pll1_clk
),
343 CLK(NULL
, "pll1_sysclk1", &pll1_sysclk1
),
344 CLK(NULL
, "pll1_sysclk2", &pll1_sysclk2
),
345 CLK(NULL
, "pll1_sysclk3", &pll1_sysclk3
),
346 CLK(NULL
, "pll1_sysclk4", &pll1_sysclk4
),
347 CLK(NULL
, "pll1_aux", &pll1_aux_clk
),
348 CLK(NULL
, "pll1_sysclkbp", &pll1_sysclkbp
),
349 CLK(NULL
, "vpss_dac", &vpss_dac_clk
),
350 CLK("vpss", "master", &vpss_master_clk
),
351 CLK("vpss", "slave", &vpss_slave_clk
),
352 CLK(NULL
, "clkout1", &clkout1_clk
),
353 CLK(NULL
, "clkout2", &clkout2_clk
),
354 CLK(NULL
, "pll2", &pll2_clk
),
355 CLK(NULL
, "pll2_sysclk1", &pll2_sysclk1
),
356 CLK(NULL
, "pll2_sysclkbp", &pll2_sysclkbp
),
357 CLK(NULL
, "clkout3", &clkout3_clk
),
358 CLK(NULL
, "arm", &arm_clk
),
359 CLK(NULL
, "mjcp", &mjcp_clk
),
360 CLK("serial8250.0", NULL
, &uart0_clk
),
361 CLK("serial8250.1", NULL
, &uart1_clk
),
362 CLK("serial8250.2", NULL
, &uart2_clk
),
363 CLK("i2c_davinci.1", NULL
, &i2c_clk
),
364 CLK("davinci-mcbsp.0", NULL
, &asp0_clk
),
365 CLK("davinci-mcbsp.1", NULL
, &asp1_clk
),
366 CLK("dm6441-mmc.0", NULL
, &mmcsd0_clk
),
367 CLK("dm6441-mmc.1", NULL
, &mmcsd1_clk
),
368 CLK("spi_davinci.0", NULL
, &spi0_clk
),
369 CLK("spi_davinci.1", NULL
, &spi1_clk
),
370 CLK("spi_davinci.2", NULL
, &spi2_clk
),
371 CLK(NULL
, "gpio", &gpio_clk
),
372 CLK(NULL
, "aemif", &aemif_clk
),
373 CLK(NULL
, "pwm0", &pwm0_clk
),
374 CLK(NULL
, "pwm1", &pwm1_clk
),
375 CLK(NULL
, "pwm2", &pwm2_clk
),
376 CLK(NULL
, "pwm3", &pwm3_clk
),
377 CLK(NULL
, "timer0", &timer0_clk
),
378 CLK(NULL
, "timer1", &timer1_clk
),
379 CLK("davinci-wdt", NULL
, &timer2_clk
),
380 CLK(NULL
, "timer3", &timer3_clk
),
381 CLK(NULL
, "rto", &rto_clk
),
382 CLK(NULL
, "usb", &usb_clk
),
383 CLK(NULL
, NULL
, NULL
),
386 /*----------------------------------------------------------------------*/
388 static u64 dm355_spi0_dma_mask
= DMA_BIT_MASK(32);
390 static struct resource dm355_spi0_resources
[] = {
394 .flags
= IORESOURCE_MEM
,
397 .start
= IRQ_DM355_SPINT0_0
,
398 .flags
= IORESOURCE_IRQ
,
402 .flags
= IORESOURCE_DMA
,
406 .flags
= IORESOURCE_DMA
,
410 static struct davinci_spi_platform_data dm355_spi0_pdata
= {
411 .version
= SPI_VERSION_1
,
414 .dma_event_q
= EVENTQ_1
,
415 .prescaler_limit
= 1,
417 static struct platform_device dm355_spi0_device
= {
418 .name
= "spi_davinci",
421 .dma_mask
= &dm355_spi0_dma_mask
,
422 .coherent_dma_mask
= DMA_BIT_MASK(32),
423 .platform_data
= &dm355_spi0_pdata
,
425 .num_resources
= ARRAY_SIZE(dm355_spi0_resources
),
426 .resource
= dm355_spi0_resources
,
429 void __init
dm355_init_spi0(unsigned chipselect_mask
,
430 const struct spi_board_info
*info
, unsigned len
)
432 /* for now, assume we need MISO */
433 davinci_cfg_reg(DM355_SPI0_SDI
);
435 /* not all slaves will be wired up */
436 if (chipselect_mask
& BIT(0))
437 davinci_cfg_reg(DM355_SPI0_SDENA0
);
438 if (chipselect_mask
& BIT(1))
439 davinci_cfg_reg(DM355_SPI0_SDENA1
);
441 spi_register_board_info(info
, len
);
443 platform_device_register(&dm355_spi0_device
);
446 /*----------------------------------------------------------------------*/
452 * Device specific mux setup
454 * soc description mux mode mode mux dbg
455 * reg offset mask mode
457 static const struct mux_config dm355_pins
[] = {
458 #ifdef CONFIG_DAVINCI_MUX
459 MUX_CFG(DM355
, MMCSD0
, 4, 2, 1, 0, false)
461 MUX_CFG(DM355
, SD1_CLK
, 3, 6, 1, 1, false)
462 MUX_CFG(DM355
, SD1_CMD
, 3, 7, 1, 1, false)
463 MUX_CFG(DM355
, SD1_DATA3
, 3, 8, 3, 1, false)
464 MUX_CFG(DM355
, SD1_DATA2
, 3, 10, 3, 1, false)
465 MUX_CFG(DM355
, SD1_DATA1
, 3, 12, 3, 1, false)
466 MUX_CFG(DM355
, SD1_DATA0
, 3, 14, 3, 1, false)
468 MUX_CFG(DM355
, I2C_SDA
, 3, 19, 1, 1, false)
469 MUX_CFG(DM355
, I2C_SCL
, 3, 20, 1, 1, false)
471 MUX_CFG(DM355
, MCBSP0_BDX
, 3, 0, 1, 1, false)
472 MUX_CFG(DM355
, MCBSP0_X
, 3, 1, 1, 1, false)
473 MUX_CFG(DM355
, MCBSP0_BFSX
, 3, 2, 1, 1, false)
474 MUX_CFG(DM355
, MCBSP0_BDR
, 3, 3, 1, 1, false)
475 MUX_CFG(DM355
, MCBSP0_R
, 3, 4, 1, 1, false)
476 MUX_CFG(DM355
, MCBSP0_BFSR
, 3, 5, 1, 1, false)
478 MUX_CFG(DM355
, SPI0_SDI
, 4, 1, 1, 0, false)
479 MUX_CFG(DM355
, SPI0_SDENA0
, 4, 0, 1, 0, false)
480 MUX_CFG(DM355
, SPI0_SDENA1
, 3, 28, 1, 1, false)
482 INT_CFG(DM355
, INT_EDMA_CC
, 2, 1, 1, false)
483 INT_CFG(DM355
, INT_EDMA_TC0_ERR
, 3, 1, 1, false)
484 INT_CFG(DM355
, INT_EDMA_TC1_ERR
, 4, 1, 1, false)
486 EVT_CFG(DM355
, EVT8_ASP1_TX
, 0, 1, 0, false)
487 EVT_CFG(DM355
, EVT9_ASP1_RX
, 1, 1, 0, false)
488 EVT_CFG(DM355
, EVT26_MMC0_RX
, 2, 1, 0, false)
490 MUX_CFG(DM355
, VOUT_FIELD
, 1, 18, 3, 1, false)
491 MUX_CFG(DM355
, VOUT_FIELD_G70
, 1, 18, 3, 0, false)
492 MUX_CFG(DM355
, VOUT_HVSYNC
, 1, 16, 1, 0, false)
493 MUX_CFG(DM355
, VOUT_COUTL_EN
, 1, 0, 0xff, 0x55, false)
494 MUX_CFG(DM355
, VOUT_COUTH_EN
, 1, 8, 0xff, 0x55, false)
496 MUX_CFG(DM355
, VIN_PCLK
, 0, 14, 1, 1, false)
497 MUX_CFG(DM355
, VIN_CAM_WEN
, 0, 13, 1, 1, false)
498 MUX_CFG(DM355
, VIN_CAM_VD
, 0, 12, 1, 1, false)
499 MUX_CFG(DM355
, VIN_CAM_HD
, 0, 11, 1, 1, false)
500 MUX_CFG(DM355
, VIN_YIN_EN
, 0, 10, 1, 1, false)
501 MUX_CFG(DM355
, VIN_CINL_EN
, 0, 0, 0xff, 0x55, false)
502 MUX_CFG(DM355
, VIN_CINH_EN
, 0, 8, 3, 3, false)
506 static u8 dm355_default_priorities
[DAVINCI_N_AINTC_IRQ
] = {
507 [IRQ_DM355_CCDC_VDINT0
] = 2,
508 [IRQ_DM355_CCDC_VDINT1
] = 6,
509 [IRQ_DM355_CCDC_VDINT2
] = 6,
510 [IRQ_DM355_IPIPE_HST
] = 6,
511 [IRQ_DM355_H3AINT
] = 6,
512 [IRQ_DM355_IPIPE_SDR
] = 6,
513 [IRQ_DM355_IPIPEIFINT
] = 6,
514 [IRQ_DM355_OSDINT
] = 7,
515 [IRQ_DM355_VENCINT
] = 6,
519 [IRQ_DM355_RTOINT
] = 4,
520 [IRQ_DM355_UARTINT2
] = 7,
521 [IRQ_DM355_TINT6
] = 7,
522 [IRQ_CCINT0
] = 5, /* dma */
523 [IRQ_CCERRINT
] = 5, /* dma */
524 [IRQ_TCERRINT0
] = 5, /* dma */
525 [IRQ_TCERRINT
] = 5, /* dma */
526 [IRQ_DM355_SPINT2_1
] = 7,
527 [IRQ_DM355_TINT7
] = 4,
528 [IRQ_DM355_SDIOINT0
] = 7,
532 [IRQ_DM355_MMCINT1
] = 7,
533 [IRQ_DM355_PWMINT3
] = 7,
536 [IRQ_DM355_SDIOINT1
] = 4,
537 [IRQ_TINT0_TINT12
] = 2, /* clockevent */
538 [IRQ_TINT0_TINT34
] = 2, /* clocksource */
539 [IRQ_TINT1_TINT12
] = 7, /* DSP timer */
540 [IRQ_TINT1_TINT34
] = 7, /* system tick */
547 [IRQ_DM355_SPINT0_0
] = 3,
548 [IRQ_DM355_SPINT0_1
] = 3,
549 [IRQ_DM355_GPIO0
] = 3,
550 [IRQ_DM355_GPIO1
] = 7,
551 [IRQ_DM355_GPIO2
] = 4,
552 [IRQ_DM355_GPIO3
] = 4,
553 [IRQ_DM355_GPIO4
] = 7,
554 [IRQ_DM355_GPIO5
] = 7,
555 [IRQ_DM355_GPIO6
] = 7,
556 [IRQ_DM355_GPIO7
] = 7,
557 [IRQ_DM355_GPIO8
] = 7,
558 [IRQ_DM355_GPIO9
] = 7,
559 [IRQ_DM355_GPIOBNK0
] = 7,
560 [IRQ_DM355_GPIOBNK1
] = 7,
561 [IRQ_DM355_GPIOBNK2
] = 7,
562 [IRQ_DM355_GPIOBNK3
] = 7,
563 [IRQ_DM355_GPIOBNK4
] = 7,
564 [IRQ_DM355_GPIOBNK5
] = 7,
565 [IRQ_DM355_GPIOBNK6
] = 7,
571 /*----------------------------------------------------------------------*/
573 static s8 queue_priority_mapping
[][2] = {
574 /* {event queue no, Priority} */
580 static const struct dma_slave_map dm355_edma_map
[] = {
581 { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 2) },
582 { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 3) },
583 { "davinci-mcbsp.1", "tx", EDMA_FILTER_PARAM(0, 8) },
584 { "davinci-mcbsp.1", "rx", EDMA_FILTER_PARAM(0, 9) },
585 { "spi_davinci.2", "tx", EDMA_FILTER_PARAM(0, 10) },
586 { "spi_davinci.2", "rx", EDMA_FILTER_PARAM(0, 11) },
587 { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 14) },
588 { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 15) },
589 { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 16) },
590 { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 17) },
591 { "dm6441-mmc.0", "rx", EDMA_FILTER_PARAM(0, 26) },
592 { "dm6441-mmc.0", "tx", EDMA_FILTER_PARAM(0, 27) },
593 { "dm6441-mmc.1", "rx", EDMA_FILTER_PARAM(0, 30) },
594 { "dm6441-mmc.1", "tx", EDMA_FILTER_PARAM(0, 31) },
597 static struct edma_soc_info dm355_edma_pdata
= {
598 .queue_priority_mapping
= queue_priority_mapping
,
599 .default_queue
= EVENTQ_1
,
600 .slave_map
= dm355_edma_map
,
601 .slavecnt
= ARRAY_SIZE(dm355_edma_map
),
604 static struct resource edma_resources
[] = {
608 .end
= 0x01c00000 + SZ_64K
- 1,
609 .flags
= IORESOURCE_MEM
,
614 .end
= 0x01c10000 + SZ_1K
- 1,
615 .flags
= IORESOURCE_MEM
,
620 .end
= 0x01c10400 + SZ_1K
- 1,
621 .flags
= IORESOURCE_MEM
,
624 .name
= "edma3_ccint",
626 .flags
= IORESOURCE_IRQ
,
629 .name
= "edma3_ccerrint",
630 .start
= IRQ_CCERRINT
,
631 .flags
= IORESOURCE_IRQ
,
633 /* not using (or muxing) TC*_ERR */
636 static const struct platform_device_info dm355_edma_device __initconst
= {
639 .dma_mask
= DMA_BIT_MASK(32),
640 .res
= edma_resources
,
641 .num_res
= ARRAY_SIZE(edma_resources
),
642 .data
= &dm355_edma_pdata
,
643 .size_data
= sizeof(dm355_edma_pdata
),
646 static struct resource dm355_asp1_resources
[] = {
649 .start
= DAVINCI_ASP1_BASE
,
650 .end
= DAVINCI_ASP1_BASE
+ SZ_8K
- 1,
651 .flags
= IORESOURCE_MEM
,
654 .start
= DAVINCI_DMA_ASP1_TX
,
655 .end
= DAVINCI_DMA_ASP1_TX
,
656 .flags
= IORESOURCE_DMA
,
659 .start
= DAVINCI_DMA_ASP1_RX
,
660 .end
= DAVINCI_DMA_ASP1_RX
,
661 .flags
= IORESOURCE_DMA
,
665 static struct platform_device dm355_asp1_device
= {
666 .name
= "davinci-mcbsp",
668 .num_resources
= ARRAY_SIZE(dm355_asp1_resources
),
669 .resource
= dm355_asp1_resources
,
672 static void dm355_ccdc_setup_pinmux(void)
674 davinci_cfg_reg(DM355_VIN_PCLK
);
675 davinci_cfg_reg(DM355_VIN_CAM_WEN
);
676 davinci_cfg_reg(DM355_VIN_CAM_VD
);
677 davinci_cfg_reg(DM355_VIN_CAM_HD
);
678 davinci_cfg_reg(DM355_VIN_YIN_EN
);
679 davinci_cfg_reg(DM355_VIN_CINL_EN
);
680 davinci_cfg_reg(DM355_VIN_CINH_EN
);
683 static struct resource dm355_vpss_resources
[] = {
685 /* VPSS BL Base address */
688 .end
= 0x01c70800 + 0xff,
689 .flags
= IORESOURCE_MEM
,
692 /* VPSS CLK Base address */
695 .end
= 0x01c70000 + 0xf,
696 .flags
= IORESOURCE_MEM
,
700 static struct platform_device dm355_vpss_device
= {
703 .dev
.platform_data
= "dm355_vpss",
704 .num_resources
= ARRAY_SIZE(dm355_vpss_resources
),
705 .resource
= dm355_vpss_resources
,
708 static struct resource vpfe_resources
[] = {
712 .flags
= IORESOURCE_IRQ
,
717 .flags
= IORESOURCE_IRQ
,
721 static u64 vpfe_capture_dma_mask
= DMA_BIT_MASK(32);
722 static struct resource dm355_ccdc_resource
[] = {
723 /* CCDC Base address */
725 .flags
= IORESOURCE_MEM
,
727 .end
= 0x01c70600 + 0x1ff,
730 static struct platform_device dm355_ccdc_dev
= {
731 .name
= "dm355_ccdc",
733 .num_resources
= ARRAY_SIZE(dm355_ccdc_resource
),
734 .resource
= dm355_ccdc_resource
,
736 .dma_mask
= &vpfe_capture_dma_mask
,
737 .coherent_dma_mask
= DMA_BIT_MASK(32),
738 .platform_data
= dm355_ccdc_setup_pinmux
,
742 static struct platform_device vpfe_capture_dev
= {
743 .name
= CAPTURE_DRV_NAME
,
745 .num_resources
= ARRAY_SIZE(vpfe_resources
),
746 .resource
= vpfe_resources
,
748 .dma_mask
= &vpfe_capture_dma_mask
,
749 .coherent_dma_mask
= DMA_BIT_MASK(32),
753 static struct resource dm355_osd_resources
[] = {
755 .start
= DM355_OSD_BASE
,
756 .end
= DM355_OSD_BASE
+ 0x17f,
757 .flags
= IORESOURCE_MEM
,
761 static struct platform_device dm355_osd_dev
= {
762 .name
= DM355_VPBE_OSD_SUBDEV_NAME
,
764 .num_resources
= ARRAY_SIZE(dm355_osd_resources
),
765 .resource
= dm355_osd_resources
,
767 .dma_mask
= &vpfe_capture_dma_mask
,
768 .coherent_dma_mask
= DMA_BIT_MASK(32),
772 static struct resource dm355_venc_resources
[] = {
774 .start
= IRQ_VENCINT
,
776 .flags
= IORESOURCE_IRQ
,
778 /* venc registers io space */
780 .start
= DM355_VENC_BASE
,
781 .end
= DM355_VENC_BASE
+ 0x17f,
782 .flags
= IORESOURCE_MEM
,
784 /* VDAC config register io space */
786 .start
= DAVINCI_SYSTEM_MODULE_BASE
+ SYSMOD_VDAC_CONFIG
,
787 .end
= DAVINCI_SYSTEM_MODULE_BASE
+ SYSMOD_VDAC_CONFIG
+ 3,
788 .flags
= IORESOURCE_MEM
,
792 static struct resource dm355_v4l2_disp_resources
[] = {
794 .start
= IRQ_VENCINT
,
796 .flags
= IORESOURCE_IRQ
,
798 /* venc registers io space */
800 .start
= DM355_VENC_BASE
,
801 .end
= DM355_VENC_BASE
+ 0x17f,
802 .flags
= IORESOURCE_MEM
,
806 static int dm355_vpbe_setup_pinmux(u32 if_type
, int field
)
809 case MEDIA_BUS_FMT_SGRBG8_1X8
:
810 davinci_cfg_reg(DM355_VOUT_FIELD_G70
);
812 case MEDIA_BUS_FMT_YUYV10_1X20
:
814 davinci_cfg_reg(DM355_VOUT_FIELD
);
816 davinci_cfg_reg(DM355_VOUT_FIELD_G70
);
822 davinci_cfg_reg(DM355_VOUT_COUTL_EN
);
823 davinci_cfg_reg(DM355_VOUT_COUTH_EN
);
828 static int dm355_venc_setup_clock(enum vpbe_enc_timings_type type
,
831 void __iomem
*vpss_clk_ctrl_reg
;
833 vpss_clk_ctrl_reg
= DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL
);
837 writel(VPSS_DACCLKEN_ENABLE
| VPSS_VENCCLKEN_ENABLE
,
840 case VPBE_ENC_DV_TIMINGS
:
841 if (pclock
> 27000000)
843 * For HD, use external clock source since we cannot
844 * support HD mode with internal clocks.
846 writel(VPSS_MUXSEL_EXTCLK_ENABLE
, vpss_clk_ctrl_reg
);
855 static struct platform_device dm355_vpbe_display
= {
858 .num_resources
= ARRAY_SIZE(dm355_v4l2_disp_resources
),
859 .resource
= dm355_v4l2_disp_resources
,
861 .dma_mask
= &vpfe_capture_dma_mask
,
862 .coherent_dma_mask
= DMA_BIT_MASK(32),
866 static struct venc_platform_data dm355_venc_pdata
= {
867 .setup_pinmux
= dm355_vpbe_setup_pinmux
,
868 .setup_clock
= dm355_venc_setup_clock
,
871 static struct platform_device dm355_venc_dev
= {
872 .name
= DM355_VPBE_VENC_SUBDEV_NAME
,
874 .num_resources
= ARRAY_SIZE(dm355_venc_resources
),
875 .resource
= dm355_venc_resources
,
877 .dma_mask
= &vpfe_capture_dma_mask
,
878 .coherent_dma_mask
= DMA_BIT_MASK(32),
879 .platform_data
= (void *)&dm355_venc_pdata
,
883 static struct platform_device dm355_vpbe_dev
= {
884 .name
= "vpbe_controller",
887 .dma_mask
= &vpfe_capture_dma_mask
,
888 .coherent_dma_mask
= DMA_BIT_MASK(32),
892 static struct resource dm355_gpio_resources
[] = {
894 .start
= DAVINCI_GPIO_BASE
,
895 .end
= DAVINCI_GPIO_BASE
+ SZ_4K
- 1,
896 .flags
= IORESOURCE_MEM
,
899 .start
= IRQ_DM355_GPIOBNK0
,
900 .end
= IRQ_DM355_GPIOBNK6
,
901 .flags
= IORESOURCE_IRQ
,
905 static struct davinci_gpio_platform_data dm355_gpio_platform_data
= {
909 int __init
dm355_gpio_register(void)
911 return davinci_gpio_register(dm355_gpio_resources
,
912 ARRAY_SIZE(dm355_gpio_resources
),
913 &dm355_gpio_platform_data
);
915 /*----------------------------------------------------------------------*/
917 static struct map_desc dm355_io_desc
[] = {
920 .pfn
= __phys_to_pfn(IO_PHYS
),
926 /* Contents of JTAG ID register used to identify exact cpu type */
927 static struct davinci_id dm355_ids
[] = {
931 .manufacturer
= 0x00f,
932 .cpu_id
= DAVINCI_CPU_ID_DM355
,
937 static u32 dm355_psc_bases
[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE
};
940 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
941 * T0_TOP: Timer 0, top : clocksource for generic timekeeping
942 * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code)
943 * T1_TOP: Timer 1, top : <unused>
945 static struct davinci_timer_info dm355_timer_info
= {
946 .timers
= davinci_timer_instance
,
947 .clockevent_id
= T0_BOT
,
948 .clocksource_id
= T0_TOP
,
951 static struct plat_serial8250_port dm355_serial0_platform_data
[] = {
953 .mapbase
= DAVINCI_UART0_BASE
,
955 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
964 static struct plat_serial8250_port dm355_serial1_platform_data
[] = {
966 .mapbase
= DAVINCI_UART1_BASE
,
968 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
977 static struct plat_serial8250_port dm355_serial2_platform_data
[] = {
979 .mapbase
= DM355_UART2_BASE
,
980 .irq
= IRQ_DM355_UARTINT2
,
981 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
991 struct platform_device dm355_serial_device
[] = {
993 .name
= "serial8250",
994 .id
= PLAT8250_DEV_PLATFORM
,
996 .platform_data
= dm355_serial0_platform_data
,
1000 .name
= "serial8250",
1001 .id
= PLAT8250_DEV_PLATFORM1
,
1003 .platform_data
= dm355_serial1_platform_data
,
1007 .name
= "serial8250",
1008 .id
= PLAT8250_DEV_PLATFORM2
,
1010 .platform_data
= dm355_serial2_platform_data
,
1017 static struct davinci_soc_info davinci_soc_info_dm355
= {
1018 .io_desc
= dm355_io_desc
,
1019 .io_desc_num
= ARRAY_SIZE(dm355_io_desc
),
1020 .jtag_id_reg
= 0x01c40028,
1022 .ids_num
= ARRAY_SIZE(dm355_ids
),
1023 .cpu_clks
= dm355_clks
,
1024 .psc_bases
= dm355_psc_bases
,
1025 .psc_bases_num
= ARRAY_SIZE(dm355_psc_bases
),
1026 .pinmux_base
= DAVINCI_SYSTEM_MODULE_BASE
,
1027 .pinmux_pins
= dm355_pins
,
1028 .pinmux_pins_num
= ARRAY_SIZE(dm355_pins
),
1029 .intc_base
= DAVINCI_ARM_INTC_BASE
,
1030 .intc_type
= DAVINCI_INTC_TYPE_AINTC
,
1031 .intc_irq_prios
= dm355_default_priorities
,
1032 .intc_irq_num
= DAVINCI_N_AINTC_IRQ
,
1033 .timer_info
= &dm355_timer_info
,
1034 .sram_dma
= 0x00010000,
1038 void __init
dm355_init_asp1(u32 evt_enable
, struct snd_platform_data
*pdata
)
1040 /* we don't use ASP1 IRQs, or we'd need to mux them ... */
1041 if (evt_enable
& ASP1_TX_EVT_EN
)
1042 davinci_cfg_reg(DM355_EVT8_ASP1_TX
);
1044 if (evt_enable
& ASP1_RX_EVT_EN
)
1045 davinci_cfg_reg(DM355_EVT9_ASP1_RX
);
1047 dm355_asp1_device
.dev
.platform_data
= pdata
;
1048 platform_device_register(&dm355_asp1_device
);
1051 void __init
dm355_init(void)
1053 davinci_common_init(&davinci_soc_info_dm355
);
1054 davinci_map_sysmod();
1057 int __init
dm355_init_video(struct vpfe_config
*vpfe_cfg
,
1058 struct vpbe_config
*vpbe_cfg
)
1060 if (vpfe_cfg
|| vpbe_cfg
)
1061 platform_device_register(&dm355_vpss_device
);
1064 vpfe_capture_dev
.dev
.platform_data
= vpfe_cfg
;
1065 platform_device_register(&dm355_ccdc_dev
);
1066 platform_device_register(&vpfe_capture_dev
);
1070 dm355_vpbe_dev
.dev
.platform_data
= vpbe_cfg
;
1071 platform_device_register(&dm355_osd_dev
);
1072 platform_device_register(&dm355_venc_dev
);
1073 platform_device_register(&dm355_vpbe_dev
);
1074 platform_device_register(&dm355_vpbe_display
);
1080 static int __init
dm355_init_devices(void)
1082 struct platform_device
*edma_pdev
;
1085 if (!cpu_is_davinci_dm355())
1088 davinci_cfg_reg(DM355_INT_EDMA_CC
);
1089 edma_pdev
= platform_device_register_full(&dm355_edma_device
);
1090 if (IS_ERR(edma_pdev
)) {
1091 pr_warn("%s: Failed to register eDMA\n", __func__
);
1092 return PTR_ERR(edma_pdev
);
1095 ret
= davinci_init_wdt();
1097 pr_warn("%s: watchdog init failed: %d\n", __func__
, ret
);
1101 postcore_initcall(dm355_init_devices
);