mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
crypto: rockchip: use devm_clk_bulk_get_all instead of devm_clk_bulk_get
Change-Id: I0af82671c0a835fb4b3a35c5b65de19a9414f843 Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
This commit is contained in:
@@ -29,8 +29,6 @@
|
||||
.valid_algs_num = ARRAY_SIZE(names),\
|
||||
.total_algs = crypto_v1_algs,\
|
||||
.total_algs_num = ARRAY_SIZE(crypto_v1_algs),\
|
||||
.clks = crypto_v1_clks,\
|
||||
.clks_num = ARRAY_SIZE(crypto_v1_clks),\
|
||||
.rsts = crypto_v1_rsts,\
|
||||
.rsts_num = ARRAY_SIZE(crypto_v1_rsts),\
|
||||
.hw_init = rk_hw_crypto_v1_init,\
|
||||
@@ -44,8 +42,6 @@
|
||||
.valid_algs_num = ARRAY_SIZE(names),\
|
||||
.total_algs = crypto_v2_algs,\
|
||||
.total_algs_num = ARRAY_SIZE(crypto_v2_algs),\
|
||||
.clks = crypto_v2_clks,\
|
||||
.clks_num = ARRAY_SIZE(crypto_v2_clks),\
|
||||
.rsts = crypto_v2_rsts,\
|
||||
.rsts_num = ARRAY_SIZE(crypto_v2_rsts),\
|
||||
.hw_init = rk_hw_crypto_v2_init,\
|
||||
@@ -59,8 +55,8 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)
|
||||
|
||||
dev_dbg(dev->dev, "clk_bulk_prepare_enable.\n");
|
||||
|
||||
ret = clk_bulk_prepare_enable(dev->soc_data->clks_num,
|
||||
&dev->clk_bulks[0]);
|
||||
ret = clk_bulk_prepare_enable(dev->clks_num,
|
||||
dev->clk_bulks);
|
||||
if (ret < 0)
|
||||
dev_err(dev->dev, "failed to enable clks %d\n", ret);
|
||||
|
||||
@@ -71,7 +67,7 @@ static void rk_crypto_disable_clk(struct rk_crypto_info *dev)
|
||||
{
|
||||
dev_dbg(dev->dev, "clk_bulk_disable_unprepare.\n");
|
||||
|
||||
clk_bulk_disable_unprepare(dev->soc_data->clks_num, &dev->clk_bulks[0]);
|
||||
clk_bulk_disable_unprepare(dev->clks_num, dev->clk_bulks);
|
||||
}
|
||||
|
||||
static int check_alignment(struct scatterlist *sg_src,
|
||||
@@ -374,13 +370,6 @@ static void rk_crypto_action(void *data)
|
||||
reset_control_assert(crypto_info->rst);
|
||||
}
|
||||
|
||||
static const char * const crypto_v2_clks[] = {
|
||||
"hclk",
|
||||
"aclk",
|
||||
"sclk",
|
||||
"apb_pclk",
|
||||
};
|
||||
|
||||
static const char * const crypto_v2_rsts[] = {
|
||||
"crypto-rst",
|
||||
};
|
||||
@@ -448,13 +437,6 @@ static const struct rk_crypto_soc_data px30_soc_data =
|
||||
static const struct rk_crypto_soc_data rv1126_soc_data =
|
||||
RK_CRYPTO_V2_SOC_DATA_INIT(rv1126_algs_name, true);
|
||||
|
||||
static const char * const crypto_v1_clks[] = {
|
||||
"hclk",
|
||||
"aclk",
|
||||
"sclk",
|
||||
"apb_pclk",
|
||||
};
|
||||
|
||||
static const char * const crypto_v1_rsts[] = {
|
||||
"crypto-rst",
|
||||
};
|
||||
@@ -511,7 +493,7 @@ static int rk_crypto_probe(struct platform_device *pdev)
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
const struct of_device_id *match;
|
||||
struct rk_crypto_info *crypto_info;
|
||||
int err = 0, i;
|
||||
int err = 0;
|
||||
|
||||
crypto_info = devm_kzalloc(&pdev->dev,
|
||||
sizeof(*crypto_info), GFP_KERNEL);
|
||||
@@ -523,13 +505,6 @@ static int rk_crypto_probe(struct platform_device *pdev)
|
||||
match = of_match_node(crypto_of_id_table, np);
|
||||
crypto_info->soc_data = (struct rk_crypto_soc_data *)match->data;
|
||||
|
||||
crypto_info->clk_bulks =
|
||||
devm_kzalloc(&pdev->dev, sizeof(*crypto_info->clk_bulks) *
|
||||
crypto_info->soc_data->clks_num, GFP_KERNEL);
|
||||
|
||||
for (i = 0; i < crypto_info->soc_data->clks_num; i++)
|
||||
crypto_info->clk_bulks[i].id = crypto_info->soc_data->clks[i];
|
||||
|
||||
if (crypto_info->soc_data->rsts[0]) {
|
||||
crypto_info->rst =
|
||||
devm_reset_control_get(dev,
|
||||
@@ -556,9 +531,8 @@ static int rk_crypto_probe(struct platform_device *pdev)
|
||||
goto err_crypto;
|
||||
}
|
||||
|
||||
err = devm_clk_bulk_get(dev, crypto_info->soc_data->clks_num,
|
||||
crypto_info->clk_bulks);
|
||||
if (err) {
|
||||
crypto_info->clks_num = devm_clk_bulk_get_all(&pdev->dev, &crypto_info->clk_bulks);
|
||||
if (crypto_info->clks_num < 0) {
|
||||
dev_err(&pdev->dev, "failed to get clks property\n");
|
||||
goto err_crypto;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ struct rk_crypto_soc_data {
|
||||
int valid_algs_num;
|
||||
struct rk_crypto_tmp **total_algs;
|
||||
int total_algs_num;
|
||||
const char * const *clks;
|
||||
const char * const *rsts;
|
||||
int clks_num;
|
||||
int rsts_num;
|
||||
unsigned int hw_info_size;
|
||||
bool use_soft_aes192;
|
||||
@@ -61,6 +59,7 @@ struct rk_crypto_info {
|
||||
struct scatterlist sg_tmp;
|
||||
struct scatterlist *first;
|
||||
struct rk_crypto_soc_data *soc_data;
|
||||
int clks_num;
|
||||
struct clk_bulk_data *clk_bulks;
|
||||
unsigned int left_bytes;
|
||||
void *addr_vir;
|
||||
|
||||
Reference in New Issue
Block a user