From 8f777bc1a66b5f604fde8bbdbe64206413c8aa1c Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Wed, 26 Dec 2018 12:47:11 +0100 Subject: [PATCH] flash: nor: ath79: remove base calculation Currently it is impossible to flash ELF with correct offsets. The reason is a bogus offset calculation extracted from base. Since any other spi drivers do not care about base, do the same for ath79 as well. Change-Id: I9e46e01c9e7a709c2d07da9203c634f302603afd Signed-off-by: Oleksij Rempel Reviewed-on: http://openocd.zylin.com/4821 Tested-by: jenkins Reviewed-by: Tomas Vanek --- doc/openocd.texi | 4 ++-- src/flash/nor/ath79.c | 14 -------------- tcl/board/8devices-lima.cfg | 2 +- tcl/board/dptechnics_dpt-board-v1.cfg | 2 +- tcl/board/tp-link_tl-mr3020.cfg | 2 +- tcl/board/tp-link_wdr4300.cfg | 2 +- 6 files changed, 6 insertions(+), 20 deletions(-) diff --git a/doc/openocd.texi b/doc/openocd.texi index 83f60520b7..21b55dca01 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -5347,12 +5347,12 @@ since the alternate function must be enabled on the GPIO pin CS1/CS2 is routed to on the given SoC. @example -flash bank $_FLASHNAME ath79 0 0 0 0 $_TARGETNAME +flash bank $_FLASHNAME ath79 0xbf000000 0 0 0 $_TARGETNAME # When using multiple chipselects the base should be different for each, # otherwise the write_image command is not able to distinguish the # banks. -flash bank flash0 ath79 0x00000000 0 0 0 $_TARGETNAME cs0 +flash bank flash0 ath79 0xbf000000 0 0 0 $_TARGETNAME cs0 flash bank flash1 ath79 0x10000000 0 0 0 $_TARGETNAME cs1 flash bank flash2 ath79 0x20000000 0 0 0 $_TARGETNAME cs2 @end example diff --git a/src/flash/nor/ath79.c b/src/flash/nor/ath79.c index d73a4916fa..520f6c5b93 100644 --- a/src/flash/nor/ath79.c +++ b/src/flash/nor/ath79.c @@ -653,13 +653,6 @@ static int ath79_write(struct flash_bank *bank, const uint8_t *buffer, LOG_DEBUG("%s: offset=0x%08" PRIx32 " count=0x%08" PRIx32, __func__, offset, count); - if (offset < bank->base || offset >= bank->base + bank->size) { - LOG_ERROR("Start address out of range"); - return ERROR_FAIL; - } - - offset -= bank->base; - if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; @@ -729,13 +722,6 @@ static int ath79_read(struct flash_bank *bank, uint8_t *buffer, LOG_DEBUG("%s: offset=0x%08" PRIx32 " count=0x%08" PRIx32, __func__, offset, count); - if (offset < bank->base || offset >= bank->base + bank->size) { - LOG_ERROR("Start address out of range"); - return ERROR_FAIL; - } - - offset -= bank->base; - if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; diff --git a/tcl/board/8devices-lima.cfg b/tcl/board/8devices-lima.cfg index 136f861978..0d35cfbc14 100644 --- a/tcl/board/8devices-lima.cfg +++ b/tcl/board/8devices-lima.cfg @@ -27,4 +27,4 @@ $_TARGETNAME configure -event reset-init { set ram_boot_address 0xa0000000 $_TARGETNAME configure -work-area-phys 0xa1FFE000 -work-area-size 0x1000 -flash bank flash0 ath79 0 0 0 0 $_TARGETNAME cs0 +flash bank flash0 ath79 0xbf000000 0 0 0 $_TARGETNAME cs0 diff --git a/tcl/board/dptechnics_dpt-board-v1.cfg b/tcl/board/dptechnics_dpt-board-v1.cfg index de31c7c090..21470b02b1 100644 --- a/tcl/board/dptechnics_dpt-board-v1.cfg +++ b/tcl/board/dptechnics_dpt-board-v1.cfg @@ -29,4 +29,4 @@ $_TARGETNAME configure -event reset-init { set ram_boot_address 0xa0000000 $_TARGETNAME configure -work-area-phys 0xa1FFE000 -work-area-size 0x1000 -flash bank flash0 ath79 0 0 0 0 $_TARGETNAME cs0 +flash bank flash0 ath79 0xbf000000 0 0 0 $_TARGETNAME cs0 diff --git a/tcl/board/tp-link_tl-mr3020.cfg b/tcl/board/tp-link_tl-mr3020.cfg index 48fb698937..366bec8e1a 100644 --- a/tcl/board/tp-link_tl-mr3020.cfg +++ b/tcl/board/tp-link_tl-mr3020.cfg @@ -9,4 +9,4 @@ $_TARGETNAME configure -event reset-init { set ram_boot_address 0xa0000000 $_TARGETNAME configure -work-area-phys 0xa1FFE000 -work-area-size 0x1000 -flash bank flash0 ath79 0 0 0 0 $_TARGETNAME cs0 +flash bank flash0 ath79 0xbf000000 0 0 0 $_TARGETNAME cs0 diff --git a/tcl/board/tp-link_wdr4300.cfg b/tcl/board/tp-link_wdr4300.cfg index c317916206..7aa79aba7a 100644 --- a/tcl/board/tp-link_wdr4300.cfg +++ b/tcl/board/tp-link_wdr4300.cfg @@ -157,4 +157,4 @@ $_TARGETNAME configure -event reset-init { set ram_boot_address 0xa0000000 $_TARGETNAME configure -work-area-phys 0x1d000000 -work-area-size 0x1000 -flash bank flash0 ath79 0 0 0 0 $_TARGETNAME cs0 +flash bank flash0 ath79 0xbf000000 0 0 0 $_TARGETNAME cs0 -- 2.30.2