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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 11, 2013 at 1:55 PM, Shawn Guo <shawn.guo@xxxxxxxxxx> wrote:
> On Wed, Dec 11, 2013 at 12:59:55PM +0800, Dong Aisheng wrote:
>> On Wed, Dec 11, 2013 at 11:56 AM, Shawn Guo <shawn.guo@xxxxxxxxxx> wrote:
>> > 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?
>> >
>>
>> 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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux