[RFC PATCH v2 1/2] optee: obtain emmc rpmb info from dt

Jens Wiklander jens.wiklander at linaro.org
Mon Jan 25 13:20:55 CET 2021


On Mon, Jan 25, 2021 at 12:50 PM Igor Opaniuk <igor.opaniuk at foundries.io> wrote:
>
> Hi Jens,
>
> On Mon, Jan 25, 2021 at 10:50 AM Jens Wiklander
> <jens.wiklander at linaro.org> wrote:
> >
> > Hi Igor,
> >
> > On Sun, Jan 24, 2021 at 11:39:45AM +0200, Igor Opaniuk wrote:
> > > From: Igor Opaniuk <igor.opaniuk at foundries.io>
> > >
> > > Add support for rpmb-dev property in optee node.
> > > Prioritize that provided eMMC info from DT for RPMB operations over
> > > the one provided by OP-TEE OS core in RPC calls.
> > >
> > > Signed-off-by: Igor Opaniuk <igor.opaniuk at foundries.io>
> > > ---
> > >
> > > Changes in v2:
> > > - Return NULL instead of ERR_PTR(-ENXIO) in get_rpmb_dev in case there
> > >   is no rpmb-dev property or somemithing went wrong
> > >
> > >  drivers/tee/optee/core.c          | 33 +++++++++++++++++
> > >  drivers/tee/optee/optee_private.h |  2 +-
> > >  drivers/tee/optee/rpmb.c          | 60 ++++++++++++++++++-------------
> > >  3 files changed, 70 insertions(+), 25 deletions(-)
> > >
> > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > > index b898c32edc..828ab9b00a 100644
> > > --- a/drivers/tee/optee/core.c
> > > +++ b/drivers/tee/optee/core.c
> > > @@ -12,6 +12,7 @@
> > >  #include <linux/arm-smccc.h>
> > >  #include <linux/err.h>
> > >  #include <linux/io.h>
> > > +#include <mmc.h>
> > >
> > >  #include "optee_smc.h"
> > >  #include "optee_msg.h"
> > > @@ -607,14 +608,46 @@ static optee_invoke_fn *get_invoke_func(struct udevice *dev)
> > >       return ERR_PTR(-EINVAL);
> > >  }
> > >
> > > +static struct mmc *get_rpmb_dev(struct udevice *dev)
> > > +{
> > > +     struct udevice *mmc_dev;
> > > +     const fdt32_t *phandle_p;
> > > +     u32 phandle;
> > > +     int ret = 0;
> > > +
> > > +     debug("optee: looking for rpmb device in DT.\n");
> > > +
> > > +     phandle_p  = ofnode_get_property(dev_ofnode(dev),
> > > +                                      "rpmb-dev", NULL);
> > > +     if (!phandle_p) {
> > > +             debug("optee: missing \"rpmb-dev\" property\n");
> >
> > With this we'll complain in the log each time "rpmb-dev" isn't found
> > even when OP-TEE isn't configured to use RPMB. This might cause some
> > confusion.
>
> Sure I'll wrap with "if (IS_ENABLED(CONFIG_SUPPORT_EMMC_RPMB))"
> get_rpmb_dev() invocation in optee_of_to_plat() .
>
> But as it's just a debug message, I would prefer to keep it for
> debugging purposes
> (I can adjust it, adding the phrase that the driver will use OP-TEE
> provided dev id instead).

Sounds good.

Cheers,
Jens


More information about the U-Boot mailing list