mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
119 lines
3.2 KiB
Diff
119 lines
3.2 KiB
Diff
From b388e1b6a75d477735f7e2b90130169638b72c37 Mon Sep 17 00:00:00 2001
|
|
From: Corentin Labbe <clabbe@baylibre.com>
|
|
Date: Tue, 27 Sep 2022 07:54:53 +0000
|
|
Subject: [PATCH 31/49] crypto: rockchip: use clk_bulk to simplify clock
|
|
management
|
|
|
|
rk3328 does not have the same clock names than rk3288, instead of using a complex
|
|
clock management, let's use clk_bulk to simplify their handling.
|
|
|
|
Reviewed-by: John Keeping <john@metanate.com>
|
|
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
|
|
---
|
|
drivers/crypto/rockchip/rk3288_crypto.c | 66 ++++---------------------
|
|
drivers/crypto/rockchip/rk3288_crypto.h | 6 +--
|
|
2 files changed, 11 insertions(+), 61 deletions(-)
|
|
|
|
--- a/drivers/crypto/rockchip/rk3288_crypto.c
|
|
+++ b/drivers/crypto/rockchip/rk3288_crypto.c
|
|
@@ -22,47 +22,16 @@ static int rk_crypto_enable_clk(struct r
|
|
{
|
|
int err;
|
|
|
|
- err = clk_prepare_enable(dev->sclk);
|
|
- if (err) {
|
|
- dev_err(dev->dev, "[%s:%d], Couldn't enable clock sclk\n",
|
|
- __func__, __LINE__);
|
|
- goto err_return;
|
|
- }
|
|
- err = clk_prepare_enable(dev->aclk);
|
|
- if (err) {
|
|
- dev_err(dev->dev, "[%s:%d], Couldn't enable clock aclk\n",
|
|
- __func__, __LINE__);
|
|
- goto err_aclk;
|
|
- }
|
|
- err = clk_prepare_enable(dev->hclk);
|
|
- if (err) {
|
|
- dev_err(dev->dev, "[%s:%d], Couldn't enable clock hclk\n",
|
|
- __func__, __LINE__);
|
|
- goto err_hclk;
|
|
- }
|
|
- err = clk_prepare_enable(dev->dmaclk);
|
|
- if (err) {
|
|
- dev_err(dev->dev, "[%s:%d], Couldn't enable clock dmaclk\n",
|
|
- __func__, __LINE__);
|
|
- goto err_dmaclk;
|
|
- }
|
|
- return err;
|
|
-err_dmaclk:
|
|
- clk_disable_unprepare(dev->hclk);
|
|
-err_hclk:
|
|
- clk_disable_unprepare(dev->aclk);
|
|
-err_aclk:
|
|
- clk_disable_unprepare(dev->sclk);
|
|
-err_return:
|
|
+ err = clk_bulk_prepare_enable(dev->num_clks, dev->clks);
|
|
+ if (err)
|
|
+ dev_err(dev->dev, "Could not enable clock clks\n");
|
|
+
|
|
return err;
|
|
}
|
|
|
|
static void rk_crypto_disable_clk(struct rk_crypto_info *dev)
|
|
{
|
|
- clk_disable_unprepare(dev->dmaclk);
|
|
- clk_disable_unprepare(dev->hclk);
|
|
- clk_disable_unprepare(dev->aclk);
|
|
- clk_disable_unprepare(dev->sclk);
|
|
+ clk_bulk_disable_unprepare(dev->num_clks, dev->clks);
|
|
}
|
|
|
|
/*
|
|
@@ -266,27 +235,10 @@ static int rk_crypto_probe(struct platfo
|
|
goto err_crypto;
|
|
}
|
|
|
|
- crypto_info->aclk = devm_clk_get(&pdev->dev, "aclk");
|
|
- if (IS_ERR(crypto_info->aclk)) {
|
|
- err = PTR_ERR(crypto_info->aclk);
|
|
- goto err_crypto;
|
|
- }
|
|
-
|
|
- crypto_info->hclk = devm_clk_get(&pdev->dev, "hclk");
|
|
- if (IS_ERR(crypto_info->hclk)) {
|
|
- err = PTR_ERR(crypto_info->hclk);
|
|
- goto err_crypto;
|
|
- }
|
|
-
|
|
- crypto_info->sclk = devm_clk_get(&pdev->dev, "sclk");
|
|
- if (IS_ERR(crypto_info->sclk)) {
|
|
- err = PTR_ERR(crypto_info->sclk);
|
|
- goto err_crypto;
|
|
- }
|
|
-
|
|
- crypto_info->dmaclk = devm_clk_get(&pdev->dev, "apb_pclk");
|
|
- if (IS_ERR(crypto_info->dmaclk)) {
|
|
- err = PTR_ERR(crypto_info->dmaclk);
|
|
+ crypto_info->num_clks = devm_clk_bulk_get_all(&pdev->dev,
|
|
+ &crypto_info->clks);
|
|
+ if (crypto_info->num_clks < 3) {
|
|
+ err = -EINVAL;
|
|
goto err_crypto;
|
|
}
|
|
|
|
--- a/drivers/crypto/rockchip/rk3288_crypto.h
|
|
+++ b/drivers/crypto/rockchip/rk3288_crypto.h
|
|
@@ -190,10 +190,8 @@
|
|
|
|
struct rk_crypto_info {
|
|
struct device *dev;
|
|
- struct clk *aclk;
|
|
- struct clk *hclk;
|
|
- struct clk *sclk;
|
|
- struct clk *dmaclk;
|
|
+ struct clk_bulk_data *clks;
|
|
+ int num_clks;
|
|
struct reset_control *rst;
|
|
void __iomem *reg;
|
|
int irq;
|