All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
To: linux-mmc@vger.kernel.org
Cc: ulf.hansson@linaro.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Subject: [RFC 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages
Date: Wed,  2 Sep 2015 01:02:17 +0530	[thread overview]
Message-ID: <1441135938-8056-3-git-send-email-vaibhav.hiremath@linaro.org> (raw)
In-Reply-To: <1441135938-8056-1-git-send-email-vaibhav.hiremath@linaro.org>

Currently, the sdhci_do_start_signal_voltage_switch() function invokes
controller specific voltage switch configuration only for 1.8v usecase;
but it is required for others as well.

For example, in case of PXA1928 SDH controller, we need to set different
configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power
control register).

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
---
Note:
Currently ->voltage_switch() callback is only supported
in f_sdh30 driver. And I am not sure on the dependency of execution
sequence for that device. I could have moved ->voltage_switch() call
at one common place (above/below), but was not quite sure about it.
So, replicated/duplicated the call for other voltages.

 drivers/mmc/host/sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3dd295f..b59b76d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
 		/* Wait for 5ms */
 		usleep_range(5000, 5500);
 
+		/* Some controller need to do more when switching */
+		if (host->ops->voltage_switch)
+			host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330);
+
 		/* 3.3V regulator output should be stable within 5 ms */
 		ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 		if (!(ctrl & SDHCI_CTRL_VDD_180))
@@ -1803,6 +1807,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
 				return -EIO;
 			}
 		}
+		/* Some controller need to do more when switching */
+		if (host->ops->voltage_switch)
+			host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_120);
+
 		return 0;
 	default:
 		/* No signal voltage switch required */
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: vaibhav.hiremath@linaro.org (Vaibhav Hiremath)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages
Date: Wed,  2 Sep 2015 01:02:17 +0530	[thread overview]
Message-ID: <1441135938-8056-3-git-send-email-vaibhav.hiremath@linaro.org> (raw)
In-Reply-To: <1441135938-8056-1-git-send-email-vaibhav.hiremath@linaro.org>

Currently, the sdhci_do_start_signal_voltage_switch() function invokes
controller specific voltage switch configuration only for 1.8v usecase;
but it is required for others as well.

For example, in case of PXA1928 SDH controller, we need to set different
configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power
control register).

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
---
Note:
Currently ->voltage_switch() callback is only supported
in f_sdh30 driver. And I am not sure on the dependency of execution
sequence for that device. I could have moved ->voltage_switch() call
at one common place (above/below), but was not quite sure about it.
So, replicated/duplicated the call for other voltages.

 drivers/mmc/host/sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3dd295f..b59b76d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
 		/* Wait for 5ms */
 		usleep_range(5000, 5500);
 
+		/* Some controller need to do more when switching */
+		if (host->ops->voltage_switch)
+			host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330);
+
 		/* 3.3V regulator output should be stable within 5 ms */
 		ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 		if (!(ctrl & SDHCI_CTRL_VDD_180))
@@ -1803,6 +1807,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
 				return -EIO;
 			}
 		}
+		/* Some controller need to do more when switching */
+		if (host->ops->voltage_switch)
+			host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_120);
+
 		return 0;
 	default:
 		/* No signal voltage switch required */
-- 
1.9.1

  parent reply	other threads:[~2015-09-01 19:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 19:32 [RFC 0/3] mmc: sdhci: pass signal voltage as an argument to ->voltage_switch() Vaibhav Hiremath
2015-09-01 19:32 ` Vaibhav Hiremath
2015-09-01 19:32 ` [RFC 1/3] mmc: sdhci: pass signal_voltage as an argument to voltage_switch callback Vaibhav Hiremath
2015-09-01 19:32   ` Vaibhav Hiremath
2015-09-01 19:32 ` Vaibhav Hiremath [this message]
2015-09-01 19:32   ` [RFC 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages Vaibhav Hiremath
2015-09-02  7:04   ` Jisheng Zhang
2015-09-02  7:04     ` Jisheng Zhang
2015-09-02  7:04     ` Jisheng Zhang
2015-09-02  8:19     ` Vaibhav Hiremath
2015-09-02  8:19       ` Vaibhav Hiremath
2015-09-02  8:26       ` Jisheng Zhang
2015-09-02  8:26         ` Jisheng Zhang
2015-09-02  8:26         ` Jisheng Zhang
2015-09-02 11:43         ` Vaibhav Hiremath
2015-09-02 11:43           ` Vaibhav Hiremath
2015-09-14  9:30           ` Ulf Hansson
2015-09-14  9:30             ` Ulf Hansson
2015-09-14  9:30             ` Ulf Hansson
2015-09-14  9:42             ` Vaibhav Hiremath
2015-09-14  9:42               ` Vaibhav Hiremath
2015-09-14  9:42               ` Vaibhav Hiremath
2015-09-14 10:34               ` Ulf Hansson
2015-09-14 10:34                 ` Ulf Hansson
2015-09-14 10:34                 ` Ulf Hansson
2015-09-14 12:41                 ` Vaibhav Hiremath
2015-09-14 12:41                   ` Vaibhav Hiremath
2015-09-14 12:41                   ` Vaibhav Hiremath
2015-09-14 12:47                   ` Vaibhav Hiremath
2015-09-14 12:47                     ` Vaibhav Hiremath
2015-09-14 12:47                     ` Vaibhav Hiremath
2015-10-02 10:00       ` Linus Walleij
2015-10-02 10:00         ` Linus Walleij
2015-10-02 10:00         ` Linus Walleij
2015-09-01 19:32 ` [RFC 3/3] mmc: sdhci-pxav3: Add ->voltage_switch callback support Vaibhav Hiremath
2015-09-01 19:32   ` Vaibhav Hiremath
2015-09-02 13:51   ` Shawn Lin
2015-09-02 14:32     ` Vaibhav Hiremath
2015-09-02 14:32       ` Vaibhav Hiremath
2015-09-03 18:35     ` Vaibhav Hiremath
2015-09-03 18:35       ` Vaibhav Hiremath

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=1441135938-8056-3-git-send-email-vaibhav.hiremath@linaro.org \
    --to=vaibhav.hiremath@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --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.