aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Schonken <olivier.schonken@gmail.com>2012-09-12 21:56:50 +0200
committerFreddie Chopin <freddie.chopin@gmail.com>2012-10-07 07:23:12 +0000
commite69b94295ead882a2c3588249985a6d1215096c8 (patch)
treefaba3bfe2b6c4ee92b298e6b699d32ff89688541
parent6d1ea5a7a9e2158f5937af66cf0f642a05cd99d1 (diff)
Modified Sector Erase for AT91SAM4S
In FLASHD_ErasePages AT91C_EFC_FCMD_EPA is used to erase sectors. According to the datasheet FARG[15:2] defines the page from which the erase will start.This page must be modulo 4, 8, 16 or 32 according to the number of pages to erase. FARG[1:0] defines the number of pages to be erased. Previously (firstpage << 2) was used to conform to this, seems it should not be shifted... Changed it to (firstPage) | erasePages. Change-Id: I791cc7fc4faf056623ad5a6c7e860315306098a1 Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com> Reviewed-on: http://openocd.zylin.com/897 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
-rw-r--r--src/flash/nor/at91sam4.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c
index fd98b7f0..ce3c1d13 100644
--- a/src/flash/nor/at91sam4.c
+++ b/src/flash/nor/at91sam4.c
@@ -722,10 +722,17 @@ static int FLASHD_ErasePages(struct sam4_bank_private *pPrivate,
break;
}
+ /* AT91C_EFC_FCMD_EPA
+ * According to the datasheet FARG[15:2] defines the page from which
+ * the erase will start.This page must be modulo 4, 8, 16 or 32
+ * according to the number of pages to erase. FARG[1:0] defines the
+ * number of pages to be erased. Previously (firstpage << 2) was used
+ * to conform to this, seems it should not be shifted...
+ */
return EFC_PerformCommand(pPrivate,
/* send Erase Page */
AT91C_EFC_FCMD_EPA,
- (firstPage << 2) | erasePages,
+ (firstPage) | erasePages,
status);
}