board-rx51-peripherals.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. /*
  2. * linux/arch/arm/mach-omap2/board-rx51-peripherals.c
  3. *
  4. * Copyright (C) 2008-2009 Nokia
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/input.h>
  14. #include <linux/input/matrix_keypad.h>
  15. #include <linux/spi/spi.h>
  16. #include <linux/wl12xx.h>
  17. #include <linux/i2c.h>
  18. #include <linux/i2c/twl.h>
  19. #include <linux/clk.h>
  20. #include <linux/delay.h>
  21. #include <linux/regulator/machine.h>
  22. #include <linux/gpio.h>
  23. #include <linux/gpio_keys.h>
  24. #include <linux/mmc/host.h>
  25. #include <linux/power/isp1704_charger.h>
  26. #include <plat/mcspi.h>
  27. #include <plat/board.h>
  28. #include <plat/common.h>
  29. #include <plat/dma.h>
  30. #include <plat/gpmc.h>
  31. #include <plat/onenand.h>
  32. #include <plat/gpmc-smc91x.h>
  33. #include <mach/board-rx51.h>
  34. #include <sound/tlv320aic3x.h>
  35. #include <sound/tpa6130a2-plat.h>
  36. #include <media/radio-si4713.h>
  37. #include <media/si4713.h>
  38. #include <linux/leds-lp5523.h>
  39. #include <../drivers/staging/iio/light/tsl2563.h>
  40. #include "mux.h"
  41. #include "hsmmc.h"
  42. #include "common-board-devices.h"
  43. #define SYSTEM_REV_B_USES_VAUX3 0x1699
  44. #define SYSTEM_REV_S_USES_VAUX3 0x8
  45. #define RX51_WL1251_POWER_GPIO 87
  46. #define RX51_WL1251_IRQ_GPIO 42
  47. #define RX51_FMTX_RESET_GPIO 163
  48. #define RX51_FMTX_IRQ 53
  49. #define RX51_LP5523_CHIP_EN_GPIO 41
  50. #define RX51_USB_TRANSCEIVER_RST_GPIO 67
  51. /* list all spi devices here */
  52. enum {
  53. RX51_SPI_WL1251,
  54. RX51_SPI_MIPID, /* LCD panel */
  55. RX51_SPI_TSC2005, /* Touch Controller */
  56. };
  57. static struct wl12xx_platform_data wl1251_pdata;
  58. #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
  59. static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
  60. .cover_comp_gain = 16,
  61. };
  62. #endif
  63. #if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
  64. static struct lp5523_led_config rx51_lp5523_led_config[] = {
  65. {
  66. .chan_nr = 0,
  67. .led_current = 50,
  68. }, {
  69. .chan_nr = 1,
  70. .led_current = 50,
  71. }, {
  72. .chan_nr = 2,
  73. .led_current = 50,
  74. }, {
  75. .chan_nr = 3,
  76. .led_current = 50,
  77. }, {
  78. .chan_nr = 4,
  79. .led_current = 50,
  80. }, {
  81. .chan_nr = 5,
  82. .led_current = 50,
  83. }, {
  84. .chan_nr = 6,
  85. .led_current = 50,
  86. }, {
  87. .chan_nr = 7,
  88. .led_current = 50,
  89. }, {
  90. .chan_nr = 8,
  91. .led_current = 50,
  92. }
  93. };
  94. static int rx51_lp5523_setup(void)
  95. {
  96. return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
  97. "lp5523_enable");
  98. }
  99. static void rx51_lp5523_release(void)
  100. {
  101. gpio_free(RX51_LP5523_CHIP_EN_GPIO);
  102. }
  103. static void rx51_lp5523_enable(bool state)
  104. {
  105. gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
  106. }
  107. static struct lp5523_platform_data rx51_lp5523_platform_data = {
  108. .led_config = rx51_lp5523_led_config,
  109. .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
  110. .clock_mode = LP5523_CLOCK_AUTO,
  111. .setup_resources = rx51_lp5523_setup,
  112. .release_resources = rx51_lp5523_release,
  113. .enable = rx51_lp5523_enable,
  114. };
  115. #endif
  116. static struct omap2_mcspi_device_config wl1251_mcspi_config = {
  117. .turbo_mode = 0,
  118. .single_channel = 1,
  119. };
  120. static struct omap2_mcspi_device_config mipid_mcspi_config = {
  121. .turbo_mode = 0,
  122. .single_channel = 1,
  123. };
  124. static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
  125. .turbo_mode = 0,
  126. .single_channel = 1,
  127. };
  128. static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
  129. [RX51_SPI_WL1251] = {
  130. .modalias = "wl1251",
  131. .bus_num = 4,
  132. .chip_select = 0,
  133. .max_speed_hz = 48000000,
  134. .mode = SPI_MODE_3,
  135. .controller_data = &wl1251_mcspi_config,
  136. .platform_data = &wl1251_pdata,
  137. },
  138. [RX51_SPI_MIPID] = {
  139. .modalias = "acx565akm",
  140. .bus_num = 1,
  141. .chip_select = 2,
  142. .max_speed_hz = 6000000,
  143. .controller_data = &mipid_mcspi_config,
  144. },
  145. [RX51_SPI_TSC2005] = {
  146. .modalias = "tsc2005",
  147. .bus_num = 1,
  148. .chip_select = 0,
  149. /* .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),*/
  150. .max_speed_hz = 6000000,
  151. .controller_data = &tsc2005_mcspi_config,
  152. /* .platform_data = &tsc2005_config,*/
  153. },
  154. };
  155. static void rx51_charger_set_power(bool on)
  156. {
  157. gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
  158. }
  159. static struct isp1704_charger_data rx51_charger_data = {
  160. .set_power = rx51_charger_set_power,
  161. };
  162. static struct platform_device rx51_charger_device = {
  163. .name = "isp1704_charger",
  164. .dev = {
  165. .platform_data = &rx51_charger_data,
  166. },
  167. };
  168. static void __init rx51_charger_init(void)
  169. {
  170. WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
  171. GPIOF_OUT_INIT_LOW, "isp1704_reset"));
  172. platform_device_register(&rx51_charger_device);
  173. }
  174. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  175. #define RX51_GPIO_CAMERA_LENS_COVER 110
  176. #define RX51_GPIO_CAMERA_FOCUS 68
  177. #define RX51_GPIO_CAMERA_CAPTURE 69
  178. #define RX51_GPIO_KEYPAD_SLIDE 71
  179. #define RX51_GPIO_LOCK_BUTTON 113
  180. #define RX51_GPIO_PROXIMITY 89
  181. #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
  182. static struct gpio_keys_button rx51_gpio_keys[] = {
  183. {
  184. .desc = "Camera Lens Cover",
  185. .type = EV_SW,
  186. .code = SW_CAMERA_LENS_COVER,
  187. .gpio = RX51_GPIO_CAMERA_LENS_COVER,
  188. .active_low = 1,
  189. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  190. }, {
  191. .desc = "Camera Focus",
  192. .type = EV_KEY,
  193. .code = KEY_CAMERA_FOCUS,
  194. .gpio = RX51_GPIO_CAMERA_FOCUS,
  195. .active_low = 1,
  196. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  197. }, {
  198. .desc = "Camera Capture",
  199. .type = EV_KEY,
  200. .code = KEY_CAMERA,
  201. .gpio = RX51_GPIO_CAMERA_CAPTURE,
  202. .active_low = 1,
  203. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  204. }, {
  205. .desc = "Lock Button",
  206. .type = EV_KEY,
  207. .code = KEY_SCREENLOCK,
  208. .gpio = RX51_GPIO_LOCK_BUTTON,
  209. .active_low = 1,
  210. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  211. }, {
  212. .desc = "Keypad Slide",
  213. .type = EV_SW,
  214. .code = SW_KEYPAD_SLIDE,
  215. .gpio = RX51_GPIO_KEYPAD_SLIDE,
  216. .active_low = 1,
  217. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  218. }, {
  219. .desc = "Proximity Sensor",
  220. .type = EV_SW,
  221. .code = SW_FRONT_PROXIMITY,
  222. .gpio = RX51_GPIO_PROXIMITY,
  223. .active_low = 0,
  224. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  225. }
  226. };
  227. static struct gpio_keys_platform_data rx51_gpio_keys_data = {
  228. .buttons = rx51_gpio_keys,
  229. .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
  230. };
  231. static struct platform_device rx51_gpio_keys_device = {
  232. .name = "gpio-keys",
  233. .id = -1,
  234. .dev = {
  235. .platform_data = &rx51_gpio_keys_data,
  236. },
  237. };
  238. static void __init rx51_add_gpio_keys(void)
  239. {
  240. platform_device_register(&rx51_gpio_keys_device);
  241. }
  242. #else
  243. static void __init rx51_add_gpio_keys(void)
  244. {
  245. }
  246. #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
  247. static uint32_t board_keymap[] = {
  248. /*
  249. * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
  250. * connected to the ground" matrix state.
  251. */
  252. KEY(0, 0, KEY_Q),
  253. KEY(0, 1, KEY_O),
  254. KEY(0, 2, KEY_P),
  255. KEY(0, 3, KEY_COMMA),
  256. KEY(0, 4, KEY_BACKSPACE),
  257. KEY(0, 6, KEY_A),
  258. KEY(0, 7, KEY_S),
  259. KEY(1, 0, KEY_W),
  260. KEY(1, 1, KEY_D),
  261. KEY(1, 2, KEY_F),
  262. KEY(1, 3, KEY_G),
  263. KEY(1, 4, KEY_H),
  264. KEY(1, 5, KEY_J),
  265. KEY(1, 6, KEY_K),
  266. KEY(1, 7, KEY_L),
  267. KEY(2, 0, KEY_E),
  268. KEY(2, 1, KEY_DOT),
  269. KEY(2, 2, KEY_UP),
  270. KEY(2, 3, KEY_ENTER),
  271. KEY(2, 5, KEY_Z),
  272. KEY(2, 6, KEY_X),
  273. KEY(2, 7, KEY_C),
  274. KEY(2, 8, KEY_F9),
  275. KEY(3, 0, KEY_R),
  276. KEY(3, 1, KEY_V),
  277. KEY(3, 2, KEY_B),
  278. KEY(3, 3, KEY_N),
  279. KEY(3, 4, KEY_M),
  280. KEY(3, 5, KEY_SPACE),
  281. KEY(3, 6, KEY_SPACE),
  282. KEY(3, 7, KEY_LEFT),
  283. KEY(4, 0, KEY_T),
  284. KEY(4, 1, KEY_DOWN),
  285. KEY(4, 2, KEY_RIGHT),
  286. KEY(4, 4, KEY_LEFTCTRL),
  287. KEY(4, 5, KEY_RIGHTALT),
  288. KEY(4, 6, KEY_LEFTSHIFT),
  289. KEY(4, 8, KEY_F10),
  290. KEY(5, 0, KEY_Y),
  291. KEY(5, 8, KEY_F11),
  292. KEY(6, 0, KEY_U),
  293. KEY(7, 0, KEY_I),
  294. KEY(7, 1, KEY_F7),
  295. KEY(7, 2, KEY_F8),
  296. };
  297. static struct matrix_keymap_data board_map_data = {
  298. .keymap = board_keymap,
  299. .keymap_size = ARRAY_SIZE(board_keymap),
  300. };
  301. static struct twl4030_keypad_data rx51_kp_data = {
  302. .keymap_data = &board_map_data,
  303. .rows = 8,
  304. .cols = 8,
  305. .rep = 1,
  306. };
  307. static struct twl4030_madc_platform_data rx51_madc_data = {
  308. .irq_line = 1,
  309. };
  310. /* Enable input logic and pull all lines up when eMMC is on. */
  311. static struct omap_board_mux rx51_mmc2_on_mux[] = {
  312. OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  313. OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  314. OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  315. OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  316. OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  317. OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  318. OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  319. OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  320. OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  321. { .reg_offset = OMAP_MUX_TERMINATOR },
  322. };
  323. /* Disable input logic and pull all lines down when eMMC is off. */
  324. static struct omap_board_mux rx51_mmc2_off_mux[] = {
  325. OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  326. OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  327. OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  328. OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  329. OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  330. OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  331. OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  332. OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  333. OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  334. { .reg_offset = OMAP_MUX_TERMINATOR },
  335. };
  336. static struct omap_mux_partition *partition;
  337. /*
  338. * Current flows to eMMC when eMMC is off and the data lines are pulled up,
  339. * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
  340. */
  341. static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
  342. {
  343. if (power_on)
  344. omap_mux_write_array(partition, rx51_mmc2_on_mux);
  345. else
  346. omap_mux_write_array(partition, rx51_mmc2_off_mux);
  347. }
  348. static struct omap2_hsmmc_info mmc[] __initdata = {
  349. {
  350. .name = "external",
  351. .mmc = 1,
  352. .caps = MMC_CAP_4_BIT_DATA,
  353. .cover_only = true,
  354. .gpio_cd = 160,
  355. .gpio_wp = -EINVAL,
  356. .power_saving = true,
  357. },
  358. {
  359. .name = "internal",
  360. .mmc = 2,
  361. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  362. /* See also rx51_mmc2_remux */
  363. .gpio_cd = -EINVAL,
  364. .gpio_wp = -EINVAL,
  365. .nonremovable = true,
  366. .power_saving = true,
  367. .remux = rx51_mmc2_remux,
  368. },
  369. {} /* Terminator */
  370. };
  371. static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
  372. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  373. };
  374. static struct regulator_consumer_supply rx51_vaux3_supply[] = {
  375. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  376. };
  377. static struct regulator_consumer_supply rx51_vsim_supply[] = {
  378. REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
  379. };
  380. static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
  381. /* tlv320aic3x analog supplies */
  382. REGULATOR_SUPPLY("AVDD", "2-0018"),
  383. REGULATOR_SUPPLY("DRVDD", "2-0018"),
  384. REGULATOR_SUPPLY("AVDD", "2-0019"),
  385. REGULATOR_SUPPLY("DRVDD", "2-0019"),
  386. /* tpa6130a2 */
  387. REGULATOR_SUPPLY("Vdd", "2-0060"),
  388. /* Keep vmmc as last item. It is not iterated for newer boards */
  389. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  390. };
  391. static struct regulator_consumer_supply rx51_vio_supplies[] = {
  392. /* tlv320aic3x digital supplies */
  393. REGULATOR_SUPPLY("IOVDD", "2-0018"),
  394. REGULATOR_SUPPLY("DVDD", "2-0018"),
  395. REGULATOR_SUPPLY("IOVDD", "2-0019"),
  396. REGULATOR_SUPPLY("DVDD", "2-0019"),
  397. /* Si4713 IO supply */
  398. REGULATOR_SUPPLY("vio", "2-0063"),
  399. };
  400. static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
  401. REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
  402. /* Si4713 supply */
  403. REGULATOR_SUPPLY("vdd", "2-0063"),
  404. };
  405. static struct regulator_consumer_supply rx51_vdac_supply[] = {
  406. REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
  407. };
  408. static struct regulator_init_data rx51_vaux1 = {
  409. .constraints = {
  410. .name = "V28",
  411. .min_uV = 2800000,
  412. .max_uV = 2800000,
  413. .always_on = true, /* due battery cover sensor */
  414. .valid_modes_mask = REGULATOR_MODE_NORMAL
  415. | REGULATOR_MODE_STANDBY,
  416. .valid_ops_mask = REGULATOR_CHANGE_MODE
  417. | REGULATOR_CHANGE_STATUS,
  418. },
  419. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
  420. .consumer_supplies = rx51_vaux1_consumers,
  421. };
  422. static struct regulator_init_data rx51_vaux2 = {
  423. .constraints = {
  424. .name = "VCSI",
  425. .min_uV = 1800000,
  426. .max_uV = 1800000,
  427. .valid_modes_mask = REGULATOR_MODE_NORMAL
  428. | REGULATOR_MODE_STANDBY,
  429. .valid_ops_mask = REGULATOR_CHANGE_MODE
  430. | REGULATOR_CHANGE_STATUS,
  431. },
  432. };
  433. /* VAUX3 - adds more power to VIO_18 rail */
  434. static struct regulator_init_data rx51_vaux3_cam = {
  435. .constraints = {
  436. .name = "VCAM_DIG_18",
  437. .min_uV = 1800000,
  438. .max_uV = 1800000,
  439. .apply_uV = true,
  440. .valid_modes_mask = REGULATOR_MODE_NORMAL
  441. | REGULATOR_MODE_STANDBY,
  442. .valid_ops_mask = REGULATOR_CHANGE_MODE
  443. | REGULATOR_CHANGE_STATUS,
  444. },
  445. };
  446. static struct regulator_init_data rx51_vaux3_mmc = {
  447. .constraints = {
  448. .name = "VMMC2_30",
  449. .min_uV = 2800000,
  450. .max_uV = 3000000,
  451. .apply_uV = true,
  452. .valid_modes_mask = REGULATOR_MODE_NORMAL
  453. | REGULATOR_MODE_STANDBY,
  454. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  455. | REGULATOR_CHANGE_MODE
  456. | REGULATOR_CHANGE_STATUS,
  457. },
  458. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux3_supply),
  459. .consumer_supplies = rx51_vaux3_supply,
  460. };
  461. static struct regulator_init_data rx51_vaux4 = {
  462. .constraints = {
  463. .name = "VCAM_ANA_28",
  464. .min_uV = 2800000,
  465. .max_uV = 2800000,
  466. .apply_uV = true,
  467. .valid_modes_mask = REGULATOR_MODE_NORMAL
  468. | REGULATOR_MODE_STANDBY,
  469. .valid_ops_mask = REGULATOR_CHANGE_MODE
  470. | REGULATOR_CHANGE_STATUS,
  471. },
  472. };
  473. static struct regulator_init_data rx51_vmmc1 = {
  474. .constraints = {
  475. .min_uV = 1850000,
  476. .max_uV = 3150000,
  477. .valid_modes_mask = REGULATOR_MODE_NORMAL
  478. | REGULATOR_MODE_STANDBY,
  479. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  480. | REGULATOR_CHANGE_MODE
  481. | REGULATOR_CHANGE_STATUS,
  482. },
  483. .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc1_supply),
  484. .consumer_supplies = rx51_vmmc1_supply,
  485. };
  486. static struct regulator_init_data rx51_vmmc2 = {
  487. .constraints = {
  488. .name = "V28_A",
  489. .min_uV = 2800000,
  490. .max_uV = 3000000,
  491. .always_on = true, /* due VIO leak to AIC34 VDDs */
  492. .apply_uV = true,
  493. .valid_modes_mask = REGULATOR_MODE_NORMAL
  494. | REGULATOR_MODE_STANDBY,
  495. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  496. | REGULATOR_CHANGE_MODE
  497. | REGULATOR_CHANGE_STATUS,
  498. },
  499. .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies),
  500. .consumer_supplies = rx51_vmmc2_supplies,
  501. };
  502. static struct regulator_init_data rx51_vpll1 = {
  503. .constraints = {
  504. .name = "VPLL",
  505. .min_uV = 1800000,
  506. .max_uV = 1800000,
  507. .apply_uV = true,
  508. .always_on = true,
  509. .valid_modes_mask = REGULATOR_MODE_NORMAL
  510. | REGULATOR_MODE_STANDBY,
  511. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  512. },
  513. };
  514. static struct regulator_init_data rx51_vpll2 = {
  515. .constraints = {
  516. .name = "VSDI_CSI",
  517. .min_uV = 1800000,
  518. .max_uV = 1800000,
  519. .apply_uV = true,
  520. .always_on = true,
  521. .valid_modes_mask = REGULATOR_MODE_NORMAL
  522. | REGULATOR_MODE_STANDBY,
  523. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  524. },
  525. };
  526. static struct regulator_init_data rx51_vsim = {
  527. .constraints = {
  528. .name = "VMMC2_IO_18",
  529. .min_uV = 1800000,
  530. .max_uV = 1800000,
  531. .apply_uV = true,
  532. .valid_modes_mask = REGULATOR_MODE_NORMAL
  533. | REGULATOR_MODE_STANDBY,
  534. .valid_ops_mask = REGULATOR_CHANGE_MODE
  535. | REGULATOR_CHANGE_STATUS,
  536. },
  537. .num_consumer_supplies = ARRAY_SIZE(rx51_vsim_supply),
  538. .consumer_supplies = rx51_vsim_supply,
  539. };
  540. static struct regulator_init_data rx51_vdac = {
  541. .constraints = {
  542. .name = "VDAC",
  543. .min_uV = 1800000,
  544. .max_uV = 1800000,
  545. .apply_uV = true,
  546. .valid_modes_mask = REGULATOR_MODE_NORMAL
  547. | REGULATOR_MODE_STANDBY,
  548. .valid_ops_mask = REGULATOR_CHANGE_MODE
  549. | REGULATOR_CHANGE_STATUS,
  550. },
  551. .num_consumer_supplies = ARRAY_SIZE(rx51_vdac_supply),
  552. .consumer_supplies = rx51_vdac_supply,
  553. };
  554. static struct regulator_init_data rx51_vio = {
  555. .constraints = {
  556. .min_uV = 1800000,
  557. .max_uV = 1800000,
  558. .valid_modes_mask = REGULATOR_MODE_NORMAL
  559. | REGULATOR_MODE_STANDBY,
  560. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  561. | REGULATOR_CHANGE_MODE
  562. | REGULATOR_CHANGE_STATUS,
  563. },
  564. .num_consumer_supplies = ARRAY_SIZE(rx51_vio_supplies),
  565. .consumer_supplies = rx51_vio_supplies,
  566. };
  567. static struct regulator_init_data rx51_vintana1 = {
  568. .constraints = {
  569. .name = "VINTANA1",
  570. .min_uV = 1500000,
  571. .max_uV = 1500000,
  572. .always_on = true,
  573. .valid_modes_mask = REGULATOR_MODE_NORMAL
  574. | REGULATOR_MODE_STANDBY,
  575. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  576. },
  577. };
  578. static struct regulator_init_data rx51_vintana2 = {
  579. .constraints = {
  580. .name = "VINTANA2",
  581. .min_uV = 2750000,
  582. .max_uV = 2750000,
  583. .apply_uV = true,
  584. .always_on = true,
  585. .valid_modes_mask = REGULATOR_MODE_NORMAL
  586. | REGULATOR_MODE_STANDBY,
  587. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  588. },
  589. };
  590. static struct regulator_init_data rx51_vintdig = {
  591. .constraints = {
  592. .name = "VINTDIG",
  593. .min_uV = 1500000,
  594. .max_uV = 1500000,
  595. .always_on = true,
  596. .valid_modes_mask = REGULATOR_MODE_NORMAL
  597. | REGULATOR_MODE_STANDBY,
  598. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  599. },
  600. };
  601. static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
  602. .gpio_reset = RX51_FMTX_RESET_GPIO,
  603. };
  604. static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
  605. I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
  606. .platform_data = &rx51_si4713_i2c_data,
  607. };
  608. static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
  609. .i2c_bus = 2,
  610. .subdev_board_info = &rx51_si4713_board_info,
  611. };
  612. static struct platform_device rx51_si4713_dev __initdata_or_module = {
  613. .name = "radio-si4713",
  614. .id = -1,
  615. .dev = {
  616. .platform_data = &rx51_si4713_data,
  617. },
  618. };
  619. static __init void rx51_init_si4713(void)
  620. {
  621. int err;
  622. err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
  623. if (err) {
  624. printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
  625. return;
  626. }
  627. rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
  628. platform_device_register(&rx51_si4713_dev);
  629. }
  630. static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
  631. {
  632. /* FIXME this gpio setup is just a placeholder for now */
  633. gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
  634. gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "speaker_en");
  635. return 0;
  636. }
  637. static struct twl4030_gpio_platform_data rx51_gpio_data = {
  638. .gpio_base = OMAP_MAX_GPIO_LINES,
  639. .irq_base = TWL4030_GPIO_IRQ_BASE,
  640. .irq_end = TWL4030_GPIO_IRQ_END,
  641. .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3)
  642. | BIT(4) | BIT(5)
  643. | BIT(8) | BIT(9) | BIT(10) | BIT(11)
  644. | BIT(12) | BIT(13) | BIT(14) | BIT(15)
  645. | BIT(16) | BIT(17) ,
  646. .setup = rx51_twlgpio_setup,
  647. };
  648. static struct twl4030_usb_data rx51_usb_data = {
  649. .usb_mode = T2_USB_MODE_ULPI,
  650. };
  651. static struct twl4030_ins sleep_on_seq[] __initdata = {
  652. /*
  653. * Turn off everything
  654. */
  655. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
  656. };
  657. static struct twl4030_script sleep_on_script __initdata = {
  658. .script = sleep_on_seq,
  659. .size = ARRAY_SIZE(sleep_on_seq),
  660. .flags = TWL4030_SLEEP_SCRIPT,
  661. };
  662. static struct twl4030_ins wakeup_seq[] __initdata = {
  663. /*
  664. * Reenable everything
  665. */
  666. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
  667. };
  668. static struct twl4030_script wakeup_script __initdata = {
  669. .script = wakeup_seq,
  670. .size = ARRAY_SIZE(wakeup_seq),
  671. .flags = TWL4030_WAKEUP12_SCRIPT,
  672. };
  673. static struct twl4030_ins wakeup_p3_seq[] __initdata = {
  674. /*
  675. * Reenable everything
  676. */
  677. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
  678. };
  679. static struct twl4030_script wakeup_p3_script __initdata = {
  680. .script = wakeup_p3_seq,
  681. .size = ARRAY_SIZE(wakeup_p3_seq),
  682. .flags = TWL4030_WAKEUP3_SCRIPT,
  683. };
  684. static struct twl4030_ins wrst_seq[] __initdata = {
  685. /*
  686. * Reset twl4030.
  687. * Reset VDD1 regulator.
  688. * Reset VDD2 regulator.
  689. * Reset VPLL1 regulator.
  690. * Enable sysclk output.
  691. * Reenable twl4030.
  692. */
  693. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
  694. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
  695. 0x13},
  696. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
  697. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
  698. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
  699. {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
  700. {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
  701. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
  702. };
  703. static struct twl4030_script wrst_script __initdata = {
  704. .script = wrst_seq,
  705. .size = ARRAY_SIZE(wrst_seq),
  706. .flags = TWL4030_WRST_SCRIPT,
  707. };
  708. static struct twl4030_script *twl4030_scripts[] __initdata = {
  709. /* wakeup12 script should be loaded before sleep script, otherwise a
  710. board might hit retention before loading of wakeup script is
  711. completed. This can cause boot failures depending on timing issues.
  712. */
  713. &wakeup_script,
  714. &sleep_on_script,
  715. &wakeup_p3_script,
  716. &wrst_script,
  717. };
  718. static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
  719. { .resource = RES_VDD1, .devgroup = -1,
  720. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  721. .remap_sleep = RES_STATE_OFF
  722. },
  723. { .resource = RES_VDD2, .devgroup = -1,
  724. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  725. .remap_sleep = RES_STATE_OFF
  726. },
  727. { .resource = RES_VPLL1, .devgroup = -1,
  728. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  729. .remap_sleep = RES_STATE_OFF
  730. },
  731. { .resource = RES_VPLL2, .devgroup = -1,
  732. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  733. },
  734. { .resource = RES_VAUX1, .devgroup = -1,
  735. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  736. },
  737. { .resource = RES_VAUX2, .devgroup = -1,
  738. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  739. },
  740. { .resource = RES_VAUX3, .devgroup = -1,
  741. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  742. },
  743. { .resource = RES_VAUX4, .devgroup = -1,
  744. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  745. },
  746. { .resource = RES_VMMC1, .devgroup = -1,
  747. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  748. },
  749. { .resource = RES_VMMC2, .devgroup = -1,
  750. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  751. },
  752. { .resource = RES_VDAC, .devgroup = -1,
  753. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  754. },
  755. { .resource = RES_VSIM, .devgroup = -1,
  756. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  757. },
  758. { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  759. .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  760. },
  761. { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  762. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  763. },
  764. { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  765. .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  766. },
  767. { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
  768. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  769. },
  770. { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  771. .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
  772. },
  773. { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  774. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  775. },
  776. { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  777. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  778. },
  779. { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  780. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  781. },
  782. { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
  783. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  784. },
  785. { .resource = RES_32KCLKOUT, .devgroup = -1,
  786. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  787. },
  788. { .resource = RES_RESET, .devgroup = -1,
  789. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  790. },
  791. { .resource = RES_MAIN_REF, .devgroup = -1,
  792. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  793. },
  794. { 0, 0},
  795. };
  796. static struct twl4030_power_data rx51_t2scripts_data __initdata = {
  797. .scripts = twl4030_scripts,
  798. .num = ARRAY_SIZE(twl4030_scripts),
  799. .resource_config = twl4030_rconfig,
  800. };
  801. struct twl4030_codec_vibra_data rx51_vibra_data __initdata = {
  802. .coexist = 0,
  803. };
  804. struct twl4030_codec_data rx51_codec_data __initdata = {
  805. .audio_mclk = 26000000,
  806. .vibra = &rx51_vibra_data,
  807. };
  808. static struct twl4030_platform_data rx51_twldata __initdata = {
  809. .irq_base = TWL4030_IRQ_BASE,
  810. .irq_end = TWL4030_IRQ_END,
  811. /* platform_data for children goes here */
  812. .gpio = &rx51_gpio_data,
  813. .keypad = &rx51_kp_data,
  814. .madc = &rx51_madc_data,
  815. .usb = &rx51_usb_data,
  816. .power = &rx51_t2scripts_data,
  817. .codec = &rx51_codec_data,
  818. .vaux1 = &rx51_vaux1,
  819. .vaux2 = &rx51_vaux2,
  820. .vaux4 = &rx51_vaux4,
  821. .vmmc1 = &rx51_vmmc1,
  822. .vpll1 = &rx51_vpll1,
  823. .vpll2 = &rx51_vpll2,
  824. .vsim = &rx51_vsim,
  825. .vdac = &rx51_vdac,
  826. .vintana1 = &rx51_vintana1,
  827. .vintana2 = &rx51_vintana2,
  828. .vintdig = &rx51_vintdig,
  829. .vio = &rx51_vio,
  830. };
  831. static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
  832. .id = TPA6130A2,
  833. .power_gpio = 98,
  834. };
  835. /* Audio setup data */
  836. static struct aic3x_setup_data rx51_aic34_setup = {
  837. .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
  838. .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT,
  839. };
  840. static struct aic3x_pdata rx51_aic3x_data = {
  841. .setup = &rx51_aic34_setup,
  842. .gpio_reset = 60,
  843. };
  844. static struct aic3x_pdata rx51_aic3x_data2 = {
  845. .gpio_reset = 60,
  846. };
  847. static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
  848. {
  849. I2C_BOARD_INFO("tlv320aic3x", 0x18),
  850. .platform_data = &rx51_aic3x_data,
  851. },
  852. {
  853. I2C_BOARD_INFO("tlv320aic3x", 0x19),
  854. .platform_data = &rx51_aic3x_data2,
  855. },
  856. #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
  857. {
  858. I2C_BOARD_INFO("tsl2563", 0x29),
  859. .platform_data = &rx51_tsl2563_platform_data,
  860. },
  861. #endif
  862. #if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
  863. {
  864. I2C_BOARD_INFO("lp5523", 0x32),
  865. .platform_data = &rx51_lp5523_platform_data,
  866. },
  867. #endif
  868. {
  869. I2C_BOARD_INFO("tpa6130a2", 0x60),
  870. .platform_data = &rx51_tpa6130a2_data,
  871. }
  872. };
  873. static int __init rx51_i2c_init(void)
  874. {
  875. if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
  876. system_rev >= SYSTEM_REV_B_USES_VAUX3) {
  877. rx51_twldata.vaux3 = &rx51_vaux3_mmc;
  878. /* Only older boards use VMMC2 for internal MMC */
  879. rx51_vmmc2.num_consumer_supplies--;
  880. } else {
  881. rx51_twldata.vaux3 = &rx51_vaux3_cam;
  882. }
  883. rx51_twldata.vmmc2 = &rx51_vmmc2;
  884. omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
  885. omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
  886. ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
  887. omap_register_i2c_bus(3, 400, NULL, 0);
  888. return 0;
  889. }
  890. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  891. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  892. static struct mtd_partition onenand_partitions[] = {
  893. {
  894. .name = "bootloader",
  895. .offset = 0,
  896. .size = 0x20000,
  897. .mask_flags = MTD_WRITEABLE, /* Force read-only */
  898. },
  899. {
  900. .name = "config",
  901. .offset = MTDPART_OFS_APPEND,
  902. .size = 0x60000,
  903. },
  904. {
  905. .name = "log",
  906. .offset = MTDPART_OFS_APPEND,
  907. .size = 0x40000,
  908. },
  909. {
  910. .name = "kernel",
  911. .offset = MTDPART_OFS_APPEND,
  912. .size = 0x200000,
  913. },
  914. {
  915. .name = "initfs",
  916. .offset = MTDPART_OFS_APPEND,
  917. .size = 0x200000,
  918. },
  919. {
  920. .name = "rootfs",
  921. .offset = MTDPART_OFS_APPEND,
  922. .size = MTDPART_SIZ_FULL,
  923. },
  924. };
  925. static struct omap_onenand_platform_data board_onenand_data[] = {
  926. {
  927. .cs = 0,
  928. .gpio_irq = 65,
  929. .parts = onenand_partitions,
  930. .nr_parts = ARRAY_SIZE(onenand_partitions),
  931. .flags = ONENAND_SYNC_READWRITE,
  932. }
  933. };
  934. #endif
  935. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  936. static struct omap_smc91x_platform_data board_smc91x_data = {
  937. .cs = 1,
  938. .gpio_irq = 54,
  939. .gpio_pwrdwn = 86,
  940. .gpio_reset = 164,
  941. .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
  942. };
  943. static void __init board_smc91x_init(void)
  944. {
  945. omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
  946. omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
  947. omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
  948. gpmc_smc91x_init(&board_smc91x_data);
  949. }
  950. #else
  951. static inline void board_smc91x_init(void)
  952. {
  953. }
  954. #endif
  955. static void rx51_wl1251_set_power(bool enable)
  956. {
  957. gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
  958. }
  959. static struct gpio rx51_wl1251_gpios[] __initdata = {
  960. { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" },
  961. { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
  962. };
  963. static void __init rx51_init_wl1251(void)
  964. {
  965. int irq, ret;
  966. ret = gpio_request_array(rx51_wl1251_gpios,
  967. ARRAY_SIZE(rx51_wl1251_gpios));
  968. if (ret < 0)
  969. goto error;
  970. irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
  971. if (irq < 0)
  972. goto err_irq;
  973. wl1251_pdata.set_power = rx51_wl1251_set_power;
  974. rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
  975. return;
  976. err_irq:
  977. gpio_free(RX51_WL1251_IRQ_GPIO);
  978. gpio_free(RX51_WL1251_POWER_GPIO);
  979. error:
  980. printk(KERN_ERR "wl1251 board initialisation failed\n");
  981. wl1251_pdata.set_power = NULL;
  982. /*
  983. * Now rx51_peripherals_spi_board_info[1].irq is zero and
  984. * set_power is null, and wl1251_probe() will fail.
  985. */
  986. }
  987. void __init rx51_peripherals_init(void)
  988. {
  989. rx51_i2c_init();
  990. regulator_has_full_constraints();
  991. gpmc_onenand_init(board_onenand_data);
  992. board_smc91x_init();
  993. rx51_add_gpio_keys();
  994. rx51_init_wl1251();
  995. rx51_init_si4713();
  996. spi_register_board_info(rx51_peripherals_spi_board_info,
  997. ARRAY_SIZE(rx51_peripherals_spi_board_info));
  998. partition = omap_mux_get("core");
  999. if (partition)
  1000. omap2_hsmmc_init(mmc);
  1001. rx51_charger_init();
  1002. }