Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: img-spfi: fix support for speeds up to 1/4th input clock

Setting the Same Edge bit indicates to the spfi block to receive and
transmit data on the same edge of the spfi clock, which in turn
doubles the operating frequency of spfi.

The maximum supported frequency is limited to 1/4th of the spfi input
clock, but without this bit set the maximum would be 1/8th of the
input clock.

The current driver calculates the divisor with maximum speed at 1/4th
of the input clock, this would fail if the requested frequency is
higher than 1/8 of the input clock. Any requests for 1/8th of the
input clock would still pass.

Fixes: 8543d0e72d43 ("spi: img-spfi: Limit bit clock to 1/4th of input clock")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>

authored by

Sifan Naeem and committed by
Mark Brown
6a806a21 b787f68c

+2
+2
drivers/spi/spi-img-spfi.c
··· 40 40 #define SPFI_CONTROL_SOFT_RESET BIT(11) 41 41 #define SPFI_CONTROL_SEND_DMA BIT(10) 42 42 #define SPFI_CONTROL_GET_DMA BIT(9) 43 + #define SPFI_CONTROL_SE BIT(8) 43 44 #define SPFI_CONTROL_TMODE_SHIFT 5 44 45 #define SPFI_CONTROL_TMODE_MASK 0x7 45 46 #define SPFI_CONTROL_TMODE_SINGLE 0 ··· 492 491 else if (xfer->tx_nbits == SPI_NBITS_QUAD && 493 492 xfer->rx_nbits == SPI_NBITS_QUAD) 494 493 val |= SPFI_CONTROL_TMODE_QUAD << SPFI_CONTROL_TMODE_SHIFT; 494 + val |= SPFI_CONTROL_SE; 495 495 spfi_writel(spfi, val, SPFI_CONTROL); 496 496 } 497 497