From patchwork Tue Aug 25 09:05:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 7069831 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E105C05AC for ; Tue, 25 Aug 2015 09:10:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 460E4207EA for ; Tue, 25 Aug 2015 09:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF932208B6 for ; Tue, 25 Aug 2015 09:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932427AbbHYJGE (ORCPT ); Tue, 25 Aug 2015 05:06:04 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:53963 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932416AbbHYJGA (ORCPT ); Tue, 25 Aug 2015 05:06:00 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t7P95u7p025035; Tue, 25 Aug 2015 04:05:56 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7P95u6R023186; Tue, 25 Aug 2015 04:05:56 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Tue, 25 Aug 2015 04:05:56 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7P95h4b031149; Tue, 25 Aug 2015 04:05:53 -0500 From: Kishon Vijay Abraham I To: , , , , , , CC: , Subject: [PATCH v2 03/11] mmc: host: omap_hsmmc: program HCTL based on signal_voltage set by mmc core Date: Tue, 25 Aug 2015 14:35:34 +0530 Message-ID: <1440493542-26150-4-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1440493542-26150-1-git-send-email-kishon@ti.com> References: <1440493542-26150-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP HCTL is now set based on ios.signal_voltage set by mmc core and not hardcoded to 3V0 if OMAP_HSMMC_SUPPORTS_DUAL_VOLT is set. If OMAP_HSMMC_SUPPORTS_DUAL_VOLT is set, it means HCTL can be set to either 3V0 or 1V8. And it should be set to 3V0 or 1V8 depending on ios.signal_voltage. Also it is now set on power mode status being changed to MMC_POWER_ON. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/omap_hsmmc.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index fd8cc81..d3fe0f8 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -229,6 +229,7 @@ struct omap_mmc_of_data { }; static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host); +static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host, int iov); static int omap_hsmmc_card_detect(struct device *dev) { @@ -1674,6 +1675,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) mmc_pdata(host)->set_power(host->dev, 1, ios->vdd); break; case MMC_POWER_ON: + omap_hsmmc_conf_bus_power(host, ios->signal_voltage); do_send_init_stream = 1; break; } @@ -1836,17 +1838,12 @@ static void omap_hsmmc_set_capabilities(struct omap_hsmmc_host *host) OMAP_HSMMC_WRITE(host->base, CAPA, val); } -static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) +static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host, int iov) { u32 hctl, value; - /* Only MMC1 supports 3.0V */ - if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) - hctl = SDVS30; - else - hctl = SDVS18; - value = OMAP_HSMMC_READ(host->base, HCTL) & ~SDVS_MASK; + hctl = (iov == MMC_SIGNAL_VOLTAGE_180) ? SDVS18 : SDVS30; OMAP_HSMMC_WRITE(host->base, HCTL, value | hctl); /* Set SD bus power bit */ @@ -2153,7 +2150,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) mmc->pm_caps |= mmc_pdata(host)->pm_caps; omap_hsmmc_set_capabilities(host); - omap_hsmmc_conf_bus_power(host); if (!pdev->dev.of_node) { res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); @@ -2328,6 +2324,7 @@ static int omap_hsmmc_suspend(struct device *dev) static int omap_hsmmc_resume(struct device *dev) { struct omap_hsmmc_host *host = dev_get_drvdata(dev); + struct mmc_ios *ios; if (!host) return 0; @@ -2337,8 +2334,9 @@ static int omap_hsmmc_resume(struct device *dev) if (host->dbclk) clk_prepare_enable(host->dbclk); + ios = &host->mmc->ios; if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) - omap_hsmmc_conf_bus_power(host); + omap_hsmmc_conf_bus_power(host, ios->signal_voltage); omap_hsmmc_protect_card(host); pm_runtime_mark_last_busy(host->dev);