Message ID | 20230706182909.79151-3-william.zhang@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2761911vqx; Thu, 6 Jul 2023 11:43:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlGa2ns3DaJLTdb0xcP8Jux3+XDBZae/e4WYX3ii1OYpwcGIntMdlFkzyJqWG0BHW+cxv3b6 X-Received: by 2002:a17:902:7fc4:b0:1b8:865e:44e7 with SMTP id t4-20020a1709027fc400b001b8865e44e7mr6289515plb.20.1688669001788; Thu, 06 Jul 2023 11:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688669001; cv=none; d=google.com; s=arc-20160816; b=T0t2DVtpECgdupmHdLMtRPUvmwU6zSNx873oIYDyqKxqClZeaU8+YnHPwtqqtG2b3y qINpUacjjIW4XsAC/dfpb85JNeXpBRrZfE7bqyGHVlB4GHuavPxi6uYNgQpWctTN8NM4 9CkY4iiE4wVKB0kKl6/SQBDPxx55Sd9qsbDtBCQO+ccTabJMT6kfNytkloqsDwKPrZlW 7deGowj8SiZSbp7C9JkoEqwgnp4fXHfuxPvNPMwjH5vZyC+aRBV6m5zIp6WxTvl6B5cF U7UJQNXBp3cp5DGECrpo9wvI63YGPTtxhw9QrIUHNSA5hT4/DJU4tb5oWbrcZDF6SIuv fIvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=M9jUpwDvuvmyT1XyvE0e45XyYXLWotDr9wT7gxrJDuU=; fh=ORNSF113G4WA1axyJjwSKo0Uw8ZG2/ZPZL9fP0p05MA=; b=Wi4OvgyK5qxaD3Im9VHY1SsIE5mNNNRYsDls8E39T0F4paNSy9191voc+9j8GBdmKu ID6YQbNMbYBbds3dn+NQg4CN98ePCiwEIjHH1XgMs7jYBQ2f8Z7UJOVW+qjVCrz/W823 sQbuZCTeKPt2XRMsZqsZ1sKbexlUi8T0FMD4XXaJ0YhOhJ1MG3nhANKOLU4w/lfXuHvV c2AlJ9DOpQ/H/3d+3TAN9cLhpE3uRsEztSbNhKIEnWSX33Css8n6fMqLzcJRHot8Erkw qTPv5qMq7xIzJt7Rzy2TUTCumwVphJVpDDwyY5yuJbF9fYJ36+kimj8MaPeKBLz0W27q 7Rug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=eR3vlrEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020a170902d4cd00b001b8c4168e20si1783402plg.58.2023.07.06.11.43.08; Thu, 06 Jul 2023 11:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=eR3vlrEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232347AbjGFS3l (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Thu, 6 Jul 2023 14:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbjGFS3f (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Jul 2023 14:29:35 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABA271BF3 for <linux-kernel@vger.kernel.org>; Thu, 6 Jul 2023 11:29:34 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-668711086f4so727617b3a.1 for <linux-kernel@vger.kernel.org>; Thu, 06 Jul 2023 11:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1688668174; x=1691260174; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=M9jUpwDvuvmyT1XyvE0e45XyYXLWotDr9wT7gxrJDuU=; b=eR3vlrEvD7GcbM/HM3wwB5wQkrx8/LUkQeu3S0bS3UGsPWAsc1BrIb1gBQo66mkwj0 zEBrQ+9LJ/K8DOU6WwUP+qvhksW0zK0ApY7JDxWEUY+HvXVu32DxgPtHXHqV3odRGPjN o0udKlnuB99rzZH5qMkFDLVGEdJQIUNSRdKo4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688668174; x=1691260174; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M9jUpwDvuvmyT1XyvE0e45XyYXLWotDr9wT7gxrJDuU=; b=FVPkWsUf/34DskPd7qYynG/cETRsUjFHf84hzng12pVYdSnXUtuK3fK+M6+drFEEom Xl9/nWoki/AbYglwSZm/FQUZZEGDoSx2CAFLcmluXaqdv8YpptRREGPiCWGPuXFqGEAc dOujKLB8I6WE0I7FynD+ID0z1SXSjsynY9q5v5aNP7vfo8SefOVG66LS5c4DO6T/DRYx CCzuQ7gprJKwAQjQKO57FhGf/dMb3WMrE7uKm2WNz0eaVxmxkUv6i/Mcy7kU0kKrUtA8 oFm0pw8rAg8Bzy4G1wZg7CZZoitoh4v5t2oTqvBenD2qoAkMT5zM3nNb0O5fU9nx8irm rMZA== X-Gm-Message-State: ABy/qLZoa4M5sM5MHvSE0hR4HL3IhlZbouNrSXpRvIv8T5PJJ6SWywYO 3Z/S6D3mp6rXR+tX/im6yevaOg== X-Received: by 2002:a05:6a00:d5d:b0:668:93e7:6800 with SMTP id n29-20020a056a000d5d00b0066893e76800mr7712593pfv.14.1688668174067; Thu, 06 Jul 2023 11:29:34 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id y13-20020aa7804d000000b006826c9e4397sm1580871pfm.48.2023.07.06.11.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 11:29:33 -0700 (PDT) From: William Zhang <william.zhang@broadcom.com> To: Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>, Linux MTD List <linux-mtd@lists.infradead.org> Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang <william.zhang@broadcom.com>, Florian Fainelli <florian.fainelli@broadcom.com>, stable@vger.kernel.org, Miquel Raynal <miquel.raynal@bootlin.com>, linux-kernel@vger.kernel.org, Vignesh Raghavendra <vigneshr@ti.com>, Richard Weinberger <richard@nod.at>, Boris Brezillon <bbrezillon@kernel.org>, Kamal Dasu <kdasu.kdev@gmail.com> Subject: [PATCH v4 2/5] mtd: rawnand: brcmnand: Fix potential false time out warning Date: Thu, 6 Jul 2023 11:29:06 -0700 Message-Id: <20230706182909.79151-3-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230706182909.79151-1-william.zhang@broadcom.com> References: <20230706182909.79151-1-william.zhang@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000ae66c205ffd5b267" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770697787412027183?= X-GMAIL-MSGID: =?utf-8?q?1770697787412027183?= |
Series |
mtd: rawnand: brcmnand: driver and doc updates
|
|
Commit Message
William Zhang
July 6, 2023, 6:29 p.m. UTC
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. Fixes: 9d2ee0a60b8b ("mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program") Signed-off-by: William Zhang <william.zhang@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Cc: stable@vger.kernel.org --- Changes in v4: - Update comment in the polling status function - Add cc stable tag Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
On Thu, 2023-07-06 at 18:29:06 UTC, William Zhang wrote: > 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. > > Fixes: 9d2ee0a60b8b ("mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program") > Signed-off-by: William Zhang <william.zhang@broadcom.com> > Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> > Cc: stable@vger.kernel.org Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 9ea96911d16b..9a373a10304d 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1080,6 +1080,14 @@ static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl, cpu_relax(); } while (time_after(limit, jiffies)); + /* + * 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);