From patchwork Fri Dec 2 02:21:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 86187 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp53460qgi; Thu, 1 Dec 2016 18:22:35 -0800 (PST) X-Received: by 10.99.242.5 with SMTP id v5mr73505637pgh.181.1480645355928; Thu, 01 Dec 2016 18:22:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si2702641plz.298.2016.12.01.18.22.35; Thu, 01 Dec 2016 18:22:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752102AbcLBCWd (ORCPT + 5 others); Thu, 1 Dec 2016 21:22:33 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:39398 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbcLBCWd (ORCPT ); Thu, 1 Dec 2016 21:22:33 -0500 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id uB22LsSA025383; Fri, 2 Dec 2016 11:21:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com uB22LsSA025383 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1480645316; bh=btXEaatYcS7s7FDSZGKXYLwZMBfmN8zn0NRdC12FHyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Da2yTvlo8YDbN11K0+WJXXXfdCdxWwAufYRTA0tScutaIX0S+UwW29veeqJDWY9GP NUrjL2xVQQ96yG1TekSBU/La1MODdGqOK3PzZJ7REYY9K/C+CUuo9mMDKJtXlptAmj PIWxgAnv7uc67kF2L5cHdBaWNBBiLAGArQKbpG2f/afo4gTWyL9NrNkvPlIEt2bZRp yDfEKy6l6VgumYSGXeA/z6dsZSinBPI94o0S7k3LNw8iv79oqAI61sgAw612LutHr+ aAP+3BPHmZfozVDq7HKbbn6VQF9WLrhwWnFivYjkEwHRIe60ygeezYH71c4Z/XWZ+C YtkuTK77F8S/g== 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 v3 1/2] mmc: sdhci: continue normal tuning if unsupported by platform tuning Date: Fri, 2 Dec 2016 11:21:50 +0900 Message-Id: <1480645311-13004-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480645311-13004-1-git-send-email-yamada.masahiro@socionext.com> References: <1480645311-13004-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 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 v3: None Changes in v2: None drivers/mmc/host/sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);