summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-dw-mmio.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:35:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:31 +0000
commit85c675d0d09a45a135bddd15d7b385f8758c32fb (patch)
tree76267dbc9b9a130337be3640948fe397b04ac629 /drivers/spi/spi-dw-mmio.c
parentAdding upstream version 6.6.15. (diff)
downloadlinux-85c675d0d09a45a135bddd15d7b385f8758c32fb.tar.xz
linux-85c675d0d09a45a135bddd15d7b385f8758c32fb.zip
Adding upstream version 6.7.7.upstream/6.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/spi/spi-dw-mmio.c')
-rw-r--r--drivers/spi/spi-dw-mmio.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index 805264c9c6..46801189a6 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -340,29 +340,20 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
if (dws->irq < 0)
return dws->irq; /* -ENXIO */
- dwsmmio->clk = devm_clk_get(&pdev->dev, NULL);
+ dwsmmio->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(dwsmmio->clk))
return PTR_ERR(dwsmmio->clk);
- ret = clk_prepare_enable(dwsmmio->clk);
- if (ret)
- return ret;
/* Optional clock needed to access the registers */
- dwsmmio->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
- if (IS_ERR(dwsmmio->pclk)) {
- ret = PTR_ERR(dwsmmio->pclk);
- goto out_clk;
- }
- ret = clk_prepare_enable(dwsmmio->pclk);
- if (ret)
- goto out_clk;
+ dwsmmio->pclk = devm_clk_get_optional_enabled(&pdev->dev, "pclk");
+ if (IS_ERR(dwsmmio->pclk))
+ return PTR_ERR(dwsmmio->pclk);
/* find an optional reset controller */
dwsmmio->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, "spi");
- if (IS_ERR(dwsmmio->rstc)) {
- ret = PTR_ERR(dwsmmio->rstc);
- goto out_clk;
- }
+ if (IS_ERR(dwsmmio->rstc))
+ return PTR_ERR(dwsmmio->rstc);
+
reset_control_deassert(dwsmmio->rstc);
dws->bus_num = pdev->id;
@@ -383,7 +374,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
if (init_func) {
ret = init_func(pdev, dwsmmio);
if (ret)
- goto out;
+ goto out_reset;
}
pm_runtime_enable(&pdev->dev);
@@ -397,9 +388,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
out:
pm_runtime_disable(&pdev->dev);
- clk_disable_unprepare(dwsmmio->pclk);
-out_clk:
- clk_disable_unprepare(dwsmmio->clk);
+out_reset:
reset_control_assert(dwsmmio->rstc);
return ret;
@@ -411,8 +400,6 @@ static void dw_spi_mmio_remove(struct platform_device *pdev)
dw_spi_remove_host(&dwsmmio->dws);
pm_runtime_disable(&pdev->dev);
- clk_disable_unprepare(dwsmmio->pclk);
- clk_disable_unprepare(dwsmmio->clk);
reset_control_assert(dwsmmio->rstc);
}