On 2017-12-18 at 10:41:48 +0100, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> wrote: > 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. While the above is true, I don't think your patch is entriely correct. Now we would write ALTERA_UART_STATUS_RRDY_MSK to the control register which would enable read-ready interrupts even in IRQ-less mode (see Table 69 in [1]). [1] https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_embedded_ip.pdf I think your patch also needs to make sure to not write the control (and only set ALTERA_UART_STATUS_RRDY_MSK in pp->imr) register if port->irq == 0. > Fixes: 2f8b9c15cd88 ("altera_uart: Add support for polling mode (IRQ-less)") > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > --- > 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 3e4b717670d7..3fa087a370b7 100644 > --- a/drivers/tty/serial/altera_uart.c > +++ b/drivers/tty/serial/altera_uart.c > @@ -311,20 +311,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) { > setup_timer(&pp->tmr, altera_uart_timer, (unsigned long)port); > 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); > -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html