board-da830-evm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * TI DA830/OMAP L137 EVM board
  4. *
  5. * Author: Mark A. Greer <[email protected]>
  6. * Derived from: arch/arm/mach-davinci/board-dm644x-evm.c
  7. *
  8. * 2007, 2009 (c) MontaVista Software, Inc.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/console.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/gpio.h>
  15. #include <linux/gpio/machine.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/i2c.h>
  18. #include <linux/platform_data/pcf857x.h>
  19. #include <linux/property.h>
  20. #include <linux/mtd/mtd.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/spi/spi.h>
  23. #include <linux/spi/flash.h>
  24. #include <linux/platform_data/gpio-davinci.h>
  25. #include <linux/platform_data/mtd-davinci.h>
  26. #include <linux/platform_data/mtd-davinci-aemif.h>
  27. #include <linux/platform_data/spi-davinci.h>
  28. #include <linux/platform_data/usb-davinci.h>
  29. #include <linux/platform_data/ti-aemif.h>
  30. #include <linux/regulator/fixed.h>
  31. #include <linux/regulator/machine.h>
  32. #include <linux/nvmem-provider.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include "common.h"
  36. #include "mux.h"
  37. #include "da8xx.h"
  38. #include "irqs.h"
  39. #define DA830_EVM_PHY_ID ""
  40. /*
  41. * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4].
  42. */
  43. #define ON_BD_USB_DRV GPIO_TO_PIN(1, 15)
  44. #define ON_BD_USB_OVC GPIO_TO_PIN(2, 4)
  45. static const short da830_evm_usb11_pins[] = {
  46. DA830_GPIO1_15, DA830_GPIO2_4,
  47. -1
  48. };
  49. static struct regulator_consumer_supply da830_evm_usb_supplies[] = {
  50. REGULATOR_SUPPLY("vbus", NULL),
  51. };
  52. static struct regulator_init_data da830_evm_usb_vbus_data = {
  53. .consumer_supplies = da830_evm_usb_supplies,
  54. .num_consumer_supplies = ARRAY_SIZE(da830_evm_usb_supplies),
  55. .constraints = {
  56. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  57. },
  58. };
  59. static struct fixed_voltage_config da830_evm_usb_vbus = {
  60. .supply_name = "vbus",
  61. .microvolts = 33000000,
  62. .init_data = &da830_evm_usb_vbus_data,
  63. };
  64. static struct platform_device da830_evm_usb_vbus_device = {
  65. .name = "reg-fixed-voltage",
  66. .id = 0,
  67. .dev = {
  68. .platform_data = &da830_evm_usb_vbus,
  69. },
  70. };
  71. static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = {
  72. .dev_id = "ohci-da8xx",
  73. .table = {
  74. GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0),
  75. { }
  76. },
  77. };
  78. static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = {
  79. .dev_id = "reg-fixed-voltage.0",
  80. .table = {
  81. GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, NULL, 0),
  82. { }
  83. },
  84. };
  85. static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = {
  86. &da830_evm_usb_oc_gpio_lookup,
  87. &da830_evm_usb_vbus_gpio_lookup,
  88. };
  89. static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = {
  90. /* TPS2065 switch @ 5V */
  91. .potpgt = (3 + 1) / 2, /* 3 ms max */
  92. };
  93. static __init void da830_evm_usb_init(void)
  94. {
  95. int ret;
  96. ret = da8xx_register_usb_phy_clocks();
  97. if (ret)
  98. pr_warn("%s: USB PHY CLK registration failed: %d\n",
  99. __func__, ret);
  100. gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups,
  101. ARRAY_SIZE(da830_evm_usb_gpio_lookups));
  102. ret = da8xx_register_usb_phy();
  103. if (ret)
  104. pr_warn("%s: USB PHY registration failed: %d\n",
  105. __func__, ret);
  106. ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
  107. if (ret)
  108. pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
  109. else {
  110. /*
  111. * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
  112. * with the power on to power good time of 3 ms.
  113. */
  114. ret = da8xx_register_usb20(1000, 3);
  115. if (ret)
  116. pr_warn("%s: USB 2.0 registration failed: %d\n",
  117. __func__, ret);
  118. }
  119. ret = davinci_cfg_reg_list(da830_evm_usb11_pins);
  120. if (ret) {
  121. pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret);
  122. return;
  123. }
  124. ret = platform_device_register(&da830_evm_usb_vbus_device);
  125. if (ret) {
  126. pr_warn("%s: Unable to register the vbus supply\n", __func__);
  127. return;
  128. }
  129. ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
  130. if (ret)
  131. pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret);
  132. }
  133. static const short da830_evm_mcasp1_pins[] = {
  134. DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_AFSR1,
  135. DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_5,
  136. DA830_ACLKR1, DA830_AXR1_6, DA830_AXR1_7, DA830_AXR1_8, DA830_AXR1_10,
  137. DA830_AXR1_11,
  138. -1
  139. };
  140. static u8 da830_iis_serializer_direction[] = {
  141. RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  142. INACTIVE_MODE, TX_MODE, INACTIVE_MODE, INACTIVE_MODE,
  143. INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
  144. };
  145. static struct snd_platform_data da830_evm_snd_data = {
  146. .tx_dma_offset = 0x2000,
  147. .rx_dma_offset = 0x2000,
  148. .op_mode = DAVINCI_MCASP_IIS_MODE,
  149. .num_serializer = ARRAY_SIZE(da830_iis_serializer_direction),
  150. .tdm_slots = 2,
  151. .serial_dir = da830_iis_serializer_direction,
  152. .asp_chan_q = EVENTQ_0,
  153. .version = MCASP_VERSION_2,
  154. .txnumevt = 1,
  155. .rxnumevt = 1,
  156. };
  157. /*
  158. * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
  159. */
  160. static const short da830_evm_mmc_sd_pins[] = {
  161. DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
  162. DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
  163. DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
  164. DA830_MMCSD_CMD, DA830_GPIO2_1, DA830_GPIO2_2,
  165. -1
  166. };
  167. #define DA830_MMCSD_WP_PIN GPIO_TO_PIN(2, 1)
  168. #define DA830_MMCSD_CD_PIN GPIO_TO_PIN(2, 2)
  169. static struct gpiod_lookup_table mmc_gpios_table = {
  170. .dev_id = "da830-mmc.0",
  171. .table = {
  172. /* gpio chip 1 contains gpio range 32-63 */
  173. GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd",
  174. GPIO_ACTIVE_LOW),
  175. GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp",
  176. GPIO_ACTIVE_LOW),
  177. { }
  178. },
  179. };
  180. static struct davinci_mmc_config da830_evm_mmc_config = {
  181. .wires = 8,
  182. .max_freq = 50000000,
  183. .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  184. };
  185. static inline void da830_evm_init_mmc(void)
  186. {
  187. int ret;
  188. ret = davinci_cfg_reg_list(da830_evm_mmc_sd_pins);
  189. if (ret) {
  190. pr_warn("%s: mmc/sd mux setup failed: %d\n", __func__, ret);
  191. return;
  192. }
  193. gpiod_add_lookup_table(&mmc_gpios_table);
  194. ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
  195. if (ret) {
  196. pr_warn("%s: mmc/sd registration failed: %d\n", __func__, ret);
  197. gpiod_remove_lookup_table(&mmc_gpios_table);
  198. }
  199. }
  200. #define HAS_MMC IS_ENABLED(CONFIG_MMC_DAVINCI)
  201. #ifdef CONFIG_DA830_UI_NAND
  202. static struct mtd_partition da830_evm_nand_partitions[] = {
  203. /* bootloader (U-Boot, etc) in first sector */
  204. [0] = {
  205. .name = "bootloader",
  206. .offset = 0,
  207. .size = SZ_128K,
  208. .mask_flags = MTD_WRITEABLE, /* force read-only */
  209. },
  210. /* bootloader params in the next sector */
  211. [1] = {
  212. .name = "params",
  213. .offset = MTDPART_OFS_APPEND,
  214. .size = SZ_128K,
  215. .mask_flags = MTD_WRITEABLE, /* force read-only */
  216. },
  217. /* kernel */
  218. [2] = {
  219. .name = "kernel",
  220. .offset = MTDPART_OFS_APPEND,
  221. .size = SZ_2M,
  222. .mask_flags = 0,
  223. },
  224. /* file system */
  225. [3] = {
  226. .name = "filesystem",
  227. .offset = MTDPART_OFS_APPEND,
  228. .size = MTDPART_SIZ_FULL,
  229. .mask_flags = 0,
  230. }
  231. };
  232. /* flash bbt descriptors */
  233. static uint8_t da830_evm_nand_bbt_pattern[] = { 'B', 'b', 't', '0' };
  234. static uint8_t da830_evm_nand_mirror_pattern[] = { '1', 't', 'b', 'B' };
  235. static struct nand_bbt_descr da830_evm_nand_bbt_main_descr = {
  236. .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
  237. NAND_BBT_WRITE | NAND_BBT_2BIT |
  238. NAND_BBT_VERSION | NAND_BBT_PERCHIP,
  239. .offs = 2,
  240. .len = 4,
  241. .veroffs = 16,
  242. .maxblocks = 4,
  243. .pattern = da830_evm_nand_bbt_pattern
  244. };
  245. static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = {
  246. .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
  247. NAND_BBT_WRITE | NAND_BBT_2BIT |
  248. NAND_BBT_VERSION | NAND_BBT_PERCHIP,
  249. .offs = 2,
  250. .len = 4,
  251. .veroffs = 16,
  252. .maxblocks = 4,
  253. .pattern = da830_evm_nand_mirror_pattern
  254. };
  255. static struct davinci_aemif_timing da830_evm_nandflash_timing = {
  256. .wsetup = 24,
  257. .wstrobe = 21,
  258. .whold = 14,
  259. .rsetup = 19,
  260. .rstrobe = 50,
  261. .rhold = 0,
  262. .ta = 20,
  263. };
  264. static struct davinci_nand_pdata da830_evm_nand_pdata = {
  265. .core_chipsel = 1,
  266. .parts = da830_evm_nand_partitions,
  267. .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions),
  268. .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
  269. .ecc_bits = 4,
  270. .bbt_options = NAND_BBT_USE_FLASH,
  271. .bbt_td = &da830_evm_nand_bbt_main_descr,
  272. .bbt_md = &da830_evm_nand_bbt_mirror_descr,
  273. .timing = &da830_evm_nandflash_timing,
  274. };
  275. static struct resource da830_evm_nand_resources[] = {
  276. [0] = { /* First memory resource is NAND I/O window */
  277. .start = DA8XX_AEMIF_CS3_BASE,
  278. .end = DA8XX_AEMIF_CS3_BASE + PAGE_SIZE - 1,
  279. .flags = IORESOURCE_MEM,
  280. },
  281. [1] = { /* Second memory resource is AEMIF control registers */
  282. .start = DA8XX_AEMIF_CTL_BASE,
  283. .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
  284. .flags = IORESOURCE_MEM,
  285. },
  286. };
  287. static struct platform_device da830_evm_aemif_devices[] = {
  288. {
  289. .name = "davinci_nand",
  290. .id = 1,
  291. .dev = {
  292. .platform_data = &da830_evm_nand_pdata,
  293. },
  294. .num_resources = ARRAY_SIZE(da830_evm_nand_resources),
  295. .resource = da830_evm_nand_resources,
  296. },
  297. };
  298. static struct resource da830_evm_aemif_resource[] = {
  299. {
  300. .start = DA8XX_AEMIF_CTL_BASE,
  301. .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
  302. .flags = IORESOURCE_MEM,
  303. },
  304. };
  305. static struct aemif_abus_data da830_evm_aemif_abus_data[] = {
  306. {
  307. .cs = 3,
  308. },
  309. };
  310. static struct aemif_platform_data da830_evm_aemif_pdata = {
  311. .abus_data = da830_evm_aemif_abus_data,
  312. .num_abus_data = ARRAY_SIZE(da830_evm_aemif_abus_data),
  313. .sub_devices = da830_evm_aemif_devices,
  314. .num_sub_devices = ARRAY_SIZE(da830_evm_aemif_devices),
  315. .cs_offset = 2,
  316. };
  317. static struct platform_device da830_evm_aemif_device = {
  318. .name = "ti-aemif",
  319. .id = -1,
  320. .dev = {
  321. .platform_data = &da830_evm_aemif_pdata,
  322. },
  323. .resource = da830_evm_aemif_resource,
  324. .num_resources = ARRAY_SIZE(da830_evm_aemif_resource),
  325. };
  326. /*
  327. * UI board NAND/NOR flashes only use 8-bit data bus.
  328. */
  329. static const short da830_evm_emif25_pins[] = {
  330. DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3,
  331. DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7,
  332. DA830_EMA_A_0, DA830_EMA_A_1, DA830_EMA_A_2, DA830_EMA_A_3,
  333. DA830_EMA_A_4, DA830_EMA_A_5, DA830_EMA_A_6, DA830_EMA_A_7,
  334. DA830_EMA_A_8, DA830_EMA_A_9, DA830_EMA_A_10, DA830_EMA_A_11,
  335. DA830_EMA_A_12, DA830_EMA_BA_0, DA830_EMA_BA_1, DA830_NEMA_WE,
  336. DA830_NEMA_CS_2, DA830_NEMA_CS_3, DA830_NEMA_OE, DA830_EMA_WAIT_0,
  337. -1
  338. };
  339. static inline void da830_evm_init_nand(int mux_mode)
  340. {
  341. int ret;
  342. if (HAS_MMC) {
  343. pr_warn("WARNING: both MMC/SD and NAND are enabled, but they share AEMIF pins\n"
  344. "\tDisable MMC/SD for NAND support\n");
  345. return;
  346. }
  347. ret = davinci_cfg_reg_list(da830_evm_emif25_pins);
  348. if (ret)
  349. pr_warn("%s: emif25 mux setup failed: %d\n", __func__, ret);
  350. ret = platform_device_register(&da830_evm_aemif_device);
  351. if (ret)
  352. pr_warn("%s: AEMIF device not registered\n", __func__);
  353. gpio_direction_output(mux_mode, 1);
  354. }
  355. #else
  356. static inline void da830_evm_init_nand(int mux_mode) { }
  357. #endif
  358. #ifdef CONFIG_DA830_UI_LCD
  359. static inline void da830_evm_init_lcdc(int mux_mode)
  360. {
  361. int ret;
  362. ret = davinci_cfg_reg_list(da830_lcdcntl_pins);
  363. if (ret)
  364. pr_warn("%s: lcdcntl mux setup failed: %d\n", __func__, ret);
  365. ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
  366. if (ret)
  367. pr_warn("%s: lcd setup failed: %d\n", __func__, ret);
  368. gpio_direction_output(mux_mode, 0);
  369. }
  370. #else
  371. static inline void da830_evm_init_lcdc(int mux_mode) { }
  372. #endif
  373. static struct nvmem_cell_info da830_evm_nvmem_cells[] = {
  374. {
  375. .name = "macaddr",
  376. .offset = 0x7f00,
  377. .bytes = ETH_ALEN,
  378. }
  379. };
  380. static struct nvmem_cell_table da830_evm_nvmem_cell_table = {
  381. .nvmem_name = "1-00500",
  382. .cells = da830_evm_nvmem_cells,
  383. .ncells = ARRAY_SIZE(da830_evm_nvmem_cells),
  384. };
  385. static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = {
  386. .nvmem_name = "1-00500",
  387. .cell_name = "macaddr",
  388. .dev_id = "davinci_emac.1",
  389. .con_id = "mac-address",
  390. };
  391. static const struct property_entry da830_evm_i2c_eeprom_properties[] = {
  392. PROPERTY_ENTRY_U32("pagesize", 64),
  393. { }
  394. };
  395. static const struct software_node da830_evm_i2c_eeprom_node = {
  396. .properties = da830_evm_i2c_eeprom_properties,
  397. };
  398. static int __init da830_evm_ui_expander_setup(struct i2c_client *client,
  399. int gpio, unsigned ngpio, void *context)
  400. {
  401. gpio_request(gpio + 6, "UI MUX_MODE");
  402. /* Drive mux mode low to match the default without UI card */
  403. gpio_direction_output(gpio + 6, 0);
  404. da830_evm_init_lcdc(gpio + 6);
  405. da830_evm_init_nand(gpio + 6);
  406. return 0;
  407. }
  408. static void da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
  409. unsigned ngpio, void *context)
  410. {
  411. gpio_free(gpio + 6);
  412. }
  413. static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
  414. .gpio_base = DAVINCI_N_GPIO,
  415. .setup = da830_evm_ui_expander_setup,
  416. .teardown = da830_evm_ui_expander_teardown,
  417. };
  418. static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
  419. {
  420. I2C_BOARD_INFO("24c256", 0x50),
  421. .swnode = &da830_evm_i2c_eeprom_node,
  422. },
  423. {
  424. I2C_BOARD_INFO("tlv320aic3x", 0x18),
  425. },
  426. {
  427. I2C_BOARD_INFO("pcf8574", 0x3f),
  428. .platform_data = &da830_evm_ui_expander_info,
  429. },
  430. };
  431. static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
  432. .bus_freq = 100, /* kHz */
  433. .bus_delay = 0, /* usec */
  434. };
  435. /*
  436. * The following EDMA channels/slots are not being used by drivers (for
  437. * example: Timer, GPIO, UART events etc) on da830/omap-l137 EVM, hence
  438. * they are being reserved for codecs on the DSP side.
  439. */
  440. static const s16 da830_dma_rsv_chans[][2] = {
  441. /* (offset, number) */
  442. { 8, 2},
  443. {12, 2},
  444. {24, 4},
  445. {30, 2},
  446. {-1, -1}
  447. };
  448. static const s16 da830_dma_rsv_slots[][2] = {
  449. /* (offset, number) */
  450. { 8, 2},
  451. {12, 2},
  452. {24, 4},
  453. {30, 26},
  454. {-1, -1}
  455. };
  456. static struct edma_rsv_info da830_edma_rsv[] = {
  457. {
  458. .rsv_chans = da830_dma_rsv_chans,
  459. .rsv_slots = da830_dma_rsv_slots,
  460. },
  461. };
  462. static struct mtd_partition da830evm_spiflash_part[] = {
  463. [0] = {
  464. .name = "DSP-UBL",
  465. .offset = 0,
  466. .size = SZ_8K,
  467. .mask_flags = MTD_WRITEABLE,
  468. },
  469. [1] = {
  470. .name = "ARM-UBL",
  471. .offset = MTDPART_OFS_APPEND,
  472. .size = SZ_16K + SZ_8K,
  473. .mask_flags = MTD_WRITEABLE,
  474. },
  475. [2] = {
  476. .name = "U-Boot",
  477. .offset = MTDPART_OFS_APPEND,
  478. .size = SZ_256K - SZ_32K,
  479. .mask_flags = MTD_WRITEABLE,
  480. },
  481. [3] = {
  482. .name = "U-Boot-Environment",
  483. .offset = MTDPART_OFS_APPEND,
  484. .size = SZ_16K,
  485. .mask_flags = 0,
  486. },
  487. [4] = {
  488. .name = "Kernel",
  489. .offset = MTDPART_OFS_APPEND,
  490. .size = MTDPART_SIZ_FULL,
  491. .mask_flags = 0,
  492. },
  493. };
  494. static struct flash_platform_data da830evm_spiflash_data = {
  495. .name = "m25p80",
  496. .parts = da830evm_spiflash_part,
  497. .nr_parts = ARRAY_SIZE(da830evm_spiflash_part),
  498. .type = "w25x32",
  499. };
  500. static struct davinci_spi_config da830evm_spiflash_cfg = {
  501. .io_type = SPI_IO_TYPE_DMA,
  502. .c2tdelay = 8,
  503. .t2cdelay = 8,
  504. };
  505. static struct spi_board_info da830evm_spi_info[] = {
  506. {
  507. .modalias = "m25p80",
  508. .platform_data = &da830evm_spiflash_data,
  509. .controller_data = &da830evm_spiflash_cfg,
  510. .mode = SPI_MODE_0,
  511. .max_speed_hz = 30000000,
  512. .bus_num = 0,
  513. .chip_select = 0,
  514. },
  515. };
  516. static __init void da830_evm_init(void)
  517. {
  518. struct davinci_soc_info *soc_info = &davinci_soc_info;
  519. int ret;
  520. da830_register_clocks();
  521. ret = da830_register_gpio();
  522. if (ret)
  523. pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
  524. ret = da830_register_edma(da830_edma_rsv);
  525. if (ret)
  526. pr_warn("%s: edma registration failed: %d\n", __func__, ret);
  527. ret = davinci_cfg_reg_list(da830_i2c0_pins);
  528. if (ret)
  529. pr_warn("%s: i2c0 mux setup failed: %d\n", __func__, ret);
  530. ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata);
  531. if (ret)
  532. pr_warn("%s: i2c0 registration failed: %d\n", __func__, ret);
  533. da830_evm_usb_init();
  534. soc_info->emac_pdata->rmii_en = 1;
  535. soc_info->emac_pdata->phy_id = DA830_EVM_PHY_ID;
  536. ret = davinci_cfg_reg_list(da830_cpgmac_pins);
  537. if (ret)
  538. pr_warn("%s: cpgmac mux setup failed: %d\n", __func__, ret);
  539. ret = da8xx_register_emac();
  540. if (ret)
  541. pr_warn("%s: emac registration failed: %d\n", __func__, ret);
  542. ret = da8xx_register_watchdog();
  543. if (ret)
  544. pr_warn("%s: watchdog registration failed: %d\n",
  545. __func__, ret);
  546. davinci_serial_init(da8xx_serial_device);
  547. nvmem_add_cell_table(&da830_evm_nvmem_cell_table);
  548. nvmem_add_cell_lookups(&da830_evm_nvmem_cell_lookup, 1);
  549. i2c_register_board_info(1, da830_evm_i2c_devices,
  550. ARRAY_SIZE(da830_evm_i2c_devices));
  551. ret = davinci_cfg_reg_list(da830_evm_mcasp1_pins);
  552. if (ret)
  553. pr_warn("%s: mcasp1 mux setup failed: %d\n", __func__, ret);
  554. da8xx_register_mcasp(1, &da830_evm_snd_data);
  555. da830_evm_init_mmc();
  556. ret = da8xx_register_rtc();
  557. if (ret)
  558. pr_warn("%s: rtc setup failed: %d\n", __func__, ret);
  559. ret = spi_register_board_info(da830evm_spi_info,
  560. ARRAY_SIZE(da830evm_spi_info));
  561. if (ret)
  562. pr_warn("%s: spi info registration failed: %d\n",
  563. __func__, ret);
  564. ret = da8xx_register_spi_bus(0, ARRAY_SIZE(da830evm_spi_info));
  565. if (ret)
  566. pr_warn("%s: spi 0 registration failed: %d\n", __func__, ret);
  567. regulator_has_full_constraints();
  568. }
  569. #ifdef CONFIG_SERIAL_8250_CONSOLE
  570. static int __init da830_evm_console_init(void)
  571. {
  572. if (!machine_is_davinci_da830_evm())
  573. return 0;
  574. return add_preferred_console("ttyS", 2, "115200");
  575. }
  576. console_initcall(da830_evm_console_init);
  577. #endif
  578. static void __init da830_evm_map_io(void)
  579. {
  580. da830_init();
  581. }
  582. MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
  583. .atag_offset = 0x100,
  584. .map_io = da830_evm_map_io,
  585. .init_irq = da830_init_irq,
  586. .init_time = da830_init_time,
  587. .init_machine = da830_evm_init,
  588. .init_late = davinci_init_late,
  589. .dma_zone_size = SZ_128M,
  590. MACHINE_END