From 90629d82daa467c03626b8abc4671046dc548118 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 21 Oct 2022 22:43:07 +0200 Subject: [PATCH] generic: 5.15: move pending xtx nand patch from pending to backport Move pending xtx nand patch from pending to backport as it got merged upstream. Signed-off-by: Christian Marangi --- ...pinand-Add-support-for-XTX-XT26G0xA.patch} | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) rename target/linux/generic/{pending-5.15/483-mtd-spinand-add-support-for-xtx-xt26g0xa.patch => backport-5.15/331-v5.19-mtd-spinand-Add-support-for-XTX-XT26G0xA.patch} (85%) diff --git a/target/linux/generic/pending-5.15/483-mtd-spinand-add-support-for-xtx-xt26g0xa.patch b/target/linux/generic/backport-5.15/331-v5.19-mtd-spinand-Add-support-for-XTX-XT26G0xA.patch similarity index 85% rename from target/linux/generic/pending-5.15/483-mtd-spinand-add-support-for-xtx-xt26g0xa.patch rename to target/linux/generic/backport-5.15/331-v5.19-mtd-spinand-Add-support-for-XTX-XT26G0xA.patch index a73c9fa97d..541d247542 100644 --- a/target/linux/generic/pending-5.15/483-mtd-spinand-add-support-for-xtx-xt26g0xa.patch +++ b/target/linux/generic/backport-5.15/331-v5.19-mtd-spinand-Add-support-for-XTX-XT26G0xA.patch @@ -1,7 +1,7 @@ -From a07e31adf2753cad2fd9790db5bfc047c81e8152 Mon Sep 17 00:00:00 2001 +From f4c5c7f9d2e5ab005d57826b740b694b042a737c Mon Sep 17 00:00:00 2001 From: Felix Matouschek -Date: Fri, 2 Jul 2021 20:31:23 +0200 -Subject: [PATCH] mtd: spinand: Add support for XTX XT26G0xA +Date: Mon, 18 Apr 2022 15:28:03 +0200 +Subject: [PATCH 1/1] mtd: spinand: Add support for XTX XT26G0xA Add support for XTX Technology XT26G01AXXXXX, XTX26G02AXXXXX and XTX26G04AXXXXX SPI NAND. @@ -11,17 +11,18 @@ These are 3V, 1G/2G/4Gbit serial SLC NAND flash devices with on-die ECC Tested on Teltonika RUTX10 flashed with OpenWrt. -Datasheets available at -http://www.xtxtech.com/download/?AId=225 -https://datasheet.lcsc.com/szlcsc/2005251034_XTX-XT26G01AWSEGA_C558841.pdf - +Links: + - http://www.xtxtech.com/download/?AId=225 + - https://datasheet.lcsc.com/szlcsc/2005251034_XTX-XT26G01AWSEGA_C558841.pdf Signed-off-by: Felix Matouschek +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20220418132803.664103-1-felix@matouschek.org --- drivers/mtd/nand/spi/Makefile | 2 +- drivers/mtd/nand/spi/core.c | 1 + - drivers/mtd/nand/spi/xtx.c | 122 ++++++++++++++++++++++++++++++++++ + drivers/mtd/nand/spi/xtx.c | 129 ++++++++++++++++++++++++++++++++++ include/linux/mtd/spinand.h | 1 + - 4 files changed, 125 insertions(+), 1 deletion(-) + 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/spi/xtx.c --- a/drivers/mtd/nand/spi/Makefile @@ -43,7 +44,7 @@ Signed-off-by: Felix Matouschek static int spinand_manufacturer_match(struct spinand_device *spinand, --- /dev/null +++ b/drivers/mtd/nand/spi/xtx.c -@@ -0,0 +1,122 @@ +@@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Author: @@ -109,18 +110,25 @@ Signed-off-by: Felix Matouschek +static int xt26g0xa_ecc_get_status(struct spinand_device *spinand, + u8 status) +{ -+ switch (status & XT26G0XA_STATUS_ECC_MASK) { ++ status = status & XT26G0XA_STATUS_ECC_MASK; ++ ++ switch (status) { + case XT26G0XA_STATUS_ECC_NO_DETECTED: + return 0; + case XT26G0XA_STATUS_ECC_8_CORRECTED: + return 8; + case XT26G0XA_STATUS_ECC_UNCOR_ERROR: + return -EBADMSG; -+ default: /* (1 << 2) through (7 << 2) are 1-7 corrected errors */ -+ return (status & XT26G0XA_STATUS_ECC_MASK) >> 2; ++ default: ++ break; + } + -+ return -EINVAL; ++ /* At this point values greater than (2 << 4) are invalid */ ++ if (status > XT26G0XA_STATUS_ECC_UNCOR_ERROR) ++ return -EINVAL; ++ ++ /* (1 << 2) through (7 << 2) are 1-7 corrected errors */ ++ return status >> 2; +} + +static const struct spinand_info xtx_spinand_table[] = { -- 2.30.2