[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200714075251.12777-5-xiaoning.wang@nxp.com>
Date: Tue, 14 Jul 2020 15:52:50 +0800
From: Clark Wang <xiaoning.wang@....com>
To: broonie@...nel.org
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 4/5] spi: lpspi: handle EPROBE_DEFER when get cs-gpios number
From: Fabrice Goucem <fabrice.goucem@....com>
If SPI is probed before the GPIO driver, it may miss the cs-gpio
configuration in dtb.
Add defer probe handler to wait GPIO driver probe.
Signed-off-by: Fabrice Goucem <fabrice.goucem@....com>
Signed-off-by: Clark Wang <xiaoning.wang@....com>
---
drivers/spi/spi-fsl-lpspi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index 6fb77f0f657a..05b6ecd82974 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -887,6 +887,11 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
for (i = 0; i < controller->num_chipselect; i++) {
int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
+ if (cs_gpio == -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+ goto out_controller_put;
+ }
+
if (!gpio_is_valid(cs_gpio) && lpspi_platform_info)
cs_gpio = lpspi_platform_info->chipselect[i];
--
2.17.1
Powered by blists - more mailing lists