board-da850-evm.c 29 KB

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