diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/atmel_spi.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 293b7cab3e57..85687aaf9cab 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -87,6 +87,16 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi) | |||
87 | unsigned gpio = (unsigned) spi->controller_data; | 87 | unsigned gpio = (unsigned) spi->controller_data; |
88 | unsigned active = spi->mode & SPI_CS_HIGH; | 88 | unsigned active = spi->mode & SPI_CS_HIGH; |
89 | u32 mr; | 89 | u32 mr; |
90 | int i; | ||
91 | u32 csr; | ||
92 | u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0; | ||
93 | |||
94 | /* Make sure clock polarity is correct */ | ||
95 | for (i = 0; i < spi->master->num_chipselect; i++) { | ||
96 | csr = spi_readl(as, CSR0 + 4 * i); | ||
97 | if ((csr ^ cpol) & SPI_BIT(CPOL)) | ||
98 | spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL)); | ||
99 | } | ||
90 | 100 | ||
91 | mr = spi_readl(as, MR); | 101 | mr = spi_readl(as, MR); |
92 | mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr); | 102 | mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr); |