board-rx51-peripherals.c 30 KB

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