|
@@ -79,6 +79,7 @@
|
|
#define A3700_SPI_BYTE_LEN BIT(5)
|
|
#define A3700_SPI_BYTE_LEN BIT(5)
|
|
#define A3700_SPI_CLK_PRESCALE BIT(0)
|
|
#define A3700_SPI_CLK_PRESCALE BIT(0)
|
|
#define A3700_SPI_CLK_PRESCALE_MASK (0x1f)
|
|
#define A3700_SPI_CLK_PRESCALE_MASK (0x1f)
|
|
|
|
+#define A3700_SPI_CLK_EVEN_OFFS (0x10)
|
|
|
|
|
|
#define A3700_SPI_WFIFO_THRS_BIT 28
|
|
#define A3700_SPI_WFIFO_THRS_BIT 28
|
|
#define A3700_SPI_RFIFO_THRS_BIT 24
|
|
#define A3700_SPI_RFIFO_THRS_BIT 24
|
|
@@ -220,6 +221,13 @@ static void a3700_spi_clock_set(struct a3700_spi *a3700_spi,
|
|
|
|
|
|
prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz);
|
|
prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz);
|
|
|
|
|
|
|
|
+ /* For prescaler values over 15, we can only set it by steps of 2.
|
|
|
|
+ * Starting from A3700_SPI_CLK_EVEN_OFFS, we set values from 0 up to
|
|
|
|
+ * 30. We only use this range from 16 to 30.
|
|
|
|
+ */
|
|
|
|
+ if (prescale > 15)
|
|
|
|
+ prescale = A3700_SPI_CLK_EVEN_OFFS + DIV_ROUND_UP(prescale, 2);
|
|
|
|
+
|
|
val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG);
|
|
val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG);
|
|
val = val & ~A3700_SPI_CLK_PRESCALE_MASK;
|
|
val = val & ~A3700_SPI_CLK_PRESCALE_MASK;
|
|
|
|
|