Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1113457imm; Wed, 1 Aug 2018 10:24:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMaO5fuX/WBwwP7LaxKeg7jfc7oVxmQtcUI0mdrRZ8Yupc0jIMOjOAFythL6u+xJhWH0OA X-Received: by 2002:a62:3306:: with SMTP id z6-v6mr27157408pfz.85.1533144241603; Wed, 01 Aug 2018 10:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144241; cv=none; d=google.com; s=arc-20160816; b=vMVZcJmmraEmliFfkS5E3G9Aji1mGEahu58dIgPN0w9IJYv74IqKB0djRrMCHbIiPA Ir74fP7VTh+Q2T5RMG4UEklEicWuT1S0HkWNbKDPg2NhEBroBqPnw4k5Xh1ss+2LyDIJ o3E/qGYUh2iUz1SSkO4mtEcZu9eRDkXUg79StVZJsm+gR+oKLYujHaDxYzLcAGtRurUf zPcgGySvm6KrhpCJFaXXUurkgFSKiRRaO+jQlktGDeSPGlK4nv6ziJeR9mdFIbh18K7m fuTSVDNO5fNm6OP3uqWuHFa32dm4tOFs/jhqFLFMB167ukOMFWwjZox0DUxn2GUD+44N YbIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bESOHTAEKhduBJKWGVwyWE4FcUFgW27MWH10cNKcTxE=; b=WcwbHAEIH9glPC0ZquE9AUYIGHDeCcnBQN089/iePaGk35wwy9XpXh/xYG0HrW2Y8n nf36ex89rX7E4PMnfeGv9zmwOWy7m/qpG97VlyJLahv2zJvafGsU6Li4NMNHFTqvolPc oLdwopNHckWgYMj52+OnfkBoxKQofEBMQQF+592JYfup+KmYZNqPyhviFbY4GPRbrGB/ rxA/aQSdZc0Ljx5RSPcE2pPWA5eJcY6rdAQc6roS1p/Voy+d6NZUfoYQcEoWTKS8+XNR WFAp54a1iJN6i8x+PbCWvFaXnq0kP4K/VATdxLEAaLE7cxfuHIX0pG/UtCCNpzLn8BGs 0DgA== 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 d11-v6si16118444plr.261.2018.08.01.10.23.47; Wed, 01 Aug 2018 10:24:01 -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 S2405584AbeHATIN (ORCPT + 99 others); Wed, 1 Aug 2018 15:08:13 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49374 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404058AbeHATIM (ORCPT ); Wed, 1 Aug 2018 15:08:12 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1226ECE6; Wed, 1 Aug 2018 17:21:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jane Wan , Boris Brezillon , Sasha Levin Subject: [PATCH 4.14 155/246] mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages Date: Wed, 1 Aug 2018 18:51:05 +0200 Message-Id: <20180801165019.144936700@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jane Wan [ Upstream commit a75bbe71a27875fdc61cde1af6d799037cef6bed ] Per ONFI specification (Rev. 4.0), if the CRC of the first parameter page read is not valid, the host should read redundant parameter page copies. Fix FSL NAND driver to read the two redundant copies which are mandatory in the specification. Signed-off-by: Jane Wan Signed-off-by: Boris Brezillon Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/fsl_ifc_nand.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -342,9 +342,16 @@ static void fsl_ifc_cmdfunc(struct mtd_i case NAND_CMD_READID: case NAND_CMD_PARAM: { + /* + * For READID, read 8 bytes that are currently used. + * For PARAM, read all 3 copies of 256-bytes pages. + */ + int len = 8; int timing = IFC_FIR_OP_RB; - if (command == NAND_CMD_PARAM) + if (command == NAND_CMD_PARAM) { timing = IFC_FIR_OP_RBCD; + len = 256 * 3; + } ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) | @@ -354,12 +361,8 @@ static void fsl_ifc_cmdfunc(struct mtd_i &ifc->ifc_nand.nand_fcr0); ifc_out32(column, &ifc->ifc_nand.row3); - /* - * although currently it's 8 bytes for READID, we always read - * the maximum 256 bytes(for PARAM) - */ - ifc_out32(256, &ifc->ifc_nand.nand_fbcr); - ifc_nand_ctrl->read_bytes = 256; + ifc_out32(len, &ifc->ifc_nand.nand_fbcr); + ifc_nand_ctrl->read_bytes = len; set_addr(mtd, 0, 0, 0); fsl_ifc_run_command(mtd);