Skip to content

Commit fb672a9

Browse files
james-c-linaroMatthewCroughan
authored andcommitted
spi: spi-fsl-lpspi: Parameterize reading num-cs from hardware
Add query_hw_for_num_cs in devtype to avoid directly checking compatible string "fsl,imx93-spi". No functionality change. Signed-off-by: James Clark <james.clark@linaro.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20250828-james-nxp-lpspi-v2-8-6262b9aa9be4@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9e1dfeb commit fb672a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787

8888
struct fsl_lpspi_devtype_data {
8989
u8 prescale_max : 3; /* 0 == no limit */
90+
bool query_hw_for_num_cs : 1;
9091
};
9192

9293
struct lpspi_config {
@@ -137,6 +138,7 @@ struct fsl_lpspi_data {
137138
*/
138139
static const struct fsl_lpspi_devtype_data imx93_lpspi_devtype_data = {
139140
.prescale_max = 1,
141+
.query_hw_for_num_cs = true,
140142
};
141143

142144
static const struct fsl_lpspi_devtype_data imx7ulp_lpspi_devtype_data = {
@@ -932,7 +934,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
932934
fsl_lpspi->rxfifosize = 1 << ((temp >> 8) & 0x0f);
933935
if (of_property_read_u32((&pdev->dev)->of_node, "num-cs",
934936
&num_cs)) {
935-
if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx93-spi"))
937+
if (devtype_data->query_hw_for_num_cs)
936938
num_cs = ((temp >> 16) & 0xf);
937939
else
938940
num_cs = 1;

0 commit comments

Comments
 (0)