diff mbox series

[LEDE-DEV] Kernel: bump 4.4 to 4.4.124 for 17.01

Message ID 20180328175152.24490-1-foss@volatilesystems.org
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [LEDE-DEV] Kernel: bump 4.4 to 4.4.124 for 17.01 | expand

Commit Message

Stijn Segers March 28, 2018, 5:51 p.m. UTC
* Refreshed patches
 * Removed 087-Revert-led-core-Fix-brightness-setting-when-setting-.patch (applied upstream)

 Compile-tested on ar71xx, ramips/mt7621, x86/64
 Run-tested on ar71xx

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
---
 include/kernel-version.mk                          |   4 +-
 .../patches-4.4/910-unaligned_access_hacks.patch   |   2 +-
 .../patches-4.4/0029-Add-dwc_otg-driver.patch      |   2 +-
 ...core-Fix-brightness-setting-when-setting-.patch |  28 ------
 .../098-usb-dwc2-Remove-unnecessary-kfree.patch    |   2 +-
 ...610-netfilter_match_bypass_default_checks.patch |  12 +--
 ...80-NET-skip-GRO-for-foreign-MAC-addresses.patch |  10 +-
 .../generic/patches-4.4/721-phy_packets.patch      |   2 +-
 .../generic/patches-4.4/902-debloat_proc.patch     |   4 +-
 .../generic/patches-4.4/904-debloat_dma_buf.patch  |   2 +-
 ...f-esdhc-add-remove-some-quirks-according-.patch |   2 +-
 ...ers-mmc-Add-compatible-string-for-LS1046A.patch |   2 +-
 ...mtd-backport-v4.7-0day-patches-from-Boris.patch | 112 ++++++++++-----------
 ...mtd-backport-v4.7-0day-patches-from-Boris.patch | 112 ++++++++++-----------
 ...0074-mtd-nand-import-nand_hw_control_init.patch |   2 +-
 .../0032-USB-dwc2-add-device_reset.patch           |   2 +-
 .../0039-mtd-add-mt7621-nand-support.patch         |   2 +-
 .../0040-nand-add-mtk-nand-hack-hook.patch         |   6 +-
 .../patches-4.4/0901-spansion_nand_id_fix.patch    |   4 +-
 19 files changed, 142 insertions(+), 170 deletions(-)
 delete mode 100644 target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch
diff mbox series

Patch

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 5cc0200893..deb13a6a82 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -3,10 +3,10 @@ 
 LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.4 = .120
+LINUX_VERSION-4.4 = .124
 
 LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
