From nobody Fri Dec 19 21:32:05 2025 Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) (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 5A8591E376E; Thu, 13 Feb 2025 06:00:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739426444; cv=none; b=kaPHH38SXvpbsQ7NFpz92ocD/GRpCMMfYgrnuyQ1bDFpeetunFsbBa+qz2Rn2Ilvaip7HNE6pB5NFgYkT0yJXqe1JRkNLz4eGS1H9PUdGwf5cHiklN6xU0gyUFcF9DxHT+s5SPeAYQCwdTrBEnRWNKvaKlVNdb0rn92f1uySYkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739426444; c=relaxed/simple; bh=bVh+FGK2nAlK+67aFhVGHvDEOpT1Y3PR9HfW5kYrQUk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=SX8v07WDQsaAmurnd56GATeYnztIWr9Nd4VH7Oim36/wETUeAxPXxJ25w0CoGKAAVVNCWej48kGl4E9R59//zmyFJlAT9sH3pOD9ZqzBFn0KbdEOqOMuTWK03v/TFTT3fVFAiX+RplYov4eM4fHM6nDscw0hv9bw/NLUJ9U7ncU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=WmUPekEU; arc=none smtp.client-ip=198.47.19.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="WmUPekEU" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 51D60Nvm3947666 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Feb 2025 00:00:23 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1739426423; bh=UDhnz5wxw1hdHaBaFUmXZ2OsCA8ywcG70oJJgWadirY=; h=From:To:CC:Subject:Date; b=WmUPekEU+t7sxR6eZVVDybaHF+73/ETG/YKOk5N1IEc2wTErilEKuYkyQ8/QV7War bRBap42jhXmScWamSMpgSaAI/SYHrDBsKKV6ynJ/tyfVKBQFwWwj9UMACFjx43k74n A/KnR0YAHK0Kd1LmVneruNq2+d2D6qzKIAF1+F8w= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 51D60NtE076218 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 13 Feb 2025 00:00:23 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 13 Feb 2025 00:00:22 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 13 Feb 2025 00:00:23 -0600 Received: from santhoshkumark.dhcp.ti.com (santhoshkumark.dhcp.ti.com [172.24.227.241]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 51D60J7K117400; Thu, 13 Feb 2025 00:00:20 -0600 From: Santhosh Kumar K To: , , , , CC: , , , , Subject: [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW Date: Thu, 13 Feb 2025 11:30:18 +0530 Message-ID: <20250213060018.2664518-1-s-k6@ti.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea Content-Type: text/plain; charset="utf-8" Fix the W25N01JW's oob_layout according to the datasheet. [1] [1] https://www.winbond.com/hq/product/code-storage-flash-memory/qspinand-f= lash/?__locale=3Den&partNo=3DW25N01JW Fixes: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND fl= ash") Cc: Sridharan S N Cc: stable@vger.kernel.org Signed-off-by: Santhosh Kumar K --- Changes in v2: - Detach patch 3/3 from v1 - Rebase on next - Link to v1: https://lore.kernel.org/linux-mtd/20250102115110.1402440-1-s= -k6@ti.com/ =20 Repo: https://github.com/santhosh21/linux/tree/uL_next Test results: https://gist.github.com/santhosh21/71ab6646dccc238a0b3c47c038= 2f219a --- drivers/mtd/nand/spi/winbond.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c index ea11ae12423f..41cd0a51e450 100644 --- a/drivers/mtd/nand/spi/winbond.c +++ b/drivers/mtd/nand/spi/winbond.c @@ -134,6 +134,30 @@ static int w25n02kv_ooblayout_free(struct mtd_info *mt= d, int section, return 0; } =20 +static int w25n01jw_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section > 3) + return -ERANGE; + + region->offset =3D (16 * section) + 12; + region->length =3D 4; + + return 0; +} + +static int w25n01jw_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section > 3) + return -ERANGE; + + region->offset =3D (16 * section) + 2; + region->length =3D 10; + + return 0; +} + static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { @@ -173,6 +197,11 @@ static const struct mtd_ooblayout_ops w35n01jw_ooblayo= ut =3D { .free =3D w35n01jw_ooblayout_free, }; =20 +static const struct mtd_ooblayout_ops w25n01jw_ooblayout =3D { + .ecc =3D w25n01jw_ooblayout_ecc, + .free =3D w25n01jw_ooblayout_free, +}; + static int w25n02kv_ecc_get_status(struct spinand_device *spinand, u8 status) { @@ -249,7 +278,7 @@ static const struct spinand_info winbond_spinand_table[= ] =3D { &write_cache_variants, &update_cache_variants), 0, - SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)), + SPINAND_ECCINFO(&w25n01jw_ooblayout, NULL)), SPINAND_INFO("W25N01KV", /* 3.3V */ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21), NAND_MEMORG(1, 2048, 96, 64, 1024, 20, 1, 1, 1), --=20 2.34.1