From patchwork Mon Sep 16 09:58:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 829004 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4187:b0:367:895a:4699 with SMTP id ei7csp699508wrb; Mon, 16 Sep 2024 02:59:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXl5zVcUFp+X88F1Q5dADnIsGWYjm4YKW5SDfVGlgIwUAUiO3qEzDXzPhvkEpgqIlSSfmEyTw==@linaro.org X-Google-Smtp-Source: AGHT+IEmz6fsL/xgIwwnyArpR1ca60UfVVCU0bhNiRpcMxZkRJNrBnYsCnRtwn8iokffrH/X6YBX X-Received: by 2002:adf:e282:0:b0:376:7dc1:6e91 with SMTP id ffacd0b85a97d-378a8a1c6c5mr12659966f8f.11.1726480743949; Mon, 16 Sep 2024 02:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726480743; cv=none; d=google.com; s=arc-20240605; b=HfCfKcNZXLw96i+BaY1noTt4YmMri1wR2uO7fOi5ttThsUu+6kIywydGIQWUUeMBzx yFZ2V8umIK2dqF2ymP90W5F+Bpz0iTsib0rqQ3NmBpHCuVsoO9ssNs/9YLdcucV3hGo9 KT6jvzJ4UShA2E68m805N1DRbMHaKisiGqES6Zr9u2urP/0AmBw8XygwDsm3ILiY4ocB hHevEhxuDa5UksKWMgBpQ22JY4JXfYFTh3kPNApaP0yc02hTm4WlsW1fMiuhC7fh2Vk4 rx4b6PBcAjDz7CUZov0tfyQsNWnalGKfVj6bev1iL6yfjLYC48Eu4pmBT62gMnzu/Q7+ O2EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=cy0AelE8X6/ImwZyMOvnLyspFv+MmXcjl2xKIRLZjow=; fh=bbSjVJcsz6ma3Arirz+KWNos93PEC62yDVUDN8y6koA=; b=hFha4kYjN/91oizXVLRwG6lLvuLTE33kGP2tAt96O7A4JVDmIYz8HxvxdlqEBJjq5A IautO0eG3XgSxFSbVwmRaMOFhWV4Es+XotL932aHsM5COFbY0mGtoZ49LViPjGI6C8GS Nkb4nY/y1OuA95knUZHY1z9q38xnhHPCGhE6TygqUh1eiuCsogHXFfmFSME8sB0B3prN ZboPylQTFY0odph36/YBLUJruIcGbEEVnNLp/0R9rbY7Dei8De5HAyAlYdUZsedm5lbm IyWhNVBRi5tyMDPiZFQVscyXKZqqMqafwXopWTBSZo7HSdQ0h4SSeFAqS00QjQEllJKC nziA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gfxXizCd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ffacd0b85a97d-378e73dfca1si2050318f8f.198.2024.09.16.02.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 02:59:03 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gfxXizCd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2D5F388EC4; Mon, 16 Sep 2024 11:58:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gfxXizCd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA84888EEB; Mon, 16 Sep 2024 11:58:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 9244F8899C for ; Mon, 16 Sep 2024 11:58:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=linus.walleij@linaro.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a8d6ac24a3bso772172966b.1 for ; Mon, 16 Sep 2024 02:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726480730; x=1727085530; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cy0AelE8X6/ImwZyMOvnLyspFv+MmXcjl2xKIRLZjow=; b=gfxXizCdUnIT1RtnVQANWiWdHBZBVu9owU/8mB0NInBemf9bxJLq1x4KU3mV84+GrD oI4+CeIkQ3P4rp62C6SUJQzsW5Uzp8C7Bsn2ZNKJku8SMEkYGf7RZyAfZNlkMHmaEnRv TlcZgDpLLHLxtGT5gJiHqdpNPHggwbE6cRkxXb4lSzyPDBfg1K/EL35EJyZJcJ581Yoz t6I9W/l40JE4tfnVkWzBLgO3zlC6gLZhXhLin5EQlI4HIZRUswKFqHR7uqKkL2rPgLr9 Xqc3vBAoT/LgTfMP4tAxmdk0GIXekgvwQqTJkSY8VE83r9K9u287JqlbqAl2Xy/poH55 qzOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726480730; x=1727085530; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cy0AelE8X6/ImwZyMOvnLyspFv+MmXcjl2xKIRLZjow=; b=byfyrc4kayu+nWhIVm99yHW+vmYtAkrx+DHPjGSbOIbS+1J/30ZI5pl+CSnMGMoyQU vlXXDgeZAtNb8d3Bo0VAbiSP2Qn3YSJDaYg8Enr6YKczKl42WidQ7FcnoUcqK6wJuWuo uzbGviLg7KZk99xtjnJh9BC/3s82XghzUvmNLf3T5N7fEMCDeMIdSjIKR331wSfhQHJH FoE8nVdyNNQYgEEX+ElkoBt4O8PNFVwok/gJunLRRvy9xraU+xAteW5a6YOgvk90SMjb VVIHFOKj+bOLRd3qfai15unuwzTZRL/q9Zol0Mp29uclL9D3/J8FK8RLWylbG0+dyZXj tw+g== X-Gm-Message-State: AOJu0YxBwnAq4cx8PcQQQqSZiLq1M004V/tGxN7C8i85Gfy678fxd9+f lww9oYfS/dNzBn96OH1wZpU9IMPd8ui9ZFn8jNBcUD+EFwTdJOd46+fyHeFyRJQ= X-Received: by 2002:a17:907:2da3:b0:a8d:63b5:e795 with SMTP id a640c23a62f3a-a8ffaadad47mr2175007666b.3.1726480729350; Mon, 16 Sep 2024 02:58:49 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a906109662fsm292862966b.38.2024.09.16.02.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 02:58:49 -0700 (PDT) From: Linus Walleij Date: Mon, 16 Sep 2024 11:58:44 +0200 Subject: [PATCH v2 2/7] mtd: rawnand: brcmnand: Fix potential false time out warning MIME-Version: 1.0 Message-Id: <20240916-brcmnand-fixes-v2-2-08632f64c8ec@linaro.org> References: <20240916-brcmnand-fixes-v2-0-08632f64c8ec@linaro.org> In-Reply-To: <20240916-brcmnand-fixes-v2-0-08632f64c8ec@linaro.org> To: u-boot@lists.denx.de, Dario Binacchi , Michael Trimarchi , Anand Gore , William Zhang , Kursad Oney , Philippe Reynes Cc: Linus Walleij , Florian Fainelli , Miquel Raynal X-Mailer: b4 0.14.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.8 at phobos.denx.de X-Virus-Status: Clean From: William Zhang Backport from the Linux kernel: commit 9cc0a598b944816f2968baf2631757f22721b996 "mtd: rawnand: brcmnand: Fix potential false time out warning" If system is busy during the command status polling function, the driver may not get the chance to poll the status register till the end of time out and return the premature status. Do a final check after time out happens to ensure reading the correct status. Signed-off-by: William Zhang Reviewed-by: Florian Fainelli Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20230706182909.79151-3-william.zhang@broadcom.com Signed-off-by: Linus Walleij Reviewed-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 700d1122639f..46a4107a83a9 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1011,6 +1011,14 @@ static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl, } while (get_timer(base) < limit); #endif /* __UBOOT__ */ + /* + * do a final check after time out in case the CPU was busy and the driver + * did not get enough time to perform the polling to avoid false alarms + */ + val = brcmnand_read_reg(ctrl, BRCMNAND_INTFC_STATUS); + if ((val & mask) == expected_val) + return 0; + dev_warn(ctrl->dev, "timeout on status poll (expected %x got %x)\n", expected_val, val & mask);