From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Chris Ball <cjb@laptop.org>,
linux-mmc@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Namjae Jeon <linkinjeon@gmail.com>,
Sergey Yanovich <ynvich@gmail.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH 2/2] mmc: core: fix performance regression initializing MMC host controllers
Date: Fri, 05 Apr 2013 16:30:06 +0300 [thread overview]
Message-ID: <515ED1DE.6070106@intel.com> (raw)
In-Reply-To: <CAPDyKFp2gKuJNY-X5obsDZVvj1V=JN2rnyfkpNKB=HZQd+_pJg@mail.gmail.com>
On 05/04/13 12:49, Ulf Hansson wrote:
> On 5 April 2013 09:26, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 05/04/13 00:02, Ulf Hansson wrote:
>>> On 4 April 2013 15:41, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>> Commit fa5501890d8974301042e0202d342a6cbe8609f4 introduced a performance
>>>> regression by adding mmc_power_up() to mmc_start_host(). mmc_power_up()
>>>> is not necessary to host controller initialization, it is part of card
>>>> initialization and is performed anyway asynchronously.
>>>
>>> This commit message is a bit miss-leading. In eMMC case, when the host
>>> driver has no possibility of power cycle the VCCQ power supply but
>>> only the VCC, this is the only proper way to prevent violation of the
>>> eMMC spec.
>>
>> But that is not true. The host controller driver can manage the voltages.
>> The patch is a workaround for the regulator_init_complete late initcall.
>
> In my view, the host driver is not responsible for implementing the
> mmc/sd/sdio protocol as such, that is the core layer responsibility.
Having VCC always on is not part of the MMC protocol. For example, you
can't look up EXT_CSD and find out if VCC is always on. Consequently,
the core does not support it. If a platform requires it, it should be
added as a new feature and flagged as such, not introduced as a "fix".
> Moreover I don't think you should consider this as a workaround, it is
> a proper fix to make sure we follow eMMC spec.
It won't work if the host controller driver is loaded as a module.
Also it causes attempts to initialize cards without first powering off
thereby ensuring they are in a known state.
>
> I noticed you V2 patch, but would still like some more clear
> information in there and maybe mention "boot time performance" instead
> of just "performance".
>
> Kind regards
> Ulf Hansson
>
>>
>> I deliberately did not paraphrase the original commit so that people who
>> wanted to know would have to look at it for themselves. I really cannot add
>> things to my commit message that do not make sense to me.
>>
>>>
>>> >From SD-card point of view, it is not needed, so this can be optimized
>>> to be done as before in an asynchronous mode.
>>>
>>>>
>>>> This patch allows a driver to leave the power up in asynchronous code
>>>> (as it was before).
>>>>
>>>> On my current target platform this reduces driver initialization from:
>>>>
>>>> [ 1.313220] initcall sdhci_acpi_driver_init+0x0/0x12 returned 0 after 102008 usecs
>>>>
>>>> to this:
>>>>
>>>> [ 1.217209] initcall sdhci_acpi_driver_init+0x0/0x12 returned 0 after 8331 usecs
>>>>
>>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>>> ---
>>>> drivers/mmc/core/core.c | 3 ++-
>>>> drivers/mmc/host/sdhci-acpi.c | 2 ++
>>>> include/linux/mmc/host.h | 1 +
>>>> 3 files changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>>> index 3bf1c46..c1893c9 100644
>>>> --- a/drivers/mmc/core/core.c
>>>> +++ b/drivers/mmc/core/core.c
>>>> @@ -2416,7 +2416,8 @@ void mmc_start_host(struct mmc_host *host)
>>>> {
>>>> host->f_init = max(freqs[0], host->f_min);
>>>> host->rescan_disable = 0;
>>>> - mmc_power_up(host);
>>>> + if (!(host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP))
>>>> + mmc_power_up(host);
>>>> mmc_detect_change(host, 0);
>>>> }
>>>>
>>>> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
>>>> index 2592ddd..7bcf74b 100644
>>>> --- a/drivers/mmc/host/sdhci-acpi.c
>>>> +++ b/drivers/mmc/host/sdhci-acpi.c
>>>> @@ -195,6 +195,8 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>>>> host->mmc->pm_caps |= c->slot->pm_caps;
>>>> }
>>>>
>>>> + host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;
>>>> +
>>>> err = sdhci_add_host(host);
>>>> if (err)
>>>> goto err_free;
>>>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>>>> index 17d7148..8873e83 100644
>>>> --- a/include/linux/mmc/host.h
>>>> +++ b/include/linux/mmc/host.h
>>>> @@ -280,6 +280,7 @@ struct mmc_host {
>>>> #define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
>>>> #define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
>>>> MMC_CAP2_PACKED_WR)
>>>> +#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
>>>>
>>>> mmc_pm_flag_t pm_caps; /* supported pm features */
>>>>
>>>> --
>>>> 1.7.11.7
>>>>
>>>
>>>
>>> Some update to the commit msg, then I am happy.
>>>
>>> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
>>>
>>>
>>
>
>
next prev parent reply other threads:[~2013-04-05 13:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 13:41 [PATCH 0/2] sdhci-acpi initialization performance regression Adrian Hunter
2013-04-04 13:41 ` [PATCH 1/2] Revert "mmc: core: wait while adding MMC host to ensure root mounts successfully" Adrian Hunter
2013-04-04 13:52 ` Sergey Yanovich
2013-04-04 13:41 ` [PATCH 2/2] mmc: core: fix performance regression initializing MMC host controllers Adrian Hunter
2013-04-04 21:02 ` Ulf Hansson
2013-04-05 7:26 ` Adrian Hunter
2013-04-05 7:40 ` [PATCH V2 2/2] mmc: core: fix performance regression initializing MMC, " Adrian Hunter
2013-04-05 9:49 ` [PATCH 2/2] mmc: core: fix performance regression initializing MMC " Ulf Hansson
2013-04-05 13:30 ` Adrian Hunter [this message]
2013-04-05 13:31 ` [PATCH V3 " Adrian Hunter
2013-04-08 9:41 ` Ulf Hansson
2013-04-08 10:49 ` [PATCH V4 " Adrian Hunter
2013-04-12 18:09 ` [PATCH 0/2] sdhci-acpi initialization performance regression Chris Ball
2013-04-15 6:47 ` Adrian Hunter
2013-04-15 15:42 ` Chris Ball
2013-04-17 5:55 ` Adrian Hunter
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=515ED1DE.6070106@intel.com \
--to=adrian.hunter@intel.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=cjb@laptop.org \
--cc=jh80.chung@samsung.com \
--cc=linkinjeon@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=ynvich@gmail.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.