From nobody Sun Feb 8 05:52:53 2026 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EF212F5A for ; Thu, 14 Nov 2024 02:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731551787; cv=none; b=bWCJO8cNNbgUDq0yeoC6c/Q0Ld7sGML3MN5Uwf/meG0hg/rFvHKXx0ximzqIN1OykUTKQTyLBuBebYs8GLgdg5iz9TXY581GUYjtjfXHwnZ6EHt7MsEWSb7vI63pfUNsl1pkppOztXXKif6VgB59rPRiNBpHcnYcclNqJ5wL1tI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731551787; c=relaxed/simple; bh=ik+zy0Kok1tHZog4WqeJ7AjDa4p2b1N0Mnse/n+Lbok=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jcTrLA/oeaNrMbTikeIfSrij5KvrNfWCC+SmbadV3QfEWShdx5ZcKQygrAf8nxqppe9GkBtCSYq2bJT0Tny9TZc72UqQDQWOMculhmOlC/D4Fi6ZOOwnJb3gV1Zh8XvqOHXojEVCE0ayVlossPt5tnmXB3LQ+tbAkk54xc5LxTU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XMz5MEpV; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XMz5MEpV" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2e2d1858cdfso129732a91.1 for ; Wed, 13 Nov 2024 18:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731551785; x=1732156585; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DZUHHT1NQG5Uvqfb4hSdJ+6FPn6N2m9pG+Uu3VTVYDw=; b=XMz5MEpVJuXJdV7RO7OIP/C5LnnrOJG67I5dZIR/wqjkuWLWL/1Olk0gebgiFjXDke rOtyRGgQzrqRCMs5A+I4lnHMNpd0yw9CnSsv4arJ6cIDyvIroPbKijxGcJ268OvR3JCm +mO7Z9mpj0pIhujFMu4p4YEEGywZZLq8Q5Nhax06y8OZ5KZYBzrsNZ0qlEkRWORLiE9V 4dTb82PEm9k7f6rfQkfDZRUr5fcjAHhSeHYZTAp8W6wBXRuJp5126vCltiqwRug3VWSc Ww2oGhRZpGzuxZJkvvcg4K+BIzcY16NI0F2ph0e5jbeR42aUOI2HJvWpUfuWuJafAe3Y 2xaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731551785; x=1732156585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DZUHHT1NQG5Uvqfb4hSdJ+6FPn6N2m9pG+Uu3VTVYDw=; b=UDmekpt8/KnerYOAfj4J0EO3rBIZjYM/ycnppWW29oJiGsnFwUXM9aZ1jSAwixbzQf rXRDEy7y14qOy55oSoMLf2miw7FfRektaMUbQjWLAEEToffK1HGTSo5dtXSqUEqfG9XL Y59XiLR4RraiElWYFEuXnUrwXOnNIjCnRxm4ZPz4olWQ/PPw+Ugj3LF2ejNW0cJngxeB uGwC7gYYdSTQiWdahVIWwgk0yiPuWjSsqfwnEX1ZvRBVSn5KG20z2xsVgLkx4Rh1N+Bu MKLZXvdTtIBqJxJlPLmz2G/FuMIKKFKhMAQ3ay2GNWjMZkPOpgyEY97ZfbkTBtQeZP+S 1/Nw== X-Forwarded-Encrypted: i=1; AJvYcCW2yEMGl20OLGlrsY7cTc02KV3tvBhu4fau1rkuLYVZAU3vWCKwmHTX0JHOPgPy74xR8zsFLma96GoAIxw=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/Ehm10oCf6PM/nDrzy9OOvNhlUh2e6oIfZzkt1+K0TyBT9AeZ qF8CYnQeTB4GeucpOEsT6yScGYRrOpojTys5aAo4J3aGXo9xzVpS X-Google-Smtp-Source: AGHT+IFmomoWIK1E10LxkjPxLyAB+RT+I8tMD2yDFYg8SKFZADuzQIR0Sozc6K79hkkKRWRlU74dUg== X-Received: by 2002:a17:90b:3146:b0:2e2:ad29:11a4 with SMTP id 98e67ed59e1d1-2e9b177fd40mr30185844a91.25.1731551784397; Wed, 13 Nov 2024 18:36:24 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211c7c565ccsm532985ad.90.2024.11.13.18.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 18:36:23 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 83E428083B; Thu, 14 Nov 2024 10:42:49 +0800 (CST) From: Cheng Ming Lin To: miquel.raynal@bootlin.com, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: richard@nod.at, alvinzhou@mxic.com.tw, leoyu@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v2 1/2] mtd: spi-nand: Add read retry support Date: Thu, 14 Nov 2024 10:35:27 +0800 Message-Id: <20241114023528.181583-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241114023528.181583-1-linchengming884@gmail.com> References: <20241114023528.181583-1-linchengming884@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cheng Ming Lin When the host ECC fails to correct the data error of NAND device, there's a special read for data recovery method which host setups for the next read retry mode and may recover the lost data by host ECC again. Signed-off-by: Cheng Ming Lin --- drivers/mtd/nand/spi/core.c | 35 +++++++++++++++++++++++++++++++++-- include/linux/mtd/spinand.h | 14 ++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 4d76f9f71a0e..bd5339a308aa 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -672,10 +672,14 @@ static int spinand_mtd_regular_page_read(struct mtd_i= nfo *mtd, loff_t from, struct spinand_device *spinand =3D mtd_to_spinand(mtd); struct nand_device *nand =3D mtd_to_nanddev(mtd); struct nand_io_iter iter; + struct mtd_ecc_stats old_stats; bool disable_ecc =3D false; bool ecc_failed =3D false; + unsigned int retry_mode =3D 0; int ret; =20 + old_stats =3D mtd->ecc_stats; + if (ops->mode =3D=3D MTD_OPS_RAW || !mtd->ooblayout) disable_ecc =3D true; =20 @@ -687,18 +691,43 @@ static int spinand_mtd_regular_page_read(struct mtd_i= nfo *mtd, loff_t from, if (ret) break; =20 +read_retry: ret =3D spinand_read_page(spinand, &iter.req); if (ret < 0 && ret !=3D -EBADMSG) break; =20 - if (ret =3D=3D -EBADMSG) + if (ret =3D=3D -EBADMSG && spinand->set_read_retry) { + if (spinand->read_retries && (++retry_mode < spinand->read_retries)) { + ret =3D spinand->set_read_retry(spinand, retry_mode); + if (ret < 0) { + ecc_failed =3D true; + break; + } + + /* Reset ecc_stats; retry */ + mtd->ecc_stats =3D old_stats; + goto read_retry; + } else { + /* No more retry modes; real failure */ + ecc_failed =3D true; + } + } else if (ret =3D=3D -EBADMSG) { ecc_failed =3D true; - else + } else { *max_bitflips =3D max_t(unsigned int, *max_bitflips, ret); + } =20 ret =3D 0; ops->retlen +=3D iter.req.datalen; ops->oobretlen +=3D iter.req.ooblen; + + /* Reset to retry mode 0 */ + if (retry_mode) { + retry_mode =3D 0; + ret =3D spinand->set_read_retry(spinand, retry_mode); + if (ret < 0) + break; + } } =20 if (ecc_failed && !ret) @@ -1268,6 +1297,8 @@ int spinand_match_and_init(struct spinand_device *spi= nand, spinand->id.len =3D 1 + table[i].devid.len; spinand->select_target =3D table[i].select_target; spinand->set_cont_read =3D table[i].set_cont_read; + spinand->read_retries =3D table[i].read_retries; + spinand->set_read_retry =3D table[i].set_read_retry; =20 op =3D spinand_select_op_variant(spinand, info->op_variants.read_cache); diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index 702e5fb13dae..bbfef90135f5 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -339,6 +339,8 @@ struct spinand_ondie_ecc_conf { * @select_target: function used to select a target/die. Required only for * multi-die chips * @set_cont_read: enable/disable continuous cached reads + * @read_retries: the number of read retry modes supported + * @set_read_retry: enable/disable read retry for data recovery * * Each SPI NAND manufacturer driver should have a spinand_info table * describing all the chips supported by the driver. @@ -359,6 +361,9 @@ struct spinand_info { unsigned int target); int (*set_cont_read)(struct spinand_device *spinand, bool enable); + unsigned int read_retries; + int (*set_read_retry)(struct spinand_device *spinand, + unsigned int read_retry); }; =20 #define SPINAND_ID(__method, ...) \ @@ -387,6 +392,10 @@ struct spinand_info { #define SPINAND_CONT_READ(__set_cont_read) \ .set_cont_read =3D __set_cont_read, =20 +#define SPINAND_READ_RETRY(__read_retries, __set_read_retry) \ + .read_retries =3D __read_retries, \ + .set_read_retry =3D __set_read_retry, + #define SPINAND_INFO(__model, __id, __memorg, __eccreq, __op_variants, \ __flags, ...) \ { \ @@ -436,6 +445,8 @@ struct spinand_dirmap { * A per-transfer check must of course be done to ensure it is * actually relevant to enable this feature. * @set_cont_read: Enable/disable the continuous read feature + * @read_retries: the number of read retry modes supported + * @set_read_retry: Enable/disable the read retry feature * @priv: manufacturer private data */ struct spinand_device { @@ -469,6 +480,9 @@ struct spinand_device { bool cont_read_possible; int (*set_cont_read)(struct spinand_device *spinand, bool enable); + unsigned int read_retries; + int (*set_read_retry)(struct spinand_device *spinand, + unsigned int retry_mode); }; =20 /** --=20 2.25.1 From nobody Sun Feb 8 05:52:53 2026 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3691A33986 for ; Thu, 14 Nov 2024 02:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731551787; cv=none; b=aJZ9MFOhPDsqbWNquB/cDGxlsDz/uQfzvLMkYf7KQPXxELtwCl6PlGnyATaiJoImgXuxEaU/rCRTjxH2nrTB69Z/4WPtzMS+jhoUR1FOa4hQStsDKvBMDH0i8aCDfr6zEpFlAWN8qNUf27Hi7SM7wy06KUo83z4Ts+Psafe7ixw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731551787; c=relaxed/simple; bh=p6QHmvybEVQoD7kyOD3B8r8jUEzQ4Zb6hkPuBqVTC9s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a3hI8sz+FC2D1+e8C4USQUpG+gmHYHxZvCQKf+yzQCU0r8pMNdXUPYSs6vzkxiO101bckDbrF809aPwPwHzA4putYYT7BF2wnAlO6NtX81lZY1iRptCCnj8SlQPaiBk+/HHwzqv0jHJrEGnFHKSI9BKAuE2V4VLtJCFSkRGsTTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zl0+pQnW; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zl0+pQnW" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7ea8c4ce232so84473a12.0 for ; Wed, 13 Nov 2024 18:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731551785; x=1732156585; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jcs6rzC2mxL1y1c4MtvLOxy5NzIRqyAyQVXMf+UasRc=; b=Zl0+pQnWlorPQ2dzKF+WjSWDerNEm+82UeftsL/HCtZpcBr1jBWY5oONw/bVoqGPJM 5PmA9DpX16vBsLFnCtUko5VEonV7+qeao9iemlYmK+8fzzSLOijUJXSZeUDE9wOpnXoS KDX5RLeebQd6dl5iphSBsjUddxVTOikgkGDiswzeBvqYmEBnJ13Z7ygsZMFacpsnRhzx eiOtSj7+DQ1jwNCYNYWcPRYHDHylAxRAgC7K5X4GtC56MwY/s2e45qIoRW1D5VB7Fwmz ro9Ru3dAivnKr/8tb/lrFGXnBvrT3LX4S3NRWgrktZCSRSUbDLaC9fnB5xtKZKycNLML Hysw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731551785; x=1732156585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jcs6rzC2mxL1y1c4MtvLOxy5NzIRqyAyQVXMf+UasRc=; b=W6aHn5xFJm4cGsUIraq4Cq5cad6YVLzV8AdSVy4Ps3o69moCnz/j01+uIoRGNMIebv XmrmIW0d35IeqDA9TAGxMMPqM/SNNFxgl8ml3JdxcgaCAdk+mo/R9wR/PCeel/9jRFHO 3YQ6SmrUh5MZHELMgNf3HDQaZWXKhh3pDCPgdp5xlPOTRiodKYUgDprNwTGj9aM9kBCQ VZv0Yvt0DKwll8RFtD+IipbRFuLooR+/TIHL5T1PdPMJaZ43sPdhTVLsuGptsxDDu/w5 Stzc9PWobmBlYbDuXQUNCLE/nroGycLSVF8tLMpUDdbU2xXtwnksV6c6yiZwrPl3vlkp vO8w== X-Forwarded-Encrypted: i=1; AJvYcCXc8A0A5sJN58qJ+PidITgdrVUTVhPODUpgG6TdGhNHgqeqoEXqgroZKOANIEJLKWy6tTE7COMIu6S8GrU=@vger.kernel.org X-Gm-Message-State: AOJu0YwSe54dw2VuaWvfjSg2P2fp2PO0q9eXajI1Waeby22qWQfk0Rtq Rr12bzFHi3SoNXJ4DBcTqeHE59wbsweCXdyIL/5/HDM9h8MHAO9Y X-Google-Smtp-Source: AGHT+IF2/7Jm6c2A5GBt1njckTBUCXCP/8OxJGtx/E524qUnSGdxvJOAVI6kShVeviiRVREXwiCyCg== X-Received: by 2002:a05:6a21:918b:b0:1dc:43:f87a with SMTP id adf61e73a8af0-1dc8348d367mr861149637.37.1731551785192; Wed, 13 Nov 2024 18:36:25 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea02495974sm250670a91.20.2024.11.13.18.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 18:36:24 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id C42958085A; Thu, 14 Nov 2024 10:42:49 +0800 (CST) From: Cheng Ming Lin To: miquel.raynal@bootlin.com, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: richard@nod.at, alvinzhou@mxic.com.tw, leoyu@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v2 2/2] mtd: spi-nand: macronix: Add support for read retry Date: Thu, 14 Nov 2024 10:35:28 +0800 Message-Id: <20241114023528.181583-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241114023528.181583-1-linchengming884@gmail.com> References: <20241114023528.181583-1-linchengming884@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cheng Ming Lin Add function for supporting read retry: - Set feature on Special Read for Data Recovery register. The Special Read for Data Recovery operation is enabled by Set Feature function. There are 6 modes for the user to recover the lost data. Signed-off-by: Cheng Ming Lin --- drivers/mtd/nand/spi/macronix.c | 79 ++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macroni= x.c index d277c3220fdc..d7087bac8da7 100644 --- a/drivers/mtd/nand/spi/macronix.c +++ b/drivers/mtd/nand/spi/macronix.c @@ -14,6 +14,8 @@ #define MACRONIX_ECCSR_BF_LAST_PAGE(eccsr) FIELD_GET(GENMASK(3, 0), eccsr) #define MACRONIX_ECCSR_BF_ACCUMULATED_PAGES(eccsr) FIELD_GET(GENMASK(7, 4)= , eccsr) #define MACRONIX_CFG_CONT_READ BIT(2) +#define MACRONIX_FEATURE_ADDR_READ_RETRY 0x70 +#define MACRONIX_NUM_READ_RETRY_MODES 6 =20 #define STATUS_ECC_HAS_BITFLIPS_THRESHOLD (3 << 4) =20 @@ -136,6 +138,23 @@ static int macronix_set_cont_read(struct spinand_devic= e *spinand, bool enable) return 0; } =20 +/** + * macronix_set_read_retry - Set the retry mode + * @spinand: SPI NAND device + * @retry_mode: Specify which retry mode to set + * + * Return: 0 on success, a negative error code otherwise. + */ +static int macronix_set_read_retry(struct spinand_device *spinand, + unsigned int retry_mode) +{ + struct spi_mem_op op =3D SPINAND_SET_FEATURE_OP(MACRONIX_FEATURE_ADDR_REA= D_RETRY, + spinand->scratchbuf); + + *spinand->scratchbuf =3D retry_mode; + return spi_mem_exec_op(spinand->spimem, &op); +} + static const struct spinand_info macronix_spinand_table[] =3D { SPINAND_INFO("MX35LF1GE4AB", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x12), @@ -168,7 +187,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, macronix_ecc_get_status), - SPINAND_CONT_READ(macronix_set_cont_read)), + SPINAND_CONT_READ(macronix_set_cont_read) + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35LF4GE4AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x37, 0x03), NAND_MEMORG(1, 4096, 128, 64, 2048, 40, 1, 1, 1), @@ -179,7 +200,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, macronix_ecc_get_status), - SPINAND_CONT_READ(macronix_set_cont_read)), + SPINAND_CONT_READ(macronix_set_cont_read) + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35LF1G24AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x14, 0x03), NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), @@ -188,7 +211,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &write_cache_variants, &update_cache_variants), SPINAND_HAS_QE_BIT, - SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)), + SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35LF2G24AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24, 0x03), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1), @@ -198,7 +223,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &update_cache_variants), SPINAND_HAS_QE_BIT | SPINAND_HAS_PROG_PLANE_SELECT_BIT, - SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)), + SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35LF2G24AD-Z4I8", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x64, 0x03), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), @@ -207,7 +234,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &write_cache_variants, &update_cache_variants), SPINAND_HAS_QE_BIT, - SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)), + SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35LF4G24AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35, 0x03), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 2, 1, 1), @@ -217,7 +246,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &update_cache_variants), SPINAND_HAS_QE_BIT | SPINAND_HAS_PROG_PLANE_SELECT_BIT, - SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)), + SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35LF4G24AD-Z4I8", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x75, 0x03), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), @@ -226,7 +257,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &write_cache_variants, &update_cache_variants), SPINAND_HAS_QE_BIT, - SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)), + SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX31LF1GE4BC", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e), NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), @@ -270,7 +303,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT | SPINAND_HAS_PROG_PLANE_SELECT_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, - macronix_ecc_get_status)), + macronix_ecc_get_status), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF4G24AD-Z4I8", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xf5, 0x03), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), @@ -280,7 +315,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &update_cache_variants), SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, - macronix_ecc_get_status)), + macronix_ecc_get_status), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF4GE4AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xb7, 0x03), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), @@ -291,7 +328,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, macronix_ecc_get_status), - SPINAND_CONT_READ(macronix_set_cont_read)), + SPINAND_CONT_READ(macronix_set_cont_read) + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF2G14AC", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa0), NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 2, 1, 1), @@ -314,7 +353,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT | SPINAND_HAS_PROG_PLANE_SELECT_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, - macronix_ecc_get_status)), + macronix_ecc_get_status), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF2G24AD-Z4I8", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xe4, 0x03), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), @@ -324,7 +365,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &update_cache_variants), SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, - macronix_ecc_get_status)), + macronix_ecc_get_status), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF2GE4AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa6, 0x03), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), @@ -335,7 +378,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, macronix_ecc_get_status), - SPINAND_CONT_READ(macronix_set_cont_read)), + SPINAND_CONT_READ(macronix_set_cont_read) + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF2GE4AC", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa2, 0x01), NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1), @@ -366,7 +411,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { &update_cache_variants), SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, - macronix_ecc_get_status)), + macronix_ecc_get_status), + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF1GE4AD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x96, 0x03), NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), @@ -377,7 +424,9 @@ static const struct spinand_info macronix_spinand_table= [] =3D { SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, macronix_ecc_get_status), - SPINAND_CONT_READ(macronix_set_cont_read)), + SPINAND_CONT_READ(macronix_set_cont_read) + SPINAND_READ_RETRY(MACRONIX_NUM_READ_RETRY_MODES, + macronix_set_read_retry)), SPINAND_INFO("MX35UF1GE4AC", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x92, 0x01), NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), --=20 2.25.1