From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean Delvare Subject: Re: [patch 2.6.22-rc2-git] SPI: add 3wire mode flag Date: Wed, 23 May 2007 13:48:53 +0200 Message-ID: <20070523134853.69e5170b@hyperion.delvare> References: <200705221242.49050.david-b@pacbell.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Andrew Morton , Kaiwan N Billimoria To: David Brownell Return-path: In-Reply-To: <200705221242.49050.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org Hi David, On Tue, 22 May 2007 12:42:48 -0700, David Brownell wrote: > Add a new spi->mode bit: SPI_3WIRE, for chips where the SI and SO signals > are shared (and which are thus only half duplex). Update the LM70 driver > to require support for that hardware mode from the controller. > > Signed-off-by: David Brownell > --- > drivers/hwmon/lm70.c | 4 ++++ > include/linux/spi/spi.h | 1 + > 2 files changed, 5 insertions(+) > > --- g26.orig/include/linux/spi/spi.h 2007-05-22 08:59:25.000000000 -0700 > +++ g26/include/linux/spi/spi.h 2007-05-22 09:07:52.000000000 -0700 > @@ -76,6 +76,7 @@ struct spi_device { > #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) > #define SPI_CS_HIGH 0x04 /* chipselect active high? */ > #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ > +#define SPI_3WIRE 0x10 /* SI/SO signals shared */ > u8 bits_per_word; > int irq; > void *controller_state; > --- g26.orig/drivers/hwmon/lm70.c 2007-05-22 09:00:24.000000000 -0700 > +++ g26/drivers/hwmon/lm70.c 2007-05-22 09:06:44.000000000 -0700 > @@ -96,6 +96,10 @@ static int __devinit lm70_probe(struct s > struct lm70 *p_lm70; > int status; > > + /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */ > + if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !spi->mode & SPI_3WIRE) I don't know anything about SPI, but the second half of the test looks broken to me. Missing parentheses? Also note that (SPI_CPOL|SPI_CPHA) is SPI_MODE_3 according to the defines above, maybe you want to use that. > + return -EINVAL; > + > p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); > if (!p_lm70) > return -ENOMEM; -- Jean Delvare ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/