summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2015-10-15 14:34:18 +0200
committerTom Rini <trini@konsulko.com>2015-11-12 13:18:58 -0500
commit6fb77c48e40c15afcc67bb8d3b5d7d300883d293 (patch)
tree909e7c13de8d7ca38e6e76487820325baac3db40
parentbf8940d35b91ef87e0e4e691c5d8cc356fcae035 (diff)
downloadu-boot-imx-6fb77c48e40c15afcc67bb8d3b5d7d300883d293.zip
u-boot-imx-6fb77c48e40c15afcc67bb8d3b5d7d300883d293.tar.gz
u-boot-imx-6fb77c48e40c15afcc67bb8d3b5d7d300883d293.tar.bz2
fastboot: nand: Add pre erase and write hooks
Some devices might need to do some per-partition initialization (ECC/Randomizer settings change for example) before actually accessing it. Add some hooks before the write and erase operations to let the boards define what they need to do if needed. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--common/fb_nand.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/fb_nand.c b/common/fb_nand.c
index 1c80ba9..57cbde0 100644
--- a/common/fb_nand.c
+++ b/common/fb_nand.c
@@ -23,6 +23,16 @@ struct fb_nand_sparse {
struct part_info *part;
};
+__weak int board_fastboot_erase_partition_setup(char *name)
+{
+ return 0;
+}
+
+__weak int board_fastboot_write_partition_setup(char *name)
+{
+ return 0;
+}
+
static int fb_nand_lookup(const char *partname, char *response,
nand_info_t **nand,
struct part_info **part)
@@ -134,6 +144,10 @@ void fb_nand_flash_write(const char *partname, unsigned int session_id,
return;
}
+ ret = board_fastboot_write_partition_setup(part->name);
+ if (ret)
+ return;
+
if (is_sparse_image(download_buffer)) {
struct fb_nand_sparse sparse_priv;
sparse_storage_t sparse;
@@ -184,6 +198,10 @@ void fb_nand_erase(const char *partname, char *response)
return;
}
+ ret = board_fastboot_erase_partition_setup(part->name);
+ if (ret)
+ return;
+
ret = _fb_nand_erase(nand, part);
if (ret) {
error("failed erasing from device %s", nand->name);