From eefadcbca7f394fb9248384f2c759ebbe81e20c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 25 Jan 2018 14:30:45 +0100 Subject: [PATCH] serial: altera: set RRDY flag also without irq MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The UART can be operated without an irq. In this case a timer is setup that regularily calls altera_uart_interrupt(). The receiving part depends on pp->imr having the bit ALTERA_UART_STATUS_RRDY_MSK set, otherwise altera_uart_rx_chars() is never called. So ensure that the bit gets set (disguised as ALTERA_UART_CONTROL_RRDY_MSK) by not returning early from altera_uart_startup() if port->irq is 0. This doesn't affect the hardware as the ALTERA_UART_CONTROL_RRDY_MSK bit isn't actually written to the control register. Signed-off-by: Uwe Kleine-König Acked-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_uart.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 427843761d32..0e487ce091ac 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c @@ -321,20 +321,20 @@ static int altera_uart_startup(struct uart_port *port) { struct altera_uart *pp = container_of(port, struct altera_uart, port); unsigned long flags; - int ret; if (!port->irq) { timer_setup(&pp->tmr, altera_uart_timer, 0); mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port)); - return 0; - } - - ret = request_irq(port->irq, altera_uart_interrupt, 0, - DRV_NAME, port); - if (ret) { - pr_err(DRV_NAME ": unable to attach Altera UART %d " - "interrupt vector=%d\n", port->line, port->irq); - return ret; + } else { + int ret; + + ret = request_irq(port->irq, altera_uart_interrupt, 0, + DRV_NAME, port); + if (ret) { + pr_err(DRV_NAME ": unable to attach Altera UART %d " + "interrupt vector=%d\n", port->line, port->irq); + return ret; + } } spin_lock_irqsave(&port->lock, flags); -- 2.11.0