summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@ew.tq-group.com>2023-07-17 10:59:34 +0200
committerMark Brown <broonie@kernel.org>2023-07-18 13:47:56 +0200
commitf46b06e62c86a688ebe691b004f3056818c8ed15 (patch)
treefc96ce2d20ff865c024027434063736c23be9212
parentspi: spi-fsl-lpspi: Move controller initialization further down (diff)
downloadlinux-f46b06e62c86a688ebe691b004f3056818c8ed15.tar.xz
linux-f46b06e62c86a688ebe691b004f3056818c8ed15.zip
spi: spi-fsl-lpspi: Read chip-select amount from hardware for i.MX93
PARAM.PCSNUM register on i.MX93 indicates the number of supported (hw) chip-selects. LPSPI4 has 3 while others have only 2. Still allow overwriting from DT. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20230717085934.409476-3-alexander.stein@ew.tq-group.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-fsl-lpspi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index f3b7bb1e52eb..e32e8cab5aa8 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -896,8 +896,12 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
fsl_lpspi->txfifosize = 1 << (temp & 0x0f);
fsl_lpspi->rxfifosize = 1 << ((temp >> 8) & 0x0f);
if (of_property_read_u32((&pdev->dev)->of_node, "num-cs",
- &num_cs))
- num_cs = 1;
+ &num_cs)) {
+ if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx93-spi"))
+ num_cs = ((temp >> 16) & 0xf);
+ else
+ num_cs = 1;
+ }
controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32);
controller->transfer_one = fsl_lpspi_transfer_one;