From: Seungwon Jeon <tgih.jun@samsung.com>
To: "'Doug Anderson'" <dianders@chromium.org>,
"'Jaehoon Chung'" <jh80.chung@samsung.com>
Cc: "'Chris Ball'" <cjb@laptop.org>,
"'James Hogan'" <james.hogan@imgtec.com>,
"'Grant Grundler'" <grundler@chromium.org>,
"'Alim Akhtar'" <alim.akhtar@samsung.com>,
"'Abhilash Kesavan'" <a.kesavan@samsung.com>,
"'Tomasz Figa'" <tomasz.figa@gmail.com>,
"'Olof Johansson'" <olof@lixom.net>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: RE: [PATCH v6 2/3] mmc: dw_mmc: Honor requests to set the clock to 0 (turn off clock)
Date: Thu, 29 Aug 2013 16:04:49 +0900 [thread overview]
Message-ID: <000301cea486$0d813eb0$2883bc10$%jun@samsung.com> (raw)
In-Reply-To: <CAD=FV=WYMyGVmG-DXk1ke-yQCrfF74KDaZAUCW3qzf+Xfp-tpQ@mail.gmail.com>
On Tuesday, August 27, 2013, Doug Anderson wrote:
> Jaehoon / Seungwon,
>
> On Mon, Aug 26, 2013 at 2:06 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> > On 08/26/2013 01:34 PM, Seungwon Jeon wrote:
> >> On Fri, August 23, 2013, Doug Anderson wrote:
> >>> Previously the dw_mmc driver would ignore any requests to disable the
> >>> card's clock. This doesn't seem like a good thing in general, but had
> >>> one extra bad side effect in the following situtation:
> >>> * mmc core would set clk to 400kHz at boot time while initting
> >>> * mmc core would set clk to 0 since no card, but it would be ignored.
> >>> * suspend to ram and resume; clocks in the dw_mmc IP block are now 0
> >>> but dw_mmc thinks that they're 400kHz (it ignored the set to 0).
> >>> * insert card
> >>> * mmc core would set clk to 400kHz which would be considered a no-op.
> >>>
> >>> Note that if there is no card in the slot and we do a suspend/resume
> >>> cycle, we _do_ still end up with differences in a dw_mmc register
> >>> dump, but the differences are clock related and we've got the clock
> >>> disabled both before and after, so this should be OK.
> >>>
> >>> Signed-off-by: Doug Anderson <dianders@chromium.org>
> >>> ---
> >>> Changes in v6:
> >>> - Replaces previous pathes that ensured saving/restoring clocks.
> >>>
> >>> drivers/mmc/host/dw_mmc.c | 21 +++++++++++----------
> >>> 1 file changed, 11 insertions(+), 10 deletions(-)
> >>>
> >>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> >>> index ee5f167..f6c7545 100644
> >>> --- a/drivers/mmc/host/dw_mmc.c
> >>> +++ b/drivers/mmc/host/dw_mmc.c
> >>> @@ -635,7 +635,11 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
> >>> u32 div;
> >>> u32 clk_en_a;
> >>>
> >>> - if (slot->clock != host->current_speed || force_clkinit) {
> >>> + if (slot->clock == 0) {
> >>> + mci_writel(host, CLKENA, 0);
> >>> + mci_send_cmd(slot,
> >>> + SDMMC_CMD_UPD_CLK | SDMMC_CMD_PRV_DAT_WAIT, 0);
> >> Basically dw_mmc driver uses host's low power mode(auto clock gating)
> >> So, how about keeping origin code rather than programming clock setting to '0'?
> > Right, Dw-mmc controller can use the Low-power mode.
> > This mode is functionality like clock-gating. Well, i didn't know what benefit we get, if set to 0.
>
> Ah, right. ...so it's unlikely that we'd save any power because we're
> already gating the clock.
>
> I'd really still rather honor the MMC subsystem's request. It
> shouldn't _hurt_ to turn the clock off when the subsystem requests it,
Even though turning off by clock programming doesn't hurt,
it is costly behavior when considering low power mode of host's own support.
Just now, how about focusing on the problem clock isn't updated properly after suspend/resume?
> right? One reason to honor the mmc core is that it will make things
> cleaner if/when we support a voltage change operation. The MMC core
> has the logic for the voltage change, and part of that involves
> turning off the clock. We'll already need a bunch of special case
> code in dw_mmc for voltage change, but it would be nice to avoid one
> extra bit.
Turning off clock during voltage switching would be another procedure.
I guess it could be discussed later.
I want to fix some minor change to prevent frequent message that Jaehoon pointed.
Thanks,
Seungwon Jeon
>
> Another option would be to add a core MMC quirk to disable MMC_CLKGATE
> on a per-driver basis. In the "single zImage" world that seems like
> the right thing to do, since the MMC_CLKGATE description seems to
> indicate that enabling that won't really work on all drivers anyway.
>
> -Doug
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-08-29 7:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 16:19 [PATCH v6 0/3] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-08-22 16:19 ` [PATCH v6 1/3] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT Doug Anderson
2013-08-22 16:19 ` [PATCH v6 2/3] mmc: dw_mmc: Honor requests to set the clock to 0 (turn off clock) Doug Anderson
2013-08-23 13:21 ` Jaehoon Chung
2013-08-23 20:40 ` Doug Anderson
2013-08-26 1:31 ` Jaehoon Chung
2013-08-26 3:38 ` Doug Anderson
2013-08-26 4:34 ` Seungwon Jeon
2013-08-26 9:06 ` Jaehoon Chung
2013-08-26 16:05 ` Doug Anderson
2013-08-29 7:04 ` Seungwon Jeon [this message]
2013-08-29 16:34 ` Doug Anderson
2013-08-30 3:55 ` Seungwon Jeon
2013-08-22 16:19 ` [PATCH v6 3/3] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
2013-08-23 12:56 ` Jaehoon Chung
2013-08-29 16:39 ` [PATCH v7 0/3] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-08-29 16:39 ` [PATCH v7 1/3] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT Doug Anderson
2013-08-29 16:39 ` [PATCH v7 2/3] mmc: dw_mmc: Honor requests to set the clock to 0 (turn off clock) Doug Anderson
2013-08-30 11:31 ` Seungwon Jeon
2013-08-29 16:39 ` [PATCH v7 3/3] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
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='000301cea486$0d813eb0$2883bc10$%jun@samsung.com' \
--to=tgih.jun@samsung.com \
--cc=a.kesavan@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=cjb@laptop.org \
--cc=dianders@chromium.org \
--cc=grundler@chromium.org \
--cc=james.hogan@imgtec.com \
--cc=jh80.chung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=olof@lixom.net \
--cc=tomasz.figa@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome