hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
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
....@@ -1111,6 +1118,13 @@
11111118 if (ret)
11121119 return ret;
11131120
1121
+ /* HWP_EN must be enabled first before block unlock region is set */
1122
+ if (spinand->id.data[0] == 0x01) {
1123
+ ret = spinand_lock_block(spinand, HWP_EN);
1124
+ if (ret)
1125
+ return ret;
1126
+ }
1127
+
11141128 ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED);
11151129 if (ret)
11161130 return ret;