board-da850-evm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. /*
  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/init.h>
  16. #include <linux/console.h>
  17. #include <linux/i2c.h>
  18. #include <linux/i2c/at24.h>
  19. #include <linux/i2c/pca953x.h>
  20. #include <linux/gpio.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/nand.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/regulator/machine.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <mach/cp_intc.h>
  30. #include <mach/da8xx.h>
  31. #include <mach/nand.h>
  32. #include <mach/mux.h>
  33. #define DA850_EVM_PHY_MASK 0x1
  34. #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
  35. #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
  36. #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
  37. #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
  38. #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
  39. #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
  40. static struct mtd_partition da850_evm_norflash_partition[] = {
  41. {
  42. .name = "bootloaders + env",
  43. .offset = 0,
  44. .size = SZ_512K,
  45. .mask_flags = MTD_WRITEABLE,
  46. },
  47. {
  48. .name = "kernel",
  49. .offset = MTDPART_OFS_APPEND,
  50. .size = SZ_2M,
  51. .mask_flags = 0,
  52. },
  53. {
  54. .name = "filesystem",
  55. .offset = MTDPART_OFS_APPEND,
  56. .size = MTDPART_SIZ_FULL,
  57. .mask_flags = 0,
  58. },
  59. };
  60. static struct physmap_flash_data da850_evm_norflash_data = {
  61. .width = 2,
  62. .parts = da850_evm_norflash_partition,
  63. .nr_parts = ARRAY_SIZE(da850_evm_norflash_partition),
  64. };
  65. static 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. static struct platform_device da850_evm_norflash_device = {
  73. .name = "physmap-flash",
  74. .id = 0,
  75. .dev = {
  76. .platform_data = &da850_evm_norflash_data,
  77. },
  78. .num_resources = 1,
  79. .resource = da850_evm_norflash_resource,
  80. };
  81. /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
  82. * (128K blocks). It may be used instead of the (default) SPI flash
  83. * to boot, using TI's tools to install the secondary boot loader
  84. * (UBL) and U-Boot.
  85. */
  86. struct mtd_partition da850_evm_nandflash_partition[] = {
  87. {
  88. .name = "u-boot env",
  89. .offset = 0,
  90. .size = SZ_128K,
  91. .mask_flags = MTD_WRITEABLE,
  92. },
  93. {
  94. .name = "UBL",
  95. .offset = MTDPART_OFS_APPEND,
  96. .size = SZ_128K,
  97. .mask_flags = MTD_WRITEABLE,
  98. },
  99. {
  100. .name = "u-boot",
  101. .offset = MTDPART_OFS_APPEND,
  102. .size = 4 * SZ_128K,
  103. .mask_flags = MTD_WRITEABLE,
  104. },
  105. {
  106. .name = "kernel",
  107. .offset = 0x200000,
  108. .size = SZ_2M,
  109. .mask_flags = 0,
  110. },
  111. {
  112. .name = "filesystem",
  113. .offset = MTDPART_OFS_APPEND,
  114. .size = MTDPART_SIZ_FULL,
  115. .mask_flags = 0,
  116. },
  117. };
  118. static struct davinci_nand_pdata da850_evm_nandflash_data = {
  119. .parts = da850_evm_nandflash_partition,
  120. .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
  121. .ecc_mode = NAND_ECC_HW,
  122. .ecc_bits = 4,
  123. .options = NAND_USE_FLASH_BBT,
  124. };
  125. static struct resource da850_evm_nandflash_resource[] = {
  126. {
  127. .start = DA8XX_AEMIF_CS3_BASE,
  128. .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
  129. .flags = IORESOURCE_MEM,
  130. },
  131. {
  132. .start = DA8XX_AEMIF_CTL_BASE,
  133. .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
  134. .flags = IORESOURCE_MEM,
  135. },
  136. };
  137. static struct platform_device da850_evm_nandflash_device = {
  138. .name = "davinci_nand",
  139. .id = 1,
  140. .dev = {
  141. .platform_data = &da850_evm_nandflash_data,
  142. },
  143. .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource),
  144. .resource = da850_evm_nandflash_resource,
  145. };
  146. static struct platform_device *da850_evm_devices[] __initdata = {
  147. &da850_evm_nandflash_device,
  148. &da850_evm_norflash_device,
  149. };
  150. #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10
  151. #define DA8XX_AEMIF_ASIZE_16BIT 0x1
  152. static void __init da850_evm_init_nor(void)
  153. {
  154. void __iomem *aemif_addr;
  155. aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
  156. /* Configure data bus width of CS2 to 16 bit */
  157. writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
  158. DA8XX_AEMIF_ASIZE_16BIT,
  159. aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
  160. iounmap(aemif_addr);
  161. }
  162. static u32 ui_card_detected;
  163. #if defined(CONFIG_MMC_DAVINCI) || \
  164. defined(CONFIG_MMC_DAVINCI_MODULE)
  165. #define HAS_MMC 1
  166. #else
  167. #define HAS_MMC 0
  168. #endif
  169. static __init void da850_evm_setup_nor_nand(void)
  170. {
  171. int ret = 0;
  172. if (ui_card_detected & !HAS_MMC) {
  173. ret = da8xx_pinmux_setup(da850_nand_pins);
  174. if (ret)
  175. pr_warning("da850_evm_init: nand mux setup failed: "
  176. "%d\n", ret);
  177. ret = da8xx_pinmux_setup(da850_nor_pins);
  178. if (ret)
  179. pr_warning("da850_evm_init: nor mux setup failed: %d\n",
  180. ret);
  181. da850_evm_init_nor();
  182. platform_add_devices(da850_evm_devices,
  183. ARRAY_SIZE(da850_evm_devices));
  184. }
  185. }
  186. #ifdef CONFIG_DA850_UI_RMII
  187. static inline void da850_evm_setup_emac_rmii(int rmii_sel)
  188. {
  189. struct davinci_soc_info *soc_info = &davinci_soc_info;
  190. soc_info->emac_pdata->rmii_en = 1;
  191. gpio_set_value(rmii_sel, 0);
  192. }
  193. #else
  194. static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
  195. #endif
  196. static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
  197. unsigned ngpio, void *c)
  198. {
  199. int sel_a, sel_b, sel_c, ret;
  200. sel_a = gpio + 7;
  201. sel_b = gpio + 6;
  202. sel_c = gpio + 5;
  203. ret = gpio_request(sel_a, "sel_a");
  204. if (ret) {
  205. pr_warning("Cannot open UI expander pin %d\n", sel_a);
  206. goto exp_setup_sela_fail;
  207. }
  208. ret = gpio_request(sel_b, "sel_b");
  209. if (ret) {
  210. pr_warning("Cannot open UI expander pin %d\n", sel_b);
  211. goto exp_setup_selb_fail;
  212. }
  213. ret = gpio_request(sel_c, "sel_c");
  214. if (ret) {
  215. pr_warning("Cannot open UI expander pin %d\n", sel_c);
  216. goto exp_setup_selc_fail;
  217. }
  218. /* deselect all functionalities */
  219. gpio_direction_output(sel_a, 1);
  220. gpio_direction_output(sel_b, 1);
  221. gpio_direction_output(sel_c, 1);
  222. ui_card_detected = 1;
  223. pr_info("DA850/OMAP-L138 EVM UI card detected\n");
  224. da850_evm_setup_nor_nand();
  225. da850_evm_setup_emac_rmii(sel_a);
  226. return 0;
  227. exp_setup_selc_fail:
  228. gpio_free(sel_b);
  229. exp_setup_selb_fail:
  230. gpio_free(sel_a);
  231. exp_setup_sela_fail:
  232. return ret;
  233. }
  234. static int da850_evm_ui_expander_teardown(struct i2c_client *client,
  235. unsigned gpio, unsigned ngpio, void *c)
  236. {
  237. /* deselect all functionalities */
  238. gpio_set_value(gpio + 5, 1);
  239. gpio_set_value(gpio + 6, 1);
  240. gpio_set_value(gpio + 7, 1);
  241. gpio_free(gpio + 5);
  242. gpio_free(gpio + 6);
  243. gpio_free(gpio + 7);
  244. return 0;
  245. }
  246. static struct pca953x_platform_data da850_evm_ui_expander_info = {
  247. .gpio_base = DAVINCI_N_GPIO,
  248. .setup = da850_evm_ui_expander_setup,
  249. .teardown = da850_evm_ui_expander_teardown,
  250. };
  251. static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
  252. {
  253. I2C_BOARD_INFO("tlv320aic3x", 0x18),
  254. },
  255. {
  256. I2C_BOARD_INFO("tca6416", 0x20),
  257. .platform_data = &da850_evm_ui_expander_info,
  258. },
  259. };
  260. static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
  261. .bus_freq = 100, /* kHz */
  262. .bus_delay = 0, /* usec */
  263. };
  264. static struct davinci_uart_config da850_evm_uart_config __initdata = {
  265. .enabled_uarts = 0x7,
  266. };
  267. /* davinci da850 evm audio machine driver */
  268. static u8 da850_iis_serializer_direction[] = {
  269. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  270. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  271. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE,
  272. RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  273. };
  274. static struct snd_platform_data da850_evm_snd_data = {
  275. .tx_dma_offset = 0x2000,
  276. .rx_dma_offset = 0x2000,
  277. .op_mode = DAVINCI_MCASP_IIS_MODE,
  278. .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
  279. .tdm_slots = 2,
  280. .serial_dir = da850_iis_serializer_direction,
  281. .eventq_no = EVENTQ_1,
  282. .version = MCASP_VERSION_2,
  283. .txnumevt = 1,
  284. .rxnumevt = 1,
  285. };
  286. static int da850_evm_mmc_get_ro(int index)
  287. {
  288. return gpio_get_value(DA850_MMCSD_WP_PIN);
  289. }
  290. static int da850_evm_mmc_get_cd(int index)
  291. {
  292. return !gpio_get_value(DA850_MMCSD_CD_PIN);
  293. }
  294. static struct davinci_mmc_config da850_mmc_config = {
  295. .get_ro = da850_evm_mmc_get_ro,
  296. .get_cd = da850_evm_mmc_get_cd,
  297. .wires = 4,
  298. .max_freq = 50000000,
  299. .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  300. .version = MMC_CTLR_VERSION_2,
  301. };
  302. static void da850_panel_power_ctrl(int val)
  303. {
  304. /* lcd backlight */
  305. gpio_set_value(DA850_LCD_BL_PIN, val);
  306. /* lcd power */
  307. gpio_set_value(DA850_LCD_PWR_PIN, val);
  308. }
  309. static int da850_lcd_hw_init(void)
  310. {
  311. int status;
  312. status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
  313. if (status < 0)
  314. return status;
  315. status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
  316. if (status < 0) {
  317. gpio_free(DA850_LCD_BL_PIN);
  318. return status;
  319. }
  320. gpio_direction_output(DA850_LCD_BL_PIN, 0);
  321. gpio_direction_output(DA850_LCD_PWR_PIN, 0);
  322. /* Switch off panel power and backlight */
  323. da850_panel_power_ctrl(0);
  324. /* Switch on panel power and backlight */
  325. da850_panel_power_ctrl(1);
  326. return 0;
  327. }
  328. /* TPS65070 voltage regulator support */
  329. /* 3.3V */
  330. struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
  331. {
  332. .supply = "usb0_vdda33",
  333. },
  334. {
  335. .supply = "usb1_vdda33",
  336. },
  337. };
  338. /* 3.3V or 1.8V */
  339. struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
  340. {
  341. .supply = "dvdd3318_a",
  342. },
  343. {
  344. .supply = "dvdd3318_b",
  345. },
  346. {
  347. .supply = "dvdd3318_c",
  348. },
  349. };
  350. /* 1.2V */
  351. struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
  352. {
  353. .supply = "cvdd",
  354. },
  355. };
  356. /* 1.8V LDO */
  357. struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
  358. {
  359. .supply = "sata_vddr",
  360. },
  361. {
  362. .supply = "usb0_vdda18",
  363. },
  364. {
  365. .supply = "usb1_vdda18",
  366. },
  367. {
  368. .supply = "ddr_dvdd18",
  369. },
  370. };
  371. /* 1.2V LDO */
  372. struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
  373. {
  374. .supply = "sata_vdd",
  375. },
  376. {
  377. .supply = "pll0_vdda",
  378. },
  379. {
  380. .supply = "pll1_vdda",
  381. },
  382. {
  383. .supply = "usbs_cvdd",
  384. },
  385. {
  386. .supply = "vddarnwa1",
  387. },
  388. };
  389. struct regulator_init_data tps65070_regulator_data[] = {
  390. /* dcdc1 */
  391. {
  392. .constraints = {
  393. .min_uV = 3150000,
  394. .max_uV = 3450000,
  395. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  396. REGULATOR_CHANGE_STATUS),
  397. .boot_on = 1,
  398. },
  399. .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers),
  400. .consumer_supplies = tps65070_dcdc1_consumers,
  401. },
  402. /* dcdc2 */
  403. {
  404. .constraints = {
  405. .min_uV = 1710000,
  406. .max_uV = 3450000,
  407. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  408. REGULATOR_CHANGE_STATUS),
  409. .boot_on = 1,
  410. },
  411. .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
  412. .consumer_supplies = tps65070_dcdc2_consumers,
  413. },
  414. /* dcdc3 */
  415. {
  416. .constraints = {
  417. .min_uV = 950000,
  418. .max_uV = 1320000,
  419. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  420. REGULATOR_CHANGE_STATUS),
  421. .boot_on = 1,
  422. },
  423. .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
  424. .consumer_supplies = tps65070_dcdc3_consumers,
  425. },
  426. /* ldo1 */
  427. {
  428. .constraints = {
  429. .min_uV = 1710000,
  430. .max_uV = 1890000,
  431. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  432. REGULATOR_CHANGE_STATUS),
  433. .boot_on = 1,
  434. },
  435. .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers),
  436. .consumer_supplies = tps65070_ldo1_consumers,
  437. },
  438. /* ldo2 */
  439. {
  440. .constraints = {
  441. .min_uV = 1140000,
  442. .max_uV = 1320000,
  443. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  444. REGULATOR_CHANGE_STATUS),
  445. .boot_on = 1,
  446. },
  447. .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers),
  448. .consumer_supplies = tps65070_ldo2_consumers,
  449. },
  450. };
  451. static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
  452. {
  453. I2C_BOARD_INFO("tps6507x", 0x48),
  454. .platform_data = &tps65070_regulator_data[0],
  455. },
  456. };
  457. static int __init pmic_tps65070_init(void)
  458. {
  459. return i2c_register_board_info(1, da850evm_tps65070_info,
  460. ARRAY_SIZE(da850evm_tps65070_info));
  461. }
  462. static const short da850_evm_lcdc_pins[] = {
  463. DA850_GPIO2_8, DA850_GPIO2_15,
  464. -1
  465. };
  466. static int __init da850_evm_config_emac(void)
  467. {
  468. void __iomem *cfg_chip3_base;
  469. int ret;
  470. u32 val;
  471. struct davinci_soc_info *soc_info = &davinci_soc_info;
  472. u8 rmii_en = soc_info->emac_pdata->rmii_en;
  473. if (!machine_is_davinci_da850_evm())
  474. return 0;
  475. cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
  476. val = __raw_readl(cfg_chip3_base);
  477. if (rmii_en) {
  478. val |= BIT(8);
  479. ret = da8xx_pinmux_setup(da850_rmii_pins);
  480. pr_info("EMAC: RMII PHY configured, MII PHY will not be"
  481. " functional\n");
  482. } else {
  483. val &= ~BIT(8);
  484. ret = da8xx_pinmux_setup(da850_cpgmac_pins);
  485. pr_info("EMAC: MII PHY configured, RMII PHY will not be"
  486. " functional\n");
  487. }
  488. if (ret)
  489. pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
  490. ret);
  491. /* configure the CFGCHIP3 register for RMII or MII */
  492. __raw_writel(val, cfg_chip3_base);
  493. ret = davinci_cfg_reg(DA850_GPIO2_6);
  494. if (ret)
  495. pr_warning("da850_evm_init:GPIO(2,6) mux setup "
  496. "failed\n");
  497. ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
  498. if (ret) {
  499. pr_warning("Cannot open GPIO %d\n",
  500. DA850_MII_MDIO_CLKEN_PIN);
  501. return ret;
  502. }
  503. /* Enable/Disable MII MDIO clock */
  504. gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en);
  505. soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK;
  506. soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY;
  507. ret = da8xx_register_emac();
  508. if (ret)
  509. pr_warning("da850_evm_init: emac registration failed: %d\n",
  510. ret);
  511. return 0;
  512. }
  513. device_initcall(da850_evm_config_emac);
  514. static __init void da850_evm_init(void)
  515. {
  516. int ret;
  517. ret = pmic_tps65070_init();
  518. if (ret)
  519. pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n",
  520. ret);
  521. ret = da8xx_register_edma();
  522. if (ret)
  523. pr_warning("da850_evm_init: edma registration failed: %d\n",
  524. ret);
  525. ret = da8xx_pinmux_setup(da850_i2c0_pins);
  526. if (ret)
  527. pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
  528. ret);
  529. ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata);
  530. if (ret)
  531. pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
  532. ret);
  533. ret = da8xx_register_watchdog();
  534. if (ret)
  535. pr_warning("da830_evm_init: watchdog registration failed: %d\n",
  536. ret);
  537. if (HAS_MMC) {
  538. ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
  539. if (ret)
  540. pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
  541. " %d\n", ret);
  542. ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
  543. if (ret)
  544. pr_warning("da850_evm_init: can not open GPIO %d\n",
  545. DA850_MMCSD_CD_PIN);
  546. gpio_direction_input(DA850_MMCSD_CD_PIN);
  547. ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
  548. if (ret)
  549. pr_warning("da850_evm_init: can not open GPIO %d\n",
  550. DA850_MMCSD_WP_PIN);
  551. gpio_direction_input(DA850_MMCSD_WP_PIN);
  552. ret = da8xx_register_mmcsd0(&da850_mmc_config);
  553. if (ret)
  554. pr_warning("da850_evm_init: mmcsd0 registration failed:"
  555. " %d\n", ret);
  556. }
  557. davinci_serial_init(&da850_evm_uart_config);
  558. i2c_register_board_info(1, da850_evm_i2c_devices,
  559. ARRAY_SIZE(da850_evm_i2c_devices));
  560. /*
  561. * shut down uart 0 and 1; they are not used on the board and
  562. * accessing them causes endless "too much work in irq53" messages
  563. * with arago fs
  564. */
  565. __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
  566. __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
  567. ret = da8xx_pinmux_setup(da850_mcasp_pins);
  568. if (ret)
  569. pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
  570. ret);
  571. da8xx_register_mcasp(0, &da850_evm_snd_data);
  572. ret = da8xx_pinmux_setup(da850_lcdcntl_pins);
  573. if (ret)
  574. pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
  575. ret);
  576. /* Handle board specific muxing for LCD here */
  577. ret = da8xx_pinmux_setup(da850_evm_lcdc_pins);
  578. if (ret)
  579. pr_warning("da850_evm_init: evm specific lcd mux setup "
  580. "failed: %d\n", ret);
  581. ret = da850_lcd_hw_init();
  582. if (ret)
  583. pr_warning("da850_evm_init: lcd initialization failed: %d\n",
  584. ret);
  585. sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
  586. ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
  587. if (ret)
  588. pr_warning("da850_evm_init: lcdc registration failed: %d\n",
  589. ret);
  590. ret = da8xx_register_rtc();
  591. if (ret)
  592. pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
  593. ret = da850_register_cpufreq();
  594. if (ret)
  595. pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
  596. ret);
  597. ret = da8xx_register_cpuidle();
  598. if (ret)
  599. pr_warning("da850_evm_init: cpuidle registration failed: %d\n",
  600. ret);
  601. }
  602. #ifdef CONFIG_SERIAL_8250_CONSOLE
  603. static int __init da850_evm_console_init(void)
  604. {
  605. return add_preferred_console("ttyS", 2, "115200");
  606. }
  607. console_initcall(da850_evm_console_init);
  608. #endif
  609. static __init void da850_evm_irq_init(void)
  610. {
  611. struct davinci_soc_info *soc_info = &davinci_soc_info;
  612. cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA850_N_CP_INTC_IRQ,
  613. soc_info->intc_irq_prios);
  614. }
  615. static void __init da850_evm_map_io(void)
  616. {
  617. da850_init();
  618. }
  619. MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138 EVM")
  620. .phys_io = IO_PHYS,
  621. .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
  622. .boot_params = (DA8XX_DDR_BASE + 0x100),
  623. .map_io = da850_evm_map_io,
  624. .init_irq = da850_evm_irq_init,
  625. .timer = &davinci_timer,
  626. .init_machine = da850_evm_init,
  627. MACHINE_END