lkml.org 
[lkml]   [2013]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] serial: 8250_dw: Improve unwritable LCR workaround
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@linux.intel.com> 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


\
 
 \ /
  Last update: 2013-09-27 10:21    [W:0.065 / U:14.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site