Message ID | 1533296325-2490-4-git-send-email-patrick.delaunay@st.com |
---|---|
State | Accepted |
Commit | 273a12526c6b6278a79f1bdf7f6cc50a32938b28 |
Delegated to: | Tom Rini |
Headers | show |
Series | Solve issue with serial rx buffer when MUX is deactivated | expand |
On 3 August 2018 at 05:38, Patrick Delaunay <patrick.delaunay@st.com> wrote: > Unify the fgetc function when MUX is activated or not: > - always call tstc() : it is the normal behavior expected > by serial uclass (call tstc then getc) and that avoids > issue when SERIAL_RX_BUFFER is activated > - reload WATCHDOG in the char waiting loop > > This patch allow to have the same behavior when CONSOLE_MUX is activated > or not and avoid regression when this feature is deactivated. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > --- > > common/console.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> I'm not sure how to test this with the various cases...
Hi Simon, > From: sjg@google.com <sjg@google.com> On Behalf Of Simon Glass > Sent: mercredi 8 août 2018 11:56 > To: Patrick DELAUNAY <patrick.delaunay@st.com> > On 3 August 2018 at 05:38, Patrick Delaunay <patrick.delaunay@st.com> wrote: > > Unify the fgetc function when MUX is activated or not: > > - always call tstc() : it is the normal behavior expected > > by serial uclass (call tstc then getc) and that avoids > > issue when SERIAL_RX_BUFFER is activated > > - reload WATCHDOG in the char waiting loop > > > > This patch allow to have the same behavior when CONSOLE_MUX is > > activated or not and avoid regression when this feature is deactivated. > > > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > > --- > > > > common/console.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > I'm not sure how to test this with the various cases... Yes it is a difficully and I don't know the process in this case, but at least the behavior (testc() function call) will be shared. If this change seens too risky, it can be dropped as only the PATCH 1/4 is mandatory to solve my issue. Regards, Patrick
On Fri, Aug 03, 2018 at 01:38:44PM +0200, Patrick Delaunay wrote: > Unify the fgetc function when MUX is activated or not: > - always call tstc() : it is the normal behavior expected > by serial uclass (call tstc then getc) and that avoids > issue when SERIAL_RX_BUFFER is activated > - reload WATCHDOG in the char waiting loop > > This patch allow to have the same behavior when CONSOLE_MUX is activated > or not and avoid regression when this feature is deactivated. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/common/console.c b/common/console.c index 7aa58d0..9a94f32 100644 --- a/common/console.c +++ b/common/console.c @@ -311,12 +311,12 @@ int serial_printf(const char *fmt, ...) int fgetc(int file) { if (file < MAX_FILES) { -#if CONFIG_IS_ENABLED(CONSOLE_MUX) /* * Effectively poll for input wherever it may be available. */ for (;;) { WATCHDOG_RESET(); +#if CONFIG_IS_ENABLED(CONSOLE_MUX) /* * Upper layer may have already called tstc() so * check for that first. @@ -324,6 +324,10 @@ int fgetc(int file) if (tstcdev != NULL) return console_getc(file); console_tstc(file); +#else + if (console_tstc(file)) + return console_getc(file); +#endif #ifdef CONFIG_WATCHDOG /* * If the watchdog must be rate-limited then it should @@ -332,9 +336,6 @@ int fgetc(int file) udelay(1); #endif } -#else - return console_getc(file); -#endif } return -1;
Unify the fgetc function when MUX is activated or not: - always call tstc() : it is the normal behavior expected by serial uclass (call tstc then getc) and that avoids issue when SERIAL_RX_BUFFER is activated - reload WATCHDOG in the char waiting loop This patch allow to have the same behavior when CONSOLE_MUX is activated or not and avoid regression when this feature is deactivated. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> --- common/console.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)