All of lore.kernel.org
 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: Wed, 13 Feb 2013 12:14:03 +0900	[thread overview]
Message-ID: <511B04FB.3040306@samsung.com> (raw)
In-Reply-To: <CAPnjgZ3x7u-g9bR0wgbfVU6nVmLVPg10VJEdpuEeda4UjjOYYA@mail.gmail.com>

Hi Simon,

It looks good to me.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 02/09/2013 01:48 AM, Simon Glass wrote:
> Hi,
> 
> On Sun, Dec 16, 2012 at 7:44 PM, Simon Glass <sjg@chromium.org> wrote:
>> Hi,
>>
>> On Sun, Dec 16, 2012 at 6:12 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> 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.
>>
>> OK thanks. Assuming that make sure that the pre-init is definitely
>> done, I suggest you then make U-Boot go and do something else for
>> 200ms, then do the full mmc init after that. It should complete
>> immediately.
>>
>> So there is no time saving in mmc init, but you can do something else
>> while waiting for the MMC init to complete (it takes 200ms or so for
>> me).
>>
>> Another thing to note with eMMC is that we probe for SD first. This
>> takes a little bit of time. We could perhaps use device tree to
>> provide information about the type of attached memory, and thus avoid
>> that probe.
> 
> Does this patch look suitable for merging at this point?
> 
> Regards,
> Simon
> 

  reply	other threads:[~2013-02-13  3:14 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
2012-12-17  3:44         ` Simon Glass
2013-02-08 16:48           ` Simon Glass
2013-02-13  3:14             ` Jaehoon Chung [this message]
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=511B04FB.3040306@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 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.