Commit d3137043 authored by Shivamurthy Shastri's avatar Shivamurthy Shastri Committed by Miquel Raynal
Browse files

mtd: spinand: micron: Generalize the OOB layout structure and function names



In order to add new Micron SPI NAND devices, we generalized the OOB
layout structure and function names.

Signed-off-by: default avatarShivamurthy Shastri <sshivamurthy@micron.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-2-sshivamurthy@micron.com
parent a5d53ad2
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -34,19 +34,19 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
		SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
		SPINAND_PROG_LOAD(false, 0, NULL, 0));

static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section,
				  struct mtd_oob_region *region)
{
	if (section)
		return -ERANGE;

	region->offset = 64;
	region->length = 64;
	region->offset = mtd->oobsize / 2;
	region->length = mtd->oobsize / 2;

	return 0;
}

static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section,
static int micron_8_ooblayout_free(struct mtd_info *mtd, int section,
				   struct mtd_oob_region *region)
{
	if (section)
@@ -54,17 +54,17 @@ static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section,

	/* Reserve 2 bytes for the BBM. */
	region->offset = 2;
	region->length = 62;
	region->length = (mtd->oobsize / 2) - 2;

	return 0;
}

static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = {
	.ecc = mt29f2g01abagd_ooblayout_ecc,
	.free = mt29f2g01abagd_ooblayout_free,
static const struct mtd_ooblayout_ops micron_8_ooblayout = {
	.ecc = micron_8_ooblayout_ecc,
	.free = micron_8_ooblayout_free,
};

static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
static int micron_8_ecc_get_status(struct spinand_device *spinand,
				   u8 status)
{
	switch (status & MICRON_STATUS_ECC_MASK) {
@@ -99,8 +99,8 @@ static const struct spinand_info micron_spinand_table[] = {
					      &write_cache_variants,
					      &update_cache_variants),
		     0,
		     SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
				     mt29f2g01abagd_ecc_get_status)),
		     SPINAND_ECCINFO(&micron_8_ooblayout,
				     micron_8_ecc_get_status)),
};

static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {