From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 CF90F42EECF for ; Tue, 28 Apr 2026 12:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777380561; cv=none; b=oKAEXbXZvzh/DQA46tk09NCPFl/eg/bpaw1zMDq+g9uwYT7tIVCNaSVbEOY+Zu28wOaA2IuN9CmwQh6ubpingx109rk+2eds9xgzDhE/BhX9PHWuz3usloNqIxuaJkyFnefdc3Bbd103JGyJ6igNjRWAWGK/xxn35FS2Jc8y1BM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777380561; c=relaxed/simple; bh=GlO/07lIE5qGy00ZrQQhJ8ZhkMbUIbxhNITBhI+MIDU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=d1gjFFXzPHixgvqrBPZ7GnQdeGrmfokKRfFJ76Um4CDnWhsOQToLFb8Tfu8IXY3V0wsgxwiE5g3Ein5wBdcdnb25N5H70Rlv/U/zvatkdubO0p9cI4YDD/xOhDyWIew2K5uytWXeqV+/i08L5oizgoQn14d3ioKVhho887EqDK4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=cYcbr1ND; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cYcbr1ND" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id B65394E40CD7; Tue, 28 Apr 2026 12:49:14 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 873AA601D0; Tue, 28 Apr 2026 12:49:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BF50910728B37; Tue, 28 Apr 2026 14:49:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1777380553; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=532MLBDCbnndBAIaErrkgKirNydKSHsihOL9UW9nCJ4=; b=cYcbr1ND0whWLj3zVzBWCIug7yqiXzeivf5pRXHgRP4JAbVBWFF9kh+LV+LBnMl5I+FdDe VwQcSlXbvsZuvcCHJiRQN7zpZ49CCh7ziBcT/HOy1lgM9p07RcVzUPTBjxT0c1pArqjbNp h9yph/jKsZBQpJqQpEsPO2+CeAFYmQCZIoD9Ip2bnlI7AAFdX1tjj3KjppaqmgN2DKE65y 23JRvpo4955zN/0aVubps3/jtxaWLCJ24qX6U7Lc1niIP0fcff9ji6WrJSt7Bn2zu+Sids mr0fpQqlE37hqN5ppWSz79Oj6NmPnEn4svoYX0cnsHIMsLOgSF9DpcvmsYHGXQ== From: Miquel Raynal To: Ziyang Huang Cc: richard@nod.at, vigneshr@ti.com, cnsztl@gmail.com, csharper2005@gmail.com, mikhail.kshevetskiy@iopsys.eu, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: spinand: fmsh: add support for FM25G{01,02}B In-Reply-To: (Ziyang Huang's message of "Wed, 15 Apr 2026 23:31:41 +0800") References: User-Agent: mu4e 1.12.7; emacs 30.2 Date: Tue, 28 Apr 2026 14:49:13 +0200 Message-ID: <87340fdzcm.fsf@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Hello Ziyang, On 15/04/2026 at 23:31:41 +08, Ziyang Huang wrote: > FM25G01B: https://www.fmsh.com/nvm/FM25G01B_ds_eng.pdf > FM25G02B: https://www.fmsh.com/nvm/FM25G02B_ds_eng.pdf Before giving the links, the commit could be slightly more verbose, such as "Add support for...". > Signed-off-by: Ziyang Huang > --- > Changes since v1: > Fix copy-paste issue. (Correct FM25G01B size.) > > drivers/mtd/nand/spi/fmsh.c | 101 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 101 insertions(+) > > diff --git a/drivers/mtd/nand/spi/fmsh.c b/drivers/mtd/nand/spi/fmsh.c > index f417955f7d1c..a9b219ae6c29 100644 > --- a/drivers/mtd/nand/spi/fmsh.c > +++ b/drivers/mtd/nand/spi/fmsh.c > @@ -9,6 +9,16 @@ > #include > #include >=20=20 > +#define FM25G01B_STATUS_ECC_MASK (7 << 4) > + #define FM25G01B_STATUS_ECC_NO_BITFLIPS (0 << 4) > + #define FM25G01B_STATUS_ECC_1_3_BITFLIPS (1 << 4) > + #define FM25G01B_STATUS_ECC_4_BITFLIPS (2 << 4) > + #define FM25G01B_STATUS_ECC_5_BITFLIPS (3 << 4) > + #define FM25G01B_STATUS_ECC_6_BITFLIPS (4 << 4) > + #define FM25G01B_STATUS_ECC_7_BITFLIPS (5 << 4) > + #define FM25G01B_STATUS_ECC_8_BITFLIPS (6 << 4) > + #define FM25G01B_STATUS_ECC_UNCOR_ERROR (7 << 4) > + > #define FM25S01BI3_STATUS_ECC_MASK (7 << 4) > #define FM25S01BI3_STATUS_ECC_NO_BITFLIPS (0 << 4) > #define FM25S01BI3_STATUS_ECC_1_3_BITFLIPS (1 << 4) > @@ -34,6 +44,72 @@ static SPINAND_OP_VARIANTS(update_cache_variants, > SPINAND_PROG_LOAD_1S_1S_4S_OP(false, 0, NULL, 0), > SPINAND_PROG_LOAD_1S_1S_1S_OP(false, 0, NULL, 0)); >=20=20 > + > +static int fm25g01b_ooblayout_ecc(struct mtd_info *mtd, int section, > + struct mtd_oob_region *region) > +{ > + if (section) > + return -ERANGE; > + > + region->offset =3D 64; > + region->length =3D 64; > + > + return 0; > +} > + > +static int fm25g01b_ooblayout_free(struct mtd_info *mtd, int section, > + struct mtd_oob_region *region) > +{ > + if (section > 3) > + return -ERANGE; > + > + if (section =3D=3D 0) { > + /* reserve 2 bytes for the BBM */ > + region->offset =3D 2; > + region->length =3D 14; > + } else { > + region->offset =3D section * 16; > + region->length =3D 16; > + } Isn't that just one big 62 bytes section starting at 2? > + > + return 0; > +} Rest lgtm. Thanks, Miqu=C3=A8l