From: Imre Deak Subject: [PATCH 0/3] ARM: OMAP: SPI edge selection [was Re: Edge selecton on SPI bus] Date: Wed, 17 May 2006 01:12:49 +0300 Message-ID: <1147817569.27886.54.camel@mammoth.research.nokia.com> References: <1147691115.32613.10.camel@mammoth.research.nokia.com> <200605151159.37793.david-b@pacbell.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200605151159.37793.david-b@pacbell.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-omap-open-source-bounces+gplao-linux-omap-open-source=gmane.org@linux.omap.com Errors-To: linux-omap-open-source-bounces+gplao-linux-omap-open-source=gmane.org@linux.omap.com To: ext David Brownell Cc: omap-linux List-Id: linux-omap@vger.kernel.org On Mon, 2006-05-15 at 11:59 -0700, ext David Brownell wrote: > On Monday 15 May 2006 4:05 am, Imre Deak wrote: > > 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. > > 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 > > - Dave > > > > > On OMAP2 this I even see from the fact that you can set the reading edge > > and the writing edge is implied. > > > > --Imre > > > >