Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3182269ybz; Mon, 27 Apr 2020 11:26:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJkrKlXcK9F/vSnN/w/D50maNueOfWQLPEXs1bwUmzTBAV2NdpvDEH1EA0KaoH/CtJxzorj X-Received: by 2002:a05:6402:17e3:: with SMTP id t3mr19815617edy.203.1588011961029; Mon, 27 Apr 2020 11:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588011961; cv=none; d=google.com; s=arc-20160816; b=0+nbwMdbL2c0+kSVBDqMbsGs/9BGbvIxw9ZOhMcdOE86cu/SmbkO6tmBe4LpRPyW2R SAyqqia+AlNHsCihzoBWLq7Jo3cZfjJQxmgD0ZW2ipAem1wBwy20xxzbepehH4c3udx2 qmYw8Jle4hGoSQpBegChXCz9/Aeht+BSqB6zce7S/Z83xWVF4S96iSA0VnwD1WaZNpnR Ki0jEDpJ6MPy1DHD//GI5s3fZ+UziZeWBnJRrs+7lqLP456ufKZQsS1b+qrEpFWUhhpg dVIF62wDUV3EySpwFaTtbgTY+xmgmmo+411aGwzb8rduXXKPU22WWgsm3HAt04X++N6F tu4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=KpEfKeN/aaKjBk0MeMkN/SISAY0QoBQveLcZZoSxSyY=; b=jX8BERKdA5pjgrvEGXcQr/YJ+3G53Vjo/dyO2R+dpUWMhopK48mPS+VCOu6mGFZuzX DXc2FegiIcrYWewfWXknMNLPjYc1iuAGoQUpDQTmsPyx0nT4mh8vcuIAsrSLgeYVFLDu AAnsbSaYixWc1Lz6lReTOo+ob01IGDsF3B1OCBlNURUO2swRJ256wZ/0hf4nTC0Y2Lxq AP1rTnWK8dE3vzeTrYkdR89c9ImagcTMMWuKW/vBBtKbQ/GqKiJW9d/bbVOQLqIaFHit 2LDxzXutQpyN9S7K3mROm3aWMJHLXj2H9m8gUORmajwwKEhUd1mOiwBLVXGdZ+0TpJ2B lmEQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si206646eja.354.2020.04.27.11.25.37; Mon, 27 Apr 2020 11:26:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbgD0SWS convert rfc822-to-8bit (ORCPT + 99 others); Mon, 27 Apr 2020 14:22:18 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:42851 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbgD0SWS (ORCPT ); Mon, 27 Apr 2020 14:22:18 -0400 X-Originating-IP: 91.224.148.103 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 6483A20005; Mon, 27 Apr 2020 18:22:13 +0000 (UTC) Date: Mon, 27 Apr 2020 20:22:12 +0200 From: Miquel Raynal To: Christophe Kerello Cc: , , , , , , , , , , Subject: Re: [PATCH v2 06/12] mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_MS for timeouts Message-ID: <20200427202212.0235d987@xps13> In-Reply-To: <1586966256-29548-7-git-send-email-christophe.kerello@st.com> References: <1586966256-29548-1-git-send-email-christophe.kerello@st.com> <1586966256-29548-7-git-send-email-christophe.kerello@st.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, Christophe Kerello wrote on Wed, 15 Apr 2020 17:57:30 +0200: > This patch removes the constant FMC2_TIMEOUT_US. > FMC2_TIMEOUT_MS is set to 5 seconds and this constant is used > each time that we need to wait (except when the timeout value > is set by the framework) > > Signed-off-by: Christophe Kerello > --- > drivers/mtd/nand/raw/stm32_fmc2_nand.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c > index ab53314..f159c39 100644 > --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c > +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c > @@ -37,8 +37,7 @@ > /* Max ECC buffer length */ > #define FMC2_MAX_ECC_BUF_LEN (FMC2_BCHDSRS_LEN * FMC2_MAX_SG) > > -#define FMC2_TIMEOUT_US 1000 > -#define FMC2_TIMEOUT_MS 1000 > +#define FMC2_TIMEOUT_MS 5000 > > /* Timings */ > #define FMC2_THIZ 1 > @@ -525,9 +524,9 @@ static int stm32_fmc2_ham_calculate(struct nand_chip *chip, const u8 *data, > u32 sr, heccr; > int ret; > > - ret = readl_relaxed_poll_timeout(fmc2->io_base + FMC2_SR, > - sr, sr & FMC2_SR_NWRF, 10, > - FMC2_TIMEOUT_MS); > + ret = readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_SR, > + sr, sr & FMC2_SR_NWRF, 1, > + 1000 * FMC2_TIMEOUT_MS); Is the _atomic suffix needed here? If yes it would deserve a separate patch with Fixes/Stable tags. > if (ret) { > dev_err(fmc2->dev, "ham timeout\n"); > return ret; > @@ -1315,7 +1314,7 @@ static int stm32_fmc2_waitrdy(struct nand_chip *chip, unsigned long timeout_ms) > /* Check if there is no pending requests to the NAND flash */ > if (readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_SR, sr, > sr & FMC2_SR_NWRF, 1, > - FMC2_TIMEOUT_US)) > + 1000 * FMC2_TIMEOUT_MS)) > dev_warn(fmc2->dev, "Waitrdy timeout\n"); > > /* Wait tWB before R/B# signal is low */ You change the timeouts from 1ms to 5s. Maybe 5s is a little bit too much IMHO but we don't really care as this is a timeout. However 1ms is tight. If you are changing this value because it triggers error (eg. when the machine is loaded), then it is a fix and should appear like it. Thanks, Miquèl