aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fainelli <[email protected]>2020-04-20 15:08:45 -0400
committerMark Brown <[email protected]>2020-04-21 16:05:57 +0100
commit0392727c261bab65a35cd4f82ee9459bc237591d (patch)
tree033598aec9337ae48f475eaee474053ebb964986
parent4df3bea7f9d2ddd9ac2c29ba945c7c4db2def29c (diff)
spi: bcm-qspi: Handle clock probe deferral
The clock provider may not be ready by the time spi-bcm-qspi gets probed, handle probe deferral using devm_clk_get_optional(). Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Kamal Dasu <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--drivers/spi/spi-bcm-qspi.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index afed1ea62ec1..4c0d0cc4d3b1 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -1227,6 +1227,11 @@ int bcm_qspi_probe(struct platform_device *pdev,
}
qspi = spi_master_get_devdata(master);
+
+ qspi->clk = devm_clk_get_optional(&pdev->dev, NULL);
+ if (IS_ERR(qspi->clk))
+ return PTR_ERR(qspi->clk);
+
qspi->pdev = pdev;
qspi->trans_pos.trans = NULL;
qspi->trans_pos.byte = 0;
@@ -1340,13 +1345,6 @@ int bcm_qspi_probe(struct platform_device *pdev,
qspi->soc_intc = NULL;
}
- qspi->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(qspi->clk)) {
- dev_warn(dev, "unable to get clock\n");
- ret = PTR_ERR(qspi->clk);
- goto qspi_probe_err;
- }
-
ret = clk_prepare_enable(qspi->clk);
if (ret) {
dev_err(dev, "failed to prepare clock\n");