* published by the Free Software Foundation.
  */
 
+#include <linux/platform_device.h>
+
+#include <linux/i2c/tps65010.h>
+
 #include <mach/mmc.h>
 #include <mach/gpio.h>
 #include <mach/mmc.h>
 
-#ifdef CONFIG_MMC_OMAP
-static int slot_cover_open;
-static struct device *mmc_device;
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-static int h2_mmc_set_power(struct device *dev, int slot, int power_on,
+static int mmc_set_power(struct device *dev, int slot, int power_on,
                                int vdd)
 {
-#ifdef CONFIG_MMC_DEBUG
-       dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
-               power_on ? "on" : "off", vdd);
-#endif
-       if (slot != 0) {
-               dev_err(dev, "No such slot %d\n", slot + 1);
-               return -ENODEV;
-       }
-
-       return 0;
-}
-
-static int h2_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
-{
-#ifdef CONFIG_MMC_DEBUG
-       dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
-               bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
-#endif
-       if (slot != 0) {
-               dev_err(dev, "No such slot %d\n", slot + 1);
-               return -ENODEV;
-       }
+       if (power_on)
+               gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 1);
+       else
+               gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
 
        return 0;
 }
 
-static int h2_mmc_get_cover_state(struct device *dev, int slot)
-{
-       BUG_ON(slot != 0);
-
-       return slot_cover_open;
-}
-
-void h2_mmc_slot_cover_handler(void *arg, int state)
-{
-       if (mmc_device == NULL)
-               return;
-
-       slot_cover_open = state;
-       omap_mmc_notify_cover_event(mmc_device, 0, state);
-}
-
-static int h2_mmc_late_init(struct device *dev)
-{
-       int ret = 0;
-
-       mmc_device = dev;
-
-       return ret;
-}
-
-static void h2_mmc_cleanup(struct device *dev)
-{
-}
-
-static struct omap_mmc_platform_data h2_mmc_data = {
+/*
+ * H2 could use the following functions tested:
+ * - mmc_get_cover_state that uses OMAP_MPUIO(1)
+ * - mmc_get_wp that uses OMAP_MPUIO(3)
+ */
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots                       = 1,
-       .switch_slot                    = NULL,
-       .init                           = h2_mmc_late_init,
-       .cleanup                        = h2_mmc_cleanup,
+       .dma_mask                       = 0xffffffff,
        .slots[0]       = {
-               .enabled                = 1,
-               .wire4                  = 1,
-               .set_power              = h2_mmc_set_power,
-               .set_bus_mode           = h2_mmc_set_bus_mode,
-               .get_ro                 = NULL,
-               .get_cover_state        = h2_mmc_get_cover_state,
+               .set_power              = mmc_set_power,
                .ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
                                          MMC_VDD_32_33 | MMC_VDD_33_34,
                .name                   = "mmcblk",
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
+
 void __init h2_mmc_init(void)
 {
-       omap1_init_mmc(&h2_mmc_data);
+       int ret;
+
+       ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
+       if (ret < 0)
+               return;
+       gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
+
+       mmc_data[0] = &mmc1_data;
+       omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
 }
 
 #else
 {
 }
 
-void h2_mmc_slot_cover_handler(void *arg, int state)
-{
-}
 #endif
 
        }
 }
 
+static int tps_setup(struct i2c_client *client, void *context)
+{
+       tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V |
+                               TPS_LDO1_ENABLE | TPS_VLDO1_3_0V);
+
+       return 0;
+}
+
+static struct tps65010_board tps_board = {
+       .base           = H2_TPS_GPIO_BASE,
+       .outmask        = 0x0f,
+       .setup          = tps_setup,
+};
+
 static struct i2c_board_info __initdata h2_i2c_board_info[] = {
        {
                I2C_BOARD_INFO("tps65010", 0x48),
                .irq            = OMAP_GPIO_IRQ(58),
+               .platform_data  = &tps_board,
        }, {
                I2C_BOARD_INFO("isp1301_omap", 0x2d),
                .irq            = OMAP_GPIO_IRQ(2),
        { OMAP_TAG_LCD,         &h2_lcd_config },
 };
 
-static struct omap_gpio_switch h2_gpio_switches[] __initdata = {
-       {
-               .name                   = "mmc_slot",
-               .gpio                   = OMAP_MPUIO(1),
-               .type                   = OMAP_GPIO_SWITCH_TYPE_COVER,
-               .debounce_rising        = 100,
-               .debounce_falling       = 0,
-               .notify                 = h2_mmc_slot_cover_handler,
-               .notify_data            = NULL,
-       },
-};
-
 #define H2_NAND_RB_GPIO_PIN    62
 
 static int h2_nand_dev_ready(struct omap_nand_platform_data *data)
        omap_register_i2c_bus(1, 100, h2_i2c_board_info,
                              ARRAY_SIZE(h2_i2c_board_info));
        h2_mmc_init();
-       omap_register_gpio_switches(h2_gpio_switches,
-                                   ARRAY_SIZE(h2_gpio_switches));
 }
 
 static void __init h2_map_io(void)
 
  * published by the Free Software Foundation.
  */
 
+#include <linux/platform_device.h>
+
+#include <linux/i2c/tps65010.h>
+
 #include <mach/mmc.h>
 #include <mach/gpio.h>
 #include <mach/mmc.h>
 
