lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 1 Jul 2018 14:11:40 +0530
From:   Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Wolfram Sang <wsa@...-dreams.de>, Rob Herring <robh+dt@...nel.org>,
        Andreas Färber <afaerber@...e.de>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-i2c <linux-i2c@...r.kernel.org>,
        刘炜 <liuwei@...ions-semi.com>,
        mp-cs@...ions-semi.com, 96boards@...obotics.com,
        devicetree <devicetree@...r.kernel.org>,
        Daniel Thompson <daniel.thompson@...aro.org>,
        amit.kucheria@...aro.org,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        hzhang@...obotics.com, bdong@...obotics.com,
        Mani Sadhasivam <manivannanece23@...il.com>,
        Thomas Liau <thomas.liau@...ions-semi.com>,
        jeff.chen@...ions-semi.com
Subject: Re: [PATCH v3 5/6] i2c: Add Actions Semiconductor Owl family S900
 I2C driver

On Sun, Jul 01, 2018 at 01:43:33PM +0530, Manivannan Sadhasivam wrote:
> Hi Andy,
> 
> On Sun, Jul 01, 2018 at 12:11:00AM +0300, Andy Shevchenko wrote:
> > On Sat, Jun 30, 2018 at 4:33 PM, Manivannan Sadhasivam
> > <manivannan.sadhasivam@...aro.org> wrote:
> > > Add Actions Semiconductor Owl family S900 I2C driver.
> > 
> > Thanks for an update. Few left comments and it would LGTM.
> > 
> 
> Thanks :)
> 
> > > +static int owl_i2c_reset(struct owl_i2c_dev *i2c_dev)
> > > +{
> > 
> > > +       mdelay(1);
> > 
> > But now, since it's not used in atomic context, we may switch to
> > usleep_range() / msleep() instead.
> > 
> 
> okay, will use msleep()
>

Just realised, I have to use spinlock for the entire owl_i2c_master_xfer
function, so can't use sleep* for delay.

> > > +       owl_i2c_update_reg(i2c_dev->base + OWL_I2C_REG_CTL,
> > > +                               OWL_I2C_CTL_EN, true);
> > > +
> > 
> > > +       /* Wait 50ms for FIFO reset complete */
> > > +       do {
> > 
> > > +               mdelay(1);
> > 
> > Especially in this case it's very important.
> > 
> 
> Okay.

Same here, but I'm not sure about the latency. What is your suggestion?

Thanks,
Mani

> 
> > > +       } while (timeout++ < OWL_I2C_MAX_RETRIES);
> > 
> > > +}
> > 
> > > +       val = (i2c_dev->clk_rate + i2c_dev->bus_freq * 16 - 1) /
> > > +                               (i2c_dev->bus_freq * 16);
> > 
> > This is effectively DIV_ROUND_UP(->clk_rate, ->bus_freq * 16).
> > 
> 
> Ack.
> 
> > > +       /*
> > > +        * By default, 0 will be returned if interrupt occurred but no
> > > +        * read or write happened. Else if msg_ptr equals to message length,
> > > +        * message count will be returned.
> > > +        */
> > 
> > > +       if (i2c_dev->msg_ptr == msg->len)
> > > +               ret = num;
> > 
> > I dunno if
> > 
> > ret = ->msg_ptr == len ? num : 0;
> > 
> > would be slightly more explicit (yes, I aware about ret == 0).
> > 
> > Up to you to choose.
> > 
> 
> As per Peter's comment, returning 0 will get changed to an error value.
> Will use this pattern once we settle with a proper error value.
> 
> > > +       /* We support only frequencies of 100k and 400k for now */
> > > +       if (i2c_dev->bus_freq != OWL_I2C_DEF_SPEED_HZ &&
> > > +                       i2c_dev->bus_freq > OWL_I2C_MAX_SPEED_HZ) {
> > 
> > I think it should be != in the second case as well.
> > 
> 
> yeah, agree. We don't support any other frequencies now.
> 
> Thanks,
> Mani
> 
> > > +               dev_err(dev, "invalid clock-frequency %d\n", i2c_dev->bus_freq);
> > > +               return -EINVAL;
> > > +       }
> > 
> > -- 
> > With Best Regards,
> > Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