* [PATCH] i2c: davinci: Avoid zero value of CLKH
@ 2018-07-13 15:20 Alexander Sverdlin
2018-07-17 11:57 ` Sekhar Nori
2018-07-23 18:07 ` Wolfram Sang
0 siblings, 2 replies; 6+ messages in thread
From: Alexander Sverdlin @ 2018-07-13 15:20 UTC (permalink / raw)
To: linux-i2c; +Cc: Sekhar Nori, Alexander Sverdlin, linux-arm-kernel, Kevin Hilman
If CLKH is set to 0 I2C clock is not generated at all, so avoid this value
and stretch the clock in this case.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: davinci: Avoid zero value of CLKH
2018-07-13 15:20 [PATCH] i2c: davinci: Avoid zero value of CLKH Alexander Sverdlin
@ 2018-07-17 11:57 ` Sekhar Nori
2018-07-20 18:43 ` Grygorii Strashko
2018-07-23 18:07 ` Wolfram Sang
1 sibling, 1 reply; 6+ messages in thread
From: Sekhar Nori @ 2018-07-17 11:57 UTC (permalink / raw)
To: Alexander Sverdlin, linux-i2c
Cc: Grygorii Strashko, linux-arm-kernel, Kevin Hilman
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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: davinci: Avoid zero value of CLKH
2018-07-17 11:57 ` Sekhar Nori
@ 2018-07-20 18:43 ` Grygorii Strashko
2018-07-20 22:18 ` Wolfram Sang
0 siblings, 1 reply; 6+ messages in thread
From: Grygorii Strashko @ 2018-07-20 18:43 UTC (permalink / raw)
To: Sekhar Nori, Alexander Sverdlin, linux-i2c; +Cc: linux-arm-kernel, Kevin Hilman
On 07/17/2018 06:57 AM, Sekhar Nori wrote:
> 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.
It will be good to know (mention) on what hw was it observed?
>
>>
>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
>
> In any case, the patch is fine.
>
> Acked-by: Sekhar Nori <nsekhar@ti.com>
>
[...]
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: davinci: Avoid zero value of CLKH
2018-07-20 18:43 ` Grygorii Strashko
@ 2018-07-20 22:18 ` Wolfram Sang
0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2018-07-20 22:18 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Alexander Sverdlin, Sekhar Nori, linux-i2c, linux-arm-kernel,
Kevin Hilman
[-- Attachment #1.1: Type: text/plain, Size: 625 bytes --]
On Fri, Jul 20, 2018 at 01:43:46PM -0500, Grygorii Strashko wrote:
>
>
> On 07/17/2018 06:57 AM, Sekhar Nori wrote:
> > 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.
>
> It will be good to know (mention) on what hw was it observed?
Some more info would also help me to decide if this is stable material
or not. Is it a bug fix or more theoretical (but still valid, of
course)?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: davinci: Avoid zero value of CLKH
2018-07-13 15:20 [PATCH] i2c: davinci: Avoid zero value of CLKH Alexander Sverdlin
2018-07-17 11:57 ` Sekhar Nori
@ 2018-07-23 18:07 ` Wolfram Sang
2018-07-24 6:17 ` Sekhar Nori
1 sibling, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2018-07-23 18:07 UTC (permalink / raw)
To: Alexander Sverdlin; +Cc: Sekhar Nori, linux-i2c, linux-arm-kernel, Kevin Hilman
[-- Attachment #1.1: Type: text/plain, Size: 521 bytes --]
On Fri, Jul 13, 2018 at 05:20:17PM +0200, 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.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Applied to for-current, thanks!
I did not add stable because Alexander told me this is very likely not
to be observed on HW out there. But TI people are investigating more.
I suggest they resend this patch to stable if they see fit. D'accord
everyone?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: davinci: Avoid zero value of CLKH
2018-07-23 18:07 ` Wolfram Sang
@ 2018-07-24 6:17 ` Sekhar Nori
0 siblings, 0 replies; 6+ messages in thread
From: Sekhar Nori @ 2018-07-24 6:17 UTC (permalink / raw)
To: Wolfram Sang, Alexander Sverdlin
Cc: linux-i2c, linux-arm-kernel, Kevin Hilman
On Monday 23 July 2018 11:37 PM, Wolfram Sang wrote:
> On Fri, Jul 13, 2018 at 05:20:17PM +0200, 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.
>>
>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
>
> Applied to for-current, thanks!
>
> I did not add stable because Alexander told me this is very likely not
> to be observed on HW out there. But TI people are investigating more.
> I suggest they resend this patch to stable if they see fit. D'accord
> everyone?
Sounds good to me.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-24 6:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 15:20 [PATCH] i2c: davinci: Avoid zero value of CLKH Alexander Sverdlin
2018-07-17 11:57 ` Sekhar Nori
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
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).