board-da850-evm.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  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/input.h>
  21. #include <linux/mfd/tps6507x.h>
  22. #include <linux/gpio.h>
  23. #include <linux/gpio_keys.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/mtd/mtd.h>
  26. #include <linux/mtd/nand.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/physmap.h>
  29. #include <linux/regulator/machine.h>
  30. #include <linux/regulator/tps6507x.h>
  31. #include <linux/input/tps6507x-ts.h>
  32. #include <linux/spi/spi.h>
  33. #include <linux/spi/flash.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/mach/arch.h>
  36. #include <mach/cp_intc.h>
  37. #include <mach/da8xx.h>
  38. #include <mach/nand.h>
  39. #include <mach/mux.h>
  40. #include <mach/aemif.h>
  41. #include <mach/spi.h>
  42. #define DA850_EVM_PHY_ID "0:00"
  43. #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
  44. #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
  45. #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
  46. #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
  47. #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
  48. static struct mtd_partition da850evm_spiflash_part[] = {
  49. [0] = {
  50. .name = "UBL",
  51. .offset = 0,
  52. .size = SZ_64K,
  53. .mask_flags = MTD_WRITEABLE,
  54. },
  55. [1] = {
  56. .name = "U-Boot",
  57. .offset = MTDPART_OFS_APPEND,
  58. .size = SZ_512K,
  59. .mask_flags = MTD_WRITEABLE,
  60. },
  61. [2] = {
  62. .name = "U-Boot-Env",
  63. .offset = MTDPART_OFS_APPEND,
  64. .size = SZ_64K,
  65. .mask_flags = MTD_WRITEABLE,
  66. },
  67. [3] = {
  68. .name = "Kernel",
  69. .offset = MTDPART_OFS_APPEND,
  70. .size = SZ_2M + SZ_512K,
  71. .mask_flags = 0,
  72. },
  73. [4] = {
  74. .name = "Filesystem",
  75. .offset = MTDPART_OFS_APPEND,
  76. .size = SZ_4M,
  77. .mask_flags = 0,
  78. },
  79. [5] = {
  80. .name = "MAC-Address",
  81. .offset = SZ_8M - SZ_64K,
  82. .size = SZ_64K,
  83. .mask_flags = MTD_WRITEABLE,
  84. },
  85. };
  86. static struct flash_platform_data da850evm_spiflash_data = {
  87. .name = "m25p80",
  88. .parts = da850evm_spiflash_part,
  89. .nr_parts = ARRAY_SIZE(da850evm_spiflash_part),
  90. .type = "m25p64",
  91. };
  92. static struct davinci_spi_config da850evm_spiflash_cfg = {
  93. .io_type = SPI_IO_TYPE_DMA,
  94. .c2tdelay = 8,
  95. .t2cdelay = 8,
  96. };
  97. static struct spi_board_info da850evm_spi_info[] = {
  98. {
  99. .modalias = "m25p80",
  100. .platform_data = &da850evm_spiflash_data,
  101. .controller_data = &da850evm_spiflash_cfg,
  102. .mode = SPI_MODE_0,
  103. .max_speed_hz = 30000000,
  104. .bus_num = 1,
  105. .chip_select = 0,
  106. },
  107. };
  108. static struct mtd_partition da850_evm_norflash_partition[] = {
  109. {
  110. .name = "bootloaders + env",
  111. .offset = 0,
  112. .size = SZ_512K,
  113. .mask_flags = MTD_WRITEABLE,
  114. },
  115. {
  116. .name = "kernel",
  117. .offset = MTDPART_OFS_APPEND,
  118. .size = SZ_2M,
  119. .mask_flags = 0,
  120. },
  121. {
  122. .name = "filesystem",
  123. .offset = MTDPART_OFS_APPEND,
  124. .size = MTDPART_SIZ_FULL,
  125. .mask_flags = 0,
  126. },
  127. };
  128. static struct physmap_flash_data da850_evm_norflash_data = {
  129. .width = 2,
  130. .parts = da850_evm_norflash_partition,
  131. .nr_parts = ARRAY_SIZE(da850_evm_norflash_partition),
  132. };
  133. static struct resource da850_evm_norflash_resource[] = {
  134. {
  135. .start = DA8XX_AEMIF_CS2_BASE,
  136. .end = DA8XX_AEMIF_CS2_BASE + SZ_32M - 1,
  137. .flags = IORESOURCE_MEM,
  138. },
  139. };
  140. static struct platform_device da850_evm_norflash_device = {
  141. .name = "physmap-flash",
  142. .id = 0,
  143. .dev = {
  144. .platform_data = &da850_evm_norflash_data,
  145. },
  146. .num_resources = 1,
  147. .resource = da850_evm_norflash_resource,
  148. };
  149. static struct davinci_pm_config da850_pm_pdata = {
  150. .sleepcount = 128,
  151. };
  152. static struct platform_device da850_pm_device = {
  153. .name = "pm-davinci",
  154. .dev = {
  155. .platform_data = &da850_pm_pdata,
  156. },
  157. .id = -1,
  158. };
  159. /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
  160. * (128K blocks). It may be used instead of the (default) SPI flash
  161. * to boot, using TI's tools to install the secondary boot loader
  162. * (UBL) and U-Boot.
  163. */
  164. static struct mtd_partition da850_evm_nandflash_partition[] = {
  165. {
  166. .name = "u-boot env",
  167. .offset = 0,
  168. .size = SZ_128K,
  169. .mask_flags = MTD_WRITEABLE,
  170. },
  171. {
  172. .name = "UBL",
  173. .offset = MTDPART_OFS_APPEND,
  174. .size = SZ_128K,
  175. .mask_flags = MTD_WRITEABLE,
  176. },
  177. {
  178. .name = "u-boot",
  179. .offset = MTDPART_OFS_APPEND,
  180. .size = 4 * SZ_128K,
  181. .mask_flags = MTD_WRITEABLE,
  182. },
  183. {
  184. .name = "kernel",
  185. .offset = 0x200000,
  186. .size = SZ_2M,
  187. .mask_flags = 0,
  188. },
  189. {
  190. .name = "filesystem",
  191. .offset = MTDPART_OFS_APPEND,
  192. .size = MTDPART_SIZ_FULL,
  193. .mask_flags = 0,
  194. },
  195. };
  196. static struct davinci_aemif_timing da850_evm_nandflash_timing = {
  197. .wsetup = 24,
  198. .wstrobe = 21,
  199. .whold = 14,
  200. .rsetup = 19,
  201. .rstrobe = 50,
  202. .rhold = 0,
  203. .ta = 20,
  204. };
  205. static struct davinci_nand_pdata da850_evm_nandflash_data = {
  206. .parts = da850_evm_nandflash_partition,
  207. .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
  208. .ecc_mode = NAND_ECC_HW,
  209. .ecc_bits = 4,
  210. .options = NAND_USE_FLASH_BBT,
  211. .timing = &da850_evm_nandflash_timing,
  212. };
  213. static struct resource da850_evm_nandflash_resource[] = {
  214. {
  215. .start = DA8XX_AEMIF_CS3_BASE,
  216. .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
  217. .flags = IORESOURCE_MEM,
  218. },
  219. {
  220. .start = DA8XX_AEMIF_CTL_BASE,
  221. .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
  222. .flags = IORESOURCE_MEM,
  223. },
  224. };
  225. static struct platform_device da850_evm_nandflash_device = {
  226. .name = "davinci_nand",
  227. .id = 1,
  228. .dev = {
  229. .platform_data = &da850_evm_nandflash_data,
  230. },
  231. .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource),
  232. .resource = da850_evm_nandflash_resource,
  233. };
  234. static struct platform_device *da850_evm_devices[] __initdata = {
  235. &da850_evm_nandflash_device,
  236. &da850_evm_norflash_device,
  237. };
  238. #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10
  239. #define DA8XX_AEMIF_ASIZE_16BIT 0x1
  240. static void __init da850_evm_init_nor(void)
  241. {
  242. void __iomem *aemif_addr;
  243. aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
  244. /* Configure data bus width of CS2 to 16 bit */
  245. writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
  246. DA8XX_AEMIF_ASIZE_16BIT,
  247. aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
  248. iounmap(aemif_addr);
  249. }
  250. static const short da850_evm_nand_pins[] = {
  251. DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
  252. DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7,
  253. DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4,
  254. DA850_NEMA_WE, DA850_NEMA_OE,
  255. -1
  256. };
  257. static const short da850_evm_nor_pins[] = {
  258. DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
  259. DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1,
  260. DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5,
  261. DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9,
  262. DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13,
  263. DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1,
  264. DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5,
  265. DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9,
  266. DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13,
  267. DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17,
  268. DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21,
  269. DA850_EMA_A_22, DA850_EMA_A_23,
  270. -1
  271. };
  272. #if defined(CONFIG_MMC_DAVINCI) || \
  273. defined(CONFIG_MMC_DAVINCI_MODULE)
  274. #define HAS_MMC 1
  275. #else
  276. #define HAS_MMC 0
  277. #endif
  278. static inline void da850_evm_setup_nor_nand(void)
  279. {
  280. int ret = 0;
  281. if (!HAS_MMC) {
  282. ret = davinci_cfg_reg_list(da850_evm_nand_pins);
  283. if (ret)
  284. pr_warning("da850_evm_init: nand mux setup failed: "
  285. "%d\n", ret);
  286. ret = davinci_cfg_reg_list(da850_evm_nor_pins);
  287. if (ret)
  288. pr_warning("da850_evm_init: nor mux setup failed: %d\n",
  289. ret);
  290. da850_evm_init_nor();
  291. platform_add_devices(da850_evm_devices,
  292. ARRAY_SIZE(da850_evm_devices));
  293. }
  294. }
  295. #ifdef CONFIG_DA850_UI_RMII
  296. static inline void da850_evm_setup_emac_rmii(int rmii_sel)
  297. {
  298. struct davinci_soc_info *soc_info = &davinci_soc_info;
  299. soc_info->emac_pdata->rmii_en = 1;
  300. gpio_set_value_cansleep(rmii_sel, 0);
  301. }
  302. #else
  303. static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
  304. #endif
  305. #define DA850_KEYS_DEBOUNCE_MS 10
  306. /*
  307. * At 200ms polling interval it is possible to miss an
  308. * event by tapping very lightly on the push button but most
  309. * pushes do result in an event; longer intervals require the
  310. * user to hold the button whereas shorter intervals require
  311. * more CPU time for polling.
  312. */
  313. #define DA850_GPIO_KEYS_POLL_MS 200
  314. enum da850_evm_ui_exp_pins {
  315. DA850_EVM_UI_EXP_SEL_C = 5,
  316. DA850_EVM_UI_EXP_SEL_B,
  317. DA850_EVM_UI_EXP_SEL_A,
  318. DA850_EVM_UI_EXP_PB8,
  319. DA850_EVM_UI_EXP_PB7,
  320. DA850_EVM_UI_EXP_PB6,
  321. DA850_EVM_UI_EXP_PB5,
  322. DA850_EVM_UI_EXP_PB4,
  323. DA850_EVM_UI_EXP_PB3,
  324. DA850_EVM_UI_EXP_PB2,
  325. DA850_EVM_UI_EXP_PB1,
  326. };
  327. static const char const *da850_evm_ui_exp[] = {
  328. [DA850_EVM_UI_EXP_SEL_C] = "sel_c",
  329. [DA850_EVM_UI_EXP_SEL_B] = "sel_b",
  330. [DA850_EVM_UI_EXP_SEL_A] = "sel_a",
  331. [DA850_EVM_UI_EXP_PB8] = "pb8",
  332. [DA850_EVM_UI_EXP_PB7] = "pb7",
  333. [DA850_EVM_UI_EXP_PB6] = "pb6",
  334. [DA850_EVM_UI_EXP_PB5] = "pb5",
  335. [DA850_EVM_UI_EXP_PB4] = "pb4",
  336. [DA850_EVM_UI_EXP_PB3] = "pb3",
  337. [DA850_EVM_UI_EXP_PB2] = "pb2",
  338. [DA850_EVM_UI_EXP_PB1] = "pb1",
  339. };
  340. #define DA850_N_UI_PB 8
  341. static struct gpio_keys_button da850_evm_ui_keys[] = {
  342. [0 ... DA850_N_UI_PB - 1] = {
  343. .type = EV_KEY,
  344. .active_low = 1,
  345. .wakeup = 0,
  346. .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
  347. .code = -1, /* assigned at runtime */
  348. .gpio = -1, /* assigned at runtime */
  349. .desc = NULL, /* assigned at runtime */
  350. },
  351. };
  352. static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
  353. .buttons = da850_evm_ui_keys,
  354. .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
  355. .poll_interval = DA850_GPIO_KEYS_POLL_MS,
  356. };
  357. static struct platform_device da850_evm_ui_keys_device = {
  358. .name = "gpio-keys-polled",
  359. .id = 0,
  360. .dev = {
  361. .platform_data = &da850_evm_ui_keys_pdata
  362. },
  363. };
  364. static void da850_evm_ui_keys_init(unsigned gpio)
  365. {
  366. int i;
  367. struct gpio_keys_button *button;
  368. for (i = 0; i < DA850_N_UI_PB; i++) {
  369. button = &da850_evm_ui_keys[i];
  370. button->code = KEY_F8 - i;
  371. button->desc = (char *)
  372. da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
  373. button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
  374. }
  375. }
  376. static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
  377. unsigned ngpio, void *c)
  378. {
  379. int sel_a, sel_b, sel_c, ret;
  380. sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
  381. sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
  382. sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
  383. ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
  384. if (ret) {
  385. pr_warning("Cannot open UI expander pin %d\n", sel_a);
  386. goto exp_setup_sela_fail;
  387. }
  388. ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
  389. if (ret) {
  390. pr_warning("Cannot open UI expander pin %d\n", sel_b);
  391. goto exp_setup_selb_fail;
  392. }
  393. ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
  394. if (ret) {
  395. pr_warning("Cannot open UI expander pin %d\n", sel_c);
  396. goto exp_setup_selc_fail;
  397. }
  398. /* deselect all functionalities */
  399. gpio_direction_output(sel_a, 1);
  400. gpio_direction_output(sel_b, 1);
  401. gpio_direction_output(sel_c, 1);
  402. da850_evm_ui_keys_init(gpio);
  403. ret = platform_device_register(&da850_evm_ui_keys_device);
  404. if (ret) {
  405. pr_warning("Could not register UI GPIO expander push-buttons");
  406. goto exp_setup_keys_fail;
  407. }
  408. pr_info("DA850/OMAP-L138 EVM UI card detected\n");
  409. da850_evm_setup_nor_nand();
  410. da850_evm_setup_emac_rmii(sel_a);
  411. return 0;
  412. exp_setup_keys_fail:
  413. gpio_free(sel_c);
  414. exp_setup_selc_fail:
  415. gpio_free(sel_b);
  416. exp_setup_selb_fail:
  417. gpio_free(sel_a);
  418. exp_setup_sela_fail:
  419. return ret;
  420. }
  421. static int da850_evm_ui_expander_teardown(struct i2c_client *client,
  422. unsigned gpio, unsigned ngpio, void *c)
  423. {
  424. platform_device_unregister(&da850_evm_ui_keys_device);
  425. /* deselect all functionalities */
  426. gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
  427. gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
  428. gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
  429. gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
  430. gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
  431. gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
  432. return 0;
  433. }
  434. /* assign the baseboard expander's GPIOs after the UI board's */
  435. #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
  436. #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
  437. enum da850_evm_bb_exp_pins {
  438. DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
  439. DA850_EVM_BB_EXP_SW_RST,
  440. DA850_EVM_BB_EXP_TP_23,
  441. DA850_EVM_BB_EXP_TP_22,
  442. DA850_EVM_BB_EXP_TP_21,
  443. DA850_EVM_BB_EXP_USER_PB1,
  444. DA850_EVM_BB_EXP_USER_LED2,
  445. DA850_EVM_BB_EXP_USER_LED1,
  446. DA850_EVM_BB_EXP_USER_SW1,
  447. DA850_EVM_BB_EXP_USER_SW2,
  448. DA850_EVM_BB_EXP_USER_SW3,
  449. DA850_EVM_BB_EXP_USER_SW4,
  450. DA850_EVM_BB_EXP_USER_SW5,
  451. DA850_EVM_BB_EXP_USER_SW6,
  452. DA850_EVM_BB_EXP_USER_SW7,
  453. DA850_EVM_BB_EXP_USER_SW8
  454. };
  455. static const char const *da850_evm_bb_exp[] = {
  456. [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en",
  457. [DA850_EVM_BB_EXP_SW_RST] = "sw_rst",
  458. [DA850_EVM_BB_EXP_TP_23] = "tp_23",
  459. [DA850_EVM_BB_EXP_TP_22] = "tp_22",
  460. [DA850_EVM_BB_EXP_TP_21] = "tp_21",
  461. [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1",
  462. [DA850_EVM_BB_EXP_USER_LED2] = "user_led2",
  463. [DA850_EVM_BB_EXP_USER_LED1] = "user_led1",
  464. [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1",
  465. [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2",
  466. [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3",
  467. [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4",
  468. [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5",
  469. [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6",
  470. [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7",
  471. [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8",
  472. };
  473. #define DA850_N_BB_USER_SW 8
  474. static struct gpio_keys_button da850_evm_bb_keys[] = {
  475. [0] = {
  476. .type = EV_KEY,
  477. .active_low = 1,
  478. .wakeup = 0,
  479. .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
  480. .code = KEY_PROG1,
  481. .desc = NULL, /* assigned at runtime */
  482. .gpio = -1, /* assigned at runtime */
  483. },
  484. [1 ... DA850_N_BB_USER_SW] = {
  485. .type = EV_SW,
  486. .active_low = 1,
  487. .wakeup = 0,
  488. .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
  489. .code = -1, /* assigned at runtime */
  490. .desc = NULL, /* assigned at runtime */
  491. .gpio = -1, /* assigned at runtime */
  492. },
  493. };
  494. static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
  495. .buttons = da850_evm_bb_keys,
  496. .nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
  497. .poll_interval = DA850_GPIO_KEYS_POLL_MS,
  498. };
  499. static struct platform_device da850_evm_bb_keys_device = {
  500. .name = "gpio-keys-polled",
  501. .id = 1,
  502. .dev = {
  503. .platform_data = &da850_evm_bb_keys_pdata
  504. },
  505. };
  506. static void da850_evm_bb_keys_init(unsigned gpio)
  507. {
  508. int i;
  509. struct gpio_keys_button *button;
  510. button = &da850_evm_bb_keys[0];
  511. button->desc = (char *)
  512. da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
  513. button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
  514. for (i = 0; i < DA850_N_BB_USER_SW; i++) {
  515. button = &da850_evm_bb_keys[i + 1];
  516. button->code = SW_LID + i;
  517. button->desc = (char *)
  518. da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
  519. button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
  520. }
  521. }
  522. #define DA850_N_BB_USER_LED 2
  523. static struct gpio_led da850_evm_bb_leds[] = {
  524. [0 ... DA850_N_BB_USER_LED - 1] = {
  525. .active_low = 1,
  526. .gpio = -1, /* assigned at runtime */
  527. .name = NULL, /* assigned at runtime */
  528. },
  529. };
  530. static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
  531. .leds = da850_evm_bb_leds,
  532. .num_leds = ARRAY_SIZE(da850_evm_bb_leds),
  533. };
  534. static struct platform_device da850_evm_bb_leds_device = {
  535. .name = "leds-gpio",
  536. .id = -1,
  537. .dev = {
  538. .platform_data = &da850_evm_bb_leds_pdata
  539. }
  540. };
  541. static void da850_evm_bb_leds_init(unsigned gpio)
  542. {
  543. int i;
  544. struct gpio_led *led;
  545. for (i = 0; i < DA850_N_BB_USER_LED; i++) {
  546. led = &da850_evm_bb_leds[i];
  547. led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
  548. led->name =
  549. da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
  550. }
  551. }
  552. static int da850_evm_bb_expander_setup(struct i2c_client *client,
  553. unsigned gpio, unsigned ngpio,
  554. void *c)
  555. {
  556. int ret;
  557. /*
  558. * Register the switches and pushbutton on the baseboard as a gpio-keys
  559. * device.
  560. */
  561. da850_evm_bb_keys_init(gpio);
  562. ret = platform_device_register(&da850_evm_bb_keys_device);
  563. if (ret) {
  564. pr_warning("Could not register baseboard GPIO expander keys");
  565. goto io_exp_setup_sw_fail;
  566. }
  567. da850_evm_bb_leds_init(gpio);
  568. ret = platform_device_register(&da850_evm_bb_leds_device);
  569. if (ret) {
  570. pr_warning("Could not register baseboard GPIO expander LEDS");
  571. goto io_exp_setup_leds_fail;
  572. }
  573. return 0;
  574. io_exp_setup_leds_fail:
  575. platform_device_unregister(&da850_evm_bb_keys_device);
  576. io_exp_setup_sw_fail:
  577. return ret;
  578. }
  579. static int da850_evm_bb_expander_teardown(struct i2c_client *client,
  580. unsigned gpio, unsigned ngpio, void *c)
  581. {
  582. platform_device_unregister(&da850_evm_bb_leds_device);
  583. platform_device_unregister(&da850_evm_bb_keys_device);
  584. return 0;
  585. }
  586. static struct pca953x_platform_data da850_evm_ui_expander_info = {
  587. .gpio_base = DAVINCI_N_GPIO,
  588. .setup = da850_evm_ui_expander_setup,
  589. .teardown = da850_evm_ui_expander_teardown,
  590. .names = da850_evm_ui_exp,
  591. };
  592. static struct pca953x_platform_data da850_evm_bb_expander_info = {
  593. .gpio_base = DA850_BB_EXPANDER_GPIO_BASE,
  594. .setup = da850_evm_bb_expander_setup,
  595. .teardown = da850_evm_bb_expander_teardown,
  596. .names = da850_evm_bb_exp,
  597. };
  598. static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
  599. {
  600. I2C_BOARD_INFO("tlv320aic3x", 0x18),
  601. },
  602. {
  603. I2C_BOARD_INFO("tca6416", 0x20),
  604. .platform_data = &da850_evm_ui_expander_info,
  605. },
  606. {
  607. I2C_BOARD_INFO("tca6416", 0x21),
  608. .platform_data = &da850_evm_bb_expander_info,
  609. },
  610. };
  611. static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
  612. .bus_freq = 100, /* kHz */
  613. .bus_delay = 0, /* usec */
  614. };
  615. static struct davinci_uart_config da850_evm_uart_config __initdata = {
  616. .enabled_uarts = 0x7,
  617. };
  618. /* davinci da850 evm audio machine driver */
  619. static u8 da850_iis_serializer_direction[] = {
  620. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  621. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  622. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE,
  623. RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  624. };
  625. static struct snd_platform_data da850_evm_snd_data = {
  626. .tx_dma_offset = 0x2000,
  627. .rx_dma_offset = 0x2000,
  628. .op_mode = DAVINCI_MCASP_IIS_MODE,
  629. .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
  630. .tdm_slots = 2,
  631. .serial_dir = da850_iis_serializer_direction,
  632. .asp_chan_q = EVENTQ_1,
  633. .version = MCASP_VERSION_2,
  634. .txnumevt = 1,
  635. .rxnumevt = 1,
  636. };
  637. static const short da850_evm_mcasp_pins[] __initconst = {
  638. DA850_AHCLKX, DA850_ACLKX, DA850_AFSX,
  639. DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE,
  640. DA850_AXR_11, DA850_AXR_12,
  641. -1
  642. };
  643. static int da850_evm_mmc_get_ro(int index)
  644. {
  645. return gpio_get_value(DA850_MMCSD_WP_PIN);
  646. }
  647. static int da850_evm_mmc_get_cd(int index)
  648. {
  649. return !gpio_get_value(DA850_MMCSD_CD_PIN);
  650. }
  651. static struct davinci_mmc_config da850_mmc_config = {
  652. .get_ro = da850_evm_mmc_get_ro,
  653. .get_cd = da850_evm_mmc_get_cd,
  654. .wires = 4,
  655. .max_freq = 50000000,
  656. .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  657. .version = MMC_CTLR_VERSION_2,
  658. };
  659. static const short da850_evm_mmcsd0_pins[] __initconst = {
  660. DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
  661. DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
  662. DA850_GPIO4_0, DA850_GPIO4_1,
  663. -1
  664. };
  665. static void da850_panel_power_ctrl(int val)
  666. {
  667. /* lcd backlight */
  668. gpio_set_value(DA850_LCD_BL_PIN, val);
  669. /* lcd power */
  670. gpio_set_value(DA850_LCD_PWR_PIN, val);
  671. }
  672. static int da850_lcd_hw_init(void)
  673. {
  674. int status;
  675. status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
  676. if (status < 0)
  677. return status;
  678. status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
  679. if (status < 0) {
  680. gpio_free(DA850_LCD_BL_PIN);
  681. return status;
  682. }
  683. gpio_direction_output(DA850_LCD_BL_PIN, 0);
  684. gpio_direction_output(DA850_LCD_PWR_PIN, 0);
  685. /* Switch off panel power and backlight */
  686. da850_panel_power_ctrl(0);
  687. /* Switch on panel power and backlight */
  688. da850_panel_power_ctrl(1);
  689. return 0;
  690. }
  691. /* TPS65070 voltage regulator support */
  692. /* 3.3V */
  693. static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
  694. {
  695. .supply = "usb0_vdda33",
  696. },
  697. {
  698. .supply = "usb1_vdda33",
  699. },
  700. };
  701. /* 3.3V or 1.8V */
  702. static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
  703. {
  704. .supply = "dvdd3318_a",
  705. },
  706. {
  707. .supply = "dvdd3318_b",
  708. },
  709. {
  710. .supply = "dvdd3318_c",
  711. },
  712. };
  713. /* 1.2V */
  714. static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
  715. {
  716. .supply = "cvdd",
  717. },
  718. };
  719. /* 1.8V LDO */
  720. static struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
  721. {
  722. .supply = "sata_vddr",
  723. },
  724. {
  725. .supply = "usb0_vdda18",
  726. },
  727. {
  728. .supply = "usb1_vdda18",
  729. },
  730. {
  731. .supply = "ddr_dvdd18",
  732. },
  733. };
  734. /* 1.2V LDO */
  735. static struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
  736. {
  737. .supply = "sata_vdd",
  738. },
  739. {
  740. .supply = "pll0_vdda",
  741. },
  742. {
  743. .supply = "pll1_vdda",
  744. },
  745. {
  746. .supply = "usbs_cvdd",
  747. },
  748. {
  749. .supply = "vddarnwa1",
  750. },
  751. };
  752. /* We take advantage of the fact that both defdcdc{2,3} are tied high */
  753. static struct tps6507x_reg_platform_data tps6507x_platform_data = {
  754. .defdcdc_default = true,
  755. };
  756. static struct regulator_init_data tps65070_regulator_data[] = {
  757. /* dcdc1 */
  758. {
  759. .constraints = {
  760. .min_uV = 3150000,
  761. .max_uV = 3450000,
  762. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  763. REGULATOR_CHANGE_STATUS),
  764. .boot_on = 1,
  765. },
  766. .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers),
  767. .consumer_supplies = tps65070_dcdc1_consumers,
  768. },
  769. /* dcdc2 */
  770. {
  771. .constraints = {
  772. .min_uV = 1710000,
  773. .max_uV = 3450000,
  774. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  775. REGULATOR_CHANGE_STATUS),
  776. .boot_on = 1,
  777. },
  778. .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
  779. .consumer_supplies = tps65070_dcdc2_consumers,
  780. .driver_data = &tps6507x_platform_data,
  781. },
  782. /* dcdc3 */
  783. {
  784. .constraints = {
  785. .min_uV = 950000,
  786. .max_uV = 1350000,
  787. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  788. REGULATOR_CHANGE_STATUS),
  789. .boot_on = 1,
  790. },
  791. .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
  792. .consumer_supplies = tps65070_dcdc3_consumers,
  793. .driver_data = &tps6507x_platform_data,
  794. },
  795. /* ldo1 */
  796. {
  797. .constraints = {
  798. .min_uV = 1710000,
  799. .max_uV = 1890000,
  800. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  801. REGULATOR_CHANGE_STATUS),
  802. .boot_on = 1,
  803. },
  804. .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers),
  805. .consumer_supplies = tps65070_ldo1_consumers,
  806. },
  807. /* ldo2 */
  808. {
  809. .constraints = {
  810. .min_uV = 1140000,
  811. .max_uV = 1320000,
  812. .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
  813. REGULATOR_CHANGE_STATUS),
  814. .boot_on = 1,
  815. },
  816. .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers),
  817. .consumer_supplies = tps65070_ldo2_consumers,
  818. },
  819. };
  820. static struct touchscreen_init_data tps6507x_touchscreen_data = {
  821. .poll_period = 30, /* ms between touch samples */
  822. .min_pressure = 0x30, /* minimum pressure to trigger touch */
  823. .vref = 0, /* turn off vref when not using A/D */
  824. .vendor = 0, /* /sys/class/input/input?/id/vendor */
  825. .product = 65070, /* /sys/class/input/input?/id/product */
  826. .version = 0x100, /* /sys/class/input/input?/id/version */
  827. };
  828. static struct tps6507x_board tps_board = {
  829. .tps6507x_pmic_init_data = &tps65070_regulator_data[0],
  830. .tps6507x_ts_init_data = &tps6507x_touchscreen_data,
  831. };
  832. static struct i2c_board_info __initdata da850_evm_tps65070_info[] = {
  833. {
  834. I2C_BOARD_INFO("tps6507x", 0x48),
  835. .platform_data = &tps_board,
  836. },
  837. };
  838. static int __init pmic_tps65070_init(void)
  839. {
  840. return i2c_register_board_info(1, da850_evm_tps65070_info,
  841. ARRAY_SIZE(da850_evm_tps65070_info));
  842. }
  843. static const short da850_evm_lcdc_pins[] = {
  844. DA850_GPIO2_8, DA850_GPIO2_15,
  845. -1
  846. };
  847. static const short da850_evm_mii_pins[] = {
  848. DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
  849. DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
  850. DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
  851. DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
  852. DA850_MDIO_D,
  853. -1
  854. };
  855. static const short da850_evm_rmii_pins[] = {
  856. DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
  857. DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
  858. DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
  859. DA850_MDIO_D,
  860. -1
  861. };
  862. static int __init da850_evm_config_emac(void)
  863. {
  864. void __iomem *cfg_chip3_base;
  865. int ret;
  866. u32 val;
  867. struct davinci_soc_info *soc_info = &davinci_soc_info;
  868. u8 rmii_en = soc_info->emac_pdata->rmii_en;
  869. if (!machine_is_davinci_da850_evm())
  870. return 0;
  871. cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
  872. val = __raw_readl(cfg_chip3_base);
  873. if (rmii_en) {
  874. val |= BIT(8);
  875. ret = davinci_cfg_reg_list(da850_evm_rmii_pins);
  876. pr_info("EMAC: RMII PHY configured, MII PHY will not be"
  877. " functional\n");
  878. } else {
  879. val &= ~BIT(8);
  880. ret = davinci_cfg_reg_list(da850_evm_mii_pins);
  881. pr_info("EMAC: MII PHY configured, RMII PHY will not be"
  882. " functional\n");
  883. }
  884. if (ret)
  885. pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
  886. ret);
  887. /* configure the CFGCHIP3 register for RMII or MII */
  888. __raw_writel(val, cfg_chip3_base);
  889. ret = davinci_cfg_reg(DA850_GPIO2_6);
  890. if (ret)
  891. pr_warning("da850_evm_init:GPIO(2,6) mux setup "
  892. "failed\n");
  893. ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
  894. if (ret) {
  895. pr_warning("Cannot open GPIO %d\n",
  896. DA850_MII_MDIO_CLKEN_PIN);
  897. return ret;
  898. }
  899. /* Enable/Disable MII MDIO clock */
  900. gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en);
  901. soc_info->emac_pdata->phy_id = DA850_EVM_PHY_ID;
  902. ret = da8xx_register_emac();
  903. if (ret)
  904. pr_warning("da850_evm_init: emac registration failed: %d\n",
  905. ret);
  906. return 0;
  907. }
  908. device_initcall(da850_evm_config_emac);
  909. /*
  910. * The following EDMA channels/slots are not being used by drivers (for
  911. * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence
  912. * they are being reserved for codecs on the DSP side.
  913. */
  914. static const s16 da850_dma0_rsv_chans[][2] = {
  915. /* (offset, number) */
  916. { 8, 6},
  917. {24, 4},
  918. {30, 2},
  919. {-1, -1}
  920. };
  921. static const s16 da850_dma0_rsv_slots[][2] = {
  922. /* (offset, number) */
  923. { 8, 6},
  924. {24, 4},
  925. {30, 50},
  926. {-1, -1}
  927. };
  928. static const s16 da850_dma1_rsv_chans[][2] = {
  929. /* (offset, number) */
  930. { 0, 28},
  931. {30, 2},
  932. {-1, -1}
  933. };
  934. static const s16 da850_dma1_rsv_slots[][2] = {
  935. /* (offset, number) */
  936. { 0, 28},
  937. {30, 90},
  938. {-1, -1}
  939. };
  940. static struct edma_rsv_info da850_edma_cc0_rsv = {
  941. .rsv_chans = da850_dma0_rsv_chans,
  942. .rsv_slots = da850_dma0_rsv_slots,
  943. };
  944. static struct edma_rsv_info da850_edma_cc1_rsv = {
  945. .rsv_chans = da850_dma1_rsv_chans,
  946. .rsv_slots = da850_dma1_rsv_slots,
  947. };
  948. static struct edma_rsv_info *da850_edma_rsv[2] = {
  949. &da850_edma_cc0_rsv,
  950. &da850_edma_cc1_rsv,
  951. };
  952. #ifdef CONFIG_CPU_FREQ
  953. static __init int da850_evm_init_cpufreq(void)
  954. {
  955. switch (system_rev & 0xF) {
  956. case 3:
  957. da850_max_speed = 456000;
  958. break;
  959. case 2:
  960. da850_max_speed = 408000;
  961. break;
  962. case 1:
  963. da850_max_speed = 372000;
  964. break;
  965. }
  966. return da850_register_cpufreq("pll0_sysclk3");
  967. }
  968. #else
  969. static __init int da850_evm_init_cpufreq(void) { return 0; }
  970. #endif
  971. static __init void da850_evm_init(void)
  972. {
  973. int ret;
  974. ret = pmic_tps65070_init();
  975. if (ret)
  976. pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n",
  977. ret);
  978. ret = da850_register_edma(da850_edma_rsv);
  979. if (ret)
  980. pr_warning("da850_evm_init: edma registration failed: %d\n",
  981. ret);
  982. ret = davinci_cfg_reg_list(da850_i2c0_pins);
  983. if (ret)
  984. pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
  985. ret);
  986. ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata);
  987. if (ret)
  988. pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
  989. ret);
  990. ret = da8xx_register_watchdog();
  991. if (ret)
  992. pr_warning("da830_evm_init: watchdog registration failed: %d\n",
  993. ret);
  994. if (HAS_MMC) {
  995. ret = davinci_cfg_reg_list(da850_evm_mmcsd0_pins);
  996. if (ret)
  997. pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
  998. " %d\n", ret);
  999. ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
  1000. if (ret)
  1001. pr_warning("da850_evm_init: can not open GPIO %d\n",
  1002. DA850_MMCSD_CD_PIN);
  1003. gpio_direction_input(DA850_MMCSD_CD_PIN);
  1004. ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
  1005. if (ret)
  1006. pr_warning("da850_evm_init: can not open GPIO %d\n",
  1007. DA850_MMCSD_WP_PIN);
  1008. gpio_direction_input(DA850_MMCSD_WP_PIN);
  1009. ret = da8xx_register_mmcsd0(&da850_mmc_config);
  1010. if (ret)
  1011. pr_warning("da850_evm_init: mmcsd0 registration failed:"
  1012. " %d\n", ret);
  1013. }
  1014. davinci_serial_init(&da850_evm_uart_config);
  1015. i2c_register_board_info(1, da850_evm_i2c_devices,
  1016. ARRAY_SIZE(da850_evm_i2c_devices));
  1017. /*
  1018. * shut down uart 0 and 1; they are not used on the board and
  1019. * accessing them causes endless "too much work in irq53" messages
  1020. * with arago fs
  1021. */
  1022. __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
  1023. __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
  1024. ret = davinci_cfg_reg_list(da850_evm_mcasp_pins);
  1025. if (ret)
  1026. pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
  1027. ret);
  1028. da8xx_register_mcasp(0, &da850_evm_snd_data);
  1029. ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
  1030. if (ret)
  1031. pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
  1032. ret);
  1033. /* Handle board specific muxing for LCD here */
  1034. ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
  1035. if (ret)
  1036. pr_warning("da850_evm_init: evm specific lcd mux setup "
  1037. "failed: %d\n", ret);
  1038. ret = da850_lcd_hw_init();
  1039. if (ret)
  1040. pr_warning("da850_evm_init: lcd initialization failed: %d\n",
  1041. ret);
  1042. sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
  1043. ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
  1044. if (ret)
  1045. pr_warning("da850_evm_init: lcdc registration failed: %d\n",
  1046. ret);
  1047. ret = da8xx_register_rtc();
  1048. if (ret)
  1049. pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
  1050. ret = da850_evm_init_cpufreq();
  1051. if (ret)
  1052. pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
  1053. ret);
  1054. ret = da8xx_register_cpuidle();
  1055. if (ret)
  1056. pr_warning("da850_evm_init: cpuidle registration failed: %d\n",
  1057. ret);
  1058. ret = da850_register_pm(&da850_pm_device);
  1059. if (ret)
  1060. pr_warning("da850_evm_init: suspend registration failed: %d\n",
  1061. ret);
  1062. ret = da8xx_register_spi(1, da850evm_spi_info,
  1063. ARRAY_SIZE(da850evm_spi_info));
  1064. if (ret)
  1065. pr_warning("da850_evm_init: spi 1 registration failed: %d\n",
  1066. ret);
  1067. }
  1068. #ifdef CONFIG_SERIAL_8250_CONSOLE
  1069. static int __init da850_evm_console_init(void)
  1070. {
  1071. if (!machine_is_davinci_da850_evm())
  1072. return 0;
  1073. return add_preferred_console("ttyS", 2, "115200");
  1074. }
  1075. console_initcall(da850_evm_console_init);
  1076. #endif
  1077. static void __init da850_evm_map_io(void)
  1078. {
  1079. da850_init();
  1080. }
  1081. MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
  1082. .boot_params = (DA8XX_DDR_BASE + 0x100),
  1083. .map_io = da850_evm_map_io,
  1084. .init_irq = cp_intc_init,
  1085. .timer = &davinci_timer,
  1086. .init_machine = da850_evm_init,
  1087. MACHINE_END