Received: by 2002:a17:90a:2044:0:0:0:0 with SMTP id n62csp532708pjc; Mon, 20 May 2019 11:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZNOB59AfbeqAzl/Negs52uyMxgG5Mbuub+hPq1GgLRU4mSSkTXzOlApC5rz1+zNNL//O9 X-Received: by 2002:a65:578b:: with SMTP id b11mr76733693pgr.446.1558376531487; Mon, 20 May 2019 11:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558376531; cv=none; d=google.com; s=arc-20160816; b=ryKVZREg0BofA4TzOFwAoPfIJndVj21wBG39ADUNU8m+PyUrqJNCe/YM1x8AQMcxyo iBrxABwA05DvrWq7GPwI1AcUps2C4qzC4+ru+ssonkygeiSpb6+09z8wyNAndz9oEqC/ 19itkTOJdFc4O7L1cmYFxJyfFjsLqm28LYI1q4TGpHaKEIwLnNM5gUzBftNAIbdvZGz+ Y6IoNXRBf89l1PvkhYJbu822467mC1rWxcDYEMhLTO63NUSW29cWzWybbQQSxpSrbLOb Ni2YggDJa3yTpiC/3ztIlBfH2h0LKMkUri7M3OkzOKcotOrgu5Uk4Tc9tzQkGSUciJmL 38IQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CzknmS3algkOP4TKdwdGkF2v7Kn89/q/nMaTVG+rIi8=; b=J0iWAc9QGO3DM/S/GGXAlqWQuKiyXLx+V3PfLZ/DtULlvmUSpL5L7Fad+eBUr3o2gO IQRUVb3GXJJD72wwcgQb0Cm0iZn6Rut8B3MUw63m5KiveSJmLlOqabFe1PJ2O8bSrACn pr8n1uaDjiaMQ13H4Wtaz5Hpc9KCdr7Wd72xPahuBQ4DWkiMs6SESfWXnHXDq1M9fsVb 7ZI6DNYHbEg4yw3ieoW23pATxAK0zQilO+LrpU7GuAu7ekIxu9XskNxjEhzF1gNXrAgZ a2W4Iwil3bvv7MSwlR9hHotFUhKuouIBzl5oyMOgbjpMZnSRYyfTxNZpfUbjZ6bUWI5y rIHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b6gZFxSg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si18274446plk.264.2019.05.20.11.21.56; Mon, 20 May 2019 11:22:11 -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=@gmail.com header.s=20161025 header.b=b6gZFxSg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726408AbfETRvc (ORCPT + 99 others); Mon, 20 May 2019 13:51:32 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:37313 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726282AbfETRvb (ORCPT ); Mon, 20 May 2019 13:51:31 -0400 Received: by mail-io1-f65.google.com with SMTP id u2so11745842ioc.4 for ; Mon, 20 May 2019 10:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CzknmS3algkOP4TKdwdGkF2v7Kn89/q/nMaTVG+rIi8=; b=b6gZFxSgX7BPxz6wATO5y49g6szkHUt8pyyQn+7XD7mrpu3cNB6yoRVVd3CQvBlLUD 13e0jpbks5gt4rufx6DheFuvjKy6fqoLQe5k+i4NbPXAmU7Py5WTPjzKm3Ye/gfqqtbO IBI1sOcKPkonTGXIdjCADvDpfHTxuG9IzltrrfuTy0D89/1OXk+OJrZL1VGuqvaTb4vX 5rl9WKSNT+8OV+7pLttFS9HM5InfGbkOBtqtl67aozzNhRveetBT1WVIZVWEmOs/32gF 6fURxoruuPRoibbX8YGJss+ZvWeXxGX45ycH3oJyLFWWDdknweY+owdP0ToMVDLUOI2m ndiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CzknmS3algkOP4TKdwdGkF2v7Kn89/q/nMaTVG+rIi8=; b=K/NI2c2RuUvt1rhsEdgGYPKVfCMSBzU1QE2a4yC0H3fbW0cJpa5/pTw4BswFVAuyU7 L5vop8iEzMoscUxF6VPJC2wgb9sXXMKRWfk1m7TuQU9wtTwglhVlfHhbR4moG0FfEZMf Q3yCeXcTR37vxjoKnrlteyT1OtnKtEnNlGUB+TDAjuPyest9v/2eh38+/L56h1Z+9Qzp ww+vHlIPaoeTNmzkS9bFtbidXhakpFiCnaGw2LcnntlnIxb39PVBnOyyntIP519GV1if avnH1A9beQTUD48pNqaKNUcAVXxFGh7Y4I/9l4qCVzoqa5K+9hoGNjuQZ2xegorpKSkT f1Pw== X-Gm-Message-State: APjAAAUSLpyTWht4NfgoqlQy41yYOcW1xoet+m8lgWD9aVBohXZGAS8b J3AZSZ6PSeLw8hWU6EXPS/Q3p8IVT0DtNg6uz3c= X-Received: by 2002:a6b:3b88:: with SMTP id i130mr26971762ioa.21.1558374690717; Mon, 20 May 2019 10:51:30 -0700 (PDT) MIME-Version: 1.0 References: <1558117914-35807-1-git-send-email-kdasu.kdev@gmail.com> <1558117914-35807-2-git-send-email-kdasu.kdev@gmail.com> <20190520144436.67e42f00@xps13> <20190520193432.79cf132f@xps13> In-Reply-To: <20190520193432.79cf132f@xps13> From: Kamal Dasu Date: Mon, 20 May 2019 13:51:19 -0400 Message-ID: Subject: Re: [PATCH 2/2] mtd: nand: raw: brcmnand: fallback to detected ecc-strength, ecc-step-size To: Miquel Raynal Cc: MTD Maling List , bcm-kernel-feedback-list@broadcom.com, Linux Kernel Mailing List , Brian Norris , Richard Weinberger , David Woodhouse , Marek Vasut , Vignesh Raghavendra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 20, 2019 at 1:34 PM Miquel Raynal w= rote: > > Hi Kamal, > > Kamal Dasu wrote on Mon, 20 May 2019 13:31:52 > -0400: > > > Will make the changes and send a V2 patch. > > > > On Mon, May 20, 2019 at 8:44 AM Miquel Raynal wrote: > > > > > > Hi Kamal, > > > > > > Kamal Dasu wrote on Fri, 17 May 2019 14:29:55 > > > -0400: > > > > > > > This change supports nand-ecc-step-size and nand-ecc-strenght field= s in > > > > > > strength > > > > > > > brcmnand dt node to be optional. > > > > > > DT ^ extra space > > > > > > > see: Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt > > > > > > > > If both nand-ecc-strength and nand-ecc-step-size are not specified = in > > > > device tree node for NAND, nand_base driver does detect onfi ext ec= c > > > > > > s/nand_base driver/the raw NAND layer/ > > > s/onfi/ONFI/ > > > s/ecc/ECC/ > > > > > > What is "ext"? Please use plain English here. > > > > > > > info from ONFI extended parameter page for parts using ONFI >=3D 2.= 1. In > > > > > > s/info/information/ > > > > > > > case of non-onfi NAND there could be a nand_id table entry with the= ecc > > > > > > s/ecc/ECC/ > > > > > > > info. If there is a valid device tree entry for nand-ecc-strength = and > > > > nand-ecc-step-size fields it still shall override the detected valu= es. > > > > > > > > Signed-off-by: Kamal Dasu > > > > --- > > > > drivers/mtd/nand/raw/brcmnand/brcmnand.c | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd= /nand/raw/brcmnand/brcmnand.c > > > > index ce0b8ff..e967b30 100644 > > > > --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c > > > > +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c > > > > @@ -2144,6 +2144,16 @@ static int brcmnand_setup_dev(struct brcmnan= d_host *host) > > > > return -EINVAL; > > > > } > > > > > > > > + if (!(chip->ecc.size > 0 && chip->ecc.strength > 0) && > > > > > > Is the case where only size OR strength is valid handled? > > > > Both strength and need to be valid, else the driver will behave like > > before and will fail the probe. > > Yes, but you do not handle the case when either strength OR size is not > valid but the other one is. Is it one purpose? > If I understand you want me to use the following check: if (ecc->mode !=3D NAND_ECC_NONE && (!ecc->size || !ecc->strength)) { if (chip->base.eccreq.step_size && chip->base.eccreq.strength) { /* use the base values */ } > > > > > > > > > + (chip->base.eccreq.strength > 0 && > > > > + chip->base.eccreq.step_size > 0)) { > > > > + /* use detected ecc parameters */ > > > > > > Use ECC > > > > > > > + chip->ecc.size =3D chip->base.eccreq.step_size; > > > > + chip->ecc.strength =3D chip->base.eccreq.strength; > > > > + pr_info("Using detected nand-ecc-step-size %d, nand-e= cc-strength %d\n", > > > > + chip->ecc.size, chip->ecc.strength); > > > > + } > > > > + > > > > switch (chip->ecc.size) { > > > > case 512: > > > > if (chip->ecc.algo =3D=3D NAND_ECC_HAMMING) > > > > > > > > > Thanks, > > > Miqu=C3=A8l > > > > Kamal > > > > > Thanks, > Miqu=C3=A8l Kamal