Merge tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm...
[linux-2.6.git] / arch / arm / mach-omap2 / board-rx51-peripherals.c
index 17f3c91..f120997 100644 (file)
 #include <linux/input.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
+#include <linux/spi/tsc2005.h>
 #include <linux/i2c.h>
-#include <linux/i2c/twl4030.h>
+#include <linux/i2c/twl.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/regulator/machine.h>
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
 #include <linux/mmc/host.h>
+#include <linux/power/isp1704_charger.h>
+#include <asm/system_info.h>
 
 #include <plat/mcspi.h>
-#include <plat/mux.h>
 #include <plat/board.h>
-#include <plat/common.h>
+#include "common.h"
 #include <plat/dma.h>
 #include <plat/gpmc.h>
 #include <plat/onenand.h>
 #include <plat/gpmc-smc91x.h>
 
+#include <mach/board-rx51.h>
+
+#include <sound/tlv320aic3x.h>
+#include <sound/tpa6130a2-plat.h>
+#include <media/radio-si4713.h>
+#include <media/si4713.h>
+#include <linux/leds-lp5523.h>
+
+#include <../drivers/staging/iio/light/tsl2563.h>
+
 #include "mux.h"
-#include "mmc-twl4030.h"
+#include "hsmmc.h"
+#include "common-board-devices.h"
 
 #define SYSTEM_REV_B_USES_VAUX3        0x1699
 #define SYSTEM_REV_S_USES_VAUX3 0x8
 
 #define RX51_WL1251_POWER_GPIO         87
 #define RX51_WL1251_IRQ_GPIO           42
+#define RX51_FMTX_RESET_GPIO           163
+#define RX51_FMTX_IRQ                  53
+#define RX51_LP5523_CHIP_EN_GPIO       41
+
+#define RX51_USB_TRANSCEIVER_RST_GPIO  67
+
+#define RX51_TSC2005_RESET_GPIO         104
+#define RX51_TSC2005_IRQ_GPIO           100
 
 /* list all spi devices here */
 enum {
        RX51_SPI_WL1251,
+       RX51_SPI_MIPID,         /* LCD panel */
+       RX51_SPI_TSC2005,       /* Touch Controller */
 };
 
 static struct wl12xx_platform_data wl1251_pdata;
+static struct tsc2005_platform_data tsc2005_pdata;
+
+#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
+static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
+       .cover_comp_gain = 16,
+};
+#endif
+
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+static struct lp5523_led_config rx51_lp5523_led_config[] = {
+       {
+               .chan_nr        = 0,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 1,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 2,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 3,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 4,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 5,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 6,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 7,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 8,
+               .led_current    = 50,
+       }
+};
+
+static int rx51_lp5523_setup(void)
+{
+       return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
+                       "lp5523_enable");
+}
+
+static void rx51_lp5523_release(void)
+{
+       gpio_free(RX51_LP5523_CHIP_EN_GPIO);
+}
+
+static void rx51_lp5523_enable(bool state)
+{
+       gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
+}
+
+static struct lp5523_platform_data rx51_lp5523_platform_data = {
+       .led_config             = rx51_lp5523_led_config,
+       .num_channels           = ARRAY_SIZE(rx51_lp5523_led_config),
+       .clock_mode             = LP5523_CLOCK_AUTO,
+       .setup_resources        = rx51_lp5523_setup,
+       .release_resources      = rx51_lp5523_release,
+       .enable                 = rx51_lp5523_enable,
+};
+#endif
 
 static struct omap2_mcspi_device_config wl1251_mcspi_config = {
        .turbo_mode     = 0,
-       .single_channel = 1,
+};
+
+static struct omap2_mcspi_device_config mipid_mcspi_config = {
+       .turbo_mode     = 0,
+};
+
+static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
+       .turbo_mode     = 0,
 };
 
 static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
@@ -64,8 +159,48 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
                .controller_data        = &wl1251_mcspi_config,
                .platform_data          = &wl1251_pdata,
        },
