From patchwork Thu May 14 08:45:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 48476 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 83C822121F for ; Thu, 14 May 2015 08:45:56 +0000 (UTC) Received: by wiz9 with SMTP id 9sf19595575wiz.3 for ; Thu, 14 May 2015 01:45:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=IdCW7yYUuSnMjftmxz2Y0kLPqWcuZmTmElP1vxFCRqc=; b=We+map6iZpfQbzAnTNaNwa660JHEkMXBr1iYys8148dSTammzK2bK7042pLWiOw7Av /UQJAGdOoE8J5xx/9y+p43saC2U0gWeIfBw7Oc7+vIo3NOFb6oYEOz++QK+MDRVvjN2n 4eGmz7ZVVk+Iqopn9KBIhvl0KbL2oOgaHRNNiFCd5rmOGGj0O5nqXRXvPiTKS6p/migy ZhaaBfPajWL/mwSMbnJ0goxPpAe+biUslYhf3jiMbdkN5H86+HMDq0Jzp1M+W7tN5lEQ JywmYS66GLR01FNDU/R9ANR9dlzdlfCbHw7y93sQ8fKr9u8NIE03EoYNso7mGC4dwXZo jcTw== X-Gm-Message-State: ALoCoQmHdvBDLb1IZaNrCWjVToiIF7mEHoC0Zx1NhmPyepJzYrQo1YFLWA5Qud3aTCGzrlYOor/c X-Received: by 10.194.189.110 with SMTP id gh14mr2319264wjc.3.1431593155843; Thu, 14 May 2015 01:45:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.194 with SMTP id v2ls428043lag.59.gmail; Thu, 14 May 2015 01:45:55 -0700 (PDT) X-Received: by 10.152.179.195 with SMTP id di3mr2314870lac.15.1431593155673; Thu, 14 May 2015 01:45:55 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id r5si13865857lar.102.2015.05.14.01.45.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2015 01:45:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laat2 with SMTP id t2so57739062laa.1 for ; Thu, 14 May 2015 01:45:55 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr2318968lbc.88.1431593155580; Thu, 14 May 2015 01:45:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1089837lbb; Thu, 14 May 2015 01:45:54 -0700 (PDT) X-Received: by 10.70.62.97 with SMTP id x1mr5919352pdr.41.1431593153786; Thu, 14 May 2015 01:45:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pn6si31328834pdb.15.2015.05.14.01.45.52; Thu, 14 May 2015 01:45:53 -0700 (PDT) Received-SPF: none (google.com: linux-mmc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932456AbbENIpv (ORCPT + 3 others); Thu, 14 May 2015 04:45:51 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35399 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753071AbbENIpu (ORCPT ); Thu, 14 May 2015 04:45:50 -0400 Received: by pabtp1 with SMTP id tp1so78445030pab.2 for ; Thu, 14 May 2015 01:45:50 -0700 (PDT) X-Received: by 10.69.10.196 with SMTP id ec4mr6012479pbd.69.1431593150077; Thu, 14 May 2015 01:45:50 -0700 (PDT) Received: from localhost.localdomain ([180.150.148.224]) by mx.google.com with ESMTPSA id dk5sm21625161pdb.88.2015.05.14.01.45.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 May 2015 01:45:48 -0700 (PDT) From: Zhangfei Gao To: Jaehoon Chung , ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Zhangfei Gao , "Jorge A. Ramirez-Ortiz" , Dan Yuan Subject: [PATCH v3 2/3] mmc: dw_mmc: add switch_voltage Date: Thu, 14 May 2015 16:45:18 +0800 Message-Id: <1431593119-31889-3-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431593119-31889-1-git-send-email-zhangfei.gao@linaro.org> References: <1431593119-31889-1-git-send-email-zhangfei.gao@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhangfei.gao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , switch_voltage is required on some platform since special register accessing Signed-off-by: Jorge A. Ramirez-Ortiz Signed-off-by: Dan Yuan Signed-off-by: Zhangfei Gao --- drivers/mmc/host/dw_mmc.c | 4 ++++ drivers/mmc/host/dw_mmc.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 5f5adaf..ce66565 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1236,11 +1236,15 @@ static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); struct dw_mci *host = slot->host; + const struct dw_mci_drv_data *drv_data = host->drv_data; u32 uhs; u32 v18 = SDMMC_UHS_18V << slot->id; int min_uv, max_uv; int ret; + if (drv_data && drv_data->switch_voltage) + return drv_data->switch_voltage(mmc, ios); + /* * Program the voltage. Note that some instances of dw_mmc may use * the UHS_REG for this. For other instances (like exynos) the UHS_REG diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index f45ab91..c723617 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -287,5 +287,7 @@ struct dw_mci_drv_data { int (*execute_tuning)(struct dw_mci_slot *slot); int (*prepare_hs400_tuning)(struct dw_mci *host, struct mmc_ios *ios); + int (*switch_voltage)(struct mmc_host *mmc, + struct mmc_ios *ios); }; #endif /* _DW_MMC_H_ */