]> Zhao Yanbai Git Server - minix.git/commitdiff
arm:tty enable FIFO 19/619/4
authorKees Jongenburger <kees.jongenburger@gmail.com>
Fri, 31 May 2013 14:20:38 +0000 (16:20 +0200)
committerGerrit Code Review <gerrit@gerrit>
Wed, 5 Jun 2013 17:19:38 +0000 (19:19 +0200)
Change-Id: Iaaa7c0bcb40c2cce2423c1defc14809ed6c70e9c

drivers/tty/arch/earm/omap_serial.h
drivers/tty/arch/earm/rs232.c

index bf5aee20f0406903cd5abcfac300d0b2b8e3739a..9d4bb0992189e51a86d6721d738f62fab2627a8a 100644 (file)
@@ -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 */
index fe294e7ab02e36cb21b66b82fc2f5c0a7167881f..46e5dec56754c7931c5eccb20d2ac16458a09f34 100644 (file)
@@ -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;
                }