All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ludovic Desroches <ludovic.desroches@atmel.com>
To: <ulf.hansson@linaro.org>, <nicolas.ferre@atmel.com>,
	<alexandre.belloni@free-electrons.com>
Cc: <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<plagnioj@jcrosoft.com>, <linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <pierre.samat@atmel.com>,
	Ludovic Desroches <ludovic.desroches@atmel.com>
Subject: [PATCH 1/2] mmc: sdhci: set bus voltage before enabling bus power
Date: Fri, 6 Nov 2015 16:59:29 +0100	[thread overview]
Message-ID: <1446825570-30029-2-git-send-email-ludovic.desroches@atmel.com> (raw)
In-Reply-To: <1446825570-30029-1-git-send-email-ludovic.desroches@atmel.com>

When there is a vmmc regulator, only SD Bus Power is set to 1 in the
Power Control Register. It means SD Bus Voltage Select field is set to 0
that is a reserved value. The SD Host Controller specification says:
'SD Bus Power: Before setting this bit, the SD Host Driver shall set SD
Bus Voltage Select.' and 'If the Host Driver selects an unsupported
voltage in the SD B?us Voltage Select field, the Host Controller may
ignore writes to SD Bus Power and keep its value at zero."

Having an external regulator means the SD Bus Voltage Select is useless
but if the Host Controller strictly follows the specification then we
need to set a valid value.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/sdhci.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ac97b46..0cfd7b2 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1278,13 +1278,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
 		spin_unlock_irq(&host->lock);
 		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
 		spin_lock_irq(&host->lock);
-
-		if (mode != MMC_POWER_OFF)
-			sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
-		else
-			sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
-
-		return;
 	}
 
 	if (mode != MMC_POWER_OFF) {
-- 
2.5.0


WARNING: multiple messages have this Message-ID (diff)
From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org
Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	pierre.samat-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org,
	Ludovic Desroches
	<ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 1/2] mmc: sdhci: set bus voltage before enabling bus power
Date: Fri, 6 Nov 2015 16:59:29 +0100	[thread overview]
Message-ID: <1446825570-30029-2-git-send-email-ludovic.desroches@atmel.com> (raw)
In-Reply-To: <1446825570-30029-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

When there is a vmmc regulator, only SD Bus Power is set to 1 in the
Power Control Register. It means SD Bus Voltage Select field is set to 0
that is a reserved value. The SD Host Controller specification says:
'SD Bus Power: Before setting this bit, the SD Host Driver shall set SD
Bus Voltage Select.' and 'If the Host Driver selects an unsupported
voltage in the SD B?us Voltage Select field, the Host Controller may
ignore writes to SD Bus Power and keep its value at zero."

Having an external regulator means the SD Bus Voltage Select is useless
but if the Host Controller strictly follows the specification then we
need to set a valid value.

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 drivers/mmc/host/sdhci.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ac97b46..0cfd7b2 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1278,13 +1278,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
 		spin_unlock_irq(&host->lock);
 		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
 		spin_lock_irq(&host->lock);
-
-		if (mode != MMC_POWER_OFF)
-			sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
-		else
-			sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
-
-		return;
 	}
 
 	if (mode != MMC_POWER_OFF) {
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: ludovic.desroches@atmel.com (Ludovic Desroches)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] mmc: sdhci: set bus voltage before enabling bus power
Date: Fri, 6 Nov 2015 16:59:29 +0100	[thread overview]
Message-ID: <1446825570-30029-2-git-send-email-ludovic.desroches@atmel.com> (raw)
In-Reply-To: <1446825570-30029-1-git-send-email-ludovic.desroches@atmel.com>

When there is a vmmc regulator, only SD Bus Power is set to 1 in the
Power Control Register. It means SD Bus Voltage Select field is set to 0
that is a reserved value. The SD Host Controller specification says:
'SD Bus Power: Before setting this bit, the SD Host Driver shall set SD
Bus Voltage Select.' and 'If the Host Driver selects an unsupported
voltage in the SD B?us Voltage Select field, the Host Controller may
ignore writes to SD Bus Power and keep its value at zero."

Having an external regulator means the SD Bus Voltage Select is useless
but if the Host Controller strictly follows the specification then we
need to set a valid value.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/sdhci.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ac97b46..0cfd7b2 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1278,13 +1278,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
 		spin_unlock_irq(&host->lock);
 		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
 		spin_lock_irq(&host->lock);
