mx51_efika.c 15 KB

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