Skip to content

Commit 935da5e

Browse files
r-vigneshbroonie
authored andcommitted
mtd: spi-nor: cadence-quadspi: Handle probe deferral while requesting DMA channel
dma_request_chan_by_mask() can throw EPROBE_DEFER if DMA provider is not yet probed. Currently driver just falls back to using PIO mode (which is less efficient) in this case. Instead return probe deferral error as is so that driver will be re probed once DMA provider is available. Signed-off-by: Vignesh Raghavendra <[email protected]> Reviewed-by: Tudor Ambarus <[email protected]> Acked-by: Tudor Ambarus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent c61088d commit 935da5e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/mtd/spi-nor/controllers/cadence-quadspi.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ static void cqspi_controller_init(struct cqspi_st *cqspi)
11691169
cqspi_controller_enable(cqspi, 1);
11701170
}
11711171

1172-
static void cqspi_request_mmap_dma(struct cqspi_st *cqspi)
1172+
static int cqspi_request_mmap_dma(struct cqspi_st *cqspi)
11731173
{
11741174
dma_cap_mask_t mask;
11751175

@@ -1178,11 +1178,16 @@ static void cqspi_request_mmap_dma(struct cqspi_st *cqspi)
11781178

11791179
cqspi->rx_chan = dma_request_chan_by_mask(&mask);
11801180
if (IS_ERR(cqspi->rx_chan)) {
1181-
dev_err(&cqspi->pdev->dev, "No Rx DMA available\n");
1181+
int ret = PTR_ERR(cqspi->rx_chan);
1182+
1183+
if (ret != -EPROBE_DEFER)
1184+
dev_err(&cqspi->pdev->dev, "No Rx DMA available\n");
11821185
cqspi->rx_chan = NULL;
1183-
return;
1186+
return ret;
11841187
}
11851188
init_completion(&cqspi->rx_dma_complete);
1189+
1190+
return 0;
11861191
}
11871192

11881193
static const struct spi_nor_controller_ops cqspi_controller_ops = {
@@ -1269,8 +1274,11 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)
12691274
dev_dbg(nor->dev, "using direct mode for %s\n",
12701275
mtd->name);
12711276

1272-
if (!cqspi->rx_chan)
1273-
cqspi_request_mmap_dma(cqspi);
1277+
if (!cqspi->rx_chan) {
1278+
ret = cqspi_request_mmap_dma(cqspi);
1279+
if (ret == -EPROBE_DEFER)
1280+
goto err;
1281+
}
12741282
}
12751283
}
12761284

0 commit comments

Comments
 (0)