blob: 53e434ba626d7f8a9349e9a702e1c8f6f7db6b32 [file] [log] [blame]
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -04001/*
2 * TI DA850/OMAP-L138 EVM board
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Derived from: arch/arm/mach-davinci/board-da830-evm.c
7 * Original Copyrights follow:
8 *
9 * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 */
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/console.h>
18#include <linux/i2c.h>
19#include <linux/i2c/at24.h>
Chaithrika U S75e2ea62009-09-30 17:00:28 -040020#include <linux/i2c/pca953x.h>
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -040021#include <linux/gpio.h>
Sudhakar Rajashekhara38beb922009-08-13 16:21:11 -040022#include <linux/platform_device.h>
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/nand.h>
25#include <linux/mtd/partitions.h>
Sudhakar Rajashekhara7c5ec602009-08-13 17:36:25 -040026#include <linux/mtd/physmap.h>
Sekhar Noria9eb1f62009-09-22 21:14:04 +053027#include <linux/regulator/machine.h>
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -040028
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31
32#include <mach/common.h>
33#include <mach/irqs.h>
34#include <mach/cp_intc.h>
35#include <mach/da8xx.h>
Sudhakar Rajashekhara38beb922009-08-13 16:21:11 -040036#include <mach/nand.h>
Sudhakar Rajashekhara7761ef62009-09-15 17:46:14 -040037#include <mach/mux.h>
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -040038
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -040039#define DA850_EVM_PHY_MASK 0x1
40#define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
41
Sudhakar Rajashekhara7761ef62009-09-15 17:46:14 -040042#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -040043#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -040044
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -040045#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
46#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
47
Chaithrika U S22067712009-09-30 17:00:53 -040048#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
49
Sudhakar Rajashekhara7c5ec602009-08-13 17:36:25 -040050static struct mtd_partition da850_evm_norflash_partition[] = {
51 {
52 .name = "NOR filesystem",
53 .offset = 0,
54 .size = MTDPART_SIZ_FULL,
55 .mask_flags = 0,
56 },
57};
58
59static struct physmap_flash_data da850_evm_norflash_data = {
60 .width = 2,
61 .parts = da850_evm_norflash_partition,
62 .nr_parts = ARRAY_SIZE(da850_evm_norflash_partition),
63};
64
65static struct resource da850_evm_norflash_resource[] = {
66 {
67 .start = DA8XX_AEMIF_CS2_BASE,
68 .end = DA8XX_AEMIF_CS2_BASE + SZ_32M - 1,
69 .flags = IORESOURCE_MEM,
70 },
71};
72
73static struct platform_device da850_evm_norflash_device = {
74 .name = "physmap-flash",
75 .id = 0,
76 .dev = {
77 .platform_data = &da850_evm_norflash_data,
78 },
79 .num_resources = 1,
80 .resource = da850_evm_norflash_resource,
81};
82
Sudhakar Rajashekhara38beb922009-08-13 16:21:11 -040083/* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
84 * (128K blocks). It may be used instead of the (default) SPI flash
85 * to boot, using TI's tools to install the secondary boot loader
86 * (UBL) and U-Boot.
87 */
88struct mtd_partition da850_evm_nandflash_partition[] = {
89 {
90 .name = "u-boot env",
91 .offset = 0,
92 .size = SZ_128K,
93 .mask_flags = MTD_WRITEABLE,
94 },
95 {
96 .name = "UBL",
97 .offset = MTDPART_OFS_APPEND,
98 .size = SZ_128K,
99 .mask_flags = MTD_WRITEABLE,
100 },
101 {
102 .name = "u-boot",
103 .offset = MTDPART_OFS_APPEND,
104 .size = 4 * SZ_128K,
105 .mask_flags = MTD_WRITEABLE,
106 },
107 {
108 .name = "kernel",
109 .offset = 0x200000,
110 .size = SZ_2M,
111 .mask_flags = 0,
112 },
113 {
114 .name = "filesystem",
115 .offset = MTDPART_OFS_APPEND,
116 .size = MTDPART_SIZ_FULL,
117 .mask_flags = 0,
118 },
119};
120
121static struct davinci_nand_pdata da850_evm_nandflash_data = {
122 .parts = da850_evm_nandflash_partition,
123 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
124 .ecc_mode = NAND_ECC_HW,
125 .options = NAND_USE_FLASH_BBT,
126};
127
128static struct resource da850_evm_nandflash_resource[] = {
129 {
130 .start = DA8XX_AEMIF_CS3_BASE,
131 .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
132 .flags = IORESOURCE_MEM,
133 },
134 {
135 .start = DA8XX_AEMIF_CTL_BASE,
136 .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
137 .flags = IORESOURCE_MEM,
138 },
139};
140
141static struct platform_device da850_evm_nandflash_device = {
142 .name = "davinci_nand",
143 .id = 1,
144 .dev = {
145 .platform_data = &da850_evm_nandflash_data,
146 },
147 .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource),
148 .resource = da850_evm_nandflash_resource,
149};
150
Chaithrika U S75e2ea62009-09-30 17:00:28 -0400151static u32 ui_card_detected;
152static void da850_evm_setup_nor_nand(void);
153
154static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
155 unsigned ngpio, void *c)
156{
Chaithrika U S22067712009-09-30 17:00:53 -0400157 struct davinci_soc_info *soc_info = &davinci_soc_info;
Chaithrika U S75e2ea62009-09-30 17:00:28 -0400158 int sel_a, sel_b, sel_c, ret;
159
160 sel_a = gpio + 7;
161 sel_b = gpio + 6;
162 sel_c = gpio + 5;
163
164 ret = gpio_request(sel_a, "sel_a");
165 if (ret) {
166 pr_warning("Cannot open UI expander pin %d\n", sel_a);
167 goto exp_setup_sela_fail;
168 }
169
170 ret = gpio_request(sel_b, "sel_b");
171 if (ret) {
172 pr_warning("Cannot open UI expander pin %d\n", sel_b);
173 goto exp_setup_selb_fail;
174 }
175
176 ret = gpio_request(sel_c, "sel_c");
177 if (ret) {
178 pr_warning("Cannot open UI expander pin %d\n", sel_c);
179 goto exp_setup_selc_fail;
180 }
181
182 /* deselect all functionalities */
183 gpio_direction_output(sel_a, 1);
184 gpio_direction_output(sel_b, 1);
185 gpio_direction_output(sel_c, 1);
186
187 ui_card_detected = 1;
188 pr_info("DA850/OMAP-L138 EVM UI card detected\n");
189
190 da850_evm_setup_nor_nand();
191
Chaithrika U S22067712009-09-30 17:00:53 -0400192 if (soc_info->emac_pdata->rmii_en)
193 /* enable RMII */
194 gpio_set_value(sel_a, 0);
195
Chaithrika U S75e2ea62009-09-30 17:00:28 -0400196 return 0;
197
198exp_setup_selc_fail:
199 gpio_free(sel_b);
200exp_setup_selb_fail:
201 gpio_free(sel_a);
202exp_setup_sela_fail:
203 return ret;
204}
205
206static int da850_evm_ui_expander_teardown(struct i2c_client *client,
207 unsigned gpio, unsigned ngpio, void *c)
208{
209 /* deselect all functionalities */
210 gpio_set_value(gpio + 5, 1);
211 gpio_set_value(gpio + 6, 1);
212 gpio_set_value(gpio + 7, 1);
213
214 gpio_free(gpio + 5);
215 gpio_free(gpio + 6);
216 gpio_free(gpio + 7);
217
218 return 0;
219}
220
221static struct pca953x_platform_data da850_evm_ui_expander_info = {
222 .gpio_base = DAVINCI_N_GPIO,
223 .setup = da850_evm_ui_expander_setup,
224 .teardown = da850_evm_ui_expander_teardown,
225};
226
Chaithrika U S1a7ff8f2009-08-25 15:20:05 +0300227static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
228 {
229 I2C_BOARD_INFO("tlv320aic3x", 0x18),
Chaithrika U S75e2ea62009-09-30 17:00:28 -0400230 },
231 {
232 I2C_BOARD_INFO("tca6416", 0x20),
233 .platform_data = &da850_evm_ui_expander_info,
234 },
Chaithrika U S1a7ff8f2009-08-25 15:20:05 +0300235};
236
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400237static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
238 .bus_freq = 100, /* kHz */
239 .bus_delay = 0, /* usec */
240};
241
242static struct davinci_uart_config da850_evm_uart_config __initdata = {
243 .enabled_uarts = 0x7,
244};
245
Sudhakar Rajashekhara38beb922009-08-13 16:21:11 -0400246static struct platform_device *da850_evm_devices[] __initdata = {
247 &da850_evm_nandflash_device,
Sudhakar Rajashekhara7c5ec602009-08-13 17:36:25 -0400248 &da850_evm_norflash_device,
Sudhakar Rajashekhara38beb922009-08-13 16:21:11 -0400249};
250
Chaithrika U S491214e2009-08-11 17:03:25 -0400251/* davinci da850 evm audio machine driver */
252static u8 da850_iis_serializer_direction[] = {
253 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
254 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
255 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE,
256 RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
257};
258
259static struct snd_platform_data da850_evm_snd_data = {
260 .tx_dma_offset = 0x2000,
261 .rx_dma_offset = 0x2000,
262 .op_mode = DAVINCI_MCASP_IIS_MODE,
263 .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
264 .tdm_slots = 2,
265 .serial_dir = da850_iis_serializer_direction,
266 .eventq_no = EVENTQ_1,
267 .version = MCASP_VERSION_2,
268 .txnumevt = 1,
269 .rxnumevt = 1,
270};
271
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400272static int da850_evm_mmc_get_ro(int index)
273{
274 return gpio_get_value(DA850_MMCSD_WP_PIN);
275}
276
277static int da850_evm_mmc_get_cd(int index)
278{
279 return !gpio_get_value(DA850_MMCSD_CD_PIN);
280}
281
282static struct davinci_mmc_config da850_mmc_config = {
283 .get_ro = da850_evm_mmc_get_ro,
284 .get_cd = da850_evm_mmc_get_cd,
285 .wires = 4,
286 .version = MMC_CTLR_VERSION_2,
287};
288
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400289static int da850_lcd_hw_init(void)
290{
291 int status;
292
293 status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
294 if (status < 0)
295 return status;
296
297 status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
298 if (status < 0) {
299 gpio_free(DA850_LCD_BL_PIN);
300 return status;
301 }
302
303 gpio_direction_output(DA850_LCD_BL_PIN, 0);
304 gpio_direction_output(DA850_LCD_PWR_PIN, 0);
305
306 /* disable lcd backlight */
307 gpio_set_value(DA850_LCD_BL_PIN, 0);
308
309 /* disable lcd power */
310 gpio_set_value(DA850_LCD_PWR_PIN, 0);
311
312 /* enable lcd power */
313 gpio_set_value(DA850_LCD_PWR_PIN, 1);
314
315 /* enable lcd backlight */
316 gpio_set_value(DA850_LCD_BL_PIN, 1);
317
318 return 0;
319}
Chaithrika U S491214e2009-08-11 17:03:25 -0400320
Sudhakar Rajashekhara7c5ec602009-08-13 17:36:25 -0400321#define DA8XX_AEMIF_CE2CFG_OFFSET 0x10
322#define DA8XX_AEMIF_ASIZE_16BIT 0x1
323
324static void __init da850_evm_init_nor(void)
325{
326 void __iomem *aemif_addr;
327
328 aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
329
330 /* Configure data bus width of CS2 to 16 bit */
331 writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
332 DA8XX_AEMIF_ASIZE_16BIT,
333 aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
334
335 iounmap(aemif_addr);
336}
337
Sekhar Noria9eb1f62009-09-22 21:14:04 +0530338/* TPS65070 voltage regulator support */
339
340/* 3.3V */
341struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
342 {
343 .supply = "usb0_vdda33",
344 },
345 {
346 .supply = "usb1_vdda33",
347 },
348};
349
350/* 3.3V or 1.8V */
351struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
352 {
353 .supply = "dvdd3318_a",
354 },
355 {
356 .supply = "dvdd3318_b",
357 },
358 {
359 .supply = "dvdd3318_c",
360 },
361};
362
363/* 1.2V */
364struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
365 {
366 .supply = "cvdd",
367 },
368};
369
370/* 1.8V LDO */
371struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
372 {
373 .supply = "sata_vddr",
374 },
375 {
376 .supply = "usb0_vdda18",
377 },
378 {
379 .supply = "usb1_vdda18",
380 },
381 {
382 .supply = "ddr_dvdd18",
383 },
384};
385
386/* 1.2V LDO */
387struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
388 {
389 .supply = "sata_vdd",
390 },
391 {
392 .supply = "pll0_vdda",
393 },
394 {
395 .supply = "pll1_vdda",
396 },
397 {
398 .supply = "usbs_cvdd",
399 },
400 {
401 .supply = "vddarnwa1",
402 },
403};
404
405struct regulator_init_data tps65070_regulator_data[] = {
406 /* dcdc1 */
407 {
408 .constraints = {
409 .min_uV = 3150000,
410 .max_uV = 3450000,
411 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
412 REGULATOR_CHANGE_STATUS),
413 .boot_on = 1,
414 },
415 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers),
416 .consumer_supplies = tps65070_dcdc1_consumers,
417 },
418
419 /* dcdc2 */
420 {
421 .constraints = {
422 .min_uV = 1710000,
423 .max_uV = 3450000,
424 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
425 REGULATOR_CHANGE_STATUS),
426 .boot_on = 1,
427 },
428 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
429 .consumer_supplies = tps65070_dcdc2_consumers,
430 },
431
432 /* dcdc3 */
433 {
434 .constraints = {
435 .min_uV = 950000,
436 .max_uV = 1320000,
437 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
438 REGULATOR_CHANGE_STATUS),
439 .boot_on = 1,
440 },
441 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
442 .consumer_supplies = tps65070_dcdc3_consumers,
443 },
444
445 /* ldo1 */
446 {
447 .constraints = {
448 .min_uV = 1710000,
449 .max_uV = 1890000,
450 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
451 REGULATOR_CHANGE_STATUS),
452 .boot_on = 1,
453 },
454 .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers),
455 .consumer_supplies = tps65070_ldo1_consumers,
456 },
457
458 /* ldo2 */
459 {
460 .constraints = {
461 .min_uV = 1140000,
462 .max_uV = 1320000,
463 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
464 REGULATOR_CHANGE_STATUS),
465 .boot_on = 1,
466 },
467 .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers),
468 .consumer_supplies = tps65070_ldo2_consumers,
469 },
470};
471
472static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
473 {
474 I2C_BOARD_INFO("tps6507x", 0x48),
475 .platform_data = &tps65070_regulator_data[0],
476 },
477};
478
479static int __init pmic_tps65070_init(void)
480{
481 return i2c_register_board_info(1, da850evm_tps65070_info,
482 ARRAY_SIZE(da850evm_tps65070_info));
483}
484
Sudhakar Rajashekhara820c4fe2009-08-13 18:16:28 -0400485#if defined(CONFIG_MMC_DAVINCI) || \
486 defined(CONFIG_MMC_DAVINCI_MODULE)
487#define HAS_MMC 1
488#else
489#define HAS_MMC 0
490#endif
491
Chaithrika U S75e2ea62009-09-30 17:00:28 -0400492static void da850_evm_setup_nor_nand(void)
493{
494 int ret = 0;
495
496 if (ui_card_detected & !HAS_MMC) {
497 ret = da8xx_pinmux_setup(da850_nand_pins);
498 if (ret)
499 pr_warning("da850_evm_init: nand mux setup failed: "
500 "%d\n", ret);
501
502 ret = da8xx_pinmux_setup(da850_nor_pins);
503 if (ret)
504 pr_warning("da850_evm_init: nor mux setup failed: %d\n",
505 ret);
506
507 da850_evm_init_nor();
508
509 platform_add_devices(da850_evm_devices,
510 ARRAY_SIZE(da850_evm_devices));
511 }
512}
513
Sudhakar Rajashekhara7761ef62009-09-15 17:46:14 -0400514static const short da850_evm_lcdc_pins[] = {
515 DA850_GPIO2_8, DA850_GPIO2_15,
516 -1
517};
518
Chaithrika U S22067712009-09-30 17:00:53 -0400519static int __init da850_evm_config_emac(u8 rmii_en)
520{
521 void __iomem *cfg_chip3_base;
522 int ret;
523 u32 val;
524
525 cfg_chip3_base = DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG);
526
527 /* configure the CFGCHIP3 register for RMII or MII */
528 val = __raw_readl(cfg_chip3_base);
529 if (rmii_en)
530 val |= BIT(8);
531 else
532 val &= ~BIT(8);
533
534 __raw_writel(val, cfg_chip3_base);
535
536 if (!rmii_en)
537 ret = da8xx_pinmux_setup(da850_cpgmac_pins);
538 else
539 ret = da8xx_pinmux_setup(da850_rmii_pins);
540 if (ret)
541 pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
542 ret);
543
544 ret = davinci_cfg_reg(DA850_GPIO2_6);
545 if (ret)
546 pr_warning("da850_evm_init:GPIO(2,6) mux setup "
547 "failed\n");
548
549 ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
550 if (ret) {
551 pr_warning("Cannot open GPIO %d\n",
552 DA850_MII_MDIO_CLKEN_PIN);
553 return ret;
554 }
555
556 if (rmii_en) {
557 /* Disable MII MDIO clock */
558 gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 1);
559 pr_info("EMAC: RMII PHY configured, MII PHY will not be"
560 " functional\n");
561 } else {
562 /* Enable MII MDIO clock */
563 gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 0);
564 pr_info("EMAC: MII PHY configured, RMII PHY will not be"
565 " functional\n");
566 }
567
568 return 0;
569}
570
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400571static __init void da850_evm_init(void)
572{
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400573 struct davinci_soc_info *soc_info = &davinci_soc_info;
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400574 int ret;
575
Sekhar Noria9eb1f62009-09-22 21:14:04 +0530576 ret = pmic_tps65070_init();
577 if (ret)
578 pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n",
579 ret);
580
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400581 ret = da8xx_register_edma();
582 if (ret)
583 pr_warning("da850_evm_init: edma registration failed: %d\n",
584 ret);
585
586 ret = da8xx_pinmux_setup(da850_i2c0_pins);
587 if (ret)
588 pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
589 ret);
590
591 ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata);
592 if (ret)
593 pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
594 ret);
595
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400596 soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK;
597 soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY;
Chaithrika U S22067712009-09-30 17:00:53 -0400598#ifdef CONFIG_DA850_UI_RMII
599 soc_info->emac_pdata->rmii_en = 1;
600#else
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400601 soc_info->emac_pdata->rmii_en = 0;
Chaithrika U S22067712009-09-30 17:00:53 -0400602#endif
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400603
Chaithrika U S22067712009-09-30 17:00:53 -0400604 ret = da850_evm_config_emac(soc_info->emac_pdata->rmii_en);
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400605 if (ret)
Chaithrika U S22067712009-09-30 17:00:53 -0400606 pr_warning("da850_evm_init: emac setup failed: %d\n", ret);
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400607
608 ret = da8xx_register_emac();
609 if (ret)
610 pr_warning("da850_evm_init: emac registration failed: %d\n",
611 ret);
612
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400613 ret = da8xx_register_watchdog();
614 if (ret)
615 pr_warning("da830_evm_init: watchdog registration failed: %d\n",
616 ret);
617
Sudhakar Rajashekhara820c4fe2009-08-13 18:16:28 -0400618 if (HAS_MMC) {
Sudhakar Rajashekhara820c4fe2009-08-13 18:16:28 -0400619 ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
620 if (ret)
621 pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
622 " %d\n", ret);
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400623
Sudhakar Rajashekhara820c4fe2009-08-13 18:16:28 -0400624 ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
625 if (ret)
626 pr_warning("da850_evm_init: can not open GPIO %d\n",
627 DA850_MMCSD_CD_PIN);
628 gpio_direction_input(DA850_MMCSD_CD_PIN);
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400629
Sudhakar Rajashekhara820c4fe2009-08-13 18:16:28 -0400630 ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
631 if (ret)
632 pr_warning("da850_evm_init: can not open GPIO %d\n",
633 DA850_MMCSD_WP_PIN);
634 gpio_direction_input(DA850_MMCSD_WP_PIN);
635
636 ret = da8xx_register_mmcsd0(&da850_mmc_config);
637 if (ret)
638 pr_warning("da850_evm_init: mmcsd0 registration failed:"
639 " %d\n", ret);
640 }
Sudhakar Rajashekhara700691f2009-08-13 15:16:23 -0400641
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400642 davinci_serial_init(&da850_evm_uart_config);
643
Chaithrika U S1a7ff8f2009-08-25 15:20:05 +0300644 i2c_register_board_info(1, da850_evm_i2c_devices,
645 ARRAY_SIZE(da850_evm_i2c_devices));
646
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400647 /*
648 * shut down uart 0 and 1; they are not used on the board and
649 * accessing them causes endless "too much work in irq53" messages
650 * with arago fs
651 */
652 __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
653 __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
Chaithrika U S491214e2009-08-11 17:03:25 -0400654
655 ret = da8xx_pinmux_setup(da850_mcasp_pins);
656 if (ret)
657 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
658 ret);
659
Mark A. Greerb8864aa2009-08-28 15:05:02 -0700660 da8xx_register_mcasp(0, &da850_evm_snd_data);
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400661
662 ret = da8xx_pinmux_setup(da850_lcdcntl_pins);
663 if (ret)
664 pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
665 ret);
666
Sudhakar Rajashekhara7761ef62009-09-15 17:46:14 -0400667 /* Handle board specific muxing for LCD here */
668 ret = da8xx_pinmux_setup(da850_evm_lcdc_pins);
669 if (ret)
670 pr_warning("da850_evm_init: evm specific lcd mux setup "
671 "failed: %d\n", ret);
672
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400673 ret = da850_lcd_hw_init();
674 if (ret)
675 pr_warning("da850_evm_init: lcd initialization failed: %d\n",
676 ret);
677
Mark A. Greerb9e63422009-09-15 18:14:19 -0700678 ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400679 if (ret)
680 pr_warning("da850_evm_init: lcdc registration failed: %d\n",
681 ret);
Mark A. Greerc51df702009-09-15 18:15:54 -0700682
683 ret = da8xx_register_rtc();
684 if (ret)
685 pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
Sekhar Nori09dc2d42009-09-22 21:14:03 +0530686
687 ret = da850_register_cpufreq();
688 if (ret)
689 pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
690 ret);
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400691}
692
693#ifdef CONFIG_SERIAL_8250_CONSOLE
694static int __init da850_evm_console_init(void)
695{
696 return add_preferred_console("ttyS", 2, "115200");
697}
698console_initcall(da850_evm_console_init);
699#endif
700
701static __init void da850_evm_irq_init(void)
702{
703 struct davinci_soc_info *soc_info = &davinci_soc_info;
704
705 cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA850_N_CP_INTC_IRQ,
706 soc_info->intc_irq_prios);
707}
708
709static void __init da850_evm_map_io(void)
710{
711 da850_init();
712}
713
714MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138 EVM")
715 .phys_io = IO_PHYS,
716 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
717 .boot_params = (DA8XX_DDR_BASE + 0x100),
718 .map_io = da850_evm_map_io,
719 .init_irq = da850_evm_irq_init,
720 .timer = &davinci_timer,
721 .init_machine = da850_evm_init,
722MACHINE_END