From nobody Tue Dec 16 19:43:01 2025 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 57ECC18E377 for ; Mon, 24 Feb 2025 07:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740380893; cv=none; b=JYCb1R9vLrLQmd09WIo7a2VBtXal9DRriK6ShMnecqIE5NmJVth3bM+F7drwKBLlidp4U4RClgrn3qkRLdq4R8XFRatcZ/+RgBwziVhhbY+GYXDtuQVql9OWkWzga5909wVeOJgNiTMK+dCgJamGKopne5HebguYBlQFOKrDxQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740380893; c=relaxed/simple; bh=ODgiHPEXc/mmRun9++koS+tR27XjVzBq3ja1K7PYHg8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eFR7FAHqZIM0QBI/RWK89eCe9/mvZST/9WMPQkf8+GKZbOeiIiy+AgJQcxw6hePxDLRt4t8ffzIASxsOwrk6v7epthPGiZnvjNzL9IHqwJQor6ajFjVEuWiLPMnFckpmUbNfcKs23VrJVep5peufbSeSNbM7L18UucYx/I54vYo= 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=NTLw72nh; arc=none smtp.client-ip=209.85.214.178 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="NTLw72nh" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-220c8eb195aso87586855ad.0 for ; Sun, 23 Feb 2025 23:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740380891; x=1740985691; 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=NuwxW0/kSg8UdM9sxgaU8RMlCzyHiyIIgr/U3aOdQEY=; b=NTLw72nhAbN6OwaB3oYb1J6B9+saoIstsLAYBNHGSPyq7avBPFeFBEjxN///GFWqHI SoCYh94h9/e3F9inqQXAYcr/RtWDxMp4+xQ8sy3jOzuRZrk0NbdK5M7wWdG5ai1tZLpj dehYzMlD+2GSqrD//1/79jhHt4M/0OIHI4Mx4ouYymsB/FbMSUdPmKAfIwCaAwDPe43+ u7EnhSw8Q2mSqadGVP37ajxViiDILBeWzhg2cBqeRdElAFVHx3JyjHqgwV6ZB6AcIQif eRhuGTX/tSi41ENS8+5rGlsh41+BE+lZ6J7i2QgYMy5zNFROkcKzqDH+eML812r9mKRd qg9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740380891; x=1740985691; 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=NuwxW0/kSg8UdM9sxgaU8RMlCzyHiyIIgr/U3aOdQEY=; b=UTqxbVaZiFKBxSoDR/uklgp5lbYWlpHThjVlUvmKNYo+9UjP341lDvb/flalhbtsPg EekzdyJ/1/31VEZRyOnE/79Noe3CW+s40XeOLIoR/Hw8rF/VcmSCeqNQJH8/KFz963PU C+SniU8jVww+zAvp88ETu2zZnvWTnQmDUHleQxOdVIY9UpZh2dO1PboOnUaZT476nb5w vCkunQd8JwfDfCG/rrno82o7NcWR/TPk5Bw6Ci2awc22LWNUwckQJW7cbyXv9gGJBFkV 7dOdeaA/2c2hR8hchK60SckOc7/uJUJUjjP5Iun+ZBlM36uVUeKkpsUPGV+/Vwb0GfNs RJqg== X-Forwarded-Encrypted: i=1; AJvYcCWVcTq1MbsXC13k9FEGovkikiQdKpBArr1dpWbaAoch0utB4Fcecq52HkxPJG1LdeiL2w8R+TcYRKZDsbs=@vger.kernel.org X-Gm-Message-State: AOJu0YwbKY1NkkbUwwyiiPAQROHT7PHIY2p3PBl2sz2UjixuJumoO/MU TMm9CqErO6j8c4H0hsBU+6hzLyudOlBtU0Df45BGm46lLOtLR3Vn X-Gm-Gg: ASbGncsOC2LwKXK+40owrxdIfQARvL4A3iQfv8LcG8ubBATdGbjvQ+k5RN6bju6OBcz zlnr9lOY5w3tub8HV6+pkCiU09I6+dVvdprCmjvraBxi0qIFX9Iof0KI7/ueI78W+seLlCiutWL T0ES0eyvZ3AM8++4GiJi3RFNZqd1n1a2eqo+eWsA2oOtkUiiHWe09vVYGbv2Ce9Z8X8JUGObhgY duAEvuTG7r42gAvW0ILI0d07AlQptFDc/FuYKLDsck9/SOmsr8+TC+E6DRI1pV9ABLI6wmhQa07 ZrD8LFW78IWc+pfHHzESrx4am3OhnXKndDmWk/Zp2JjXe5u0RA== X-Google-Smtp-Source: AGHT+IGfszCtI/n/y/N1a12SDHSeE9d2dYjSptoYpB6Sb9ADrTYnehoVJIVKr/VCIRLpEtH3TRJxsg== X-Received: by 2002:a17:903:2283:b0:216:48f4:4f3d with SMTP id d9443c01a7336-2219ff50ddfmr143610565ad.13.1740380891444; Sun, 23 Feb 2025 23:08:11 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d5349061sm174504825ad.5.2025.02.23.23.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 23:08:10 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id A6222806A6; Mon, 24 Feb 2025 15:18:18 +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 v5 1/2] mtd: spi-nand: Add read retry support Date: Mon, 24 Feb 2025 15:03:48 +0800 Message-Id: <20250224070349.446739-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250224070349.446739-1-linchengming884@gmail.com> References: <20250224070349.446739-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 can be setup by the host for the next read. There are several retry levels that can be attempted until the lost data is recovered or definitely assumed lost. Signed-off-by: Cheng Ming Lin --- drivers/mtd/nand/spi/core.c | 35 +++++++++++++++++++++++++++++++++-- include/linux/mtd/spinand.h | 15 +++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index dc5b11fa7a15..d16e42cf8fae 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -700,11 +700,15 @@ 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 mtd_ecc_stats old_stats; struct nand_io_iter iter; 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 @@ -716,18 +720,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 <=3D spinand->read_retries))= { + ret =3D spinand->set_read_retry(spinand, retry_mode); + if (ret < 0) { + spinand->set_read_retry(spinand, 0); + return ret; + } + + /* 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) + return ret; + } } =20 if (ecc_failed && !ret) @@ -1320,6 +1349,8 @@ int spinand_match_and_init(struct spinand_device *spi= nand, spinand->set_cont_read =3D table[i].set_cont_read; spinand->fact_otp =3D &table[i].fact_otp; spinand->user_otp =3D &table[i].user_otp; + 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 73424405232a..5837a09ab9d8 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -452,6 +452,8 @@ struct spinand_user_otp { * @set_cont_read: enable/disable continuous cached reads * @fact_otp: SPI NAND factory OTP info. * @user_otp: SPI NAND user OTP info. + * @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. @@ -474,6 +476,9 @@ struct spinand_info { bool enable); struct spinand_fact_otp fact_otp; struct spinand_user_otp user_otp; + unsigned int read_retries; + int (*set_read_retry)(struct spinand_device *spinand, + unsigned int read_retry); }; =20 #define SPINAND_ID(__method, ...) \ @@ -520,6 +525,10 @@ struct spinand_info { .ops =3D __ops, \ } =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, ...) \ { \ @@ -572,6 +581,8 @@ struct spinand_dirmap { * @priv: manufacturer private data * @fact_otp: SPI NAND factory OTP info. * @user_otp: SPI NAND user OTP info. + * @read_retries: the number of read retry modes supported + * @set_read_retry: Enable/disable the read retry feature */ struct spinand_device { struct nand_device base; @@ -607,6 +618,10 @@ struct spinand_device { =20 const struct spinand_fact_otp *fact_otp; const struct spinand_user_otp *user_otp; + + unsigned int read_retries; + int (*set_read_retry)(struct spinand_device *spinand, + unsigned int retry_mode); }; =20 /** --=20 2.25.1 From nobody Tue Dec 16 19:43:01 2025 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 F0DAF23A990 for ; Mon, 24 Feb 2025 07:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740380893; cv=none; b=Bl3XQIZlN41O1eoL0VtuQIW5hcpxaEghPzDpyadPB7NUYluKqulAfSJk98m6o3LFnZyeKw+uzl+vB09B6k7I+eUX4606L+9G6BpqHIycgtpKZLzw+Cyax/JvGePKsliv4k0k4j5eKoJTQ1AFha8doKH15A3jsQMs+gcZqDPnGfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740380893; c=relaxed/simple; bh=ccs5KxPYeFLieKvJ7FDXVStz4gHQqg+xqogF8gSelnY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CJjxT0YJm5rzVzZxiwT8uAULFvHwvhBEeTNFYyGY4zazM3U5ltTIVRJ7tfFsLmGE+URmeJUvq34YQjstihujxMl3T/L5V3Vkol7EtAQvtWmygSjmNpa2XuCrONHwcF19x1a9DSwLEl0e7Ls9NUgpBUX+jldkWcR8eNfB8uV54yU= 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=CqJGlLzV; arc=none smtp.client-ip=209.85.216.45 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="CqJGlLzV" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-2fbffe0254fso8258814a91.3 for ; Sun, 23 Feb 2025 23:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740380891; x=1740985691; 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=f5FYO4MnEgAdczm5bGqfGwTqr6ni+nm2y6p6XaFQ6qU=; b=CqJGlLzV2kLjLCC/KTGjvfsEwwptDOfzFcBrU0Egethor5Vt06yYW4DRSTRsMuQocm ZFPITB5mjAVbTDcO68O7JOUeiD5+rM5hL+G9BgWh/1Z/+o9J9TN0DTzEl2hTb4eUAW3U +h3LggDiq2ilCQVTO6jIpbWWlGCJ9KG0f3IV532qZzpVjpMP6duLoMj/EdM8n2ed7gcY tClg/zhI9HewRCuONwL6bcPRo3woVn9DCNMLGsmomM67QwU67bDOxTlMzczgOlaFcuDt dPnz8VOtOYjJyBQUQ/rdZ8Ha48+0dcfQOHJ6Hqmq9ihpQqyXOrDDuzmhPUnxatEgdsRn PymQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740380891; x=1740985691; 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=f5FYO4MnEgAdczm5bGqfGwTqr6ni+nm2y6p6XaFQ6qU=; b=WVtPGeAyEvAcnKXATBGMpu81X43GKiW+Z6temrKffDCCdtkIcZpCL5HbBPm505eTVH 7frt4ma5LcCoxqQM9T9NgnW+wf7buTqLt7zaBwD3znbsX1Vbmae7R2GzbEykJPB+MEMB XL36uOj+zacW61p8QXNB9bGgk1e76hc1RcYMx2BiyC5NAgL5/akd34An1QICUFpB8kvy 3zjaCOpt6Ls4YhALTmOJZsC8SDL2y1A8Wll6zXH9Z3/rECjvdX+708B1vSCYc7iT1aZC Z0naWr2Qg8690ASc75hsAIavgJ/XghZ8/45Ea9PM+Aacw/Ew0DIzX+kAAyyc805ZXOfm 6rJA== X-Forwarded-Encrypted: i=1; AJvYcCXymimPAMSHv0U3Z5t9QzjNvBhStLd0PTAjkZNkU++d7G1pfzQL0R7Qp/kHU+Ea8v0wDV9rDJnwnDqw0i0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7OAbrO38iKhlxmR3IemZTnk8mXtQ51ddXjIVKUyqwBO7pZLcx izIjsY/zF9Rsf6D26j9bu9mnKImkXXEp2suRSaVX4tHzAobixvhz X-Gm-Gg: ASbGncvap69BdMRYF4zXBoH/rdBSEwEqIDqsGwLvySJ1Uqu+lemFVUKhLpyZ5QgDuUB K5jPe4vjTlDkrC7n+yE1KU5OyPSlCawPsADo6ncVcleTqVhu9E3FfWPrF0VSN3ibg3VDH/BE5u8 exUkkcABo18Y93F6EUDbREw0QCNeAXGJyRBF2WDNGA+Tcl5KvAREipkR4veDhAiDBNtDN940J7c GFfBK1vTqCRMlbGBIBgFqFzOen+gtLIM6Cy9KrMecxD7veyFBiYLdZzmVum4Rq+TnsGm5SybMFn xdJt0OtAQO3Td7mvZl3ts7pq0f9tn3gRSlIaxT0LNppLGjiKSQ== X-Google-Smtp-Source: AGHT+IF6iAQd9FN+K1KtbbQ8XBRW1HmHqrKJdn+kn4HBTAB2ab+Tb0lVQnMh83irHuxnku8oYwIZoA== X-Received: by 2002:a05:6a21:6b01:b0:1ee:d418:f756 with SMTP id adf61e73a8af0-1eef3dd06fbmr22565387637.38.1740380891163; Sun, 23 Feb 2025 23:08:11 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73284a7401dsm13214597b3a.134.2025.02.23.23.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 23:08:10 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id B38B780733; Mon, 24 Feb 2025 15:18:18 +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 v5 2/2] mtd: spi-nand: macronix: Add support for read retry Date: Mon, 24 Feb 2025 15:03:49 +0800 Message-Id: <20250224070349.446739-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250224070349.446739-1-linchengming884@gmail.com> References: <20250224070349.446739-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 read retry support. The Special Read for Data Recovery operation is enabled by Set Feature function. There are 5 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 3dc4d63d6832..1ef08ad850a2 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 5 =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