Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3595089pxb; Mon, 24 Jan 2022 13:06:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrlZA5xaCqnCFQorTkf5g1WiBdCW6J7f8pXrajCNJojkHqPoJ6idxZIQPkllaDNyw3bhkt X-Received: by 2002:a63:1011:: with SMTP id f17mr13050112pgl.436.1643058365660; Mon, 24 Jan 2022 13:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058365; cv=none; d=google.com; s=arc-20160816; b=UYEgHWIlWTrROxo4kxfyo16F/qmG5H5nBc2JIn3fs4bbreGCrUnMjbMeuCF06QIEEM 8DgqJr7oMdcs47Z/FDBVOG0/+N9djMqHrE3q58ruGz/hsKNact2Yk+EXFwynuOdDswzv hWe7i+rUH3X8SFqTQG5np9dQWNTPPCP3pOiQRjr7VYEubywQjJHRx1H4E1vl+w2TjhjV FqbnKlGaIcA7aiXVqUb4UDpwSzflI9V+o0Hxbh101wV8NHuHn4VgrFDMB4bRA6IQ8CCO 39aaBC1VUZ2TwzkxsEOX7g59MT79o/1hQd2PCyxqnugi0y67r7nL+VEyGUSPix4Tloyb zMkQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uWFtD4waJY7ZmHu1oSN9Rs30LUso6bpenHOROgXj8DA=; b=bqfhb8QRFvSho/QoHucqYF7F1DBaa7LFDSJJdpsTdurZsp7HGY+JnipvSenYcx5c34 Dvu8jcyzaoFI06dlc8P81AI2oSY9m2UtLpnFHnFNHgP5WM3PMYYdwRm4V3DerSrr2Hnp NKSwqbkuGd1jJ0m7eGIA5OoM/VPX5hoTi59kPHRJqZ9e9U5ohUGr84NETDJ8cbaNz+Kc OPeNqPcuzCoYks2bELTydJlaA86f7iu0XyxoKmpZFeUCK7zrz7Vla4gJqc/PO+1SbOY4 fchbWRlRUNZ62BdNUZgNeptSBAsURQLZAu11ZdEb9mKiR3ascmYbTTamsrUdNcG/18dW fsDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lFcDVWb9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 193si4023363pgc.216.2022.01.24.13.05.51; Mon, 24 Jan 2022 13:06:05 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lFcDVWb9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384736AbiAXUa2 (ORCPT + 99 others); Mon, 24 Jan 2022 15:30:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52018 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379215AbiAXUKg (ORCPT ); Mon, 24 Jan 2022 15:10:36 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id 4FEBDB8119E; Mon, 24 Jan 2022 20:10:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 799E6C340E5; Mon, 24 Jan 2022 20:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055034; bh=w6SHKE6jX4ZUVWOWECRb9u1Z6a+zZf7mElpRsXhmPcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lFcDVWb9kQuzWRWXzRQvsqMfTiocTmtQFymTvnk92mInjEAIMPDnIuPslLWSEh0gj 417eN6lngrFI0CgurwxnReTKgEIZa+nuvTEIq1tYOdt58qnoNvNB1xIeyPrRM/HHM9 Sx7+iD/+6zSg6ENJqbvkGNb6f7JI/H5cCK81+mTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.15 020/846] mtd: rawnand: ingenic: JZ4740 needs oob_first read page function Date: Mon, 24 Jan 2022 19:32:17 +0100 Message-Id: <20220124184101.614244813@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Paul Cercueil commit 0171480007d64f663aae9226303f1b1e4621229e upstream. The ECC engine on the JZ4740 SoC requires the ECC data to be read before the page; using the default page reading function does not work. Indeed, the old JZ4740 NAND driver (removed in 5.4) did use the 'OOB first' flag that existed back then. Use the newly created nand_read_page_hwecc_oob_first() to address this issue. This issue was not found when the new ingenic-nand driver was developed, most likely because the Device Tree used had the nand-ecc-mode set to "hw_oob_first", which seems to not be supported anymore. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-5-paul@crapouillou.net Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c @@ -32,6 +32,7 @@ struct jz_soc_info { unsigned long addr_offset; unsigned long cmd_offset; const struct mtd_ooblayout_ops *oob_layout; + bool oob_first; }; struct ingenic_nand_cs { @@ -240,6 +241,9 @@ static int ingenic_nand_attach_chip(stru if (chip->bbt_options & NAND_BBT_USE_FLASH) chip->bbt_options |= NAND_BBT_NO_OOB; + if (nfc->soc_info->oob_first) + chip->ecc.read_page = nand_read_page_hwecc_oob_first; + /* For legacy reasons we use a different layout on the qi,lb60 board. */ if (of_machine_is_compatible("qi,lb60")) mtd_set_ooblayout(mtd, &qi_lb60_ooblayout_ops); @@ -534,6 +538,7 @@ static const struct jz_soc_info jz4740_s .data_offset = 0x00000000, .cmd_offset = 0x00008000, .addr_offset = 0x00010000, + .oob_first = true, }; static const struct jz_soc_info jz4725b_soc_info = {