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: 9980797 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 AB900602A0 for ; Mon, 2 Oct 2017 12:44:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D7C32847A for ; Mon, 2 Oct 2017 12:44:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91F9B28724; Mon, 2 Oct 2017 12:44:43 +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 4A0422847A for ; Mon, 2 Oct 2017 12:44:43 +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=d+Ih1vTg127dQ2tg44Aen94PFoZ15pIGXbBWpgtWGc0=; b=IBwRQnds2vWmcnqCUfmPKS0NIJ yULr1k8yQ4XFxGc8Q9pa5l6f+0dqXmTnI52eAVMQimgMJ3fYmWNnE6l8T1mZNZZzdahWbqHgqPQbr hRusx6ih+zJSZfTJI/+DTxknxfZVlKk3LNWP1NsiTHTh6vNn8zxzlr15hpNqArAOgFLeux5vO4Hw/ NNrpBJqMbeky9fh6hoZnptrhXuRFmjU34wAcFWBIXSA0UTlYUoLxPeP/Yo1A4DEEEaNgSH6kzHcjv PCJRf2ziRKDlIhreldIJxP6TzStpXu52ibq0tcXNlqzylu/1LXE4hTTmeIM1GN3gCWV/1LlmbgMGl 4Qtu0sXQ==; 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 1dz05K-0003hl-7O; Mon, 02 Oct 2017 12:44:34 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dyzpX-0000PO-FU for linux-arm-kernel@lists.infradead.org; Mon, 02 Oct 2017 12:28:25 +0000 Received: by mail-wm0-x22f.google.com with SMTP id q132so10242501wmd.2 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=OwZH2YLKwQMwHT9AmAZtOEyJ1AaU1JO3ANLn0Q8PLw86xizKB73SvwXSSA8bPtc1Gd MpI6rkiJSTy8TKK3YplkpKAZn4GGHibm274XOBb246KDUkNvZicPos+zzxAAmBL/qifX 1FW26i2TPY7FrdClaYoVA7kjRUlwROj5P+S+fpL4DewHiu39pAwmtq5Qy7zweL4/0Clo BMlAgta9gxs0zYIDWkOAi4/h71JZDzpoJNHgOJ5Jz57SAX/+ohc6nZFTjnIyoHTZSFbi Y3A7ASvfqhMWTFtYpKh4BNiMcMJuqesvgc8so565+GkWQtq5FCpg0/H5ALDO4BFC5+Ij zcYA== X-Gm-Message-State: AMCzsaX2QAuB+vcIyRIk87JUhLcsNU2V0tUPN/qTrppn2W6DlQqOyX8n fY6UblDx8JNg5LwY1aAtEIZZMA== 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_908290_64441EC4 X-CRM114-Status: GOOD ( 13.72 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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;