From nobody Mon Feb 9 00:04:40 2026 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 C56511C174A for ; Wed, 22 Jan 2025 07:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737529208; cv=none; b=f/U8qO4OpIWooW3p9+Yd3ealNE+OKUSSXefYiRm3s6urp2pfGGDn5wSr4YnzQnnDTxvqS0nAcvvRd4KzZl97ZKy+Lkn2vmGl3tN4RSfYGEG8r4luFwg4GxPCrR/uHaqZOzx55I5z3c+Mm10kCO8TEhhp67XTVvYeZKKUdxW99UA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737529208; c=relaxed/simple; bh=cVEnQSCPwyyZOHs6Sm5jb518r31I0Qknh6S9Uk2Umaw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HwZnU8g1DSqgqlHrQlv1RPcBgWh2+X+htHTWkSUd5nj695UtTU9XCU3iVxjJFSe5nrMBxMZG2ED73ZB6jR6nDsrNRPybnwtt2mYw0LSwYNI5jP3ggqglUbiPF5qoARpqJxYGJO/a+23qS+7W0roE9zJo61TK5OKX9x+oz1pXOY4= 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=Cqq48XEa; arc=none smtp.client-ip=209.85.216.54 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="Cqq48XEa" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2efd81c7ca4so8814181a91.2 for ; Tue, 21 Jan 2025 23:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737529206; x=1738134006; 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=orKgfn/62hgyXHtKpMULf6DcLHIRTW29nQEWatsda+s=; b=Cqq48XEapNcBCTuFF30xptYWVF3qZxobCNGGJs+eMxdf7MubbjZoRp2yLpilHMDj7k +hYvBdE+0cp//R/SFtZZiJmCPHr09SabyMQHg8Ut1sRDOcIrrXt/JBp2OGtVkKy09wJD YDqpfWg4EAM4ljllU6MYFevwziSCTaLK3og2cjyASZIpEHV6zDqO+3HUBnV+K5O5kDKI 9xUvcAeFvD7tpD/dhL6CPUDCl2gl+S9h426H6XxKeqU3Tnja2O22MMarjW1AtgrXnTRe hehosXciUGxgNYRqAMtNwGFN2HqOdU93y6II3RVfeJAaF/js6wsqXt+4x7LisF+tNW9U ewdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737529206; x=1738134006; 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=orKgfn/62hgyXHtKpMULf6DcLHIRTW29nQEWatsda+s=; b=TjACzJSEcS+qiRfrb6cdqURfZ/qeuhO2cgnO8npsizs/SXjA1cYTgYZ1AxTIWyoE7s HZJXjzxS7hEQoELvYGne6XG4y95MoaV0CoQXzqHyS1Woqlqh/hhUBWXeYCYM+wPfufDr PtgUZEhiuiCyih2AcAUBzJ5ih1o8XiV42Vo+TfnS/QYsmSXuPDK1nv8wa9spyeJCF4Pa zdaNXZtYZe3w0RUOJt9u3mYYPg/taHC0jAdVYPnOEJ5gnqYHXRjtX79dOjeGDwGYeu33 byE/j7JPALQOkHN2EBa3LOv/9gP4TRYvq/7UxOCASyr/v5E/Jo8xEYQb/PWgY3/H0p8d J2lg== X-Forwarded-Encrypted: i=1; AJvYcCXI8oQskr08KZpozzxZPXRU4NnYNPjkeEiH1zGILUPgczDcBiBa+SLVRaXgPKypyN/4I8kWN4LttTrzwr8=@vger.kernel.org X-Gm-Message-State: AOJu0YxzomIfdjv2QxlVvVfd166IVl0o1Ydvwo3+6Ul+pRpwSwqGQibN EkVlbtjs3uB6afamEFcRH5UhlHyyug4L5d+d/ApQHw4VUNUs4L8E X-Gm-Gg: ASbGncs4RyDeqfjvIWw7B4yYiKpw1jNOjwJLHhJjq5fbsVXwmbLhoncRKHi5ZABjALV QU9kz/pAxHNBPr838UtlI/Sfcn+8tjz89bCQaj2VAVinqmzZrGKWSckSGAmxE36ypm4/fdfg5hb H1wZG/mzbDCOiywatXgvJT7TurLKrwLA7mV92x+iMUOYQLOhqMM3rCV9rcB9M1ulExS70FEaTVf o54UOFsBrHmJtA5Z3QacndVBihx/EvR9MgqBnBC56OouEW3z9EbNpXM1fHh44sGg5/lLhF7Xmfz 3U7+qwEi4wsSFQ6hAA== X-Google-Smtp-Source: AGHT+IF3j9wNjx/QmXnK6y25+vqbk9nxjFMXAMQM7bsucb9ST55Vtw+XzXdPQUNXlrlJ+UJpiJl2MQ== X-Received: by 2002:a05:6a00:1c84:b0:72a:9e3c:920d with SMTP id d2e1a72fcca58-72dafbe6a98mr25796238b3a.22.1737529204462; Tue, 21 Jan 2025 23:00:04 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72dab9c8d7csm10499480b3a.101.2025.01.21.23.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 23:00:04 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 529848086D; Wed, 22 Jan 2025 15:11:07 +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 v3 1/2] mtd: spi-nand: Add read retry support Date: Wed, 22 Jan 2025 14:56:04 +0800 Message-Id: <20250122065605.285145-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122065605.285145-1-linchengming884@gmail.com> References: <20250122065605.285145-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..3f72d94c09f3 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 < spinand->read_retries)) { + ret =3D spinand->set_read_retry(spinand, retry_mode); + if (ret < 0) { + ecc_failed =3D true; + 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 Mon Feb 9 00:04:40 2026 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 ABFE01BD9F8 for ; Wed, 22 Jan 2025 07:00:05 +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=1737529207; cv=none; b=aisJAt0WpRrxT/Ha2pvhHyck8KuxQByLGQql34q3SScLBkg5FYVWrg4gnZnNJsGng3yD46SZOel+Z+T9dOYeRsFHGyNjPWGY/cD3aJLeRenCczfvp0oQJB1mqXbgZG7G2KvpjiNDtW/S286ipjMnB1NtET+vi4Dg+/9RRL47rVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737529207; c=relaxed/simple; bh=V65ix7kEC/uHQi5P+gmihAi4vvRinNykAZUcKMgsW50=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hPLQsylTKyiYNenJACLaDpkACAmYy8CW1MJaeoExao1zAdqBG/SJ6p/bamN4ngJDDw+Ct9+1uE2QqnbHp6GLWmCTiV0mjPW9dIcgCTDPm+qHUs0devkl5+s7WrWJUEX++N5wHsyTx1wAnrwI4VshPUKlWxvKKgkY25AiQtG5qIQ= 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=PPWGidkL; 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="PPWGidkL" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-21670dce0a7so136110805ad.1 for ; Tue, 21 Jan 2025 23:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737529205; x=1738134005; 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=AXrSsk/WJ+wpbAFAOo12xL0y3vgGX4Equ+yHr3ypru8=; b=PPWGidkL40a8fn/spIkYqxFWVGFRqINxBlfO5Cs161a23ABjQI19Elg+C/7oMNdLEg XIQWNti1GnCgd8C/5kyK7MC3OFoY3abwD1BfMTJVagxlZAXpEmFhUiG1LBHx98kuFXqg zoAqyBwOOlnniQZSdi3/OV5xIjotv6QvhdnrTqAopbyguyl2ysoHq1NQJdU6/LHgJ/Pg JcPXdv74V+vtPflkd0KvpVQp0PbJLRwmLJYS8vi0LB+/fP18ffxu/jQMEXQxnJsDbo4t 8Jw1IkSdWY/hzub5JEMck/BBfVVfw1LMbReBCJYTz7zXNjKqScTwWtDrqlSsfqPKI2gY qHGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737529205; x=1738134005; 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=AXrSsk/WJ+wpbAFAOo12xL0y3vgGX4Equ+yHr3ypru8=; b=BUwl+FZJ/CKCJi67bAa1mgzLOadEeV0M/TauXkS+SW4qxbglpHhCNmAM/Y3qx9uwcw QBnXQwP+PLc8R4o+aVBGQNRgsQ6epSh9Bw2gW/F5Mkr7WzegUsu4IRlZbl8fc7528vlV hSJsQjtFZYcbXyELoBvIVw4p0LrWwEs0vHejGLR3pA7dOlOuldHUrfm/4aHXrn1d81iX kqaQmjY60lw+KQZ4UGNxqbMWDLsXCrpEcRcDfpaix8GdZ/1+NXxjlzGhafp4s02xLX2z tlvjh2JkBzOwkBN1lmohI64pox7bPvL/i0uj6O6tW7KluuhRjTVs9zzv4iSom2dOkKKn Z/Ig== X-Forwarded-Encrypted: i=1; AJvYcCUNfFqdIziyHfjKyQCPScHj0LKgyS1zd958al4Og2IX8d7OyqmEksT4lGCv6s7rhYnFeK4BN5A7EkbxuAk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4YVKM9qJy6RbiSwW2f/eE+sNtdvAcetlFZpQq9PPSYMVYRdx2 vD7CfVk3rtRspJZSrboPMlf2lvV9q4ivHZdvJf53qR8SEPD0PpYc X-Gm-Gg: ASbGncsbYQLSUIGjee4z3r4kkRM7zht+O8ejmXRPFtYavCGTwpSySCP9hB2AjO5J/Uy pjOhLrWvRMr8M0GLdMqh9ePavAvoUmS8usuc4HHbk6qgf/ObkCBp/BEYvXcUT1aZ21kFVSCkvjE Uuzn/LPeMHhc2KrwhM5RWw9OcrOMmd340/d2UE1oxKaq2SV9JK8odaI0AYeb3W9Bvk4VLWgtrGS qInP6yEZx7/26xjcpXzeI0zqzpdCEG9G/Q3bn05digILnsy3c5Vw3L2a2uRqutEZY71uRe72pgr fB57yaZUkffxrXOaqQ== X-Google-Smtp-Source: AGHT+IEIrHwLB3WTLwayzB2OSmba1zFsJdfhmUlcPOEZ/FmvWHb0t+GKrLa1D2pO+bSxnO2O+XKG1g== X-Received: by 2002:a05:6a00:4fd3:b0:72a:8461:d172 with SMTP id d2e1a72fcca58-72daf9becfamr32613466b3a.3.1737529204757; Tue, 21 Jan 2025 23:00:04 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72dab9c8e95sm10464977b3a.106.2025.01.21.23.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 23:00:04 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 57D678094D; Wed, 22 Jan 2025 15:11:07 +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 v3 2/2] mtd: spi-nand: macronix: Add support for read retry Date: Wed, 22 Jan 2025 14:56:05 +0800 Message-Id: <20250122065605.285145-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122065605.285145-1-linchengming884@gmail.com> References: <20250122065605.285145-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 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