Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: altera: set RRDY flag also without irq

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 <u.kleine-koenig@pengutronix.de>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
eefadcbc 2ea6ad8b

+9 -9
+9 -9
drivers/tty/serial/altera_uart.c
··· 321 321 { 322 322 struct altera_uart *pp = container_of(port, struct altera_uart, port); 323 323 unsigned long flags; 324 - int ret; 325 324 326 325 if (!port->irq) { 327 326 timer_setup(&pp->tmr, altera_uart_timer, 0); 328 327 mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port)); 329 - return 0; 330 - } 328 + } else { 329 + int ret; 331 330 332 - ret = request_irq(port->irq, altera_uart_interrupt, 0, 333 - DRV_NAME, port); 334 - if (ret) { 335 - pr_err(DRV_NAME ": unable to attach Altera UART %d " 336 - "interrupt vector=%d\n", port->line, port->irq); 337 - return ret; 331 + ret = request_irq(port->irq, altera_uart_interrupt, 0, 332 + DRV_NAME, port); 333 + if (ret) { 334 + pr_err(DRV_NAME ": unable to attach Altera UART %d " 335 + "interrupt vector=%d\n", port->line, port->irq); 336 + return ret; 337 + } 338 338 } 339 339 340 340 spin_lock_irqsave(&port->lock, flags);