board-da850-evm.c 19 KB

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