diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_imx.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 1cf9d5faabf4..69d6dba67c19 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -174,7 +174,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
174 | #define SPI_IMX2_3_CTRL 0x08 | 174 | #define SPI_IMX2_3_CTRL 0x08 |
175 | #define SPI_IMX2_3_CTRL_ENABLE (1 << 0) | 175 | #define SPI_IMX2_3_CTRL_ENABLE (1 << 0) |
176 | #define SPI_IMX2_3_CTRL_XCH (1 << 2) | 176 | #define SPI_IMX2_3_CTRL_XCH (1 << 2) |
177 | #define SPI_IMX2_3_CTRL_MODE(cs) (1 << ((cs) + 4)) | 177 | #define SPI_IMX2_3_CTRL_MODE_MASK (0xf << 4) |
178 | #define SPI_IMX2_3_CTRL_POSTDIV_OFFSET 8 | 178 | #define SPI_IMX2_3_CTRL_POSTDIV_OFFSET 8 |
179 | #define SPI_IMX2_3_CTRL_PREDIV_OFFSET 12 | 179 | #define SPI_IMX2_3_CTRL_PREDIV_OFFSET 12 |
180 | #define SPI_IMX2_3_CTRL_CS(cs) ((cs) << 18) | 180 | #define SPI_IMX2_3_CTRL_CS(cs) ((cs) << 18) |
@@ -253,8 +253,14 @@ static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx, | |||
253 | { | 253 | { |
254 | u32 ctrl = SPI_IMX2_3_CTRL_ENABLE, cfg = 0; | 254 | u32 ctrl = SPI_IMX2_3_CTRL_ENABLE, cfg = 0; |
255 | 255 | ||
256 | /* set master mode */ | 256 | /* |
257 | ctrl |= SPI_IMX2_3_CTRL_MODE(config->cs); | 257 | * The hardware seems to have a race condition when changing modes. The |
258 | * current assumption is that the selection of the channel arrives | ||
259 | * earlier in the hardware than the mode bits when they are written at | ||
260 | * the same time. | ||
261 | * So set master mode for all channels as we do not support slave mode. | ||
262 | */ | ||
263 | ctrl |= SPI_IMX2_3_CTRL_MODE_MASK; | ||
258 | 264 | ||
259 | /* set clock speed */ | 265 | /* set clock speed */ |
260 | ctrl |= spi_imx2_3_clkdiv(spi_imx->spi_clk, config->speed_hz); | 266 | ctrl |= spi_imx2_3_clkdiv(spi_imx->spi_clk, config->speed_hz); |