From: NeilBrown <neilb@suse.de>
To: Paul Walmsley <paul@pwsan.com>
Cc: greg@kroah.com, khilman@ti.com, govindraj.raja@ti.com,
tomi.valkeinen@ti.com, linux-serial@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: patch "tty: serial: OMAP: ensure FIFO levels are set correctly in non-DMA" added to tty tree
Date: Sat, 4 Feb 2012 08:59:40 +1100 [thread overview]
Message-ID: <20120204085940.2de44594@notabene.brown> (raw)
In-Reply-To: <alpine.DEB.2.00.1202031255330.27947@utopia.booyaka.com>
[-- Attachment #1: Type: text/plain, Size: 2514 bytes --]
On Fri, 3 Feb 2012 13:10:28 -0700 (MST) Paul Walmsley <paul@pwsan.com> wrote:
> One other comment..
>
> On Fri, 3 Feb 2012, NeilBrown wrote:
>
> > On Thu, 2 Feb 2012 22:45:53 -0700 (MST) Paul Walmsley <paul@pwsan.com> wrote:
> >
> > > On Fri, 3 Feb 2012, NeilBrown wrote:
> > >
> > > > I can remove this effect with:
> > > >
> > > > diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> > > > index f809041..c7ef760 100644
> > > > --- a/drivers/tty/serial/omap-serial.c
> > > > +++ b/drivers/tty/serial/omap-serial.c
> > > > @@ -440,7 +440,8 @@ static unsigned int serial_omap_tx_empty(struct uart_port *port)
> > > > spin_lock_irqsave(&up->port.lock, flags);
> > > > ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
> > > > spin_unlock_irqrestore(&up->port.lock, flags);
> > > > - pm_runtime_put(&up->pdev->dev);
> > > > + pm_runtime_mark_last_busy(&up->pdev->dev);
> > > > + pm_runtime_put_autosuspend(&up->pdev->dev);
> > > > return ret;
> > > > }
>
> It's a little surprising that this helps. The pm_runtime_get*() and
> _put*() in serial_omap_tx_empty() are just intended to ensure that the
> UART's clocks are running for that LSR register read.
>
> Considering your theory that the UART clocks are being cut while there's
> still data in the FIFO, you might consider removing this code at the end
> of transmit_chars():
>
> if (uart_circ_empty(xmit))
> serial_omap_stop_tx(&up->port);
I read the code and chickened out of just removing that.
serial_omap_stop_tx seem to do 2 things:
1/ tell the uart to stop sending interrupts when the tx fifo is empty
2/ set forceidle (really smartidle) on the uart.
I didn't feel comfortable removing '1' as I thought it might generate an
interrupt storm .. maybe not.
Instead I just removed '2'. In fact I replaced the 'set_forceidle' call with
'set_noidle'. So the uart should never report that it was idle.
I did this with my other patch removed so pm_runtime_put() was still being
called.
Result: I still get corruption.
So having the UART say "no, I'm not idle" does *not* stop the clock
being turned off when we use omap_hwmod_idle() to turn off the clocks.
When we turn off a clock, if that is the last clock in the clock-domain, we
also turn off the clock-domain (I think).
Could it be that the clock-domain doesn't do any handshaking with modules,
and so turns off the clocks even though they are being used?
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: neilb@suse.de (NeilBrown)
To: linux-arm-kernel@lists.infradead.org
Subject: patch "tty: serial: OMAP: ensure FIFO levels are set correctly in non-DMA" added to tty tree
Date: Sat, 4 Feb 2012 08:59:40 +1100 [thread overview]
Message-ID: <20120204085940.2de44594@notabene.brown> (raw)
In-Reply-To: <alpine.DEB.2.00.1202031255330.27947@utopia.booyaka.com>
On Fri, 3 Feb 2012 13:10:28 -0700 (MST) Paul Walmsley <paul@pwsan.com> wrote:
> One other comment..
>
> On Fri, 3 Feb 2012, NeilBrown wrote:
>
> > On Thu, 2 Feb 2012 22:45:53 -0700 (MST) Paul Walmsley <paul@pwsan.com> wrote:
> >
> > > On Fri, 3 Feb 2012, NeilBrown wrote:
> > >
> > > > I can remove this effect with:
> > > >
> > > > diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> > > > index f809041..c7ef760 100644
> > > > --- a/drivers/tty/serial/omap-serial.c
> > > > +++ b/drivers/tty/serial/omap-serial.c
> > > > @@ -440,7 +440,8 @@ static unsigned int serial_omap_tx_empty(struct uart_port *port)
> > > > spin_lock_irqsave(&up->port.lock, flags);
> > > > ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
> > > > spin_unlock_irqrestore(&up->port.lock, flags);
> > > > - pm_runtime_put(&up->pdev->dev);
> > > > + pm_runtime_mark_last_busy(&up->pdev->dev);
> > > > + pm_runtime_put_autosuspend(&up->pdev->dev);
> > > > return ret;
> > > > }
>
> It's a little surprising that this helps. The pm_runtime_get*() and
> _put*() in serial_omap_tx_empty() are just intended to ensure that the
> UART's clocks are running for that LSR register read.
>
> Considering your theory that the UART clocks are being cut while there's
> still data in the FIFO, you might consider removing this code at the end
> of transmit_chars():
>
> if (uart_circ_empty(xmit))
> serial_omap_stop_tx(&up->port);
I read the code and chickened out of just removing that.
serial_omap_stop_tx seem to do 2 things:
1/ tell the uart to stop sending interrupts when the tx fifo is empty
2/ set forceidle (really smartidle) on the uart.
I didn't feel comfortable removing '1' as I thought it might generate an
interrupt storm .. maybe not.
Instead I just removed '2'. In fact I replaced the 'set_forceidle' call with
'set_noidle'. So the uart should never report that it was idle.
I did this with my other patch removed so pm_runtime_put() was still being
called.
Result: I still get corruption.
So having the UART say "no, I'm not idle" does *not* stop the clock
being turned off when we use omap_hwmod_idle() to turn off the clocks.
When we turn off a clock, if that is the last clock in the clock-domain, we
also turn off the clock-domain (I think).
Could it be that the clock-domain doesn't do any handshaking with modules,
and so turns off the clocks even though they are being used?
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120204/73feba82/attachment.sig>
next prev parent reply other threads:[~2012-02-03 21:59 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <13274430881471@kroah.org>
2012-01-26 3:02 ` patch "tty: serial: OMAP: ensure FIFO levels are set correctly in non-DMA" added to tty tree Paul Walmsley
2012-01-26 3:02 ` Paul Walmsley
2012-01-26 4:21 ` Greg KH
2012-01-26 4:21 ` Greg KH
2012-01-26 4:31 ` Paul Walmsley
2012-01-26 4:31 ` Paul Walmsley
2012-01-26 19:16 ` Greg KH
2012-01-26 19:16 ` Greg KH
2012-01-26 19:34 ` Paul Walmsley
2012-01-26 19:34 ` Paul Walmsley
2012-02-02 20:03 ` Paul Walmsley
2012-02-02 20:03 ` Paul Walmsley
2012-02-02 20:22 ` Greg KH
2012-02-02 20:22 ` Greg KH
2012-02-03 4:07 ` NeilBrown
2012-02-03 4:07 ` NeilBrown
2012-02-03 5:45 ` Paul Walmsley
2012-02-03 5:45 ` Paul Walmsley
2012-02-03 9:54 ` NeilBrown
2012-02-03 9:54 ` NeilBrown
2012-02-03 11:42 ` Grazvydas Ignotas
2012-02-03 11:42 ` Grazvydas Ignotas
2012-02-03 12:11 ` NeilBrown
2012-02-03 12:11 ` NeilBrown
2012-02-03 19:49 ` Paul Walmsley
2012-02-03 19:49 ` Paul Walmsley
2012-02-03 20:34 ` Paul Walmsley
2012-02-03 20:34 ` Paul Walmsley
2012-02-03 21:42 ` Paul Walmsley
2012-02-03 21:42 ` Paul Walmsley
2012-02-03 22:10 ` NeilBrown
2012-02-03 22:10 ` NeilBrown
2012-02-03 22:30 ` Paul Walmsley
2012-02-03 22:30 ` Paul Walmsley
2012-02-04 0:23 ` Woodruff, Richard
2012-02-04 0:23 ` Woodruff, Richard
2012-02-04 0:59 ` Paul Walmsley
2012-02-04 0:59 ` Paul Walmsley
2012-02-04 1:46 ` Woodruff, Richard
2012-02-04 1:46 ` Woodruff, Richard
2012-02-04 2:39 ` Paul Walmsley
2012-02-04 2:39 ` Paul Walmsley
2012-02-04 2:31 ` NeilBrown
2012-02-04 2:31 ` NeilBrown
2012-02-07 1:00 ` Woodruff, Richard
2012-02-07 1:00 ` Woodruff, Richard
2012-02-03 19:42 ` Paul Walmsley
2012-02-03 19:42 ` Paul Walmsley
2012-02-03 20:44 ` NeilBrown
2012-02-03 20:44 ` NeilBrown
2012-02-03 21:04 ` Paul Walmsley
2012-02-03 21:04 ` Paul Walmsley
2012-02-04 16:00 ` Grazvydas Ignotas
2012-02-04 16:00 ` Grazvydas Ignotas
2012-02-04 16:31 ` Paul Walmsley
2012-02-04 16:31 ` Paul Walmsley
2012-02-04 16:57 ` Russell King - ARM Linux
2012-02-04 16:57 ` Russell King - ARM Linux
2012-02-04 17:32 ` Paul Walmsley
2012-02-04 17:32 ` Paul Walmsley
2012-02-04 17:55 ` Russell King - ARM Linux
2012-02-04 17:55 ` Russell King - ARM Linux
2012-02-04 19:37 ` Paul Walmsley
2012-02-04 19:37 ` Paul Walmsley
2012-02-05 12:16 ` Russell King - ARM Linux
2012-02-05 12:16 ` Russell King - ARM Linux
2012-02-08 15:50 ` Paul Walmsley
2012-02-08 15:50 ` Paul Walmsley
2012-02-04 16:39 ` Russell King - ARM Linux
2012-02-04 16:39 ` Russell King - ARM Linux
2012-02-04 16:49 ` Paul Walmsley
2012-02-04 16:49 ` Paul Walmsley
2012-02-04 16:55 ` Paul Walmsley
2012-02-04 16:55 ` Paul Walmsley
2012-02-04 17:01 ` Russell King - ARM Linux
2012-02-04 17:01 ` Russell King - ARM Linux
2012-02-04 17:22 ` Paul Walmsley
2012-02-04 17:22 ` Paul Walmsley
2012-02-04 17:47 ` Russell King - ARM Linux
2012-02-04 17:47 ` Russell King - ARM Linux
2012-02-04 18:59 ` Tony Lindgren
2012-02-04 18:59 ` Tony Lindgren
2012-02-04 19:24 ` Paul Walmsley
2012-02-04 19:24 ` Paul Walmsley
2012-02-04 20:07 ` Russell King - ARM Linux
2012-02-04 20:07 ` Russell King - ARM Linux
2012-02-05 15:37 ` Woodruff, Richard
2012-02-05 15:37 ` Woodruff, Richard
2012-02-05 16:03 ` Russell King - ARM Linux
2012-02-05 16:03 ` Russell King - ARM Linux
2012-02-05 17:57 ` Woodruff, Richard
2012-02-05 17:57 ` Woodruff, Richard
2012-02-06 23:58 ` NeilBrown
2012-02-06 23:58 ` NeilBrown
2012-02-07 1:13 ` Woodruff, Richard
2012-02-07 1:13 ` Woodruff, Richard
2012-02-03 19:34 ` Paul Walmsley
2012-02-03 19:34 ` Paul Walmsley
2012-02-03 20:10 ` Paul Walmsley
2012-02-03 20:10 ` Paul Walmsley
2012-02-03 21:59 ` NeilBrown [this message]
2012-02-03 21:59 ` NeilBrown
2012-02-03 23:02 ` Paul Walmsley
2012-02-03 23:02 ` Paul Walmsley
2012-02-04 0:01 ` NeilBrown
2012-02-04 0:01 ` NeilBrown
2012-02-04 2:06 ` Paul Walmsley
2012-02-04 2:06 ` Paul Walmsley
2012-02-04 2:12 ` Paul Walmsley
2012-02-04 2:12 ` Paul Walmsley
2012-02-04 3:09 ` NeilBrown
2012-02-04 3:09 ` NeilBrown
2012-02-04 3:16 ` Paul Walmsley
2012-02-04 3:16 ` Paul Walmsley
2012-02-04 3:43 ` NeilBrown
2012-02-04 3:43 ` NeilBrown
2012-02-04 3:56 ` Paul Walmsley
2012-02-04 3:56 ` Paul Walmsley
2012-02-04 4:17 ` NeilBrown
2012-02-04 4:17 ` NeilBrown
2012-02-03 6:56 ` Govindraj
2012-02-03 6:56 ` Govindraj
2012-02-03 12:07 ` NeilBrown
2012-02-03 12:07 ` NeilBrown
2012-02-03 12:20 ` Russell King - ARM Linux
2012-02-03 12:20 ` Russell King - ARM Linux
2012-02-03 19:54 ` Paul Walmsley
2012-02-03 19:54 ` Paul Walmsley
2012-02-03 12:12 ` Felipe Contreras
2012-02-03 12:12 ` Felipe Contreras
2012-02-02 21:02 ` Greg KH
2012-02-02 21:02 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120204085940.2de44594@notabene.brown \
--to=neilb@suse.de \
--cc=govindraj.raja@ti.com \
--cc=greg@kroah.com \
--cc=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.