[PATCH] glamo-mci: Make use of mmc_host_enable/disable instead of custom timer.

Thibaut Girka thib at sitedethib.com
Mon Jun 14 14:07:24 CEST 2010


Here is a few comments on the patch, explaining why there is quite a lot
of mmc_host_{enable,disable} calls:

> @@ -839,12 +835,12 @@ static int glamo_mci_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, mmc);
>  
> -	glamo_engine_enable(host->core, GLAMO_ENGINE_MMC);
> -	glamo_mci_reset(host);
> -	glamo_engine_disable(host->core, GLAMO_ENGINE_MMC);
> +	mmc->caps |= MMC_CAP_DISABLE;
> +	mmc_set_disable_delay(mmc, 1000 / 16);
>  
> -	setup_timer(&host->disable_timer, glamo_mci_disable_timer,
> -				(unsigned long)host);
> +	mmc_host_enable(mmc);
> +	glamo_mci_reset(host);
> +	mmc_host_lazy_disable(mmc);
> [...]
> @@ -919,16 +918,17 @@ static int glamo_mci_resume(struct device *dev)
> 	struct glamo_mci_host *host = mmc_priv(mmc);
>  	int ret;
>  
> -
> +	mmc_host_enable(mmc);
>  	glamo_mci_reset(host);
> -	glamo_engine_enable(host->core, GLAMO_ENGINE_MMC);
> > [...]
-	return 0;
> +	mmc_host_lazy_disable(host->mmc);

In those two cases, we are calling glamo_mci_reset, so, the engine
should be enabled, which is done with mmc_host_enable.


> @@ -881,7 +877,10 @@ static int glamo_mci_remove(struct platform_device *pdev)
>  
>  	free_irq(host->irq, host);
>  
> +	mmc_host_enable(mmc);
>  	mmc_remove_host(mmc);
> +	mmc_host_disable(mmc);
> +
> [...]
> @@ -908,7 +905,9 @@ static int glamo_mci_suspend(struct device *dev)
>  
>  	disable_irq(host->irq);
>  
> +	mmc_host_enable(mmc);
>  	ret = mmc_suspend_host(mmc, PMSG_SUSPEND);
> +	mmc_host_disable(mmc);

In these two other cases, we are calling mmc_{suspend,remove}_host,
which are calling mmc_stop_host, eventually calling
mmc_host_lazy_disable from mmc_release_host.
This schedules a delayed work, but we want to disable the engine right
now and dismiss any delayed work, since the device won't be available,
that's why we are using mmc_host_disable here.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20100614/e9e1f47e/attachment.pgp 


More information about the openmoko-kernel mailing list