All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] spi: lpspi: Add support for 'num-cs' property
@ 2021-12-07 10:41 Alexander Stein
  2021-12-07 12:57 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Stein @ 2021-12-07 10:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Alexander Stein, linux-spi

This adds support for multiple hardware chip selects. They are controlled
in register TCR bits 24, and possibly more depending on hardware platform.
The driver already supports multiple chip selects in fsl_lpspi_set_cmd(),
so allow setting more than the default 1 for supported chip selects in DT.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
This has been verified using a logic analyzer on a custom board on a
i.MX8XQP with 2 chip selects connected.

 drivers/spi/spi-fsl-lpspi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index 4c601294f8fa..532bdfb523ea 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -819,6 +819,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
 	struct spi_controller *controller;
 	struct resource *res;
 	int ret, irq;
+	u32 num_cs;
 	u32 temp;
 	bool is_slave;
 
@@ -835,6 +836,11 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, controller);
 
+	if (!device_property_read_u32(&pdev->dev, "num-cs", &num_cs))
+		controller->num_chipselect = num_cs;
+	else
+		controller->num_chipselect = 1;
+
 	fsl_lpspi = spi_controller_get_devdata(controller);
 	fsl_lpspi->dev = &pdev->dev;
 	fsl_lpspi->is_slave = is_slave;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-08 13:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 10:41 [PATCH 1/1] spi: lpspi: Add support for 'num-cs' property Alexander Stein
2021-12-07 12:57 ` Mark Brown
2021-12-08  6:59   ` (EXT) " Alexander Stein
2021-12-08 13:56     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.