board-da830-evm.c 17 KB

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