mach-pcm037.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /*
  2. * Copyright (C) 2008 Sascha Hauer, Pengutronix
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <linux/types.h>
  15. #include <linux/init.h>
  16. #include <linux/dma-mapping.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/mtd/physmap.h>
  19. #include <linux/mtd/plat-ram.h>
  20. #include <linux/memory.h>
  21. #include <linux/gpio.h>
  22. #include <linux/smsc911x.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/i2c.h>
  25. #include <linux/property.h>
  26. #include <linux/delay.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/irq.h>
  29. #include <linux/can/platform/sja1000.h>
  30. #include <linux/usb/otg.h>
  31. #include <linux/usb/ulpi.h>
  32. #include <linux/gfp.h>
  33. #include <linux/regulator/machine.h>
  34. #include <linux/regulator/fixed.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach/time.h>
  38. #include <asm/mach/map.h>
  39. #include "common.h"
  40. #include "devices-imx31.h"
  41. #include "ehci.h"
  42. #include "hardware.h"
  43. #include "iomux-mx3.h"
  44. #include "pcm037.h"
  45. #include "ulpi.h"
  46. static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
  47. static int __init pcm037_variant_setup(char *str)
  48. {
  49. if (!strcmp("eet", str))
  50. pcm037_instance = PCM037_EET;
  51. else if (strcmp("pcm970", str))
  52. pr_warn("Unknown pcm037 baseboard variant %s\n", str);
  53. return 1;
  54. }
  55. /* Supported values: "pcm970" (default) and "eet" */
  56. __setup("pcm037_variant=", pcm037_variant_setup);
  57. enum pcm037_board_variant pcm037_variant(void)
  58. {
  59. return pcm037_instance;
  60. }
  61. /* UART1 with RTS/CTS handshake signals */
  62. static unsigned int pcm037_uart1_handshake_pins[] = {
  63. MX31_PIN_CTS1__CTS1,
  64. MX31_PIN_RTS1__RTS1,
  65. MX31_PIN_TXD1__TXD1,
  66. MX31_PIN_RXD1__RXD1,
  67. };
  68. /* UART1 without RTS/CTS handshake signals */
  69. static unsigned int pcm037_uart1_pins[] = {
  70. MX31_PIN_TXD1__TXD1,
  71. MX31_PIN_RXD1__RXD1,
  72. };
  73. static unsigned int pcm037_pins[] = {
  74. /* I2C */
  75. MX31_PIN_CSPI2_MOSI__SCL,
  76. MX31_PIN_CSPI2_MISO__SDA,
  77. MX31_PIN_CSPI2_SS2__I2C3_SDA,
  78. MX31_PIN_CSPI2_SCLK__I2C3_SCL,
  79. /* SDHC1 */
  80. MX31_PIN_SD1_DATA3__SD1_DATA3,
  81. MX31_PIN_SD1_DATA2__SD1_DATA2,
  82. MX31_PIN_SD1_DATA1__SD1_DATA1,
  83. MX31_PIN_SD1_DATA0__SD1_DATA0,
  84. MX31_PIN_SD1_CLK__SD1_CLK,
  85. MX31_PIN_SD1_CMD__SD1_CMD,
  86. IOMUX_MODE(MX31_PIN_SCK6, IOMUX_CONFIG_GPIO), /* card detect */
  87. IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), /* write protect */
  88. /* SPI1 */
  89. MX31_PIN_CSPI1_MOSI__MOSI,
  90. MX31_PIN_CSPI1_MISO__MISO,
  91. MX31_PIN_CSPI1_SCLK__SCLK,
  92. MX31_PIN_CSPI1_SPI_RDY__SPI_RDY,
  93. MX31_PIN_CSPI1_SS0__SS0,
  94. MX31_PIN_CSPI1_SS1__SS1,
  95. MX31_PIN_CSPI1_SS2__SS2,
  96. /* UART2 */
  97. MX31_PIN_TXD2__TXD2,
  98. MX31_PIN_RXD2__RXD2,
  99. MX31_PIN_CTS2__CTS2,
  100. MX31_PIN_RTS2__RTS2,
  101. /* UART3 */
  102. MX31_PIN_CSPI3_MOSI__RXD3,
  103. MX31_PIN_CSPI3_MISO__TXD3,
  104. MX31_PIN_CSPI3_SCLK__RTS3,
  105. MX31_PIN_CSPI3_SPI_RDY__CTS3,
  106. /* LAN9217 irq pin */
  107. IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
  108. /* Onewire */
  109. MX31_PIN_BATT_LINE__OWIRE,
  110. /* Framebuffer */
  111. MX31_PIN_LD0__LD0,
  112. MX31_PIN_LD1__LD1,
  113. MX31_PIN_LD2__LD2,
  114. MX31_PIN_LD3__LD3,
  115. MX31_PIN_LD4__LD4,
  116. MX31_PIN_LD5__LD5,
  117. MX31_PIN_LD6__LD6,
  118. MX31_PIN_LD7__LD7,
  119. MX31_PIN_LD8__LD8,
  120. MX31_PIN_LD9__LD9,
  121. MX31_PIN_LD10__LD10,
  122. MX31_PIN_LD11__LD11,
  123. MX31_PIN_LD12__LD12,
  124. MX31_PIN_LD13__LD13,
  125. MX31_PIN_LD14__LD14,
  126. MX31_PIN_LD15__LD15,
  127. MX31_PIN_LD16__LD16,
  128. MX31_PIN_LD17__LD17,
  129. MX31_PIN_VSYNC3__VSYNC3,
  130. MX31_PIN_HSYNC__HSYNC,
  131. MX31_PIN_FPSHIFT__FPSHIFT,
  132. MX31_PIN_DRDY0__DRDY0,
  133. MX31_PIN_D3_REV__D3_REV,
  134. MX31_PIN_CONTRAST__CONTRAST,
  135. MX31_PIN_D3_SPL__D3_SPL,
  136. MX31_PIN_D3_CLS__D3_CLS,
  137. MX31_PIN_LCS0__GPIO3_23,
  138. /* GPIO */
  139. IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO),
  140. /* OTG */
  141. MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
  142. MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
  143. MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
  144. MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
  145. MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
  146. MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
  147. MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
  148. MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
  149. MX31_PIN_USBOTG_CLK__USBOTG_CLK,
  150. MX31_PIN_USBOTG_DIR__USBOTG_DIR,
  151. MX31_PIN_USBOTG_NXT__USBOTG_NXT,
  152. MX31_PIN_USBOTG_STP__USBOTG_STP,
  153. /* USB host 2 */
  154. IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
  155. IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
  156. IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
  157. IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
  158. IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
  159. IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
  160. IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC),
  161. IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC),
  162. IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC),
  163. IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC),
  164. IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC),
  165. IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC),
  166. };
  167. static struct physmap_flash_data pcm037_flash_data = {
  168. .width = 2,
  169. };
  170. static struct resource pcm037_flash_resource = {
  171. .start = 0xa0000000,
  172. .end = 0xa1ffffff,
  173. .flags = IORESOURCE_MEM,
  174. };
  175. static struct platform_device pcm037_flash = {
  176. .name = "physmap-flash",
  177. .id = 0,
  178. .dev = {
  179. .platform_data = &pcm037_flash_data,
  180. },
  181. .resource = &pcm037_flash_resource,
  182. .num_resources = 1,
  183. };
  184. static const struct imxuart_platform_data uart_pdata __initconst = {
  185. .flags = IMXUART_HAVE_RTSCTS,
  186. };
  187. static struct resource smsc911x_resources[] = {
  188. {
  189. .start = MX31_CS1_BASE_ADDR + 0x300,
  190. .end = MX31_CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
  191. .flags = IORESOURCE_MEM,
  192. }, {
  193. /* irq number is run-time assigned */
  194. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  195. },
  196. };
  197. static struct smsc911x_platform_config smsc911x_info = {
  198. .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY |
  199. SMSC911X_SAVE_MAC_ADDRESS,
  200. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  201. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  202. .phy_interface = PHY_INTERFACE_MODE_MII,
  203. };
  204. static struct platform_device pcm037_eth = {
  205. .name = "smsc911x",
  206. .id = -1,
  207. .num_resources = ARRAY_SIZE(smsc911x_resources),
  208. .resource = smsc911x_resources,
  209. .dev = {
  210. .platform_data = &smsc911x_info,
  211. },
  212. };
  213. static struct platdata_mtd_ram pcm038_sram_data = {
  214. .bankwidth = 2,
  215. };
  216. static struct resource pcm038_sram_resource = {
  217. .start = MX31_CS4_BASE_ADDR,
  218. .end = MX31_CS4_BASE_ADDR + 512 * 1024 - 1,
  219. .flags = IORESOURCE_MEM,
  220. };
  221. static struct platform_device pcm037_sram_device = {
  222. .name = "mtd-ram",
  223. .id = 0,
  224. .dev = {
  225. .platform_data = &pcm038_sram_data,
  226. },
  227. .num_resources = 1,
  228. .resource = &pcm038_sram_resource,
  229. };
  230. static const struct mxc_nand_platform_data
  231. pcm037_nand_board_info __initconst = {
  232. .width = 1,
  233. .hw_ecc = 1,
  234. };
  235. static const struct imxi2c_platform_data pcm037_i2c1_data __initconst = {
  236. .bitrate = 100000,
  237. };
  238. static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = {
  239. .bitrate = 20000,
  240. };
  241. static const struct property_entry board_eeprom_properties[] = {
  242. PROPERTY_ENTRY_U32("pagesize", 32),
  243. { }
  244. };
  245. static struct i2c_board_info pcm037_i2c_devices[] = {
  246. {
  247. I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
  248. .properties = board_eeprom_properties,
  249. }, {
  250. I2C_BOARD_INFO("pcf8563", 0x51),
  251. }
  252. };
  253. /* Not connected by default */
  254. #ifdef PCM970_SDHC_RW_SWITCH
  255. static int pcm970_sdhc1_get_ro(struct device *dev)
  256. {
  257. return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_SFS6));
  258. }
  259. #endif
  260. #define SDHC1_GPIO_WP IOMUX_TO_GPIO(MX31_PIN_SFS6)
  261. #define SDHC1_GPIO_DET IOMUX_TO_GPIO(MX31_PIN_SCK6)
  262. static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
  263. void *data)
  264. {
  265. int ret;
  266. ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect");
  267. if (ret)
  268. return ret;
  269. gpio_direction_input(SDHC1_GPIO_DET);
  270. #ifdef PCM970_SDHC_RW_SWITCH
  271. ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp");
  272. if (ret)
  273. goto err_gpio_free;
  274. gpio_direction_input(SDHC1_GPIO_WP);
  275. #endif
  276. ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq,
  277. IRQF_TRIGGER_FALLING, "sdhc-detect", data);
  278. if (ret)
  279. goto err_gpio_free_2;
  280. return 0;
  281. err_gpio_free_2:
  282. #ifdef PCM970_SDHC_RW_SWITCH
  283. gpio_free(SDHC1_GPIO_WP);
  284. err_gpio_free:
  285. #endif
  286. gpio_free(SDHC1_GPIO_DET);
  287. return ret;
  288. }
  289. static void pcm970_sdhc1_exit(struct device *dev, void *data)
  290. {
  291. free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), data);
  292. gpio_free(SDHC1_GPIO_DET);
  293. gpio_free(SDHC1_GPIO_WP);
  294. }
  295. static const struct imxmmc_platform_data sdhc_pdata __initconst = {
  296. #ifdef PCM970_SDHC_RW_SWITCH
  297. .get_ro = pcm970_sdhc1_get_ro,
  298. #endif
  299. .init = pcm970_sdhc1_init,
  300. .exit = pcm970_sdhc1_exit,
  301. };
  302. static struct platform_device *devices[] __initdata = {
  303. &pcm037_flash,
  304. &pcm037_sram_device,
  305. };
  306. static const struct fb_videomode fb_modedb[] = {
  307. {
  308. /* 240x320 @ 60 Hz Sharp */
  309. .name = "Sharp-LQ035Q7DH06-QVGA",
  310. .refresh = 60,
  311. .xres = 240,
  312. .yres = 320,
  313. .pixclock = 185925,
  314. .left_margin = 9,
  315. .right_margin = 16,
  316. .upper_margin = 7,
  317. .lower_margin = 9,
  318. .hsync_len = 1,
  319. .vsync_len = 1,
  320. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE |
  321. FB_SYNC_CLK_INVERT | FB_SYNC_CLK_IDLE_EN,
  322. .vmode = FB_VMODE_NONINTERLACED,
  323. .flag = 0,
  324. }, {
  325. /* 240x320 @ 60 Hz */
  326. .name = "TX090",
  327. .refresh = 60,
  328. .xres = 240,
  329. .yres = 320,
  330. .pixclock = 38255,
  331. .left_margin = 144,
  332. .right_margin = 0,
  333. .upper_margin = 7,
  334. .lower_margin = 40,
  335. .hsync_len = 96,
  336. .vsync_len = 1,
  337. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
  338. .vmode = FB_VMODE_NONINTERLACED,
  339. .flag = 0,
  340. }, {
  341. /* 240x320 @ 60 Hz */
  342. .name = "CMEL-OLED",
  343. .refresh = 60,
  344. .xres = 240,
  345. .yres = 320,
  346. .pixclock = 185925,
  347. .left_margin = 9,
  348. .right_margin = 16,
  349. .upper_margin = 7,
  350. .lower_margin = 9,
  351. .hsync_len = 1,
  352. .vsync_len = 1,
  353. .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
  354. .vmode = FB_VMODE_NONINTERLACED,
  355. .flag = 0,
  356. },
  357. };
  358. static struct mx3fb_platform_data mx3fb_pdata = {
  359. .name = "Sharp-LQ035Q7DH06-QVGA",
  360. .mode = fb_modedb,
  361. .num_modes = ARRAY_SIZE(fb_modedb),
  362. };
  363. static struct resource pcm970_sja1000_resources[] = {
  364. {
  365. .start = MX31_CS5_BASE_ADDR,
  366. .end = MX31_CS5_BASE_ADDR + 0x100 - 1,
  367. .flags = IORESOURCE_MEM,
  368. }, {
  369. /* irq number is run-time assigned */
  370. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  371. },
  372. };
  373. struct sja1000_platform_data pcm970_sja1000_platform_data = {
  374. .osc_freq = 16000000,
  375. .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
  376. .cdr = CDR_CBP,
  377. };
  378. static struct platform_device pcm970_sja1000 = {
  379. .name = "sja1000_platform",
  380. .dev = {
  381. .platform_data = &pcm970_sja1000_platform_data,
  382. },
  383. .resource = pcm970_sja1000_resources,
  384. .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
  385. };
  386. static int pcm037_otg_init(struct platform_device *pdev)
  387. {
  388. return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
  389. }
  390. static struct mxc_usbh_platform_data otg_pdata __initdata = {
  391. .init = pcm037_otg_init,
  392. .portsc = MXC_EHCI_MODE_ULPI,
  393. };
  394. static int pcm037_usbh2_init(struct platform_device *pdev)
  395. {
  396. return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
  397. }
  398. static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
  399. .init = pcm037_usbh2_init,
  400. .portsc = MXC_EHCI_MODE_ULPI,
  401. };
  402. static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
  403. .operating_mode = FSL_USB2_DR_DEVICE,
  404. .phy_mode = FSL_USB2_PHY_ULPI,
  405. };
  406. static bool otg_mode_host __initdata;
  407. static int __init pcm037_otg_mode(char *options)
  408. {
  409. if (!strcmp(options, "host"))
  410. otg_mode_host = true;
  411. else if (!strcmp(options, "device"))
  412. otg_mode_host = false;
  413. else
  414. pr_info("otg_mode neither \"host\" nor \"device\". "
  415. "Defaulting to device\n");
  416. return 1;
  417. }
  418. __setup("otg_mode=", pcm037_otg_mode);
  419. static struct regulator_consumer_supply dummy_supplies[] = {
  420. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  421. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  422. };
  423. /*
  424. * Board specific initialization.
  425. */
  426. static void __init pcm037_init(void)
  427. {
  428. imx31_soc_init();
  429. regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  430. mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
  431. mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
  432. "pcm037");
  433. #define H2_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS \
  434. | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
  435. mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, H2_PAD_CFG);
  436. mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, H2_PAD_CFG);
  437. mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, H2_PAD_CFG);
  438. mxc_iomux_set_pad(MX31_PIN_USBH2_STP, H2_PAD_CFG);
  439. mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, H2_PAD_CFG); /* USBH2_DATA0 */
  440. mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, H2_PAD_CFG); /* USBH2_DATA1 */
  441. mxc_iomux_set_pad(MX31_PIN_SRXD6, H2_PAD_CFG); /* USBH2_DATA2 */
  442. mxc_iomux_set_pad(MX31_PIN_STXD6, H2_PAD_CFG); /* USBH2_DATA3 */
  443. mxc_iomux_set_pad(MX31_PIN_SFS3, H2_PAD_CFG); /* USBH2_DATA4 */
  444. mxc_iomux_set_pad(MX31_PIN_SCK3, H2_PAD_CFG); /* USBH2_DATA5 */
  445. mxc_iomux_set_pad(MX31_PIN_SRXD3, H2_PAD_CFG); /* USBH2_DATA6 */
  446. mxc_iomux_set_pad(MX31_PIN_STXD3, H2_PAD_CFG); /* USBH2_DATA7 */
  447. if (pcm037_variant() == PCM037_EET)
  448. mxc_iomux_setup_multiple_pins(pcm037_uart1_pins,
  449. ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1");
  450. else
  451. mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins,
  452. ARRAY_SIZE(pcm037_uart1_handshake_pins),
  453. "pcm037_uart1");
  454. platform_add_devices(devices, ARRAY_SIZE(devices));
  455. imx31_add_imx2_wdt();
  456. imx31_add_imx_uart0(&uart_pdata);
  457. /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
  458. imx31_add_imx_uart1(&uart_pdata);
  459. imx31_add_imx_uart2(&uart_pdata);
  460. imx31_add_mxc_w1();
  461. /* I2C adapters and devices */
  462. i2c_register_board_info(1, pcm037_i2c_devices,
  463. ARRAY_SIZE(pcm037_i2c_devices));
  464. imx31_add_imx_i2c1(&pcm037_i2c1_data);
  465. imx31_add_imx_i2c2(&pcm037_i2c2_data);
  466. imx31_add_mxc_nand(&pcm037_nand_board_info);
  467. imx31_add_ipu_core();
  468. imx31_add_mx3_sdc_fb(&mx3fb_pdata);
  469. if (otg_mode_host) {
  470. otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
  471. ULPI_OTG_DRVVBUS_EXT);
  472. if (otg_pdata.otg)
  473. imx31_add_mxc_ehci_otg(&otg_pdata);
  474. }
  475. usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
  476. ULPI_OTG_DRVVBUS_EXT);
  477. if (usbh2_pdata.otg)
  478. imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
  479. if (!otg_mode_host)
  480. imx31_add_fsl_usb2_udc(&otg_device_pdata);
  481. }
  482. static void __init pcm037_timer_init(void)
  483. {
  484. mx31_clocks_init(26000000);
  485. }
  486. static void __init pcm037_init_late(void)
  487. {
  488. int ret;
  489. /* LAN9217 IRQ pin */
  490. ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
  491. if (!ret) {
  492. gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
  493. smsc911x_resources[1].start =
  494. gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
  495. smsc911x_resources[1].end =
  496. gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
  497. platform_device_register(&pcm037_eth);
  498. } else {
  499. pr_warn("could not get LAN irq gpio\n");
  500. }
  501. imx31_add_mxc_mmc(0, &sdhc_pdata);
  502. pcm970_sja1000_resources[1].start =
  503. gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
  504. pcm970_sja1000_resources[1].end =
  505. gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
  506. platform_device_register(&pcm970_sja1000);
  507. pcm037_eet_init_devices();
  508. }
  509. MACHINE_START(PCM037, "Phytec Phycore pcm037")
  510. /* Maintainer: Pengutronix */
  511. .atag_offset = 0x100,
  512. .map_io = mx31_map_io,
  513. .init_early = imx31_init_early,
  514. .init_irq = mx31_init_irq,
  515. .init_time = pcm037_timer_init,
  516. .init_machine = pcm037_init,
  517. .init_late = pcm037_init_late,
  518. .restart = mxc_restart,
  519. MACHINE_END