All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@google.com>
To: Yuvaraj Kumar C D <yuvaraj.cd@gmail.com>
Cc: linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Chris Ball <cjb@laptop.org>, Seungwon Jeon <tgih.jun@samsung.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Sonny Rao <sonnyrao@chromium.org>,
	Tomasz Figa <t.figa@samsung.com>,
	Kukjin Kim <kgene.kim@samsung.com>,
	sunil joshi <joshi@samsung.com>,
	ks.giri@samsung.com, Prashanth G <prashanth.g@samsung.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
Subject: Re: [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc
Date: Tue, 24 Jun 2014 11:10:48 -0700	[thread overview]
Message-ID: <CAD=FV=XxdWEpoTMfJmUHpY7ykF+ZWrvP-GAoF+=mEeSeP7+ekA@mail.gmail.com> (raw)
In-Reply-To: <1403520321-2431-3-git-send-email-yuvaraj.cd@samsung.com>

Yuvaraj,

On Mon, Jun 23, 2014 at 3:45 AM, Yuvaraj Kumar C D <yuvaraj.cd@gmail.com> wrote:
> On exynos 5250 and 5420 based boards which uses built-in CD# line
> for card detection.But unfortunately CD# line is on the same voltage
> rails as of I/O voltage rails.When we cut off vqmmc,the consequent
> card detection will break in these boards.
>
> Also if we let alone the vqmmc turned on when vmmc turned off, the
> card could have half way powered and this can damage the card.So
> this patch adds a check so that, if the board used the built-in
> card detection mechanism i.e through CDETECT, it will not turned
> down vqmmc and vmmc both.
>
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c |   23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)

Yes, but...

As I mentioned in our separate email thread about this you're now
preventing mmc_power_cycle() from working properly.

IMHO you need the patch I sent you back on April 24th (was it that
long ago?).  Due to the brokenness of exynos (and anyone else that
powers CD off of vqmmc) you need to extend the MMC core to
differentiate several different types of "power off":

* power off because no card is plugged in: you should keep your card on.
* power off because you're power cycling: you should power off your card.
* power off because the system is suspending: you should power off your card.

...the third bullet point is something I hadn't though of until just
now and probably isn't addressed in my old patch...


Also: as we've discussed privately: you could imagine someone
designing an exynos5-based board where they've put the CD on a
separate GPIO.  On a system like this then all these hacks won't be
necessary.

---

Verbatim from my email about this topic on May 28th:

There are two important cases to handle:

1. Properly power cycle both vmmc and vqmmc (at the same time!) in
mmc_power_cycle().

2. DON'T power off for mmc_power_off() unless it's part of
mmc_power_cycle().  Specifically note that mmc_power_off() is called
in a whole bunch of places other than mmc_power_cycle().  For
instance, if we fail to probe a card we'll call mmc_power_off().  All
of these _must_ not turn off power to card detect or else we won't be
able to see future card insertions.  Note that mmc_power_off() might
be called on its own even when a card is inserted.  Look at the end of
mmc_rescan_try_freq().  It will be called if there are errors
attaching a card.


Rules to always remember:

* On all boards you should turn on vmmc and vqmmc at the same time.
It's illegal to have vqmmc on without vmmc and not good to have vmmc
on without vqmmc.

* On exynos you must ensure that vqmmc is on at all times, except
during power cycling of a card.  If vqmmc is not on you can't detect
card insertions or removals since the card detect line won't be
powered.

* To handle errors, you must ensure that mmc_power_cycle() actually
cycles power to the card.

