board-rx51-peripherals.c 32 KB

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