mx51_efika.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. /*
  2. * based on code from the following
  3. * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
  4. * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
  5. * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
  6. *
  7. * The code contained herein is licensed under the GNU General Public
  8. * License. You may obtain a copy of the GNU General Public License
  9. * Version 2 or later at the following locations:
  10. *
  11. * http://www.opensource.org/licenses/gpl-license.html
  12. * http://www.gnu.org/copyleft/gpl.html
  13. */
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/i2c.h>
  17. #include <linux/gpio.h>
  18. #include <linux/leds.h>
  19. #include <linux/input.h>
  20. #include <linux/delay.h>
  21. #include <linux/io.h>
  22. #include <linux/spi/flash.h>
  23. #include <linux/spi/spi.h>
  24. #include <linux/mfd/mc13892.h>
  25. #include <linux/regulator/machine.h>
  26. #include <linux/regulator/consumer.h>
  27. #include <mach/common.h>
  28. #include <mach/hardware.h>
  29. #include <mach/iomux-mx51.h>
  30. #include <linux/usb/otg.h>
  31. #include <linux/usb/ulpi.h>
  32. #include <mach/ulpi.h>
  33. #include <asm/setup.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/mach/arch.h>
  36. #include <asm/mach/time.h>
  37. #include "devices-imx51.h"
  38. #include "efika.h"
  39. #include "cpu_op-mx51.h"
  40. #define MX51_USB_CTRL_1_OFFSET 0x10
  41. #define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
  42. #define MX51_USB_PLL_DIV_19_2_MHZ 0x01
  43. #define EFIKAMX_USB_HUB_RESET IMX_GPIO_NR(1, 5)
  44. #define EFIKAMX_USBH1_STP IMX_GPIO_NR(1, 27)
  45. #define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24)
  46. #define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25)
  47. #define EFIKAMX_PMIC IMX_GPIO_NR(1, 6)
  48. static iomux_v3_cfg_t mx51efika_pads[] = {
  49. /* UART1 */
  50. MX51_PAD_UART1_RXD__UART1_RXD,
  51. MX51_PAD_UART1_TXD__UART1_TXD,
  52. MX51_PAD_UART1_RTS__UART1_RTS,
  53. MX51_PAD_UART1_CTS__UART1_CTS,
  54. /* SD 1 */
  55. MX51_PAD_SD1_CMD__SD1_CMD,
  56. MX51_PAD_SD1_CLK__SD1_CLK,
  57. MX51_PAD_SD1_DATA0__SD1_DATA0,
  58. MX51_PAD_SD1_DATA1__SD1_DATA1,
  59. MX51_PAD_SD1_DATA2__SD1_DATA2,
  60. MX51_PAD_SD1_DATA3__SD1_DATA3,
  61. /* SD 2 */
  62. MX51_PAD_SD2_CMD__SD2_CMD,
  63. MX51_PAD_SD2_CLK__SD2_CLK,
  64. MX51_PAD_SD2_DATA0__SD2_DATA0,
  65. MX51_PAD_SD2_DATA1__SD2_DATA1,
  66. MX51_PAD_SD2_DATA2__SD2_DATA2,
  67. MX51_PAD_SD2_DATA3__SD2_DATA3,
  68. /* SD/MMC WP/CD */
  69. MX51_PAD_GPIO1_0__SD1_CD,
  70. MX51_PAD_GPIO1_1__SD1_WP,
  71. MX51_PAD_GPIO1_7__SD2_WP,
  72. MX51_PAD_GPIO1_8__SD2_CD,
  73. /* spi */
  74. MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
  75. MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
  76. MX51_PAD_CSPI1_SS0__GPIO4_24,
  77. MX51_PAD_CSPI1_SS1__GPIO4_25,
  78. MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
  79. MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
  80. MX51_PAD_GPIO1_6__GPIO1_6,
  81. /* USB HOST1 */
  82. MX51_PAD_USBH1_CLK__USBH1_CLK,
  83. MX51_PAD_USBH1_DIR__USBH1_DIR,
  84. MX51_PAD_USBH1_NXT__USBH1_NXT,
  85. MX51_PAD_USBH1_DATA0__USBH1_DATA0,
  86. MX51_PAD_USBH1_DATA1__USBH1_DATA1,
  87. MX51_PAD_USBH1_DATA2__USBH1_DATA2,
  88. MX51_PAD_USBH1_DATA3__USBH1_DATA3,
  89. MX51_PAD_USBH1_DATA4__USBH1_DATA4,
  90. MX51_PAD_USBH1_DATA5__USBH1_DATA5,
  91. MX51_PAD_USBH1_DATA6__USBH1_DATA6,
  92. MX51_PAD_USBH1_DATA7__USBH1_DATA7,
  93. /* USB HUB RESET */
  94. MX51_PAD_GPIO1_5__GPIO1_5,
  95. /* WLAN */
  96. MX51_PAD_EIM_A22__GPIO2_16,
  97. MX51_PAD_EIM_A16__GPIO2_10,
  98. /* USB PHY RESET */
  99. MX51_PAD_EIM_D27__GPIO2_9,
  100. };
  101. /* Serial ports */
  102. static const struct imxuart_platform_data uart_pdata = {
  103. .flags = IMXUART_HAVE_RTSCTS,
  104. };
  105. /* This function is board specific as the bit mask for the plldiv will also
  106. * be different for other Freescale SoCs, thus a common bitmask is not
  107. * possible and cannot get place in /plat-mxc/ehci.c.
  108. */
  109. static int initialize_otg_port(struct platform_device *pdev)
  110. {
  111. u32 v;
  112. void __iomem *usb_base;
  113. void __iomem *usbother_base;
  114. usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
  115. if (!usb_base)
  116. return -ENOMEM;
  117. usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
  118. /* Set the PHY clock to 19.2MHz */
  119. v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
  120. v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
  121. v |= MX51_USB_PLL_DIV_19_2_MHZ;
  122. __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
  123. iounmap(usb_base);
  124. mdelay(10);
  125. return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
  126. }
  127. static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
  128. .init = initialize_otg_port,
  129. .portsc = MXC_EHCI_UTMI_16BIT,
  130. };
  131. static int initialize_usbh1_port(struct platform_device *pdev)
  132. {
  133. iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
  134. iomux_v3_cfg_t usbh1gpio = MX51_PAD_USBH1_STP__GPIO1_27;
  135. u32 v;
  136. void __iomem *usb_base;
  137. void __iomem *socregs_base;
  138. mxc_iomux_v3_setup_pad(usbh1gpio);
  139. gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp");
  140. gpio_direction_output(EFIKAMX_USBH1_STP, 0);
  141. msleep(1);
  142. gpio_set_value(EFIKAMX_USBH1_STP, 1);
  143. msleep(1);
  144. usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
  145. socregs_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
  146. /* The clock for the USBH1 ULPI port will come externally */
  147. /* from the PHY. */
  148. v = __raw_readl(socregs_base + MX51_USB_CTRL_1_OFFSET);
  149. __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
  150. socregs_base + MX51_USB_CTRL_1_OFFSET);
  151. iounmap(usb_base);
  152. gpio_free(EFIKAMX_USBH1_STP);
  153. mxc_iomux_v3_setup_pad(usbh1stp);
  154. mdelay(10);
  155. return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_ITC_NO_THRESHOLD);
  156. }
  157. static struct mxc_usbh_platform_data usbh1_config __initdata = {
  158. .init = initialize_usbh1_port,
  159. .portsc = MXC_EHCI_MODE_ULPI,
  160. };
  161. static void mx51_efika_hubreset(void)
  162. {
  163. gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst");
  164. gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1);
  165. msleep(1);
  166. gpio_set_value(EFIKAMX_USB_HUB_RESET, 0);
  167. msleep(1);
  168. gpio_set_value(EFIKAMX_USB_HUB_RESET, 1);
  169. }
  170. static void __init mx51_efika_usb(void)
  171. {
  172. mx51_efika_hubreset();
  173. /* pulling it low, means no USB at all... */
  174. gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset");
  175. gpio_direction_output(EFIKA_USB_PHY_RESET, 0);
  176. msleep(1);
  177. gpio_set_value(EFIKA_USB_PHY_RESET, 1);
  178. usbh1_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
  179. ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND);
  180. imx51_add_mxc_ehci_otg(&dr_utmi_config);
  181. if (usbh1_config.otg)
  182. imx51_add_mxc_ehci_hs(1, &usbh1_config);
  183. }
  184. static struct mtd_partition mx51_efika_spi_nor_partitions[] = {
  185. {
  186. .name = "u-boot",
  187. .offset = 0,
  188. .size = SZ_256K,
  189. },
  190. {
  191. .name = "config",
  192. .offset = MTDPART_OFS_APPEND,
  193. .size = SZ_64K,
  194. },
  195. };
  196. static struct flash_platform_data mx51_efika_spi_flash_data = {
  197. .name = "spi_flash",
  198. .parts = mx51_efika_spi_nor_partitions,
  199. .nr_parts = ARRAY_SIZE(mx51_efika_spi_nor_partitions),
  200. .type = "sst25vf032b",
  201. };
  202. static struct regulator_consumer_supply sw1_consumers[] = {
  203. {
  204. .supply = "cpu_vcc",
  205. }
  206. };
  207. static struct regulator_consumer_supply vdig_consumers[] = {
  208. /* sgtl5000 */
  209. REGULATOR_SUPPLY("VDDA", "1-000a"),
  210. REGULATOR_SUPPLY("VDDD", "1-000a"),
  211. };
  212. static struct regulator_consumer_supply vvideo_consumers[] = {
  213. /* sgtl5000 */
  214. REGULATOR_SUPPLY("VDDIO", "1-000a"),
  215. };
  216. static struct regulator_consumer_supply vsd_consumers[] = {
  217. REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.0"),
  218. REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.1"),
  219. };
  220. static struct regulator_consumer_supply pwgt1_consumer[] = {
  221. {
  222. .supply = "pwgt1",
  223. }
  224. };
  225. static struct regulator_consumer_supply pwgt2_consumer[] = {
  226. {
  227. .supply = "pwgt2",
  228. }
  229. };
  230. static struct regulator_consumer_supply coincell_consumer[] = {
  231. {
  232. .supply = "coincell",
  233. }
  234. };
  235. static struct regulator_init_data sw1_init = {
  236. .constraints = {
  237. .name = "SW1",
  238. .min_uV = 600000,
  239. .max_uV = 1375000,
  240. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  241. .valid_modes_mask = 0,
  242. .always_on = 1,
  243. .boot_on = 1,
  244. .state_mem = {
  245. .uV = 850000,
  246. .mode = REGULATOR_MODE_NORMAL,
  247. .enabled = 1,
  248. },
  249. },
  250. .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
  251. .consumer_supplies = sw1_consumers,
  252. };
  253. static struct regulator_init_data sw2_init = {
  254. .constraints = {
  255. .name = "SW2",
  256. .min_uV = 900000,
  257. .max_uV = 1850000,
  258. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  259. .always_on = 1,
  260. .boot_on = 1,
  261. .state_mem = {
  262. .uV = 950000,
  263. .mode = REGULATOR_MODE_NORMAL,
  264. .enabled = 1,
  265. },
  266. }
  267. };
  268. static struct regulator_init_data sw3_init = {
  269. .constraints = {
  270. .name = "SW3",
  271. .min_uV = 1100000,
  272. .max_uV = 1850000,
  273. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  274. .always_on = 1,
  275. .boot_on = 1,
  276. }
  277. };
  278. static struct regulator_init_data sw4_init = {
  279. .constraints = {
  280. .name = "SW4",
  281. .min_uV = 1100000,
  282. .max_uV = 1850000,
  283. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  284. .always_on = 1,
  285. .boot_on = 1,
  286. }
  287. };
  288. static struct regulator_init_data viohi_init = {
  289. .constraints = {
  290. .name = "VIOHI",
  291. .boot_on = 1,
  292. .always_on = 1,
  293. }
  294. };
  295. static struct regulator_init_data vusb_init = {
  296. .constraints = {
  297. .name = "VUSB",
  298. .boot_on = 1,
  299. .always_on = 1,
  300. }
  301. };
  302. static struct regulator_init_data swbst_init = {
  303. .constraints = {
  304. .name = "SWBST",
  305. }
  306. };
  307. static struct regulator_init_data vdig_init = {
  308. .constraints = {
  309. .name = "VDIG",
  310. .min_uV = 1050000,
  311. .max_uV = 1800000,
  312. .valid_ops_mask =
  313. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  314. .boot_on = 1,
  315. .always_on = 1,
  316. },
  317. .num_consumer_supplies = ARRAY_SIZE(vdig_consumers),
  318. .consumer_supplies = vdig_consumers,
  319. };
  320. static struct regulator_init_data vpll_init = {
  321. .constraints = {
  322. .name = "VPLL",
  323. .min_uV = 1050000,
  324. .max_uV = 1800000,
  325. .valid_ops_mask =
  326. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  327. .boot_on = 1,
  328. .always_on = 1,
  329. }
  330. };
  331. static struct regulator_init_data vusb2_init = {
  332. .constraints = {
  333. .name = "VUSB2",
  334. .min_uV = 2400000,
  335. .max_uV = 2775000,
  336. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  337. .boot_on = 1,
  338. .always_on = 1,
  339. }
  340. };
  341. static struct regulator_init_data vvideo_init = {
  342. .constraints = {
  343. .name = "VVIDEO",
  344. .min_uV = 2775000,
  345. .max_uV = 2775000,
  346. .valid_ops_mask =
  347. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  348. .boot_on = 1,
  349. .apply_uV = 1,
  350. },
  351. .num_consumer_supplies = ARRAY_SIZE(vvideo_consumers),
  352. .consumer_supplies = vvideo_consumers,
  353. };
  354. static struct regulator_init_data vaudio_init = {
  355. .constraints = {
  356. .name = "VAUDIO",
  357. .min_uV = 2300000,
  358. .max_uV = 3000000,
  359. .valid_ops_mask =
  360. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  361. .boot_on = 1,
  362. }
  363. };
  364. static struct regulator_init_data vsd_init = {
  365. .constraints = {
  366. .name = "VSD",
  367. .min_uV = 1800000,
  368. .max_uV = 3150000,
  369. .valid_ops_mask =
  370. REGULATOR_CHANGE_VOLTAGE,
  371. .boot_on = 1,
  372. },
  373. .num_consumer_supplies = ARRAY_SIZE(vsd_consumers),
  374. .consumer_supplies = vsd_consumers,
  375. };
  376. static struct regulator_init_data vcam_init = {
  377. .constraints = {
  378. .name = "VCAM",
  379. .min_uV = 2500000,
  380. .max_uV = 3000000,
  381. .valid_ops_mask =
  382. REGULATOR_CHANGE_VOLTAGE |
  383. REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
  384. .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
  385. .boot_on = 1,
  386. }
  387. };
  388. static struct regulator_init_data vgen1_init = {
  389. .constraints = {
  390. .name = "VGEN1",
  391. .min_uV = 1200000,
  392. .max_uV = 3150000,
  393. .valid_ops_mask =
  394. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  395. .boot_on = 1,
  396. .always_on = 1,
  397. }
  398. };
  399. static struct regulator_init_data vgen2_init = {
  400. .constraints = {
  401. .name = "VGEN2",
  402. .min_uV = 1200000,
  403. .max_uV = 3150000,
  404. .valid_ops_mask =
  405. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  406. .boot_on = 1,
  407. .always_on = 1,
  408. }
  409. };
  410. static struct regulator_init_data vgen3_init = {
  411. .constraints = {
  412. .name = "VGEN3",
  413. .min_uV = 1800000,
  414. .max_uV = 2900000,
  415. .valid_ops_mask =
  416. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  417. .boot_on = 1,
  418. .always_on = 1,
  419. }
  420. };
  421. static struct regulator_init_data gpo1_init = {
  422. .constraints = {
  423. .name = "GPO1",
  424. }
  425. };
  426. static struct regulator_init_data gpo2_init = {
  427. .constraints = {
  428. .name = "GPO2",
  429. }
  430. };
  431. static struct regulator_init_data gpo3_init = {
  432. .constraints = {
  433. .name = "GPO3",
  434. }
  435. };
  436. static struct regulator_init_data gpo4_init = {
  437. .constraints = {
  438. .name = "GPO4",
  439. }
  440. };
  441. static struct regulator_init_data pwgt1_init = {
  442. .constraints = {
  443. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  444. .boot_on = 1,
  445. },
  446. .num_consumer_supplies = ARRAY_SIZE(pwgt1_consumer),
  447. .consumer_supplies = pwgt1_consumer,
  448. };
  449. static struct regulator_init_data pwgt2_init = {
  450. .constraints = {
  451. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  452. .boot_on = 1,
  453. },
  454. .num_consumer_supplies = ARRAY_SIZE(pwgt2_consumer),
  455. .consumer_supplies = pwgt2_consumer,
  456. };
  457. static struct regulator_init_data vcoincell_init = {
  458. .constraints = {
  459. .name = "COINCELL",
  460. .min_uV = 3000000,
  461. .max_uV = 3000000,
  462. .valid_ops_mask =
  463. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
  464. },
  465. .num_consumer_supplies = ARRAY_SIZE(coincell_consumer),
  466. .consumer_supplies = coincell_consumer,
  467. };
  468. static struct mc13xxx_regulator_init_data mx51_efika_regulators[] = {
  469. { .id = MC13892_SW1, .init_data = &sw1_init },
  470. { .id = MC13892_SW2, .init_data = &sw2_init },
  471. { .id = MC13892_SW3, .init_data = &sw3_init },
  472. { .id = MC13892_SW4, .init_data = &sw4_init },
  473. { .id = MC13892_SWBST, .init_data = &swbst_init },
  474. { .id = MC13892_VIOHI, .init_data = &viohi_init },
  475. { .id = MC13892_VPLL, .init_data = &vpll_init },
  476. { .id = MC13892_VDIG, .init_data = &vdig_init },
  477. { .id = MC13892_VSD, .init_data = &vsd_init },
  478. { .id = MC13892_VUSB2, .init_data = &vusb2_init },
  479. { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
  480. { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
  481. { .id = MC13892_VCAM, .init_data = &vcam_init },
  482. { .id = MC13892_VGEN1, .init_data = &vgen1_init },
  483. { .id = MC13892_VGEN2, .init_data = &vgen2_init },
  484. { .id = MC13892_VGEN3, .init_data = &vgen3_init },
  485. { .id = MC13892_VUSB, .init_data = &vusb_init },
  486. { .id = MC13892_GPO1, .init_data = &gpo1_init },
  487. { .id = MC13892_GPO2, .init_data = &gpo2_init },
  488. { .id = MC13892_GPO3, .init_data = &gpo3_init },
  489. { .id = MC13892_GPO4, .init_data = &gpo4_init },
  490. { .id = MC13892_PWGT1SPI, .init_data = &pwgt1_init },
  491. { .id = MC13892_PWGT2SPI, .init_data = &pwgt2_init },
  492. { .id = MC13892_VCOINCELL, .init_data = &vcoincell_init },
  493. };
  494. static struct mc13xxx_platform_data mx51_efika_mc13892_data = {
  495. .flags = MC13XXX_USE_RTC,
  496. .regulators = {
  497. .num_regulators = ARRAY_SIZE(mx51_efika_regulators),
  498. .regulators = mx51_efika_regulators,
  499. },
  500. };
  501. static struct spi_board_info mx51_efika_spi_board_info[] __initdata = {
  502. {
  503. .modalias = "m25p80",
  504. .max_speed_hz = 25000000,
  505. .bus_num = 0,
  506. .chip_select = 1,
  507. .platform_data = &mx51_efika_spi_flash_data,
  508. .irq = -1,
  509. },
  510. {
  511. .modalias = "mc13892",
  512. .max_speed_hz = 1000000,
  513. .bus_num = 0,
  514. .chip_select = 0,
  515. .platform_data = &mx51_efika_mc13892_data,
  516. .irq = IMX_GPIO_TO_IRQ(EFIKAMX_PMIC),
  517. },
  518. };
  519. static int mx51_efika_spi_cs[] = {
  520. EFIKAMX_SPI_CS0,
  521. EFIKAMX_SPI_CS1,
  522. };
  523. static const struct spi_imx_master mx51_efika_spi_pdata __initconst = {
  524. .chipselect = mx51_efika_spi_cs,
  525. .num_chipselect = ARRAY_SIZE(mx51_efika_spi_cs),
  526. };
  527. void __init efika_board_common_init(void)
  528. {
  529. mxc_iomux_v3_setup_multiple_pads(mx51efika_pads,
  530. ARRAY_SIZE(mx51efika_pads));
  531. imx51_add_imx_uart(0, &uart_pdata);
  532. mx51_efika_usb();
  533. /* FIXME: comes from original code. check this. */
  534. if (mx51_revision() < IMX_CHIP_REVISION_2_0)
  535. sw2_init.constraints.state_mem.uV = 1100000;
  536. else if (mx51_revision() == IMX_CHIP_REVISION_2_0) {
  537. sw2_init.constraints.state_mem.uV = 1250000;
  538. sw1_init.constraints.state_mem.uV = 1000000;
  539. }
  540. if (machine_is_mx51_efikasb())
  541. vgen1_init.constraints.max_uV = 1200000;
  542. gpio_request(EFIKAMX_PMIC, "pmic irq");
  543. gpio_direction_input(EFIKAMX_PMIC);
  544. spi_register_board_info(mx51_efika_spi_board_info,
  545. ARRAY_SIZE(mx51_efika_spi_board_info));
  546. imx51_add_ecspi(0, &mx51_efika_spi_pdata);
  547. imx51_add_pata_imx();
  548. #if defined(CONFIG_CPU_FREQ_IMX)
  549. get_cpu_op = mx51_get_cpu_op;
  550. #endif
  551. }