From d045520b818bfcc2866635005fea95465ddbb07b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Mon, 16 Jun 2014 18:08:45 +0200 Subject: [PATCH] karo: tx6: actually use 'skip' parameter in tx6_prog_uboot() to determine start of image in flash --- board/karo/tx6/flash.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; -- 2.39.2