From nobody Tue Dec 16 13:27:29 2025 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 2A2E6201017 for ; Fri, 21 Feb 2025 09:37:41 +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=1740130663; cv=none; b=pW+OQlo+SkUOMYFEdGTI+lRiLp7LiPJ6Q+5i9k7PsfhsysD90q5Vm368zOeIgFg8zmaZHgtddNNId4B4NMZe3wf6B9mdqEI/QU+wADuXRhjWGer/RJKO5lfoAZhALnJD765+6lNhnxjlE9xFjEx/EULCzp9t3JjmMBn4BKTdCV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740130663; c=relaxed/simple; bh=WZAORZnSKINKjodaXKGwI7hqf9qMH5x5iz3zgcL8GPY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ck52+FhB3uQaJNHyjcRdXvYYiv/Mtufx+qCqBLBA4F89rIY/9n+gdR18BfSu7LsmlKgvbRGTiESWjhugZOZnIZJBw5gCzBo0L8JHcoRFGkPwqvXCPDBgImxJRWJrfegyUIO7iqXrHiJKmHQ7iqLLICMPQY8MghskdzKb1sFnRHw= 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=GyOYC/nN; 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="GyOYC/nN" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2fc0d44a876so3043463a91.3 for ; Fri, 21 Feb 2025 01:37:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740130661; x=1740735461; 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=5uTXc5mDGcxofMRZcNXDa/UBr6/on046eyKp8zh2sgQ=; b=GyOYC/nN6FGjZUCNUpJPrn4zrOFDj5+y4qryJDHevSJidFLOKDYbskRto+lMzaeXln YP5NMIgYBPMMHPaKMZKUuB9EEt7SY0t/NGDy707A8C+hTmQ7w/ngnnCjdqR3OGeFn7kf 6i0Lu2cEhnnRJ51J8XcvkjPc4UrGkgDBoxo8YYWKVy+8Bkifr19Ok5QVZ9sDl3krfv+p iWlORvIvQD/dqxJuz1pXqVKd9kjPFPhcFs1An1pOauR2e8kPgGhnfXW+8NH418pdVPF3 d7qsIrejKnF+TWCV0R8jlkdBIqdrwr5Gc79Z7h6Rh9xAAg2hUVmdfr2JKHBI9HIvfqNW h6qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740130661; x=1740735461; 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=5uTXc5mDGcxofMRZcNXDa/UBr6/on046eyKp8zh2sgQ=; b=ocKIuQgfA6ggryxkpfCom61fZuG3SqEPyqs1mnK9WB1tj/Tu+LeaB9C8e8fvCQjxsZ wdtU4lpD3FiQOcz7FJ2VY+hdTtwVT2BgxWcspd4bTg1RrYJ/+i6I8LCgoOqsvzqs2RCv 5zCs3JPWn30XQtsKTs1b7wRiELPdMAi94zrvoYSIkyzIRo5f5SLCbwq2hsdv2iT8JFGW twVELG5HGdxj91XaX5boTEXg2xmwss734Z+Iy/dZqW09spokwumDbzu+d6J09A62dxn+ ggGpqNp0f28ar8IjJEpUO2q+/3NifG25j/jwMWR9bJsmf4OIiRulhf+Zse/e3ZEsVsWn dvRQ== X-Forwarded-Encrypted: i=1; AJvYcCWQjMaDWKV+Kax/cjO4q3Rm3ULBtQiCsJG92/rJW3RaoAU5ayyXAABX6rKSbG0acKnIOLWvZ26rVyn+dao=@vger.kernel.org X-Gm-Message-State: AOJu0YwhV9W54XH/cucIbr/9hnwKdSp0NE9Z+kaJNYz6Xnt2fbHO5J3z VKxDbqNXh2IMnOGB0LIv+n6Z9w0PdtWSFshDhHxduu/lSpxwDJhT X-Gm-Gg: ASbGnct4/moiyTtnxKMGt8kovLfSaffe6aE/gtn2Ktzz29GsmXe5WOGJKahhigPFaP2 4JuTsyVbFeD7Xg2ZdTO41rrOb497/orikelmYseZb3d/JQuXK/iO6pGbmmvbyDpZ+1Bk19TNnkr DLKAsuSfuSlnjTK9lLkDFTsH7dfE/rt/DcLmM5BHjSkTGGH0h28W3yvgCslWky9JRyTbMhMo/Rk ba0/0sDMKePXhJYt6ea7kxgEURs62URZqemDZOQ3f0ktsfyjkZnbmvPYcSVYf5Mm+F6zBGZfpfH GN3qRRja1x40pEvRFlxj/hASBWjrScyjG/V9Mv6D9+cOUIxERA== X-Google-Smtp-Source: AGHT+IHUPjYb2qe97dUurXhu/69IHL6noHJOVmh7CNoaPDeusUsv3n9W6aIlNXrzZoAP/1F2rTNX6g== X-Received: by 2002:a17:90b:2b8e:b0:2ef:19d0:2261 with SMTP id 98e67ed59e1d1-2fce78cbe94mr4724202a91.16.1740130661359; Fri, 21 Feb 2025 01:37:41 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fceb088c7dsm976492a91.39.2025.02.21.01.37.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 01:37:41 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 4FFAA8058E; Fri, 21 Feb 2025 17:47:53 +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 v4 1/2] mtd: spi-nand: Add read retry support Date: Fri, 21 Feb 2025 17:32:59 +0800 Message-Id: <20250221093300.430994-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250221093300.430994-1-linchengming884@gmail.com> References: <20250221093300.430994-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 | 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..beb40f3619ca 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -671,11 +671,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 @@ -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 <=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) @@ -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 Tue Dec 16 13:27:29 2025 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 B9AE2204099 for ; Fri, 21 Feb 2025 09:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740130664; cv=none; b=eONP3krGDkz37X7OEW1mbb300tMl4EwQoSFwlEQXXUDP3coMj8NFjCbbmupv6Kd3PNMzL0+A7fFGYHC7so6fKwXktaJ5JK7gesU6oOorSKzig4oxjh8wE4TAdF5ftoP9iCTDzwBoi/80ONLgCqvY89k3ISUzqQ4aeKeEmMCCIG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740130664; c=relaxed/simple; bh=3KDAHGo41KC9nS5UOQ2rc+N3/qw4xgauGRWgYb/mxCo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hp0jTcdUp7j3uokzVS3pNMsF70kpkRPwUmfTz6Z1tyHWOuFCr5ZovHL5nE63JDncGGg+qY2WREqQVKk9f+DRcy/yhp5pQ+yVjhJjMaLZjeENrMTYDQNZ7Qg64NfOV5dGesmzWCWC5RbuJ8zPOUjDzXgzOEmKbKqxGZjkDt4b1aQ= 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=iLR8cSVc; arc=none smtp.client-ip=209.85.214.179 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="iLR8cSVc" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-220bff984a0so36151095ad.3 for ; Fri, 21 Feb 2025 01:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740130662; x=1740735462; 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=AZypDoIb3PvUtYaTIKYKko9b5RY6swPXf9N3dy7NqeI=; b=iLR8cSVcKk0EX0jrkyMgAd9r0LolSCW939hMBJK+G+sVGb9zhqWvKIj8mU+SCU5iRT 0uWxU58McVLvjBKezot2HbeJWBFZ05qIcSELMMUkWUUGCMPt090/q8M2wwwQ6AJRZqJ7 jT3HqDX+lxf2tupE0S5ppvKPVD0iwWbnTFkPQq0wYJqcq1C5v1rzP+JNvHQaMfZQLeg0 P0KXMo6SfXW5Ihp0XdUAHLcGUBFk12Ma8BH0KbnHg0Fk2WXYvmCIZBa6CwUk3Zt2f0Ua MBMT8oGY7V5ocJUsxaOU7Ki4wLTeWEwPYtbOutcYdcfJ4RLaIe1p5jyfR1zryMufWU4W Cczg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740130662; x=1740735462; 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=AZypDoIb3PvUtYaTIKYKko9b5RY6swPXf9N3dy7NqeI=; b=ELTTJ7FEeMRhXqG6uBfHnzkNf5FF+4fPfmR4mXm89uwxHH6TJaSJt8tR1S3Wg58tO7 l+JIjTv4J2a+oC4CKF8nd+Vfk0LNYoWPCA37iXCaLMRmUhdLCGGhst9dEJTFaJgUPBD2 Q5nulYqRM36J53orrsjreTztCFyImiMIEfe9jTxX70aokGAjxG509SumAhVaayFuVIJR AxKYqIdRuPDksZNMgLS0rB6KmFd63lm7yC4Rif+ePv5fRPCYsBbOx6xt/m/L6I8oVy46 7jj6Tge8gMtOJR2STSin0LWNsqOzPGQbTx5qCZbuwORAvJeTROXG9R48wHGdJ/aaU3kC 7GCg== X-Forwarded-Encrypted: i=1; AJvYcCX5Pq6d1tHHA63RQ/Bl8NEm6c4lsPHTwki0MqFtrOk8b1GALu18ymxlumU9kPUNPOVGJ/+3aRXRw2DljxU=@vger.kernel.org X-Gm-Message-State: AOJu0Yyq2AgHFWhHG0wHi5/q4PKVPLcwprqXjV/aIm2XLK+89lEoHCGD m5HS4o3miY/XCEIYXSiMhqI/3usw3GxqYBzEkWPm3pAJQfIUDAMU X-Gm-Gg: ASbGncsjLU5DGX95pWhUrCsvBuou6mnt/SgrmhDn32kl2bb6MbRXXdVk3CbcpT0o5K1 uxIfozWrAEfo6DMBbJ3gnmOJ1Urs8J8LGcQr7hfYhQD606EW+0cFMOKq5q5igtSllj0GU4aQswF CP2I0zLn1A6d19CW2Y3c7Ob6sVq6TcOp0y+Sp6mlVl4fhaMeoHu7usJ8YwgAICTK/uTr7LJv6Jp wlRQOOIvCTZwYdM7+P0be0DImbabQZCy0zA4HMhnKXCP9MEvsKGlC6Z9Ka5UCLYP1vk4E/sYzbt Sy9JqCuzR589DUQpjtpGwXhS8pEZvGDS0I3p28lMrbcAlCzCaQ== X-Google-Smtp-Source: AGHT+IFEjku/zRtoq15yS1odPvTrJ/BSCP3PpqrbP64QU8Alyni1zYmSLsmSQzR7FTprpT8+Qv6DdQ== X-Received: by 2002:a05:6a21:681:b0:1ee:d515:c6ea with SMTP id adf61e73a8af0-1eef3dea48dmr5522617637.36.1740130661915; Fri, 21 Feb 2025 01:37:41 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7324273d9fbsm15699183b3a.102.2025.02.21.01.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 01:37:41 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 526D580A58; Fri, 21 Feb 2025 17:47:53 +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 v4 2/2] mtd: spi-nand: macronix: Add support for read retry Date: Fri, 21 Feb 2025 17:33:00 +0800 Message-Id: <20250221093300.430994-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250221093300.430994-1-linchengming884@gmail.com> References: <20250221093300.430994-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 d277c3220fdc..3562bf585ae9 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