board-rx51-peripherals.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154
  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. };
  124. static struct omap2_mcspi_device_config mipid_mcspi_config = {
  125. .turbo_mode = 0,
  126. };
  127. static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
  128. .turbo_mode = 0,
  129. };
  130. static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
  131. [RX51_SPI_WL1251] = {
  132. .modalias = "wl1251",
  133. .bus_num = 4,
  134. .chip_select = 0,
  135. .max_speed_hz = 48000000,
  136. .mode = SPI_MODE_3,
  137. .controller_data = &wl1251_mcspi_config,
  138. .platform_data = &wl1251_pdata,
  139. },
  140. [RX51_SPI_MIPID] = {
  141. .modalias = "acx565akm",
  142. .bus_num = 1,
  143. .chip_select = 2,
  144. .max_speed_hz = 6000000,
  145. .controller_data = &mipid_mcspi_config,
  146. },
  147. [RX51_SPI_TSC2005] = {
  148. .modalias = "tsc2005",
  149. .bus_num = 1,
  150. .chip_select = 0,
  151. .max_speed_hz = 6000000,
  152. .controller_data = &tsc2005_mcspi_config,
  153. .platform_data = &tsc2005_pdata,
  154. },
  155. };
  156. static void rx51_charger_set_power(bool on)
  157. {
  158. gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
  159. }
  160. static struct isp1704_charger_data rx51_charger_data = {
  161. .set_power = rx51_charger_set_power,
  162. };
  163. static struct platform_device rx51_charger_device = {
  164. .name = "isp1704_charger",
  165. .dev = {
  166. .platform_data = &rx51_charger_data,
  167. },
  168. };
  169. static void __init rx51_charger_init(void)
  170. {
  171. WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
  172. GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
  173. platform_device_register(&rx51_charger_device);
  174. }
  175. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  176. #define RX51_GPIO_CAMERA_LENS_COVER 110
  177. #define RX51_GPIO_CAMERA_FOCUS 68
  178. #define RX51_GPIO_CAMERA_CAPTURE 69
  179. #define RX51_GPIO_KEYPAD_SLIDE 71
  180. #define RX51_GPIO_LOCK_BUTTON 113
  181. #define RX51_GPIO_PROXIMITY 89
  182. #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
  183. static struct gpio_keys_button rx51_gpio_keys[] = {
  184. {
  185. .desc = "Camera Lens Cover",
  186. .type = EV_SW,
  187. .code = SW_CAMERA_LENS_COVER,
  188. .gpio = RX51_GPIO_CAMERA_LENS_COVER,
  189. .active_low = 1,
  190. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  191. }, {
  192. .desc = "Camera Focus",
  193. .type = EV_KEY,
  194. .code = KEY_CAMERA_FOCUS,
  195. .gpio = RX51_GPIO_CAMERA_FOCUS,
  196. .active_low = 1,
  197. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  198. }, {
  199. .desc = "Camera Capture",
  200. .type = EV_KEY,
  201. .code = KEY_CAMERA,
  202. .gpio = RX51_GPIO_CAMERA_CAPTURE,
  203. .active_low = 1,
  204. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  205. }, {
  206. .desc = "Lock Button",
  207. .type = EV_KEY,
  208. .code = KEY_SCREENLOCK,
  209. .gpio = RX51_GPIO_LOCK_BUTTON,
  210. .active_low = 1,
  211. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  212. }, {
  213. .desc = "Keypad Slide",
  214. .type = EV_SW,
  215. .code = SW_KEYPAD_SLIDE,
  216. .gpio = RX51_GPIO_KEYPAD_SLIDE,
  217. .active_low = 1,
  218. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  219. }, {
  220. .desc = "Proximity Sensor",
  221. .type = EV_SW,
  222. .code = SW_FRONT_PROXIMITY,
  223. .gpio = RX51_GPIO_PROXIMITY,
  224. .active_low = 0,
  225. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  226. }
  227. };
  228. static struct gpio_keys_platform_data rx51_gpio_keys_data = {
  229. .buttons = rx51_gpio_keys,
  230. .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
  231. };
  232. static struct platform_device rx51_gpio_keys_device = {
  233. .name = "gpio-keys",
  234. .id = -1,
  235. .dev = {
  236. .platform_data = &rx51_gpio_keys_data,
  237. },
  238. };
  239. static void __init rx51_add_gpio_keys(void)
  240. {
  241. platform_device_register(&rx51_gpio_keys_device);
  242. }
  243. #else
  244. static void __init rx51_add_gpio_keys(void)
  245. {
  246. }
  247. #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
  248. static uint32_t board_keymap[] = {
  249. /*
  250. * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
  251. * connected to the ground" matrix state.
  252. */
  253. KEY(0, 0, KEY_Q),
  254. KEY(0, 1, KEY_O),
  255. KEY(0, 2, KEY_P),
  256. KEY(0, 3, KEY_COMMA),
  257. KEY(0, 4, KEY_BACKSPACE),
  258. KEY(0, 6, KEY_A),
  259. KEY(0, 7, KEY_S),
  260. KEY(1, 0, KEY_W),
  261. KEY(1, 1, KEY_D),
  262. KEY(1, 2, KEY_F),
  263. KEY(1, 3, KEY_G),
  264. KEY(1, 4, KEY_H),
  265. KEY(1, 5, KEY_J),
  266. KEY(1, 6, KEY_K),
  267. KEY(1, 7, KEY_L),
  268. KEY(2, 0, KEY_E),
  269. KEY(2, 1, KEY_DOT),
  270. KEY(2, 2, KEY_UP),
  271. KEY(2, 3, KEY_ENTER),
  272. KEY(2, 5, KEY_Z),
  273. KEY(2, 6, KEY_X),
  274. KEY(2, 7, KEY_C),
  275. KEY(2, 8, KEY_F9),
  276. KEY(3, 0, KEY_R),
  277. KEY(3, 1, KEY_V),
  278. KEY(3, 2, KEY_B),
  279. KEY(3, 3, KEY_N),
  280. KEY(3, 4, KEY_M),
  281. KEY(3, 5, KEY_SPACE),
  282. KEY(3, 6, KEY_SPACE),
  283. KEY(3, 7, KEY_LEFT),
  284. KEY(4, 0, KEY_T),
  285. KEY(4, 1, KEY_DOWN),
  286. KEY(4, 2, KEY_RIGHT),
  287. KEY(4, 4, KEY_LEFTCTRL),
  288. KEY(4, 5, KEY_RIGHTALT),
  289. KEY(4, 6, KEY_LEFTSHIFT),
  290. KEY(4, 8, KEY_F10),
  291. KEY(5, 0, KEY_Y),
  292. KEY(5, 8, KEY_F11),
  293. KEY(6, 0, KEY_U),
  294. KEY(7, 0, KEY_I),
  295. KEY(7, 1, KEY_F7),
  296. KEY(7, 2, KEY_F8),
  297. };
  298. static struct matrix_keymap_data board_map_data = {
  299. .keymap = board_keymap,
  300. .keymap_size = ARRAY_SIZE(board_keymap),
  301. };
  302. static struct twl4030_keypad_data rx51_kp_data = {
  303. .keymap_data = &board_map_data,
  304. .rows = 8,
  305. .cols = 8,
  306. .rep = 1,
  307. };
  308. /* Enable input logic and pull all lines up when eMMC is on. */
  309. static struct omap_board_mux rx51_mmc2_on_mux[] = {
  310. OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  311. OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  312. OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  313. OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  314. OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  315. OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  316. OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  317. OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  318. OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  319. { .reg_offset = OMAP_MUX_TERMINATOR },
  320. };
  321. /* Disable input logic and pull all lines down when eMMC is off. */
  322. static struct omap_board_mux rx51_mmc2_off_mux[] = {
  323. OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  324. OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  325. OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  326. OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  327. OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  328. OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  329. OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  330. OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  331. OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  332. { .reg_offset = OMAP_MUX_TERMINATOR },
  333. };
  334. static struct omap_mux_partition *partition;
  335. /*
  336. * Current flows to eMMC when eMMC is off and the data lines are pulled up,
  337. * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
  338. */
  339. static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
  340. {
  341. if (power_on)
  342. omap_mux_write_array(partition, rx51_mmc2_on_mux);
  343. else
  344. omap_mux_write_array(partition, rx51_mmc2_off_mux);
  345. }
  346. static struct omap2_hsmmc_info mmc[] __initdata = {
  347. {
  348. .name = "external",
  349. .mmc = 1,
  350. .caps = MMC_CAP_4_BIT_DATA,
  351. .cover_only = true,
  352. .gpio_cd = 160,
  353. .gpio_wp = -EINVAL,
  354. .power_saving = true,
  355. },
  356. {
  357. .name = "internal",
  358. .mmc = 2,
  359. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  360. /* See also rx51_mmc2_remux */
  361. .gpio_cd = -EINVAL,
  362. .gpio_wp = -EINVAL,
  363. .nonremovable = true,
  364. .power_saving = true,
  365. .remux = rx51_mmc2_remux,
  366. },
  367. {} /* Terminator */
  368. };
  369. static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
  370. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  371. };
  372. static struct regulator_consumer_supply rx51_vaux2_supply[] = {
  373. REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
  374. };
  375. static struct regulator_consumer_supply rx51_vaux3_supply[] = {
  376. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  377. };
  378. static struct regulator_consumer_supply rx51_vsim_supply[] = {
  379. REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
  380. };
  381. static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
  382. /* tlv320aic3x analog supplies */
  383. REGULATOR_SUPPLY("AVDD", "2-0018"),
  384. REGULATOR_SUPPLY("DRVDD", "2-0018"),
  385. REGULATOR_SUPPLY("AVDD", "2-0019"),
  386. REGULATOR_SUPPLY("DRVDD", "2-0019"),
  387. /* tpa6130a2 */
  388. REGULATOR_SUPPLY("Vdd", "2-0060"),
  389. /* Keep vmmc as last item. It is not iterated for newer boards */
  390. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  391. };
  392. static struct regulator_consumer_supply rx51_vio_supplies[] = {
  393. /* tlv320aic3x digital supplies */
  394. REGULATOR_SUPPLY("IOVDD", "2-0018"),
  395. REGULATOR_SUPPLY("DVDD", "2-0018"),
  396. REGULATOR_SUPPLY("IOVDD", "2-0019"),
  397. REGULATOR_SUPPLY("DVDD", "2-0019"),
  398. /* Si4713 IO supply */
  399. REGULATOR_SUPPLY("vio", "2-0063"),
  400. };
  401. static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
  402. REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
  403. /* Si4713 supply */
  404. REGULATOR_SUPPLY("vdd", "2-0063"),
  405. };
  406. static struct regulator_init_data rx51_vaux1 = {
  407. .constraints = {
  408. .name = "V28",
  409. .min_uV = 2800000,
  410. .max_uV = 2800000,
  411. .always_on = true, /* due battery cover sensor */
  412. .valid_modes_mask = REGULATOR_MODE_NORMAL
  413. | REGULATOR_MODE_STANDBY,
  414. .valid_ops_mask = REGULATOR_CHANGE_MODE
  415. | REGULATOR_CHANGE_STATUS,
  416. },
  417. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
  418. .consumer_supplies = rx51_vaux1_consumers,
  419. };
  420. static struct regulator_init_data rx51_vaux2 = {
  421. .constraints = {
  422. .name = "VCSI",
  423. .min_uV = 1800000,
  424. .max_uV = 1800000,
  425. .valid_modes_mask = REGULATOR_MODE_NORMAL
  426. | REGULATOR_MODE_STANDBY,
  427. .valid_ops_mask = REGULATOR_CHANGE_MODE
  428. | REGULATOR_CHANGE_STATUS,
  429. },
  430. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux2_supply),
  431. .consumer_supplies = rx51_vaux2_supply,
  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_vio = {
  541. .constraints = {
  542. .min_uV = 1800000,
  543. .max_uV = 1800000,
  544. .valid_modes_mask = REGULATOR_MODE_NORMAL
  545. | REGULATOR_MODE_STANDBY,
  546. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  547. | REGULATOR_CHANGE_MODE
  548. | REGULATOR_CHANGE_STATUS,
  549. },
  550. .num_consumer_supplies = ARRAY_SIZE(rx51_vio_supplies),
  551. .consumer_supplies = rx51_vio_supplies,
  552. };
  553. static struct regulator_init_data rx51_vintana1 = {
  554. .constraints = {
  555. .name = "VINTANA1",
  556. .min_uV = 1500000,
  557. .max_uV = 1500000,
  558. .always_on = true,
  559. .valid_modes_mask = REGULATOR_MODE_NORMAL
  560. | REGULATOR_MODE_STANDBY,
  561. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  562. },
  563. };
  564. static struct regulator_init_data rx51_vintana2 = {
  565. .constraints = {
  566. .name = "VINTANA2",
  567. .min_uV = 2750000,
  568. .max_uV = 2750000,
  569. .apply_uV = true,
  570. .always_on = true,
  571. .valid_modes_mask = REGULATOR_MODE_NORMAL
  572. | REGULATOR_MODE_STANDBY,
  573. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  574. },
  575. };
  576. static struct regulator_init_data rx51_vintdig = {
  577. .constraints = {
  578. .name = "VINTDIG",
  579. .min_uV = 1500000,
  580. .max_uV = 1500000,
  581. .always_on = true,
  582. .valid_modes_mask = REGULATOR_MODE_NORMAL
  583. | REGULATOR_MODE_STANDBY,
  584. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  585. },
  586. };
  587. static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
  588. .gpio_reset = RX51_FMTX_RESET_GPIO,
  589. };
  590. static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
  591. I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
  592. .platform_data = &rx51_si4713_i2c_data,
  593. };
  594. static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
  595. .i2c_bus = 2,
  596. .subdev_board_info = &rx51_si4713_board_info,
  597. };
  598. static struct platform_device rx51_si4713_dev = {
  599. .name = "radio-si4713",
  600. .id = -1,
  601. .dev = {
  602. .platform_data = &rx51_si4713_data,
  603. },
  604. };
  605. static __init void rx51_init_si4713(void)
  606. {
  607. int err;
  608. err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
  609. if (err) {
  610. printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
  611. return;
  612. }
  613. rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
  614. platform_device_register(&rx51_si4713_dev);
  615. }
  616. static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
  617. {
  618. /* FIXME this gpio setup is just a placeholder for now */
  619. gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
  620. gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "speaker_en");
  621. return 0;
  622. }
  623. static struct twl4030_gpio_platform_data rx51_gpio_data = {
  624. .gpio_base = OMAP_MAX_GPIO_LINES,
  625. .irq_base = TWL4030_GPIO_IRQ_BASE,
  626. .irq_end = TWL4030_GPIO_IRQ_END,
  627. .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3)
  628. | BIT(4) | BIT(5)
  629. | BIT(8) | BIT(9) | BIT(10) | BIT(11)
  630. | BIT(12) | BIT(13) | BIT(14) | BIT(15)
  631. | BIT(16) | BIT(17) ,
  632. .setup = rx51_twlgpio_setup,
  633. };
  634. static struct twl4030_ins sleep_on_seq[] __initdata = {
  635. /*
  636. * Turn off everything
  637. */
  638. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
  639. };
  640. static struct twl4030_script sleep_on_script __initdata = {
  641. .script = sleep_on_seq,
  642. .size = ARRAY_SIZE(sleep_on_seq),
  643. .flags = TWL4030_SLEEP_SCRIPT,
  644. };
  645. static struct twl4030_ins wakeup_seq[] __initdata = {
  646. /*
  647. * Reenable everything
  648. */
  649. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
  650. };
  651. static struct twl4030_script wakeup_script __initdata = {
  652. .script = wakeup_seq,
  653. .size = ARRAY_SIZE(wakeup_seq),
  654. .flags = TWL4030_WAKEUP12_SCRIPT,
  655. };
  656. static struct twl4030_ins wakeup_p3_seq[] __initdata = {
  657. /*
  658. * Reenable everything
  659. */
  660. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
  661. };
  662. static struct twl4030_script wakeup_p3_script __initdata = {
  663. .script = wakeup_p3_seq,
  664. .size = ARRAY_SIZE(wakeup_p3_seq),
  665. .flags = TWL4030_WAKEUP3_SCRIPT,
  666. };
  667. static struct twl4030_ins wrst_seq[] __initdata = {
  668. /*
  669. * Reset twl4030.
  670. * Reset VDD1 regulator.
  671. * Reset VDD2 regulator.
  672. * Reset VPLL1 regulator.
  673. * Enable sysclk output.
  674. * Reenable twl4030.
  675. */
  676. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
  677. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
  678. 0x13},
  679. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
  680. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
  681. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
  682. {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
  683. {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
  684. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
  685. };
  686. static struct twl4030_script wrst_script __initdata = {
  687. .script = wrst_seq,
  688. .size = ARRAY_SIZE(wrst_seq),
  689. .flags = TWL4030_WRST_SCRIPT,
  690. };
  691. static struct twl4030_script *twl4030_scripts[] __initdata = {
  692. /* wakeup12 script should be loaded before sleep script, otherwise a
  693. board might hit retention before loading of wakeup script is
  694. completed. This can cause boot failures depending on timing issues.
  695. */
  696. &wakeup_script,
  697. &sleep_on_script,
  698. &wakeup_p3_script,
  699. &wrst_script,
  700. };
  701. static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
  702. { .resource = RES_VDD1, .devgroup = -1,
  703. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  704. .remap_sleep = RES_STATE_OFF
  705. },
  706. { .resource = RES_VDD2, .devgroup = -1,
  707. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  708. .remap_sleep = RES_STATE_OFF
  709. },
  710. { .resource = RES_VPLL1, .devgroup = -1,
  711. .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
  712. .remap_sleep = RES_STATE_OFF
  713. },
  714. { .resource = RES_VPLL2, .devgroup = -1,
  715. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  716. },
  717. { .resource = RES_VAUX1, .devgroup = -1,
  718. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  719. },
  720. { .resource = RES_VAUX2, .devgroup = -1,
  721. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  722. },
  723. { .resource = RES_VAUX3, .devgroup = -1,
  724. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  725. },
  726. { .resource = RES_VAUX4, .devgroup = -1,
  727. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  728. },
  729. { .resource = RES_VMMC1, .devgroup = -1,
  730. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  731. },
  732. { .resource = RES_VMMC2, .devgroup = -1,
  733. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  734. },
  735. { .resource = RES_VDAC, .devgroup = -1,
  736. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  737. },
  738. { .resource = RES_VSIM, .devgroup = -1,
  739. .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
  740. },
  741. { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  742. .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  743. },
  744. { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  745. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  746. },
  747. { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  748. .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  749. },
  750. { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
  751. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  752. },
  753. { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  754. .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
  755. },
  756. { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  757. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  758. },
  759. { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  760. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  761. },
  762. { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
  763. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  764. },
  765. { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
  766. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  767. },
  768. { .resource = RES_32KCLKOUT, .devgroup = -1,
  769. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  770. },
  771. { .resource = RES_RESET, .devgroup = -1,
  772. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  773. },
  774. { .resource = RES_MAIN_REF, .devgroup = -1,
  775. .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
  776. },
  777. { 0, 0},
  778. };
  779. static struct twl4030_power_data rx51_t2scripts_data __initdata = {
  780. .scripts = twl4030_scripts,
  781. .num = ARRAY_SIZE(twl4030_scripts),
  782. .resource_config = twl4030_rconfig,
  783. };
  784. struct twl4030_vibra_data rx51_vibra_data __initdata = {
  785. .coexist = 0,
  786. };
  787. struct twl4030_audio_data rx51_audio_data __initdata = {
  788. .audio_mclk = 26000000,
  789. .vibra = &rx51_vibra_data,
  790. };
  791. static struct twl4030_platform_data rx51_twldata __initdata = {
  792. /* platform_data for children goes here */
  793. .gpio = &rx51_gpio_data,
  794. .keypad = &rx51_kp_data,
  795. .power = &rx51_t2scripts_data,
  796. .audio = &rx51_audio_data,
  797. .vaux1 = &rx51_vaux1,
  798. .vaux2 = &rx51_vaux2,
  799. .vaux4 = &rx51_vaux4,
  800. .vmmc1 = &rx51_vmmc1,
  801. .vpll1 = &rx51_vpll1,
  802. .vpll2 = &rx51_vpll2,
  803. .vsim = &rx51_vsim,
  804. .vintana1 = &rx51_vintana1,
  805. .vintana2 = &rx51_vintana2,
  806. .vintdig = &rx51_vintdig,
  807. .vio = &rx51_vio,
  808. };
  809. static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
  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("bq27200", 0x55),
  847. },
  848. {
  849. I2C_BOARD_INFO("tpa6130a2", 0x60),
  850. .platform_data = &rx51_tpa6130a2_data,
  851. }
  852. };
  853. static int __init rx51_i2c_init(void)
  854. {
  855. if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
  856. system_rev >= SYSTEM_REV_B_USES_VAUX3) {
  857. rx51_twldata.vaux3 = &rx51_vaux3_mmc;
  858. /* Only older boards use VMMC2 for internal MMC */
  859. rx51_vmmc2.num_consumer_supplies--;
  860. } else {
  861. rx51_twldata.vaux3 = &rx51_vaux3_cam;
  862. }
  863. rx51_twldata.vmmc2 = &rx51_vmmc2;
  864. omap3_pmic_get_config(&rx51_twldata,
  865. TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC,
  866. TWL_COMMON_REGULATOR_VDAC);
  867. rx51_twldata.vdac->constraints.apply_uV = true;
  868. rx51_twldata.vdac->constraints.name = "VDAC";
  869. omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
  870. omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
  871. ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
  872. omap_register_i2c_bus(3, 400, NULL, 0);
  873. return 0;
  874. }
  875. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  876. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  877. static struct mtd_partition onenand_partitions[] = {
  878. {
  879. .name = "bootloader",
  880. .offset = 0,
  881. .size = 0x20000,
  882. .mask_flags = MTD_WRITEABLE, /* Force read-only */
  883. },
  884. {
  885. .name = "config",
  886. .offset = MTDPART_OFS_APPEND,
  887. .size = 0x60000,
  888. },
  889. {
  890. .name = "log",
  891. .offset = MTDPART_OFS_APPEND,
  892. .size = 0x40000,
  893. },
  894. {
  895. .name = "kernel",
  896. .offset = MTDPART_OFS_APPEND,
  897. .size = 0x200000,
  898. },
  899. {
  900. .name = "initfs",
  901. .offset = MTDPART_OFS_APPEND,
  902. .size = 0x200000,
  903. },
  904. {
  905. .name = "rootfs",
  906. .offset = MTDPART_OFS_APPEND,
  907. .size = MTDPART_SIZ_FULL,
  908. },
  909. };
  910. static struct omap_onenand_platform_data board_onenand_data[] = {
  911. {
  912. .cs = 0,
  913. .gpio_irq = 65,
  914. .parts = onenand_partitions,
  915. .nr_parts = ARRAY_SIZE(onenand_partitions),
  916. .flags = ONENAND_SYNC_READWRITE,
  917. }
  918. };
  919. #endif
  920. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  921. static struct omap_smc91x_platform_data board_smc91x_data = {
  922. .cs = 1,
  923. .gpio_irq = 54,
  924. .gpio_pwrdwn = 86,
  925. .gpio_reset = 164,
  926. .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
  927. };
  928. static void __init board_smc91x_init(void)
  929. {
  930. omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
  931. omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
  932. omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
  933. gpmc_smc91x_init(&board_smc91x_data);
  934. }
  935. #else
  936. static inline void board_smc91x_init(void)
  937. {
  938. }
  939. #endif
  940. static void rx51_wl1251_set_power(bool enable)
  941. {
  942. gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
  943. }
  944. static struct gpio rx51_wl1251_gpios[] __initdata = {
  945. { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" },
  946. { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
  947. };
  948. static void __init rx51_init_wl1251(void)
  949. {
  950. int irq, ret;
  951. ret = gpio_request_array(rx51_wl1251_gpios,
  952. ARRAY_SIZE(rx51_wl1251_gpios));
  953. if (ret < 0)
  954. goto error;
  955. irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
  956. if (irq < 0)
  957. goto err_irq;
  958. wl1251_pdata.set_power = rx51_wl1251_set_power;
  959. rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
  960. return;
  961. err_irq:
  962. gpio_free(RX51_WL1251_IRQ_GPIO);
  963. gpio_free(RX51_WL1251_POWER_GPIO);
  964. error:
  965. printk(KERN_ERR "wl1251 board initialisation failed\n");
  966. wl1251_pdata.set_power = NULL;
  967. /*
  968. * Now rx51_peripherals_spi_board_info[1].irq is zero and
  969. * set_power is null, and wl1251_probe() will fail.
  970. */
  971. }
  972. static struct tsc2005_platform_data tsc2005_pdata = {
  973. .ts_pressure_max = 2048,
  974. .ts_pressure_fudge = 2,
  975. .ts_x_max = 4096,
  976. .ts_x_fudge = 4,
  977. .ts_y_max = 4096,
  978. .ts_y_fudge = 7,
  979. .ts_x_plate_ohm = 280,
  980. .esd_timeout_ms = 8000,
  981. };
  982. static struct gpio rx51_tsc2005_gpios[] __initdata = {
  983. { RX51_TSC2005_IRQ_GPIO, GPIOF_IN, "tsc2005 IRQ" },
  984. { RX51_TSC2005_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "tsc2005 reset" },
  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. omap_mux_init_gpio(RX51_TSC2005_RESET_GPIO, OMAP_PIN_OUTPUT);
  994. omap_mux_init_gpio(RX51_TSC2005_IRQ_GPIO, OMAP_PIN_INPUT_PULLUP);
  995. r = gpio_request_array(rx51_tsc2005_gpios,
  996. ARRAY_SIZE(rx51_tsc2005_gpios));
  997. if (r < 0) {
  998. printk(KERN_ERR "tsc2005 board initialization failed\n");
  999. tsc2005_pdata.esd_timeout_ms = 0;
  1000. return;
  1001. }
  1002. tsc2005_pdata.set_reset = rx51_tsc2005_set_reset;
  1003. rx51_peripherals_spi_board_info[RX51_SPI_TSC2005].irq =
  1004. gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
  1005. }
  1006. void __init rx51_peripherals_init(void)
  1007. {
  1008. rx51_i2c_init();
  1009. regulator_has_full_constraints();
  1010. gpmc_onenand_init(board_onenand_data);
  1011. board_smc91x_init();
  1012. rx51_add_gpio_keys();
  1013. rx51_init_wl1251();
  1014. rx51_init_tsc2005();
  1015. rx51_init_si4713();
  1016. spi_register_board_info(rx51_peripherals_spi_board_info,
  1017. ARRAY_SIZE(rx51_peripherals_spi_board_info));
  1018. partition = omap_mux_get("core");
  1019. if (partition)
  1020. omap_hsmmc_init(mmc);
  1021. rx51_charger_init();
  1022. }