mx51_efika.c 15 KB

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