Commit 61444368 authored by Pankaj Gupta's avatar Pankaj Gupta Committed by Herbert Xu

crypto: caam - init-clk based on caam-page0-access

CAAM clock initializat is done based on the basis of soc specific
info stored in struct caam_imx_data:
- caam-page0-access flag
- num_clks

CAAM driver needs to be aware of access rights to CAAM control page
i.e., page0, to do things differently.
Signed-off-by: default avatarPankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: default avatarGaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f8c423ba
...@@ -512,6 +512,7 @@ static const struct of_device_id caam_match[] = { ...@@ -512,6 +512,7 @@ static const struct of_device_id caam_match[] = {
MODULE_DEVICE_TABLE(of, caam_match); MODULE_DEVICE_TABLE(of, caam_match);
struct caam_imx_data { struct caam_imx_data {
bool page0_access;
const struct clk_bulk_data *clks; const struct clk_bulk_data *clks;
int num_clks; int num_clks;
}; };
...@@ -524,6 +525,7 @@ static const struct clk_bulk_data caam_imx6_clks[] = { ...@@ -524,6 +525,7 @@ static const struct clk_bulk_data caam_imx6_clks[] = {
}; };
static const struct caam_imx_data caam_imx6_data = { static const struct caam_imx_data caam_imx6_data = {
.page0_access = true,
.clks = caam_imx6_clks, .clks = caam_imx6_clks,
.num_clks = ARRAY_SIZE(caam_imx6_clks), .num_clks = ARRAY_SIZE(caam_imx6_clks),
}; };
...@@ -534,6 +536,7 @@ static const struct clk_bulk_data caam_imx7_clks[] = { ...@@ -534,6 +536,7 @@ static const struct clk_bulk_data caam_imx7_clks[] = {
}; };
static const struct caam_imx_data caam_imx7_data = { static const struct caam_imx_data caam_imx7_data = {
.page0_access = true,
.clks = caam_imx7_clks, .clks = caam_imx7_clks,
.num_clks = ARRAY_SIZE(caam_imx7_clks), .num_clks = ARRAY_SIZE(caam_imx7_clks),
}; };
...@@ -545,6 +548,7 @@ static const struct clk_bulk_data caam_imx6ul_clks[] = { ...@@ -545,6 +548,7 @@ static const struct clk_bulk_data caam_imx6ul_clks[] = {
}; };
static const struct caam_imx_data caam_imx6ul_data = { static const struct caam_imx_data caam_imx6ul_data = {
.page0_access = true,
.clks = caam_imx6ul_clks, .clks = caam_imx6ul_clks,
.num_clks = ARRAY_SIZE(caam_imx6ul_clks), .num_clks = ARRAY_SIZE(caam_imx6ul_clks),
}; };
...@@ -554,6 +558,7 @@ static const struct clk_bulk_data caam_vf610_clks[] = { ...@@ -554,6 +558,7 @@ static const struct clk_bulk_data caam_vf610_clks[] = {
}; };
static const struct caam_imx_data caam_vf610_data = { static const struct caam_imx_data caam_vf610_data = {
.page0_access = true,
.clks = caam_vf610_clks, .clks = caam_vf610_clks,
.num_clks = ARRAY_SIZE(caam_vf610_clks), .num_clks = ARRAY_SIZE(caam_vf610_clks),
}; };
...@@ -860,6 +865,7 @@ static int caam_probe(struct platform_device *pdev) ...@@ -860,6 +865,7 @@ static int caam_probe(struct platform_device *pdev)
int pg_size; int pg_size;
int BLOCK_OFFSET = 0; int BLOCK_OFFSET = 0;
bool reg_access = true; bool reg_access = true;
const struct caam_imx_data *imx_soc_data;
ctrlpriv = devm_kzalloc(&pdev->dev, sizeof(*ctrlpriv), GFP_KERNEL); ctrlpriv = devm_kzalloc(&pdev->dev, sizeof(*ctrlpriv), GFP_KERNEL);
if (!ctrlpriv) if (!ctrlpriv)
...@@ -894,12 +900,20 @@ static int caam_probe(struct platform_device *pdev) ...@@ -894,12 +900,20 @@ static int caam_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
imx_soc_data = imx_soc_match->data;
reg_access = reg_access && imx_soc_data->page0_access;
/*
* CAAM clocks cannot be controlled from kernel.
*/
if (!imx_soc_data->num_clks)
goto iomap_ctrl;
ret = init_clocks(dev, imx_soc_match->data); ret = init_clocks(dev, imx_soc_match->data);
if (ret) if (ret)
return ret; return ret;
} }
iomap_ctrl:
/* Get configuration properties from device tree */ /* Get configuration properties from device tree */
/* First, get register page */ /* First, get register page */
ctrl = devm_of_iomap(dev, nprop, 0, NULL); ctrl = devm_of_iomap(dev, nprop, 0, NULL);
......
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