[v1,1/2] dt-bindings: mtd: nand-controller: add nand-skip-bbtscan and nand-no-bbm-quirk DT options
Message ID | 61c84262-cd98-1e60-d95b-9b0492083994@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp119220vqt; Sat, 15 Jul 2023 04:07:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4gUEQ3OmJcp+9cym2IyxX4KR9v8Nxel/Fh3MP/XZfy/YkQsuv66imteVKVbtLyY695sxi X-Received: by 2002:a17:90a:13c6:b0:262:cef9:84f6 with SMTP id s6-20020a17090a13c600b00262cef984f6mr6135925pjf.22.1689419268231; Sat, 15 Jul 2023 04:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689419268; cv=none; d=google.com; s=arc-20160816; b=ra84sn4jCIwa0VxsS+ZeAUpVWdBibdHjhbAn0Ke2dHuOUfY7rZLInve3D738l++Feh lBs/6BqmOipQsRLkzIvE/TexbfqjDRoMRqK/El4xqOtiaT5WC2SyqITOFifrTHHb0+Hd ravsyhUmiVFf3u8IKmjC7puxo9AOZNZW/Cb+KAAjnljaEhPagJzeYtqlbz2JztZzPC+m zvr1R53lKQG3vq8c8RD8IQ3a4pL87z1GhIE7BcWRY90KWUkKDFFdt8g63GUJo2GfuXXZ vgP/XEUkU0IydrY2xkU/5rrzIdnbxEnVel68FrsNJyllItAt0d3pS5ecXmSJczLs5jUE MNrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id:dkim-signature; bh=rn5C5YBsaSogUUgEp4dzGB5xBo5qBNnix/jnrz9gqkM=; fh=Mm3aYVXr+xjNRxTTpvktY8DO3dvcU4YjgupeO2eVvb0=; b=vawGPZRSMT9637r9ligkXj823YBq2zCTFpi7muag/jTuoQkZgxPVjqzN5XVbFbGGxz y4eNpE8NWRIhORI78ydCuAV8gtjAx2m7qL/VBxNhk9CU8OpBByTErRNxe9Nxx36fAIRj EtubsaaQOPVGrjprIRpftNPXlO+SltVS1iuu5XUfXKa2nahVNMSn1+XcDD4/Z4ZGuV3k 8TuNLKXipdUeK/FqyuUScqEXHNjD7Fkan490fIfv38doBnuXJaMoNC07/rpXYIRwkHWk BfXxJaBmCPHxYPkfTv8ZoMa7vwiswyTmuEgMu/koPCb4h0nQ/WWHJHeDjrUyiMlYr8DD qDTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fDx9RWHq; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090ad50a00b00256d7cc5b67si2762792pju.133.2023.07.15.04.07.27; Sat, 15 Jul 2023 04:07:48 -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=@gmail.com header.s=20221208 header.b=fDx9RWHq; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbjGOKsa (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Sat, 15 Jul 2023 06:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjGOKs2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 15 Jul 2023 06:48:28 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 253E13A86; Sat, 15 Jul 2023 03:48:27 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-992ca792065so386685366b.2; Sat, 15 Jul 2023 03:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689418105; x=1692010105; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=rn5C5YBsaSogUUgEp4dzGB5xBo5qBNnix/jnrz9gqkM=; b=fDx9RWHqR3WdveXG/OlDdrTexq4fbNMPt2ZBSoL0Xwa6tCqLAuScCyfOnhhX1ac0ts ysauNt9TuGVshmSJpp5FWmLJP1S7eZv3nO5o3BkKAlr9SWOY4qDMxuGQTwjL9Ne5lEZ3 vF2k0HrrOg5DSsIuQFpsnjMzvuJY1zJE1a95jfDi33rLE/Ohan1/JiD1h1Izom+IFNnc pvuiC0DnrG/+ow/XT250CZBIS9DlpHVnyCHBKFn2fTETBQPFuWbs4sCGk3feLD/NENCw Kh1Ms1RYHTE/kZLsebUXxFSmw9KEad17kJPeKU8q/wG1Xstw1s+uZjp1OXzZA6aTpAWp JYcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689418105; x=1692010105; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rn5C5YBsaSogUUgEp4dzGB5xBo5qBNnix/jnrz9gqkM=; b=XooRytEg5uFPV6qv8HqzOuSVCzEnO/yoq/0uUhDTu9JMu475PEdK13LmLmjpmjPvhL hmkMtpMuUo507ddYNt8ZMcotZ9Fu3aCHXEPcDaHnFLje4CW5PF9QPeAHMlZ187SMhbCk omwhBk0RUn5wSgtC1/xXYh95Txe+pRrQgFWf7TnJLtaPKC5/I71Vu/FnDvfyv4CtXGDb UedZfFqJ6Jbb1zWqnaUizEoepEbcnvF2eydLlvJC0Y5U8CEFM2mS0XvR4GpYDEASwrkE e74PH2a18r2nadcVTv2jbQ/fYPD2g3gYJLvh6PV8AKmk1B/0TY7sWmCNI4Z6JQcAZEfl TLaA== X-Gm-Message-State: ABy/qLaWeZL8svIyg5hXsGsQuet+FQptVxcmCB94PRbNX7dSjcbCUPEj wlsRKkKFA9QkkaxgCwUiYSI= X-Received: by 2002:a17:906:6884:b0:988:4dc:e3a3 with SMTP id n4-20020a170906688400b0098804dce3a3mr6496371ejr.31.1689418105356; Sat, 15 Jul 2023 03:48:25 -0700 (PDT) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id d20-20020a17090648d400b00993feabdc6asm6642782ejt.157.2023.07.15.03.48.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Jul 2023 03:48:24 -0700 (PDT) Message-ID: <61c84262-cd98-1e60-d95b-9b0492083994@gmail.com> Date: Sat, 15 Jul 2023 12:48:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Johan Jonker <jbx6244@gmail.com> Subject: [PATCH v1 1/2] dt-bindings: mtd: nand-controller: add nand-skip-bbtscan and nand-no-bbm-quirk DT options To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, 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: INBOX X-GMAIL-THRID: 1771484498684462449 X-GMAIL-MSGID: 1771484498684462449 |
Series |
[v1,1/2] dt-bindings: mtd: nand-controller: add nand-skip-bbtscan and nand-no-bbm-quirk DT options
|
|
Commit Message
Johan Jonker
July 15, 2023, 10:48 a.m. UTC
A NAND chip can contain a different data format then the MTD framework
expects in the erase blocks for the Bad Block Table(BBT).
Result is a failed probe, while nothing wrong with the hardware.
Some MTD flags need to be set to gain access again.
Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option
so that the original content is unchanged during the driver probe.
The NAND_NO_BBM_QUIRK option allows us to erase bad blocks with
the nand_erase_nand() function and the flash_erase command.
Add nand-skip-bbtscan and nand-no-bbm-quirk Device Tree options,
so the user has the "freedom of choice" by neutral
access mode to read and write in whatever format is needed.
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
Previous discussion:
[PATCH v3 3/3] mtd: rawnand: rockchip-nand-controller: add skipbbt option
https://lore.kernel.org/linux-mtd/1618382560.2326931.1689261435022.JavaMail.zimbra@nod.at/
---
.../devicetree/bindings/mtd/nand-controller.yaml | 13 +++++++++++++
1 file changed, 13 insertions(+)
--
2.30.2
Comments
On Sat, Jul 15, 2023 at 12:48:16PM +0200, Johan Jonker wrote: > A NAND chip can contain a different data format then the MTD framework > expects in the erase blocks for the Bad Block Table(BBT). > Result is a failed probe, while nothing wrong with the hardware. > Some MTD flags need to be set to gain access again. > > Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option > so that the original content is unchanged during the driver probe. > The NAND_NO_BBM_QUIRK option allows us to erase bad blocks with > the nand_erase_nand() function and the flash_erase command. > > Add nand-skip-bbtscan and nand-no-bbm-quirk Device Tree options, > so the user has the "freedom of choice" by neutral > access mode to read and write in whatever format is needed. > > Signed-off-by: Johan Jonker <jbx6244@gmail.com> > --- > > Previous discussion: > [PATCH v3 3/3] mtd: rawnand: rockchip-nand-controller: add skipbbt option > https://lore.kernel.org/linux-mtd/1618382560.2326931.1689261435022.JavaMail.zimbra@nod.at/ > --- > .../devicetree/bindings/mtd/nand-controller.yaml | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml > index f70a32d2d9d4..ca04d06a0377 100644 > --- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml > +++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml > @@ -103,6 +103,19 @@ patternProperties: > the boot ROM or similar restrictions. > $ref: /schemas/types.yaml#/definitions/flag > > + nand-no-bbm-quirk: > + description: > + Some controllers with pipelined ECC engines override the BBM marker with > + data or ECC bytes, thus making bad block detection through bad block marker > + impossible. Let's flag those chips so the core knows it shouldn't check the > + BBM and consider all blocks good. > + $ref: /schemas/types.yaml#/definitions/flag While this seems okay, as it seems to describe facet of the hardware... > + nand-skip-bbtscan: > + description: > + This option skips the BBT scan during initialization. > + $ref: /schemas/types.yaml#/definitions/flag ...this seems to be used to control the behaviour of software, and does not describe the underlying hardware. Maybe I'm off, but the description of the property does not hint at the aspect of the hardware that this addresses. Thanks, Conor. > + > nand-rb: > description: > Contains the native Ready/Busy IDs. > -- > 2.30.2 >
On 7/18/23 17:46, Conor Dooley wrote: > On Sat, Jul 15, 2023 at 12:48:16PM +0200, Johan Jonker wrote: >> A NAND chip can contain a different data format then the MTD framework >> expects in the erase blocks for the Bad Block Table(BBT). >> Result is a failed probe, while nothing wrong with the hardware. >> Some MTD flags need to be set to gain access again. >> >> Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option >> so that the original content is unchanged during the driver probe. >> The NAND_NO_BBM_QUIRK option allows us to erase bad blocks with >> the nand_erase_nand() function and the flash_erase command. >> >> Add nand-skip-bbtscan and nand-no-bbm-quirk Device Tree options, >> so the user has the "freedom of choice" by neutral >> access mode to read and write in whatever format is needed. >> >> Signed-off-by: Johan Jonker <jbx6244@gmail.com> >> --- >> >> Previous discussion: >> [PATCH v3 3/3] mtd: rawnand: rockchip-nand-controller: add skipbbt option >> https://lore.kernel.org/linux-mtd/1618382560.2326931.1689261435022.JavaMail.zimbra@nod.at/ >> --- >> .../devicetree/bindings/mtd/nand-controller.yaml | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml >> index f70a32d2d9d4..ca04d06a0377 100644 >> --- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml >> +++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml >> @@ -103,6 +103,19 @@ patternProperties: >> the boot ROM or similar restrictions. >> $ref: /schemas/types.yaml#/definitions/flag >> >> + nand-no-bbm-quirk: >> + description: >> + Some controllers with pipelined ECC engines override the BBM marker with >> + data or ECC bytes, thus making bad block detection through bad block marker >> + impossible. Let's flag those chips so the core knows it shouldn't check the >> + BBM and consider all blocks good. >> + $ref: /schemas/types.yaml#/definitions/flag > > While this seems okay, as it seems to describe facet of the hardware... > >> + nand-skip-bbtscan: >> + description: >> + This option skips the BBT scan during initialization. >> + $ref: /schemas/types.yaml#/definitions/flag > > ...this seems to be used to control the behaviour of software, and does > not describe the underlying hardware. > > Maybe I'm off, but the description of the property does not hint at the > aspect of the hardware that this addresses. Hi Conor, Thank you! Your point is correct. However I need both flags to change MTD software driver probe behavior in case of formatting. Patch was made after comment by Miquel: 'I would rather prefer a DT property which says "do not use the standard pattern".' DT should describe hardware and not software probe configuration. Currently not aware what other options we have for module parameters. Prefer my solution in the link. Could the MTD maintainer have a look again? Thanks! Please advise. Johan Jonker > > Thanks, > Conor. > >> + >> nand-rb: >> description: >> Contains the native Ready/Busy IDs. >> -- >> 2.30.2 >>
Hi Johan, Richard, jbx6244@gmail.com wrote on Wed, 19 Jul 2023 21:39:24 +0200: > On 7/18/23 17:46, Conor Dooley wrote: > > On Sat, Jul 15, 2023 at 12:48:16PM +0200, Johan Jonker wrote: > >> A NAND chip can contain a different data format then the MTD framework > >> expects in the erase blocks for the Bad Block Table(BBT). > >> Result is a failed probe, while nothing wrong with the hardware. > >> Some MTD flags need to be set to gain access again. > >> > >> Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option > >> so that the original content is unchanged during the driver probe. > >> The NAND_NO_BBM_QUIRK option allows us to erase bad blocks with > >> the nand_erase_nand() function and the flash_erase command. > >> > >> Add nand-skip-bbtscan and nand-no-bbm-quirk Device Tree options, > >> so the user has the "freedom of choice" by neutral > >> access mode to read and write in whatever format is needed. > >> > >> Signed-off-by: Johan Jonker <jbx6244@gmail.com> > >> --- > >> > >> Previous discussion: > >> [PATCH v3 3/3] mtd: rawnand: rockchip-nand-controller: add skipbbt option > >> https://lore.kernel.org/linux-mtd/1618382560.2326931.1689261435022.JavaMail.zimbra@nod.at/ > >> --- > >> .../devicetree/bindings/mtd/nand-controller.yaml | 13 +++++++++++++ > >> 1 file changed, 13 insertions(+) > >> > >> diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml > >> index f70a32d2d9d4..ca04d06a0377 100644 > >> --- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml > >> +++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml > >> @@ -103,6 +103,19 @@ patternProperties: > >> the boot ROM or similar restrictions. > >> $ref: /schemas/types.yaml#/definitions/flag > >> > >> + nand-no-bbm-quirk: > >> + description: > >> + Some controllers with pipelined ECC engines override the BBM marker with > >> + data or ECC bytes, thus making bad block detection through bad block marker > >> + impossible. Let's flag those chips so the core knows it shouldn't check the > >> + BBM and consider all blocks good. I am sorry but this is totally broken. We cannot just "consider all blocks good". > >> + $ref: /schemas/types.yaml#/definitions/flag > > > > While this seems okay, as it seems to describe facet of the hardware... > > > >> + nand-skip-bbtscan: > >> + description: > >> + This option skips the BBT scan during initialization. > >> + $ref: /schemas/types.yaml#/definitions/flag > > > > ...this seems to be used to control the behaviour of software, and does > > not describe the underlying hardware. > > > > Maybe I'm off, but the description of the property does not hint at the > > aspect of the hardware that this addresses. > > Hi Conor, > > > Thank you! > Your point is correct. > However I need both flags to change MTD software driver probe behavior in case of formatting. > > Patch was made after comment by Miquel: > 'I would rather prefer a DT property which says "do not use the > standard pattern".' > > DT should describe hardware and not software probe configuration. > Currently not aware what other options we have for module parameters. > Prefer my solution in the link. Could the MTD maintainer have a look again? Thanks! > Please advise. The more I think about this, the less I want to support it. You are basically getting rid of any bad block support so in practice you don't want to use mtd. Richard, what do you think? I have no strong opinion about all this, but I just feel it's terribly wrong. Thanks, Miquèl
diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml index f70a32d2d9d4..ca04d06a0377 100644 --- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml +++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml @@ -103,6 +103,19 @@ patternProperties: the boot ROM or similar restrictions. $ref: /schemas/types.yaml#/definitions/flag + nand-no-bbm-quirk: + description: + Some controllers with pipelined ECC engines override the BBM marker with + data or ECC bytes, thus making bad block detection through bad block marker + impossible. Let's flag those chips so the core knows it shouldn't check the + BBM and consider all blocks good. + $ref: /schemas/types.yaml#/definitions/flag + + nand-skip-bbtscan: + description: + This option skips the BBT scan during initialization. + $ref: /schemas/types.yaml#/definitions/flag + nand-rb: description: Contains the native Ready/Busy IDs.