[QUESTION] PPC4xx SPI mode

Herrera-Bendezu, Luis lherrera at harris.com
Fri Jan 30 07:38:17 EST 2009


Actually SPI_IOC_WR_MODE changes are not used for file I/O read() and
write(). SPI_IOC_MESSAGE uses modified SPI parameters only when ioctl()
argument struct spio_ioc_transfer fields: speed_hz and bits_per_word are
non-zero.

This mechanism is enforced by spi_bitbang.c function bitbang_work()
that calls setup_transfer function (in my case spi_ppc4xx_setupxfer())
only when the above condition is true.

On the other hand, read() and write() queue their messages with struct
spi_transfer fields speed_hz and bits_per_word set to 0. 

IMHO all three cases should behave similarly.

Regards,
Luis 

-----Original Message-----
From: linuxppc-dev-bounces+lherrera=harris.com at ozlabs.org
[mailto:linuxppc-dev-bounces+lherrera=harris.com at ozlabs.org] On Behalf
Of Herrera-Bendezu, Luis
Sent: Wednesday, January 28, 2009 7:08 PM
To: linuxppc-dev at ozlabs.org
Subject: [QUESTION] PPC4xx SPI mode


I am using PPC440EPx SPI driver to access devices with different clock
polarities (SPI_MODE_0 and SPI_MODE_2), but otherwise similar SPI
parameters (max clock frequency, bits per word, etc.) If spidev is
used to modify clock polarity via ioctl SPI_IOC_WR_MODE, it does not
have any effect on the controller.

This list has dicussed a related issue:
http://ozlabs.org/pipermail/linuxppc-dev/2009-January/066749.html

that explains why SPI_IOC_WR_MODE does not work, function
spi_ppc4xx_setupxfer() is called only once by spi_ppc4xx_setup()
function. Any subsequent call just ignores request to change SPI
configuration and does not report any error.

Is this how the driver is supposed to work?
Can the above usage be acommodated into the driver?

Thanks,
Luis


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev



More information about the Linuxppc-dev mailing list