aboutsummaryrefslogtreecommitdiff
path: root/drivers/fastboot/fb_nand.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/fastboot/fb_nand.c')
-rw-r--r--drivers/fastboot/fb_nand.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index c07655e49ed..2ee0d644e0c 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -31,7 +31,8 @@ __weak int board_fastboot_write_partition_setup(char *name)
static int fb_nand_lookup(const char *partname,
struct mtd_info **mtd,
- struct part_info **part)
+ struct part_info **part,
+ char *response)
{
struct mtd_device *dev;
int ret;
@@ -40,21 +41,21 @@ static int fb_nand_lookup(const char *partname,
ret = mtdparts_init();
if (ret) {
pr_err("Cannot initialize MTD partitions\n");
- fastboot_fail("cannot init mtdparts");
+ fastboot_fail("cannot init mtdparts", response);
return ret;
}
ret = find_dev_and_part(partname, &dev, &pnum, part);
if (ret) {
pr_err("cannot find partition: '%s'", partname);
- fastboot_fail("cannot find partition");
+ fastboot_fail("cannot find partition", response);
return ret;
}
if (dev->id->type != MTD_DEV_TYPE_NAND) {
pr_err("partition '%s' is not stored on a NAND device",
partname);
- fastboot_fail("not a NAND device");
+ fastboot_fail("not a NAND device", response);
return -EINVAL;
}
@@ -145,16 +146,16 @@ static lbaint_t fb_nand_sparse_reserve(struct sparse_storage *info,
}
void fb_nand_flash_write(const char *cmd, void *download_buffer,
- unsigned int download_bytes)
+ unsigned int download_bytes, char *response)
{
struct part_info *part;
struct mtd_info *mtd = NULL;
int ret;
- ret = fb_nand_lookup(cmd, &mtd, &part);
+ ret = fb_nand_lookup(cmd, &mtd, &part, response);
if (ret) {
pr_err("invalid NAND device");
- fastboot_fail("invalid NAND device");
+ fastboot_fail("invalid NAND device", response);
return;
}
@@ -180,9 +181,10 @@ void fb_nand_flash_write(const char *cmd, void *download_buffer,
sparse.start);
sparse.priv = &sparse_priv;
- ret = write_sparse_image(&sparse, cmd, download_buffer);
+ ret = write_sparse_image(&sparse, cmd, download_buffer,
+ response);
if (!ret)
- fastboot_okay("");
+ fastboot_okay(NULL, response);
} else {
printf("Flashing raw image at offset 0x%llx\n",
part->offset);
@@ -195,23 +197,23 @@ void fb_nand_flash_write(const char *cmd, void *download_buffer,
}
if (ret) {
- fastboot_fail("error writing the image");
+ fastboot_fail("error writing the image", response);
return;
}
- fastboot_okay("");
+ fastboot_okay(NULL, response);
}
-void fb_nand_erase(const char *cmd)
+void fb_nand_erase(const char *cmd, char *response)
{
struct part_info *part;
struct mtd_info *mtd = NULL;
int ret;
- ret = fb_nand_lookup(cmd, &mtd, &part);
+ ret = fb_nand_lookup(cmd, &mtd, &part, response);
if (ret) {
pr_err("invalid NAND device");
- fastboot_fail("invalid NAND device");
+ fastboot_fail("invalid NAND device", response);
return;
}
@@ -222,9 +224,9 @@ void fb_nand_erase(const char *cmd)
ret = _fb_nand_erase(mtd, part);
if (ret) {
pr_err("failed erasing from device %s", mtd->name);
- fastboot_fail("failed erasing from device");
+ fastboot_fail("failed erasing from device", response);
return;
}
- fastboot_okay("");
+ fastboot_okay(NULL, response);
}