[PATCH 1/6] mmc: sdhci: add platfrom get_max_timeout hook

Shawn Guo shawn.guo at linaro.org
Tue Dec 10 22:56:56 EST 2013


On Wed, Dec 11, 2013 at 11:20:59AM +0800, Dong Aisheng wrote:
> No, the max_to is the max timeout counter value, you need to divide it
> by the timeout clock
> to get the timeout time.
> The defined of this API is return the max timeout value in
> miliseconds, so you need to
> divide the clock by 1000.
> None of these handles the detail bout discard_to.

Let me start it over again.  Here is basically what your patch does.

-     mmc->max_discard_to = (1 << 27) / host->timeout_clk;
+     if (host->ops->get_max_timeout)
+             mmc->max_discard_to = host->ops->get_max_timeout(host);

The only thing that does not work for you in the existing code is the
(1 << 27) part, right?

If so, why not just create a platform hook to return the correct thing
for you platform, i.e. (1 << 28)?

	if (host->ops->get_max_timeout)
		mmc->max_discard_to = host->ops->hook_foo(host);

unsigned int esdhc_hook_foo(struct sdhci_host *host)
{
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct pltfm_imx_data *imx_data = pltfm_host->priv;

	return esdhc_is_usdhc(imx_data) ? 1 << 28 : 1 << 27;
}

Such patch will be ease to be understood and less offensive to the
existing code, no?

Shawn




More information about the linux-arm-kernel mailing list