Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3787349rwp; Sat, 15 Jul 2023 09:19:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHiaREDjamnHSzUWyjNwCQp7l484FHcvqUdtzzSygGS+35L+iKo22Ztxjh+CfJACNjeWpu0 X-Received: by 2002:a05:6a20:7f8c:b0:11f:985e:ae2c with SMTP id d12-20020a056a207f8c00b0011f985eae2cmr2974422pzj.3.1689437993202; Sat, 15 Jul 2023 09:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689437993; cv=none; d=google.com; s=arc-20160816; b=YtIYfSCm8izN5gZFWgKE8ABBqU6E2Ygv2sdvHcMifHuZRTz+lFRqJrLGipKGHvGJ6K sCBI32fJR/Dn4Zu4X4WX8tFSDoysyhOL6tlS73Vk1MSBcprodut4Ztq+sjX6rLZP0uTa VEWRjVYXkAwjk3NqHwLBANmEFvIhGB40FB5sPca5Fd9bd38ncj7veFmbN1RCF0klN7uo 6YP5A1AM2KAxMxsl3Gn/vLIxTH2pr9wg+V55JdcMgPf24mhPyi7txg5tkk/mBeuwWOde NeBU9DUf3eJ1o26bOyj++5WkSaTH0W19z8VWfEdCQuZwvbpKzSVWr/Q0F8SMN9Vq+hYU UOFA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=t/7fa1VodGmzW8y0BKaOaML3SEXmiAKlgK+Q/+vMQV8=; fh=rIeRDPN4Xb7VQwCXxVgj0dw3Fh2Vl5And41xyVTI99M=; b=iwBpvg8G45yJJt93eKBc/w4Gr8efIyiv/LEeF22Wpavu41/+Nrn0GG2e9lMynwkrm2 /lVrVvmyB19BjDOJlkdxEkjGn2NMNlWeYEMwuQ9LFKXp/CmBLXXO3U4mAxaNQO3YpqxE br5xQQFVxCqJ3DevSSPA5ADDkLfp/byuGeHwoU7gmaV5FxvkHZZj0nbz61nUBNQ22jnq h51pRbmEGQGcEzGqetfkMkbku5Vd+Fr0e5J7SHu+CGOVIfvu2OpNmj1gndI1dSykcNkd 7llH7gLSVADnNFqCOU01chk/xWf6johjgFPyF+837+HSa5whfHNOLFu3aoAbqdCM8iqu pkCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dUH6X1Y1; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a632a11000000b0053fb354c191si8333893pgq.861.2023.07.15.09.19.38; Sat, 15 Jul 2023 09:19:53 -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=@bootlin.com header.s=gm1 header.b=dUH6X1Y1; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbjGOPzp (ORCPT + 99 others); Sat, 15 Jul 2023 11:55:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjGOPzo (ORCPT ); Sat, 15 Jul 2023 11:55:44 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B6F132; Sat, 15 Jul 2023 08:55:42 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id A88B21C0003; Sat, 15 Jul 2023 15:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689436541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t/7fa1VodGmzW8y0BKaOaML3SEXmiAKlgK+Q/+vMQV8=; b=dUH6X1Y12IOT2F/sFhd4jGSWKbwni4/FzOi0GZOEN5k4LPXlD9Aw7mB0U6xeWT6zGwPLf7 buhDI5e6DpVZWdnjfizz98ZRZHj+y4U1ZcmsL6nvukOOj7fUAQ/cTHg99Sa3wpTaTk7Yh/ 4R8hHVg49rPBpA1s7/ElgLGKuywYt7H20Li9CwzReflL0Dnq2Q+gCDs+RBVUX7uIPuWF6C OxOecvHzgww6n5qpiLkUJlhx/BkOR4d7rZvOvhMvvY64Mmqq6yOEPKA1f3PFrTJm/i1qnr aSVPoLaewwsYN6qGYbNPxUiHz+M6mrxWqCTkwhTDgWQS66Y+jD9UBVMU1fvl+g== Date: Sat, 15 Jul 2023 17:55:38 +0200 From: Miquel Raynal To: Johan Jonker 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 Subject: Re: [PATCH v1 2/2] mtd: rawnand: add nand-skip-bbtscan and nand-no-bbm-quirk DT options Message-ID: <20230715175538.7142a141@xps-13> In-Reply-To: <2b0dc481-562f-c8df-545e-dcf6548adb07@gmail.com> References: <61c84262-cd98-1e60-d95b-9b0492083994@gmail.com> <2b0dc481-562f-c8df-545e-dcf6548adb07@gmail.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Johan, jbx6244@gmail.com wrote on Sat, 15 Jul 2023 12:49:18 +0200: > 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. >=20 > 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. >=20 > 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. This sounds like a partial solution. How do you handle bad blocks? > Signed-off-by: Johan Jonker > --- >=20 > Previous discussion: > [PATCH v3 3/3] mtd: rawnand: rockchip-nand-controller: add skipbbt option > https://lore.kernel.org/linux-mtd/1618382560.2326931.1689261435022.JavaMa= il.zimbra@nod.at/ > --- > drivers/mtd/nand/raw/nand_base.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand= _base.c > index a6af521832aa..f0fa5c3519b1 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -5521,6 +5521,12 @@ static int rawnand_dt_init(struct nand_chip *chip) > if (of_property_read_bool(dn, "nand-is-boot-medium")) > chip->options |=3D NAND_IS_BOOT_MEDIUM; >=20 > + if (of_property_read_bool(dn, "nand-no-bbm-quirk")) > + chip->options |=3D NAND_NO_BBM_QUIRK; > + > + if (of_property_read_bool(dn, "nand-skip-bbtscan")) > + chip->options |=3D NAND_SKIP_BBTSCAN; > + > if (of_property_read_bool(dn, "nand-on-flash-bbt")) > chip->bbt_options |=3D NAND_BBT_USE_FLASH; >=20 > -- > 2.30.2 >=20 Thanks, Miqu=C3=A8l