From: manivannan.sadhasivam@linaro.org (Manivannan Sadhasivam)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 5/6] i2c: Add Actions Semiconductor Owl family S900 I2C driver
Date: Sun, 1 Jul 2018 13:43:33 +0530 [thread overview]
Message-ID: <20180701081333.GB28390@Mani-XPS-13-9360> (raw)
In-Reply-To: <CAHp75VcVNb51tJzKbCU3pqf0XYPCUZWpv38nfaV1711vyf2S0Q@mail.gmail.com>
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@linaro.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()
> > + 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.
> > + } 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
next prev parent reply other threads:[~2018-07-01 8:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 13:33 [PATCH v3 0/6] Add Actions Semiconductor Owl S900 I2C support Manivannan Sadhasivam
2018-06-30 13:33 ` [PATCH v3 1/6] dt-bindings: i2c: Add binding for Actions Semiconductor Owl I2C controller Manivannan Sadhasivam
2018-06-30 13:33 ` [PATCH v3 2/6] arm64: dts: actions: Add Actions Semiconductor S900 I2C controller nodes Manivannan Sadhasivam
2018-06-30 20:57 ` Peter Rosin
2018-06-30 13:33 ` [PATCH v3 3/6] arm64: dts: actions: Add pinctrl definition for S900 I2C controller Manivannan Sadhasivam
2018-06-30 13:33 ` [PATCH v3 4/6] arm64: dts: actions: Enable I2C1 and I2C2 in Bubblegum-96 board Manivannan Sadhasivam
2018-06-30 13:33 ` [PATCH v3 5/6] i2c: Add Actions Semiconductor Owl family S900 I2C driver Manivannan Sadhasivam
2018-06-30 21:11 ` Andy Shevchenko
2018-07-01 8:13 ` Manivannan Sadhasivam [this message]
2018-07-01 8:41 ` Manivannan Sadhasivam
2018-07-01 9:11 ` Andy Shevchenko
2018-07-01 4:57 ` Peter Rosin
2018-07-01 8:08 ` Manivannan Sadhasivam
2018-06-30 13:33 ` [PATCH v3 6/6] MAINTAINERS: Add entry for Actions Semiconductor Owl " Manivannan Sadhasivam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180701081333.GB28390@Mani-XPS-13-9360 \
--to=manivannan.sadhasivam@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox