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

mmc: Allow the tmio_mmc mfd driver to specify get_cd handler

Some controllers, supported by the tmio_mmc driver do not have the card
detect pin of a slot connected, so that polling needs to be used and
card detection is handled by other means.
This patch 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
19ca7502 9b16c0a4

+14
+13
drivers/mmc/host/tmio_mmc.c
··· 756 756 (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)) ? 0 : 1; 757 757 } 758 758 759 + static int tmio_mmc_get_cd(struct mmc_host *mmc) 760 + { 761 + struct tmio_mmc_host *host = mmc_priv(mmc); 762 + struct mfd_cell *cell = host->pdev->dev.platform_data; 763 + struct tmio_mmc_data *pdata = cell->driver_data; 764 + 765 + if (!pdata->get_cd) 766 + return -ENOSYS; 767 + else 768 + return pdata->get_cd(host->pdev); 769 + } 770 + 759 771 static const struct mmc_host_ops tmio_mmc_ops = { 760 772 .request = tmio_mmc_request, 761 773 .set_ios = tmio_mmc_set_ios, 762 774 .get_ro = tmio_mmc_get_ro, 775 + .get_cd = tmio_mmc_get_cd, 763 776 }; 764 777 765 778 #ifdef CONFIG_PM
+1
include/linux/mfd/tmio.h
··· 74 74 struct tmio_mmc_dma *dma; 75 75 void (*set_pwr)(struct platform_device *host, int state); 76 76 void (*set_clk_div)(struct platform_device *host, int state); 77 + int (*get_cd)(struct platform_device *host); 77 78 }; 78 79 79 80 /*