diff options
author | Aymen Sghaier <aymen.sghaier@nxp.com> | 2018-04-11 11:36:33 +0200 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:32:49 +0800 |
commit | f06ccb125bbcd3e743d0d0eaabd158c21d3c5361 (patch) | |
tree | 5f4419e3a8f235650d377b595f41679b53adb7b4 /drivers/crypto | |
parent | 4f2f6dd13be7ce4e1d77b90f0c6a5ad3dd6a5dd8 (diff) |
MLK-17302: crypto: caam: Move RNG instantiation to SECO
On i.MX8 platforms with SECO/SCU the RNG is not anymore instantiated
by the Kernel driver but by SECO. This is true for B0 revision and
later. A0 revision is not supported.
Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/inst_rng.c | 42 | ||||
-rw-r--r-- | drivers/crypto/caam/inst_rng.h | 6 | ||||
-rw-r--r-- | drivers/crypto/caam/jr.c | 24 |
3 files changed, 7 insertions, 65 deletions
diff --git a/drivers/crypto/caam/inst_rng.c b/drivers/crypto/caam/inst_rng.c index 7ab379dfe448..a8ed0816ff0e 100644 --- a/drivers/crypto/caam/inst_rng.c +++ b/drivers/crypto/caam/inst_rng.c @@ -7,7 +7,6 @@ #include <linux/device.h> #include <linux/of_address.h> -#include <soc/imx8/sc/sci.h> #include <linux/wait.h> #include "compat.h" #include "regs.h" @@ -271,10 +270,10 @@ static void kick_trng(struct device *ctrldev, int ent_delay) } /* - * inst_rng_imx6 - RNG instantiation function for i.MX6/7 platforms + * inst_rng_imx - RNG instantiation function for i.MX6/7/8m platforms * @pdev - pointer to the device */ -int inst_rng_imx6(struct platform_device *pdev) +int inst_rng_imx(struct platform_device *pdev) { struct device *ctrldev, *dev; struct caam_drv_private *ctrlpriv; @@ -367,43 +366,6 @@ int inst_rng_imx6(struct platform_device *pdev) } /* - * inst_rng_imx8 - RNG instantiation function for i.MX8 platforms - * @pdev - pointer to the device - */ -int inst_rng_imx8(struct platform_device *pdev) -{ - struct device *ctrldev, *dev; - struct caam_drv_private *ctrlpriv; - struct caam_ctrl __iomem *ctrl; - int ret = 0, rdx; - u32 cha_vid_ls; - - dev = &pdev->dev; - ctrldev = pdev->dev.parent; - ctrlpriv = dev_get_drvdata(ctrldev); - ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl; - - rdx = ctrlpriv->first_jr_index; - cha_vid_ls = rd_reg32(&ctrlpriv->jr[rdx]->perfmon.cha_id_ls); - /* - * If SEC has RNG version >= 4 and RNG state handle has not been - * already instantiated, do RNG instantiation - */ - if ((cha_vid_ls & CHA_ID_LS_RNG_MASK) >> CHA_ID_LS_RNG_SHIFT >= 4) { - /* - * For i.MX8QM rev A0 the secure keys (TDKEK, JDKEK, TDSK), - * are not * generated so gen_sk is set to 1. - */ - ret = instantiate_rng(0, 1); - } - /* - * For i.MX8QM rev A0, SH0 and SH1 are instantiated here. - */ - ctrlpriv->rng4_sh_init = RDSTA_IFMASK; - return ret; -} - -/* * deinst_rng - RNG de-instantiation function * @pdev - pointer to the device */ diff --git a/drivers/crypto/caam/inst_rng.h b/drivers/crypto/caam/inst_rng.h index 87bfc2c9fcf8..e0477262fe2a 100644 --- a/drivers/crypto/caam/inst_rng.h +++ b/drivers/crypto/caam/inst_rng.h @@ -2,7 +2,7 @@ /* * CAAM Private/internal definitions between modules * - * Copyright 2017-2018 NXP Semiconductor, Inc. + * Copyright 2017-2018 NXP */ #ifndef INST_RNG_H @@ -11,9 +11,7 @@ #include <linux/platform_device.h> #define ENT_DELAY_STEP (400) -int inst_rng_imx6(struct platform_device *pdev); - -int inst_rng_imx8(struct platform_device *pdev); +int inst_rng_imx(struct platform_device *pdev); int deinst_rng(struct platform_device *pdev); diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 847d91a5ca7e..c400c3c4319b 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -578,33 +578,15 @@ static int caam_jr_probe(struct platform_device *pdev) * then try to instantiate RNG */ if (jrppriv->ridx == jrpriv->ridx) { - if (of_machine_is_compatible("fsl,imx8qm") || - of_machine_is_compatible("fsl,imx8qxp")) { - /* - * This is a workaround for SOC REV_A0: - * i.MX8QM and i.MX8QXP reach kernel level - * with RNG un-instantiated. It is instantiated - * here unlike REV_B0 and later. - */ -#ifdef CONFIG_HAVE_IMX8_SOC - if (imx8_get_soc_revision() == IMX_CHIP_REVISION_1_0) - error = inst_rng_imx8(pdev); -#endif - } else { + if (!of_machine_is_compatible("fsl,imx8qm") && + !of_machine_is_compatible("fsl,imx8qxp")) /* * This call is done for legacy SOCs: * i.MX6 i.MX7 and i.MX8M (mScale). */ - error = inst_rng_imx6(pdev); - } + error = inst_rng_imx(pdev); } if (error != 0) { -#ifdef CONFIG_HAVE_IMX8_SOC - if (imx8_get_soc_revision() == IMX_CHIP_REVISION_1_0) - dev_err(jrdev, - "This is a known limitation on A0 SOC revision\n" - "RNG instantiation failed, CAAM needs a reboot\n"); -#endif /* CONFIG_HAVE_IMX8_SOC */ spin_lock(&driver_data.jr_alloc_lock); list_del(&jrpriv->list_node); spin_unlock(&driver_data.jr_alloc_lock); |