All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Problems with suspend/resume of pxa2xx_spi
Date: Thu, 28 Feb 2008 16:56:45 -0800	[thread overview]
Message-ID: <200802281656.45757.david-b@pacbell.net> (raw)
In-Reply-To: <33e9dd1c0802281635v18bcdd49te38d49e7a24abacf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thursday 28 February 2008, Zik Saleeba wrote:
> I fixed my other suspend/resume problem - it was unrelated to spi. So
> restoring the SSP registers is the fix. It's all working correctly for
> me now.

Good.  I can believe that driver hasn't had much suspend/resume testing;
many platforms don't get such testing, and often not all drivers get
covered.  PXA has had issues where even the reference boards (for folk
who have them) don't really leverage all the peripherals.


> I've never submitted a patch before so I'd appreciate a review of this
> before I submit it properly:

See Documentation/SubmittingPatches.  The most obvious bit:

> Index: pxa2xx_spi.c
> ===================================================================
> --- pxa2xx_spi.c        (revision 562)
> +++ pxa2xx_spi.c        (working copy)

Patch format should let it be applied at toplevei with "patch -p1" ...


> @@ -102,6 +102,12 @@

I prefer to see patches generated with "diff -p ..." so there's
more context to review *just the patch* ...


>         u32 int_cr1;
>         u32 clear_sr;
>         u32 mask_sr;
> +
> +        /* saved state for suspend/resume */
> +        u32 saved_sscr0;
> +        u32 saved_sscr1;
> +        u32 saved_sst0;
> +        u32 saved_sspsp;
> 
>         /* Driver message queue */
>         struct workqueue_struct *workqueue;
> @@ -1570,11 +1576,16 @@
>  static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
>  {
>         struct driver_data *drv_data = platform_get_drvdata(pdev);
> +       void *reg = drv_data->ioaddr;
>         int status = 0;
> 
> -       /* Check all childern for current power state */

You should also generate patches aginst the *CURRENT* kernel,
which in this case doesn't have that needless loop.


> +        /* Save register state */
> +        drv_data->saved_sscr0 = read_SSCR0(reg);
> +        drv_data->saved_sscr1 = read_SSCR1(reg);
> +        if (drv_data->ssp_type != PXA25x_SSP)
> +                drv_data->saved_sst0 = read_SSTO(reg);
> +        drv_data->saved_sspsp = read_SSPSP(reg);
> +
> +       /* Check all children for current power state */
>         if (device_for_each_child(&pdev->dev, &state, suspend_devices) != 0) {

I think you have some indentation problems ... looks like you're
either not using TAB for indent, or added an extra space afterwards.


>                 dev_warn(&pdev->dev, "suspend aborted\n");
>                 return -1;
> @@ -1592,13 +1604,21 @@
>  static int pxa2xx_spi_resume(struct platform_device *pdev)
>  {
>         struct driver_data *drv_data = platform_get_drvdata(pdev);
> +       void *reg = drv_data->ioaddr;
>         int status = 0;
> 
>         /* Enable the SSP clock */
>         pxa_set_cken(drv_data->master_info->clock_enable, 1);
> 
> +       /* Load saved SSP configuration */
> +        write_SSCR0(0, reg);
> +        write_SSCR1(drv_data->saved_sscr1, reg);
> +        write_SSCR0(drv_data->saved_sscr0, reg);
> +        write_SSITR(0, reg);
> +       if (drv_data->ssp_type != PXA25x_SSP)
> +                write_SSTO(drv_data->saved_sst0, reg);
> +        write_SSPSP(drv_data->saved_sspsp, reg);
> +
>         /* Start the queue running */
>         status = start_queue(drv_data);
>         if (status != 0) {
> 
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  parent reply	other threads:[~2008-02-29  0:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-21  3:32 Problems with suspend/resume of pxa2xx_spi Zik Saleeba
     [not found] ` <33e9dd1c0802201932v6873415bm9202ad478f192b7f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-21  4:31   ` Ned Forrester
     [not found]     ` <47BCFEA4.1090105-/d+BM93fTQY@public.gmane.org>
2008-02-21 19:38       ` David Brownell
2008-02-28 23:02   ` Zik Saleeba
     [not found]     ` <33e9dd1c0802281502x3d045a03pcb6282a781ac4e56-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-29  0:35       ` Zik Saleeba
     [not found]         ` <33e9dd1c0802281635v18bcdd49te38d49e7a24abacf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-29  0:56           ` David Brownell [this message]
     [not found]             ` <200802281656.45757.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-02-29  1:02               ` Zik Saleeba
2008-02-29  1:31       ` Ned Forrester
     [not found]         ` <47C76057.30705-/d+BM93fTQY@public.gmane.org>
2008-02-29  1:44           ` Zik Saleeba
     [not found]             ` <33e9dd1c0802281744g48c74670v6b71ced41edf1300-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-29  2:11               ` Ned Forrester
2008-02-29  4:31       ` Ned Forrester
     [not found]         ` <47C78A98.6010808-/d+BM93fTQY@public.gmane.org>
2008-02-29 23:50           ` Zik Saleeba

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=200802281656.45757.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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.