Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1966243imm; Fri, 7 Sep 2018 08:48:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYiwU/aOTelgrWtX90b3P2+Yag1xB3wz3P4IVHlztKNs4UpB8fFAf2xxXrJQPDHM6O90YiL X-Received: by 2002:a17:902:7b96:: with SMTP id w22-v6mr8498559pll.24.1536335311823; Fri, 07 Sep 2018 08:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536335311; cv=none; d=google.com; s=arc-20160816; b=r1qR2gAuDKwhGAHWMP/yEN/mM5tR6VwUerLnPnZES/cJ9N0FguB+Tc+2LGc5l6doi0 nBD3lE5PYfvUDuh/MLoFI+uVZsdX2Ge3/INNlbcXu2GSdvfvsRuFJqxbOcQ8+EMWLu9d c/zBghIX8RcaVLYos6xjVf0y5NlSt9gYfEV4h7O2HV6KJ6OM2/lMBzgUoW/w+NdSS/mI ztsXNvlqgrGFILTzUFiJVr2OulseyEJ1PZ1hQYRAaFHZk6CUInG2zd5VRefndnXs+07X HGYabJ17JX6FV1ABfJy+Acg/WCfpQr9wc+fZTOoJ3xrjC0P0l8CetUulIr3kJnxvYxLv +r2A== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=yWf3WegYndCGHLpety+L621Z/DT/7CcuOuxHRMuPRFM=; b=j2xMYi1D3/xJZBma6GrEeLXAAtT/p/jFjpCUn75BVvNFVa/E0sCqGxgT2HBrO+HzoJ lrHPXUhDLOrtxC3yrn/rUtsQQtu2wZmskZfjxY2d0oyaCK8sSdj9p0Piwp17ZWGGqz7r sq3stGLDvVGQuaJDkfhMPS01917ZV4xLyEz4tgS3B2KzuDqfc4hs//z3U+2baHSk6Zle dD2PU4zwXShkGbhpRMEZzUfoWAvxIVJWl0pAQaVgMPQuHDNoM4MM2sjQGx3PniD7lped zfe+4x+GD3q7dU7tCkH4GXh+e6kNPWERDZ+K9KqkuK3Gc/+utmpE+JeiJbuMpYlIPRwf ygNA== 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 t188-v6si8934916pfd.148.2018.09.07.08.48.16; Fri, 07 Sep 2018 08:48:31 -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 S1728792AbeIGStm (ORCPT + 99 others); Fri, 7 Sep 2018 14:49:42 -0400 Received: from mail.bootlin.com ([62.4.15.54]:43796 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbeIGStl (ORCPT ); Fri, 7 Sep 2018 14:49:41 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 7452120799; Fri, 7 Sep 2018 16:08:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-30-219.w90-88.abo.wanadoo.fr [90.88.15.219]) by mail.bootlin.com (Postfix) with ESMTPSA id 1B51920701; Fri, 7 Sep 2018 16:08:23 +0200 (CEST) Date: Fri, 7 Sep 2018 16:08:22 +0200 From: Boris Brezillon To: Masahiro Yamada Cc: linux-mtd@lists.infradead.org, Miquel Raynal , devicetree@vger.kernel.org, Rob Herring , Dinh Nguyen , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Mark Rutland Subject: Re: [PATCH] mtd: rawnand: denali: add DT property to specify skipped bytes in OOB Message-ID: <20180907160822.319047c8@bbrezillon> In-Reply-To: <1536317783-4942-1-git-send-email-yamada.masahiro@socionext.com> References: <1536317783-4942-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masahiro, On Fri, 7 Sep 2018 19:56:23 +0900 Masahiro Yamada wrote: > 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. You cannot support the reset control either because > resetting the controller will get register values lost. > > This commit adds a way to specify it via DT. If the property > "denali,oob-skip-bytes" exists, the value will be set to the register. Hm, do we really need to make this config customizable? I mean, either you have a large-page NAND (page > 512 bytes) and the 2 first bytes must be reserved for the BBM or you have a small-page NAND and the BBM is at position 4 and 5. Are you sure people configure that differently? Don't you always have SPARE_AREA_SKIP_BYTES set to 6 or 2? Regards, Boris