MLK-24708 spi: imx: 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. Reviewed-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> (cherry picked from commit c2b2a4d1006b48ab311d2f948e83490d8ea453f5)5.4-rM2-2.2.x-imx-squashed
parent
8660d4e1be
commit
a6d5b357da
|
@ -1775,8 +1775,13 @@ static int spi_imx_probe(struct platform_device *pdev)
|
|||
/* Request GPIO CS lines, if any */
|
||||
if (!spi_imx->slave_mode && master->cs_gpios) {
|
||||
for (i = 0; i < master->num_chipselect; i++) {
|
||||
if (!gpio_is_valid(master->cs_gpios[i]))
|
||||
if (!gpio_is_valid(master->cs_gpios[i])) {
|
||||
if (master->cs_gpios[i] == -EPROBE_DEFER) {
|
||||
ret = -EPROBE_DEFER;
|
||||
goto out_spi_bitbang;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = devm_gpio_request(&pdev->dev,
|
||||
master->cs_gpios[i],
|
||||
|
|
Loading…
Reference in New Issue