summaryrefslogtreecommitdiff
path: root/drivers/serial/serial_sh.c
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2012-12-10 13:44:41 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2012-12-10 14:13:27 +0900
commit2c601c7208713ba9b2158c57adcf515f4bdbc212 (patch)
tree9f6e70f33565beceb956b98c261bee19731d50d2 /drivers/serial/serial_sh.c
parentb8a7c467960ffb4d5a5e1eef5f7783fb6f594542 (diff)
parentfd4d564b3c80b111f18c93adb14233a6a7ddb0e9 (diff)
downloadu-boot-imx-2c601c7208713ba9b2158c57adcf515f4bdbc212.zip
u-boot-imx-2c601c7208713ba9b2158c57adcf515f4bdbc212.tar.gz
u-boot-imx-2c601c7208713ba9b2158c57adcf515f4bdbc212.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot into resolve
Conflicts: README board/samsung/universal_c210/universal.c drivers/misc/Makefile drivers/power/power_fsl.c include/configs/mx35pdk.h include/configs/mx53loco.h include/configs/seaboard.h
Diffstat (limited to 'drivers/serial/serial_sh.c')
-rw-r--r--drivers/serial/serial_sh.c20
1 files changed, 13 insertions, 7 deletions
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)
{