board-rx51-peripherals.c 34 KB

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