All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuvaraj Kumar C D <yuvaraj.cd@gmail.com>
To: linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, jh80.chung@samsung.com,
	cjb@laptop.org, tgih.jun@samsung.com, linux-mmc@vger.kernel.org,
	ulf.hansson@linaro.org
Cc: sonnyrao@chromium.org, t.figa@samsung.com, kgene.kim@samsung.com,
	joshi@samsung.com, ks.giri@samsung.com, prashanth.g@samsung.com,
	alim.akhtar@samsung.com,
	Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
Subject: [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc
Date: Mon, 23 Jun 2014 16:15:20 +0530	[thread overview]
Message-ID: <1403520321-2431-3-git-send-email-yuvaraj.cd@samsung.com> (raw)
In-Reply-To: <1403520321-2431-1-git-send-email-yuvaraj.cd@samsung.com>

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(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index f5cabce..e034bce 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -932,6 +932,25 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	spin_unlock_bh(&host->lock);
 }
 
+/*
+ * some of the boards use controller CD line for card detection.Unfortunately
+ * CD line is bind to the same volatge domain as of the IO lines.If we turn off
+ * IO voltage domain, CD line wont work.
+ * Return true when controller CD line is used for card detection or return
+ * false.
+ */
+static bool dw_mci_builtin_cd(struct dw_mci_slot *slot)
+{
+	struct dw_mci_board *brd = slot->host->pdata;
+	struct mmc_host *mmc = slot->mmc;
+
+	if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) &&
+			!IS_ERR_VALUE(mmc_gpio_get_cd(mmc)))
+		return true;
+	else
+		return false;
+}
+
 static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
 	struct dw_mci_slot *slot = mmc_priv(mmc);
@@ -988,6 +1007,10 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		mci_writel(slot->host, PWREN, regs);
 		break;
 	case MMC_POWER_OFF:
+		if (dw_mci_builtin_cd(slot) &&
+				!test_bit(DW_MMC_CARD_PRESENT, &slot->flags))
+			return;
+
 		if (!IS_ERR(mmc->supply.vqmmc) &&
 				test_bit(DW_MMC_IO_POWERED, &slot->flags)) {
 			ret = regulator_disable(mmc->supply.vqmmc);
-- 
1.7.10.4


WARNING: multiple messages have this Message-ID (diff)
From: yuvaraj.cd@gmail.com (Yuvaraj Kumar C D)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc
Date: Mon, 23 Jun 2014 16:15:20 +0530	[thread overview]
Message-ID: <1403520321-2431-3-git-send-email-yuvaraj.cd@samsung.com> (raw)
In-Reply-To: <1403520321-2431-1-git-send-email-yuvaraj.cd@samsung.com>

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(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index f5cabce..e034bce 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -932,6 +932,25 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	spin_unlock_bh(&host->lock);
 }
 
+/*
+ * some of the boards use controller CD line for card detection.Unfortunately
+ * CD line is bind to the same volatge domain as of the IO lines.If we turn off
+ * IO voltage domain, CD line wont work.
+ * Return true when controller CD line is used for card detection or return
+ * false.
+ */
+static bool dw_mci_builtin_cd(struct dw_mci_slot *slot)
+{
+	struct dw_mci_board *brd = slot->host->pdata;
+	struct mmc_host *mmc = slot->mmc;
+
+	if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) &&
+			!IS_ERR_VALUE(mmc_gpio_get_cd(mmc)))
+		return true;
+	else
+		return false;
+}
+
 static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
 	struct dw_mci_slot *slot = mmc_priv(mmc);
@@ -988,6 +1007,10 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		mci_writel(slot->host, PWREN, regs);
 		break;
 	case MMC_POWER_OFF:
+		if (dw_mci_builtin_cd(slot) &&
+				!test_bit(DW_MMC_CARD_PRESENT, &slot->flags))
+			return;
+
 		if (!IS_ERR(mmc->supply.vqmmc) &&
 				test_bit(DW_MMC_IO_POWERED, &slot->flags)) {
 			ret = regulator_disable(mmc->supply.vqmmc);
-- 
1.7.10.4

  parent reply	other threads:[~2014-06-23 10:45 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 ` Yuvaraj Kumar C D [this message]
2014-06-23 10:45   ` [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc Yuvaraj Kumar C D
2014-06-24 18:10   ` Doug Anderson
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=1403520321-2431-3-git-send-email-yuvaraj.cd@samsung.com \
    --to=yuvaraj.cd@gmail.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@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.