[PATCH 1/1] spi: lpspi: Add support for 'num-cs' property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
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




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux