blob: 4e66881c7aee748dddf82a304fb261dc89edde97 [file] [log] [blame]
Mark A. Greer55c79a42009-06-03 18:36:54 -07001/*
2 * DA8XX/OMAP L1XX platform device data
3 *
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>
7 *
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.
12 */
Mark A. Greer55c79a42009-06-03 18:36:54 -070013#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h>
16#include <linux/serial_8250.h>
17
18#include <mach/cputype.h>
19#include <mach/common.h>
20#include <mach/time.h>
21#include <mach/da8xx.h>
Sekhar Nori1960e692009-10-22 15:12:14 +053022#include <mach/cpuidle.h>
Mark A. Greer55c79a42009-06-03 18:36:54 -070023
24#include "clock.h"
25
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
Sergei Shtylyov8ac764e2011-04-06 17:29:24 +000031#define DA8XX_RTC_BASE 0x01c23000
32#define DA8XX_MMCSD0_BASE 0x01c40000
33#define DA8XX_SPI0_BASE 0x01c41000
34#define DA830_SPI1_BASE 0x01e12000
35#define DA8XX_LCD_CNTRL_BASE 0x01e13000
36#define DA850_MMCSD1_BASE 0x01e1b000
Mark A. Greer55c79a42009-06-03 18:36:54 -070037#define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
38#define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
39#define DA8XX_EMAC_CPGMAC_BASE 0x01e23000
40#define DA8XX_EMAC_MDIO_BASE 0x01e24000
Mark A. Greer55c79a42009-06-03 18:36:54 -070041#define DA8XX_I2C1_BASE 0x01e28000
Sergei Shtylyov8ac764e2011-04-06 17:29:24 +000042#define DA850_TPCC1_BASE 0x01e30000
43#define DA850_TPTC2_BASE 0x01e38000
Sergei Shtylyov9e7d24f2011-04-06 17:17:21 +000044#define DA850_SPI1_BASE 0x01f0e000
Sergei Shtylyov8ac764e2011-04-06 17:29:24 +000045#define DA8XX_DDR2_CTL_BASE 0xb0000000
Mark A. Greer55c79a42009-06-03 18:36:54 -070046
47#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
48#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
49#define DA8XX_EMAC_RAM_OFFSET 0x0000
Mark A. Greer55c79a42009-06-03 18:36:54 -070050#define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K
51
Michael Williamson54ce6882011-02-24 10:18:28 +053052#define DA8XX_DMA_SPI0_RX EDMA_CTLR_CHAN(0, 14)
53#define DA8XX_DMA_SPI0_TX EDMA_CTLR_CHAN(0, 15)
Michael Williamsone38c2b22011-02-22 13:36:57 +000054#define DA8XX_DMA_MMCSD0_RX EDMA_CTLR_CHAN(0, 16)
55#define DA8XX_DMA_MMCSD0_TX EDMA_CTLR_CHAN(0, 17)
Michael Williamson54ce6882011-02-24 10:18:28 +053056#define DA8XX_DMA_SPI1_RX EDMA_CTLR_CHAN(0, 18)
57#define DA8XX_DMA_SPI1_TX EDMA_CTLR_CHAN(0, 19)
Michael Williamsone38c2b22011-02-22 13:36:57 +000058#define DA850_DMA_MMCSD1_RX EDMA_CTLR_CHAN(1, 28)
59#define DA850_DMA_MMCSD1_TX EDMA_CTLR_CHAN(1, 29)
60
Sekhar Norid2de0582009-11-16 17:21:32 +053061void __iomem *da8xx_syscfg0_base;
62void __iomem *da8xx_syscfg1_base;
Sekhar Nori6a28ade2009-08-31 15:47:59 +053063
Mark A. Greer55c79a42009-06-03 18:36:54 -070064static struct plat_serial8250_port da8xx_serial_pdata[] = {
65 {
66 .mapbase = DA8XX_UART0_BASE,
67 .irq = IRQ_DA8XX_UARTINT0,
68 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
69 UPF_IOREMAP,
70 .iotype = UPIO_MEM,
71 .regshift = 2,
72 },
73 {
74 .mapbase = DA8XX_UART1_BASE,
75 .irq = IRQ_DA8XX_UARTINT1,
76 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
77 UPF_IOREMAP,
78 .iotype = UPIO_MEM,
79 .regshift = 2,
80 },
81 {
82 .mapbase = DA8XX_UART2_BASE,
83 .irq = IRQ_DA8XX_UARTINT2,
84 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
85 UPF_IOREMAP,
86 .iotype = UPIO_MEM,
87 .regshift = 2,
88 },
89 {
90 .flags = 0,
91 },
92};
93
94struct platform_device da8xx_serial_device = {
95 .name = "serial8250",
96 .id = PLAT8250_DEV_PLATFORM,
97 .dev = {
98 .platform_data = da8xx_serial_pdata,
99 },
100};
101
Mark A. Greer55c79a42009-06-03 18:36:54 -0700102static const s8 da8xx_queue_tc_mapping[][2] = {
103 /* {event queue no, TC no} */
104 {0, 0},
105 {1, 1},
106 {-1, -1}
107};
108
109static const s8 da8xx_queue_priority_mapping[][2] = {
110 /* {event queue no, Priority} */
111 {0, 3},
112 {1, 7},
113 {-1, -1}
114};
115
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530116static const s8 da850_queue_tc_mapping[][2] = {
117 /* {event queue no, TC no} */
118 {0, 0},
119 {-1, -1}
120};
121
122static const s8 da850_queue_priority_mapping[][2] = {
123 /* {event queue no, Priority} */
124 {0, 3},
125 {-1, -1}
126};
127
Sekhar Noribc3ac9f2010-06-29 11:35:12 +0530128static struct edma_soc_info da830_edma_cc0_info = {
129 .n_channel = 32,
130 .n_region = 4,
131 .n_slot = 128,
132 .n_tc = 2,
133 .n_cc = 1,
134 .queue_tc_mapping = da8xx_queue_tc_mapping,
135 .queue_priority_mapping = da8xx_queue_priority_mapping,
Mark A. Greer55c79a42009-06-03 18:36:54 -0700136};
137
Sekhar Noribc3ac9f2010-06-29 11:35:12 +0530138static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = {
139 &da830_edma_cc0_info,
140};
141
142static struct edma_soc_info da850_edma_cc_info[] = {
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530143 {
144 .n_channel = 32,
145 .n_region = 4,
146 .n_slot = 128,
147 .n_tc = 2,
148 .n_cc = 1,
149 .queue_tc_mapping = da8xx_queue_tc_mapping,
150 .queue_priority_mapping = da8xx_queue_priority_mapping,
151 },
152 {
153 .n_channel = 32,
154 .n_region = 4,
155 .n_slot = 128,
156 .n_tc = 1,
157 .n_cc = 1,
158 .queue_tc_mapping = da850_queue_tc_mapping,
159 .queue_priority_mapping = da850_queue_priority_mapping,
160 },
161};
162
Sekhar Noribc3ac9f2010-06-29 11:35:12 +0530163static struct edma_soc_info *da850_edma_info[EDMA_MAX_CC] = {
164 &da850_edma_cc_info[0],
165 &da850_edma_cc_info[1],
166};
167
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530168static struct resource da830_edma_resources[] = {
Mark A. Greer55c79a42009-06-03 18:36:54 -0700169 {
170 .name = "edma_cc0",
171 .start = DA8XX_TPCC_BASE,
172 .end = DA8XX_TPCC_BASE + SZ_32K - 1,
173 .flags = IORESOURCE_MEM,
174 },
175 {
176 .name = "edma_tc0",
177 .start = DA8XX_TPTC0_BASE,
178 .end = DA8XX_TPTC0_BASE + SZ_1K - 1,
179 .flags = IORESOURCE_MEM,
180 },
181 {
182 .name = "edma_tc1",
183 .start = DA8XX_TPTC1_BASE,
184 .end = DA8XX_TPTC1_BASE + SZ_1K - 1,
185 .flags = IORESOURCE_MEM,
186 },
187 {
188 .name = "edma0",
Sudhakar Rajashekhara2259bbd2009-07-10 06:28:52 -0400189 .start = IRQ_DA8XX_CCINT0,
Mark A. Greer55c79a42009-06-03 18:36:54 -0700190 .flags = IORESOURCE_IRQ,
191 },
192 {
193 .name = "edma0_err",
194 .start = IRQ_DA8XX_CCERRINT,
195 .flags = IORESOURCE_IRQ,
196 },
197};
198
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530199static struct resource da850_edma_resources[] = {
200 {
201 .name = "edma_cc0",
202 .start = DA8XX_TPCC_BASE,
203 .end = DA8XX_TPCC_BASE + SZ_32K - 1,
204 .flags = IORESOURCE_MEM,
205 },
206 {
207 .name = "edma_tc0",
208 .start = DA8XX_TPTC0_BASE,
209 .end = DA8XX_TPTC0_BASE + SZ_1K - 1,
210 .flags = IORESOURCE_MEM,
211 },
212 {
213 .name = "edma_tc1",
214 .start = DA8XX_TPTC1_BASE,
215 .end = DA8XX_TPTC1_BASE + SZ_1K - 1,
216 .flags = IORESOURCE_MEM,
217 },
218 {
219 .name = "edma_cc1",
220 .start = DA850_TPCC1_BASE,
221 .end = DA850_TPCC1_BASE + SZ_32K - 1,
222 .flags = IORESOURCE_MEM,
223 },
224 {
225 .name = "edma_tc2",
226 .start = DA850_TPTC2_BASE,
227 .end = DA850_TPTC2_BASE + SZ_1K - 1,
228 .flags = IORESOURCE_MEM,
229 },
230 {
231 .name = "edma0",
232 .start = IRQ_DA8XX_CCINT0,
233 .flags = IORESOURCE_IRQ,
234 },
235 {
236 .name = "edma0_err",
237 .start = IRQ_DA8XX_CCERRINT,
238 .flags = IORESOURCE_IRQ,
239 },
240 {
241 .name = "edma1",
242 .start = IRQ_DA850_CCINT1,
243 .flags = IORESOURCE_IRQ,
244 },
245 {
246 .name = "edma1_err",
247 .start = IRQ_DA850_CCERRINT1,
248 .flags = IORESOURCE_IRQ,
249 },
250};
251
252static struct platform_device da830_edma_device = {
Mark A. Greer55c79a42009-06-03 18:36:54 -0700253 .name = "edma",
254 .id = -1,
255 .dev = {
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530256 .platform_data = da830_edma_info,
Mark A. Greer55c79a42009-06-03 18:36:54 -0700257 },
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530258 .num_resources = ARRAY_SIZE(da830_edma_resources),
259 .resource = da830_edma_resources,
260};
261
262static struct platform_device da850_edma_device = {
263 .name = "edma",
264 .id = -1,
265 .dev = {
266 .platform_data = da850_edma_info,
267 },
268 .num_resources = ARRAY_SIZE(da850_edma_resources),
269 .resource = da850_edma_resources,
Mark A. Greer55c79a42009-06-03 18:36:54 -0700270};
271
Rajashekhara, Sudhakara941c502010-06-29 11:35:14 +0530272int __init da830_register_edma(struct edma_rsv_info *rsv)
Mark A. Greer55c79a42009-06-03 18:36:54 -0700273{
Rajashekhara, Sudhakara941c502010-06-29 11:35:14 +0530274 da830_edma_cc0_info.rsv = rsv;
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530275
Rajashekhara, Sudhakara941c502010-06-29 11:35:14 +0530276 return platform_device_register(&da830_edma_device);
277}
Sudhakar Rajashekhara3f995f22010-01-06 17:30:06 +0530278
Rajashekhara, Sudhakara941c502010-06-29 11:35:14 +0530279int __init da850_register_edma(struct edma_rsv_info *rsv[2])
280{
281 if (rsv) {
282 da850_edma_cc_info[0].rsv = rsv[0];
283 da850_edma_cc_info[1].rsv = rsv[1];
284 }
285
286 return platform_device_register(&da850_edma_device);
Mark A. Greer55c79a42009-06-03 18:36:54 -0700287}
288
289static struct resource da8xx_i2c_resources0[] = {
290 {
291 .start = DA8XX_I2C0_BASE,
292 .end = DA8XX_I2C0_BASE + SZ_4K - 1,
293 .flags = IORESOURCE_MEM,
294 },
295 {
296 .start = IRQ_DA8XX_I2CINT0,
297 .end = IRQ_DA8XX_I2CINT0,
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302static struct platform_device da8xx_i2c_device0 = {
303 .name = "i2c_davinci",
304 .id = 1,
305 .num_resources = ARRAY_SIZE(da8xx_i2c_resources0),
306 .resource = da8xx_i2c_resources0,
307};
308
309static struct resource da8xx_i2c_resources1[] = {
310 {
311 .start = DA8XX_I2C1_BASE,
312 .end = DA8XX_I2C1_BASE + SZ_4K - 1,
313 .flags = IORESOURCE_MEM,
314 },
315 {
316 .start = IRQ_DA8XX_I2CINT1,
317 .end = IRQ_DA8XX_I2CINT1,
318 .flags = IORESOURCE_IRQ,
319 },
320};
321
322static struct platform_device da8xx_i2c_device1 = {
323 .name = "i2c_davinci",
324 .id = 2,
325 .num_resources = ARRAY_SIZE(da8xx_i2c_resources1),
326 .resource = da8xx_i2c_resources1,
327};
328
329int __init da8xx_register_i2c(int instance,
330 struct davinci_i2c_platform_data *pdata)
331{
332 struct platform_device *pdev;
333
334 if (instance == 0)
335 pdev = &da8xx_i2c_device0;
336 else if (instance == 1)
337 pdev = &da8xx_i2c_device1;
338 else
339 return -EINVAL;
340
341 pdev->dev.platform_data = pdata;
342 return platform_device_register(pdev);
343}
344
345static struct resource da8xx_watchdog_resources[] = {
346 {
347 .start = DA8XX_WDOG_BASE,
348 .end = DA8XX_WDOG_BASE + SZ_4K - 1,
349 .flags = IORESOURCE_MEM,
350 },
351};
352
Cyril Chemparathyc78a5bc2010-05-01 18:38:28 -0400353struct platform_device da8xx_wdt_device = {
Mark A. Greer55c79a42009-06-03 18:36:54 -0700354 .name = "watchdog",
355 .id = -1,
356 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources),
357 .resource = da8xx_watchdog_resources,
358};
359
360int __init da8xx_register_watchdog(void)
361{
Cyril Chemparathyc78a5bc2010-05-01 18:38:28 -0400362 return platform_device_register(&da8xx_wdt_device);
Mark A. Greer55c79a42009-06-03 18:36:54 -0700363}
364
365static struct resource da8xx_emac_resources[] = {
366 {
367 .start = DA8XX_EMAC_CPPI_PORT_BASE,
Cyril Chemparathyd22960c2010-09-15 10:11:22 -0400368 .end = DA8XX_EMAC_CPPI_PORT_BASE + SZ_16K - 1,
Mark A. Greer55c79a42009-06-03 18:36:54 -0700369 .flags = IORESOURCE_MEM,
370 },
371 {
372 .start = IRQ_DA8XX_C0_RX_THRESH_PULSE,
373 .end = IRQ_DA8XX_C0_RX_THRESH_PULSE,
374 .flags = IORESOURCE_IRQ,
375 },
376 {
377 .start = IRQ_DA8XX_C0_RX_PULSE,
378 .end = IRQ_DA8XX_C0_RX_PULSE,
379 .flags = IORESOURCE_IRQ,
380 },
381 {
382 .start = IRQ_DA8XX_C0_TX_PULSE,
383 .end = IRQ_DA8XX_C0_TX_PULSE,
384 .flags = IORESOURCE_IRQ,
385 },
386 {
387 .start = IRQ_DA8XX_C0_MISC_PULSE,
388 .end = IRQ_DA8XX_C0_MISC_PULSE,
389 .flags = IORESOURCE_IRQ,
390 },
391};
392
393struct emac_platform_data da8xx_emac_pdata = {
394 .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET,
395 .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET,
396 .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET,
Mark A. Greer55c79a42009-06-03 18:36:54 -0700397 .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE,
398 .version = EMAC_VERSION_2,
399};
400
401static struct platform_device da8xx_emac_device = {
402 .name = "davinci_emac",
403 .id = 1,
404 .dev = {
405 .platform_data = &da8xx_emac_pdata,
406 },
407 .num_resources = ARRAY_SIZE(da8xx_emac_resources),
408 .resource = da8xx_emac_resources,
409};
410
Cyril Chemparathyd22960c2010-09-15 10:11:22 -0400411static struct resource da8xx_mdio_resources[] = {
412 {
413 .start = DA8XX_EMAC_MDIO_BASE,
414 .end = DA8XX_EMAC_MDIO_BASE + SZ_4K - 1,
415 .flags = IORESOURCE_MEM,
416 },
417};
418
419static struct platform_device da8xx_mdio_device = {
420 .name = "davinci_mdio",
421 .id = 0,
422 .num_resources = ARRAY_SIZE(da8xx_mdio_resources),
423 .resource = da8xx_mdio_resources,
424};
425
Mark A. Greer31f53cf2009-08-28 15:02:54 -0700426int __init da8xx_register_emac(void)
427{
Cyril Chemparathyd22960c2010-09-15 10:11:22 -0400428 int ret;
429
430 ret = platform_device_register(&da8xx_mdio_device);
431 if (ret < 0)
432 return ret;
433 ret = platform_device_register(&da8xx_emac_device);
434 if (ret < 0)
435 return ret;
436 ret = clk_add_alias(NULL, dev_name(&da8xx_mdio_device.dev),
437 NULL, &da8xx_emac_device.dev);
438 return ret;
Mark A. Greer31f53cf2009-08-28 15:02:54 -0700439}
440
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400441static struct resource da830_mcasp1_resources[] = {
442 {
443 .name = "mcasp1",
444 .start = DAVINCI_DA830_MCASP1_REG_BASE,
445 .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1,
446 .flags = IORESOURCE_MEM,
447 },
448 /* TX event */
449 {
450 .start = DAVINCI_DA830_DMA_MCASP1_AXEVT,
451 .end = DAVINCI_DA830_DMA_MCASP1_AXEVT,
452 .flags = IORESOURCE_DMA,
453 },
454 /* RX event */
455 {
456 .start = DAVINCI_DA830_DMA_MCASP1_AREVT,
457 .end = DAVINCI_DA830_DMA_MCASP1_AREVT,
458 .flags = IORESOURCE_DMA,
459 },
460};
461
462static struct platform_device da830_mcasp1_device = {
463 .name = "davinci-mcasp",
464 .id = 1,
465 .num_resources = ARRAY_SIZE(da830_mcasp1_resources),
466 .resource = da830_mcasp1_resources,
467};
468
Chaithrika U S491214e2009-08-11 17:03:25 -0400469static struct resource da850_mcasp_resources[] = {
470 {
471 .name = "mcasp",
472 .start = DAVINCI_DA8XX_MCASP0_REG_BASE,
473 .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1,
474 .flags = IORESOURCE_MEM,
475 },
476 /* TX event */
477 {
478 .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT,
479 .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT,
480 .flags = IORESOURCE_DMA,
481 },
482 /* RX event */
483 {
484 .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT,
485 .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT,
486 .flags = IORESOURCE_DMA,
487 },
488};
489
490static struct platform_device da850_mcasp_device = {
491 .name = "davinci-mcasp",
492 .id = 0,
493 .num_resources = ARRAY_SIZE(da850_mcasp_resources),
494 .resource = da850_mcasp_resources,
495};
496
Rajashekhara, Sudhakarb3d1ffb2011-01-21 21:13:06 +0530497struct platform_device davinci_pcm_device = {
498 .name = "davinci-pcm-audio",
499 .id = -1,
500};
501
Mark A. Greerb8864aa2009-08-28 15:05:02 -0700502void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400503{
Rajashekhara, Sudhakarb3d1ffb2011-01-21 21:13:06 +0530504 platform_device_register(&davinci_pcm_device);
505
Chaithrika U S491214e2009-08-11 17:03:25 -0400506 /* DA830/OMAP-L137 has 3 instances of McASP */
507 if (cpu_is_davinci_da830() && id == 1) {
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400508 da830_mcasp1_device.dev.platform_data = pdata;
509 platform_device_register(&da830_mcasp1_device);
Chaithrika U S491214e2009-08-11 17:03:25 -0400510 } else if (cpu_is_davinci_da850()) {
511 da850_mcasp_device.dev.platform_data = pdata;
512 platform_device_register(&da850_mcasp_device);
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400513 }
514}
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400515
516static const struct display_panel disp_panel = {
517 QVGA,
518 16,
519 16,
520 COLOR_ACTIVE,
521};
522
523static struct lcd_ctrl_config lcd_cfg = {
524 &disp_panel,
525 .ac_bias = 255,
526 .ac_bias_intrpt = 0,
527 .dma_burst_sz = 16,
528 .bpp = 16,
529 .fdd = 255,
530 .tft_alt_mode = 0,
531 .stn_565_mode = 0,
532 .mono_8bit_mode = 0,
533 .invert_line_clock = 1,
534 .invert_frm_clock = 1,
535 .sync_edge = 0,
536 .sync_ctrl = 1,
537 .raster_order = 0,
538};
539
Mark A. Greerb9e63422009-09-15 18:14:19 -0700540struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata = {
541 .manu_name = "sharp",
542 .controller_data = &lcd_cfg,
543 .type = "Sharp_LCD035Q3DG01",
544};
545
546struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata = {
547 .manu_name = "sharp",
548 .controller_data = &lcd_cfg,
549 .type = "Sharp_LK043T1DG01",
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400550};
551
552static struct resource da8xx_lcdc_resources[] = {
553 [0] = { /* registers */
554 .start = DA8XX_LCD_CNTRL_BASE,
555 .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1,
556 .flags = IORESOURCE_MEM,
557 },
558 [1] = { /* interrupt */
559 .start = IRQ_DA8XX_LCDINT,
560 .end = IRQ_DA8XX_LCDINT,
561 .flags = IORESOURCE_IRQ,
562 },
563};
564
Mark A. Greerb9e63422009-09-15 18:14:19 -0700565static struct platform_device da8xx_lcdc_device = {
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400566 .name = "da8xx_lcdc",
567 .id = 0,
568 .num_resources = ARRAY_SIZE(da8xx_lcdc_resources),
569 .resource = da8xx_lcdc_resources,
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400570};
571
Mark A. Greerb9e63422009-09-15 18:14:19 -0700572int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata)
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400573{
Mark A. Greerb9e63422009-09-15 18:14:19 -0700574 da8xx_lcdc_device.dev.platform_data = pdata;
575 return platform_device_register(&da8xx_lcdc_device);
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400576}
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400577
578static struct resource da8xx_mmcsd0_resources[] = {
579 { /* registers */
580 .start = DA8XX_MMCSD0_BASE,
581 .end = DA8XX_MMCSD0_BASE + SZ_4K - 1,
582 .flags = IORESOURCE_MEM,
583 },
584 { /* interrupt */
585 .start = IRQ_DA8XX_MMCSDINT0,
586 .end = IRQ_DA8XX_MMCSDINT0,
587 .flags = IORESOURCE_IRQ,
588 },
589 { /* DMA RX */
Michael Williamsone38c2b22011-02-22 13:36:57 +0000590 .start = DA8XX_DMA_MMCSD0_RX,
591 .end = DA8XX_DMA_MMCSD0_RX,
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400592 .flags = IORESOURCE_DMA,
593 },
594 { /* DMA TX */
Michael Williamsone38c2b22011-02-22 13:36:57 +0000595 .start = DA8XX_DMA_MMCSD0_TX,
596 .end = DA8XX_DMA_MMCSD0_TX,
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400597 .flags = IORESOURCE_DMA,
598 },
599};
600
601static struct platform_device da8xx_mmcsd0_device = {
602 .name = "davinci_mmc",
603 .id = 0,
604 .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources),
605 .resource = da8xx_mmcsd0_resources,
606};
607
608int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)
609{
610 da8xx_mmcsd0_device.dev.platform_data = config;
611 return platform_device_register(&da8xx_mmcsd0_device);
612}
Mark A. Greerc51df702009-09-15 18:15:54 -0700613
Juha Kuikkab8241ae2010-08-26 12:40:47 -0700614#ifdef CONFIG_ARCH_DAVINCI_DA850
615static struct resource da850_mmcsd1_resources[] = {
616 { /* registers */
617 .start = DA850_MMCSD1_BASE,
618 .end = DA850_MMCSD1_BASE + SZ_4K - 1,
619 .flags = IORESOURCE_MEM,
620 },
621 { /* interrupt */
622 .start = IRQ_DA850_MMCSDINT0_1,
623 .end = IRQ_DA850_MMCSDINT0_1,
624 .flags = IORESOURCE_IRQ,
625 },
626 { /* DMA RX */
Michael Williamsone38c2b22011-02-22 13:36:57 +0000627 .start = DA850_DMA_MMCSD1_RX,
628 .end = DA850_DMA_MMCSD1_RX,
Juha Kuikkab8241ae2010-08-26 12:40:47 -0700629 .flags = IORESOURCE_DMA,
630 },
631 { /* DMA TX */
Michael Williamsone38c2b22011-02-22 13:36:57 +0000632 .start = DA850_DMA_MMCSD1_TX,
633 .end = DA850_DMA_MMCSD1_TX,
Juha Kuikkab8241ae2010-08-26 12:40:47 -0700634 .flags = IORESOURCE_DMA,
635 },
636};
637
638static struct platform_device da850_mmcsd1_device = {
639 .name = "davinci_mmc",
640 .id = 1,
641 .num_resources = ARRAY_SIZE(da850_mmcsd1_resources),
642 .resource = da850_mmcsd1_resources,
643};
644
645int __init da850_register_mmcsd1(struct davinci_mmc_config *config)
646{
647 da850_mmcsd1_device.dev.platform_data = config;
648 return platform_device_register(&da850_mmcsd1_device);
649}
650#endif
651
Mark A. Greerc51df702009-09-15 18:15:54 -0700652static struct resource da8xx_rtc_resources[] = {
653 {
654 .start = DA8XX_RTC_BASE,
655 .end = DA8XX_RTC_BASE + SZ_4K - 1,
656 .flags = IORESOURCE_MEM,
657 },
658 { /* timer irq */
659 .start = IRQ_DA8XX_RTC,
660 .end = IRQ_DA8XX_RTC,
661 .flags = IORESOURCE_IRQ,
662 },
663 { /* alarm irq */
664 .start = IRQ_DA8XX_RTC,
665 .end = IRQ_DA8XX_RTC,
666 .flags = IORESOURCE_IRQ,
667 },
668};
669
670static struct platform_device da8xx_rtc_device = {
671 .name = "omap_rtc",
672 .id = -1,
673 .num_resources = ARRAY_SIZE(da8xx_rtc_resources),
674 .resource = da8xx_rtc_resources,
675};
676
677int da8xx_register_rtc(void)
678{
Sekhar Nori75c99bb2009-11-16 17:21:31 +0530679 int ret;
Cyril Chemparathydb6db5d2010-05-07 17:06:33 -0400680 void __iomem *base;
681
682 base = ioremap(DA8XX_RTC_BASE, SZ_4K);
683 if (WARN_ON(!base))
684 return -ENOMEM;
Sekhar Nori75c99bb2009-11-16 17:21:31 +0530685
Mark A. Greerc51df702009-09-15 18:15:54 -0700686 /* Unlock the rtc's registers */
Cyril Chemparathydb6db5d2010-05-07 17:06:33 -0400687 __raw_writel(0x83e70b13, base + 0x6c);
688 __raw_writel(0x95a4f1e0, base + 0x70);
689
690 iounmap(base);
Mark A. Greerc51df702009-09-15 18:15:54 -0700691
Sekhar Nori75c99bb2009-11-16 17:21:31 +0530692 ret = platform_device_register(&da8xx_rtc_device);
693 if (!ret)
694 /* Atleast on DA850, RTC is a wakeup source */
695 device_init_wakeup(&da8xx_rtc_device.dev, true);
696
697 return ret;
Mark A. Greerc51df702009-09-15 18:15:54 -0700698}
Sekhar Nori1960e692009-10-22 15:12:14 +0530699
Sekhar Nori948c66d2009-11-16 17:21:37 +0530700static void __iomem *da8xx_ddr2_ctlr_base;
701void __iomem * __init da8xx_get_mem_ctlr(void)
702{
703 if (da8xx_ddr2_ctlr_base)
704 return da8xx_ddr2_ctlr_base;
705
706 da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K);
707 if (!da8xx_ddr2_ctlr_base)
708 pr_warning("%s: Unable to map DDR2 controller", __func__);
709
710 return da8xx_ddr2_ctlr_base;
711}
712
Sekhar Nori1960e692009-10-22 15:12:14 +0530713static struct resource da8xx_cpuidle_resources[] = {
714 {
715 .start = DA8XX_DDR2_CTL_BASE,
716 .end = DA8XX_DDR2_CTL_BASE + SZ_32K - 1,
717 .flags = IORESOURCE_MEM,
718 },
719};
720
721/* DA8XX devices support DDR2 power down */
722static struct davinci_cpuidle_config da8xx_cpuidle_pdata = {
723 .ddr2_pdown = 1,
724};
725
726
727static struct platform_device da8xx_cpuidle_device = {
728 .name = "cpuidle-davinci",
729 .num_resources = ARRAY_SIZE(da8xx_cpuidle_resources),
730 .resource = da8xx_cpuidle_resources,
731 .dev = {
732 .platform_data = &da8xx_cpuidle_pdata,
733 },
734};
735
736int __init da8xx_register_cpuidle(void)
737{
Sekhar Nori948c66d2009-11-16 17:21:37 +0530738 da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr();
739
Sekhar Nori1960e692009-10-22 15:12:14 +0530740 return platform_device_register(&da8xx_cpuidle_device);
741}
Michael Williamson54ce6882011-02-24 10:18:28 +0530742
743static struct resource da8xx_spi0_resources[] = {
744 [0] = {
745 .start = DA8XX_SPI0_BASE,
746 .end = DA8XX_SPI0_BASE + SZ_4K - 1,
747 .flags = IORESOURCE_MEM,
748 },
749 [1] = {
750 .start = IRQ_DA8XX_SPINT0,
751 .end = IRQ_DA8XX_SPINT0,
752 .flags = IORESOURCE_IRQ,
753 },
754 [2] = {
755 .start = DA8XX_DMA_SPI0_RX,
756 .end = DA8XX_DMA_SPI0_RX,
757 .flags = IORESOURCE_DMA,
758 },
759 [3] = {
760 .start = DA8XX_DMA_SPI0_TX,
761 .end = DA8XX_DMA_SPI0_TX,
762 .flags = IORESOURCE_DMA,
763 },
764};
765
766static struct resource da8xx_spi1_resources[] = {
767 [0] = {
Sergei Shtylyov9e7d24f2011-04-06 17:17:21 +0000768 .start = DA830_SPI1_BASE,
769 .end = DA830_SPI1_BASE + SZ_4K - 1,
Michael Williamson54ce6882011-02-24 10:18:28 +0530770 .flags = IORESOURCE_MEM,
771 },
772 [1] = {
773 .start = IRQ_DA8XX_SPINT1,
774 .end = IRQ_DA8XX_SPINT1,
775 .flags = IORESOURCE_IRQ,
776 },
777 [2] = {
778 .start = DA8XX_DMA_SPI1_RX,
779 .end = DA8XX_DMA_SPI1_RX,
780 .flags = IORESOURCE_DMA,
781 },
782 [3] = {
783 .start = DA8XX_DMA_SPI1_TX,
784 .end = DA8XX_DMA_SPI1_TX,
785 .flags = IORESOURCE_DMA,
786 },
787};
788
789struct davinci_spi_platform_data da8xx_spi_pdata[] = {
790 [0] = {
791 .version = SPI_VERSION_2,
792 .intr_line = 1,
793 .dma_event_q = EVENTQ_0,
794 },
795 [1] = {
796 .version = SPI_VERSION_2,
797 .intr_line = 1,
798 .dma_event_q = EVENTQ_0,
799 },
800};
801
802static struct platform_device da8xx_spi_device[] = {
803 [0] = {
804 .name = "spi_davinci",
805 .id = 0,
806 .num_resources = ARRAY_SIZE(da8xx_spi0_resources),
807 .resource = da8xx_spi0_resources,
808 .dev = {
809 .platform_data = &da8xx_spi_pdata[0],
810 },
811 },
812 [1] = {
813 .name = "spi_davinci",
814 .id = 1,
815 .num_resources = ARRAY_SIZE(da8xx_spi1_resources),
816 .resource = da8xx_spi1_resources,
817 .dev = {
818 .platform_data = &da8xx_spi_pdata[1],
819 },
820 },
821};
822
823int __init da8xx_register_spi(int instance, struct spi_board_info *info,
824 unsigned len)
825{
826 int ret;
827
828 if (instance < 0 || instance > 1)
829 return -EINVAL;
830
831 ret = spi_register_board_info(info, len);
832 if (ret)
833 pr_warning("%s: failed to register board info for spi %d :"
834 " %d\n", __func__, instance, ret);
835
836 da8xx_spi_pdata[instance].num_chipselect = len;
837
Sergei Shtylyov9e7d24f2011-04-06 17:17:21 +0000838 if (instance == 1 && cpu_is_davinci_da850()) {
839 da8xx_spi1_resources[0].start = DA850_SPI1_BASE;
840 da8xx_spi1_resources[0].end = DA850_SPI1_BASE + SZ_4K - 1;
841 }
842
Michael Williamson54ce6882011-02-24 10:18:28 +0530843 return platform_device_register(&da8xx_spi_device[instance]);
844}