From: Peter Hurley <peter@hurleysoftware.com>
To: Sudhir Sreedharan <ssreedharan@mvista.com>,
gregkh@linuxfoundation.org, khilman@kernel.org
Cc: linux-serial@vger.kernel.org, jslaby@suse.cz,
linux-kernel@vger.kernel.org, olof@lixom.net,
linux-arm-kernel@lists.infradead.org, geert@linux-m68k.org
Subject: Re: [PATCH] tty: serial: 8250_core: restore the LCR register in set_sleep
Date: Thu, 16 Oct 2014 08:35:35 -0400 [thread overview]
Message-ID: <543FBB97.9010006@hurleysoftware.com> (raw)
In-Reply-To: <1413355395-5871-1-git-send-email-ssreedharan@mvista.com>
On 10/15/2014 02:43 AM, Sudhir Sreedharan wrote:
> In ST16650V2 based serial uarts, while initalizing the PM state,
> LCR registers are being initialized to 0 in serial8250_set_sleep().
> If console port is already initialized and being used, this will
> throws garbage in the console.
>
> Signed-off-by: Sudhir Sreedharan <ssreedharan@mvista.com>
> ---
> drivers/tty/serial/8250/8250_core.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index ca5cfdc..e054482 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -595,6 +595,7 @@ static void serial8250_rpm_put_tx(struct uart_8250_port *p)
> */
> static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
> {
> + unsigned char lcr, efr;
> /*
> * Exar UARTs have a SLEEP register that enables or disables
> * each UART to enter sleep mode separately. On the XR17V35x the
> @@ -611,6 +612,8 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
>
> if (p->capabilities & UART_CAP_SLEEP) {
> if (p->capabilities & UART_CAP_EFR) {
> + lcr = serial_in(p, UART_LCR);
> + efr = serial_in(p, UART_EFR);
> serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
> serial_out(p, UART_EFR, UART_EFR_ECB);
> serial_out(p, UART_LCR, 0);
> @@ -618,8 +621,8 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
> serial_out(p, UART_IER, sleep ? UART_IERX_SLEEP : 0);
> if (p->capabilities & UART_CAP_EFR) {
> serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
> - serial_out(p, UART_EFR, 0);
> - serial_out(p, UART_LCR, 0);
> + serial_out(p, UART_EFR, sleep ? 0 : efr);
> + serial_out(p, UART_LCR, sleep ? 0 : lcr);
Why is it necessary to clear EFR and LCR here? Does the UART not
power down?
UARTs with CAP_SLEEP but not CAP_EFR don't clear LCR before sleep.
However, if there is some kind of intentional side-effect here,
then a comment should note that.
Regards,
Peter Hurley
> }
> }
> out:
>
WARNING: multiple messages have this Message-ID (diff)
From: peter@hurleysoftware.com (Peter Hurley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] tty: serial: 8250_core: restore the LCR register in set_sleep
Date: Thu, 16 Oct 2014 08:35:35 -0400 [thread overview]
Message-ID: <543FBB97.9010006@hurleysoftware.com> (raw)
In-Reply-To: <1413355395-5871-1-git-send-email-ssreedharan@mvista.com>
On 10/15/2014 02:43 AM, Sudhir Sreedharan wrote:
> In ST16650V2 based serial uarts, while initalizing the PM state,
> LCR registers are being initialized to 0 in serial8250_set_sleep().
> If console port is already initialized and being used, this will
> throws garbage in the console.
>
> Signed-off-by: Sudhir Sreedharan <ssreedharan@mvista.com>
> ---
> drivers/tty/serial/8250/8250_core.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index ca5cfdc..e054482 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -595,6 +595,7 @@ static void serial8250_rpm_put_tx(struct uart_8250_port *p)
> */
> static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
> {
> + unsigned char lcr, efr;
> /*
> * Exar UARTs have a SLEEP register that enables or disables
> * each UART to enter sleep mode separately. On the XR17V35x the
> @@ -611,6 +612,8 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
>
> if (p->capabilities & UART_CAP_SLEEP) {
> if (p->capabilities & UART_CAP_EFR) {
> + lcr = serial_in(p, UART_LCR);
> + efr = serial_in(p, UART_EFR);
> serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
> serial_out(p, UART_EFR, UART_EFR_ECB);
> serial_out(p, UART_LCR, 0);
> @@ -618,8 +621,8 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
> serial_out(p, UART_IER, sleep ? UART_IERX_SLEEP : 0);
> if (p->capabilities & UART_CAP_EFR) {
> serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
> - serial_out(p, UART_EFR, 0);
> - serial_out(p, UART_LCR, 0);
> + serial_out(p, UART_EFR, sleep ? 0 : efr);
> + serial_out(p, UART_LCR, sleep ? 0 : lcr);
Why is it necessary to clear EFR and LCR here? Does the UART not
power down?
UARTs with CAP_SLEEP but not CAP_EFR don't clear LCR before sleep.
However, if there is some kind of intentional side-effect here,
then a comment should note that.
Regards,
Peter Hurley
> }
> }
> out:
>
next prev parent reply other threads:[~2014-10-16 12:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-22 6:30 [PATCH] serial/core: Initialize the console pm state Sudhir Sreedharan
2014-10-01 17:27 ` Kevin Hilman
2014-10-01 17:27 ` Kevin Hilman
2014-10-03 4:35 ` Greg KH
2014-10-03 4:35 ` Greg KH
2014-10-03 12:22 ` Geert Uytterhoeven
2014-10-03 12:22 ` Geert Uytterhoeven
2014-10-06 9:48 ` Sudhir Sreedharan
2014-10-06 9:48 ` Sudhir Sreedharan
2014-10-06 9:27 ` Sudhir Sreedharan
2014-10-06 9:27 ` Sudhir Sreedharan
2014-10-09 13:42 ` Sudhir Sreedharan
2014-10-09 13:42 ` Sudhir Sreedharan
2014-10-09 13:45 ` [PATCH] tty: serial: 8250_core: Do not call set_sleep for console port Sudhir Sreedharan
2014-10-09 13:45 ` Sudhir Sreedharan
2014-10-09 14:45 ` Peter Hurley
2014-10-09 14:45 ` Peter Hurley
2014-10-15 6:43 ` [PATCH] tty: serial: 8250_core: restore the LCR register in set_sleep Sudhir Sreedharan
2014-10-15 6:43 ` Sudhir Sreedharan
2014-10-16 7:21 ` Kevin Hilman
2014-10-16 7:21 ` Kevin Hilman
2014-10-16 10:15 ` Sudhir Sreedharan
2014-10-16 10:15 ` Sudhir Sreedharan
2014-10-16 12:35 ` Peter Hurley [this message]
2014-10-16 12:35 ` Peter Hurley
2014-10-17 10:25 ` Sudhir Sreedharan
2014-10-17 10:25 ` Sudhir Sreedharan
2014-10-17 12:39 ` [PATCH v1] " Sudhir Sreedharan
2014-10-17 12:39 ` Sudhir Sreedharan
2014-10-17 12:46 ` Peter Hurley
2014-10-17 12:46 ` Peter Hurley
2014-10-20 15:01 ` Kevin Hilman
2014-10-20 15:01 ` Kevin Hilman
2014-10-21 6:45 ` Sudhir Sreedharan
2014-10-21 6:45 ` Sudhir Sreedharan
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=543FBB97.9010006@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=olof@lixom.net \
--cc=ssreedharan@mvista.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.