Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2545691pxb; Mon, 19 Apr 2021 08:08:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAXcOZ3Vx3kCa218OnmwOK9uJytYg6c3eyi7s9ImfLb4ONuRtbsU+pglGtOgeJivNz7c5W X-Received: by 2002:a17:90a:300f:: with SMTP id g15mr26713163pjb.88.1618844927619; Mon, 19 Apr 2021 08:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618844927; cv=none; d=google.com; s=arc-20160816; b=DXzq+54rwcTJbVJOsMjuy8Dopw4UsZo7FqCEnSXFR8FmwvIpnGdHqfaLL7YQNtMG9V GIvTfUDnHoheDJn2JiRkmS691xK5IYHV2XxFNn6i/GPnD6NCwrkxIJbWsJGt6b4Sn2YX xZt6M6s82HnK8wLpg2m11ruNcZuq/ciaY3n7FSx5jzxxad0MUvCALRP1b1rDjOUpJi7t e8LdNsMyc1ihHh5BioxQ5FGbuECWHcfD+OUcypTbOA2pi4paCSx+D8IzJq8pWTEaZaSA nGK7zYuF0YXZctriPHYskHuboweaDU+w8YjZjIMaIVvmwjCoBQ/cohkGEPaGvZq/lyIT VcHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5N/4afh/76o9xmN/A6vVG6tBpB33SpBRcH6vowge1BM=; b=QM6MQcjMLsSoZgRgk4l769Eh+1qdzDLzcItyA7/aQczrJxiVrWcIjhiwn1kvFfFRsO 2a2EmSleDPvZ6TUrHrbr5UDCb+nracdT81lLKFX1OG10qn17bohGPfvUqShLCs23gOBh AUVRv6k5PQNiuLXmYwhmqIVvOCXo5NDrlpZTRpnwmrG9tCfgppuPXL2WnnWqR+FwOqOI 89lGwqyxafkx98WLfAhCmJhypsWd0u+4E1tyBCfDTsjxSOAzLyZxyzmzI9sOqjZNaI2h 7GB3F5gRYi06j6GsgPvD8gwMtlx4q+RsUHHPuspJPC9ab7CyZiem1qWWR5dL/CK58w2b 556w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=raQCN7FT; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si21114936pfk.28.2021.04.19.08.08.35; Mon, 19 Apr 2021 08:08:47 -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=@linuxfoundation.org header.s=korg header.b=raQCN7FT; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239428AbhDSNL5 (ORCPT + 99 others); Mon, 19 Apr 2021 09:11:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:43786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239459AbhDSNI6 (ORCPT ); Mon, 19 Apr 2021 09:08:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B808961285; Mon, 19 Apr 2021 13:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618837707; bh=/l6XAgg8zgygTRzAIB62RivYZBwC+wbTWD//wep9ppE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=raQCN7FTSsaenaZ3WygxFPKZb9h9pBRebi/XQ2f5fLChCCrWqqBu8ZVzgl6Rk9bzt bQLLu8kjlwGNa4P7Q7CEz1YDi3cyrN0TdPZ5stD+ROwdv98p6v34ZK0t1+/2p3o6l7 6zYoXTOrx04HVMOmjWy86oRC9Kan/8z33RRbbjx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , Boris Brezillon , Miquel Raynal , Sasha Levin Subject: [PATCH 5.11 004/122] mtd: rawnand: mtk: Fix WAITRDY break condition and timeout Date: Mon, 19 Apr 2021 15:04:44 +0200 Message-Id: <20210419130530.320083765@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130530.166331793@linuxfoundation.org> References: <20210419130530.166331793@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hauke Mehrtens [ Upstream commit 2fb164f0ce95e504e2688b4f984893c29ebd19ab ] This fixes NAND_OP_WAITRDY_INSTR operation in the driver. Without this change the driver waits till the system is busy, but we should wait till the busy flag is cleared. The readl_poll_timeout() function gets a break condition, not a wait condition. In addition fix the timeout. The timeout_ms is given in ms, but the readl_poll_timeout() function takes the timeout in us. Multiple the given timeout by 1000 to convert it. Without this change, the driver does not work at all, it doesn't even identify the NAND chip. Fixes: 5197360f9e09 ("mtd: rawnand: mtk: Convert the driver to exec_op()") Signed-off-by: Hauke Mehrtens Reviewed-by: Boris Brezillon Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20210309000107.1368404-1-hauke@hauke-m.de Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/mtk_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c index 57f1f1708994..5c5c92132287 100644 --- a/drivers/mtd/nand/raw/mtk_nand.c +++ b/drivers/mtd/nand/raw/mtk_nand.c @@ -488,8 +488,8 @@ static int mtk_nfc_exec_instr(struct nand_chip *chip, return 0; case NAND_OP_WAITRDY_INSTR: return readl_poll_timeout(nfc->regs + NFI_STA, status, - status & STA_BUSY, 20, - instr->ctx.waitrdy.timeout_ms); + !(status & STA_BUSY), 20, + instr->ctx.waitrdy.timeout_ms * 1000); default: break; } -- 2.30.2