Thread (30 messages) 30 messages, 3 authors, 2013-12-17
STALE4594d

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

From: Dong Aisheng <hidden>
Date: 2013-12-17 06:15:59
Also in: linux-mmc

On Wed, Dec 11, 2013 at 1:55 PM, Shawn Guo [off-list ref] wrote:
On Wed, Dec 11, 2013 at 12:59:55PM +0800, Dong Aisheng wrote:
quoted
On Wed, Dec 11, 2013 at 11:56 AM, Shawn Guo [off-list ref] wrote:
quoted
On Wed, Dec 11, 2013 at 11:20:59AM +0800, Dong Aisheng wrote:
quoted
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?
The example you give is not correct here.
Sorry.  Yes, there is a error in my example code.  What about this?

        mmc->max_discard_to = host->ops->hook_foo ? host->ops->hook_foo(host) : 1 << 27;
        mmc->max_discard_to /= host->timeout_clk;
Actually i did like this for FSL internal tree.
Just because one concern that other SoCs may have different case
e.g. for imx5, the max count becomes 1 << 26 when DDR is enabled.
Then this way becomes unwork.
And i don't know how many other special SoC exists working on different way.
So i prefer-ed a more flexible way in this patch.

However, after one more thought, since the issue of the example i gave
can be addressed with my patch 5 (able to update max_discard_to when
DDR enabled).
And we already have timeout_clk hook, so it seems we could also go this way.

Regards
Dong Aisheng
Shawn
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help