Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tony Lindgren <tony@atomide.com>,
	Rajendra Nayak <rnayak@ti.com>, Felipe Balbi <balbi@ti.com>,
	Kevin Hilman <khilman@linaro.org>
Subject: Re: [PATCH 2/2] serial: omap: fix wrong context restoration on init
Date: Fri, 12 Jul 2013 15:11:46 +0300	[thread overview]
Message-ID: <20130712121146.GC17053@arwen.pp.htv.fi> (raw)
In-Reply-To: <1373630142-21765-2-git-send-email-grygorii.strashko@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]

hi,

On Fri, Jul 12, 2013 at 02:55:42PM +0300, Grygorii Strashko wrote:
> Since commit a630fbf "serial: omap: Fix device tree based PM runtime"
> the OMAP serial driver will always try to restore its context in
> serial_omap_runtime_resume(). But the problem is that during driver
> initialization the UART context is not ready yet and, as result, first
> call to pm_runtime_get*() will cause UART register overwriting by all
> zeros. This causes Kernel boot hang in case if "earlyprintk" feature is
> enabled at least [1].
> 
> Unfortunately, there is no exact place in driver now where we can
> determine that UART context is ready - most of registers configured in
> serial_omap_set_termios(), but some of them in other places.
> More over, even if PM runtime will be disabled (blocked) during OMAP
> serial driver probe() execution [2],[3] it will fix only console UART,
> but context of other UARTs will be overwriting by all zeros during first
> access to the corresponding UART.
> 
> To fix this issue:
> - introduce additional "initialized" flag and update PM runtime callback
> to do nothing if its not set. Set "initialized" at the end of probe().
> - read current UART registers configuration in probe and use it by
> default.
> 
> [1] http://www.spinics.net/lists/arm-kernel/msg256828.html
> [2] http://www.spinics.net/lists/arm-kernel/msg258062.html
> [3] http://www.spinics.net/lists/arm-kernel/msg258040.html
> 
> CC: Tony Lindgren <tony@atomide.com>
> CC: Rajendra Nayak <rnayak@ti.com>
> CC: Felipe Balbi <balbi@ti.com>
> CC: Kevin Hilman <khilman@linaro.org>
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> tested on OMAP4 SDP with and without earlyprintk enabled.
>  drivers/tty/serial/omap-serial.c |   27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index f39bf0c..e1e9667 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -162,6 +162,7 @@ struct uart_omap_port {
>  	struct work_struct	qos_work;
>  	struct pinctrl		*pins;
>  	bool			is_suspending;
> +	bool			initialized;

you really think adding this sort of bool flag is the best thing we can
do ? Something which will, quite likely, spread through every single
driver ?

oh well...

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-07-12 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 11:55 [PATCH 1/2] serial: omap: enable PM runtime only when its fully configured Grygorii Strashko
2013-07-12 11:55 ` [PATCH 2/2] serial: omap: fix wrong context restoration on init Grygorii Strashko
2013-07-12 12:11   ` Felipe Balbi [this message]
2013-07-26 23:00     ` Greg Kroah-Hartman

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=20130712121146.GC17053@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=grygorii.strashko@ti.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rnayak@ti.com \
    --cc=tony@atomide.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