blob: bbcb6775a6a3006486b5d64890aca629e66e3ab3 [file] [log] [blame]
Lauri Leukkunenffe7f952009-03-23 18:38:17 -07001/*
Amit Kucheria9312fff2009-08-27 20:27:57 +02002 * linux/arch/arm/mach-omap2/board-rx51-peripherals.c
Lauri Leukkunenffe7f952009-03-23 18:38:17 -07003 *
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
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/input.h>
Janusz Krzysztofik61354342009-10-22 14:43:17 -070015#include <linux/input/matrix_keypad.h>
Lauri Leukkunenffe7f952009-03-23 18:38:17 -070016#include <linux/spi/spi.h>
Ohad Ben-Cohenc1f9a092010-09-16 13:16:02 +020017#include <linux/wl12xx.h>
Lauri Leukkunenffe7f952009-03-23 18:38:17 -070018#include <linux/i2c.h>
Balaji T Kebeb53e2009-12-15 20:09:02 +053019#include <linux/i2c/twl.h>
Lauri Leukkunenffe7f952009-03-23 18:38:17 -070020#include <linux/clk.h>
21#include <linux/delay.h>
22#include <linux/regulator/machine.h>
23#include <linux/gpio.h>
Jani Nikulaf014ee32009-11-05 22:59:47 -080024#include <linux/gpio_keys.h>
Adrian Hunter5e763d22009-09-22 16:45:05 -070025#include <linux/mmc/host.h>
Lauri Leukkunenffe7f952009-03-23 18:38:17 -070026
Tony Lindgrence491cf2009-10-20 09:40:47 -070027#include <plat/mcspi.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070028#include <plat/board.h>
29#include <plat/common.h>
30#include <plat/dma.h>
31#include <plat/gpmc.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070032#include <plat/onenand.h>
33#include <plat/gpmc-smc91x.h>
Lauri Leukkunenffe7f952009-03-23 18:38:17 -070034
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070035#include <mach/board-rx51.h>
36
Jarkko Nikula87581fd2010-08-02 13:18:02 +030037#include <sound/tlv320aic3x.h>
Jarkko Nikula64d06692010-08-02 13:18:03 +030038#include <sound/tpa6130a2-plat.h>
Jarkko Nikula589541c2011-02-21 08:42:36 +020039#include <media/radio-si4713.h>
40#include <media/si4713.h>
Jarkko Nikula87581fd2010-08-02 13:18:02 +030041
Mathias Nyman70b5d732010-08-02 13:18:03 +030042#include <../drivers/staging/iio/light/tsl2563.h>
43
Tony Lindgren4896e392009-12-11 16:16:32 -080044#include "mux.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080045#include "hsmmc.h"
Lauri Leukkunenffe7f952009-03-23 18:38:17 -070046
Adrian Hunterf52eeee2009-05-28 14:04:04 -070047#define SYSTEM_REV_B_USES_VAUX3 0x1699
48#define SYSTEM_REV_S_USES_VAUX3 0x8
49
Kalle Valoa24e61a2009-11-18 18:41:06 -080050#define RX51_WL1251_POWER_GPIO 87
51#define RX51_WL1251_IRQ_GPIO 42
Jarkko Nikula589541c2011-02-21 08:42:36 +020052#define RX51_FMTX_RESET_GPIO 163
53#define RX51_FMTX_IRQ 53
Kalle Valoa24e61a2009-11-18 18:41:06 -080054
55/* list all spi devices here */
56enum {
57 RX51_SPI_WL1251,
Roger Quadros03e11102010-05-10 10:35:17 +020058 RX51_SPI_MIPID, /* LCD panel */
Roger Quadros6996e7f2010-03-22 17:16:25 +020059 RX51_SPI_TSC2005, /* Touch Controller */
Kalle Valoa24e61a2009-11-18 18:41:06 -080060};
61
62static struct wl12xx_platform_data wl1251_pdata;
63
Mathias Nyman70b5d732010-08-02 13:18:03 +030064#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
65static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
66 .cover_comp_gain = 16,
67};
68#endif
69
Kalle Valoa24e61a2009-11-18 18:41:06 -080070static struct omap2_mcspi_device_config wl1251_mcspi_config = {
71 .turbo_mode = 0,
72 .single_channel = 1,
73};
74
Roger Quadros03e11102010-05-10 10:35:17 +020075static struct omap2_mcspi_device_config mipid_mcspi_config = {
76 .turbo_mode = 0,
77 .single_channel = 1,
78};
79
Roger Quadros6996e7f2010-03-22 17:16:25 +020080static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
81 .turbo_mode = 0,
82 .single_channel = 1,
83};
84
Kalle Valoa24e61a2009-11-18 18:41:06 -080085static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
86 [RX51_SPI_WL1251] = {
87 .modalias = "wl1251",
88 .bus_num = 4,
89 .chip_select = 0,
90 .max_speed_hz = 48000000,
Kalle Valo860fc972009-12-11 16:16:37 -080091 .mode = SPI_MODE_3,
Kalle Valoa24e61a2009-11-18 18:41:06 -080092 .controller_data = &wl1251_mcspi_config,
93 .platform_data = &wl1251_pdata,
94 },
Roger Quadros03e11102010-05-10 10:35:17 +020095 [RX51_SPI_MIPID] = {
96 .modalias = "acx565akm",
97 .bus_num = 1,
98 .chip_select = 2,
99 .max_speed_hz = 6000000,
100 .controller_data = &mipid_mcspi_config,
101 },
Roger Quadros6996e7f2010-03-22 17:16:25 +0200102 [RX51_SPI_TSC2005] = {
103 .modalias = "tsc2005",
104 .bus_num = 1,
105 .chip_select = 0,
106 /* .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),*/
107 .max_speed_hz = 6000000,
108 .controller_data = &tsc2005_mcspi_config,
109 /* .platform_data = &tsc2005_config,*/
110 },
Kalle Valoa24e61a2009-11-18 18:41:06 -0800111};
112
Heikki Krogerusfd0964c2010-08-19 15:09:37 +0300113static struct platform_device rx51_charger_device = {
114 .name = "isp1704_charger",
115};
116
Jani Nikulaf014ee32009-11-05 22:59:47 -0800117#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
118
119#define RX51_GPIO_CAMERA_LENS_COVER 110
120#define RX51_GPIO_CAMERA_FOCUS 68
121#define RX51_GPIO_CAMERA_CAPTURE 69
122#define RX51_GPIO_KEYPAD_SLIDE 71
123#define RX51_GPIO_LOCK_BUTTON 113
124#define RX51_GPIO_PROXIMITY 89
125
126#define RX51_GPIO_DEBOUNCE_TIMEOUT 10
127
128static struct gpio_keys_button rx51_gpio_keys[] = {
129 {
130 .desc = "Camera Lens Cover",
131 .type = EV_SW,
132 .code = SW_CAMERA_LENS_COVER,
133 .gpio = RX51_GPIO_CAMERA_LENS_COVER,
134 .active_low = 1,
135 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
136 }, {
137 .desc = "Camera Focus",
138 .type = EV_KEY,
139 .code = KEY_CAMERA_FOCUS,
140 .gpio = RX51_GPIO_CAMERA_FOCUS,
141 .active_low = 1,
142 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
143 }, {
144 .desc = "Camera Capture",
145 .type = EV_KEY,
146 .code = KEY_CAMERA,
147 .gpio = RX51_GPIO_CAMERA_CAPTURE,
148 .active_low = 1,
149 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
150 }, {
151 .desc = "Lock Button",
152 .type = EV_KEY,
153 .code = KEY_SCREENLOCK,
154 .gpio = RX51_GPIO_LOCK_BUTTON,
155 .active_low = 1,
156 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
157 }, {
158 .desc = "Keypad Slide",
159 .type = EV_SW,
160 .code = SW_KEYPAD_SLIDE,
161 .gpio = RX51_GPIO_KEYPAD_SLIDE,
162 .active_low = 1,
163 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
164 }, {
165 .desc = "Proximity Sensor",
166 .type = EV_SW,
167 .code = SW_FRONT_PROXIMITY,
168 .gpio = RX51_GPIO_PROXIMITY,
169 .active_low = 0,
170 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
171 }
172};
173
174static struct gpio_keys_platform_data rx51_gpio_keys_data = {
175 .buttons = rx51_gpio_keys,
176 .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
177};
178
179static struct platform_device rx51_gpio_keys_device = {
180 .name = "gpio-keys",
181 .id = -1,
182 .dev = {
183 .platform_data = &rx51_gpio_keys_data,
184 },
185};
186
187static void __init rx51_add_gpio_keys(void)
188{
189 platform_device_register(&rx51_gpio_keys_device);
190}
191#else
192static void __init rx51_add_gpio_keys(void)
193{
194}
195#endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
196
Manjunath Kondaiah Gbead4372010-10-08 10:01:13 -0700197static uint32_t board_keymap[] = {
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700198 /*
199 * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
200 * connected to the ground" matrix state.
201 */
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700202 KEY(0, 0, KEY_Q),
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700203 KEY(0, 1, KEY_O),
204 KEY(0, 2, KEY_P),
205 KEY(0, 3, KEY_COMMA),
206 KEY(0, 4, KEY_BACKSPACE),
207 KEY(0, 6, KEY_A),
208 KEY(0, 7, KEY_S),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700209
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700210 KEY(1, 0, KEY_W),
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700211 KEY(1, 1, KEY_D),
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700212 KEY(1, 2, KEY_F),
213 KEY(1, 3, KEY_G),
214 KEY(1, 4, KEY_H),
215 KEY(1, 5, KEY_J),
216 KEY(1, 6, KEY_K),
217 KEY(1, 7, KEY_L),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700218
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700219 KEY(2, 0, KEY_E),
220 KEY(2, 1, KEY_DOT),
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700221 KEY(2, 2, KEY_UP),
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700222 KEY(2, 3, KEY_ENTER),
223 KEY(2, 5, KEY_Z),
224 KEY(2, 6, KEY_X),
225 KEY(2, 7, KEY_C),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700226 KEY(2, 8, KEY_F9),
227
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700228 KEY(3, 0, KEY_R),
229 KEY(3, 1, KEY_V),
230 KEY(3, 2, KEY_B),
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700231 KEY(3, 3, KEY_N),
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700232 KEY(3, 4, KEY_M),
233 KEY(3, 5, KEY_SPACE),
234 KEY(3, 6, KEY_SPACE),
235 KEY(3, 7, KEY_LEFT),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700236
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700237 KEY(4, 0, KEY_T),
238 KEY(4, 1, KEY_DOWN),
239 KEY(4, 2, KEY_RIGHT),
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700240 KEY(4, 4, KEY_LEFTCTRL),
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700241 KEY(4, 5, KEY_RIGHTALT),
242 KEY(4, 6, KEY_LEFTSHIFT),
Dmitry Torokhov2e65a202010-07-26 01:12:37 -0700243 KEY(4, 8, KEY_F10),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700244
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700245 KEY(5, 0, KEY_Y),
Dmitry Torokhov2e65a202010-07-26 01:12:37 -0700246 KEY(5, 8, KEY_F11),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700247
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700248 KEY(6, 0, KEY_U),
Dmitry Torokhov3fea6022010-07-20 20:25:35 -0700249
Amit Kucheriaacf442d2009-10-05 21:43:44 -0700250 KEY(7, 0, KEY_I),
251 KEY(7, 1, KEY_F7),
252 KEY(7, 2, KEY_F8),
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700253};
254
Tony Lindgren4f543332009-09-24 16:23:16 -0700255static struct matrix_keymap_data board_map_data = {
256 .keymap = board_keymap,
257 .keymap_size = ARRAY_SIZE(board_keymap),
258};
259
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700260static struct twl4030_keypad_data rx51_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700261 .keymap_data = &board_map_data,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700262 .rows = 8,
263 .cols = 8,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700264 .rep = 1,
265};
266
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700267static struct twl4030_madc_platform_data rx51_madc_data = {
268 .irq_line = 1,
269};
270
Adrian Hunterce6f0012010-02-15 10:03:34 -0800271/* Enable input logic and pull all lines up when eMMC is on. */
272static struct omap_board_mux rx51_mmc2_on_mux[] = {
273 OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
274 OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
275 OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
276 OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
277 OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
278 OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
279 OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
280 OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
281 OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
282 { .reg_offset = OMAP_MUX_TERMINATOR },
283};
284
285/* Disable input logic and pull all lines down when eMMC is off. */
286static struct omap_board_mux rx51_mmc2_off_mux[] = {
287 OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
288 OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
289 OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
290 OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
291 OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
292 OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
293 OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
294 OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
295 OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
296 { .reg_offset = OMAP_MUX_TERMINATOR },
297};
298
Benoit Cousson112485e2010-08-16 10:55:35 +0200299static struct omap_mux_partition *partition;
300
Adrian Hunterce6f0012010-02-15 10:03:34 -0800301/*
302 * Current flows to eMMC when eMMC is off and the data lines are pulled up,
303 * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
304 */
305static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
306{
307 if (power_on)
Benoit Cousson112485e2010-08-16 10:55:35 +0200308 omap_mux_write_array(partition, rx51_mmc2_on_mux);
Adrian Hunterce6f0012010-02-15 10:03:34 -0800309 else
Benoit Cousson112485e2010-08-16 10:55:35 +0200310 omap_mux_write_array(partition, rx51_mmc2_off_mux);
Adrian Hunterce6f0012010-02-15 10:03:34 -0800311}
312
Adrian Hunter68ff0422010-02-15 10:03:34 -0800313static struct omap2_hsmmc_info mmc[] __initdata = {
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700314 {
315 .name = "external",
316 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000317 .caps = MMC_CAP_4_BIT_DATA,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700318 .cover_only = true,
319 .gpio_cd = 160,
320 .gpio_wp = -EINVAL,
Adrian Hunter5e763d22009-09-22 16:45:05 -0700321 .power_saving = true,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700322 },
323 {
324 .name = "internal",
325 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000326 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
327 /* See also rx51_mmc2_remux */
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700328 .gpio_cd = -EINVAL,
329 .gpio_wp = -EINVAL,
Adrian Hunter5e763d22009-09-22 16:45:05 -0700330 .nonremovable = true,
331 .power_saving = true,
Adrian Hunterce6f0012010-02-15 10:03:34 -0800332 .remux = rx51_mmc2_remux,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700333 },
334 {} /* Terminator */
335};
336
Jarkko Nikula5c7d9bb2010-08-02 13:18:02 +0300337static struct regulator_consumer_supply rx51_vmmc1_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530338 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700339
Jarkko Nikula5c7d9bb2010-08-02 13:18:02 +0300340static struct regulator_consumer_supply rx51_vaux3_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530341 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700342
Jarkko Nikula5c7d9bb2010-08-02 13:18:02 +0300343static struct regulator_consumer_supply rx51_vsim_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530344 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700345
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700346static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
347 /* tlv320aic3x analog supplies */
Jarkko Nikula5c7d9bb2010-08-02 13:18:02 +0300348 REGULATOR_SUPPLY("AVDD", "2-0018"),
349 REGULATOR_SUPPLY("DRVDD", "2-0018"),
Jarkko Nikulacaeeb4a2010-12-20 18:48:16 -0800350 REGULATOR_SUPPLY("AVDD", "2-0019"),
351 REGULATOR_SUPPLY("DRVDD", "2-0019"),
Jarkko Nikula64d06692010-08-02 13:18:03 +0300352 /* tpa6130a2 */
353 REGULATOR_SUPPLY("Vdd", "2-0060"),
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700354 /* Keep vmmc as last item. It is not iterated for newer boards */
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530355 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700356};
357
358static struct regulator_consumer_supply rx51_vio_supplies[] = {
359 /* tlv320aic3x digital supplies */
Jarkko Nikula5c7d9bb2010-08-02 13:18:02 +0300360 REGULATOR_SUPPLY("IOVDD", "2-0018"),
361 REGULATOR_SUPPLY("DVDD", "2-0018"),
Jarkko Nikulacaeeb4a2010-12-20 18:48:16 -0800362 REGULATOR_SUPPLY("IOVDD", "2-0019"),
363 REGULATOR_SUPPLY("DVDD", "2-0019"),
Jarkko Nikula589541c2011-02-21 08:42:36 +0200364 /* Si4713 IO supply */
365 REGULATOR_SUPPLY("vio", "2-0063"),
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700366};
367
Roger Quadros0581b522010-05-12 11:48:47 +0300368static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
Jarkko Nikulab5b99452010-12-21 17:25:34 +0000369 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
Jarkko Nikula589541c2011-02-21 08:42:36 +0200370 /* Si4713 supply */
371 REGULATOR_SUPPLY("vdd", "2-0063"),
Roger Quadros0581b522010-05-12 11:48:47 +0300372};
373
Jarkko Nikula31bbb4f2010-12-21 17:25:35 +0000374static struct regulator_consumer_supply rx51_vdac_supply[] = {
Senthilvadivu Guruswamy30ea50c2011-01-24 06:22:01 +0000375 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
Jarkko Nikula31bbb4f2010-12-21 17:25:35 +0000376};
377
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700378static struct regulator_init_data rx51_vaux1 = {
379 .constraints = {
380 .name = "V28",
381 .min_uV = 2800000,
382 .max_uV = 2800000,
Jarkko Nikula000d5342010-08-02 13:18:02 +0300383 .always_on = true, /* due battery cover sensor */
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700384 .valid_modes_mask = REGULATOR_MODE_NORMAL
385 | REGULATOR_MODE_STANDBY,
386 .valid_ops_mask = REGULATOR_CHANGE_MODE
387 | REGULATOR_CHANGE_STATUS,
388 },
Roger Quadros0581b522010-05-12 11:48:47 +0300389 .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
390 .consumer_supplies = rx51_vaux1_consumers,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700391};
392
393static struct regulator_init_data rx51_vaux2 = {
394 .constraints = {
395 .name = "VCSI",
396 .min_uV = 1800000,
397 .max_uV = 1800000,
398 .valid_modes_mask = REGULATOR_MODE_NORMAL
399 | REGULATOR_MODE_STANDBY,
400 .valid_ops_mask = REGULATOR_CHANGE_MODE
401 | REGULATOR_CHANGE_STATUS,
402 },
403};
404
405/* VAUX3 - adds more power to VIO_18 rail */
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700406static struct regulator_init_data rx51_vaux3_cam = {
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700407 .constraints = {
408 .name = "VCAM_DIG_18",
409 .min_uV = 1800000,
410 .max_uV = 1800000,
411 .apply_uV = true,
412 .valid_modes_mask = REGULATOR_MODE_NORMAL
413 | REGULATOR_MODE_STANDBY,
414 .valid_ops_mask = REGULATOR_CHANGE_MODE
415 | REGULATOR_CHANGE_STATUS,
416 },
417};
418
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700419static struct regulator_init_data rx51_vaux3_mmc = {
420 .constraints = {
421 .name = "VMMC2_30",
422 .min_uV = 2800000,
423 .max_uV = 3000000,
424 .apply_uV = true,
425 .valid_modes_mask = REGULATOR_MODE_NORMAL
426 | REGULATOR_MODE_STANDBY,
427 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
428 | REGULATOR_CHANGE_MODE
429 | REGULATOR_CHANGE_STATUS,
430 },
431 .num_consumer_supplies = 1,
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700432 .consumer_supplies = &rx51_vaux3_supply,
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700433};
434
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700435static struct regulator_init_data rx51_vaux4 = {
436 .constraints = {
437 .name = "VCAM_ANA_28",
438 .min_uV = 2800000,
439 .max_uV = 2800000,
440 .apply_uV = true,
441 .valid_modes_mask = REGULATOR_MODE_NORMAL
442 | REGULATOR_MODE_STANDBY,
443 .valid_ops_mask = REGULATOR_CHANGE_MODE
444 | REGULATOR_CHANGE_STATUS,
445 },
446};
447
448static struct regulator_init_data rx51_vmmc1 = {
449 .constraints = {
450 .min_uV = 1850000,
451 .max_uV = 3150000,
452 .valid_modes_mask = REGULATOR_MODE_NORMAL
453 | REGULATOR_MODE_STANDBY,
454 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
455 | REGULATOR_CHANGE_MODE
456 | REGULATOR_CHANGE_STATUS,
457 },
458 .num_consumer_supplies = 1,
459 .consumer_supplies = &rx51_vmmc1_supply,
460};
461
462static struct regulator_init_data rx51_vmmc2 = {
463 .constraints = {
Jarkko Nikulaf2add1d2010-05-10 14:29:18 -0700464 .name = "V28_A",
465 .min_uV = 2800000,
466 .max_uV = 3000000,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700467 .apply_uV = true,
468 .valid_modes_mask = REGULATOR_MODE_NORMAL
469 | REGULATOR_MODE_STANDBY,
470 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
471 | REGULATOR_CHANGE_MODE
472 | REGULATOR_CHANGE_STATUS,
473 },
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700474 .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies),
475 .consumer_supplies = rx51_vmmc2_supplies,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700476};
477
478static struct regulator_init_data rx51_vsim = {
479 .constraints = {
480 .name = "VMMC2_IO_18",
481 .min_uV = 1800000,
482 .max_uV = 1800000,
483 .apply_uV = true,
484 .valid_modes_mask = REGULATOR_MODE_NORMAL
485 | REGULATOR_MODE_STANDBY,
486 .valid_ops_mask = REGULATOR_CHANGE_MODE
487 | REGULATOR_CHANGE_STATUS,
488 },
489 .num_consumer_supplies = 1,
490 .consumer_supplies = &rx51_vsim_supply,
491};
492
493static struct regulator_init_data rx51_vdac = {
494 .constraints = {
Jarkko Nikula31bbb4f2010-12-21 17:25:35 +0000495 .name = "VDAC",
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700496 .min_uV = 1800000,
497 .max_uV = 1800000,
Jarkko Nikula31bbb4f2010-12-21 17:25:35 +0000498 .apply_uV = true,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700499 .valid_modes_mask = REGULATOR_MODE_NORMAL
500 | REGULATOR_MODE_STANDBY,
Jarkko Nikula31bbb4f2010-12-21 17:25:35 +0000501 .valid_ops_mask = REGULATOR_CHANGE_MODE
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700502 | REGULATOR_CHANGE_STATUS,
503 },
Jarkko Nikula31bbb4f2010-12-21 17:25:35 +0000504 .num_consumer_supplies = 1,
505 .consumer_supplies = rx51_vdac_supply,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700506};
507
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700508static struct regulator_init_data rx51_vio = {
509 .constraints = {
510 .min_uV = 1800000,
511 .max_uV = 1800000,
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_vio_supplies),
519 .consumer_supplies = rx51_vio_supplies,
520};
521
Jarkko Nikula589541c2011-02-21 08:42:36 +0200522static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
523 .gpio_reset = RX51_FMTX_RESET_GPIO,
524};
525
526static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
527 I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
528 .platform_data = &rx51_si4713_i2c_data,
529};
530
531static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
532 .i2c_bus = 2,
533 .subdev_board_info = &rx51_si4713_board_info,
534};
535
536static struct platform_device rx51_si4713_dev __initdata_or_module = {
537 .name = "radio-si4713",
538 .id = -1,
539 .dev = {
540 .platform_data = &rx51_si4713_data,
541 },
542};
543
544static __init void rx51_init_si4713(void)
545{
546 int err;
547
548 err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
549 if (err) {
550 printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
551 return;
552 }
553 rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
554 platform_device_register(&rx51_si4713_dev);
555}
556
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700557static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
558{
559 /* FIXME this gpio setup is just a placeholder for now */
560 gpio_request(gpio + 6, "backlight_pwm");
561 gpio_direction_output(gpio + 6, 0);
562 gpio_request(gpio + 7, "speaker_en");
563 gpio_direction_output(gpio + 7, 1);
564
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700565 return 0;
566}
567
568static struct twl4030_gpio_platform_data rx51_gpio_data = {
569 .gpio_base = OMAP_MAX_GPIO_LINES,
570 .irq_base = TWL4030_GPIO_IRQ_BASE,
571 .irq_end = TWL4030_GPIO_IRQ_END,
572 .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3)
573 | BIT(4) | BIT(5)
574 | BIT(8) | BIT(9) | BIT(10) | BIT(11)
575 | BIT(12) | BIT(13) | BIT(14) | BIT(15)
576 | BIT(16) | BIT(17) ,
577 .setup = rx51_twlgpio_setup,
578};
579
Roger Quadrosdfc27b32009-08-10 14:49:51 +0300580static struct twl4030_usb_data rx51_usb_data = {
581 .usb_mode = T2_USB_MODE_ULPI,
582};
583
Amit Kucheria9312fff2009-08-27 20:27:57 +0200584static struct twl4030_ins sleep_on_seq[] __initdata = {
585/*
Amit Kucheria3c684e842009-10-19 15:11:08 +0300586 * Turn off everything
Amit Kucheria9312fff2009-08-27 20:27:57 +0200587 */
Amit Kucheria3c684e842009-10-19 15:11:08 +0300588 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
Amit Kucheria9312fff2009-08-27 20:27:57 +0200589};
590
591static struct twl4030_script sleep_on_script __initdata = {
592 .script = sleep_on_seq,
593 .size = ARRAY_SIZE(sleep_on_seq),
594 .flags = TWL4030_SLEEP_SCRIPT,
595};
596
597static struct twl4030_ins wakeup_seq[] __initdata = {
598/*
Amit Kucheria3c684e842009-10-19 15:11:08 +0300599 * Reenable everything
Amit Kucheria9312fff2009-08-27 20:27:57 +0200600 */
Amit Kucheria3c684e842009-10-19 15:11:08 +0300601 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
Amit Kucheria9312fff2009-08-27 20:27:57 +0200602};
603
604static struct twl4030_script wakeup_script __initdata = {
605 .script = wakeup_seq,
606 .size = ARRAY_SIZE(wakeup_seq),
607 .flags = TWL4030_WAKEUP12_SCRIPT,
608};
609
610static struct twl4030_ins wakeup_p3_seq[] __initdata = {
611/*
Amit Kucheria3c684e842009-10-19 15:11:08 +0300612 * Reenable everything
Amit Kucheria9312fff2009-08-27 20:27:57 +0200613 */
Amit Kucheria3c684e842009-10-19 15:11:08 +0300614 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
Amit Kucheria9312fff2009-08-27 20:27:57 +0200615};
616
617static struct twl4030_script wakeup_p3_script __initdata = {
618 .script = wakeup_p3_seq,
619 .size = ARRAY_SIZE(wakeup_p3_seq),
620 .flags = TWL4030_WAKEUP3_SCRIPT,
621};
622
623static struct twl4030_ins wrst_seq[] __initdata = {
624/*
625 * Reset twl4030.
626 * Reset VDD1 regulator.
627 * Reset VDD2 regulator.
628 * Reset VPLL1 regulator.
629 * Enable sysclk output.
630 * Reenable twl4030.
631 */
632 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
633 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
634 0x13},
Amit Kucheria9312fff2009-08-27 20:27:57 +0200635 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
636 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
637 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
638 {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
Amit Kucheria3c684e842009-10-19 15:11:08 +0300639 {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
Amit Kucheria9312fff2009-08-27 20:27:57 +0200640 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
641};
642
643static struct twl4030_script wrst_script __initdata = {
644 .script = wrst_seq,
645 .size = ARRAY_SIZE(wrst_seq),
646 .flags = TWL4030_WRST_SCRIPT,
647};
648
649static struct twl4030_script *twl4030_scripts[] __initdata = {
650 /* wakeup12 script should be loaded before sleep script, otherwise a
651 board might hit retention before loading of wakeup script is
652 completed. This can cause boot failures depending on timing issues.
653 */
654 &wakeup_script,
655 &sleep_on_script,
656 &wakeup_p3_script,
657 &wrst_script,
658};
659
660static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
Amit Kucheria3c684e842009-10-19 15:11:08 +0300661 { .resource = RES_VDD1, .devgroup = -1,
662 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
663 .remap_sleep = RES_STATE_OFF
664 },
665 { .resource = RES_VDD2, .devgroup = -1,
666 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
667 .remap_sleep = RES_STATE_OFF
668 },
669 { .resource = RES_VPLL1, .devgroup = -1,
670 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
671 .remap_sleep = RES_STATE_OFF
672 },
673 { .resource = RES_VPLL2, .devgroup = -1,
674 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
675 },
676 { .resource = RES_VAUX1, .devgroup = -1,
677 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
678 },
679 { .resource = RES_VAUX2, .devgroup = -1,
680 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
681 },
682 { .resource = RES_VAUX3, .devgroup = -1,
683 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
684 },
685 { .resource = RES_VAUX4, .devgroup = -1,
686 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
687 },
688 { .resource = RES_VMMC1, .devgroup = -1,
689 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
690 },
691 { .resource = RES_VMMC2, .devgroup = -1,
692 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
693 },
694 { .resource = RES_VDAC, .devgroup = -1,
695 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
696 },
697 { .resource = RES_VSIM, .devgroup = -1,
698 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
699 },
700 { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
701 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
702 },
703 { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
704 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
705 },
706 { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
707 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
708 },
709 { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
710 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
711 },
712 { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
713 .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
714 },
715 { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
716 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
717 },
718 { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
719 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
720 },
721 { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
722 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
723 },
724 { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
725 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
726 },
727 { .resource = RES_32KCLKOUT, .devgroup = -1,
728 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
729 },
730 { .resource = RES_RESET, .devgroup = -1,
731 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
732 },
733 { .resource = RES_Main_Ref, .devgroup = -1,
734 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
735 },
Amit Kucheria9312fff2009-08-27 20:27:57 +0200736 { 0, 0},
737};
738
739static struct twl4030_power_data rx51_t2scripts_data __initdata = {
740 .scripts = twl4030_scripts,
741 .num = ARRAY_SIZE(twl4030_scripts),
742 .resource_config = twl4030_rconfig,
743};
744
Ilkka Koskinenb7a834c2011-02-25 08:46:23 +0000745struct twl4030_codec_vibra_data rx51_vibra_data __initdata = {
746 .coexist = 0,
747};
748
749struct twl4030_codec_data rx51_codec_data __initdata = {
750 .audio_mclk = 26000000,
751 .vibra = &rx51_vibra_data,
752};
Amit Kucheria9312fff2009-08-27 20:27:57 +0200753
Amit Kucheria9312fff2009-08-27 20:27:57 +0200754static struct twl4030_platform_data rx51_twldata __initdata = {
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700755 .irq_base = TWL4030_IRQ_BASE,
756 .irq_end = TWL4030_IRQ_END,
757
758 /* platform_data for children goes here */
759 .gpio = &rx51_gpio_data,
760 .keypad = &rx51_kp_data,
761 .madc = &rx51_madc_data,
Roger Quadrosdfc27b32009-08-10 14:49:51 +0300762 .usb = &rx51_usb_data,
Amit Kucheria9312fff2009-08-27 20:27:57 +0200763 .power = &rx51_t2scripts_data,
Ilkka Koskinenb7a834c2011-02-25 08:46:23 +0000764 .codec = &rx51_codec_data,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700765
766 .vaux1 = &rx51_vaux1,
767 .vaux2 = &rx51_vaux2,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700768 .vaux4 = &rx51_vaux4,
769 .vmmc1 = &rx51_vmmc1,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700770 .vsim = &rx51_vsim,
771 .vdac = &rx51_vdac,
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700772 .vio = &rx51_vio,
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700773};
774
Jarkko Nikulaf0c61d32010-12-18 18:17:10 +0000775static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
Jarkko Nikula64d06692010-08-02 13:18:03 +0300776 .id = TPA6130A2,
777 .power_gpio = 98,
778};
779
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700780static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
781 {
782 I2C_BOARD_INFO("twl5030", 0x48),
783 .flags = I2C_CLIENT_WAKE,
784 .irq = INT_34XX_SYS_NIRQ,
785 .platform_data = &rx51_twldata,
786 },
787};
788
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000789/* Audio setup data */
790static struct aic3x_setup_data rx51_aic34_setup = {
791 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
792 .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT,
793};
794
Mark Browne4862f22010-08-16 18:42:58 +0100795static struct aic3x_pdata rx51_aic3x_data = {
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000796 .setup = &rx51_aic34_setup,
797 .gpio_reset = 60,
798};
799
Jarkko Nikulacaeeb4a2010-12-20 18:48:16 -0800800static struct aic3x_pdata rx51_aic3x_data2 = {
801 .gpio_reset = 60,
802};
803
Jarkko Nikuladabe9292010-05-10 14:29:18 -0700804static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
805 {
806 I2C_BOARD_INFO("tlv320aic3x", 0x18),
Jarkko Nikula87581fd2010-08-02 13:18:02 +0300807 .platform_data = &rx51_aic3x_data,
Jarkko Nikuladabe9292010-05-10 14:29:18 -0700808 },
Jarkko Nikulacaeeb4a2010-12-20 18:48:16 -0800809 {
810 I2C_BOARD_INFO("tlv320aic3x", 0x19),
811 .platform_data = &rx51_aic3x_data2,
812 },
Mathias Nyman70b5d732010-08-02 13:18:03 +0300813#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
814 {
815 I2C_BOARD_INFO("tsl2563", 0x29),
816 .platform_data = &rx51_tsl2563_platform_data,
817 },
818#endif
Jarkko Nikula64d06692010-08-02 13:18:03 +0300819 {
820 I2C_BOARD_INFO("tpa6130a2", 0x60),
821 .platform_data = &rx51_tpa6130a2_data,
822 }
Jarkko Nikuladabe9292010-05-10 14:29:18 -0700823};
824
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700825static int __init rx51_i2c_init(void)
826{
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700827 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700828 system_rev >= SYSTEM_REV_B_USES_VAUX3) {
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700829 rx51_twldata.vaux3 = &rx51_vaux3_mmc;
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700830 /* Only older boards use VMMC2 for internal MMC */
831 rx51_vmmc2.num_consumer_supplies--;
832 } else {
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700833 rx51_twldata.vaux3 = &rx51_vaux3_cam;
Adrian Hunterf52eeee2009-05-28 14:04:04 -0700834 }
Jarkko Nikula4cfcaef2010-05-10 14:29:19 -0700835 rx51_twldata.vmmc2 = &rx51_vmmc2;
Aaro Koskinencb3cc452009-10-14 09:56:34 -0700836 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
Jarkko Nikuladabe9292010-05-10 14:29:18 -0700837 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
838 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
839 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700840 omap_register_i2c_bus(3, 400, NULL, 0);
841 return 0;
842}
843
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700844#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
845 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
846
847static struct mtd_partition onenand_partitions[] = {
848 {
849 .name = "bootloader",
850 .offset = 0,
851 .size = 0x20000,
852 .mask_flags = MTD_WRITEABLE, /* Force read-only */
853 },
854 {
855 .name = "config",
856 .offset = MTDPART_OFS_APPEND,
857 .size = 0x60000,
858 },
859 {
860 .name = "log",
861 .offset = MTDPART_OFS_APPEND,
862 .size = 0x40000,
863 },
864 {
865 .name = "kernel",
866 .offset = MTDPART_OFS_APPEND,
867 .size = 0x200000,
868 },
869 {
870 .name = "initfs",
871 .offset = MTDPART_OFS_APPEND,
872 .size = 0x200000,
873 },
874 {
875 .name = "rootfs",
876 .offset = MTDPART_OFS_APPEND,
877 .size = MTDPART_SIZ_FULL,
878 },
879};
880
Aaro Koskinen54031872010-12-02 15:51:24 +0000881static struct omap_onenand_platform_data board_onenand_data[] = {
882 {
883 .cs = 0,
884 .gpio_irq = 65,
885 .parts = onenand_partitions,
886 .nr_parts = ARRAY_SIZE(onenand_partitions),
887 .flags = ONENAND_SYNC_READWRITE,
888 }
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700889};
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700890#endif
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700891
Tony Lindgren1a48e152009-05-28 13:23:52 -0700892#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
893
894static struct omap_smc91x_platform_data board_smc91x_data = {
895 .cs = 1,
896 .gpio_irq = 54,
897 .gpio_pwrdwn = 86,
898 .gpio_reset = 164,
899 .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
900};
901
902static void __init board_smc91x_init(void)
903{
Tony Lindgren4896e392009-12-11 16:16:32 -0800904 omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
905 omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
906 omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
Tony Lindgren1a48e152009-05-28 13:23:52 -0700907
908 gpmc_smc91x_init(&board_smc91x_data);
909}
910
911#else
912
913static inline void board_smc91x_init(void)
914{
915}
916
917#endif
918
Kalle Valoa24e61a2009-11-18 18:41:06 -0800919static void rx51_wl1251_set_power(bool enable)
920{
921 gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
922}
923
924static void __init rx51_init_wl1251(void)
925{
926 int irq, ret;
927
928 ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
929 if (ret < 0)
930 goto error;
931
932 ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
933 if (ret < 0)
934 goto err_power;
935
936 ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
937 if (ret < 0)
938 goto err_power;
939
940 ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
941 if (ret < 0)
942 goto err_irq;
943
944 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
945 if (irq < 0)
946 goto err_irq;
947
948 wl1251_pdata.set_power = rx51_wl1251_set_power;
949 rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
950
951 return;
952
953err_irq:
954 gpio_free(RX51_WL1251_IRQ_GPIO);
955
956err_power:
957 gpio_free(RX51_WL1251_POWER_GPIO);
958
959error:
960 printk(KERN_ERR "wl1251 board initialisation failed\n");
961 wl1251_pdata.set_power = NULL;
962
963 /*
964 * Now rx51_peripherals_spi_board_info[1].irq is zero and
965 * set_power is null, and wl1251_probe() will fail.
966 */
967}
968
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700969void __init rx51_peripherals_init(void)
970{
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700971 rx51_i2c_init();
Aaro Koskinen54031872010-12-02 15:51:24 +0000972 gpmc_onenand_init(board_onenand_data);
Tony Lindgren1a48e152009-05-28 13:23:52 -0700973 board_smc91x_init();
Jani Nikulaf014ee32009-11-05 22:59:47 -0800974 rx51_add_gpio_keys();
Kalle Valoa24e61a2009-11-18 18:41:06 -0800975 rx51_init_wl1251();
Jarkko Nikula589541c2011-02-21 08:42:36 +0200976 rx51_init_si4713();
Kalle Valoa24e61a2009-11-18 18:41:06 -0800977 spi_register_board_info(rx51_peripherals_spi_board_info,
978 ARRAY_SIZE(rx51_peripherals_spi_board_info));
Benoit Cousson112485e2010-08-16 10:55:35 +0200979
980 partition = omap_mux_get("core");
981 if (partition)
982 omap2_hsmmc_init(mmc);
983
Heikki Krogerusfd0964c2010-08-19 15:09:37 +0300984 platform_device_register(&rx51_charger_device);
Lauri Leukkunenffe7f952009-03-23 18:38:17 -0700985}
986