board-rx51-peripherals.c 32 KB

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