+       [RX51_SPI_MIPID] = {
+               .modalias               = "acx565akm",
+               .bus_num                = 1,
+               .chip_select            = 2,
+               .max_speed_hz           = 6000000,
+               .controller_data        = &mipid_mcspi_config,
+       },
+       [RX51_SPI_TSC2005] = {
+               .modalias               = "tsc2005",
+               .bus_num                = 1,
+               .chip_select            = 0,
+               .irq                    = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
+               .max_speed_hz           = 6000000,
+               .controller_data        = &tsc2005_mcspi_config,
+               .platform_data          = &tsc2005_pdata,
+       },
+};
+
+static void rx51_charger_set_power(bool on)
+{
+       gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
+}
+
+static struct isp1704_charger_data rx51_charger_data = {
+       .set_power      = rx51_charger_set_power,
+};
+
+static struct platform_device rx51_charger_device = {
+       .name   = "isp1704_charger",
+       .dev    = {
+               .platform_data = &rx51_charger_data,
+       },
 };
 
+static void __init rx51_charger_init(void)
+{
+       WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
+               GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
+
+       platform_device_register(&rx51_charger_device);
+}
+
 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
 
 #define RX51_GPIO_CAMERA_LENS_COVER    110
@@ -146,7 +281,11 @@ static void __init rx51_add_gpio_keys(void)
 }
 #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
 
