[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1] xen/serial: Return actual bytes stored in TX FIFO for OMAP
This is intended to decrease a time spending in transmitter while waiting for the free space in TX FIFO. And as result to reduce the impact of hvc on the entire system running on OMAP5/DRA7XX based platforms. Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@xxxxxxxxxxxxxxx> CC: Ian Campbell <ian.campbell@xxxxxxxxxx> CC: Julien Grall <julien.grall@xxxxxxxxxx> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx> --- xen/drivers/char/omap-uart.c | 11 ++++++++++- xen/include/xen/8250-uart.h | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c index d8f64ea..8c542a7 100644 --- a/xen/drivers/char/omap-uart.c +++ b/xen/drivers/char/omap-uart.c @@ -233,11 +233,20 @@ static int omap_uart_tx_ready(struct serial_port *port) { struct omap_uart *uart = port->uart; uint32_t reg; + uint8_t cnt; reg = omap_read(uart, UART_IER); omap_write(uart, UART_IER, reg | UART_IER_ETHREI); - return omap_read(uart, UART_LSR) & UART_LSR_THRE ? uart->fifo_size : 0; + /* Check for empty space in TX FIFO */ + if ( omap_read(uart, UART_OMAP_SSR) & UART_OMAP_SSR_TX_FIFO_FULL_MASK ) + return 0; + + /* Check number of data bytes stored in TX FIFO */ + cnt = omap_read(uart, UART_OMAP_TXFIFO_LVL); + ASSERT( cnt >= 0 && cnt <= uart->fifo_size ); + + return (uart->fifo_size - cnt); } static void omap_uart_putc(struct serial_port *port, char c) diff --git a/xen/include/xen/8250-uart.h b/xen/include/xen/8250-uart.h index 304b9dd..700b2d4 100644 --- a/xen/include/xen/8250-uart.h +++ b/xen/include/xen/8250-uart.h @@ -143,6 +143,15 @@ /* Supplementary control register */ #define UART_OMAP_SCR 0x10 +/* Supplementary status register */ +#define UART_OMAP_SSR 0x11 + +/* Supplementary status register bitmasks */ +#define UART_OMAP_SSR_TX_FIFO_FULL_MASK (1 << 0) + +/* TX FIFO level register */ +#define UART_OMAP_TXFIFO_LVL 0x1A + /* SCR register bitmasks */ #define OMAP_UART_SCR_RX_TRIG_GRANU1_MASK (1 << 7) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |