Hi I'm having some trouble with the SPI on my IMX6S based Riotboard. I am running Android v4.3 with kernel v3.0.35.
I'm trying to get SPI_MODE3 to work but it appears to always clock out in SPI_MODE0. Has anyone seen this before?
Spidev test program:
root@RIoTboard_6solo:/ # /system/lcdtest/spidev_test -H -O
spi mode: 3
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF
Output on logic analyser:
Solved! Go to Solution.
I found a guy who had the same problem and got SPI_MODE_3 working.
Hi, Luke
I had the same problem. Could you share the method you solve it. Thanks!
Well it looks like they deleted the post that I used as a reference. That's not very helpful.
I think I was able to find the change that I made.
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index be58e17..4bc1b70 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -185,6 +185,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
#define SPI_IMX2_3_CONFIG_SCLKPOL(cs) (1 << ((cs) + 4))
#define SPI_IMX2_3_CONFIG_SBBCTRL(cs) (1 << ((cs) + 8))
#define SPI_IMX2_3_CONFIG_SSBPOL(cs) (1 << ((cs) + 12))
+#define SPI_IMX2_3_CONFIG_SCLKCTL(cs) (1 << ((cs) + 20))
#define SPI_IMX2_3_INT 0x10
#define SPI_IMX2_3_INT_TEEN (1 << 0)
@@ -276,7 +277,10 @@ static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx,
cfg |= SPI_IMX2_3_CONFIG_SCLKPHA(config->cs);
if (config->mode & SPI_CPOL)
- cfg |= SPI_IMX2_3_CONFIG_SCLKPOL(config->cs);
+ {
+ //cfg |= SPI_IMX2_3_CONFIG_SCLKPOL(config->cs);
+ cfg |= SPI_IMX2_3_CONFIG_SCLKCTL(config->cs);
+ }
if (config->mode & SPI_CS_HIGH)
cfg |= SPI_IMX2_3_CONFIG_SSBPOL(config->cs);
That may help. Although in the end I ended up bit banging the SPI.
Hi Luke,
i have the same problem of the spi_mode changge, but i used your method, i found the spi_imx2_3_config have not used ,Pls,give me suggest.
Br
ken