Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp348179pxk; Sun, 30 Aug 2020 05:53:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOYGRXw3FUo7RvqJ+udi9DCyy6RK9dfmKXGAOCASQZg29b71ywiAJ/osykEyGi8wzbAeJC X-Received: by 2002:a17:906:7197:: with SMTP id h23mr7368931ejk.20.1598792023556; Sun, 30 Aug 2020 05:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598792023; cv=none; d=google.com; s=arc-20160816; b=R+J+osZrsiOZNvma5PWW7mLVddB0nTxDbAXAwCUK8VOnYi/GGkxOt7N8wRoeMkE5BB r9eJ7GT3S50sOfH6uV65yQSPbR3dz4OiUdmPR41a04TQgeb+LpTizXCdemaBEgFXeWkF v3kI1T0ejYQBJ1wVk+SC1l6vlc8mSQQESpGON/dUbmu8FxIs0dsl811kTO0ZJSMoa7jh SbRCrHBgzWifIJs086t2pebUS1rVEMkYBLQ6lxoPZEyHc5CvnlsbZZt5Auqg/dZrDVUl tyEFPNWEjY862cGqfzOqb3wffVUKZ2R5QFYOryFKGCThUAqQPQppEr6shWvMtV7uhrwa AqYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pdBRR0cueC+gQFMWe643ZTOPACqLEtpMVbSZLMNIJk8=; b=KfgfP6cdoxyPVdjVXSvK2nZqOkmRpydsFJQRu/6Qu8LCDKBwlNfAQh0/v3mbQOtwt8 PtePSSx+x/DPAcenS1F4e/arXdi6mzFVibuxaYoHOUvB72QzGSR0agrbACnkb7daCfSK kr8DdjzmsLoGvRaY18Fhh7nUmP8OPG1hv998Gd6Ggq5rrN7FtGDQY7rOjsYvHxILxYWq rGcCp9wQ+ofSLdFBa1ZBA4lrLnkqLF3hBYyMhD0UHDr/tlEmXktRlr1/mubviLDBIrjt 9yqMLrX90OKH5HKUAsoWN79TCOPEF+EjZT+As3XvEVltfkNhoVHcipc3vdJJEjWanJqV IYbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nXZvxVAY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si3637319eja.141.2020.08.30.05.53.18; Sun, 30 Aug 2020 05:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nXZvxVAY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728828AbgH3MtS (ORCPT + 99 others); Sun, 30 Aug 2020 08:49:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728686AbgH3MtP (ORCPT ); Sun, 30 Aug 2020 08:49:15 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB8B7C061573; Sun, 30 Aug 2020 05:49:14 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id d18so3348859iop.13; Sun, 30 Aug 2020 05:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pdBRR0cueC+gQFMWe643ZTOPACqLEtpMVbSZLMNIJk8=; b=nXZvxVAYREeSQudgh5+FEP9PDKNIFXymwC/FlXmvC3gptxL63qm2e7mHxhHkFau5qh 2B5zLmRu9pDycfVr8sGnqogTSC9i8RWh2jTLL+eLAlVA1PuposUsD3C4QigoyoS4aV+e jC1xTnrrMuj87umbNnmcDgLuO22Hp3K2A6zBqumWazXMaE+CuUrnCnk1fHk+LPmM4sFC uKfK5UiIeLES0sJzHHylkDPqEYYO7RGucS0X+HM2h3EZgqIUv0RPWuaxwj249C1VplMd ORn/YxVjTGLzbzXCL3crni/RO6PDMpQ6vdePMs7tKwX2BGgt900+8kCsHtjtwtAOfVtn ZP+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pdBRR0cueC+gQFMWe643ZTOPACqLEtpMVbSZLMNIJk8=; b=OSNcregdiO8DdPnWrUFndG9/84wCyloGpTlHT06UIQcnTET3Le9mkAHVpadRnSrGDl LDyne5AmK44C2cXBiD7+nHbOY3BAWLnf7Z4I9bcfaEXrzYoYkiFXQ6yTnAJF6JNz4vV/ tJIZlPpyaW5DeWssoUEzeUoJlB3tG8jb/QeeOhXLQEH2daea/fOyI1HG2x4PJeS+ZmOs bby5BPKjvgbFk8BCC4SzK8mRW6RVpOGlz0AMPPOj4TSOpg0POoqJhCq2URZhvMR53CxX EfLxOYzQaxFi7xDeRgujZn3pJ6QVZrDZA/AIchIj5dyFzyF5/vV90nPvvf6i0sNbLQ+P ETow== X-Gm-Message-State: AOAM533GORqJx2el739mVf0qsp+jzLxrG2sj1reaVlQRPLCUheex1CXZ wqrRHdhNX81S58jrT+hdYLuWki36MLCQhFKkxA== X-Received: by 2002:a02:ccdb:: with SMTP id k27mr7904474jaq.103.1598791753939; Sun, 30 Aug 2020 05:49:13 -0700 (PDT) MIME-Version: 1.0 References: <20200830122051.197892-1-tali.perry1@gmail.com> In-Reply-To: <20200830122051.197892-1-tali.perry1@gmail.com> From: Avi Fishman Date: Sun, 30 Aug 2020 15:47:52 +0300 Message-ID: Subject: Re: [PATCH v2] i2c: npcm7xx: bug fix timeout (usec instead of msec) To: Tali Perry Cc: kunyi@google.com, xqiu@google.com, Benjamin Fair , Joel Stanley , Tomer Maimon , wsa@the-dreams.de, linux-i2c@vger.kernel.org, OpenBMC Maillist , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 30, 2020 at 3:21 PM Tali Perry wrote: > > i2c: npcm7xx: bug fix timeout (usec instead of msec) > > Signed-off-by: Tali Perry Reviewed-by: Avi Fishman > --- > 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