-#ifdef CONFIG_MMC_OMAP
-static int slot_cover_open;
-static struct device *mmc_device;
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-static int h3_mmc_set_power(struct device *dev, int slot, int power_on,
+static int mmc_set_power(struct device *dev, int slot, int power_on,
                                int vdd)
 {
-#ifdef CONFIG_MMC_DEBUG
-       dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
-               power_on ? "on" : "off", vdd);
-#endif
-       if (slot != 0) {
-               dev_err(dev, "No such slot %d\n", slot + 1);
-               return -ENODEV;
-       }
+       if (power_on)
+               gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 1);
+       else
+               gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
 
        return 0;
 }
 
-static int h3_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
-{
-       int ret = 0;
-
-#ifdef CONFIG_MMC_DEBUG
-       dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
-               bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
-#endif
-       if (slot != 0) {
-               dev_err(dev, "No such slot %d\n", slot + 1);
-               return -ENODEV;
-       }
-
-       /* Treated on upper level */
-
-       return bus_mode;
-}
-
-static int h3_mmc_get_cover_state(struct device *dev, int slot)
-{
-       BUG_ON(slot != 0);
-
-       return slot_cover_open;
-}
-
-void h3_mmc_slot_cover_handler(void *arg, int state)
-{
-       if (mmc_device == NULL)
-               return;
-
-       slot_cover_open = state;
-       omap_mmc_notify_cover_event(mmc_device, 0, state);
-}
-
-static int h3_mmc_late_init(struct device *dev)
-{
-       int ret = 0;
-
-       mmc_device = dev;
-
-       return ret;
-}
-
-static void h3_mmc_cleanup(struct device *dev)
-{
-}
-
-static struct omap_mmc_platform_data h3_mmc_data = {
+/*
+ * H3 could use the following functions tested:
+ * - mmc_get_cover_state that uses OMAP_MPUIO(1)
+ * - mmc_get_wp that maybe uses OMAP_MPUIO(3)
+ */
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots                       = 1,
-       .switch_slot                    = NULL,
-       .init                           = h3_mmc_late_init,
-       .cleanup                        = h3_mmc_cleanup,
+       .dma_mask                       = 0xffffffff,
        .slots[0]       = {
-               .enabled                = 1,
-               .wire4                  = 1,
-               .set_power              = h3_mmc_set_power,
-               .set_bus_mode           = h3_mmc_set_bus_mode,
-               .get_ro                 = NULL,
-               .get_cover_state        = h3_mmc_get_cover_state,
+               .set_power              = mmc_set_power,
                .ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
                                          MMC_VDD_32_33 | MMC_VDD_33_34,
                .name                   = "mmcblk",
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
+
 void __init h3_mmc_init(void)
 {
-       omap1_init_mmc(&h3_mmc_data);
+       int ret;
+
+       ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
+       if (ret < 0)
+               return;
+       gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
+
+       mmc_data[0] = &mmc1_data;
+       omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
 }
 
 #else
 {
 }
 
-void h3_mmc_slot_cover_handler(void *arg, int state)
-{
-}
 #endif
 
        { OMAP_TAG_LCD,         &h3_lcd_config },
 };
 
-static struct omap_gpio_switch h3_gpio_switches[] __initdata = {
-       {
-               .name                   = "mmc_slot",
-               .gpio                   = OMAP_MPUIO(1),
-               .type                   = OMAP_GPIO_SWITCH_TYPE_COVER,
-               .debounce_rising        = 100,
-               .debounce_falling       = 0,
-               .notify                 = h3_mmc_slot_cover_handler,
-               .notify_data            = NULL,
-       },
-};
-
 #define H3_NAND_RB_GPIO_PIN    10
 
 static int nand_dev_ready(struct omap_nand_platform_data *data)
        omap_register_i2c_bus(1, 100, h3_i2c_board_info,
                              ARRAY_SIZE(h3_i2c_board_info));
        h3_mmc_init();
-       omap_register_gpio_switches(h3_gpio_switches,
-                                   ARRAY_SIZE(h3_gpio_switches));
 }
 
 static void __init h3_init_smc91x(void)
 
 };
 #endif
 
-static struct omap_mmc_platform_data innovator_mmc_data = {
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+
+static int mmc_set_power(struct device *dev, int slot, int power_on,
+                               int vdd)
+{
+       if (power_on)
+               fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3),
+                               OMAP1510_FPGA_POWER);
+       else
+               fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3),
+                               OMAP1510_FPGA_POWER);
+
+       return 0;
+}
+
+/*
+ * Innovator could use the following functions tested:
+ * - mmc_get_wp that uses OMAP_MPUIO(3)
+ * - mmc_get_cover_state that uses FPGA F4 UIO43
+ */
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots                       = 1,
        .slots[0]       = {
-               .enabled                = 1,
+               .set_power              = mmc_set_power,
                .wire4                  = 1,
-               .wp_pin                 = OMAP_MPUIO(3),
-               .power_pin              = -1,   /* FPGA F3 UIO42 */
-               .switch_pin             = -1,   /* FPGA F4 UIO43 */
                .name                   = "mmcblk",
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
+
+void __init innovator_mmc_init(void)
+{
+       mmc_data[0] = &mmc1_data;
+       omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
+}
+
+#else
+static inline void innovator_mmc_init(void)
+{
+}
+#endif
+
 static struct omap_uart_config innovator_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
        omap_board_config_size = ARRAY_SIZE(innovator_config);
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
-       omap1_init_mmc(&innovator_mmc_data);
+       innovator_mmc_init();
 }
 
 static void __init innovator_map_io(void)
 
        .pins[0]        = 6,
 };
 
