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: 9980783 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 1CAF160365 for ; Mon, 2 Oct 2017 12:29:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E09E1FFAD for ; Mon, 2 Oct 2017 12:29:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02C451FFDB; Mon, 2 Oct 2017 12:29:02 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B06271FF14 for ; Mon, 2 Oct 2017 12:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1VEUKPQ9czoaKRCI4N8rUAQq4seM84ow5MYyUcsWsK8=; b=SZ14VFxXPyMf47C60+oRBOGwdh sVSF04zvY2d5l6lwqJYlsohlLjcXIQkWs2TNkaBB1XE2A7OYcxJWvHlbeuK9dFbj/Xg3y2hdG+NbH pci5WamWycG6b7hdbbG00YaBnsJnSQDnjN/vFKc9ABtfAFJqIr6r+gx1YPD0PvYALAxRei0WLEilK FX58i9GUJV1+34d9MgvSlkO23JdkTo4lZd66KJfYq0s8K/stWQnZppQhTdoi7xBOMWrL3KUTj/PFa gZPCbBaO6kU86BUYqgnVHwhjj7dW4nWGiHC0QNDxHzv8Bxk9P94yctDwUZmdwJoPfj+j0XqkIQhL6 pU7ti66g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dyzqB-000176-3x; Mon, 02 Oct 2017 12:28:55 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dyzpX-0000PP-FD for linux-amlogic@lists.infradead.org; Mon, 02 Oct 2017 12:28:18 +0000 Received: by mail-wm0-x229.google.com with SMTP id k4so8107711wmc.1 for ; Mon, 02 Oct 2017 05:27:55 -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=h3m4rOQoKcrgFglBJegV2M//MG5dkfN/3GmuldY1Qc/V/HGH84QBsejWRVxozjWt2K rSKtcC7wJ0Mhff2i0XmaqczcWbHiBmeIOLemJLZWuz72/EBFSRXUNS1sZwuXtoJea4Q4 FLa+9CpEUpTIhOhvA75wFzFGHJGjW29bEBA0ddfN7iaV03NjUNIHKpxOePPwvsaN6VFN X2Lc74wwx/RFL3oe0HXknvDYE4kGF8yTNgQ5iCu17jlF96ko3OufPKdrx+/LQIVeR/N/ 48Ve/ZGm+blXHdLGd+YI9OikcW/sjB5dYqEI8XdEZKMI4BXG6v6baRv9noA+Nn+Tkt0M ACww== X-Gm-Message-State: AMCzsaVqm/Sji5qWJaUNCKObUYm4rFkxkATrgrJgQtISLjaoOkbLN7oo zkQGAKZ87rTeYn2jO0oPiANDbA== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171002_052815_878371_308B9E5D X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, Jerome Brunet , linux-arm-kernel@lists.infradead.org, Heiner Kallweit MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.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;