board-rx51-peripherals.c 30 KB

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