Re: [PATCH v3 17/22] mtd: spinand: Create direct mapping descriptors for ECC operations

Miquel Raynal
2021-12-07T10:54:30Z

Hi Boris,

boris.brezillon@collabora.com wrote on Tue, 7 Dec 2021 10:46:27 +0100:

> On Tue, 7 Dec 2021 10:34:17 +0100
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> > /**
> > diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
> > index 85e2ff7b840d..3be594be24c0 100644
> > --- a/include/linux/spi/spi-mem.h
> > +++ b/include/linux/spi/spi-mem.h
> > @@ -94,6 +94,7 @@ enum spi_mem_data_dir {
> > * operation does not involve transferring data
> > * @data.buf.in: input buffer (must be DMA-able)
> > * @data.buf.out: output buffer (must be DMA-able)
> > + * @ecc_en: error correction is required
> > */
> > struct spi_mem_op {
> > struct {
> > @@ -126,6 +127,8 @@ struct spi_mem_op {
> > const void *out;
> > } buf;
> > } data;
> > +
> > + bool ecc_en;
> > };
>
> I really think this should be in it's own commit.

Oh crap, I forgot about that.

> And you need to make
> sure all existing drivers reject operation that have ecc_en set to
> true (that shouldn't be too complicated since most of them use generic
> helpers to do the check).

Yes, I can add this check as well.

I will propose a first patch creating a spi-mem helper to do generic
checks, given a number of additional parameters (dtr, ecc). The current
helpers will call this generic function depending on what they check
(support for dtr or not). Then I will export this generic helper and
let the drivers use it directly if needed, in order to avoid the
explosion of helpers in the core to check all the possible combinations.

I'll certainly propose a v4 just with these patches and then apply them
within the v3 if everyone agrees with the rest.

Thanks,
Miquèl