From patchwork Thu Dec 1 03:36:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9455305 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 86E2D60515 for ; Thu, 1 Dec 2016 03:36:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7588828492 for ; Thu, 1 Dec 2016 03:36:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68BD6284AE; Thu, 1 Dec 2016 03:36:40 +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=ham 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 7CDD928492 for ; Thu, 1 Dec 2016 03:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591AbcLADgi (ORCPT ); Wed, 30 Nov 2016 22:36:38 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:46387 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753128AbcLADgh (ORCPT ); Wed, 30 Nov 2016 22:36:37 -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 uB13aAJD010579; Thu, 1 Dec 2016 12:36:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com uB13aAJD010579 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1480563372; bh=cLx/ORBefVokCZ8/mDoWOAH4KNjrIYWXPzDdT8CZ5h0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DP62+CBG5GVoHbXsKJ+SF6VMDVwqF7KXYr4QFN+E7GMcBnwq9/BGBxD1ReYnS1lRS ovW4MpvbTBPW9KjBhG6YVBfNvMxon3/dLM0XoXMagIJPmpdbqhzvbhKcYmHCM0+yOL jYoNZpCf6a1l+Jnfq04ltIqAUWJpp6Bl5rr8jyn1C1wTy4o0MBfYhHuAnrxK/L9hJ+ bzQKqbfLbjVHDeWJRjLHpLlzBNBBH6W0t27UVy0uBCJEh+T5IdWrSyQH2YFbUpr9aR ackFhMfJJeTiUxTXkoAhxLRlYo1nkxNMiAfEr8KdpAQgs+tNtrFVRi0bX4w8WXPBA/ D3tVTtHDph+9Q== 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 v2 1/2] mmc: sdhci: continue normal tuning if unsupported by platform tuning Date: Thu, 1 Dec 2016 12:36:05 +0900 Message-Id: <1480563366-7259-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480563366-7259-1-git-send-email-yamada.masahiro@socionext.com> References: <1480563366-7259-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 use platform-specific tuning (to support eMMC HS200), but still let it reuse the code provided by sdhci_execute_tuning() for SD timing. If sdhci_ops::platform_execute_tuning receives a timing it does not take care of, it can return -ENOTSUPP. Then, it will fall back to the SDHCI standard tuning. Signed-off-by: Masahiro Yamada --- I want to use this in the next commit. The Cadence IP supports eMMC as well as SD. The tuning for SD is pretty simple; just set the "Execute Tuning" bit of the HOST_CONTROL2 register. So, I can re-use the sdhci_execute_tuning(). 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 v2: None drivers/mmc/host/sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 42ef3eb..cdce489 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2004,7 +2004,9 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) if (host->ops->platform_execute_tuning) { spin_unlock_irqrestore(&host->lock, flags); err = host->ops->platform_execute_tuning(host, opcode); - return err; + if (err != -ENOTSUPP) + return err; + spin_lock_irqsave(&host->lock, flags); } ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);