summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-12 07:03:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-12 08:29:48 +0200
commit4e880df3470eb099c9934e6b37af87ab47255c52 (patch)
tree325ccd953ae643c9f0ec58bf4498b79bc9070b2f
parentc3400f3d6430af32baaa9f4a878561e9faca7500 (diff)
downloadbarebox-4e880df3470eb099c9934e6b37af87ab47255c52.tar.gz
barebox-4e880df3470eb099c9934e6b37af87ab47255c52.tar.xz
imx-bbu-nand-fcb: Erase whole partition
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@pengutronix.de>
-rw-r--r--common/imx-bbu-nand-fcb.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index d65b9cd91f..c4f49b551a 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;