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/spi/tsc2005.h>
19 #include <linux/i2c.h>
20 #include <linux/i2c/twl.h>
21 #include <linux/clk.h>
22 #include <linux/delay.h>
23 #include <linux/regulator/machine.h>
24 #include <linux/gpio.h>
25 #include <linux/gpio_keys.h>
26 #include <linux/mmc/host.h>
27 #include <linux/power/isp1704_charger.h>
28 #include <asm/system_info.h>
30 #include <plat/mcspi.h>
31 #include <plat/board.h>
34 #include <plat/gpmc.h>
35 #include <plat/onenand.h>
36 #include <plat/gpmc-smc91x.h>
38 #include <mach/board-rx51.h>
40 #include <sound/tlv320aic3x.h>
41 #include <sound/tpa6130a2-plat.h>
42 #include <media/radio-si4713.h>
43 #include <media/si4713.h>
44 #include <linux/leds-lp5523.h>
46 #include <../drivers/staging/iio/light/tsl2563.h>
47 #include <linux/lis3lv02d.h>
51 #include "common-board-devices.h"
53 #define SYSTEM_REV_B_USES_VAUX3 0x1699
54 #define SYSTEM_REV_S_USES_VAUX3 0x8
56 #define RX51_WL1251_POWER_GPIO 87
57 #define RX51_WL1251_IRQ_GPIO 42
58 #define RX51_FMTX_RESET_GPIO 163
59 #define RX51_FMTX_IRQ 53
60 #define RX51_LP5523_CHIP_EN_GPIO 41
62 #define RX51_USB_TRANSCEIVER_RST_GPIO 67
64 #define RX51_TSC2005_RESET_GPIO 104
65 #define RX51_TSC2005_IRQ_GPIO 100
67 #define LIS302_IRQ1_GPIO 181
68 #define LIS302_IRQ2_GPIO 180 /* Not yet in use */
70 /* list all spi devices here */
73 RX51_SPI_MIPID
, /* LCD panel */
74 RX51_SPI_TSC2005
, /* Touch Controller */
77 static struct wl12xx_platform_data wl1251_pdata
;
78 static struct tsc2005_platform_data tsc2005_pdata
;
80 #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
81 static int lis302_setup(void)
84 int irq1
= LIS302_IRQ1_GPIO
;
85 int irq2
= LIS302_IRQ2_GPIO
;
87 /* gpio for interrupt pin 1 */
88 err
= gpio_request(irq1
, "lis3lv02dl_irq1");
90 printk(KERN_ERR
"lis3lv02dl: gpio request failed\n");
94 /* gpio for interrupt pin 2 */
95 err
= gpio_request(irq2
, "lis3lv02dl_irq2");
98 printk(KERN_ERR
"lis3lv02dl: gpio request failed\n");
102 gpio_direction_input(irq1
);
103 gpio_direction_input(irq2
);
109 static int lis302_release(void)
111 gpio_free(LIS302_IRQ1_GPIO
);
112 gpio_free(LIS302_IRQ2_GPIO
);
117 static struct lis3lv02d_platform_data rx51_lis3lv02d_data
= {
118 .click_flags
= LIS3_CLICK_SINGLE_X
| LIS3_CLICK_SINGLE_Y
|
120 /* Limits are 0.5g * value */
123 .click_thresh_z
= 10,
124 /* Click must be longer than time limit */
125 .click_time_limit
= 9,
126 /* Kind of debounce filter */
129 /* Limits for all axis. millig-value / 18 to get HW values */
130 .wakeup_flags
= LIS3_WAKEUP_X_HI
| LIS3_WAKEUP_Y_HI
,
131 .wakeup_thresh
= 800 / 18,
132 .wakeup_flags2
= LIS3_WAKEUP_Z_HI
,
133 .wakeup_thresh2
= 900 / 18,
135 .hipass_ctrl
= LIS3_HIPASS1_DISABLE
| LIS3_HIPASS2_DISABLE
,
137 /* Interrupt line 2 for click detection, line 1 for thresholds */
138 .irq_cfg
= LIS3_IRQ2_CLICK
| LIS3_IRQ1_FF_WU_12
,
140 .axis_x
= LIS3_DEV_X
,
141 .axis_y
= LIS3_INV_DEV_Y
,
142 .axis_z
= LIS3_INV_DEV_Z
,
143 .setup_resources
= lis302_setup
,
144 .release_resources
= lis302_release
,
145 .st_min_limits
= {-32, 3, 3},
146 .st_max_limits
= {-3, 32, 32},
147 .irq2
= OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO
),
151 #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
152 static struct tsl2563_platform_data rx51_tsl2563_platform_data
= {
153 .cover_comp_gain
= 16,
157 #if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
158 static struct lp5523_led_config rx51_lp5523_led_config
[] = {
189 static int rx51_lp5523_setup(void)
191 return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO
, GPIOF_DIR_OUT
,
195 static void rx51_lp5523_release(void)
197 gpio_free(RX51_LP5523_CHIP_EN_GPIO
);
200 static void rx51_lp5523_enable(bool state
)
202 gpio_set_value(RX51_LP5523_CHIP_EN_GPIO
, !!state
);
205 static struct lp5523_platform_data rx51_lp5523_platform_data
= {
206 .led_config
= rx51_lp5523_led_config
,
207 .num_channels
= ARRAY_SIZE(rx51_lp5523_led_config
),
208 .clock_mode
= LP5523_CLOCK_AUTO
,
209 .setup_resources
= rx51_lp5523_setup
,
210 .release_resources
= rx51_lp5523_release
,
211 .enable
= rx51_lp5523_enable
,
215 static struct omap2_mcspi_device_config wl1251_mcspi_config
= {
219 static struct omap2_mcspi_device_config mipid_mcspi_config
= {
223 static struct omap2_mcspi_device_config tsc2005_mcspi_config
= {
227 static struct spi_board_info rx51_peripherals_spi_board_info
[] __initdata
= {
228 [RX51_SPI_WL1251
] = {
229 .modalias
= "wl1251",
232 .max_speed_hz
= 48000000,
234 .controller_data
= &wl1251_mcspi_config
,
235 .platform_data
= &wl1251_pdata
,
238 .modalias
= "acx565akm",
241 .max_speed_hz
= 6000000,
242 .controller_data
= &mipid_mcspi_config
,
244 [RX51_SPI_TSC2005
] = {
245 .modalias
= "tsc2005",
248 .max_speed_hz
= 6000000,
249 .controller_data
= &tsc2005_mcspi_config
,
250 .platform_data
= &tsc2005_pdata
,
254 static void rx51_charger_set_power(bool on
)
256 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO
, on
);
259 static struct isp1704_charger_data rx51_charger_data
= {
260 .set_power
= rx51_charger_set_power
,
263 static struct platform_device rx51_charger_device
= {
264 .name
= "isp1704_charger",
266 .platform_data
= &rx51_charger_data
,
270 static void __init
rx51_charger_init(void)
272 WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO
,
273 GPIOF_OUT_INIT_HIGH
, "isp1704_reset"));
275 platform_device_register(&rx51_charger_device
);
278 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
280 #define RX51_GPIO_CAMERA_LENS_COVER 110
281 #define RX51_GPIO_CAMERA_FOCUS 68
282 #define RX51_GPIO_CAMERA_CAPTURE 69
283 #define RX51_GPIO_KEYPAD_SLIDE 71
284 #define RX51_GPIO_LOCK_BUTTON 113
285 #define RX51_GPIO_PROXIMITY 89
287 #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
289 static struct gpio_keys_button rx51_gpio_keys
[] = {
291 .desc
= "Camera Lens Cover",
293 .code
= SW_CAMERA_LENS_COVER
,
294 .gpio
= RX51_GPIO_CAMERA_LENS_COVER
,
296 .debounce_interval
= RX51_GPIO_DEBOUNCE_TIMEOUT
,
298 .desc
= "Camera Focus",
300 .code
= KEY_CAMERA_FOCUS
,
301 .gpio
= RX51_GPIO_CAMERA_FOCUS
,
303 .debounce_interval
= RX51_GPIO_DEBOUNCE_TIMEOUT
,
305 .desc
= "Camera Capture",
308 .gpio
= RX51_GPIO_CAMERA_CAPTURE
,
310 .debounce_interval
= RX51_GPIO_DEBOUNCE_TIMEOUT
,
312 .desc
= "Lock Button",
314 .code
= KEY_SCREENLOCK
,
315 .gpio
= RX51_GPIO_LOCK_BUTTON
,
317 .debounce_interval
= RX51_GPIO_DEBOUNCE_TIMEOUT
,
319 .desc
= "Keypad Slide",
321 .code
= SW_KEYPAD_SLIDE
,
322 .gpio
= RX51_GPIO_KEYPAD_SLIDE
,
324 .debounce_interval
= RX51_GPIO_DEBOUNCE_TIMEOUT
,
326 .desc
= "Proximity Sensor",
328 .code
= SW_FRONT_PROXIMITY
,
329 .gpio
= RX51_GPIO_PROXIMITY
,
331 .debounce_interval
= RX51_GPIO_DEBOUNCE_TIMEOUT
,
335 static struct gpio_keys_platform_data rx51_gpio_keys_data
= {
336 .buttons
= rx51_gpio_keys
,
337 .nbuttons
= ARRAY_SIZE(rx51_gpio_keys
),
340 static struct platform_device rx51_gpio_keys_device
= {
344 .platform_data
= &rx51_gpio_keys_data
,
348 static void __init
rx51_add_gpio_keys(void)
350 platform_device_register(&rx51_gpio_keys_device
);
353 static void __init
rx51_add_gpio_keys(void)
356 #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
358 static uint32_t board_keymap
[] = {
360 * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
361 * connected to the ground" matrix state.
366 KEY(0, 3, KEY_COMMA
),
367 KEY(0, 4, KEY_BACKSPACE
),
383 KEY(2, 3, KEY_ENTER
),
394 KEY(3, 5, KEY_SPACE
),
395 KEY(3, 6, KEY_SPACE
),
400 KEY(4, 2, KEY_RIGHT
),
401 KEY(4, 4, KEY_LEFTCTRL
),
402 KEY(4, 5, KEY_RIGHTALT
),
403 KEY(4, 6, KEY_LEFTSHIFT
),
416 static struct matrix_keymap_data board_map_data
= {
417 .keymap
= board_keymap
,
418 .keymap_size
= ARRAY_SIZE(board_keymap
),
421 static struct twl4030_keypad_data rx51_kp_data
= {
422 .keymap_data
= &board_map_data
,
428 /* Enable input logic and pull all lines up when eMMC is on. */
429 static struct omap_board_mux rx51_mmc2_on_mux
[] = {
430 OMAP3_MUX(SDMMC2_CMD
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
431 OMAP3_MUX(SDMMC2_DAT0
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
432 OMAP3_MUX(SDMMC2_DAT1
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
433 OMAP3_MUX(SDMMC2_DAT2
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
434 OMAP3_MUX(SDMMC2_DAT3
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
435 OMAP3_MUX(SDMMC2_DAT4
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
436 OMAP3_MUX(SDMMC2_DAT5
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
437 OMAP3_MUX(SDMMC2_DAT6
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
438 OMAP3_MUX(SDMMC2_DAT7
, OMAP_PIN_INPUT_PULLUP
| OMAP_MUX_MODE0
),
439 { .reg_offset
= OMAP_MUX_TERMINATOR
},
442 /* Disable input logic and pull all lines down when eMMC is off. */
443 static struct omap_board_mux rx51_mmc2_off_mux
[] = {
444 OMAP3_MUX(SDMMC2_CMD
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
445 OMAP3_MUX(SDMMC2_DAT0
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
446 OMAP3_MUX(SDMMC2_DAT1
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
447 OMAP3_MUX(SDMMC2_DAT2
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
448 OMAP3_MUX(SDMMC2_DAT3
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
449 OMAP3_MUX(SDMMC2_DAT4
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
450 OMAP3_MUX(SDMMC2_DAT5
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
451 OMAP3_MUX(SDMMC2_DAT6
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
452 OMAP3_MUX(SDMMC2_DAT7
, OMAP_PULL_ENA
| OMAP_MUX_MODE0
),
453 { .reg_offset
= OMAP_MUX_TERMINATOR
},
456 static struct omap_mux_partition
*partition
;
459 * Current flows to eMMC when eMMC is off and the data lines are pulled up,
460 * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
462 static void rx51_mmc2_remux(struct device
*dev
, int slot
, int power_on
)
465 omap_mux_write_array(partition
, rx51_mmc2_on_mux
);
467 omap_mux_write_array(partition
, rx51_mmc2_off_mux
);
470 static struct omap2_hsmmc_info mmc
[] __initdata
= {
474 .caps
= MMC_CAP_4_BIT_DATA
,
478 .power_saving
= true,
483 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
484 /* See also rx51_mmc2_remux */
487 .nonremovable
= true,
488 .power_saving
= true,
489 .remux
= rx51_mmc2_remux
,
494 static struct regulator_consumer_supply rx51_vmmc1_supply
[] = {
495 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
498 static struct regulator_consumer_supply rx51_vaux2_supply
[] = {
499 REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
502 static struct regulator_consumer_supply rx51_vaux3_supply
[] = {
503 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
506 static struct regulator_consumer_supply rx51_vsim_supply
[] = {
507 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
510 static struct regulator_consumer_supply rx51_vmmc2_supplies
[] = {
511 /* tlv320aic3x analog supplies */
512 REGULATOR_SUPPLY("AVDD", "2-0018"),
513 REGULATOR_SUPPLY("DRVDD", "2-0018"),
514 REGULATOR_SUPPLY("AVDD", "2-0019"),
515 REGULATOR_SUPPLY("DRVDD", "2-0019"),
517 REGULATOR_SUPPLY("Vdd", "2-0060"),
518 /* Keep vmmc as last item. It is not iterated for newer boards */
519 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
522 static struct regulator_consumer_supply rx51_vio_supplies
[] = {
523 /* tlv320aic3x digital supplies */
524 REGULATOR_SUPPLY("IOVDD", "2-0018"),
525 REGULATOR_SUPPLY("DVDD", "2-0018"),
526 REGULATOR_SUPPLY("IOVDD", "2-0019"),
527 REGULATOR_SUPPLY("DVDD", "2-0019"),
528 /* Si4713 IO supply */
529 REGULATOR_SUPPLY("vio", "2-0063"),
532 static struct regulator_consumer_supply rx51_vaux1_consumers
[] = {
533 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
535 REGULATOR_SUPPLY("vdd", "2-0063"),
538 static struct regulator_init_data rx51_vaux1
= {
543 .always_on
= true, /* due battery cover sensor */
544 .valid_modes_mask
= REGULATOR_MODE_NORMAL
545 | REGULATOR_MODE_STANDBY
,
546 .valid_ops_mask
= REGULATOR_CHANGE_MODE
547 | REGULATOR_CHANGE_STATUS
,
549 .num_consumer_supplies
= ARRAY_SIZE(rx51_vaux1_consumers
),
550 .consumer_supplies
= rx51_vaux1_consumers
,
553 static struct regulator_init_data rx51_vaux2
= {
558 .valid_modes_mask
= REGULATOR_MODE_NORMAL
559 | REGULATOR_MODE_STANDBY
,
560 .valid_ops_mask
= REGULATOR_CHANGE_MODE
561 | REGULATOR_CHANGE_STATUS
,
563 .num_consumer_supplies
= ARRAY_SIZE(rx51_vaux2_supply
),
564 .consumer_supplies
= rx51_vaux2_supply
,
567 /* VAUX3 - adds more power to VIO_18 rail */
568 static struct regulator_init_data rx51_vaux3_cam
= {
570 .name
= "VCAM_DIG_18",
574 .valid_modes_mask
= REGULATOR_MODE_NORMAL
575 | REGULATOR_MODE_STANDBY
,
576 .valid_ops_mask
= REGULATOR_CHANGE_MODE
577 | REGULATOR_CHANGE_STATUS
,
581 static struct regulator_init_data rx51_vaux3_mmc
= {
587 .valid_modes_mask
= REGULATOR_MODE_NORMAL
588 | REGULATOR_MODE_STANDBY
,
589 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
590 | REGULATOR_CHANGE_MODE
591 | REGULATOR_CHANGE_STATUS
,
593 .num_consumer_supplies
= ARRAY_SIZE(rx51_vaux3_supply
),
594 .consumer_supplies
= rx51_vaux3_supply
,
597 static struct regulator_init_data rx51_vaux4
= {
599 .name
= "VCAM_ANA_28",
603 .valid_modes_mask
= REGULATOR_MODE_NORMAL
604 | REGULATOR_MODE_STANDBY
,
605 .valid_ops_mask
= REGULATOR_CHANGE_MODE
606 | REGULATOR_CHANGE_STATUS
,
610 static struct regulator_init_data rx51_vmmc1
= {
614 .valid_modes_mask
= REGULATOR_MODE_NORMAL
615 | REGULATOR_MODE_STANDBY
,
616 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
617 | REGULATOR_CHANGE_MODE
618 | REGULATOR_CHANGE_STATUS
,
620 .num_consumer_supplies
= ARRAY_SIZE(rx51_vmmc1_supply
),
621 .consumer_supplies
= rx51_vmmc1_supply
,
624 static struct regulator_init_data rx51_vmmc2
= {
629 .always_on
= true, /* due VIO leak to AIC34 VDDs */
631 .valid_modes_mask
= REGULATOR_MODE_NORMAL
632 | REGULATOR_MODE_STANDBY
,
633 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
634 | REGULATOR_CHANGE_MODE
635 | REGULATOR_CHANGE_STATUS
,
637 .num_consumer_supplies
= ARRAY_SIZE(rx51_vmmc2_supplies
),
638 .consumer_supplies
= rx51_vmmc2_supplies
,
641 static struct regulator_init_data rx51_vpll1
= {
648 .valid_modes_mask
= REGULATOR_MODE_NORMAL
649 | REGULATOR_MODE_STANDBY
,
650 .valid_ops_mask
= REGULATOR_CHANGE_MODE
,
654 static struct regulator_init_data rx51_vpll2
= {
661 .valid_modes_mask
= REGULATOR_MODE_NORMAL
662 | REGULATOR_MODE_STANDBY
,
663 .valid_ops_mask
= REGULATOR_CHANGE_MODE
,
667 static struct regulator_init_data rx51_vsim
= {
669 .name
= "VMMC2_IO_18",
673 .valid_modes_mask
= REGULATOR_MODE_NORMAL
674 | REGULATOR_MODE_STANDBY
,
675 .valid_ops_mask
= REGULATOR_CHANGE_MODE
676 | REGULATOR_CHANGE_STATUS
,
678 .num_consumer_supplies
= ARRAY_SIZE(rx51_vsim_supply
),
679 .consumer_supplies
= rx51_vsim_supply
,
682 static struct regulator_init_data rx51_vio
= {
686 .valid_modes_mask
= REGULATOR_MODE_NORMAL
687 | REGULATOR_MODE_STANDBY
,
688 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
689 | REGULATOR_CHANGE_MODE
690 | REGULATOR_CHANGE_STATUS
,
692 .num_consumer_supplies
= ARRAY_SIZE(rx51_vio_supplies
),
693 .consumer_supplies
= rx51_vio_supplies
,
696 static struct regulator_init_data rx51_vintana1
= {
702 .valid_modes_mask
= REGULATOR_MODE_NORMAL
703 | REGULATOR_MODE_STANDBY
,
704 .valid_ops_mask
= REGULATOR_CHANGE_MODE
,
708 static struct regulator_init_data rx51_vintana2
= {
715 .valid_modes_mask
= REGULATOR_MODE_NORMAL
716 | REGULATOR_MODE_STANDBY
,
717 .valid_ops_mask
= REGULATOR_CHANGE_MODE
,
721 static struct regulator_init_data rx51_vintdig
= {
727 .valid_modes_mask
= REGULATOR_MODE_NORMAL
728 | REGULATOR_MODE_STANDBY
,
729 .valid_ops_mask
= REGULATOR_CHANGE_MODE
,
733 static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module
= {
734 .gpio_reset
= RX51_FMTX_RESET_GPIO
,
737 static struct i2c_board_info rx51_si4713_board_info __initdata_or_module
= {
738 I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH
),
739 .platform_data
= &rx51_si4713_i2c_data
,
742 static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module
= {
744 .subdev_board_info
= &rx51_si4713_board_info
,
747 static struct platform_device rx51_si4713_dev
= {
748 .name
= "radio-si4713",
751 .platform_data
= &rx51_si4713_data
,
755 static __init
void rx51_init_si4713(void)
759 err
= gpio_request_one(RX51_FMTX_IRQ
, GPIOF_DIR_IN
, "si4713 irq");
761 printk(KERN_ERR
"Cannot request si4713 irq gpio. %d\n", err
);
764 rx51_si4713_board_info
.irq
= gpio_to_irq(RX51_FMTX_IRQ
);
765 platform_device_register(&rx51_si4713_dev
);
768 static int rx51_twlgpio_setup(struct device
*dev
, unsigned gpio
, unsigned n
)
770 /* FIXME this gpio setup is just a placeholder for now */
771 gpio_request_one(gpio
+ 6, GPIOF_OUT_INIT_LOW
, "backlight_pwm");
772 gpio_request_one(gpio
+ 7, GPIOF_OUT_INIT_LOW
, "speaker_en");
777 static struct twl4030_gpio_platform_data rx51_gpio_data
= {
778 .gpio_base
= OMAP_MAX_GPIO_LINES
,
779 .irq_base
= TWL4030_GPIO_IRQ_BASE
,
780 .irq_end
= TWL4030_GPIO_IRQ_END
,
781 .pulldowns
= BIT(0) | BIT(1) | BIT(2) | BIT(3)
783 | BIT(8) | BIT(9) | BIT(10) | BIT(11)
784 | BIT(12) | BIT(13) | BIT(14) | BIT(15)
785 | BIT(16) | BIT(17) ,
786 .setup
= rx51_twlgpio_setup
,
789 static struct twl4030_ins sleep_on_seq
[] __initdata
= {
791 * Turn off everything
793 {MSG_BROADCAST(DEV_GRP_NULL
, RES_GRP_ALL
, 1, 0, RES_STATE_SLEEP
), 2},
796 static struct twl4030_script sleep_on_script __initdata
= {
797 .script
= sleep_on_seq
,
798 .size
= ARRAY_SIZE(sleep_on_seq
),
799 .flags
= TWL4030_SLEEP_SCRIPT
,
802 static struct twl4030_ins wakeup_seq
[] __initdata
= {
804 * Reenable everything
806 {MSG_BROADCAST(DEV_GRP_NULL
, RES_GRP_ALL
, 1, 0, RES_STATE_ACTIVE
), 2},
809 static struct twl4030_script wakeup_script __initdata
= {
810 .script
= wakeup_seq
,
811 .size
= ARRAY_SIZE(wakeup_seq
),
812 .flags
= TWL4030_WAKEUP12_SCRIPT
,
815 static struct twl4030_ins wakeup_p3_seq
[] __initdata
= {
817 * Reenable everything
819 {MSG_BROADCAST(DEV_GRP_NULL
, RES_GRP_ALL
, 1, 0, RES_STATE_ACTIVE
), 2},
822 static struct twl4030_script wakeup_p3_script __initdata
= {
823 .script
= wakeup_p3_seq
,
824 .size
= ARRAY_SIZE(wakeup_p3_seq
),
825 .flags
= TWL4030_WAKEUP3_SCRIPT
,
828 static struct twl4030_ins wrst_seq
[] __initdata
= {
831 * Reset VDD1 regulator.
832 * Reset VDD2 regulator.
833 * Reset VPLL1 regulator.
834 * Enable sysclk output.
837 {MSG_SINGULAR(DEV_GRP_NULL
, RES_RESET
, RES_STATE_OFF
), 2},
838 {MSG_BROADCAST(DEV_GRP_NULL
, RES_GRP_ALL
, 0, 1, RES_STATE_ACTIVE
),
840 {MSG_BROADCAST(DEV_GRP_NULL
, RES_GRP_PP
, 0, 3, RES_STATE_OFF
), 0x13},
841 {MSG_SINGULAR(DEV_GRP_NULL
, RES_VDD1
, RES_STATE_WRST
), 0x13},
842 {MSG_SINGULAR(DEV_GRP_NULL
, RES_VDD2
, RES_STATE_WRST
), 0x13},
843 {MSG_SINGULAR(DEV_GRP_NULL
, RES_VPLL1
, RES_STATE_WRST
), 0x35},
844 {MSG_SINGULAR(DEV_GRP_P3
, RES_HFCLKOUT
, RES_STATE_ACTIVE
), 2},
845 {MSG_SINGULAR(DEV_GRP_NULL
, RES_RESET
, RES_STATE_ACTIVE
), 2},
848 static struct twl4030_script wrst_script __initdata
= {
850 .size
= ARRAY_SIZE(wrst_seq
),
851 .flags
= TWL4030_WRST_SCRIPT
,
854 static struct twl4030_script
*twl4030_scripts
[] __initdata
= {
855 /* wakeup12 script should be loaded before sleep script, otherwise a
856 board might hit retention before loading of wakeup script is
857 completed. This can cause boot failures depending on timing issues.
865 static struct twl4030_resconfig twl4030_rconfig
[] __initdata
= {
866 { .resource
= RES_VDD1
, .devgroup
= -1,
867 .type
= 1, .type2
= -1, .remap_off
= RES_STATE_OFF
,
868 .remap_sleep
= RES_STATE_OFF
870 { .resource
= RES_VDD2
, .devgroup
= -1,
871 .type
= 1, .type2
= -1, .remap_off
= RES_STATE_OFF
,
872 .remap_sleep
= RES_STATE_OFF
874 { .resource
= RES_VPLL1
, .devgroup
= -1,
875 .type
= 1, .type2
= -1, .remap_off
= RES_STATE_OFF
,
876 .remap_sleep
= RES_STATE_OFF
878 { .resource
= RES_VPLL2
, .devgroup
= -1,
879 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
881 { .resource
= RES_VAUX1
, .devgroup
= -1,
882 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
884 { .resource
= RES_VAUX2
, .devgroup
= -1,
885 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
887 { .resource
= RES_VAUX3
, .devgroup
= -1,
888 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
890 { .resource
= RES_VAUX4
, .devgroup
= -1,
891 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
893 { .resource
= RES_VMMC1
, .devgroup
= -1,
894 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
896 { .resource
= RES_VMMC2
, .devgroup
= -1,
897 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
899 { .resource
= RES_VDAC
, .devgroup
= -1,
900 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
902 { .resource
= RES_VSIM
, .devgroup
= -1,
903 .type
= -1, .type2
= 3, .remap_off
= -1, .remap_sleep
= -1
905 { .resource
= RES_VINTANA1
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
906 .type
= -1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
908 { .resource
= RES_VINTANA2
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
909 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
911 { .resource
= RES_VINTDIG
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
912 .type
= -1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
914 { .resource
= RES_VIO
, .devgroup
= DEV_GRP_P3
,
915 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
917 { .resource
= RES_CLKEN
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
918 .type
= 1, .type2
= -1 , .remap_off
= -1, .remap_sleep
= -1
920 { .resource
= RES_REGEN
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
921 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
923 { .resource
= RES_NRES_PWRON
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
924 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
926 { .resource
= RES_SYSEN
, .devgroup
= DEV_GRP_P1
| DEV_GRP_P3
,
927 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
929 { .resource
= RES_HFCLKOUT
, .devgroup
= DEV_GRP_P3
,
930 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
932 { .resource
= RES_32KCLKOUT
, .devgroup
= -1,
933 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
935 { .resource
= RES_RESET
, .devgroup
= -1,
936 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
938 { .resource
= RES_MAIN_REF
, .devgroup
= -1,
939 .type
= 1, .type2
= -1, .remap_off
= -1, .remap_sleep
= -1
944 static struct twl4030_power_data rx51_t2scripts_data __initdata
= {
945 .scripts
= twl4030_scripts
,
946 .num
= ARRAY_SIZE(twl4030_scripts
),
947 .resource_config
= twl4030_rconfig
,
950 static struct twl4030_vibra_data rx51_vibra_data __initdata
= {
954 static struct twl4030_audio_data rx51_audio_data __initdata
= {
955 .audio_mclk
= 26000000,
956 .vibra
= &rx51_vibra_data
,
959 static struct twl4030_platform_data rx51_twldata __initdata
= {
960 /* platform_data for children goes here */
961 .gpio
= &rx51_gpio_data
,
962 .keypad
= &rx51_kp_data
,
963 .power
= &rx51_t2scripts_data
,
964 .audio
= &rx51_audio_data
,
966 .vaux1
= &rx51_vaux1
,
967 .vaux2
= &rx51_vaux2
,
968 .vaux4
= &rx51_vaux4
,
969 .vmmc1
= &rx51_vmmc1
,
970 .vpll1
= &rx51_vpll1
,
971 .vpll2
= &rx51_vpll2
,
973 .vintana1
= &rx51_vintana1
,
974 .vintana2
= &rx51_vintana2
,
975 .vintdig
= &rx51_vintdig
,
979 static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module
= {
983 /* Audio setup data */
984 static struct aic3x_setup_data rx51_aic34_setup
= {
985 .gpio_func
[0] = AIC3X_GPIO1_FUNC_DISABLED
,
986 .gpio_func
[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT
,
989 static struct aic3x_pdata rx51_aic3x_data
= {
990 .setup
= &rx51_aic34_setup
,
994 static struct aic3x_pdata rx51_aic3x_data2
= {
998 static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2
[] = {
1000 I2C_BOARD_INFO("tlv320aic3x", 0x18),
1001 .platform_data
= &rx51_aic3x_data
,
1004 I2C_BOARD_INFO("tlv320aic3x", 0x19),
1005 .platform_data
= &rx51_aic3x_data2
,
1007 #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
1009 I2C_BOARD_INFO("tsl2563", 0x29),
1010 .platform_data
= &rx51_tsl2563_platform_data
,
1013 #if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
1015 I2C_BOARD_INFO("lp5523", 0x32),
1016 .platform_data
= &rx51_lp5523_platform_data
,
1020 I2C_BOARD_INFO("bq27200", 0x55),
1023 I2C_BOARD_INFO("tpa6130a2", 0x60),
1024 .platform_data
= &rx51_tpa6130a2_data
,
1028 static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3
[] = {
1029 #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
1031 I2C_BOARD_INFO("lis3lv02d", 0x1d),
1032 .platform_data
= &rx51_lis3lv02d_data
,
1033 .irq
= OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO
),
1038 static int __init
rx51_i2c_init(void)
1040 if ((system_rev
>= SYSTEM_REV_S_USES_VAUX3
&& system_rev
< 0x100) ||
1041 system_rev
>= SYSTEM_REV_B_USES_VAUX3
) {
1042 rx51_twldata
.vaux3
= &rx51_vaux3_mmc
;
1043 /* Only older boards use VMMC2 for internal MMC */
1044 rx51_vmmc2
.num_consumer_supplies
--;
1046 rx51_twldata
.vaux3
= &rx51_vaux3_cam
;
1048 rx51_twldata
.vmmc2
= &rx51_vmmc2
;
1049 omap3_pmic_get_config(&rx51_twldata
,
1050 TWL_COMMON_PDATA_USB
| TWL_COMMON_PDATA_MADC
,
1051 TWL_COMMON_REGULATOR_VDAC
);
1053 rx51_twldata
.vdac
->constraints
.apply_uV
= true;
1054 rx51_twldata
.vdac
->constraints
.name
= "VDAC";
1056 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ
, &rx51_twldata
);
1057 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2
,
1058 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2
));
1059 omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3
,
1060 ARRAY_SIZE(rx51_peripherals_i2c_board_info_3
));
1064 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
1065 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
1067 static struct mtd_partition onenand_partitions
[] = {
1069 .name
= "bootloader",
1072 .mask_flags
= MTD_WRITEABLE
, /* Force read-only */
1076 .offset
= MTDPART_OFS_APPEND
,
1081 .offset
= MTDPART_OFS_APPEND
,
1086 .offset
= MTDPART_OFS_APPEND
,
1091 .offset
= MTDPART_OFS_APPEND
,
1096 .offset
= MTDPART_OFS_APPEND
,
1097 .size
= MTDPART_SIZ_FULL
,
1101 static struct omap_onenand_platform_data board_onenand_data
[] = {
1105 .parts
= onenand_partitions
,
1106 .nr_parts
= ARRAY_SIZE(onenand_partitions
),
1107 .flags
= ONENAND_SYNC_READWRITE
,
1112 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1114 static struct omap_smc91x_platform_data board_smc91x_data
= {
1119 .flags
= GPMC_TIMINGS_SMC91C96
| IORESOURCE_IRQ_HIGHLEVEL
,
1122 static void __init
board_smc91x_init(void)
1124 omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN
);
1125 omap_mux_init_gpio(86, OMAP_PIN_OUTPUT
);
1126 omap_mux_init_gpio(164, OMAP_PIN_OUTPUT
);
1128 gpmc_smc91x_init(&board_smc91x_data
);
1133 static inline void board_smc91x_init(void)
1139 static void rx51_wl1251_set_power(bool enable
)
1141 gpio_set_value(RX51_WL1251_POWER_GPIO
, enable
);
1144 static struct gpio rx51_wl1251_gpios
[] __initdata
= {
1145 { RX51_WL1251_POWER_GPIO
, GPIOF_OUT_INIT_LOW
, "wl1251 power" },
1146 { RX51_WL1251_IRQ_GPIO
, GPIOF_IN
, "wl1251 irq" },
1149 static void __init
rx51_init_wl1251(void)
1153 ret
= gpio_request_array(rx51_wl1251_gpios
,
1154 ARRAY_SIZE(rx51_wl1251_gpios
));
1158 irq
= gpio_to_irq(RX51_WL1251_IRQ_GPIO
);
1162 wl1251_pdata
.set_power
= rx51_wl1251_set_power
;
1163 rx51_peripherals_spi_board_info
[RX51_SPI_WL1251
].irq
= irq
;
1168 gpio_free(RX51_WL1251_IRQ_GPIO
);
1169 gpio_free(RX51_WL1251_POWER_GPIO
);
1171 printk(KERN_ERR
"wl1251 board initialisation failed\n");
1172 wl1251_pdata
.set_power
= NULL
;
1175 * Now rx51_peripherals_spi_board_info[1].irq is zero and
1176 * set_power is null, and wl1251_probe() will fail.
1180 static struct tsc2005_platform_data tsc2005_pdata
= {
1181 .ts_pressure_max
= 2048,
1182 .ts_pressure_fudge
= 2,
1187 .ts_x_plate_ohm
= 280,
1188 .esd_timeout_ms
= 8000,
1191 static struct gpio rx51_tsc2005_gpios
[] __initdata
= {
1192 { RX51_TSC2005_IRQ_GPIO
, GPIOF_IN
, "tsc2005 IRQ" },
1193 { RX51_TSC2005_RESET_GPIO
, GPIOF_OUT_INIT_HIGH
, "tsc2005 reset" },
1196 static void rx51_tsc2005_set_reset(bool enable
)
1198 gpio_set_value(RX51_TSC2005_RESET_GPIO
, enable
);
1201 static void __init
rx51_init_tsc2005(void)
1205 omap_mux_init_gpio(RX51_TSC2005_RESET_GPIO
, OMAP_PIN_OUTPUT
);
1206 omap_mux_init_gpio(RX51_TSC2005_IRQ_GPIO
, OMAP_PIN_INPUT_PULLUP
);
1208 r
= gpio_request_array(rx51_tsc2005_gpios
,
1209 ARRAY_SIZE(rx51_tsc2005_gpios
));
1211 printk(KERN_ERR
"tsc2005 board initialization failed\n");
1212 tsc2005_pdata
.esd_timeout_ms
= 0;
1216 tsc2005_pdata
.set_reset
= rx51_tsc2005_set_reset
;
1217 rx51_peripherals_spi_board_info
[RX51_SPI_TSC2005
].irq
=
1218 gpio_to_irq(RX51_TSC2005_IRQ_GPIO
);
1221 void __init
rx51_peripherals_init(void)
1224 regulator_has_full_constraints();
1225 gpmc_onenand_init(board_onenand_data
);
1226 board_smc91x_init();
1227 rx51_add_gpio_keys();
1229 rx51_init_tsc2005();
1231 spi_register_board_info(rx51_peripherals_spi_board_info
,
1232 ARRAY_SIZE(rx51_peripherals_spi_board_info
));
1234 partition
= omap_mux_get("core");
1236 omap_hsmmc_init(mmc
);
1238 rx51_charger_init();