mbox series

[V1,0/2] Introduce new quirk to use reserved timeout

Message ID 1588772671-19675-1-git-send-email-sartgarg@codeaurora.org
Headers show
Series Introduce new quirk to use reserved timeout | expand

Message

Sarthak Garg May 6, 2020, 1:44 p.m. UTC
Introduce a new quirk for letting vendor drivers to use reserved timeout
value (0xF) in timeout control register.

Sarthak Garg (2):
  mmc: sdhci: Introduce new quirk to use reserved timeout
  mmc: sdhci-msm: Use maximum possible data timeout value

 drivers/mmc/host/sdhci-msm.c | 3 ++-
 drivers/mmc/host/sdhci.c     | 3 ++-
 drivers/mmc/host/sdhci.h     | 5 +++++
 3 files changed, 9 insertions(+), 2 deletions(-)

Comments

Sarthak Garg May 19, 2020, 2:08 p.m. UTC | #1
On 2020-05-18 18:20, Ulf Hansson wrote:
> On Mon, 18 May 2020 at 13:45, Adrian Hunter <adrian.hunter@intel.com> 
> wrote:
>> 
>> On 18/05/20 12:39 pm, Ulf Hansson wrote:
>> > On Wed, 6 May 2020 at 15:53, Sarthak Garg <sartgarg@codeaurora.org> wrote:
>> >>
>> >> Introduce a new quirk for letting vendor drivers to use reserved
>> >> timeout value (0xF) in timeout control register.
>> >>
>> >> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
>> >> Signed-off-by: Sarthak Garg <sartgarg@codeaurora.org>
>> >> ---
>> >>  drivers/mmc/host/sdhci.c | 3 ++-
>> >>  drivers/mmc/host/sdhci.h | 5 +++++
>> >>  2 files changed, 7 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> >> index 1bb6b67..07528a9 100644
>> >> --- a/drivers/mmc/host/sdhci.c
>> >> +++ b/drivers/mmc/host/sdhci.c
>> >> @@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>> >>         }
>> >>
>> >>         if (count >= 0xF) {
>> >> -               if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT))
>> >> +               if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) ||
>> >> +               !(host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))
>> >
>> > I don't quite get how this can make your variant use 0xF rather than 0xE?
>> >
>> > To me it looks like an updated conditional check to print a debug message, no?
>> 
>> Probably need to introduce host->max_timeout_count, set it to 0xE in
>> sdhci_alloc_host(), and change sdhci_calc_timeout() to use it in place 
>> of
>> all the 0xE and 0xF constants.
> 
> Yep, that seems like a reasonable approach to me as well.
> 
> [...]
> 
> Kind regards
> Uffe

Resending the mail again as can't see my comment on the 
https://patchwork.kernel.org/ page.
Sorry for the mistake just want to update the logic as below.
-               count = 0xE;
+               if(!(host->quirks2 & 
SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))
+                       count = 0xE;
Adrian Hunter May 24, 2020, 3:57 p.m. UTC | #2
On 19/05/20 5:08 pm, sartgarg@codeaurora.org wrote:
> On 2020-05-18 18:20, Ulf Hansson wrote:
>> On Mon, 18 May 2020 at 13:45, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>
>>> On 18/05/20 12:39 pm, Ulf Hansson wrote:
>>> > On Wed, 6 May 2020 at 15:53, Sarthak Garg <sartgarg@codeaurora.org> wrote:
>>> >>
>>> >> Introduce a new quirk for letting vendor drivers to use reserved
>>> >> timeout value (0xF) in timeout control register.
>>> >>
>>> >> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
>>> >> Signed-off-by: Sarthak Garg <sartgarg@codeaurora.org>
>>> >> ---
>>> >>  drivers/mmc/host/sdhci.c | 3 ++-
>>> >>  drivers/mmc/host/sdhci.h | 5 +++++
>>> >>  2 files changed, 7 insertions(+), 1 deletion(-)
>>> >>
>>> >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>> >> index 1bb6b67..07528a9 100644
>>> >> --- a/drivers/mmc/host/sdhci.c
>>> >> +++ b/drivers/mmc/host/sdhci.c
>>> >> @@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host
>>> *host, struct mmc_command *cmd,
>>> >>         }
>>> >>
>>> >>         if (count >= 0xF) {
>>> >> -               if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT))
>>> >> +               if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) ||
>>> >> +               !(host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))
>>> >
>>> > I don't quite get how this can make your variant use 0xF rather than 0xE?
>>> >
>>> > To me it looks like an updated conditional check to print a debug
>>> message, no?
>>>
>>> Probably need to introduce host->max_timeout_count, set it to 0xE in
>>> sdhci_alloc_host(), and change sdhci_calc_timeout() to use it in place of
>>> all the 0xE and 0xF constants.
>>
>> Yep, that seems like a reasonable approach to me as well.
>>
>> [...]
>>
>> Kind regards
>> Uffe
> 
> Resending the mail again as can't see my comment on the
> https://patchwork.kernel.org/ page.
> Sorry for the mistake just want to update the logic as below.
> -               count = 0xE;
> +               if(!(host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))
> +                       count = 0xE;

I think it is conceptually simpler to define SDHCI constants as variables
and let vendor drivers change them if need be.  In other words, what I wrote
above.  It changes more code, but the overall result is more consistent.