-LINUX_KERNEL_HASH-4.4.120 = a25f07372a2661c577e3c8a395bfb4a9f277518a01d097275604eccd3689f478
+LINUX_KERNEL_HASH-4.4.124 = 59341c0af64bf0e2ba6f5305bff564286c228755827b8bebd002a9db2abc2129
 
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
diff --git a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
index 72d964df63..7858abc64b 100644
--- a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
+++ b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
@@ -359,7 +359,7 @@ 
  	for (p = *head; p; p = p->next) {
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
-@@ -458,7 +458,7 @@ static struct neighbour *ipv4_neigh_look
+@@ -461,7 +461,7 @@ static struct neighbour *ipv4_neigh_look
  	else if (skb)
  		pkey = &ip_hdr(skb)->daddr;
  
diff --git a/target/linux/brcm2708/patches-4.4/0029-Add-dwc_otg-driver.patch b/target/linux/brcm2708/patches-4.4/0029-Add-dwc_otg-driver.patch
index 561fcaed10..b94c0e0e06 100644
--- a/target/linux/brcm2708/patches-4.4/0029-Add-dwc_otg-driver.patch
+++ b/target/linux/brcm2708/patches-4.4/0029-Add-dwc_otg-driver.patch
@@ -670,7 +670,7 @@  dwc_otg: Remove duplicate gadget probe/unregister function
  		msleep(100);	/* Cool down */
 --- a/drivers/usb/core/message.c
 +++ b/drivers/usb/core/message.c
-@@ -1909,6 +1909,85 @@ free_interfaces:
+@@ -1913,6 +1913,85 @@ free_interfaces:
  	if (cp->string == NULL &&
  			!(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
  		cp->string = usb_cache_string(dev, cp->desc.iConfiguration);
diff --git a/target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch b/target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch
deleted file mode 100644
index 6378ed4351..0000000000
--- a/target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch
+++ /dev/null
@@ -1,28 +0,0 @@ 
-From 4b98deaa353d8f7af3f7543d0b59497fe1275599 Mon Sep 17 00:00:00 2001
-Message-Id: <4b98deaa353d8f7af3f7543d0b59497fe1275599.1520544136.git.mschiffer@universe-factory.net>
-From: Matthias Schiffer <mschiffer@universe-factory.net>
-Date: Thu, 8 Mar 2018 22:22:08 +0100
-Subject: [PATCH] Revert "led: core: Fix brightness setting when setting
- delay_off=0"
-
-This reverts commit 20ac8f72514b3af8b62c520d55656ded865eff00.
----
- drivers/leds/led-core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
-index 92b6798ef5b3..c1c3af089634 100644
---- a/drivers/leds/led-core.c
-+++ b/drivers/leds/led-core.c
-@@ -149,7 +149,7 @@ void led_blink_set(struct led_classdev *led_cdev,
- 		   unsigned long *delay_on,
- 		   unsigned long *delay_off)
- {
--	led_stop_software_blink(led_cdev);
-+	del_timer_sync(&led_cdev->blink_timer);
- 
- 	led_cdev->flags &= ~LED_BLINK_ONESHOT;
- 	led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP;
--- 
-2.16.2
-
diff --git a/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch b/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch
index 3a27feac8f..9ae6a41bff 100644
--- a/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch
+++ b/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch
@@ -14,7 +14,7 @@  Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
 
 --- a/drivers/usb/dwc2/hcd.c
 +++ b/drivers/usb/dwc2/hcd.c
-@@ -3160,7 +3160,6 @@ error3:
+@@ -3161,7 +3161,6 @@ error3:
  error2:
  	usb_put_hcd(hcd);
  error1:
diff --git a/target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch
index 257bcf79ee..9d0a2b37a6 100644
--- a/target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch
+++ b/target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch
@@ -50,16 +50,16 @@ 
  static bool
  ip_checkentry(const struct ipt_ip *ip)
  {
-@@ -655,6 +681,8 @@ find_check_entry(struct ipt_entry *e, st
+@@ -659,6 +685,8 @@ find_check_entry(struct ipt_entry *e, st
+	struct xt_mtchk_param mtpar;
  	struct xt_entry_match *ematch;
- 	unsigned long pcnt;
  
 +	ip_checkdefault(&e->ip);
 +
- 	pcnt = xt_percpu_counter_alloc();
- 	if (IS_ERR_VALUE(pcnt))
+	if (!xt_percpu_counter_alloc(alloc_state, &e->counters))
  		return -ENOMEM;
-@@ -953,6 +981,7 @@ copy_entries_to_user(unsigned int total_
+
+@@ -957,6 +985,7 @@ copy_entries_to_user(unsigned int total_
  	const struct xt_table_info *private = table->private;
  	int ret = 0;
  	const void *loc_cpu_entry;
@@ -67,7 +67,7 @@ 
  
  	counters = alloc_counters(table);
  	if (IS_ERR(counters))
-@@ -979,6 +1008,14 @@ copy_entries_to_user(unsigned int total_
+@@ -983,6 +1012,14 @@ copy_entries_to_user(unsigned int total_
  			ret = -EFAULT;
  			goto free_counters;
  		}
diff --git a/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
index 7c96f4f171..bfe76dbc16 100644
--- a/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
+++ b/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
@@ -17,7 +17,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -4271,6 +4271,9 @@ static enum gro_result dev_gro_receive(s
+@@ -4278,6 +4278,9 @@ static enum gro_result dev_gro_receive(s
  	enum gro_result ret;
  	int grow;
  
@@ -27,7 +27,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	if (!(skb->dev->features & NETIF_F_GRO))
  		goto normal;
  
-@@ -5437,6 +5440,48 @@ static void __netdev_adjacent_dev_unlink
+@@ -5444,6 +5447,48 @@ static void __netdev_adjacent_dev_unlink
  					   &upper_dev->adj_list.lower);
  }
  
@@ -76,7 +76,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static int __netdev_upper_dev_link(struct net_device *dev,
  				   struct net_device *upper_dev, bool master,
  				   void *private)
-@@ -5508,6 +5553,7 @@ static int __netdev_upper_dev_link(struc
+@@ -5515,6 +5560,7 @@ static int __netdev_upper_dev_link(struc
  			goto rollback_lower_mesh;
  	}
  
@@ -84,7 +84,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  	return 0;
-@@ -5634,6 +5680,7 @@ void netdev_upper_dev_unlink(struct net_
+@@ -5641,6 +5687,7 @@ void netdev_upper_dev_unlink(struct net_
  	list_for_each_entry(i, &upper_dev->all_adj_list.upper, list)
  		__netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr);
  
@@ -92,7 +92,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  }
-@@ -6174,6 +6221,7 @@ int dev_set_mac_address(struct net_devic
+@@ -6181,6 +6228,7 @@ int dev_set_mac_address(struct net_devic
  	if (err)
  		return err;
  	dev->addr_assign_type = NET_ADDR_SET;
diff --git a/target/linux/generic/patches-4.4/721-phy_packets.patch b/target/linux/generic/patches-4.4/721-phy_packets.patch
index 716c1a0273..39dc5ccbfc 100644
--- a/target/linux/generic/patches-4.4/721-phy_packets.patch
+++ b/target/linux/generic/patches-4.4/721-phy_packets.patch
@@ -86,7 +86,7 @@ 
  	help
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -2747,10 +2747,20 @@ static int xmit_one(struct sk_buff *skb,
+@@ -2754,10 +2754,20 @@ static int xmit_one(struct sk_buff *skb,
  	if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all))
  		dev_queue_xmit_nit(skb, dev);
  
diff --git a/target/linux/generic/patches-4.4/902-debloat_proc.patch b/target/linux/generic/patches-4.4/902-debloat_proc.patch
index 931f43fce4..636ea422e4 100644
--- a/target/linux/generic/patches-4.4/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.4/902-debloat_proc.patch
@@ -111,7 +111,7 @@ 
  	if (!root_irq_dir)
 --- a/kernel/time/timer_list.c
 +++ b/kernel/time/timer_list.c
-@@ -393,6 +393,8 @@ static int __init init_timer_list_procfs
+@@ -399,6 +399,8 @@ static int __init init_timer_list_procfs
  {
  	struct proc_dir_entry *pe;
  
@@ -239,7 +239,7 @@ 
  
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
-@@ -420,6 +420,9 @@ static struct pernet_operations ip_rt_pr
+@@ -423,6 +423,9 @@ static struct pernet_operations ip_rt_pr
  
  static int __init ip_rt_proc_init(void)
  {
diff --git a/target/linux/generic/patches-4.4/904-debloat_dma_buf.patch b/target/linux/generic/patches-4.4/904-debloat_dma_buf.patch
index b9fdad9c1b..a43ebf19e0 100644
--- a/target/linux/generic/patches-4.4/904-debloat_dma_buf.patch
+++ b/target/linux/generic/patches-4.4/904-debloat_dma_buf.patch
@@ -34,7 +34,7 @@ 
 +MODULE_LICENSE("GPL");
 --- a/kernel/sched/core.c
 +++ b/kernel/sched/core.c
-@@ -2096,6 +2096,7 @@ int wake_up_state(struct task_struct *p,
+@@ -2097,6 +2097,7 @@ int wake_up_state(struct task_struct *p,
  {
  	return try_to_wake_up(p, state, 0);
  }
diff --git a/target/linux/layerscape/patches-4.4/8048-mmc-sdhci-of-esdhc-add-remove-some-quirks-according-.patch b/target/linux/layerscape/patches-4.4/8048-mmc-sdhci-of-esdhc-add-remove-some-quirks-according-.patch
index 3391053356..624aab36a8 100644
--- a/target/linux/layerscape/patches-4.4/8048-mmc-sdhci-of-esdhc-add-remove-some-quirks-according-.patch
+++ b/target/linux/layerscape/patches-4.4/8048-mmc-sdhci-of-esdhc-add-remove-some-quirks-according-.patch
@@ -34,7 +34,7 @@  Integrated-by: Zhao Qiang <qiang.zhao@nxp.com>
 
 --- a/drivers/mmc/host/sdhci-of-esdhc.c
 +++ b/drivers/mmc/host/sdhci-of-esdhc.c
-@@ -621,6 +621,14 @@ static int sdhci_esdhc_probe(struct plat
+@@ -635,6 +635,14 @@ static int sdhci_esdhc_probe(struct plat
  	if (of_device_is_compatible(np, "fsl,ls1021a-esdhc"))
  		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
  
diff --git a/target/linux/layerscape/patches-4.4/8142-drivers-mmc-Add-compatible-string-for-LS1046A.patch b/target/linux/layerscape/patches-4.4/8142-drivers-mmc-Add-compatible-string-for-LS1046A.patch
index d9b4ecb083..1cc3b0539e 100644
--- a/target/linux/layerscape/patches-4.4/8142-drivers-mmc-Add-compatible-string-for-LS1046A.patch
+++ b/target/linux/layerscape/patches-4.4/8142-drivers-mmc-Add-compatible-string-for-LS1046A.patch
@@ -10,7 +10,7 @@  Signed-off-by: Yutang Jiang <yutang.jiang@nxp.com>
 
 --- a/drivers/mmc/host/sdhci-of-esdhc.c
 +++ b/drivers/mmc/host/sdhci-of-esdhc.c
-@@ -615,6 +615,7 @@ static int sdhci_esdhc_probe(struct plat
+@@ -629,6 +629,7 @@ static int sdhci_esdhc_probe(struct plat
  	    of_device_is_compatible(np, "fsl,p4080-esdhc") ||
  	    of_device_is_compatible(np, "fsl,p1020-esdhc") ||
  	    of_device_is_compatible(np, "fsl,t1040-esdhc") ||
diff --git a/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch b/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
index f1f4971b3d..5edd9c3639 100644
--- a/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
+++ b/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
@@ -1954,7 +1954,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	int ctrl = NAND_CTRL_CLE | NAND_CTRL_CHANGE;
  
  	/* Write out the command to the device */
-@@ -708,7 +733,7 @@ static void nand_command(struct mtd_info
+@@ -710,7 +735,7 @@ static void nand_command(struct mtd_info
  static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
  			    int column, int page_addr)
  {
@@ -1963,7 +1963,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Emulate NAND_CMD_READOOB */
  	if (command == NAND_CMD_READOOB) {
-@@ -832,7 +857,7 @@ static void panic_nand_get_device(struct
+@@ -837,7 +862,7 @@ static void panic_nand_get_device(struct
  static int
  nand_get_device(struct mtd_info *mtd, int new_state)
  {
@@ -1972,7 +1972,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	spinlock_t *lock = &chip->controller->lock;
  	wait_queue_head_t *wq = &chip->controller->wq;
  	DECLARE_WAITQUEUE(wait, current);
-@@ -952,7 +977,7 @@ static int __nand_unlock(struct mtd_info
+@@ -957,7 +982,7 @@ static int __nand_unlock(struct mtd_info
  {
  	int ret = 0;
  	int status, page;
@@ -1981,7 +1981,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Submit address of first page to unlock */
  	page = ofs >> chip->page_shift;
-@@ -987,7 +1012,7 @@ int nand_unlock(struct mtd_info *mtd, lo
+@@ -992,7 +1017,7 @@ int nand_unlock(struct mtd_info *mtd, lo
  {
  	int ret = 0;
  	int chipnr;
@@ -1990,7 +1990,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	pr_debug("%s: start = 0x%012llx, len = %llu\n",
  			__func__, (unsigned long long)ofs, len);
-@@ -1050,7 +1075,7 @@ int nand_lock(struct mtd_info *mtd, loff
+@@ -1055,7 +1080,7 @@ int nand_lock(struct mtd_info *mtd, loff
  {
  	int ret = 0;
  	int chipnr, status, page;
@@ -1999,7 +1999,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	pr_debug("%s: start = 0x%012llx, len = %llu\n",
  			__func__, (unsigned long long)ofs, len);
-@@ -1309,13 +1334,12 @@ static int nand_read_page_raw_syndrome(s
+@@ -1314,13 +1339,12 @@ static int nand_read_page_raw_syndrome(s
  static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
  				uint8_t *buf, int oob_required, int page)
  {
@@ -2014,7 +2014,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	unsigned int max_bitflips = 0;
  
  	chip->ecc.read_page_raw(mtd, chip, buf, 1, page);
-@@ -1323,8 +1347,10 @@ static int nand_read_page_swecc(struct m
+@@ -1328,8 +1352,10 @@ static int nand_read_page_swecc(struct m
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
  		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  
@@ -2027,7 +2027,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	eccsteps = chip->ecc.steps;
  	p = buf;
-@@ -1356,14 +1382,14 @@ static int nand_read_subpage(struct mtd_
+@@ -1361,14 +1387,14 @@ static int nand_read_subpage(struct mtd_
  			uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi,
  			int page)
  {
@@ -2045,7 +2045,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Column address within the page aligned to ECC size (256bytes) */
  	start_step = data_offs / chip->ecc.size;
-@@ -1391,12 +1417,13 @@ static int nand_read_subpage(struct mtd_
+@@ -1396,12 +1422,13 @@ static int nand_read_subpage(struct mtd_
  	 * The performance is faster if we position offsets according to
  	 * ecc.pos. Let's make sure that there are no gaps in ECC positions.
  	 */
@@ -2065,7 +2065,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	if (gaps) {
  		chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
  		chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-@@ -1405,20 +1432,23 @@ static int nand_read_subpage(struct mtd_
+@@ -1410,20 +1437,23 @@ static int nand_read_subpage(struct mtd_
  		 * Send the command to read the particular ECC bytes take care
  		 * about buswidth alignment in read_buf.
  		 */
@@ -2095,7 +2095,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	p = bufpoi + data_col_addr;
  	for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) {
-@@ -1426,6 +1456,16 @@ static int nand_read_subpage(struct mtd_
+@@ -1431,6 +1461,16 @@ static int nand_read_subpage(struct mtd_
  
  		stat = chip->ecc.correct(mtd, p,
  			&chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
@@ -2112,7 +2112,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (stat < 0) {
  			mtd->ecc_stats.failed++;
  		} else {
-@@ -1449,13 +1489,12 @@ static int nand_read_subpage(struct mtd_
+@@ -1454,13 +1494,12 @@ static int nand_read_subpage(struct mtd_
  static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
  				uint8_t *buf, int oob_required, int page)
  {
@@ -2127,7 +2127,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	unsigned int max_bitflips = 0;
  
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
-@@ -1465,8 +1504,10 @@ static int nand_read_page_hwecc(struct m
+@@ -1470,8 +1509,10 @@ static int nand_read_page_hwecc(struct m
  	}
  	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  
@@ -2140,7 +2140,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	eccsteps = chip->ecc.steps;
  	p = buf;
-@@ -1475,6 +1516,15 @@ static int nand_read_page_hwecc(struct m
+@@ -1480,6 +1521,15 @@ static int nand_read_page_hwecc(struct m
  		int stat;
  
  		stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
@@ -2156,7 +2156,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (stat < 0) {
  			mtd->ecc_stats.failed++;
  		} else {
-@@ -1502,12 +1552,11 @@ static int nand_read_page_hwecc(struct m
+@@ -1507,12 +1557,11 @@ static int nand_read_page_hwecc(struct m
  static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
  	struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
  {
@@ -2170,7 +2170,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	uint8_t *ecc_calc = chip->buffers->ecccalc;
  	unsigned int max_bitflips = 0;
  
-@@ -1516,8 +1565,10 @@ static int nand_read_page_hwecc_oob_firs
+@@ -1521,8 +1570,10 @@ static int nand_read_page_hwecc_oob_firs
  	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  	chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
  
@@ -2183,7 +2183,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
  		int stat;
-@@ -1527,6 +1578,15 @@ static int nand_read_page_hwecc_oob_firs
+@@ -1532,6 +1583,15 @@ static int nand_read_page_hwecc_oob_firs
  		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  
  		stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL);
@@ -2199,7 +2199,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (stat < 0) {
  			mtd->ecc_stats.failed++;
  		} else {
-@@ -1554,6 +1614,7 @@ static int nand_read_page_syndrome(struc
+@@ -1559,6 +1619,7 @@ static int nand_read_page_syndrome(struc
  	int i, eccsize = chip->ecc.size;
  	int eccbytes = chip->ecc.bytes;
  	int eccsteps = chip->ecc.steps;
@@ -2207,7 +2207,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	uint8_t *p = buf;
  	uint8_t *oob = chip->oob_poi;
  	unsigned int max_bitflips = 0;
-@@ -1573,19 +1634,29 @@ static int nand_read_page_syndrome(struc
+@@ -1578,19 +1639,29 @@ static int nand_read_page_syndrome(struc
  		chip->read_buf(mtd, oob, eccbytes);
  		stat = chip->ecc.correct(mtd, p, oob, NULL);
  
@@ -2244,7 +2244,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	}
  
  	/* Calculate remaining oob bytes */
-@@ -1598,14 +1669,17 @@ static int nand_read_page_syndrome(struc
+@@ -1603,14 +1674,17 @@ static int nand_read_page_syndrome(struc
  
  /**
   * nand_transfer_oob - [INTERN] Transfer oob to client buffer
@@ -2264,7 +2264,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	switch (ops->mode) {
  
  	case MTD_OPS_PLACE_OOB:
-@@ -1613,31 +1687,12 @@ static uint8_t *nand_transfer_oob(struct
+@@ -1618,31 +1692,12 @@ static uint8_t *nand_transfer_oob(struct
  		memcpy(oob, chip->oob_poi + ops->ooboffs, len);
  		return oob + len;
  
@@ -2302,7 +2302,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	default:
  		BUG();
  	}
-@@ -1655,7 +1710,7 @@ static uint8_t *nand_transfer_oob(struct
+@@ -1660,7 +1715,7 @@ static uint8_t *nand_transfer_oob(struct
   */
  static int nand_setup_read_retry(struct mtd_info *mtd, int retry_mode)
  {
@@ -2311,7 +2311,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	pr_debug("setting READ RETRY mode %d\n", retry_mode);
  
-@@ -1680,12 +1735,11 @@ static int nand_do_read_ops(struct mtd_i
+@@ -1685,12 +1740,11 @@ static int nand_do_read_ops(struct mtd_i
  			    struct mtd_oob_ops *ops)
  {
  	int chipnr, page, realpage, col, bytes, aligned, oob_required;
@@ -2326,7 +2326,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	uint8_t *bufpoi, *oob, *buf;
  	int use_bufpoi;
-@@ -1772,7 +1826,7 @@ read_retry:
+@@ -1777,7 +1831,7 @@ read_retry:
  				int toread = min(oobreadlen, max_oobsize);
  
  				if (toread) {
@@ -2335,7 +2335,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  						oob, ops, toread);
  					oobreadlen -= toread;
  				}
-@@ -2025,7 +2079,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2030,7 +2084,7 @@ static int nand_do_read_oob(struct mtd_i
  {
  	unsigned int max_bitflips = 0;
  	int page, realpage, chipnr;
@@ -2344,7 +2344,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	struct mtd_ecc_stats stats;
  	int readlen = ops->ooblen;
  	int len;
-@@ -2037,10 +2091,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2042,10 +2096,7 @@ static int nand_do_read_oob(struct mtd_i
  
  	stats = mtd->ecc_stats;
  
@@ -2356,7 +2356,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (unlikely(ops->ooboffs >= len)) {
  		pr_debug("%s: attempt to start read outside oob\n",
-@@ -2074,7 +2125,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2079,7 +2130,7 @@ static int nand_do_read_oob(struct mtd_i
  			break;
  
  		len = min(len, readlen);
@@ -2365,7 +2365,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  		if (chip->options & NAND_NEED_READRDY) {
  			/* Apply delay or wait for ready/busy pin */
-@@ -2235,19 +2286,20 @@ static int nand_write_page_swecc(struct
+@@ -2240,19 +2291,20 @@ static int nand_write_page_swecc(struct
  				 const uint8_t *buf, int oob_required,
  				 int page)
  {
@@ -2390,7 +2390,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	return chip->ecc.write_page_raw(mtd, chip, buf, 1, page);
  }
-@@ -2264,12 +2316,11 @@ static int nand_write_page_hwecc(struct
+@@ -2269,12 +2321,11 @@ static int nand_write_page_hwecc(struct
  				  const uint8_t *buf, int oob_required,
  				  int page)
  {
@@ -2404,7 +2404,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
  		chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
-@@ -2277,8 +2328,10 @@ static int nand_write_page_hwecc(struct
+@@ -2282,8 +2333,10 @@ static int nand_write_page_hwecc(struct
  		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  	}
  
@@ -2417,7 +2417,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
  
-@@ -2306,11 +2359,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2311,11 +2364,10 @@ static int nand_write_subpage_hwecc(stru
  	int ecc_size      = chip->ecc.size;
  	int ecc_bytes     = chip->ecc.bytes;
  	int ecc_steps     = chip->ecc.steps;
@@ -2430,7 +2430,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	for (step = 0; step < ecc_steps; step++) {
  		/* configure controller for WRITE access */
-@@ -2338,8 +2390,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2343,8 +2395,10 @@ static int nand_write_subpage_hwecc(stru
  	/* copy calculated ECC for whole page to chip->buffer->oob */
  	/* this include masked-value(0xFF) for unwritten subpages */
  	ecc_calc = chip->buffers->ecccalc;
@@ -2443,7 +2443,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* write OOB buffer to NAND device */
  	chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
-@@ -2475,7 +2529,8 @@ static int nand_write_page(struct mtd_in
+@@ -2480,7 +2534,8 @@ static int nand_write_page(struct mtd_in
  static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
  			      struct mtd_oob_ops *ops)
  {
@@ -2453,7 +2453,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/*
  	 * Initialise to all 0xFF, to avoid the possibility of left over OOB
-@@ -2490,31 +2545,12 @@ static uint8_t *nand_fill_oob(struct mtd
+@@ -2495,31 +2550,12 @@ static uint8_t *nand_fill_oob(struct mtd
  		memcpy(chip->oob_poi + ops->ooboffs, oob, len);
  		return oob + len;
  
@@ -2491,7 +2491,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	default:
  		BUG();
  	}
-@@ -2535,12 +2571,11 @@ static int nand_do_write_ops(struct mtd_
+@@ -2540,12 +2576,11 @@ static int nand_do_write_ops(struct mtd_
  			     struct mtd_oob_ops *ops)
  {
  	int chipnr, realpage, page, blockmask, column;
@@ -2506,7 +2506,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	uint8_t *oob = ops->oobbuf;
  	uint8_t *buf = ops->datbuf;
-@@ -2665,7 +2700,7 @@ err_out:
+@@ -2670,7 +2705,7 @@ err_out:
  static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
  			    size_t *retlen, const uint8_t *buf)
  {
@@ -2515,7 +2515,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	int chipnr = (int)(to >> chip->chip_shift);
  	struct mtd_oob_ops ops;
  	int ret;
-@@ -2728,15 +2763,12 @@ static int nand_do_write_oob(struct mtd_
+@@ -2733,15 +2768,12 @@ static int nand_do_write_oob(struct mtd_
  			     struct mtd_oob_ops *ops)
  {
  	int chipnr, page, status, len;
@@ -2533,7 +2533,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Do not allow write past end of page */
  	if ((ops->ooboffs + ops->ooblen) > len) {
-@@ -2853,7 +2885,7 @@ out:
+@@ -2858,7 +2890,7 @@ out:
   */
  static int single_erase(struct mtd_info *mtd, int page)
  {
@@ -2542,7 +2542,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	/* Send commands to erase a block */
  	chip->cmdfunc(mtd, NAND_CMD_ERASE1, -1, page);
  	chip->cmdfunc(mtd, NAND_CMD_ERASE2, -1, -1);
-@@ -2885,7 +2917,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2890,7 +2922,7 @@ int nand_erase_nand(struct mtd_info *mtd
  		    int allowbbt)
  {
  	int page, status, pages_per_block, ret, chipnr;
@@ -2551,7 +2551,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	loff_t len;
  
  	pr_debug("%s: start = 0x%012llx, len = %llu\n",
-@@ -2924,7 +2956,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2929,7 +2961,7 @@ int nand_erase_nand(struct mtd_info *mtd
  	while (len) {
  		/* Check if we have a bad block, we do not erase bad blocks! */
  		if (nand_block_checkbad(mtd, ((loff_t) page) <<
@@ -2560,7 +2560,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			pr_warn("%s: attempt to erase a bad block at page 0x%08x\n",
  				    __func__, page);
  			instr->state = MTD_ERASE_FAILED;
-@@ -3011,7 +3043,20 @@ static void nand_sync(struct mtd_info *m
+@@ -3016,7 +3048,20 @@ static void nand_sync(struct mtd_info *m
   */
  static int nand_block_isbad(struct mtd_info *mtd, loff_t offs)
  {
@@ -2582,7 +2582,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  }
  
  /**
-@@ -3100,7 +3145,7 @@ static int nand_suspend(struct mtd_info
+@@ -3105,7 +3150,7 @@ static int nand_suspend(struct mtd_info
   */
  static void nand_resume(struct mtd_info *mtd)
  {
@@ -2591,7 +2591,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (chip->state == FL_PM_SUSPENDED)
  		nand_release_device(mtd);
-@@ -3272,7 +3317,7 @@ ext_out:
+@@ -3277,7 +3322,7 @@ ext_out:
  
  static int nand_setup_read_retry_micron(struct mtd_info *mtd, int retry_mode)
  {
@@ -2600,7 +2600,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {retry_mode};
  
  	return chip->onfi_set_features(mtd, chip, ONFI_FEATURE_ADDR_READ_RETRY,
-@@ -3943,10 +3988,13 @@ ident_done:
+@@ -3948,10 +3993,13 @@ ident_done:
  	return type;
  }
  
@@ -2617,7 +2617,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (of_get_nand_bus_width(dn) == 16)
  		chip->options |= NAND_BUSWIDTH_16;
-@@ -3955,6 +4003,7 @@ static int nand_dt_init(struct mtd_info
+@@ -3960,6 +4008,7 @@ static int nand_dt_init(struct mtd_info
  		chip->bbt_options |= NAND_BBT_USE_FLASH;
  
  	ecc_mode = of_get_nand_ecc_mode(dn);
@@ -2625,7 +2625,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	ecc_strength = of_get_nand_ecc_strength(dn);
  	ecc_step = of_get_nand_ecc_step_size(dn);
  
-@@ -3967,6 +4016,9 @@ static int nand_dt_init(struct mtd_info
+@@ -3972,6 +4021,9 @@ static int nand_dt_init(struct mtd_info
  	if (ecc_mode >= 0)
  		chip->ecc.mode = ecc_mode;
  
@@ -2635,7 +2635,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	if (ecc_strength >= 0)
  		chip->ecc.strength = ecc_strength;
  
-@@ -3990,15 +4042,16 @@ int nand_scan_ident(struct mtd_info *mtd
+@@ -3995,15 +4047,16 @@ int nand_scan_ident(struct mtd_info *mtd
  		    struct nand_flash_dev *table)
  {
  	int i, nand_maf_id, nand_dev_id;
@@ -2658,7 +2658,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (!mtd->name && mtd->dev.parent)
  		mtd->name = dev_name(mtd->dev.parent);
-@@ -4061,7 +4114,7 @@ EXPORT_SYMBOL(nand_scan_ident);
+@@ -4066,7 +4119,7 @@ EXPORT_SYMBOL(nand_scan_ident);
   */
  static bool nand_ecc_strength_good(struct mtd_info *mtd)
  {
@@ -2667,7 +2667,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	struct nand_ecc_ctrl *ecc = &chip->ecc;
  	int corr, ds_corr;
  
-@@ -4089,10 +4142,10 @@ static bool nand_ecc_strength_good(struc
+@@ -4094,10 +4147,10 @@ static bool nand_ecc_strength_good(struc
   */
  int nand_scan_tail(struct mtd_info *mtd)
  {
@@ -2680,7 +2680,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* New bad blocks should be marked in OOB, flash-based BBT, or both */
  	BUG_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
-@@ -4119,19 +4172,15 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4124,19 +4177,15 @@ int nand_scan_tail(struct mtd_info *mtd)
  	/*
  	 * If no default placement scheme is given, select an appropriate one.
  	 */
@@ -2703,7 +2703,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			break;
  		default:
  			pr_warn("No oob scheme defined for oobsize %d\n",
-@@ -4174,7 +4223,7 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4179,7 +4228,7 @@ int nand_scan_tail(struct mtd_info *mtd)
  			ecc->write_oob = nand_write_oob_std;
  		if (!ecc->read_subpage)
  			ecc->read_subpage = nand_read_subpage;
@@ -2712,7 +2712,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			ecc->write_subpage = nand_write_subpage_hwecc;
  
  	case NAND_ECC_HW_SYNDROME:
-@@ -4252,10 +4301,8 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4257,10 +4306,8 @@ int nand_scan_tail(struct mtd_info *mtd)
  		}
  
  		/* See nand_bch_init() for details. */
@@ -2725,7 +2725,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (!ecc->priv) {
  			pr_warn("BCH ECC initialization failed!\n");
  			BUG();
-@@ -4286,20 +4333,9 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4291,20 +4338,9 @@ int nand_scan_tail(struct mtd_info *mtd)
  	if (!ecc->write_oob_raw)
  		ecc->write_oob_raw = ecc->write_oob;
  
@@ -2749,7 +2749,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/*
  	 * Set the number of read / write steps for one page depending on ECC
-@@ -4312,6 +4348,21 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4317,6 +4353,21 @@ int nand_scan_tail(struct mtd_info *mtd)
  	}
  	ecc->total = ecc->steps * ecc->bytes;
  
@@ -2771,7 +2771,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	/* Allow subpage writes up to ecc.steps. Not possible for MLC flash */
  	if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && nand_is_slc(chip)) {
  		switch (ecc->steps) {
-@@ -4368,10 +4419,6 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4373,10 +4424,6 @@ int nand_scan_tail(struct mtd_info *mtd)
  	mtd->_block_markbad = nand_block_markbad;
  	mtd->writebufsize = mtd->writesize;
  
@@ -2782,7 +2782,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	/*
  	 * Initialize bitflip_threshold to its default prior scan_bbt() call.
  	 * scan_bbt() might invoke mtd_read(), thus bitflip_threshold must be
-@@ -4427,7 +4474,7 @@ EXPORT_SYMBOL(nand_scan);
+@@ -4432,7 +4479,7 @@ EXPORT_SYMBOL(nand_scan);
   */
  void nand_release(struct mtd_info *mtd)
  {
diff --git a/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch b/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
index f1f4971b3d..5edd9c3639 100644
--- a/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
+++ b/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
@@ -1954,7 +1954,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	int ctrl = NAND_CTRL_CLE | NAND_CTRL_CHANGE;
  
  	/* Write out the command to the device */
-@@ -708,7 +733,7 @@ static void nand_command(struct mtd_info
+@@ -710,7 +735,7 @@ static void nand_command(struct mtd_info
  static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
  			    int column, int page_addr)
  {
@@ -1963,7 +1963,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Emulate NAND_CMD_READOOB */
  	if (command == NAND_CMD_READOOB) {
-@@ -832,7 +857,7 @@ static void panic_nand_get_device(struct
+@@ -837,7 +862,7 @@ static void panic_nand_get_device(struct
  static int
  nand_get_device(struct mtd_info *mtd, int new_state)
  {
@@ -1972,7 +1972,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	spinlock_t *lock = &chip->controller->lock;
  	wait_queue_head_t *wq = &chip->controller->wq;
  	DECLARE_WAITQUEUE(wait, current);
-@@ -952,7 +977,7 @@ static int __nand_unlock(struct mtd_info
+@@ -957,7 +982,7 @@ static int __nand_unlock(struct mtd_info
  {
  	int ret = 0;
  	int status, page;
@@ -1981,7 +1981,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Submit address of first page to unlock */
  	page = ofs >> chip->page_shift;
-@@ -987,7 +1012,7 @@ int nand_unlock(struct mtd_info *mtd, lo
+@@ -992,7 +1017,7 @@ int nand_unlock(struct mtd_info *mtd, lo
  {
  	int ret = 0;
  	int chipnr;
@@ -1990,7 +1990,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	pr_debug("%s: start = 0x%012llx, len = %llu\n",
  			__func__, (unsigned long long)ofs, len);
-@@ -1050,7 +1075,7 @@ int nand_lock(struct mtd_info *mtd, loff
+@@ -1055,7 +1080,7 @@ int nand_lock(struct mtd_info *mtd, loff
  {
  	int ret = 0;
  	int chipnr, status, page;
@@ -1999,7 +1999,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	pr_debug("%s: start = 0x%012llx, len = %llu\n",
  			__func__, (unsigned long long)ofs, len);
-@@ -1309,13 +1334,12 @@ static int nand_read_page_raw_syndrome(s
+@@ -1314,13 +1339,12 @@ static int nand_read_page_raw_syndrome(s
  static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
  				uint8_t *buf, int oob_required, int page)
  {
@@ -2014,7 +2014,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	unsigned int max_bitflips = 0;
  
  	chip->ecc.read_page_raw(mtd, chip, buf, 1, page);
-@@ -1323,8 +1347,10 @@ static int nand_read_page_swecc(struct m
+@@ -1328,8 +1352,10 @@ static int nand_read_page_swecc(struct m
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
  		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  
@@ -2027,7 +2027,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	eccsteps = chip->ecc.steps;
  	p = buf;
-@@ -1356,14 +1382,14 @@ static int nand_read_subpage(struct mtd_
+@@ -1361,14 +1387,14 @@ static int nand_read_subpage(struct mtd_
  			uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi,
  			int page)
  {
@@ -2045,7 +2045,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Column address within the page aligned to ECC size (256bytes) */
  	start_step = data_offs / chip->ecc.size;
-@@ -1391,12 +1417,13 @@ static int nand_read_subpage(struct mtd_
+@@ -1396,12 +1422,13 @@ static int nand_read_subpage(struct mtd_
  	 * The performance is faster if we position offsets according to
  	 * ecc.pos. Let's make sure that there are no gaps in ECC positions.
  	 */
@@ -2065,7 +2065,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	if (gaps) {
  		chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
  		chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-@@ -1405,20 +1432,23 @@ static int nand_read_subpage(struct mtd_
+@@ -1410,20 +1437,23 @@ static int nand_read_subpage(struct mtd_
  		 * Send the command to read the particular ECC bytes take care
  		 * about buswidth alignment in read_buf.
  		 */
@@ -2095,7 +2095,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	p = bufpoi + data_col_addr;
  	for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) {
-@@ -1426,6 +1456,16 @@ static int nand_read_subpage(struct mtd_
+@@ -1431,6 +1461,16 @@ static int nand_read_subpage(struct mtd_
  
  		stat = chip->ecc.correct(mtd, p,
  			&chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
@@ -2112,7 +2112,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (stat < 0) {
  			mtd->ecc_stats.failed++;
  		} else {
-@@ -1449,13 +1489,12 @@ static int nand_read_subpage(struct mtd_
+@@ -1454,13 +1494,12 @@ static int nand_read_subpage(struct mtd_
  static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
  				uint8_t *buf, int oob_required, int page)
  {
@@ -2127,7 +2127,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	unsigned int max_bitflips = 0;
  
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
-@@ -1465,8 +1504,10 @@ static int nand_read_page_hwecc(struct m
+@@ -1470,8 +1509,10 @@ static int nand_read_page_hwecc(struct m
  	}
  	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  
@@ -2140,7 +2140,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	eccsteps = chip->ecc.steps;
  	p = buf;
-@@ -1475,6 +1516,15 @@ static int nand_read_page_hwecc(struct m
+@@ -1480,6 +1521,15 @@ static int nand_read_page_hwecc(struct m
  		int stat;
  
  		stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
@@ -2156,7 +2156,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (stat < 0) {
  			mtd->ecc_stats.failed++;
  		} else {
-@@ -1502,12 +1552,11 @@ static int nand_read_page_hwecc(struct m
+@@ -1507,12 +1557,11 @@ static int nand_read_page_hwecc(struct m
  static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
  	struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
  {
@@ -2170,7 +2170,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	uint8_t *ecc_calc = chip->buffers->ecccalc;
  	unsigned int max_bitflips = 0;
  
-@@ -1516,8 +1565,10 @@ static int nand_read_page_hwecc_oob_firs
+@@ -1521,8 +1570,10 @@ static int nand_read_page_hwecc_oob_firs
  	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  	chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
  
@@ -2183,7 +2183,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
  		int stat;
-@@ -1527,6 +1578,15 @@ static int nand_read_page_hwecc_oob_firs
+@@ -1532,6 +1583,15 @@ static int nand_read_page_hwecc_oob_firs
  		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  
  		stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL);
@@ -2199,7 +2199,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (stat < 0) {
  			mtd->ecc_stats.failed++;
  		} else {
-@@ -1554,6 +1614,7 @@ static int nand_read_page_syndrome(struc
+@@ -1559,6 +1619,7 @@ static int nand_read_page_syndrome(struc
  	int i, eccsize = chip->ecc.size;
  	int eccbytes = chip->ecc.bytes;
  	int eccsteps = chip->ecc.steps;
@@ -2207,7 +2207,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	uint8_t *p = buf;
  	uint8_t *oob = chip->oob_poi;
  	unsigned int max_bitflips = 0;
-@@ -1573,19 +1634,29 @@ static int nand_read_page_syndrome(struc
+@@ -1578,19 +1639,29 @@ static int nand_read_page_syndrome(struc
  		chip->read_buf(mtd, oob, eccbytes);
  		stat = chip->ecc.correct(mtd, p, oob, NULL);
  
@@ -2244,7 +2244,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	}
  
  	/* Calculate remaining oob bytes */
-@@ -1598,14 +1669,17 @@ static int nand_read_page_syndrome(struc
+@@ -1603,14 +1674,17 @@ static int nand_read_page_syndrome(struc
  
  /**
   * nand_transfer_oob - [INTERN] Transfer oob to client buffer
@@ -2264,7 +2264,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	switch (ops->mode) {
  
  	case MTD_OPS_PLACE_OOB:
-@@ -1613,31 +1687,12 @@ static uint8_t *nand_transfer_oob(struct
+@@ -1618,31 +1692,12 @@ static uint8_t *nand_transfer_oob(struct
  		memcpy(oob, chip->oob_poi + ops->ooboffs, len);
  		return oob + len;
  
@@ -2302,7 +2302,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	default:
  		BUG();
  	}
-@@ -1655,7 +1710,7 @@ static uint8_t *nand_transfer_oob(struct
+@@ -1660,7 +1715,7 @@ static uint8_t *nand_transfer_oob(struct
   */
  static int nand_setup_read_retry(struct mtd_info *mtd, int retry_mode)
  {
@@ -2311,7 +2311,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	pr_debug("setting READ RETRY mode %d\n", retry_mode);
  
-@@ -1680,12 +1735,11 @@ static int nand_do_read_ops(struct mtd_i
+@@ -1685,12 +1740,11 @@ static int nand_do_read_ops(struct mtd_i
  			    struct mtd_oob_ops *ops)
  {
  	int chipnr, page, realpage, col, bytes, aligned, oob_required;
@@ -2326,7 +2326,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	uint8_t *bufpoi, *oob, *buf;
  	int use_bufpoi;
-@@ -1772,7 +1826,7 @@ read_retry:
+@@ -1777,7 +1831,7 @@ read_retry:
  				int toread = min(oobreadlen, max_oobsize);
  
  				if (toread) {
@@ -2335,7 +2335,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  						oob, ops, toread);
  					oobreadlen -= toread;
  				}
-@@ -2025,7 +2079,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2030,7 +2084,7 @@ static int nand_do_read_oob(struct mtd_i
  {
  	unsigned int max_bitflips = 0;
  	int page, realpage, chipnr;
@@ -2344,7 +2344,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	struct mtd_ecc_stats stats;
  	int readlen = ops->ooblen;
  	int len;
-@@ -2037,10 +2091,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2042,10 +2096,7 @@ static int nand_do_read_oob(struct mtd_i
  
  	stats = mtd->ecc_stats;
  
@@ -2356,7 +2356,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (unlikely(ops->ooboffs >= len)) {
  		pr_debug("%s: attempt to start read outside oob\n",
-@@ -2074,7 +2125,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2079,7 +2130,7 @@ static int nand_do_read_oob(struct mtd_i
  			break;
  
  		len = min(len, readlen);
@@ -2365,7 +2365,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  		if (chip->options & NAND_NEED_READRDY) {
  			/* Apply delay or wait for ready/busy pin */
-@@ -2235,19 +2286,20 @@ static int nand_write_page_swecc(struct
+@@ -2240,19 +2291,20 @@ static int nand_write_page_swecc(struct
  				 const uint8_t *buf, int oob_required,
  				 int page)
  {
@@ -2390,7 +2390,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	return chip->ecc.write_page_raw(mtd, chip, buf, 1, page);
  }
-@@ -2264,12 +2316,11 @@ static int nand_write_page_hwecc(struct
+@@ -2269,12 +2321,11 @@ static int nand_write_page_hwecc(struct
  				  const uint8_t *buf, int oob_required,
  				  int page)
  {
@@ -2404,7 +2404,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
  		chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
-@@ -2277,8 +2328,10 @@ static int nand_write_page_hwecc(struct
+@@ -2282,8 +2333,10 @@ static int nand_write_page_hwecc(struct
  		chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  	}
  
@@ -2417,7 +2417,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
  
-@@ -2306,11 +2359,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2311,11 +2364,10 @@ static int nand_write_subpage_hwecc(stru
  	int ecc_size      = chip->ecc.size;
  	int ecc_bytes     = chip->ecc.bytes;
  	int ecc_steps     = chip->ecc.steps;
@@ -2430,7 +2430,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	for (step = 0; step < ecc_steps; step++) {
  		/* configure controller for WRITE access */
-@@ -2338,8 +2390,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2343,8 +2395,10 @@ static int nand_write_subpage_hwecc(stru
  	/* copy calculated ECC for whole page to chip->buffer->oob */
  	/* this include masked-value(0xFF) for unwritten subpages */
  	ecc_calc = chip->buffers->ecccalc;
@@ -2443,7 +2443,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* write OOB buffer to NAND device */
  	chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
-@@ -2475,7 +2529,8 @@ static int nand_write_page(struct mtd_in
+@@ -2480,7 +2534,8 @@ static int nand_write_page(struct mtd_in
  static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
  			      struct mtd_oob_ops *ops)
  {
@@ -2453,7 +2453,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/*
  	 * Initialise to all 0xFF, to avoid the possibility of left over OOB
-@@ -2490,31 +2545,12 @@ static uint8_t *nand_fill_oob(struct mtd
+@@ -2495,31 +2550,12 @@ static uint8_t *nand_fill_oob(struct mtd
  		memcpy(chip->oob_poi + ops->ooboffs, oob, len);
  		return oob + len;
  
@@ -2491,7 +2491,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	default:
  		BUG();
  	}
-@@ -2535,12 +2571,11 @@ static int nand_do_write_ops(struct mtd_
+@@ -2540,12 +2576,11 @@ static int nand_do_write_ops(struct mtd_
  			     struct mtd_oob_ops *ops)
  {
  	int chipnr, realpage, page, blockmask, column;
@@ -2506,7 +2506,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	uint8_t *oob = ops->oobbuf;
  	uint8_t *buf = ops->datbuf;
-@@ -2665,7 +2700,7 @@ err_out:
+@@ -2670,7 +2705,7 @@ err_out:
  static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
  			    size_t *retlen, const uint8_t *buf)
  {
@@ -2515,7 +2515,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	int chipnr = (int)(to >> chip->chip_shift);
  	struct mtd_oob_ops ops;
  	int ret;
-@@ -2728,15 +2763,12 @@ static int nand_do_write_oob(struct mtd_
+@@ -2733,15 +2768,12 @@ static int nand_do_write_oob(struct mtd_
  			     struct mtd_oob_ops *ops)
  {
  	int chipnr, page, status, len;
@@ -2533,7 +2533,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* Do not allow write past end of page */
  	if ((ops->ooboffs + ops->ooblen) > len) {
-@@ -2853,7 +2885,7 @@ out:
+@@ -2858,7 +2890,7 @@ out:
   */
  static int single_erase(struct mtd_info *mtd, int page)
  {
@@ -2542,7 +2542,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	/* Send commands to erase a block */
  	chip->cmdfunc(mtd, NAND_CMD_ERASE1, -1, page);
  	chip->cmdfunc(mtd, NAND_CMD_ERASE2, -1, -1);
-@@ -2885,7 +2917,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2890,7 +2922,7 @@ int nand_erase_nand(struct mtd_info *mtd
  		    int allowbbt)
  {
  	int page, status, pages_per_block, ret, chipnr;
@@ -2551,7 +2551,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	loff_t len;
  
  	pr_debug("%s: start = 0x%012llx, len = %llu\n",
-@@ -2924,7 +2956,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2929,7 +2961,7 @@ int nand_erase_nand(struct mtd_info *mtd
  	while (len) {
  		/* Check if we have a bad block, we do not erase bad blocks! */
  		if (nand_block_checkbad(mtd, ((loff_t) page) <<
@@ -2560,7 +2560,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			pr_warn("%s: attempt to erase a bad block at page 0x%08x\n",
  				    __func__, page);
  			instr->state = MTD_ERASE_FAILED;
-@@ -3011,7 +3043,20 @@ static void nand_sync(struct mtd_info *m
+@@ -3016,7 +3048,20 @@ static void nand_sync(struct mtd_info *m
   */
  static int nand_block_isbad(struct mtd_info *mtd, loff_t offs)
  {
@@ -2582,7 +2582,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  }
  
  /**
-@@ -3100,7 +3145,7 @@ static int nand_suspend(struct mtd_info
+@@ -3105,7 +3150,7 @@ static int nand_suspend(struct mtd_info
   */
  static void nand_resume(struct mtd_info *mtd)
  {
@@ -2591,7 +2591,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (chip->state == FL_PM_SUSPENDED)
  		nand_release_device(mtd);
-@@ -3272,7 +3317,7 @@ ext_out:
+@@ -3277,7 +3322,7 @@ ext_out:
  
  static int nand_setup_read_retry_micron(struct mtd_info *mtd, int retry_mode)
  {
@@ -2600,7 +2600,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {retry_mode};
  
  	return chip->onfi_set_features(mtd, chip, ONFI_FEATURE_ADDR_READ_RETRY,
-@@ -3943,10 +3988,13 @@ ident_done:
+@@ -3948,10 +3993,13 @@ ident_done:
  	return type;
  }
  
@@ -2617,7 +2617,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (of_get_nand_bus_width(dn) == 16)
  		chip->options |= NAND_BUSWIDTH_16;
-@@ -3955,6 +4003,7 @@ static int nand_dt_init(struct mtd_info
+@@ -3960,6 +4008,7 @@ static int nand_dt_init(struct mtd_info
  		chip->bbt_options |= NAND_BBT_USE_FLASH;
  
  	ecc_mode = of_get_nand_ecc_mode(dn);
@@ -2625,7 +2625,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	ecc_strength = of_get_nand_ecc_strength(dn);
  	ecc_step = of_get_nand_ecc_step_size(dn);
  
-@@ -3967,6 +4016,9 @@ static int nand_dt_init(struct mtd_info
+@@ -3972,6 +4021,9 @@ static int nand_dt_init(struct mtd_info
  	if (ecc_mode >= 0)
  		chip->ecc.mode = ecc_mode;
  
@@ -2635,7 +2635,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	if (ecc_strength >= 0)
  		chip->ecc.strength = ecc_strength;
  
-@@ -3990,15 +4042,16 @@ int nand_scan_ident(struct mtd_info *mtd
+@@ -3995,15 +4047,16 @@ int nand_scan_ident(struct mtd_info *mtd
  		    struct nand_flash_dev *table)
  {
  	int i, nand_maf_id, nand_dev_id;
@@ -2658,7 +2658,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	if (!mtd->name && mtd->dev.parent)
  		mtd->name = dev_name(mtd->dev.parent);
-@@ -4061,7 +4114,7 @@ EXPORT_SYMBOL(nand_scan_ident);
+@@ -4066,7 +4119,7 @@ EXPORT_SYMBOL(nand_scan_ident);
   */
  static bool nand_ecc_strength_good(struct mtd_info *mtd)
  {
@@ -2667,7 +2667,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	struct nand_ecc_ctrl *ecc = &chip->ecc;
  	int corr, ds_corr;
  
-@@ -4089,10 +4142,10 @@ static bool nand_ecc_strength_good(struc
+@@ -4094,10 +4147,10 @@ static bool nand_ecc_strength_good(struc
   */
  int nand_scan_tail(struct mtd_info *mtd)
  {
@@ -2680,7 +2680,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/* New bad blocks should be marked in OOB, flash-based BBT, or both */
  	BUG_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
-@@ -4119,19 +4172,15 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4124,19 +4177,15 @@ int nand_scan_tail(struct mtd_info *mtd)
  	/*
  	 * If no default placement scheme is given, select an appropriate one.
  	 */
@@ -2703,7 +2703,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			break;
  		default:
  			pr_warn("No oob scheme defined for oobsize %d\n",
-@@ -4174,7 +4223,7 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4179,7 +4228,7 @@ int nand_scan_tail(struct mtd_info *mtd)
  			ecc->write_oob = nand_write_oob_std;
  		if (!ecc->read_subpage)
  			ecc->read_subpage = nand_read_subpage;
@@ -2712,7 +2712,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			ecc->write_subpage = nand_write_subpage_hwecc;
  
  	case NAND_ECC_HW_SYNDROME:
-@@ -4252,10 +4301,8 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4257,10 +4306,8 @@ int nand_scan_tail(struct mtd_info *mtd)
  		}
  
  		/* See nand_bch_init() for details. */
@@ -2725,7 +2725,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  		if (!ecc->priv) {
  			pr_warn("BCH ECC initialization failed!\n");
  			BUG();
-@@ -4286,20 +4333,9 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4291,20 +4338,9 @@ int nand_scan_tail(struct mtd_info *mtd)
  	if (!ecc->write_oob_raw)
  		ecc->write_oob_raw = ecc->write_oob;
  
@@ -2749,7 +2749,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  	/*
  	 * Set the number of read / write steps for one page depending on ECC
-@@ -4312,6 +4348,21 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4317,6 +4353,21 @@ int nand_scan_tail(struct mtd_info *mtd)
  	}
  	ecc->total = ecc->steps * ecc->bytes;
  
@@ -2771,7 +2771,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	/* Allow subpage writes up to ecc.steps. Not possible for MLC flash */
  	if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && nand_is_slc(chip)) {
  		switch (ecc->steps) {
-@@ -4368,10 +4419,6 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4373,10 +4424,6 @@ int nand_scan_tail(struct mtd_info *mtd)
  	mtd->_block_markbad = nand_block_markbad;
  	mtd->writebufsize = mtd->writesize;
  
@@ -2782,7 +2782,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  	/*
  	 * Initialize bitflip_threshold to its default prior scan_bbt() call.
  	 * scan_bbt() might invoke mtd_read(), thus bitflip_threshold must be
-@@ -4427,7 +4474,7 @@ EXPORT_SYMBOL(nand_scan);
+@@ -4432,7 +4479,7 @@ EXPORT_SYMBOL(nand_scan);
   */
  void nand_release(struct mtd_info *mtd)
  {
diff --git a/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch b/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch
index 8ff28b3bc2..2a98c39a21 100644
--- a/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch
+++ b/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch
@@ -87,7 +87,7 @@  Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  	}
 --- a/drivers/mtd/nand/nand_base.c
 +++ b/drivers/mtd/nand/nand_base.c
-@@ -3208,8 +3208,7 @@ static void nand_set_defaults(struct nan
+@@ -3213,8 +3213,7 @@ static void nand_set_defaults(struct nan
  
  	if (!chip->controller) {
  		chip->controller = &chip->hwcontrol;
diff --git a/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch b/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch
index e77e02f677..10ce2451da 100644
--- a/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch
+++ b/target/linux/ramips/patches-4.4/0032-USB-dwc2-add-device_reset.patch
@@ -18,7 +18,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
  #include <linux/usb/hcd.h>
  #include <linux/usb/ch11.h>
-@@ -3002,6 +3003,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso
+@@ -3003,6 +3004,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso
  
  	retval = -ENOMEM;
  
diff --git a/target/linux/ramips/patches-4.4/0039-mtd-add-mt7621-nand-support.patch b/target/linux/ramips/patches-4.4/0039-mtd-add-mt7621-nand-support.patch
index 7bb996af51..7cba939ca6 100644
--- a/target/linux/ramips/patches-4.4/0039-mtd-add-mt7621-nand-support.patch
+++ b/target/linux/ramips/patches-4.4/0039-mtd-add-mt7621-nand-support.patch
@@ -4078,7 +4078,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  {
  	struct nand_chip *chip = mtd->priv;
  
-@@ -829,7 +829,7 @@ static void panic_nand_get_device(struct
+@@ -834,7 +834,7 @@ static void panic_nand_get_device(struct
   *
   * Get the device and lock it for exclusive access
   */
diff --git a/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch b/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch
index 7c4570486c..9608f6c52e 100644
--- a/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch
+++ b/target/linux/ramips/patches-4.4/0040-nand-add-mtk-nand-hack-hook.patch
@@ -100,7 +100,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  
 --- a/drivers/mtd/nand/nand_base.c
 +++ b/drivers/mtd/nand/nand_base.c
-@@ -1727,6 +1727,9 @@ static int nand_do_read_ops(struct mtd_i
+@@ -1732,6 +1732,9 @@ static int nand_do_read_ops(struct mtd_i
  						 __func__, buf);
  
  read_retry:
@@ -110,7 +110,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
  
  			/*
-@@ -1745,6 +1748,7 @@ read_retry:
+@@ -1750,6 +1753,7 @@ read_retry:
  			else
  				ret = chip->ecc.read_page(mtd, chip, bufpoi,
  							  oob_required, page);
@@ -118,7 +118,7 @@  Signed-off-by: John Crispin <blogic@openwrt.org>
  			if (ret < 0) {
  				if (use_bufpoi)
  					/* Invalidate page cache */
-@@ -2938,8 +2942,11 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2943,8 +2947,11 @@ int nand_erase_nand(struct mtd_info *mtd
  		if (page <= chip->pagebuf && chip->pagebuf <
  		    (page + pages_per_block))
  			chip->pagebuf = -1;
diff --git a/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch b/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch
index 56c8342e99..a023284a4d 100644
--- a/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch
+++ b/target/linux/ramips/patches-4.4/0901-spansion_nand_id_fix.patch
@@ -13,7 +13,7 @@  Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
 
 --- a/drivers/mtd/nand/nand_base.c
 +++ b/drivers/mtd/nand/nand_base.c
-@@ -3574,6 +3574,7 @@ static void nand_decode_ext_id(struct mt
+@@ -3579,6 +3579,7 @@ static void nand_decode_ext_id(struct mt
  	/*
  	 * Field definitions are in the following datasheets:
  	 * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32)
@@ -21,7 +21,7 @@  Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
  	 * New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44)
  	 * Hynix MLC   (6 byte ID): Hynix H27UBG8T2B (p.22)
  	 *
-@@ -3671,6 +3672,19 @@ static void nand_decode_ext_id(struct mt
+@@ -3676,6 +3677,19 @@ static void nand_decode_ext_id(struct mt
  		*busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;
  
  		/*