summaryrefslogtreecommitdiffstats
path: root/commands/nandtest.c
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@googlemail.com>2012-10-22 09:23:32 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-23 08:27:33 +0200
commitb63fe60bef166c44effb83856bd2d1068fb829e7 (patch)
tree362baa22d8cdf9421e840d93f2c7fe39d8679467 /commands/nandtest.c
parentbbc7a434e60b7f356c9e7ede5d5a23cf146663e3 (diff)
downloadbarebox-b63fe60bef166c44effb83856bd2d1068fb829e7.tar.gz
nandtest: add another constraints check
Add check if writesize is a multiple of erasesize. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/nandtest.c')
-rw-r--r--commands/nandtest.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/commands/nandtest.c b/commands/nandtest.c
index f9c9318..f08f8eb 100644
--- a/commands/nandtest.c
+++ b/commands/nandtest.c
@@ -282,6 +282,13 @@ static int do_nandtest(int argc, char *argv[])
printf("Erasesize: 0x%08x\n", meminfo.erasesize);
printf("Starting nandtest...\n");
+ if (!IS_ALIGNED(meminfo.erasesize, meminfo.writesize)) {
+ printf("Erasesize 0x%08x is not a multiple "
+ "of writesize 0x%08x.\n"
+ "Please check driver implementation\n",
+ meminfo.erasesize, meminfo.writesize);
+ goto err;
+ }
if (!IS_ALIGNED(flash_offset, meminfo.erasesize)) {
printf("Offset 0x%08llx not multiple of erase size 0x%08x\n",
flash_offset, meminfo.erasesize);