From: Lothar Waßmann Date: Mon, 16 Jun 2014 16:08:45 +0000 (+0200) Subject: karo: tx6: actually use 'skip' parameter in tx6_prog_uboot() to determine start of... X-Git-Tag: KARO-TX-2014-07-10~9^2 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=d045520b818bfcc2866635005fea95465ddbb07b karo: tx6: actually use 'skip' parameter in tx6_prog_uboot() to determine start of image in flash --- diff --git a/board/karo/tx6/flash.c b/board/karo/tx6/flash.c index a558cd9eea..ce90c4e6c9 100644 --- a/board/karo/tx6/flash.c +++ b/board/karo/tx6/flash.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012,2014 Lothar Waßmann + * Copyright (C) 2012-2014 Lothar Waßmann * * See file CREDITS for list of people who contributed to this * project. @@ -412,6 +412,8 @@ static int tx6_prog_uboot(void *addr, int start_block, int skip, int ret; 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; erase_opts.offset = start_block * mtd->erasesize; erase_opts.length = max_len; @@ -429,9 +431,8 @@ static int tx6_prog_uboot(void *addr, int start_block, int skip, (u64)start_block * mtd->erasesize, (u64)start_block * mtd->erasesize + size - 1, addr); actual = size; - ret = nand_write_skip_bad(mtd, start_block * mtd->erasesize, - &actual, NULL, erase_opts.length, addr, - WITH_DROP_FFS); + ret = nand_write_skip_bad(mtd, prg_start, &actual, NULL, + prg_length, addr, WITH_DROP_FFS); if (ret) { printf("Failed to program flash: %d\n", ret); return ret;