Skip to content

Commit 35a3997

Browse files
Alexander SteinJiri Slaby
Alexander Stein
authored and
Jiri Slaby
committed
spi: fsl-dspi: Fix CTAR selection
commit 5cc7b04 upstream. There are only 4 CTAR registers (CTAR0 - CTAR3) so we can only use the lower 2 bits of the chip select to select a CTAR register. SPI_PUSHR_CTAS used the lower 3 bits which would result in wrong bit values if the chip selects 4/5 are used. For those chip selects SPI_CTAR even calculated offsets of non-existing registers. Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Jiri Slaby <[email protected]>
1 parent d0ef4ac commit 35a3997

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
#define SPI_TCR 0x08
4747

48-
#define SPI_CTAR(x) (0x0c + (x * 4))
48+
#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4))
4949
#define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27)
5050
#define SPI_CTAR_CPOL(x) ((x) << 26)
5151
#define SPI_CTAR_CPHA(x) ((x) << 25)
@@ -69,7 +69,7 @@
6969

7070
#define SPI_PUSHR 0x34
7171
#define SPI_PUSHR_CONT (1 << 31)
72-
#define SPI_PUSHR_CTAS(x) (((x) & 0x00000007) << 28)
72+
#define SPI_PUSHR_CTAS(x) (((x) & 0x00000003) << 28)
7373
#define SPI_PUSHR_EOQ (1 << 27)
7474
#define SPI_PUSHR_CTCNT (1 << 26)
7575
#define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16)

0 commit comments

Comments
 (0)