-
-		if (mode != MMC_POWER_OFF)
-			sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
-		else
-			sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
-
-		return;
 	}
 
 	if (mode != MMC_POWER_OFF) {
-- 
2.5.0

  reply	other threads:[~2015-11-06 16:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 15:59 [PATCH 0/2] mmc: sdhci: potentially bad behavior when using vmmc supply Ludovic Desroches
2015-11-06 15:59 ` Ludovic Desroches
2015-11-06 15:59 ` Ludovic Desroches
2015-11-06 15:59 ` Ludovic Desroches [this message]
2015-11-06 15:59   ` [PATCH 1/2] mmc: sdhci: set bus voltage before enabling bus power Ludovic Desroches
2015-11-06 15:59   ` Ludovic Desroches
2015-11-09 13:23   ` Ludovic Desroches
2015-11-09 13:23     ` Ludovic Desroches
2015-11-09 13:23     ` Ludovic Desroches
2015-11-09 14:12     ` Ulf Hansson
2015-11-09 14:12       ` Ulf Hansson
2015-11-09 14:12       ` Ulf Hansson
2015-11-09 14:40       ` Ludovic Desroches
2015-11-09 14:40         ` Ludovic Desroches
2015-11-09 14:40         ` Ludovic Desroches
2015-11-09 16:00         ` Ulf Hansson
2015-11-09 16:00           ` Ulf Hansson
2015-11-09 16:00           ` Ulf Hansson
2015-11-09 16:30           ` Ludovic Desroches
2015-11-09 16:30             ` Ludovic Desroches
2015-11-09 16:30             ` Ludovic Desroches
2015-11-24  9:23             ` Ludovic Desroches
2015-11-24  9:23               ` Ludovic Desroches
2015-11-24  9:23               ` Ludovic Desroches
2015-11-24 11:01               ` Ulf Hansson
2015-11-24 11:01                 ` Ulf Hansson
2015-11-24 11:01                 ` Ulf Hansson
2015-11-24 13:12                 ` Ludovic Desroches
2015-11-24 13:12                   ` Ludovic Desroches
2015-11-24 13:12                   ` Ludovic Desroches
2015-11-24 13:56                   ` Ulf Hansson
2015-11-24 13:56                     ` Ulf Hansson
2015-11-24 13:56                     ` Ulf Hansson
2015-11-24 14:08                     ` Ludovic Desroches
2015-11-24 14:08                       ` Ludovic Desroches
2015-11-24 14:08                       ` Ludovic Desroches
2015-11-24 15:17                       ` Ulf Hansson
2015-11-24 15:17                         ` Ulf Hansson
2015-11-24 15:17                         ` Ulf Hansson
2015-11-06 15:59 ` [PATCH 2/2] ARM: at91/dt: sama5d2 Xplained: add regulators for sdhci devices Ludovic Desroches
2015-11-06 15:59   ` Ludovic Desroches
2015-11-06 15:59   ` Ludovic Desroches
2015-11-06 16:42 ` [PATCH 0/2] mmc: sdhci: potentially bad behavior when using vmmc supply Ulf Hansson
2015-11-06 16:42   ` Ulf Hansson
2015-11-06 16:42   ` Ulf Hansson
2015-11-09  7:41   ` Ludovic Desroches
2015-11-09  7:41     ` Ludovic Desroches
2015-11-09  7:41     ` Ludovic Desroches
2015-11-09  9:38     ` Ulf Hansson
2015-11-09  9:38       ` Ulf Hansson
2015-11-09  9:38       ` Ulf Hansson
2015-11-09 10:25       ` Ludovic Desroches
2015-11-09 10:25         ` Ludovic Desroches
2015-11-09 10:25         ` Ludovic Desroches
2015-11-09 10:50         ` Ulf Hansson
2015-11-09 10:50           ` Ulf Hansson
2015-11-09 10:50           ` Ulf Hansson
2015-11-09 13:14           ` Ludovic Desroches
2015-11-09 13:14             ` Ludovic Desroches
2015-11-09 13:14             ` Ludovic Desroches
2015-11-09 13:18             ` Ulf Hansson
2015-11-09 13:18               ` Ulf Hansson
2015-11-09 13:18               ` Ulf Hansson

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=1446825570-30029-2-git-send-email-ludovic.desroches@atmel.com \
    --to=ludovic.desroches@atmel.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=pierre.samat@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=ulf.hansson@linaro.org \
    /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.