board-rx51-peripherals.c 33 KB

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