* [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
@ 2026-11-21 23:41 Vít Kazík
2026-11-22 0:26 ` Vít Kazík
0 siblings, 1 reply; 5+ messages in thread
From: Vít Kazík @ 2026-11-21 23:41 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr
Cc: tudor.ambarus, linux-mtd, linux-kernel, Vít Kazík
Add support for the Micron MT29F1G01AAADD (M68A), a 1Gb 3.3V SPI NAND
with 2048+64 byte pages, 64 pages per block, two planes and 4-bit
on-die ECC.
The 64 spare bytes are split into four 16-byte sections, each with
2 reserved bytes, 6 free bytes and 8 ECC bytes. The existing
micron_4_ooblayout reports the reserved bytes of sections 1-3 as
free, so add a layout that exposes only bytes 2-7 of each section.
Tested on a Motorola NCAP-500 (Atheros AR7242) running OpenWrt
with kernel 6.18.39, using UBI with UBIFS for about 3 months.
The chip is detected correctly:
spi-nand spi0.1: Micron SPI NAND was found.
spi-nand spi0.1: 128 MiB, block size: 128 KiB,
page size: 2048, OOB size: 64
Signed-off-by: Vít Kazík <vitkazik@vitkazik.cz>
---
drivers/mtd/nand/spi/micron.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 36f6cbbd7462..cc6eff0e54c2 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -134,6 +134,23 @@ static const struct mtd_ooblayout_ops micron_4_ooblayout = {
.free = micron_4_ooblayout_free,
};
+static int micron_m68a_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section >= 4)
+ return -ERANGE;
+
+ region->offset = (section * 16) + 2;
+ region->length = 6;
+
+ return 0;
+}
+
+static const struct mtd_ooblayout_ops micron_m68a_ooblayout = {
+ .ecc = micron_4_ooblayout_ecc,
+ .free = micron_m68a_ooblayout_free,
+};
+
static int micron_select_target(struct spinand_device *spinand,
unsigned int target)
{
@@ -404,6 +421,16 @@ static const struct spinand_info micron_spinand_table[] = {
SPINAND_ECCINFO(µn_8_ooblayout,
micron_8_ecc_get_status),
SPINAND_SELECT_TARGET(micron_select_target)),
+ /* M68A 1Gb 3.3V */
+ SPINAND_INFO("MT29F1G01AAADD",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x12),
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 2, 1, 1),
+ NAND_ECCREQ(4, 512),
+ SPINAND_INFO_OP_VARIANTS(&x4_read_cache_variants,
+ &x1_write_cache_variants,
+ &x1_update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(µn_m68a_ooblayout, NULL)),
/* M69A 2Gb 3.3V */
SPINAND_INFO("MT29F2G01AAAED",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x9F),
base-commit: ec1e844b9486302a488abc03ea918db60709766e
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2026-11-21 23:41 [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD Vít Kazík
@ 2026-11-22 0:26 ` Vít Kazík
2026-11-23 10:45 ` Marco Felsch
2026-11-23 14:43 ` Miquel Raynal
0 siblings, 2 replies; 5+ messages in thread
From: Vít Kazík @ 2026-11-22 0:26 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr
Cc: tudor.ambarus, linux-mtd, linux-kernel, m.felsch, sshivamurthy
Hi,
I found Marco Felsch's earlier submission for this chip (2019/2020)
only after sending this patch, and have read that discussion now. My patch was written independently from the datasheet, and it already uses
4-bit/512-byte ECC as agreed there.
One difference is the free OOB area. I expose bytes 2-7 of each
section, following Table 11, while Marco's version
exposed bytes 4-7 so that the free area is always ECC-protected. I'm
happy to switch to 4-7 if that is preferred.
Marco, if you still plan to send an updated version, please say so and I will happily step aside.
Thanks,
Vít
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2026-11-22 0:26 ` Vít Kazík
@ 2026-11-23 10:45 ` Marco Felsch
2026-11-23 12:35 ` Vít Kazík
2026-11-23 14:43 ` Miquel Raynal
1 sibling, 1 reply; 5+ messages in thread
From: Marco Felsch @ 2026-11-23 10:45 UTC (permalink / raw)
To: Vít Kazík
Cc: miquel.raynal, richard, vigneshr, tudor.ambarus, linux-mtd,
linux-kernel, sshivamurthy
Hey,
On 26-11-22 00:26, Vít Kazík wrote:
> Hi,
> I found Marco Felsch's earlier submission for this chip (2019/2020)
Uhh that's an old series ^^ Can you send me a link so I can check it
quickly please?
Regards,
Marco
> only after sending this patch, and have read that discussion now. My patch was written independently from the datasheet, and it already uses
> 4-bit/512-byte ECC as agreed there.
>
> One difference is the free OOB area. I expose bytes 2-7 of each
> section, following Table 11, while Marco's version
> exposed bytes 4-7 so that the free area is always ECC-protected. I'm
> happy to switch to 4-7 if that is preferred.
>
> Marco, if you still plan to send an updated version, please say so and I will happily step aside.
>
> Thanks,
> Vít
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2026-11-23 10:45 ` Marco Felsch
@ 2026-11-23 12:35 ` Vít Kazík
0 siblings, 0 replies; 5+ messages in thread
From: Vít Kazík @ 2026-11-23 12:35 UTC (permalink / raw)
To: Marco Felsch
Cc: miquel.raynal, richard, vigneshr, tudor.ambarus, linux-mtd,
linux-kernel, sshivamurthy
Hi Marco,
>> Hi,
>> I found Marco Felsch's earlier submission for this chip (2019/2020)
>
>Uhh that's an old series ^^ Can you send me a link so I can check it
>quickly please?
Sure, here is the last message of the thread
https://lore.kernel.org/all/20200117071810.2kuiwr6rhlofp6th@pengutronix.de/
Regards,
Vít
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2026-11-22 0:26 ` Vít Kazík
2026-11-23 10:45 ` Marco Felsch
@ 2026-11-23 14:43 ` Miquel Raynal
1 sibling, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2026-11-23 14:43 UTC (permalink / raw)
To: Vít Kazík
Cc: richard, vigneshr, tudor.ambarus, linux-mtd, linux-kernel,
m.felsch, sshivamurthy
On 22/11/2026 at 00:26:20 GMT, Vít Kazík <vitkazik@vitkazik.cz> wrote:
> Hi,
> I found Marco Felsch's earlier submission for this chip (2019/2020)
> only after sending this patch, and have read that discussion now. My patch was written independently from the datasheet, and it already uses
> 4-bit/512-byte ECC as agreed there.
>
> One difference is the free OOB area. I expose bytes 2-7 of each
> section, following Table 11, while Marco's version
> exposed bytes 4-7 so that the free area is always ECC-protected. I'm
> happy to switch to 4-7 if that is preferred.
Yes please.
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-23 14:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-21 23:41 [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD Vít Kazík
2026-11-22 0:26 ` Vít Kazík
2026-11-23 10:45 ` Marco Felsch
2026-11-23 12:35 ` Vít Kazík
2026-11-23 14:43 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®