[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKKbWA47=-ubf+HZJwNMWdPsKdeOO6VAUvApcvewhOcxhg0KWQ@mail.gmail.com>
Date: Sun, 30 Aug 2020 15:47:52 +0300
From: Avi Fishman <avifishman70@...il.com>
To: Tali Perry <tali.perry1@...il.com>
Cc: kunyi@...gle.com, xqiu@...gle.com,
Benjamin Fair <benjaminfair@...gle.com>,
Joel Stanley <joel@....id.au>,
Tomer Maimon <tmaimon77@...il.com>, wsa@...-dreams.de,
linux-i2c@...r.kernel.org,
OpenBMC Maillist <openbmc@...ts.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] i2c: npcm7xx: bug fix timeout (usec instead of msec)
On Sun, Aug 30, 2020 at 3:21 PM Tali Perry <tali.perry1@...il.com> wrote:
>
> i2c: npcm7xx: bug fix timeout (usec instead of msec)
>
> Signed-off-by: Tali Perry <tali.perry1@...il.com>
Reviewed-by: Avi Fishman <avifishman70@...il.com>
> ---
> drivers/i2c/busses/i2c-npcm7xx.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
> index 75f07138a6fa..abb334492a3d 100644
> --- a/drivers/i2c/busses/i2c-npcm7xx.c
> +++ b/drivers/i2c/busses/i2c-npcm7xx.c
> @@ -2093,8 +2093,13 @@ 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);
> + /*
> + * Adaptive TimeOut: estimated time in usec + 100% margin:
> + * 2: double the timeout for clock stretching case
> + * 9: bits per transaction (including the ack/nack)
> + * 1000000: micro second in a second
> + */
> + timeout_usec = (2 * 9 * 1000000 / 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
Powered by blists - more mailing lists