From patchwork Mon Oct 2 12:27:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9980775 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 2DB3C60365 for ; Mon, 2 Oct 2017 12:28:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20A7428782 for ; Mon, 2 Oct 2017 12:28:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 156CB28892; Mon, 2 Oct 2017 12:28:27 +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 92F5B28782 for ; Mon, 2 Oct 2017 12:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751308AbdJBM15 (ORCPT ); Mon, 2 Oct 2017 08:27:57 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:55007 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbdJBM1z (ORCPT ); Mon, 2 Oct 2017 08:27:55 -0400 Received: by mail-wm0-f48.google.com with SMTP id i124so10216920wmf.3 for ; Mon, 02 Oct 2017 05:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7CkBvwonkVOhON/4HrCHr7vpIOloln4LXHTZU1V9M+I=; b=Ly/LP6OugtKsBEJqUB6thk54nVs7+uJesym12TluNXyAGxG2u3wTegAe2xWkj90f4t fLpOlBEbPM4xCHRUZEEYdvchtUYcu3d7+kTRTcf4UX0YZ8YDyrfJLmfS+VSaR9ljdHCU HBoheX7V6XQ8xC/KpTJrnPyGPexq8zvqkTMNl74Hj2d2zHeL+r+J8/BFywIeCK2XpBL/ k3Vxb/VwSrfuowhNfgSGCD3pNghawM5pHqOXKzpHv89ZFInsaHoRQQfCVOP7Hoyq4ap0 25YLn/bDPwM7sCQLMOyxOxEIvR3iC7MNIoKrCO5tK/ZMxkMCpqgzXQNqc9/tvubwiUhD NnAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7CkBvwonkVOhON/4HrCHr7vpIOloln4LXHTZU1V9M+I=; b=H2HNwzL3wX3eYadgawT+079loQuWxv0/7jAA0T58xBto4kaNAnL0vvEnWd5Z1Qm/xL ee/O4Mb4GgUa+rHAo9kirUhnfmh6NH+9RUfEgUpdnRWy+16S/4OrbXN78teYIlWsDcKj qLvSTV4XkQ6iet27CHI0sP7ljkMogHm1mzJGewUqmq2alTH/N49t4XkvzmzaGy/64FCL 453vFltK7fecTN2QQivcjHer1XdgJmhOAjXTwcWnyLU8fsxQakWap74eS+/VRgp/LL14 V3YbRGnIDlFZt/rAAWo38pBuzRrjY4R4epMxMQ6XPvQgs3cni1mn4hW8iYZVLs6TQNPI YlEQ== X-Gm-Message-State: AMCzsaW6eG3a+e/3YSuWrSExoS1apX1O6eCK/bhxLVIL3iXqVXMokLuT 3OodsUEuuhLNpHTfS3sx9koRaA== X-Google-Smtp-Source: AOwi7QAboVDXjWTEXcHQidweGkI7m75yu2L9f9aP91cUzd8Ic8tLeZIZ/e2noMkjA5azS6VDaZtXYQ== X-Received: by 10.28.196.79 with SMTP id u76mr7369024wmf.95.1506947273636; Mon, 02 Oct 2017 05:27:53 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id u96sm14354287wrc.68.2017.10.02.05.27.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Oct 2017 05:27:52 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Carlo Caione , Kevin Hilman Cc: Jerome Brunet , Heiner Kallweit , linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] mmc: meson-gx: include tx phase in the tuning process Date: Mon, 2 Oct 2017 14:27:43 +0200 Message-Id: <20171002122743.32334-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20171002122743.32334-1-jbrunet@baylibre.com> References: <20171002122743.32334-1-jbrunet@baylibre.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 It has been reported that some platforms (odroid-c2) may require a different tx phase setting to operate at high speed (hs200 and hs400) To improve the situation, this patch includes tx phase in the tuning process. Fixes: d341ca88eead ("mmc: meson-gx: rework tuning function") Reported-by: Heiner Kallweit Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 08a55c2e96e1..85745ef179e2 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -716,6 +716,22 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode, static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct meson_host *host = mmc_priv(mmc); + int ret; + + /* + * If this is the initial tuning, try to get a sane Rx starting + * phase before doing the actual tuning. + */ + if (!mmc->doing_retune) { + ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); + + if (ret) + return ret; + } + + ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->tx_clk); + if (ret) + return ret; return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); } @@ -746,8 +762,9 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (!IS_ERR(mmc->supply.vmmc)) mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); - /* Reset rx phase */ + /* Reset phases */ clk_set_phase(host->rx_clk, 0); + clk_set_phase(host->tx_clk, 270); break;