Received: by 10.213.65.68 with SMTP id h4csp29616imn; Thu, 15 Mar 2018 08:37:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELsXIrKMyGO14gwSFM1Oexz+yDtkXJ69to3WfmzTt9SDrCE+6YqcBY9A/aRD8fj3NIILjvKR X-Received: by 10.99.96.66 with SMTP id u63mr7118079pgb.22.1521128279689; Thu, 15 Mar 2018 08:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521128279; cv=none; d=google.com; s=arc-20160816; b=vPkLvMq2FvOCqyClmZP5mzEo3be49yhVHXm7V3FxuMdD9XIUbovsC/EPcCmlgthBk6 hZ6kFbTgKU8aWYcqF2tle+fojo+vqBarBfN1kX6S5xtbCsLl+O7xS0gAYNy7e6er24D9 a7z0vgYaOBahvNUOt7eaqD60300VxskP82A9WMvOcv5OQY8mXtm697o3vRDy/WmBnyaj Xg1qhKY9Wk9YCeZQDMWLHp5wTLgPjXqASUKSf8xomU5byF+Mm3r1KX/Yva3XgU9tls1Y gPKbrNFsDsrhX/LrYqMabT9dMVsSwqi8xNIugBccNq85zy44RAB9TuumIWG1hBsadtim zlqA== 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 :arc-authentication-results; bh=SfvPkENoA2Xq+4YojNE86bD+Az2VlEJl6IhKjvRO3/o=; b=SEjBKw2PreqApqyIpemoOX/lEkXm9M1pz7nh8syi2MThP4oybMyQAeSXnXMyc+AFYz 8oKT5s+EKEu2+epEbpcL/glTCCjZmcuCLhpsh+SZ6fQp0ni7OjrKi7Zu/2ev51ID/IRf 8iutp0ZpNiqpqi/R5Tx9glAEenD1H4fsz6yxhX+sRMR796G38h9DE9WHsRFiGwVYOsZe GXedQT0QEVOiAo0GhDw+LE8jsOwJC9kea+1bkMNO41TVeHzxUxR8RnXIopMyOQHwv42g V6JDsJp6FpeFPi+j5R4TcneodH3fjyiGGo7+zIrUX61MTzDCU4VSsJtiXMtxaoldiF53 tYOA== 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 u21si4024518pfl.176.2018.03.15.08.37.43; Thu, 15 Mar 2018 08:37:59 -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 S1752600AbeCOPgk (ORCPT + 99 others); Thu, 15 Mar 2018 11:36:40 -0400 Received: from mail.bootlin.com ([62.4.15.54]:60378 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbeCOPgj (ORCPT ); Thu, 15 Mar 2018 11:36:39 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id BAA26206FB; Thu, 15 Mar 2018 16:36:36 +0100 (CET) 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, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (96-65-213-252-static.hfc.comcastbusiness.net [96.65.213.252]) by mail.bootlin.com (Postfix) with ESMTPSA id 37A432037A; Thu, 15 Mar 2018 16:36:24 +0100 (CET) Date: Thu, 15 Mar 2018 16:36:20 +0100 From: Boris Brezillon To: Stefan Agner , han.xu@nxp.com Cc: boris.brezillon@free-electrons.com, max.oss.09@gmail.com, richard@nod.at, linux-kernel@vger.kernel.org, marek.vasut@gmail.com, linux-mtd@lists.infradead.org, cyrille.pitchen@wedev4u.fr, dwmw2@infradead.org Subject: Re: [PATCH v2 1/2] mtd: rawnand: gpmi: add support for specific ECC strength Message-ID: <20180315163620.6122d752@bbrezillon> In-Reply-To: <20180304200602.11475-1-stefan@agner.ch> References: <20180304200602.11475-1-stefan@agner.ch> 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, On Sun, 4 Mar 2018 21:06:01 +0100 Stefan Agner wrote: > Add support for specified ECC strength/size using device tree > properties nand-ecc-strength/nand-ecc-step-size. Han, we didn't hear back from you on that. Are you okay with adding these new properties? IIRC, you feared there would be a delta between u-boot and linux support. Stephan, there's no changelog. Has anything changed in this version or is this just a RESEND? Regards, Boris > > Signed-off-by: Stefan Agner > --- > drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 30 ++++++++++++++++++++---------- > 1 file changed, 20 insertions(+), 10 deletions(-) > > diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > index 61fdd733492f..d04754289c03 100644 > --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > @@ -198,17 +198,16 @@ static inline bool gpmi_check_ecc(struct gpmi_nand_data *this) > * > * We may have available oob space in this case. > */ > -static int set_geometry_by_ecc_info(struct gpmi_nand_data *this) > +static int set_geometry_by_ecc_info(struct gpmi_nand_data *this, > + unsigned int ecc_strength, > + unsigned int ecc_step) > { > struct bch_geometry *geo = &this->bch_geometry; > struct nand_chip *chip = &this->nand; > struct mtd_info *mtd = nand_to_mtd(chip); > unsigned int block_mark_bit_offset; > > - if (!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0)) > - return -EINVAL; > - > - switch (chip->ecc_step_ds) { > + switch (ecc_step) { > case SZ_512: > geo->gf_len = 13; > break; > @@ -221,8 +220,8 @@ static int set_geometry_by_ecc_info(struct gpmi_nand_data *this) > chip->ecc_strength_ds, chip->ecc_step_ds); > return -EINVAL; > } > - geo->ecc_chunk_size = chip->ecc_step_ds; > - geo->ecc_strength = round_up(chip->ecc_strength_ds, 2); > + geo->ecc_chunk_size = ecc_step; > + geo->ecc_strength = round_up(ecc_strength, 2); > if (!gpmi_check_ecc(this)) > return -EINVAL; > > @@ -230,7 +229,7 @@ static int set_geometry_by_ecc_info(struct gpmi_nand_data *this) > if (geo->ecc_chunk_size < mtd->oobsize) { > dev_err(this->dev, > "unsupported nand chip. ecc size: %d, oob size : %d\n", > - chip->ecc_step_ds, mtd->oobsize); > + ecc_step, mtd->oobsize); > return -EINVAL; > } > > @@ -423,9 +422,20 @@ static int legacy_set_geometry(struct gpmi_nand_data *this) > > int common_nfc_set_geometry(struct gpmi_nand_data *this) > { > + struct nand_chip *chip = &this->nand; > + > + if (chip->ecc.strength > 0 && chip->ecc.size > 0) > + return set_geometry_by_ecc_info(this, chip->ecc.strength, > + chip->ecc.size); > + > if ((of_property_read_bool(this->dev->of_node, "fsl,use-minimum-ecc")) > - || legacy_set_geometry(this)) > - return set_geometry_by_ecc_info(this); > + || legacy_set_geometry(this)) { > + if (!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0)) > + return -EINVAL; > + > + return set_geometry_by_ecc_info(this, chip->ecc_strength_ds, > + chip->ecc_step_ds); > + } > > return 0; > } -- Boris Brezillon, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com