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.
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/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/board.h>
29 #include <plat/common.h>
31 #include <plat/gpmc.h>
32 #include <plat/onenand.h>
33 #include <plat/gpmc-smc91x.h>
35 #include <mach/board-rx51.h>
37 #include <sound/tlv320aic3x.h>
38 #include <sound/tpa6130a2-plat.h>
39 #include <media/radio-si4713.h>
40 #include <media/si4713.h>
42 #include <../drivers/staging/iio/light/tsl2563.h>
47 #define SYSTEM_REV_B_USES_VAUX3 0x1699
48 #define SYSTEM_REV_S_USES_VAUX3 0x8
50 #define RX51_WL1251_POWER_GPIO 87
51 #define RX51_WL1251_IRQ_GPIO 42
52 #define RX51_FMTX_RESET_GPIO 163
53 #define RX51_FMTX_IRQ 53
55 /* list all spi devices here */
58 RX51_SPI_MIPID, /* LCD panel */
59 RX51_SPI_TSC2005, /* Touch Controller */
62 static struct wl12xx_platform_data wl1251_pdata;
64 #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
65 static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
66 .cover_comp_gain = 16,
70 static struct omap2_mcspi_device_config wl1251_mcspi_config = {
75 static struct omap2_mcspi_device_config mipid_mcspi_config = {
80 static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
85 static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
90 .max_speed_hz = 48000000,
92 .controller_data = &wl1251_mcspi_config,
93 .platform_data = &wl1251_pdata,
96 .modalias = "acx565akm",
99 .max_speed_hz = 6000000,
100 .controller_data = &mipid_mcspi_config,
102 [RX51_SPI_TSC2005] = {
103 .modalias = "tsc2005",
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,*/
113 static struct platform_device rx51_charger_device = {
114 .name = "isp1704_charger",
117 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
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
126 #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
128 static struct gpio_keys_button rx51_gpio_keys[] = {
130 .desc = "Camera Lens Cover",
132 .code = SW_CAMERA_LENS_COVER,
133 .gpio = RX51_GPIO_CAMERA_LENS_COVER,
135 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
137 .desc = "Camera Focus",
139 .code = KEY_CAMERA_FOCUS,
140 .gpio = RX51_GPIO_CAMERA_FOCUS,
142 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
144 .desc = "Camera Capture",
147 .gpio = RX51_GPIO_CAMERA_CAPTURE,
149 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
151 .desc = "Lock Button",
153 .code = KEY_SCREENLOCK,
154 .gpio = RX51_GPIO_LOCK_BUTTON,
156 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
158 .desc = "Keypad Slide",
160 .code = SW_KEYPAD_SLIDE,
161 .gpio = RX51_GPIO_KEYPAD_SLIDE,
163 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
165 .desc = "Proximity Sensor",
167 .code = SW_FRONT_PROXIMITY,
168 .gpio = RX51_GPIO_PROXIMITY,
170 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
174 static struct gpio_keys_platform_data rx51_gpio_keys_data = {
175 .buttons = rx51_gpio_keys,
176 .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
179 static struct platform_device rx51_gpio_keys_device = {
183 .platform_data = &rx51_gpio_keys_data,
187 static void __init rx51_add_gpio_keys(void)
189 platform_device_register(&rx51_gpio_keys_device);
192 static void __init rx51_add_gpio_keys(void)
195 #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
197 static uint32_t board_keymap[] = {
199 * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
200 * connected to the ground" matrix state.
205 KEY(0, 3, KEY_COMMA),
206 KEY(0, 4, KEY_BACKSPACE),
222 KEY(2, 3, KEY_ENTER),
233 KEY(3, 5, KEY_SPACE),
234 KEY(3, 6, KEY_SPACE),
239 KEY(4, 2, KEY_RIGHT),
240 KEY(4, 4, KEY_LEFTCTRL),
241 KEY(4, 5, KEY_RIGHTALT),
242 KEY(4, 6, KEY_LEFTSHIFT),
255 static struct matrix_keymap_data board_map_data = {
256 .keymap = board_keymap,
257 .keymap_size = ARRAY_SIZE(board_keymap),
260 static struct twl4030_keypad_data rx51_kp_data = {
261 .keymap_data = &board_map_data,
267 static struct twl4030_madc_platform_data rx51_madc_data = {
271 /* Enable input logic and pull all lines up when eMMC is on. */
272 static 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 },
285 /* Disable input logic and pull all lines down when eMMC is off. */
286 static 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 },
299 static struct omap_mux_partition *partition;
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.
305 static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
308 omap_mux_write_array(partition, rx51_mmc2_on_mux);
310 omap_mux_write_array(partition, rx51_mmc2_off_mux);
313 static struct omap2_hsmmc_info mmc[] __initdata = {
317 .caps = MMC_CAP_4_BIT_DATA,
321 .power_saving = true,
326 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
327 /* See also rx51_mmc2_remux */
330 .nonremovable = true,
331 .power_saving = true,
332 .remux = rx51_mmc2_remux,
337 static struct regulator_consumer_supply rx51_vmmc1_supply =
338 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
340 static struct regulator_consumer_supply rx51_vaux3_supply =
341 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
343 static struct regulator_consumer_supply rx51_vsim_supply =
344 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
346 static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
347 /* tlv320aic3x analog supplies */
348 REGULATOR_SUPPLY("AVDD", "2-0018"),
349 REGULATOR_SUPPLY("DRVDD", "2-0018"),
350 REGULATOR_SUPPLY("AVDD", "2-0019"),
351 REGULATOR_SUPPLY("DRVDD", "2-0019"),
353 REGULATOR_SUPPLY("Vdd", "2-0060"),
354 /* Keep vmmc as last item. It is not iterated for newer boards */
355 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
358 static struct regulator_consumer_supply rx51_vio_supplies[] = {
359 /* tlv320aic3x digital supplies */
360 REGULATOR_SUPPLY("IOVDD", "2-0018"),
361 REGULATOR_SUPPLY("DVDD", "2-0018"),
362 REGULATOR_SUPPLY("IOVDD", "2-0019"),
363 REGULATOR_SUPPLY("DVDD", "2-0019"),
364 /* Si4713 IO supply */
365 REGULATOR_SUPPLY("vio", "2-0063"),
368 static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
369 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
371 REGULATOR_SUPPLY("vdd", "2-0063"),
374 static struct regulator_consumer_supply rx51_vdac_supply[] = {
375 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
378 static struct regulator_init_data rx51_vaux1 = {
383 .always_on = true, /* due battery cover sensor */
384 .valid_modes_mask = REGULATOR_MODE_NORMAL
385 | REGULATOR_MODE_STANDBY,
386 .valid_ops_mask = REGULATOR_CHANGE_MODE
387 | REGULATOR_CHANGE_STATUS,
389 .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers),
390 .consumer_supplies = rx51_vaux1_consumers,
393 static struct regulator_init_data rx51_vaux2 = {
398 .valid_modes_mask = REGULATOR_MODE_NORMAL
399 | REGULATOR_MODE_STANDBY,
400 .valid_ops_mask = REGULATOR_CHANGE_MODE
401 | REGULATOR_CHANGE_STATUS,
405 /* VAUX3 - adds more power to VIO_18 rail */
406 static struct regulator_init_data rx51_vaux3_cam = {
408 .name = "VCAM_DIG_18",
412 .valid_modes_mask = REGULATOR_MODE_NORMAL
413 | REGULATOR_MODE_STANDBY,
414 .valid_ops_mask = REGULATOR_CHANGE_MODE
415 | REGULATOR_CHANGE_STATUS,
419 static struct regulator_init_data rx51_vaux3_mmc = {
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,
431 .num_consumer_supplies = 1,
432 .consumer_supplies = &rx51_vaux3_supply,
435 static struct regulator_init_data rx51_vaux4 = {
437 .name = "VCAM_ANA_28",
441 .valid_modes_mask = REGULATOR_MODE_NORMAL
442 | REGULATOR_MODE_STANDBY,
443 .valid_ops_mask = REGULATOR_CHANGE_MODE
444 | REGULATOR_CHANGE_STATUS,
448 static struct regulator_init_data rx51_vmmc1 = {
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,
458 .num_consumer_supplies = 1,
459 .consumer_supplies = &rx51_vmmc1_supply,
462 static struct regulator_init_data rx51_vmmc2 = {
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,
474 .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies),
475 .consumer_supplies = rx51_vmmc2_supplies,
478 static struct regulator_init_data rx51_vsim = {
480 .name = "VMMC2_IO_18",
484 .valid_modes_mask = REGULATOR_MODE_NORMAL
485 | REGULATOR_MODE_STANDBY,
486 .valid_ops_mask = REGULATOR_CHANGE_MODE
487 | REGULATOR_CHANGE_STATUS,
489 .num_consumer_supplies = 1,
490 .consumer_supplies = &rx51_vsim_supply,
493 static struct regulator_init_data rx51_vdac = {
499 .valid_modes_mask = REGULATOR_MODE_NORMAL
500 | REGULATOR_MODE_STANDBY,
501 .valid_ops_mask = REGULATOR_CHANGE_MODE
502 | REGULATOR_CHANGE_STATUS,
504 .num_consumer_supplies = 1,
505 .consumer_supplies = rx51_vdac_supply,
508 static struct regulator_init_data rx51_vio = {
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,
518 .num_consumer_supplies = ARRAY_SIZE(rx51_vio_supplies),
519 .consumer_supplies = rx51_vio_supplies,
522 static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
523 .gpio_reset = RX51_FMTX_RESET_GPIO,
526 static 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,
531 static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
533 .subdev_board_info = &rx51_si4713_board_info,
536 static struct platform_device rx51_si4713_dev __initdata_or_module = {
537 .name = "radio-si4713",
540 .platform_data = &rx51_si4713_data,
544 static __init void rx51_init_si4713(void)
548 err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
550 printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
553 rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
554 platform_device_register(&rx51_si4713_dev);
557 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
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);
568 static 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)
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,
580 static struct twl4030_usb_data rx51_usb_data = {
581 .usb_mode = T2_USB_MODE_ULPI,
584 static struct twl4030_ins sleep_on_seq[] __initdata = {
586 * Turn off everything
588 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
591 static struct twl4030_script sleep_on_script __initdata = {
592 .script = sleep_on_seq,
593 .size = ARRAY_SIZE(sleep_on_seq),
594 .flags = TWL4030_SLEEP_SCRIPT,
597 static struct twl4030_ins wakeup_seq[] __initdata = {
599 * Reenable everything
601 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
604 static struct twl4030_script wakeup_script __initdata = {
605 .script = wakeup_seq,
606 .size = ARRAY_SIZE(wakeup_seq),
607 .flags = TWL4030_WAKEUP12_SCRIPT,
610 static struct twl4030_ins wakeup_p3_seq[] __initdata = {
612 * Reenable everything
614 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
617 static struct twl4030_script wakeup_p3_script __initdata = {
618 .script = wakeup_p3_seq,
619 .size = ARRAY_SIZE(wakeup_p3_seq),
620 .flags = TWL4030_WAKEUP3_SCRIPT,
623 static struct twl4030_ins wrst_seq[] __initdata = {
626 * Reset VDD1 regulator.
627 * Reset VDD2 regulator.
628 * Reset VPLL1 regulator.
629 * Enable sysclk output.
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),
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},
639 {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
640 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
643 static struct twl4030_script wrst_script __initdata = {
645 .size = ARRAY_SIZE(wrst_seq),
646 .flags = TWL4030_WRST_SCRIPT,
649 static 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.
660 static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
661 { .resource = RES_VDD1, .devgroup = -1,
662 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
663 .remap_sleep = RES_STATE_OFF
665 { .resource = RES_VDD2, .devgroup = -1,
666 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
667 .remap_sleep = RES_STATE_OFF
669 { .resource = RES_VPLL1, .devgroup = -1,
670 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
671 .remap_sleep = RES_STATE_OFF
673 { .resource = RES_VPLL2, .devgroup = -1,
674 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
676 { .resource = RES_VAUX1, .devgroup = -1,
677 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
679 { .resource = RES_VAUX2, .devgroup = -1,
680 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
682 { .resource = RES_VAUX3, .devgroup = -1,
683 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
685 { .resource = RES_VAUX4, .devgroup = -1,
686 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
688 { .resource = RES_VMMC1, .devgroup = -1,
689 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
691 { .resource = RES_VMMC2, .devgroup = -1,
692 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
694 { .resource = RES_VDAC, .devgroup = -1,
695 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
697 { .resource = RES_VSIM, .devgroup = -1,
698 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
700 { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
701 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
703 { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
704 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
706 { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
707 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
709 { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
710 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
712 { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
713 .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
715 { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
716 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
718 { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
719 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
721 { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
722 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
724 { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
725 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
727 { .resource = RES_32KCLKOUT, .devgroup = -1,
728 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
730 { .resource = RES_RESET, .devgroup = -1,
731 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
733 { .resource = RES_MAIN_REF, .devgroup = -1,
734 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
739 static struct twl4030_power_data rx51_t2scripts_data __initdata = {
740 .scripts = twl4030_scripts,
741 .num = ARRAY_SIZE(twl4030_scripts),
742 .resource_config = twl4030_rconfig,
745 struct twl4030_codec_vibra_data rx51_vibra_data __initdata = {
749 struct twl4030_codec_data rx51_codec_data __initdata = {
750 .audio_mclk = 26000000,
751 .vibra = &rx51_vibra_data,
754 static struct twl4030_platform_data rx51_twldata __initdata = {
755 .irq_base = TWL4030_IRQ_BASE,
756 .irq_end = TWL4030_IRQ_END,
758 /* platform_data for children goes here */
759 .gpio = &rx51_gpio_data,
760 .keypad = &rx51_kp_data,
761 .madc = &rx51_madc_data,
762 .usb = &rx51_usb_data,
763 .power = &rx51_t2scripts_data,
764 .codec = &rx51_codec_data,
766 .vaux1 = &rx51_vaux1,
767 .vaux2 = &rx51_vaux2,
768 .vaux4 = &rx51_vaux4,
769 .vmmc1 = &rx51_vmmc1,
775 static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
780 static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
782 I2C_BOARD_INFO("twl5030", 0x48),
783 .flags = I2C_CLIENT_WAKE,
784 .irq = INT_34XX_SYS_NIRQ,
785 .platform_data = &rx51_twldata,
789 /* Audio setup data */
790 static 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,
795 static struct aic3x_pdata rx51_aic3x_data = {
796 .setup = &rx51_aic34_setup,
800 static struct aic3x_pdata rx51_aic3x_data2 = {
804 static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
806 I2C_BOARD_INFO("tlv320aic3x", 0x18),
807 .platform_data = &rx51_aic3x_data,
810 I2C_BOARD_INFO("tlv320aic3x", 0x19),
811 .platform_data = &rx51_aic3x_data2,
813 #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
815 I2C_BOARD_INFO("tsl2563", 0x29),
816 .platform_data = &rx51_tsl2563_platform_data,
820 I2C_BOARD_INFO("tpa6130a2", 0x60),
821 .platform_data = &rx51_tpa6130a2_data,
825 static int __init rx51_i2c_init(void)
827 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
828 system_rev >= SYSTEM_REV_B_USES_VAUX3) {
829 rx51_twldata.vaux3 = &rx51_vaux3_mmc;
830 /* Only older boards use VMMC2 for internal MMC */
831 rx51_vmmc2.num_consumer_supplies--;
833 rx51_twldata.vaux3 = &rx51_vaux3_cam;
835 rx51_twldata.vmmc2 = &rx51_vmmc2;
836 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
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));
840 omap_register_i2c_bus(3, 400, NULL, 0);
844 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
845 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
847 static struct mtd_partition onenand_partitions[] = {
849 .name = "bootloader",
852 .mask_flags = MTD_WRITEABLE, /* Force read-only */
856 .offset = MTDPART_OFS_APPEND,
861 .offset = MTDPART_OFS_APPEND,
866 .offset = MTDPART_OFS_APPEND,
871 .offset = MTDPART_OFS_APPEND,
876 .offset = MTDPART_OFS_APPEND,
877 .size = MTDPART_SIZ_FULL,
881 static struct omap_onenand_platform_data board_onenand_data[] = {
885 .parts = onenand_partitions,
886 .nr_parts = ARRAY_SIZE(onenand_partitions),
887 .flags = ONENAND_SYNC_READWRITE,
892 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
894 static struct omap_smc91x_platform_data board_smc91x_data = {
899 .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
902 static void __init board_smc91x_init(void)
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);
908 gpmc_smc91x_init(&board_smc91x_data);
913 static inline void board_smc91x_init(void)
919 static void rx51_wl1251_set_power(bool enable)
921 gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
924 static void __init rx51_init_wl1251(void)
928 ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
932 ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
936 ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
940 ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
944 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
948 wl1251_pdata.set_power = rx51_wl1251_set_power;
949 rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
954 gpio_free(RX51_WL1251_IRQ_GPIO);
957 gpio_free(RX51_WL1251_POWER_GPIO);
960 printk(KERN_ERR "wl1251 board initialisation failed\n");
961 wl1251_pdata.set_power = NULL;
964 * Now rx51_peripherals_spi_board_info[1].irq is zero and
965 * set_power is null, and wl1251_probe() will fail.
969 void __init rx51_peripherals_init(void)
972 gpmc_onenand_init(board_onenand_data);
974 rx51_add_gpio_keys();
977 spi_register_board_info(rx51_peripherals_spi_board_info,
978 ARRAY_SIZE(rx51_peripherals_spi_board_info));
980 partition = omap_mux_get("core");
982 omap2_hsmmc_init(mmc);
984 platform_device_register(&rx51_charger_device);