]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
mfd: Allow the platform to specify the sh_mobile_sdhi get_cd handler
authorArnd Hannemann <arnd@arndnet.de>
Tue, 24 Aug 2010 15:27:00 +0000 (17:27 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 28 Oct 2010 22:29:11 +0000 (00:29 +0200)
On some platforms (e.g. AP4EVB) the card detect pin of a slot is not
directly connected to the sdhi hardware, so that polling needs to be used
with tmio_mmc and card detection is handled in the platform code.
This patch allows to set tmio_mmc capabilities (to pass the
MMC_CAP_NEEDS_POLL flag) and exposes a get_cd hook for that purpose.

Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/sh_mobile_sdhi.c
include/linux/mfd/sh_mobile_sdhi.h

index 49b4d069cbf912070b16e3d740fceaa17ef662af..01d83a41d570a1a5ccf2decdc167eed774fa7bfa 100644 (file)
@@ -65,6 +65,17 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
                p->set_pwr(pdev, state);
 }
 
+static int sh_mobile_sdhi_get_cd(struct platform_device *tmio)
+{
+       struct platform_device *pdev = to_platform_device(tmio->dev.parent);
+       struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
+
+       if (p && p->get_cd)
+               return p->get_cd(pdev);
+       else
+               return -ENOSYS;
+}
+
 static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
        struct sh_mobile_sdhi *priv;
@@ -106,10 +117,12 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
 
        mmc_data->hclk = clk_get_rate(priv->clk);
        mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
+       mmc_data->get_cd = sh_mobile_sdhi_get_cd;
        mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
        if (p) {
                mmc_data->flags = p->tmio_flags;
                mmc_data->ocr_mask = p->tmio_ocr_mask;
+               mmc_data->capabilities |= p->tmio_caps;
        }
 
        if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
index 49067802a6d77e0ec347d3ef8a102b9ccd1a0352..c981b959760f717ffff9e88895900bb6e46321bf 100644 (file)
@@ -7,8 +7,10 @@ struct sh_mobile_sdhi_info {
        int dma_slave_tx;
        int dma_slave_rx;
        unsigned long tmio_flags;
+       unsigned long tmio_caps;
        u32 tmio_ocr_mask;      /* available MMC voltages */
        void (*set_pwr)(struct platform_device *pdev, int state);
+       int (*get_cd)(struct platform_device *pdev);
 };
 
 #endif /* __SH_MOBILE_SDHI_H__ */