@@ -59,6 +59,7 @@
#include <linux/sizes.h>
#include <linux/io.h>
#include <linux/acpi.h>
+#include <linux/debugfs.h>
#include "amba-pl011.h"
@@ -73,6 +74,8 @@
#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
#define UART_DUMMY_DR_RX (1 << 16)
+static u32 rxis_count, rtis_count;
+
static u16 pl011_std_offsets[REG_ARRAY_SIZE] = {
[REG_DR] = UART01x_DR,
[REG_FR] = UART01x_FR,
@@ -325,15 +328,13 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
* inserts them into the TTY layer. Returns the number of characters
* read from the FIFO.
*/
-static int pl011_fifo_to_tty(struct uart_amba_port *uap)
+static int pl011_fifo_to_tty(struct uart_amba_port *uap, int avail)
{
- u16 status;
unsigned int ch, flag, max_count = 256;
int fifotaken = 0;
while (max_count--) {
- status = pl011_read(uap, REG_FR);
- if (status & UART01x_FR_RXFE)
+ if (avail-- <= 0 && (pl011_read(uap, REG_FR) & UART01x_FR_RXFE))
break;
/* Take chars from the FIFO and update status */
@@ -954,7 +955,7 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
* will always find the error in the FIFO, never in the DMA
* buffer.
*/
- fifotaken = pl011_fifo_to_tty(uap);
+ fifotaken = pl011_fifo_to_tty(uap, 0);
}
spin_unlock(&uap->port.lock);
@@ -1361,11 +1362,11 @@ static void pl011_enable_ms(struct uart_port *port)
pl011_write(uap->im, uap, REG_IMSC);
}
-static void pl011_rx_chars(struct uart_amba_port *uap)
+static void pl011_rx_chars(struct uart_amba_port *uap, int avail)
__releases(&uap->port.lock)
__acquires(&uap->port.lock)
{
- pl011_fifo_to_tty(uap);
+ pl011_fifo_to_tty(uap, avail);
spin_unlock(&uap->port.lock);
tty_flip_buffer_push(&uap->port.state->port);
@@ -1515,8 +1516,15 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
if (status & (UART011_RTIS|UART011_RXIS)) {
if (pl011_dma_rx_running(uap))
pl011_dma_rx_irq(uap);
- else
- pl011_rx_chars(uap);
+ else {
+ if (status & UART011_RXIS)
+ ++rxis_count;
+ else
+ ++rtis_count;
+
+ pl011_rx_chars(uap,
+ (status & UART011_RXIS) ? 16 : 1);
+ }
}
if (status & (UART011_DSRMIS|UART011_DCDMIS|
UART011_CTSMIS|UART011_RIMIS))
@@ -2822,6 +2830,9 @@ static int __init pl011_init(void)
{
printk(KERN_INFO "Serial: AMBA PL011 UART driver\n");
+ debugfs_create_u32("pl011-rxis", 0444, NULL, &rxis_count);
+ debugfs_create_u32("pl011-rtis", 0444, NULL, &rtis_count);
+
if (platform_driver_register(&arm_sbsa_uart_platform_driver))
pr_warn("could not register SBSA UART platform driver\n");
return amba_driver_register(&pl011_driver);