]> git.baikalelectronics.ru Git - kernel.git/commit
spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3
authorKevin Groeneveld <kgroeneveld@lenbrook.com>
Sat, 18 Mar 2023 22:21:32 +0000 (18:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:40 +0000 (17:32 +0100)
commit567619f9826e110b01776ec4cd86c01290abb452
treeb92b01c0def1a2f38fa0c27b6105cd372098346c
parent67d1f850522ca616d5a3456d84df881ba9967531
spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3

[ Upstream commit 87c614175bbf28d3fd076dc2d166bac759e41427 ]

When using gpio based chip select the cs value can go outside the range
0 – 3. The various MX51_ECSPI_* macros did not take this into consideration
resulting in possible corruption of the configuration.

For example for any cs value over 3 the SCLKPHA bits would not be set and
other values in the register possibly corrupted.

One way to fix this is to just mask the cs bits to 2 bits. This still
allows all 4 native chip selects to work as well as gpio chip selects
(which can use any of the 4 chip select configurations).

Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com>
Link: https://lore.kernel.org/r/20230318222132.3373-1-kgroeneveld@lenbrook.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-imx.c