1
0
Fork 0

MLK-24366-3 spi: lpspi: handle EPROBE_DEFER when get cs-gpios number

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@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Fabrice Goucem 2020-06-29 14:49:44 +02:00 committed by Clark Wang
parent 9cc4a608fd
commit ee28ce5745
1 changed files with 5 additions and 0 deletions

View File

@ -895,6 +895,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];