]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Clean-up MMC device init
authorTony Lindgren <tony@atomide.com>
Fri, 12 Sep 2008 00:23:52 +0000 (17:23 -0700)
committerTony Lindgren <tony@atomide.com>
Fri, 12 Sep 2008 00:38:38 +0000 (17:38 -0700)
Clean-up MMC device init:

- Initialize devices in mach-omap1/devices.c and mach-omap2/devices.c
  instead of plat-omap/devices.c

- Remove old struct omap_mmc_config, use struct omap_mmc_platform_data instead

Note that this removes the second omap-hsmmc controller init for overo.
This needs to be fixed properly by changing hsmmc_init() to accept
board specific struct omap_mmc_platform_data.

Signed-off-by: Tony Lindgren <tony@atomide.com>
33 files changed:
arch/arm/mach-omap1/board-h2-mmc.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3-mmc.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-sx1-mmc.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap1/devices.c
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-apollon-mmc.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4-mmc.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-omap2/board-n800-mmc.c
arch/arm/mach-omap2/board-n800.c
arch/arm/mach-omap2/board-omap2evm.c
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-overo.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/hsmmc.c
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/include/mach/board.h
arch/arm/plat-omap/include/mach/mmc.h
drivers/mmc/host/omap.c
drivers/mmc/host/omap_hsmmc.c

index ab9ee5820c489f935784fa1148764190ede72fdf..37031e01773c93805e1b3560397ba795aff69701 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <mach/mmc.h>
 #include <mach/gpio.h>
+#include <mach/mmc.h>
 
 #ifdef CONFIG_MMC_OMAP
 static int slot_cover_open;
