forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/mtd/nand/spi/core.c
....@@ -527,7 +527,7 @@
527527 const struct nand_page_io_req *req,
528528 bool ecc_enabled)
529529 {
530
- u8 status;
530
+ u8 status = 0;
531531 int ret;
532532
533533 ret = spinand_load_page_op(spinand, req);
....@@ -535,6 +535,13 @@
535535 return ret;
536536
537537 ret = spinand_wait(spinand, &status);
538
+ /*
539
+ * When there is data outside of OIP in the status, the status data is
540
+ * inaccurate and needs to be reconfirmed
541
+ */
542
+ if (spinand->id.data[0] == 0x01 && status && !ret)
543
+ ret = spinand_wait(spinand, &status);
544
+
538545 if (ret < 0)
539546 return ret;
540547
....@@ -866,6 +873,7 @@
866873 &skyhigh_spinand_manufacturer,
867874 &toshiba_spinand_manufacturer,
868875 &unim_spinand_manufacturer,
876
+ &unim_zl_spinand_manufacturer,
869877 &winbond_spinand_manufacturer,
870878 &xincun_spinand_manufacturer,
871879 &xtx_spinand_manufacturer,
....@@ -1111,6 +1119,13 @@
11111119 if (ret)
11121120 return ret;
11131121
1122
+ /* HWP_EN must be enabled first before block unlock region is set */
1123
+ if (spinand->id.data[0] == 0x01) {
1124
+ ret = spinand_lock_block(spinand, HWP_EN);
1125
+ if (ret)
1126
+ return ret;
1127
+ }
1128
+
11141129 ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED);
11151130 if (ret)
11161131 return ret;