From: Kees Jongenburger Date: Fri, 31 May 2013 14:20:38 +0000 (+0200) Subject: arm:tty enable FIFO X-Git-Tag: v3.3.0~932 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F619%2F4;p=minix.git arm:tty enable FIFO Change-Id: Iaaa7c0bcb40c2cce2423c1defc14809ed6c70e9c --- diff --git a/drivers/tty/arch/earm/omap_serial.h b/drivers/tty/arch/earm/omap_serial.h index bf5aee20f..9d4bb0992 100644 --- a/drivers/tty/arch/earm/omap_serial.h +++ b/drivers/tty/arch/earm/omap_serial.h @@ -27,7 +27,7 @@ #define OMAP3_SYSS 0x16 /* System status register */ /* Enhanced Features Register bits */ -#define UART_EFR_ECB 0x10 /* Enhanced control bit */ +#define UART_EFR_ECB (1 << 4)/* Enhanced control bit */ /* Interrupt Enable Register bits */ #define UART_IER_MSI 0x08 /* Modem status interrupt */ @@ -94,6 +94,7 @@ /* Line status register fields */ #define OMAP3_LSR_TX_FIFO_E (1 << 5) /* Transmit FIFO empty */ #define OMAP3_LSR_RX_FIFO_E (1 << 0) /* Receive FIFO empty */ +#define OMAP3_LSR_RXOE (1 << 1) /* Overrun error.*/ /* Supplementary status register fields */ #define OMAP3_SSR_TX_FIFO_FULL (1 << 0) /* Transmit FIFO full */ diff --git a/drivers/tty/arch/earm/rs232.c b/drivers/tty/arch/earm/rs232.c index fe294e7ab..46e5dec56 100644 --- a/drivers/tty/arch/earm/rs232.c +++ b/drivers/tty/arch/earm/rs232.c @@ -388,10 +388,11 @@ static void rs_config(rs232_t *rs) serial_out(rs, OMAP3_LCR, UART_LCR_CONF_MODE_A); /* 3 */ mcr = serial_in(rs, OMAP3_MCR); /* 4a */ serial_out(rs, OMAP3_MCR, mcr | UART_MCR_TCRTLR); /* 4b */ - /* Set up FIFO for 1 byte */ + /* Set up FIFO */ rs->fcr = 0; rs->fcr &= ~OMAP_UART_FCR_RX_FIFO_TRIG_MASK; rs->fcr |= (0x1 << OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT); + rs->fcr |= UART_FCR_ENABLE_FIFO; serial_out(rs, OMAP3_FCR, rs->fcr); /* 5 */ serial_out(rs, OMAP3_LCR, UART_LCR_CONF_MODE_B); /* 6 */ /* DMA triggers, not supported by this driver */ /* 7 */ @@ -735,11 +736,10 @@ static void read_chars(rs232_t *rs, unsigned int status) { unsigned char c; - unsigned int lsr; - - lsr = status; - if (lsr & UART_LSR_DR) { + /* check the line status to know if there are more chars */ + while (serial_in(rs, OMAP3_LSR) & UART_LSR_DR) { + assert( (serial_in(rs,OMAP3_LSR) & OMAP3_LSR_RXOE) == 0); c = serial_in(rs, OMAP3_RHR); if (!(rs->ostate & ORAW)) { if (c == rs->oxoff) { @@ -755,9 +755,15 @@ read_chars(rs232_t *rs, unsigned int status) return; } - if (++rs->icount == RS_IHIGHWATER && rs->idevready) istop(rs); + if (++rs->icount == RS_IHIGHWATER && rs->idevready) { + istop(rs); + } + *rs->ihead = c; - if (++rs->ihead == bufend(rs->ibuf)) rs->ihead = rs->ibuf; + if (++rs->ihead == bufend(rs->ibuf)) { + rs->ihead = rs->ibuf; + } + if (rs->icount == 1) { rs->tty->tty_events = 1; }