-static struct omap_mmc_platform_data nokia770_mmc_data = {
-       .nr_slots                       = 2,
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+
+#define NOKIA770_GPIO_MMC_POWER                41
+#define NOKIA770_GPIO_MMC_SWITCH       23
+
+static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on,
+                               int vdd)
+{
+       if (power_on)
+               gpio_set_value(NOKIA770_GPIO_MMC_POWER, 1);
+       else
+               gpio_set_value(NOKIA770_GPIO_MMC_POWER, 0);
+
+       return 0;
+}
+
+static int nokia770_mmc_get_cover_state(struct device *dev, int slot)
+{
+       return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH);
+}
+
+static struct omap_mmc_platform_data nokia770_mmc2_data = {
+       .nr_slots                       = 1,
+       .dma_mask                       = 0xffffffff,
        .slots[0]       = {
-               .enabled                = 0,
-               .wire4                  = 0,
-               .wp_pin                 = -1,
-               .power_pin              = -1,
-               .switch_pin             = -1,
+               .set_power              = nokia770_mmc_set_power,
+               .get_cover_state        = nokia770_mmc_get_cover_state,
                .name                   = "mmcblk",
        },
-       .slots[1]       = {
-               .enabled                = 0,
-               .wire4                  = 0,
-               .wp_pin                 = -1,
-               .power_pin              = -1,
-               .switch_pin             = -1,
-               .name                   = "mmcblk",
-       },
-
 };
 
+static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC];
+
+static void __init nokia770_mmc_init(void)
+{
+       int ret;
+
+       ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
+       if (ret < 0)
+               return;
+       gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
+
+       ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
+       if (ret < 0) {
+               gpio_free(NOKIA770_GPIO_MMC_POWER);
+               return;
+       }
+       gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
+
+       /* Only the second MMC controller is used */
+       nokia770_mmc_data[1] = &nokia770_mmc2_data;
+       omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC);
+}
+
+#else
+static inline void nokia770_mmc_init(void)
+{
+}
+#endif
+
 static struct omap_board_config_kernel nokia770_config[] __initdata = {
        { OMAP_TAG_USB,         NULL },
 };
        hwa742_dev_init();
        ads7846_dev_init();
        mipid_dev_init();
-       omap1_init_mmc(&nokia770_mmc_data);
+       nokia770_mmc_init();
 }
 
 static void __init omap_nokia770_map_io(void)
 
 #include <mach/mcbsp.h>
 #include <mach/omap-alsa.h>
 #include <mach/gpio-switch.h>
-#include <mach/mmc.h>
 
 static void __init omap_palmte_init_irq(void)
 {
        .pins[0]        = 2,
 };
 
-static struct omap_mmc_platform_data palmzte_mmc_data = {
-       .nr_slots                       = 1,
-       .slots[0]       = {
-               .enabled                = 1,
-               .wp_pin                 = PALMTE_MMC_WP_GPIO,
-               .power_pin              = PALMTE_MMC_POWER_GPIO,
-               .switch_pin             = PALMTE_MMC_SWITCH_GPIO,
-               .name                   = "mmcblk",
-       },
-};
-
 static struct omap_lcd_config palmte_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
        palmte_misc_gpio_setup();
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
-       omap1_init_mmc(&palmte_mmc_data);
 }
 
 static void __init omap_palmte_map_io(void)
 
 #include <mach/keypad.h>
 #include <mach/common.h>
 #include <mach/omap-alsa.h>
-#include <mach/mmc.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
        .pins[0]        = 2,
 };
 
-static struct omap_mmc_platform_data palmz71_mmc_data = {
-       .nr_slots                       = 1,
-       .slots[0]       = {
-               .enabled                = 1,
-               .wire4                  = 0,
-               .wp_pin                 = PALMZ71_MMC_WP_GPIO,
-               .power_pin              = -1,
-               .switch_pin             = PALMZ71_MMC_IN_GPIO,
-               .name                   = "mmcblk",
-       },
-};
-
 static struct omap_lcd_config palmz71_lcd_config __initdata = {
        .ctrl_name = "internal",
 };
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
        palmz71_gpio_setup(0);
-       omap1_init_mmc(&palmz71_mmc_data);
 }
 
 static void __init
 
 #include <mach/mmc.h>
 #include <mach/gpio.h>
 
-#ifdef CONFIG_MMC_OMAP
-static int slot_cover_open;
-static struct device *mmc_device;
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-static int sx1_mmc_set_power(struct device *dev, int slot, int power_on,
+static int mmc_set_power(struct device *dev, int slot, int power_on,
                                int vdd)
 {
        int err;
        u8 dat = 0;
 
-#ifdef CONFIG_MMC_DEBUG
-       dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
-               power_on ? "on" : "off", vdd);
-#endif
-
-       if (slot != 0) {
-               dev_err(dev, "No such slot %d\n", slot + 1);
-               return -ENODEV;
-       }
-
        err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
        if (err < 0)
                return err;
        return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
 }
 
