Commit 3a6fd464 authored by Corentin Labbe's avatar Corentin Labbe Committed by Herbert Xu

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: default avatarJohn Keeping <john@metanate.com>
Signed-off-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6f611925
...@@ -22,47 +22,16 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) ...@@ -22,47 +22,16 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)
{ {
int err; int err;
err = clk_prepare_enable(dev->sclk); err = clk_bulk_prepare_enable(dev->num_clks, dev->clks);
if (err) { if (err)
dev_err(dev->dev, "[%s:%d], Couldn't enable clock sclk\n", dev_err(dev->dev, "Could not enable clock clks\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:
return err; return err;
} }
static void rk_crypto_disable_clk(struct rk_crypto_info *dev) static void rk_crypto_disable_clk(struct rk_crypto_info *dev)
{ {
clk_disable_unprepare(dev->dmaclk); clk_bulk_disable_unprepare(dev->num_clks, dev->clks);
clk_disable_unprepare(dev->hclk);
clk_disable_unprepare(dev->aclk);
clk_disable_unprepare(dev->sclk);
} }
/* /*
...@@ -266,27 +235,10 @@ static int rk_crypto_probe(struct platform_device *pdev) ...@@ -266,27 +235,10 @@ static int rk_crypto_probe(struct platform_device *pdev)
goto err_crypto; goto err_crypto;
} }
crypto_info->aclk = devm_clk_get(&pdev->dev, "aclk"); crypto_info->num_clks = devm_clk_bulk_get_all(&pdev->dev,
if (IS_ERR(crypto_info->aclk)) { &crypto_info->clks);
err = PTR_ERR(crypto_info->aclk); if (crypto_info->num_clks < 3) {
goto err_crypto; err = -EINVAL;
}
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);
goto err_crypto; goto err_crypto;
} }
......
...@@ -190,10 +190,8 @@ ...@@ -190,10 +190,8 @@
struct rk_crypto_info { struct rk_crypto_info {
struct device *dev; struct device *dev;
struct clk *aclk; struct clk_bulk_data *clks;
struct clk *hclk; int num_clks;
struct clk *sclk;
struct clk *dmaclk;
struct reset_control *rst; struct reset_control *rst;
void __iomem *reg; void __iomem *reg;
int irq; int irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment