diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 3e9ddaa81e..17219f6c3f 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -4,12 +4,12 @@ LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .71
 LINUX_VERSION-4.4 = .121
-LINUX_VERSION-4.9 = .91
+LINUX_VERSION-4.9 = .95
 LINUX_VERSION-4.14 = .34
 
 LINUX_KERNEL_HASH-3.18.71 = 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
 LINUX_KERNEL_HASH-4.4.121 = 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729
-LINUX_KERNEL_HASH-4.9.91 = 60caa752ec9fa1c426f6a2f37db3f268d0961b67a723b6443949112167b39832
+LINUX_KERNEL_HASH-4.9.95 = 9e5a6d27c26d0f978c573449be34d9a3b984e9e6617d1b3f0498d06fb6319ff4
 LINUX_KERNEL_HASH-4.14.34 = 782b6c4c85275c382c820e1934d3e6003ef468f43cfc5e7c22bc07c331a12bb9
 
 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
diff --git a/target/linux/ar71xx/patches-4.9/432-spi-rb4xx-spi-driver.patch b/target/linux/ar71xx/patches-4.9/432-spi-rb4xx-spi-driver.patch
index 5428d3d1c2..e896d0bdf4 100644
--- a/target/linux/ar71xx/patches-4.9/432-spi-rb4xx-spi-driver.patch
+++ b/target/linux/ar71xx/patches-4.9/432-spi-rb4xx-spi-driver.patch
@@ -1,6 +1,6 @@
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
-@@ -534,6 +534,12 @@ config SPI_QUP
+@@ -533,6 +533,12 @@ config SPI_QUP
  	  This driver can also be built as a module.  If so, the module
  	  will be called spi_qup.
  
diff --git a/target/linux/ar71xx/patches-4.9/433-spi-rb4xx-cpld-driver.patch b/target/linux/ar71xx/patches-4.9/433-spi-rb4xx-cpld-driver.patch
index b1cd6a545b..c44acab32e 100644
--- a/target/linux/ar71xx/patches-4.9/433-spi-rb4xx-cpld-driver.patch
+++ b/target/linux/ar71xx/patches-4.9/433-spi-rb4xx-cpld-driver.patch
@@ -1,6 +1,6 @@
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
-@@ -762,6 +762,13 @@ config SPI_TLE62X0
+@@ -761,6 +761,13 @@ config SPI_TLE62X0
  	  sysfs interface, with each line presented as a kind of GPIO
  	  exposing both switch control and diagnostic feedback.
  
diff --git a/target/linux/ar71xx/patches-4.9/435-spi-vsc7385_driver.patch b/target/linux/ar71xx/patches-4.9/435-spi-vsc7385_driver.patch
index fe6acde70a..f9f1f7a1e5 100644
--- a/target/linux/ar71xx/patches-4.9/435-spi-vsc7385_driver.patch
+++ b/target/linux/ar71xx/patches-4.9/435-spi-vsc7385_driver.patch
@@ -1,6 +1,6 @@
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
-@@ -769,6 +769,11 @@ config SPI_RB4XX_CPLD
+@@ -768,6 +768,11 @@ config SPI_RB4XX_CPLD
  	  SPI driver for the Xilinx CPLD chip present on the
  	  MikroTik RB4xx boards.
  
diff --git a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch
index 464a930f32..4c59876b82 100644
--- a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch
+++ b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch
@@ -267,7 +267,7 @@
  		case IPV6_2292HOPOPTS:
 --- a/net/ipv6/ip6_gre.c
 +++ b/net/ipv6/ip6_gre.c
