Catching up on old mail ...
On Monday 18 August 2008, Daniel Ribeiro wrote:
> As I already said, i am converting a working driver from ssp.c´s
> ssp_read_word/ssp_write_word to pxa2xx_spi. The driver works just
> fine with:
>
> gpio_set_value(cs, 0);
> ssp_write_word(&ssp_dev, data);
> ssp_read_word(&ssp_dev, &ret);
> gpio_set_value(cs, 1);
That is, 64 bit times ... two sequential word transfers.
> After the conversion i ended with this code:
>
> static int ezx_pcap_putget(u32 *data)
> {
> struct spi_transfer t;
> struct spi_message m;
>
> spi_message_init(&m);
> t.len = 4;
> t.tx_buf = (u8 *)data;
> t.rx_buf = (u8 *)data;
> t.bits_per_word = 32;
That is, 32 bit times ... two *parallel* word transfers.
> spi_message_add_tail(&t, &m);
> return spi_sync(pcap.spi, &m);
> }
So "deasserting CS too early" was what you *requested* and
it's no wonder the driver did just that.
You could instead
return spi_write_then_read(pcap.spi, data, 4, data, 4);
to get the sequential (not concurrent!) I/O you need. Be
careful of byte ordering, of course; you probably should
set spi->bits_per_word to 32 and then spi_setup(), as part
of your driver init.
- Dave
-------------------------------------------------------------------------
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=/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general