* [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
@ 2026-11-21 23:41 Vít Kazík
2026-11-21 23:56 ` sashiko-bot
2026-11-22 0:26 ` Vít Kazík
0 siblings, 2 replies; 14+ 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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 14+ 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-21 23:56 ` sashiko-bot
2026-11-22 0:26 ` Vít Kazík
1 sibling, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-21 23:56 UTC (permalink / raw)
To: Vít Kazík, miquel.raynal, richard, vigneshr
Cc: tudor.ambarus, linux-mtd
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mtd: spinand: micron: divide-by-zero in
micron_4_ooblayout_ecc() when no ECC
--
commit 4c40aef0592463ef1027b9070b229cf841212d82
Author: Vít Kazík <vitkazik@vitkazik.cz>
mtd: spinand: micron: add support for MT29F1G01AAADD
This commit adds SPI NAND table support and an OOB layout definition for the
Micron MT29F1G01AAADD (M68A) flash chip.
> diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> index 36f6cbbd7462c..cc6eff0e54c24 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,
> +};
[Severity: Medium]
Can wiring micron_4_ooblayout_ecc into micron_m68a_ooblayout cause a divide by
zero in micron_4_ooblayout_ecc() when the device is probed without an ECC
engine (such as with nand-no-ecc-engine in Device Tree)?
drivers/mtd/nand/spi/micron.c:micron_4_ooblayout_ecc() {
...
if (section >= spinand->base.memorg.pagesize /
mtd->ecc_step_size)
return -ERANGE;
...
}
When !nand->ecc.engine, spinand_init() still installs
spinand->eccinfo.ooblayout while leaving mtd->ecc_step_size at 0. During
spinand_probe(), mtd_device_register() -> add_mtd_device() ->
mtd_debugfs_populate() calls mtd_ooblayout_ecc(mtd, 0, ®ion), which invokes
micron_4_ooblayout_ecc() and divides by mtd->ecc_step_size.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121234125.16093-1-vitkazik@vitkazik.cz?part=1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ 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-21 23:56 ` sashiko-bot
@ 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, 2 replies; 14+ 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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ 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; 14+ 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
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ 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; 14+ 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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ 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; 14+ 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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
@ 2019-11-08 7:48 Marco Felsch
0 siblings, 0 replies; 14+ messages in thread
From: Marco Felsch @ 2019-11-08 7:48 UTC (permalink / raw)
To: miquel.raynal, frieder.schrempf, bbrezillon, richard
Cc: marek.vasut, sshivamurthy, linux-mtd, kernel, Peter Pan
The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a
capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1].
Unfortunatly the linked device is marked as EoL, but I will expect that
the MT29F1G01AAADDH4-ITX behaves the same way.
[1] https://datasheet.octopart.com/MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
Cc: Peter Pan <peterpandong@micron.com>
Cc: sshivamurthy@micron.com
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v2:
- Convert 0x10 into 16 for ooblayout description
- Don't break web link within commit message
drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 7d7b1f7fcf71..70e278759bd3 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0));
+static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd,
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
+
+static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd,
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
+
+static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd,
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
+
static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
@@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
return -EINVAL;
}
+static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 3)
+ return -ERANGE;
+
+ region->offset = (section * 16) + 8;
+ region->length = 8;
+
+ return 0;
+}
+
+static int mt29f1g01aaadd_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 3)
+ return -ERANGE;
+
+ /* 2 bytes for the BBM + 2 bytes to skip non-ecc memory */
+ region->offset = (section * 16) + 4;
+ region->length = 4;
+
+ return 0;
+}
+
+static const struct mtd_ooblayout_ops mt29f1g01aaadd_ooblayout = {
+ .ecc = mt29f1g01aaadd_ooblayout_ecc,
+ .free = mt29f1g01aaadd_ooblayout_free,
+};
+
+static int mt29f1g01aaadd_ecc_get_status(struct spinand_device *spinand,
+ u8 status)
+{
+ switch (status & STATUS_ECC_MASK) {
+ case STATUS_ECC_NO_BITFLIPS:
+ return 0;
+ case STATUS_ECC_HAS_BITFLIPS:
+ /* 1 to 4-bit error detected and corrected */
+ return 4;
+ case STATUS_ECC_UNCOR_ERROR:
+ return -EBADMSG;
+ default:
+ return -EINVAL;
+ }
+}
+
static const struct spinand_info micron_spinand_table[] = {
SPINAND_INFO("MT29F2G01ABAGD", 0x24,
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
@@ -100,6 +158,16 @@ static const struct spinand_info micron_spinand_table[] = {
0,
SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
mt29f2g01abagd_ecc_get_status)),
+ SPINAND_INFO("MT29F1G01AAADD", 0x12,
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 2, 1, 1),
+ NAND_ECCREQ(4, 2048),
+ SPINAND_INFO_OP_VARIANTS(
+ &read_cache_variants_mt29f1g01aaadd,
+ &write_cache_variants_mt29f1g01aaadd,
+ &update_cache_variants_mt29f1g01aaadd),
+ 0,
+ SPINAND_ECCINFO(&mt29f1g01aaadd_ooblayout,
+ mt29f1g01aaadd_ecc_get_status)),
};
static int micron_spinand_detect(struct spinand_device *spinand)
--
2.20.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
@ 2019-08-14 8:22 Marco Felsch
2019-08-19 8:17 ` Miquel Raynal
0 siblings, 1 reply; 14+ messages in thread
From: Marco Felsch @ 2019-08-14 8:22 UTC (permalink / raw)
To: miquel.raynal, frieder.schrempf, bbrezillon, richard
Cc: marek.vasut, linux-mtd, kernel, Peter Pan
The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a
capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1].
Unfortunatly the linked device is marked as EoL, but I will expect that
the MT29F1G01AAADDH4-ITX behaves the same way.
[1] https://datasheet.octopart.com/ \
MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
Cc: Peter Pan <peterpandong@micron.com>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 7d7b1f7fcf71..9d63450afc69 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0));
+static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd,
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
+
+static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd,
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
+
+static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd,
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
+
static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
@@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
return -EINVAL;
}
+static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 3)
+ return -ERANGE;
+
+ region->offset = (section * 0x10) + 8;
+ region->length = 8;
+
+ return 0;
+}
+
+static int mt29f1g01aaadd_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 3)
+ return -ERANGE;
+
+ /* 2 bytes for the BBM + 2 bytes to skip non-ecc memory */
+ region->offset = (section * 0x10) + 4;
+ region->length = 4;
+
+ return 0;
+}
+
+static const struct mtd_ooblayout_ops mt29f1g01aaadd_ooblayout = {
+ .ecc = mt29f1g01aaadd_ooblayout_ecc,
+ .free = mt29f1g01aaadd_ooblayout_free,
+};
+
+static int mt29f1g01aaadd_ecc_get_status(struct spinand_device *spinand,
+ u8 status)
+{
+ switch (status & STATUS_ECC_MASK) {
+ case STATUS_ECC_NO_BITFLIPS:
+ return 0;
+ case STATUS_ECC_HAS_BITFLIPS:
+ /* 1 to 4-bit error detected and corrected */
+ return 4;
+ case STATUS_ECC_UNCOR_ERROR:
+ return -EBADMSG;
+ default:
+ return -EINVAL;
+ }
+}
+
static const struct spinand_info micron_spinand_table[] = {
SPINAND_INFO("MT29F2G01ABAGD", 0x24,
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
@@ -100,6 +158,16 @@ static const struct spinand_info micron_spinand_table[] = {
0,
SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
mt29f2g01abagd_ecc_get_status)),
+ SPINAND_INFO("MT29F1G01AAADD", 0x12,
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 2, 1, 1),
+ NAND_ECCREQ(4, 2048),
+ SPINAND_INFO_OP_VARIANTS(
+ &read_cache_variants_mt29f1g01aaadd,
+ &write_cache_variants_mt29f1g01aaadd,
+ &update_cache_variants_mt29f1g01aaadd),
+ 0,
+ SPINAND_ECCINFO(&mt29f1g01aaadd_ooblayout,
+ mt29f1g01aaadd_ecc_get_status)),
};
static int micron_spinand_detect(struct spinand_device *spinand)
--
2.20.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2019-08-14 8:22 Marco Felsch
@ 2019-08-19 8:17 ` Miquel Raynal
2019-08-19 13:30 ` Marco Felsch
2019-08-20 8:28 ` Uwe Kleine-König
0 siblings, 2 replies; 14+ messages in thread
From: Miquel Raynal @ 2019-08-19 8:17 UTC (permalink / raw)
To: Marco Felsch
Cc: bbrezillon, richard, frieder.schrempf, marek.vasut, linux-mtd,
kernel, Peter Pan
Hi Marco,
Marco Felsch <m.felsch@pengutronix.de> wrote on Wed, 14 Aug 2019
10:22:32 +0200:
> The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a
> capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1].
>
> Unfortunatly the linked device is marked as EoL, but I will expect that
> the MT29F1G01AAADDH4-ITX behaves the same way.
>
> [1] https://datasheet.octopart.com/ \
> MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
>
> Cc: Peter Pan <peterpandong@micron.com>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++
> 1 file changed, 68 insertions(+)
>
> diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> index 7d7b1f7fcf71..9d63450afc69 100644
> --- a/drivers/mtd/nand/spi/micron.c
> +++ b/drivers/mtd/nand/spi/micron.c
> @@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
> SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
> SPINAND_PROG_LOAD(false, 0, NULL, 0));
>
> +static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd,
> + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
> + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
> + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
> + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
> +
> +static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd,
> + SPINAND_PROG_LOAD(true, 0, NULL, 0));
> +
> +static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd,
> + SPINAND_PROG_LOAD(false, 0, NULL, 0));
> +
> static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
> struct mtd_oob_region *region)
> {
> @@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
> return -EINVAL;
> }
>
> +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
> + struct mtd_oob_region *region)
> +{
> + if (section > 3)
> + return -ERANGE;
> +
> + region->offset = (section * 0x10) + 8;
Any reason to use hex here? ^
If not I would prefer decimal numbers.
Otherwise looks fine.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2019-08-19 8:17 ` Miquel Raynal
@ 2019-08-19 13:30 ` Marco Felsch
2019-08-19 14:34 ` Miquel Raynal
2019-08-20 8:28 ` Uwe Kleine-König
1 sibling, 1 reply; 14+ messages in thread
From: Marco Felsch @ 2019-08-19 13:30 UTC (permalink / raw)
To: Miquel Raynal
Cc: bbrezillon, richard, frieder.schrempf, marek.vasut, linux-mtd,
kernel, Peter Pan
Hi Miquel,
On 19-08-19 10:17, Miquel Raynal wrote:
> Hi Marco,
>
> Marco Felsch <m.felsch@pengutronix.de> wrote on Wed, 14 Aug 2019
> 10:22:32 +0200:
>
> > The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a
> > capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1].
> >
> > Unfortunatly the linked device is marked as EoL, but I will expect that
> > the MT29F1G01AAADDH4-ITX behaves the same way.
> >
> > [1] https://datasheet.octopart.com/ \
> > MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
> >
> > Cc: Peter Pan <peterpandong@micron.com>
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> > drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++
> > 1 file changed, 68 insertions(+)
> >
> > diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> > index 7d7b1f7fcf71..9d63450afc69 100644
> > --- a/drivers/mtd/nand/spi/micron.c
> > +++ b/drivers/mtd/nand/spi/micron.c
> > @@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
> > SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
> > SPINAND_PROG_LOAD(false, 0, NULL, 0));
> >
> > +static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd,
> > + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
> > + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
> > + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
> > + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
> > +
> > +static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd,
> > + SPINAND_PROG_LOAD(true, 0, NULL, 0));
> > +
> > +static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd,
> > + SPINAND_PROG_LOAD(false, 0, NULL, 0));
> > +
> > static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > struct mtd_oob_region *region)
> > {
> > @@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
> > return -EINVAL;
> > }
> >
> > +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > + struct mtd_oob_region *region)
> > +{
> > + if (section > 3)
> > + return -ERANGE;
> > +
> > + region->offset = (section * 0x10) + 8;
>
> Any reason to use hex here? ^
>
> If not I would prefer decimal numbers.
Since the datasheet describe it in hex to.
Can you have a look on [1] table 11? May we do something like:
region->offset = (section * 0x10) + 0x8;
[1] https://datasheet.octopart.com/MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
>
> Otherwise looks fine.
Anyway I can change the above code to use only decimal values if you
like it more.
Regards,
Marco
>
> Thanks,
> Miquèl
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2019-08-19 13:30 ` Marco Felsch
@ 2019-08-19 14:34 ` Miquel Raynal
2019-08-20 6:39 ` Marco Felsch
0 siblings, 1 reply; 14+ messages in thread
From: Miquel Raynal @ 2019-08-19 14:34 UTC (permalink / raw)
To: Marco Felsch
Cc: bbrezillon, richard, frieder.schrempf, marek.vasut, linux-mtd,
kernel, Peter Pan
Hi Marco,
Marco Felsch <m.felsch@pengutronix.de> wrote on Mon, 19 Aug 2019
15:30:42 +0200:
> Hi Miquel,
>
> On 19-08-19 10:17, Miquel Raynal wrote:
> > Hi Marco,
> >
> > Marco Felsch <m.felsch@pengutronix.de> wrote on Wed, 14 Aug 2019
> > 10:22:32 +0200:
> >
> > > The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a
> > > capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1].
> > >
> > > Unfortunatly the linked device is marked as EoL, but I will expect that
> > > the MT29F1G01AAADDH4-ITX behaves the same way.
> > >
> > > [1] https://datasheet.octopart.com/ \
> > > MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
> > >
> > > Cc: Peter Pan <peterpandong@micron.com>
> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > ---
> > > drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++
> > > 1 file changed, 68 insertions(+)
> > >
> > > diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> > > index 7d7b1f7fcf71..9d63450afc69 100644
> > > --- a/drivers/mtd/nand/spi/micron.c
> > > +++ b/drivers/mtd/nand/spi/micron.c
> > > @@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
> > > SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
> > > SPINAND_PROG_LOAD(false, 0, NULL, 0));
> > >
> > > +static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd,
> > > + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
> > > + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
> > > + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
> > > + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
> > > +
> > > +static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd,
> > > + SPINAND_PROG_LOAD(true, 0, NULL, 0));
> > > +
> > > +static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd,
> > > + SPINAND_PROG_LOAD(false, 0, NULL, 0));
> > > +
> > > static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > > struct mtd_oob_region *region)
> > > {
> > > @@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
> > > return -EINVAL;
> > > }
> > >
> > > +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > > + struct mtd_oob_region *region)
> > > +{
> > > + if (section > 3)
> > > + return -ERANGE;
> > > +
> > > + region->offset = (section * 0x10) + 8;
> >
> > Any reason to use hex here? ^
> >
> > If not I would prefer decimal numbers.
>
> Since the datasheet describe it in hex to.
>
> Can you have a look on [1] table 11? May we do something like:
>
> region->offset = (section * 0x10) + 0x8;
>
> [1] https://datasheet.octopart.com/MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
>
> >
> > Otherwise looks fine.
>
> Anyway I can change the above code to use only decimal values if you
> like it more.
I think it is better to reserve hexadecimal values to register
operations. Please translate into decimal.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2019-08-19 14:34 ` Miquel Raynal
@ 2019-08-20 6:39 ` Marco Felsch
0 siblings, 0 replies; 14+ messages in thread
From: Marco Felsch @ 2019-08-20 6:39 UTC (permalink / raw)
To: Miquel Raynal
Cc: bbrezillon, richard, frieder.schrempf, marek.vasut, linux-mtd,
kernel, Peter Pan
Hi Miquel,
On 19-08-19 16:34, Miquel Raynal wrote:
> Hi Marco,
>
> Marco Felsch <m.felsch@pengutronix.de> wrote on Mon, 19 Aug 2019
> 15:30:42 +0200:
>
> > Hi Miquel,
> >
> > On 19-08-19 10:17, Miquel Raynal wrote:
> > > Hi Marco,
> > >
> > > Marco Felsch <m.felsch@pengutronix.de> wrote on Wed, 14 Aug 2019
> > > 10:22:32 +0200:
> > >
> > > > The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a
> > > > capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1].
> > > >
> > > > Unfortunatly the linked device is marked as EoL, but I will expect that
> > > > the MT29F1G01AAADDH4-ITX behaves the same way.
> > > >
> > > > [1] https://datasheet.octopart.com/ \
> > > > MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
> > > >
> > > > Cc: Peter Pan <peterpandong@micron.com>
> > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > ---
> > > > drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 68 insertions(+)
> > > >
> > > > diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> > > > index 7d7b1f7fcf71..9d63450afc69 100644
> > > > --- a/drivers/mtd/nand/spi/micron.c
> > > > +++ b/drivers/mtd/nand/spi/micron.c
> > > > @@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
> > > > SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
> > > > SPINAND_PROG_LOAD(false, 0, NULL, 0));
> > > >
> > > > +static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd,
> > > > + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
> > > > + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
> > > > + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
> > > > + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
> > > > +
> > > > +static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd,
> > > > + SPINAND_PROG_LOAD(true, 0, NULL, 0));
> > > > +
> > > > +static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd,
> > > > + SPINAND_PROG_LOAD(false, 0, NULL, 0));
> > > > +
> > > > static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > > > struct mtd_oob_region *region)
> > > > {
> > > > @@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
> > > > return -EINVAL;
> > > > }
> > > >
> > > > +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > > > + struct mtd_oob_region *region)
> > > > +{
> > > > + if (section > 3)
> > > > + return -ERANGE;
> > > > +
> > > > + region->offset = (section * 0x10) + 8;
> > >
> > > Any reason to use hex here? ^
> > >
> > > If not I would prefer decimal numbers.
> >
> > Since the datasheet describe it in hex to.
> >
> > Can you have a look on [1] table 11? May we do something like:
> >
> > region->offset = (section * 0x10) + 0x8;
> >
> > [1] https://datasheet.octopart.com/MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf
> >
> > >
> > > Otherwise looks fine.
> >
> > Anyway I can change the above code to use only decimal values if you
> > like it more.
>
> I think it is better to reserve hexadecimal values to register
> operations. Please translate into decimal.
Okay. Just one last question. What is the common way to go to specify
the free area? By this I mean that the NAND has two areas to store the
user metadata calling it 'user metadata I' and 'user metadata II'. 'user
metadata II' isn't ecc protected so I skip them. But the current
supported chip does not skip the user metadata area which isn't
protected [1] table 10.
[1] https://www.micron.com/~/media/documents/products/data-sheet/nand-flash/70-series/m79a_2gb_3v_nand_spi.pdf
Regards,
Marco
>
> Thanks,
> Miquèl
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2019-08-19 8:17 ` Miquel Raynal
2019-08-19 13:30 ` Marco Felsch
@ 2019-08-20 8:28 ` Uwe Kleine-König
2019-08-20 8:32 ` Miquel Raynal
1 sibling, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2019-08-20 8:28 UTC (permalink / raw)
To: Miquel Raynal
Cc: bbrezillon, richard, Marco Felsch, frieder.schrempf, marek.vasut,
linux-mtd, kernel, Peter Pan
Hello Miquèl,
On Mon, Aug 19, 2019 at 10:17:18AM +0200, Miquel Raynal wrote:
> Marco Felsch <m.felsch@pengutronix.de> wrote on Wed, 14 Aug 2019
> 10:22:32 +0200:
> > +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > + struct mtd_oob_region *region)
> > +{
> > + if (section > 3)
> > + return -ERANGE;
> > +
> > + region->offset = (section * 0x10) + 8;
>
> Any reason to use hex here? ^
>
> If not I would prefer decimal numbers.
IMHO it is quite common to use hexadecimal also for register offsets,
not only for register values.
I checked a few drivers (drivers/mtd/nand/raw/mxc_nand.c,
drivers/clk/meson/g12a.c, drivers/gpio/gpio-sch.c) and they all use hex
also for the offsets, so it seems to be at least usual. Also as offsets
for repeating registers are usually powers of two, hexadecimal constants
are more suitable IMHO.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
2019-08-20 8:28 ` Uwe Kleine-König
@ 2019-08-20 8:32 ` Miquel Raynal
0 siblings, 0 replies; 14+ messages in thread
From: Miquel Raynal @ 2019-08-20 8:32 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: bbrezillon, richard, Marco Felsch, frieder.schrempf, marek.vasut,
linux-mtd, kernel, Peter Pan
Hi Uwe,
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote on Tue, 20 Aug
2019 10:28:37 +0200:
> Hello Miquèl,
>
> On Mon, Aug 19, 2019 at 10:17:18AM +0200, Miquel Raynal wrote:
> > Marco Felsch <m.felsch@pengutronix.de> wrote on Wed, 14 Aug 2019
> > 10:22:32 +0200:
> > > +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section,
> > > + struct mtd_oob_region *region)
> > > +{
> > > + if (section > 3)
> > > + return -ERANGE;
> > > +
> > > + region->offset = (section * 0x10) + 8;
> >
> > Any reason to use hex here? ^
> >
> > If not I would prefer decimal numbers.
>
> IMHO it is quite common to use hexadecimal also for register offsets,
> not only for register values.
>
> I checked a few drivers (drivers/mtd/nand/raw/mxc_nand.c,
> drivers/clk/meson/g12a.c, drivers/gpio/gpio-sch.c) and they all use hex
> also for the offsets, so it seems to be at least usual. Also as offsets
> for repeating registers are usually powers of two, hexadecimal constants
> are more suitable IMHO.
Absolutely. But here region->offset is not a register offset at all, it
is an indication for the upper layers of the position of an area within
a bigger buffer (here: where are the ECC bytes in my buffer in RAM). I
don't think hexadecimal numbers have any interest here.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-11-23 14:43 UTC | newest]
Thread overview: 14+ 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-21 23:56 ` sashiko-bot
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
-- strict thread matches above, loose matches on Subject: below --
2019-11-08 7:48 Marco Felsch
2019-08-14 8:22 Marco Felsch
2019-08-19 8:17 ` Miquel Raynal
2019-08-19 13:30 ` Marco Felsch
2019-08-19 14:34 ` Miquel Raynal
2019-08-20 6:39 ` Marco Felsch
2019-08-20 8:28 ` Uwe Kleine-König
2019-08-20 8:32 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox