Received: by 10.213.65.68 with SMTP id h4csp31326imn; Thu, 15 Mar 2018 08:41:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELvkrQ56OEVF2SNoojBKpM91lsVNM1AXH46nvPwOBpwPsf6OiaX+GZah+q2V2l557A03puhP X-Received: by 10.99.143.3 with SMTP id n3mr7099764pgd.159.1521128476304; Thu, 15 Mar 2018 08:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521128476; cv=none; d=google.com; s=arc-20160816; b=y5m564iAyXiM4q6fXPp6vRptf+wf0mndKNpMxkn8Md6/gDCW8gCGUsStxZbSgQfhgI 3aZOA/maKheIW6iJjrZb06kZ4ChjLp+LKJP5V3eRv0coBbHPg334JZkYsqN7CO8U7+5J 6bwfQgEuKclhpgRZ9L6m8uqVJetZK/IaUXrJfikF34cTkoKzGdjfP7VDV7t3gMCRtnLx pq/S29gj+uvDWhDIkFaNzPT5ji2NyYBzK6ZLmejp8h56lgfvC41XSuTAU4jb9C+A30h4 iNzr0hZScEetpD4bKQbB36GUFjubIxgMQL1vFE/m110FoliHcErujNrmx7Xc2nNVpdfK 4CIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:message-id:from:cc:to :subject:content-transfer-encoding:mime-version:references :in-reply-to:user-agent:date:arc-authentication-results; bh=XYnWwHMh18IA6KMOzw/vFmJgiw5mXQqDiGUCpjaybXI=; b=OA4mN6TsxSOA5Q1YLE4ODaGZ3rvjWDhBl6bjQrZ50MBTxD3aPm/j325ll15rUfXctM vReux5f9oD7X3ery4oEh6Hw/w94QM2FuVhcZeQfHJChsUGACbeYe9VfpgNTiNlpb4fme eG5Kmysy1fKkGoUW2fgm1PwcRkDIKm7G0VtNgj2gUVJLXA8no0p/ZeQWdNcQ5ACtG2d8 aL9h2zRnhAtUabTsX04mIaAhskMZgx/09CJG7jw41kD7csNusTlzkifOK0YxCq3+ftDr lbVV8UKH+LY6L2DQWQUQ63ZmM4kFyoEL8xyxqQOwvYpFtoqdsMnJbe71Txh4qqM0uG9b 9gLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@agner.ch header.s=dkim header.b=ZrDYNB90; 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 v8-v6si4177404plk.659.2018.03.15.08.41.01; Thu, 15 Mar 2018 08:41:16 -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=fail header.i=@agner.ch header.s=dkim header.b=ZrDYNB90; 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 S932406AbeCOPja (ORCPT + 99 others); Thu, 15 Mar 2018 11:39:30 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:60727 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752738AbeCOPj3 (ORCPT ); Thu, 15 Mar 2018 11:39:29 -0400 Received: from [192.168.0.38] (178-82-4-249.dynamic.hispeed.ch [178.82.4.249]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 2BD915C0A76; Thu, 15 Mar 2018 16:39:13 +0100 (CET) Date: Thu, 15 Mar 2018 16:39:18 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <20180315163620.6122d752@bbrezillon> References: <20180304200602.11475-1-stefan@agner.ch> <20180315163620.6122d752@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2 1/2] mtd: rawnand: gpmi: add support for specific ECC strength To: Boris Brezillon , 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 From: Stefan Agner Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1521128353; bh=XYnWwHMh18IA6KMOzw/vFmJgiw5mXQqDiGUCpjaybXI=; h=Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Subject:To:CC:From:Message-ID; b=ZrDYNB90XKu+N+WPffipDPI3pS+0t0qD7UorgEoKQzxCMDiWtSVRUIr0d68Dkd4y1506tWhFHNDZlK3O7r7EcSrgyG+rUlatX17gf0D1AB4bp/0RowkE+psAyh4FaXGksH386hmyP5NevTnTurSmutFZ1L2pZO1woVNmmwFFTu0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On March 15, 2018 4:36:20 PM GMT+01:00, Boris Brezillon wrote: >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=2E > >Han, we didn't hear back from you on that=2E Are you okay with adding >these new properties? IIRC, you feared there would be a delta between >u-boot and linux support=2E > >Stephan, there's no changelog=2E Has anything changed in this version or >is this just a RESEND? Sorry forgot that=2E I just split documentation and driver changes=2E -- Stefan > >Regards, > >Boris > >>=20 >> Signed-off-by: Stefan Agner >> --- >> drivers/mtd/nand/gpmi-nand/gpmi-nand=2Ec | 30 >++++++++++++++++++++---------- >> 1 file changed, 20 insertions(+), 10 deletions(-) >>=20 >> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand=2Ec >b/drivers/mtd/nand/gpmi-nand/gpmi-nand=2Ec >> index 61fdd733492f=2E=2Ed04754289c03 100644 >> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand=2Ec >> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand=2Ec >> @@ -198,17 +198,16 @@ static inline bool gpmi_check_ecc(struct >gpmi_nand_data *this) >> * >> * We may have available oob space in this case=2E >> */ >> -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 =3D &this->bch_geometry; >> struct nand_chip *chip =3D &this->nand; >> struct mtd_info *mtd =3D nand_to_mtd(chip); >> unsigned int block_mark_bit_offset; >> =20 >> - 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 =3D 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 =3D chip->ecc_step_ds; >> - geo->ecc_strength =3D round_up(chip->ecc_strength_ds, 2); >> + geo->ecc_chunk_size =3D ecc_step; >> + geo->ecc_strength =3D round_up(ecc_strength, 2); >> if (!gpmi_check_ecc(this)) >> return -EINVAL; >> =20 >> @@ -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=2E ecc size: %d, oob size : %d\n", >> - chip->ecc_step_ds, mtd->oobsize); >> + ecc_step, mtd->oobsize); >> return -EINVAL; >> } >> =20 >> @@ -423,9 +422,20 @@ static int legacy_set_geometry(struct >gpmi_nand_data *this) >> =20 >> int common_nfc_set_geometry(struct gpmi_nand_data *this) >> { >> + struct nand_chip *chip =3D &this->nand; >> + >> + if (chip->ecc=2Estrength > 0 && chip->ecc=2Esize > 0) >> + return set_geometry_by_ecc_info(this, chip->ecc=2Estrength, >> + chip->ecc=2Esize); >> + >> 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); >> + } >> =20 >> return 0; >> } --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E