From: Ned Forrester <nforrester-/d+BM93fTQY@public.gmane.org>
To: Daniel Ribeiro <drwyrm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] pxa2xx_spi: wait_rx_stall before deasserting CS on PIO mode
Date: Mon, 18 Aug 2008 14:53:09 -0400 [thread overview]
Message-ID: <48A9C515.3000908@whoi.edu> (raw)
In-Reply-To: <6669365c0808171553i3f64b667t18fcea589d94411a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Daniel Ribeiro wrote:
> Hi,
>
> I am converting a driver from ssp.c API to pxa2xx_spi. But
> when using PIO mode i am getting bogus rx data.
>
> I did some tests, and it looks like CS is being deasserted
> before the IO is done.
>
> The following patch solved the issue for me.
Can you be more specific about your problem? If CS is not being
asserted/deasserted at the right times, then that needs to be fixed.
What are you using for CS; this driver only works correctly when a GPIO
pin is assigned for CS, and is controlled with the cs_control() callback.
The below patch seems to paper over some other problem.
wait_ssp_rx_stall() is used to recover from errors, by flushing and
discarding words from the RX fifo. Also, int_transfer_complete() is
only called from places where we know that all expected characters have
been received and transferred to memory.
This patch would "fix" a situation where extra words are in the RX FIFO
after the expected number have been read. If there are more characters
in the FIFO than were transmitted, then that needs to be fixed and not
ignored.
Can you provide a patch or more information that addresses the
underlying problem?
> pxa2xx_spi: wait_rx_stall before deasserting CS on PIO mode
>
> Signed-off-by: Daniel Ribeiro <drwyrm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
> index 0c452c4..4a9c34e 100644
> --- a/drivers/spi/pxa2xx_spi.c
> +++ b/drivers/spi/pxa2xx_spi.c
> @@ -593,6 +593,10 @@ static void int_transfer_complete(struct driver_data *drv_data)
> {
> void __iomem *reg = drv_data->ioaddr;
>
> + if (wait_ssp_rx_stall(drv_data->ioaddr) == 0)
> + dev_err(&drv_data->pdev->dev,
> + "interrupt_transfer: ssp rx stall failed\n");
> +
> /* Stop SSP */
> write_SSSR(drv_data->clear_sr, reg);
> write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);
>
>
--
Ned Forrester nforrester-/d+BM93fTQY@public.gmane.org
Oceanographic Systems Lab 508-289-2226
Applied Ocean Physics and Engineering Dept.
Woods Hole Oceanographic Institution Woods Hole, MA 02543, USA
http://www.whoi.edu/sbl/liteSite.do?litesiteid=7212
http://www.whoi.edu/hpb/Site.do?id=1532
http://www.whoi.edu/page.do?pid=10079
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
next prev parent reply other threads:[~2008-08-18 18:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-17 22:53 [PATCH] pxa2xx_spi: wait_rx_stall before deasserting CS on PIO mode Daniel Ribeiro
[not found] ` <6669365c0808171553i3f64b667t18fcea589d94411a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-17 22:59 ` Daniel Ribeiro
2008-08-18 18:53 ` Ned Forrester [this message]
[not found] ` <48A9C515.3000908-/d+BM93fTQY@public.gmane.org>
2008-08-18 19:27 ` Daniel Ribeiro
[not found] ` <6669365c0808181227k2fa01d6fu570cebc10630f55d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-18 20:47 ` Ned Forrester
[not found] ` <48A9DFD9.9000708-/d+BM93fTQY@public.gmane.org>
2008-08-18 23:06 ` Daniel Ribeiro
[not found] ` <6669365c0808181606u4ead2f27h1f2286f9365e8a7a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-19 5:58 ` Ned Forrester
2008-08-19 5:58 ` Daniel Ribeiro
[not found] ` <6669365c0808182258t6c4a5086xd9425435930e6d8f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-19 6:08 ` Ned Forrester
2008-08-19 16:48 ` Ned Forrester
2008-09-11 17:41 ` David Brownell
[not found] ` <200809111041.20900.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-09-12 1:53 ` Daniel Ribeiro
2008-09-12 2:53 ` Ned Forrester
2008-09-12 2:59 ` Ned Forrester
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=48A9C515.3000908@whoi.edu \
--to=nforrester-/d+bm93ftqy@public.gmane.org \
--cc=drwyrm-Re5JQEeQqe8AvxtiuMwx3w@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.