All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Valentin <edubezval@gmail.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Linux PM <linux-pm@vger.kernel.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Shenwei Wang <shenwei.wang@freescale.com>
Subject: Re: [PATCH 5/8] serial: imx: save and restore context in the suspend path
Date: Sun, 9 Aug 2015 21:04:05 -0700	[thread overview]
Message-ID: <20150810040404.GA5943@localhost.localdomain> (raw)
In-Reply-To: <CAOMZO5D18DCBXYLA8Z36ZY3wezzS9Nh64d0KWZ==zcFMHaBpsA@mail.gmail.com>

On Mon, Aug 10, 2015 at 12:30:18AM -0300, Fabio Estevam wrote:
> Hi Eduardo,
> 
> On Sun, Aug 9, 2015 at 3:19 PM, Eduardo Valentin <edubezval@gmail.com> wrote:
> > This change teaches the imx serial driver to save its
> > context and restore it across suspend and resume path.
> > To do so, it introduces serial_imx_restore_context()
> > and serial_imx_save_context() functions. They use
> > a shadow set of registers to save key registers
> > and restore them accordingly. These functions can
> > be reused on other situations, when the device
> > context is lost.
> >
> > Cc: Fabio Stevam <festevam@gmail.com>
> 
> s/Stevam/Estevam (applies to all the patches)

Sorry, my bad here.

> 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Jiri Slaby <jslaby@suse.com>
> > Cc: linux-serial@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > ---
> >  drivers/tty/serial/imx.c | 34 ++++++++++++++++++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> >
> > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> > index a03855d..494b182 100644
> > --- a/drivers/tty/serial/imx.c
> > +++ b/drivers/tty/serial/imx.c
> > @@ -217,6 +217,8 @@ struct imx_port {
> >         unsigned int            tx_bytes;
> >         unsigned int            dma_tx_nents;
> >         wait_queue_head_t       dma_wait;
> > +       unsigned int            saved_reg[8];
> > +       bool                    context_saved;
> >  };
> >
> >  struct imx_port_ucrs {
> > @@ -1803,6 +1805,36 @@ static struct uart_driver imx_reg = {
> >         .cons           = IMX_CONSOLE,
> >  };
> >
> > +static void serial_imx_restore_context(struct imx_port *sport)
> > +{
> > +       if (!sport->context_saved)
> > +               return;
> > +
> > +       writel(sport->saved_reg[4], sport->port.membase + UFCR);
> > +       writel(sport->saved_reg[5], sport->port.membase + UBIR);
> > +       writel(sport->saved_reg[6], sport->port.membase + UBMR);
> > +       writel(sport->saved_reg[7], sport->port.membase + IMX21_UTS);
> > +       writel(sport->saved_reg[0], sport->port.membase + UCR1);
> > +       writel(sport->saved_reg[1] | 0x1, sport->port.membase + UCR2);
> > +       writel(sport->saved_reg[2], sport->port.membase + UCR3);
> > +       writel(sport->saved_reg[3], sport->port.membase + UCR4);
> > +       sport->context_saved = false;
> > +}
> > +
> > +static void serial_imx_save_context(struct imx_port *sport)
> > +{
> > +       /* Save necessary regs */
> > +       sport->saved_reg[0] = readl(sport->port.membase + UCR1);
> > +       sport->saved_reg[1] = readl(sport->port.membase + UCR2);
> > +       sport->saved_reg[2] = readl(sport->port.membase + UCR3);
> > +       sport->saved_reg[3] = readl(sport->port.membase + UCR4);
> > +       sport->saved_reg[4] = readl(sport->port.membase + UFCR);
> > +       sport->saved_reg[5] = readl(sport->port.membase + UBIR);
> > +       sport->saved_reg[6] = readl(sport->port.membase + UBMR);
> > +       sport->saved_reg[7] = readl(sport->port.membase + IMX21_UTS);
> > +       sport->context_saved = true;
> > +}
> 
> This seems to be similar to what Shenwei posted earlier:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/360841.html

OK. Do you know what is the status of that patch set?

did it get accepted by any tree so far?

> 
> Regards,
> 
> Fabio Estevam

  reply	other threads:[~2015-08-10  4:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-09 18:19 [PATCH 0/8] serial: imx: rework pm support and add runtime pm Eduardo Valentin
2015-08-09 18:19 ` [PATCH 1/8] serial: imx: remove unbalanced clk_prepare Eduardo Valentin
2015-08-09 18:19 ` [PATCH 2/8] serial: imx: introduce serial_imx_enable_wakeup() Eduardo Valentin
2015-08-09 18:19 ` [PATCH 3/8] serial: imx: allow waking up on RTSD Eduardo Valentin
2015-08-09 18:19 ` [PATCH 4/8] serial: imx: use dev_pm_ops Eduardo Valentin
2015-08-09 18:19 ` [PATCH 5/8] serial: imx: save and restore context in the suspend path Eduardo Valentin
2015-08-10  3:30   ` Fabio Estevam
2015-08-10  4:04     ` Eduardo Valentin [this message]
2015-08-10 12:17       ` Fabio Estevam
2015-08-10 23:50         ` Eduardo Valentin
2015-08-09 18:19 ` [PATCH 6/8] serial: imx: add a flag to indicate we are " Eduardo Valentin
2015-08-09 18:19 ` [PATCH 7/8] serial: imx: add runtime pm support Eduardo Valentin
2015-08-09 18:19 ` [PATCH 8/8] serial: imx: add pm_qos request Eduardo Valentin

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=20150810040404.GA5943@localhost.localdomain \
    --to=edubezval@gmail.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shenwei.wang@freescale.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.