Skip to content

ARM: OMAP: SPI edge selection [was Re: Edge selecton on SPI bus]

Imre Deak linux-omap 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ARM: OMAP: omap2_mcspi: fix for channel configuration and CSdrivers/spi/omap2_mcspi.c+7 -40 replies
2/3ARM: OMAP: edge selection for McSPI / uWiredrivers/spi/omap2_mcspi.c drivers/spi/omap_uwire.c+5 -50 replies
3/3Input: ads7846: select correct SPI modedrivers/input/touchscreen/ads7846.c+4 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] ARM: OMAP: SPI edge selection [was Re: Edge selecton on SPI bus]
Quoted 11 lines · ext David Brownell
Quoted 9 lines · Imre Deak

Hi,

I think the edge selection in the omap_uwire and omap2_mcspi is borked. I have a patch for it, but I'd like to ask first if my assumption is right:
On the SPI / uWire bus by definition you can only configure a mode (one of the 4 modes), in which the read / write takes place on opposite edges. That is you can't configure for example a read rising edge / write rising edge mode.

Quoted 8 lines

That's my understanding, yes. Consider that if you connect MOSI directly to MISO for a loopback configuration, what you send is supposed to exactly match what you receive ... that couldn't happen if there were no settling time between setting MOSI and reading MISO.

That WRITE_FALLING | READ_FALLING always did look goofy, but I recall it as more or less a direct translation from the old driver. In any case the REVISIT note seems to have gotten lost.

I think the devices worked so far with this buggy logic since I suspect a complementary problem in the TRM for the read edge selection HW flag. I checked this against devices that are known to be using a given SPI mode.

The OMAP2 McSPI code too has a wrong mapping between SPI mode and read / write edge.

Also at least the ads7846 was using incorrectly SPI mode 0, since it's expecting writes on the falling / reads on the rising edge which maps to mode 1.

I'm posting 3 patches to solve these issues.

--Imre

Quoted 11 lines

- Dave

Quoted 6 lines

On OMAP2 this I even see from the fact that you can set the reading edge and the writing edge is implied.

--Imre