mach-imx27_visstrim_m10.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. /*
  2. * mach-imx27_visstrim_m10.c
  3. *
  4. * Copyright 2010 Javier Martin <javier.martin@vista-silicon.com>
  5. *
  6. * Based on mach-pcm038.c, mach-pca100.c, mach-mx27ads.c and others.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. * MA 02110-1301, USA.
  22. */
  23. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  24. #include <linux/platform_device.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/i2c.h>
  27. #include <linux/platform_data/pca953x.h>
  28. #include <linux/input.h>
  29. #include <linux/gpio.h>
  30. #include <linux/delay.h>
  31. #include <linux/dma-mapping.h>
  32. #include <linux/leds.h>
  33. #include <linux/platform_data/asoc-mx27vis.h>
  34. #include <media/soc_camera.h>
  35. #include <sound/tlv320aic32x4.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/time.h>
  39. #include <asm/system_info.h>
  40. #include <asm/memblock.h>
  41. #include "common.h"
  42. #include "devices-imx27.h"
  43. #include "ehci.h"
  44. #include "hardware.h"
  45. #include "iomux-mx27.h"
  46. #define TVP5150_RSTN (GPIO_PORTC + 18)
  47. #define TVP5150_PWDN (GPIO_PORTC + 19)
  48. #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
  49. #define SDHC1_IRQ_GPIO IMX_GPIO_NR(2, 25)
  50. #define VERSION_MASK 0x7
  51. #define MOTHERBOARD_SHIFT 4
  52. #define EXPBOARD_SHIFT 0
  53. #define MOTHERBOARD_BIT2 (GPIO_PORTD + 31)
  54. #define MOTHERBOARD_BIT1 (GPIO_PORTD + 30)
  55. #define MOTHERBOARD_BIT0 (GPIO_PORTD + 29)
  56. #define EXPBOARD_BIT2 (GPIO_PORTD + 25)
  57. #define EXPBOARD_BIT1 (GPIO_PORTD + 27)
  58. #define EXPBOARD_BIT0 (GPIO_PORTD + 28)
  59. #define AMP_GAIN_0 (GPIO_PORTF + 9)
  60. #define AMP_GAIN_1 (GPIO_PORTF + 8)
  61. #define AMP_MUTE_SDL (GPIO_PORTE + 5)
  62. #define AMP_MUTE_SDR (GPIO_PORTF + 7)
  63. static const int visstrim_m10_pins[] __initconst = {
  64. /* UART1 (console) */
  65. PE12_PF_UART1_TXD,
  66. PE13_PF_UART1_RXD,
  67. PE14_PF_UART1_CTS,
  68. PE15_PF_UART1_RTS,
  69. /* FEC */
  70. PD0_AIN_FEC_TXD0,
  71. PD1_AIN_FEC_TXD1,
  72. PD2_AIN_FEC_TXD2,
  73. PD3_AIN_FEC_TXD3,
  74. PD4_AOUT_FEC_RX_ER,
  75. PD5_AOUT_FEC_RXD1,
  76. PD6_AOUT_FEC_RXD2,
  77. PD7_AOUT_FEC_RXD3,
  78. PD8_AF_FEC_MDIO,
  79. PD9_AIN_FEC_MDC,
  80. PD10_AOUT_FEC_CRS,
  81. PD11_AOUT_FEC_TX_CLK,
  82. PD12_AOUT_FEC_RXD0,
  83. PD13_AOUT_FEC_RX_DV,
  84. PD14_AOUT_FEC_RX_CLK,
  85. PD15_AOUT_FEC_COL,
  86. PD16_AIN_FEC_TX_ER,
  87. PF23_AIN_FEC_TX_EN,
  88. /* SSI1 */
  89. PC20_PF_SSI1_FS,
  90. PC21_PF_SSI1_RXD,
  91. PC22_PF_SSI1_TXD,
  92. PC23_PF_SSI1_CLK,
  93. /* SDHC1 */
  94. PE18_PF_SD1_D0,
  95. PE19_PF_SD1_D1,
  96. PE20_PF_SD1_D2,
  97. PE21_PF_SD1_D3,
  98. PE22_PF_SD1_CMD,
  99. PE23_PF_SD1_CLK,
  100. /* Both I2Cs */
  101. PD17_PF_I2C_DATA,
  102. PD18_PF_I2C_CLK,
  103. PC5_PF_I2C2_SDA,
  104. PC6_PF_I2C2_SCL,
  105. /* USB OTG */
  106. OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
  107. PC9_PF_USBOTG_DATA0,
  108. PC11_PF_USBOTG_DATA1,
  109. PC10_PF_USBOTG_DATA2,
  110. PC13_PF_USBOTG_DATA3,
  111. PC12_PF_USBOTG_DATA4,
  112. PC7_PF_USBOTG_DATA5,
  113. PC8_PF_USBOTG_DATA6,
  114. PE25_PF_USBOTG_DATA7,
  115. PE24_PF_USBOTG_CLK,
  116. PE2_PF_USBOTG_DIR,
  117. PE0_PF_USBOTG_NXT,
  118. PE1_PF_USBOTG_STP,
  119. PB23_PF_USB_PWR,
  120. PB24_PF_USB_OC,
  121. /* CSI */
  122. TVP5150_RSTN | GPIO_GPIO | GPIO_OUT,
  123. TVP5150_PWDN | GPIO_GPIO | GPIO_OUT,
  124. PB10_PF_CSI_D0,
  125. PB11_PF_CSI_D1,
  126. PB12_PF_CSI_D2,
  127. PB13_PF_CSI_D3,
  128. PB14_PF_CSI_D4,
  129. PB15_PF_CSI_MCLK,
  130. PB16_PF_CSI_PIXCLK,
  131. PB17_PF_CSI_D5,
  132. PB18_PF_CSI_D6,
  133. PB19_PF_CSI_D7,
  134. PB20_PF_CSI_VSYNC,
  135. PB21_PF_CSI_HSYNC,
  136. /* mother board version */
  137. MOTHERBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
  138. MOTHERBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
  139. MOTHERBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
  140. /* expansion board version */
  141. EXPBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
  142. EXPBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
  143. EXPBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
  144. /* Audio AMP control */
  145. AMP_GAIN_0 | GPIO_GPIO | GPIO_OUT,
  146. AMP_GAIN_1 | GPIO_GPIO | GPIO_OUT,
  147. AMP_MUTE_SDL | GPIO_GPIO | GPIO_OUT,
  148. AMP_MUTE_SDR | GPIO_GPIO | GPIO_OUT,
  149. };
  150. static struct gpio visstrim_m10_version_gpios[] = {
  151. { EXPBOARD_BIT0, GPIOF_IN, "exp-version-0" },
  152. { EXPBOARD_BIT1, GPIOF_IN, "exp-version-1" },
  153. { EXPBOARD_BIT2, GPIOF_IN, "exp-version-2" },
  154. { MOTHERBOARD_BIT0, GPIOF_IN, "mother-version-0" },
  155. { MOTHERBOARD_BIT1, GPIOF_IN, "mother-version-1" },
  156. { MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" },
  157. };
  158. static const struct gpio visstrim_m10_gpios[] __initconst = {
  159. {
  160. .gpio = TVP5150_RSTN,
  161. .flags = GPIOF_DIR_OUT | GPIOF_INIT_HIGH,
  162. .label = "tvp5150_rstn",
  163. },
  164. {
  165. .gpio = TVP5150_PWDN,
  166. .flags = GPIOF_DIR_OUT | GPIOF_INIT_LOW,
  167. .label = "tvp5150_pwdn",
  168. },
  169. {
  170. .gpio = OTG_PHY_CS_GPIO,
  171. .flags = GPIOF_DIR_OUT | GPIOF_INIT_LOW,
  172. .label = "usbotg_cs",
  173. },
  174. {
  175. .gpio = AMP_GAIN_0,
  176. .flags = GPIOF_DIR_OUT,
  177. .label = "amp-gain-0",
  178. },
  179. {
  180. .gpio = AMP_GAIN_1,
  181. .flags = GPIOF_DIR_OUT,
  182. .label = "amp-gain-1",
  183. },
  184. {
  185. .gpio = AMP_MUTE_SDL,
  186. .flags = GPIOF_DIR_OUT,
  187. .label = "amp-mute-sdl",
  188. },
  189. {
  190. .gpio = AMP_MUTE_SDR,
  191. .flags = GPIOF_DIR_OUT,
  192. .label = "amp-mute-sdr",
  193. },
  194. };
  195. /* Camera */
  196. static int visstrim_camera_power(struct device *dev, int on)
  197. {
  198. gpio_set_value(TVP5150_PWDN, on);
  199. return 0;
  200. };
  201. static int visstrim_camera_reset(struct device *dev)
  202. {
  203. gpio_set_value(TVP5150_RSTN, 0);
  204. ndelay(500);
  205. gpio_set_value(TVP5150_RSTN, 1);
  206. return 0;
  207. };
  208. static struct i2c_board_info visstrim_i2c_camera = {
  209. I2C_BOARD_INFO("tvp5150", 0x5d),
  210. };
  211. static struct soc_camera_link iclink_tvp5150 = {
  212. .bus_id = 0,
  213. .board_info = &visstrim_i2c_camera,
  214. .i2c_adapter_id = 0,
  215. .power = visstrim_camera_power,
  216. .reset = visstrim_camera_reset,
  217. };
  218. static struct mx2_camera_platform_data visstrim_camera = {
  219. .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE |
  220. MX2_CAMERA_PCLK_SAMPLE_RISING,
  221. .clk = 100000,
  222. };
  223. static phys_addr_t mx2_camera_base __initdata;
  224. #define MX2_CAMERA_BUF_SIZE SZ_8M
  225. static void __init visstrim_analog_camera_init(void)
  226. {
  227. struct platform_device *pdev;
  228. int dma;
  229. gpio_set_value(TVP5150_PWDN, 1);
  230. ndelay(1);
  231. gpio_set_value(TVP5150_RSTN, 0);
  232. ndelay(500);
  233. gpio_set_value(TVP5150_RSTN, 1);
  234. ndelay(200000);
  235. pdev = imx27_add_mx2_camera(&visstrim_camera);
  236. if (IS_ERR(pdev))
  237. return;
  238. dma = dma_declare_coherent_memory(&pdev->dev,
  239. mx2_camera_base, mx2_camera_base,
  240. MX2_CAMERA_BUF_SIZE,
  241. DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
  242. if (!(dma & DMA_MEMORY_MAP))
  243. return;
  244. }
  245. static void __init visstrim_reserve(void)
  246. {
  247. /* reserve 4 MiB for mx2-camera */
  248. mx2_camera_base = arm_memblock_steal(3 * MX2_CAMERA_BUF_SIZE,
  249. MX2_CAMERA_BUF_SIZE);
  250. }
  251. /* GPIOs used as events for applications */
  252. static struct gpio_keys_button visstrim_gpio_keys[] = {
  253. {
  254. .type = EV_KEY,
  255. .code = KEY_RESTART,
  256. .gpio = (GPIO_PORTC + 15),
  257. .desc = "Default config",
  258. .active_low = 0,
  259. .wakeup = 1,
  260. },
  261. {
  262. .type = EV_KEY,
  263. .code = KEY_RECORD,
  264. .gpio = (GPIO_PORTF + 14),
  265. .desc = "Record",
  266. .active_low = 0,
  267. .wakeup = 1,
  268. },
  269. {
  270. .type = EV_KEY,
  271. .code = KEY_STOP,
  272. .gpio = (GPIO_PORTF + 13),
  273. .desc = "Stop",
  274. .active_low = 0,
  275. .wakeup = 1,
  276. }
  277. };
  278. static const struct gpio_keys_platform_data
  279. visstrim_gpio_keys_platform_data __initconst = {
  280. .buttons = visstrim_gpio_keys,
  281. .nbuttons = ARRAY_SIZE(visstrim_gpio_keys),
  282. };
  283. /* led */
  284. static const struct gpio_led visstrim_m10_leds[] __initconst = {
  285. {
  286. .name = "visstrim:ld0",
  287. .default_trigger = "nand-disk",
  288. .gpio = (GPIO_PORTC + 29),
  289. },
  290. {
  291. .name = "visstrim:ld1",
  292. .default_trigger = "nand-disk",
  293. .gpio = (GPIO_PORTC + 24),
  294. },
  295. {
  296. .name = "visstrim:ld2",
  297. .default_trigger = "nand-disk",
  298. .gpio = (GPIO_PORTC + 28),
  299. },
  300. {
  301. .name = "visstrim:ld3",
  302. .default_trigger = "nand-disk",
  303. .gpio = (GPIO_PORTC + 25),
  304. },
  305. };
  306. static const struct gpio_led_platform_data visstrim_m10_led_data __initconst = {
  307. .leds = visstrim_m10_leds,
  308. .num_leds = ARRAY_SIZE(visstrim_m10_leds),
  309. };
  310. /* Visstrim_SM10 has a microSD slot connected to sdhc1 */
  311. static int visstrim_m10_sdhc1_init(struct device *dev,
  312. irq_handler_t detect_irq, void *data)
  313. {
  314. int ret;
  315. ret = request_irq(gpio_to_irq(SDHC1_IRQ_GPIO), detect_irq,
  316. IRQF_TRIGGER_FALLING, "mmc-detect", data);
  317. return ret;
  318. }
  319. static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
  320. {
  321. free_irq(gpio_to_irq(SDHC1_IRQ_GPIO), data);
  322. }
  323. static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata __initconst = {
  324. .init = visstrim_m10_sdhc1_init,
  325. .exit = visstrim_m10_sdhc1_exit,
  326. };
  327. /* Visstrim_SM10 NOR flash */
  328. static struct physmap_flash_data visstrim_m10_flash_data = {
  329. .width = 2,
  330. };
  331. static struct resource visstrim_m10_flash_resource = {
  332. .start = 0xc0000000,
  333. .end = 0xc0000000 + SZ_64M - 1,
  334. .flags = IORESOURCE_MEM,
  335. };
  336. static struct platform_device visstrim_m10_nor_mtd_device = {
  337. .name = "physmap-flash",
  338. .id = 0,
  339. .dev = {
  340. .platform_data = &visstrim_m10_flash_data,
  341. },
  342. .num_resources = 1,
  343. .resource = &visstrim_m10_flash_resource,
  344. };
  345. static struct platform_device *platform_devices[] __initdata = {
  346. &visstrim_m10_nor_mtd_device,
  347. };
  348. /* Visstrim_M10 uses UART0 as console */
  349. static const struct imxuart_platform_data uart_pdata __initconst = {
  350. .flags = IMXUART_HAVE_RTSCTS,
  351. };
  352. /* I2C */
  353. static const struct imxi2c_platform_data visstrim_m10_i2c_data __initconst = {
  354. .bitrate = 100000,
  355. };
  356. static struct pca953x_platform_data visstrim_m10_pca9555_pdata = {
  357. .gpio_base = 240, /* After MX27 internal GPIOs */
  358. .invert = 0,
  359. };
  360. static struct aic32x4_pdata visstrim_m10_aic32x4_pdata = {
  361. .power_cfg = AIC32X4_PWR_MICBIAS_2075_LDOIN |
  362. AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE |
  363. AIC32X4_PWR_AIC32X4_LDO_ENABLE |
  364. AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 |
  365. AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED,
  366. .micpga_routing = AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K |
  367. AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K,
  368. .swapdacs = false,
  369. };
  370. static struct i2c_board_info visstrim_m10_i2c_devices[] = {
  371. {
  372. I2C_BOARD_INFO("pca9555", 0x20),
  373. .platform_data = &visstrim_m10_pca9555_pdata,
  374. },
  375. {
  376. I2C_BOARD_INFO("tlv320aic32x4", 0x18),
  377. .platform_data = &visstrim_m10_aic32x4_pdata,
  378. },
  379. {
  380. I2C_BOARD_INFO("m41t00", 0x68),
  381. }
  382. };
  383. /* USB OTG */
  384. static int otg_phy_init(struct platform_device *pdev)
  385. {
  386. return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
  387. }
  388. static const struct mxc_usbh_platform_data
  389. visstrim_m10_usbotg_pdata __initconst = {
  390. .init = otg_phy_init,
  391. .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
  392. };
  393. /* SSI */
  394. static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
  395. .flags = IMX_SSI_DMA | IMX_SSI_SYN,
  396. };
  397. /* coda */
  398. static void __init visstrim_coda_init(void)
  399. {
  400. struct platform_device *pdev;
  401. int dma;
  402. pdev = imx27_add_coda();
  403. dma = dma_declare_coherent_memory(&pdev->dev,
  404. mx2_camera_base + MX2_CAMERA_BUF_SIZE,
  405. mx2_camera_base + MX2_CAMERA_BUF_SIZE,
  406. MX2_CAMERA_BUF_SIZE,
  407. DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
  408. if (!(dma & DMA_MEMORY_MAP))
  409. return;
  410. }
  411. /* DMA deinterlace */
  412. static struct platform_device visstrim_deinterlace = {
  413. .name = "m2m-deinterlace",
  414. .id = 0,
  415. };
  416. static void __init visstrim_deinterlace_init(void)
  417. {
  418. int ret = -ENOMEM;
  419. struct platform_device *pdev = &visstrim_deinterlace;
  420. int dma;
  421. ret = platform_device_register(pdev);
  422. dma = dma_declare_coherent_memory(&pdev->dev,
  423. mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
  424. mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
  425. MX2_CAMERA_BUF_SIZE,
  426. DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
  427. if (!(dma & DMA_MEMORY_MAP))
  428. return;
  429. }
  430. /* Emma-PrP for format conversion */
  431. static void __init visstrim_emmaprp_init(void)
  432. {
  433. struct platform_device *pdev;
  434. int dma;
  435. pdev = imx27_add_mx2_emmaprp();
  436. if (IS_ERR(pdev))
  437. return;
  438. /*
  439. * Use the same memory area as the analog camera since both
  440. * devices are, by nature, exclusive.
  441. */
  442. dma = dma_declare_coherent_memory(&pdev->dev,
  443. mx2_camera_base, mx2_camera_base,
  444. MX2_CAMERA_BUF_SIZE,
  445. DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
  446. if (!(dma & DMA_MEMORY_MAP))
  447. pr_err("Failed to declare memory for emmaprp\n");
  448. }
  449. /* Audio */
  450. static const struct snd_mx27vis_platform_data snd_mx27vis_pdata __initconst = {
  451. .amp_gain0_gpio = AMP_GAIN_0,
  452. .amp_gain1_gpio = AMP_GAIN_1,
  453. .amp_mutel_gpio = AMP_MUTE_SDL,
  454. .amp_muter_gpio = AMP_MUTE_SDR,
  455. };
  456. static void __init visstrim_m10_revision(void)
  457. {
  458. int exp_version = 0;
  459. int mo_version = 0;
  460. int ret;
  461. ret = gpio_request_array(visstrim_m10_version_gpios,
  462. ARRAY_SIZE(visstrim_m10_version_gpios));
  463. if (ret) {
  464. pr_err("Failed to request version gpios");
  465. return;
  466. }
  467. /* Get expansion board version (negative logic) */
  468. exp_version |= !gpio_get_value(EXPBOARD_BIT2) << 2;
  469. exp_version |= !gpio_get_value(EXPBOARD_BIT1) << 1;
  470. exp_version |= !gpio_get_value(EXPBOARD_BIT0);
  471. /* Get mother board version (negative logic) */
  472. mo_version |= !gpio_get_value(MOTHERBOARD_BIT2) << 2;
  473. mo_version |= !gpio_get_value(MOTHERBOARD_BIT1) << 1;
  474. mo_version |= !gpio_get_value(MOTHERBOARD_BIT0);
  475. system_rev = 0x27000;
  476. system_rev |= (mo_version << MOTHERBOARD_SHIFT);
  477. system_rev |= (exp_version << EXPBOARD_SHIFT);
  478. }
  479. static void __init visstrim_m10_board_init(void)
  480. {
  481. int ret;
  482. imx27_soc_init();
  483. visstrim_m10_revision();
  484. ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
  485. ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
  486. if (ret)
  487. pr_err("Failed to setup pins (%d)\n", ret);
  488. imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata);
  489. imx27_add_imx_uart0(&uart_pdata);
  490. imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
  491. imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
  492. i2c_register_board_info(0, visstrim_m10_i2c_devices,
  493. ARRAY_SIZE(visstrim_m10_i2c_devices));
  494. imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
  495. imx27_add_mxc_ehci_otg(&visstrim_m10_usbotg_pdata);
  496. imx27_add_fec(NULL);
  497. platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
  498. }
  499. static void __init visstrim_m10_late_init(void)
  500. {
  501. int mo_version, ret;
  502. ret = gpio_request_array(visstrim_m10_gpios,
  503. ARRAY_SIZE(visstrim_m10_gpios));
  504. if (ret)
  505. pr_err("Failed to request gpios (%d)\n", ret);
  506. imx_add_gpio_keys(&visstrim_gpio_keys_platform_data);
  507. imx_add_platform_device("mx27vis", 0, NULL, 0, &snd_mx27vis_pdata,
  508. sizeof(snd_mx27vis_pdata));
  509. platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0,
  510. &iclink_tvp5150, sizeof(iclink_tvp5150));
  511. gpio_led_register_device(0, &visstrim_m10_led_data);
  512. /* Use mother board version to decide what video devices we shall use */
  513. mo_version = (system_rev >> MOTHERBOARD_SHIFT) & VERSION_MASK;
  514. if (mo_version & 0x1) {
  515. visstrim_emmaprp_init();
  516. /*
  517. * Despite not being used, tvp5150 must be
  518. * powered on to avoid I2C problems. To minimize
  519. * power consupmtion keep reset enabled.
  520. */
  521. gpio_set_value(TVP5150_PWDN, 1);
  522. ndelay(1);
  523. gpio_set_value(TVP5150_RSTN, 0);
  524. } else {
  525. visstrim_deinterlace_init();
  526. visstrim_analog_camera_init();
  527. }
  528. visstrim_coda_init();
  529. }
  530. static void __init visstrim_m10_timer_init(void)
  531. {
  532. mx27_clocks_init((unsigned long)25000000);
  533. }
  534. MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10")
  535. .atag_offset = 0x100,
  536. .reserve = visstrim_reserve,
  537. .map_io = mx27_map_io,
  538. .init_early = imx27_init_early,
  539. .init_irq = mx27_init_irq,
  540. .init_time = visstrim_m10_timer_init,
  541. .init_machine = visstrim_m10_board_init,
  542. .init_late = visstrim_m10_late_init,
  543. .restart = mxc_restart,
  544. MACHINE_END