isp1704_charger: Allow board specific powering routine
[deliverable/linux.git] / arch / arm / mach-omap2 / board-rx51-peripherals.c
CommitLineData
ffe7f95b 1/*
9312fffb 2 * linux/arch/arm/mach-omap2/board-rx51-peripherals.c
ffe7f95b
LL
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
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/input.h>
6135434a 15#include <linux/input/matrix_keypad.h>
ffe7f95b 16#include <linux/spi/spi.h>
c1f9a095 17#include <linux/wl12xx.h>
ffe7f95b 18#include <linux/i2c.h>
ebeb53e1 19#include <linux/i2c/twl.h>
ffe7f95b
LL
20#include <linux/clk.h>
21#include <linux/delay.h>
22#include <linux/regulator/machine.h>
23#include <linux/gpio.h>
f014ee32 24#include <linux/gpio_keys.h>
5e763d29 25#include <linux/mmc/host.h>
ffe7f95b 26
ce491cf8 27#include <plat/mcspi.h>
ce491cf8
TL
28#include <plat/board.h>
29#include <plat/common.h>
30#include <plat/dma.h>
31#include <plat/gpmc.h>
ce491cf8
TL
32#include <plat/onenand.h>
33#include <plat/gpmc-smc91x.h>
ffe7f95b 34
04aeae77
MK
35#include <mach/board-rx51.h>
36
87581fd4 37#include <sound/tlv320aic3x.h>
64d06691 38#include <sound/tpa6130a2-plat.h>
589541c0
JN
39#include <media/radio-si4713.h>
40#include <media/si4713.h>
87581fd4 41
70b5d737
MN
42#include <../drivers/staging/iio/light/tsl2563.h>
43
4896e394 44#include "mux.h"
d02a900b 45#include "hsmmc.h"
ffe7f95b 46
f52eeee8
AH
47#define SYSTEM_REV_B_USES_VAUX3 0x1699
48#define SYSTEM_REV_S_USES_VAUX3 0x8
49
a24e61a9
KV
50#define RX51_WL1251_POWER_GPIO 87
51#define RX51_WL1251_IRQ_GPIO 42
589541c0
JN
52#define RX51_FMTX_RESET_GPIO 163
53#define RX51_FMTX_IRQ 53
a24e61a9
KV
54
55/* list all spi devices here */
56enum {
57 RX51_SPI_WL1251,
03e11104 58 RX51_SPI_MIPID, /* LCD panel */
6996e7ff 59 RX51_SPI_TSC2005, /* Touch Controller */
a24e61a9
KV
60};
61
62static struct wl12xx_platform_data wl1251_pdata;
63
70b5d737
MN
64#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
a24e61a9
KV
70static struct omap2_mcspi_device_config wl1251_mcspi_config = {
71 .turbo_mode = 0,
72 .single_channel = 1,
73};
74
03e11104
RQ
75static struct omap2_mcspi_device_config mipid_mcspi_config = {
76 .turbo_mode = 0,
77 .single_channel = 1,
78};
79
6996e7ff
RQ
80static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
81 .turbo_mode = 0,
82 .single_channel = 1,
83};
84
a24e61a9
KV
85static 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,
860fc976 91 .mode = SPI_MODE_3,
a24e61a9
KV
92 .controller_data = &wl1251_mcspi_config,
93 .platform_data = &wl1251_pdata,
94 },
03e11104
RQ
95 [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 },
6996e7ff
RQ
102 [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 },
a24e61a9
KV
111};
112
fd0964c5
HK
113static struct platform_device rx51_charger_device = {
114 .name = "isp1704_charger",
115};
116
f014ee32
JN
117#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
bead4375 197static uint32_t board_keymap[] = {
3fea6026
DT
198 /*
199 * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
200 * connected to the ground" matrix state.
201 */
ffe7f95b 202 KEY(0, 0, KEY_Q),
acf442dc
AK
203 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),
3fea6026 209
acf442dc 210 KEY(1, 0, KEY_W),
ffe7f95b 211 KEY(1, 1, KEY_D),
acf442dc
AK
212 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),
3fea6026 218
acf442dc
AK
219 KEY(2, 0, KEY_E),
220 KEY(2, 1, KEY_DOT),
ffe7f95b 221 KEY(2, 2, KEY_UP),
acf442dc
AK
222 KEY(2, 3, KEY_ENTER),
223 KEY(2, 5, KEY_Z),
224 KEY(2, 6, KEY_X),
225 KEY(2, 7, KEY_C),
3fea6026
DT
226 KEY(2, 8, KEY_F9),
227
acf442dc
AK
228 KEY(3, 0, KEY_R),
229 KEY(3, 1, KEY_V),
230 KEY(3, 2, KEY_B),
ffe7f95b 231 KEY(3, 3, KEY_N),
acf442dc
AK
232 KEY(3, 4, KEY_M),
233 KEY(3, 5, KEY_SPACE),
234 KEY(3, 6, KEY_SPACE),
235 KEY(3, 7, KEY_LEFT),
3fea6026 236
acf442dc
AK
237 KEY(4, 0, KEY_T),
238 KEY(4, 1, KEY_DOWN),
239 KEY(4, 2, KEY_RIGHT),
ffe7f95b 240 KEY(4, 4, KEY_LEFTCTRL),
acf442dc
AK
241 KEY(4, 5, KEY_RIGHTALT),
242 KEY(4, 6, KEY_LEFTSHIFT),
2e65a207 243 KEY(4, 8, KEY_F10),
3fea6026 244
acf442dc 245 KEY(5, 0, KEY_Y),
2e65a207 246 KEY(5, 8, KEY_F11),
3fea6026 247
acf442dc 248 KEY(6, 0, KEY_U),
3fea6026 249
acf442dc
AK
250 KEY(7, 0, KEY_I),
251 KEY(7, 1, KEY_F7),
252 KEY(7, 2, KEY_F8),
ffe7f95b
LL
253};
254
4f543332
TL
255static struct matrix_keymap_data board_map_data = {
256 .keymap = board_keymap,
257 .keymap_size = ARRAY_SIZE(board_keymap),
258};
259
ffe7f95b 260static struct twl4030_keypad_data rx51_kp_data = {
4f543332 261 .keymap_data = &board_map_data,
ffe7f95b
LL
262 .rows = 8,
263 .cols = 8,
ffe7f95b
LL
264 .rep = 1,
265};
266
ffe7f95b
LL
267static struct twl4030_madc_platform_data rx51_madc_data = {
268 .irq_line = 1,
269};
270
ce6f0016
AH
271/* 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
112485e9
BC
299static struct omap_mux_partition *partition;
300
ce6f0016
AH
301/*
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)
112485e9 308 omap_mux_write_array(partition, rx51_mmc2_on_mux);
ce6f0016 309 else
112485e9 310 omap_mux_write_array(partition, rx51_mmc2_off_mux);
ce6f0016
AH
311}
312
68ff0423 313static struct omap2_hsmmc_info mmc[] __initdata = {
ffe7f95b
LL
314 {
315 .name = "external",
316 .mmc = 1,
3a63833e 317 .caps = MMC_CAP_4_BIT_DATA,
ffe7f95b
LL
318 .cover_only = true,
319 .gpio_cd = 160,
320 .gpio_wp = -EINVAL,
5e763d29 321 .power_saving = true,
ffe7f95b
LL
322 },
323 {
324 .name = "internal",
325 .mmc = 2,
3a63833e
SG
326 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
327 /* See also rx51_mmc2_remux */
ffe7f95b
LL
328 .gpio_cd = -EINVAL,
329 .gpio_wp = -EINVAL,
5e763d29
AH
330 .nonremovable = true,
331 .power_saving = true,
ce6f0016 332 .remux = rx51_mmc2_remux,
ffe7f95b
LL
333 },
334 {} /* Terminator */
335};
336
5c7d9bbe 337static struct regulator_consumer_supply rx51_vmmc1_supply =
0005ae73 338 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
ffe7f95b 339
5c7d9bbe 340static struct regulator_consumer_supply rx51_vaux3_supply =
0005ae73 341 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
ffe7f95b 342
5c7d9bbe 343static struct regulator_consumer_supply rx51_vsim_supply =
0005ae73 344 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
ffe7f95b 345
4cfcaef1
JN
346static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
347 /* tlv320aic3x analog supplies */
5c7d9bbe
JN
348 REGULATOR_SUPPLY("AVDD", "2-0018"),
349 REGULATOR_SUPPLY("DRVDD", "2-0018"),
caeeb4aa
JN
350 REGULATOR_SUPPLY("AVDD", "2-0019"),
351 REGULATOR_SUPPLY("DRVDD", "2-0019"),
64d06691
JN
352 /* tpa6130a2 */
353 REGULATOR_SUPPLY("Vdd", "2-0060"),
4cfcaef1 354 /* Keep vmmc as last item. It is not iterated for newer boards */
0005ae73 355 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
4cfcaef1
JN
356};
357
358static struct regulator_consumer_supply rx51_vio_supplies[] = {
359 /* tlv320aic3x digital supplies */
5c7d9bbe
JN
360 REGULATOR_SUPPLY("IOVDD", "2-0018"),
361 REGULATOR_SUPPLY("DVDD", "2-0018"),
caeeb4aa
JN
362 REGULATOR_SUPPLY("IOVDD", "2-0019"),
363 REGULATOR_SUPPLY("DVDD", "2-0019"),
589541c0
JN
364 /* Si4713 IO supply */
365 REGULATOR_SUPPLY("vio", "2-0063"),
4cfcaef1
JN
366};
367
0581b52e 368static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
b5b9945b 369 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
589541c0
JN
370 /* Si4713 supply */
371 REGULATOR_SUPPLY("vdd", "2-0063"),
0581b52e
RQ
372};
373
31bbb4f0 374static struct regulator_consumer_supply rx51_vdac_supply[] = {
30ea50c9 375 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
31bbb4f0
JN
376};
377
ffe7f95b
LL
378static struct regulator_init_data rx51_vaux1 = {
379 .constraints = {
380 .name = "V28",
381 .min_uV = 2800000,
382 .max_uV = 2800000,
000d534e 383 .always_on = true, /* due battery cover sensor */
ffe7f95b
LL
384 .valid_modes_mask = REGULATOR_MODE_NORMAL
385 | REGULATOR_MODE_STANDBY,
386 .valid_ops_mask = REGULATOR_CHANGE_MODE
387 | REGULATOR_CHANGE_STATUS,
388 },
0581b52e
RQ
389 .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
390 .consumer_supplies = rx51_vaux1_consumers,
ffe7f95b
LL
391};
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 */
f52eeee8 406static struct regulator_init_data rx51_vaux3_cam = {
ffe7f95b
LL
407 .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
f52eeee8
AH
419static 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,
4cfcaef1 432 .consumer_supplies = &rx51_vaux3_supply,
f52eeee8
AH
433};
434
ffe7f95b
LL
435static 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 = {
f2add1de
JN
464 .name = "V28_A",
465 .min_uV = 2800000,
466 .max_uV = 3000000,
ffe7f95b
LL
467 .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 },
4cfcaef1
JN
474 .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies),
475 .consumer_supplies = rx51_vmmc2_supplies,
ffe7f95b
LL
476};
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 = {
31bbb4f0 495 .name = "VDAC",
ffe7f95b
LL
496 .min_uV = 1800000,
497 .max_uV = 1800000,
31bbb4f0 498 .apply_uV = true,
ffe7f95b
LL
499 .valid_modes_mask = REGULATOR_MODE_NORMAL
500 | REGULATOR_MODE_STANDBY,
31bbb4f0 501 .valid_ops_mask = REGULATOR_CHANGE_MODE
ffe7f95b
LL
502 | REGULATOR_CHANGE_STATUS,
503 },
31bbb4f0
JN
504 .num_consumer_supplies = 1,
505 .consumer_supplies = rx51_vdac_supply,
ffe7f95b
LL
506};
507
4cfcaef1
JN
508static 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
589541c0
JN
522static 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
ffe7f95b
LL
557static 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
ffe7f95b
LL
565 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
dfc27b34
RQ
580static struct twl4030_usb_data rx51_usb_data = {
581 .usb_mode = T2_USB_MODE_ULPI,
582};
583
9312fffb
AK
584static struct twl4030_ins sleep_on_seq[] __initdata = {
585/*
3c684e84 586 * Turn off everything
9312fffb 587 */
3c684e84 588 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
9312fffb
AK
589};
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/*
3c684e84 599 * Reenable everything
9312fffb 600 */
3c684e84 601 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
9312fffb
AK
602};
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/*
3c684e84 612 * Reenable everything
9312fffb 613 */
3c684e84 614 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
9312fffb
AK
615};
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},
9312fffb
AK
635 {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},
3c684e84 639 {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
9312fffb
AK
640 {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 = {
3c684e84
AK
661 { .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 },
9312fffb
AK
736 { 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
b7a834cc
IK
745struct 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};
9312fffb 753
9312fffb 754static struct twl4030_platform_data rx51_twldata __initdata = {
ffe7f95b
LL
755 .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,
dfc27b34 762 .usb = &rx51_usb_data,
9312fffb 763 .power = &rx51_t2scripts_data,
b7a834cc 764 .codec = &rx51_codec_data,
ffe7f95b
LL
765
766 .vaux1 = &rx51_vaux1,
767 .vaux2 = &rx51_vaux2,
ffe7f95b
LL
768 .vaux4 = &rx51_vaux4,
769 .vmmc1 = &rx51_vmmc1,
ffe7f95b
LL
770 .vsim = &rx51_vsim,
771 .vdac = &rx51_vdac,
4cfcaef1 772 .vio = &rx51_vio,
ffe7f95b
LL
773};
774
f0c61d3d 775static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
64d06691
JN
776 .id = TPA6130A2,
777 .power_gpio = 98,
778};
779
ffe7f95b
LL
780static 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
f0fba2ad
LG
789/* 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
e4862f2f 795static struct aic3x_pdata rx51_aic3x_data = {
f0fba2ad
LG
796 .setup = &rx51_aic34_setup,
797 .gpio_reset = 60,
798};
799
caeeb4aa
JN
800static struct aic3x_pdata rx51_aic3x_data2 = {
801 .gpio_reset = 60,
802};
803
dabe929b
JN
804static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
805 {
806 I2C_BOARD_INFO("tlv320aic3x", 0x18),
87581fd4 807 .platform_data = &rx51_aic3x_data,
dabe929b 808 },
caeeb4aa
JN
809 {
810 I2C_BOARD_INFO("tlv320aic3x", 0x19),
811 .platform_data = &rx51_aic3x_data2,
812 },
70b5d737
MN
813#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
64d06691
JN
819 {
820 I2C_BOARD_INFO("tpa6130a2", 0x60),
821 .platform_data = &rx51_tpa6130a2_data,
822 }
dabe929b
JN
823};
824
ffe7f95b
LL
825static int __init rx51_i2c_init(void)
826{
f52eeee8 827 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
4cfcaef1 828 system_rev >= SYSTEM_REV_B_USES_VAUX3) {
f52eeee8 829 rx51_twldata.vaux3 = &rx51_vaux3_mmc;
4cfcaef1
JN
830 /* Only older boards use VMMC2 for internal MMC */
831 rx51_vmmc2.num_consumer_supplies--;
832 } else {
f52eeee8 833 rx51_twldata.vaux3 = &rx51_vaux3_cam;
f52eeee8 834 }
4cfcaef1 835 rx51_twldata.vmmc2 = &rx51_vmmc2;
cb3cc45a 836 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
dabe929b
JN
837 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));
ffe7f95b
LL
840 omap_register_i2c_bus(3, 400, NULL, 0);
841 return 0;
842}
843
aa62e90f
JY
844#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
5403187f
AK
881static 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 }
aa62e90f 889};
aa62e90f 890#endif
ffe7f95b 891
1a48e157
TL
892#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{
4896e394
TL
904 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);
1a48e157
TL
907
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
a24e61a9
KV
919static 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
ffe7f95b
LL
969void __init rx51_peripherals_init(void)
970{
ffe7f95b 971 rx51_i2c_init();
5403187f 972 gpmc_onenand_init(board_onenand_data);
1a48e157 973 board_smc91x_init();
f014ee32 974 rx51_add_gpio_keys();
a24e61a9 975 rx51_init_wl1251();
589541c0 976 rx51_init_si4713();
a24e61a9
KV
977 spi_register_board_info(rx51_peripherals_spi_board_info,
978 ARRAY_SIZE(rx51_peripherals_spi_board_info));
112485e9
BC
979
980 partition = omap_mux_get("core");
981 if (partition)
982 omap2_hsmmc_init(mmc);
983
fd0964c5 984 platform_device_register(&rx51_charger_device);
ffe7f95b
LL
985}
986
This page took 0.200467 seconds and 5 git commands to generate.