From: Lothar Waßmann Date: Thu, 30 Jun 2016 13:41:36 +0000 (+0200) Subject: karo: tx28: fix bugs in 'romupdate' command X-Git-Tag: KARO-TX-2016-07-05~3^2 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=ec116a5aff3a35eec5e958d5070f19d9c77c7e11 karo: tx28: fix bugs in 'romupdate' command --- diff --git a/board/karo/tx28/flash.c b/board/karo/tx28/flash.c index af9bb7285e..6539b24d31 100644 --- a/board/karo/tx28/flash.c +++ b/board/karo/tx28/flash.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Lothar Waßmann + * Copyright (C) 2011-2016 Lothar Waßmann * * See file CREDITS for list of people who contributed to this * project. @@ -354,9 +354,9 @@ static int tx28_prog_uboot(void *addr, int start_block, int skip, nand_erase_options_t erase_opts = { 0, }; size_t actual; size_t prg_length = max_len - skip * mtd->erasesize; - int prg_start = (start_block + skip) * mtd->erasesize; + int prg_start = start_block * mtd->erasesize; - erase_opts.offset = start_block * mtd->erasesize; + erase_opts.offset = (start_block - skip) * mtd->erasesize; erase_opts.length = max_len; erase_opts.quiet = 1; @@ -673,7 +673,7 @@ int do_update(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) printf("Programming redundant U-Boot image to block %lu @ %08llx\n", fw2_start_block, (u64)fw2_start_block * mtd->erasesize); - ret = tx28_prog_uboot(addr, fw2_start_block, fw2_skip, fw_num_blocks, + ret = tx28_prog_uboot(addr, fw2_start_block, fw2_skip, size, max_len2); out: free(buf);