linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Govindraj <govindraj.ti@gmail.com>
To: NeilBrown <neilb@suse.de>
Cc: Paul Walmsley <paul@pwsan.com>, Greg KH <gregkh@suse.de>,
	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: Fri, 3 Feb 2012 12:26:14 +0530	[thread overview]
Message-ID: <CAAL8m4ztuB-kJvLGd=8PqPCLFcvPW9AQcdcFQ+e03vDT240vog@mail.gmail.com> (raw)
In-Reply-To: <20120203150708.386951d2@notabene.brown>

On Fri, Feb 3, 2012 at 9:37 AM, NeilBrown <neilb@suse.de> wrote:
> On Thu, 2 Feb 2012 13:03:01 -0700 (MST) Paul Walmsley <paul@pwsan.com> wrote:
>
>> Hi Greg,
>>
>> On Thu, 26 Jan 2012, Paul Walmsley wrote:
>>
>> > On Thu, 26 Jan 2012, Greg KH wrote:
>> >
>> > > Ok, I've just reverted both of these patches for now, please send new
>> > > ones when you have them.
>> >
>> > Thanks.  A pull request is at the bottom of this message.  The patches
>> > are also available from the mailing list archives here:
>> >
>> > http://marc.info/?l=linux-arm-kernel&m=132754676014389&w=2
>> > http://marc.info/?l=linux-arm-kernel&m=132754677914395&w=2
>> > http://marc.info/?l=linux-arm-kernel&m=132754676014388&w=2
>>
>> Any comments on these?
>
> Can I comment??...  They are good but ....
>
> I've tried two approaches to getting serial behaviour that I am happy with.
> They are with and without runtime pm.
>
> If I enable runtime pm by setting power/autosuspend_delay_ms (e.g. to 5000)
> then CPUIDLE enters lower states and I think it uses less power but I
> sometimes lose the first char I type (that is known) but also I sometimes get
> corruption on output.
>
> The problem seems to be that we turn off the clocks when the kernel's ring
> buffer is empty rather than waiting for the UART's fifo to be empty.
> So I get corruption near the end of a stream of output ... not right at the
> end so something must be turning the clocks back on somehow.
>
> 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;
>  }
>

But looking into it UART_LSR_TEMT("include/linux/serial_reg.h") => 0x40

from omap trm:

TX_SR_E => bit 6
"Read 0x1: Transmitter hold (TX FIFO) and shift registers are empty."

So it means all data from tx fifo has shifted out and no pending data in
tx fifo.

But we had used UART_LSR_THRE (0x20) here for tx fifo emptiness comparison
then  from omap trm

TX_FIFO_E => bit 5

"Read 0x1: Transmit hold register (TX FIFO) is empty.
The transmission is not necessarily complete"

So I think all data has been shifted out from tx fifo for
serial_omap_tx_empty check.

>
> i.e. when the tx buffer is empty, so turn the clocks off immediately, but
> wait a while for the fifo to empty.  Hopefully the auto-suspend time is
> enough.
>

[...]

>
> p.s. who should I formally submit OMAP-UART patches to?  I have a couple of
> others such as the below that I should submit somewhere.
>
>
> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
> index 247d894..35a649f 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -54,11 +54,9 @@
>
>  struct omap_uart_state {
>        int num;
> -       int can_sleep;
>
>        struct list_head node;
>        struct omap_hwmod *oh;
> -       struct platform_device *pdev;
>  };
>
>  static LIST_HEAD(uart_list);
> @@ -381,8 +379,6 @@ void __init omap_serial_init_port(struct omap_board_data *bd
>
>        oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
>
> -       uart->pdev = pdev;
> -
>        oh->dev_attr = uart;
>
>        if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)

Acked-by: Govindraj.R <govindraj.raja@ti.com>

Please post out this part as a patch,
I think this change has to go through linux-omap tree.

--
Thanks,
Govindraj.R
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-02-03  6:56 UTC|newest]

