2019-12-13 15:40:04

by Adam Ford

[permalink] [raw]
Subject: [PATCH V2 1/3] crypto: caam: Add support for i.MX8M Mini

The i.MX8M Mini uses the same crypto engine as the i.MX8MQ, but
the driver is restricting the check to just the i.MX8MQ.

This patch expands the check for either i.MX8MQ or i.MX8MM.

Signed-off-by: Adam Ford <[email protected]>

---
V2: Expand the check that forces the setting on imx8mq to also be true for imx8mm
Explictly state imx8mm compatiblity instead of making it generic to all imx8m*
this is mostly due to lack of other hardware to test

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index d7c3c3805693..c01dda692ecc 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -102,7 +102,8 @@ static inline int run_descriptor_deco0(struct device *ctrldev, u32 *desc,
* Apparently on i.MX8MQ it doesn't matter if virt_en == 1
* and the following steps should be performed regardless
*/
- of_machine_is_compatible("fsl,imx8mq")) {
+ of_machine_is_compatible("fsl,imx8mq") ||
+ of_machine_is_compatible("fsl,imx8mm")) {
clrsetbits_32(&ctrl->deco_rsr, 0, DECORSR_JR0);

while (!(rd_reg32(&ctrl->deco_rsr) & DECORSR_VALID) &&
@@ -509,6 +510,7 @@ static const struct soc_device_attribute caam_imx_soc_table[] = {
{ .soc_id = "i.MX6*", .data = &caam_imx6_data },
{ .soc_id = "i.MX7*", .data = &caam_imx7_data },
{ .soc_id = "i.MX8MQ", .data = &caam_imx7_data },
+ { .soc_id = "i.MX8MM", .data = &caam_imx7_data },
{ .family = "Freescale i.MX" },
{ /* sentinel */ }
};
--
2.20.1


2019-12-13 15:40:11

by Adam Ford

[permalink] [raw]
Subject: [PATCH V2 3/3] arm64: defconfig: Enable CRYPTO_DEV_FSL_CAAM

Both the i.MX8MQ and i.MX8M Mini support the CAAM driver, but it
is currently not enabled by default.

This patch enables this driver by default.

Signed-off-by: Adam Ford <[email protected]>
---
V2: New to series

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 6a83ba2aea3e..0212975b908b 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -845,6 +845,7 @@ CONFIG_SECURITY=y
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_DEV_SUN8I_CE=m
+CONFIG_CRYPTO_DEV_FSL_CAAM=y
CONFIG_CRYPTO_DEV_HISI_ZIP=m
CONFIG_CMA_SIZE_MBYTES=32
CONFIG_PRINTK_TIME=y
--
2.20.1

2019-12-20 08:08:02

by Horia Geanta

[permalink] [raw]
Subject: Re: [PATCH V2 3/3] arm64: defconfig: Enable CRYPTO_DEV_FSL_CAAM

On 12/17/2019 8:25 PM, Fabio Estevam wrote:
> Hi Adam,
>
> On Tue, Dec 17, 2019 at 10:07 AM Adam Ford <[email protected]> wrote:
>
>> Out of curiosity, what is the rule for when things are 'm' vs 'y'?
>>
>> In the Code Aurora repo, it is set to 'y' and the mainline kernel for
>> the i.MX6/7, the imx_v6_v7_defconfig is also set to 'y' which is why I
>> used 'y' here.
>>
>> I can do a V3 to address the other items you noted, but I want to
>> understand the rules about the defconfig so I don't make the same
>> mistake again.
>
> In arch/arm64/configs/defconfig we try to select modules whenever possible.
>
> The exceptions are drivers that are vital for boot such as PMIC,
> pinctrl, clks, etc.
>
> The CAAM driver does not fall into this category, so selecting it as
> module is preferred here.
>
One comment here though.

CAAM's RNG is not "vital" for booting, but IIUC it would decrease the boot time
since it feeds the entropy pool through the hwrng interface.

Once RNG driver is fixed, would it be acceptable to add:
CONFIG_HW_RANDOM=y
CONFIG_CRYPTO_DEV_FSL_CAAM=y
in arm64 defconfig?

Thanks,
Horia