From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Vaga Subject: Re: How to correctly use spi_slave_tegra Date: Thu, 15 Nov 2012 20:19:44 +0100 Message-ID: <18285117.GZ9tCClAXO@number-5> References: <3877625.uASAU6TrGF@number-5> <50A538DA.2010906@wwwdotorg.org> <50A53CB7.1090705@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <50A53CB7.1090705-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Laxman Dewangan Cc: Stephen Warren , "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "a.sappia-197Af0g7QoUlk5EcyZIkJQ@public.gmane.org" , "puria.nafisi-yFROiS3d6cY@public.gmane.org" List-Id: linux-tegra@vger.kernel.org > >> Hi, > >> > >> I'm working on the SPI bus on a Nvidia Tegra 2 system (Toradex Colibri). > >> I'm using kernel 2.6.32 with toradex and nvidia patches. > > > > Laxman, are you able to help with these questions? > > We have the driver from K2.6.39, K3.1 and K3.4. > I suggest to use the driver from k2.6.39 rather than K2.3.36 version. I checked again. I copied the wrong version, I'm on 2.6.36.2. I wrongly replaced the 6 with the last 2: sorry :/ > >> As I understand: > >> - obviously I must configure SPI before master start communication > >> - speed_hz must be the same of the master > >> - I must use spi_async (spi_sync can freeze the driver) > >> - Only messages with single transfer. If the master sends messages with > >> multiple transfer, I must receive them with a single transfer > >> - I have two callback. the message->complete from the SPI framework and > >> the > >> spi_tegra_register_callback from the spi_slave_tegra > >> > > From a very very very brief look at ouor android-tegra-nv-3.1 branch, > > > > your understanding sounds at least reasonable even if not correct! > > Yes, the above are correct. The way we wrote the driver is that to > support the sync and async both. > When driver configures spi controller and ready for receive data then > the callback from client is called. This callback is registered through > spi_tegra_register_callback(). The client code then can inform master in > this callback to start transfer through some mechanism i.e. gpio ok -- Federico Vaga