Skip to contentSkip to conversation

mtd: spinand: add support for HeYangTek HYF1GQ4UDACAE

PATCH Applied Aleksei Sviridkin 2 participants 2 messages Jun 16 – Jun 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: spinand: add support for HeYangTek HYF1GQ4UDACAE

The HeYangTek HYF1GQ4UDACAE is a 1 Gbit (128 MiB) SLC SPI-NAND with 2048 + 64 byte pages and on-die 4-bit / 512-byte ECC; its JEDEC manufacturer ID is 0xc9. The die is GD5F1GQ4-compatible, so the OOB layout is taken from the in-tree gd5fxgq4xa. The die exposes only a coarse 2-bit ECC status with no fine-grained bitflip-count register, so the status is decoded into a representative number of corrected bitflips.

It is found, among others, on some Keenetic KN-3411 (Buddy 6) units.

Datasheet:
https://www.heyangtek.cn/previewfile.jsp?file=ABUIABA9GAAgwsvRnwYo-eDpsgc

---
This revives Maxim Anisimov's 2024 submission [1], which stalled on the review feedback. Changes since then:

- The OOB layout no longer leaves undefined bytes: it is taken verbatim from the in-tree gd5fxgq4xa, which the die is compatible with (BBM in byte 0, ECC parity in bytes 8..15 of each 16-byte section, the rest exposed as free).
- The ECC status decoding is documented and uses '/' instead of a shift. The die exposes only the coarse 2-bit status with no register for the exact bitflip count, so the below-threshold code reports strength/2 and the refresh-recommended code reports the full strength.
- The datasheet link is added to the commit message.

Tested on a Keenetic KN-3411 (Buddy 6): the chip is detected and a UBIFS rootfs mounts and runs on it. nandbiterrs is not applicable here -- this is an on-die-ECC part with NOP=1, so the in-place raw page reprogram that nandbiterrs relies on corrupts the page independently of this driver.

[1] https://lore.kernel.org/linux-mtd/[email protected]/

 drivers/mtd/nand/spi/Makefile    |   2 +-
 drivers/mtd/nand/spi/core.c      |   1 +
 drivers/mtd/nand/spi/heyangtek.c | 132 +++++++++++++++++++++++++++++++
 include/linux/mtd/spinand.h      |   1 +
 4 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mtd/nand/spi/heyangtek.c
drivers/mtd/nand/spi/Makefile +1 -1
index a47bd22cd..b5ccb4486 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 spinand-objs := core.o otp.o
-spinand-objs += alliancememory.o ato.o dosilicon.o esmt.o fmsh.o foresee.o gigadevice.o
+spinand-objs += alliancememory.o ato.o dosilicon.o esmt.o fmsh.o foresee.o gigadevice.o heyangtek.o
 spinand-objs += macronix.o micron.o paragon.o skyhigh.o toshiba.o winbond.o xtx.o
 obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
drivers/mtd/nand/spi/core.c +1 -0
index 0b076790b..0cdd4a62e 100644
@@ -1336,6 +1336,7 @@ static const struct spinand_manufacturer *spinand_manufacturers[] = {
 	&fmsh_spinand_manufacturer,
 	&foresee_spinand_manufacturer,
 	&gigadevice_spinand_manufacturer,
+	&heyangtek_spinand_manufacturer,
 	&macronix_spinand_manufacturer,
 	&micron_spinand_manufacturer,
 	&paragon_spinand_manufacturer,
drivers/mtd/nand/spi/heyangtek.c new file +132 -0

132 lines not on this page · raw message

include/linux/mtd/spinand.h +1 -0
index 782984ba3..48357e6ff 100644
@@ -437,6 +437,7 @@ extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer;
 extern const struct spinand_manufacturer fmsh_spinand_manufacturer;
 extern const struct spinand_manufacturer foresee_spinand_manufacturer;
 extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
+extern const struct spinand_manufacturer heyangtek_spinand_manufacturer;
 extern const struct spinand_manufacturer macronix_spinand_manufacturer;
 extern const struct spinand_manufacturer micron_spinand_manufacturer;
 extern const struct spinand_manufacturer paragon_spinand_manufacturer;
Signature · 1 line
2.39.5
maintainer Applied
#1 lore raw
Quoted 8 lines · Aleksei Sviridkin

The HeYangTek HYF1GQ4UDACAE is a 1 Gbit (128 MiB) SLC SPI-NAND with 2048 + 64 byte pages and on-die 4-bit / 512-byte ECC; its JEDEC manufacturer ID is 0xc9. The die is GD5F1GQ4-compatible, so the OOB layout is taken from the in-tree gd5fxgq4xa. The die exposes only a coarse 2-bit ECC status with no fine-grained bitflip-count register, so the status is decoded into a representative number of corrected bitflips.

[...]

Applied to nand/next, thanks!

[1/1] mtd: spinand: add support for HeYangTek HYF1GQ4UDACAE

      commit: a8374683868634012ac873d628fa581fcc452e9c

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl