aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_mpc83xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi_mpc83xx.c')
-rw-r--r--drivers/spi/spi_mpc83xx.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index e2d8dbc15c80..18c475dd5709 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -153,13 +153,16 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
153 len = len - 1; 153 len = len - 1;
154 154
155 /* mask out bits we are going to set */ 155 /* mask out bits we are going to set */
156 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH | 156 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
157 SPMODE_LEN(0xF) | SPMODE_DIV16 | SPMODE_PM(0xF)); 157 | SPMODE_LEN(0xF) | SPMODE_DIV16
158 | SPMODE_PM(0xF) | SPMODE_REV);
158 159
159 if (spi->mode & SPI_CPHA) 160 if (spi->mode & SPI_CPHA)
160 regval |= SPMODE_CP_BEGIN_EDGECLK; 161 regval |= SPMODE_CP_BEGIN_EDGECLK;
161 if (spi->mode & SPI_CPOL) 162 if (spi->mode & SPI_CPOL)
162 regval |= SPMODE_CI_INACTIVEHIGH; 163 regval |= SPMODE_CI_INACTIVEHIGH;
164 if (!(spi->mode & SPI_LSB_FIRST))
165 regval |= SPMODE_REV;
163 166
164 regval |= SPMODE_LEN(len); 167 regval |= SPMODE_LEN(len);
165 168
@@ -248,9 +251,11 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
248 251
249 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); 252 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
250 253
251 /* Mask out bits_per_wordgth */ 254 /* mask out bits we are going to set */
252 regval &= ~SPMODE_LEN(0xF); 255 regval &= ~(SPMODE_LEN(0xF) | SPMODE_REV);
253 regval |= SPMODE_LEN(bits_per_word); 256 regval |= SPMODE_LEN(bits_per_word);
257 if (!(spi->mode & SPI_LSB_FIRST))
258 regval |= SPMODE_REV;
254 259
255 /* Turn off SPI unit prior changing mode */ 260 /* Turn off SPI unit prior changing mode */
256 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0); 261 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
@@ -260,7 +265,7 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
260} 265}
261 266
262/* the spi->mode bits understood by this driver: */ 267/* the spi->mode bits understood by this driver: */
263#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH) 268#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST)
264 269
265static int mpc83xx_spi_setup(struct spi_device *spi) 270static int mpc83xx_spi_setup(struct spi_device *spi)
266{ 271{