aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Ketola <timo@exertus.fi>2012-01-17 10:42:19 +0200
committerSpencer Oliver <spen@spen-soft.co.uk>2012-01-23 11:46:43 +0000
commit3c63eff2d97007c1ed9bea63388e97931dc67970 (patch)
tree7161bf14a263289f7ca0625fc3678859e74bbfbd /src
parent536ca77e38fee2967275c8e08354804adae87e82 (diff)
i.MX25: Set OOB size (MXC NFC)
SPAS register (OOB size) is left wrong after reset with respect to 2KiB page NAND chip. That will lead to ECC errors after 'reset halt'. Change-Id: If5a4685cb8d6be35879453951611ef1059da219c Signed-off-by: Timo Ketola <timo@exertus.fi> Reviewed-on: http://openocd.zylin.com/384 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nand/mxc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/flash/nand/mxc.c b/src/flash/nand/mxc.c
index b6694ca0..30170190 100644
--- a/src/flash/nand/mxc.c
+++ b/src/flash/nand/mxc.c
@@ -39,6 +39,7 @@
* !! all function only tested with 2k page nand device; mxc_write_page
* writes the 4 MAIN_BUFFER's and is not compatible with < 2k page
* !! oob must be be used due to NFS bug
+ * !! oob must be 64 bytes per 2KiB page
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -48,6 +49,8 @@
#include "mxc.h"
#include <target/target.h>
+#define OOB_SIZE 64
+
#define nfc_is_v1() (mxc_nf_info->mxc_version == MXC_VERSION_MX27 || \
mxc_nf_info->mxc_version == MXC_VERSION_MX31)
#define nfc_is_v2() (mxc_nf_info->mxc_version == MXC_VERSION_MX25 || \
@@ -732,6 +735,7 @@ static int initialize_nf_controller(struct nand_device *nand)
LOG_DEBUG("MXC_NF : work without ECC mode");
}
if (nfc_is_v2()) {
+ target_write_u16(target, MXC_NF_V2_SPAS, OOB_SIZE / 2);
if (nand->page_size) {
uint16_t pages_per_block = nand->erase_size / nand->page_size;
work_mode |= MXC_NF_V2_CFG1_PPB(ffs(pages_per_block) - 6);