[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200522104536.4ikmhiaxg7keahdp@ti.com>
Date: Fri, 22 May 2020 16:15:36 +0530
From: Pratyush Yadav <p.yadav@...com>
To: <masonccyang@...c.com.tw>
CC: Alexandre Belloni <alexandre.belloni@...tlin.com>,
Boris Brezillon <boris.brezillon@...labora.com>,
Mark Brown <broonie@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-mtd@...ts.infradead.org>, <linux-spi@...r.kernel.org>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Sekhar Nori <nsekhar@...com>,
Richard Weinberger <richard@....at>,
Tudor Ambarus <tudor.ambarus@...rochip.com>,
Vignesh Raghavendra <vigneshr@...com>, <juliensu@...c.com.tw>
Subject: Re: [PATCH v5 01/19] spi: spi-mem: allow specifying whether an op is
DTR or not
[Seems like I forgot to send this and it stayed in my Drafts folder.
Anyway, fixed in v7]
Hi Mason,
On 21/05/20 04:27PM, masonccyang@...c.com.tw wrote:
>
> Hi Pratyush,
>
> Given cmd.nbytes a initial value & check it !
>
> >
> > [PATCH v5 01/19] spi: spi-mem: allow specifying whether an op is DTR or
> not
> >
> > Each phase is given a separate 'dtr' field so mixed protocols like
> > 4S-4D-4D can be supported.
> >
> > Signed-off-by: Pratyush Yadav <p.yadav@...com>
> > ---
> > drivers/spi/spi-mem.c | 3 +++
> > include/linux/spi/spi-mem.h | 8 ++++++++
> > 2 files changed, 11 insertions(+)
> >
> > diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
> > index 9a86cc27fcc0..93e255287ab9 100644
> > --- a/drivers/spi/spi-mem.c
> > +++ b/drivers/spi/spi-mem.c
> > @@ -156,6 +156,9 @@ bool spi_mem_default_supports_op(struct spi_mem
> *mem,
> > op->data.dir == SPI_MEM_DATA_OUT))
> > return false;
> >
> > + if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr)
> > + return false;
> > +
>
> + if (op->cmd.nbytes != 1)
> + return false;
Good catch. Will fix.
> > return true;
> > }
> > EXPORT_SYMBOL_GPL(spi_mem_default_supports_op);
>
>
> static int spi_mem_check_op(const struct spi_mem_op *op)
> {
> - if (!op->cmd.buswidth)
> + if (!op->cmd.buswidth || op->cmd.nbytes < 1 ||
> op->cmd.nbytes > 2)
> return -EINVAL;
Will fix.
>
> > diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
> > index af9ff2f0f1b2..e3dcb956bf61 100644
> > --- a/include/linux/spi/spi-mem.h
> > +++ b/include/linux/spi/spi-mem.h
>
> #define SPI_MEM_OP_CMD(__opcode, __buswidth) \
> { \
> .buswidth = __buswidth, \
> .opcode = __opcode, \
> + .nbytes = 1, \
> }
Will fix. Thanks.
--
Regards,
Pratyush Yadav
Texas Instruments India
Powered by blists - more mailing lists