summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ram/stm32mp1/stm32mp1_tests.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c b/drivers/ram/stm32mp1/stm32mp1_tests.c
index a2a69da9a3..952006aa14 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -14,6 +14,8 @@
#define ADDR_INVALID 0xFFFFFFFF
+#define PATTERN_DEFAULT "-"
+
DECLARE_GLOBAL_DATA_PTR;
static int get_bufsize(char *string, int argc, char *argv[], int arg_nb,
@@ -103,6 +105,10 @@ static int get_pattern(char *string, int argc, char *argv[], int arg_nb,
unsigned long value;
if (argc > arg_nb) {
+ if (!strcmp(argv[arg_nb], PATTERN_DEFAULT)) {
+ *pattern = default_pattern;
+ return 0;
+ }
if (strict_strtoul(argv[arg_nb], 16, &value) < 0) {
sprintf(string, "invalid %d parameter %s",
arg_nb, argv[arg_nb]);
@@ -1343,17 +1349,52 @@ static enum test_result test_all(struct stm32mp1_ddrctl *ctl,
char *string, int argc, char *argv[])
{
enum test_result res = TEST_PASSED, result;
- int i, nb_error = 0;
+ int i, j, nb_error = 0, len;
u32 loop = 0, nb_loop;
+ int argc_test;
+ char *argv_test[4];
+ char loop_string[] = "1";
+ char pattern_string[] = PATTERN_DEFAULT;
+ u32 *addr;
if (get_nb_loop(string, argc, argv, 0, &nb_loop, 1))
return TEST_ERROR;
+ if (get_addr(string, argc, argv, 2, (u32 *)&addr))
+ return TEST_ERROR;
+
while (!nb_error) {
/* execute all the test except the lasts which are infinite */
for (i = 1; i < test_nb - NB_TEST_INFINITE; i++) {
+ argc_test = 0;
+ j = 0;
+ len = strlen(test[i].usage);
+ if (argc > 1 && j < len &&
+ !strncmp("[size]", &test[i].usage[j], 6)) {
+ argv_test[argc_test++] = argv[1];
+ j += 7;
+ }
+ if (argc > 2) {
+ if (j < len &&
+ !strncmp("[loop]", &test[i].usage[j], 6)) {
+ argv_test[argc_test++] = loop_string;
+ j += 7;
+ }
+ if (j < len &&
+ !strncmp("[pattern]", &test[i].usage[j],
+ 9)) {
+ argv_test[argc_test++] = pattern_string;
+ j += 10;
+ }
+ if (j < len &&
+ !strncmp("[addr]", &test[i].usage[j], 6)) {
+ argv_test[argc_test++] = argv[2];
+ j += 7;
+ }
+ }
printf("execute %d:%s\n", (int)i, test[i].name);
- result = test[i].fct(ctl, phy, string, 0, NULL);
+ result = test[i].fct(ctl, phy, string,
+ argc_test, argv_test);
printf("result %d:%s = ", (int)i, test[i].name);
if (result != TEST_PASSED) {
nb_error++;
@@ -1384,7 +1425,7 @@ static enum test_result test_all(struct stm32mp1_ddrctl *ctl,
****************************************************************/
const struct test_desc test[] = {
- {test_all, "All", "[loop]", "Execute all tests", 1 },
+ {test_all, "All", "[loop] [size] [addr]", "Execute all tests", 3 },
{test_databus, "Simple DataBus", "[addr]",
"Verifies each data line by walking 1 on fixed address",
1