From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D7B5C00449 for ; Fri, 5 Oct 2018 14:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5291206B2 for ; Fri, 5 Oct 2018 14:39:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5291206B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729044AbeJEVi1 convert rfc822-to-8bit (ORCPT ); Fri, 5 Oct 2018 17:38:27 -0400 Received: from mail.bootlin.com ([62.4.15.54]:47621 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728361AbeJEVi1 (ORCPT ); Fri, 5 Oct 2018 17:38:27 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 2A7C620CFE; Fri, 5 Oct 2018 16:39:24 +0200 (CEST) Received: from xps13 (AAubervilliers-681-1-28-153.w90-88.abo.wanadoo.fr [90.88.148.153]) by mail.bootlin.com (Postfix) with ESMTPSA id D2A0F2090A; Fri, 5 Oct 2018 16:39:13 +0200 (CEST) Date: Fri, 5 Oct 2018 16:39:14 +0200 From: Miquel Raynal To: Masahiro Yamada Cc: linux-mtd@lists.infradead.org, Boris Brezillon , Dinh Nguyen , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse Subject: Re: [PATCH v2] mtd: rawnand: denali: set SPARE_AREA_SKIP_BYTES register to 8 if unset Message-ID: <20181005163914.5262e46d@xps13> In-Reply-To: <1538108161-6174-1-git-send-email-yamada.masahiro@socionext.com> References: <1538108161-6174-1-git-send-email-yamada.masahiro@socionext.com> Organization: Bootlin X-Mailer: Claws Mail 3.16.0 (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 Masahiro, Masahiro Yamada wrote on Fri, 28 Sep 2018 13:16:01 +0900: > NAND devices need additional data area (OOB) for error correction, > but it is also used for Bad Block Marker (BBM). In many cases, the > first byte in OOB is used for BBM, but the location actually depends > on chip vendors. The NAND controller should preserve the precious > BBM to keep track of bad blocks. > > In Denali IP, the SPARE_AREA_SKIP_BYTES register is used to specify > the number of bytes to skip from the start of OOB. The ECC engine > will automatically skip the specified number of bytes when it gets > access to OOB area. > > The same value for SPARE_AREA_SKIP_BYTES should be used between > firmware and the operating system if you intend to use the NAND > device across the control hand-off. > > In fact, the current denali.c code expects firmware to have already > set the SPARE_AREA_SKIP_BYTES register, then reads the value out. > > If no firmware (or bootloader) has initialized the controller, the > register value is zero, which is the default after power-on-reset. > In other words, the Linux driver cannot initialize the controller > by itself. > > Some possible solutions are: > > [1] Add a DT property to specify the skipped bytes in OOB > [2] Associate the preferred value with compatible > [3] Hard-code the default value in the driver > > My first attempt was [1], but in the review process, [3] was suggested > as a counter-implementation. > (https://lore.kernel.org/patchwork/patch/983055/) > > The default value 8 was chosen to match to the boot ROM of the UniPhier > platform. The preferred value may vary by platform. If so, please > trade up to a different solution. > > Signed-off-by: Masahiro Yamada > --- > Applied to nand/next. Thanks, Miquèl