| Index: linux-5.4.158/drivers/mtd/nand/spi/gigadevice.c |
| =================================================================== |
| --- linux-5.4.158.orig/drivers/mtd/nand/spi/gigadevice.c |
| +++ linux-5.4.158/drivers/mtd/nand/spi/gigadevice.c |
| @@ -36,6 +36,15 @@ static SPINAND_OP_VARIANTS(read_cache_va |
| SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0), |
| SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0)); |
| |
| +/* Q5 devices, QUADIO: Dummy bytes only valid for 1 GBit variants */ |
| +static SPINAND_OP_VARIANTS(gd5f1gq5_read_cache_variants, |
| + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), |
| + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), |
| + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_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, |
| SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), |
| SPINAND_PROG_LOAD(true, 0, NULL, 0)); |
| @@ -223,7 +232,54 @@ static int gd5fxgq4ufxxg_ecc_get_status( |
| return -EINVAL; |
| } |
| |
| +static int esmt_1_ooblayout_ecc(struct mtd_info *mtd, int section, |
| + struct mtd_oob_region *region) |
| +{ |
| + if (section > 3) |
| + return -ERANGE; |
| + |
| + region->offset = (16 * section) + 8; |
| + region->length = 8; |
| + |
| + return 0; |
| +} |
| + |
| +static int esmt_1_ooblayout_free(struct mtd_info *mtd, int section, |
| + struct mtd_oob_region *region) |
| +{ |
| + if (section > 3) |
| + return -ERANGE; |
| + |
| + region->offset = (16 * section) + 2; |
| + region->length = 6; |
| + |
| + return 0; |
| +} |
| + |
| +static const struct mtd_ooblayout_ops esmt_1_ooblayout = { |
| + .ecc = esmt_1_ooblayout_ecc, |
| + .free = esmt_1_ooblayout_free, |
| +}; |
| + |
| static const struct spinand_info gigadevice_spinand_table[] = { |
| + SPINAND_INFO("F50L1G41LB", 0x01, |
| + NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), |
| + NAND_ECCREQ(8, 512), |
| + SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants, |
| + &write_cache_variants, |
| + &update_cache_variants), |
| + 0, |
| + SPINAND_ECCINFO(&esmt_1_ooblayout, |
| + NULL)), |
| + SPINAND_INFO("GD5F1GQ5UExxG", 0x51, |
| + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), |
| + NAND_ECCREQ(4, 512), |
| + SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants, |
| + &write_cache_variants, |
| + &update_cache_variants), |
| + SPINAND_HAS_QE_BIT, |
| + SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout, |
| + gd5fxgq4xa_ecc_get_status)), |
| SPINAND_INFO("GD5F1GQ4xA", 0xF1, |
| NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), |
| NAND_ECCREQ(8, 512), |