Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 777271d0 authored by Arnd Hannemann's avatar Arnd Hannemann Committed by Samuel Ortiz
Browse files

mmc: Allow the platform to specify the sh_mmcif get_cd handler



In some platforms (e.g. AP4EVB) the card detect pin of a slot is not
directly connected to the sh_mmcif controller, so that polling needs
to be used. To overcome the overhead induced by querying the controller
on each poll cycle, card detection can be handled in the platform code
more efficiently.
This patch exposes a get_cd hook for that purpose.

Signed-off-by: default avatarArnd Hannemann <arnd@arndnet.de>
Tested-by: default avatarYusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 998283e2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -710,9 +710,21 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
	host->bus_width = ios->bus_width;
}

static int sh_mmcif_get_cd(struct mmc_host *mmc)
{
	struct sh_mmcif_host *host = mmc_priv(mmc);
	struct sh_mmcif_plat_data *p = host->pd->dev.platform_data;

	if (!p->get_cd)
		return -ENOSYS;
	else
		return p->get_cd(host->pd);
}

static struct mmc_host_ops sh_mmcif_ops = {
	.request	= sh_mmcif_request,
	.set_ios	= sh_mmcif_set_ios,
	.get_cd		= sh_mmcif_get_cd,
};

static void sh_mmcif_detect(struct mmc_host *mmc)
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
struct sh_mmcif_plat_data {
	void (*set_pwr)(struct platform_device *pdev, int state);
	void (*down_pwr)(struct platform_device *pdev);
	int (*get_cd)(struct platform_device *pdef);
	u8	sup_pclk;	/* 1 :SH7757, 0: SH7724/SH7372 */
	unsigned long caps;
	u32	ocr;