stm32mp: stm32prog: enable videoconsole
authorPatrick Delaunay <patrick.delaunay@st.com>
Wed, 18 Mar 2020 08:25:01 +0000 (09:25 +0100)
committerPatrick Delaunay <patrick.delaunay@st.com>
Thu, 14 May 2020 07:02:12 +0000 (09:02 +0200)
Enable the videoconsole during the stm32prog command execution
to have information without UART.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c

index 1769ba05f2899d4d83b74ff16c06809c368cfe6b..15bbdc2cb6565fe31ee28d4b9b88ab2895624451 100644 (file)
 
 struct stm32prog_data *stm32prog_data;
 
+static void enable_vidconsole(void)
+{
+#ifdef CONFIG_DM_VIDEO
+       char *stdname;
+       char buf[64];
+
+       stdname = env_get("stdout");
+       if (!stdname || !strstr(stdname, "vidconsole")) {
+               if (!stdname)
+                       snprintf(buf, sizeof(buf), "serial,vidconsole");
+               else
+                       snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
+               env_set("stdout", buf);
+       }
+
+       stdname = env_get("stderr");
+       if (!stdname || !strstr(stdname, "vidconsole")) {
+               if (!stdname)
+                       snprintf(buf, sizeof(buf), "serial,vidconsole");
+               else
+                       snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
+               env_set("stderr", buf);
+       }
+#endif
+}
+
 static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
                        char * const argv[])
 {
@@ -45,6 +71,8 @@ static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
        if (argc > 4)
                size = simple_strtoul(argv[4], NULL, 16);
 
+       enable_vidconsole();
+
        data = (struct stm32prog_data *)malloc(sizeof(*data));
 
        if (!data) {