omap4: pandaboard: fix up mmc card detect logic
authorMenon, Nishanth <nm@ti.com>
Tue, 19 Oct 2010 14:50:25 +0000 (09:50 -0500)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 28 Oct 2010 22:30:32 +0000 (00:30 +0200)
For MMC1 Controller, card detect interrupt source is
twl6030 which is non-gpio. The card detect call back function provides
card present/absent status by reading MMC Control register present
on twl6030. This functionality was introduced in mfd tree on
track to kernel.org

Sync pandaboard to the same and make mmc work.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Acked-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Tested-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Madhusudhan Chikkature <madhu.cr@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
arch/arm/mach-omap2/board-omap4panda.c

index 702f2a63f2c1b891ca8afdd1bf6f34b6c9016699..1ecd0a6cefb777736e6148060e74557783280e2b 100644 (file)
@@ -160,10 +160,19 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev)
                                struct platform_device, dev);
        struct omap_mmc_platform_data *pdata = dev->platform_data;
 
+       if (!pdata) {
+               dev_err(dev, "%s: NULL platform data\n", __func__);
+               return -EINVAL;
+       }
        /* Setting MMC1 Card detect Irq */
-       if (pdev->id == 0)
-               pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
-                                               MMCDETECT_INTR_OFFSET;
+       if (pdev->id == 0) {
+               ret = twl6030_mmc_card_detect_config();
+                if (ret)
+                       dev_err(dev, "%s: Error card detect config(%d)\n",
+                               __func__, ret);
+                else
+                       pdata->slots[0].card_detect = twl6030_mmc_card_detect;
+       }
        return ret;
 }