From patchwork Thu May 7 07:56:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 6354471 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 213379F1C2 for ; Thu, 7 May 2015 07:57:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 426E3203B1 for ; Thu, 7 May 2015 07:57:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D90520386 for ; Thu, 7 May 2015 07:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751709AbbEGH5A (ORCPT ); Thu, 7 May 2015 03:57:00 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:35479 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036AbbEGH47 (ORCPT ); Thu, 7 May 2015 03:56:59 -0400 Received: by pdbqd1 with SMTP id qd1so34333830pdb.2 for ; Thu, 07 May 2015 00:56:59 -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=0Z/x8Rzui7ow27r6kP6Tck30cCLXw2KTKsnOfN9xpKE=; b=CZ5cSY7HmAPuqpmukqiFi5CtdF6wR/qs6VeCZcbeKNRbtHdQBNZ45LBgLLrA1VBjPm NRLwedIuW35BK/CFMNkWN/8bJUWSApGgnXK5YwAD3nxFOxsy9IMBPBx5EbMrOjbZ+KmY sE62WFqmijOHe9FMX/7qYBqcjEcOTBhUuReiIc1QFULtw8+RVxDBdOfTjbFWnokMF5u/ GfJfCJWv1DBAXfYQrCiK9D5Xbz5DhZaZFxjvOhSC6TBoDs4F+jn3FjBzBUcga6doO+I5 wy+Eaggx9sZHwBSldzu/970J1IpeQIhvDKRCJ0ouzuqbrzrz0p0my+D2DhuOY5vXZV1L tXcQ== X-Gm-Message-State: ALoCoQm+8ikb5pr22JaetXNpzNKj9LMHy269sVFfgT+E2LG1h3YvsjotL/5FyOF1gJwW+viBsGy6 X-Received: by 10.70.134.133 with SMTP id pk5mr4640505pdb.133.1430985419324; Thu, 07 May 2015 00:56:59 -0700 (PDT) Received: from localhost.localdomain ([104.207.83.5]) by mx.google.com with ESMTPSA id l5sm1249389pbq.15.2015.05.07.00.56.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 May 2015 00:56:58 -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 v2 2/3] mmc: dw_mmc: add switch_voltage Date: Thu, 7 May 2015 15:56:40 +0800 Message-Id: <1430985401-12202-3-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430985401-12202-1-git-send-email-zhangfei.gao@linaro.org> References: <1430985401-12202-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 | 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_ */