developer | 759668b | 2021-12-28 17:34:37 +0800 | [diff] [blame] | 1 | Index: linux-5.4.158/drivers/mtd/nand/spi/gigadevice.c |
| 2 | =================================================================== |
| 3 | --- linux-5.4.158.orig/drivers/mtd/nand/spi/gigadevice.c |
| 4 | +++ linux-5.4.158/drivers/mtd/nand/spi/gigadevice.c |
| 5 | @@ -36,6 +36,15 @@ static SPINAND_OP_VARIANTS(read_cache_va |
| 6 | SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0), |
| 7 | SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0)); |
| 8 | |
| 9 | +/* Q5 devices, QUADIO: Dummy bytes only valid for 1 GBit variants */ |
| 10 | +static SPINAND_OP_VARIANTS(gd5f1gq5_read_cache_variants, |
| 11 | + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), |
| 12 | + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), |
| 13 | + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), |
| 14 | + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), |
| 15 | + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), |
| 16 | + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); |
| 17 | + |
| 18 | static SPINAND_OP_VARIANTS(write_cache_variants, |
| 19 | SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), |
| 20 | SPINAND_PROG_LOAD(true, 0, NULL, 0)); |
developer | 391f42c | 2022-01-12 17:21:17 +0800 | [diff] [blame] | 21 | @@ -223,7 +232,54 @@ static int gd5fxgq4ufxxg_ecc_get_status( |
| 22 | return -EINVAL; |
developer | 759668b | 2021-12-28 17:34:37 +0800 | [diff] [blame] | 23 | } |
| 24 | |
developer | 391f42c | 2022-01-12 17:21:17 +0800 | [diff] [blame] | 25 | +static int esmt_1_ooblayout_ecc(struct mtd_info *mtd, int section, |
| 26 | + struct mtd_oob_region *region) |
| 27 | +{ |
| 28 | + if (section > 3) |
| 29 | + return -ERANGE; |
| 30 | + |
| 31 | + region->offset = (16 * section) + 8; |
| 32 | + region->length = 8; |
| 33 | + |
| 34 | + return 0; |
| 35 | +} |
| 36 | + |
| 37 | +static int esmt_1_ooblayout_free(struct mtd_info *mtd, int section, |
| 38 | + struct mtd_oob_region *region) |
| 39 | +{ |
| 40 | + if (section > 3) |
| 41 | + return -ERANGE; |
| 42 | + |
| 43 | + region->offset = (16 * section) + 2; |
| 44 | + region->length = 6; |
| 45 | + |
| 46 | + return 0; |
| 47 | +} |
| 48 | + |
| 49 | +static const struct mtd_ooblayout_ops esmt_1_ooblayout = { |
| 50 | + .ecc = esmt_1_ooblayout_ecc, |
developer | 94da18a | 2022-01-13 09:54:19 +0800 | [diff] [blame] | 51 | + .free = esmt_1_ooblayout_free, |
developer | 391f42c | 2022-01-12 17:21:17 +0800 | [diff] [blame] | 52 | +}; |
| 53 | + |
developer | 759668b | 2021-12-28 17:34:37 +0800 | [diff] [blame] | 54 | static const struct spinand_info gigadevice_spinand_table[] = { |
| 55 | + SPINAND_INFO("F50L1G41LB", 0x01, |
| 56 | + NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), |
| 57 | + NAND_ECCREQ(8, 512), |
| 58 | + SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants, |
| 59 | + &write_cache_variants, |
| 60 | + &update_cache_variants), |
| 61 | + 0, |
developer | 391f42c | 2022-01-12 17:21:17 +0800 | [diff] [blame] | 62 | + SPINAND_ECCINFO(&esmt_1_ooblayout, |
| 63 | + NULL)), |
developer | 759668b | 2021-12-28 17:34:37 +0800 | [diff] [blame] | 64 | + SPINAND_INFO("GD5F1GQ5UExxG", 0x51, |
| 65 | + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), |
| 66 | + NAND_ECCREQ(4, 512), |
| 67 | + SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants, |
| 68 | + &write_cache_variants, |
| 69 | + &update_cache_variants), |
| 70 | + SPINAND_HAS_QE_BIT, |
| 71 | + SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout, |
| 72 | + gd5fxgq4xa_ecc_get_status)), |
| 73 | SPINAND_INFO("GD5F1GQ4xA", 0xF1, |
| 74 | NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), |
| 75 | NAND_ECCREQ(8, 512), |