flash: nor: ath79: remove base calculation 21/4821/3
authorOleksij Rempel <linux@rempel-privat.de>
Wed, 26 Dec 2018 11:47:11 +0000 (12:47 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Wed, 2 Jan 2019 21:53:41 +0000 (21:53 +0000)
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 <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/4821
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
doc/openocd.texi
src/flash/nor/ath79.c
tcl/board/8devices-lima.cfg
tcl/board/dptechnics_dpt-board-v1.cfg
tcl/board/tp-link_tl-mr3020.cfg
tcl/board/tp-link_wdr4300.cfg

index 83f60520b712cdf0f1fadea1253694646479ce38..21b55dca01fda9609f4de9d9ecea5bbb4a9ab2d4 100644 (file)
@@ -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
 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.
 
 # 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
 flash bank flash1 ath79 0x10000000 0 0 0 $_TARGETNAME cs1
 flash bank flash2 ath79 0x20000000 0 0 0 $_TARGETNAME cs2
 @end example
index d73a4916fac1d2ebaf4147302dff9b533c823285..520f6c5b93732c179ed0ef65ddfe96ccf27a4a63 100644 (file)
@@ -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);
 
        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;
        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);
 
        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;
        if (target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
                return ERROR_TARGET_NOT_HALTED;
index 136f8619783d909ee28d32fb8908c497f381fff4..0d35cfbc14b18bafd3a46d8155d0ff48836f416b 100644 (file)
@@ -27,4 +27,4 @@ $_TARGETNAME configure -event reset-init {
 set ram_boot_address 0xa0000000
 $_TARGETNAME configure -work-area-phys 0xa1FFE000 -work-area-size 0x1000
 
 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
index de31c7c090a023eb77dd419e16759fb8fab9436e..21470b02b152b2c03da7c646e1d175fe103d589e 100644 (file)
@@ -29,4 +29,4 @@ $_TARGETNAME configure -event reset-init {
 set ram_boot_address 0xa0000000
 $_TARGETNAME configure -work-area-phys 0xa1FFE000 -work-area-size 0x1000
 
 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
index 48fb698937aba9b2b1c6fddcc0085f0f14607a53..366bec8e1a3917e529499a4ec503c62950f1c058 100644 (file)
@@ -9,4 +9,4 @@ $_TARGETNAME configure -event reset-init {
 set ram_boot_address 0xa0000000
 $_TARGETNAME configure -work-area-phys 0xa1FFE000 -work-area-size 0x1000
 
 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
index c317916206003032fb7fcca7bdb59758114bb97a..7aa79aba7a436ecd375c12db4da75f29a93e8033 100644 (file)
@@ -157,4 +157,4 @@ $_TARGETNAME configure -event reset-init {
 set ram_boot_address 0xa0000000
 $_TARGETNAME configure -work-area-phys 0x1d000000 -work-area-size 0x1000
 
 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

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)