Message ID | 1353397058-5177-1-git-send-email-koba@kmckk.co.jp |
---|---|
State | Accepted, archived |
Delegated to: | Nobuhiro Iwamatsu |
Headers | show |
On Tue, Nov 20, 2012 at 4:37 PM, Tetsuyuki Kobayashi <koba@kmckk.co.jp> wrote: > On kzm9g board (rmobile SoC), autoboot fails if serial console cable is not > connected. When serial cable is not connected, serial error occurs and > some garbage comes in data register. > sh_serial_tstc() in serial_sh.c does not check error status and misunderstand > there is some input data. It is the reason that autoboot fails. > This patch adds checking error status in sh_serial_tstc(). > > This patch is based on v2013.01-rc1 tag of u-boot master git. > > Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp> Applied, thanks. I will push this to v2013.01. Best regards, Nobuhiro
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index 3c931d0..ee1f2d7 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -117,6 +117,14 @@ static int serial_rx_fifo_level(void) return scif_rxfill(&sh_sci); } +static void handle_error(void) +{ + sci_in(&sh_sci, SCxSR); + sci_out(&sh_sci, SCxSR, SCxSR_ERROR_CLEAR(&sh_sci)); + sci_in(&sh_sci, SCLSR); + sci_out(&sh_sci, SCLSR, 0x00); +} + void serial_raw_putc(const char c) { while (1) { @@ -138,16 +146,14 @@ static void sh_serial_putc(const char c) static int sh_serial_tstc(void) { + if (sci_in(&sh_sci, SCxSR) & SCIF_ERRORS) { + handle_error(); + return 0; + } + return serial_rx_fifo_level() ? 1 : 0; } -void handle_error(void) -{ - sci_in(&sh_sci, SCxSR); - sci_out(&sh_sci, SCxSR, SCxSR_ERROR_CLEAR(&sh_sci)); - sci_in(&sh_sci, SCLSR); - sci_out(&sh_sci, SCLSR, 0x00); -} int serial_getc_check(void) {
On kzm9g board (rmobile SoC), autoboot fails if serial console cable is not connected. When serial cable is not connected, serial error occurs and some garbage comes in data register. sh_serial_tstc() in serial_sh.c does not check error status and misunderstand there is some input data. It is the reason that autoboot fails. This patch adds checking error status in sh_serial_tstc(). This patch is based on v2013.01-rc1 tag of u-boot master git. Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp> --- Hello Iwamatsu-san, I checked this patch only on kzm9g board. Other SH or rmobile SoC might have the same problem. drivers/serial/serial_sh.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)