linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	Chris Ball <chris@printf.net>,
	Dong Aisheng <b29396@freescale.com>,
	Stephen Warren <swarren@nvidia.com>,
	Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Subject: Re: [PATCH 08/10] mmc: card: Use R1 response for the stop cmd at recovery path
Date: Thu, 23 Jan 2014 16:29:33 +0200	[thread overview]
Message-ID: <52E1274D.3050200@intel.com> (raw)
In-Reply-To: <CAPDyKFpB4CUqzLsDE1NyGuWX4nMLRL7HwtPpcKp82vP1VGhJmg@mail.gmail.com>

On 23/01/14 15:21, Ulf Hansson wrote:
> On 23 January 2014 11:09, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 22/01/14 17:00, Ulf Hansson wrote:
>>> Hosts supporting MMC_CAP_WAIT_WHILE_BUSY shall not be waiting for busy
>>> detection completion in the recovery path, which were the case when
>>> using R1B response.
>>>
>>> Start using R1 as response instead to align behavior, no matter if
>>> MMC_CAP_WAIT_WHILE_BUSY is supported or not.
>>
>> This does not make sense to me.  If you are sending a STOP command you
>> should use the correct response type.  R1B should be OK here because the
>> card should release the busy signal in any case except failure.
> 
> For those hosts not supporting MMC_CAP_WAIT_WHILE_BUSY a R1B is
> assumed to be treated same as an R1, which means there are no busy
> detection handled in the host.

That is not entirely true.  For hosts that do not set
MMC_CAP_WAIT_WHILE_BUSY we don't know if they wait or not.  I imagine most
do because it is more efficient, but the kernel has always been programmed
to poll the status anyway so you can't tell from the code.

MMC_CAP_WAIT_WHILE_BUSY was one of my inventions I am afraid.  If I recall
correctly it was mainly due to the SLEEP command because you can't poll in
that case and you don't want to delay the system from sleeping - if you are
certain that the controller has waited for busy to de-assert (i.e.
MMC_CAP_WAIT_WHILE_BUSY) then you can exit immediately.

> 
> mmc_blk_cmd_recovery() is the only caller of the send_stop() function.
> Additionally it does not care about to handle busy detection with
> CDM13 polling.
> 
> Now, since most hosts don't support MMC_CAP_WAIT_WHILE_BUSY which
> means there no busy detection done, I wanted to align to this
> behaviour - no matter if the host can do HW busy detection or not.
> 
> I am not saying this is how it must be done, just trying to provide
> you with some more reasons to why I wanted to change.
> 
> If we instead decide keep the R1B for send_stop(), we should implement
> CMD 13 polling to meet the same behaviour for hosts not supporting
> MMC_CAP_WAIT_WHILE_BUSY. In this scenario, we need to set a select a
> busy timeout, do you have any suggestion of what would be a reasonable
> value for it?

It is hard to tell if waiting is ever going to help more than hinder, so I
would not change this.

> 
> Kind regards
> Ulf Hansson
> 
>>
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>> ---
>>>  drivers/mmc/card/block.c |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index 87cd2b0..74169fa 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -728,7 +728,7 @@ static int send_stop(struct mmc_card *card, u32 *status)
>>>       int err;
>>>
>>>       cmd.opcode = MMC_STOP_TRANSMISSION;
>>> -     cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
>>> +     cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
>>>       err = mmc_wait_for_cmd(card->host, &cmd, 5);
>>>       if (err == 0)
>>>               *status = cmd.resp[0];
>>>
>>
> 
> 


  reply	other threads:[~2014-01-23 14:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 15:00 [PATCH 00/10] mmc: Improve busy detection for MMC_CAP_WAIT_WHILE_BUSY Ulf Hansson
2014-01-22 15:00 ` [PATCH 01/10] mmc: core: Rename max_discard_to to max_busy_timeout Ulf Hansson
2014-01-22 15:00 ` [PATCH 02/10] mmc: core: Rename cmd_timeout_ms to busy_timeout Ulf Hansson
2014-01-22 15:00 ` [PATCH 03/10] mmc: core: Add ignore_crc flag to __mmc_switch Ulf Hansson
2014-01-22 15:00 ` [PATCH 04/10] mmc: core: Fixup busy detection for mmc switch operations Ulf Hansson
2014-01-23 10:10   ` Adrian Hunter
2014-01-23 14:11     ` Ulf Hansson
2014-01-27 10:40       ` Adrian Hunter
2014-01-28 11:37         ` Ulf Hansson
2014-01-22 15:00 ` [PATCH 05/10] mmc: core: Use generic CMD6 time while switching to eMMC HS200 mode Ulf Hansson
2014-01-22 15:00 ` [PATCH 06/10] mmc: core: Respect host's max_busy_timeout when sending sleep cmd Ulf Hansson
2014-01-23 10:23   ` Adrian Hunter
2014-01-23 14:26     ` Ulf Hansson
2014-01-27 10:46       ` Adrian Hunter
2014-01-28 12:43         ` Ulf Hansson
2014-01-22 15:00 ` [PATCH 07/10] mmc: card: Use R1 responses for stop cmds for read requests Ulf Hansson
2014-01-22 15:00 ` [PATCH 08/10] mmc: card: Use R1 response for the stop cmd at recovery path Ulf Hansson
2014-01-23 10:09   ` Adrian Hunter
2014-01-23 13:21     ` Ulf Hansson
2014-01-23 14:29       ` Adrian Hunter [this message]
2014-01-23 14:59         ` Ulf Hansson
2014-01-27 10:40           ` Adrian Hunter
2014-01-28 12:39             ` Ulf Hansson
2014-01-28 14:45               ` Adrian Hunter
2014-01-28 16:11                 ` Ulf Hansson
2014-01-22 15:00 ` [PATCH 09/10] mmc: mmci: Handle CMD irq before DATA irq Ulf Hansson
2014-01-22 15:19   ` Russell King - ARM Linux
2014-01-22 15:43     ` Ulf Hansson
2014-01-22 15:00 ` [PATCH 10/10] mmc: mmci: Enable support for busy detection for ux500 variant 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=52E1274D.3050200@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=b29396@freescale.com \
    --cc=chris@printf.net \
    --cc=linux-mmc@vger.kernel.org \
    --cc=swarren@nvidia.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vladimir_zapolskiy@mentor.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).