* [PATCH v1] i2c: npcm7xx: bug fix timeout (usec instead of msec)
@ 2020-08-30 7:49 Tali Perry
2020-08-30 8:47 ` Avi Fishman
0 siblings, 1 reply; 3+ messages in thread
From: Tali Perry @ 2020-08-30 7:49 UTC (permalink / raw)
To: kunyi, xqiu, benjaminfair, avifishman70, joel, tmaimon77, wsa
Cc: linux-i2c, openbmc, linux-kernel, Tali Perry
i2c: npcm7xx: bug fix timeout (usec instead of msec)
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 75f07138a6fa..c118f93a2610 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2094,7 +2094,7 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
}
/* Adaptive TimeOut: astimated time in usec + 100% margin */
- timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite);
+ timeout_usec = (2 * 10000000 / bus->bus_freq) * (2 + nread + nwrite);
timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec));
if (nwrite >= 32 * 1024 || nread >= 32 * 1024) {
dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
base-commit: d012a7190fc1fd72ed48911e77ca97ba4521bccd
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] i2c: npcm7xx: bug fix timeout (usec instead of msec)
2020-08-30 7:49 [PATCH v1] i2c: npcm7xx: bug fix timeout (usec instead of msec) Tali Perry
@ 2020-08-30 8:47 ` Avi Fishman
0 siblings, 0 replies; 3+ messages in thread
From: Avi Fishman @ 2020-08-30 8:47 UTC (permalink / raw)
To: Tali Perry
Cc: kunyi, xqiu, Benjamin Fair, Joel Stanley, Tomer Maimon, wsa,
OpenBMC Maillist, linux-i2c, Linux Kernel Mailing List
Hi Tali,
On Sun, Aug 30, 2020 at 11:09 AM Tali Perry <tali.perry1@gmail.com> wrote:
>
> i2c: npcm7xx: bug fix timeout (usec instead of msec)
>
> Signed-off-by: Tali Perry <tali.perry1@gmail.com>
> ---
> drivers/i2c/busses/i2c-npcm7xx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
> index 75f07138a6fa..c118f93a2610 100644
> --- a/drivers/i2c/busses/i2c-npcm7xx.c
> +++ b/drivers/i2c/busses/i2c-npcm7xx.c
> @@ -2094,7 +2094,7 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> }
>
> /* Adaptive TimeOut: astimated time in usec + 100% margin */
> - timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite);
I suggest to add a short description like:
2: double the timeout for clock stretching case
9: bits per transaction (including the avk/nack)
1000000: micro second in a second
timeout_usec = (2 * 9 * 1000000 / bus->bus_freq) * (2 + nread + nwrite);
> + timeout_usec = (2 * 10000000 / bus->bus_freq) * (2 + nread + nwrite);
> timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec));
> if (nwrite >= 32 * 1024 || nread >= 32 * 1024) {
> dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
>
> base-commit: d012a7190fc1fd72ed48911e77ca97ba4521bccd
> --
> 2.22.0
>
--
Regards,
Avi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] i2c: npcm7xx: bug fix timeout (usec instead of msec)
@ 2020-08-30 8:47 ` Avi Fishman
0 siblings, 0 replies; 3+ messages in thread
From: Avi Fishman @ 2020-08-30 8:47 UTC (permalink / raw)
To: Tali Perry
Cc: kunyi, xqiu, Benjamin Fair, Joel Stanley, Tomer Maimon, wsa,
OpenBMC Maillist, linux-i2c, Linux Kernel Mailing List
Hi Tali,
On Sun, Aug 30, 2020 at 11:09 AM Tali Perry <tali.perry1@gmail.com> wrote:
>
> i2c: npcm7xx: bug fix timeout (usec instead of msec)
>
> Signed-off-by: Tali Perry <tali.perry1@gmail.com>
> ---
> drivers/i2c/busses/i2c-npcm7xx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
> index 75f07138a6fa..c118f93a2610 100644
> --- a/drivers/i2c/busses/i2c-npcm7xx.c
> +++ b/drivers/i2c/busses/i2c-npcm7xx.c
> @@ -2094,7 +2094,7 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> }
>
> /* Adaptive TimeOut: astimated time in usec + 100% margin */
> - timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite);
I suggest to add a short description like:
2: double the timeout for clock stretching case
9: bits per transaction (including the avk/nack)
1000000: micro second in a second
timeout_usec = (2 * 9 * 1000000 / bus->bus_freq) * (2 + nread + nwrite);
> + timeout_usec = (2 * 10000000 / bus->bus_freq) * (2 + nread + nwrite);
> timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec));
> if (nwrite >= 32 * 1024 || nread >= 32 * 1024) {
> dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
>
> base-commit: d012a7190fc1fd72ed48911e77ca97ba4521bccd
> --
> 2.22.0
>
--
Regards,
Avi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-30 8:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30 7:49 [PATCH v1] i2c: npcm7xx: bug fix timeout (usec instead of msec) Tali Perry
2020-08-30 8:47 ` Avi Fishman
2020-08-30 8:47 ` Avi Fishman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.