2 * DA8XX/OMAP L1XX platform device data
4 * Copyright (c) 2007-2009, MontaVista Software, Inc. <source@mvista.com>
5 * Derived from code that was:
6 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/dma-mapping.h>
16 #include <linux/serial_8250.h>
18 #include <mach/cputype.h>
19 #include <mach/common.h>
20 #include <mach/time.h>
21 #include <mach/da8xx.h>
22 #include <mach/cpuidle.h>
26 #define DA8XX_TPCC_BASE 0x01c00000
27 #define DA8XX_TPTC0_BASE 0x01c08000
28 #define DA8XX_TPTC1_BASE 0x01c08400
29 #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
30 #define DA8XX_I2C0_BASE 0x01c22000
31 #define DA8XX_RTC_BASE 0x01C23000
32 #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
33 #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
34 #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000
35 #define DA8XX_EMAC_MDIO_BASE 0x01e24000
36 #define DA8XX_GPIO_BASE 0x01e26000
37 #define DA8XX_I2C1_BASE 0x01e28000
39 #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
40 #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
41 #define DA8XX_EMAC_RAM_OFFSET 0x0000
42 #define DA8XX_MDIO_REG_OFFSET 0x4000
43 #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K
45 void __iomem
*da8xx_syscfg_base
;
47 static struct plat_serial8250_port da8xx_serial_pdata
[] = {
49 .mapbase
= DA8XX_UART0_BASE
,
50 .irq
= IRQ_DA8XX_UARTINT0
,
51 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
57 .mapbase
= DA8XX_UART1_BASE
,
58 .irq
= IRQ_DA8XX_UARTINT1
,
59 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
65 .mapbase
= DA8XX_UART2_BASE
,
66 .irq
= IRQ_DA8XX_UARTINT2
,
67 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
77 struct platform_device da8xx_serial_device
= {
79 .id
= PLAT8250_DEV_PLATFORM
,
81 .platform_data
= da8xx_serial_pdata
,
85 static const s8 da8xx_dma_chan_no_event
[] = {
90 static const s8 da8xx_queue_tc_mapping
[][2] = {
91 /* {event queue no, TC no} */
97 static const s8 da8xx_queue_priority_mapping
[][2] = {
98 /* {event queue no, Priority} */
104 static struct edma_soc_info da8xx_edma_info
[] = {
111 .noevent
= da8xx_dma_chan_no_event
,
112 .queue_tc_mapping
= da8xx_queue_tc_mapping
,
113 .queue_priority_mapping
= da8xx_queue_priority_mapping
,
117 static struct resource da8xx_edma_resources
[] = {
120 .start
= DA8XX_TPCC_BASE
,
121 .end
= DA8XX_TPCC_BASE
+ SZ_32K
- 1,
122 .flags
= IORESOURCE_MEM
,
126 .start
= DA8XX_TPTC0_BASE
,
127 .end
= DA8XX_TPTC0_BASE
+ SZ_1K
- 1,
128 .flags
= IORESOURCE_MEM
,
132 .start
= DA8XX_TPTC1_BASE
,
133 .end
= DA8XX_TPTC1_BASE
+ SZ_1K
- 1,
134 .flags
= IORESOURCE_MEM
,
138 .start
= IRQ_DA8XX_CCINT0
,
139 .flags
= IORESOURCE_IRQ
,
143 .start
= IRQ_DA8XX_CCERRINT
,
144 .flags
= IORESOURCE_IRQ
,
148 static struct platform_device da8xx_edma_device
= {
152 .platform_data
= da8xx_edma_info
,
154 .num_resources
= ARRAY_SIZE(da8xx_edma_resources
),
155 .resource
= da8xx_edma_resources
,
158 int __init
da8xx_register_edma(void)
160 return platform_device_register(&da8xx_edma_device
);
163 static struct resource da8xx_i2c_resources0
[] = {
165 .start
= DA8XX_I2C0_BASE
,
166 .end
= DA8XX_I2C0_BASE
+ SZ_4K
- 1,
167 .flags
= IORESOURCE_MEM
,
170 .start
= IRQ_DA8XX_I2CINT0
,
171 .end
= IRQ_DA8XX_I2CINT0
,
172 .flags
= IORESOURCE_IRQ
,
176 static struct platform_device da8xx_i2c_device0
= {
177 .name
= "i2c_davinci",
179 .num_resources
= ARRAY_SIZE(da8xx_i2c_resources0
),
180 .resource
= da8xx_i2c_resources0
,
183 static struct resource da8xx_i2c_resources1
[] = {
185 .start
= DA8XX_I2C1_BASE
,
186 .end
= DA8XX_I2C1_BASE
+ SZ_4K
- 1,
187 .flags
= IORESOURCE_MEM
,
190 .start
= IRQ_DA8XX_I2CINT1
,
191 .end
= IRQ_DA8XX_I2CINT1
,
192 .flags
= IORESOURCE_IRQ
,
196 static struct platform_device da8xx_i2c_device1
= {
197 .name
= "i2c_davinci",
199 .num_resources
= ARRAY_SIZE(da8xx_i2c_resources1
),
200 .resource
= da8xx_i2c_resources1
,
203 int __init
da8xx_register_i2c(int instance
,
204 struct davinci_i2c_platform_data
*pdata
)
206 struct platform_device
*pdev
;
209 pdev
= &da8xx_i2c_device0
;
210 else if (instance
== 1)
211 pdev
= &da8xx_i2c_device1
;
215 pdev
->dev
.platform_data
= pdata
;
216 return platform_device_register(pdev
);
219 static struct resource da8xx_watchdog_resources
[] = {
221 .start
= DA8XX_WDOG_BASE
,
222 .end
= DA8XX_WDOG_BASE
+ SZ_4K
- 1,
223 .flags
= IORESOURCE_MEM
,
227 struct platform_device davinci_wdt_device
= {
230 .num_resources
= ARRAY_SIZE(da8xx_watchdog_resources
),
231 .resource
= da8xx_watchdog_resources
,
234 int __init
da8xx_register_watchdog(void)
236 return platform_device_register(&davinci_wdt_device
);
239 static struct resource da8xx_emac_resources
[] = {
241 .start
= DA8XX_EMAC_CPPI_PORT_BASE
,
242 .end
= DA8XX_EMAC_CPPI_PORT_BASE
+ 0x5000 - 1,
243 .flags
= IORESOURCE_MEM
,
246 .start
= IRQ_DA8XX_C0_RX_THRESH_PULSE
,
247 .end
= IRQ_DA8XX_C0_RX_THRESH_PULSE
,
248 .flags
= IORESOURCE_IRQ
,
251 .start
= IRQ_DA8XX_C0_RX_PULSE
,
252 .end
= IRQ_DA8XX_C0_RX_PULSE
,
253 .flags
= IORESOURCE_IRQ
,
256 .start
= IRQ_DA8XX_C0_TX_PULSE
,
257 .end
= IRQ_DA8XX_C0_TX_PULSE
,
258 .flags
= IORESOURCE_IRQ
,
261 .start
= IRQ_DA8XX_C0_MISC_PULSE
,
262 .end
= IRQ_DA8XX_C0_MISC_PULSE
,
263 .flags
= IORESOURCE_IRQ
,
267 struct emac_platform_data da8xx_emac_pdata
= {
268 .ctrl_reg_offset
= DA8XX_EMAC_CTRL_REG_OFFSET
,
269 .ctrl_mod_reg_offset
= DA8XX_EMAC_MOD_REG_OFFSET
,
270 .ctrl_ram_offset
= DA8XX_EMAC_RAM_OFFSET
,
271 .mdio_reg_offset
= DA8XX_MDIO_REG_OFFSET
,
272 .ctrl_ram_size
= DA8XX_EMAC_CTRL_RAM_SIZE
,
273 .version
= EMAC_VERSION_2
,
276 static struct platform_device da8xx_emac_device
= {
277 .name
= "davinci_emac",
280 .platform_data
= &da8xx_emac_pdata
,
282 .num_resources
= ARRAY_SIZE(da8xx_emac_resources
),
283 .resource
= da8xx_emac_resources
,
286 int __init
da8xx_register_emac(void)
288 return platform_device_register(&da8xx_emac_device
);
291 static struct resource da830_mcasp1_resources
[] = {
294 .start
= DAVINCI_DA830_MCASP1_REG_BASE
,
295 .end
= DAVINCI_DA830_MCASP1_REG_BASE
+ (SZ_1K
* 12) - 1,
296 .flags
= IORESOURCE_MEM
,
300 .start
= DAVINCI_DA830_DMA_MCASP1_AXEVT
,
301 .end
= DAVINCI_DA830_DMA_MCASP1_AXEVT
,
302 .flags
= IORESOURCE_DMA
,
306 .start
= DAVINCI_DA830_DMA_MCASP1_AREVT
,
307 .end
= DAVINCI_DA830_DMA_MCASP1_AREVT
,
308 .flags
= IORESOURCE_DMA
,
312 static struct platform_device da830_mcasp1_device
= {
313 .name
= "davinci-mcasp",
315 .num_resources
= ARRAY_SIZE(da830_mcasp1_resources
),
316 .resource
= da830_mcasp1_resources
,
319 static struct resource da850_mcasp_resources
[] = {
322 .start
= DAVINCI_DA8XX_MCASP0_REG_BASE
,
323 .end
= DAVINCI_DA8XX_MCASP0_REG_BASE
+ (SZ_1K
* 12) - 1,
324 .flags
= IORESOURCE_MEM
,
328 .start
= DAVINCI_DA8XX_DMA_MCASP0_AXEVT
,
329 .end
= DAVINCI_DA8XX_DMA_MCASP0_AXEVT
,
330 .flags
= IORESOURCE_DMA
,
334 .start
= DAVINCI_DA8XX_DMA_MCASP0_AREVT
,
335 .end
= DAVINCI_DA8XX_DMA_MCASP0_AREVT
,
336 .flags
= IORESOURCE_DMA
,
340 static struct platform_device da850_mcasp_device
= {
341 .name
= "davinci-mcasp",
343 .num_resources
= ARRAY_SIZE(da850_mcasp_resources
),
344 .resource
= da850_mcasp_resources
,
347 void __init
da8xx_register_mcasp(int id
, struct snd_platform_data
*pdata
)
349 /* DA830/OMAP-L137 has 3 instances of McASP */
350 if (cpu_is_davinci_da830() && id
== 1) {
351 da830_mcasp1_device
.dev
.platform_data
= pdata
;
352 platform_device_register(&da830_mcasp1_device
);
353 } else if (cpu_is_davinci_da850()) {
354 da850_mcasp_device
.dev
.platform_data
= pdata
;
355 platform_device_register(&da850_mcasp_device
);
359 static const struct display_panel disp_panel
= {
366 static struct lcd_ctrl_config lcd_cfg
= {
376 .invert_line_clock
= 1,
377 .invert_frm_clock
= 1,
383 struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata
= {
384 .manu_name
= "sharp",
385 .controller_data
= &lcd_cfg
,
386 .type
= "Sharp_LCD035Q3DG01",
389 struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata
= {
390 .manu_name
= "sharp",
391 .controller_data
= &lcd_cfg
,
392 .type
= "Sharp_LK043T1DG01",
395 static struct resource da8xx_lcdc_resources
[] = {
396 [0] = { /* registers */
397 .start
= DA8XX_LCD_CNTRL_BASE
,
398 .end
= DA8XX_LCD_CNTRL_BASE
+ SZ_4K
- 1,
399 .flags
= IORESOURCE_MEM
,
401 [1] = { /* interrupt */
402 .start
= IRQ_DA8XX_LCDINT
,
403 .end
= IRQ_DA8XX_LCDINT
,
404 .flags
= IORESOURCE_IRQ
,
408 static struct platform_device da8xx_lcdc_device
= {
409 .name
= "da8xx_lcdc",
411 .num_resources
= ARRAY_SIZE(da8xx_lcdc_resources
),
412 .resource
= da8xx_lcdc_resources
,
415 int __init
da8xx_register_lcdc(struct da8xx_lcdc_platform_data
*pdata
)
417 da8xx_lcdc_device
.dev
.platform_data
= pdata
;
418 return platform_device_register(&da8xx_lcdc_device
);
421 static struct resource da8xx_mmcsd0_resources
[] = {
423 .start
= DA8XX_MMCSD0_BASE
,
424 .end
= DA8XX_MMCSD0_BASE
+ SZ_4K
- 1,
425 .flags
= IORESOURCE_MEM
,
428 .start
= IRQ_DA8XX_MMCSDINT0
,
429 .end
= IRQ_DA8XX_MMCSDINT0
,
430 .flags
= IORESOURCE_IRQ
,
433 .start
= EDMA_CTLR_CHAN(0, 16),
434 .end
= EDMA_CTLR_CHAN(0, 16),
435 .flags
= IORESOURCE_DMA
,
438 .start
= EDMA_CTLR_CHAN(0, 17),
439 .end
= EDMA_CTLR_CHAN(0, 17),
440 .flags
= IORESOURCE_DMA
,
444 static struct platform_device da8xx_mmcsd0_device
= {
445 .name
= "davinci_mmc",
447 .num_resources
= ARRAY_SIZE(da8xx_mmcsd0_resources
),
448 .resource
= da8xx_mmcsd0_resources
,
451 int __init
da8xx_register_mmcsd0(struct davinci_mmc_config
*config
)
453 da8xx_mmcsd0_device
.dev
.platform_data
= config
;
454 return platform_device_register(&da8xx_mmcsd0_device
);
457 static struct resource da8xx_rtc_resources
[] = {
459 .start
= DA8XX_RTC_BASE
,
460 .end
= DA8XX_RTC_BASE
+ SZ_4K
- 1,
461 .flags
= IORESOURCE_MEM
,
464 .start
= IRQ_DA8XX_RTC
,
465 .end
= IRQ_DA8XX_RTC
,
466 .flags
= IORESOURCE_IRQ
,
469 .start
= IRQ_DA8XX_RTC
,
470 .end
= IRQ_DA8XX_RTC
,
471 .flags
= IORESOURCE_IRQ
,
475 static struct platform_device da8xx_rtc_device
= {
478 .num_resources
= ARRAY_SIZE(da8xx_rtc_resources
),
479 .resource
= da8xx_rtc_resources
,
482 int da8xx_register_rtc(void)
486 /* Unlock the rtc's registers */
487 __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE
+ 0x6c));
488 __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE
+ 0x70));
490 ret
= platform_device_register(&da8xx_rtc_device
);
492 /* Atleast on DA850, RTC is a wakeup source */
493 device_init_wakeup(&da8xx_rtc_device
.dev
, true);
498 static struct resource da8xx_cpuidle_resources
[] = {
500 .start
= DA8XX_DDR2_CTL_BASE
,
501 .end
= DA8XX_DDR2_CTL_BASE
+ SZ_32K
- 1,
502 .flags
= IORESOURCE_MEM
,
506 /* DA8XX devices support DDR2 power down */
507 static struct davinci_cpuidle_config da8xx_cpuidle_pdata
= {
512 static struct platform_device da8xx_cpuidle_device
= {
513 .name
= "cpuidle-davinci",
514 .num_resources
= ARRAY_SIZE(da8xx_cpuidle_resources
),
515 .resource
= da8xx_cpuidle_resources
,
517 .platform_data
= &da8xx_cpuidle_pdata
,
521 int __init
da8xx_register_cpuidle(void)
523 return platform_device_register(&da8xx_cpuidle_device
);