aboutsummaryrefslogtreecommitdiff
path: root/src/flash/cfi.c
diff options
context:
space:
mode:
authorkc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-22 17:48:26 +0000
committerkc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-22 17:48:26 +0000
commitc48ad46aa37a3ababe605f0d284aff830abed67d (patch)
tree0be4d8ed03423e7bc9b3c17ed88c734aa5ac9525 /src/flash/cfi.c
parentda5c37517ac2e2cfd67fcd9beefad5a97d15697c (diff)
downloadriscv-openocd-c48ad46aa37a3ababe605f0d284aff830abed67d.zip
riscv-openocd-c48ad46aa37a3ababe605f0d284aff830abed67d.tar.gz
riscv-openocd-c48ad46aa37a3ababe605f0d284aff830abed67d.tar.bz2
Author: Raúl Sánchez Siles <rsanchezs@infoglobal.es>
- Fix calculation of flash_address for x16 devices used as x8 git-svn-id: svn://svn.berlios.de/openocd/trunk@1885 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/cfi.c')
-rw-r--r--src/flash/cfi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/flash/cfi.c b/src/flash/cfi.c
index c51539f..7ae58f1 100644
--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -112,9 +112,11 @@ static void cfi_fixup(flash_bank_t *bank, cfi_fixup_t *fixups)
/* inline u32 flash_address(flash_bank_t *bank, int sector, u32 offset) */
static __inline__ u32 flash_address(flash_bank_t *bank, int sector, u32 offset)
{
+ cfi_flash_bank_t *cfi_info = bank->driver_priv;
+
/* while the sector list isn't built, only accesses to sector 0 work */
if (sector == 0)
- return bank->base + offset * bank->bus_width;
+ return bank->base + (offset * bank->bus_width << cfi_info->x16_as_x8 );
else
{
if (!bank->sectors)
@@ -122,7 +124,7 @@ static __inline__ u32 flash_address(flash_bank_t *bank, int sector, u32 offset)
LOG_ERROR("BUG: sector list not yet built");
exit(-1);
}
- return bank->base + bank->sectors[sector].offset + offset * bank->bus_width;
+ return bank->base + bank->sectors[sector].offset + (offset * bank->bus_width << cfi_info->x16_as_x8 );
}
}