board-rx51-peripherals.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  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. /* Enable input logic and pull all lines up when eMMC is on. */
  308. static struct omap_board_mux rx51_mmc2_on_mux[] = {
  309. OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  310. OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  311. OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  312. OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  313. OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  314. OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  315. OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  316. OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  317. OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  318. { .reg_offset = OMAP_MUX_TERMINATOR },
  319. };
  320. /* Disable input logic and pull all lines down when eMMC is off. */
  321. static struct omap_board_mux rx51_mmc2_off_mux[] = {
  322. OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  323. OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  324. OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  325. OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  326. OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  327. OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  328. OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  329. OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  330. OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  331. { .reg_offset = OMAP_MUX_TERMINATOR },
  332. };
  333. static struct omap_mux_partition *partition;
  334. /*
  335. * Current flows to eMMC when eMMC is off and the data lines are pulled up,
  336. * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
  337. */
  338. static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
  339. {
  340. if (power_on)
  341. omap_mux_write_array(partition, rx51_mmc2_on_mux);
  342. else
  343. omap_mux_write_array(partition, rx51_mmc2_off_mux);
  344. }
  345. static struct omap2_hsmmc_info mmc[] __initdata = {
  346. {
  347. .name = "external",
  348. .mmc = 1,
  349. .caps = MMC_CAP_4_BIT_DATA,
  350. .cover_only = true,
  351. .gpio_cd = 160,
  352. .gpio_wp = -EINVAL,
  353. .power_saving = true,
  354. },
  355. {
  356. .name = "internal",
  357. .mmc = 2,
  358. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  359. /* See also rx51_mmc2_remux */
  360. .gpio_cd = -EINVAL,
  361. .gpio_wp = -EINVAL,
  362. .nonremovable = true,
  363. .power_saving = true,
  364. .remux = rx51_mmc2_remux,
  365. },
  366. {} /* Terminator */
  367. };
  368. static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
  369. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  370. };
  371. static struct regulator_consumer_supply rx51_vaux2_supply[] = {
  372. REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
  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_init_data rx51_vaux1 = {
  406. .constraints = {
  407. .name = "V28",
  408. .min_uV = 2800000,
  409. .max_uV = 2800000,
  410. .always_on = true, /* due battery cover sensor */
  411. .valid_modes_mask = REGULATOR_MODE_NORMAL
  412. | REGULATOR_MODE_STANDBY,
  413. .valid_ops_mask = REGULATOR_CHANGE_MODE
  414. | REGULATOR_CHANGE_STATUS,
  415. },
  416. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
  417. .consumer_supplies = rx51_vaux1_consumers,
  418. };
  419. static struct regulator_init_data rx51_vaux2 = {
  420. .constraints = {
  421. .name = "VCSI",
  422. .min_uV = 1800000,
  423. .max_uV = 1800000,
  424. .valid_modes_mask = REGULATOR_MODE_NORMAL
  425. | REGULATOR_MODE_STANDBY,
  426. .valid_ops_mask = REGULATOR_CHANGE_MODE
  427. | REGULATOR_CHANGE_STATUS,
  428. },
  429. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux2_supply),
  430. .consumer_supplies = rx51_vaux2_supply,
  431. };
  432. /* VAUX3 - adds more power to VIO_18 rail */
  433. static struct regulator_init_data rx51_vaux3_cam = {
  434. .constraints = {
  435. .name = "VCAM_DIG_18",
  436. .min_uV = 1800000,
  437. .max_uV = 1800000,
  438. .apply_uV = true,
  439. .valid_modes_mask = REGULATOR_MODE_NORMAL
  440. | REGULATOR_MODE_STANDBY,
  441. .valid_ops_mask = REGULATOR_CHANGE_MODE
  442. | REGULATOR_CHANGE_STATUS,
  443. },
  444. };
  445. static struct regulator_init_data rx51_vaux3_mmc = {
  446. .constraints = {
  447. .name = "VMMC2_30",
  448. .min_uV = 2800000,
  449. .max_uV = 3000000,
  450. .apply_uV = true,
  451. .valid_modes_mask = REGULATOR_MODE_NORMAL
  452. | REGULATOR_MODE_STANDBY,
  453. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  454. | REGULATOR_CHANGE_MODE
  455. | REGULATOR_CHANGE_STATUS,
  456. },
  457. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux3_supply),
  458. .consumer_supplies = rx51_vaux3_supply,
  459. };
  460. static struct regulator_init_data rx51_vaux4 = {
  461. .constraints = {
  462. .name = "VCAM_ANA_28",
  463. .min_uV = 2800000,
  464. .max_uV = 2800000,
  465. .apply_uV = true,
  466. .valid_modes_mask = REGULATOR_MODE_NORMAL
  467. | REGULATOR_MODE_STANDBY,
  468. .valid_ops_mask = REGULATOR_CHANGE_MODE
  469. | REGULATOR_CHANGE_STATUS,
  470. },
  471. };
  472. static struct regulator_init_data rx51_vmmc1 = {
  473. .constraints = {
  474. .min_uV = 1850000,
  475. .max_uV = 3150000,
  476. .valid_modes_mask = REGULATOR_MODE_NORMAL
  477. | REGULATOR_MODE_STANDBY,
  478. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  479. | REGULATOR_CHANGE_MODE
  480. | REGULATOR_CHANGE_STATUS,
  481. },
  482. .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc1_supply),
  483. .consumer_supplies = rx51_vmmc1_supply,
  484. };
  485. static struct regulator_init_data rx51_vmmc2 = {
  486. .constraints = {
  487. .name = "V28_A",
  488. .min_uV = 2800000,
  489. .max_uV = 3000000,
  490. .always_on = true, /* due VIO leak to AIC34 VDDs */
  491. .apply_uV = true,
  492. .valid_modes_mask = REGULATOR_MODE_NORMAL
  493. | REGULATOR_MODE_STANDBY,
  494. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  495. | REGULATOR_CHANGE_MODE
  496. | REGULATOR_CHANGE_STATUS,
  497. },
  498. .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies),
  499. .consumer_supplies = rx51_vmmc2_supplies,
  500. };
  501. static struct regulator_init_data rx51_vpll1 = {
  502. .constraints = {
  503. .name = "VPLL",
  504. .min_uV = 1800000,
  505. .max_uV = 1800000,
  506. .apply_uV = true,
  507. .always_on = true,
  508. .valid_modes_mask = REGULATOR_MODE_NORMAL
  509. | REGULATOR_MODE_STANDBY,
  510. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  511. },
  512. };
  513. static struct regulator_init_data rx51_vpll2 = {
  514. .constraints = {
  515. .name = "VSDI_CSI",
  516. .min_uV = 1800000,
  517. .max_uV = 1800000,
  518. .apply_uV = true,
  519. .always_on = true,
  520. .valid_modes_mask = REGULATOR_MODE_NORMAL
  521. | REGULATOR_MODE_STANDBY,
  522. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  523. },
  524. };
  525. static struct regulator_init_data rx51_vsim = {
  526. .constraints = {
  527. .name = "VMMC2_IO_18",
  528. .min_uV = 1800000,
  529. .max_uV = 1800000,
  530. .apply_uV = true,
  531. .valid_modes_mask = REGULATOR_MODE_NORMAL
  532. | REGULATOR_MODE_STANDBY,
  533. .valid_ops_mask = REGULATOR_CHANGE_MODE
  534. | REGULATOR_CHANGE_STATUS,
  535. },
  536. .num_consumer_supplies = ARRAY_SIZE(rx51_vsim_supply),
  537. .consumer_supplies = rx51_vsim_supply,
  538. };
  539. static struct regulator_init_data rx51_vio = {
  540. .constraints = {
  541. .min_uV = 1800000,
  542. .max_uV = 1800000,
  543. .valid_modes_mask = REGULATOR_MODE_NORMAL
  544. | REGULATOR_MODE_STANDBY,
  545. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  546. | REGULATOR_CHANGE_MODE
  547. | REGULATOR_CHANGE_STATUS,
  548. },
  549. .num_consumer_supplies = ARRAY_SIZE(rx51_vio_supplies),
  550. .consumer_supplies = rx51_vio_supplies,
  551. };
  552. static struct regulator_init_data rx51_vintana1 = {
  553. .constraints = {
  554. .name = "VINTANA1",
  555. .min_uV = 1500000,
  556. .max_uV = 1500000,
  557. .always_on = true,
  558. .valid_modes_mask = REGULATOR_MODE_NORMAL
  559. | REGULATOR_MODE_STANDBY,
  560. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  561. },
  562. };
  563. static struct regulator_init_data rx51_vintana2 = {
  564. .constraints = {
  565. .name = "VINTANA2",
  566. .min_uV = 2750000,
  567. .max_uV = 2750000,
  568. .apply_uV = true,
  569. .always_on = true,
  570. .valid_modes_mask = REGULATOR_MODE_NORMAL
  571. | REGULATOR_MODE_STANDBY,
  572. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  573. },
  574. };
  575. static struct regulator_init_data rx51_vintdig = {
  576. .constraints = {
  577. .name = "VINTDIG",
  578. .min_uV = 1500000,
  579. .max_uV = 1500000,
  580. .always_on = true,
  581. .valid_modes_mask = REGULATOR_MODE_NORMAL
  582. | REGULATOR_MODE_STANDBY,
  583. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  584. },
  585. };
  586. static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
  587. .gpio_reset = RX51_FMTX_RESET_GPIO,
  588. };
  589. static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
  590. I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
  591. .platform_data = &rx51_si4713_i2c_data,
  592. };
  593. static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
  594. .i2c_bus = 2,
  595. .subdev_board_info = &rx51_si4713_board_info,
  596. };
  597. static struct platform_device rx51_si4713_dev = {
  598. .name = "radio-si4713",
  599. .id = -1,
  600. .dev = {
  601. .platform_data = &rx51_si4713_data,
  602. },
  603. };
  604. static __init void rx51_init_si4713(void)
  605. {
  606. int err;
  607. err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
  608. if (err) {
  609. printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
  610. return;
  611. }
  612. rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
  613. platform_device_register(&rx51_si4713_dev);
  614. }
  615. static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
  616. {
  617. /* FIXME this gpio setup is just a placeholder for now */
  618. gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
  619. gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "speaker_en");
  620. return 0;
  621. }
  622. static struct twl4030_gpio_platform_data rx51_gpio_data = {
  623. .gpio_base = OMAP_MAX_GPIO_LINES,
  624. .irq_base = TWL4030_GPIO_IRQ_BASE,
  625. .irq_end = TWL4030_GPIO_IRQ_END,
  626. .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3)
  627. | BIT(4) | BIT(5)
  628. | BIT(8) | BIT(9) | BIT(10) | BIT(11)
  629. | BIT(12) | BIT(13) | BIT(14) | BIT(15)
  630. | BIT(16) | BIT(17) ,
  631. .setup = rx51_twlgpio_setup,
  632. };
  633. static struct twl4030_ins sleep_on_seq[] __initdata = {
  634. /*
  635. * Turn off everything
  636. */
  637. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
  638. };
  639. static struct twl4030_script sleep_on_script __initdata = {
  640. .script = sleep_on_seq,
  641. .size = ARRAY_SIZE(sleep_on_seq),
  642. .flags = TWL4030_SLEEP_SCRIPT,
  643. };
  644. static struct twl4030_ins wakeup_seq[] __initdata = {
  645. /*
  646. * Reenable everything
  647. */
  648. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
  649. };
  650. static struct twl4030_script wakeup_script __initdata = {
  651. .script = wakeup_seq,
  652. .size = ARRAY_SIZE(wakeup_seq),
  653. .flags = TWL4030_WAKEUP12_SCRIPT,
  654. };
  655. static struct twl4030_ins wakeup_p3_seq[] __initdata = {
  656. /*
  657. * Reenable everything
  658. */
  659. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
  660. };
  661. static struct twl4030_script wakeup_p3_script __initdata = {
  662. .script = wakeup_p3_seq,
  663. .size = ARRAY_SIZE(wakeup_p3_seq),
  664. .flags = TWL4030_WAKEUP3_SCRIPT,
  665. };
  666. static struct twl4030_ins wrst_seq[] __initdata = {
  667. /*
  668. * Reset twl4030.
  669. * Reset VDD1 regulator.
  670. * Reset VDD2 regulator.
  671. * Reset VPLL1 regulator.
  672. * Enable sysclk output.
  673. * Reenable twl4030.
  674. */
  675. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
  676. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
  677. 0x13},
  678. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
  679. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
  680. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
  681. {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
  682. {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
  683. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
  684. };
  685. static struct twl4030_script wrst_script __initdata = {
  686. .script = wrst_seq,
  687. .size = ARRAY_SIZE(wrst_seq),
  688. .flags = TWL4030_WRST_SCRIPT,
  689. };
  690. static struct twl4030_script *twl4030_scripts[] __initdata = {
  691. /* wakeup12 script should be loaded before sleep script, otherwise a
  692. board might hit retention before loading of wakeup script is
  693. completed. This can cause boot failures depending on timing issues.
  694. */
  695. &wakeup_script,
  696. &sleep_on_script,
  697. &wakeup_p3_script,
  698. &wrst_script,
  699. };
  700. static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
  701. { .resource = RES_VDD1, .devgroup = -1,
  702. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  703. .remap_sleep = RES_STATE_OFF
  704. },
  705. { .resource = RES_VDD2, .devgroup = -1,
  706. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  707. .remap_sleep = RES_STATE_OFF
  708. },
  709. { .resource = RES_VPLL1, .devgroup = -1,
  710. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  711. .remap_sleep = RES_STATE_OFF
  712. },
  713. { .resource = RES_VPLL2, .devgroup = -1,
  714. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  715. },
  716. { .resource = RES_VAUX1, .devgroup = -1,
  717. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  718. },
  719. { .resource = RES_VAUX2, .devgroup = -1,
  720. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  721. },
  722. { .resource = RES_VAUX3, .devgroup = -1,
  723. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  724. },
  725. { .resource = RES_VAUX4, .devgroup = -1,
  726. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  727. },
  728. { .resource = RES_VMMC1, .devgroup = -1,
  729. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  730. },
  731. { .resource = RES_VMMC2, .devgroup = -1,
  732. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  733. },
  734. { .resource = RES_VDAC, .devgroup = -1,
  735. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  736. },
  737. { .resource = RES_VSIM, .devgroup = -1,
  738. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  739. },
  740. { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  741. .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  742. },
  743. { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  744. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  745. },
  746. { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  747. .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  748. },
  749. { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
  750. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  751. },
  752. { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  753. .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
  754. },
  755. { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  756. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  757. },
  758. { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  759. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  760. },
  761. { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  762. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  763. },
  764. { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
  765. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  766. },
  767. { .resource = RES_32KCLKOUT, .devgroup = -1,
  768. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  769. },
  770. { .resource = RES_RESET, .devgroup = -1,
  771. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  772. },
  773. { .resource = RES_MAIN_REF, .devgroup = -1,
  774. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  775. },
  776. { 0, 0},
  777. };
  778. static struct twl4030_power_data rx51_t2scripts_data __initdata = {
  779. .scripts = twl4030_scripts,
  780. .num = ARRAY_SIZE(twl4030_scripts),
  781. .resource_config = twl4030_rconfig,
  782. };
  783. struct twl4030_vibra_data rx51_vibra_data __initdata = {
  784. .coexist = 0,
  785. };
  786. struct twl4030_audio_data rx51_audio_data __initdata = {
  787. .audio_mclk = 26000000,
  788. .vibra = &rx51_vibra_data,
  789. };
  790. static struct twl4030_platform_data rx51_twldata __initdata = {
  791. /* platform_data for children goes here */
  792. .gpio = &rx51_gpio_data,
  793. .keypad = &rx51_kp_data,
  794. .power = &rx51_t2scripts_data,
  795. .audio = &rx51_audio_data,
  796. .vaux1 = &rx51_vaux1,
  797. .vaux2 = &rx51_vaux2,
  798. .vaux4 = &rx51_vaux4,
  799. .vmmc1 = &rx51_vmmc1,
  800. .vpll1 = &rx51_vpll1,
  801. .vpll2 = &rx51_vpll2,
  802. .vsim = &rx51_vsim,
  803. .vintana1 = &rx51_vintana1,
  804. .vintana2 = &rx51_vintana2,
  805. .vintdig = &rx51_vintdig,
  806. .vio = &rx51_vio,
  807. };
  808. static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
  809. .id = TPA6130A2,
  810. .power_gpio = 98,
  811. };
  812. /* Audio setup data */
  813. static struct aic3x_setup_data rx51_aic34_setup = {
  814. .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
  815. .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT,
  816. };
  817. static struct aic3x_pdata rx51_aic3x_data = {
  818. .setup = &rx51_aic34_setup,
  819. .gpio_reset = 60,
  820. };
  821. static struct aic3x_pdata rx51_aic3x_data2 = {
  822. .gpio_reset = 60,
  823. };
  824. static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
  825. {
  826. I2C_BOARD_INFO("tlv320aic3x", 0x18),
  827. .platform_data = &rx51_aic3x_data,
  828. },
  829. {
  830. I2C_BOARD_INFO("tlv320aic3x", 0x19),
  831. .platform_data = &rx51_aic3x_data2,
  832. },
  833. #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
  834. {
  835. I2C_BOARD_INFO("tsl2563", 0x29),
  836. .platform_data = &rx51_tsl2563_platform_data,
  837. },
  838. #endif
  839. #if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
  840. {
  841. I2C_BOARD_INFO("lp5523", 0x32),
  842. .platform_data = &rx51_lp5523_platform_data,
  843. },
  844. #endif
  845. {
  846. I2C_BOARD_INFO("tpa6130a2", 0x60),
  847. .platform_data = &rx51_tpa6130a2_data,
  848. }
  849. };
  850. static int __init rx51_i2c_init(void)
  851. {
  852. if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
  853. system_rev >= SYSTEM_REV_B_USES_VAUX3) {
  854. rx51_twldata.vaux3 = &rx51_vaux3_mmc;
  855. /* Only older boards use VMMC2 for internal MMC */
  856. rx51_vmmc2.num_consumer_supplies--;
  857. } else {
  858. rx51_twldata.vaux3 = &rx51_vaux3_cam;
  859. }
  860. rx51_twldata.vmmc2 = &rx51_vmmc2;
  861. omap3_pmic_get_config(&rx51_twldata,
  862. TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC,
  863. TWL_COMMON_REGULATOR_VDAC);
  864. rx51_twldata.vdac->constraints.apply_uV = true;
  865. rx51_twldata.vdac->constraints.name = "VDAC";
  866. omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
  867. omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
  868. ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
  869. omap_register_i2c_bus(3, 400, NULL, 0);
  870. return 0;
  871. }
  872. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  873. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  874. static struct mtd_partition onenand_partitions[] = {
  875. {
  876. .name = "bootloader",
  877. .offset = 0,
  878. .size = 0x20000,
  879. .mask_flags = MTD_WRITEABLE, /* Force read-only */
  880. },
  881. {
  882. .name = "config",
  883. .offset = MTDPART_OFS_APPEND,
  884. .size = 0x60000,
  885. },
  886. {
  887. .name = "log",
  888. .offset = MTDPART_OFS_APPEND,
  889. .size = 0x40000,
  890. },
  891. {
  892. .name = "kernel",
  893. .offset = MTDPART_OFS_APPEND,
  894. .size = 0x200000,
  895. },
  896. {
  897. .name = "initfs",
  898. .offset = MTDPART_OFS_APPEND,
  899. .size = 0x200000,
  900. },
  901. {
  902. .name = "rootfs",
  903. .offset = MTDPART_OFS_APPEND,
  904. .size = MTDPART_SIZ_FULL,
  905. },
  906. };
  907. static struct omap_onenand_platform_data board_onenand_data[] = {
  908. {
  909. .cs = 0,
  910. .gpio_irq = 65,
  911. .parts = onenand_partitions,
  912. .nr_parts = ARRAY_SIZE(onenand_partitions),
  913. .flags = ONENAND_SYNC_READWRITE,
  914. }
  915. };
  916. #endif
  917. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  918. static struct omap_smc91x_platform_data board_smc91x_data = {
  919. .cs = 1,
  920. .gpio_irq = 54,
  921. .gpio_pwrdwn = 86,
  922. .gpio_reset = 164,
  923. .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
  924. };
  925. static void __init board_smc91x_init(void)
  926. {
  927. omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
  928. omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
  929. omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
  930. gpmc_smc91x_init(&board_smc91x_data);
  931. }
  932. #else
  933. static inline void board_smc91x_init(void)
  934. {
  935. }
  936. #endif
  937. static void rx51_wl1251_set_power(bool enable)
  938. {
  939. gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
  940. }
  941. static struct gpio rx51_wl1251_gpios[] __initdata = {
  942. { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" },
  943. { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
  944. };
  945. static void __init rx51_init_wl1251(void)
  946. {
  947. int irq, ret;
  948. ret = gpio_request_array(rx51_wl1251_gpios,
  949. ARRAY_SIZE(rx51_wl1251_gpios));
  950. if (ret < 0)
  951. goto error;
  952. irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
  953. if (irq < 0)
  954. goto err_irq;
  955. wl1251_pdata.set_power = rx51_wl1251_set_power;
  956. rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
  957. return;
  958. err_irq:
  959. gpio_free(RX51_WL1251_IRQ_GPIO);
  960. gpio_free(RX51_WL1251_POWER_GPIO);
  961. error:
  962. printk(KERN_ERR "wl1251 board initialisation failed\n");
  963. wl1251_pdata.set_power = NULL;
  964. /*
  965. * Now rx51_peripherals_spi_board_info[1].irq is zero and
  966. * set_power is null, and wl1251_probe() will fail.
  967. */
  968. }
  969. void __init rx51_peripherals_init(void)
  970. {
  971. rx51_i2c_init();
  972. regulator_has_full_constraints();
  973. gpmc_onenand_init(board_onenand_data);
  974. board_smc91x_init();
  975. rx51_add_gpio_keys();
  976. rx51_init_wl1251();
  977. rx51_init_si4713();
  978. spi_register_board_info(rx51_peripherals_spi_board_info,
  979. ARRAY_SIZE(rx51_peripherals_spi_board_info));
  980. partition = omap_mux_get("core");
  981. if (partition)
  982. omap2_hsmmc_init(mmc);
  983. rx51_charger_init();
  984. }