From patchwork Mon Sep 18 13:44:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 112921 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3683462qgf; Mon, 18 Sep 2017 06:44:38 -0700 (PDT) X-Received: by 10.99.119.11 with SMTP id s11mr1148864pgc.398.1505742278492; Mon, 18 Sep 2017 06:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505742278; cv=none; d=google.com; s=arc-20160816; b=1FiGVUm4f/wp6iMm03VDF0Y6qMLHIQI+Dj7vmZBBHNPsgKxATyMAgFKp8BrH4Xbr/T DepawbRIeBZKySHusGldl1sM1BGgIQlsG0RTnKZNPwV7fDCwrP0XsFno3zdm5c3M9Oft Q0WgfRWAd/wYj1U2iwlPv3TXFCoa5Uu3cgXqERNXo+dU0qAhIzVv7rabUw7heGQD2uwX ZV9DaMTgYkyCdDCSi2LSRgW6MHWGQ8J6s+3P/ap418W9tYG21KdbDGe8s/n75eSYiAcW 5AgYMJXyGkLqnp8kLoKB2X1Ie9UHh1G8JMDByjrMLZPJp0CfEdMM0hWrMqDenqNsjhJR s2tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6fsKUpL2LP3KkFwmtSi5oXOtyXP5jI6tzBCYybBh/uw=; b=AlRT2v4ywuYsR2HAJtV/OUrXcfhY3MtU3eAXsJzyQWLpvd8OubGWxOsG4yLItwE++W DV15qLBfC2s+cANZUAAANNfKb5LXCxNznj/Us7k4N2ZUqkt1xZBaaf3rocgmy9bx25ON 6k3QajbKPoUKZSIz/82llq2UYc9C1B6k9cYQiIUElLJmJrcZv81wBMie5hTPXP3r0WpN x6SU9dTr0oVoDPlsmolCyk7haLrLPuRRzupz2M3FhJwx3HyqlqmbnWfrScRVVCgFbTAB Pe7U9a97ETO8O0m1ZaxS3wTBHW2BX9jDYTXUBCe6ElLaC2H+pGA6GJPpkr86YsoTatFC hOjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Kmyg7aPQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h89si4961692pld.242.2017.09.18.06.44.38; Mon, 18 Sep 2017 06:44:38 -0700 (PDT) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Kmyg7aPQ; 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 S932673AbdIRNoh (ORCPT + 6 others); Mon, 18 Sep 2017 09:44:37 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:47866 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932670AbdIRNog (ORCPT ); Mon, 18 Sep 2017 09:44:36 -0400 Received: by mail-wm0-f48.google.com with SMTP id 13so2838206wmq.2 for ; Mon, 18 Sep 2017 06:44:36 -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=dIhUOXQVIvv2jywtXs3Aviji7AQdcJ/cGsued9EWxLM=; b=Kmyg7aPQyg/5DaZ4CgrewGnAruk+P0M4l9ZOxjYPLr1Q+zyDrQLnhXUU/jX68MdKtl ZMQZdCu8ggxVLR/IWuzhXIGvnlgyUysKtG3zSQBqwT7iLeEq3W7ko0MOThjUB4ScOn0W HiIEiEkxQml7ipghVEr9AV81yYNjZrWeQIdEb3hlhgc0WuQD4rW0yBRolVfhaTAoIDus Ge/2YVRmO2PToClp7isPalkeZD+Sr2V3Q50F1PrDiaheuGS3clI96V7WVGxKj6jG14qT cuLRDHsf+5r+AVI4EXNCjK2/EN7oqjCTqwshvho4rkFwEdat8i1yoiz4c2me6c8LrB/b 147g== 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=dIhUOXQVIvv2jywtXs3Aviji7AQdcJ/cGsued9EWxLM=; b=PgkZOWh0EqEylToRD7kpi/V/PexohXKrb1KV6UOJ34WoVo+hNlQssl/J/CGerJq9Kl cZiC+cwq+jfL9/TgoLIAx4/UFOu5L5ELcPjGCe56vUT56UJddyBERiBf5pDlfT4r7ImM giBI6897U7VUSHBCxEk5ymRQMn7m77ZfdIXRsiUkW41Y5ARC5Ux+qDNtUdJbkpRv2pyn cNGJpdeluYpOy+36bQ0xagUl+G22ClJrYXPvB9gAuigGL+W4iMUHZ7moAIeR3ofyA3yP ftmiNOVNe9jhnt7gQwmwkO78lSvGs0yU4bL2PFBSmJI/p6KP6s+fvhQtHi/slOvlYEri 7TLg== X-Gm-Message-State: AHPjjUjq9sQBEBacAN6tgksdX08XI2xN/OLCtAGIDl9K/3ZMiQPVXt3z IWQ5kVOPITO94t66UDSHIspYsA== X-Google-Smtp-Source: AOwi7QDcN1SsV9ssZq4eTgftYTP4r/yN2MOYAb9orygaeteQEUH3FgCZqk/TceHvAKMfydNwwdmE2A== X-Received: by 10.28.22.9 with SMTP id 9mr8179539wmw.38.1505742275352; Mon, 18 Sep 2017 06:44:35 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id h201sm7452800wmd.27.2017.09.18.06.44.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2017 06:44:34 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Kevin Hilman , Heiner Kallweit Cc: Jerome Brunet , Carlo Caione , linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH/RFT] mmc: meson-gx: include tx phase in the tuning process Date: Mon, 18 Sep 2017 15:44:31 +0200 Message-Id: <20170918134431.17520-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org It has been reported that some platforms (odroid-c2) may require a different tx phase setting to operate at high speed. To improve the situation, this patch includes tx phase in the tuning process. Reported-by: Heiner Kallweit Signed-off-by: Jerome Brunet --- Hi Heiner, Would you mind trying this change with your setup and letting us know if it helps ? It seems like a good idea to add an initial Rx tuning before doing the actual tuning but, honestly, I don't know if it is really necessary. Regards Jerome drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.13.5 -- 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/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index c885c2d4b904..0254d8bfd536 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -717,6 +717,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); }