public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] mmc: Split device init to decouple OCR-polling delay
Date: Mon, 17 Dec 2012 11:12:58 +0900	[thread overview]
Message-ID: <50CE7FAA.8080601@samsung.com> (raw)
In-Reply-To: <CAPnjgZ2yRVbCPLh9DrypgjJVCWcK8n6eZDwM8TAPOT4O8nWV6A@mail.gmail.com>

On 12/16/2012 02:18 AM, Simon Glass wrote:
> Hi,
> 
> On Fri, Nov 30, 2012 at 3:13 PM, Simon Glass <sjg@chromium.org> wrote:
>> Hi Jaehoon,
>>
>> On Fri, Nov 30, 2012 at 12:25 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> Hi,
>>>
>>> This concept is very good.
>>> But I have one question. I think need to call mmc_init() one more, right?
>>> how did you save the boot time(200ms)?
>>>
>>> On 11/29/2012 10:21 AM, Simon Glass wrote:
>>>> From: Che-Liang Chiou <clchiou@chromium.org>
>>>>
>>>> Most of time that MMC driver spends on initializing a device is polling
>>>> OCR (operation conditions register).  To decouple this polling loop,
>>>> device init is split into two parts: The first part fires the OCR query
>>>> command, and the second part polls the result.  So the caller is now no
>>>> longer bound to the OCR-polling delay; he may fire the query, go
>>>> somewhere and then come back later for the result.
>>>>
>>>> To use this, call mmc_set_preinit() on any device which needs this.
>>>>
>>>> This can save significant amounts of time on boot (e.g. 200ms) by
>>>> hiding the MMC init time behind other init.
>>> snip..
>>>> +int mmc_init(struct mmc *mmc)
>>>> +{
>>>> +     int err = IN_PROGRESS;
>>>> +     unsigned start = get_timer(0);
>>>> +
>>>> +     if (mmc->has_init)
>>>> +             return 0;
>>>> +     if (!mmc->init_in_progress)
>>>> +             err = mmc_start_init(mmc);
>>> It need not to return? if err is IN_PROGRESS, next condition is immediately run.
>>> Then i think we didn't save the time before adjust this patch.
>>
>> It's a little confusing, but the way it works is that mmc_preinit()
>> calls mmc_start_init() early in boot. Then when mmc_init() finally
>> gets called (later) it finishes off the init. We still need mmc_init()
>> to actually fully complete the init. If it were to return before
>> completing the init then we would be unable to use the MMC.
>>
>>>> +
>>>> +     if (!err || err == IN_PROGRESS)
>>>> +             err = mmc_complete_init(mmc);
>>>> +     debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
>>>>       return err;
>>>>  }
>>
> 
> Does this patch look good now? I am wondering if it will be including
> in release, or in next?
Well, concept is very good. But i didn't see the any benefit yet.
I will test more...and share the result.

Best Regards,
Jaehoon Chung
> 
> Regards,
> Simon
> 
>> [snip]
>>
>> Regards,
>> Simon
> 

  reply	other threads:[~2012-12-17  2:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29  1:21 [U-Boot] [PATCH v2] mmc: Split device init to decouple OCR-polling delay Simon Glass
2012-11-29 15:20 ` Jae hoon Chung
2012-11-30 23:05   ` Simon Glass
2012-11-30  8:25 ` Jaehoon Chung
2012-11-30 23:13   ` Simon Glass
2012-12-15 17:18     ` Simon Glass
2012-12-17  2:12       ` Jaehoon Chung [this message]
2012-12-17  3:44         ` Simon Glass
2013-02-08 16:48           ` Simon Glass
2013-02-13  3:14             ` Jaehoon Chung
2013-03-16 20:35               ` Simon Glass
2013-04-03 18:49                 ` Simon Glass
2013-04-29  5:02                   ` Jaehoon Chung

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=50CE7FAA.8080601@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=u-boot@lists.denx.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