Thread overview: 66+ 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  4:21   ` Greg KH
2012-01-26  4:31     ` Paul Walmsley
2012-01-26 19:16       ` Greg KH
2012-01-26 19:34         ` Paul Walmsley
2012-02-02 20:03           ` Paul Walmsley
2012-02-02 20:22             ` Greg KH
2012-02-03  4:07             ` NeilBrown
2012-02-03  5:45               ` Paul Walmsley
2012-02-03  9:54                 ` NeilBrown
2012-02-03 11:42                   ` Grazvydas Ignotas
2012-02-03 12:11                     ` NeilBrown
2012-02-03 19:49                       ` Paul Walmsley
2012-02-03 20:34                         ` Paul Walmsley
2012-02-03 21:42                         ` Paul Walmsley
2012-02-03 22:10                           ` NeilBrown
2012-02-03 22:30                             ` Paul Walmsley
2012-02-04  0:23                       ` Woodruff, Richard
2012-02-04  0:59                         ` Paul Walmsley
2012-02-04  1:46                           ` Woodruff, Richard
2012-02-04  2:39                             ` Paul Walmsley
2012-02-04  2:31                         ` NeilBrown
2012-02-07  1:00                           ` Woodruff, Richard
2012-02-03 19:42                     ` Paul Walmsley
2012-02-03 20:44                       ` NeilBrown
2012-02-03 21:04                         ` Paul Walmsley
2012-02-04 16:00                       ` Grazvydas Ignotas
2012-02-04 16:31                         ` Paul Walmsley
2012-02-04 16:57                           ` Russell King - ARM Linux
2012-02-04 17:32                             ` Paul Walmsley
2012-02-04 17:55                               ` Russell King - ARM Linux
2012-02-04 19:37                                 ` Paul Walmsley
2012-02-05 12:16                                   ` Russell King - ARM Linux
2012-02-08 15:50                                 ` Paul Walmsley
2012-02-04 16:39                         ` Russell King - ARM Linux
2012-02-04 16:49                           ` Paul Walmsley
2012-02-04 16:55                             ` Paul Walmsley
2012-02-04 17:01                             ` Russell King - ARM Linux
2012-02-04 17:22                               ` Paul Walmsley
2012-02-04 17:47                                 ` Russell King - ARM Linux
2012-02-04 18:59                                   ` Tony Lindgren
2012-02-04 19:24                                   ` Paul Walmsley
2012-02-04 20:07                                     ` Russell King - ARM Linux
2012-02-05 15:37                           ` Woodruff, Richard
2012-02-05 16:03                             ` Russell King - ARM Linux
2012-02-05 17:57                               ` Woodruff, Richard
2012-02-06 23:58                                 ` NeilBrown
2012-02-07  1:13                                   ` Woodruff, Richard
2012-02-03 19:34                   ` Paul Walmsley
2012-02-03 20:10                   ` Paul Walmsley
2012-02-03 21:59                     ` NeilBrown
2012-02-03 23:02                       ` Paul Walmsley
2012-02-04  0:01                         ` NeilBrown
2012-02-04  2:06                           ` Paul Walmsley
2012-02-04  2:12                             ` Paul Walmsley
2012-02-04  3:09                             ` NeilBrown
2012-02-04  3:16                               ` Paul Walmsley
2012-02-04  3:43                                 ` NeilBrown
2012-02-04  3:56                                   ` Paul Walmsley
2012-02-04  4:17                                     ` NeilBrown
2012-02-03  6:56               ` Govindraj [this message]
2012-02-03 12:07                 ` NeilBrown
2012-02-03 12:20                   ` Russell King - ARM Linux
2012-02-03 19:54                     ` Paul Walmsley
2012-02-03 12:12               ` Felipe Contreras
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='CAAL8m4ztuB-kJvLGd=8PqPCLFcvPW9AQcdcFQ+e03vDT240vog@mail.gmail.com' \
    --to=govindraj.ti@gmail.com \
    --cc=govindraj.raja@ti.com \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=neilb@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).