-static int sx1_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
-{
-#ifdef CONFIG_MMC_DEBUG
-       dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
-               bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
-#endif
-       if (slot != 0) {
-               dev_err(dev, "No such slot %d\n", slot + 1);
-               return -ENODEV;
-       }
-
-       return 0;
-}
-
-static int sx1_mmc_get_cover_state(struct device *dev, int slot)
-{
-       BUG_ON(slot != 0);
-
-       return slot_cover_open;
-}
-
-void sx1_mmc_slot_cover_handler(void *arg, int state)
-{
-       if (mmc_device == NULL)
-               return;
-
-       slot_cover_open = state;
-       omap_mmc_notify_cover_event(mmc_device, 0, state);
-}
-
-static int sx1_mmc_late_init(struct device *dev)
-{
-       int ret = 0;
-
-       mmc_device = dev;
-
-       return ret;
-}
-
-static void sx1_mmc_cleanup(struct device *dev)
-{
-}
-
-static struct omap_mmc_platform_data sx1_mmc_data = {
+/* Cover switch is at OMAP_MPUIO(3) */
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots                       = 1,
-       .switch_slot                    = NULL,
-       .init                           = sx1_mmc_late_init,
-       .cleanup                        = sx1_mmc_cleanup,
        .slots[0]       = {
-               .enabled                = 1,
-               .wire4                  = 0,
-               .set_power              = sx1_mmc_set_power,
-               .set_bus_mode           = sx1_mmc_set_bus_mode,
-               .get_ro                 = NULL,
-               .get_cover_state        = sx1_mmc_get_cover_state,
+               .set_power              = mmc_set_power,
                .ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
                                          MMC_VDD_32_33 | MMC_VDD_33_34,
                .name                   = "mmcblk",
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP15XX_NR_MMC];
+
 void __init sx1_mmc_init(void)
 {
-       omap1_init_mmc(&sx1_mmc_data);
+       mmc_data[0] = &mmc1_data;
+       omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
 }
 
 #else
 {
 }
 
-void sx1_mmc_slot_cover_handler(void *arg, int state)
-{
-}
 #endif
 
        { OMAP_TAG_UART,        &sx1_uart_config },
 };
 
-static struct omap_gpio_switch sx1_gpio_switches[] __initdata = {
-       {
-               .name                   = "mmc_slot",
-               .gpio                   = OMAP_MPUIO(3),
-               .type                   = OMAP_GPIO_SWITCH_TYPE_COVER,
-               .debounce_rising        = 100,
-               .debounce_falling       = 0,
-               .notify                 = sx1_mmc_slot_cover_handler,
-               .notify_data            = NULL,
-       },
-};
-
 /*-----------------------------------------*/
 
 static void __init omap_sx1_init(void)
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
        sx1_mmc_init();
-       omap_register_gpio_switches(sx1_gpio_switches,
-                                   ARRAY_SIZE(sx1_gpio_switches));
 
        /* turn on USB power */
        /* sx1_setusbpower(1); cant do it here because i2c is not ready */
 
 #include <mach/mux.h>
 #include <mach/tc.h>
 #include <mach/usb.h>
