mtd: spinand: add GD5F4GM7UExxG and XT26G04C
Subsystems (2)
cover mtd: spinand: add GD5F4GM7UExxG and XT26G04C
This series adds two 4Gbit 3.3V SPI NAND parts:
- GigaDevice GD5F4GM7UExxG
- XTX XT26G04C
Both have 4096 byte pages, 256 byte OOB and 8-bit on-die ECC. The GigaDevice part reuses existing code. The XTX part needs a new ECC status function.
Both parts are tested on STM32MP133 boards with UBI and UBIFS: full device read, write and read back, and a system update.
The same entries are sent to U-Boot.
Angelo Compagnucci (2):
mtd: spinand: gigadevice: add support for GD5F4GM7UExxG
mtd: spinand: xtx: add support for XT26G04C
drivers/mtd/nand/spi/gigadevice.c | 10 ++++++++++ drivers/mtd/nand/spi/xtx.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)
base-commit: 30daaf3e7897b4a8d9b72e5b0c86dd6e2a4d7d85
Signature · 1 line
2.53.0
PATCH 1/2 mtd: spinand: gigadevice: add support for GD5F4GM7UExxG
Add the GigaDevice GD5F4GM7UExxG. It is a 4Gbit 3.3V SPI NAND with 4096 byte pages and 256 byte OOB.
The ECC status works like on the GD5F4GM8. With ECC enabled, only the first 128 OOB bytes are free. The other 128 hold the ECC parity, like on the GD5F4GQ4xC. The Quad IO read needs two dummy bytes, like on the GD5F1GQ5.
The values come from the GigaDevice datasheet DS-01326, Rev 1.0.
Tested on an STM32MP133 board with UBI and UBIFS.
--- drivers/mtd/nand/spi/gigadevice.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mtd/nand/spi/gigadevice.c +10 -0
@@ -564,6 +564,16 @@ static const struct spinand_info gigadevice_spinand_table[] = { SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout, gd5fxgq4uexxg_ecc_get_status)), +SPINAND_INFO ("GD5F4GM7UExxG" , +SPINAND_ID (SPINAND_READID_METHOD_OPCODE_DUMMY ,0x94 ), +NAND_MEMORG (1 ,4096 ,256 ,64 ,2048 ,40 ,1 ,1 ,1 ), +NAND_ECCREQ (8 ,512 ), +SPINAND_INFO_OP_VARIANTS (&read_cache_variants_1gq5, + &write_cache_variants, + &update_cache_variants), +SPINAND_HAS_QE_BIT , +SPINAND_ECCINFO (&gd5fxgq4xc_oob_256_ops, + gd5fxgq4uexxg_ecc_get_status)), SPINAND_INFO("GD5F4GM8UExxG", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x95), NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
Signature · 1 line
2.53.0
PATCH 2/2 mtd: spinand: xtx: add support for XT26G04C
In reply to Angelo CompagnucciAdd the XTX XT26G04C. It is a 4Gbit 3.3V SPI NAND with 4096 byte pages, 256 byte OOB and 8-bit on-die ECC.
The status register reports the number of corrected bits in bits 7:4. Values 0 to 8 are valid and 0xf means an uncorrectable error. The other XTX parts use a different format, so add a new ECC status function.
The values come from the XTX XT26G04C datasheet, Rev 1.9.
Tested on an STM32MP133 board with UBI and UBIFS.
--- drivers/mtd/nand/spi/xtx.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/mtd/nand/spi/xtx.c +28 -0
@@ -22,6 +22,9 @@#define XT26XXXD_STATUS_ECC_8_CORRECTED (3)#define XT26XXXD_STATUS_ECC_UNCOR_ERROR (2) +#define XT26G0XC_STATUS_ECC_MASK GENMASK(7, 4) +#define XT26G0XC_STATUS_ECC_UNCOR_ERROR (0xf) + static SPINAND_OP_VARIANTS(read_cache_variants, SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 1, NULL, 0, 0), SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0, 0),
@@ -138,6 +141,21 @@ static int xt26xxxd_ecc_get_status(struct spinand_device *spinand,return -EINVAL ; } + +static int xt26g0xc_ecc_get_status (struct spinand_device *spinand, +u8 status) +{ +u8 eccsr =FIELD_GET (XT26G0XC_STATUS_ECC_MASK , status); + +if (eccsr <=8 ) +return eccsr; + +if (eccsr ==XT26G0XC_STATUS_ECC_UNCOR_ERROR ) +return -EBADMSG ; + +return -EINVAL ; +} +static const struct spinand_info xtx_spinand_table[] = { SPINAND_INFO("XT26G01A", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xE1),
@@ -249,6 +267,16 @@ static const struct spinand_info xtx_spinand_table[] = { 0, SPINAND_ECCINFO(&xt26xxxd_ooblayout, xt26xxxd_ecc_get_status)), +SPINAND_INFO ("XT26G04C" , +SPINAND_ID (SPINAND_READID_METHOD_OPCODE_ADDR ,0x13 ), +NAND_MEMORG (1 ,4096 ,256 ,64 ,2048 ,40 ,1 ,1 ,1 ), +NAND_ECCREQ (8 ,512 ), +SPINAND_INFO_OP_VARIANTS (&read_cache_variants, + &write_cache_variants, + &update_cache_variants), +SPINAND_HAS_QE_BIT , +SPINAND_ECCINFO (&xt26xxxd_ooblayout, + xt26g0xc_ecc_get_status)), };static const struct spinand_manufacturer_ops xtx_spinand_manuf_ops = {
Signature · 1 line
2.53.0
Quoted 10 lines · Angelo Compagnucci
This series adds two 4Gbit 3.3V SPI NAND parts:
- GigaDevice GD5F4GM7UExxG
- XTX XT26G04CBoth have 4096 byte pages, 256 byte OOB and 8-bit on-die ECC. The GigaDevice part reuses existing code. The XTX part needs a new ECC status function.
[...]
Applied to nand/next, thanks!
[1/2] mtd: spinand: gigadevice: add support for GD5F4GM7UExxG
commit: 3c8f7e833f0c6373bee90b897ce0697e2e697dcb
[2/2] mtd: spinand: xtx: add support for XT26G04C
commit: 2c6220ff6e7cbb287120a047e1da9509d66c4915Patche(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