board-da830-evm.c 17 KB

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