-static int board_keymap[] = {
+static uint32_t board_keymap[] = {
+       /*
+        * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
+        * connected to the ground" matrix state.
+        */
        KEY(0, 0, KEY_Q),
        KEY(0, 1, KEY_O),
        KEY(0, 2, KEY_P),
@@ -154,6 +293,7 @@ static int board_keymap[] = {
        KEY(0, 4, KEY_BACKSPACE),
        KEY(0, 6, KEY_A),
        KEY(0, 7, KEY_S),
+
        KEY(1, 0, KEY_W),
        KEY(1, 1, KEY_D),
        KEY(1, 2, KEY_F),
@@ -162,6 +302,7 @@ static int board_keymap[] = {
        KEY(1, 5, KEY_J),
        KEY(1, 6, KEY_K),
        KEY(1, 7, KEY_L),
+
        KEY(2, 0, KEY_E),
        KEY(2, 1, KEY_DOT),
        KEY(2, 2, KEY_UP),
@@ -169,6 +310,8 @@ static int board_keymap[] = {
        KEY(2, 5, KEY_Z),
        KEY(2, 6, KEY_X),
        KEY(2, 7, KEY_C),
+       KEY(2, 8, KEY_F9),
+
        KEY(3, 0, KEY_R),
        KEY(3, 1, KEY_V),
        KEY(3, 2, KEY_B),
@@ -177,20 +320,23 @@ static int board_keymap[] = {
        KEY(3, 5, KEY_SPACE),
        KEY(3, 6, KEY_SPACE),
        KEY(3, 7, KEY_LEFT),
+
        KEY(4, 0, KEY_T),
        KEY(4, 1, KEY_DOWN),
        KEY(4, 2, KEY_RIGHT),
        KEY(4, 4, KEY_LEFTCTRL),
        KEY(4, 5, KEY_RIGHTALT),
        KEY(4, 6, KEY_LEFTSHIFT),
+       KEY(4, 8, KEY_F10),
+
        KEY(5, 0, KEY_Y),
+       KEY(5, 8, KEY_F11),
+
        KEY(6, 0, KEY_U),
+
        KEY(7, 0, KEY_I),
        KEY(7, 1, KEY_F7),
        KEY(7, 2, KEY_F8),
-       KEY(0xff, 2, KEY_F9),
-       KEY(0xff, 4, KEY_F10),
-       KEY(0xff, 5, KEY_F11),
 };
 
 static struct matrix_keymap_data board_map_data = {
@@ -205,15 +351,53 @@ static struct twl4030_keypad_data rx51_kp_data = {
        .rep            = 1,
 };
 
-static struct twl4030_madc_platform_data rx51_madc_data = {
-       .irq_line               = 1,
+/* Enable input logic and pull all lines up when eMMC is on. */
+static struct omap_board_mux rx51_mmc2_on_mux[] = {
+       OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       { .reg_offset = OMAP_MUX_TERMINATOR },
+};
+
+/* Disable input logic and pull all lines down when eMMC is off. */
+static struct omap_board_mux rx51_mmc2_off_mux[] = {
+       OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
+       { .reg_offset = OMAP_MUX_TERMINATOR },
 };
 
-static struct twl4030_hsmmc_info mmc[] = {
+static struct omap_mux_partition *partition;
+
+/*
+ * Current flows to eMMC when eMMC is off and the data lines are pulled up,
+ * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
+ */
+static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
+{
+       if (power_on)
+               omap_mux_write_array(partition, rx51_mmc2_on_mux);
+       else
+               omap_mux_write_array(partition, rx51_mmc2_off_mux);
+}
+
+static struct omap2_hsmmc_info mmc[] __initdata = {
        {
                .name           = "external",
                .mmc            = 1,
-               .wires          = 4,
+               .caps           = MMC_CAP_4_BIT_DATA,
                .cover_only     = true,
                .gpio_cd        = 160,
                .gpio_wp        = -EINVAL,
@@ -222,25 +406,59 @@ static struct twl4030_hsmmc_info mmc[] = {
        {
                .name           = "internal",
                .mmc            = 2,
-               .wires          = 8,
+               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+                                               /* See also rx51_mmc2_remux */
                .gpio_cd        = -EINVAL,
                .gpio_wp        = -EINVAL,
                .nonremovable   = true,
                .power_saving   = true,
+               .remux          = rx51_mmc2_remux,
        },
        {}      /* Terminator */
 };
 
-static struct regulator_consumer_supply rx51_vmmc1_supply = {
-       .supply                 = "vmmc",
+static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
+       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
+};
+
+static struct regulator_consumer_supply rx51_vaux2_supply[] = {
+       REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
+};
+
+static struct regulator_consumer_supply rx51_vaux3_supply[] = {
+       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
+};
+
+static struct regulator_consumer_supply rx51_vsim_supply[] = {
+       REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
 };
 
-static struct regulator_consumer_supply rx51_vmmc2_supply = {
-       .supply                 = "vmmc",
+static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
+       /* tlv320aic3x analog supplies */
+       REGULATOR_SUPPLY("AVDD", "2-0018"),
+       REGULATOR_SUPPLY("DRVDD", "2-0018"),
+       REGULATOR_SUPPLY("AVDD", "2-0019"),
+       REGULATOR_SUPPLY("DRVDD", "2-0019"),
+       /* tpa6130a2 */
+       REGULATOR_SUPPLY("Vdd", "2-0060"),
+       /* Keep vmmc as last item. It is not iterated for newer boards */
+       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
 };
 
-static struct regulator_consumer_supply rx51_vsim_supply = {
-       .supply                 = "vmmc_aux",
+static struct regulator_consumer_supply rx51_vio_supplies[] = {
+       /* tlv320aic3x digital supplies */
+       REGULATOR_SUPPLY("IOVDD", "2-0018"),
+       REGULATOR_SUPPLY("DVDD", "2-0018"),
+       REGULATOR_SUPPLY("IOVDD", "2-0019"),
+       REGULATOR_SUPPLY("DVDD", "2-0019"),
+       /* Si4713 IO supply */
+       REGULATOR_SUPPLY("vio", "2-0063"),
+};
+
+static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
+       REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
+       /* Si4713 supply */
+       REGULATOR_SUPPLY("vdd", "2-0063"),
 };
 
 static struct regulator_init_data rx51_vaux1 = {
@@ -248,11 +466,14 @@ static struct regulator_init_data rx51_vaux1 = {
                .name                   = "V28",
                .min_uV                 = 2800000,
                .max_uV                 = 2800000,
+               .always_on              = true, /* due battery cover sensor */
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux1_consumers),
+       .consumer_supplies      = rx51_vaux1_consumers,
 };
 
 static struct regulator_init_data rx51_vaux2 = {
@@ -265,6 +486,8 @@ static struct regulator_init_data rx51_vaux2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux2_supply),
+       .consumer_supplies      = rx51_vaux2_supply,
 };
 
 /* VAUX3 - adds more power to VIO_18 rail */
@@ -293,8 +516,8 @@ static struct regulator_init_data rx51_vaux3_mmc = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vmmc2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux3_supply),
+       .consumer_supplies      = rx51_vaux3_supply,
 };
 
 static struct regulator_init_data rx51_vaux4 = {
@@ -320,15 +543,16 @@ static struct regulator_init_data rx51_vmmc1 = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vmmc1_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vmmc1_supply),
+       .consumer_supplies      = rx51_vmmc1_supply,
 };
 
 static struct regulator_init_data rx51_vmmc2 = {
        .constraints = {
-               .name                   = "VMMC2_30",
-               .min_uV                 = 1850000,
-               .max_uV                 = 3150000,
+               .name                   = "V28_A",
+               .min_uV                 = 2800000,
+               .max_uV                 = 3000000,
+               .always_on              = true, /* due VIO leak to AIC34 VDDs */
                .apply_uV               = true,
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
@@ -336,8 +560,34 @@ static struct regulator_init_data rx51_vmmc2 = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vmmc2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vmmc2_supplies),
+       .consumer_supplies      = rx51_vmmc2_supplies,
+};
+
+static struct regulator_init_data rx51_vpll1 = {
+       .constraints = {
+               .name                   = "VPLL",
+               .min_uV                 = 1800000,
+               .max_uV                 = 1800000,
+               .apply_uV               = true,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct regulator_init_data rx51_vpll2 = {
+       .constraints = {
+               .name                   = "VSDI_CSI",
+               .min_uV                 = 1800000,
+               .max_uV                 = 1800000,
+               .apply_uV               = true,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
 };
 
 static struct regulator_init_data rx51_vsim = {
@@ -351,11 +601,11 @@ static struct regulator_init_data rx51_vsim = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vsim_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vsim_supply),
+       .consumer_supplies      = rx51_vsim_supply,
 };
 
-static struct regulator_init_data rx51_vdac = {
+static struct regulator_init_data rx51_vio = {
        .constraints = {
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
@@ -365,21 +615,87 @@ static struct regulator_init_data rx51_vdac = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vio_supplies),
+       .consumer_supplies      = rx51_vio_supplies,
 };
 
+static struct regulator_init_data rx51_vintana1 = {
+       .constraints = {
+               .name                   = "VINTANA1",
+               .min_uV                 = 1500000,
+               .max_uV                 = 1500000,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct regulator_init_data rx51_vintana2 = {
+       .constraints = {
+               .name                   = "VINTANA2",
+               .min_uV                 = 2750000,
+               .max_uV                 = 2750000,
+               .apply_uV               = true,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct regulator_init_data rx51_vintdig = {
+       .constraints = {
+               .name                   = "VINTDIG",
+               .min_uV                 = 1500000,
+               .max_uV                 = 1500000,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
+       .gpio_reset     = RX51_FMTX_RESET_GPIO,
+};
+
+static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
+       I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
+       .platform_data  = &rx51_si4713_i2c_data,
+};
+
+static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
+       .i2c_bus        = 2,
+       .subdev_board_info = &rx51_si4713_board_info,
+};
+
+static struct platform_device rx51_si4713_dev = {
+       .name   = "radio-si4713",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &rx51_si4713_data,
+       },
+};
+
+static __init void rx51_init_si4713(void)
+{
+       int err;
+
+       err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
+       if (err) {
+               printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
+               return;
+       }
+       rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
+       platform_device_register(&rx51_si4713_dev);
+}
+
 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
 {
        /* FIXME this gpio setup is just a placeholder for now */
-       gpio_request(gpio + 6, "backlight_pwm");
-       gpio_direction_output(gpio + 6, 0);
-       gpio_request(gpio + 7, "speaker_en");
-       gpio_direction_output(gpio + 7, 1);
-
-       /* set up MMC adapters, linking their regulators to them */
-       twl4030_mmc_init(mmc);
-       rx51_vmmc1_supply.dev = mmc[0].dev;
-       rx51_vmmc2_supply.dev = mmc[1].dev;
-       rx51_vsim_supply.dev = mmc[1].dev;
+       gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
+       gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "speaker_en");
 
        return 0;
 }
@@ -396,10 +712,6 @@ static struct twl4030_gpio_platform_data rx51_gpio_data = {
        .setup                  = rx51_twlgpio_setup,
 };
 
-static struct twl4030_usb_data rx51_usb_data = {
-       .usb_mode               = T2_USB_MODE_ULPI,
-};
-
 static struct twl4030_ins sleep_on_seq[] __initdata = {
 /*
  * Turn off everything
@@ -549,7 +861,7 @@ static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
        { .resource = RES_RESET, .devgroup = -1,
          .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
        },
-       { .resource = RES_Main_Ref, .devgroup = -1,
+       { .resource = RES_MAIN_REF, .devgroup = -1,
          .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
        },
        { 0, 0},
@@ -561,48 +873,105 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = {
        .resource_config = twl4030_rconfig,
 };
 
+struct twl4030_vibra_data rx51_vibra_data __initdata = {
+       .coexist        = 0,
+};
 
+struct twl4030_audio_data rx51_audio_data __initdata = {
+       .audio_mclk     = 26000000,
+       .vibra          = &rx51_vibra_data,
+};
 
 static struct twl4030_platform_data rx51_twldata __initdata = {
-       .irq_base               = TWL4030_IRQ_BASE,
-       .irq_end                = TWL4030_IRQ_END,
-
        /* platform_data for children goes here */
        .gpio                   = &rx51_gpio_data,
        .keypad                 = &rx51_kp_data,
-       .madc                   = &rx51_madc_data,
-       .usb                    = &rx51_usb_data,
        .power                  = &rx51_t2scripts_data,
+       .audio                  = &rx51_audio_data,
 
        .vaux1                  = &rx51_vaux1,
        .vaux2                  = &rx51_vaux2,
        .vaux4                  = &rx51_vaux4,
        .vmmc1                  = &rx51_vmmc1,
+       .vpll1                  = &rx51_vpll1,
+       .vpll2                  = &rx51_vpll2,
        .vsim                   = &rx51_vsim,
-       .vdac                   = &rx51_vdac,
+       .vintana1               = &rx51_vintana1,
+       .vintana2               = &rx51_vintana2,
+       .vintdig                = &rx51_vintdig,
+       .vio                    = &rx51_vio,
+};
+
+static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module = {
+       .power_gpio             = 98,
+};
+
+/* Audio setup data */
+static struct aic3x_setup_data rx51_aic34_setup = {
+       .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
+       .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT,
 };
 
-static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
+static struct aic3x_pdata rx51_aic3x_data = {
+       .setup = &rx51_aic34_setup,
+       .gpio_reset = 60,
+};
+
+static struct aic3x_pdata rx51_aic3x_data2 = {
+       .gpio_reset = 60,
+};
+
+static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
+       {
+               I2C_BOARD_INFO("tlv320aic3x", 0x18),
+               .platform_data = &rx51_aic3x_data,
+       },
        {
-               I2C_BOARD_INFO("twl5030", 0x48),
-               .flags = I2C_CLIENT_WAKE,
-               .irq = INT_34XX_SYS_NIRQ,
-               .platform_data = &rx51_twldata,
+               I2C_BOARD_INFO("tlv320aic3x", 0x19),
+               .platform_data = &rx51_aic3x_data2,
        },
+#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
+       {
+               I2C_BOARD_INFO("tsl2563", 0x29),
+               .platform_data = &rx51_tsl2563_platform_data,
+       },
+#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+       {
+               I2C_BOARD_INFO("lp5523", 0x32),
+               .platform_data  = &rx51_lp5523_platform_data,
+       },
+#endif
+       {
+               I2C_BOARD_INFO("bq27200", 0x55),
+       },
+       {
+               I2C_BOARD_INFO("tpa6130a2", 0x60),
+               .platform_data = &rx51_tpa6130a2_data,
+       }
 };
 
 static int __init rx51_i2c_init(void)
 {
        if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
-           system_rev >= SYSTEM_REV_B_USES_VAUX3)
+           system_rev >= SYSTEM_REV_B_USES_VAUX3) {
                rx51_twldata.vaux3 = &rx51_vaux3_mmc;
-       else {
+               /* Only older boards use VMMC2 for internal MMC */
+               rx51_vmmc2.num_consumer_supplies--;
+       } else {
                rx51_twldata.vaux3 = &rx51_vaux3_cam;
-               rx51_twldata.vmmc2 = &rx51_vmmc2;
        }
-       omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
-                       ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
-       omap_register_i2c_bus(2, 100, NULL, 0);
+       rx51_twldata.vmmc2 = &rx51_vmmc2;
+       omap3_pmic_get_config(&rx51_twldata,
+                       TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC,
+                       TWL_COMMON_REGULATOR_VDAC);
+
+       rx51_twldata.vdac->constraints.apply_uV = true;
+       rx51_twldata.vdac->constraints.name = "VDAC";
+
+       omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
+       omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
+                             ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
        omap_register_i2c_bus(3, 400, NULL, 0);
        return 0;
 }
@@ -644,25 +1013,15 @@ static struct mtd_partition onenand_partitions[] = {
        },
 };
 
-static struct omap_onenand_platform_data board_onenand_data = {
-       .cs             = 0,
-       .gpio_irq       = 65,
-       .parts          = onenand_partitions,
-       .nr_parts       = ARRAY_SIZE(onenand_partitions),
-       .flags          = ONENAND_SYNC_READWRITE,
+static struct omap_onenand_platform_data board_onenand_data[] = {
+       {
+               .cs             = 0,
+               .gpio_irq       = 65,
+               .parts          = onenand_partitions,
+               .nr_parts       = ARRAY_SIZE(onenand_partitions),
+               .flags          = ONENAND_SYNC_READWRITE,
+       }
 };
-
-static void __init board_onenand_init(void)
-{
-       gpmc_onenand_init(&board_onenand_data);
-}
-
-#else
-
-static inline void board_onenand_init(void)
-{
-}
-
 #endif
 
 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
@@ -697,26 +1056,20 @@ static void rx51_wl1251_set_power(bool enable)
        gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
 }
 
+static struct gpio rx51_wl1251_gpios[] __initdata = {
+       { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW,   "wl1251 power"  },
+       { RX51_WL1251_IRQ_GPIO,   GPIOF_IN,             "wl1251 irq"    },
+};
+
 static void __init rx51_init_wl1251(void)
 {
        int irq, ret;
 
-       ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
+       ret = gpio_request_array(rx51_wl1251_gpios,
+                                ARRAY_SIZE(rx51_wl1251_gpios));
        if (ret < 0)
                goto error;
 
-       ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
-       if (ret < 0)
-               goto err_power;
-
-       ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
-       if (ret < 0)
-               goto err_power;
-
-       ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
-       if (ret < 0)
-               goto err_irq;
-
        irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
        if (irq < 0)
                goto err_irq;
@@ -728,10 +1081,7 @@ static void __init rx51_init_wl1251(void)
 
 err_irq:
        gpio_free(RX51_WL1251_IRQ_GPIO);
-
-err_power:
        gpio_free(RX51_WL1251_POWER_GPIO);
-
 error:
        printk(KERN_ERR "wl1251 board initialisation failed\n");
        wl1251_pdata.set_power = NULL;
@@ -742,14 +1092,62 @@ error:
         */
 }
 
+static struct tsc2005_platform_data tsc2005_pdata = {
+       .ts_pressure_max        = 2048,
+       .ts_pressure_fudge      = 2,
+       .ts_x_max               = 4096,
+       .ts_x_fudge             = 4,
+       .ts_y_max               = 4096,
+       .ts_y_fudge             = 7,
+       .ts_x_plate_ohm         = 280,
+       .esd_timeout_ms         = 8000,
+};
+
+static struct gpio rx51_tsc2005_gpios[] __initdata = {
+       { RX51_TSC2005_IRQ_GPIO,   GPIOF_IN,            "tsc2005 IRQ"   },
+       { RX51_TSC2005_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "tsc2005 reset" },
+};
+
+static void rx51_tsc2005_set_reset(bool enable)
+{
+       gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
+}
+
+static void __init rx51_init_tsc2005(void)
+{
+       int r;
+
+       omap_mux_init_gpio(RX51_TSC2005_RESET_GPIO, OMAP_PIN_OUTPUT);
+       omap_mux_init_gpio(RX51_TSC2005_IRQ_GPIO, OMAP_PIN_INPUT_PULLUP);
+
+       r = gpio_request_array(rx51_tsc2005_gpios,
+                              ARRAY_SIZE(rx51_tsc2005_gpios));
+       if (r < 0) {
+               printk(KERN_ERR "tsc2005 board initialization failed\n");
+               tsc2005_pdata.esd_timeout_ms = 0;
+               return;
+       }
+
+       tsc2005_pdata.set_reset = rx51_tsc2005_set_reset;
+}
+
 void __init rx51_peripherals_init(void)
 {
        rx51_i2c_init();
-       board_onenand_init();
+       regulator_has_full_constraints();
+       gpmc_onenand_init(board_onenand_data);
        board_smc91x_init();
        rx51_add_gpio_keys();
        rx51_init_wl1251();
+       rx51_init_tsc2005();
+       rx51_init_si4713();
        spi_register_board_info(rx51_peripherals_spi_board_info,
                                ARRAY_SIZE(rx51_peripherals_spi_board_info));
+
+       partition = omap_mux_get("core");
+       if (partition)
+               omap_hsmmc_init(mmc);
+
+       rx51_charger_init();
 }