.. | .. |
---|
29 | 29 | SPINAND_PROG_LOAD(false, 0, NULL, 0)); |
---|
30 | 30 | |
---|
31 | 31 | static int f50lxx41x_ooblayout_ecc(struct mtd_info *mtd, int section, |
---|
32 | | - struct mtd_oob_region *region) |
---|
| 32 | + struct mtd_oob_region *region) |
---|
33 | 33 | { |
---|
34 | 34 | if (section > 3) |
---|
35 | 35 | return -ERANGE; |
---|
.. | .. |
---|
41 | 41 | } |
---|
42 | 42 | |
---|
43 | 43 | static int f50lxx41x_ooblayout_free(struct mtd_info *mtd, int section, |
---|
44 | | - struct mtd_oob_region *region) |
---|
| 44 | + struct mtd_oob_region *region) |
---|
45 | 45 | { |
---|
46 | 46 | if (section > 3) |
---|
47 | 47 | return -ERANGE; |
---|
.. | .. |
---|
57 | 57 | .free = f50lxx41x_ooblayout_free, |
---|
58 | 58 | }; |
---|
59 | 59 | |
---|
| 60 | +static int f50l2g41ka_ooblayout_ecc(struct mtd_info *mtd, int section, |
---|
| 61 | + struct mtd_oob_region *region) |
---|
| 62 | +{ |
---|
| 63 | + if (section) |
---|
| 64 | + return -ERANGE; |
---|
| 65 | + |
---|
| 66 | + region->offset = mtd->oobsize / 2; |
---|
| 67 | + region->length = mtd->oobsize / 2; |
---|
| 68 | + |
---|
| 69 | + return 0; |
---|
| 70 | +} |
---|
| 71 | + |
---|
| 72 | +static int f50l2g41ka_ooblayout_free(struct mtd_info *mtd, int section, |
---|
| 73 | + struct mtd_oob_region *region) |
---|
| 74 | +{ |
---|
| 75 | + if (section) |
---|
| 76 | + return -ERANGE; |
---|
| 77 | + |
---|
| 78 | + region->offset = 2; |
---|
| 79 | + region->length = mtd->oobsize / 2 - 2; |
---|
| 80 | + |
---|
| 81 | + return 0; |
---|
| 82 | +} |
---|
| 83 | + |
---|
| 84 | +static const struct mtd_ooblayout_ops f50l2g41ka_ooblayout = { |
---|
| 85 | + .ecc = f50l2g41ka_ooblayout_ecc, |
---|
| 86 | + .free = f50l2g41ka_ooblayout_free, |
---|
| 87 | +}; |
---|
| 88 | + |
---|
| 89 | +/* |
---|
| 90 | + * ecc bits: 0xC0[4,6] |
---|
| 91 | + * [0b000], No bit errors were detected; |
---|
| 92 | + * [0b001] and [0b011], 1~6 Bit errors were detected and corrected. Not |
---|
| 93 | + * reach Flipping Bits; |
---|
| 94 | + * [0b101], Bit error count equals the bit flip |
---|
| 95 | + * detection threshold |
---|
| 96 | + * [0b010], Multiple bit errors were detected and |
---|
| 97 | + * not corrected. |
---|
| 98 | + * others, Reserved. |
---|
| 99 | + */ |
---|
| 100 | +static int f50l2g41ka_ecc_ecc_get_status(struct spinand_device *spinand, |
---|
| 101 | + u8 status) |
---|
| 102 | +{ |
---|
| 103 | + struct nand_device *nand = spinand_to_nand(spinand); |
---|
| 104 | + u8 eccsr = (status & GENMASK(6, 4)) >> 4; |
---|
| 105 | + |
---|
| 106 | + if (eccsr <= 1 || eccsr == 3) |
---|
| 107 | + return eccsr; |
---|
| 108 | + else if (eccsr == 5) |
---|
| 109 | + return nanddev_get_ecc_requirements(nand)->strength; |
---|
| 110 | + else |
---|
| 111 | + return -EBADMSG; |
---|
| 112 | +} |
---|
| 113 | + |
---|
60 | 114 | static const struct spinand_info esmt_spinand_table[] = { |
---|
61 | 115 | SPINAND_INFO("F50L1G41LB", |
---|
62 | 116 | SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x01), |
---|
.. | .. |
---|
67 | 121 | &update_cache_variants), |
---|
68 | 122 | 0, |
---|
69 | 123 | SPINAND_ECCINFO(&f50lxx41x_ooblayout, NULL)), |
---|
| 124 | + SPINAND_INFO("F50L2G41KA", |
---|
| 125 | + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x41, 0x7F), |
---|
| 126 | + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), |
---|
| 127 | + NAND_ECCREQ(8, 512), |
---|
| 128 | + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, |
---|
| 129 | + &write_cache_variants, |
---|
| 130 | + &update_cache_variants), |
---|
| 131 | + 0, |
---|
| 132 | + SPINAND_ECCINFO(&f50l2g41ka_ooblayout, f50l2g41ka_ecc_ecc_get_status)), |
---|
70 | 133 | }; |
---|
71 | 134 | |
---|
72 | 135 | static const struct spinand_manufacturer_ops esmt_spinand_manuf_ops = { |
---|