-@@ -395,7 +395,7 @@ static void ip6gre_err(struct sk_buff *s
+@@ -397,7 +397,7 @@ static void ip6gre_err(struct sk_buff *s
  		return;
  	ipv6h = (const struct ipv6hdr *)skb->data;
  	greh = (const struct gre_base_hdr *)(skb->data + offset);
@@ -795,7 +795,7 @@
  
 --- a/net/ipv4/tcp_input.c
 +++ b/net/ipv4/tcp_input.c
-@@ -3892,14 +3892,16 @@ static bool tcp_parse_aligned_timestamp(
+@@ -3894,14 +3894,16 @@ static bool tcp_parse_aligned_timestamp(
  {
  	const __be32 *ptr = (const __be32 *)(th + 1);
  
diff --git a/target/linux/ar71xx/patches-4.9/930-chipidea-pullup.patch b/target/linux/ar71xx/patches-4.9/930-chipidea-pullup.patch
index ce31595d96..1c4ef3891c 100644
--- a/target/linux/ar71xx/patches-4.9/930-chipidea-pullup.patch
+++ b/target/linux/ar71xx/patches-4.9/930-chipidea-pullup.patch
@@ -22,7 +22,7 @@
  {
  	ci_hdrc_gadget_destroy(ci);
  	ci_hdrc_host_destroy(ci);
--	if (ci->is_otg)
+-	if (ci->is_otg && ci->roles[CI_ROLE_GADGET])
 +	if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET])
  		ci_hdrc_otg_destroy(ci);
  }
@@ -37,8 +37,8 @@
  	ret = hw_device_init(ci, base);
  	if (ret < 0) {
  		dev_err(dev, "can't initialize hardware\n");
-@@ -955,7 +958,7 @@ static int ci_hdrc_probe(struct platform
- 		goto deinit_phy;
+@@ -963,7 +966,7 @@ static int ci_hdrc_probe(struct platform
+ 		goto deinit_gadget;
  	}
  
 -	if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) {
diff --git a/target/linux/ath25/patches-4.9/130-watchdog.patch b/target/linux/ath25/patches-4.9/130-watchdog.patch
index fef3ac098a..7009dd9286 100644
--- a/target/linux/ath25/patches-4.9/130-watchdog.patch
+++ b/target/linux/ath25/patches-4.9/130-watchdog.patch
@@ -212,7 +212,7 @@
 +MODULE_ALIAS("platform:" DRIVER_NAME);
 --- a/drivers/watchdog/Kconfig
 +++ b/drivers/watchdog/Kconfig
-@@ -1554,6 +1554,13 @@ config PIC32_DMT
+@@ -1555,6 +1555,13 @@ config PIC32_DMT
  	  To compile this driver as a loadable module, choose M here.
  	  The module will be called pic32-dmt.
  
diff --git a/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch b/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
index 665c9786c7..caed9ec41d 100644
--- a/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
+++ b/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1190,6 +1190,18 @@ static const struct flash_info *spi_nor_
+@@ -1194,6 +1194,18 @@ static const struct flash_info *spi_nor_
  	}
  	dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
  		id[0], id[1], id[2]);
diff --git a/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch b/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch
index 50e1f47f6e..9f6049b6cc 100644
--- a/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch
+++ b/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch
@@ -39,7 +39,7 @@ Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
 
 --- a/drivers/usb/dwc2/hcd.c
 +++ b/drivers/usb/dwc2/hcd.c
-@@ -4366,6 +4366,9 @@ static int _dwc2_hcd_suspend(struct usb_
+@@ -4369,6 +4369,9 @@ static int _dwc2_hcd_suspend(struct usb_
  	if (!HCD_HW_ACCESSIBLE(hcd))
  		goto unlock;
  
diff --git a/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch b/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch
index 7e4ae20704..df9d434c9f 100644
--- a/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch
+++ b/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch
@@ -8,7 +8,7 @@
  
  	/*
  	 * Some really old flashes (like AT45DB*) had smaller erasesize-s, but
-@@ -269,12 +270,23 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -283,12 +284,23 @@ static int bcm47xxpart_parse(struct mtd_
  		if (buf[0] == NVRAM_HEADER) {
  			bcm47xxpart_add_part(&parts[curr_part++], "nvram",
  					     master->size - blocksize, 0);
diff --git a/target/linux/brcm47xx/patches-4.9/831-old_gpio_wdt.patch b/target/linux/brcm47xx/patches-4.9/831-old_gpio_wdt.patch
index ac71864d0c..3eb67dfd64 100644
--- a/target/linux/brcm47xx/patches-4.9/831-old_gpio_wdt.patch
+++ b/target/linux/brcm47xx/patches-4.9/831-old_gpio_wdt.patch
@@ -4,7 +4,7 @@ Signed-off-by: Mathias Adam <m.adam--openwrt@adamis.de>
 
 --- a/drivers/watchdog/Kconfig
 +++ b/drivers/watchdog/Kconfig
-@@ -1388,6 +1388,15 @@ config WDT_MTX1
+@@ -1389,6 +1389,15 @@ config WDT_MTX1
  	  Hardware driver for the MTX-1 boards. This is a watchdog timer that
  	  will reboot the machine after a 100 seconds timer expired.
  
diff --git a/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch b/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch
index 01bf7983fc..3bb486c958 100644
--- a/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch
+++ b/target/linux/generic/backport-4.9/050-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
-@@ -5185,7 +5185,6 @@ error3:
+@@ -5188,7 +5188,6 @@ error3:
  error2:
  	usb_put_hcd(hcd);
  error1:
diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch
index 477c498b2b..8d51e1b1df 100644
--- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch
+++ b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch
@@ -1095,7 +1095,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  		dma_intr_ena = smsc9420_reg_read(pd, DMAC_INTR_ENA);
 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
-@@ -2684,7 +2684,7 @@ static int stmmac_poll(struct napi_struc
+@@ -2693,7 +2693,7 @@ static int stmmac_poll(struct napi_struc
  
  	work_done = stmmac_rx(priv, budget);
  	if (work_done < budget) {
@@ -1150,7 +1150,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  	return work_done;
 --- a/drivers/net/ethernet/ti/cpsw.c
 +++ b/drivers/net/ethernet/ti/cpsw.c
-@@ -839,7 +839,7 @@ static int cpsw_rx_poll(struct napi_stru
+@@ -843,7 +843,7 @@ static int cpsw_rx_poll(struct napi_stru
  	}
  
  	if (num_rx < budget) {
diff --git a/target/linux/generic/hack-4.9/204-module_strip.patch b/target/linux/generic/hack-4.9/204-module_strip.patch
index 3dc0c88db1..c6484a8f92 100644
--- a/target/linux/generic/hack-4.9/204-module_strip.patch
+++ b/target/linux/generic/hack-4.9/204-module_strip.patch
@@ -114,7 +114,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  config MODULES_TREE_LOOKUP
 --- a/kernel/module.c
 +++ b/kernel/module.c
-@@ -2954,9 +2954,11 @@ static struct module *setup_load_info(st
+@@ -2968,9 +2968,11 @@ static struct module *setup_load_info(st
  
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  {
@@ -127,7 +127,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	if (flags & MODULE_INIT_IGNORE_VERMAGIC)
  		modmagic = NULL;
  
-@@ -2977,6 +2979,7 @@ static int check_modinfo(struct module *
+@@ -2991,6 +2993,7 @@ static int check_modinfo(struct module *
  				mod->name);
  		add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
  	}
diff --git a/target/linux/generic/hack-4.9/902-debloat_proc.patch b/target/linux/generic/hack-4.9/902-debloat_proc.patch
index 01c67c2290..ae2dad61e5 100644
--- a/target/linux/generic/hack-4.9/902-debloat_proc.patch
+++ b/target/linux/generic/hack-4.9/902-debloat_proc.patch
@@ -243,7 +243,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
 --- a/mm/vmstat.c
 +++ b/mm/vmstat.c
-@@ -1798,10 +1798,12 @@ static int __init setup_vmstat(void)
+@@ -1796,10 +1796,12 @@ static int __init setup_vmstat(void)
  	cpu_notifier_register_done();
  #endif
  #ifdef CONFIG_PROC_FS
diff --git a/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch b/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch
index c8258e5cb2..87b12b9cbe 100644
--- a/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch
+++ b/target/linux/generic/pending-4.9/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch
@@ -23,7 +23,7 @@ Tested-by: Aaron Brown <aaron.f.brown@intel.com>
 
 --- a/drivers/net/ethernet/intel/e1000e/netdev.c
 +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
-@@ -5072,7 +5072,7 @@ static bool e1000e_has_link(struct e1000
+@@ -5078,7 +5078,7 @@ static bool e1000e_has_link(struct e1000
  
  	/* get_link_status is set on LSC (link status) interrupt or
  	 * Rx sequence error interrupt.  get_link_status will stay
@@ -32,7 +32,7 @@ Tested-by: Aaron Brown <aaron.f.brown@intel.com>
  	 * for copper adapters ONLY
  	 */
  	switch (hw->phy.media_type) {
-@@ -5090,7 +5090,7 @@ static bool e1000e_has_link(struct e1000
+@@ -5096,7 +5096,7 @@ static bool e1000e_has_link(struct e1000
  		break;
  	case e1000_media_type_internal_serdes:
  		ret_val = hw->mac.ops.check_for_link(hw);
diff --git a/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
index aeefcaf39c..b922be6f3d 100644
--- a/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
+++ b/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
@@ -143,7 +143,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	}
  	return &ip6n->tnls[prio][h];
  }
-@@ -381,6 +392,12 @@ ip6_tnl_dev_uninit(struct net_device *de
+@@ -384,6 +395,12 @@ ip6_tnl_dev_uninit(struct net_device *de
  	struct net *net = t->net;
  	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
  
@@ -156,7 +156,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	if (dev == ip6n->fb_tnl_dev)
  		RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);
  	else
-@@ -777,6 +794,107 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
+@@ -780,6 +797,107 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
  }
  EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl);
  
@@ -264,7 +264,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb,
  			 const struct tnl_ptk_info *tpi,
  			 struct metadata_dst *tun_dst,
-@@ -829,6 +947,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl
+@@ -832,6 +950,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl
  	skb_reset_network_header(skb);
  	memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
  
@@ -292,7 +292,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	__skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
  
  	err = dscp_ecn_decapsulate(tunnel, ipv6h, skb);
-@@ -958,6 +1097,7 @@ static void init_tel_txopt(struct ipv6_t
+@@ -961,6 +1100,7 @@ static void init_tel_txopt(struct ipv6_t
  	opt->ops.opt_nflen = 8;
  }
  
@@ -300,7 +300,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  /**
   * ip6_tnl_addr_conflict - compare packet addresses to tunnel's own
   *   @t: the outgoing tunnel device
-@@ -1292,6 +1432,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1298,6 +1438,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  {
  	struct ip6_tnl *t = netdev_priv(dev);
  	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
@@ -308,7 +308,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	int encap_limit = -1;
  	__u16 offset;
  	struct flowi6 fl6;
-@@ -1350,6 +1491,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1356,6 +1497,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  			fl6.flowi6_mark = skb->mark;
  	}
  
@@ -327,7 +327,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
  		return -1;
  
-@@ -1477,6 +1630,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
+@@ -1483,6 +1636,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
  	t->parms.flowinfo = p->flowinfo;
  	t->parms.link = p->link;
  	t->parms.proto = p->proto;
@@ -342,7 +342,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	dst_cache_reset(&t->dst_cache);
  	ip6_tnl_link_config(t);
  	return 0;
-@@ -1515,6 +1676,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
+@@ -1521,6 +1682,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
  	p->flowinfo = u->flowinfo;
  	p->link = u->link;
  	p->proto = u->proto;
@@ -350,7 +350,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	memcpy(p->name, u->name, sizeof(u->name));
  }
  
-@@ -1892,6 +2054,15 @@ static int ip6_tnl_validate(struct nlatt
+@@ -1898,6 +2060,15 @@ static int ip6_tnl_validate(struct nlatt
  	return 0;
  }
  
@@ -366,7 +366,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  static void ip6_tnl_netlink_parms(struct nlattr *data[],
  				  struct __ip6_tnl_parm *parms)
  {
-@@ -1926,6 +2097,46 @@ static void ip6_tnl_netlink_parms(struct
+@@ -1932,6 +2103,46 @@ static void ip6_tnl_netlink_parms(struct
  
  	if (data[IFLA_IPTUN_COLLECT_METADATA])
  		parms->collect_md = true;
@@ -413,7 +413,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  }
  
  static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[],
-@@ -2035,6 +2246,12 @@ static void ip6_tnl_dellink(struct net_d
+@@ -2041,6 +2252,12 @@ static void ip6_tnl_dellink(struct net_d
  
  static size_t ip6_tnl_get_size(const struct net_device *dev)
  {
@@ -426,7 +426,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	return
  		/* IFLA_IPTUN_LINK */
  		nla_total_size(4) +
-@@ -2062,6 +2279,24 @@ static size_t ip6_tnl_get_size(const str
+@@ -2068,6 +2285,24 @@ static size_t ip6_tnl_get_size(const str
  		nla_total_size(2) +
  		/* IFLA_IPTUN_COLLECT_METADATA */
  		nla_total_size(0) +
@@ -451,7 +451,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  		0;
  }
  
-@@ -2069,6 +2304,9 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -2075,6 +2310,9 @@ static int ip6_tnl_fill_info(struct sk_b
  {
  	struct ip6_tnl *tunnel = netdev_priv(dev);
  	struct __ip6_tnl_parm *parm = &tunnel->parms;
@@ -461,7 +461,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
  	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
  	    nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
-@@ -2077,9 +2315,27 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -2083,9 +2321,27 @@ static int ip6_tnl_fill_info(struct sk_b
  	    nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) ||
  	    nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
  	    nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) ||
@@ -490,7 +490,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) ||
  	    nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) ||
  	    nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) ||
-@@ -2117,6 +2373,7 @@ static const struct nla_policy ip6_tnl_p
+@@ -2123,6 +2379,7 @@ static const struct nla_policy ip6_tnl_p
  	[IFLA_IPTUN_ENCAP_SPORT]	= { .type = NLA_U16 },
  	[IFLA_IPTUN_ENCAP_DPORT]	= { .type = NLA_U16 },
  	[IFLA_IPTUN_COLLECT_METADATA]	= { .type = NLA_FLAG },
diff --git a/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
index 85293a2da5..ad3a15705b 100644
--- a/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
+++ b/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
@@ -141,7 +141,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  static const struct rt6_info ip6_blk_hole_entry_template = {
  	.dst = {
  		.__refcnt	= ATOMIC_INIT(1),
-@@ -1967,6 +1984,11 @@ static struct rt6_info *ip6_route_info_c
+@@ -1970,6 +1987,11 @@ static struct rt6_info *ip6_route_info_c
  			rt->dst.output = ip6_pkt_prohibit_out;
  			rt->dst.input = ip6_pkt_prohibit;
  			break;
@@ -153,7 +153,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		case RTN_THROW:
  		case RTN_UNREACHABLE:
  		default:
-@@ -2610,6 +2632,17 @@ static int ip6_pkt_prohibit_out(struct n
+@@ -2613,6 +2635,17 @@ static int ip6_pkt_prohibit_out(struct n
  	return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
  }
  
@@ -171,7 +171,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  /*
   *	Allocate a dst for local (unicast / anycast) address.
   */
-@@ -2845,7 +2878,8 @@ static int rtm_to_fib6_config(struct sk_
+@@ -2848,7 +2881,8 @@ static int rtm_to_fib6_config(struct sk_
  	if (rtm->rtm_type == RTN_UNREACHABLE ||
  	    rtm->rtm_type == RTN_BLACKHOLE ||
  	    rtm->rtm_type == RTN_PROHIBIT ||
@@ -181,7 +181,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		cfg->fc_flags |= RTF_REJECT;
  
  	if (rtm->rtm_type == RTN_LOCAL)
-@@ -3217,6 +3251,9 @@ static int rt6_fill_node(struct net *net
+@@ -3220,6 +3254,9 @@ static int rt6_fill_node(struct net *net
  		case -EACCES:
  			rtm->rtm_type = RTN_PROHIBIT;
  			break;
@@ -191,7 +191,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		case -EAGAIN:
  			rtm->rtm_type = RTN_THROW;
  			break;
-@@ -3493,6 +3530,8 @@ static int ip6_route_dev_notify(struct n
+@@ -3496,6 +3533,8 @@ static int ip6_route_dev_notify(struct n
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  		net->ipv6.ip6_prohibit_entry->dst.dev = dev;
  		net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
@@ -200,7 +200,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
  		net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
  #endif
-@@ -3719,6 +3758,17 @@ static int __net_init ip6_route_net_init
+@@ -3722,6 +3761,17 @@ static int __net_init ip6_route_net_init
  	net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
  	dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
  			 ip6_template_metrics, true);
@@ -218,7 +218,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  
  	net->ipv6.sysctl.flush_delay = 0;
-@@ -3737,6 +3787,8 @@ out:
+@@ -3740,6 +3790,8 @@ out:
  	return ret;
  
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -227,7 +227,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  out_ip6_prohibit_entry:
  	kfree(net->ipv6.ip6_prohibit_entry);
  out_ip6_null_entry:
-@@ -3754,6 +3806,7 @@ static void __net_exit ip6_route_net_exi
+@@ -3757,6 +3809,7 @@ static void __net_exit ip6_route_net_exi
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  	kfree(net->ipv6.ip6_prohibit_entry);
  	kfree(net->ipv6.ip6_blk_hole_entry);
@@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  	dst_entries_destroy(&net->ipv6.ip6_dst_ops);
  }
-@@ -3827,6 +3880,9 @@ void __init ip6_route_init_special_entri
+@@ -3830,6 +3883,9 @@ void __init ip6_route_init_special_entri
  	init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
  	init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
  	init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
diff --git a/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
index 86a64d8424..4d1f6c4c2b 100644
--- a/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
+++ b/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
@@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	__u16			tc_index;	/* traffic control index */
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -4542,6 +4542,9 @@ static enum gro_result dev_gro_receive(s
+@@ -4550,6 +4550,9 @@ static enum gro_result dev_gro_receive(s
  	enum gro_result ret;
  	int grow;
  
@@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	if (!(skb->dev->features & NETIF_F_GRO))
  		goto normal;
  
-@@ -5830,6 +5833,48 @@ static void __netdev_adjacent_dev_unlink
+@@ -5838,6 +5841,48 @@ static void __netdev_adjacent_dev_unlink
  					   &upper_dev->adj_list.lower);
  }
  
@@ -93,7 +93,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 *upper_priv, void *upper_info)
-@@ -5902,6 +5947,7 @@ static int __netdev_upper_dev_link(struc
+@@ -5910,6 +5955,7 @@ static int __netdev_upper_dev_link(struc
  			goto rollback_lower_mesh;
  	}
  
@@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  					    &changeupper_info.info);
  	ret = notifier_to_errno(ret);
-@@ -6028,6 +6074,7 @@ void netdev_upper_dev_unlink(struct net_
+@@ -6036,6 +6082,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);
  
@@ -109,7 +109,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  }
-@@ -6628,6 +6675,7 @@ int dev_set_mac_address(struct net_devic
+@@ -6636,6 +6683,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/pending-4.9/701-phy_extension.patch b/target/linux/generic/pending-4.9/701-phy_extension.patch
index 4569336bf3..628e1d31b9 100644
--- a/target/linux/generic/pending-4.9/701-phy_extension.patch
+++ b/target/linux/generic/pending-4.9/701-phy_extension.patch
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
 
 --- a/drivers/net/phy/phy.c
 +++ b/drivers/net/phy/phy.c
-@@ -466,6 +466,50 @@ int phy_ethtool_ksettings_get(struct phy
+@@ -472,6 +472,50 @@ int phy_ethtool_ksettings_get(struct phy
  }
  EXPORT_SYMBOL(phy_ethtool_ksettings_get);
  
diff --git a/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch b/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch
index e3a1c8a7ee..1cb51a2ed5 100644
--- a/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch
+++ b/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch
@@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  {
 --- a/lib/Kconfig.debug
 +++ b/lib/Kconfig.debug
-@@ -396,6 +396,11 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE
+@@ -410,6 +410,11 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE
  	  This may be set to 1 or 0 to enable or disable them all, or
  	  to a bitmask as described in Documentation/sysrq.txt.
  
diff --git a/target/linux/generic/pending-4.9/920-mangle_bootargs.patch b/target/linux/generic/pending-4.9/920-mangle_bootargs.patch
index ec2f340097..3422f41519 100644
--- a/target/linux/generic/pending-4.9/920-mangle_bootargs.patch
+++ b/target/linux/generic/pending-4.9/920-mangle_bootargs.patch
@@ -31,7 +31,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
  	help
 --- a/init/main.c
 +++ b/init/main.c
-@@ -352,6 +352,29 @@ static inline void setup_nr_cpu_ids(void
+@@ -353,6 +353,29 @@ static inline void setup_nr_cpu_ids(void
  static inline void smp_prepare_cpus(unsigned int maxcpus) { }
  #endif
  
@@ -61,7 +61,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
  /*
   * We need to store the untouched command line for future reference.
   * We also need to store the touched command line since the parameter
-@@ -505,6 +528,7 @@ asmlinkage __visible void __init start_k
+@@ -506,6 +529,7 @@ asmlinkage __visible void __init start_k
  	pr_notice("%s", linux_banner);
  	setup_arch(&command_line);
  	mm_init_cpumask(&init_mm);
diff --git a/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch
index 478dad7861..be1a7e5648 100644
--- a/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch
+++ b/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch
@@ -157,7 +157,7 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
  }
 --- a/init/main.c
 +++ b/init/main.c
-@@ -88,6 +88,10 @@
+@@ -89,6 +89,10 @@
  #include <asm/sections.h>
  #include <asm/cacheflush.h>
  
@@ -168,7 +168,7 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
  static int kernel_init(void *);
  
  extern void init_IRQ(void);
-@@ -539,6 +543,18 @@ asmlinkage __visible void __init start_k
+@@ -540,6 +544,18 @@ asmlinkage __visible void __init start_k
  	page_alloc_init();
  
  	pr_notice("Kernel command line: %s\n", boot_command_line);
diff --git a/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch b/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch
index 6046d6cde1..eb6acdb2f7 100644
--- a/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch
+++ b/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch
@@ -11,7 +11,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 
 --- a/drivers/net/phy/phy.c
 +++ b/drivers/net/phy/phy.c
-@@ -1032,7 +1032,8 @@ void phy_state_machine(struct work_struc
+@@ -1038,7 +1038,8 @@ void phy_state_machine(struct work_struc
  		/* If the link is down, give up on negotiation for now */
  		if (!phydev->link) {
  			phydev->state = PHY_NOLINK;
@@ -21,7 +21,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  			phydev->adjust_link(phydev->attached_dev);
  			break;
  		}
-@@ -1124,7 +1125,8 @@ void phy_state_machine(struct work_struc
+@@ -1130,7 +1131,8 @@ void phy_state_machine(struct work_struc
  			netif_carrier_on(phydev->attached_dev);
  		} else {
  			phydev->state = PHY_NOLINK;
@@ -31,7 +31,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  		}
  
  		phydev->adjust_link(phydev->attached_dev);
-@@ -1136,7 +1138,8 @@ void phy_state_machine(struct work_struc
+@@ -1142,7 +1144,8 @@ void phy_state_machine(struct work_struc
  	case PHY_HALTED:
  		if (phydev->link) {
  			phydev->link = 0;
diff --git a/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch b/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch
index 64597cec87..da48ae3a18 100644
--- a/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch
+++ b/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch
@@ -65,7 +65,7 @@ Signed-off-by: Mark Brown <broonie@kernel.org>
 +};
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
-@@ -404,6 +404,14 @@ config SPI_NUC900
+@@ -403,6 +403,14 @@ config SPI_NUC900
  	help
  	  SPI driver for Nuvoton NUC900 series ARM SoCs
  
diff --git a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch
index 77e54f8340..a284d8bbd4 100644
--- a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch
@@ -421,7 +421,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
   *	These are the defined Ethernet Protocol ID's.
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -6622,9 +6622,18 @@ int dev_set_mtu(struct net_device *dev,
+@@ -6630,9 +6630,18 @@ int dev_set_mtu(struct net_device *dev,
  	if (new_mtu == dev->mtu)
  		return 0;
  
diff --git a/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch b/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
index 0276ebe339..52dfced2b8 100644
--- a/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
@@ -335,7 +335,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	return 1;
 --- a/arch/arm64/include/asm/pgtable-prot.h
 +++ b/arch/arm64/include/asm/pgtable-prot.h
-@@ -42,6 +42,7 @@
+@@ -48,6 +48,7 @@
  #define PROT_NORMAL_NC		(PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC))
  #define PROT_NORMAL_WT		(PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT))
  #define PROT_NORMAL		(PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
diff --git a/target/linux/layerscape/patches-4.9/302-dts-support-layercape.patch b/target/linux/layerscape/patches-4.9/302-dts-support-layercape.patch
index 361f43c6b4..37dc5ee5f0 100644
--- a/target/linux/layerscape/patches-4.9/302-dts-support-layercape.patch
+++ b/target/linux/layerscape/patches-4.9/302-dts-support-layercape.patch
@@ -340,7 +340,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  			reg = <0x0 0x1570e08 0x0 0x8>;
  			msi-controller;
  			interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>;
-@@ -137,16 +144,17 @@
+@@ -137,11 +144,12 @@
  			compatible = "fsl,ifc", "simple-bus";
  			reg = <0x0 0x1530000 0x0 0x10000>;
  			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
@@ -354,12 +354,6 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  			big-endian;
  		};
  
- 		esdhc: esdhc@1560000 {
--			compatible = "fsl,esdhc";
-+			compatible = "fsl,ls1021a-esdhc","fsl,esdhc";
- 			reg = <0x0 0x1560000 0x0 0x10000>;
- 			interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
- 			clock-frequency = <0>;
 @@ -163,7 +171,7 @@
  			      <0x0 0x20220520 0x0 0x4>;
  			reg-names = "ahci", "sata-ecc";
diff --git a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch
index 6ffc2e1097..9d84968608 100644
--- a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch
@@ -768,7 +768,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	{ "w25q32", INFO(0xef4016, 0, 64 * 1024,  64, SECT_4K) },
  	{
  		"w25q32dw", INFO(0xef6016, 0, 64 * 1024,  64,
-@@ -1192,6 +1216,53 @@ static const struct flash_info *spi_nor_
+@@ -1196,6 +1220,53 @@ static const struct flash_info *spi_nor_
  		id[0], id[1], id[2]);
  	return ERR_PTR(-ENODEV);
  }
@@ -822,7 +822,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  
  static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
  			size_t *retlen, u_char *buf)
-@@ -1411,7 +1482,7 @@ static int macronix_quad_enable(struct s
+@@ -1415,7 +1486,7 @@ static int macronix_quad_enable(struct s
   * Write status Register and configuration register with 2 bytes
   * The first byte will be written to the status register, while the
   * second byte will be written to the configuration register.
@@ -831,7 +831,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
   */
  static int write_sr_cr(struct spi_nor *nor, u16 val)
  {
-@@ -1459,6 +1530,24 @@ static int spansion_quad_enable(struct s
+@@ -1463,6 +1534,24 @@ static int spansion_quad_enable(struct s
  	return 0;
  }
  
@@ -856,7 +856,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
  {
  	int status;
-@@ -1605,9 +1694,25 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1609,9 +1698,25 @@ int spi_nor_scan(struct spi_nor *nor, co
  		write_sr(nor, 0);
  		spi_nor_wait_till_ready(nor);
  	}
@@ -882,7 +882,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	mtd->priv = nor;
  	mtd->type = MTD_NORFLASH;
  	mtd->writesize = 1;
-@@ -1641,6 +1746,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1645,6 +1750,8 @@ int spi_nor_scan(struct spi_nor *nor, co
  		nor->flags |= SNOR_F_USE_FSR;
  	if (info->flags & SPI_NOR_HAS_TB)
  		nor->flags |= SNOR_F_HAS_SR_TB;
@@ -891,7 +891,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  
  #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
  	/* prefer "small sector" erase if possible */
-@@ -1680,9 +1787,15 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1684,9 +1791,15 @@ int spi_nor_scan(struct spi_nor *nor, co
  	/* Some devices cannot do fast-read, no matter what DT tells us */
  	if (info->flags & SPI_NOR_NO_FR)
  		nor->flash_read = SPI_NOR_NORMAL;
@@ -910,7 +910,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  		ret = set_quad_mode(nor, info);
  		if (ret) {
  			dev_err(dev, "quad mode not supported\n");
-@@ -1695,6 +1808,9 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1699,6 +1812,9 @@ int spi_nor_scan(struct spi_nor *nor, co
  
  	/* Default commands */
  	switch (nor->flash_read) {
diff --git a/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch b/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch
index 197fd9c50f..acc75cdc2c 100644
--- a/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch
@@ -1618,7 +1618,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  		.config_intr = &marvell_config_intr,
 --- a/drivers/net/phy/phy.c
 +++ b/drivers/net/phy/phy.c
-@@ -585,7 +585,7 @@ int phy_mii_ioctl(struct phy_device *phy
+@@ -591,7 +591,7 @@ int phy_mii_ioctl(struct phy_device *phy
  		return 0;
  
  	case SIOCSHWTSTAMP:
@@ -1627,7 +1627,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  			return phydev->drv->hwtstamp(phydev, ifr);
  		/* fall through */
  
-@@ -610,6 +610,9 @@ static int phy_start_aneg_priv(struct ph
+@@ -616,6 +616,9 @@ static int phy_start_aneg_priv(struct ph
  	bool trigger = 0;
  	int err;
  
@@ -1637,7 +1637,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	mutex_lock(&phydev->lock);
  
  	if (AUTONEG_DISABLE == phydev->autoneg)
-@@ -1009,7 +1012,7 @@ void phy_state_machine(struct work_struc
+@@ -1015,7 +1018,7 @@ void phy_state_machine(struct work_struc
  
  	old_state = phydev->state;
  
@@ -1646,7 +1646,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  		phydev->drv->link_change_notify(phydev);
  
  	switch (phydev->state) {
-@@ -1311,6 +1314,9 @@ EXPORT_SYMBOL(phy_write_mmd_indirect);
+@@ -1317,6 +1320,9 @@ EXPORT_SYMBOL(phy_write_mmd_indirect);
   */
  int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
  {
@@ -1656,7 +1656,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	/* According to 802.3az,the EEE is supported only in full duplex-mode.
  	 * Also EEE feature is active when core is operating with MII, GMII
  	 * or RGMII (all kinds). Internal PHYs are also allowed to proceed and
-@@ -1388,6 +1394,9 @@ EXPORT_SYMBOL(phy_init_eee);
+@@ -1394,6 +1400,9 @@ EXPORT_SYMBOL(phy_init_eee);
   */
  int phy_get_eee_err(struct phy_device *phydev)
  {
@@ -1666,7 +1666,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	return phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_WK_ERR, MDIO_MMD_PCS);
  }
  EXPORT_SYMBOL(phy_get_eee_err);
-@@ -1404,6 +1413,9 @@ int phy_ethtool_get_eee(struct phy_devic
+@@ -1410,6 +1419,9 @@ int phy_ethtool_get_eee(struct phy_devic
  {
  	int val;
  
@@ -1676,7 +1676,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	/* Get Supported EEE */
  	val = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, MDIO_MMD_PCS);
  	if (val < 0)
-@@ -1437,6 +1449,9 @@ int phy_ethtool_set_eee(struct phy_devic
+@@ -1443,6 +1455,9 @@ int phy_ethtool_set_eee(struct phy_devic
  {
  	int val = ethtool_adv_to_mmd_eee_adv_t(data->advertised);
  
@@ -1686,7 +1686,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	/* Mask prohibited EEE modes */
  	val &= ~phydev->eee_broken_modes;
  
-@@ -1448,7 +1463,7 @@ EXPORT_SYMBOL(phy_ethtool_set_eee);
+@@ -1454,7 +1469,7 @@ EXPORT_SYMBOL(phy_ethtool_set_eee);
  
  int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
  {
@@ -1695,7 +1695,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  		return phydev->drv->set_wol(phydev, wol);
  
  	return -EOPNOTSUPP;
-@@ -1457,7 +1472,7 @@ EXPORT_SYMBOL(phy_ethtool_set_wol);
+@@ -1463,7 +1478,7 @@ EXPORT_SYMBOL(phy_ethtool_set_wol);
  
  void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
  {
diff --git a/target/linux/layerscape/patches-4.9/803-cpufreq-support-layerscape.patch b/target/linux/layerscape/patches-4.9/803-cpufreq-support-layerscape.patch
index 465f909a97..ac9b4b068a 100644
--- a/target/linux/layerscape/patches-4.9/803-cpufreq-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/803-cpufreq-support-layerscape.patch
@@ -328,7 +328,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  		pr_info("Freescale QorIQ CPU frequency scaling driver\n");
 --- a/drivers/firmware/psci.c
 +++ b/drivers/firmware/psci.c
-@@ -418,8 +418,12 @@ CPUIDLE_METHOD_OF_DECLARE(psci, "psci",
+@@ -437,8 +437,12 @@ CPUIDLE_METHOD_OF_DECLARE(psci, "psci",
  
  static int psci_system_suspend(unsigned long unused)
  {
@@ -343,7 +343,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  }
  
  static int psci_system_suspend_enter(suspend_state_t state)
-@@ -439,6 +443,8 @@ static void __init psci_init_system_susp
+@@ -458,6 +462,8 @@ static void __init psci_init_system_susp
  	if (!IS_ENABLED(CONFIG_SUSPEND))
  		return;
  
@@ -352,7 +352,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	ret = psci_features(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND));
  
  	if (ret != PSCI_RET_NOT_SUPPORTED)
-@@ -516,6 +522,8 @@ static void __init psci_0_2_set_function
+@@ -562,6 +568,8 @@ static void __init psci_0_2_set_function
  	arm_pm_restart = psci_sys_reset;
  
  	pm_power_off = psci_sys_poweroff;
diff --git a/target/linux/layerscape/patches-4.9/812-mmc-layerscape-support.patch b/target/linux/layerscape/patches-4.9/812-mmc-layerscape-support.patch
index 67c32dc4a4..4b32417379 100644
--- a/target/linux/layerscape/patches-4.9/812-mmc-layerscape-support.patch
+++ b/target/linux/layerscape/patches-4.9/812-mmc-layerscape-support.patch
@@ -482,7 +482,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	sdhci_get_of_property(pdev);
 --- a/drivers/mmc/host/sdhci.c
 +++ b/drivers/mmc/host/sdhci.c
-@@ -1624,26 +1624,24 @@ static void sdhci_set_ios(struct mmc_hos
+@@ -1631,26 +1631,24 @@ static void sdhci_set_ios(struct mmc_hos
  
  	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
  
@@ -523,7 +523,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  		if (!host->preset_enabled) {
  			sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
  			/*
-@@ -1956,7 +1954,7 @@ static int sdhci_prepare_hs400_tuning(st
+@@ -1963,7 +1961,7 @@ static int sdhci_prepare_hs400_tuning(st
  	return 0;
  }
  
@@ -532,7 +532,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  {
  	struct sdhci_host *host = mmc_priv(mmc);
  	u16 ctrl;
-@@ -2015,6 +2013,9 @@ static int sdhci_execute_tuning(struct m
+@@ -2022,6 +2020,9 @@ static int sdhci_execute_tuning(struct m
  		return err;
  	}
  
@@ -542,7 +542,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
  	ctrl |= SDHCI_CTRL_EXEC_TUNING;
  	if (host->quirks2 & SDHCI_QUIRK2_TUNING_WORK_AROUND)
-@@ -2127,9 +2128,10 @@ static int sdhci_execute_tuning(struct m
+@@ -2134,9 +2135,10 @@ static int sdhci_execute_tuning(struct m
  
  		ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
  
@@ -556,7 +556,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	} while (ctrl & SDHCI_CTRL_EXEC_TUNING);
  
  	/*
-@@ -2165,6 +2167,7 @@ out_unlock:
+@@ -2172,6 +2174,7 @@ out_unlock:
  	spin_unlock_irqrestore(&host->lock, flags);
  	return err;
  }
@@ -564,7 +564,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  
  static int sdhci_select_drive_strength(struct mmc_card *card,
  				       unsigned int max_dtr, int host_drv,
-@@ -2997,6 +3000,8 @@ struct sdhci_host *sdhci_alloc_host(stru
+@@ -3004,6 +3007,8 @@ struct sdhci_host *sdhci_alloc_host(stru
  
  	host->flags = SDHCI_SIGNALING_330;
  
diff --git a/target/linux/layerscape/patches-4.9/813-qe-support-layerscape.patch b/target/linux/layerscape/patches-4.9/813-qe-support-layerscape.patch
index c1431306a4..1dfa46e839 100644
--- a/target/linux/layerscape/patches-4.9/813-qe-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/813-qe-support-layerscape.patch
@@ -1162,7 +1162,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  	/* Move to next BD in the ring */
  	if (!(bd_status & T_W_S))
 @@ -457,7 +457,7 @@ static int hdlc_rx_done(struct ucc_hdlc_
- 	struct sk_buff *skb;
+ 	struct sk_buff *skb = NULL;
  	hdlc_device *hdlc = dev_to_hdlc(dev);
  	struct qe_bd *bd;
 -	u32 bd_status;
diff --git a/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch b/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch
index 69bbb411d8..e6ca1447ff 100644
--- a/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch
+++ b/target/linux/sunxi/patches-4.9/0050-stmmac-form-4-10.patch
@@ -2177,7 +2177,7 @@
  
  	/* reserved for future extensions */
  	if (config.flags)
-@@ -703,7 +705,7 @@ static void stmmac_release_ptp(struct st
+@@ -712,7 +714,7 @@ static void stmmac_release_ptp(struct st
  static void stmmac_adjust_link(struct net_device *dev)
  {
  	struct stmmac_priv *priv = netdev_priv(dev);
@@ -2186,7 +2186,7 @@
  	unsigned long flags;
  	int new_state = 0;
  	unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
-@@ -756,9 +758,9 @@ static void stmmac_adjust_link(struct ne
+@@ -765,9 +767,9 @@ static void stmmac_adjust_link(struct ne
  				stmmac_hw_fix_mac_speed(priv);
  				break;
  			default:
@@ -2199,7 +2199,7 @@
  				break;
  			}
  
-@@ -811,10 +813,10 @@ static void stmmac_check_pcs_mode(struct
+@@ -820,10 +822,10 @@ static void stmmac_check_pcs_mode(struct
  		    (interface == PHY_INTERFACE_MODE_RGMII_ID) ||
  		    (interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
  		    (interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
@@ -2212,7 +2212,7 @@
  			priv->hw->pcs = STMMAC_PCS_SGMII;
  		}
  	}
-@@ -849,15 +851,15 @@ static int stmmac_init_phy(struct net_de
+@@ -858,15 +860,15 @@ static int stmmac_init_phy(struct net_de
  
  		snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
  			 priv->plat->phy_addr);
@@ -2231,7 +2231,7 @@
  		if (!phydev)
  			return -ENODEV;
  
-@@ -890,10 +892,8 @@ static int stmmac_init_phy(struct net_de
+@@ -899,10 +901,8 @@ static int stmmac_init_phy(struct net_de
  	if (phydev->is_pseudo_fixed_link)
  		phydev->irq = PHY_POLL;
  
@@ -2244,7 +2244,7 @@
  
  	return 0;
  }
-@@ -979,7 +979,8 @@ static int stmmac_init_rx_buffers(struct
+@@ -988,7 +988,8 @@ static int stmmac_init_rx_buffers(struct
  
  	skb = __netdev_alloc_skb_ip_align(priv->dev, priv->dma_buf_sz, flags);
  	if (!skb) {
@@ -2254,7 +2254,7 @@
  		return -ENOMEM;
  	}
  	priv->rx_skbuff[i] = skb;
-@@ -987,15 +988,15 @@ static int stmmac_init_rx_buffers(struct
+@@ -996,15 +997,15 @@ static int stmmac_init_rx_buffers(struct
  						priv->dma_buf_sz,
  						DMA_FROM_DEVICE);
  	if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) {
@@ -2273,7 +2273,7 @@
  
  	if ((priv->hw->mode->init_desc3) &&
  	    (priv->dma_buf_sz == BUF_SIZE_16KiB))
-@@ -1037,13 +1038,14 @@ static int init_dma_desc_rings(struct ne
+@@ -1046,13 +1047,14 @@ static int init_dma_desc_rings(struct ne
  
  	priv->dma_buf_sz = bfsize;
  
@@ -2294,7 +2294,7 @@
  	for (i = 0; i < DMA_RX_SIZE; i++) {
  		struct dma_desc *p;
  		if (priv->extend_desc)
-@@ -1055,10 +1057,9 @@ static int init_dma_desc_rings(struct ne
+@@ -1064,10 +1066,9 @@ static int init_dma_desc_rings(struct ne
  		if (ret)
  			goto err_init_rx_buffers;
  
@@ -2308,7 +2308,7 @@
  	}
  	priv->cur_rx = 0;
  	priv->dirty_rx = (unsigned int)(i - DMA_RX_SIZE);
-@@ -1313,7 +1314,7 @@ static void stmmac_tx_clean(struct stmma
+@@ -1322,7 +1323,7 @@ static void stmmac_tx_clean(struct stmma
  	unsigned int bytes_compl = 0, pkts_compl = 0;
  	unsigned int entry = priv->dirty_tx;
  
@@ -2317,7 +2317,7 @@
  
  	priv->xstats.tx_clean++;
  
-@@ -1384,22 +1385,17 @@ static void stmmac_tx_clean(struct stmma
+@@ -1393,22 +1394,17 @@ static void stmmac_tx_clean(struct stmma
  	netdev_completed_queue(priv->dev, pkts_compl, bytes_compl);
  
  	if (unlikely(netif_queue_stopped(priv->dev) &&
@@ -2345,7 +2345,7 @@
  }
  
  static inline void stmmac_enable_dma_irq(struct stmmac_priv *priv)
-@@ -1503,7 +1499,7 @@ static void stmmac_mmc_setup(struct stmm
+@@ -1512,7 +1508,7 @@ static void stmmac_mmc_setup(struct stmm
  		dwmac_mmc_ctrl(priv->mmcaddr, mode);
  		memset(&priv->mmc, 0, sizeof(struct stmmac_counters));
  	} else
@@ -2354,7 +2354,7 @@
  }
  
  /**
-@@ -1516,18 +1512,18 @@ static void stmmac_mmc_setup(struct stmm
+@@ -1525,18 +1521,18 @@ static void stmmac_mmc_setup(struct stmm
  static void stmmac_selec_desc_mode(struct stmmac_priv *priv)
  {
  	if (priv->plat->enh_desc) {
@@ -2377,7 +2377,7 @@
  		priv->hw->desc = &ndesc_ops;
  	}
  }
-@@ -1568,8 +1564,8 @@ static void stmmac_check_ether_addr(stru
+@@ -1577,8 +1573,8 @@ static void stmmac_check_ether_addr(stru
  					     priv->dev->dev_addr, 0);
  		if (!is_valid_ether_addr(priv->dev->dev_addr))
  			eth_hw_addr_random(priv->dev);
@@ -2388,7 +2388,7 @@
  	}
  }
  
-@@ -1583,16 +1579,12 @@ static void stmmac_check_ether_addr(stru
+@@ -1592,16 +1588,12 @@ static void stmmac_check_ether_addr(stru
   */
  static int stmmac_init_dma_engine(struct stmmac_priv *priv)
  {
@@ -2408,7 +2408,7 @@
  	}
  
  	if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE))
-@@ -1604,8 +1596,8 @@ static int stmmac_init_dma_engine(struct
+@@ -1613,8 +1605,8 @@ static int stmmac_init_dma_engine(struct
  		return ret;
  	}
  
@@ -2419,7 +2419,7 @@
  
  	if (priv->synopsys_id >= DWMAC_CORE_4_00) {
  		priv->rx_tail_addr = priv->dma_rx_phy +
-@@ -1677,7 +1669,8 @@ static int stmmac_hw_setup(struct net_de
+@@ -1686,7 +1678,8 @@ static int stmmac_hw_setup(struct net_de
  	/* DMA initialization and SW reset */
  	ret = stmmac_init_dma_engine(priv);
  	if (ret < 0) {
@@ -2429,7 +2429,7 @@
  		return ret;
  	}
  
-@@ -1706,7 +1699,7 @@ static int stmmac_hw_setup(struct net_de
+@@ -1715,7 +1708,7 @@ static int stmmac_hw_setup(struct net_de
  
  	ret = priv->hw->mac->rx_ipc(priv->hw);
  	if (!ret) {
@@ -2438,7 +2438,7 @@
  		priv->plat->rx_coe = STMMAC_RX_COE_NONE;
  		priv->hw->rx_csum = 0;
  	}
-@@ -1731,10 +1724,11 @@ static int stmmac_hw_setup(struct net_de
+@@ -1740,10 +1733,11 @@ static int stmmac_hw_setup(struct net_de
  #ifdef CONFIG_DEBUG_FS
  	ret = stmmac_init_fs(dev);
  	if (ret < 0)
@@ -2452,7 +2452,7 @@
  	priv->hw->dma->start_tx(priv->ioaddr);
  	priv->hw->dma->start_rx(priv->ioaddr);
  
-@@ -1789,8 +1783,9 @@ static int stmmac_open(struct net_device
+@@ -1798,8 +1792,9 @@ static int stmmac_open(struct net_device
  	    priv->hw->pcs != STMMAC_PCS_RTBI) {
  		ret = stmmac_init_phy(dev);
  		if (ret) {
@@ -2464,7 +2464,7 @@
  			return ret;
  		}
  	}
-@@ -1805,33 +1800,36 @@ static int stmmac_open(struct net_device
+@@ -1814,33 +1809,36 @@ static int stmmac_open(struct net_device
  
  	ret = alloc_dma_desc_resources(priv);
  	if (ret < 0) {
@@ -2508,7 +2508,7 @@
  		goto init_error;
  	}
  
-@@ -1840,8 +1838,9 @@ static int stmmac_open(struct net_device
+@@ -1849,8 +1847,9 @@ static int stmmac_open(struct net_device
  		ret = request_irq(priv->wol_irq, stmmac_interrupt,
  				  IRQF_SHARED, dev->name, dev);
  		if (unlikely(ret < 0)) {
@@ -2520,7 +2520,7 @@
  			goto wolirq_error;
  		}
  	}
-@@ -1851,8 +1850,9 @@ static int stmmac_open(struct net_device
+@@ -1860,8 +1859,9 @@ static int stmmac_open(struct net_device
  		ret = request_irq(priv->lpi_irq, stmmac_interrupt, IRQF_SHARED,
  				  dev->name, dev);
  		if (unlikely(ret < 0)) {
@@ -2532,7 +2532,7 @@
  			goto lpiirq_error;
  		}
  	}
-@@ -1871,8 +1871,8 @@ wolirq_error:
+@@ -1880,8 +1880,8 @@ wolirq_error:
  init_error:
  	free_dma_desc_resources(priv);
  dma_desc_error:
@@ -2543,7 +2543,7 @@
  
  	return ret;
  }
-@@ -1891,10 +1891,9 @@ static int stmmac_release(struct net_dev
+@@ -1900,10 +1900,9 @@ static int stmmac_release(struct net_dev
  		del_timer_sync(&priv->eee_ctrl_timer);
  
  	/* Stop and disconnect the PHY */
@@ -2557,7 +2557,7 @@
  	}
  
  	netif_stop_queue(dev);
-@@ -1954,13 +1953,13 @@ static void stmmac_tso_allocator(struct
+@@ -1963,13 +1962,13 @@ static void stmmac_tso_allocator(struct
  		priv->cur_tx = STMMAC_GET_ENTRY(priv->cur_tx, DMA_TX_SIZE);
  		desc = priv->dma_tx + priv->cur_tx;
  
@@ -2573,7 +2573,7 @@
  			0, 0);
  
  		tmp_len -= TSO_MAX_BUFF_SIZE;
-@@ -2005,8 +2004,6 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2014,8 +2013,6 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	u8 proto_hdr_len;
  	int i;
  
@@ -2582,7 +2582,7 @@
  	/* Compute header lengths */
  	proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
  
-@@ -2016,9 +2013,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2025,9 +2022,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
  		if (!netif_queue_stopped(dev)) {
  			netif_stop_queue(dev);
  			/* This is a hard error, log it. */
@@ -2595,7 +2595,7 @@
  		return NETDEV_TX_BUSY;
  	}
  
-@@ -2056,11 +2054,11 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2065,11 +2063,11 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	priv->tx_skbuff_dma[first_entry].len = skb_headlen(skb);
  	priv->tx_skbuff[first_entry] = skb;
  
@@ -2609,7 +2609,7 @@
  
  	/* If needed take extra descriptors to fill the remaining payload */
  	tmp_pay_len = pay_len - TSO_MAX_BUFF_SIZE;
-@@ -2089,8 +2087,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2098,8 +2096,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	priv->cur_tx = STMMAC_GET_ENTRY(priv->cur_tx, DMA_TX_SIZE);
  
  	if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
@@ -2620,7 +2620,7 @@
  		netif_stop_queue(dev);
  	}
  
-@@ -2134,7 +2132,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2143,7 +2141,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	 * descriptor and then barrier is needed to make sure that
  	 * all is coherent before granting the DMA engine.
  	 */
@@ -2629,7 +2629,7 @@
  
  	if (netif_msg_pktdata(priv)) {
  		pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
-@@ -2153,11 +2151,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2162,11 +2160,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, priv->tx_tail_addr,
  				       STMMAC_CHAN0);
  
@@ -2641,7 +2641,7 @@
  	dev_err(priv->device, "Tx dma map failed\n");
  	dev_kfree_skb(skb);
  	priv->dev->stats.tx_dropped++;
-@@ -2189,14 +2185,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2198,14 +2194,13 @@ static netdev_tx_t stmmac_xmit(struct sk
  			return stmmac_tso_xmit(skb, dev);
  	}
  
@@ -2659,7 +2659,7 @@
  		}
  		return NETDEV_TX_BUSY;
  	}
-@@ -2249,13 +2244,11 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2258,13 +2253,11 @@ static netdev_tx_t stmmac_xmit(struct sk
  
  		priv->tx_skbuff[entry] = NULL;
  
@@ -2678,7 +2678,7 @@
  
  		priv->tx_skbuff_dma[entry].map_as_page = true;
  		priv->tx_skbuff_dma[entry].len = len;
-@@ -2273,9 +2266,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2282,9 +2275,10 @@ static netdev_tx_t stmmac_xmit(struct sk
  	if (netif_msg_pktdata(priv)) {
  		void *tx_head;
  
@@ -2692,7 +2692,7 @@
  
  		if (priv->extend_desc)
  			tx_head = (void *)priv->dma_etx;
-@@ -2284,13 +2278,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2293,13 +2287,13 @@ static netdev_tx_t stmmac_xmit(struct sk
  
  		priv->hw->desc->display_ring(tx_head, DMA_TX_SIZE, false);
  
@@ -2709,7 +2709,7 @@
  		netif_stop_queue(dev);
  	}
  
-@@ -2326,13 +2320,11 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2335,13 +2329,11 @@ static netdev_tx_t stmmac_xmit(struct sk
  		if (dma_mapping_error(priv->device, des))
  			goto dma_map_err;
  
@@ -2728,7 +2728,7 @@
  
  		priv->tx_skbuff_dma[first_entry].len = nopaged_len;
  		priv->tx_skbuff_dma[first_entry].last_segment = last_segment;
-@@ -2353,7 +2345,7 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2362,7 +2354,7 @@ static netdev_tx_t stmmac_xmit(struct sk
  		 * descriptor and then barrier is needed to make sure that
  		 * all is coherent before granting the DMA engine.
  		 */
@@ -2737,7 +2737,7 @@
  	}
  
  	netdev_sent_queue(dev, skb->len);
-@@ -2364,12 +2356,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2373,12 +2365,10 @@ static netdev_tx_t stmmac_xmit(struct sk
  		priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, priv->tx_tail_addr,
  					       STMMAC_CHAN0);
  
@@ -2751,7 +2751,7 @@
  	dev_kfree_skb(skb);
  	priv->dev->stats.tx_dropped++;
  	return NETDEV_TX_OK;
-@@ -2440,16 +2430,16 @@ static inline void stmmac_rx_refill(stru
+@@ -2449,16 +2439,16 @@ static inline void stmmac_rx_refill(stru
  					   DMA_FROM_DEVICE);
  			if (dma_mapping_error(priv->device,
  					      priv->rx_skbuff_dma[entry])) {
@@ -2771,7 +2771,7 @@
  			}
  			if (priv->hw->mode->refill_desc3)
  				priv->hw->mode->refill_desc3(priv, p);
-@@ -2457,17 +2447,17 @@ static inline void stmmac_rx_refill(stru
+@@ -2466,17 +2456,17 @@ static inline void stmmac_rx_refill(stru
  			if (priv->rx_zeroc_thresh > 0)
  				priv->rx_zeroc_thresh--;
  
@@ -2793,7 +2793,7 @@
  
  		entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
  	}
-@@ -2491,7 +2481,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2500,7 +2490,7 @@ static int stmmac_rx(struct stmmac_priv
  	if (netif_msg_rx_status(priv)) {
  		void *rx_head;
  
@@ -2802,7 +2802,7 @@
  		if (priv->extend_desc)
  			rx_head = (void *)priv->dma_erx;
  		else
-@@ -2553,9 +2543,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2562,9 +2552,9 @@ static int stmmac_rx(struct stmmac_priv
  			unsigned int des;
  
  			if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
@@ -2814,7 +2814,7 @@
  
  			frame_len = priv->hw->desc->get_rx_frame_len(p, coe);
  
-@@ -2564,9 +2554,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2573,9 +2563,9 @@ static int stmmac_rx(struct stmmac_priv
  			 *  ignored
  			 */
  			if (frame_len > priv->dma_buf_sz) {
@@ -2827,7 +2827,7 @@
  				priv->dev->stats.rx_length_errors++;
  				break;
  			}
-@@ -2578,11 +2568,11 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2587,11 +2577,11 @@ static int stmmac_rx(struct stmmac_priv
  				frame_len -= ETH_FCS_LEN;
  
  			if (netif_msg_rx_status(priv)) {
@@ -2843,7 +2843,7 @@
  			}
  
  			/* The zero-copy is always used for all the sizes
-@@ -2619,8 +2609,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2628,8 +2618,9 @@ static int stmmac_rx(struct stmmac_priv
  			} else {
  				skb = priv->rx_skbuff[entry];
  				if (unlikely(!skb)) {
@@ -2855,7 +2855,7 @@
  					priv->dev->stats.rx_dropped++;
  					break;
  				}
-@@ -2636,7 +2627,8 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2645,7 +2636,8 @@ static int stmmac_rx(struct stmmac_priv
  			}
  
  			if (netif_msg_pktdata(priv)) {
@@ -2865,7 +2865,7 @@
  				print_pkt(skb->data, frame_len);
  			}
  
-@@ -2739,7 +2731,7 @@ static int stmmac_change_mtu(struct net_
+@@ -2748,7 +2740,7 @@ static int stmmac_change_mtu(struct net_
  	int max_mtu;
  
  	if (netif_running(dev)) {
@@ -2874,7 +2874,7 @@
  		return -EBUSY;
  	}
  
-@@ -2831,7 +2823,7 @@ static irqreturn_t stmmac_interrupt(int
+@@ -2840,7 +2832,7 @@ static irqreturn_t stmmac_interrupt(int
  		pm_wakeup_event(priv->device, 0);
  
  	if (unlikely(!dev)) {
@@ -2883,7 +2883,7 @@
  		return IRQ_NONE;
  	}
  
-@@ -2889,7 +2881,6 @@ static void stmmac_poll_controller(struc
+@@ -2898,7 +2890,6 @@ static void stmmac_poll_controller(struc
   */
  static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
  {
@@ -2891,7 +2891,7 @@
  	int ret = -EOPNOTSUPP;
  
  	if (!netif_running(dev))
-@@ -2899,9 +2890,9 @@ static int stmmac_ioctl(struct net_devic
+@@ -2908,9 +2899,9 @@ static int stmmac_ioctl(struct net_devic
  	case SIOCGMIIPHY:
  	case SIOCGMIIREG:
  	case SIOCSMIIREG:
@@ -2903,7 +2903,7 @@
  		break;
  	case SIOCSHWTSTAMP:
  		ret = stmmac_hwtstamp_ioctl(dev, rq);
-@@ -2929,14 +2920,17 @@ static void sysfs_display_ring(void *hea
+@@ -2938,14 +2929,17 @@ static void sysfs_display_ring(void *hea
  			x = *(u64 *) ep;
  			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
  				   i, (unsigned int)virt_to_phys(ep),
@@ -2924,7 +2924,7 @@
  			p++;
  		}
  		seq_printf(seq, "\n");
-@@ -2968,6 +2962,8 @@ static int stmmac_sysfs_ring_open(struct
+@@ -2977,6 +2971,8 @@ static int stmmac_sysfs_ring_open(struct
  	return single_open(file, stmmac_sysfs_ring_read, inode->i_private);
  }
  
@@ -2933,7 +2933,7 @@
  static const struct file_operations stmmac_rings_status_fops = {
  	.owner = THIS_MODULE,
  	.open = stmmac_sysfs_ring_open,
-@@ -2990,11 +2986,11 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -2999,11 +2995,11 @@ static int stmmac_sysfs_dma_cap_read(str
  	seq_printf(seq, "\tDMA HW features\n");
  	seq_printf(seq, "==============================\n");
  
@@ -2948,7 +2948,7 @@
  		   (priv->dma_cap.half_duplex) ? "Y" : "N");
  	seq_printf(seq, "\tHash Filter: %s\n",
  		   (priv->dma_cap.hash_filter) ? "Y" : "N");
-@@ -3012,9 +3008,9 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -3021,9 +3017,9 @@ static int stmmac_sysfs_dma_cap_read(str
  		   (priv->dma_cap.rmon) ? "Y" : "N");
  	seq_printf(seq, "\tIEEE 1588-2002 Time Stamp: %s\n",
  		   (priv->dma_cap.time_stamp) ? "Y" : "N");
@@ -2960,7 +2960,7 @@
  		   (priv->dma_cap.eee) ? "Y" : "N");
  	seq_printf(seq, "\tAV features: %s\n", (priv->dma_cap.av) ? "Y" : "N");
  	seq_printf(seq, "\tChecksum Offload in TX: %s\n",
-@@ -3061,8 +3057,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3070,8 +3066,7 @@ static int stmmac_init_fs(struct net_dev
  	priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);
  
  	if (!priv->dbgfs_dir || IS_ERR(priv->dbgfs_dir)) {
@@ -2970,7 +2970,7 @@
  
  		return -ENOMEM;
  	}
-@@ -3074,7 +3069,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3083,7 +3078,7 @@ static int stmmac_init_fs(struct net_dev
  				    &stmmac_rings_status_fops);
  
  	if (!priv->dbgfs_rings_status || IS_ERR(priv->dbgfs_rings_status)) {
@@ -2979,7 +2979,7 @@
  		debugfs_remove_recursive(priv->dbgfs_dir);
  
  		return -ENOMEM;
-@@ -3086,7 +3081,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3095,7 +3090,7 @@ static int stmmac_init_fs(struct net_dev
  					    dev, &stmmac_dma_cap_fops);
  
  	if (!priv->dbgfs_dma_cap || IS_ERR(priv->dbgfs_dma_cap)) {
@@ -2988,7 +2988,7 @@
  		debugfs_remove_recursive(priv->dbgfs_dir);
  
  		return -ENOMEM;
-@@ -3158,11 +3153,11 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3167,11 +3162,11 @@ static int stmmac_hw_init(struct stmmac_
  	} else {
  		if (chain_mode) {
  			priv->hw->mode = &chain_mode_ops;
@@ -3002,7 +3002,7 @@
  			priv->mode = STMMAC_RING_MODE;
  		}
  	}
-@@ -3170,7 +3165,7 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3179,7 +3174,7 @@ static int stmmac_hw_init(struct stmmac_
  	/* Get the HW capability (new GMAC newer than 3.50a) */
  	priv->hw_cap_support = stmmac_get_hw_features(priv);
  	if (priv->hw_cap_support) {
@@ -3011,7 +3011,7 @@
  
  		/* We can override some gmac/dma configuration fields: e.g.
  		 * enh_desc, tx_coe (e.g. that are passed through the
-@@ -3195,8 +3190,9 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3204,8 +3199,9 @@ static int stmmac_hw_init(struct stmmac_
  		else if (priv->dma_cap.rx_coe_type1)
  			priv->plat->rx_coe = STMMAC_RX_COE_TYPE1;
  
@@ -3023,7 +3023,7 @@
  
  	/* To use alternate (extended), normal or GMAC4 descriptor structures */
  	if (priv->synopsys_id >= DWMAC_CORE_4_00)
-@@ -3206,20 +3202,20 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3215,20 +3211,20 @@ static int stmmac_hw_init(struct stmmac_
  
  	if (priv->plat->rx_coe) {
  		priv->hw->rx_csum = priv->plat->rx_coe;
@@ -3049,7 +3049,7 @@
  
  	return 0;
  }
-@@ -3278,8 +3274,8 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3287,8 +3283,8 @@ int stmmac_dvr_probe(struct device *devi
  
  	priv->stmmac_clk = devm_clk_get(priv->device, STMMAC_RESOURCE_NAME);
  	if (IS_ERR(priv->stmmac_clk)) {
@@ -3060,7 +3060,7 @@
  		/* If failed to obtain stmmac_clk and specific clk_csr value
  		 * is NOT passed from the platform, probe fail.
  		 */
-@@ -3328,7 +3324,7 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3337,7 +3333,7 @@ int stmmac_dvr_probe(struct device *devi
  	if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) {
  		ndev->hw_features |= NETIF_F_TSO;
  		priv->tso = true;
@@ -3069,7 +3069,7 @@
  	}
  	ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
  	ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
-@@ -3348,13 +3344,13 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3357,13 +3353,13 @@ int stmmac_dvr_probe(struct device *devi
  	 */
  	if ((priv->synopsys_id >= DWMAC_CORE_3_50) && (!priv->plat->riwt_off)) {
  		priv->use_riwt = 1;
@@ -3085,7 +3085,7 @@
  
  	/* If a specific clk_csr value is passed from the platform
  	 * this means that the CSR Clock Range selection cannot be
-@@ -3375,15 +3371,17 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3384,15 +3380,17 @@ int stmmac_dvr_probe(struct device *devi
  		/* MDIO bus Registration */
  		ret = stmmac_mdio_register(ndev);
  		if (ret < 0) {
@@ -3107,7 +3107,7 @@
  		goto error_netdev_register;
  	}
  
-@@ -3394,7 +3392,7 @@ error_netdev_register:
+@@ -3403,7 +3401,7 @@ error_netdev_register:
  	    priv->hw->pcs != STMMAC_PCS_TBI &&
  	    priv->hw->pcs != STMMAC_PCS_RTBI)
  		stmmac_mdio_unregister(ndev);
@@ -3116,7 +3116,7 @@
  	netif_napi_del(&priv->napi);
  error_hw_init:
  	clk_disable_unprepare(priv->pclk);
-@@ -3418,7 +3416,7 @@ int stmmac_dvr_remove(struct device *dev
+@@ -3427,7 +3425,7 @@ int stmmac_dvr_remove(struct device *dev
  	struct net_device *ndev = dev_get_drvdata(dev);
  	struct stmmac_priv *priv = netdev_priv(ndev);
  
@@ -3125,7 +3125,7 @@
  
  	priv->hw->dma->stop_rx(priv->ioaddr);
  	priv->hw->dma->stop_tx(priv->ioaddr);
-@@ -3456,8 +3454,8 @@ int stmmac_suspend(struct device *dev)
+@@ -3465,8 +3463,8 @@ int stmmac_suspend(struct device *dev)
  	if (!ndev || !netif_running(ndev))
  		return 0;
  
@@ -3136,7 +3136,7 @@
  
  	spin_lock_irqsave(&priv->lock, flags);
  
-@@ -3551,8 +3549,8 @@ int stmmac_resume(struct device *dev)
+@@ -3560,8 +3558,8 @@ int stmmac_resume(struct device *dev)
  
  	spin_unlock_irqrestore(&priv->lock, flags);
  
diff --git a/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch b/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch
index 31d045670b..95eb3deeb0 100644
--- a/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch
+++ b/target/linux/sunxi/patches-4.9/0051-stmmac-form-4-11.patch
@@ -1469,7 +1469,7 @@
   *  a proprietary structure used to pass information to the driver.
   *  Description:
   *  This function configures the MAC to enable/disable both outgoing(TX)
-@@ -612,7 +609,7 @@ static int stmmac_hwtstamp_ioctl(struct
+@@ -621,7 +618,7 @@ static int stmmac_hwtstamp_ioctl(struct
  
  		/* program Sub Second Increment reg */
  		sec_inc = priv->hw->ptp->config_sub_second_increment(
@@ -1478,7 +1478,7 @@
  			priv->plat->has_gmac4);
  		temp = div_u64(1000000000ULL, sec_inc);
  
-@@ -622,7 +619,7 @@ static int stmmac_hwtstamp_ioctl(struct
+@@ -631,7 +628,7 @@ static int stmmac_hwtstamp_ioctl(struct
  		 * where, freq_div_ratio = 1e9ns/sec_inc
  		 */
  		temp = (u64)(temp << 32);
@@ -1487,7 +1487,7 @@
  		priv->hw->ptp->config_addend(priv->ptpaddr,
  					     priv->default_addend);
  
-@@ -650,18 +647,6 @@ static int stmmac_init_ptp(struct stmmac
+@@ -659,18 +656,6 @@ static int stmmac_init_ptp(struct stmmac
  	if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))
  		return -EOPNOTSUPP;
  
@@ -1506,7 +1506,7 @@
  	priv->adv_ts = 0;
  	/* Check if adv_ts can be enabled for dwmac 4.x core */
  	if (priv->plat->has_gmac4 && priv->dma_cap.atime_stamp)
-@@ -688,8 +673,8 @@ static int stmmac_init_ptp(struct stmmac
+@@ -697,8 +682,8 @@ static int stmmac_init_ptp(struct stmmac
  
  static void stmmac_release_ptp(struct stmmac_priv *priv)
  {
@@ -1517,7 +1517,7 @@
  	stmmac_ptp_unregister(priv);
  }
  
-@@ -710,7 +695,7 @@ static void stmmac_adjust_link(struct ne
+@@ -719,7 +704,7 @@ static void stmmac_adjust_link(struct ne
  	int new_state = 0;
  	unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
  
@@ -1526,7 +1526,7 @@
  		return;
  
  	spin_lock_irqsave(&priv->lock, flags);
-@@ -737,33 +722,36 @@ static void stmmac_adjust_link(struct ne
+@@ -746,33 +731,36 @@ static void stmmac_adjust_link(struct ne
  			new_state = 1;
  			switch (phydev->speed) {
  			case 1000:
@@ -1577,7 +1577,7 @@
  			priv->speed = phydev->speed;
  		}
  
-@@ -776,8 +764,8 @@ static void stmmac_adjust_link(struct ne
+@@ -785,8 +773,8 @@ static void stmmac_adjust_link(struct ne
  	} else if (priv->oldlink) {
  		new_state = 1;
  		priv->oldlink = 0;
@@ -1588,7 +1588,7 @@
  	}
  
  	if (new_state && netif_msg_link(priv))
-@@ -839,8 +827,8 @@ static int stmmac_init_phy(struct net_de
+@@ -848,8 +836,8 @@ static int stmmac_init_phy(struct net_de
  	int interface = priv->plat->interface;
  	int max_speed = priv->plat->max_speed;
  	priv->oldlink = 0;
@@ -1599,7 +1599,7 @@
  
  	if (priv->plat->phy_node) {
  		phydev = of_phy_connect(dev, priv->plat->phy_node,
-@@ -892,9 +880,7 @@ static int stmmac_init_phy(struct net_de
+@@ -901,9 +889,7 @@ static int stmmac_init_phy(struct net_de
  	if (phydev->is_pseudo_fixed_link)
  		phydev->irq = PHY_POLL;
  
@@ -1610,7 +1610,7 @@
  	return 0;
  }
  
-@@ -1020,7 +1006,7 @@ static void stmmac_free_rx_buffers(struc
+@@ -1029,7 +1015,7 @@ static void stmmac_free_rx_buffers(struc
   * @dev: net device structure
   * @flags: gfp flag.
   * Description: this function initializes the DMA RX/TX descriptors
@@ -1619,7 +1619,7 @@
   * modes.
   */
  static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
-@@ -1133,13 +1119,6 @@ static void dma_free_tx_skbufs(struct st
+@@ -1142,13 +1128,6 @@ static void dma_free_tx_skbufs(struct st
  	int i;
  
  	for (i = 0; i < DMA_TX_SIZE; i++) {
@@ -1633,7 +1633,7 @@
  		if (priv->tx_skbuff_dma[i].buf) {
  			if (priv->tx_skbuff_dma[i].map_as_page)
  				dma_unmap_page(priv->device,
-@@ -1153,7 +1132,7 @@ static void dma_free_tx_skbufs(struct st
+@@ -1162,7 +1141,7 @@ static void dma_free_tx_skbufs(struct st
  						 DMA_TO_DEVICE);
  		}
  
@@ -1642,7 +1642,7 @@
  			dev_kfree_skb_any(priv->tx_skbuff[i]);
  			priv->tx_skbuff[i] = NULL;
  			priv->tx_skbuff_dma[i].buf = 0;
-@@ -1277,6 +1256,28 @@ static void free_dma_desc_resources(stru
+@@ -1286,6 +1265,28 @@ static void free_dma_desc_resources(stru
  }
  
  /**
@@ -1671,7 +1671,7 @@
   *  stmmac_dma_operation_mode - HW DMA operation mode
   *  @priv: driver private structure
   *  Description: it is used for configuring the DMA operation mode register in
-@@ -1677,10 +1678,6 @@ static int stmmac_hw_setup(struct net_de
+@@ -1686,10 +1687,6 @@ static int stmmac_hw_setup(struct net_de
  	/* Copy the MAC addr into the HW  */
  	priv->hw->mac->set_umac_addr(priv->hw, dev->dev_addr, 0);
  
@@ -1682,7 +1682,7 @@
  	/* PS and related bits will be programmed according to the speed */
  	if (priv->hw->pcs) {
  		int speed = priv->plat->mac_port_sel_speed;
-@@ -1697,6 +1694,10 @@ static int stmmac_hw_setup(struct net_de
+@@ -1706,6 +1703,10 @@ static int stmmac_hw_setup(struct net_de
  	/* Initialize the MAC Core */
  	priv->hw->mac->core_init(priv->hw, dev->mtu);
  
@@ -1693,7 +1693,7 @@
  	ret = priv->hw->mac->rx_ipc(priv->hw);
  	if (!ret) {
  		netdev_warn(priv->dev, "RX IPC Checksum Offload disabled\n");
-@@ -1717,8 +1718,10 @@ static int stmmac_hw_setup(struct net_de
+@@ -1726,8 +1727,10 @@ static int stmmac_hw_setup(struct net_de
  
  	if (init_ptp) {
  		ret = stmmac_init_ptp(priv);
@@ -1706,7 +1706,7 @@
  	}
  
  #ifdef CONFIG_DEBUG_FS
-@@ -1732,11 +1735,6 @@ static int stmmac_hw_setup(struct net_de
+@@ -1741,11 +1744,6 @@ static int stmmac_hw_setup(struct net_de
  	priv->hw->dma->start_tx(priv->ioaddr);
  	priv->hw->dma->start_rx(priv->ioaddr);
  
@@ -1718,7 +1718,7 @@
  	priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
  
  	if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
-@@ -2526,7 +2524,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2535,7 +2533,7 @@ static int stmmac_rx(struct stmmac_priv
  		if (unlikely(status == discard_frame)) {
  			priv->dev->stats.rx_errors++;
  			if (priv->hwts_rx_en && !priv->extend_desc) {
@@ -1727,7 +1727,7 @@
  				 * with timestamp value, hence reinitialize
  				 * them in stmmac_rx_refill() function so that
  				 * device can reuse it.
-@@ -2549,7 +2547,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2558,7 +2556,7 @@ static int stmmac_rx(struct stmmac_priv
  
  			frame_len = priv->hw->desc->get_rx_frame_len(p, coe);
  
@@ -1736,7 +1736,7 @@
  			 *  (preallocated during init) then the packet is
  			 *  ignored
  			 */
-@@ -2769,7 +2767,7 @@ static netdev_features_t stmmac_fix_feat
+@@ -2778,7 +2776,7 @@ static netdev_features_t stmmac_fix_feat
  	/* Some GMAC devices have a bugged Jumbo frame support that
  	 * needs to have the Tx COE disabled for oversized frames
  	 * (due to limited buffer sizes). In this case we disable
@@ -1745,7 +1745,7 @@
  	 */
  	if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN))
  		features &= ~NETIF_F_CSUM_MASK;
-@@ -2915,9 +2913,7 @@ static void sysfs_display_ring(void *hea
+@@ -2924,9 +2922,7 @@ static void sysfs_display_ring(void *hea
  	struct dma_desc *p = (struct dma_desc *)head;
  
  	for (i = 0; i < size; i++) {
@@ -1755,7 +1755,7 @@
  			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
  				   i, (unsigned int)virt_to_phys(ep),
  				   le32_to_cpu(ep->basic.des0),
-@@ -2926,7 +2922,6 @@ static void sysfs_display_ring(void *hea
+@@ -2935,7 +2931,6 @@ static void sysfs_display_ring(void *hea
  				   le32_to_cpu(ep->basic.des3));
  			ep++;
  		} else {
@@ -1763,7 +1763,7 @@
  			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
  				   i, (unsigned int)virt_to_phys(ep),
  				   le32_to_cpu(p->des0), le32_to_cpu(p->des1),
-@@ -2996,7 +2991,7 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -3005,7 +3000,7 @@ static int stmmac_sysfs_dma_cap_read(str
  		   (priv->dma_cap.hash_filter) ? "Y" : "N");
  	seq_printf(seq, "\tMultiple MAC address registers: %s\n",
  		   (priv->dma_cap.multi_addr) ? "Y" : "N");
@@ -1772,7 +1772,7 @@
  		   (priv->dma_cap.pcs) ? "Y" : "N");
  	seq_printf(seq, "\tSMA (MDIO) Interface: %s\n",
  		   (priv->dma_cap.sma_mdio) ? "Y" : "N");
-@@ -3272,44 +3267,8 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3281,44 +3276,8 @@ int stmmac_dvr_probe(struct device *devi
  	if ((phyaddr >= 0) && (phyaddr <= 31))
  		priv->plat->phy_addr = phyaddr;
  
@@ -1819,7 +1819,7 @@
  
  	/* Init MAC and get the capabilities */
  	ret = stmmac_hw_init(priv);
-@@ -3395,10 +3354,6 @@ error_netdev_register:
+@@ -3404,10 +3363,6 @@ error_netdev_register:
  error_mdio_register:
  	netif_napi_del(&priv->napi);
  error_hw_init:
@@ -1830,7 +1830,7 @@
  	free_netdev(ndev);
  
  	return ret;
-@@ -3424,10 +3379,10 @@ int stmmac_dvr_remove(struct device *dev
+@@ -3433,10 +3388,10 @@ int stmmac_dvr_remove(struct device *dev
  	stmmac_set_mac(priv->ioaddr, false);
  	netif_carrier_off(ndev);
  	unregister_netdev(ndev);
@@ -1845,7 +1845,7 @@
  	if (priv->hw->pcs != STMMAC_PCS_RGMII &&
  	    priv->hw->pcs != STMMAC_PCS_TBI &&
  	    priv->hw->pcs != STMMAC_PCS_RTBI)
-@@ -3476,14 +3431,14 @@ int stmmac_suspend(struct device *dev)
+@@ -3485,14 +3440,14 @@ int stmmac_suspend(struct device *dev)
  		stmmac_set_mac(priv->ioaddr, false);
  		pinctrl_pm_select_sleep_state(priv->device);
  		/* Disable clock in case of PWM is off */
@@ -1864,7 +1864,7 @@
  	return 0;
  }
  EXPORT_SYMBOL_GPL(stmmac_suspend);
-@@ -3516,9 +3471,9 @@ int stmmac_resume(struct device *dev)
+@@ -3525,9 +3480,9 @@ int stmmac_resume(struct device *dev)
  		priv->irq_wake = 0;
  	} else {
  		pinctrl_pm_select_default_state(priv->device);
diff --git a/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch b/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch
index 1356a4b9e9..aa6b813daf 100644
--- a/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch
+++ b/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch
@@ -2782,43 +2782,7 @@
  	}
  }
  
-@@ -477,7 +552,10 @@ static int stmmac_hwtstamp_ioctl(struct
- 			/* PTP v1, UDP, any kind of event packet */
- 			config.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
- 			/* take time stamp for all event messages */
--			snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
-+			if (priv->plat->has_gmac4)
-+				snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
-+			else
-+				snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
- 
- 			ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
- 			ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
-@@ -509,7 +587,10 @@ static int stmmac_hwtstamp_ioctl(struct
- 			config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
- 			ptp_v2 = PTP_TCR_TSVER2ENA;
- 			/* take time stamp for all event messages */
--			snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
-+			if (priv->plat->has_gmac4)
-+				snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
-+			else
-+				snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
- 
- 			ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
- 			ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
-@@ -543,7 +624,10 @@ static int stmmac_hwtstamp_ioctl(struct
- 			config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
- 			ptp_v2 = PTP_TCR_TSVER2ENA;
- 			/* take time stamp for all event messages */
--			snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
-+			if (priv->plat->has_gmac4)
-+				snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
-+			else
-+				snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
- 
- 			ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
- 			ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
-@@ -679,6 +763,19 @@ static void stmmac_release_ptp(struct st
+@@ -688,6 +763,19 @@ static void stmmac_release_ptp(struct st
  }
  
  /**
@@ -2838,7 +2802,7 @@
   * stmmac_adjust_link - adjusts the link parameters
   * @dev: net device structure
   * Description: this is the helper called by the physical abstraction layer
-@@ -693,7 +790,6 @@ static void stmmac_adjust_link(struct ne
+@@ -702,7 +790,6 @@ static void stmmac_adjust_link(struct ne
  	struct phy_device *phydev = dev->phydev;
  	unsigned long flags;
  	int new_state = 0;
@@ -2846,7 +2810,7 @@
  
  	if (!phydev)
  		return;
-@@ -715,8 +811,7 @@ static void stmmac_adjust_link(struct ne
+@@ -724,8 +811,7 @@ static void stmmac_adjust_link(struct ne
  		}
  		/* Flow Control operation */
  		if (phydev->pause)
@@ -2856,7 +2820,7 @@
  
  		if (phydev->speed != priv->speed) {
  			new_state = 1;
-@@ -884,22 +979,56 @@ static int stmmac_init_phy(struct net_de
+@@ -893,22 +979,56 @@ static int stmmac_init_phy(struct net_de
  	return 0;
  }
  
@@ -2887,7 +2851,7 @@
 +
 +		/* Display RX ring */
 +		priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true);
- 	}
++	}
 +}
 +
 +static void stmmac_display_tx_rings(struct stmmac_priv *priv)
@@ -2906,26 +2870,26 @@
 +			head_tx = (void *)tx_q->dma_etx;
 +		else
 +			head_tx = (void *)tx_q->dma_tx;
- 
--	/* Display Rx ring */
--	priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true);
--	/* Display Tx ring */
--	priv->hw->desc->display_ring(head_tx, DMA_TX_SIZE, false);
++
 +		priv->hw->desc->display_ring(head_tx, DMA_TX_SIZE, false);
-+	}
+ 	}
 +}
 +
 +static void stmmac_display_rings(struct stmmac_priv *priv)
 +{
 +	/* Display RX ring */
 +	stmmac_display_rx_rings(priv);
-+
+ 
+-	/* Display Rx ring */
+-	priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true);
+-	/* Display Tx ring */
+-	priv->hw->desc->display_ring(head_tx, DMA_TX_SIZE, false);
 +	/* Display TX ring */
 +	stmmac_display_tx_rings(priv);
  }
  
  static int stmmac_set_bfsize(int mtu, int bufsize)
-@@ -919,48 +1048,88 @@ static int stmmac_set_bfsize(int mtu, in
+@@ -928,48 +1048,88 @@ static int stmmac_set_bfsize(int mtu, in
  }
  
  /**
@@ -3024,7 +2988,7 @@
  	struct sk_buff *skb;
  
  	skb = __netdev_alloc_skb_ip_align(priv->dev, priv->dma_buf_sz, flags);
-@@ -969,20 +1138,20 @@ static int stmmac_init_rx_buffers(struct
+@@ -978,20 +1138,20 @@ static int stmmac_init_rx_buffers(struct
  			   "%s: Rx init fails; skb is NULL\n", __func__);
  		return -ENOMEM;
  	}
@@ -3050,7 +3014,7 @@
  
  	if ((priv->hw->mode->init_desc3) &&
  	    (priv->dma_buf_sz == BUF_SIZE_16KiB))
-@@ -991,30 +1160,71 @@ static int stmmac_init_rx_buffers(struct
+@@ -1000,30 +1160,71 @@ static int stmmac_init_rx_buffers(struct
  	return 0;
  }
  
@@ -3131,7 +3095,7 @@
  
  	if (priv->hw->mode->set_16kib_bfsize)
  		bfsize = priv->hw->mode->set_16kib_bfsize(dev->mtu);
-@@ -1024,235 +1234,409 @@ static int init_dma_desc_rings(struct ne
+@@ -1033,235 +1234,409 @@ static int init_dma_desc_rings(struct ne
  
  	priv->dma_buf_sz = bfsize;
  
@@ -3151,11 +3115,17 @@
 -			p = priv->dma_rx + i;
 +	for (queue = 0; queue < rx_count; queue++) {
 +		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
-+
+ 
+-		ret = stmmac_init_rx_buffers(priv, p, i, flags);
+-		if (ret)
+-			goto err_init_rx_buffers;
 +		netif_dbg(priv, probe, priv->dev,
 +			  "(%s) dma_rx_phy=0x%08x\n", __func__,
 +			  (u32)rx_q->dma_rx_phy);
-+
+ 
+-		netif_dbg(priv, probe, priv->dev, "[%p]\t[%p]\t[%x]\n",
+-			  priv->rx_skbuff[i], priv->rx_skbuff[i]->data,
+-			  (unsigned int)priv->rx_skbuff_dma[i]);
 +		for (i = 0; i < DMA_RX_SIZE; i++) {
 +			struct dma_desc *p;
 +
@@ -3173,16 +3143,10 @@
 +				  rx_q->rx_skbuff[i], rx_q->rx_skbuff[i]->data,
 +				  (unsigned int)rx_q->rx_skbuff_dma[i]);
 +		}
- 
--		ret = stmmac_init_rx_buffers(priv, p, i, flags);
--		if (ret)
--			goto err_init_rx_buffers;
++
 +		rx_q->cur_rx = 0;
 +		rx_q->dirty_rx = (unsigned int)(i - DMA_RX_SIZE);
- 
--		netif_dbg(priv, probe, priv->dev, "[%p]\t[%p]\t[%x]\n",
--			  priv->rx_skbuff[i], priv->rx_skbuff[i]->data,
--			  (unsigned int)priv->rx_skbuff_dma[i]);
++
 +		stmmac_clear_rx_descriptors(priv, queue);
 +
 +		/* Setup the chained descriptor addresses */
@@ -3644,9 +3608,9 @@
 +err_dma_buffers:
 +	free_dma_tx_desc_resources(priv);
 +
- 	return ret;
- }
- 
++	return ret;
++}
++
 +/**
 + * alloc_dma_desc_resources - alloc TX/RX resources.
 + * @priv: private structure
@@ -3665,9 +3629,9 @@
 +
 +	ret = alloc_dma_tx_desc_resources(priv);
 +
-+	return ret;
-+}
-+
+ 	return ret;
+ }
+ 
 +/**
 + * free_dma_desc_resources - free dma desc resources
 + * @priv: private structure
@@ -3706,7 +3670,7 @@
  }
  
  /**
-@@ -1262,19 +1646,104 @@ static void free_dma_desc_resources(stru
+@@ -1271,19 +1646,104 @@ static void free_dma_desc_resources(stru
   */
  static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv)
  {
@@ -3822,7 +3786,7 @@
  }
  
  /**
-@@ -1285,11 +1754,20 @@ static void stmmac_mac_enable_rx_queues(
+@@ -1294,11 +1754,20 @@ static void stmmac_mac_enable_rx_queues(
   */
  static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
  {
@@ -3847,7 +3811,7 @@
  		/*
  		 * In case of GMAC, SF mode can be enabled
  		 * to perform the TX COE in HW. This depends on:
-@@ -1297,37 +1775,53 @@ static void stmmac_dma_operation_mode(st
+@@ -1306,37 +1775,53 @@ static void stmmac_dma_operation_mode(st
  		 * 2) There is no bugged Jumbo frame support
  		 *    that needs to not insert csum in the TDES.
  		 */
@@ -3911,7 +3875,7 @@
  
  		status = priv->hw->desc->tx_status(&priv->dev->stats,
  						      &priv->xstats, p,
-@@ -1348,48 +1842,51 @@ static void stmmac_tx_clean(struct stmma
+@@ -1357,48 +1842,51 @@ static void stmmac_tx_clean(struct stmma
  			stmmac_get_tx_hwtstamp(priv, p, skb);
  		}
  
@@ -3981,7 +3945,7 @@
  	}
  
  	if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) {
-@@ -1399,45 +1896,76 @@ static void stmmac_tx_clean(struct stmma
+@@ -1408,45 +1896,76 @@ static void stmmac_tx_clean(struct stmma
  	netif_tx_unlock(priv->dev);
  }
  
@@ -4073,7 +4037,7 @@
  }
  
  /**
-@@ -1449,31 +1977,43 @@ static void stmmac_tx_err(struct stmmac_
+@@ -1458,31 +1977,43 @@ static void stmmac_tx_err(struct stmmac_
   */
  static void stmmac_dma_interrupt(struct stmmac_priv *priv)
  {
@@ -4138,7 +4102,7 @@
  }
  
  /**
-@@ -1580,6 +2120,13 @@ static void stmmac_check_ether_addr(stru
+@@ -1589,6 +2120,13 @@ static void stmmac_check_ether_addr(stru
   */
  static int stmmac_init_dma_engine(struct stmmac_priv *priv)
  {
@@ -4152,7 +4116,7 @@
  	int atds = 0;
  	int ret = 0;
  
-@@ -1597,19 +2144,49 @@ static int stmmac_init_dma_engine(struct
+@@ -1606,19 +2144,49 @@ static int stmmac_init_dma_engine(struct
  		return ret;
  	}
  
@@ -4214,7 +4178,7 @@
  	}
  
  	if (priv->plat->axi && priv->hw->dma->axi)
-@@ -1627,8 +2204,12 @@ static int stmmac_init_dma_engine(struct
+@@ -1636,8 +2204,12 @@ static int stmmac_init_dma_engine(struct
  static void stmmac_tx_timer(unsigned long data)
  {
  	struct stmmac_priv *priv = (struct stmmac_priv *)data;
@@ -4228,7 +4192,7 @@
  }
  
  /**
-@@ -1650,6 +2231,196 @@ static void stmmac_init_tx_coalesce(stru
+@@ -1659,6 +2231,196 @@ static void stmmac_init_tx_coalesce(stru
  	add_timer(&priv->txtimer);
  }
  
@@ -4425,7 +4389,7 @@
  /**
   * stmmac_hw_setup - setup mac in a usable state.
   *  @dev : pointer to the device structure.
-@@ -1665,6 +2436,9 @@ static void stmmac_init_tx_coalesce(stru
+@@ -1674,6 +2436,9 @@ static void stmmac_init_tx_coalesce(stru
  static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
  {
  	struct stmmac_priv *priv = netdev_priv(dev);
@@ -4435,7 +4399,7 @@
  	int ret;
  
  	/* DMA initialization and SW reset */
-@@ -1694,9 +2468,9 @@ static int stmmac_hw_setup(struct net_de
+@@ -1703,9 +2468,9 @@ static int stmmac_hw_setup(struct net_de
  	/* Initialize the MAC Core */
  	priv->hw->mac->core_init(priv->hw, dev->mtu);
  
@@ -4448,7 +4412,7 @@
  
  	ret = priv->hw->mac->rx_ipc(priv->hw);
  	if (!ret) {
-@@ -1706,10 +2480,7 @@ static int stmmac_hw_setup(struct net_de
+@@ -1715,10 +2480,7 @@ static int stmmac_hw_setup(struct net_de
  	}
  
  	/* Enable the MAC Rx/Tx */
@@ -4460,7 +4424,7 @@
  
  	/* Set the HW DMA mode and the COE */
  	stmmac_dma_operation_mode(priv);
-@@ -1717,6 +2488,10 @@ static int stmmac_hw_setup(struct net_de
+@@ -1726,6 +2488,10 @@ static int stmmac_hw_setup(struct net_de
  	stmmac_mmc_setup(priv);
  
  	if (init_ptp) {
@@ -4471,7 +4435,7 @@
  		ret = stmmac_init_ptp(priv);
  		if (ret == -EOPNOTSUPP)
  			netdev_warn(priv->dev, "PTP not supported by HW\n");
-@@ -1731,35 +2506,37 @@ static int stmmac_hw_setup(struct net_de
+@@ -1740,35 +2506,37 @@ static int stmmac_hw_setup(struct net_de
  			    __func__);
  #endif
  	/* Start the ball rolling... */
@@ -4523,7 +4487,7 @@
  /**
   *  stmmac_open - open entry point of the driver
   *  @dev : pointer to the device structure.
-@@ -1828,7 +2605,7 @@ static int stmmac_open(struct net_device
+@@ -1837,7 +2605,7 @@ static int stmmac_open(struct net_device
  		netdev_err(priv->dev,
  			   "%s: ERROR: allocating the IRQ %d (error: %d)\n",
  			   __func__, dev->irq, ret);
@@ -4532,7 +4496,7 @@
  	}
  
  	/* Request the Wake IRQ in case of another line is used for WoL */
-@@ -1855,8 +2632,8 @@ static int stmmac_open(struct net_device
+@@ -1864,8 +2632,8 @@ static int stmmac_open(struct net_device
  		}
  	}
  
@@ -4543,7 +4507,7 @@
  
  	return 0;
  
-@@ -1865,7 +2642,12 @@ lpiirq_error:
+@@ -1874,7 +2642,12 @@ lpiirq_error:
  		free_irq(priv->wol_irq, dev);
  wolirq_error:
  	free_irq(dev->irq, dev);
@@ -4556,7 +4520,7 @@
  init_error:
  	free_dma_desc_resources(priv);
  dma_desc_error:
-@@ -1894,9 +2676,9 @@ static int stmmac_release(struct net_dev
+@@ -1903,9 +2676,9 @@ static int stmmac_release(struct net_dev
  		phy_disconnect(dev->phydev);
  	}
  
@@ -4568,7 +4532,7 @@
  
  	del_timer_sync(&priv->txtimer);
  
-@@ -1908,14 +2690,13 @@ static int stmmac_release(struct net_dev
+@@ -1917,14 +2690,13 @@ static int stmmac_release(struct net_dev
  		free_irq(priv->lpi_irq, dev);
  
  	/* Stop TX/RX DMA and clear the descriptors */
@@ -4585,7 +4549,7 @@
  
  	netif_carrier_off(dev);
  
-@@ -1934,22 +2715,24 @@ static int stmmac_release(struct net_dev
+@@ -1943,22 +2715,24 @@ static int stmmac_release(struct net_dev
   *  @des: buffer start address
   *  @total_len: total length to fill in descriptors
   *  @last_segmant: condition for the last descriptor
@@ -4614,7 +4578,7 @@
  
  		desc->des0 = cpu_to_le32(des + (total_len - tmp_len));
  		buff_size = tmp_len >= TSO_MAX_BUFF_SIZE ?
-@@ -1957,7 +2740,7 @@ static void stmmac_tso_allocator(struct
+@@ -1966,7 +2740,7 @@ static void stmmac_tso_allocator(struct
  
  		priv->hw->desc->prepare_tso_tx_desc(desc, 0, buff_size,
  			0, 1,
@@ -4623,7 +4587,7 @@
  			0, 0);
  
  		tmp_len -= TSO_MAX_BUFF_SIZE;
-@@ -1993,23 +2776,28 @@ static void stmmac_tso_allocator(struct
+@@ -2002,23 +2776,28 @@ static void stmmac_tso_allocator(struct
   */
  static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
  {
@@ -4658,7 +4622,7 @@
  			/* This is a hard error, log it. */
  			netdev_err(priv->dev,
  				   "%s: Tx Ring full when queue awake\n",
-@@ -2024,10 +2812,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2033,10 +2812,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
  
  	/* set new MSS value if needed */
  	if (mss != priv->mss) {
@@ -4671,7 +4635,7 @@
  	}
  
  	if (netif_msg_tx_queued(priv)) {
-@@ -2037,9 +2825,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2046,9 +2825,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
  			skb->data_len);
  	}
  
@@ -4683,7 +4647,7 @@
  	first = desc;
  
  	/* first descriptor: fill Headers on Buf1 */
-@@ -2048,9 +2836,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2057,9 +2836,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	if (dma_mapping_error(priv->device, des))
  		goto dma_map_err;
  
@@ -4695,7 +4659,7 @@
  
  	first->des0 = cpu_to_le32(des);
  
-@@ -2061,7 +2848,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2070,7 +2848,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	/* If needed take extra descriptors to fill the remaining payload */
  	tmp_pay_len = pay_len - TSO_MAX_BUFF_SIZE;
  
@@ -4704,7 +4668,7 @@
  
  	/* Prepare fragments */
  	for (i = 0; i < nfrags; i++) {
-@@ -2070,24 +2857,34 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2079,24 +2857,34 @@ static netdev_tx_t stmmac_tso_xmit(struc
  		des = skb_frag_dma_map(priv->device, frag, 0,
  				       skb_frag_size(frag),
  				       DMA_TO_DEVICE);
@@ -4748,7 +4712,7 @@
  	}
  
  	dev->stats.tx_bytes += skb->len;
-@@ -2119,7 +2916,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2128,7 +2916,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
  	priv->hw->desc->prepare_tso_tx_desc(first, 1,
  			proto_hdr_len,
  			pay_len,
@@ -4757,7 +4721,7 @@
  			tcp_hdrlen(skb) / 4, (skb->len - proto_hdr_len));
  
  	/* If context desc is used to change MSS */
-@@ -2134,20 +2931,20 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2143,20 +2931,20 @@ static netdev_tx_t stmmac_tso_xmit(struc
  
  	if (netif_msg_pktdata(priv)) {
  		pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
@@ -4784,7 +4748,7 @@
  
  	return NETDEV_TX_OK;
  
-@@ -2171,21 +2968,27 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2180,21 +2968,27 @@ static netdev_tx_t stmmac_xmit(struct sk
  	struct stmmac_priv *priv = netdev_priv(dev);
  	unsigned int nopaged_len = skb_headlen(skb);
  	int i, csum_insertion = 0, is_jumbo = 0;
@@ -4816,7 +4780,7 @@
  			/* This is a hard error, log it. */
  			netdev_err(priv->dev,
  				   "%s: Tx Ring full when queue awake\n",
-@@ -2197,20 +3000,18 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2206,20 +3000,18 @@ static netdev_tx_t stmmac_xmit(struct sk
  	if (priv->tx_path_in_lpi_mode)
  		stmmac_disable_eee_mode(priv);
  
@@ -4840,7 +4804,7 @@
  	enh_desc = priv->plat->enh_desc;
  	/* To program the descriptors according to the size of the frame */
  	if (enh_desc)
-@@ -2218,7 +3019,7 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2227,7 +3019,7 @@ static netdev_tx_t stmmac_xmit(struct sk
  
  	if (unlikely(is_jumbo) && likely(priv->synopsys_id <
  					 DWMAC_CORE_4_00)) {
@@ -4849,7 +4813,7 @@
  		if (unlikely(entry < 0))
  			goto dma_map_err;
  	}
-@@ -2231,48 +3032,56 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2240,48 +3032,56 @@ static netdev_tx_t stmmac_xmit(struct sk
  		entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
  
  		if (likely(priv->extend_desc))
@@ -4919,7 +4883,7 @@
  
  		priv->hw->desc->display_ring(tx_head, DMA_TX_SIZE, false);
  
-@@ -2280,10 +3089,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2289,10 +3089,10 @@ static netdev_tx_t stmmac_xmit(struct sk
  		print_pkt(skb->data, skb->len);
  	}
  
@@ -4932,7 +4896,7 @@
  	}
  
  	dev->stats.tx_bytes += skb->len;
-@@ -2318,14 +3127,14 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2327,14 +3127,14 @@ static netdev_tx_t stmmac_xmit(struct sk
  		if (dma_mapping_error(priv->device, des))
  			goto dma_map_err;
  
@@ -4950,7 +4914,7 @@
  
  		if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
  			     priv->hwts_tx_en)) {
-@@ -2337,7 +3146,7 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2346,7 +3146,7 @@ static netdev_tx_t stmmac_xmit(struct sk
  		/* Prepare the first descriptor setting the OWN bit too */
  		priv->hw->desc->prepare_tx_desc(first, 1, nopaged_len,
  						csum_insertion, priv->mode, 1,
@@ -4959,7 +4923,7 @@
  
  		/* The own bit must be the latest setting done when prepare the
  		 * descriptor and then barrier is needed to make sure that
-@@ -2346,13 +3155,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2355,13 +3155,13 @@ static netdev_tx_t stmmac_xmit(struct sk
  		dma_wmb();
  	}
  
@@ -4976,7 +4940,7 @@
  
  	return NETDEV_TX_OK;
  
-@@ -2380,9 +3189,9 @@ static void stmmac_rx_vlan(struct net_de
+@@ -2389,9 +3189,9 @@ static void stmmac_rx_vlan(struct net_de
  }
  
  
@@ -4988,7 +4952,7 @@
  		return 0;
  
  	return 1;
-@@ -2391,30 +3200,33 @@ static inline int stmmac_rx_threshold_co
+@@ -2400,30 +3200,33 @@ static inline int stmmac_rx_threshold_co
  /**
   * stmmac_rx_refill - refill used skb preallocated buffers
   * @priv: driver private structure
@@ -5029,7 +4993,7 @@
  				if (unlikely(net_ratelimit()))
  					dev_err(priv->device,
  						"fail to alloc skb entry %d\n",
-@@ -2422,28 +3234,28 @@ static inline void stmmac_rx_refill(stru
+@@ -2431,28 +3234,28 @@ static inline void stmmac_rx_refill(stru
  				break;
  			}
  
@@ -5066,7 +5030,7 @@
  
  			netif_dbg(priv, rx_status, priv->dev,
  				  "refill entry #%d\n", entry);
-@@ -2459,31 +3271,33 @@ static inline void stmmac_rx_refill(stru
+@@ -2468,31 +3271,33 @@ static inline void stmmac_rx_refill(stru
  
  		entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
  	}
@@ -5107,7 +5071,7 @@
  
  		priv->hw->desc->display_ring(rx_head, DMA_RX_SIZE, true);
  	}
-@@ -2493,9 +3307,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2502,9 +3307,9 @@ static int stmmac_rx(struct stmmac_priv
  		struct dma_desc *np;
  
  		if (priv->extend_desc)
@@ -5119,7 +5083,7 @@
  
  		/* read the status of the incoming frame */
  		status = priv->hw->desc->rx_status(&priv->dev->stats,
-@@ -2506,20 +3320,20 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2515,20 +3320,20 @@ static int stmmac_rx(struct stmmac_priv
  
  		count++;
  
@@ -5145,7 +5109,7 @@
  							   entry);
  		if (unlikely(status == discard_frame)) {
  			priv->dev->stats.rx_errors++;
-@@ -2529,9 +3343,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2538,9 +3343,9 @@ static int stmmac_rx(struct stmmac_priv
  				 * them in stmmac_rx_refill() function so that
  				 * device can reuse it.
  				 */
@@ -5157,7 +5121,7 @@
  						 priv->dma_buf_sz,
  						 DMA_FROM_DEVICE);
  			}
-@@ -2579,7 +3393,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2588,7 +3393,7 @@ static int stmmac_rx(struct stmmac_priv
  			 */
  			if (unlikely(!priv->plat->has_gmac4 &&
  				     ((frame_len < priv->rx_copybreak) ||
@@ -5166,7 +5130,7 @@
  				skb = netdev_alloc_skb_ip_align(priv->dev,
  								frame_len);
  				if (unlikely(!skb)) {
-@@ -2591,21 +3405,21 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2600,21 +3405,21 @@ static int stmmac_rx(struct stmmac_priv
  				}
  
  				dma_sync_single_for_cpu(priv->device,
@@ -5192,7 +5156,7 @@
  				if (unlikely(!skb)) {
  					netdev_err(priv->dev,
  						   "%s: Inconsistent Rx chain\n",
-@@ -2614,12 +3428,12 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2623,12 +3428,12 @@ static int stmmac_rx(struct stmmac_priv
  					break;
  				}
  				prefetch(skb->data - NET_IP_ALIGN);
@@ -5208,7 +5172,7 @@
  						 priv->dma_buf_sz,
  						 DMA_FROM_DEVICE);
  			}
-@@ -2641,7 +3455,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2650,7 +3455,7 @@ static int stmmac_rx(struct stmmac_priv
  			else
  				skb->ip_summed = CHECKSUM_UNNECESSARY;
  
@@ -5217,7 +5181,7 @@
  
  			priv->dev->stats.rx_packets++;
  			priv->dev->stats.rx_bytes += frame_len;
-@@ -2649,7 +3463,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2658,7 +3463,7 @@ static int stmmac_rx(struct stmmac_priv
  		entry = next_entry;
  	}
  
@@ -5226,7 +5190,7 @@
  
  	priv->xstats.rx_pkt_n += count;
  
-@@ -2666,16 +3480,24 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2675,16 +3480,24 @@ static int stmmac_rx(struct stmmac_priv
   */
  static int stmmac_poll(struct napi_struct *napi, int budget)
  {
@@ -5255,7 +5219,7 @@
  	}
  	return work_done;
  }
-@@ -2691,9 +3513,12 @@ static int stmmac_poll(struct napi_struc
+@@ -2700,9 +3513,12 @@ static int stmmac_poll(struct napi_struc
  static void stmmac_tx_timeout(struct net_device *dev)
  {
  	struct stmmac_priv *priv = netdev_priv(dev);
@@ -5269,7 +5233,7 @@
  }
  
  /**
-@@ -2816,6 +3641,12 @@ static irqreturn_t stmmac_interrupt(int
+@@ -2825,6 +3641,12 @@ static irqreturn_t stmmac_interrupt(int
  {
  	struct net_device *dev = (struct net_device *)dev_id;
  	struct stmmac_priv *priv = netdev_priv(dev);
@@ -5282,7 +5246,7 @@
  
  	if (priv->irq_wake)
  		pm_wakeup_event(priv->device, 0);
-@@ -2829,16 +3660,30 @@ static irqreturn_t stmmac_interrupt(int
+@@ -2838,16 +3660,30 @@ static irqreturn_t stmmac_interrupt(int
  	if ((priv->plat->has_gmac) || (priv->plat->has_gmac4)) {
  		int status = priv->hw->mac->host_irq_status(priv->hw,
  							    &priv->xstats);
@@ -5317,7 +5281,7 @@
  		}
  
  		/* PCS link status */
-@@ -2923,7 +3768,7 @@ static void sysfs_display_ring(void *hea
+@@ -2932,7 +3768,7 @@ static void sysfs_display_ring(void *hea
  			ep++;
  		} else {
  			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
@@ -5326,7 +5290,7 @@
  				   le32_to_cpu(p->des0), le32_to_cpu(p->des1),
  				   le32_to_cpu(p->des2), le32_to_cpu(p->des3));
  			p++;
-@@ -2936,17 +3781,40 @@ static int stmmac_sysfs_ring_read(struct
+@@ -2945,17 +3781,40 @@ static int stmmac_sysfs_ring_read(struct
  {
  	struct net_device *dev = seq->private;
  	struct stmmac_priv *priv = netdev_priv(dev);
@@ -5377,7 +5341,7 @@
  	}
  
  	return 0;
-@@ -3229,11 +4097,14 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3238,11 +4097,14 @@ int stmmac_dvr_probe(struct device *devi
  		     struct plat_stmmacenet_data *plat_dat,
  		     struct stmmac_resources *res)
  {
@@ -5394,7 +5358,7 @@
  	if (!ndev)
  		return -ENOMEM;
  
-@@ -3275,6 +4146,10 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3284,6 +4146,10 @@ int stmmac_dvr_probe(struct device *devi
  	if (ret)
  		goto error_hw_init;
  
@@ -5405,7 +5369,7 @@
  	ndev->netdev_ops = &stmmac_netdev_ops;
  
  	ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-@@ -3307,7 +4182,12 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3316,7 +4182,12 @@ int stmmac_dvr_probe(struct device *devi
  			 "Enable RX Mitigation via HW Watchdog Timer\n");
  	}
  
@@ -5419,7 +5383,7 @@
  
  	spin_lock_init(&priv->lock);
  
-@@ -3352,7 +4232,11 @@ error_netdev_register:
+@@ -3361,7 +4232,11 @@ error_netdev_register:
  	    priv->hw->pcs != STMMAC_PCS_RTBI)
  		stmmac_mdio_unregister(ndev);
  error_mdio_register:
@@ -5432,7 +5396,7 @@
  error_hw_init:
  	free_netdev(ndev);
  
-@@ -3373,10 +4257,9 @@ int stmmac_dvr_remove(struct device *dev
+@@ -3382,10 +4257,9 @@ int stmmac_dvr_remove(struct device *dev
  
  	netdev_info(priv->dev, "%s: removing driver", __func__);
  
@@ -5445,7 +5409,7 @@
  	netif_carrier_off(ndev);
  	unregister_netdev(ndev);
  	if (priv->plat->stmmac_rst)
-@@ -3415,20 +4298,19 @@ int stmmac_suspend(struct device *dev)
+@@ -3424,20 +4298,19 @@ int stmmac_suspend(struct device *dev)
  	spin_lock_irqsave(&priv->lock, flags);
  
  	netif_device_detach(ndev);
@@ -5470,7 +5434,7 @@
  		pinctrl_pm_select_sleep_state(priv->device);
  		/* Disable clock in case of PWM is off */
  		clk_disable(priv->plat->pclk);
-@@ -3444,6 +4326,31 @@ int stmmac_suspend(struct device *dev)
+@@ -3453,6 +4326,31 @@ int stmmac_suspend(struct device *dev)
  EXPORT_SYMBOL_GPL(stmmac_suspend);
  
  /**
@@ -5502,7 +5466,7 @@
   * stmmac_resume - resume callback
   * @dev: device pointer
   * Description: when resume this function is invoked to setup the DMA and CORE
-@@ -3483,10 +4390,8 @@ int stmmac_resume(struct device *dev)
+@@ -3492,10 +4390,8 @@ int stmmac_resume(struct device *dev)
  
  	spin_lock_irqsave(&priv->lock, flags);
  
@@ -5515,7 +5479,7 @@
  	/* reset private mss value to force mss context settings at
  	 * next tso xmit (only used for gmac4).
  	 */
-@@ -3498,9 +4403,9 @@ int stmmac_resume(struct device *dev)
+@@ -3507,9 +4403,9 @@ int stmmac_resume(struct device *dev)
  	stmmac_init_tx_coalesce(priv);
  	stmmac_set_rx_mode(ndev);
  
@@ -5867,18 +5831,6 @@
  		plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
  		dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
  	}
---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
-+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
-@@ -59,7 +59,8 @@
- /* Enable Snapshot for Messages Relevant to Master */
- #define	PTP_TCR_TSMSTRENA	BIT(15)
- /* Select PTP packets for Taking Snapshots */
--#define	PTP_TCR_SNAPTYPSEL_1	GENMASK(17, 16)
-+#define	PTP_TCR_SNAPTYPSEL_1	BIT(16)
-+#define	PTP_GMAC4_TCR_SNAPTYPSEL_1	GENMASK(17, 16)
- /* Enable MAC address for PTP Frame Filtering */
- #define	PTP_TCR_TSENMACADDR	BIT(18)
- 
 --- a/include/linux/stmmac.h
 +++ b/include/linux/stmmac.h
 @@ -28,6 +28,9 @@