@@ -83,6 +84,8 @@ static struct omap_mmc_platform_data h2_mmc_data = {
        .init                           = h2_mmc_late_init,
        .cleanup                        = h2_mmc_cleanup,
        .slots[0]       = {
+               .enabled                = 1,
+               .wire4                  = 1,
                .set_power              = h2_mmc_set_power,
                .set_bus_mode           = h2_mmc_set_bus_mode,
                .get_ro                 = NULL,
@@ -95,7 +98,7 @@ static struct omap_mmc_platform_data h2_mmc_data = {
 
 void __init h2_mmc_init(void)
 {
-       omap_set_mmc_info(1, &h2_mmc_data);
+       omap1_init_mmc(&h2_mmc_data);
 }
 
 #else
index 1055de1ae4d1890a4c43e0b865635065659900f7..ac51d255aa0c9b553167e458b3826d9388fe4cf0 100644 (file)
@@ -470,15 +470,6 @@ static struct omap_usb_config h2_usb_config __initdata = {
        .pins[1]        = 3,
 };
 
-static struct omap_mmc_config h2_mmc_config __initdata = {
-       .mmc[0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
-extern struct omap_mmc_platform_data h2_mmc_data;
-
 static struct omap_uart_config h2_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -489,7 +480,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
 
 static struct omap_board_config_kernel h2_config[] __initdata = {
        { OMAP_TAG_USB,         &h2_usb_config },
-       { OMAP_TAG_MMC,         &h2_mmc_config },
        { OMAP_TAG_UART,        &h2_uart_config },
        { OMAP_TAG_LCD,         &h2_lcd_config },
 };
index 36085819098cbdd687665e42946fd0bfcb8a125c..44e9d536587a49c2ceb236ed287b7ce49ff5696c 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <mach/mmc.h>
 #include <mach/gpio.h>
+#include <mach/mmc.h>
 
 #ifdef CONFIG_MMC_OMAP
 static int slot_cover_open;
@@ -87,6 +88,8 @@ static struct omap_mmc_platform_data h3_mmc_data = {
        .init                           = h3_mmc_late_init,
        .cleanup                        = h3_mmc_cleanup,
        .slots[0]       = {
+               .enabled                = 1,
+               .wire4                  = 1,
                .set_power              = h3_mmc_set_power,
                .set_bus_mode           = h3_mmc_set_bus_mode,
                .get_ro                 = NULL,
@@ -99,7 +102,7 @@ static struct omap_mmc_platform_data h3_mmc_data = {
 
 void __init h3_mmc_init(void)
 {
-       omap_set_mmc_info(1, &h3_mmc_data);
+       omap1_init_mmc(&h3_mmc_data);
 }
 
 #else
index 7516d21af86c28c9ef1b5c9de4c24f0654337fce..0c1b001626f4ccfe042294e7071f3a6b370c4907 100644 (file)
@@ -462,15 +462,6 @@ static struct omap_usb_config h3_usb_config __initdata = {
        .pins[1]        = 3,
 };
 
-static struct omap_mmc_config h3_mmc_config __initdata = {
-       .mmc[0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
-extern struct omap_mmc_platform_data h3_mmc_data;
-
 static struct omap_uart_config h3_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -481,7 +472,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
 
 static struct omap_board_config_kernel h3_config[] __initdata = {
        { OMAP_TAG_USB,         &h3_usb_config },
-       { OMAP_TAG_MMC,         &h3_mmc_config },
        { OMAP_TAG_UART,        &h3_uart_config },
        { OMAP_TAG_LCD,         &h3_lcd_config },
 };
index cbc11be5cd2a9ebcbc1fc43f82308f17c969076c..9ed0feff6fbc2844442333c87bd05e6e6c13d889 100644 (file)
@@ -39,6 +39,7 @@
 #include <mach/common.h>
 #include <mach/mcbsp.h>
 #include <mach/omap-alsa.h>
+#include <mach/mmc.h>
 
 static int innovator_keymap[] = {
        KEY(0, 0, KEY_F1),
@@ -360,13 +361,15 @@ static struct omap_lcd_config innovator1610_lcd_config __initdata = {
 };
 #endif
 
-static struct omap_mmc_config innovator_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-               .wp_pin         = OMAP_MPUIO(3),
-               .power_pin      = -1,   /* FPGA F3 UIO42 */
-               .switch_pin     = -1,   /* FPGA F4 UIO43 */
+static struct omap_mmc_platform_data innovator_mmc_data = {
+       .nr_slots                       = 1,
+       .slots[0]       = {
+               .enabled                = 1,
+               .wire4                  = 1,
+               .wp_pin                 = OMAP_MPUIO(3),
+               .power_pin              = -1,   /* FPGA F3 UIO42 */
+               .switch_pin             = -1,   /* FPGA F4 UIO43 */
+               .name                   = "mmcblk",
        },
 };
 
@@ -377,7 +380,6 @@ static struct omap_uart_config innovator_uart_config __initdata = {
 static struct omap_board_config_kernel innovator_config[] = {
        { OMAP_TAG_USB,         NULL },
        { OMAP_TAG_LCD,         NULL },
-       { OMAP_TAG_MMC,         &innovator_mmc_config },
        { OMAP_TAG_UART,        &innovator_uart_config },
 };
 
@@ -412,6 +414,7 @@ static void __init innovator_init(void)
        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);
 }
 
 static void __init innovator_map_io(void)
index 0e297f3de01aa0a7286f41699ba50f25b9ea54ff..6e96a9d81ad739c046e009a016c9963010f7d962 100644 (file)
@@ -36,6 +36,7 @@
 #include <mach/omapfb.h>
 #include <mach/hwa742.h>
 #include <mach/lcd_mipid.h>
+#include <mach/mmc.h>
 
 #define ADS7846_PENDOWN_GPIO   15
 
@@ -215,26 +216,29 @@ static struct omap_usb_config nokia770_usb_config __initdata = {
        .pins[0]        = 6,
 };
 
-static struct omap_mmc_config nokia770_mmc_config __initdata = {
-       .mmc[0] = {
-               .enabled        = 0,
-               .wire4          = 0,
-               .wp_pin         = -1,
-               .power_pin      = -1,
-               .switch_pin     = -1,
+static struct omap_mmc_platform_data nokia770_mmc_data = {
+       .nr_slots                       = 2,
+       .slots[0]       = {
+               .enabled                = 0,
+               .wire4                  = 0,
+               .wp_pin                 = -1,
+               .power_pin              = -1,
+               .switch_pin             = -1,
+               .name                   = "mmcblk",
        },
-       .mmc[1] = {
-               .enabled        = 0,
-               .wire4          = 0,
-               .wp_pin         = -1,
-               .power_pin      = -1,
-               .switch_pin     = -1,
+       .slots[1]       = {
+               .enabled                = 0,
+               .wire4                  = 0,
+               .wp_pin                 = -1,
+               .power_pin              = -1,
+               .switch_pin             = -1,
+               .name                   = "mmcblk",
        },
+
 };
 
 static struct omap_board_config_kernel nokia770_config[] __initdata = {
        { OMAP_TAG_USB,         NULL },
-       { OMAP_TAG_MMC,         &nokia770_mmc_config },
 };
 
 #if    defined(CONFIG_OMAP_DSP)
@@ -378,6 +382,7 @@ static void __init omap_nokia770_init(void)
        hwa742_dev_init();
        ads7846_dev_init();
        mipid_dev_init();
+       omap1_init_mmc(&nokia770_mmc_data);
 }
 
 static void __init omap_nokia770_map_io(void)
index 4b2c62b3853d3137d8e86b0affacc6e412bb1445..992ade0aa8092af47ee371fcb4de0154e8870dd3 100644 (file)
@@ -45,6 +45,7 @@
 #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)
 {
@@ -196,12 +197,14 @@ static struct omap_usb_config palmte_usb_config __initdata = {
        .pins[0]        = 2,
 };
 
-static struct omap_mmc_config palmte_mmc_config __initdata = {
-       .mmc[0]         = {
-               .enabled        = 1,
-               .wp_pin         = PALMTE_MMC_WP_GPIO,
-               .power_pin      = PALMTE_MMC_POWER_GPIO,
-               .switch_pin     = PALMTE_MMC_SWITCH_GPIO,
+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",
        },
 };
 
@@ -317,7 +320,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
 
 static struct omap_board_config_kernel palmte_config[] __initdata = {
        { OMAP_TAG_USB,         &palmte_usb_config },
-       { OMAP_TAG_MMC,         &palmte_mmc_config },
        { OMAP_TAG_LCD,         &palmte_lcd_config },
        { OMAP_TAG_UART,        &palmte_uart_config },
 };
@@ -408,6 +410,7 @@ static void __init omap_palmte_init(void)
        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)
index e719294250b1f5dedf0bbec0a486ee855caf536d..5c75b9a4d52c87ba8c37cf30d12f0beaf8bfe7bc 100644 (file)
@@ -43,6 +43,7 @@
 #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>
@@ -267,13 +268,15 @@ static struct omap_usb_config palmz71_usb_config __initdata = {
        .pins[0]        = 2,
 };
 
-static struct omap_mmc_config palmz71_mmc_config __initdata = {
-       .mmc[0] = {
-               .enabled        = 1,
-               .wire4          = 0,
-               .wp_pin         = PALMZ71_MMC_WP_GPIO,
-               .power_pin      = -1,
-               .switch_pin     = PALMZ71_MMC_IN_GPIO,
+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",
        },
 };
 
@@ -287,7 +290,6 @@ static struct omap_uart_config palmz71_uart_config __initdata = {
 
 static struct omap_board_config_kernel palmz71_config[] __initdata = {
        {OMAP_TAG_USB,  &palmz71_usb_config},
-       {OMAP_TAG_MMC,  &palmz71_mmc_config},
        {OMAP_TAG_LCD,  &palmz71_lcd_config},
        {OMAP_TAG_UART, &palmz71_uart_config},
 };
@@ -365,6 +367,7 @@ omap_palmz71_init(void)
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
        palmz71_gpio_setup(0);
+       omap1_init_mmc(&palmz71_mmc_data);
 }
 
 static void __init
index 0be4ebaa2842a120e2be29e96ce8906ec32fb105..524d22de1d5ee22e60ebd8d69179c0b1cb5b8a6d 100644 (file)
@@ -12,6 +12,8 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/platform_device.h>
+
 #include <mach/hardware.h>
 #include <mach/mmc.h>
 #include <mach/gpio.h>
@@ -97,6 +99,8 @@ static struct omap_mmc_platform_data sx1_mmc_data = {
        .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,
@@ -109,7 +113,7 @@ static struct omap_mmc_platform_data sx1_mmc_data = {
 
 void __init sx1_mmc_init(void)
 {
-       omap_set_mmc_info(1, &sx1_mmc_data);
+       omap1_init_mmc(&sx1_mmc_data);
 }
 
 #else
index d3156b8451daabc5c63a28298a31cb93b437b12a..0d235e7facdbd22f034803cb5e0291f3167498ee 100644 (file)
@@ -379,15 +379,6 @@ static struct omap_usb_config sx1_usb_config __initdata = {
        .pins[2]        = 0,
 };
 
-/*----------- MMC -------------------------*/
-
-static struct omap_mmc_config sx1_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 0,
-       },
-};
-
 /*----------- LCD -------------------------*/
 
 static struct platform_device sx1_lcd_device = {
@@ -415,7 +406,6 @@ static struct omap_uart_config sx1_uart_config __initdata = {
 
 static struct omap_board_config_kernel sx1_config[] __initdata = {
        { OMAP_TAG_USB, &sx1_usb_config },
-       { OMAP_TAG_MMC, &sx1_mmc_config },
        { OMAP_TAG_LCD, &sx1_lcd_config },
        { OMAP_TAG_UART,        &sx1_uart_config },
 };
@@ -458,7 +448,6 @@ static void __init omap_sx1_init(void)
        omap_set_gpio_dataout(1, 1);/*A_IRDA_OFF = 1 */
        omap_set_gpio_dataout(11, 0);/*A_SWITCH = 0 */
        omap_set_gpio_dataout(15, 0);/*A_USB_ON = 0 */
-
 }
 /*----------------------------------------*/
 static void __init omap_sx1_init_irq(void)
index 53650072ff496b5076c462237c109e0383e27467..57be5298f539e103981b0c2f4023a1c77bfa4357 100644 (file)
@@ -34,6 +34,7 @@
 #include <mach/mux.h>
 #include <mach/tc.h>
 #include <mach/usb.h>
+#include <mach/mmc.h>
 
 static struct plat_serial8250_port voiceblue_ports[] = {
        {
@@ -140,11 +141,13 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
        .pins[2]        = 6,
 };
 
-static struct omap_mmc_config voiceblue_mmc_config __initdata = {
-       .mmc[0] = {
-               .enabled        = 1,
-               .power_pin      = 2,
-               .switch_pin     = -1,
+static struct omap_mmc_platform_data voiceblue_mmc_data = {
+       .nr_slots                       = 1,
+       .slots[0]       = {
+               .enabled                = 1,
+               .power_pin              = 2,
+               .switch_pin             = -1,
+               .name                   = "mmcblk",
        },
 };
 
@@ -154,7 +157,6 @@ static struct omap_uart_config voiceblue_uart_config __initdata = {
 
 static struct omap_board_config_kernel voiceblue_config[] = {
        { OMAP_TAG_USB,  &voiceblue_usb_config },
-       { OMAP_TAG_MMC,  &voiceblue_mmc_config },
        { OMAP_TAG_UART, &voiceblue_uart_config },
 };
 
@@ -202,6 +204,8 @@ static void __init voiceblue_init(void)
         * (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)
index 79cfe0147d930ef814c10602f727e04272e6ee23..97b472c25cd9ade864be93d075b8c5c35717bcdc 100644 (file)
@@ -22,6 +22,7 @@
 #include <mach/board.h>
 #include <mach/mux.h>
 #include <mach/gpio.h>
+#include <mach/mmc.h>
 
 /*-------------------------------------------------------------------------*/
 
@@ -99,6 +100,136 @@ static inline void omap_init_mbox(void)
 static inline void omap_init_mbox(void) { }
 #endif
 
+/*-------------------------------------------------------------------------*/
+
+#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)
+{
+       if (info->slots[0].enabled) {
+               omap_cfg_reg(MMC_CMD);
+               omap_cfg_reg(MMC_CLK);
+               omap_cfg_reg(MMC_DAT0);
+               if (cpu_is_omap1710()) {
+                       omap_cfg_reg(M15_1710_MMC_CLKI);
+                       omap_cfg_reg(P19_1710_MMC_CMDDIR);
+                       omap_cfg_reg(P20_1710_MMC_DATDIR0);
+               }
+               if (info->slots[0].wire4) {
+                       omap_cfg_reg(MMC_DAT1);
+                       /* NOTE: DAT2 can be on W10 (here) or M15 */
+                       if (!info->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) {
+                       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) {
+                               omap_cfg_reg(V8_1610_MMC2_DAT1);
+                               omap_cfg_reg(W15_1610_MMC2_DAT2);
+                               omap_cfg_reg(R10_1610_MMC2_DAT3);
+                       }
+
+                       /* These are needed for the level shifter */
+                       omap_cfg_reg(V9_1610_MMC2_CMDDIR);
+                       omap_cfg_reg(V5_1610_MMC2_DATDIR0);
+                       omap_cfg_reg(W19_1610_MMC2_DATDIR1);
+               }
+
+               /* Feedback clock must be set on OMAP-1710 MMC2 */
+               if (cpu_is_omap1710())
+                       omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
+                                       MOD_CONF_CTRL_1);
+       }
+}
+
+void omap1_init_mmc(struct omap_mmc_platform_data *info)
+{
+       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);
+
+       omap_init_mmc(info, &omap1_mmc1_device, OMAP1_MMC2_DEVICE);
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+
 #if defined(CONFIG_OMAP_STI)
 
 #define OMAP1_STI_BASE         0xfffea000
index 94e202df3709b9375a00b89d8cd662235581adc6..22aa28c7fcb85edf2fb91ec18c2984546388c04b 100644 (file)
@@ -365,18 +365,10 @@ struct omap_serial_console_config sdp2430_serial_console_config __initdata = {
        .console_speed = 115200,
 };
 
-static struct omap_mmc_config sdp2430_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct omap_board_config_kernel sdp2430_config[] __initdata = {
        {OMAP_TAG_UART, &sdp2430_uart_config},
        {OMAP_TAG_LCD, &sdp2430_lcd_config},
        {OMAP_TAG_SERIAL_CONSOLE, &sdp2430_serial_console_config},
-       {OMAP_TAG_MMC,  &sdp2430_mmc_config},
 };
 
 static int __init omap2430_i2c_init(void)
index d27158ec3141f22515986632b54b72c948185f1e..a9f368b4e10176d2320ca81a5f803093878f2747 100644 (file)
@@ -329,17 +329,9 @@ static struct omap_lcd_config sdp3430_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
 
-static struct omap_mmc_config sdp3430_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct omap_board_config_kernel sdp3430_config[] __initdata = {
        { OMAP_TAG_UART,        &sdp3430_uart_config },
-       {OMAP_TAG_LCD,          &sdp3430_lcd_config},
-       {OMAP_TAG_MMC,          &sdp3430_mmc_config },
+       { OMAP_TAG_LCD,         &sdp3430_lcd_config },
 };
 
 static int __init omap3430_i2c_init(void)
index 71fccd9b3f3539bb6cfbcc1fea59affc2f75900c..a33e8ca9114a1cc2deb7f3b8224aac8ed73183b8 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/platform_device.h>
 
 #include <mach/gpio.h>
 #include <mach/mmc.h>
@@ -58,12 +59,24 @@ static void apollon_mmc_cleanup(struct device *dev)
 {
 }
 
+/*
+ * Note: If you want to detect card feature, please assign GPIO 37
+ */
 static struct omap_mmc_platform_data apollon_mmc_data = {
        .nr_slots                       = 1,
        .switch_slot                    = NULL,
        .init                           = apollon_mmc_late_init,
        .cleanup                        = apollon_mmc_cleanup,
        .slots[0]       = {
+               .enabled                = 1,
+               .wire4                  = 1,
+
+               /*
+                * Use internal loop-back in MMC/SDIO Module Input Clock
+                * selection
+                */
+               .internal_clock         = 1,
+
                .set_power              = apollon_mmc_set_power,
                .set_bus_mode           = apollon_mmc_set_bus_mode,
                .get_ro                 = NULL,
@@ -76,7 +89,7 @@ static struct omap_mmc_platform_data apollon_mmc_data = {
 
 void __init apollon_mmc_init(void)
 {
-       omap_set_mmc_info(1, &apollon_mmc_data);
+       omap2_init_mmc(&apollon_mmc_data);
 }
 
 #else  /* !CONFIG_MMC_OMAP */
index e76328062c0d2e754dabbaec73e0d2f537340e0e..1f3af4825e7f1b85ea1ac9e59b41a34e3e644502 100644 (file)
@@ -351,18 +351,6 @@ static struct omap_uart_config apollon_uart_config __initdata = {
        .enabled_uarts = (1 << 0) | (0 << 1) | (0 << 2),
 };
 
-/*
- * Note: If you want to detect card feature, please assign GPIO 37
- */
-static struct omap_mmc_config apollon_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       /* Use internal loop-back in MMC/SDIO Module Input Clock selection */
-               .internal_clock = 1,
-       },
-};
-
 static struct omap_usb_config apollon_usb_config __initdata = {
        .register_dev   = 1,
        .hmc_mode       = 0x14, /* 0:dev 1:host1 2:disable */
@@ -376,7 +364,6 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
 
 static struct omap_board_config_kernel apollon_config[] __initdata = {
        { OMAP_TAG_UART,        &apollon_uart_config },
-       { OMAP_TAG_MMC,         &apollon_mmc_config },
        { OMAP_TAG_USB,         &apollon_usb_config },
        { OMAP_TAG_LCD,         &apollon_lcd_config },
 };
index 70931b582072c982b87cb6fe57e3fe82db762241..0e353b3611f373503dbb6674e1ce15d85d606125 100644 (file)
@@ -41,19 +41,8 @@ static struct omap_uart_config generic_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
 
-static struct omap_mmc_config generic_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 0,
-               .wire4          = 0,
-               .wp_pin         = -1,
-               .power_pin      = -1,
-               .switch_pin     = -1,
-       },
-};
-
 static struct omap_board_config_kernel generic_config[] __initdata = {
        { OMAP_TAG_UART,        &generic_uart_config },
-       { OMAP_TAG_MMC,         &generic_mmc_config },
 };
 
 static void __init omap_generic_init(void)
index 0916a3ca5df3d6a8cabcb08a46417a4b6e2ad188..169c5ee8b742c54122a460000045fe93656d6807 100644 (file)
  * published by the Free Software Foundation.
  */
 
-#include <mach/mmc.h>
-
-#include <asm/mach-types.h>
 #include <linux/delay.h>
+#include <linux/platform_device.h>
 #include <linux/i2c/menelaus.h>
 
+#include <asm/mach-types.h>
+
+#include <mach/mmc.h>
+
 #ifdef CONFIG_MMC_OMAP
 
 /* Bit mask for slots detection interrupts */
@@ -228,6 +230,8 @@ static struct omap_mmc_platform_data h4_mmc_data = {
        .init                   = h4_mmc_late_init,
        .cleanup                = h4_mmc_cleanup,
        .slots[0] = {
+               .enabled        = 1,
+               .wire4          = 1,
                .set_power      = h4_mmc_set_power,
                .set_bus_mode   = h4_mmc_set_bus_mode,
                .get_ro         = NULL,
@@ -238,6 +242,8 @@ static struct omap_mmc_platform_data h4_mmc_data = {
                .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,
@@ -253,7 +259,7 @@ static struct omap_mmc_platform_data h4_mmc_data = {
 
 void __init h4_mmc_init(void)
 {
-       omap_set_mmc_info(1, &h4_mmc_data);
+       omap2_init_mmc(&h4_mmc_data);
 }
 
 #else
index 54ecab9ed5a8e62f551eace3baa7cea495359503..c65358b2c2ba61d989f54f73c42c630286497bea 100644 (file)
@@ -391,19 +391,6 @@ static struct omap_uart_config h4_uart_config __initdata = {
 #endif
 };
 
-static struct omap_mmc_config h4_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-       .mmc [1] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
-extern struct omap_mmc_platform_data h4_mmc_data;
-
 static struct omap_lcd_config h4_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
@@ -470,7 +457,6 @@ static struct spi_board_info h4_spi_board_info[] __initdata = {
 
 static struct omap_board_config_kernel h4_config[] __initdata = {
        { OMAP_TAG_UART,        &h4_uart_config },
-       { OMAP_TAG_MMC,         &h4_mmc_config },
        { OMAP_TAG_LCD,         &h4_lcd_config },
        { OMAP_TAG_USB,         &h4_usb_config },
 };
@@ -664,13 +650,6 @@ static struct i2c_board_info __initdata h4_i2c_board_info[] = {
 #endif
 };
 
-static struct i2c_board_info __initdata h4_i2c_board_info[] = {
-       {
-               I2C_BOARD_INFO("isp1301_omap", 0x2d),
-               .irq            = OMAP_GPIO_IRQ(125),
-       },
-};
-
 static void __init omap_h4_init(void)
 {
        /*
index 987f86039d61b9420d863f6b700bc7bd75c5170c..ffd27d676ce0aac63aec44622bb58a5752fe89a3 100644 (file)
@@ -201,16 +201,8 @@ static struct omap_uart_config ldp_uart_config __initdata = {
        .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
 
-static struct omap_mmc_config ldp_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct omap_board_config_kernel ldp_config[] __initdata = {
        { OMAP_TAG_UART,        &ldp_uart_config },
-       { OMAP_TAG_MMC,         &ldp_mmc_config },
 };
 
 static int __init omap_i2c_init(void)
index dac159f2f9a46d28d0cbd7f292f2c861d5a97ad4..bcbba9440bf16632cdef77e655f5abd1fbe9f055 100644 (file)
@@ -9,13 +9,16 @@
  * published by the Free Software Foundation.
  */
 
-#include <mach/mmc.h>
-#include <mach/gpio.h>
-
-#include <asm/mach-types.h>
 #include <linux/delay.h>
+#include <linux/platform_device.h>
 #include <linux/i2c/menelaus.h>
 
+#include <asm/mach-types.h>
+
+#include <mach/mmc.h>
+#include <mach/gpio.h>
+#include <mach/mmc.h>
+
 #ifdef CONFIG_MMC_OMAP
 
 static const int slot_switch_gpio = 96;
@@ -301,6 +304,8 @@ static struct omap_mmc_platform_data n800_mmc_data = {
        .shutdown               = n800_mmc_shutdown,
        .max_freq               = 24000000,
        .slots[0] = {
+               .enabled        = 1,
+               .wire4          = 1,
                .set_power      = n800_mmc_set_power,
                .set_bus_mode   = n800_mmc_set_bus_mode,
                .get_ro         = NULL,
@@ -339,7 +344,6 @@ void __init n800_mmc_init(void)
                n800_mmc_data.slots[1].ban_openended = 1;
        }
 
-       omap_set_mmc_info(1, &n800_mmc_data);
        if (omap_request_gpio(slot_switch_gpio) < 0)
                BUG();
        omap_set_gpio_dataout(slot_switch_gpio, 0);
@@ -356,6 +360,8 @@ void __init n800_mmc_init(void)
                omap_set_gpio_dataout(n810_slot2_pw_vdd, 0);
                omap_set_gpio_direction(n810_slot2_pw_vdd, 0);
        }
+
+       omap2_init_mmc(&n800_mmc_data);
 }
 #else
 
index 1df9f3dcc28dccb00ffeee5585fa3ef3ab290958..2c64d2d47ed9fd70d159d6780eddc6ca79528641 100644 (file)
@@ -265,22 +265,12 @@ static void __init blizzard_dev_init(void)
        omapfb_set_ctrl_platform_data(&n800_blizzard_data);
 }
 
-static struct omap_mmc_config n800_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled                = 1,
-               .wire4                  = 1,
-       },
-};
-
-extern struct omap_mmc_platform_data n800_mmc_data;
-
 static struct omap_board_config_kernel n800_config[] __initdata = {
        { OMAP_TAG_UART,                        &n800_uart_config },
        { OMAP_TAG_FBMEM,                       &n800_fbmem0_config },
        { OMAP_TAG_FBMEM,                       &n800_fbmem1_config },
        { OMAP_TAG_FBMEM,                       &n800_fbmem2_config },
        { OMAP_TAG_TMP105,                      &n800_tmp105_config },
-       { OMAP_TAG_MMC,                         &n800_mmc_config },
 };
 
 static struct tsc2301_platform_data tsc2301_config = {
index 138e80c33fc2225f971942c1812ed23c2217838d..d55f6f7b7e845c04e1bef18e6fb9b284c9eeeb4f 100644 (file)
@@ -229,17 +229,9 @@ static struct omap_uart_config omap2_evm_uart_config __initdata = {
        .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
 
-static struct omap_mmc_config omap2_evm_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct omap_board_config_kernel omap2_evm_config[] __initdata = {
        { OMAP_TAG_UART,        &omap2_evm_uart_config },
        { OMAP_TAG_LCD,         &omap2_evm_lcd_config },
-       { OMAP_TAG_MMC,         &omap2_evm_mmc_config },
 };
 
 static int __init omap2_evm_i2c_init(void)
index 9babe44a8838d993303fb880e0bfa8b13a1251b1..4d0818d0252e103b47b0eaac4757eb4c313cda94 100644 (file)
@@ -125,13 +125,6 @@ static void __init omap3_beagle_init_irq(void)
        omap_gpio_init();
 }
 
-static struct omap_mmc_config omap3beagle_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct platform_device omap3_beagle_twl4030rtc_device = {
        .name           = "twl4030_rtc",
        .id             = -1,
@@ -196,7 +189,6 @@ static struct platform_device keys_gpio = {
 
 static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
        { OMAP_TAG_UART,        &omap3_beagle_uart_config },
-       { OMAP_TAG_MMC,         &omap3beagle_mmc_config },
        { OMAP_TAG_LCD,         &omap3_beagle_lcd_config },
 };
 
index 9a4784ead4873ae3246bc2c5e1581353d60e2293..ee8a84d3a43eccc871d60cafff0f88ad8061dea5 100644 (file)
@@ -96,13 +96,6 @@ static int __init omap3_evm_i2c_init(void)
        return 0;
 }
 
-static struct omap_mmc_config omap3_evm_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct platform_device omap3_evm_lcd_device = {
        .name           = "omap3evm_lcd",
        .id             = -1,
@@ -208,7 +201,6 @@ static void __init omap3_evm_init_irq(void)
 
 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
        { OMAP_TAG_UART,        &omap3_evm_uart_config },
-       { OMAP_TAG_MMC,         &omap3_evm_mmc_config },
        { OMAP_TAG_LCD,         &omap3_evm_lcd_config },
 };
 
index 175a444089c527b05a5b9bbb696669ceb33e3467..396ec33d5c4b267209c4744abf485ec280f7ed5a 100644 (file)
@@ -158,17 +158,6 @@ static void __init overo_init_irq(void)
        omap_gpio_init();
 }
 
-static struct omap_mmc_config overo_mmc_config __initdata = {
-       .mmc[0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-       .mmc[1] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct platform_device overo_twl4030rtc_device = {
        .name           = "twl4030_rtc",
        .id             = -1,
@@ -185,7 +174,6 @@ static struct omap_lcd_config overo_lcd_config __initdata = {
 
 static struct omap_board_config_kernel overo_config[] __initdata = {
        { OMAP_TAG_UART,        &overo_uart_config },
-       { OMAP_TAG_MMC,         &overo_mmc_config },
        { OMAP_TAG_LCD,         &overo_lcd_config },
 };
 
index f0e601c78c47ac9aebec4059e1eb94ddebb0a142..ba0e098cc0f1b86f7c30b35ff33be9eef5154ca2 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
+#include <mach/control.h>
 #include <mach/tc.h>
 #include <mach/board.h>
 #include <mach/mux.h>
 #include <mach/gpio.h>
 #include <mach/eac.h>
+#include <mach/mmc.h>
 
 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
 
@@ -354,6 +356,115 @@ static void omap_init_sha1_md5(void)
 static inline void omap_init_sha1_md5(void) { }
 #endif
 
+/*-------------------------------------------------------------------------*/
+
+#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)
+{
+       if (!cpu_is_omap2420())
+               return;
+
+       if (info->slots[0].enabled) {
+               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) {
+                       omap_cfg_reg(H14_24XX_MMC_DAT1);
+                       omap_cfg_reg(E19_24XX_MMC_DAT2);
+                       omap_cfg_reg(D19_24XX_MMC_DAT3);
+                       omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
+                       omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
+                       omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
+               }
+
+               /*
+                * Use internal loop-back in MMC/SDIO Module Input Clock
+                * selection
+                */
+               if (info->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)
+{
+       if (!info)
+               return;
+
+       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);
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+
 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
 #define OMAP_HDQ_BASE  0x480B2000
index 3805b930e0a85d35b85ef8febe71185b198a092d..7334d86aa87c7ca61b89e1f46ded850a3ad169e2 100644 (file)
@@ -265,6 +265,8 @@ static struct omap_mmc_platform_data hsmmc_data = {
        .resume                         = hsmmc_resume,
 #endif
        .slots[0] = {
+               .enabled                = 1,
+               .wire4                  = 1,
                .set_power              = hsmmc_set_power,
                .set_bus_mode           = NULL,
                .get_ro                 = NULL,
@@ -280,7 +282,7 @@ static struct omap_mmc_platform_data hsmmc_data = {
 
 void __init hsmmc_init(void)
 {
-       omap_set_mmc_info(1, &hsmmc_data);
+       omap2_init_mmc(&hsmmc_data);
 }
 
 #else
index 5312677053ace03b5d76e98e4bf5055a35efc965..f633697aa50f58512a249d591c27661455831612 100644 (file)
@@ -21,7 +21,6 @@
 #include <asm/mach/map.h>
 
 #include <mach/tc.h>
-#include <mach/control.h>
 #include <mach/board.h>
 #include <mach/mmc.h>
 #include <mach/mux.h>
@@ -195,212 +194,22 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
 #if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
        defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
-#define        OMAP_MMC1_BASE          0x4809c000
-#define        OMAP_MMC1_END           (OMAP_MMC1_BASE + 0x1fc)
-#define        OMAP_MMC1_INT           INT_24XX_MMC_IRQ
-
-#define        OMAP_MMC2_BASE          0x480b4000
-#define        OMAP_MMC2_END           (OMAP_MMC2_BASE + 0x1fc)
-#define        OMAP_MMC2_INT           INT_24XX_MMC2_IRQ
-
-#else
-
-#define        OMAP_MMC1_BASE          0xfffb7800
-#define        OMAP_MMC1_END           (OMAP_MMC1_BASE + 0x7f)
-#define OMAP_MMC1_INT          INT_MMC
-
-#define        OMAP_MMC2_BASE          0xfffb7c00      /* omap16xx only */
-#define        OMAP_MMC2_END           (OMAP_MMC2_BASE + 0x7f)
-#define        OMAP_MMC2_INT           INT_1610_MMC2
-
-#endif
-
-static struct omap_mmc_platform_data mmc1_data;
-
-static u64 mmc1_dmamask = 0xffffffff;
-
-static struct resource mmc1_resources[] = {
-       {
-               .start          = OMAP_MMC1_BASE,
-               .end            = OMAP_MMC1_END,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP_MMC1_INT,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device mmc_omap_device1 = {
-       .name           = "mmci-omap",
-       .id             = 1,
-       .dev = {
-               .dma_mask       = &mmc1_dmamask,
-               .platform_data  = &mmc1_data,
-       },
-       .num_resources  = ARRAY_SIZE(mmc1_resources),
-       .resource       = mmc1_resources,
-};
-
-#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
-       defined(CONFIG_ARCH_OMAP34XX)
-
-static struct omap_mmc_platform_data mmc2_data;
-
-static u64 mmc2_dmamask = 0xffffffff;
-
-static struct resource mmc2_resources[] = {
-       {
-               .start          = OMAP_MMC2_BASE,
-               .end            = OMAP_MMC2_END,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP_MMC2_INT,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device mmc_omap_device2 = {
-       .name           = "mmci-omap",
-       .id             = 2,
-       .dev = {
-               .dma_mask       = &mmc2_dmamask,
-               .platform_data  = &mmc2_data,
-       },
-       .num_resources  = ARRAY_SIZE(mmc2_resources),
-       .resource       = mmc2_resources,
-};
-#endif
-
-static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf)
-{
-       if (cpu_is_omap2430() || cpu_is_omap34xx())
-               return;
-
-       if (mmc_conf->mmc[0].enabled) {
-               if (cpu_is_omap24xx()) {
-                       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);
-               } else {
-                       omap_cfg_reg(MMC_CMD);
-                       omap_cfg_reg(MMC_CLK);
-                       omap_cfg_reg(MMC_DAT0);
-                       if (cpu_is_omap1710()) {
-                               omap_cfg_reg(M15_1710_MMC_CLKI);
-                               omap_cfg_reg(P19_1710_MMC_CMDDIR);
-                               omap_cfg_reg(P20_1710_MMC_DATDIR0);
-                       }
-               }
-               if (mmc_conf->mmc[0].wire4) {
-                       if (cpu_is_omap24xx()) {
-                               omap_cfg_reg(H14_24XX_MMC_DAT1);
-                               omap_cfg_reg(E19_24XX_MMC_DAT2);
-                               omap_cfg_reg(D19_24XX_MMC_DAT3);
-                               omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
-                               omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
-                               omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
-                       } else {
-                               omap_cfg_reg(MMC_DAT1);
-                               /* NOTE:  DAT2 can be on W10 (here) or M15 */
-                               if (!mmc_conf->mmc[0].nomux)
-                                       omap_cfg_reg(MMC_DAT2);
-                               omap_cfg_reg(MMC_DAT3);
-                       }
-               }
-#if defined(CONFIG_ARCH_OMAP2420)
-               if (mmc_conf->mmc[0].internal_clock) {
-                       /*
-                        * Use internal loop-back in MMC/SDIO
-                        * Module Input Clock selection
-                        */
-                       if (cpu_is_omap24xx()) {
-                               u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-                               v |= (1 << 24); /* not used in 243x */
-                               omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-                       }
-               }
-#endif
-       }
-
-#ifdef CONFIG_ARCH_OMAP16XX
-       /* block 2 is on newer chips, and has many pinout options */
-       if (mmc_conf->mmc[1].enabled) {
-               if (!mmc_conf->mmc[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 (mmc_conf->mmc[1].wire4) {
-                               omap_cfg_reg(V8_1610_MMC2_DAT1);
-                               omap_cfg_reg(W15_1610_MMC2_DAT2);
-                               omap_cfg_reg(R10_1610_MMC2_DAT3);
-                       }
-
-                       /* These are needed for the level shifter */
-                       omap_cfg_reg(V9_1610_MMC2_CMDDIR);
-                       omap_cfg_reg(V5_1610_MMC2_DATDIR0);
-                       omap_cfg_reg(W19_1610_MMC2_DATDIR1);
-               }
-
-               /* Feedback clock must be set on OMAP-1710 MMC2 */
-               if (cpu_is_omap1710())
-                       omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
-                                    MOD_CONF_CTRL_1);
-       }
-#endif
-}
-
-static void __init omap_init_mmc(void)
+/*
+ * 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)
 {
-       const struct omap_mmc_config    *mmc_conf;
-
-       /* NOTE:  assumes MMC was never (wrongly) enabled */
-       mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
-       if (!mmc_conf)
+       if (!info)
                return;
 
-       omap_init_mmc_conf(mmc_conf);
-
-       if (mmc_conf->mmc[0].enabled) {
-               mmc1_data.conf = mmc_conf->mmc[0];
-               (void) platform_device_register(&mmc_omap_device1);
-       }
-
-#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
-       defined(CONFIG_ARCH_OMAP34XX)
-       if (mmc_conf->mmc[1].enabled) {
-               mmc2_data.conf = mmc_conf->mmc[1];
-               (void) platform_device_register(&mmc_omap_device2);
-       }
-#endif
-}
+       if (info->slots[0].enabled && pdev1)
+               (void) platform_device_register(pdev1);
 
-void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info)
-{
-       switch (host) {
-       case 1:
-               mmc1_data = *info;
-               break;
-#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
-       defined(CONFIG_ARCH_OMAP34XX)
-       case 2:
-               mmc2_data = *info;
-               break;
-#endif
-       default:
-               BUG();
-       }
+       if (info->slots[1].enabled && pdev2)
+               (void) platform_device_register(pdev2);
 }
 
-#else
-static inline void omap_init_mmc(void) {}
-void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) {}
 #endif
 
 /*-------------------------------------------------------------------------*/
@@ -545,7 +354,6 @@ static int __init omap_init_devices(void)
         */
        omap_init_dsp();
        omap_init_kp();
-       omap_init_mmc();
        omap_init_uwire();
        omap_init_wdt();
        omap_init_rng();
index a1a66ac8576f92072dda1ad7c8835abd4b780eb5..2ba5e5dffadedeb125286490e7c3465bf34e2516 100644 (file)
@@ -16,7 +16,6 @@
 
 /* Different peripheral ids */
 #define OMAP_TAG_CLOCK         0x4f01
-#define OMAP_TAG_MMC           0x4f02
 #define OMAP_TAG_SERIAL_CONSOLE 0x4f03
 #define OMAP_TAG_USB           0x4f04
 #define OMAP_TAG_LCD           0x4f05
@@ -38,27 +37,6 @@ struct omap_clock_config {
        u8 system_clock_type;
 };
 
-struct omap_mmc_conf {
-       unsigned enabled:1;
-       /* nomux means "standard" muxing is wrong on this board, and that
-        * board-specific code handled it before common init logic.
-        */
-       unsigned nomux:1;
-       /* switch pin can be for card detect (default) or card cover */
-       unsigned cover:1;
-       /* 4 wire signaling is optional, and is only used for SD/SDIO */
-       unsigned wire4:1;
-       /* use the internal clock */
-       unsigned internal_clock:1;
-       s16 power_pin;
-       s16 switch_pin;
-       s16 wp_pin;
-};
-
-struct omap_mmc_config {
-       struct omap_mmc_conf mmc[2];
-};
-
 struct omap_serial_console_config {
        u8 console_uart;
        u32 console_speed;
index c4830153a4f3359d08d8e37b6bd318bd9b3bc6cb..af391e6a16ddb74e1e4ca97e45ff6a7adff7b562 100644 (file)
@@ -20,7 +20,6 @@
 #define OMAP_MMC_MAX_SLOTS     2
 
 struct omap_mmc_platform_data {
-       struct omap_mmc_conf    conf;
 
        /* number of slots on board */
        unsigned nr_slots:2;
@@ -42,6 +41,27 @@ struct omap_mmc_platform_data {
        int (*resume)(struct device *dev, int slot);
 
        struct omap_mmc_slot_data {
+
+               unsigned enabled:1;
+
+               /*
+                * nomux means "standard" muxing is wrong on this board, and
+                * that board-specific code handled it before common init logic.
+                */
+               unsigned nomux:1;
+
+               /* switch pin can be for card detect (default) or card cover */
+               unsigned cover:1;
+
+               /* 4 wire signaling is optional, and is only used for SD/SDIO */
+               unsigned wire4:1;
+
+               /* use the internal clock */
+               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);
                int (* get_ro)(struct device *dev, int slot);
@@ -66,11 +86,28 @@ struct omap_mmc_platform_data {
        } slots[OMAP_MMC_MAX_SLOTS];
 };
 
-extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info);
-
 /* called from board-specific card detection service routine */
 extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
 
+#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);
+#else
+static inline void omap1_init_mmc(struct omap_mmc_platform_data *info)
+{
+}
+static inline void omap2_init_mmc(struct omap_mmc_platform_data *info)
+{
+}
+static inline void omap_init_mmc(struct omap_mmc_platform_data *info,
+               struct platform_device *pdev1, struct platform_device *pdev2)
+{
+}
+#endif
+
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 void __init hsmmc_init(void);
 #endif
index 1b9fc3c6b8752240c591aa23ed6a7d0f13bbea44..608829423c22fc66db336359b771b13f829d693f 100644 (file)
@@ -1317,7 +1317,7 @@ static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id)
        host->slots[id] = slot;
 
        mmc->caps = 0;
-       if (host->pdata->conf.wire4)
+       if (host->pdata->slots[id].wire4)
                mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        mmc->ops = &mmc_omap_ops;
index dc8a13950ee00cb10dc52699eb1ea15958c14660..997f0dccd4209b231877b9cffc526fe196cdcad3 100644 (file)
@@ -881,7 +881,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
        mmc->ocr_avail = mmc_slot(host).ocr_mask;
        mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
 
-       if (pdata->conf.wire4)
+       if (pdata->slots[host->slot_id].wire4)
                mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        /* Only MMC1 supports 3.0V */