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

spi: sh-msiof: Restrict bits per word to 8/16/24/32 on R-Car Gen2/3

While the MSIOF variants in older SuperH and SH/R-Mobile SoCs support
bits-per-word values in the full range 8..32, the variants present in
R-Car Gen2 and Gen3 SoCs are restricted to 8, 16, 24, or 32.

Obtain the value from family-specific sh_msiof_chipdata to fix this.

Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Geert Uytterhoeven and committed by
Mark Brown
0e836c3b daad4d2a

+7 -1
+7 -1
drivers/spi/spi-sh-msiof.c
··· 32 32 #include <asm/unaligned.h> 33 33 34 34 struct sh_msiof_chipdata { 35 + u32 bits_per_word_mask; 35 36 u16 tx_fifo_size; 36 37 u16 rx_fifo_size; 37 38 u16 ctlr_flags; ··· 1049 1048 } 1050 1049 1051 1050 static const struct sh_msiof_chipdata sh_data = { 1051 + .bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32), 1052 1052 .tx_fifo_size = 64, 1053 1053 .rx_fifo_size = 64, 1054 1054 .ctlr_flags = 0, ··· 1057 1055 }; 1058 1056 1059 1057 static const struct sh_msiof_chipdata rcar_gen2_data = { 1058 + .bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) | 1059 + SPI_BPW_MASK(24) | SPI_BPW_MASK(32), 1060 1060 .tx_fifo_size = 64, 1061 1061 .rx_fifo_size = 64, 1062 1062 .ctlr_flags = SPI_CONTROLLER_MUST_TX, ··· 1066 1062 }; 1067 1063 1068 1064 static const struct sh_msiof_chipdata rcar_gen3_data = { 1065 + .bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) | 1066 + SPI_BPW_MASK(24) | SPI_BPW_MASK(32), 1069 1067 .tx_fifo_size = 64, 1070 1068 .rx_fifo_size = 64, 1071 1069 .ctlr_flags = SPI_CONTROLLER_MUST_TX, ··· 1392 1386 ctlr->setup = sh_msiof_spi_setup; 1393 1387 ctlr->prepare_message = sh_msiof_prepare_message; 1394 1388 ctlr->slave_abort = sh_msiof_slave_abort; 1395 - ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); 1389 + ctlr->bits_per_word_mask = chipdata->bits_per_word_mask; 1396 1390 ctlr->auto_runtime_pm = true; 1397 1391 ctlr->transfer_one = sh_msiof_transfer_one; 1398 1392