diff options
author | Aymen Sghaier <aymen.sghaier@nxp.com> | 2018-04-11 11:36:33 +0200 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 05d2076074509bc42a09700d06020211e8da26a3 (patch) | |
tree | bf4c57d74ab45bdd6fb97ad7cb4821a51474c7eb /drivers/crypto/caam | |
parent | 51906356ee1d391cbf05f1d2755a819153d48c26 (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/caam')
-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 | 30 |
3 files changed, 8 insertions, 70 deletions
diff --git a/drivers/crypto/caam/inst_rng.c b/drivers/crypto/caam/inst_rng.c index e30dafb142b1..51bedb9dbf6a 100644 --- a/drivers/crypto/caam/inst_rng.c +++ b/drivers/crypto/caam/inst_rng.c @@ -6,7 +6,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" @@ -270,10 +269,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; @@ -363,43 +362,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 4f49f1016655..66f098d94920 100644 --- a/drivers/crypto/caam/inst_rng.h +++ b/drivers/crypto/caam/inst_rng.h @@ -1,7 +1,7 @@ /* * CAAM Private/internal definitions between modules * - * Copyright 2017 NXP + * Copyright 2017-2018 NXP */ #ifndef INST_RNG_H @@ -10,9 +10,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 b218bd387678..537e95524e0e 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -3,15 +3,11 @@ * JobR backend functionality * * Copyright 2008-2016 Freescale Semiconductor, Inc. - * Copyright 2017 NXP + * Copyright 2017-2018 NXP */ #include <linux/of_irq.h> #include <linux/of_address.h> -#ifdef CONFIG_HAVE_IMX8_SOC -#include <soc/imx/revision.h> -#include <soc/imx8/soc.h> -#endif #include "compat.h" #include "regs.h" #include "jr.h" @@ -561,33 +557,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 /* CONFIG_HAVE_IMX8_SOC */ - } 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); |