summaryrefslogtreecommitdiff
path: root/target/linux/ramips/patches/111-nand-controller-busy.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ramips/patches/111-nand-controller-busy.patch')
-rwxr-xr-xtarget/linux/ramips/patches/111-nand-controller-busy.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/target/linux/ramips/patches/111-nand-controller-busy.patch b/target/linux/ramips/patches/111-nand-controller-busy.patch
new file mode 100755
index 0000000..c87bbb5
--- /dev/null
+++ b/target/linux/ramips/patches/111-nand-controller-busy.patch
@@ -0,0 +1,55 @@
+Index: linux-3.10.14/drivers/mtd/ralink/ralink_nand.c
+===================================================================
+--- linux-3.10.14.orig/drivers/mtd/ralink/ralink_nand.c
++++ linux-3.10.14/drivers/mtd/ralink/ralink_nand.c
+@@ -377,7 +377,10 @@ static int nfc_check_wp(void)
+ int ret;
+
+ ret = _nfc_read_status(&result);
+- //FIXME, if ret < 0
++ if (ret) {
++ printk(KERN_WARNING "unable to tell WP. default FALSE.\n");
++ return 0;
++ }
+
+ return !(result & NAND_STATUS_WP);
+ #endif
+@@ -1332,10 +1335,9 @@ nand_get_device(struct ra_nand_chip *ra,
+ int ret = 0;
+
+ #if !defined (__UBOOT__)
+- ret = mutex_lock(ra->controller);
++ mutex_lock(ra->controller);
+ #endif ///
+- if (!ret)
+- ra->state = new_state;
++ ra->state = new_state;
+
+ return ret;
+
+@@ -1596,6 +1598,7 @@ int nand_erase_nand(struct ra_nand_chip
+
+ #ifdef SKIP_BAD_BLOCK
+ do {
++ int newpage = page_remap(ra, page);
+ #if defined (CONFIG_SUPPORT_OPENWRT)
+ if (((page << ra->page_shift) >= (int)rootfs_offset) && ((page << ra->page_shift) < (int)rootfs_data_offset))
+ {
+@@ -1606,8 +1609,6 @@ int nand_erase_nand(struct ra_nand_chip
+ }
+ }
+ #endif
+- int newpage = page_remap(ra, page);
+-
+ if (newpage < 0)
+ {
+ // printk("page_remap failed, page = 0x%x\n", page);
+@@ -2881,7 +2882,7 @@ static int ramtd_nand_writeoob(struct mt
+
+ ra_dbg("%s: \n", __func__);
+
+- nand_get_device(ra, FL_READING);
++ nand_get_device(ra, FL_WRITING);
+
+ ret = nand_do_write_ops(ra, to, ops);
+