Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp979151ybe; Thu, 19 Sep 2019 06:55:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1ZbYmuYzudVBhfxJYgW2raC20NudLIa9dW8TLXdOL3l3d0CVQM7wcjHs6D72eh7DzLZpD X-Received: by 2002:a17:907:411d:: with SMTP id nw21mr14161701ejb.8.1568901339458; Thu, 19 Sep 2019 06:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568901339; cv=none; d=google.com; s=arc-20160816; b=g6W6sypeeZsvcrYDADdYVMGeS7nbIR4Fk1Q1hfuj2QpLw3SqZqOB2fwShT3ZG3k/wI d69LdOvAffPuqXQVVXPX0aRtde1rRXGOIOMe35ux7fG1H581V2bCPaRAR3BhBM5ckgaN WUPAbiXrZy7lNAwyc9GxTanNPlTo6IlpTm+nEdmoUL837j+XoqoaqDF0JWbT2bSP5weu 8DpMNWwSqV4ubgHuP/n1D76aUNcdV7tXGp4ctVMkmxpeGGBAio9lQUlunPQ55o2Fq1eJ +cKCCZcM3dYjbYdzvJj72PhY4uRUgpyNUiART33fVL5iX+HAfTRvZENk9tIT/CSlNbZg f9Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=bwabJWKil2jIqs2mAPPXdRmnK0dF/hzrxqh4uvOj9XM=; b=AoQoPRdEiJ2SW9e3Mqp2COUvkHm1hsI+0cijxw0gI+lyR4E4DW/BAE7N8pQOC3A211 sJ3obIMSooIbm3qHcZFajLSSJSmCjhnFp5/YAReB6ysWT+kYMYkGDRGKfDf0GeV+D/Ne XfqaarEMuIvTWLhCiTxUc/pxwHw5V9+1VWq3PCG4IKcPkI/E1gz+2c9Air4R7bVauADO pxle1PoSxQlQFNnwzfAWErAUpetOmVVy8Q7+g8ttuBKULwYQuWiTCa+hRvOiqgxkWdUf VioKZVIwx88eN8gHc9l0jZ4xfevmtAQDwzew+5r0PUA1wi5ZhdmKJb/zLKrv+Z0EeHeY F6mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si5053966edw.51.2019.09.19.06.55.16; Thu, 19 Sep 2019 06:55:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389689AbfISM6Y convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Sep 2019 08:58:24 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:56931 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387712AbfISM6Y (ORCPT ); Thu, 19 Sep 2019 08:58:24 -0400 Received: from xps13 (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: miquel.raynal@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 36BFB240005; Thu, 19 Sep 2019 12:58:19 +0000 (UTC) Date: Thu, 19 Sep 2019 14:58:19 +0200 From: Miquel Raynal To: Piotr Sroka Cc: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Vignesh Raghavendra , Boris Brezillon , Frieder Schrempf , , Subject: Re: [PATCH] - change calculating of position page containing BBM Message-ID: <20190919145819.66e74aef@xps13> In-Reply-To: <20190919124139.10856-1-piotrs@cadence.com> References: <20190919124139.10856-1-piotrs@cadence.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Piotr, Piotr Sroka wrote on Thu, 19 Sep 2019 13:41:35 +0100: > Change calculating of position page containing BBM > > If none of BBM flags is set then function nand_bbm_get_next_page > reports EINVAL. It causes that BBM is not read at all during scanning > factory bad blocks. The result is that the BBT table is build without > checking factory BBM at all. For Micron flash memories none of this > flag is set if page size is different than 2048 bytes. "none of these flags are set" > > This patch changes the nand_bbm_get_next_page function. "Address this regression by changing the nand_bbm_get_next_page_function." > It will return 0 if none of BBM flag is set and page parameter is 0. no BBM flag is set > After that modification way of discovering factory bad blocks will work > similar as in kernel version 5.1. > Fixes + stable tags would be great! > Signed-off-by: Piotr Sroka > --- > drivers/mtd/nand/raw/nand_base.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c > index 5c2c30a7dffa..f64e3b6605c6 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -292,12 +292,16 @@ int nand_bbm_get_next_page(struct nand_chip *chip, int page) > struct mtd_info *mtd = nand_to_mtd(chip); > int last_page = ((mtd->erasesize - mtd->writesize) >> > chip->page_shift) & chip->pagemask; > + unsigned int bbm_flags = NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE > + | NAND_BBM_LASTPAGE; > > + if (page == 0 && !(chip->options & bbm_flags)) > + return 0; > if (page == 0 && chip->options & NAND_BBM_FIRSTPAGE) > return 0; > - else if (page <= 1 && chip->options & NAND_BBM_SECONDPAGE) > + if (page <= 1 && chip->options & NAND_BBM_SECONDPAGE) > return 1; > - else if (page <= last_page && chip->options & NAND_BBM_LASTPAGE) > + if (page <= last_page && chip->options & NAND_BBM_LASTPAGE) > return last_page; > > return -EINVAL; Lookgs good otherwise. Thanks, Miquèl