aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2007-07-31 03:38:45 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 18:39:40 -0400
commit2a485d7ad2b68600e423f8799efc0d074029ec01 (patch)
tree147689d4fe83eddc14d953140bdbbea792860d70 /drivers
parent22b238bdb93ed2fcb1d627ce81d8a2fcbe24de85 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi_mpc83xx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 72812bb9b40f..0c16a2b39b41 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -39,6 +39,7 @@ struct mpc83xx_spi_reg {
39}; 39};
40 40
41/* SPI Controller mode register definitions */ 41/* SPI Controller mode register definitions */
42#define SPMODE_LOOP (1 << 30)
42#define SPMODE_CI_INACTIVEHIGH (1 << 29) 43#define SPMODE_CI_INACTIVEHIGH (1 << 29)
43#define SPMODE_CP_BEGIN_EDGECLK (1 << 28) 44#define SPMODE_CP_BEGIN_EDGECLK (1 << 28)
44#define SPMODE_DIV16 (1 << 27) 45#define SPMODE_DIV16 (1 << 27)
@@ -155,7 +156,7 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
155 /* mask out bits we are going to set */ 156 /* mask out bits we are going to set */
156 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH 157 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
157 | SPMODE_LEN(0xF) | SPMODE_DIV16 158 | SPMODE_LEN(0xF) | SPMODE_DIV16
158 | SPMODE_PM(0xF) | SPMODE_REV); 159 | SPMODE_PM(0xF) | SPMODE_REV | SPMODE_LOOP);
159 160
160 if (spi->mode & SPI_CPHA) 161 if (spi->mode & SPI_CPHA)
161 regval |= SPMODE_CP_BEGIN_EDGECLK; 162 regval |= SPMODE_CP_BEGIN_EDGECLK;
@@ -163,6 +164,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
163 regval |= SPMODE_CI_INACTIVEHIGH; 164 regval |= SPMODE_CI_INACTIVEHIGH;
164 if (!(spi->mode & SPI_LSB_FIRST)) 165 if (!(spi->mode & SPI_LSB_FIRST))
165 regval |= SPMODE_REV; 166 regval |= SPMODE_REV;
167 if (spi->mode & SPI_LOOP)
168 regval |= SPMODE_LOOP;
166 169
167 regval |= SPMODE_LEN(len); 170 regval |= SPMODE_LEN(len);
168 171
@@ -273,7 +276,8 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
273} 276}
274 277
275/* the spi->mode bits understood by this driver: */ 278/* the spi->mode bits understood by this driver: */
276#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST) 279#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
280 | SPI_LSB_FIRST | SPI_LOOP)
277 281
278static int mpc83xx_spi_setup(struct spi_device *spi) 282static int mpc83xx_spi_setup(struct spi_device *spi)
279{ 283{