Skip to content

Commit 5f94774

Browse files
hanxu-nxpbroonie
authored andcommitted
spi: spi-fsl-lpspi: support multiple cs for lpspi
support to get chip select number from DT file. Signed-off-by: Han Xu <han.xu@nxp.com> Link: https://lore.kernel.org/r/20221206225410.604482-1-han.xu@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7073888 commit 5f94774

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct fsl_lpspi_data {
9898
struct clk *clk_ipg;
9999
struct clk *clk_per;
100100
bool is_slave;
101+
u32 num_cs;
101102
bool is_only_cs1;
102103
bool is_first_byte;
103104

@@ -840,6 +841,9 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
840841
fsl_lpspi->is_slave = is_slave;
841842
fsl_lpspi->is_only_cs1 = of_property_read_bool((&pdev->dev)->of_node,
842843
"fsl,spi-only-use-cs1-sel");
844+
if (of_property_read_u32((&pdev->dev)->of_node, "num-cs",
845+
&fsl_lpspi->num_cs))
846+
fsl_lpspi->num_cs = 1;
843847

844848
controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32);
845849
controller->transfer_one = fsl_lpspi_transfer_one;
@@ -849,6 +853,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
849853
controller->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX;
850854
controller->dev.of_node = pdev->dev.of_node;
851855
controller->bus_num = pdev->id;
856+
controller->num_chipselect = fsl_lpspi->num_cs;
852857
controller->slave_abort = fsl_lpspi_slave_abort;
853858
if (!fsl_lpspi->is_slave)
854859
controller->use_gpio_descriptors = true;

0 commit comments

Comments
 (0)