Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Allow the platform to specify the sh_mobile_sdhi get_cd handler

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>

authored by

Arnd Hannemann and committed by
Samuel Ortiz
998283e2 19ca7502

+15
+13
drivers/mfd/sh_mobile_sdhi.c
··· 65 65 p->set_pwr(pdev, state); 66 66 } 67 67 68 + static int sh_mobile_sdhi_get_cd(struct platform_device *tmio) 69 + { 70 + struct platform_device *pdev = to_platform_device(tmio->dev.parent); 71 + struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; 72 + 73 + if (p && p->get_cd) 74 + return p->get_cd(pdev); 75 + else 76 + return -ENOSYS; 77 + } 78 + 68 79 static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) 69 80 { 70 81 struct sh_mobile_sdhi *priv; ··· 117 106 118 107 mmc_data->hclk = clk_get_rate(priv->clk); 119 108 mmc_data->set_pwr = sh_mobile_sdhi_set_pwr; 109 + mmc_data->get_cd = sh_mobile_sdhi_get_cd; 120 110 mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; 121 111 if (p) { 122 112 mmc_data->flags = p->tmio_flags; 123 113 mmc_data->ocr_mask = p->tmio_ocr_mask; 114 + mmc_data->capabilities |= p->tmio_caps; 124 115 } 125 116 126 117 if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
+2
include/linux/mfd/sh_mobile_sdhi.h
··· 7 7 int dma_slave_tx; 8 8 int dma_slave_rx; 9 9 unsigned long tmio_flags; 10 + unsigned long tmio_caps; 10 11 u32 tmio_ocr_mask; /* available MMC voltages */ 11 12 void (*set_pwr)(struct platform_device *pdev, int state); 13 + int (*get_cd)(struct platform_device *pdev); 12 14 }; 13 15 14 16 #endif /* __SH_MOBILE_SDHI_H__ */