Skip to content

Commit

Permalink
MLK-24708 spi: imx: handle EPROBE_DEFER when get cs-gpios number
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wangxiaoningnxp committed Sep 4, 2020
1 parent f34abcf commit c2b2a4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/spi/spi-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit c2b2a4d

Please sign in to comment.