From patchwork Mon Dec 5 02:10:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9460217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65F4C60231 for ; Mon, 5 Dec 2016 02:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5835826247 for ; Mon, 5 Dec 2016 02:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D38126253; Mon, 5 Dec 2016 02:11:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5344126247 for ; Mon, 5 Dec 2016 02:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751195AbcLECLm (ORCPT ); Sun, 4 Dec 2016 21:11:42 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:30796 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbcLECLm (ORCPT ); Sun, 4 Dec 2016 21:11:42 -0500 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id uB52B48s021359; Mon, 5 Dec 2016 11:11:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com uB52B48s021359 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1480903866; bh=It+tbm3lwg///6B6crBLQo5ql0FojceCavPa07aePVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QqKPB46q/Wc41qmP8sIycNxMIfYV8bU+PWGO1aWOBA/qAb2yX8TDjA+pJ3rHxgvaZ O/ZPJtmbPrqXfDsAc9kn46cRGTdaFyHkz+B5GGfUeYr9DeraBg5J4f3uKm2k51wYKC 7OUNmk1CQoUrpzhxnOX1MWfNB9iXnaE+ZR14Cnm2vp9NidoVt/GpESE+XSNqWnre1Q NcDuw0Hrvdl2l4h5kKQBGYJW5yaRp+uKAoPwu8/7bOwSJY1vG36F/zOymeom3j8/AN SaEegFEFMgXt3XqB9M520J7hlruCDy4y8r8HMqlQEKFN8iBE3/BGWwuat6BbHztogx dvvW2oUrtqa8Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Adrian Hunter , Ulf Hansson , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2] mmc: sdhci: export sdhci_execute_tuning() Date: Mon, 5 Dec 2016 11:10:53 +0900 Message-Id: <1480903854-22701-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480903854-22701-1-git-send-email-yamada.masahiro@socionext.com> References: <1480903854-22701-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some SDHCI-compat controllers support not only SD, but also eMMC, but they use different commands for tuning: CMD19 for SD, CMD21 for eMMC. Due to the difference of the underlying mechanism, some controllers (at least, the Cadence IP is the case) provide their own registers for the eMMC tuning. This commit will be useful when we want to override .execute_tuning callback (for eMMC HS200 tuning), but still let it fall back to sdhci_execute_tuning() for SD timing. Signed-off-by: Masahiro Yamada Acked-by: Adrian Hunter --- I want to use this in the next commit. The Cadence IP supports eMMC as well as SD. I want to re-use the sdhci_execute_tuning() for SD timing. On the other hand, Cadence provides its own way for eMMC HS200 tuning; I need to touch some registers that are specific to Cadence's design. Changes in v4: - export sdhci_execute_tuning() instead of using execute_execute_tuning() Changes in v3: None Changes in v2: None drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 42ef3eb..0c03a89 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1948,7 +1948,7 @@ static int sdhci_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_ios *ios) return 0; } -static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) +int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host = mmc_priv(mmc); u16 ctrl; @@ -2141,6 +2141,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) spin_unlock_irqrestore(&host->lock, flags); return err; } +EXPORT_SYMBOL_GPL(sdhci_execute_tuning); static int sdhci_select_drive_strength(struct mmc_card *card, unsigned int max_dtr, int host_drv, diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 9c35776..786eee9 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -689,6 +689,7 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, void sdhci_set_bus_width(struct sdhci_host *host, int width); void sdhci_reset(struct sdhci_host *host, u8 mask); void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); +int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); #ifdef CONFIG_PM extern int sdhci_suspend_host(struct sdhci_host *host);