Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: spinand: gigadevice: Add support for GD5F4GQ4xC

This adds support for the following 4GiB chips:
GD5F4GQ4RCYIG 1.8V
GD5F4GQ4UCYIG 3.3V

The datasheet can be found here:
https://www.novitronic.ch/sixcms/media.php/2/DS-00173-GD5F4GQ4xCxIG-Rev1.574695.pdf

The GD5F4GQ4UCYIGT (3.3V) version is used on the Imagination
Technologies Creator Ci40 (Marduk), the 1.8V version was not tested.

This device only works in single SPI mode and not in dual or quad mode
for me on this board.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200820165121.3192-4-hauke@hauke-m.de

authored by

Hauke Mehrtens and committed by
Miquel Raynal
302d8a22 aea7687e

+49
+49
drivers/mtd/nand/spi/gigadevice.c
··· 132 132 .free = gd5fxgq4_variant2_ooblayout_free, 133 133 }; 134 134 135 + static int gd5fxgq4xc_ooblayout_256_ecc(struct mtd_info *mtd, int section, 136 + struct mtd_oob_region *oobregion) 137 + { 138 + if (section) 139 + return -ERANGE; 140 + 141 + oobregion->offset = 128; 142 + oobregion->length = 128; 143 + 144 + return 0; 145 + } 146 + 147 + static int gd5fxgq4xc_ooblayout_256_free(struct mtd_info *mtd, int section, 148 + struct mtd_oob_region *oobregion) 149 + { 150 + if (section) 151 + return -ERANGE; 152 + 153 + oobregion->offset = 1; 154 + oobregion->length = 127; 155 + 156 + return 0; 157 + } 158 + 159 + static const struct mtd_ooblayout_ops gd5fxgq4xc_oob_256_ops = { 160 + .ecc = gd5fxgq4xc_ooblayout_256_ecc, 161 + .free = gd5fxgq4xc_ooblayout_256_free, 162 + }; 163 + 135 164 static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand, 136 165 u8 status) 137 166 { ··· 254 225 SPINAND_HAS_QE_BIT, 255 226 SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout, 256 227 gd5fxgq4xa_ecc_get_status)), 228 + SPINAND_INFO("GD5F4GQ4RC", 229 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE, 0xa4, 0x68), 230 + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), 231 + NAND_ECCREQ(8, 512), 232 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f, 233 + &write_cache_variants, 234 + &update_cache_variants), 235 + SPINAND_HAS_QE_BIT, 236 + SPINAND_ECCINFO(&gd5fxgq4xc_oob_256_ops, 237 + gd5fxgq4ufxxg_ecc_get_status)), 238 + SPINAND_INFO("GD5F4GQ4UC", 239 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE, 0xb4, 0x68), 240 + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), 241 + NAND_ECCREQ(8, 512), 242 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f, 243 + &write_cache_variants, 244 + &update_cache_variants), 245 + SPINAND_HAS_QE_BIT, 246 + SPINAND_ECCINFO(&gd5fxgq4xc_oob_256_ops, 247 + gd5fxgq4ufxxg_ecc_get_status)), 257 248 SPINAND_INFO("GD5F1GQ4UExxG", 258 249 SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xd1), 259 250 NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),