ARM: davinci: mmc: derive version information from device name
authorManjunathappa, Prakash <prakash.pm@ti.com>
Thu, 28 Mar 2013 13:11:59 +0000 (18:41 +0530)
committerSekhar Nori <nsekhar@ti.com>
Wed, 3 Apr 2013 04:12:16 +0000 (09:42 +0530)
Remove specifying mmc controller IP version information via platform
data, instead specify device name so that driver derives it from
platform_device_id table. Also change the clock node name to match
the changed dev_id.
Tested on da850-evm to make sure driver loads without clk_get failures.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
19 files changed:
arch/arm/mach-davinci/board-da830-evm.c
arch/arm/mach-davinci/board-da850-evm.c
arch/arm/mach-davinci/board-dm355-evm.c
arch/arm/mach-davinci/board-dm365-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-neuros-osd2.c
arch/arm/mach-davinci/board-omapl138-hawk.c
arch/arm/mach-davinci/board-tnetv107x-evm.c
arch/arm/mach-davinci/da830.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/devices-tnetv107x.c
arch/arm/mach-davinci/devices.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/tnetv107x.c
drivers/mmc/host/davinci_mmc.c
include/linux/platform_data/mmc-davinci.h

index 6da25eebf9110f3548fa8f803f0d81bf7e330b4e..12e6f756361da8b94c781082324ed94309eb7af1 100644 (file)
@@ -246,7 +246,6 @@ static struct davinci_mmc_config da830_evm_mmc_config = {
        .wires                  = 8,
        .max_freq               = 50000000,
        .caps                   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-       .version                = MMC_CTLR_VERSION_2,
 };
 
 static inline void da830_evm_init_mmc(void)
