[PATCH v6 3/7] tpm: Add the RNG child device

Simon Glass sjg at chromium.org
Tue Jul 12 12:58:40 CEST 2022


Hi Ilias,

On Fri, 8 Jul 2022 at 02:24, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> Hi Simon,
>
> [...]
>
> > > +
> > >  UCLASS_DRIVER(tpm) = {
> > > -       .id             = UCLASS_TPM,
> > > -       .name           = "tpm",
> > > -       .flags          = DM_UC_FLAG_SEQ_ALIAS,
> > > +       .id                     = UCLASS_TPM,
> > > +       .name                   = "tpm",
> > > +       .flags                  = DM_UC_FLAG_SEQ_ALIAS,
> > >  #if CONFIG_IS_ENABLED(OF_REAL)
> > > -       .post_bind      = dm_scan_fdt_dev,
> > > +       .post_bind              = dm_scan_fdt_dev,
> > >  #endif
> > > +       .post_probe             = tpm_uclass_post_probe,
> > >         .per_device_auto        = sizeof(struct tpm_chip_priv),
> > >  };
> > > --
> > > 2.25.1
> > >
> >
> > The driver needs a compatible string so it can be in the device tree.
>
> Why?  I've tried to hint this on the previous iteration of the patch.
> The RNG here is not a *device*.  The TPM is the device and you are
> guaranteed to have an RNG.  The way to get a random number is send a
> special command to the TPM. So all that we should do here is leverage
> the fact that the TPM is already in the device tree.
>
> And fwiw we should stick to try to stick to what the DT spec defines
> as much as possible.  I personally don't see this as a special usecase
> were deviating from the spec is justified.

This is not a deviation from a spec. What spec? Also, I don't want to
get into another discussion about what a device is. We can disagree on
that if you like.

One reason is that U-Boot generally requires compatible strings, e.g.
with of-platdata. But also we can refer to the rand device from
elsewhere in the tree. I know that Linux does lots of ad-hoc device
creation and doesn't really have the concept of a uclass consistently
applied, but this is U-Boot.

So please add a compatible string sow e can use it in the DT.

\Regards,
Simon


More information about the U-Boot mailing list