Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1811168imm; Thu, 24 May 2018 01:00:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYs+vTYfdr6+nthKrc24Tp/35Fs8QlBLoy+DorpH6BAIww82prq1CRxesACCByjchYeCHx X-Received: by 2002:a63:4202:: with SMTP id p2-v6mr4977326pga.137.1527148855546; Thu, 24 May 2018 01:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527148855; cv=none; d=google.com; s=arc-20160816; b=nWYe2HLK4iKryiD1s2R2NrUy5iyHTKbk9Z8Kjcw+LP+bMFBlTDHl/4G7iiOjXN+2Ut MG+djbQ+EOqDGNNrDKgq77KYxNRBXazPRpmaP3FTCkgt2bhAMiO0CLbk1qOJiPAOSfAv cLg+JAuK8ntpqlIJwBtgpDMWUp5Uo/8lUckkFDJZHy3BGC6YbxvSl9cnH33fQ3JMY3Sv RGs+5u33cAFACfgXt53ZTVqtV+GWH1dYP2ePrsAXAS5W631L0Wi0fd6l44Nqu9Q1oXIi 5mfgH3y5dRDeuJvMOGcsQ1MFs90+KyDLCw5M2OQ/T6qZ0aTG+aZqXljNfOtAJSgZnpe8 Ygaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=90In+kDwrmlR6QAIMyXTjFp+MAN6+T08vtmdyGHjz/o=; b=fmL29IVEXUmz5Yh4qqUQQPdc0FS3O4edCTEApho8dpRrx+ChrzzjFH0b7jUj09Q4i9 jGpvAIExVBLTgje4i/s0/2/RBHD9KtWSr7KllGGv7DbMLDwdUKRJ8dnOWn4opwvi+mKj rvMmvCe5EGnAkHMkEZcZkoDAFodikGWxvM0kz0+q9h4x5PpRmx4RN8CXVyCQCHUfjtHH rQcT8v6cd9t1cCkgIo06txCNAWgDTE7WmpaY/TpTyKmkjKuD/hKb+Baih73fNdd3BZI7 zvWyIzAElqwP0vrxL+gFehHAY0o5RZxxkVGWn6IPzXcrIH33h2aOK8EF798iQfceIHPB rl1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endian-se.20150623.gappssmtp.com header.s=20150623 header.b=xySQVLCU; 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 q19-v6si11589217pgc.524.2018.05.24.01.00.07; Thu, 24 May 2018 01:00:55 -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; dkim=pass header.i=@endian-se.20150623.gappssmtp.com header.s=20150623 header.b=xySQVLCU; 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 S965184AbeEXHpj (ORCPT + 99 others); Thu, 24 May 2018 03:45:39 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:37018 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965172AbeEXHpg (ORCPT ); Thu, 24 May 2018 03:45:36 -0400 Received: by mail-yw0-f193.google.com with SMTP id j190-v6so116742ywe.4 for ; Thu, 24 May 2018 00:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endian-se.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=90In+kDwrmlR6QAIMyXTjFp+MAN6+T08vtmdyGHjz/o=; b=xySQVLCU52DZnxhIgyVonDy6BGQyHiHO4RRsd0k0ZvviM/NViwZCIEng56SUAchcS2 M57j9+BZYhlKKc2EqdveLV1QA0cGvLs6p2qLNPPQxO5yiQjF0ceVig44hW9+++V+UmXa mea8sSZ3hffb3YeJhWHrvi8KbGQrVoKzCgTZhiFXGVb9Egfb7ZnWVKMxITHs8a8Vn1oK VCJqWPycZ1iLSYOtxX2Hf/N8+gi+6TTJagqKPw1lZKfKTpmkP+vIGJHRtLX1IipccICA HZwI9luW1M/7QKTq0SkTRhdM0d2ZbP7829evvGCVurxplPTFvhgo2yh2f3xwhxzpbqwX +vDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=90In+kDwrmlR6QAIMyXTjFp+MAN6+T08vtmdyGHjz/o=; b=QgPlxGQ3WSjr5wldkdE8d3MCI35y4gypTid+SGRhtyPFX81sowAVlP63807DyvyHeB d6yKW8U0ZNLjsFtmsZ64RdZokPtYs/HSEKaj+qLkjQhSVr+ih6Zq2dRrp0xSSUD2kHeI 7XCTCURbickTMxNbsvIVhiGIX7BKxhtywelgu7M/ZZmylvvNQZY9bCPxClhtuTY+MbBz hfbV0C24e36Z7HBkI2DUz7oWHiNrwYquYgOCBragBw1Flo+WyL4EokmIvbC7/Jcq3UjP +SzJP3u1lsn9SL3LR6lD9Cwg+JOs8kKdVLbySbyCmK2QrMRYgZgBBIDCk9tlUc2OF498 cZPg== X-Gm-Message-State: ALKqPwewQ2UUDhUXVNzcEZtdEX87W2186wo9rnSYDI3xxFKVDEpBGEeX 2wdmhfE5eVZOW5QcmbTm/Km9PzNfAXr/hRWgwflPtg== X-Received: by 2002:a81:7541:: with SMTP id q62-v6mr3179806ywc.84.1527147936241; Thu, 24 May 2018 00:45:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:2d26:0:0:0:0:0 with HTTP; Thu, 24 May 2018 00:45:35 -0700 (PDT) In-Reply-To: <86fdf19ec92b732709732fb60199f16488b4b727.1526990589.git.stefan@agner.ch> References: <86fdf19ec92b732709732fb60199f16488b4b727.1526990589.git.stefan@agner.ch> From: Benjamin Lindqvist Date: Thu, 24 May 2018 09:45:35 +0200 Message-ID: Subject: Re: [RESEND PATCH 2/5] mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver To: Stefan Agner Cc: boris.brezillon@bootlin.com, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, thierry.reding@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, Lucas Stach , miquel.raynal@bootlin.com, richard@nod.at, marcel@ziswiler.com, krzk@kernel.org, digetx@gmail.com, jonathanh@nvidia.com, pdeschrijver@nvidia.com, pgaikwad@nvidia.com, Mirza Krak , linux-mtd@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stefan (and all), First off, I apoloigize in advance if I'm deviating from common kernel mailing list courtesy -- this is my first time responding. I just have a comment on the NAND driver that I'd like to bring to the public. > + switch (mtd->oobsize) { > ... > + case 224: > + mtd_set_ooblayout(mtd, &tegra_nand_oob_224_ops); > + chip->ecc.strength = 8; > + chip->ecc.bytes = 18; > + value |= CFG_ECC_SEL | CFG_TVAL_8; > + break; + case 224: I am not sure how you arrived at this oobsize-based inference. I have not seen any explicit relation between oob size and ECC algorithm used in the reference manual. Indeed, the U-Boot I was working on (a fork of the Toradex 2015.04 U-Boot) always has oobsize == 224 but used either BCH[t=16] or RS[t=4]. In fact, we tried choosing RS[t=8] in U-Boot but we failed to make the BootROM decode this at all. So we had to use RS[t=4]. But changing the algorithm did not automatically change the oobsize, at least it didn't for us. So maybe you should consider if this is really the way to go about deciding which algorithm is used. Note that we're in fact using this patch set in Linux today, but we had to remove the oobsize inference part. Currently we're simply hard coding it to CFG_TVAL_4, but maybe it would be cleaner to add ECC algo as a board config instead, e.g. in the .dts file or whatever. This seems to be done by other vendors already, see for example excerpt of Documentation/devicetree/bindings/mtd/gpmc-nand.txt below: - ti,nand-ecc-opt: A string setting the ECC layout to use. One of: "sw" 1-bit Hamming ecc code via software "hw" use "ham1" instead "hw-romcode" use "ham1" instead "ham1" 1-bit Hamming ecc code "bch4" 4-bit BCH ecc code "bch8" 8-bit BCH ecc code "bch16" 16-bit BCH ECC code Refer below "How to select correct ECC scheme for your device ?" It seems as if this method would be equally applicable to Tegra NAND. Best regards, Benjamin