[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347454546-23236-21-git-send-email-siglesias@igalia.com>
Date: Wed, 12 Sep 2012 14:55:43 +0200
From: Samuel Iglesias Gonsalvez <siglesias@...lia.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
industrypack-devel@...ts.sourceforge.net,
Samuel Iglesias Gonsalvez <siglesias@...lia.com>
Subject: [PATCH 21/24] Staging: ipack/devices/ipoctal: read more than one character from RX FIFO.
The RX FIFO has a size of 3 characters. Check if when we are picking the
oldest one, we have more to read.
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@...lia.com>
---
drivers/staging/ipack/devices/ipoctal.c | 60 ++++++++++++++++++-------------
1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 8b2be61..4f79fad 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -134,33 +134,45 @@ static int ipoctal_get_icount(struct tty_struct *tty,
static void ipoctal_irq_rx(struct ipoctal_channel *channel,
struct tty_struct *tty, u8 sr)
{
- unsigned char value = ioread8(&channel->regs->r.rhr);
+ unsigned char value;
unsigned char flag = TTY_NORMAL;
-
- /* Error: count statistics */
- if (sr & SR_ERROR) {
- iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
-
- if (sr & SR_OVERRUN_ERROR) {
- channel->stats.overrun_err++;
- /* Overrun doesn't affect the current character*/
- tty_insert_flip_char(tty, 0, TTY_OVERRUN);
- }
- if (sr & SR_PARITY_ERROR) {
- channel->stats.parity_err++;
- flag = TTY_PARITY;
- }
- if (sr & SR_FRAMING_ERROR) {
- channel->stats.framing_err++;
- flag = TTY_FRAME;
+ u8 isr;
+
+ do {
+ value = ioread8(&channel->regs->r.rhr);
+ /* Error: count statistics */
+ if (sr & SR_ERROR) {
+ iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
+
+ if (sr & SR_OVERRUN_ERROR) {
+ channel->stats.overrun_err++;
+ /* Overrun doesn't affect the current character*/
+ tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+ }
+ if (sr & SR_PARITY_ERROR) {
+ channel->stats.parity_err++;
+ flag = TTY_PARITY;
+ }
+ if (sr & SR_FRAMING_ERROR) {
+ channel->stats.framing_err++;
+ flag = TTY_FRAME;
+ }
+ if (sr & SR_RECEIVED_BREAK) {
+ channel->stats.rcv_break++;
+ flag = TTY_BREAK;
+ }
}
- if (sr & SR_RECEIVED_BREAK) {
- channel->stats.rcv_break++;
- flag = TTY_BREAK;
- }
- }
+ tty_insert_flip_char(tty, value, flag);
- tty_insert_flip_char(tty, value, flag);
+ /* Check if there are more characters in RX FIFO
+ * If there are more, the isr register for this channel
+ * has enabled the RxRDY|FFULL bit.
+ */
+ isr = ioread8(&channel->block_regs->r.isr);
+ sr = ioread8(&channel->regs->r.sr);
+ } while (isr & channel->isr_rx_rdy_mask);
+
+ tty_flip_buffer_push(tty);
}
static void ipoctal_irq_tx(struct ipoctal_channel *channel)
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists