[PATCH 09/10] imx-bbu-nand-fcb: Erase whole partition
Sascha Hauer
s.hauer at pengutronix.de
Thu Jun 11 23:35:45 PDT 2015
Now that we use a partition for the bootloader instead of
the whole NAND device we can erase it completely instead of
hardcoded 2MB.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
common/imx-bbu-nand-fcb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index d65b9cd..c4f49b5 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -275,11 +275,10 @@ static int fcb_create(struct imx_nand_fcb_bbu_handler *imx_handler,
static int imx_bbu_erase(struct mtd_info *mtd)
{
uint64_t offset = 0;
- int len = SZ_2M;
struct erase_info erase;
int ret;
- while (len > 0) {
+ while (offset < mtd->size) {
pr_debug("erasing at 0x%08llx\n", offset);
if (mtd_block_isbad(mtd, offset)) {
pr_debug("erase skip block @ 0x%08llx\n", offset);
@@ -296,7 +295,6 @@ static int imx_bbu_erase(struct mtd_info *mtd)
return ret;
offset += mtd->erasesize;
- len -= mtd->erasesize;
}
return 0;
--
2.1.4
More information about the barebox
mailing list