From patchwork Tue Mar 9 23:52:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 1450245 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=OrBfTmqU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=hauke-m.de header.i=@hauke-m.de header.a=rsa-sha256 header.s=MBO0001 header.b=ICXwOF3+; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DwBsR1tQGz9sWQ for ; Wed, 10 Mar 2021 10:55:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4bFerRj8PeZSPhCnGQaasZ6S/5q2JmN5quyOAn6m2R8=; b=OrBfTmqUhylOTtwY9qCyBoPiJ 3a2+sNXUTSkZ5AW82QWmTolUeMuOvrt8/fxG+3R9BIWtlfNM7l3eTh80O6Sy8wRiX1SQ+NJmo3/G3 hvUWqodWNYesT4w3CZeL8oGYe8z0EKiap2G1F4PYhsksjj22jX9DP3YVcDkj92Rrh4BsRNh7wYsc5 RHfAarcbs+y6rFzU74cUOu5sGnpYNhCX4HQcyUx5EI53CWQLI7Ly+2OyESETE6p/oPAReEHxS5pYP d8ZSQ0v/Yq1Xp5VjYkj7Eelbm78Qn7GP73lIKW2Pg9RJZ5xwGL9kwEbqpJ6IMMZPrGQlD4k2gHFA0 x2oGFqEDw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJm9p-005eyc-TJ; Tue, 09 Mar 2021 23:52:58 +0000 Received: from mout-p-201.mailbox.org ([80.241.56.171]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJm9b-005evC-RN for openwrt-devel@lists.openwrt.org; Tue, 09 Mar 2021 23:52:46 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4DwBpg0SKYzQjmg; Wed, 10 Mar 2021 00:52:43 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hauke-m.de; s=MBO0001; t=1615333961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s40HokZWniQY1tivB460iRHVJA0JC2yJPj2LOIjZr1c=; b=ICXwOF3+nt1l8ID0d0pHYccphZUeFjJp5QEIS4SdRPpoxZ55Zvt+rFyyjdON7u3gIabnhG bOff+97gVM9sDmGsJ4JHj9O5D810ngLVzBQ99SxI/Ly47MCV7Zqv5Czexrf2V7j4Pu/ba2 QI22jimlPwGw5wBtQ3n5YVSRwvhMOkfUB0l+BNOBHxCBq1lAIaPo55NoHiVW2gbqdapD+U VJrACp7syYVz5kpWGEctw9BGOpQ+WqIhLW3ERaFsI7AsMZPcxI+68F0lM1s3gi1ldl6W2O 9N/sbSf3fsRlZ/0cum72e95FHOlCG04VeGSozATde0aAAfxu9ueGY3eO/NGafw== Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id EBVoZ4pcuEAG; Wed, 10 Mar 2021 00:52:40 +0100 (CET) From: Hauke Mehrtens To: openwrt-devel@lists.openwrt.org Cc: musashino.open@gmail.com, Hauke Mehrtens Subject: [PATCH 1/5] mediatek: Fix mtk parallel nand driver Date: Wed, 10 Mar 2021 00:52:10 +0100 Message-Id: <20210309235214.1690449-2-hauke@hauke-m.de> In-Reply-To: <20210309235214.1690449-1-hauke@hauke-m.de> References: <20210309235214.1690449-1-hauke@hauke-m.de> MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 0.18 / 15.00 / 15.00 X-Rspamd-Queue-Id: 32D0917D9 X-Rspamd-UID: 1464aa X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_235244_145379_2638B36E X-CRM114-Status: GOOD ( 16.45 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This fixes some bugs in the mtk parallel nand driver introduced in 5.10. This patch was send upstream. Signed-off-by: Hauke Mehrtens --- ...Fix-WAITRDY-break-condition-and-time.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 target/linux/mediatek/pa [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.171 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [80.241.56.171 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This fixes some bugs in the mtk parallel nand driver introduced in 5.10. This patch was send upstream. Signed-off-by: Hauke Mehrtens --- ...Fix-WAITRDY-break-condition-and-time.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch diff --git a/target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch b/target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch new file mode 100644 index 000000000000..340e80f67b12 --- /dev/null +++ b/target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch @@ -0,0 +1,36 @@ +From 4a4854761c9dedeedbf72c25d1317ab2e7600d4f Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 8 Mar 2021 23:16:17 +0100 +Subject: [PATCH] mtd: rawnand: mtk: Fix WAITRDY break condition and timeout + +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 +--- + drivers/mtd/nand/raw/mtk_nand.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- 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 nan + 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; + }