mach-pcm037.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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/platform_data/at24.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 struct at24_platform_data board_eeprom = {
  242. .byte_len = 4096,
  243. .page_size = 32,
  244. .flags = AT24_FLAG_ADDR16,
  245. };
  246. static struct i2c_board_info pcm037_i2c_devices[] = {
  247. {
  248. I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
  249. .platform_data = &board_eeprom,
  250. }, {
  251. I2C_BOARD_INFO("pcf8563", 0x51),
  252. }
  253. };
  254. /* Not connected by default */
  255. #ifdef PCM970_SDHC_RW_SWITCH
  256. static int pcm970_sdhc1_get_ro(struct device *dev)
  257. {
  258. return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_SFS6));
  259. }
  260. #endif
  261. #define SDHC1_GPIO_WP IOMUX_TO_GPIO(MX31_PIN_SFS6)
  262. #define SDHC1_GPIO_DET IOMUX_TO_GPIO(MX31_PIN_SCK6)
  263. static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
  264. void *data)
  265. {
  266. int ret;
  267. ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect");
  268. if (ret)
  269. return ret;
  270. gpio_direction_input(SDHC1_GPIO_DET);
  271. #ifdef PCM970_SDHC_RW_SWITCH
  272. ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp");
  273. if (ret)
  274. goto err_gpio_free;
  275. gpio_direction_input(SDHC1_GPIO_WP);
  276. #endif
  277. ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq,
  278. IRQF_TRIGGER_FALLING, "sdhc-detect", data);
  279. if (ret)
  280. goto err_gpio_free_2;
  281. return 0;
  282. err_gpio_free_2:
  283. #ifdef PCM970_SDHC_RW_SWITCH
  284. gpio_free(SDHC1_GPIO_WP);
  285. err_gpio_free:
  286. #endif
  287. gpio_free(SDHC1_GPIO_DET);
  288. return ret;
  289. }
  290. static void pcm970_sdhc1_exit(struct device *dev, void *data)
  291. {
  292. free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), data);
  293. gpio_free(SDHC1_GPIO_DET);
  294. gpio_free(SDHC1_GPIO_WP);
  295. }
  296. static const struct imxmmc_platform_data sdhc_pdata __initconst = {
  297. #ifdef PCM970_SDHC_RW_SWITCH
  298. .get_ro = pcm970_sdhc1_get_ro,
  299. #endif
  300. .init = pcm970_sdhc1_init,
  301. .exit = pcm970_sdhc1_exit,
  302. };
  303. static struct platform_device *devices[] __initdata = {
  304. &pcm037_flash,
  305. &pcm037_sram_device,
  306. };
  307. static const struct fb_videomode fb_modedb[] = {
  308. {
  309. /* 240x320 @ 60 Hz Sharp */
  310. .name = "Sharp-LQ035Q7DH06-QVGA",
  311. .refresh = 60,
  312. .xres = 240,
  313. .yres = 320,
  314. .pixclock = 185925,
  315. .left_margin = 9,
  316. .right_margin = 16,
  317. .upper_margin = 7,
  318. .lower_margin = 9,
  319. .hsync_len = 1,
  320. .vsync_len = 1,
  321. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE |
  322. FB_SYNC_CLK_INVERT | FB_SYNC_CLK_IDLE_EN,
  323. .vmode = FB_VMODE_NONINTERLACED,
  324. .flag = 0,
  325. }, {
  326. /* 240x320 @ 60 Hz */
  327. .name = "TX090",
  328. .refresh = 60,
  329. .xres = 240,
  330. .yres = 320,
  331. .pixclock = 38255,
  332. .left_margin = 144,
  333. .right_margin = 0,
  334. .upper_margin = 7,
  335. .lower_margin = 40,
  336. .hsync_len = 96,
  337. .vsync_len = 1,
  338. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
  339. .vmode = FB_VMODE_NONINTERLACED,
  340. .flag = 0,
  341. }, {
  342. /* 240x320 @ 60 Hz */
  343. .name = "CMEL-OLED",
  344. .refresh = 60,
  345. .xres = 240,
  346. .yres = 320,
  347. .pixclock = 185925,
  348. .left_margin = 9,
  349. .right_margin = 16,
  350. .upper_margin = 7,
  351. .lower_margin = 9,
  352. .hsync_len = 1,
  353. .vsync_len = 1,
  354. .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
  355. .vmode = FB_VMODE_NONINTERLACED,
  356. .flag = 0,
  357. },
  358. };
  359. static struct mx3fb_platform_data mx3fb_pdata = {
  360. .name = "Sharp-LQ035Q7DH06-QVGA",
  361. .mode = fb_modedb,
  362. .num_modes = ARRAY_SIZE(fb_modedb),
  363. };
  364. static struct resource pcm970_sja1000_resources[] = {
  365. {
  366. .start = MX31_CS5_BASE_ADDR,
  367. .end = MX31_CS5_BASE_ADDR + 0x100 - 1,
  368. .flags = IORESOURCE_MEM,
  369. }, {
  370. /* irq number is run-time assigned */
  371. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  372. },
  373. };
  374. struct sja1000_platform_data pcm970_sja1000_platform_data = {
  375. .osc_freq = 16000000,
  376. .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
  377. .cdr = CDR_CBP,
  378. };
  379. static struct platform_device pcm970_sja1000 = {
  380. .name = "sja1000_platform",
  381. .dev = {
  382. .platform_data = &pcm970_sja1000_platform_data,
  383. },
  384. .resource = pcm970_sja1000_resources,
  385. .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
  386. };
  387. static int pcm037_otg_init(struct platform_device *pdev)
  388. {
  389. return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
  390. }
  391. static struct mxc_usbh_platform_data otg_pdata __initdata = {
  392. .init = pcm037_otg_init,
  393. .portsc = MXC_EHCI_MODE_ULPI,
  394. };
  395. static int pcm037_usbh2_init(struct platform_device *pdev)
  396. {
  397. return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
  398. }
  399. static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
  400. .init = pcm037_usbh2_init,
  401. .portsc = MXC_EHCI_MODE_ULPI,
  402. };
  403. static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
  404. .operating_mode = FSL_USB2_DR_DEVICE,
  405. .phy_mode = FSL_USB2_PHY_ULPI,
  406. };
  407. static bool otg_mode_host __initdata;
  408. static int __init pcm037_otg_mode(char *options)
  409. {
  410. if (!strcmp(options, "host"))
  411. otg_mode_host = true;
  412. else if (!strcmp(options, "device"))
  413. otg_mode_host = false;
  414. else
  415. pr_info("otg_mode neither \"host\" nor \"device\". "
  416. "Defaulting to device\n");
  417. return 1;
  418. }
  419. __setup("otg_mode=", pcm037_otg_mode);
  420. static struct regulator_consumer_supply dummy_supplies[] = {
  421. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  422. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  423. };
  424. /*
  425. * Board specific initialization.
  426. */
  427. static void __init pcm037_init(void)
  428. {
  429. imx31_soc_init();
  430. regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  431. mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
  432. mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
  433. "pcm037");
  434. #define H2_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS \
  435. | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
  436. mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, H2_PAD_CFG);
  437. mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, H2_PAD_CFG);
  438. mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, H2_PAD_CFG);
  439. mxc_iomux_set_pad(MX31_PIN_USBH2_STP, H2_PAD_CFG);
  440. mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, H2_PAD_CFG); /* USBH2_DATA0 */
  441. mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, H2_PAD_CFG); /* USBH2_DATA1 */
  442. mxc_iomux_set_pad(MX31_PIN_SRXD6, H2_PAD_CFG); /* USBH2_DATA2 */
  443. mxc_iomux_set_pad(MX31_PIN_STXD6, H2_PAD_CFG); /* USBH2_DATA3 */
  444. mxc_iomux_set_pad(MX31_PIN_SFS3, H2_PAD_CFG); /* USBH2_DATA4 */
  445. mxc_iomux_set_pad(MX31_PIN_SCK3, H2_PAD_CFG); /* USBH2_DATA5 */
  446. mxc_iomux_set_pad(MX31_PIN_SRXD3, H2_PAD_CFG); /* USBH2_DATA6 */
  447. mxc_iomux_set_pad(MX31_PIN_STXD3, H2_PAD_CFG); /* USBH2_DATA7 */
  448. if (pcm037_variant() == PCM037_EET)
  449. mxc_iomux_setup_multiple_pins(pcm037_uart1_pins,
  450. ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1");
  451. else
  452. mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins,
  453. ARRAY_SIZE(pcm037_uart1_handshake_pins),
  454. "pcm037_uart1");
  455. platform_add_devices(devices, ARRAY_SIZE(devices));
  456. imx31_add_imx2_wdt();
  457. imx31_add_imx_uart0(&uart_pdata);
  458. /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
  459. imx31_add_imx_uart1(&uart_pdata);
  460. imx31_add_imx_uart2(&uart_pdata);
  461. imx31_add_mxc_w1();
  462. /* I2C adapters and devices */
  463. i2c_register_board_info(1, pcm037_i2c_devices,
  464. ARRAY_SIZE(pcm037_i2c_devices));
  465. imx31_add_imx_i2c1(&pcm037_i2c1_data);
  466. imx31_add_imx_i2c2(&pcm037_i2c2_data);
  467. imx31_add_mxc_nand(&pcm037_nand_board_info);
  468. imx31_add_ipu_core();
  469. imx31_add_mx3_sdc_fb(&mx3fb_pdata);
  470. if (otg_mode_host) {
  471. otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
  472. ULPI_OTG_DRVVBUS_EXT);
  473. if (otg_pdata.otg)
  474. imx31_add_mxc_ehci_otg(&otg_pdata);
  475. }
  476. usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
  477. ULPI_OTG_DRVVBUS_EXT);
  478. if (usbh2_pdata.otg)
  479. imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
  480. if (!otg_mode_host)
  481. imx31_add_fsl_usb2_udc(&otg_device_pdata);
  482. }
  483. static void __init pcm037_timer_init(void)
  484. {
  485. mx31_clocks_init(26000000);
  486. }
  487. static void __init pcm037_init_late(void)
  488. {
  489. int ret;
  490. /* LAN9217 IRQ pin */
  491. ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
  492. if (!ret) {
  493. gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
  494. smsc911x_resources[1].start =
  495. gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
  496. smsc911x_resources[1].end =
  497. gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
  498. platform_device_register(&pcm037_eth);
  499. } else {
  500. pr_warn("could not get LAN irq gpio\n");
  501. }
  502. imx31_add_mxc_mmc(0, &sdhc_pdata);
  503. pcm970_sja1000_resources[1].start =
  504. gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
  505. pcm970_sja1000_resources[1].end =
  506. gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
  507. platform_device_register(&pcm970_sja1000);
  508. pcm037_eet_init_devices();
  509. }
  510. MACHINE_START(PCM037, "Phytec Phycore pcm037")
  511. /* Maintainer: Pengutronix */
  512. .atag_offset = 0x100,
  513. .map_io = mx31_map_io,
  514. .init_early = imx31_init_early,
  515. .init_irq = mx31_init_irq,
  516. .init_time = pcm037_timer_init,
  517. .init_machine = pcm037_init,
  518. .init_late = pcm037_init_late,
  519. .restart = mxc_restart,
  520. MACHINE_END