board-rx51-peripherals.c 32 KB

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