Message ID | 20230605061048.485622-1-AVKrasnov@sberdevices.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2484065vqr; Sun, 4 Jun 2023 23:23:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ656bTdAgfNFJDm79a2sWHZaLx5pF1WE5Q0ZmfHH8oHWGIlOvOsv1vyuuOs8RbGF1R4RpQe X-Received: by 2002:a17:902:d489:b0:1b0:46af:7f15 with SMTP id c9-20020a170902d48900b001b046af7f15mr3011488plg.64.1685946216055; Sun, 04 Jun 2023 23:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685946216; cv=none; d=google.com; s=arc-20160816; b=ZtCbG7bIvzNYfYBIsGsChH2S4FJmlDAACTiPaVkRHGs64t+LAthNIiy+2NjGBN0DB0 bwOqroHZesI77XNaYTfrVyMKZmCZ7CWXd3bDYpdqq15Bh4qo8PcYHDnJalcU5bl09CWO 85as7r0Q6WobiaUXtMR3Yv3MOJVGP4ou3byZ5tkw4f3Oy+tkKYIbg6VttykQRutwES6u hLKrCorxgcEm6HD/eJKhdrNTPmefJXv+h2v+NHPz8CJcPZInL5rn4DZLrKZCgM7zYuRD /gsU/ZOF1QEMN41U/Nvtf3ro54Ikgt17oLBAJtJDrIA8wab3HZqmq21V/i12i7bc9SLM nzbQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=knbIn8sgeJrLUQJlKWQNrWneQ8bifk2QzuAqk/RVJh0=; b=McxE85w6g+s0rhnV+BrDrU4PkJVFtmLNGtoob2momx2zzt/qlV2SIiU8SMv3lVinko DYyf3bWNh2BP9U9l+4vc4J1K+eLk7B21n9yNzXLZfcGvIdCefHvmigM2jnWVXVt7n0Le XG+WjLeily+2/ZyY2H9JqQycWkfDwWTSahFlpahsc7qhZcExQCnfRTTGCdmQ0ZakbzZJ i3osEKscXhdCz6Hh+GoANaKsyOar8ksW5Pi+BeVg4PZKk1ZGiviI4NwkK30iqFz2etZm xib4ky/ro0DiIK1Pbt7R78BO4xwwitvlVJVcitd5WfV2FqyoszoOtM0MB3CAKnl4RjLJ 68cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=JcrASE0H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij5-20020a170902ab4500b001b05e96d85csi4891333plb.341.2023.06.04.23.23.21; Sun, 04 Jun 2023 23:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=JcrASE0H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjFEGQQ (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Mon, 5 Jun 2023 02:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjFEGQN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 5 Jun 2023 02:16:13 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D817DB; Sun, 4 Jun 2023 23:16:09 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 716BD5FD15; Mon, 5 Jun 2023 09:16:06 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1685945766; bh=knbIn8sgeJrLUQJlKWQNrWneQ8bifk2QzuAqk/RVJh0=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=JcrASE0H46Hg6zUOeQKL8OGaNW6C5/blcsv+FXm/0orAfzL4Co6JQZsDmH95mHV55 QiueNtCAh8IT6wDWOz5MxaaMFUq5B13ufyRz62Xivgbx4CVmndKfTc9/72mSbAqevu VTV2O5QaWc4MLBSa5kCDp/N5dihr986GalRAGaHCCayZDV+uDNxlqRL9q4Zyaaej17 NuId1zDeY8dVWJ4glHsATaMZW1mIz5Y+G1qZMrDAgkrNbO6zIeba/CqVpgJhtsPbHY BqNVClLkpuKgbekKWOcmnQ2UV4gEhFCFeTVbL1Lh872eHhXODsHmvljX3+ucr6KAUI K99vpzVuit6ow== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Mon, 5 Jun 2023 09:16:03 +0300 (MSK) From: Arseniy Krasnov <AVKrasnov@sberdevices.ru> To: Liang Yang <liang.yang@amlogic.com>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, Neil Armstrong <neil.armstrong@linaro.org>, Kevin Hilman <khilman@baylibre.com>, Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Yixun Lan <yixun.lan@amlogic.com>, Jianxin Pan <jianxin.pan@amlogic.com> CC: <oxffffaa@gmail.com>, <kernel@sberdevices.ru>, Arseniy Krasnov <AVKrasnov@sberdevices.ru>, <stable@vger.kernel.org>, <linux-mtd@lists.infradead.org>, <linux-arm-kernel@lists.infradead.org>, <linux-amlogic@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH v1] mtd: rawnand: meson: fix ready/busy command Date: Mon, 5 Jun 2023 09:10:48 +0300 Message-ID: <20230605061048.485622-1-AVKrasnov@sberdevices.ru> X-Mailer: git-send-email 2.35.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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/06/05 01:06:00 #21433300 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767842739414435252?= X-GMAIL-MSGID: =?utf-8?q?1767842739414435252?= |
Series |
[v1] mtd: rawnand: meson: fix ready/busy command
|
|
Commit Message
Arseniy Krasnov
June 5, 2023, 6:10 a.m. UTC
Fix the ready/busy command value.
Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
Cc: stable@vger.kernel.org
Suggested-by: Liang Yang <liang.yang@amlogic.com>
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
drivers/mtd/nand/raw/meson_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hello Miquel! I exclude this patch from the recent Meson patchset, as it is fix and not related to another patches. Also I think that I can split Meson patchset (from links below) in the following way: 1) Patch/patchset for OOB layout 2) Patchset for "nand-rb" logic (meson_nand.c + DT bindings) These two can also go independently: 3) https://lore.kernel.org/linux-mtd/20230601061850.3907800-6-AVKrasnov@sberdevices.ru/ 4) https://lore.kernel.org/linux-mtd/20230601061850.3907800-7-AVKrasnov@sberdevices.ru/ What do You think? Thanks, Arseniy On 05.06.2023 09:10, Arseniy Krasnov wrote: > Fix the ready/busy command value. > > Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") > Cc: stable@vger.kernel.org > Suggested-by: Liang Yang <liang.yang@amlogic.com> > Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> > --- > drivers/mtd/nand/raw/meson_nand.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c > index 074e14225c06..9dd4a676497b 100644 > --- a/drivers/mtd/nand/raw/meson_nand.c > +++ b/drivers/mtd/nand/raw/meson_nand.c > @@ -37,7 +37,7 @@ > #define NFC_CMD_SCRAMBLER_ENABLE BIT(19) > #define NFC_CMD_SCRAMBLER_DISABLE 0 > #define NFC_CMD_SHORTMODE_DISABLE 0 > -#define NFC_CMD_RB_INT BIT(14) > +#define NFC_CMD_RB_INT ((0xb << 10) | BIT(18) | BIT(16)) > > #define NFC_CMD_GET_SIZE(x) (((x) >> 22) & GENMASK(4, 0)) >
On Mon, Jun 05, 2023 at 09:10:48AM +0300, Arseniy Krasnov wrote:
> Fix the ready/busy command value.
"Fix" it in what way? Please provide more information, this does not
explain what is happening here at all.
greg k-h
Seems this fix is not full, pls ignore it Thanks, Arseniy On 05.06.2023 10:05, Greg KH wrote: > On Mon, Jun 05, 2023 at 09:10:48AM +0300, Arseniy Krasnov wrote: >> Fix the ready/busy command value. > > "Fix" it in what way? Please provide more information, this does not > explain what is happening here at all. > > greg k-h
Hi Arseniy, avkrasnov@sberdevices.ru wrote on Mon, 5 Jun 2023 09:39:40 +0300: > Hello Miquel! > > I exclude this patch from the recent Meson patchset, as it is fix and not related to another patches. > Also I think that I can split Meson patchset (from links below) in the following way: > 1) Patch/patchset for OOB layout > 2) Patchset for "nand-rb" logic (meson_nand.c + DT bindings) > These two can also go independently: > 3) https://lore.kernel.org/linux-mtd/20230601061850.3907800-6-AVKrasnov@sberdevices.ru/ > 4) https://lore.kernel.org/linux-mtd/20230601061850.3907800-7-AVKrasnov@sberdevices.ru/ LGTM. > > What do You think? > > Thanks, Arseniy > > On 05.06.2023 09:10, Arseniy Krasnov wrote: > > Fix the ready/busy command value. > > > > Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") > > Cc: stable@vger.kernel.org > > Suggested-by: Liang Yang <liang.yang@amlogic.com> > > Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> > > --- > > drivers/mtd/nand/raw/meson_nand.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c > > index 074e14225c06..9dd4a676497b 100644 > > --- a/drivers/mtd/nand/raw/meson_nand.c > > +++ b/drivers/mtd/nand/raw/meson_nand.c > > @@ -37,7 +37,7 @@ > > #define NFC_CMD_SCRAMBLER_ENABLE BIT(19) > > #define NFC_CMD_SCRAMBLER_DISABLE 0 > > #define NFC_CMD_SHORTMODE_DISABLE 0 > > -#define NFC_CMD_RB_INT BIT(14) > > +#define NFC_CMD_RB_INT ((0xb << 10) | BIT(18) | BIT(16)) > > > > #define NFC_CMD_GET_SIZE(x) (((x) >> 22) & GENMASK(4, 0)) > > Thanks, Miquèl
On 05.06.2023 11:17, Miquel Raynal wrote: > Hi Arseniy, > > avkrasnov@sberdevices.ru wrote on Mon, 5 Jun 2023 09:39:40 +0300: > >> Hello Miquel! >> >> I exclude this patch from the recent Meson patchset, as it is fix and not related to another patches. >> Also I think that I can split Meson patchset (from links below) in the following way: >> 1) Patch/patchset for OOB layout >> 2) Patchset for "nand-rb" logic (meson_nand.c + DT bindings) >> These two can also go independently: >> 3) https://lore.kernel.org/linux-mtd/20230601061850.3907800-6-AVKrasnov@sberdevices.ru/ >> 4) https://lore.kernel.org/linux-mtd/20230601061850.3907800-7-AVKrasnov@sberdevices.ru/ > > LGTM. I think we don't need this patch with new RB_INT value. I dive into conversations with Liang Yang - author of this driver. He said, that this define is "special" polling mode. Now I'm a little bit more experienced in NAND area, so IIUC we have two basic waiting modes: 1) Software, by sending status command, then polling reply from controller, and then finally send READ0 to exit status reading mode (nand_soft_waitrdy()). 2) By RB pin and interrupt - in this mode we send vendor specific command to the controller and it triggers interrupt on RB pin update. In this case RB pin must be connected to the controller. This mode is already implemented by Liang Yang. Now, command with this new define works in the following way: we send status command, by instead of reading reply from it by software, controller itself checks RB pin and status ready bit in IO bus. Driver just waits on completion. After waiting we need to send READ0 command again to make controller leave status reading mode. I think this is like "intermediate" mode between software polling and hardware interrupt - there is no need to spin in loop, waiting for status ready bit, but still need to leave status mode by sending READ0 command. I'm not sure that we need this as third mode of waiting for command is done. May be at least not in this work on Meson driver, so I guess to drop this patch at this moment and add 'nand_soft_waitrdy()' support. Thanks, Arseniy > >> >> What do You think? >> >> Thanks, Arseniy >> >> On 05.06.2023 09:10, Arseniy Krasnov wrote: >>> Fix the ready/busy command value. >>> >>> Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") >>> Cc: stable@vger.kernel.org >>> Suggested-by: Liang Yang <liang.yang@amlogic.com> >>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >>> --- >>> drivers/mtd/nand/raw/meson_nand.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c >>> index 074e14225c06..9dd4a676497b 100644 >>> --- a/drivers/mtd/nand/raw/meson_nand.c >>> +++ b/drivers/mtd/nand/raw/meson_nand.c >>> @@ -37,7 +37,7 @@ >>> #define NFC_CMD_SCRAMBLER_ENABLE BIT(19) >>> #define NFC_CMD_SCRAMBLER_DISABLE 0 >>> #define NFC_CMD_SHORTMODE_DISABLE 0 >>> -#define NFC_CMD_RB_INT BIT(14) >>> +#define NFC_CMD_RB_INT ((0xb << 10) | BIT(18) | BIT(16)) >>> >>> #define NFC_CMD_GET_SIZE(x) (((x) >> 22) & GENMASK(4, 0)) >>> > > > Thanks, > Miquèl
Hi Arseniy, avkrasnov@sberdevices.ru wrote on Mon, 5 Jun 2023 11:27:34 +0300: > On 05.06.2023 11:17, Miquel Raynal wrote: > > Hi Arseniy, > > > > avkrasnov@sberdevices.ru wrote on Mon, 5 Jun 2023 09:39:40 +0300: > > > >> Hello Miquel! > >> > >> I exclude this patch from the recent Meson patchset, as it is fix and not related to another patches. > >> Also I think that I can split Meson patchset (from links below) in the following way: > >> 1) Patch/patchset for OOB layout > >> 2) Patchset for "nand-rb" logic (meson_nand.c + DT bindings) > >> These two can also go independently: > >> 3) https://lore.kernel.org/linux-mtd/20230601061850.3907800-6-AVKrasnov@sberdevices.ru/ > >> 4) https://lore.kernel.org/linux-mtd/20230601061850.3907800-7-AVKrasnov@sberdevices.ru/ > > > > LGTM. > > I think we don't need this patch with new RB_INT value. I dive into conversations with Liang Yang - author of this driver. He said, > that this define is "special" polling mode. Now I'm a little bit more experienced in NAND area, so IIUC we have two basic waiting modes: > 1) Software, by sending status command, then polling reply from controller, and then finally send READ0 to exit status reading mode (nand_soft_waitrdy()). This is useful... > 2) By RB pin and interrupt - in this mode we send vendor specific command to the controller and it triggers interrupt on RB pin update. > In this case RB pin must be connected to the controller. This mode is already implemented by Liang Yang. ...this is useful... > > Now, command with this new define works in the following way: we send status command, by instead of reading reply from it by software, > controller itself checks RB pin and status ready bit in IO bus. Driver just waits on completion. After waiting we need to send > READ0 command again to make controller leave status reading mode. I think this is like "intermediate" mode between software polling > and hardware interrupt - there is no need to spin in loop, waiting for status ready bit, but still need to leave status mode by sending > READ0 command. I'm not sure that we need this as third mode of waiting for command is done. May be at least not in this work on Meson driver, > so I guess to drop this patch at this moment and add 'nand_soft_waitrdy()' support. ...I agree we can skip this one. Thanks, Miquèl
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 074e14225c06..9dd4a676497b 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -37,7 +37,7 @@ #define NFC_CMD_SCRAMBLER_ENABLE BIT(19) #define NFC_CMD_SCRAMBLER_DISABLE 0 #define NFC_CMD_SHORTMODE_DISABLE 0 -#define NFC_CMD_RB_INT BIT(14) +#define NFC_CMD_RB_INT ((0xb << 10) | BIT(18) | BIT(16)) #define NFC_CMD_GET_SIZE(x) (((x) >> 22) & GENMASK(4, 0))