[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <000001d8058d$eb130710$c1391530$@mentor.com>
Date: Sun, 9 Jan 2022 22:20:01 +0300
From: Andrew Gabbasov <andrew_gabbasov@...tor.com>
To: 'Geert Uytterhoeven' <geert@...ux-m68k.org>
CC: 'Linux-Renesas' <linux-renesas-soc@...r.kernel.org>,
'Linux I2C' <linux-i2c@...r.kernel.org>,
'Linux Kernel Mailing List' <linux-kernel@...r.kernel.org>,
'Wolfram Sang' <wsa+renesas@...g-engineering.com>,
"Surachari, Bhuvanesh" <Bhuvanesh_Surachari@...tor.com>
Subject: RE: [PATCH] i2c: rcar: add SMBus block read support
Hello Geert, Wolfram,
Could you please let me know your opinion on version 2 of this patch,
that addressed your earlier review comments?
https://lore.kernel.org/all/20211006182314.10585-1-andrew_gabbasov@mentor.com/
Does it still need any further modifications or are you going to promote it further upstream?
Thanks.
Best regards,
Andrew
> -----Original Message-----
> From: Andrew Gabbasov <andrew_gabbasov@...tor.com>
> Sent: Thursday, November 18, 2021 1:35 PM
> To: 'Geert Uytterhoeven' <geert@...ux-m68k.org>
> Cc: 'Linux-Renesas' <linux-renesas-soc@...r.kernel.org>; 'Linux I2C' <linux-i2c@...r.kernel.org>; 'Linux Kernel
> Mailing List' <linux-kernel@...r.kernel.org>; 'Wolfram Sang' <wsa+renesas@...g-engineering.com>; Surachari,
> Bhuvanesh <Bhuvanesh_Surachari@...tor.com>
> Subject: RE: [PATCH] i2c: rcar: add SMBus block read support
>
> Hello Geert, Wolfram,
>
> Do you have any feedback on version 2 of this patch, that was submitted
> after your review comments below?
>
> https://lore.kernel.org/all/20211006182314.10585-1-andrew_gabbasov@mentor.com/
>
> Thanks!
>
> Best regards,
> Andrew
>
> > -----Original Message-----
> > From: Andrew Gabbasov <andrew_gabbasov@...tor.com>
> > Sent: Wednesday, October 06, 2021 9:12 PM
> > To: 'Geert Uytterhoeven' <geert@...ux-m68k.org>
> > Cc: Linux-Renesas <linux-renesas-soc@...r.kernel.org>; Linux I2C <linux-i2c@...r.kernel.org>; Linux Kernel
> > Mailing List <linux-kernel@...r.kernel.org>; Wolfram Sang <wsa+renesas@...g-engineering.com>; Surachari,
> > Bhuvanesh <Bhuvanesh_Surachari@...tor.com>
> > Subject: RE: [PATCH] i2c: rcar: add SMBus block read support
> >
> > Hi Geert,
> >
> > Thank you for your review!
> >
> > > -----Original Message-----
> > > From: Geert Uytterhoeven <geert@...ux-m68k.org>
> > > Sent: Tuesday, October 05, 2021 4:32 PM
> > > To: Gabbasov, Andrew <Andrew_Gabbasov@...tor.com>
> > > Cc: Linux-Renesas <linux-renesas-soc@...r.kernel.org>; Linux I2C <linux-i2c@...r.kernel.org>; Linux Kernel
> > > Mailing List <linux-kernel@...r.kernel.org>; Wolfram Sang <wsa+renesas@...g-engineering.com>; Surachari,
> > > Bhuvanesh <Bhuvanesh_Surachari@...tor.com>
> > > Subject: Re: [PATCH] i2c: rcar: add SMBus block read support
> > >
> > > Hi Andrew,
> > >
> > > On Wed, Sep 22, 2021 at 6:14 PM Andrew Gabbasov
> > > <andrew_gabbasov@...tor.com> wrote:
> > > > The smbus block read is not currently supported for rcar i2c devices.
> > > > This patchset adds the support to rcar i2c bus so that blocks of data
> > > > can be read using SMbus block reads.(using i2c_smbus_read_block_data()
> > > > function from the i2c-core-smbus.c).
> > > >
> > > > Inspired by commit 8e8782c71595 ("i2c: imx: add SMBus block read support")
> > > >
> > > > This patch (adapted) was tested with v4.14, but due to lack of real
> > > > hardware with SMBus block read operations support, using "simulation",
> > > > that is manual analysis of data, read from plain I2C devices with
> > > > SMBus block read request.
> > > >
> > > > Signed-off-by: Bhuvanesh Surachari <bhuvanesh_surachari@...tor.com>
> > > > Signed-off-by: Andrew Gabbasov <andrew_gabbasov@...tor.com>
> > >
> > > Thanks for your patch!
> > >
> > > > --- a/drivers/i2c/busses/i2c-rcar.c
> > > > +++ b/drivers/i2c/busses/i2c-rcar.c
> > > > @@ -429,9 +431,16 @@ static bool rcar_i2c_dma(struct rcar_i2c_priv *priv)
> > > > /*
> > > > * The last two bytes needs to be fetched using PIO in
> > > > * order for the STOP phase to work.
> > > > + *
> > > > + * For SMBus block read the first byte was received using PIO.
> > >
> > > So it might be easier to read, and more maintainable, to keep the
> > > old assignments:
> > >
> > > buf = priv->msg->buf;
> > > len = priv->msg->len - 2;
> > >
> > > and adjust them for SMBus afterwards:
> > >
> > > if (block_data) {
> > > /* For SMBus block read the first byte was received using PIO */
> > > buf++;
> > > len--;
> > > }
> > >
> > > ?
> > >
> > > > */
> > > > - buf = priv->msg->buf;
> > > > - len = priv->msg->len - 2;
> > > > + if (block_data) {
> > > > + buf = priv->msg->buf + 1;
> > > > + len = priv->msg->len - 3;
> > > > + } else {
> > > > + buf = priv->msg->buf;
> > > > + len = priv->msg->len - 2;
> > > > + }
> > > > } else {
> > > > /*
> > > > * First byte in message was sent using PIO.
> > >
> > > And below we have another case handling buf and len :-(
> > >
> > > So perhaps:
> > >
> > > buf = priv->msg->buf;
> > > len = priv->msg->len;
> > >
> > > if (read) {
> > > /*
> > > * The last two bytes needs to be fetched using PIO in
> > > * order for the STOP phase to work.
> > > */
> > > len -= 2;
> > > }
> > > if (!read || block_data) {
> > > /* First byte in message was sent using PIO *
> > > buf++;
> > > len--;
> > > }
> >
> > Probably I was trying to minimize the changes ;-)
> >
> > However, I agree with you that the whole code fragment can be simplified
> > and your variant indeed looks more clean and understandable.
> > Thank you for your suggestion, I'll submit version 2 of the patch
> > with this fragment changed.
> >
> > Thanks!
> >
> > Best regards,
> > Andrew
Powered by blists - more mailing lists