diff options
Diffstat (limited to 'arch/arm/mach-omap/am33xx_bbu_nand.c')
-rw-r--r-- | arch/arm/mach-omap/am33xx_bbu_nand.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/arch/arm/mach-omap/am33xx_bbu_nand.c b/arch/arm/mach-omap/am33xx_bbu_nand.c index 25f0e79ee6..7785d40f1f 100644 --- a/arch/arm/mach-omap/am33xx_bbu_nand.c +++ b/arch/arm/mach-omap/am33xx_bbu_nand.c @@ -62,21 +62,15 @@ static int write_image(const char *devfile, const void *image, size_t size) } /* - * This handler updates all given xload slots in nand with an image. + * Upate given nand partitions with an image */ -static int nand_xloadslots_update_handler(struct bbu_handler *handler, - struct bbu_data *data) +static int nand_slot_update_handler(struct bbu_handler *handler, + struct bbu_data *data) { - int ret = 0; + int ret, i; + struct nand_bbu_handler *nh; const void *image = data->image; size_t size = data->len; - struct nand_bbu_handler *nh; - int i = 0; - - if (file_detect_type(image, size) != filetype_ch_image) { - pr_err("%s is not a valid ch-image\n", data->imagefile); - return -EINVAL; - } nh = container_of(handler, struct nand_bbu_handler, bbu_handler); @@ -100,6 +94,23 @@ static int nand_xloadslots_update_handler(struct bbu_handler *handler, return 0; } +/* + * This handler updates all given xload slots in nand with an image. + */ +static int nand_xloadslots_update_handler(struct bbu_handler *handler, + struct bbu_data *data) +{ + const void *image = data->image; + size_t size = data->len; + + if (file_detect_type(image, size) != filetype_ch_image) { + pr_err("%s is not a valid ch-image\n", data->imagefile); + return -EINVAL; + } + + return nand_slot_update_handler(handler, data); +} + int am33xx_bbu_nand_xloadslots_register_handler(const char *name, char **devicefile, int num_devicefiles) @@ -124,32 +135,27 @@ int am33xx_bbu_nand_xloadslots_register_handler(const char *name, static int nand_update_handler(struct bbu_handler *handler, struct bbu_data *data) { - int ret = 0; const void *image = data->image; size_t size = data->len; - struct nand_bbu_handler *nh; if (file_detect_type(image, size) != filetype_arm_barebox) { pr_err("%s is not a valid barebox image\n", data->imagefile); return -EINVAL; } - nh = container_of(handler, struct nand_bbu_handler, bbu_handler); - - ret = bbu_confirm(data); - if (ret != 0) - return ret; - - return write_image(data->devicefile, image, size); + return nand_slot_update_handler(handler, data); } -int am33xx_bbu_nand_register_handler(const char *name, char *devicefile) +int am33xx_bbu_nand_slots_register_handler(const char *name, char **devicefile, + int num_devicefiles) { struct nand_bbu_handler *handler; int ret; handler = xzalloc(sizeof(*handler)); - handler->bbu_handler.devicefile = devicefile; + handler->devicefile = devicefile; + handler->num_devicefiles = num_devicefiles; + handler->bbu_handler.devicefile = devicefile[0]; handler->bbu_handler.handler = nand_update_handler; handler->bbu_handler.name = name; |