From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70B52D3C92F for ; Mon, 21 Oct 2024 02:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bf7ZQ2vXj6JorqEGjz7XEV1A94uZWCECK/fe9E3SPTo=; b=JKaQDrHATWE0zHuh5EDACO7tVv dfyM6Vc0H2RaJTtJDhZdvxuG6ontlcUiRf4ROBu3gBVWnO6uEQ9ElOy+IfpHU5vcTYWaogLjqnKZm U7H+ocf5iJntJ6U2z36cLO4O/5OHUdfCXTYiXfHpIRuML2YczOvpT+J+v96ymKDpP5l0+d+KD38rI RHOEop3VPIYNzmDgKFJ+8CC8l1EGHwnY4OD5pWAkrSihBompf72dBnmVIh/idyBeiQfaWrrw9o0m8 vBPpja+GS/zs58/Y53NoLJkSCoUvC9fH4KQVY3qn7x9Xed6OAfyRyWmyVyuabD2ZP6C3TVq1rern7 iKYTA5Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2ht5-00000005qh5-0J7C; Mon, 21 Oct 2024 02:11:15 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2hrb-00000005qa8-15f6; Mon, 21 Oct 2024 02:09:44 +0000 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-71e681bc315so2457733b3a.0; Sun, 20 Oct 2024 19:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729476581; x=1730081381; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bf7ZQ2vXj6JorqEGjz7XEV1A94uZWCECK/fe9E3SPTo=; b=SwC0Bimlm51SoKqbfwLYhkPN0QLQDHySc/z9bkM5BYta7yf/yG38mpZ/lepPy+jCdH 5qPWDT3MSij1cADvblQRyQH0OqpeParg7kC0Ae7dMSTAMbZqQJO1AZW1QTjirgbgOziU G43rr2gI6TFqzmM0l2v1V4dv3oF5MT851+iQF4BzcWaVBwHH8o6P7wDEJIBrb8AS+YYt WzYdPhzRJSZSDdWQNzJz3ujFZPBSsPIL8cXAGXCkvPTqecoRvcx4JVp9QOpMSvV8yg/w eswhHpqCXvRzaPWcZyUD43o+YTIE7LrTjGV5Sly7PkdLCSqXGUqenwy7tA8wl+oeqKjJ nLAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729476581; x=1730081381; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bf7ZQ2vXj6JorqEGjz7XEV1A94uZWCECK/fe9E3SPTo=; b=mhSu/cfjYC461yyHXLC9AxdC5YIVYr/QTyE0FkQe0inJpOZcNugJu9Xls+3RqKa6S0 C1TLTMcFbtYe65lCbwuGs2TYs1Ut3bFVOoF/cqUr/Eh/4/q07XInIL1jfVPQMu5tW0Ye fKJvMGO0ZC2fPO56rjXzY317nrUGZaOIjzBFM1uIZGtu+iDkuKiVa5WyLSAMIf0a1HOp nktmJpl22lk/iVFxoyWD5lSA8b+DqLGbJW/o6DVGlPfy2Lvx9k/ySquKF6fiVQbl8ZTX OPl50AUsM6HUeT+qWFAS+QmXU0pPlOfwSLc6zWwy8qd2P5AkwzIgT/xg2NfQB1n4Eagu GOyg== X-Forwarded-Encrypted: i=1; AJvYcCVXopHBt4NxH8JZz18XcJnwbxPbtEPdvcV5/N3Dp2lPRKGBisRvOOlsJRgum0cz8kHXO6iGivnJXFKaB+NLyb/f@lists.infradead.org, AJvYcCX0F2LUzHGf2tJfMqsKxYa/l+6rFrKv0HMqOFc7KCapVLrXKAonEWOnoyY4B1TQFHZJMiO4hBi8XdCf@lists.infradead.org X-Gm-Message-State: AOJu0Yyu3uS/owp/2tX4w7LyKZDrFyiPPkxJanhxa5nid8Ie/UkaYbDe RYFj48FGo4YLlqGb/YoKT1eWG3PIjdtYCWvfKFepFBJCXAiDYEbBOX3pVg== X-Google-Smtp-Source: AGHT+IFq7IOvWK3WEZq7H92NJ9rZFuPaZ3gta4tblIVUEdLtLS9whI4zUy8XlVEj522zW40a785d0A== X-Received: by 2002:a05:6a00:1d15:b0:71e:591d:cb4c with SMTP id d2e1a72fcca58-71e8fd43bc5mr26167952b3a.1.1729476581198; Sun, 20 Oct 2024 19:09:41 -0700 (PDT) Received: from [172.19.1.53] (60-250-192-107.hinet-ip.hinet.net. [60.250.192.107]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1332f6asm1775801b3a.69.2024.10.20.19.09.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Oct 2024 19:09:40 -0700 (PDT) Message-ID: Date: Mon, 21 Oct 2024 10:09:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 2/2] mtd: rawnand: nuvoton: add new driver for the Nuvoton MA35 SoC To: Sascha Hauer Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, nikita.shubin@maquefel.me, arnd@arndb.de, vkoul@kernel.org, esben@geanix.com, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20241018022519.721914-1-hpchen0nvt@gmail.com> <20241018022519.721914-3-hpchen0nvt@gmail.com> Content-Language: en-US From: Hui-Ping Chen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241020_190943_325127_6A410D74 X-CRM114-Status: GOOD ( 18.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dear Sascha, Thank you for your reply. On 2024/10/18 下午 05:40, Sascha Hauer wrote: > On Fri, Oct 18, 2024 at 02:25:19AM +0000, Hui-Ping Chen wrote: >> +static int ma35_nfi_ecc_check(struct nand_chip *chip, u8 *addr) >> +{ >> + struct ma35_nand_info *nand = nand_get_controller_data(chip); >> + struct mtd_info *mtd = nand_to_mtd(chip); >> + int i, j, nchunks = 0; >> + int report_err = 0; >> + int err_cnt = 0; >> + u32 status; >> + >> + nchunks = mtd->writesize / chip->ecc.steps; >> + if (nchunks < 4) >> + nchunks = 1; >> + else >> + nchunks /= 4; >> + >> + for (j = 0; j < nchunks; j++) { >> + status = readl(nand->regs + MA35_NFI_REG_NANDECCES0 + j * 4); >> + if (!status) >> + continue; >> + >> + for (i = 0; i < 4; i++) { >> + if ((status & ECC_STATUS_MASK) == 0x01) { >> + /* Correctable error */ >> + err_cnt = (status >> 2) & ECC_ERR_CNT_MASK; >> + ma35_nfi_correct(chip, j * 4 + i, err_cnt, addr); >> + report_err += err_cnt; > This is still wrong. This should be > > report_err = max(report_err, err_cnt); > > You have to search for the subpage that has the most bitflips and return > the number of bitflips on that subpage, *not* the total amount of errors > on the whole page. > > That said, the statistic counter should still count the total number of > bitflips occurred. I re-examined the return value of read_page, and it indeed needs to return the maximum bitflips for the subpage. I will correct this return value. Thank you. > Sascha > >> + } else { >> + /* Uncorrectable error */ >> + dev_warn(nand->dev, "uncorrectable error! 0x%4x\n", status); >> + return -EBADMSG; >> + } >> + status >>= 8; >> + } >> + } >> + return report_err; >> +} >> + Best regards, Hui-Ping Chen