scottellis / spike

Writing a Linux SPI driver for OMAP3 systems
http://www.jumpnowtek.com
16 stars 9 forks source link

How to chage chip select signal polarity #2

Closed alexvatti closed 13 years ago

alexvatti commented 13 years ago

Hi, With respect to SPI communication in linux kernel gumstix board.

Generally chip select is low,when operation is performed on device in SPI communication. If i want to change reverse chip select signal ,that is chip select is high during operation,low is idle state. Where i have to make changes. I got adc code, for your site. Could you please help me

scottellis commented 13 years ago

I think adding SPI_CS_HIGH to the spi_device mode will work. I didn't try.

spi_device->mode = SPI_MODE_0 | SPI_CS_HIGH;

The definitions are in the kernel source include/linux/spi/spi.h ...

define SPICPHA 0x01 /* clock phase /

#define SPI_CPOL    0x02            /_ clock polarity _/
#define SPI_MODE_0  (0|0)           /_ (original MicroWire) _/
#define SPI_MODE_1  (0|SPI_CPHA)
#define SPI_MODE_2  (SPI_CPOL|0)
#define SPI_MODE_3  (SPI_CPOL|SPI_CPHA)
#define SPI_CS_HIGH 0x04            /_ chipselect active high? _/
#define SPI_LSB_FIRST   0x08            /_ per-word bits-on-wire _/
#define SPI_3WIRE   0x10            /_ SI/SO signals shared _/
#define SPI_LOOP    0x20            /_ loopback mode _/
#define SPI_NO_CS   0x40            /_ 1 dev/bus, no chipselect _/
#define SPI_READY   0x80            /_ slave pulls low to pause */
...

Let me know what happens.

alexvatti commented 13 years ago

You are correct.Thank you very much for the help.