Commit 35f859fc authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Herbert Xu

crypto: ccree - better clock handling

Use managed clock handling, differentiate between no clock (possibly OK)
and clock init failure (never OK) and correctly handle clock detection
being deferred.
Suggested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 281a58c8
...@@ -190,6 +190,7 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -190,6 +190,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
u64 dma_mask; u64 dma_mask;
const struct cc_hw_data *hw_rev; const struct cc_hw_data *hw_rev;
const struct of_device_id *dev_id; const struct of_device_id *dev_id;
struct clk *clk;
int rc = 0; int rc = 0;
new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL); new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
...@@ -219,7 +220,24 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -219,7 +220,24 @@ static int init_cc_resources(struct platform_device *plat_dev)
platform_set_drvdata(plat_dev, new_drvdata); platform_set_drvdata(plat_dev, new_drvdata);
new_drvdata->plat_dev = plat_dev; new_drvdata->plat_dev = plat_dev;
new_drvdata->clk = of_clk_get(np, 0); clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk))
switch (PTR_ERR(clk)) {
/* Clock is optional so this might be fine */
case -ENOENT:
break;
/* Clock not available, let's try again soon */
case -EPROBE_DEFER:
return -EPROBE_DEFER;
default:
dev_err(dev, "Error getting clock: %ld\n",
PTR_ERR(clk));
return PTR_ERR(clk);
}
new_drvdata->clk = clk;
new_drvdata->coherent = of_dma_is_coherent(np); new_drvdata->coherent = of_dma_is_coherent(np);
/* Get device resources */ /* Get device resources */
......
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