board-rx51-peripherals.c 34 KB

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