board-rx51-peripherals.c 34 KB

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