Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[safe/jmp/linux-2.6] / drivers / mfd / sh_mobile_sdhi.c
index 56f72cc..497f91b 100644 (file)
 
 #include <linux/kernel.h>
 #include <linux/clk.h>
+#include <linux/slab.h>
 #include <linux/platform_device.h>
-
+#include <linux/mmc/host.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 
 struct sh_mobile_sdhi {
        struct clk *clk;
@@ -50,6 +52,15 @@ static struct mfd_cell sh_mobile_sdhi_cell = {
        .resources     = sh_mobile_sdhi_resources,
 };
 
+static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
+{
+       struct platform_device *pdev = to_platform_device(tmio->dev.parent);
+       struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
+
+       if (p && p->set_pwr)
+               p->set_pwr(pdev, state);
+}
+
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
        struct sh_mobile_sdhi *priv;
@@ -85,8 +96,9 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 
        clk_enable(priv->clk);
 
-       /* FIXME: silly const unsigned int hclk */
-       *(unsigned int *)&priv->mmc_data.hclk = clk_get_rate(priv->clk);
+       priv->mmc_data.hclk = clk_get_rate(priv->clk);
+       priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr;
+       priv->mmc_data.capabilities = MMC_CAP_MMC_HIGHSPEED;
 
        memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
        priv->cell_mmc.driver_data = &priv->mmc_data;