blob: 2e888d38ce926a120831d62b39d49403c1bdb1ca [file] [log] [blame]
developer5d148cb2023-06-02 13:08:11 +08001From aebf853ada4f73280d4cf7a1799cb0ebf84f87e1 Mon Sep 17 00:00:00 2001
2From: Sam Shih <sam.shih@mediatek.com>
3Date: Fri, 2 Jun 2023 13:06:11 +0800
4Subject: [PATCH]
5 [spi-and-storage][999-2318-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch]
developer41370d52022-03-16 16:01:59 +08006
developer41370d52022-03-16 16:01:59 +08007---
8 drivers/mtd/nand/spi/micron.c | 28 ++++++++++++++--------------
9 1 file changed, 14 insertions(+), 14 deletions(-)
10
11diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
developer5d148cb2023-06-02 13:08:11 +080012index f56f81325..cc1ee6842 100644
developer41370d52022-03-16 16:01:59 +080013--- a/drivers/mtd/nand/spi/micron.c
14+++ b/drivers/mtd/nand/spi/micron.c
15@@ -34,38 +34,38 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
16 SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
17 SPINAND_PROG_LOAD(false, 0, NULL, 0));
18
19-static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
20- struct mtd_oob_region *region)
21+static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section,
22+ struct mtd_oob_region *region)
23 {
24 if (section)
25 return -ERANGE;
26
27- region->offset = 64;
28- region->length = 64;
29+ region->offset = mtd->oobsize / 2;
30+ region->length = mtd->oobsize / 2;
31
32 return 0;
33 }
34
35-static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section,
36- struct mtd_oob_region *region)
37+static int micron_8_ooblayout_free(struct mtd_info *mtd, int section,
38+ struct mtd_oob_region *region)
39 {
40 if (section)
41 return -ERANGE;
42
43 /* Reserve 2 bytes for the BBM. */
44 region->offset = 2;
45- region->length = 62;
46+ region->length = (mtd->oobsize / 2) - 2;
47
48 return 0;
49 }
50
51-static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = {
52- .ecc = mt29f2g01abagd_ooblayout_ecc,
53- .free = mt29f2g01abagd_ooblayout_free,
54+static const struct mtd_ooblayout_ops micron_8_ooblayout = {
55+ .ecc = micron_8_ooblayout_ecc,
56+ .free = micron_8_ooblayout_free,
57 };
58
59-static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
60- u8 status)
61+static int micron_8_ecc_get_status(struct spinand_device *spinand,
62+ u8 status)
63 {
64 switch (status & MICRON_STATUS_ECC_MASK) {
65 case STATUS_ECC_NO_BITFLIPS:
66@@ -99,8 +99,8 @@ static const struct spinand_info micron_spinand_table[] = {
67 &write_cache_variants,
68 &update_cache_variants),
69 0,
70- SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
71- mt29f2g01abagd_ecc_get_status)),
72+ SPINAND_ECCINFO(&micron_8_ooblayout,
73+ micron_8_ecc_get_status)),
74 };
75
76 static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
developer5d148cb2023-06-02 13:08:11 +080077--
782.34.1
79