From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71190C43334 for ; Mon, 20 Jun 2022 11:07:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1659880584; Mon, 20 Jun 2022 13:07:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Q4aRABR1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A0F21803DF; Mon, 20 Jun 2022 13:07:18 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 70A71805F4 for ; Mon, 20 Jun 2022 13:07:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 999B661165; Mon, 20 Jun 2022 11:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DADF9C3411B; Mon, 20 Jun 2022 11:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655723234; bh=+5/pE+zoPiFEpEqADrpDTj6eXBwFKKE8Od+8zSPM594=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4aRABR1F9IRlvO3RMt9jIX/bEWZH/2Ip65YxikIu5TpqJSDIuwxL7ytaNSKfXe+w xCtQyV4Tur7N4Z0IEyesQoD+0bVTGFPJ5G8TTced3AO9b2yOyQ5Od7bI07NYi0bZ/e 6eaoKPN8UXkpB3XD9Fhuder8AdObgIn9xo0o6esec1FfdTeQV2uBqMoAQfibATFMVz 86yBT5ouAhBycnuXIAR9etZtaAW8o/ReCAUGHEkpy3v982fYhWSP9uPkjRF7BfxIbK xFKnO2Rj+Rcyam+xg6pIKc4yA3LIKYRXSLjfYgmmystuXtWqs88oXfGWuskga0xm9F BW/Xlb1KiGrcA== Received: by pali.im (Postfix) id 04FCDF8F; Mon, 20 Jun 2022 13:07:10 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: "Peng Fan (OSS)" Cc: Priyanka Jain , Wolfgang Denk , Sinan Akman , u-boot@lists.denx.de Subject: [PATCH v2] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode Date: Mon, 20 Jun 2022 13:07:03 +0200 Message-Id: <20220620110703.30463-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220620110218.dtzplvmtv4elhfos@pali> References: <20220620110218.dtzplvmtv4elhfos@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean ecc.mode is set to 0 (aliased to NAND_ECC_NONE) either when function nand_scan_ident() has not selected ecc.mode or when it selected it to none ecc mode. Distinguish between these two states by checking of node property "nand-ecc-mode" which function nand_scan_ident() uses for filling ecc.mode. This change fixes usage of none ecc mode if it is specified in DTS file. Fixes: c9ea9019c5aa ("mtd: rawnand: fsl_elbc: Use ECC configuration from device tree") Signed-off-by: Pali Rohár --- Changes in v2: * Add guard for ofnode_read_string() --- drivers/mtd/nand/raw/fsl_elbc_nand.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c index e734139b5ea5..5d50302eefbe 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c @@ -744,7 +744,11 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, ofnode flash_node) return ret; /* If nand_scan_ident() has not selected ecc.mode, do it now */ - if (nand->ecc.mode == NAND_ECC_NONE) { + if (nand->ecc.mode == 0 +#if CONFIG_IS_ENABLED(OF_CONTROL) + && !ofnode_read_string(nand->flash_node, "nand-ecc-mode") +#endif + ) { /* If CS Base Register selects full hardware ECC then use it */ if ((br & BR_DECC) == BR_DECC_CHK_GEN) { nand->ecc.mode = NAND_ECC_HW; -- 2.20.1