mx51_efika.c 15 KB

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