Change CPHA in the middle of transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi linux-spi list,

I am trying to communicate with an SPI device that latches MOSI bits on the
rising edge of the clock, while MISO bits are latched on the falling
edge. Fortunately, MOSI and MISO bits are not simultaneous. So Tx/Rx
work if SPI master changes CPHA at the right time with chip-select asserted.

It looks like generic SPI code provides no way to flip CPHA for different
spi_transfer in the context of a single spi_message. At the drivers level,
some drivers program SPI mode per spi_transfer (e.g. spi-imx mx1/mx21/mx31
variants), while others do that per spi_message (e.g. spi-imx mx51 variant).

I can hack around the problem from userspace with manual control of the GPIO
chip-select signal, and separate spidev SPI_IOC_MESSAGE calls with
SPI_IOC_RD_MODE in between. Not very nice.

I think about adding SPI_RX_CPHA_FLIP mode bit for that. Hardware that
supports separate MISO/MOSI CPHA can program that permanently for spi_device
that needs it (is there any such SPI master?). If not, the driver flips CPHA
when spi_transfer tx_buf is NULL.

Would that be acceptable?

Any other suggestion?

Thanks,
baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@xxxxxxxxxx - tel: +972.52.368.4656, http://www.tkos.co.il -



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux