Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab0a71f0 authored by Samuel Iglesias Gonsalvez's avatar Samuel Iglesias Gonsalvez Committed by Greg Kroah-Hartman
Browse files

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: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c1d784a
Loading
Loading
Loading
Loading
+36 −24
Original line number Original line Diff line number Diff line
@@ -134,9 +134,12 @@ static int ipoctal_get_icount(struct tty_struct *tty,
static void ipoctal_irq_rx(struct ipoctal_channel *channel,
static void ipoctal_irq_rx(struct ipoctal_channel *channel,
			   struct tty_struct *tty, u8 sr)
			   struct tty_struct *tty, u8 sr)
{
{
	unsigned char value = ioread8(&channel->regs->r.rhr);
	unsigned char value;
	unsigned char flag = TTY_NORMAL;
	unsigned char flag = TTY_NORMAL;
	u8 isr;


	do {
		value = ioread8(&channel->regs->r.rhr);
		/* Error: count statistics */
		/* Error: count statistics */
		if (sr & SR_ERROR) {
		if (sr & SR_ERROR) {
			iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
			iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
@@ -159,8 +162,17 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel,
				flag = TTY_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)
static void ipoctal_irq_tx(struct ipoctal_channel *channel)