linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hein_Tibosch <hein_tibosch@yahoo.es>
To: Andy Ross <andy.ross@windriver.com>
Cc: Chris Ball <cjb@laptop.org>,
	linux-mmc@vger.kernel.org, Pierre Ossman <pierre@ossman.eu>,
	Ben Nizette <bn@niasdigital.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Adrian Hunter <adrian.hunter@nokia.com>,
	Matt Fleming <matt@console-pimps.org>
Subject: Re: [PATCH] Fix sd/sdio/mmc initialization frequency retries
Date: Mon, 03 Jan 2011 02:08:52 +0800	[thread overview]
Message-ID: <4D20BF34.7070008@yahoo.es> (raw)
In-Reply-To: <4D1E4084.3080601@yahoo.es>

On 1-1-2011 04:43, Hein_Tibosch wrote:
> On 29-12-2010 01:15, Andy Ross wrote:
>> I'm working with a eMMC device that broke after this commit:
>>
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=88ae8b86648
>>
>> The older hack I'd been given hard-coded the initialisation frequency
>> at 200kHz (instead of 400kHz in the original upstream) and works fine.
>>
>> But the new code tries to dynamically detect the highest frequency
>> that will work, but as far as I can tell the logic is wrong.  It will
>> continue trying after failed mmc_send_*_cond() calls, but *not* after
>> failures later on in mmc_attach_{sd,sdio,mmc}.  My boards (at 400kHz)
>> are getting successful returns from mmc_send_op_cond(), but failing in
>> mmc_attach_mmc().  If I retry at 300, it works.
>>
>> Tested on the same controller using a sdhc card.  No idea how the
>> extra retries will affect other hardware (though as the original code
>> was fixed at 400, presumably very few devices will care?).
>
> <snip>
>
> Don't know why all these additions of claim/release?
> In some cases it will lead to unnecessary releases, just because
> later in the branch claim will be called.
>
> I think in all 3 cases (sd/sdio/mmc) the change can be much simpler.
> For instance for sd.c I would do this:
>
> ---
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 49da4df..18331eb
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
>
> <snip>
>
> @@ -825,6 +829,7 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
>  	if (err)
>  		goto remove_card;
>
> +	mmc_claim_host(host);
>  	return 0;
>
>  remove_card:
> @@ -833,7 +838,6 @@ remove_card:
>  	mmc_claim_host(host);
>  err:
>  	mmc_detach_bus(host);
> -	mmc_release_host(host);
>
>  	printk(KERN_ERR "%s: error %d whilst initialising SD card\n",
>  		mmc_hostname(host), err);
> --
>
I tested the simplified patch as described above on AVR32 with an sd-card.

It worked well and the timing was the same as before: each frequency tried
takes about 22 ms. The third time, at 200Khz, the card got initialized.

But not much time is lost, in a meanwhile it was starting up the USB host

Hein


      reply	other threads:[~2011-01-02 18:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 17:15 [PATCH] Fix sd/sdio/mmc initialization frequency retries Andy Ross
2010-12-31  4:49 ` Chris Ball
2011-01-03 18:36   ` Andy Ross
2011-01-04  1:29     ` Chris Ball
2011-01-04 17:27       ` Chris Ball
2010-12-31 20:43 ` Hein_Tibosch
2011-01-02 18:08   ` Hein_Tibosch [this message]

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=4D20BF34.7070008@yahoo.es \
    --to=hein_tibosch@yahoo.es \
    --cc=adrian.hunter@nokia.com \
    --cc=andy.ross@windriver.com \
    --cc=bn@niasdigital.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matt@console-pimps.org \
    --cc=pierre@ossman.eu \
    --cc=s.hauer@pengutronix.de \
    /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).