memtest: Fix SDRAM size calculations
Calculating the size and end of the test region as

  end = PAGE_ALIGN_DOWN(bank->res->end) - 1;
  size = end - start + 1;

is wrong. For an example resource of

  start = 0x80000000, end = 0x8fffffff

end results in:

  end = PAGE_ALIGN_DOWN(0x8fffffff) - 1 = 0x8fffefff

instead of 0x8fffffff. The size is then calculated to

  size = end - start + 1 = 0x8fffefff - 0x80000000 + 1 = 0x0ffff000

instead of 0x10000000

The correct way to do this is to calculate the real size and apply a
PAGE_ALIGN_DOWN afterwards:

  size = PAGE_ALIGN_DOWN(bank->res->end - start + 1) = 0x10000000

Fix this in three different places.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent ec258b8 commit 33ddaad19a253468ca5c67782b8d26bb9aadba14
@Sascha Hauer Sascha Hauer authored on 26 Jan 2015
Showing 1 changed file
View
commands/memtest.c