Skip to content

Commit 6144436

Browse files
panguptaherbertx
authored andcommitted
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: Pankaj Gupta <[email protected]> Reviewed-by: Gaurav Jain <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent f8c423b commit 6144436

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/crypto/caam/ctrl.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ static const struct of_device_id caam_match[] = {
512512
MODULE_DEVICE_TABLE(of, caam_match);
513513

514514
struct caam_imx_data {
515+
bool page0_access;
515516
const struct clk_bulk_data *clks;
516517
int num_clks;
517518
};
@@ -524,6 +525,7 @@ static const struct clk_bulk_data caam_imx6_clks[] = {
524525
};
525526

526527
static const struct caam_imx_data caam_imx6_data = {
528+
.page0_access = true,
527529
.clks = caam_imx6_clks,
528530
.num_clks = ARRAY_SIZE(caam_imx6_clks),
529531
};
@@ -534,6 +536,7 @@ static const struct clk_bulk_data caam_imx7_clks[] = {
534536
};
535537

536538
static const struct caam_imx_data caam_imx7_data = {
539+
.page0_access = true,
537540
.clks = caam_imx7_clks,
538541
.num_clks = ARRAY_SIZE(caam_imx7_clks),
539542
};
@@ -545,6 +548,7 @@ static const struct clk_bulk_data caam_imx6ul_clks[] = {
545548
};
546549

547550
static const struct caam_imx_data caam_imx6ul_data = {
551+
.page0_access = true,
548552
.clks = caam_imx6ul_clks,
549553
.num_clks = ARRAY_SIZE(caam_imx6ul_clks),
550554
};
@@ -554,6 +558,7 @@ static const struct clk_bulk_data caam_vf610_clks[] = {
554558
};
555559

556560
static const struct caam_imx_data caam_vf610_data = {
561+
.page0_access = true,
557562
.clks = caam_vf610_clks,
558563
.num_clks = ARRAY_SIZE(caam_vf610_clks),
559564
};
@@ -860,6 +865,7 @@ static int caam_probe(struct platform_device *pdev)
860865
int pg_size;
861866
int BLOCK_OFFSET = 0;
862867
bool reg_access = true;
868+
const struct caam_imx_data *imx_soc_data;
863869

864870
ctrlpriv = devm_kzalloc(&pdev->dev, sizeof(*ctrlpriv), GFP_KERNEL);
865871
if (!ctrlpriv)
@@ -894,12 +900,20 @@ static int caam_probe(struct platform_device *pdev)
894900
return -EINVAL;
895901
}
896902

903+
imx_soc_data = imx_soc_match->data;
904+
reg_access = reg_access && imx_soc_data->page0_access;
905+
/*
906+
* CAAM clocks cannot be controlled from kernel.
907+
*/
908+
if (!imx_soc_data->num_clks)
909+
goto iomap_ctrl;
910+
897911
ret = init_clocks(dev, imx_soc_match->data);
898912
if (ret)
899913
return ret;
900914
}
901915

902-
916+
iomap_ctrl:
903917
/* Get configuration properties from device tree */
904918
/* First, get register page */
905919
ctrl = devm_of_iomap(dev, nprop, 0, NULL);

0 commit comments

Comments
 (0)