]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: spi-fsl-lpspi: Clamp too high speed_hz
authorStefan Wahren <wahrenst@gmx.net>
Thu, 7 Aug 2025 10:07:42 +0000 (12:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:31:11 +0000 (16:31 +0200)
commitaa2b0dc33258d594c4834b5b54f842e48e763657
treeb7bda1385ee714bd0dc6df7c6a8674c786290143
parenta9e5924daa954c9f585c1ca00358afe71d6781c4
spi: spi-fsl-lpspi: Clamp too high speed_hz

[ Upstream commit af357a6a3b7d685e7aa621c6fb1d4ed6c349ec9e ]

Currently the driver is not able to handle the case that a SPI device
specifies a higher spi-max-frequency than half of per-clk:

    per-clk should be at least two times of transfer speed

Fix this by clamping to the max possible value and use the minimum SCK
period of 2 cycles.

Fixes: 77736a98b859 ("spi: lpspi: add the error info of transfer speed setting")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://patch.msgid.link/20250807100742.9917-1-wahrenst@gmx.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-fsl-lpspi.c