board-rx51-peripherals.c 34 KB

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