board-rx51-peripherals.c 34 KB

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