[EXT] Re: [PATCH] i.MX8 crypto/fsl: Enable fsl CAAM rng driver

Gaurav Jain gaurav.jain at nxp.com
Fri Apr 22 13:11:51 CEST 2022


Hello Stefano

> -----Original Message-----
> From: Stefano Babic <sbabic at denx.de>
> Sent: Friday, April 22, 2022 2:29 AM
> To: Gaurav Jain <gaurav.jain at nxp.com>; Stefano Babic <sbabic at denx.de>; u-
> boot at lists.denx.de
> Cc: Fabio Estevam <festevam at gmail.com>; Priyanka Jain
> <priyanka.jain at nxp.com>; Ye Li <ye.li at nxp.com>; Horia Geanta
> <horia.geanta at nxp.com>; Silvano Di Ninno <silvano.dininno at nxp.com>; Varun
> Sethi <V.Sethi at nxp.com>; dl-uboot-imx <uboot-imx at nxp.com>
> Subject: [EXT] Re: [PATCH] i.MX8 crypto/fsl: Enable fsl CAAM rng driver
> 
> Caution: EXT Email
> 
> Hi Gaurav,
> 
> Il 19.04.22 16:04, Gaurav Jain ha scritto:
> > rng driver enabled to read random number using caam.
> >
> > Signed-off-by: Gaurav Jain <gaurav.jain at nxp.com>
> > ---
> >   drivers/crypto/fsl/jr.c  | 8 +++++++-
> >   drivers/crypto/fsl/rng.c | 8 +++++++-
> >   2 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c index
> > 85a3dac796..acd29924f7 100644
> > --- a/drivers/crypto/fsl/jr.c
> > +++ b/drivers/crypto/fsl/jr.c
> > @@ -767,8 +767,14 @@ init:
> >               return -1;
> >       }
> >   #if CONFIG_IS_ENABLED(OF_CONTROL)
> > -     if (ofnode_valid(scu_node))
> > +     if (ofnode_valid(scu_node)) {
> > +             if (IS_ENABLED(CONFIG_DM_RNG)) {
> > +                     ret = device_bind_driver(NULL, "caam-rng", "caam-rng", NULL);
> > +                     if (ret)
> > +                             printf("Couldn't bind rng driver (%d)\n", ret);
> > +             }
> >               return ret;
> > +     }
> >   #endif
> >
> >   #ifdef CONFIG_FSL_CORENET
> > diff --git a/drivers/crypto/fsl/rng.c b/drivers/crypto/fsl/rng.c index
> > 0636494805..b568c337a6 100644
> > --- a/drivers/crypto/fsl/rng.c
> > +++ b/drivers/crypto/fsl/rng.c
> > @@ -26,10 +26,16 @@ struct caam_rng_priv {
> >
> >   static int caam_rng_read_one(struct caam_rng_priv *priv)
> >   {
> > +     struct udevice *dev;
> >       int size = ALIGN(CAAM_RNG_MAX_FIFO_STORE_SIZE,
> ARCH_DMA_MINALIGN);
> >       int ret;
> >
> > -     ret = run_descriptor_jr(priv->desc);
> > +     if (uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr),
> &dev) || !dev) {
> > +             printf("No CAAM device\n");
> > +             return -ENODEV;
> > +     }
> > +
> > +     ret = misc_ioctl(dev, CAAM_JR_RUN_DESC, priv->desc);
> >       if (ret < 0)
> >               return -EIO;
> >
> 
> This breaks the kontron_sl28 board. Can you check and fix it, please ?
> Thanks !

Sent v2 of this patch after fixing the error.

Regards
Gaurav Jain
> 
> Best regards,
> Stefano
> 
> --
> =================================================================
> ====
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
> =================================================================
> ====


More information about the U-Boot mailing list