-#include <mach/mmc.h>
 
 static struct plat_serial8250_port voiceblue_ports[] = {
        {
        .pins[2]        = 6,
 };
 
-static struct omap_mmc_platform_data voiceblue_mmc_data = {
-       .nr_slots                       = 1,
-       .slots[0]       = {
-               .enabled                = 1,
-               .power_pin              = 2,
-               .switch_pin             = -1,
-               .name                   = "mmcblk",
-       },
-};
-
 static struct omap_uart_config voiceblue_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
         * (it is connected through invertor) */
        omap_writeb(0x00, OMAP_LPG1_LCR);
        omap_writeb(0x00, OMAP_LPG1_PMR);       /* Disable clock */
-
-       omap1_init_mmc(&voiceblue_mmc_data);
 }
 
 static void __init voiceblue_map_io(void)
 
 
 static struct clk mmc1_ck = {
        .name           = "mmc_ck",
-       .id             = 1,
        /* Functional clock is direct from ULPD, interface clock is ARMPER */
        .parent         = &armper_ck.clk,
        .rate           = 48000000,
 
 static struct clk mmc2_ck = {
        .name           = "mmc_ck",
-       .id             = 2,
+       .id             = 1,
        /* Functional clock is direct from ULPD, interface clock is ARMPER */
        .parent         = &armper_ck.clk,
        .rate           = 48000000,
 
 
 #if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
-#define        OMAP1_MMC1_BASE         0xfffb7800
-#define        OMAP1_MMC1_END          (OMAP1_MMC1_BASE + 0x7f)
-#define OMAP1_MMC1_INT         INT_MMC
-
-#define        OMAP1_MMC2_BASE         0xfffb7c00      /* omap16xx only */
-#define        OMAP1_MMC2_END          (OMAP1_MMC2_BASE + 0x7f)
-#define        OMAP1_MMC2_INT          INT_1610_MMC2
-
-static u64 omap1_mmc1_dmamask = 0xffffffff;
-
-static struct resource omap1_mmc1_resources[] = {
-       {
-               .start          = OMAP1_MMC1_BASE,
-               .end            = OMAP1_MMC1_END,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP1_MMC1_INT,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device omap1_mmc1_device = {
-       .name           = "mmci-omap",
-       .id             = 1,
-       .dev = {
-               .dma_mask       = &omap1_mmc1_dmamask,
-       },
-       .num_resources  = ARRAY_SIZE(omap1_mmc1_resources),
-       .resource       = omap1_mmc1_resources,
-};
-
-#if defined(CONFIG_ARCH_OMAP16XX)
-
-static u64 omap1_mmc2_dmamask = 0xffffffff;
-
-static struct resource omap1_mmc2_resources[] = {
-       {
-               .start          = OMAP1_MMC2_BASE,
-               .end            = OMAP1_MMC2_END,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP1_MMC2_INT,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device omap1_mmc2_device = {
-       .name           = "mmci-omap",
-       .id             = 2,
-       .dev = {
-               .dma_mask       = &omap1_mmc2_dmamask,
-       },
-       .num_resources  = ARRAY_SIZE(omap1_mmc2_resources),
-       .resource       = omap1_mmc2_resources,
-};
-#define OMAP1_MMC2_DEVICE      &omap1_mmc2_device
-#else
-#define OMAP1_MMC2_DEVICE      &omap1_mmc1_device      /* Dummy */
-#endif
-
-static inline void omap1_mmc_mux(struct omap_mmc_platform_data *info)
+static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
+                       int controller_nr)
 {
-       if (info->slots[0].enabled) {
+       if (controller_nr == 0) {
                omap_cfg_reg(MMC_CMD);
                omap_cfg_reg(MMC_CLK);
                omap_cfg_reg(MMC_DAT0);
                        omap_cfg_reg(P19_1710_MMC_CMDDIR);
                        omap_cfg_reg(P20_1710_MMC_DATDIR0);
                }
-               if (info->slots[0].wire4) {
+               if (mmc_controller->slots[0].wire4) {
                        omap_cfg_reg(MMC_DAT1);
                        /* NOTE: DAT2 can be on W10 (here) or M15 */
-                       if (!info->slots[0].nomux)
+                       if (!mmc_controller->slots[0].nomux)
                                omap_cfg_reg(MMC_DAT2);
                        omap_cfg_reg(MMC_DAT3);
                }
        }
 
        /* Block 2 is on newer chips, and has many pinout options */
-       if (cpu_is_omap16xx() && info->slots[1].enabled) {
-               if (!info->slots[1].nomux) {
+       if (cpu_is_omap16xx() && controller_nr == 1) {
+               if (!mmc_controller->slots[1].nomux) {
                        omap_cfg_reg(Y8_1610_MMC2_CMD);
                        omap_cfg_reg(Y10_1610_MMC2_CLK);
                        omap_cfg_reg(R18_1610_MMC2_CLKIN);
                        omap_cfg_reg(W8_1610_MMC2_DAT0);
-                       if (info->slots[1].wire4) {
+                       if (mmc_controller->slots[1].wire4) {
                                omap_cfg_reg(V8_1610_MMC2_DAT1);
                                omap_cfg_reg(W15_1610_MMC2_DAT2);
                                omap_cfg_reg(R10_1610_MMC2_DAT3);
        }
 }
 
-void omap1_init_mmc(struct omap_mmc_platform_data *info)
+void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                       int nr_controllers)
 {
-       if (!info)
-               return;
-
-       omap1_mmc_mux(info);
-       platform_set_drvdata(&omap1_mmc1_device, info);
-
-       if (cpu_is_omap16xx())
-               platform_set_drvdata(OMAP1_MMC2_DEVICE, info);
+       int i;
+
+       for (i = 0; i < nr_controllers; i++) {
+               unsigned long base, size;
+               unsigned int irq = 0;
+
+               if (!mmc_data[i])
+                       continue;
+
+               omap1_mmc_mux(mmc_data[i], i);
+
+               switch (i) {
+               case 0:
+                       base = OMAP1_MMC1_BASE;
+                       irq = INT_MMC;
+                       break;
+               case 1:
+                       if (!cpu_is_omap16xx())
+                               return;
+                       base = OMAP1_MMC2_BASE;
+                       irq = INT_1610_MMC2;
+                       break;
+               default:
+                       continue;
+               }
+               size = OMAP1_MMC_SIZE;
 
-       omap_init_mmc(info, &omap1_mmc1_device, OMAP1_MMC2_DEVICE);
+               omap_mmc_add(i, base, size, irq, mmc_data[i]);
+       };
 }
 
 #endif
 
 /*
  * Note: If you want to detect card feature, please assign GPIO 37
  */
-static struct omap_mmc_platform_data apollon_mmc_data = {
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots                       = 1,
-       .switch_slot                    = NULL,
        .init                           = apollon_mmc_late_init,
        .cleanup                        = apollon_mmc_cleanup,
+       .dma_mask                       = 0xffffffff,
        .slots[0]       = {
-               .enabled                = 1,
                .wire4                  = 1,
 
                /*
 
                .set_power              = apollon_mmc_set_power,
                .set_bus_mode           = apollon_mmc_set_bus_mode,
-               .get_ro                 = NULL,
-               .get_cover_state        = NULL,
                .ocr_mask               = MMC_VDD_30_31 | MMC_VDD_31_32 |
                                          MMC_VDD_32_33 | MMC_VDD_33_34,
                .name                   = "mmcblk",
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
+
 void __init apollon_mmc_init(void)
 {
-       omap2_init_mmc(&apollon_mmc_data);
+       mmc_data[0] = &mmc1_data;
+       omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
 }
 
 #else  /* !CONFIG_MMC_OMAP */
 
        menelaus_unregister_mmc_callback();
 }
 
-static struct omap_mmc_platform_data h4_mmc_data = {
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots               = 2,
        .switch_slot            = h4_mmc_switch_slot,
        .init                   = h4_mmc_late_init,
        .cleanup                = h4_mmc_cleanup,
+       .dma_mask               = 0xffffffff,
        .slots[0] = {
-               .enabled        = 1,
                .wire4          = 1,
                .set_power      = h4_mmc_set_power,
                .set_bus_mode   = h4_mmc_set_bus_mode,
-               .get_ro         = NULL,
                .get_cover_state= h4_mmc_slot1_cover_state,
                .ocr_mask       = MMC_VDD_165_195 |
                                  MMC_VDD_28_29 | MMC_VDD_30_31 |
                .name           = "slot1",
        },
        .slots[1] = {
-               .enabled        = 1,
                .wire4          = 1,
                .set_power      = h4_mmc_set_power,
                .set_bus_mode   = h4_mmc_set_bus_mode,
-               .get_ro         = NULL,
                .get_cover_state= h4_mmc_slot2_cover_state,
                .ocr_mask       = MMC_VDD_165_195 | MMC_VDD_20_21 |
                                  MMC_VDD_21_22 | MMC_VDD_22_23 | MMC_VDD_23_24 |
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
+
 void __init h4_mmc_init(void)
 {
-       omap2_init_mmc(&h4_mmc_data);
+       mmc_data[0] = &mmc1_data;
+       omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
 }
 
 #else
 
 #include <mach/gpio.h>
 #include <mach/mmc.h>
 
-#ifdef CONFIG_MMC_OMAP
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static const int slot_switch_gpio = 96;
 
        }
 }
 
-static struct omap_mmc_platform_data n800_mmc_data = {
+/*
+ * MMC controller1 has two slots that are multiplexed via I2C.
+ * MMC controller2 is not in use.
+ */
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots               = 2,
        .switch_slot            = n800_mmc_switch_slot,
        .init                   = n800_mmc_late_init,
        .cleanup                = n800_mmc_cleanup,
        .shutdown               = n800_mmc_shutdown,
        .max_freq               = 24000000,
+       .dma_mask               = 0xffffffff,
        .slots[0] = {
-               .enabled        = 1,
                .wire4          = 1,
                .set_power      = n800_mmc_set_power,
                .set_bus_mode   = n800_mmc_set_bus_mode,
-               .get_ro         = NULL,
                .get_cover_state= n800_mmc_get_cover_state,
                .ocr_mask       = MMC_VDD_165_195 | MMC_VDD_30_31 |
                                  MMC_VDD_32_33   | MMC_VDD_33_34,
        .slots[1] = {
                .set_power      = n800_mmc_set_power,
                .set_bus_mode   = n800_mmc_set_bus_mode,
-               .get_ro         = NULL,
                .get_cover_state= n800_mmc_get_cover_state,
                .ocr_mask       = MMC_VDD_165_195 | MMC_VDD_20_21 |
                                  MMC_VDD_21_22 | MMC_VDD_22_23 | MMC_VDD_23_24 |
        },
 };
 
+static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
+
 void __init n800_mmc_init(void)
 
 {
        if (machine_is_nokia_n810()) {
-               n800_mmc_data.slots[0].name = "external";
+               n800_mmc1_data.slots[0].name = "external";
 
                /*
                 * Some Samsung Movinand chips do not like open-ended
                 * while doing so. Reducing the number of blocks in
                 * the transfer or delays in clock disable do not help
                 */
-               n800_mmc_data.slots[1].name = "internal";
-               n800_mmc_data.slots[1].ban_openended = 1;
+               n800_mmc1_data.slots[1].name = "internal";
+               n800_mmc1_data.slots[1].ban_openended = 1;
        }
 
        if (omap_request_gpio(slot_switch_gpio) < 0)
                omap_set_gpio_direction(n810_slot2_pw_vdd, 0);
        }
 
-       omap2_init_mmc(&n800_mmc_data);
+       mmc_data[0] = &mmc1_data;
+       omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
 }
 #else
 
 
 
 static struct clk mmchsdb1_fck = {
        .name           = "mmchsdb_fck",
-       .id             = 1,
        .parent         = &func_32k_ck,
        .prcm_mod       = CORE_MOD,
        .flags          = CLOCK_IN_OMAP243X,
 
 static struct clk mmchsdb2_fck = {
        .name           = "mmchsdb_fck",
-       .id             = 2,
+       .id             = 1,
        .parent         = &func_32k_ck,
        .prcm_mod       = CORE_MOD,
        .flags          = CLOCK_IN_OMAP243X,
 
 
 static struct clk mmchs3_fck = {
        .name           = "mmchs_fck",
-       .id             = 3,
+       .id             = 2,
        .parent         = &core_96m_fck,
        .prcm_mod       = CORE_MOD,
        .enable_reg     = CM_FCLKEN1,
 
 static struct clk mmchs2_fck = {
        .name           = "mmchs_fck",
-       .id             = 2,
+       .id             = 1,
        .parent         = &core_96m_fck,
        .prcm_mod       = CORE_MOD,
        .enable_reg     = CM_FCLKEN1,
 
 static struct clk mmchs1_fck = {
        .name           = "mmchs_fck",
-       .id             = 1,
        .parent         = &core_96m_fck,
        .prcm_mod       = CORE_MOD,
        .enable_reg     = CM_FCLKEN1,
 
 static struct clk mmchs3_ick = {
        .name           = "mmchs_ick",
-       .id             = 3,
+       .id             = 2,
        .parent         = &core_l4_ick,
        .prcm_mod       = CORE_MOD,
        .enable_reg     = CM_ICLKEN1,
 
 static struct clk mmchs2_ick = {
        .name           = "mmchs_ick",
-       .id             = 2,
+       .id             = 1,
        .parent         = &core_l4_ick,
        .prcm_mod       = CORE_MOD,
        .enable_reg     = CM_ICLKEN1,
 
 static struct clk mmchs1_ick = {
        .name           = "mmchs_ick",
-       .id             = 1,
        .parent         = &core_l4_ick,
        .prcm_mod       = CORE_MOD,
        .enable_reg     = CM_ICLKEN1,
 
 #if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
        defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-#define        OMAP2_MMC1_BASE         0x4809c000
-#define        OMAP2_MMC1_END          (OMAP2_MMC1_BASE + 0x1fc)
-#define        OMAP2_MMC1_INT          INT_24XX_MMC_IRQ
-
-#define        OMAP2_MMC2_BASE         0x480b4000
-#define        OMAP2_MMC2_END          (OMAP2_MMC2_BASE + 0x1fc)
-#define        OMAP2_MMC2_INT          INT_24XX_MMC2_IRQ
-
-static u64 omap2_mmc1_dmamask = 0xffffffff;
-
-static struct resource omap2_mmc1_resources[] = {
-       {
-               .start          = OMAP2_MMC1_BASE,
-               .end            = OMAP2_MMC1_END,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP2_MMC1_INT,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device omap2_mmc1_device = {
-       .name           = "mmci-omap",
-       .id             = 1,
-       .dev = {
-               .dma_mask       = &omap2_mmc1_dmamask,
-       },
-       .num_resources  = ARRAY_SIZE(omap2_mmc1_resources),
-       .resource       = omap2_mmc1_resources,
-};
-
-static u64 omap2_mmc2_dmamask = 0xffffffff;
-
-static struct resource omap2_mmc2_resources[] = {
-       {
-               .start          = OMAP2_MMC2_BASE,
-               .end            = OMAP2_MMC2_END,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP2_MMC2_INT,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device omap2_mmc2_device = {
-       .name           = "mmci-omap",
-       .id             = 2,
-       .dev = {
-               .dma_mask       = &omap2_mmc2_dmamask,
-       },
-       .num_resources  = ARRAY_SIZE(omap2_mmc2_resources),
-       .resource       = omap2_mmc2_resources,
-};
-
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *info)
+static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
+                       int controller_nr)
 {
-       if (!cpu_is_omap2420())
-               return;
-
-       if (info->slots[0].enabled) {
+       if (cpu_is_omap2420() && controller_nr == 0) {
                omap_cfg_reg(H18_24XX_MMC_CMD);
                omap_cfg_reg(H15_24XX_MMC_CLKI);
                omap_cfg_reg(G19_24XX_MMC_CLKO);
                omap_cfg_reg(F20_24XX_MMC_DAT0);
                omap_cfg_reg(F19_24XX_MMC_DAT_DIR0);
                omap_cfg_reg(G18_24XX_MMC_CMD_DIR);
-               if (info->slots[0].wire4) {
+               if (mmc_controller->slots[0].wire4) {
                        omap_cfg_reg(H14_24XX_MMC_DAT1);
                        omap_cfg_reg(E19_24XX_MMC_DAT2);
                        omap_cfg_reg(D19_24XX_MMC_DAT3);
                 * Use internal loop-back in MMC/SDIO Module Input Clock
                 * selection
                 */
-               if (info->slots[0].internal_clock) {
+               if (mmc_controller->slots[0].internal_clock) {
                        u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
                        v |= (1 << 24);
                        omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
        }
 }
 
-void omap2_init_mmc(struct omap_mmc_platform_data *info)
+void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                       int nr_controllers)
 {
-       if (!info)
-               return;
+       int i;
+
+       for (i = 0; i < nr_controllers; i++) {
+               unsigned long base, size;
+               unsigned int irq = 0;
+
+               if (!mmc_data[i])
+                       continue;
+
+               omap2_mmc_mux(mmc_data[i], i);
+
+               switch (i) {
+               case 0:
+                       base = OMAP2_MMC1_BASE;
+                       irq = INT_24XX_MMC_IRQ;
+                       break;
+               case 1:
+                       base = OMAP2_MMC2_BASE;
+                       irq = INT_24XX_MMC2_IRQ;
+                       break;
+               case 2:
+                       if (!cpu_is_omap34xx())
+                               return;
+                       base = OMAP3_MMC3_BASE;
+                       irq = INT_34XX_MMC3_IRQ;
+                       break;
+               default:
+                       continue;
+               }
+
+               if (cpu_is_omap2420())
+                       size = OMAP2420_MMC_SIZE;
+               else
+                       size = HSMMC_SIZE;
 
-       omap2_mmc_mux(info);
-       omap2_mmc1_device.dev.platform_data = info;
-       omap2_mmc2_device.dev.platform_data = info;
-       omap_init_mmc(info, &omap2_mmc1_device, &omap2_mmc2_device);
+               omap_mmc_add(i, base, size, irq, mmc_data[i]);
+       };
 }
 
 #endif
 
        return 1;
 }
 
-static struct omap_mmc_platform_data hsmmc_data = {
+static struct omap_mmc_platform_data mmc1_data = {
        .nr_slots                       = 1,
-       .switch_slot                    = NULL,
        .init                           = hsmmc_late_init,
        .cleanup                        = hsmmc_cleanup,
 #ifdef CONFIG_PM
        .suspend                        = hsmmc_suspend,
        .resume                         = hsmmc_resume,
 #endif
+       .dma_mask                       = 0xffffffff,
        .slots[0] = {
-               .enabled                = 1,
                .wire4                  = 1,
                .set_power              = hsmmc_set_power,
-               .set_bus_mode           = NULL,
-               .get_ro                 = NULL,
-               .get_cover_state        = NULL,
                .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34 |
                                                MMC_VDD_165_195,
                .name                   = "first slot",
        },
 };
 
+static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC];
+
 void __init hsmmc_init(void)
 {
-       omap2_init_mmc(&hsmmc_data);
+       hsmmc_data[0] = &mmc1_data;
+       omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
 }
 
 #else
 
 #if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
        defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
+#define OMAP_MMC_NR_RES                2
+
 /*
  * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
  */
-void omap_init_mmc(struct omap_mmc_platform_data *info,
-               struct platform_device *pdev1, struct platform_device *pdev2)
+int __init omap_mmc_add(int id, unsigned long base, unsigned long size,
+               unsigned int irq, struct omap_mmc_platform_data *data)
 {
-       if (!info)
-               return;
-
-       if (info->slots[0].enabled && pdev1)
-               (void) platform_device_register(pdev1);
+       struct platform_device *pdev;
+       struct resource res[OMAP_MMC_NR_RES];
+       int ret;
+
+       pdev = platform_device_alloc("mmci-omap", id);
+       if (!pdev)
+               return -ENOMEM;
+
+       memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource));
+       res[0].start = base;
+       res[0].end = base + size - 1;
+       res[0].flags = IORESOURCE_MEM;
+       res[1].start = res[1].end = irq;
+       res[1].flags = IORESOURCE_IRQ;
+
+       ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
+       if (ret == 0)
+               ret = platform_device_add_data(pdev, data, sizeof(*data));
+       if (ret)
+               goto fail;
+
+       ret = platform_device_add(pdev);
+       if (ret)
+               goto fail;
+       return 0;
 
-       if (info->slots[1].enabled && pdev2)
-               (void) platform_device_register(pdev2);
+fail:
+       platform_device_put(pdev);
+       return ret;
 }
 
 #endif
 
 #ifndef __ASM_ARCH_OMAP_H2_H
 #define __ASM_ARCH_OMAP_H2_H
 
-/* Placeholder for H2 specific defines */
-
 /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
 #define OMAP1610_ETHR_START            0x04000300
 
+#define H2_TPS_GPIO_BASE               (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */)
+#      define H2_TPS_GPIO_MMC_PWR_EN   (H2_TPS_GPIO_BASE + 3)
+
 extern void h2_mmc_init(void);
-extern void h2_mmc_slot_cover_handler(void *arg, int state);
 
 #endif /*  __ASM_ARCH_OMAP_H2_H */
 
 
 /* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
 #define OMAP1710_ETHR_START            0x04000300
 
+#define H3_TPS_GPIO_BASE               (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */)
+#      define H3_TPS_GPIO_MMC_PWR_EN   (H3_TPS_GPIO_BASE + 4)
+
 extern void h3_mmc_init(void);
-extern void h3_mmc_slot_cover_handler(void *arg, int state);
 
 #endif /*  __ASM_ARCH_OMAP_H3_H */
 
 
 #include <mach/board.h>
 
+#define OMAP15XX_NR_MMC                1
+#define OMAP16XX_NR_MMC                2
+#define OMAP1_MMC_SIZE         0x080
+#define OMAP1_MMC1_BASE                0xfffb7800
+#define OMAP1_MMC2_BASE                0xfffb7c00      /* omap16xx only */
+
+#define OMAP24XX_NR_MMC                2
+#define OMAP34XX_NR_MMC                3
+#define OMAP2420_MMC_SIZE      OMAP1_MMC_SIZE
+#define HSMMC_SIZE             0x200
+#define OMAP2_MMC1_BASE                0x4809c000
+#define OMAP2_MMC2_BASE                0x480b4000
+#define OMAP3_MMC3_BASE                0x480ad000
+
 #define OMAP_MMC_MAX_SLOTS     2
 
 struct omap_mmc_platform_data {
 
-       /* number of slots on board */
+       /* number of slots per controller */
        unsigned nr_slots:2;
 
        /* set if your board has components or wiring that limits the
        int (*suspend)(struct device *dev, int slot);
        int (*resume)(struct device *dev, int slot);
 
-       struct omap_mmc_slot_data {
+       u64 dma_mask;
 
-               unsigned enabled:1;
+       struct omap_mmc_slot_data {
 
                /*
                 * nomux means "standard" muxing is wrong on this board, and
                unsigned internal_clock:1;
                s16 power_pin;
                s16 switch_pin;
-               s16 wp_pin;
 
                int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
                int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
                /* return MMC cover switch state, can be NULL if not supported.
                 *
                 * possible return values:
-                *   0 - open
-                *   1 - closed
+                *   0 - closed
+                *   1 - open
                 */
                int (* get_cover_state)(struct device *dev, int slot);
 
 
 #if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
        defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
-void omap1_init_mmc(struct omap_mmc_platform_data *info);
-void omap2_init_mmc(struct omap_mmc_platform_data *info);
-void omap_init_mmc(struct omap_mmc_platform_data *info,
-               struct platform_device *pdev1, struct platform_device *pdev2);
+void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                               int nr_controllers);
+void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                               int nr_controllers);
+int omap_mmc_add(int id, unsigned long base, unsigned long size,
+                       unsigned int irq, struct omap_mmc_platform_data *data);
 #else
-static inline void omap1_init_mmc(struct omap_mmc_platform_data *info)
+static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                               int nr_controllers)
 {
 }
-static inline void omap2_init_mmc(struct omap_mmc_platform_data *info)
+static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
+                               int nr_controllers)
 {
 }
-static inline void omap_init_mmc(struct omap_mmc_platform_data *info,
-               struct platform_device *pdev1, struct platform_device *pdev2)
+static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
+               unsigned int irq, struct omap_mmc_platform_data *data)
 {
+       return 0;
 }
 #endif
 
 
        host->irq = irq;
 
        host->use_dma = 1;
+       host->dev->dma_mask = &pdata->dma_mask;
        host->dma_ch = -1;
 
        host->irq = irq;
 
        host            = mmc_priv(mmc);
        host->mmc       = mmc;
        host->pdata     = pdata;
+       host->dev       = &pdev->dev;
        host->use_dma   = 1;
+       host->dev->dma_mask = &pdata->dma_mask;
        host->dma_ch    = -1;
        host->irq       = irq;
        host->id        = pdev->id;