[PATCH 09/12] mtd: spinand: micron: prepare for generalizing drive=

From: Shivamurthy Shastri
Date: Tue May 07 2019 - 09:19:22 EST


Generalize OOB layout structure and function names.

Signed-off-by: Shivamurthy Shastri <sshivamurthy@xxxxxxxxxx>
---
drivers/mtd/nand/spi/micron.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 7d7b1f7fcf71..95bc5264ebc1 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -34,38 +34,38 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0));
=20
-static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
- struct mtd_oob_region *region)
+static int micron_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
{
if (section)
return -ERANGE;
=20
- region->offset =3D 64;
- region->length =3D 64;
+ region->offset =3D mtd->oobsize / 2;
+ region->length =3D mtd->oobsize / 2;
=20
return 0;
}
=20
-static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section=
,
- struct mtd_oob_region *region)
+static int micron_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
{
if (section)
return -ERANGE;
=20
/* Reserve 2 bytes for the BBM. */
region->offset =3D 2;
- region->length =3D 62;
+ region->length =3D (mtd->oobsize / 2) - 2;
=20
return 0;
}
=20
-static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout =3D {
- .ecc =3D mt29f2g01abagd_ooblayout_ecc,
- .free =3D mt29f2g01abagd_ooblayout_free,
+static const struct mtd_ooblayout_ops micron_ooblayout_ops =3D {
+ .ecc =3D micron_ooblayout_ecc,
+ .free =3D micron_ooblayout_free,
};
=20
-static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
- u8 status)
+static int micron_ecc_get_status(struct spinand_device *spinand,
+ u8 status)
{
switch (status & MICRON_STATUS_ECC_MASK) {
case STATUS_ECC_NO_BITFLIPS:
@@ -98,8 +98,8 @@ static const struct spinand_info micron_spinand_table[] =
=3D {
&write_cache_variants,
&update_cache_variants),
0,
- SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
- mt29f2g01abagd_ecc_get_status)),
+ SPINAND_ECCINFO(&micron_ooblayout_ops,
+ micron_ecc_get_status)),
};
=20
static int micron_spinand_detect(struct spinand_device *spinand)
--=20
2.17.1