All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: "Paul Fertser" <fercerpav@gmail.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"Chaotian Jing" <chaotian.jing@mediatek.com>,
	"Shawn Lin" <shawn.lin@rock-chips.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Subject: Re: [PATCH 3/3] mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch()
Date: Wed, 24 Feb 2021 12:09:44 +0100	[thread overview]
Message-ID: <CAPDyKFrWOs7xO1f+miz4cQznHcYQL+sunpzOW3Jg6P0rFOSS1g@mail.gmail.com> (raw)
In-Reply-To: <c9adeaa3-8833-fe2b-cea8-50b645db0a9d@intel.com>

On Tue, 23 Feb 2021 at 14:42, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 23/02/21 1:54 pm, Ulf Hansson wrote:
> > On Tue, 23 Feb 2021 at 12:19, Paul Fertser <fercerpav@gmail.com> wrote:
> >>
> >> Hello Adrian,
> >>
> >> On Tue, Feb 23, 2021 at 01:01:09PM +0200, Adrian Hunter wrote:
> >>> On 23/02/21 11:32 am, Paul Fertser wrote:
> >>>> Hello Ulf,
> >>>>
> >>>> On Tue, Feb 23, 2021 at 10:23:28AM +0100, Ulf Hansson wrote:
> >>>>>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> >>>>>> index f5dedb7f9b27..9adf735391fa 100644
> >>>>>> --- a/drivers/mmc/core/mmc.c
> >>>>>> +++ b/drivers/mmc/core/mmc.c
> >>>>>> @@ -426,8 +426,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
> >>>>>>                 /* EXT_CSD value is in units of 10ms, but we store in ms */
> >>>>>>                 card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
> >>>>>>                 /* Some eMMC set the value too low so set a minimum */
> >>>>>> -               if (card->ext_csd.part_time &&
> >>>>>> -                   card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
> >>>>>> +               if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
> >>>>>>                         card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
> >>>>>>
> >>>>>>                 /* Sleep / awake timeout in 100ns units */
> >>>>>>
> >>>>>> I do not see any more warnings on my system.
> >>>>>
> >>>>> That looks like the correct fix to the problem. Do you want to send a
> >>>>> proper patch that I can pick up or do you prefer if help to do it?
> >>>>
> >>>> I've sent this as a diff precisely because 1c447116d017 was so
> >>>> explicit about special-casing zero ext_csd timeout value, so I thought
> >>>> probably Adrian can provide the rationale for that. I'd prefer to wait
> >>>> for his feedback before sending a formal patch. Does this make sense?
> >>>
> >>> Zero means indefinite.  Might be safer to use a higher value than
> >>> MMC_MIN_PART_SWITCH_TIME for that case.  The maximum GENERIC_CMD6_TIME is
> >>> 2550 ms.
> >>
> >> Thanks for the clarification! I would guess that most likely than not
> >> when whoever defines that value to be zero it means "I do not
> >> care/know" rather than "the timeout must be set to more than 2550 ms,
> >> too bad 8 bits are not enough to represent that". I'd say setting it
> >> to DEFAULT_CMD6_TIMEOUT_MS should be safe enough since it worked
> >> before.
> >
> > Hmm.
> >
> > The DEFAULT_CMD6_TIMEOUT_MS is intended to override the
> > ext_csd->generic_cmd6_time, in case it's not defined in the register.
> >
> > Perhaps it's reasonable to think that eMMC vendors specify the
> > GENERIC_CMD6_TIME, but may skip to specify other timeouts, like the
> > PARTITION_SWITCH_TIME. In that case, should we use the specified
> > GENERIC_CMD6_TIME, rather than always default to
> > DEFAULT_CMD6_TIMEOUT_MS?
>
> Sounds reasonable, but perhaps still enforce a minimum, for some of the same
> reasons as commit 1c447116d017 ?
> e.g.
>
>         if (!card->ext_csd.part_time)
>                 card->ext_csd.part_time = card->ext_csd.generic_cmd6_time;
>         if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
>                 card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
>

Makes perfect sense to me!

Kind regards
Uffe

  reply	other threads:[~2021-02-24 11:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 14:27 [PATCH 0/3] mmc: core: Update timeouts for __mmc_switch() Ulf Hansson
2020-01-22 14:27 ` [PATCH 1/3] mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC Ulf Hansson
2020-01-22 14:27 ` [PATCH 2/3] mmc: block: Use generic_cmd6_time when modifying INAND_CMD38_ARG_EXT_CSD Ulf Hansson
2020-01-22 14:27 ` [PATCH 3/3] mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch() Ulf Hansson
2021-02-22 16:24   ` Paul Fertser
2021-02-22 20:12     ` Paul Fertser
2021-02-23  9:23       ` Ulf Hansson
2021-02-23  9:32         ` Paul Fertser
2021-02-23 10:44           ` Ulf Hansson
2021-02-23 11:01           ` Adrian Hunter
2021-02-23 11:19             ` Paul Fertser
2021-02-23 11:54               ` Ulf Hansson
2021-02-23 13:42                 ` Adrian Hunter
2021-02-24 11:09                   ` Ulf Hansson [this message]
2021-03-03  9:26                     ` [PATCH] mmc: mmc: Fix partition switch time Adrian Hunter
2021-03-04 13:50                       ` Ulf Hansson
2020-01-24 11:25 ` [PATCH 0/3] mmc: core: Update timeouts for __mmc_switch() Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFrWOs7xO1f+miz4cQznHcYQL+sunpzOW3Jg6P0rFOSS1g@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=fercerpav@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=shawn.lin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.