linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jassi Brar <jassisinghbrar@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	David Brownell <dbrownell@users.sourceforge.net>,
	Jassi Brar <jassi.brar@samsung.com>,
	spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] spi/spi_s3c64xx: Fix timeout handling in wait_for_xfer()
Date: Wed, 8 Sep 2010 10:11:59 +0900	[thread overview]
Message-ID: <AANLkTi=6voS7WXcXgVTdK614W0Epy_Ehf5QzufErV2tD@mail.gmail.com> (raw)
In-Reply-To: <1283873872-8633-1-git-send-email-broonie@opensource.wolfsonmicro.com>

On Wed, Sep 8, 2010 at 12:37 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> In wait_for_xfer() for PIO transfer we are using val as both a
> counter variable to track the number of spins we've waited for
> completion and the value we read from the controller, causing
> us to fail to ever actually notice the timeout. Fix this by using
> a separate value to hold the register readback.
>
> Also warn when we hit the timeout.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/spi/spi_s3c64xx.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
> index 6e48ea9..03b28e4 100644
> --- a/drivers/spi/spi_s3c64xx.c
> +++ b/drivers/spi/spi_s3c64xx.c
> @@ -321,7 +321,7 @@ static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
>  {
>        struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
>        void __iomem *regs = sdd->regs;
> -       unsigned long val;
> +       unsigned long val, reg;
>        int ms;
>
>        /* millisecs to xfer 'len' bytes @ 'cur_speed' */
> @@ -333,13 +333,16 @@ static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
>                val = wait_for_completion_timeout(&sdd->xfer_completion, val);
>        } else {
>                val = msecs_to_loops(ms);
> +
>                do {
> -                       val = readl(regs + S3C64XX_SPI_STATUS);
> -               } while (RX_FIFO_LVL(val, sci) < xfer->len && --val);
> +                       reg = readl(regs + S3C64XX_SPI_STATUS);
> +               } while (RX_FIFO_LVL(reg, sci) < xfer->len && --val);
>        }
>
> -       if (!val)
> +       if (!val) {
> +               dev_warn(&sdd->pdev->dev, "Transfer timeout\n");
>                return -EIO;
> +       }

I have already submitted a patch a few days ago
https://patchwork.kernel.org/patch/151941/
(It's strange that Grant's id isn't there in the CC list, despite my writing it)

  parent reply	other threads:[~2010-09-08  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07 15:37 [PATCH 1/2] spi/spi_s3c64xx: Fix timeout handling in wait_for_xfer() Mark Brown
2010-09-07 15:37 ` [PATCH 2/2] spi/spi_s3c64xx: Increase dead reckoning time " Mark Brown
2010-09-08  1:44   ` Jassi Brar
2010-09-08 16:00     ` Grant Likely
2010-09-08  1:11 ` Jassi Brar [this message]
2010-09-08  9:06   ` [PATCH 1/2] spi/spi_s3c64xx: Fix timeout handling " Mark Brown

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='AANLkTi=6voS7WXcXgVTdK614W0Epy_Ehf5QzufErV2tD@mail.gmail.com' \
    --to=jassisinghbrar@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --cc=jassi.brar@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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).