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: 47882 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 700A72121F for ; Fri, 1 May 2015 01:47:25 +0000 (UTC) Received: by lbos2 with SMTP id s2sf20691292lbo.2 for ; Thu, 30 Apr 2015 18:47:24 -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=i2FgiH0yr+Ngh2GuwqnRpP8sr68R3fKjihgcfxkLmhU=; b=JwNbjDl3Jtk9McCpZ9BMlO+Dzqh8D37pBwApYJfPUlXpAeL78F7fg3YTqSSgioQ4eD lQpX2RUk01MQ4JYB2nMpE8o70fHPKOYr10AqNLKBFga/K4+kYDeqmtrWb9B/jeYkZdny Vyw3yeQwTtaSsgDCh8a32D1n9s2DqWvu+jkrr9Y8PD9VzYmuyNbE/aO+QdexVuoTP3Tv eOFWBbxxeUG1tMlGAj8S2XeCNsALFoS/PLr/Z0ApqZ2CFNqVc9p96i/hv837pUT2w2+J Um9jhBe/d2Xy0aqDYqknR+sUsLwR0HIcUWQAwa1ylXMX9krbFbnl7AptZKBuFV95UsMg I6kA== X-Gm-Message-State: ALoCoQmhfLOt2hcfxoGDxbV79iVBAiykCof26di0F76TKpZ5sHeU2nJP47JSAns2hmFLcb2oYNP9 X-Received: by 10.112.118.162 with SMTP id kn2mr5265104lbb.22.1430444844399; Thu, 30 Apr 2015 18:47:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.135 with SMTP id e7ls502852lam.79.gmail; Thu, 30 Apr 2015 18:47:24 -0700 (PDT) X-Received: by 10.152.207.105 with SMTP id lv9mr6449109lac.10.1430444844255; Thu, 30 Apr 2015 18:47:24 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id dh4si2985195lac.35.2015.04.30.18.47.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 18:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbcga7 with SMTP id ga7so57539980lbc.1 for ; Thu, 30 Apr 2015 18:47:23 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr6445324lab.35.1430444843630; Thu, 30 Apr 2015 18:47:23 -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.67.65 with SMTP id l1csp33299lbt; Thu, 30 Apr 2015 18:47:22 -0700 (PDT) X-Received: by 10.66.235.36 with SMTP id uj4mr13368134pac.123.1430444841888; Thu, 30 Apr 2015 18:47:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si5848838pdi.227.2015.04.30.18.47.21; Thu, 30 Apr 2015 18:47:21 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S1753245AbbEABrU (ORCPT + 6 others); Thu, 30 Apr 2015 21:47:20 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:35265 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751206AbbEABrT (ORCPT ); Thu, 30 Apr 2015 21:47:19 -0400 Received: by pdbqd1 with SMTP id qd1so78298907pdb.2 for ; Thu, 30 Apr 2015 18:47:19 -0700 (PDT) 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: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.217.178 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 | 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_ */