From 21b62edb4b7f5d2fd6f0a0920cf27414fd6b8fd8 Mon Sep 17 00:00:00 2001 From: Jon Lin Date: Sat, 14 Sep 2024 17:33:38 +0800 Subject: [PATCH] mtd: spinand: GSTO: Support new device GSS01GSAX1 and GSS02GSAX1 Change-Id: I898bcc599fe338ef71012de0b170d08c888644bc Signed-off-by: Jon Lin --- drivers/mtd/nand/spi/gsto.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/mtd/nand/spi/gsto.c b/drivers/mtd/nand/spi/gsto.c index fc4098e22b38..56c0dcbbd0be 100644 --- a/drivers/mtd/nand/spi/gsto.c +++ b/drivers/mtd/nand/spi/gsto.c @@ -57,6 +57,35 @@ static const struct mtd_ooblayout_ops gss0xgsak1_ooblayout = { .free = gss0xgsak1_ooblayout_free, }; +static int gss0xgsax1_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section) + return -ERANGE; + + region->offset = 64; + region->length = 64; + + return 0; +} + +static int gss0xgsax1_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section) + return -ERANGE; + + region->offset = 2; + region->length = 62; + + return 0; +} + +static const struct mtd_ooblayout_ops gss0xgsax1_ooblayout = { + .ecc = gss0xgsax1_ooblayout_ecc, + .free = gss0xgsax1_ooblayout_free, +}; + static const struct spinand_info gsto_spinand_table[] = { SPINAND_INFO("GSS01GSAK1", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBA, 0x13), @@ -76,6 +105,24 @@ static const struct spinand_info gsto_spinand_table[] = { &update_cache_variants), 0, SPINAND_ECCINFO(&gss0xgsak1_ooblayout, NULL)), + SPINAND_INFO("GSS02GSAX1", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCA), + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&gss0xgsax1_ooblayout, NULL)), + SPINAND_INFO("GSS01GSAX1", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCA), + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&gss0xgsax1_ooblayout, NULL)), }; static const struct spinand_manufacturer_ops gsto_spinand_manuf_ops = {