From patchwork Wed Feb 23 14:13:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1596720 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=bmO0N88d; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K3dLm6HzXz9sGf for ; Thu, 24 Feb 2022 01:13:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 242F283B58; Wed, 23 Feb 2022 15:13:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="bmO0N88d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9284883B6D; Wed, 23 Feb 2022 15:13:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EA62283A9D for ; Wed, 23 Feb 2022 15:13:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ed1-x530.google.com with SMTP id h15so27392011edv.7 for ; Wed, 23 Feb 2022 06:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RN6L6vcbNMJTIgDi/DXzX3+UV8S+/8O00tXfypPHyDg=; b=bmO0N88dwRe5hpXobclpkuz/WLVXJpkYab4kzHJVBWMV8rYCPlrXavj3pwZZSrKSY6 JzgXfxCgNhh0vcHqPrUoWS3kyN4eAdBvTCIxbgzQIQ5RMat6LfzZGZL6WIZ22cSg21nN u4/0Qigbph/CgdAUvMyDMZqXtpIDZha6pF9yRTq9zWFbfIKp/3S3CpZOy5+3ah0bFxwN qk+EWmdFMpH4CE5u9qdPR68ilkxVQzZFIRi2Y3To2RyDBqWZB6Sw1adeAj9pdVIWw4Rm YPDuSFMmSV1W1xzinPv80MFetZUwPEVd7bwP4N/XIz3OwNZUzB3tYNxL7iNBCJMk6n3V fT+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RN6L6vcbNMJTIgDi/DXzX3+UV8S+/8O00tXfypPHyDg=; b=B7n5T0XejzHH6KAM9TTobj5oJOXLEtrEFdhMJGlTAOsPxj4392/Cumml38O4PZVeCb lTlq0uvc8/ct+exCo1D7kEsGtjLeh8ArllePC2NuNoJ7MmhKeaenbLryMzgLA5WtktAw KJ8wWnvJEMVBiJE1VaWCeDrSqU37riWeeNPOFM2bJ44cGwAsfLQXaQE1l6M3ozxPS9Jq 0yuSS+7YQpEjVLVmPRVetdod/FHHxJH1GS2XhcneXyyD6Od5VQXZzHlwwlIo1+QB+Jkl Ef3l+vgjb5oxdV6w/WAQPYIeJrKvOzGaLktLv4NLeqb25T04Ch7ecJJrnvzk8j+vNFxJ LW/A== X-Gm-Message-State: AOAM531WIPcsQZnyWjhUNcLfGfs1+h30ZLJg/ZuIveNvx1OKsOfY8p1H 6m8yQbVU//j0kOloqAW0/AgwkFugccVoag== X-Google-Smtp-Source: ABdhPJyATgioH765+tthFIUMf1pNMCWA0dRh/K0QfyUBnlFVQ1FiunQr28MPVBP+2x+5bJnfutUSng== X-Received: by 2002:aa7:d6c3:0:b0:40f:405a:fbf8 with SMTP id x3-20020aa7d6c3000000b0040f405afbf8mr31086308edr.447.1645625615027; Wed, 23 Feb 2022 06:13:35 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id j18sm3067970ejm.102.2022.02.23.06.13.34 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Feb 2022 06:13:34 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Ashok Reddy Soma , Jaehoon Chung , Peng Fan Subject: [PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue Date: Wed, 23 Feb 2022 15:13:30 +0100 Message-Id: <61fc1160ada0dd622cd29e381a74af7bf3d9a200.1645625609.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Ashok Reddy Soma In the workaround added with 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait till sd card detect state is stable")' the timeout variable has post decrement. Whenever timeout happens, this post decrement is making timeout=0xffffffff, so timeout error print and return statement are never reached. Fix it by decrementing it inside the while loop. Signed-off-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- drivers/mmc/zynq_sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 5cea4c695e8d..f4d69a2f7098 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -773,8 +773,9 @@ static int arasan_sdhci_probe(struct udevice *dev) u32 timeout = 1000; while (((sdhci_readl(host, SDHCI_PRESENT_STATE) & - SDHCI_CARD_STATE_STABLE) == 0) && timeout--) { + SDHCI_CARD_STATE_STABLE) == 0) && timeout) { mdelay(1); + timeout--; } if (!timeout) { dev_err(dev, "Sdhci card detect state not stable\n");