* Change CPHA in the middle of transaction
@ 2022-04-06 10:38 Baruch Siach
0 siblings, 0 replies; only message in thread
From: Baruch Siach @ 2022-04-06 10:38 UTC (permalink / raw)
To: linux-spi
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@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-06 14:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-06 10:38 Change CPHA in the middle of transaction Baruch Siach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox