linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seungwon Jeon <tgih.jun@samsung.com>
To: 'Doug Anderson' <dianders@chromium.org>
Cc: 'Chris Ball' <cjb@laptop.org>, 'Olof Johansson' <olof@lixom.net>,
	'Jaehoon Chung' <jh80.chung@samsung.com>,
	'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>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: RE: [PATCH v4 3/4] mmc: dw_mmc: Always setup the bus after suspend/resume
Date: Mon, 12 Aug 2013 16:20:30 +0900	[thread overview]
Message-ID: <000d01ce972c$6cf14730$46d3d590$%jun@samsung.com> (raw)
In-Reply-To: <CAD=FV=VO=50uMXfwY5iNa+xiamRiHTSpTMXs+EdMeUTawkeyqw@mail.gmail.com>

On Sat, August 10, 2013,Doug Anderson wrote:
> Seungwon,
> 
> On Fri, Aug 9, 2013 at 6:35 AM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> > On Wed, August 07, 2013, Doug Anderson wrote:
> >> After suspend/resume all of the dw_mmc registers are reset to
> >> defaults.  We restore most of them, but specifically don't setup the
> >> clock registers after resume unless we've got a powered card.  Things
> >> still work because the core will eventually call set_ios() and we'll
> >> set things up.
> >
> > Hmm, I didn't get the need of this call during resume.
> > I think set_ios is only valid where core layer calls.
> > Besides, important things is ios's parameters.
> > If suspend has finished successfully, last call of set_ios() is from mmc_power_off().
> > On seeing fields of 'mmc->ios' stored last, these values aren't proper in resume phase.
> > Please check mmc_power_off() function.
> > In case MMC_PM_KEEP_POWER it could be kept.
> 
> Most of my reasoning has to do with the fact that the state of the
> system after suspend/resume should not be significantly different than
> the state of the system before suspend/resume.  If the state of the
> system is different in the two cases it points out potential problems
> or inefficiencies.
> 
> To make this more concrete:
> 
> 1. Boot up a system with no card in the SD Card slot.
> 2. Note down the value of registers like CLKDIV, CLKENA, etc.
> 3. Suspend / resume (S2R)
> 4. Check the values of CLKDIV, CLKENA, etc.
> 
> You will notice that they are different.  This is a bad sign and can
> be a source of bugs (though I don't know of any).  ...or it could mean
> that power draw is different (could be better, could be worse) after a
> suspend/resume cycle.
> 
> 
> Said another way, if the value of CLKDIV, CLKENA, etc is not important
> when a card is not inserted, why do they get initialized at boot time?
> 
> 
> In general, I think that the mmc core code makes the assumption that
> it's up to the driver to make sure that its state is preserved across
> S2R.  For dw_mmc the driver doesn't do the "brute force" that some
> drivers do of just saving and restoring all registers using a copy
> loop.  Instead, the dw_mmc driver runs code that tries to set the
> state back to something reasonable.  Without my patch the dw_mmc
> driver doesn't run any code that restores these registers.
> dw_mci_set_ios() will do so.

This seems pretty associated with [1/4 patch]. (Anyway continued, ...)
Basically, both CLKDIV and CLKENA will be set with the reset value of zero. This means clock is disabled.
While resume of dw_mmc is completed, initial configuration registers will be set except for runtime registers.
I think registers related to clock are close to runtime.
Core layer knows the correct clock rate for current device mode and will actually request it by set_ios.
If core layer requests set_ios no more after dw_mmc resume is completed, dw_mmc will keep the clock to be disabled.
Then, dw_mmc doesn't need self call of dw_mci_set_ios.

Thanks,
Seungwon Jeon
> 
> Another option would be to forcibly save/restore registers in suspend/resume.
> 
> -Doug


  reply	other threads:[~2013-08-12  7:20 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 17:31 [PATCH 0/5] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-07-09 17:31 ` [PATCH 1/5] mmc: dw_mmc: Invalidate cache of current_speed after suspend/resume Doug Anderson
2013-07-09 17:31 ` [PATCH 2/5] mmc: dw_mmc: Add suspend/resume callbacks; disable irq during suspend Doug Anderson
2013-07-09 21:17   ` James Hogan
2013-07-09 21:31     ` Doug Anderson
2013-07-09 17:31 ` [PATCH 3/5] mmc: dw_mmc: Add exynos resume callback to clear WAKEUP_INT Doug Anderson
2013-07-09 19:09   ` Doug Anderson
2013-07-11  0:43     ` Grant Grundler
2013-07-09 17:31 ` [PATCH 4/5] mmc: dw_mmc: Always setup the bus after suspend/resume Doug Anderson
2013-07-09 17:31 ` [PATCH 5/5] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
2013-07-09 23:19 ` [PATCH v2 0/5] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-07-09 23:19   ` [PATCH v2 1/5] mmc: dw_mmc: Invalidate cache of current_speed after suspend/resume Doug Anderson
2013-07-09 23:19   ` [PATCH v2 2/5] mmc: dw_mmc: Add suspend_noirq/resume_noirq callbacks for dw_mmc-pltfm Doug Anderson
2013-07-10  8:37     ` James Hogan
2013-07-10 15:08       ` Doug Anderson
2013-07-09 23:19   ` [PATCH v2 3/5] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT Doug Anderson
2013-07-10 14:54     ` Seungwon Jeon
2013-07-10 15:05       ` Doug Anderson
2013-07-15 12:09         ` Seungwon Jeon
2013-07-31 16:18           ` Doug Anderson
2013-08-06 21:36             ` Doug Anderson
2013-07-09 23:19   ` [PATCH v2 4/5] mmc: dw_mmc: Always setup the bus after suspend/resume Doug Anderson
2013-07-09 23:19   ` [PATCH v2 5/5] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
2013-07-10 14:54     ` Seungwon Jeon
2013-07-10 15:42   ` [PATCH v3 0/5] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-07-10 15:42     ` [PATCH v3 1/5] mmc: dw_mmc: Invalidate cache of current_speed after suspend/resume Doug Anderson
2013-07-10 15:42     ` [PATCH v3 2/5] mmc: dw_mmc: Add suspend_noirq/resume_noirq callbacks for dw_mmc-pltfm Doug Anderson
2013-07-15 12:09       ` Seungwon Jeon
2013-08-06 21:32         ` Doug Anderson
2013-07-10 15:42     ` [PATCH v3 3/5] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT Doug Anderson
2013-07-16  1:36       ` Jaehoon Chung
2013-07-10 15:42     ` [PATCH v3 4/5] mmc: dw_mmc: Always setup the bus after suspend/resume Doug Anderson
2013-07-10 15:42     ` [PATCH v3 5/5] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
2013-08-06 21:37     ` [PATCH v4 0/4] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-08-06 21:37       ` [PATCH v4 1/4] mmc: dw_mmc: Invalidate cache of current_speed after suspend/resume Doug Anderson
2013-08-06 21:58         ` Tomasz Figa
2013-08-08  5:14         ` Jaehoon Chung
2013-08-09 13:32         ` Seungwon Jeon
2013-08-09 15:22           ` Doug Anderson
2013-08-12  7:14             ` Seungwon Jeon
2013-08-22  0:54               ` Doug Anderson
2013-08-22 16:25                 ` Doug Anderson
2013-08-06 21:37       ` [PATCH v4 2/4] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT Doug Anderson
2013-08-06 21:58         ` Tomasz Figa
2013-08-06 22:09           ` Doug Anderson
2013-08-06 22:20             ` Tomasz Figa
2013-08-09 13:33         ` Seungwon Jeon
2013-08-09 15:05           ` Doug Anderson
2013-08-06 21:37       ` [PATCH v4 3/4] mmc: dw_mmc: Always setup the bus after suspend/resume Doug Anderson
2013-08-06 22:01         ` Tomasz Figa
2013-08-09 13:35         ` Seungwon Jeon
2013-08-09 15:43           ` Doug Anderson
2013-08-12  7:20             ` Seungwon Jeon [this message]
2013-08-06 21:37       ` [PATCH v4 4/4] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
2013-08-06 22:02         ` Tomasz Figa
2013-08-09 16:33       ` [PATCH v5 0/4] mmc: dw_mmc: fixes for suspend/resume on exynos Doug Anderson
2013-08-09 16:33         ` [PATCH v5 1/4] mmc: dw_mmc: Invalidate cache of current_speed after suspend/resume Doug Anderson
2013-08-09 16:33         ` [PATCH v5 2/4] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT Doug Anderson
2013-08-09 16:41           ` Fabio Estevam
2013-08-09 16:48             ` Doug Anderson
2013-08-12  7:21           ` Seungwon Jeon
2013-08-09 16:33         ` [PATCH v5 3/4] mmc: dw_mmc: Always setup the bus after suspend/resume Doug Anderson
2013-08-09 16:33         ` [PATCH v5 4/4] mmc: dw_mmc: Set timeout to max upon resume Doug Anderson
2013-08-21 11:48         ` [PATCH v5 0/4] mmc: dw_mmc: fixes for suspend/resume on exynos Seungwon Jeon
2013-08-21 15:13           ` 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='000d01ce972c$6cf14730$46d3d590$%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;
as well as URLs for NNTP newsgroup(s).