[PATCH 41/47] mtd: nand: stm_nand_bch: MTD erase (BCH)

From: Lee Jones
Date: Thu May 01 2014 - 06:01:00 EST


Carry out the normal checks, then attempt to erase a given block.

Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
---
drivers/mtd/nand/stm_nand_bch.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c
index e742655..11735ee 100644
--- a/drivers/mtd/nand/stm_nand_bch.c
+++ b/drivers/mtd/nand/stm_nand_bch.c
@@ -529,6 +529,16 @@ static uint8_t bch_erase_block(struct nandi_controller *nandi,
return status;
}

+static int bch_erase(struct mtd_info *mtd, int page)
+{
+ struct nand_chip *chip = mtd->priv;
+ struct nandi_controller *nandi = chip->priv;
+ uint32_t page_size = mtd->writesize;
+ loff_t offs = page * page_size;
+
+ return bch_erase_block(nandi, offs);
+}
+
/*
* Detect an erased page, tolerating and correcting up to a specified number of
* bits at '0'. (For many devices, it is now deemed within spec for an erased
@@ -1370,6 +1380,7 @@ static void nandi_set_mtd_defaults(struct nandi_controller *nandi,

chip->ecc.read_page = bch_read;
chip->write_page = bch_write;
+ chip->erase = bch_erase;

chip->scan_bbt = bch_scan_bbt;
}
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/