From: nsekhar@ti.com (Sekhar Nori)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] i2c: davinci: Avoid zero value of CLKH
Date: Tue, 17 Jul 2018 17:27:51 +0530 [thread overview]
Message-ID: <ab965f1d-de6c-75f7-9ebd-35d31ed3de18@ti.com> (raw)
In-Reply-To: <20180713152017.2207-1-alexander.sverdlin@nokia.com>
On Friday 13 July 2018 08:50 PM, Alexander Sverdlin wrote:
> If CLKH is set to 0 I2C clock is not generated at all, so avoid this value
> and stretch the clock in this case.
This must be by observation since specification does not seem to state
this.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
In any case, the patch is fine.
Acked-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
> ---
> drivers/i2c/busses/i2c-davinci.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 75d6ab177055..7379043711df 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -237,12 +237,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
> /*
> * It's not always possible to have 1 to 2 ratio when d=7, so fall back
> * to minimal possible clkh in this case.
> + *
> + * Note:
> + * CLKH is not allowed to be 0, in this case I2C clock is not generated
> + * at all
> */
> - if (clk >= clkl + d) {
> + if (clk > clkl + d) {
> clkh = clk - clkl - d;
> clkl -= d;
> } else {
> - clkh = 0;
> + clkh = 1;
> clkl = clk - (d << 1);
> }
>
> --
> 2.18.0
>
next prev parent reply other threads:[~2018-07-17 11:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 15:20 [PATCH] i2c: davinci: Avoid zero value of CLKH Alexander Sverdlin
2018-07-17 11:57 ` Sekhar Nori [this message]
2018-07-20 18:43 ` Grygorii Strashko
2018-07-20 22:18 ` Wolfram Sang
2018-07-23 18:07 ` Wolfram Sang
2018-07-24 6:17 ` Sekhar Nori
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=ab965f1d-de6c-75f7-9ebd-35d31ed3de18@ti.com \
--to=nsekhar@ti.com \
--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;
as well as URLs for NNTP newsgroup(s).