From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 4/4] ram: stm32mp1: add size and addr parameter to test all
Date: Thu, 2 Jul 2020 07:39:09 +0000 [thread overview]
Message-ID: <e176541f-4be9-514b-815a-8eadf6ec77ea@st.com> (raw)
In-Reply-To: <20200612103440.4.Id92de3d924b6867219d678a450c01fd8abe8c268@changeid>
Hi Patrick
On 6/12/20 10:34 AM, Patrick Delaunay wrote:
> Add size and addr parameter to test "All" to override the default
> value (4kB and STM32_DDR_BASE) used in tests with these optional
> parameters: [size] or [addr].
>
> When other optional parameters are present before [addr],
> they are replaced by default value:
> - [loop] = "1"
> - [pattern] = "-" (new: force default pattern)
>
> Example to use:
>
> DDR>test 0 1 0x20000
>
> DDR>test 0 1 0x1000000 0xD0000000
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
> drivers/ram/stm32mp1/stm32mp1_tests.c | 47 +++++++++++++++++++++++++--
> 1 file 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
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Thanks
next prev parent reply other threads:[~2020-07-02 7:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-12 8:34 [PATCH 1/4] ram: stm32mp1: protect minimum value in get_bufsize Patrick Delaunay
2020-06-12 8:34 ` [PATCH 2/4] ram: stm32mp1: add parameter addr in test FrequencySelectivePattern Patrick Delaunay
2020-07-02 7:35 ` Patrice CHOTARD
2020-06-12 8:34 ` [PATCH 3/4] ram: stm32mp1: use the DDR size by default in the test addressBus Patrick Delaunay
2020-07-02 7:38 ` Patrice CHOTARD
2020-06-12 8:34 ` [PATCH 4/4] ram: stm32mp1: add size and addr parameter to test all Patrick Delaunay
2020-07-02 7:39 ` Patrice CHOTARD [this message]
2020-07-02 7:33 ` [PATCH 1/4] ram: stm32mp1: protect minimum value in get_bufsize Patrice CHOTARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e176541f-4be9-514b-815a-8eadf6ec77ea@st.com \
--to=patrice.chotard@st.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.