From: Simon Kagstrom Subject: Re: [PATCH 2/2] spi_bitbang: Add support for non-blocking synchronous transfers Date: Sat, 28 Feb 2009 10:09:14 +0100 Message-ID: <20090228100914.2ec2ff7f@lska2> References: <20090228081036.31964.80618.stgit@fedora.yogi> <20090228081117.31964.51155.stgit@fedora.yogi> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Andy Green , David Brownell , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Balaji Rao Return-path: In-Reply-To: <20090228081117.31964.51155.stgit-bnrf61MYqdMYW0ZX77RX+A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org Thanks for taking this up Balaji! In the comment below I'm assuming the Openmoko accelerometer use of this functionality, which would include doing SPI transfers in the interrupt handler. On Sat, 28 Feb 2009 13:41:17 +0530 Balaji Rao wrote: > +/* Synchronous non blocking transfer */ > +int > +spi_bitbang_transfer_sync(struct spi_device *spi, struct spi_message > *m) +{ > [...] > + if (setup_transfer) { > + status = setup_transfer(spi, t); > [...] > + if (!m->is_dma_mapped) > + t->rx_dma = t->tx_dma = 0; > + status = bitbang->txrx_bufs(spi, t); Another thing that we'd need to take care of is that the stuff being called from the synhronous transfer is actually callable from interrupt context. Looking at txrx_bufs for s3c24xx (s3c24xx_spi_txrx), it's using a wait_for_completion which is in turn completed by the s3c24xx SPI interrupt handler. Without trying, I'm guessing that that won't be possible from interrupt context. // Simon ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H