board-rx51-peripherals.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  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 <plat-omap/dma-omap.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 void rx51_charger_set_power(bool on)
  222. {
  223. gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
  224. }
  225. static struct isp1704_charger_data rx51_charger_data = {
  226. .set_power = rx51_charger_set_power,
  227. };
  228. static struct platform_device rx51_charger_device = {
  229. .name = "isp1704_charger",
  230. .dev = {
  231. .platform_data = &rx51_charger_data,
  232. },
  233. };
  234. static void __init rx51_charger_init(void)
  235. {
  236. WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
  237. GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
  238. platform_device_register(&rx51_charger_device);
  239. }
  240. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  241. #define RX51_GPIO_CAMERA_LENS_COVER 110
  242. #define RX51_GPIO_CAMERA_FOCUS 68
  243. #define RX51_GPIO_CAMERA_CAPTURE 69
  244. #define RX51_GPIO_KEYPAD_SLIDE 71
  245. #define RX51_GPIO_LOCK_BUTTON 113
  246. #define RX51_GPIO_PROXIMITY 89
  247. #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
  248. static struct gpio_keys_button rx51_gpio_keys[] = {
  249. {
  250. .desc = "Camera Lens Cover",
  251. .type = EV_SW,
  252. .code = SW_CAMERA_LENS_COVER,
  253. .gpio = RX51_GPIO_CAMERA_LENS_COVER,
  254. .active_low = 1,
  255. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  256. }, {
  257. .desc = "Camera Focus",
  258. .type = EV_KEY,
  259. .code = KEY_CAMERA_FOCUS,
  260. .gpio = RX51_GPIO_CAMERA_FOCUS,
  261. .active_low = 1,
  262. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  263. }, {
  264. .desc = "Camera Capture",
  265. .type = EV_KEY,
  266. .code = KEY_CAMERA,
  267. .gpio = RX51_GPIO_CAMERA_CAPTURE,
  268. .active_low = 1,
  269. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  270. }, {
  271. .desc = "Lock Button",
  272. .type = EV_KEY,
  273. .code = KEY_SCREENLOCK,
  274. .gpio = RX51_GPIO_LOCK_BUTTON,
  275. .active_low = 1,
  276. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  277. }, {
  278. .desc = "Keypad Slide",
  279. .type = EV_SW,
  280. .code = SW_KEYPAD_SLIDE,
  281. .gpio = RX51_GPIO_KEYPAD_SLIDE,
  282. .active_low = 1,
  283. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  284. }, {
  285. .desc = "Proximity Sensor",
  286. .type = EV_SW,
  287. .code = SW_FRONT_PROXIMITY,
  288. .gpio = RX51_GPIO_PROXIMITY,
  289. .active_low = 0,
  290. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  291. }
  292. };
  293. static struct gpio_keys_platform_data rx51_gpio_keys_data = {
  294. .buttons = rx51_gpio_keys,
  295. .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
  296. };
  297. static struct platform_device rx51_gpio_keys_device = {
  298. .name = "gpio-keys",
  299. .id = -1,
  300. .dev = {
  301. .platform_data = &rx51_gpio_keys_data,
  302. },
  303. };
  304. static void __init rx51_add_gpio_keys(void)
  305. {
  306. platform_device_register(&rx51_gpio_keys_device);
  307. }
  308. #else
  309. static void __init rx51_add_gpio_keys(void)
  310. {
  311. }
  312. #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
  313. static uint32_t board_keymap[] = {
  314. /*
  315. * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
  316. * connected to the ground" matrix state.
  317. */
  318. KEY(0, 0, KEY_Q),
  319. KEY(0, 1, KEY_O),
  320. KEY(0, 2, KEY_P),
  321. KEY(0, 3, KEY_COMMA),
  322. KEY(0, 4, KEY_BACKSPACE),
  323. KEY(0, 6, KEY_A),
  324. KEY(0, 7, KEY_S),
  325. KEY(1, 0, KEY_W),
  326. KEY(1, 1, KEY_D),
  327. KEY(1, 2, KEY_F),
  328. KEY(1, 3, KEY_G),
  329. KEY(1, 4, KEY_H),
  330. KEY(1, 5, KEY_J),
  331. KEY(1, 6, KEY_K),
  332. KEY(1, 7, KEY_L),
  333. KEY(2, 0, KEY_E),
  334. KEY(2, 1, KEY_DOT),
  335. KEY(2, 2, KEY_UP),
  336. KEY(2, 3, KEY_ENTER),
  337. KEY(2, 5, KEY_Z),
  338. KEY(2, 6, KEY_X),
  339. KEY(2, 7, KEY_C),
  340. KEY(2, 8, KEY_F9),
  341. KEY(3, 0, KEY_R),
  342. KEY(3, 1, KEY_V),
  343. KEY(3, 2, KEY_B),
  344. KEY(3, 3, KEY_N),
  345. KEY(3, 4, KEY_M),
  346. KEY(3, 5, KEY_SPACE),
  347. KEY(3, 6, KEY_SPACE),
  348. KEY(3, 7, KEY_LEFT),
  349. KEY(4, 0, KEY_T),
  350. KEY(4, 1, KEY_DOWN),
  351. KEY(4, 2, KEY_RIGHT),
  352. KEY(4, 4, KEY_LEFTCTRL),
  353. KEY(4, 5, KEY_RIGHTALT),
  354. KEY(4, 6, KEY_LEFTSHIFT),
  355. KEY(4, 8, KEY_F10),
  356. KEY(5, 0, KEY_Y),
  357. KEY(5, 8, KEY_F11),
  358. KEY(6, 0, KEY_U),
  359. KEY(7, 0, KEY_I),
  360. KEY(7, 1, KEY_F7),
  361. KEY(7, 2, KEY_F8),
  362. };
  363. static struct matrix_keymap_data board_map_data = {
  364. .keymap = board_keymap,
  365. .keymap_size = ARRAY_SIZE(board_keymap),
  366. };
  367. static struct twl4030_keypad_data rx51_kp_data = {
  368. .keymap_data = &board_map_data,
  369. .rows = 8,
  370. .cols = 8,
  371. .rep = 1,
  372. };
  373. /* Enable input logic and pull all lines up when eMMC is on. */
  374. static struct omap_board_mux rx51_mmc2_on_mux[] = {
  375. OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  376. OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  377. OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  378. OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  379. OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  380. OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  381. OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  382. OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  383. OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
  384. { .reg_offset = OMAP_MUX_TERMINATOR },
  385. };
  386. /* Disable input logic and pull all lines down when eMMC is off. */
  387. static struct omap_board_mux rx51_mmc2_off_mux[] = {
  388. OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  389. OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  390. OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  391. OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  392. OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  393. OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  394. OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  395. OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  396. OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
  397. { .reg_offset = OMAP_MUX_TERMINATOR },
  398. };
  399. static struct omap_mux_partition *partition;
  400. /*
  401. * Current flows to eMMC when eMMC is off and the data lines are pulled up,
  402. * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
  403. */
  404. static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
  405. {
  406. if (power_on)
  407. omap_mux_write_array(partition, rx51_mmc2_on_mux);
  408. else
  409. omap_mux_write_array(partition, rx51_mmc2_off_mux);
  410. }
  411. static struct omap2_hsmmc_info mmc[] __initdata = {
  412. {
  413. .name = "external",
  414. .mmc = 1,
  415. .caps = MMC_CAP_4_BIT_DATA,
  416. .cover_only = true,
  417. .gpio_cd = 160,
  418. .gpio_wp = -EINVAL,
  419. .power_saving = true,
  420. },
  421. {
  422. .name = "internal",
  423. .mmc = 2,
  424. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  425. /* See also rx51_mmc2_remux */
  426. .gpio_cd = -EINVAL,
  427. .gpio_wp = -EINVAL,
  428. .nonremovable = true,
  429. .power_saving = true,
  430. .remux = rx51_mmc2_remux,
  431. },
  432. {} /* Terminator */
  433. };
  434. static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
  435. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  436. };
  437. static struct regulator_consumer_supply rx51_vaux2_supply[] = {
  438. REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
  439. };
  440. static struct regulator_consumer_supply rx51_vaux3_supply[] = {
  441. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  442. };
  443. static struct regulator_consumer_supply rx51_vsim_supply[] = {
  444. REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
  445. };
  446. static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
  447. /* tlv320aic3x analog supplies */
  448. REGULATOR_SUPPLY("AVDD", "2-0018"),
  449. REGULATOR_SUPPLY("DRVDD", "2-0018"),
  450. REGULATOR_SUPPLY("AVDD", "2-0019"),
  451. REGULATOR_SUPPLY("DRVDD", "2-0019"),
  452. /* tpa6130a2 */
  453. REGULATOR_SUPPLY("Vdd", "2-0060"),
  454. /* Keep vmmc as last item. It is not iterated for newer boards */
  455. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  456. };
  457. static struct regulator_consumer_supply rx51_vio_supplies[] = {
  458. /* tlv320aic3x digital supplies */
  459. REGULATOR_SUPPLY("IOVDD", "2-0018"),
  460. REGULATOR_SUPPLY("DVDD", "2-0018"),
  461. REGULATOR_SUPPLY("IOVDD", "2-0019"),
  462. REGULATOR_SUPPLY("DVDD", "2-0019"),
  463. /* Si4713 IO supply */
  464. REGULATOR_SUPPLY("vio", "2-0063"),
  465. };
  466. static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
  467. REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
  468. /* Si4713 supply */
  469. REGULATOR_SUPPLY("vdd", "2-0063"),
  470. };
  471. static struct regulator_init_data rx51_vaux1 = {
  472. .constraints = {
  473. .name = "V28",
  474. .min_uV = 2800000,
  475. .max_uV = 2800000,
  476. .always_on = true, /* due battery cover sensor */
  477. .valid_modes_mask = REGULATOR_MODE_NORMAL
  478. | REGULATOR_MODE_STANDBY,
  479. .valid_ops_mask = REGULATOR_CHANGE_MODE
  480. | REGULATOR_CHANGE_STATUS,
  481. },
  482. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
  483. .consumer_supplies = rx51_vaux1_consumers,
  484. };
  485. static struct regulator_init_data rx51_vaux2 = {
  486. .constraints = {
  487. .name = "VCSI",
  488. .min_uV = 1800000,
  489. .max_uV = 1800000,
  490. .valid_modes_mask = REGULATOR_MODE_NORMAL
  491. | REGULATOR_MODE_STANDBY,
  492. .valid_ops_mask = REGULATOR_CHANGE_MODE
  493. | REGULATOR_CHANGE_STATUS,
  494. },
  495. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux2_supply),
  496. .consumer_supplies = rx51_vaux2_supply,
  497. };
  498. /* VAUX3 - adds more power to VIO_18 rail */
  499. static struct regulator_init_data rx51_vaux3_cam = {
  500. .constraints = {
  501. .name = "VCAM_DIG_18",
  502. .min_uV = 1800000,
  503. .max_uV = 1800000,
  504. .apply_uV = true,
  505. .valid_modes_mask = REGULATOR_MODE_NORMAL
  506. | REGULATOR_MODE_STANDBY,
  507. .valid_ops_mask = REGULATOR_CHANGE_MODE
  508. | REGULATOR_CHANGE_STATUS,
  509. },
  510. };
  511. static struct regulator_init_data rx51_vaux3_mmc = {
  512. .constraints = {
  513. .name = "VMMC2_30",
  514. .min_uV = 2800000,
  515. .max_uV = 3000000,
  516. .apply_uV = true,
  517. .valid_modes_mask = REGULATOR_MODE_NORMAL
  518. | REGULATOR_MODE_STANDBY,
  519. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  520. | REGULATOR_CHANGE_MODE
  521. | REGULATOR_CHANGE_STATUS,
  522. },
  523. .num_consumer_supplies = ARRAY_SIZE(rx51_vaux3_supply),
  524. .consumer_supplies = rx51_vaux3_supply,
  525. };
  526. static struct regulator_init_data rx51_vaux4 = {
  527. .constraints = {
  528. .name = "VCAM_ANA_28",
  529. .min_uV = 2800000,
  530. .max_uV = 2800000,
  531. .apply_uV = true,
  532. .valid_modes_mask = REGULATOR_MODE_NORMAL
  533. | REGULATOR_MODE_STANDBY,
  534. .valid_ops_mask = REGULATOR_CHANGE_MODE
  535. | REGULATOR_CHANGE_STATUS,
  536. },
  537. };
  538. static struct regulator_init_data rx51_vmmc1 = {
  539. .constraints = {
  540. .min_uV = 1850000,
  541. .max_uV = 3150000,
  542. .valid_modes_mask = REGULATOR_MODE_NORMAL
  543. | REGULATOR_MODE_STANDBY,
  544. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  545. | REGULATOR_CHANGE_MODE
  546. | REGULATOR_CHANGE_STATUS,
  547. },
  548. .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc1_supply),
  549. .consumer_supplies = rx51_vmmc1_supply,
  550. };
  551. static struct regulator_init_data rx51_vmmc2 = {
  552. .constraints = {
  553. .name = "V28_A",
  554. .min_uV = 2800000,
  555. .max_uV = 3000000,
  556. .always_on = true, /* due VIO leak to AIC34 VDDs */
  557. .apply_uV = true,
  558. .valid_modes_mask = REGULATOR_MODE_NORMAL
  559. | REGULATOR_MODE_STANDBY,
  560. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  561. | REGULATOR_CHANGE_MODE
  562. | REGULATOR_CHANGE_STATUS,
  563. },
  564. .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies),
  565. .consumer_supplies = rx51_vmmc2_supplies,
  566. };
  567. static struct regulator_init_data rx51_vpll1 = {
  568. .constraints = {
  569. .name = "VPLL",
  570. .min_uV = 1800000,
  571. .max_uV = 1800000,
  572. .apply_uV = true,
  573. .always_on = true,
  574. .valid_modes_mask = REGULATOR_MODE_NORMAL
  575. | REGULATOR_MODE_STANDBY,
  576. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  577. },
  578. };
  579. static struct regulator_init_data rx51_vpll2 = {
  580. .constraints = {
  581. .name = "VSDI_CSI",
  582. .min_uV = 1800000,
  583. .max_uV = 1800000,
  584. .apply_uV = true,
  585. .always_on = true,
  586. .valid_modes_mask = REGULATOR_MODE_NORMAL
  587. | REGULATOR_MODE_STANDBY,
  588. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  589. },
  590. };
  591. static struct regulator_init_data rx51_vsim = {
  592. .constraints = {
  593. .name = "VMMC2_IO_18",
  594. .min_uV = 1800000,
  595. .max_uV = 1800000,
  596. .apply_uV = true,
  597. .valid_modes_mask = REGULATOR_MODE_NORMAL
  598. | REGULATOR_MODE_STANDBY,
  599. .valid_ops_mask = REGULATOR_CHANGE_MODE
  600. | REGULATOR_CHANGE_STATUS,
  601. },
  602. .num_consumer_supplies = ARRAY_SIZE(rx51_vsim_supply),
  603. .consumer_supplies = rx51_vsim_supply,
  604. };
  605. static struct regulator_init_data rx51_vio = {
  606. .constraints = {
  607. .min_uV = 1800000,
  608. .max_uV = 1800000,
  609. .valid_modes_mask = REGULATOR_MODE_NORMAL
  610. | REGULATOR_MODE_STANDBY,
  611. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  612. | REGULATOR_CHANGE_MODE
  613. | REGULATOR_CHANGE_STATUS,
  614. },
  615. .num_consumer_supplies = ARRAY_SIZE(rx51_vio_supplies),
  616. .consumer_supplies = rx51_vio_supplies,
  617. };
  618. static struct regulator_init_data rx51_vintana1 = {
  619. .constraints = {
  620. .name = "VINTANA1",
  621. .min_uV = 1500000,
  622. .max_uV = 1500000,
  623. .always_on = true,
  624. .valid_modes_mask = REGULATOR_MODE_NORMAL
  625. | REGULATOR_MODE_STANDBY,
  626. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  627. },
  628. };
  629. static struct regulator_init_data rx51_vintana2 = {
  630. .constraints = {
  631. .name = "VINTANA2",
  632. .min_uV = 2750000,
  633. .max_uV = 2750000,
  634. .apply_uV = true,
  635. .always_on = true,
  636. .valid_modes_mask = REGULATOR_MODE_NORMAL
  637. | REGULATOR_MODE_STANDBY,
  638. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  639. },
  640. };
  641. static struct regulator_init_data rx51_vintdig = {
  642. .constraints = {
  643. .name = "VINTDIG",
  644. .min_uV = 1500000,
  645. .max_uV = 1500000,
  646. .always_on = true,
  647. .valid_modes_mask = REGULATOR_MODE_NORMAL
  648. | REGULATOR_MODE_STANDBY,
  649. .valid_ops_mask = REGULATOR_CHANGE_MODE,
  650. },
  651. };
  652. static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
  653. .gpio_reset = RX51_FMTX_RESET_GPIO,
  654. };
  655. static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
  656. I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
  657. .platform_data = &rx51_si4713_i2c_data,
  658. };
  659. static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
  660. .i2c_bus = 2,
  661. .subdev_board_info = &rx51_si4713_board_info,
  662. };
  663. static struct platform_device rx51_si4713_dev __initdata_or_module = {
  664. .name = "radio-si4713",
  665. .id = -1,
  666. .dev = {
  667. .platform_data = &rx51_si4713_data,
  668. },
  669. };
  670. static __init void rx51_init_si4713(void)
  671. {
  672. int err;
  673. err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
  674. if (err) {
  675. printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
  676. return;
  677. }
  678. rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
  679. platform_device_register(&rx51_si4713_dev);
  680. }
  681. static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
  682. {
  683. /* FIXME this gpio setup is just a placeholder for now */
  684. gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
  685. gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "speaker_en");
  686. return 0;
  687. }
  688. static struct twl4030_gpio_platform_data rx51_gpio_data = {
  689. .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. static struct twl4030_vibra_data rx51_vibra_data __initdata = {
  847. .coexist = 0,
  848. };
  849. static 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. },
  921. #endif
  922. };
  923. static int __init rx51_i2c_init(void)
  924. {
  925. if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
  926. system_rev >= SYSTEM_REV_B_USES_VAUX3) {
  927. rx51_twldata.vaux3 = &rx51_vaux3_mmc;
  928. /* Only older boards use VMMC2 for internal MMC */
  929. rx51_vmmc2.num_consumer_supplies--;
  930. } else {
  931. rx51_twldata.vaux3 = &rx51_vaux3_cam;
  932. }
  933. rx51_twldata.vmmc2 = &rx51_vmmc2;
  934. omap3_pmic_get_config(&rx51_twldata,
  935. TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC,
  936. TWL_COMMON_REGULATOR_VDAC);
  937. rx51_twldata.vdac->constraints.apply_uV = true;
  938. rx51_twldata.vdac->constraints.name = "VDAC";
  939. omap_pmic_init(1, 2200, "twl5030", 7 + OMAP_INTC_START, &rx51_twldata);
  940. omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
  941. ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
  942. #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
  943. rx51_lis3lv02d_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
  944. rx51_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
  945. #endif
  946. omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3,
  947. ARRAY_SIZE(rx51_peripherals_i2c_board_info_3));
  948. return 0;
  949. }
  950. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  951. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  952. static struct mtd_partition onenand_partitions[] = {
  953. {
  954. .name = "bootloader",
  955. .offset = 0,
  956. .size = 0x20000,
  957. .mask_flags = MTD_WRITEABLE, /* Force read-only */
  958. },
  959. {
  960. .name = "config",
  961. .offset = MTDPART_OFS_APPEND,
  962. .size = 0x60000,
  963. },
  964. {
  965. .name = "log",
  966. .offset = MTDPART_OFS_APPEND,
  967. .size = 0x40000,
  968. },
  969. {
  970. .name = "kernel",
  971. .offset = MTDPART_OFS_APPEND,
  972. .size = 0x200000,
  973. },
  974. {
  975. .name = "initfs",
  976. .offset = MTDPART_OFS_APPEND,
  977. .size = 0x200000,
  978. },
  979. {
  980. .name = "rootfs",
  981. .offset = MTDPART_OFS_APPEND,
  982. .size = MTDPART_SIZ_FULL,
  983. },
  984. };
  985. static struct omap_onenand_platform_data board_onenand_data[] = {
  986. {
  987. .cs = 0,
  988. .gpio_irq = 65,
  989. .parts = onenand_partitions,
  990. .nr_parts = ARRAY_SIZE(onenand_partitions),
  991. .flags = ONENAND_SYNC_READWRITE,
  992. }
  993. };
  994. #endif
  995. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  996. static struct omap_smc91x_platform_data board_smc91x_data = {
  997. .cs = 1,
  998. .gpio_irq = 54,
  999. .gpio_pwrdwn = 86,
  1000. .gpio_reset = 164,
  1001. .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
  1002. };
  1003. static void __init board_smc91x_init(void)
  1004. {
  1005. omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
  1006. omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
  1007. omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
  1008. gpmc_smc91x_init(&board_smc91x_data);
  1009. }
  1010. #else
  1011. static inline void board_smc91x_init(void)
  1012. {
  1013. }
  1014. #endif
  1015. static void rx51_wl1251_set_power(bool enable)
  1016. {
  1017. gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
  1018. }
  1019. static struct gpio rx51_wl1251_gpios[] __initdata = {
  1020. { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" },
  1021. { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
  1022. };
  1023. static void __init rx51_init_wl1251(void)
  1024. {
  1025. int irq, ret;
  1026. ret = gpio_request_array(rx51_wl1251_gpios,
  1027. ARRAY_SIZE(rx51_wl1251_gpios));
  1028. if (ret < 0)
  1029. goto error;
  1030. irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
  1031. if (irq < 0)
  1032. goto err_irq;
  1033. wl1251_pdata.set_power = rx51_wl1251_set_power;
  1034. rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
  1035. return;
  1036. err_irq:
  1037. gpio_free(RX51_WL1251_IRQ_GPIO);
  1038. gpio_free(RX51_WL1251_POWER_GPIO);
  1039. error:
  1040. printk(KERN_ERR "wl1251 board initialisation failed\n");
  1041. wl1251_pdata.set_power = NULL;
  1042. /*
  1043. * Now rx51_peripherals_spi_board_info[1].irq is zero and
  1044. * set_power is null, and wl1251_probe() will fail.
  1045. */
  1046. }
  1047. static struct tsc2005_platform_data tsc2005_pdata = {
  1048. .ts_pressure_max = 2048,
  1049. .ts_pressure_fudge = 2,
  1050. .ts_x_max = 4096,
  1051. .ts_x_fudge = 4,
  1052. .ts_y_max = 4096,
  1053. .ts_y_fudge = 7,
  1054. .ts_x_plate_ohm = 280,
  1055. .esd_timeout_ms = 8000,
  1056. };
  1057. static struct gpio rx51_tsc2005_gpios[] __initdata = {
  1058. { RX51_TSC2005_IRQ_GPIO, GPIOF_IN, "tsc2005 IRQ" },
  1059. { RX51_TSC2005_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "tsc2005 reset" },
  1060. };
  1061. static void rx51_tsc2005_set_reset(bool enable)
  1062. {
  1063. gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
  1064. }
  1065. static void __init rx51_init_tsc2005(void)
  1066. {
  1067. int r;
  1068. omap_mux_init_gpio(RX51_TSC2005_RESET_GPIO, OMAP_PIN_OUTPUT);
  1069. omap_mux_init_gpio(RX51_TSC2005_IRQ_GPIO, OMAP_PIN_INPUT_PULLUP);
  1070. r = gpio_request_array(rx51_tsc2005_gpios,
  1071. ARRAY_SIZE(rx51_tsc2005_gpios));
  1072. if (r < 0) {
  1073. printk(KERN_ERR "tsc2005 board initialization failed\n");
  1074. tsc2005_pdata.esd_timeout_ms = 0;
  1075. return;
  1076. }
  1077. tsc2005_pdata.set_reset = rx51_tsc2005_set_reset;
  1078. rx51_peripherals_spi_board_info[RX51_SPI_TSC2005].irq =
  1079. gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
  1080. }
  1081. #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
  1082. static struct lirc_rx51_platform_data rx51_lirc_data = {
  1083. .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
  1084. .pwm_timer = 9, /* Use GPT 9 for CIR */
  1085. };
  1086. static struct platform_device rx51_lirc_device = {
  1087. .name = "lirc_rx51",
  1088. .id = -1,
  1089. .dev = {
  1090. .platform_data = &rx51_lirc_data,
  1091. },
  1092. };
  1093. static void __init rx51_init_lirc(void)
  1094. {
  1095. platform_device_register(&rx51_lirc_device);
  1096. }
  1097. #else
  1098. static void __init rx51_init_lirc(void)
  1099. {
  1100. }
  1101. #endif
  1102. void __init rx51_peripherals_init(void)
  1103. {
  1104. rx51_i2c_init();
  1105. regulator_has_full_constraints();
  1106. gpmc_onenand_init(board_onenand_data);
  1107. board_smc91x_init();
  1108. rx51_add_gpio_keys();
  1109. rx51_init_wl1251();
  1110. rx51_init_tsc2005();
  1111. rx51_init_si4713();
  1112. rx51_init_lirc();
  1113. spi_register_board_info(rx51_peripherals_spi_board_info,
  1114. ARRAY_SIZE(rx51_peripherals_spi_board_info));
  1115. partition = omap_mux_get("core");
  1116. if (partition)
  1117. omap_hsmmc_init(mmc);
  1118. rx51_charger_init();
  1119. }