Hi, On Wed, Sep 25, 2013 at 03:47:14PM -0700, Tim Kryger wrote: > On Wed, Sep 25, 2013 at 4:42 AM, Heikki Krogerus > <heikki.krogerus@xxxxxxxxxxxxxxx> wrote: > > On Tue, Sep 24, 2013 at 05:39:09PM -0700, Tim Kryger wrote: > >> static void dw8250_serial_out(struct uart_port *p, int offset, int value) > >> { > >> struct dw8250_data *d = p->private_data; > >> > >> - if (offset == UART_LCR) > >> - d->last_lcr = value; > >> - > >> - if (offset == UART_MCR) > >> - d->last_mcr = value; > >> - > >> - writeb(value, p->membase + (offset << p->regshift)); > >> + if (offset == UART_LCR) { > >> + int tries = 1000; > >> + while (tries--) { > >> + if (value == p->serial_in(p, UART_LCR)) > >> + return; > >> + dw8250_force_idle(p); > >> + writeb(value, p->membase + (UART_LCR << p->regshift)); > >> + } > >> + dev_err(p->dev, "Couldn't set LCR to %d\n", value); > > > > Is it not enough to simply poll USR[0] to see when the UART becomes > > free? > > Unfortunately not. The LCR is modified while holding the spinlock > with local interrupts disabled so the ISR is deprived of the > opportunity to empty the FIFO. > > Given that the hardware will never become idle so long as there are > characters in the RX FIFO, the only option is to forcibly empty it > here. OK. The LCR issue is only a problem when the UART is configured with the busy functionality (UART_16550_COMPATIBLE == NO). Otherwise LRC is always accessible and this is not necessary. We need a flag for the UART_16550_COMPATIBLE configuration, and use this WA based on that. Thanks, -- heikki -- 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