From 9df731a176aab8e03b984b681b1bea01ccff6644 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 06 Nov 2023 07:23:06 +0000
Subject: [PATCH] rk3568 rt uboot init

---
 u-boot/drivers/mtd/nand/spi/unim.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/u-boot/drivers/mtd/nand/spi/unim.c b/u-boot/drivers/mtd/nand/spi/unim.c
index 8dd0b9b..b4e3e5b 100644
--- a/u-boot/drivers/mtd/nand/spi/unim.c
+++ b/u-boot/drivers/mtd/nand/spi/unim.c
@@ -71,12 +71,13 @@
 static int tx25g01_ecc_get_status(struct spinand_device *spinand,
 				  u8 status)
 {
-	u8 eccsr = (status & GENMASK(6, 4)) >> 2;
+	struct nand_device *nand = spinand_to_nand(spinand);
+	u8 eccsr = (status & GENMASK(6, 4)) >> 4;
 
-	if (eccsr <= 7)
+	if (eccsr < 4)
 		return eccsr;
-	else if (eccsr == 12)
-		return 8;
+	else if (eccsr == 4)
+		return nand->eccreq.strength;
 	else
 		return -EBADMSG;
 }

--
Gitblit v1.6.2