netlink: Implment netlink_broadcast_filtered
[linux/fpc-iii.git] / arch / arm / mach-omap2 / board-rx51-peripherals.c
blob4377a4cf36eb7356aa79018f1035b4c7d5dabebe
1 /*
2 * linux/arch/arm/mach-omap2/board-rx51-peripherals.c
4 * Copyright (C) 2008-2009 Nokia
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 */
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/input.h>
15 #include <linux/input/matrix_keypad.h>
16 #include <linux/spi/spi.h>
17 #include <linux/spi/wl12xx.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>
27 #include <plat/mcspi.h>
28 #include <plat/mux.h>
29 #include <plat/board.h>
30 #include <plat/common.h>
31 #include <plat/dma.h>
32 #include <plat/gpmc.h>
33 #include <plat/onenand.h>
34 #include <plat/gpmc-smc91x.h>
36 #include "mux.h"
37 #include "hsmmc.h"
39 #define SYSTEM_REV_B_USES_VAUX3 0x1699
40 #define SYSTEM_REV_S_USES_VAUX3 0x8
42 #define RX51_WL1251_POWER_GPIO 87
43 #define RX51_WL1251_IRQ_GPIO 42
45 /* list all spi devices here */
46 enum {
47 RX51_SPI_WL1251,
50 static struct wl12xx_platform_data wl1251_pdata;
52 static struct omap2_mcspi_device_config wl1251_mcspi_config = {
53 .turbo_mode = 0,
54 .single_channel = 1,
57 static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
58 [RX51_SPI_WL1251] = {
59 .modalias = "wl1251",
60 .bus_num = 4,
61 .chip_select = 0,
62 .max_speed_hz = 48000000,
63 .mode = SPI_MODE_3,
64 .controller_data = &wl1251_mcspi_config,
65 .platform_data = &wl1251_pdata,
69 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
71 #define RX51_GPIO_CAMERA_LENS_COVER 110
72 #define RX51_GPIO_CAMERA_FOCUS 68
73 #define RX51_GPIO_CAMERA_CAPTURE 69
74 #define RX51_GPIO_KEYPAD_SLIDE 71
75 #define RX51_GPIO_LOCK_BUTTON 113
76 #define RX51_GPIO_PROXIMITY 89
78 #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
80 static struct gpio_keys_button rx51_gpio_keys[] = {
82 .desc = "Camera Lens Cover",
83 .type = EV_SW,
84 .code = SW_CAMERA_LENS_COVER,
85 .gpio = RX51_GPIO_CAMERA_LENS_COVER,
86 .active_low = 1,
87 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
88 }, {
89 .desc = "Camera Focus",
90 .type = EV_KEY,
91 .code = KEY_CAMERA_FOCUS,
92 .gpio = RX51_GPIO_CAMERA_FOCUS,
93 .active_low = 1,
94 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
95 }, {
96 .desc = "Camera Capture",
97 .type = EV_KEY,
98 .code = KEY_CAMERA,
99 .gpio = RX51_GPIO_CAMERA_CAPTURE,
100 .active_low = 1,
101 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
102 }, {
103 .desc = "Lock Button",
104 .type = EV_KEY,
105 .code = KEY_SCREENLOCK,
106 .gpio = RX51_GPIO_LOCK_BUTTON,
107 .active_low = 1,
108 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
109 }, {
110 .desc = "Keypad Slide",
111 .type = EV_SW,
112 .code = SW_KEYPAD_SLIDE,
113 .gpio = RX51_GPIO_KEYPAD_SLIDE,
114 .active_low = 1,
115 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
116 }, {
117 .desc = "Proximity Sensor",
118 .type = EV_SW,
119 .code = SW_FRONT_PROXIMITY,
120 .gpio = RX51_GPIO_PROXIMITY,
121 .active_low = 0,
122 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
126 static struct gpio_keys_platform_data rx51_gpio_keys_data = {
127 .buttons = rx51_gpio_keys,
128 .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
131 static struct platform_device rx51_gpio_keys_device = {
132 .name = "gpio-keys",
133 .id = -1,
134 .dev = {
135 .platform_data = &rx51_gpio_keys_data,
139 static void __init rx51_add_gpio_keys(void)
141 platform_device_register(&rx51_gpio_keys_device);
143 #else
144 static void __init rx51_add_gpio_keys(void)
147 #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
149 static int board_keymap[] = {
150 KEY(0, 0, KEY_Q),
151 KEY(0, 1, KEY_O),
152 KEY(0, 2, KEY_P),
153 KEY(0, 3, KEY_COMMA),
154 KEY(0, 4, KEY_BACKSPACE),
155 KEY(0, 6, KEY_A),
156 KEY(0, 7, KEY_S),
157 KEY(1, 0, KEY_W),
158 KEY(1, 1, KEY_D),
159 KEY(1, 2, KEY_F),
160 KEY(1, 3, KEY_G),
161 KEY(1, 4, KEY_H),
162 KEY(1, 5, KEY_J),
163 KEY(1, 6, KEY_K),
164 KEY(1, 7, KEY_L),
165 KEY(2, 0, KEY_E),
166 KEY(2, 1, KEY_DOT),
167 KEY(2, 2, KEY_UP),
168 KEY(2, 3, KEY_ENTER),
169 KEY(2, 5, KEY_Z),
170 KEY(2, 6, KEY_X),
171 KEY(2, 7, KEY_C),
172 KEY(3, 0, KEY_R),
173 KEY(3, 1, KEY_V),
174 KEY(3, 2, KEY_B),
175 KEY(3, 3, KEY_N),
176 KEY(3, 4, KEY_M),
177 KEY(3, 5, KEY_SPACE),
178 KEY(3, 6, KEY_SPACE),
179 KEY(3, 7, KEY_LEFT),
180 KEY(4, 0, KEY_T),
181 KEY(4, 1, KEY_DOWN),
182 KEY(4, 2, KEY_RIGHT),
183 KEY(4, 4, KEY_LEFTCTRL),
184 KEY(4, 5, KEY_RIGHTALT),
185 KEY(4, 6, KEY_LEFTSHIFT),
186 KEY(5, 0, KEY_Y),
187 KEY(6, 0, KEY_U),
188 KEY(7, 0, KEY_I),
189 KEY(7, 1, KEY_F7),
190 KEY(7, 2, KEY_F8),
191 KEY(0xff, 2, KEY_F9),
192 KEY(0xff, 4, KEY_F10),
193 KEY(0xff, 5, KEY_F11),
196 static struct matrix_keymap_data board_map_data = {
197 .keymap = board_keymap,
198 .keymap_size = ARRAY_SIZE(board_keymap),
201 static struct twl4030_keypad_data rx51_kp_data = {
202 .keymap_data = &board_map_data,
203 .rows = 8,
204 .cols = 8,
205 .rep = 1,
208 static struct twl4030_madc_platform_data rx51_madc_data = {
209 .irq_line = 1,
212 /* Enable input logic and pull all lines up when eMMC is on. */
213 static struct omap_board_mux rx51_mmc2_on_mux[] = {
214 OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
215 OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
216 OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
217 OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
218 OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
219 OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
220 OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
221 OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
222 OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
223 { .reg_offset = OMAP_MUX_TERMINATOR },
226 /* Disable input logic and pull all lines down when eMMC is off. */
227 static struct omap_board_mux rx51_mmc2_off_mux[] = {
228 OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
229 OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
230 OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
231 OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
232 OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
233 OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
234 OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
235 OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
236 OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
237 { .reg_offset = OMAP_MUX_TERMINATOR },
241 * Current flows to eMMC when eMMC is off and the data lines are pulled up,
242 * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
244 static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
246 if (power_on)
247 omap_mux_write_array(rx51_mmc2_on_mux);
248 else
249 omap_mux_write_array(rx51_mmc2_off_mux);
252 static struct omap2_hsmmc_info mmc[] __initdata = {
254 .name = "external",
255 .mmc = 1,
256 .wires = 4,
257 .cover_only = true,
258 .gpio_cd = 160,
259 .gpio_wp = -EINVAL,
260 .power_saving = true,
263 .name = "internal",
264 .mmc = 2,
265 .wires = 8, /* See also rx51_mmc2_remux */
266 .gpio_cd = -EINVAL,
267 .gpio_wp = -EINVAL,
268 .nonremovable = true,
269 .power_saving = true,
270 .remux = rx51_mmc2_remux,
272 {} /* Terminator */
275 static struct regulator_consumer_supply rx51_vmmc1_supply = {
276 .supply = "vmmc",
277 .dev_name = "mmci-omap-hs.0",
280 static struct regulator_consumer_supply rx51_vmmc2_supply = {
281 .supply = "vmmc",
282 .dev_name = "mmci-omap-hs.1",
285 static struct regulator_consumer_supply rx51_vsim_supply = {
286 .supply = "vmmc_aux",
287 .dev_name = "mmci-omap-hs.1",
290 static struct regulator_init_data rx51_vaux1 = {
291 .constraints = {
292 .name = "V28",
293 .min_uV = 2800000,
294 .max_uV = 2800000,
295 .valid_modes_mask = REGULATOR_MODE_NORMAL
296 | REGULATOR_MODE_STANDBY,
297 .valid_ops_mask = REGULATOR_CHANGE_MODE
298 | REGULATOR_CHANGE_STATUS,
302 static struct regulator_init_data rx51_vaux2 = {
303 .constraints = {
304 .name = "VCSI",
305 .min_uV = 1800000,
306 .max_uV = 1800000,
307 .valid_modes_mask = REGULATOR_MODE_NORMAL
308 | REGULATOR_MODE_STANDBY,
309 .valid_ops_mask = REGULATOR_CHANGE_MODE
310 | REGULATOR_CHANGE_STATUS,
314 /* VAUX3 - adds more power to VIO_18 rail */
315 static struct regulator_init_data rx51_vaux3_cam = {
316 .constraints = {
317 .name = "VCAM_DIG_18",
318 .min_uV = 1800000,
319 .max_uV = 1800000,
320 .apply_uV = true,
321 .valid_modes_mask = REGULATOR_MODE_NORMAL
322 | REGULATOR_MODE_STANDBY,
323 .valid_ops_mask = REGULATOR_CHANGE_MODE
324 | REGULATOR_CHANGE_STATUS,
328 static struct regulator_init_data rx51_vaux3_mmc = {
329 .constraints = {
330 .name = "VMMC2_30",
331 .min_uV = 2800000,
332 .max_uV = 3000000,
333 .apply_uV = true,
334 .valid_modes_mask = REGULATOR_MODE_NORMAL
335 | REGULATOR_MODE_STANDBY,
336 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
337 | REGULATOR_CHANGE_MODE
338 | REGULATOR_CHANGE_STATUS,
340 .num_consumer_supplies = 1,
341 .consumer_supplies = &rx51_vmmc2_supply,
344 static struct regulator_init_data rx51_vaux4 = {
345 .constraints = {
346 .name = "VCAM_ANA_28",
347 .min_uV = 2800000,
348 .max_uV = 2800000,
349 .apply_uV = true,
350 .valid_modes_mask = REGULATOR_MODE_NORMAL
351 | REGULATOR_MODE_STANDBY,
352 .valid_ops_mask = REGULATOR_CHANGE_MODE
353 | REGULATOR_CHANGE_STATUS,
357 static struct regulator_init_data rx51_vmmc1 = {
358 .constraints = {
359 .min_uV = 1850000,
360 .max_uV = 3150000,
361 .valid_modes_mask = REGULATOR_MODE_NORMAL
362 | REGULATOR_MODE_STANDBY,
363 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
364 | REGULATOR_CHANGE_MODE
365 | REGULATOR_CHANGE_STATUS,
367 .num_consumer_supplies = 1,
368 .consumer_supplies = &rx51_vmmc1_supply,
371 static struct regulator_init_data rx51_vmmc2 = {
372 .constraints = {
373 .name = "VMMC2_30",
374 .min_uV = 1850000,
375 .max_uV = 3150000,
376 .apply_uV = true,
377 .valid_modes_mask = REGULATOR_MODE_NORMAL
378 | REGULATOR_MODE_STANDBY,
379 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
380 | REGULATOR_CHANGE_MODE
381 | REGULATOR_CHANGE_STATUS,
383 .num_consumer_supplies = 1,
384 .consumer_supplies = &rx51_vmmc2_supply,
387 static struct regulator_init_data rx51_vsim = {
388 .constraints = {
389 .name = "VMMC2_IO_18",
390 .min_uV = 1800000,
391 .max_uV = 1800000,
392 .apply_uV = true,
393 .valid_modes_mask = REGULATOR_MODE_NORMAL
394 | REGULATOR_MODE_STANDBY,
395 .valid_ops_mask = REGULATOR_CHANGE_MODE
396 | REGULATOR_CHANGE_STATUS,
398 .num_consumer_supplies = 1,
399 .consumer_supplies = &rx51_vsim_supply,
402 static struct regulator_init_data rx51_vdac = {
403 .constraints = {
404 .min_uV = 1800000,
405 .max_uV = 1800000,
406 .valid_modes_mask = REGULATOR_MODE_NORMAL
407 | REGULATOR_MODE_STANDBY,
408 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
409 | REGULATOR_CHANGE_MODE
410 | REGULATOR_CHANGE_STATUS,
414 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
416 /* FIXME this gpio setup is just a placeholder for now */
417 gpio_request(gpio + 6, "backlight_pwm");
418 gpio_direction_output(gpio + 6, 0);
419 gpio_request(gpio + 7, "speaker_en");
420 gpio_direction_output(gpio + 7, 1);
422 return 0;
425 static struct twl4030_gpio_platform_data rx51_gpio_data = {
426 .gpio_base = OMAP_MAX_GPIO_LINES,
427 .irq_base = TWL4030_GPIO_IRQ_BASE,
428 .irq_end = TWL4030_GPIO_IRQ_END,
429 .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3)
430 | BIT(4) | BIT(5)
431 | BIT(8) | BIT(9) | BIT(10) | BIT(11)
432 | BIT(12) | BIT(13) | BIT(14) | BIT(15)
433 | BIT(16) | BIT(17) ,
434 .setup = rx51_twlgpio_setup,
437 static struct twl4030_usb_data rx51_usb_data = {
438 .usb_mode = T2_USB_MODE_ULPI,
441 static struct twl4030_ins sleep_on_seq[] __initdata = {
443 * Turn off everything
445 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
448 static struct twl4030_script sleep_on_script __initdata = {
449 .script = sleep_on_seq,
450 .size = ARRAY_SIZE(sleep_on_seq),
451 .flags = TWL4030_SLEEP_SCRIPT,
454 static struct twl4030_ins wakeup_seq[] __initdata = {
456 * Reenable everything
458 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
461 static struct twl4030_script wakeup_script __initdata = {
462 .script = wakeup_seq,
463 .size = ARRAY_SIZE(wakeup_seq),
464 .flags = TWL4030_WAKEUP12_SCRIPT,
467 static struct twl4030_ins wakeup_p3_seq[] __initdata = {
469 * Reenable everything
471 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
474 static struct twl4030_script wakeup_p3_script __initdata = {
475 .script = wakeup_p3_seq,
476 .size = ARRAY_SIZE(wakeup_p3_seq),
477 .flags = TWL4030_WAKEUP3_SCRIPT,
480 static struct twl4030_ins wrst_seq[] __initdata = {
482 * Reset twl4030.
483 * Reset VDD1 regulator.
484 * Reset VDD2 regulator.
485 * Reset VPLL1 regulator.
486 * Enable sysclk output.
487 * Reenable twl4030.
489 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
490 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
491 0x13},
492 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
493 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
494 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
495 {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
496 {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
497 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
500 static struct twl4030_script wrst_script __initdata = {
501 .script = wrst_seq,
502 .size = ARRAY_SIZE(wrst_seq),
503 .flags = TWL4030_WRST_SCRIPT,
506 static struct twl4030_script *twl4030_scripts[] __initdata = {
507 /* wakeup12 script should be loaded before sleep script, otherwise a
508 board might hit retention before loading of wakeup script is
509 completed. This can cause boot failures depending on timing issues.
511 &wakeup_script,
512 &sleep_on_script,
513 &wakeup_p3_script,
514 &wrst_script,
517 static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
518 { .resource = RES_VDD1, .devgroup = -1,
519 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
520 .remap_sleep = RES_STATE_OFF
522 { .resource = RES_VDD2, .devgroup = -1,
523 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
524 .remap_sleep = RES_STATE_OFF
526 { .resource = RES_VPLL1, .devgroup = -1,
527 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
528 .remap_sleep = RES_STATE_OFF
530 { .resource = RES_VPLL2, .devgroup = -1,
531 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
533 { .resource = RES_VAUX1, .devgroup = -1,
534 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
536 { .resource = RES_VAUX2, .devgroup = -1,
537 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
539 { .resource = RES_VAUX3, .devgroup = -1,
540 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
542 { .resource = RES_VAUX4, .devgroup = -1,
543 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
545 { .resource = RES_VMMC1, .devgroup = -1,
546 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
548 { .resource = RES_VMMC2, .devgroup = -1,
549 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
551 { .resource = RES_VDAC, .devgroup = -1,
552 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
554 { .resource = RES_VSIM, .devgroup = -1,
555 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
557 { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
558 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
560 { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
561 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
563 { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
564 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
566 { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
567 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
569 { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
570 .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
572 { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
573 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
575 { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
576 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
578 { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
579 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
581 { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
582 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
584 { .resource = RES_32KCLKOUT, .devgroup = -1,
585 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
587 { .resource = RES_RESET, .devgroup = -1,
588 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
590 { .resource = RES_Main_Ref, .devgroup = -1,
591 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
593 { 0, 0},
596 static struct twl4030_power_data rx51_t2scripts_data __initdata = {
597 .scripts = twl4030_scripts,
598 .num = ARRAY_SIZE(twl4030_scripts),
599 .resource_config = twl4030_rconfig,
604 static struct twl4030_platform_data rx51_twldata __initdata = {
605 .irq_base = TWL4030_IRQ_BASE,
606 .irq_end = TWL4030_IRQ_END,
608 /* platform_data for children goes here */
609 .gpio = &rx51_gpio_data,
610 .keypad = &rx51_kp_data,
611 .madc = &rx51_madc_data,
612 .usb = &rx51_usb_data,
613 .power = &rx51_t2scripts_data,
615 .vaux1 = &rx51_vaux1,
616 .vaux2 = &rx51_vaux2,
617 .vaux4 = &rx51_vaux4,
618 .vmmc1 = &rx51_vmmc1,
619 .vsim = &rx51_vsim,
620 .vdac = &rx51_vdac,
623 static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
625 I2C_BOARD_INFO("twl5030", 0x48),
626 .flags = I2C_CLIENT_WAKE,
627 .irq = INT_34XX_SYS_NIRQ,
628 .platform_data = &rx51_twldata,
632 static int __init rx51_i2c_init(void)
634 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
635 system_rev >= SYSTEM_REV_B_USES_VAUX3)
636 rx51_twldata.vaux3 = &rx51_vaux3_mmc;
637 else {
638 rx51_twldata.vaux3 = &rx51_vaux3_cam;
639 rx51_twldata.vmmc2 = &rx51_vmmc2;
641 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
642 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
643 omap_register_i2c_bus(2, 100, NULL, 0);
644 omap_register_i2c_bus(3, 400, NULL, 0);
645 return 0;
648 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
649 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
651 static struct mtd_partition onenand_partitions[] = {
653 .name = "bootloader",
654 .offset = 0,
655 .size = 0x20000,
656 .mask_flags = MTD_WRITEABLE, /* Force read-only */
659 .name = "config",
660 .offset = MTDPART_OFS_APPEND,
661 .size = 0x60000,
664 .name = "log",
665 .offset = MTDPART_OFS_APPEND,
666 .size = 0x40000,
669 .name = "kernel",
670 .offset = MTDPART_OFS_APPEND,
671 .size = 0x200000,
674 .name = "initfs",
675 .offset = MTDPART_OFS_APPEND,
676 .size = 0x200000,
679 .name = "rootfs",
680 .offset = MTDPART_OFS_APPEND,
681 .size = MTDPART_SIZ_FULL,
685 static struct omap_onenand_platform_data board_onenand_data = {
686 .cs = 0,
687 .gpio_irq = 65,
688 .parts = onenand_partitions,
689 .nr_parts = ARRAY_SIZE(onenand_partitions),
690 .flags = ONENAND_SYNC_READWRITE,
693 static void __init board_onenand_init(void)
695 gpmc_onenand_init(&board_onenand_data);
698 #else
700 static inline void board_onenand_init(void)
704 #endif
706 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
708 static struct omap_smc91x_platform_data board_smc91x_data = {
709 .cs = 1,
710 .gpio_irq = 54,
711 .gpio_pwrdwn = 86,
712 .gpio_reset = 164,
713 .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
716 static void __init board_smc91x_init(void)
718 omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
719 omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
720 omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
722 gpmc_smc91x_init(&board_smc91x_data);
725 #else
727 static inline void board_smc91x_init(void)
731 #endif
733 static void rx51_wl1251_set_power(bool enable)
735 gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
738 static void __init rx51_init_wl1251(void)
740 int irq, ret;
742 ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
743 if (ret < 0)
744 goto error;
746 ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
747 if (ret < 0)
748 goto err_power;
750 ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
751 if (ret < 0)
752 goto err_power;
754 ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
755 if (ret < 0)
756 goto err_irq;
758 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
759 if (irq < 0)
760 goto err_irq;
762 wl1251_pdata.set_power = rx51_wl1251_set_power;
763 rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
765 return;
767 err_irq:
768 gpio_free(RX51_WL1251_IRQ_GPIO);
770 err_power:
771 gpio_free(RX51_WL1251_POWER_GPIO);
773 error:
774 printk(KERN_ERR "wl1251 board initialisation failed\n");
775 wl1251_pdata.set_power = NULL;
778 * Now rx51_peripherals_spi_board_info[1].irq is zero and
779 * set_power is null, and wl1251_probe() will fail.
783 void __init rx51_peripherals_init(void)
785 rx51_i2c_init();
786 board_onenand_init();
787 board_smc91x_init();
788 rx51_add_gpio_keys();
789 rx51_init_wl1251();
790 spi_register_board_info(rx51_peripherals_spi_board_info,
791 ARRAY_SIZE(rx51_peripherals_spi_board_info));
792 omap2_hsmmc_init(mmc);