kernel: bump 5.4 to 5.4.92
[openwrt/openwrt.git] / target / linux / generic / pending-5.4 / 447-mtd-spinand-gigadevice-Add-support-for-GD5F4GQ4xC.patch
1 From 30521ccfb4597f91b9e5c7967acef9c7c85e58a8 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Wed, 12 Aug 2020 22:50:26 +0200
4 Subject: [PATCH v2 447/447] mtd: spinand: gigadevice: Add support for
5 GD5F4GQ4xC
6
7 This adds support for the following 4GiB chips:
8 GD5F4GQ4RCYIG 1.8V
9 GD5F4GQ4UCYIG 3.3V
10
11 The datasheet can be found here:
12 https://www.novitronic.ch/sixcms/media.php/2/DS-00173-GD5F4GQ4xCxIG-Rev1.574695.pdf
13
14 The GD5F4GQ4UCYIGT (3.3V) version is used on the Imagination
15 Technologies Creator Ci40 (Marduk), the 1.8V version was not tested.
16
17 This device only works in single SPI mode and not in dual or quad mode
18 for me on this board.
19
20 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
21 ---
22 drivers/mtd/nand/spi/gigadevice.c | 49 +++++++++++++++++++++++++++++++
23 1 file changed, 49 insertions(+)
24
25 --- a/drivers/mtd/nand/spi/gigadevice.c
26 +++ b/drivers/mtd/nand/spi/gigadevice.c
27 @@ -132,6 +132,35 @@ static const struct mtd_ooblayout_ops gd
28 .free = gd5fxgq4_variant2_ooblayout_free,
29 };
30
31 +static int gd5fxgq4xc_ooblayout_256_ecc(struct mtd_info *mtd, int section,
32 + struct mtd_oob_region *oobregion)
33 +{
34 + if (section)
35 + return -ERANGE;
36 +
37 + oobregion->offset = 128;
38 + oobregion->length = 128;
39 +
40 + return 0;
41 +}
42 +
43 +static int gd5fxgq4xc_ooblayout_256_free(struct mtd_info *mtd, int section,
44 + struct mtd_oob_region *oobregion)
45 +{
46 + if (section)
47 + return -ERANGE;
48 +
49 + oobregion->offset = 1;
50 + oobregion->length = 127;
51 +
52 + return 0;
53 +}
54 +
55 +static const struct mtd_ooblayout_ops gd5fxgq4xc_oob_256_ops = {
56 + .ecc = gd5fxgq4xc_ooblayout_256_ecc,
57 + .free = gd5fxgq4xc_ooblayout_256_free,
58 +};
59 +
60 static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
61 u8 status)
62 {
63 @@ -222,6 +251,24 @@ static const struct spinand_info gigadev
64 SPINAND_HAS_QE_BIT,
65 SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
66 gd5fxgq4xa_ecc_get_status)),
67 + SPINAND_INFO("GD5F4GQ4RC", 0xa468,
68 + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
69 + NAND_ECCREQ(8, 512),
70 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f,
71 + &write_cache_variants,
72 + &update_cache_variants),
73 + SPINAND_HAS_QE_BIT,
74 + SPINAND_ECCINFO(&gd5fxgq4xc_oob_256_ops,
75 + gd5fxgq4ufxxg_ecc_get_status)),
76 + SPINAND_INFO("GD5F4GQ4UC", 0xb468,
77 + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
78 + NAND_ECCREQ(8, 512),
79 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f,
80 + &write_cache_variants,
81 + &update_cache_variants),
82 + SPINAND_HAS_QE_BIT,
83 + SPINAND_ECCINFO(&gd5fxgq4xc_oob_256_ops,
84 + gd5fxgq4ufxxg_ecc_get_status)),
85 SPINAND_INFO("GD5F1GQ4UExxG", 0xd1,
86 NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
87 NAND_ECCREQ(8, 512),