board-rx51-peripherals.c 33 KB

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