board-rx51-peripherals.c 34 KB

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