From patchwork Fri Jul 24 07:15:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1335397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BCgV24b0gz9sRK for ; Fri, 24 Jul 2020 17:16:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jwIJTQBQ; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BCgV222z0zDsPf for ; Fri, 24 Jul 2020 17:16:10 +1000 (AEST) X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jwIJTQBQ; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BCgTr40gjzDrqV for ; Fri, 24 Jul 2020 17:16:00 +1000 (AEST) Received: by mail-pf1-x442.google.com with SMTP id a14so4599096pfi.2 for ; Fri, 24 Jul 2020 00:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EC0ci2DhDfgePNa/vZJrm+2m6aiXsL39LhLmpYhtep0=; b=jwIJTQBQ+HWUkP2NpurV5dxnMGxrWMVOaT7EUeAt/1xnOED8Jmb/ZzDb0XUzPO46T5 jzUPEvUnRXcWPkMwTdkn87O8qj3EOxSMMXcUkbNm4jt2IZFXFX6RLfUeP9cEcBVfC8qk vmYaKlkAx/eSpk2lEoaxyMhpSO4s+8ZDUclVRuXu1t2v628ssIBLpmJz7W8tb7+7fNkf WUP3D+Jk9EgH/4lhD3MidlhXq5ntMOhBmiCDIeCHPZzKWpZIV7IyvDJMU/1tI0sz57B/ 5bRKoe+POyIY6/eXuf1MBG64VOsaVkCEgWv367G81AiJHzMFLPUPFsbvfaxcyDk0mYIZ yiag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EC0ci2DhDfgePNa/vZJrm+2m6aiXsL39LhLmpYhtep0=; b=TA8oD9rfPl5bEzxO+0PLRsMkTVyPPnn924rSjBoFxy4gPBy2mZiHMsAzxlW4QBi69T 4+1iNa3nE0VvTEuO+gLd1/ipQ1q3RJ1AXiAuY2Ramnb05B8fSzIS4PAd22WLw+tbASh8 Oalu0TQzgpv0TktE0dS+y4ZzyacwAS9tGSlPJeaoxbQ1J8P13xXnOBv7fivLd+9aSyP+ cSjDLSym4Q5SVJxH47bmBn+MJiisDwYLGy8MU1flpi4prZ993Yy+8rfWTGFArcJNPI5W n0G8VmhaRKJLxLOJyXrLPidXIKsaNpt6RSy9nZmHg6wMG630t7CdvPD3DHj2e4u0G7wZ ELBA== X-Gm-Message-State: AOAM5325EMW00h2g2uZTBAlqWbwyBhGzVsMTQ3zZvx0bx3x/wnyGl7NR oFvDkJDrZkPGhvVpg1eC1KpsSvcV92w= X-Google-Smtp-Source: ABdhPJz0dHQZpci2WbryWFU8Gj6ifsOaIxPpXAbvIjMsjGra6WY6jsbV7VA7vjB3JlnoeQv5Yz+Emg== X-Received: by 2002:a63:9201:: with SMTP id o1mr6678759pgd.99.1595574958107; Fri, 24 Jul 2020 00:15:58 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id e20sm5206216pfl.212.2020.07.24.00.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 00:15:56 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org Subject: [PATCH 2/2] fsi/sbefifo: Fix reset timeout Date: Fri, 24 Jul 2020 16:45:18 +0930 Message-Id: <20200724071518.430515-3-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200724071518.430515-1-joel@jms.id.au> References: <20200724071518.430515-1-joel@jms.id.au> MIME-Version: 1.0 X-BeenThere: linux-fsi@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joachim Fenkes , linux-kernel@vger.kernel.org, Alistar Popple Errors-To: linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "linux-fsi" From: Joachim Fenkes On BMCs with lower timer resolution than 1ms, msleep(1) will take way longer than 1ms, so looping 10k times won't wait for 10s but significantly longer. Fix this by using jiffies like the rest of the code. Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO") Signed-off-by: Joachim Fenkes Signed-off-by: Joel Stanley --- drivers/fsi/fsi-sbefifo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 655b45c1f6ba..3ad9510ad4a4 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -325,6 +325,7 @@ static int sbefifo_up_write(struct sbefifo *sbefifo, __be32 word) static int sbefifo_request_reset(struct sbefifo *sbefifo) { struct device *dev = &sbefifo->fsi_dev->dev; + unsigned long end_time; u32 status, timeout; int rc; @@ -341,7 +342,8 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo) } /* Wait for it to complete */ - for (timeout = 0; timeout < SBEFIFO_RESET_TIMEOUT; timeout++) { + end_time = jiffies + msecs_to_jiffies(SBEFIFO_RESET_TIMEOUT); + while (!time_after(jiffies, end_time)) { rc = sbefifo_regr(sbefifo, SBEFIFO_UP | SBEFIFO_STS, &status); if (rc) { dev_err(dev, "Failed to read UP fifo status during reset" @@ -355,7 +357,7 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo) return 0; } - msleep(1); + cond_resched(); } dev_err(dev, "FIFO reset timed out\n");