[PATCH 2/6 v4] tpm2: Add a TPMv2 MMIO TIS driver

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Nov 5 09:17:21 CET 2021


Hi Simon, 

[...]

> > +                          u8 *result)
> > +{
> > +       struct tpm_tis_chip_data *drv_data = (void *)dev_get_driver_data(udev);
> > +
> > +       while (len--)
> > +               *result++ = ioread8(drv_data->iobase + addr);
> > +       return 0;
> > +}
> > +
> > +static int mmio_write_bytes(struct udevice *udev, u32 addr, u16 len,
> > +                           const u8 *value)
> > +{
> > +       struct tpm_tis_chip_data *drv_data = (void *)dev_get_driver_data(udev);
> > +
> > +       while (len--)
> > +               iowrite8(*value++, drv_data->iobase + addr);
> 
> So should this use regmap?
> 

Isn't the point of regmap abstracting the bus access itself? Something
along the lines of 

********			**********       ***********
* SPI **  --> 		*        * -->   * SPI DM ** --> Device
********			*        *       ***********
					* REGMAP *
********			*        *
* MMIO *  -->		*        * -->   **************
********			**********		 * MMIO access*  --> Device
									 **************

Right now we have discrete drivers for the SPI and MMIO TPMs.
However using it makes sense if we want to merge parts of the SPI, MMIO and I2C
drivers in the future. That though is not what this patchset deals with. 
Let's first clean up the crud of the TIS APIs duplication  we've been
carrying over various TPM drivers and worry about consolidating the bus
accesses later.

Thanks
/Ilias

> > +       return 0;
> > +}
> [..]
> 
> Regards,
> Simon


More information about the U-Boot mailing list