Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1284616pxx; Fri, 30 Oct 2020 06:41:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLXBdeg3iU9J/euSnxDPed56if/98TBIAYOQA5ENqZF5hI8gv084rTuhWRaY6mUdj99hio X-Received: by 2002:a50:bb25:: with SMTP id y34mr2319817ede.249.1604065262513; Fri, 30 Oct 2020 06:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604065262; cv=none; d=google.com; s=arc-20160816; b=H7j48bSFMo+fNutX0FnITbword7c51sNUSyNVg/v2jRyK0jk7xfPyZ2dBarbqzcJKu 1SSjJFrmpo7RJGWGol5gdOV80+QeoBiAw1NE9/CgsGETxXBJ270ezbcm2LLixOolcUbT EpF1nABAoTSrFbb/a1BmTzOCAS7zLRVCvlg52l7Nk7E47FwYx154RWNQL53ybRa9vY1P TCo1b62wc+FOa4uNRLA8RO8zpH7HeoRnBUHffR72WP850cF9U4TZK1l/ll0f9zulLmyg 0z9vhnA656qGTCQna/CDtu2uip/7xDb44+LNAN2cqnvkeC7O9azr0UfnOHTQRbITtSAb lrlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=8bZ4YGJI1SSIOfhQj52b44Lw4PZseoOPe2QB3Jy0++A=; b=SWH2XyUORV+Ai9m5KivhNJnAejha8WvTI54lZhNcD1Nb42M7kiCDYOZtxQKcpBK7Se cWnqk7hgLowisMW+5WrgF5vSq1PHmo8AvrtSJABR5VZegSrSBLU3Eet0AgSQB40CXEJ0 N7sZrN4sKGMjQtQLEhIdN48FZ+ZLKa9cV0eiT+YNmL3wPaVSufum7U1V2+4C0eg6rEcS /jyKogZdGstAD65+vcxn5yrcUtxNE+G7KqgGhhr1WytOLboK1fOoC/cYedCMDBuKu/Vf FnqB/azxJHR6cXtQjCEV9fuhJcjixo2dDDmzCbr+17wFPhxfNkEd4DPEX2RRMwAltYk/ R6BQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si4480138edy.300.2020.10.30.06.40.38; Fri, 30 Oct 2020 06:41:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725939AbgJ3Ngd convert rfc822-to-8bit (ORCPT + 99 others); Fri, 30 Oct 2020 09:36:33 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:60917 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgJ3Ngd (ORCPT ); Fri, 30 Oct 2020 09:36:33 -0400 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id B132B200006; Fri, 30 Oct 2020 13:36:28 +0000 (UTC) Date: Fri, 30 Oct 2020 14:36:27 +0100 From: Miquel Raynal To: Christophe Kerello Cc: , , , , Subject: Re: [PATCH v2] mtd: rawnand: stm32_fmc2: fix broken ECC Message-ID: <20201030143627.1a910cbc@xps13> In-Reply-To: <1604064819-26861-1-git-send-email-christophe.kerello@st.com> References: <1604064819-26861-1-git-send-email-christophe.kerello@st.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, Christophe Kerello wrote on Fri, 30 Oct 2020 14:33:39 +0100: > Since commit d7157ff49a5b ("mtd: rawnand: Use the ECC framework user > input parsing bits"), ECC are broken in FMC2 driver in case of > nand-ecc-step-size and nand-ecc-strength are not set in the device tree. > To avoid this issue, the default settings are now set in > stm32_fmc2_nfc_attach_chip function. > > Signed-off-by: Christophe Kerello > Fixes: d7157ff49a5b ("mtd: rawnand: Use the ECC framework user input parsing bits") > --- > Changes in v2: > - move default ECC settings in stm32_fmc2_nfc_attach_chip function. > > drivers/mtd/nand/raw/stm32_fmc2_nand.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c > index b31a581..550bda4 100644 > --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c > +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c > @@ -1708,6 +1708,13 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip) > return -EINVAL; > } > > + /* Default ECC settings in case they are not set in the device tree */ > + if (!chip->ecc.size) > + chip->ecc.size = FMC2_ECC_STEP_SIZE; > + > + if (!chip->ecc.strength) > + chip->ecc.strength = FMC2_ECC_BCH8; > + > ret = nand_ecc_choose_conf(chip, &stm32_fmc2_nfc_ecc_caps, > mtd->oobsize - FMC2_BBM_LEN); > if (ret) { > @@ -1727,8 +1734,7 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip) > > mtd_set_ooblayout(mtd, &stm32_fmc2_nfc_ooblayout_ops); > > - if (chip->options & NAND_BUSWIDTH_16) > - stm32_fmc2_nfc_set_buswidth_16(nfc, true); > + stm32_fmc2_nfc_setup(chip); > > return 0; > } > @@ -1952,11 +1958,6 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev) > chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE | > NAND_USES_DMA; > > - /* Default ECC settings */ > - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; > - chip->ecc.size = FMC2_ECC_STEP_SIZE; > - chip->ecc.strength = FMC2_ECC_BCH8; > - > /* Scan to find existence of the device */ > ret = nand_scan(chip, nand->ncs); > if (ret) This overall looks very good to me, thanks for this update! Cheers, Miquèl