From: David Brownell <[EMAIL PROTECTED]>

Finish basic updates to let the DaVinci MMC driver talk to
the second MMC controller on dm355:

 - Update the MMC driver to use clk_get() correctly
    * use logical "mmc" clockname
    * fix its error handling logic (!)

 - Bugfixes to probe():
    * call mmc_add_host() only *after* everything is set up
    * check for mmc_add_host() errors
    * call request_irq() only after the host was added
    * start timer polling only after the host was added

 - And some cosmetic bits:
    * use more modern timer setup calls
    * request_irq() says mmc0 or mmc1, matching custom

So now it comes up on both MMC controllers, and starts collecting 
interrupts on the second ... so there's progress.  But it can't
see a card in either slot of a dm355 yet.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
 drivers/mmc/host/davinci_mmc.c |   30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -33,6 +33,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/mmc.h>
@@ -1333,12 +1334,14 @@ static int davinci_mmcsd_probe(struct pl
        spin_lock_init(&host->lock);
 
        ret = -ENXIO;
-       host->clk = clk_get(NULL, "MMCSDCLK");
-       if (host->clk) {
+       host->clk = clk_get(&pdev->dev, "mmc");
+       if (!IS_ERR(host->clk)) {
                clk_enable(host->clk);
                host->mmc_input_clk = clk_get_rate(host->clk);
-       } else
+       } else {
+               ret = PTR_ERR(host->clk);
                goto out;
+       }
 
        init_mmcsd_host(host);
 
@@ -1381,18 +1384,21 @@ static int davinci_mmcsd_probe(struct pl
        host->irq = irq;
        host->sd_support = 1;
 
-       ret = request_irq(irq, mmc_davinci_irq, 0, DRIVER_NAME, host);
-       if (ret)
-               goto out;
+       setup_timer(&host->timer, davinci_mmc_check_status,
+                       (unsigned long)host);
 
        platform_set_drvdata(pdev, host);
-       mmc_add_host(mmc);
 
-       init_timer(&host->timer);
-       host->timer.data = (unsigned long)host;
-       host->timer.function = davinci_mmc_check_status;
-       host->timer.expires = jiffies + MULTIPILER_TO_HZ * HZ;
-       add_timer(&host->timer);
+       ret = mmc_add_host(mmc);
+       if (ret < 0)
+               goto out;
+
+       ret = request_irq(irq, mmc_davinci_irq, 0, mmc_hostname(mmc), host);
+       if (ret)
+               goto out;
+
+       /* start probing for card */
+       mod_timer(&host->timer, jiffies + MULTIPILER_TO_HZ * HZ);
 
        dev_info(mmc_dev(host->mmc), "Using %s, %d-bit mode\n",
            mmcsd_cfg.use_dma ? "DMA" : "PIO",

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to