From patchwork Wed Mar 18 08:25:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 243786 List-Id: U-Boot discussion From: patrick.delaunay at st.com (Patrick Delaunay) Date: Wed, 18 Mar 2020 09:25:01 +0100 Subject: [PATCH 16/18] stm32mp: stm32prog: enable videoconsole In-Reply-To: <20200318082503.8025-1-patrick.delaunay@st.com> References: <20200318082503.8025-1-patrick.delaunay@st.com> Message-ID: <20200318082503.8025-17-patrick.delaunay@st.com> Enable the videoconsole during the stm32prog command execution to have information without UART. Signed-off-by: Patrick Delaunay --- .../cmd_stm32prog/cmd_stm32prog.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index 1769ba05f2..15bbdc2cb6 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -11,6 +11,32 @@ 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) {