index c2dfe06563df2af58c02efea8973b17eb0420179..dcc8710936a5d598425f84efd35d3602d7b6bba9 100644 (file)
@@ -802,7 +802,6 @@ static struct davinci_mmc_config da850_mmc_config = {
        .wires          = 4,
        .max_freq       = 50000000,
        .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-       .version        = MMC_CTLR_VERSION_2,
 };
 
 static const short da850_evm_mmcsd0_pins[] __initconst = {
@@ -1372,7 +1371,6 @@ static struct davinci_mmc_config da850_wl12xx_mmc_config = {
        .max_freq       = 25000000,
        .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
                          MMC_CAP_POWER_OFF_CARD,
-       .version        = MMC_CTLR_VERSION_2,
 };
 
 static const short da850_wl12xx_pins[] __initconst = {
index 147b8e1a4407f794052de4579ba6630f195f982b..bfdf8b979a64d1e0219738a2a020bb5f0b6527a3 100644 (file)
@@ -280,7 +280,6 @@ static struct davinci_mmc_config dm355evm_mmc_config = {
        .wires          = 4,
        .max_freq       = 50000000,
        .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-       .version        = MMC_CTLR_VERSION_1,
 };
 
 /* Don't connect anything to J10 unless you're only using USB host
index c2d4958a0cb6a632a4d1b7b5f5bc8c56dafbc424..4cfdd9109e19fe362252f83d21bcf1595b131aee 100644 (file)
@@ -253,7 +253,6 @@ static struct davinci_mmc_config dm365evm_mmc_config = {
        .wires          = 4,
        .max_freq       = 50000000,
        .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-       .version        = MMC_CTLR_VERSION_2,
 };
 
 static void dm365evm_emac_configure(void)
index 71735e7797cc147d89590d27570802fa57979f3e..c0206d5f2bf6e54c4760375daf4e763e6de0ba6a 100644 (file)
@@ -570,7 +570,6 @@ static struct davinci_mmc_config dm6446evm_mmc_config = {
        .get_cd         = dm6444evm_mmc_get_cd,
        .get_ro         = dm6444evm_mmc_get_ro,
        .wires          = 4,
-       .version        = MMC_CTLR_VERSION_1
 };
 
 static struct i2c_board_info __initdata i2c_info[] =  {
index 1c98107527fa5a0d83353f058660a1a48fc228c2..b70e83c03bed87c8769c4954d297ff4f5f8d05ba 100644 (file)
@@ -164,7 +164,6 @@ static void __init davinci_ntosd2_map_io(void)
 
 static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
        .wires          = 4,
-       .version        = MMC_CTLR_VERSION_1
 };
 
 
index 5a2bd44da54d8493f5da9bbbb52ab663fb729bdc..328dbd8a37f5b3871fcad3edff523009c46dbb7a 100644 (file)
@@ -136,7 +136,6 @@ static struct davinci_mmc_config da850_mmc_config = {
        .wires          = 4,
        .max_freq       = 50000000,
        .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-       .version        = MMC_CTLR_VERSION_2,
 };
 
 static __init void omapl138_hawk_mmc_init(void)
index 4f416023d4e2d1d09f8ab1bf18d6e4663066ad8f..ba798370fc96d1b8f338a20903bd5e0891280b80 100644 (file)
@@ -85,7 +85,6 @@ static struct davinci_mmc_config mmc_config = {
        .wires          = 4,
        .max_freq       = 50000000,
        .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-       .version        = MMC_CTLR_VERSION_1,
 };
 
 static const short sdio1_pins[] __initconst = {
index 678a54a64daee17b09cf096cf4bcb2f31199383b..abbaf0270be6550795b824e36b6fda2de933c3aa 100644 (file)
@@ -394,7 +394,7 @@ static struct clk_lookup da830_clks[] = {
        CLK(NULL,               "tpcc",         &tpcc_clk),
        CLK(NULL,               "tptc0",        &tptc0_clk),
        CLK(NULL,               "tptc1",        &tptc1_clk),
-       CLK("davinci_mmc.0",    NULL,           &mmcsd_clk),
+       CLK("da830-mmc.0",      NULL,           &mmcsd_clk),
        CLK(NULL,               "uart0",        &uart0_clk),
        CLK(NULL,               "uart1",        &uart1_clk),
        CLK(NULL,               "uart2",        &uart2_clk),
index 2a2f60c54ec6a1b1b6c829403996ba0916fddabb..4d6933848abfaeaab005ed972916fb0cfb69b5da 100644 (file)
@@ -463,8 +463,8 @@ static struct clk_lookup da850_clks[] = {
        CLK("davinci_emac.1",   NULL,           &emac_clk),
        CLK("davinci-mcasp.0",  NULL,           &mcasp_clk),
        CLK("da8xx_lcdc.0",     "fck",          &lcdc_clk),
-       CLK("davinci_mmc.0",    NULL,           &mmcsd0_clk),
-       CLK("davinci_mmc.1",    NULL,           &mmcsd1_clk),
+       CLK("da830-mmc.0",      NULL,           &mmcsd0_clk),
+       CLK("da830-mmc.1",      NULL,           &mmcsd1_clk),
        CLK(NULL,               "aemif",        &aemif_clk),
        CLK(NULL,               "usb11",        &usb11_clk),
        CLK(NULL,               "usb20",        &usb20_clk),
index fc50243b1481ca471efca2271b0f7b93ba7d7f7e..cb97e07db284df9b956b03dd3aeb28bc843cb0f2 100644 (file)
@@ -664,7 +664,7 @@ static struct resource da8xx_mmcsd0_resources[] = {
 };
 
 static struct platform_device da8xx_mmcsd0_device = {
-       .name           = "davinci_mmc",
+       .name           = "da830-mmc",
        .id             = 0,
        .num_resources  = ARRAY_SIZE(da8xx_mmcsd0_resources),
        .resource       = da8xx_mmcsd0_resources,
@@ -701,7 +701,7 @@ static struct resource da850_mmcsd1_resources[] = {
 };
 
 static struct platform_device da850_mmcsd1_device = {
-       .name           = "davinci_mmc",
+       .name           = "da830-mmc",
        .id             = 1,
        .num_resources  = ARRAY_SIZE(da850_mmcsd1_resources),
        .resource       = da850_mmcsd1_resources,
index 773ab07a71a0536351ab2ba00338f769f159237e..cfb194df18edb7f72deaf907858905781bac210f 100644 (file)
@@ -218,7 +218,7 @@ static u64 mmc1_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device mmc_devices[2] = {
        {
-               .name           = "davinci_mmc",
+               .name           = "dm6441-mmc",
                .id             = 0,
                .dev            = {
                        .dma_mask               = &mmc0_dma_mask,
@@ -228,7 +228,7 @@ static struct platform_device mmc_devices[2] = {
                .resource       = mmc0_resources
        },
        {
-               .name           = "davinci_mmc",
+               .name           = "dm6441-mmc",
                .id             = 1,
                .dev            = {
                        .dma_mask               = &mmc1_dma_mask,
index 4c48a36ee567d6a98b2eb5d0a56ef9b51f2121b0..f6927df2dda861ada422677564426a40fb3f6df4 100644 (file)
@@ -150,7 +150,7 @@ static struct resource mmcsd0_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd0_device = {
-       .name = "davinci_mmc",
+       .name = "dm6441-mmc",
        .id = 0,
        .dev = {
                .dma_mask = &mmcsd0_dma_mask,
@@ -187,7 +187,7 @@ static struct resource mmcsd1_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd1_device = {
-       .name = "davinci_mmc",
+       .name = "dm6441-mmc",
        .id = 1,
        .dev = {
                .dma_mask = &mmcsd1_dma_mask,
@@ -235,6 +235,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
                        mmcsd1_resources[0].end = DM365_MMCSD1_BASE +
                                                        SZ_4K - 1;
                        mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1;
+                       davinci_mmcsd1_device.name = "da830-mmc";
                } else
                        break;
 
@@ -256,6 +257,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
                        mmcsd0_resources[0].end = DM365_MMCSD0_BASE +
                                                        SZ_4K - 1;
                        mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0;
+                       davinci_mmcsd0_device.name = "da830-mmc";
                } else if (cpu_is_davinci_dm644x()) {
                        /* REVISIT: should this be in board-init code? */
                        /* Power-on 3.3V IO cells */
index b49c3b77d55e5ac3e9884762a2fcdab28c03453b..87e6104f45e657eaec9026d22120aba25de93b7b 100644 (file)
@@ -361,8 +361,8 @@ static struct clk_lookup dm355_clks[] = {
        CLK("i2c_davinci.1", NULL, &i2c_clk),
        CLK("davinci-mcbsp.0", NULL, &asp0_clk),
        CLK("davinci-mcbsp.1", NULL, &asp1_clk),
-       CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
-       CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
+       CLK("dm6441-mmc.0", NULL, &mmcsd0_clk),
+       CLK("dm6441-mmc.1", NULL, &mmcsd1_clk),
        CLK("spi_davinci.0", NULL, &spi0_clk),
        CLK("spi_davinci.1", NULL, &spi1_clk),
        CLK("spi_davinci.2", NULL, &spi2_clk),
index 6c3980540be0525a9e3d7a5c699ed2221d378a35..2791df9187b3f8acfd18ead5ad3e238ad8d9414d 100644 (file)
@@ -454,8 +454,8 @@ static struct clk_lookup dm365_clks[] = {
        CLK(NULL, "uart0", &uart0_clk),
        CLK(NULL, "uart1", &uart1_clk),
        CLK("i2c_davinci.1", NULL, &i2c_clk),
-       CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
-       CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
+       CLK("da830-mmc.0", NULL, &mmcsd0_clk),
+       CLK("da830-mmc.1", NULL, &mmcsd1_clk),
        CLK("spi_davinci.0", NULL, &spi0_clk),
        CLK("spi_davinci.1", NULL, &spi1_clk),
        CLK("spi_davinci.2", NULL, &spi2_clk),
index db1dd92e00af44c13f7f55f0ae364f08be1035c4..ab6bf54c65c7c7451f1457d99bdd556a4dee1bbf 100644 (file)
@@ -310,7 +310,7 @@ static struct clk_lookup dm644x_clks[] = {
        CLK("i2c_davinci.1", NULL, &i2c_clk),
        CLK("palm_bk3710", NULL, &ide_clk),
        CLK("davinci-mcbsp", NULL, &asp_clk),
-       CLK("davinci_mmc.0", NULL, &mmcsd_clk),
+       CLK("dm6441-mmc.0", NULL, &mmcsd_clk),
        CLK(NULL, "spi", &spi_clk),
        CLK(NULL, "gpio", &gpio_clk),
        CLK(NULL, "usb", &usb_clk),
index dc1a209b9b66624fdfa8f748e237b682e3cec18a..3b2a70d43efac247b65a055f949d7df5814e79a8 100644 (file)
@@ -272,7 +272,7 @@ static struct clk_lookup clks[] = {
        CLK("tnetv107x-keypad.0", NULL,                 &clk_keypad),
        CLK(NULL,               "clk_gpio",             &clk_gpio),
        CLK(NULL,               "clk_mdio",             &clk_mdio),
-       CLK("davinci_mmc.0",    NULL,                   &clk_sdio0),
+       CLK("dm6441-mmc.0",     NULL,                   &clk_sdio0),
        CLK(NULL,               "uart0",                &clk_uart0),
        CLK(NULL,               "uart1",                &clk_uart1),
        CLK(NULL,               "timer0",               &clk_timer0),
@@ -292,7 +292,7 @@ static struct clk_lookup clks[] = {
        CLK(NULL,               "clk_system",           &clk_system),
        CLK(NULL,               "clk_imcop",            &clk_imcop),
        CLK(NULL,               "clk_spare",            &clk_spare),
-       CLK("davinci_mmc.1",    NULL,                   &clk_sdio1),
+       CLK("dm6441-mmc.1",     NULL,                   &clk_sdio1),
        CLK(NULL,               "clk_ddr2_vrst",        &clk_ddr2_vrst),
        CLK(NULL,               "clk_ddr2_vctl_rst",    &clk_ddr2_vctl_rst),
        CLK(NULL,               NULL,                   NULL),
index 20636772c09bd2aa2b794f44c3029e1f57559578..b5f1c019ecad97d1f1403db2e2ce01508202e606 100644 (file)
@@ -1157,6 +1157,18 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
        mmc_davinci_reset_ctrl(host, 0);
 }
 
+static struct platform_device_id davinci_mmc_devtype[] = {
+       {
+               .name   = "dm6441-mmc",
+               .driver_data = MMC_CTLR_VERSION_1,
+       }, {
+               .name   = "da830-mmc",
+               .driver_data = MMC_CTLR_VERSION_2,
+       },
+       {},
+};
+MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
+
 static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 {
        struct davinci_mmc_config *pdata = pdev->dev.platform_data;
@@ -1165,6 +1177,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
        struct resource *r, *mem = NULL;
        int ret = 0, irq = 0;
        size_t mem_size;
+       const struct platform_device_id *id_entry;
 
        /* REVISIT:  when we're fully converted, fail if pdata is NULL */
 
@@ -1237,7 +1250,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
        if (pdata && (pdata->wires == 8))
                mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
 
-       host->version = pdata->version;
+       id_entry = platform_get_device_id(pdev);
+       if (id_entry)
+               host->version = id_entry->driver_data;
 
        mmc->ops = &mmc_davinci_ops;
        mmc->f_min = 312500;
@@ -1408,6 +1423,7 @@ static struct platform_driver davinci_mmcsd_driver = {
                .pm     = davinci_mmcsd_pm_ops,
        },
        .remove         = __exit_p(davinci_mmcsd_remove),
+       .id_table       = davinci_mmc_devtype,
 };
 
 static int __init davinci_mmcsd_init(void)
index 5ba6b22ce338e791188b053301e6e768b1556294..9cea4ee377b5bedca8a95f64aa226e3870b962b9 100644 (file)
@@ -23,9 +23,6 @@ struct davinci_mmc_config {
        /* any additional host capabilities: OR'd in to mmc->f_caps */
        u32     caps;
 
-       /* Version of the MMC/SD controller */
-       u8      version;
-
        /* Number of sg segments */
        u8      nr_sg;
 };