From patchwork Wed Mar 29 07:47:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 13192058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACCD6C74A5B for ; Wed, 29 Mar 2023 07:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:From:CC:To:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5Z5qcrP6B5/H7ce7R/BdeiOxxhvxySE+X5ssfP9/zXw=; b=ihC1Bzsb/CGM79 F3hB0xr9tmALy0jgXUhjWwzRbfnpDH2kbtwMnBYHcDd9SNgHE8Yrwe2PgpeR2JlrRo5DmOWO856kK 1v221aS1gaWh0oYpe+Fm64Uydvla65ZTBGH6+vjL5jXrEqdRS7h8UPojm6rAYT2B77OE3mXv9OAoa 1922O24LWb5J9vH7oUXUDWtrJ/pxiTS9mshz7MA+nNyZn9xHdwkOoBNvBCvNSaq6ng8Jk08sm6FTn Sz220FXg2bgYrAFgffCh2Jwx0BNN/M7qBb/AFKC/h9GbQiiG04pVe2Pai+TGUzvvEuhTyb0nx5fal +NGOxrSvlPQnEiYOhE8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phQa7-00Gxr7-0k; Wed, 29 Mar 2023 07:50:55 +0000 Received: from mx.sberdevices.ru ([45.89.227.171]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phQa4-00Gxpu-0T; Wed, 29 Mar 2023 07:50:54 +0000 Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id D04D85FD03; Wed, 29 Mar 2023 10:50:48 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680076248; bh=SteJ8B6mpqmaAAU3M4+MgtqGOmVDvwZO8JpXbEiJOuE=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=LdFXgQePQqM3H2QutQMJE7jBHMY7P0GMrc/9o4PPdsqXP6TRH+nnNiB95tRZeazIy dqpKyr4glZsKPUSHLGUGAANFoxDWd0kXo37VhbSpmYslrJGqlTAGq2eZpvn43k+ZSA zP5Wed8tZxrbj5EkccGICeX+2unn2qGIOfRaC9NMfstnBu7zDRBpbOJOnChK0HUyxl oBD8wZ2g7JROzQCQLhd/zbrqmBLGZV3x6K//tZWs61w5sIpjzo+xeAefwl5Y7GiOn/ H3OpdDFHkibKcOM5go04pHBiml0txVsbB0ZlqczJvFZVPPp3sLq8HCaQlJIkoie6kB flEJz74D5s+4g== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Wed, 29 Mar 2023 10:50:48 +0300 (MSK) Message-ID: <3794ffbf-dfea-e96f-1f97-fe235b005e19@sberdevices.ru> Date: Wed, 29 Mar 2023 10:47:26 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US To: Liang Yang , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jianxin Pan , Yixun Lan CC: , , , , , From: Arseniy Krasnov Subject: [PATCH v2] mtd: rawnand: meson: fix bitmask for length in command word X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/03/29 04:10:00 #21025776 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_005052_531460_FEBB8B97 X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Valid mask is 0x3FFF, without this patch the following problems were found: 1) [ 0.938914] Could not find a valid ONFI parameter page, trying bit-wise majority to recover it [ 0.947384] ONFI parameter recovery failed, aborting 2) Read with disabled ECC mode was broken. Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") Cc: Signed-off-by: Arseniy Krasnov --- drivers/mtd/nand/raw/meson_nand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index a28574c00900..074e14225c06 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -280,7 +280,7 @@ static void meson_nfc_cmd_access(struct nand_chip *nand, int raw, bool dir, if (raw) { len = mtd->writesize + mtd->oobsize; - cmd = (len & GENMASK(5, 0)) | scrambler | DMA_DIR(dir); + cmd = (len & GENMASK(13, 0)) | scrambler | DMA_DIR(dir); writel(cmd, nfc->reg_base + NFC_REG_CMD); return; } @@ -544,7 +544,7 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len) if (ret) goto out; - cmd = NFC_CMD_N2M | (len & GENMASK(5, 0)); + cmd = NFC_CMD_N2M | (len & GENMASK(13, 0)); writel(cmd, nfc->reg_base + NFC_REG_CMD); meson_nfc_drain_cmd(nfc); @@ -568,7 +568,7 @@ static int meson_nfc_write_buf(struct nand_chip *nand, u8 *buf, int len) if (ret) return ret; - cmd = NFC_CMD_M2N | (len & GENMASK(5, 0)); + cmd = NFC_CMD_M2N | (len & GENMASK(13, 0)); writel(cmd, nfc->reg_base + NFC_REG_CMD); meson_nfc_drain_cmd(nfc);