From patchwork Fri May 1 01:46:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 6307791 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 206319F326 for ; Fri, 1 May 2015 01:47:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44FBA201BC for ; Fri, 1 May 2015 01:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FBD220165 for ; Fri, 1 May 2015 01:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752958AbbEABrU (ORCPT ); Thu, 30 Apr 2015 21:47:20 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:35265 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbbEABrT (ORCPT ); Thu, 30 Apr 2015 21:47:19 -0400 Received: by pdbqd1 with SMTP id qd1so78298906pdb.2 for ; Thu, 30 Apr 2015 18:47:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=J3ECL7u/0bbzG8rd9p5MTRPMp7ejIVqVjZHsH5H2WLU=; b=N67SCd1V+WzHL7EGzNgbKca5JNKTCzPmDaZFfg0ds5UD2hrZTNxZiWBvwve7akZT26 sJPLJOCIGi8xQpJKSAy/jafKrvG9NvkhlcXM7ez1aeLyxe7i8ad6RhI55vBM/BPt2zdz dwKVCt2L0eCyBQFvuZIb47KieEglvBmQ5MC12dC51/rcSh6pj2gPHDgtIC292GqzsVNJ 9Xn3NDd/BX6LEYan9XJmbw6u/leNudHxcbrHrebdAnfr5qxVJHMxXgbq2s6ahdKxD4Yl SgcC7fqCJ0++IQtuBzoDroLpPREg9/ZmqggEvo0ryiyupvlDFqkmrIPCz2Dim+wnO72P T40A== X-Gm-Message-State: ALoCoQkOE1h092ve7KrCyBn0ElTcUl6zGSRviFpShbRPWi2hqdrgUULjPSdtFZubhGemXY0BgCdt X-Received: by 10.70.96.162 with SMTP id dt2mr13302571pdb.20.1430444839160; Thu, 30 Apr 2015 18:47:19 -0700 (PDT) Received: from localhost.localdomain ([180.150.153.56]) by mx.google.com with ESMTPSA id ef3sm3354503pbc.26.2015.04.30.18.47.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 18:47:18 -0700 (PDT) From: Zhangfei Gao To: Jaehoon Chung , Ulf Hansson Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Zhangfei Gao , "Jorge A. Ramirez-Ortiz" , Dan Yuan Subject: [PATCH 2/3] mmc: dw_mmc: add switch_voltage Date: Fri, 1 May 2015 09:46:57 +0800 Message-Id: <1430444818-7740-3-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430444818-7740-1-git-send-email-zhangfei.gao@linaro.org> References: <1430444818-7740-1-git-send-email-zhangfei.gao@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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 | 6 ++++++ drivers/mmc/host/dw_mmc.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 69952b2..488a8af 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1236,11 +1236,17 @@ 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) { + ret = drv_data->switch_voltage(mmc, ios); + return ret; + } + /* * 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_ */