From patchwork Fri May 19 08:15:02 2017 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: 100163 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp201345qge; Fri, 19 May 2017 01:16:55 -0700 (PDT) X-Received: by 10.98.18.84 with SMTP id a81mr9215373pfj.188.1495181815643; Fri, 19 May 2017 01:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495181815; cv=none; d=google.com; s=arc-20160816; b=m2sKDHquvce9g9+u8JekDkRtWzDS2lxVKR7hV0QU53SynihsJH1mgL0JFw4ZGGQ0JV 7XnmHKfAh3/oolhfyFbad3KrUUV7rQ8LCG8Mof5nn/p629P2G6Y/PJCEktt/2MYF78ue x3nDFYUqKVlP/a0laDgaJD8eG7MutCgyXSKX4P0JV8kmv67cnqRDGb9t5MFwD+rVPOCY Tl7dXDDLzNYb53BbJD2ZXRAzI10e0d3su80GrjwDmDPNU1GISOcOOUuk4QyzRmith46l g/DeuP/mzD3I71L+iUg9DY5S6NGA3sJaqU2jhxbjfHDxINBTyCJlMezAgNKcR4NDfXfR sSpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=W8Pt2Fc+03TujXirgzZvON9JsUDqbZ1zUX6pb6HM5r0=; b=RfaHW4f8CkE328Cbl41Ee/PG+s+5D+d4zopPtbO2hgMJ2k0nyAULQSpDZ1bW786x9r LdCjutc45pO0ClDng5kn1qYay6R5mMhlAPCZeOF0JYUCS9zaZ60WX1eq+VEO6TqzX4C2 cTBbw77AJSjkItButO29WlpHoa4KMtnHK2utJ0kwR8x/x93+1nF8FCuIvply61QarjLt UNZDOL7t/BX1EP3ngydD/2sHANLvsHukhfnUdziHJ3unfHTSpijmj8H9Jh6qnpv2VlPx rQE2NGTR/EAa9z7lxbys6jx+Nhf3GAdNA/cdhH1NGR9mRP8e+n6EELLJsRAZ5PCLYpAp Sdqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si7607951pfl.131.2017.05.19.01.16.55; Fri, 19 May 2017 01:16:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697AbdESIQh (ORCPT + 25 others); Fri, 19 May 2017 04:16:37 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:50183 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750761AbdESIQ3 (ORCPT ); Fri, 19 May 2017 04:16:29 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4J8FtYV024225; Fri, 19 May 2017 03:15:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495181755; bh=5VKcseTBHaOSYn0mlFLPxEVWYxoq8LhuWX6endVOqxA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=btKAdhE+DEmr6R/k44JnZlxB/RDJ3VBVld30SuBYnCXwGlEe4h8GdGiHbKIR5I4Lp s/JXn8f54UU2pL5jSuAuW9EPMIxA8FatQXus2Z9+ZGhVKn/05KDhBmfddMLBhGEvDj PLZNRASiss0chqPkIVzGbKx7K/M6FIKWfOXudISw= 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 v4J8FtAJ025611; Fri, 19 May 2017 03:15:55 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Fri, 19 May 2017 03:15:54 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4J8FfQ9009185; Fri, 19 May 2017 03:15:51 -0500 From: Kishon Vijay Abraham I To: Ulf Hansson , Rob Herring , Tony Lindgren CC: , , , , , , Jonathan Corbet , Mark Rutland , Russell King , , Subject: [PATCH 02/41] mmc: host: omap_hsmmc: Separate setting voltage capabilities from bus power Date: Fri, 19 May 2017 13:45:02 +0530 Message-ID: <20170519081541.26753-3-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170519081541.26753-1-kishon@ti.com> References: <20170519081541.26753-1-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a separate function to set the voltage capabilities of the host controller. Voltage capabilities should be set only once during controller initialization but bus power can be changed every time there is a voltage switch and whenever a different card is inserted. This allows omap_hsmmc_conf_bus_power to be invoked every time there is a voltage switch. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/mmc/host/omap_hsmmc.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) -- 2.11.0 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 2000aaa359c8..42954efe12f7 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1809,25 +1809,34 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host) return ret; } +static void omap_hsmmc_set_capabilities(struct omap_hsmmc_host *host) +{ + u32 val; + + val = OMAP_HSMMC_READ(host->base, CAPA); + + /* Only MMC1 supports 3.0V */ + if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) + val |= (VS30 | VS18); + else + val |= VS18; + + OMAP_HSMMC_WRITE(host->base, CAPA, val); +} + static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) { - u32 hctl, capa, value; + u32 hctl, value; /* Only MMC1 supports 3.0V */ - if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) { + if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) hctl = SDVS30; - capa = VS30 | VS18; - } else { + else hctl = SDVS18; - capa = VS18; - } value = OMAP_HSMMC_READ(host->base, HCTL) & ~SDVS_MASK; OMAP_HSMMC_WRITE(host->base, HCTL, value | hctl); - value = OMAP_HSMMC_READ(host->base, CAPA); - OMAP_HSMMC_WRITE(host->base, CAPA, value | capa); - /* Set SD bus power bit */ set_sd_bus_power(host); } @@ -2134,6 +2143,7 @@ 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); host->rx_chan = dma_request_chan(&pdev->dev, "rx");