diff options
author | Han Xu <han.xu@nxp.com> | 2022-12-06 16:54:09 -0600 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-12-07 14:19:20 +0000 |
commit | 5f947746f0089529c85654704643f158b420ff92 (patch) | |
tree | eed6b366382bf221d8a464dbab20323364e80978 /drivers/spi | |
parent | 7073888c86601389e17f3ee8ab15ab7aef148839 (diff) |
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-fsl-lpspi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index e8c1c8a4c6c8..34488de55587 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -98,6 +98,7 @@ struct fsl_lpspi_data { struct clk *clk_ipg; struct clk *clk_per; bool is_slave; + u32 num_cs; bool is_only_cs1; bool is_first_byte; @@ -840,6 +841,9 @@ static int fsl_lpspi_probe(struct platform_device *pdev) fsl_lpspi->is_slave = is_slave; fsl_lpspi->is_only_cs1 = of_property_read_bool((&pdev->dev)->of_node, "fsl,spi-only-use-cs1-sel"); + if (of_property_read_u32((&pdev->dev)->of_node, "num-cs", + &fsl_lpspi->num_cs)) + fsl_lpspi->num_cs = 1; controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); controller->transfer_one = fsl_lpspi_transfer_one; @@ -849,6 +853,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev) controller->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX; controller->dev.of_node = pdev->dev.of_node; controller->bus_num = pdev->id; + controller->num_chipselect = fsl_lpspi->num_cs; controller->slave_abort = fsl_lpspi_slave_abort; if (!fsl_lpspi->is_slave) controller->use_gpio_descriptors = true; |