From patchwork Sun Nov 10 15:40:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1192631 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KQt2zd+u"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 479yvd3qZfz9sPJ for ; Mon, 11 Nov 2019 02:43:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 38F55C21E47; Sun, 10 Nov 2019 15:41:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 30020C21E16; Sun, 10 Nov 2019 15:40:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7DBB2C21DD7; Sun, 10 Nov 2019 15:40:40 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by lists.denx.de (Postfix) with ESMTPS id 5FF27C21C8B for ; Sun, 10 Nov 2019 15:40:37 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id t26so10797974wmi.4 for ; Sun, 10 Nov 2019 07:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eFzw7Fk/OWSxiqCaG+RNOkMsPHBeUjRrg2U4C3H41dY=; b=KQt2zd+ub/aweU9HZFvaw6BH2DfF3JjBXy9zc59hQy7SJEsIyYa7UqEORt7oyu/i1A 4Nvnx7zGbbXsh51poshu7eFffbIrA/ytyb/L8V5V9TvA4SHBSwvjrERLsGTRYqNeXZHv yQKq6Bqt0gO2ZJU+OSj1jcr+tJYp2A8/dlIdAP1j0ltyUy30Z5SSlwyLOmtZ+N2Bj9g2 +JID9mJTmWn1PA9Uo2pIfKvC7skY2YCdxGBbasMdZN79ADonGTdwKNi5wefQDeCQNiOR j0Z6MxfJbNOa2Zk1o1HqG99GRnw9qFbrC/RV7vUBlmbm1nxbBfcfQ9l6lK+NDRC5kMor MSlQ== 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:mime-version:content-transfer-encoding; bh=eFzw7Fk/OWSxiqCaG+RNOkMsPHBeUjRrg2U4C3H41dY=; b=BLo6Uk/2F+qf7+WwvzsolD5kEueyFqSQgVTDprv9j63xJycI+rdiWnW1boYOVSRQrq MRdlMbmsw1QZVsFdLPZULwqsUW8peGyy2J1cY5r/clF85+E7cwj6IKdHB74mEj42y5Sb BgxNEipHOTr2IF7tJ60ISjecTsStehYEA/pBjMQve0t48yl2zwlLzRfKQP5toS6qxio3 g5DnlyI2orm4nyq29TQGh2cJNEA00fSZVLRPOvPnwpSeJflSh1vZauNwwzEwgobY8UXP Q+WTFTFXZknA7vCNM4mOxAozZuXOrqo35X/o34Seu1mgBQPUxGvm39Y50z67pDPfKUI7 JTXw== X-Gm-Message-State: APjAAAXsaUHsFYOC7GJn19Ey+mZJ4FS434nvLJ4QgigMskIvQKNzlNbC MoSGyZ+cc4OUNAJPT3PaAfXrX+Nnwj0= X-Google-Smtp-Source: APXvYqy9CNQL0yP00K+g9gBnu0KMQjsnNkNqeM0akV9BCllBUyBAbzZJxO7B7V5rwKeJWMGULNfnPA== X-Received: by 2002:a1c:a4c5:: with SMTP id n188mr16445332wme.30.1573400436591; Sun, 10 Nov 2019 07:40:36 -0800 (PST) Received: from chi.lan (p578adb1c.dip0.t-ipconnect.de. [87.138.219.28]) by smtp.gmail.com with ESMTPSA id v10sm24948918wmg.48.2019.11.10.07.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2019 07:40:35 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Date: Sun, 10 Nov 2019 16:40:05 +0100 Message-Id: <20191110154012.24603-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191110154012.24603-1-marek.vasut+renesas@gmail.com> References: <20191110154012.24603-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 Cc: Marek Vasut Subject: [U-Boot] [PATCH 2/9] mmc: tmio: sdhi: Track SMPCMP valu in private data X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Retain the SMPCMP value from last calibration in private data. This will be later used for skipping bad taps. Signed-off-by: Marek Vasut Cc: Masahiro Yamada --- drivers/mmc/renesas-sdhi.c | 18 ++++++++++-------- drivers/mmc/tmio-common.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index acc44e5b90..2f34173d03 100644 --- a/drivers/mmc/renesas-sdhi.c +++ b/drivers/mmc/renesas-sdhi.c @@ -289,7 +289,7 @@ static unsigned int renesas_sdhi_compare_scc_data(struct tmio_sd_priv *priv) } static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv, - unsigned int taps, unsigned int smpcmp) + unsigned int taps) { unsigned long tap_cnt; /* counter of tuning success */ unsigned long tap_start;/* start position of tuning success */ @@ -311,9 +311,9 @@ static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv, taps &= ~BIT(i % priv->tap_num); taps &= ~BIT((i % priv->tap_num) + priv->tap_num); } - if (!(smpcmp & BIT(i))) { - smpcmp &= ~BIT(i % priv->tap_num); - smpcmp &= ~BIT((i % priv->tap_num) + priv->tap_num); + if (!(priv->smpcmp & BIT(i))) { + priv->smpcmp &= ~BIT(i % priv->tap_num); + priv->smpcmp &= ~BIT((i % priv->tap_num) + priv->tap_num); } } @@ -355,7 +355,7 @@ static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv, tap_start = 0; tap_end = 0; for (i = 0; i < priv->tap_num * 2; i++) { - if (smpcmp & BIT(i)) + if (priv->smpcmp & BIT(i)) ntap++; else { if (ntap > match_cnt) { @@ -398,7 +398,7 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode) struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct mmc *mmc = upriv->mmc; unsigned int tap_num; - unsigned int taps = 0, smpcmp = 0; + unsigned int taps = 0; int i, ret = 0; u32 caps; @@ -426,6 +426,8 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode) goto out; } + priv->smpcmp = 0; + /* Issue CMD19 twice for each tap */ for (i = 0; i < 2 * priv->tap_num; i++) { renesas_sdhi_prepare_tuning(priv, i % priv->tap_num); @@ -443,12 +445,12 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode) ret = renesas_sdhi_compare_scc_data(priv); if (ret == 0) - smpcmp |= BIT(i); + priv->smpcmp |= BIT(i); mdelay(1); } - ret = renesas_sdhi_select_tuning(priv, taps, smpcmp); + ret = renesas_sdhi_select_tuning(priv, taps); out: if (ret < 0) { diff --git a/drivers/mmc/tmio-common.h b/drivers/mmc/tmio-common.h index da89cc90c2..79f51d21af 100644 --- a/drivers/mmc/tmio-common.h +++ b/drivers/mmc/tmio-common.h @@ -137,6 +137,7 @@ struct tmio_sd_priv { struct clk clk; #endif #if CONFIG_IS_ENABLED(RENESAS_SDHI) + unsigned int smpcmp; u8 tap_set; u8 tap_num; u8 nrtaps;