[U-Boot] [PATCH v2 14/38] spi: Add support for memory-mapped flash

Simon Glass sjg at chromium.org
Fri Oct 18 14:13:52 UTC 2019


Hi Vignesh,

On Fri, 18 Oct 2019 at 02:50, Vignesh Raghavendra <vigneshr at ti.com> wrote:
>
[..]

> >>>> As it stands we don't actually use that uclass with this SPI flash
> >>>> driver - it implements the SPI_FLASH interface directly.
> >>>>
> >>>> But given that I'm going to try to use the same ich.c driver this
> >>>> should be easy enough.
> >>>>
> >>>> I've just found the weird mem_ops argument within struct dm_spi_ops...oh dear.
> >>>>
> >>>
> >>> The mem_ops was added by Vignesh. I believe that was derived from the
> >>> Linux kernel.
> >
>
> spi_mem_ops in U-Boot was added by Miquel while introducing SPI NAND
> support in U-Boot, but I extended its usage to SPI NOR devices as well.
>
> > The problem is that it is ops within ops so doesn't follow driver model.
>
> Hmm, why is that so?
> ops within ops is not unheard of and is common in kernel as well. This
> actually allows to grouping of similar operations into simple structs
> and thus improves readability.

It is not used elsewhere in driver model though.

Also there are no tests. How can we get some tests in there?

Regards,
Simon


More information about the U-Boot mailing list