From patchwork Fri Jul 24 07:15:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1335396 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 4BCgTy0zZJz9sSn for ; Fri, 24 Jul 2020 17:16:06 +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=EyNWaIcz; 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 4BCgTx0pCCzDrqX for ; Fri, 24 Jul 2020 17:16:05 +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::1041; helo=mail-pj1-x1041.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=EyNWaIcz; dkim-atps=neutral Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) (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 4BCgTm4vFwzDrFm for ; Fri, 24 Jul 2020 17:15:56 +1000 (AEST) Received: by mail-pj1-x1041.google.com with SMTP id a9so4731609pjd.3 for ; Fri, 24 Jul 2020 00:15:56 -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=m1cxk/yJDhQzHWxIfDtc4KRiJ6G7tfj5/p6X6jwH+Gc=; b=EyNWaIcz3awnLmOZp7ObOt7Sc266NbIAdgQeQz42bIDRybALnG0DkZd9IJfJbsYASP p2+lQXVYgL97v8R4jcb+tjCWP8s/1YqAQIyz/u6vWBQngBgVxxV0BKMH4dUg5fvS8tDI 5SQOkT9YdaqbS5KM02tcIBdUXUweooesiLBZoFZEi08lz9UxGdvJVd5121n7LmyHLesi /lbbznze8b7ME2Dy6oz2q+0MXu6DtnZpJ3y+ISkkekhEOnNqG1puA9hb8JeggiGrZv49 L0Ny2ks9r43wLbBZKAGSbYsrBCvDHrKm+0ZF2lRtoNhXy3pTzgjSNf3/cRB0T1HpBHIO qfBw== 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=m1cxk/yJDhQzHWxIfDtc4KRiJ6G7tfj5/p6X6jwH+Gc=; b=cmsFIOVb1F/4wmZHOz9GQEFavH2MeWbdnVXrQMP8l3xNY9BOW1UIl/ALWHVcxdnHbg chihysWZDLExqSe4fQcqh87yFBWOtsVzJfX+/ePwJDoLDaJovccguArOgSdAaMmUl4xX 1al2MZxHOPS/+KzQs068Zz4LIN6nEIvLnGnZ89wc+TJQnk0xcgbJqxsqRjIBs3Cd0y3w MHRmGOWJHRFFd5Co3X7LP31PSAsEbxILZK8QGoI7iy0wruWOAlwzEGpoTy0l3ebEHt8i 2twOU/EyIrSew8aCc/BBht9I05KKZYzWL1vU6Bxt49PdQGKy5TB22BYYWfBgqzBF6HTV bxHg== X-Gm-Message-State: AOAM530jgO70E9biN0zyqBhxdVtvFV0kRS4Mkc5DGQtYIOoTVmUzR1Bx Bu/22V4/AYQTSrgQ25FG2QzvTWMH7bY= X-Google-Smtp-Source: ABdhPJxgvBNXWtqzgzBUzJ9ogczfeKoncBUHrg12gGEGNxjtq7ZC9euY9OtybQjhckPRtijdwo4UgA== X-Received: by 2002:a17:90b:338d:: with SMTP id ke13mr4089518pjb.60.1595574953153; Fri, 24 Jul 2020 00:15:53 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id e20sm5206216pfl.212.2020.07.24.00.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 00:15:52 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org Subject: [PATCH 1/2] fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE Date: Fri, 24 Jul 2020 16:45:17 +0930 Message-Id: <20200724071518.430515-2-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 When the SBE requests a reset via the down FIFO, that is also the FIFO we should go and reset ;) 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index f54df9ebc8b3..655b45c1f6ba 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -400,7 +400,7 @@ static int sbefifo_cleanup_hw(struct sbefifo *sbefifo) /* The FIFO already contains a reset request from the SBE ? */ if (down_status & SBEFIFO_STS_RESET_REQ) { dev_info(dev, "Cleanup: FIFO reset request set, resetting\n"); - rc = sbefifo_regw(sbefifo, SBEFIFO_UP, SBEFIFO_PERFORM_RESET); + rc = sbefifo_regw(sbefifo, SBEFIFO_DOWN, SBEFIFO_PERFORM_RESET); if (rc) { sbefifo->broken = true; dev_err(dev, "Cleanup: Reset reg write failed, rc=%d\n", rc); 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");