summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-03-11 11:08:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-08 13:35:32 +0200
commit5c9b26378e5b80cc876ec2515047d8b2759ff47c (patch)
tree7e9abc2646282a760fabbc210815dff08c967b65 /common
parent9ec9e1b5dea426d96e8465b708aee03fe79f0044 (diff)
downloadbarebox-5c9b26378e5b80cc876ec2515047d8b2759ff47c.tar.gz
barebox-5c9b26378e5b80cc876ec2515047d8b2759ff47c.tar.xz
imx-bbu-nand-fcb: When writing firmware return new bad blocks
Positive return values of imx_bbu_write_firmware() so far indicate the last block that has been written to. This value is unused, so return values > 0 to indicate if there are new bad blocks. This information can be used in the next step to know if the DBBT has to be rewritten. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/imx-bbu-nand-fcb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 0c7f75c1d1..3e1f35fbea 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -400,7 +400,7 @@ static int imx_bbu_firmware_start_block(struct mtd_info *mtd, int num)
static int imx_bbu_write_firmware(struct mtd_info *mtd, unsigned num, void *buf,
size_t len)
{
- int ret, i;
+ int ret, i, newbadblock = 0;
int num_blocks = imx_bbu_firmware_max_blocks(mtd);
int block = imx_bbu_firmware_start_block(mtd, num);
@@ -437,6 +437,7 @@ static int imx_bbu_write_firmware(struct mtd_info *mtd, unsigned num, void *buf,
if (ret == -EIO) {
block++;
num_blocks--;
+ newbadblock = 1;
continue;
}
@@ -449,7 +450,7 @@ static int imx_bbu_write_firmware(struct mtd_info *mtd, unsigned num, void *buf,
num_blocks--;
}
- return block;
+ return newbadblock;
}
static void *dbbt_data_create(struct mtd_info *mtd)