WARNING: multiple messages have this Message-ID (diff)
From: dianders@google.com (Doug Anderson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc
Date: Tue, 24 Jun 2014 11:10:48 -0700	[thread overview]
Message-ID: <CAD=FV=XxdWEpoTMfJmUHpY7ykF+ZWrvP-GAoF+=mEeSeP7+ekA@mail.gmail.com> (raw)
In-Reply-To: <1403520321-2431-3-git-send-email-yuvaraj.cd@samsung.com>

Yuvaraj,

On Mon, Jun 23, 2014 at 3:45 AM, Yuvaraj Kumar C D <yuvaraj.cd@gmail.com> wrote:
> On exynos 5250 and 5420 based boards which uses built-in CD# line
> for card detection.But unfortunately CD# line is on the same voltage
> rails as of I/O voltage rails.When we cut off vqmmc,the consequent
> card detection will break in these boards.
>
> Also if we let alone the vqmmc turned on when vmmc turned off, the
> card could have half way powered and this can damage the card.So
> this patch adds a check so that, if the board used the built-in
> card detection mechanism i.e through CDETECT, it will not turned
> down vqmmc and vmmc both.
>
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c |   23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)

Yes, but...

As I mentioned in our separate email thread about this you're now
preventing mmc_power_cycle() from working properly.

IMHO you need the patch I sent you back on April 24th (was it that
long ago?).  Due to the brokenness of exynos (and anyone else that
powers CD off of vqmmc) you need to extend the MMC core to
differentiate several different types of "power off":

* power off because no card is plugged in: you should keep your card on.
* power off because you're power cycling: you should power off your card.
* power off because the system is suspending: you should power off your card.

...the third bullet point is something I hadn't though of until just
now and probably isn't addressed in my old patch...


Also: as we've discussed privately: you could imagine someone
designing an exynos5-based board where they've put the CD on a
separate GPIO.  On a system like this then all these hacks won't be
necessary.

---

Verbatim from my email about this topic on May 28th:

There are two important cases to handle:

1. Properly power cycle both vmmc and vqmmc (at the same time!) in
mmc_power_cycle().

2. DON'T power off for mmc_power_off() unless it's part of
mmc_power_cycle().  Specifically note that mmc_power_off() is called
in a whole bunch of places other than mmc_power_cycle().  For
instance, if we fail to probe a card we'll call mmc_power_off().  All
of these _must_ not turn off power to card detect or else we won't be
able to see future card insertions.  Note that mmc_power_off() might
be called on its own even when a card is inserted.  Look at the end of
mmc_rescan_try_freq().  It will be called if there are errors
attaching a card.


Rules to always remember:

* On all boards you should turn on vmmc and vqmmc at the same time.
It's illegal to have vqmmc on without vmmc and not good to have vmmc
on without vqmmc.

* On exynos you must ensure that vqmmc is on at all times, except
during power cycling of a card.  If vqmmc is not on you can't detect
card insertions or removals since the card detect line won't be
powered.

