diff options
-rw-r--r-- | drivers/spi/spi-armada-3700.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index 77fe55ce790c..d65345312527 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #define A3700_SPI_BYTE_LEN BIT(5) | 79 | #define A3700_SPI_BYTE_LEN BIT(5) |
80 | #define A3700_SPI_CLK_PRESCALE BIT(0) | 80 | #define A3700_SPI_CLK_PRESCALE BIT(0) |
81 | #define A3700_SPI_CLK_PRESCALE_MASK (0x1f) | 81 | #define A3700_SPI_CLK_PRESCALE_MASK (0x1f) |
82 | #define A3700_SPI_CLK_EVEN_OFFS (0x10) | ||
82 | 83 | ||
83 | #define A3700_SPI_WFIFO_THRS_BIT 28 | 84 | #define A3700_SPI_WFIFO_THRS_BIT 28 |
84 | #define A3700_SPI_RFIFO_THRS_BIT 24 | 85 | #define A3700_SPI_RFIFO_THRS_BIT 24 |
@@ -220,6 +221,13 @@ static void a3700_spi_clock_set(struct a3700_spi *a3700_spi, | |||
220 | 221 | ||
221 | prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz); | 222 | prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz); |
222 | 223 | ||
224 | /* For prescaler values over 15, we can only set it by steps of 2. | ||
225 | * Starting from A3700_SPI_CLK_EVEN_OFFS, we set values from 0 up to | ||
226 | * 30. We only use this range from 16 to 30. | ||
227 | */ | ||
228 | if (prescale > 15) | ||
229 | prescale = A3700_SPI_CLK_EVEN_OFFS + DIV_ROUND_UP(prescale, 2); | ||
230 | |||
223 | val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); | 231 | val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); |
224 | val = val & ~A3700_SPI_CLK_PRESCALE_MASK; | 232 | val = val & ~A3700_SPI_CLK_PRESCALE_MASK; |
225 | 233 | ||