From nobody Sun Feb 8 13:45:08 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D36D54690 for ; Mon, 12 Aug 2024 02:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723429200; cv=none; b=Kqv0zBWt/Rl/Wr9JN+monAArX/3VDWYQFh+Rq8kaq4pLZY1CYQwPc/Gp5VPlfNtZryWVGzsd3Soks8YK0zlk2JuofzGeiNgBPGbtgjc5O0ySJqlealW2dmkj3f1x/ZZ3CLvh9+YSJJ9rYbEbU7oX9Q3UKB68cPAR6uMWaDTqCSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723429200; c=relaxed/simple; bh=ef0XlytiFM3L4mjh1F0FlAAJ/kSocYpyq7Hu/VIEM14=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=ohKjiIZlDDI9EfSPLt/DHvWVDL5w/5k9Pa0EoMLI8IPvu9O7lJ66g+M/tbZEp9bITaTrXGyjDO7IDypIDhkhR0Eb8aiYVHM4rUB78Mr0EUqYQ1P2yZwwDNJg+BNYinGekEd9JxPQ7PWIqummzJbaDq2cEkGbELyzctC1sbAncFs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98) (envelope-from ) id 1sdKIj-000000005nm-2IQk; Mon, 12 Aug 2024 01:56:49 +0000 Date: Mon, 12 Aug 2024 02:56:41 +0100 From: Daniel Golle To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Daniel Golle , Mika Westerberg , Chia-Lin Kao , Martin Kurbanov , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength Message-ID: <2117e387260b0a96f95b8e1652ff79e0e2d71d53.1723427450.git.daniel@makrotopia.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reporting an unclean read from SPI-NAND only when the maximum number of correctable bitflip errors has been hit seems a bit late. UBI LEB scrubbing, which depends on the lower MTD device reporting correctable bitflips, then only kicks in when it's almost too late. Set bitflip_threshold to 75% of the ECC strength, which is also the default for raw NAND. Signed-off-by: Daniel Golle Reviewed-by: Frieder Schrempf --- drivers/mtd/nand/spi/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index e0b6715e5dfed..018c854d06193 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -1287,6 +1287,7 @@ static int spinand_init(struct spinand_device *spinan= d) /* Propagate ECC information to mtd_info */ mtd->ecc_strength =3D nanddev_get_ecc_conf(nand)->strength; mtd->ecc_step_size =3D nanddev_get_ecc_conf(nand)->step_size; + mtd->bitflip_threshold =3D DIV_ROUND_UP(mtd->ecc_strength * 3, 4); =20 ret =3D spinand_create_dirmaps(spinand); if (ret) { --=20 2.46.0