* To handle errors, you must ensure that mmc_power_cycle() actually
cycles power to the card.

  reply	other threads:[~2014-06-24 18:10 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 10:45 [PATCH 0/3] Adding UHS support for dw_mmc driver Yuvaraj Kumar C D
2014-06-23 10:45 ` Yuvaraj Kumar C D
2014-06-23 10:45 ` [PATCH 1/3] mmc: dw_mmc: use mmc_regulator_get_supply to handle regulators Yuvaraj Kumar C D
2014-06-23 10:45   ` Yuvaraj Kumar C D
2014-06-24 18:00   ` Doug Anderson
2014-06-24 18:00     ` Doug Anderson
2014-06-25  3:18     ` Jaehoon Chung
2014-06-25  3:18       ` Jaehoon Chung
2014-06-25  4:00       ` Doug Anderson
2014-06-25  4:00         ` Doug Anderson
2014-06-25 11:18       ` Seungwon Jeon
2014-06-25 11:18         ` Seungwon Jeon
2014-06-25 17:28         ` Doug Anderson
2014-06-25 17:28           ` Doug Anderson
2014-06-26 10:30           ` Seungwon Jeon
2014-06-26 10:30             ` Seungwon Jeon
2014-06-26 16:20             ` Doug Anderson
2014-06-26 16:20               ` Doug Anderson
2014-06-27 11:19               ` Seungwon Jeon
2014-06-27 11:19                 ` Seungwon Jeon
2014-06-26 11:21     ` Yuvaraj Kumar
2014-06-26 11:21       ` Yuvaraj Kumar
2014-06-26 16:18       ` Doug Anderson
2014-06-26 16:18         ` Doug Anderson
2014-06-27 10:59         ` Yuvaraj Kumar
2014-06-27 10:59           ` Yuvaraj Kumar
2014-06-27 22:47           ` Doug Anderson
2014-06-27 22:47             ` Doug Anderson
2014-07-22 19:31             ` Javier Martinez Canillas
2014-07-22 19:31               ` Javier Martinez Canillas
2014-06-30 12:13         ` Jaehoon Chung
2014-06-30 12:13           ` Jaehoon Chung
2014-06-30 15:06           ` Doug Anderson
2014-06-30 15:06             ` Doug Anderson
2014-07-01  4:25             ` Jaehoon Chung
2014-07-01  4:25               ` Jaehoon Chung
2014-06-23 10:45 ` [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc Yuvaraj Kumar C D
2014-06-23 10:45   ` Yuvaraj Kumar C D
2014-06-24 18:10   ` Doug Anderson [this message]
2014-06-24 18:10     ` Doug Anderson
2014-06-23 10:45 ` [PATCH 3/3] mmc: dw_mmc: Support voltage changes Yuvaraj Kumar C D
2014-06-23 10:45   ` Yuvaraj Kumar C D
2014-06-24 18:17   ` Doug Anderson
2014-06-24 18:17     ` Doug Anderson
2014-06-25 13:08   ` Seungwon Jeon
2014-06-25 13:08     ` Seungwon Jeon
2014-06-25 17:46     ` Doug Anderson
2014-06-25 17:46       ` Doug Anderson
2014-06-26 10:41       ` Seungwon Jeon
2014-06-26 10:41         ` Seungwon Jeon
2014-06-26 16:50         ` Doug Anderson
2014-06-26 16:50           ` Doug Anderson
2014-06-27  6:35           ` Yuvaraj Kumar
2014-06-27  6:35             ` Yuvaraj Kumar
2014-06-27 11:18             ` Seungwon Jeon
2014-06-27 11:18               ` Seungwon Jeon
2014-06-30 12:18               ` Jaehoon Chung
2014-06-30 12:18                 ` Jaehoon Chung
2014-07-01 11:17               ` Yuvaraj Kumar
2014-07-01 11:17                 ` Yuvaraj Kumar
2014-07-04 10:08                 ` Seungwon Jeon
2014-07-04 10:08                   ` Seungwon Jeon
2014-07-07  5:23                   ` Seungwon Jeon
2014-07-07  5:23                     ` Seungwon Jeon
2014-07-08  4:34                     ` Yuvaraj Kumar
2014-07-08  4:34                       ` Yuvaraj Kumar
2014-07-08  9:56                       ` Seungwon Jeon
2014-07-08  9:56                         ` Seungwon Jeon
2014-06-26 11:38       ` Yuvaraj Kumar
2014-06-26 11:38         ` Yuvaraj Kumar

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='CAD=FV=XxdWEpoTMfJmUHpY7ykF+ZWrvP-GAoF+=mEeSeP7+ekA@mail.gmail.com' \
    --to=dianders@google.com \
    --cc=alim.akhtar@samsung.com \
    --cc=cjb@laptop.org \
    --cc=jh80.chung@samsung.com \
    --cc=joshi@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=ks.giri@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=prashanth.g@samsung.com \
    --cc=sonnyrao@chromium.org \
    --cc=t.figa@samsung.com \
    --cc=tgih.jun@samsung.com \
    --cc=ulf.hansson@linaro.org \
    --cc=yuvaraj.cd@gmail.com \
    --cc=yuvaraj.cd@samsung.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.