summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2019-07-30 19:16:50 +0200
committerPatrice Chotard <patrice.chotard@st.com>2019-08-27 11:19:23 +0200
commit37f41ae900388965dd07486004b65e5f11f9a82e (patch)
tree163f124cf694eb25c9667199fe58565625763b52
parent4b0496fe79a749b151126f38ceaccef4911aa504 (diff)
stm32mp1: ram: update loop management in infinite test
Reduce verbosity of the infinite tests to avoid CubeMX issue. test and display loop by 1024*1024 accesses: read or write. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
-rw-r--r--drivers/ram/stm32mp1/stm32mp1_tests.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c b/drivers/ram/stm32mp1/stm32mp1_tests.c
index 691c63c3ae..7356802257 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -1241,6 +1241,7 @@ static enum test_result test_read(struct stm32mp1_ddrctl *ctl,
u32 *addr;
u32 data;
u32 loop = 0;
+ int i, size = 1024 * 1024;
bool random = false;
if (get_addr(string, argc, argv, 0, (u32 *)&addr))
@@ -1254,14 +1255,19 @@ static enum test_result test_read(struct stm32mp1_ddrctl *ctl,
printf("running at 0x%08x\n", (u32)addr);
while (1) {
- if (random)
- addr = (u32 *)(STM32_DDR_BASE +
- (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
- data = readl(addr);
- if (test_loop_end(&loop, 0, 1000))
+ for (i = 0; i < size; i++) {
+ if (random)
+ addr = (u32 *)(STM32_DDR_BASE +
+ (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
+ data = readl(addr);
+ }
+ if (test_loop_end(&loop, 0, 1))
break;
}
- sprintf(string, "0x%x: %x", (u32)addr, data);
+ if (random)
+ sprintf(string, "%d loops random", loop);
+ else
+ sprintf(string, "%d loops at 0x%x: %x", loop, (u32)addr, data);
return TEST_PASSED;
}
@@ -1280,6 +1286,7 @@ static enum test_result test_write(struct stm32mp1_ddrctl *ctl,
u32 *addr;
u32 data = 0xA5A5AA55;
u32 loop = 0;
+ int i, size = 1024 * 1024;
bool random = false;
if (get_addr(string, argc, argv, 0, (u32 *)&addr))
@@ -1293,16 +1300,21 @@ static enum test_result test_write(struct stm32mp1_ddrctl *ctl,
printf("running at 0x%08x\n", (u32)addr);
while (1) {
- if (random) {
- addr = (u32 *)(STM32_DDR_BASE +
- (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
- data = rand();
+ for (i = 0; i < size; i++) {
+ if (random) {
+ addr = (u32 *)(STM32_DDR_BASE +
+ (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
+ data = rand();
+ }
+ writel(data, addr);
}
- writel(data, addr);
- if (test_loop_end(&loop, 0, 1000))
+ if (test_loop_end(&loop, 0, 1))
break;
}
- sprintf(string, "0x%x: %x", (u32)addr, data);
+ if (random)
+ sprintf(string, "%d loops random", loop);
+ else
+ sprintf(string, "%d loops at 0x%x: %x", loop, (u32)addr, data);
return TEST_PASSED;
}