From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755323AbbIATft (ORCPT ); Tue, 1 Sep 2015 15:35:49 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:36347 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753431AbbIATf3 (ORCPT ); Tue, 1 Sep 2015 15:35:29 -0400 From: Vaibhav Hiremath To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Vaibhav Hiremath 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 Message-Id: <1441135938-8056-3-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441135938-8056-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1441135938-8056-1-git-send-email-vaibhav.hiremath@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: vaibhav.hiremath@linaro.org (Vaibhav Hiremath) Date: Wed, 2 Sep 2015 01:02:17 +0530 Subject: [RFC 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages In-Reply-To: <1441135938-8056-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1441135938-8056-1-git-send-email-vaibhav.hiremath@linaro.org> Message-ID: <1441135938-8056-3-git-send-email-vaibhav.hiremath@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.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 --- 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