Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi_mpc83xx: support loopback mode

This exposes the hardware loopback mode to drivers, primarily for testing.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Anton Vorontsov and committed by
Linus Torvalds
2a485d7a 22b238bd

+6 -2
+6 -2
drivers/spi/spi_mpc83xx.c
··· 39 39 }; 40 40 41 41 /* SPI Controller mode register definitions */ 42 + #define SPMODE_LOOP (1 << 30) 42 43 #define SPMODE_CI_INACTIVEHIGH (1 << 29) 43 44 #define SPMODE_CP_BEGIN_EDGECLK (1 << 28) 44 45 #define SPMODE_DIV16 (1 << 27) ··· 156 155 /* mask out bits we are going to set */ 157 156 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH 158 157 | SPMODE_LEN(0xF) | SPMODE_DIV16 159 - | SPMODE_PM(0xF) | SPMODE_REV); 158 + | SPMODE_PM(0xF) | SPMODE_REV | SPMODE_LOOP); 160 159 161 160 if (spi->mode & SPI_CPHA) 162 161 regval |= SPMODE_CP_BEGIN_EDGECLK; ··· 164 163 regval |= SPMODE_CI_INACTIVEHIGH; 165 164 if (!(spi->mode & SPI_LSB_FIRST)) 166 165 regval |= SPMODE_REV; 166 + if (spi->mode & SPI_LOOP) 167 + regval |= SPMODE_LOOP; 167 168 168 169 regval |= SPMODE_LEN(len); 169 170 ··· 276 273 } 277 274 278 275 /* the spi->mode bits understood by this driver: */ 279 - #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST) 276 + #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \ 277 + | SPI_LSB_FIRST | SPI_LOOP) 280 278 281 279 static int mpc83xx_spi_setup(struct spi_device *spi) 282 280 {