Subject: Re: [spi-devel-general] [PATCH 2/3] [SPI] Add new mode: SPI_LOOP

From: David Brownell <[email-masked]>
Date: Thu, 26 Jul 2007 20:07:07 -0700

On Thursday 26 July 2007, Anton Vorontsov wrote:
> Loopback mode is supported by various controllers, this mode
> is useful for testing, especially in conjunction with spidev
> driver.

ISTR that Stephen Street provided a loopback mode for debug
in his pxa2xx_spi code.  And I know you're fight that this
mode shows up in a lot of hardware.

Comments, anyone?  This seems like a fair way to expose this
mechanism.  And I tend to agree that it'd mostly be useful in
conjunction with "spidev".

Anton -- assuming this goes in, it'd be nice if you could
contribute a simple test program using this, which we could
keep in Documentation/spi somewhere.  (Maybe with other testing
notes, if anyone comes up with such.)

- Dave

>	...
>
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -77,6 +77,7 @@ struct spi_device {
>  #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 */
> +#define	SPI_LOOP	0x20			/* loopback mode */
>  	u8			bits_per_word;
>  	int			irq;
>  	void			*controller_state;