Browse Source

Bump kernel to 4.4.120 and update e2fsprogs

RISCi_ATOM 6 years ago
parent
commit
f569eb5ecc
57 changed files with 333 additions and 4114 deletions
  1. 2 1
      include/kernel-version.mk
  2. 3 0
      target/linux/ar71xx/patches-4.4/004-register_gpio_driver_earlier.patch
  3. 38 0
      target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
  4. 1 1
      target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
  5. 2 2
      target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
  6. 10 10
      target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
  7. 1 1
      target/linux/generic/patches-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch
  8. 0 46
      target/linux/generic/patches-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch
  9. 0 106
      target/linux/generic/patches-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch
  10. 0 39
      target/linux/generic/patches-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch
  11. 0 34
      target/linux/generic/patches-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch
  12. 0 25
      target/linux/generic/patches-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch
  13. 0 175
      target/linux/generic/patches-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch
  14. 0 68
      target/linux/generic/patches-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch
  15. 0 105
      target/linux/generic/patches-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch
  16. 0 407
      target/linux/generic/patches-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch
  17. 0 112
      target/linux/generic/patches-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch
  18. 0 676
      target/linux/generic/patches-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch
  19. 0 384
      target/linux/generic/patches-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch
  20. 0 1260
      target/linux/generic/patches-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch
  21. 0 26
      target/linux/generic/patches-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch
  22. 0 42
      target/linux/generic/patches-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch
  23. 0 28
      target/linux/generic/patches-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch
  24. 0 161
      target/linux/generic/patches-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch
  25. 0 31
      target/linux/generic/patches-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch
  26. 0 33
      target/linux/generic/patches-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch
  27. 0 25
      target/linux/generic/patches-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch
  28. 0 35
      target/linux/generic/patches-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch
  29. 28 0
      target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch
  30. 1 1
      target/linux/generic/patches-4.4/201-extra_optimization.patch
  31. 1 1
      target/linux/generic/patches-4.4/202-reduce_module_size.patch
  32. 11 8
      target/linux/generic/patches-4.4/204-module_strip.patch
  33. 1 1
      target/linux/generic/patches-4.4/221-module_exports.patch
  34. 2 2
      target/linux/generic/patches-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch
  35. 2 2
      target/linux/generic/patches-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch
  36. 11 2
      target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch
  37. 86 0
      target/linux/generic/patches-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch
  38. 1 1
      target/linux/generic/patches-4.4/653-disable_netlink_trim.patch
  39. 1 1
      target/linux/generic/patches-4.4/660-fq_codel_defaults.patch
  40. 2 2
      target/linux/generic/patches-4.4/662-use_fq_codel_by_default.patch
  41. 20 20
      target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
  42. 9 9
      target/linux/generic/patches-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
  43. 5 5
      target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
  44. 1 1
      target/linux/generic/patches-4.4/701-phy_extension.patch
  45. 1 1
      target/linux/generic/patches-4.4/710-phy-add-mdio_register_board_info.patch
  46. 0 88
      target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch
  47. 4 4
      target/linux/generic/patches-4.4/834-ledtrig-libata.patch
  48. 1 1
      target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
  49. 3 3
      target/linux/generic/patches-4.4/902-debloat_proc.patch
  50. 0 80
      target/linux/generic/patches-4.4/903-debloat_direct_io.patch
  51. 2 2
      target/linux/generic/patches-4.4/904-debloat_dma_buf.patch
  52. 0 12
      target/linux/generic/patches-4.4/920-cve-2018-5333-fix.patch
  53. 1 1
      target/linux/generic/patches-4.4/921-use_preinit_as_init.patch
  54. 3 3
      target/linux/generic/patches-4.4/995-mangle_bootargs.patch
  55. 25 29
      target/linux/x86/config-4.4
  56. 1 1
      tools/e2fsprogs/Makefile
  57. 53 0
      tools/e2fsprogs/patches/005-misc-rename-copy_file_range-to-copy_file_chunk.patch

+ 2 - 1
include/kernel-version.mk

@@ -2,9 +2,10 @@
 
 
 LINUX_RELEASE?=1
 LINUX_RELEASE?=1
 
 
-LINUX_VERSION-4.4 = .115
+LINUX_VERSION-4.4 = .120
 
 
 LINUX_KERNEL_HASH-4.4.115 = 184861c36af4094120417c2270abaca4b90a275019f667c79574f6f8e41858ca
 LINUX_KERNEL_HASH-4.4.115 = 184861c36af4094120417c2270abaca4b90a275019f667c79574f6f8e41858ca
+LINUX_KERNEL_HASH-4.4.120 = 667fcda44441106b649afe0952a3f4243ee9a214d9445491a3710e75572bf39f
 
 
 ifdef KERNEL_PATCHVER
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))

+ 3 - 0
target/linux/ar71xx/patches-4.4/004-register_gpio_driver_earlier.patch

@@ -1,3 +1,6 @@
+HACK: register the GPIO driver earlier to ensure that gpio_request calls
+from mach files succeed.
+
 --- a/drivers/gpio/gpio-ath79.c
 --- a/drivers/gpio/gpio-ath79.c
 +++ b/drivers/gpio/gpio-ath79.c
 +++ b/drivers/gpio/gpio-ath79.c
 @@ -202,7 +202,11 @@ static struct platform_driver ath79_gpio
 @@ -202,7 +202,11 @@ static struct platform_driver ath79_gpio

+ 38 - 0
target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch

@@ -0,0 +1,38 @@
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -157,6 +157,10 @@
+ #define QCA956X_EHCI0_BASE	0x1b000000
+ #define QCA956X_EHCI1_BASE	0x1b400000
+ #define QCA956X_EHCI_SIZE	0x200
++#define QCA956X_GMAC_SGMII_BASE	(AR71XX_APB_BASE + 0x00070000)
++#define QCA956X_GMAC_SGMII_SIZE	0x64
++#define QCA956X_PLL_BASE	(AR71XX_APB_BASE + 0x00050000)
++#define QCA956X_PLL_SIZE	0x50
+ #define QCA956X_GMAC_BASE	(AR71XX_APB_BASE + 0x00070000)
+ #define QCA956X_GMAC_SIZE	0x64
+ 
+@@ -404,6 +408,7 @@
+ #define QCA956X_PLL_DDR_CONFIG_REG			0x08
+ #define QCA956X_PLL_DDR_CONFIG1_REG			0x0c
+ #define QCA956X_PLL_CLK_CTRL_REG			0x10
++#define QCA956X_PLL_ETH_XMII_CONTROL_REG		0x30
+ 
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT		12
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
+@@ -1186,4 +1191,16 @@
+ #define QCA955X_ETH_CFG_TXE_DELAY_MASK	0x3
+ #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT	20
+ 
++/*
++ * QCA956X GMAC Interface
++ */
++
++#define QCA956X_GMAC_REG_ETH_CFG		0x00
++
++#define QCA956X_ETH_CFG_SW_ONLY_MODE		BIT(7)
++#define QCA956X_ETH_CFG_SW_PHY_SWAP		    BIT(8)
++#define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP	BIT(9)
++#define QCA956X_ETH_CFG_SW_APB_ACCESS		BIT(10)
++#define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST	BIT(13)
++
+ #endif /* __ASM_MACH_AR71XX_REGS_H */

+ 1 - 1
target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch

@@ -20,7 +20,7 @@
  #define AR71XX_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
  #define AR71XX_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
  #define AR71XX_UART_SIZE	0x100
  #define AR71XX_UART_SIZE	0x100
  #define AR71XX_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
  #define AR71XX_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
-@@ -218,6 +218,9 @@
+@@ -222,6 +222,9 @@
  #define QCA953X_DDR_REG_FLUSH_PCIE	0xa8
  #define QCA953X_DDR_REG_FLUSH_PCIE	0xa8
  #define QCA953X_DDR_REG_FLUSH_WMAC	0xac
  #define QCA953X_DDR_REG_FLUSH_WMAC	0xac
  
  

+ 2 - 2
target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch

@@ -48,7 +48,7 @@ functions on the Arduino Yun.
  	void __iomem *reg = ath79_gpio_get_function_reg();
  	void __iomem *reg = ath79_gpio_get_function_reg();
 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
-@@ -850,6 +850,7 @@
+@@ -855,6 +855,7 @@
  #define AR71XX_GPIO_REG_INT_PENDING	0x20
  #define AR71XX_GPIO_REG_INT_PENDING	0x20
  #define AR71XX_GPIO_REG_INT_ENABLE	0x24
  #define AR71XX_GPIO_REG_INT_ENABLE	0x24
  #define AR71XX_GPIO_REG_FUNC		0x28
  #define AR71XX_GPIO_REG_FUNC		0x28
@@ -56,7 +56,7 @@ functions on the Arduino Yun.
  
  
  #define AR934X_GPIO_REG_OUT_FUNC0	0x2c
  #define AR934X_GPIO_REG_OUT_FUNC0	0x2c
  #define AR934X_GPIO_REG_OUT_FUNC1	0x30
  #define AR934X_GPIO_REG_OUT_FUNC1	0x30
-@@ -974,6 +975,8 @@
+@@ -979,6 +980,8 @@
  #define AR724X_GPIO_FUNC_UART_EN		BIT(1)
  #define AR724X_GPIO_FUNC_UART_EN		BIT(1)
  #define AR724X_GPIO_FUNC_JTAG_DISABLE		BIT(0)
  #define AR724X_GPIO_FUNC_JTAG_DISABLE		BIT(0)
  
  

+ 10 - 10
target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch

@@ -276,7 +276,7 @@
  
  
  	t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
  	t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
  				 key, greh->protocol);
  				 key, greh->protocol);
-@@ -479,11 +479,11 @@ static int ip6gre_rcv(struct sk_buff *sk
+@@ -482,11 +482,11 @@ static int ip6gre_rcv(struct sk_buff *sk
  			offset += 4;
  			offset += 4;
  		}
  		}
  		if (flags&GRE_KEY) {
  		if (flags&GRE_KEY) {
@@ -290,7 +290,7 @@
  			offset += 4;
  			offset += 4;
  		}
  		}
  	}
  	}
-@@ -745,7 +745,7 @@ static netdev_tx_t ip6gre_xmit2(struct s
+@@ -748,7 +748,7 @@ static netdev_tx_t ip6gre_xmit2(struct s
  
  
  		if (tunnel->parms.o_flags&GRE_SEQ) {
  		if (tunnel->parms.o_flags&GRE_SEQ) {
  			++tunnel->o_seqno;
  			++tunnel->o_seqno;
@@ -299,7 +299,7 @@
  			ptr--;
  			ptr--;
  		}
  		}
  		if (tunnel->parms.o_flags&GRE_KEY) {
  		if (tunnel->parms.o_flags&GRE_KEY) {
-@@ -841,7 +841,7 @@ static inline int ip6gre_xmit_ipv6(struc
+@@ -844,7 +844,7 @@ static inline int ip6gre_xmit_ipv6(struc
  
  
  	dsfield = ipv6_get_dsfield(ipv6h);
  	dsfield = ipv6_get_dsfield(ipv6h);
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
@@ -310,7 +310,7 @@
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
 --- a/net/ipv6/ip6_tunnel.c
 --- a/net/ipv6/ip6_tunnel.c
 +++ b/net/ipv6/ip6_tunnel.c
 +++ b/net/ipv6/ip6_tunnel.c
-@@ -1409,7 +1409,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1307,7 +1307,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  
  
  	dsfield = ipv6_get_dsfield(ipv6h);
  	dsfield = ipv6_get_dsfield(ipv6h);
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
@@ -491,7 +491,7 @@
  		memcpy(p, foc->val, foc->len);
  		memcpy(p, foc->val, foc->len);
 --- a/net/ipv4/igmp.c
 --- a/net/ipv4/igmp.c
 +++ b/net/ipv4/igmp.c
 +++ b/net/ipv4/igmp.c
-@@ -505,7 +505,7 @@ static struct sk_buff *add_grec(struct s
+@@ -533,7 +533,7 @@ static struct sk_buff *add_grec(struct s
  		if (!skb)
  		if (!skb)
  			return NULL;
  			return NULL;
  		psrc = (__be32 *)skb_put(skb, sizeof(__be32));
  		psrc = (__be32 *)skb_put(skb, sizeof(__be32));
@@ -664,7 +664,7 @@
  
  
  #define	IP6_MF		0x0001
  #define	IP6_MF		0x0001
  #define	IP6_OFFSET	0xFFF8
  #define	IP6_OFFSET	0xFFF8
-@@ -417,8 +417,8 @@ static inline void __ipv6_addr_set_half(
+@@ -418,8 +418,8 @@ static inline void __ipv6_addr_set_half(
  	}
  	}
  #endif
  #endif
  #endif
  #endif
@@ -675,7 +675,7 @@
  }
  }
  
  
  static inline void ipv6_addr_set(struct in6_addr *addr, 
  static inline void ipv6_addr_set(struct in6_addr *addr, 
-@@ -477,6 +477,8 @@ static inline bool ipv6_prefix_equal(con
+@@ -478,6 +478,8 @@ static inline bool ipv6_prefix_equal(con
  	const __be32 *a1 = addr1->s6_addr32;
  	const __be32 *a1 = addr1->s6_addr32;
  	const __be32 *a2 = addr2->s6_addr32;
  	const __be32 *a2 = addr2->s6_addr32;
  	unsigned int pdw, pbi;
  	unsigned int pdw, pbi;
@@ -684,7 +684,7 @@
  
  
  	/* check complete u32 in prefix */
  	/* check complete u32 in prefix */
  	pdw = prefixlen >> 5;
  	pdw = prefixlen >> 5;
-@@ -485,7 +487,9 @@ static inline bool ipv6_prefix_equal(con
+@@ -486,7 +488,9 @@ static inline bool ipv6_prefix_equal(con
  
  
  	/* check incomplete u32 in prefix */
  	/* check incomplete u32 in prefix */
  	pbi = prefixlen & 0x1f;
  	pbi = prefixlen & 0x1f;
@@ -695,7 +695,7 @@
  		return false;
  		return false;
  
  
  	return true;
  	return true;
-@@ -629,13 +633,13 @@ static inline void ipv6_addr_set_v4mappe
+@@ -630,13 +634,13 @@ static inline void ipv6_addr_set_v4mappe
   */
   */
  static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
  static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
  {
  {
@@ -711,7 +711,7 @@
  		if (xb)
  		if (xb)
  			return i * 32 + 31 - __fls(ntohl(xb));
  			return i * 32 + 31 - __fls(ntohl(xb));
  	}
  	}
-@@ -804,17 +808,18 @@ static inline int ip6_default_np_autolab
+@@ -805,17 +809,18 @@ static inline int ip6_default_np_autolab
  static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
  static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
  				__be32 flowlabel)
  				__be32 flowlabel)
  {
  {

+ 1 - 1
target/linux/generic/patches-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch

@@ -53,7 +53,7 @@ Cc: <stable@vger.kernel.org>
  		err = ovl_check_whiteouts(realpath->dentry, rdd);
  		err = ovl_check_whiteouts(realpath->dentry, rdd);
  
  
  	fput(realfile);
  	fput(realfile);
-@@ -569,3 +569,64 @@ void ovl_cleanup_whiteouts(struct dentry
+@@ -573,3 +573,64 @@ void ovl_cleanup_whiteouts(struct dentry
  	}
  	}
  	mutex_unlock(&upper->d_inode->i_mutex);
  	mutex_unlock(&upper->d_inode->i_mutex);
  }
  }

+ 0 - 46
target/linux/generic/patches-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch

@@ -1,46 +0,0 @@
-From 1f820f538f7396db7fd40684b9c3620816acc5a3 Mon Sep 17 00:00:00 2001
-From: Arnd Bergmann <arnd@arndb.de>
-Date: Fri, 29 Jan 2016 12:39:12 +0100
-Subject: [PATCH] net: bgmac: clarify CONFIG_BCMA dependency
-
-The bgmac driver depends on BCMA_HOST_SOC, which is only used
-when CONFIG_BCMA is enabled. However, it is a bool option and can
-be set when CONFIG_BCMA=m, and then bgmac can be built-in, leading
-to an obvious link error:
-
-drivers/built-in.o: In function `bgmac_init':
-:(.init.text+0x7f2c): undefined reference to `__bcma_driver_register'
-drivers/built-in.o: In function `bgmac_exit':
-:(.exit.text+0x110a): undefined reference to `bcma_driver_unregister'
-
-To avoid this case, we need to depend on both BCMA and BCMA_SOC,
-as this patch does. I'm also trying to make the dependency more
-readable by splitting it into three lines, and adding a COMPILE_TEST
-alternative so we can test-build it in all configurations that
-support BCMA.
-
-The added dependency on FIXED_PHY addresses a related issue where
-we cannot call fixed_phy_register() when CONFIG_FIXED_PHY=m and
-CONFIG_BGMAC=y.
-
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/Kconfig | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/Kconfig
-+++ b/drivers/net/ethernet/broadcom/Kconfig
-@@ -151,8 +151,11 @@ config BNX2X_VXLAN
- 
- config BGMAC
- 	tristate "BCMA bus GBit core support"
--	depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X)
-+	depends on BCMA && BCMA_HOST_SOC
-+	depends on HAS_DMA
-+	depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST
- 	select PHYLIB
-+	select FIXED_PHY
- 	---help---
- 	  This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus.
- 	  They can be found on BCM47xx SoCs and provide gigabit ethernet.

+ 0 - 106
target/linux/generic/patches-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch

@@ -1,106 +0,0 @@
-From 387b75f8b31437792e8334390fdf5cf060d1e3da Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Tue, 2 Feb 2016 07:47:14 +0100
-Subject: [PATCH] bgmac: add helper checking for BCM4707 / BCM53018 chip id
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Chipsets with BCM4707 / BCM53018 ID require special handling at a few
-places in the code. It's likely there will be more IDs to check in the
-future. To simplify it add this trivial helper.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 30 ++++++++++++++++--------------
- 1 file changed, 16 insertions(+), 14 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -26,6 +26,17 @@ static const struct bcma_device_id bgmac
- };
- MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
- 
-+static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac)
-+{
-+	switch (bgmac->core->bus->chipinfo.id) {
-+	case BCMA_CHIP_ID_BCM4707:
-+	case BCMA_CHIP_ID_BCM53018:
-+		return true;
-+	default:
-+		return false;
-+	}
-+}
-+
- static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask,
- 			     u32 value, int timeout)
- {
-@@ -991,11 +1002,9 @@ static void bgmac_mac_speed(struct bgmac
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
- 	struct bcma_device *core = bgmac->core;
--	struct bcma_chipinfo *ci = &core->bus->chipinfo;
- 	u8 imode;
- 
--	if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--	    ci->id == BCMA_CHIP_ID_BCM53018) {
-+	if (bgmac_is_bcm4707_family(bgmac)) {
- 		bcma_awrite32(core, BCMA_IOCTL,
- 			      bcma_aread32(core, BCMA_IOCTL) | 0x40 |
- 			      BGMAC_BCMA_IOCTL_SW_CLKEN);
-@@ -1059,9 +1068,7 @@ static void bgmac_chip_reset(struct bgma
- 	}
- 
- 	/* Request Misc PLL for corerev > 2 */
--	if (core->id.rev > 2 &&
--	    ci->id != BCMA_CHIP_ID_BCM4707 &&
--	    ci->id != BCMA_CHIP_ID_BCM53018) {
-+	if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) {
- 		bgmac_set(bgmac, BCMA_CLKCTLST,
- 			  BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
- 		bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-@@ -1197,8 +1204,7 @@ static void bgmac_enable(struct bgmac *b
- 		break;
- 	}
- 
--	if (ci->id != BCMA_CHIP_ID_BCM4707 &&
--	    ci->id != BCMA_CHIP_ID_BCM53018) {
-+	if (!bgmac_is_bcm4707_family(bgmac)) {
- 		rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
- 		rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
- 		bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
-@@ -1477,14 +1483,12 @@ static int bgmac_fixed_phy_register(stru
- 
- static int bgmac_mii_register(struct bgmac *bgmac)
- {
--	struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
- 	struct mii_bus *mii_bus;
- 	struct phy_device *phy_dev;
- 	char bus_id[MII_BUS_ID_SIZE + 3];
- 	int i, err = 0;
- 
--	if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--	    ci->id == BCMA_CHIP_ID_BCM53018)
-+	if (bgmac_is_bcm4707_family(bgmac))
- 		return bgmac_fixed_phy_register(bgmac);
- 
- 	mii_bus = mdiobus_alloc();
-@@ -1555,7 +1559,6 @@ static void bgmac_mii_unregister(struct
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
--	struct bcma_chipinfo *ci = &core->bus->chipinfo;
- 	struct net_device *net_dev;
- 	struct bgmac *bgmac;
- 	struct ssb_sprom *sprom = &core->bus->sprom;
-@@ -1641,8 +1644,7 @@ static int bgmac_probe(struct bcma_devic
- 	bgmac_chip_reset(bgmac);
- 
- 	/* For Northstar, we have to take all GMAC core out of reset */
--	if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--	    ci->id == BCMA_CHIP_ID_BCM53018) {
-+	if (bgmac_is_bcm4707_family(bgmac)) {
- 		struct bcma_device *ns_core;
- 		int ns_gmac;
- 

+ 0 - 39
target/linux/generic/patches-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch

@@ -1,39 +0,0 @@
-From 9e4e6206c67ae11d68fc96882256f37c237087d4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Mon, 22 Feb 2016 22:51:13 +0100
-Subject: [PATCH] bgmac: support Ethernet device on BCM47094 SoC
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It needs very similar workarounds to the one on BCM4707. It was tested
-on D-Link DIR-885L home router.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -30,6 +30,7 @@ static inline bool bgmac_is_bcm4707_fami
- {
- 	switch (bgmac->core->bus->chipinfo.id) {
- 	case BCMA_CHIP_ID_BCM4707:
-+	case BCMA_CHIP_ID_BCM47094:
- 	case BCMA_CHIP_ID_BCM53018:
- 		return true;
- 	default:
-@@ -1056,8 +1057,9 @@ static void bgmac_chip_reset(struct bgma
- 	    (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
- 		iost &= ~BGMAC_BCMA_IOST_ATTACHED;
- 
--	/* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */
--	if (ci->id != BCMA_CHIP_ID_BCM4707) {
-+	/* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
-+	if (ci->id != BCMA_CHIP_ID_BCM4707 &&
-+	    ci->id != BCMA_CHIP_ID_BCM47094) {
- 		flags = 0;
- 		if (iost & BGMAC_BCMA_IOST_ATTACHED) {
- 			flags = BGMAC_BCMA_IOCTL_SW_CLKEN;

+ 0 - 34
target/linux/generic/patches-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch

@@ -1,34 +0,0 @@
-From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001
-From: Felix Fietkau <nbd@nbd.name>
-Date: Tue, 12 Apr 2016 18:27:29 +0200
-Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly
-fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means
-only some devices as most of BCM4708A0KF-s got core rev 4).
-This was tested for regressions on BCM47094 which doesn't seem to care
-which bit gets used.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
-
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -199,9 +199,9 @@
- #define  BGMAC_CMDCFG_TAI			0x00000200
- #define  BGMAC_CMDCFG_HD			0x00000400	/* Set if in half duplex mode */
- #define  BGMAC_CMDCFG_HD_SHIFT			10
--#define  BGMAC_CMDCFG_SR_REV0			0x00000800	/* Set to reset mode, for other revs */
--#define  BGMAC_CMDCFG_SR_REV4			0x00002000	/* Set to reset mode, only for core rev 4 */
--#define  BGMAC_CMDCFG_SR(rev)  ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
-+#define  BGMAC_CMDCFG_SR_REV0			0x00000800	/* Set to reset mode, for core rev 0-3 */
-+#define  BGMAC_CMDCFG_SR_REV4			0x00002000	/* Set to reset mode, for core rev >= 4 */
-+#define  BGMAC_CMDCFG_SR(rev)  ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
- #define  BGMAC_CMDCFG_ML			0x00008000	/* Set to activate mac loopback mode */
- #define  BGMAC_CMDCFG_AE			0x00400000
- #define  BGMAC_CMDCFG_CFE			0x00800000

+ 0 - 25
target/linux/generic/patches-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch

@@ -1,25 +0,0 @@
-From 2022e9d50798aa592887ccb5a7d045e537f3855f Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Tue, 7 Jun 2016 15:06:13 -0700
-Subject: [PATCH 1/3] bgmac: Bind net_device with backing device structure
-
-In preparation for allowing different helpers to be utilized against
-network devices created by the bgmac driver, make sure that we bind the
-net_device with core->dev.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1604,6 +1604,7 @@ static int bgmac_probe(struct bcma_devic
- 	bgmac->net_dev = net_dev;
- 	bgmac->core = core;
- 	bcma_set_drvdata(core, bgmac);
-+	SET_NETDEV_DEV(net_dev, &core->dev);
- 
- 	/* Defaults */
- 	memcpy(bgmac->net_dev->dev_addr, mac, ETH_ALEN);

+ 0 - 175
target/linux/generic/patches-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch

@@ -1,175 +0,0 @@
-From f6613d4fa937fa8388f2c1cb4e69ccc25e9e2336 Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Tue, 7 Jun 2016 15:06:14 -0700
-Subject: [PATCH 2/3] bgmac: Add support for ethtool statistics
-
-Read the statistics from the BGMAC's builtin MAC and return them to
-user-space using the standard ethtool helpers.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 124 ++++++++++++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.h |   4 +-
- 2 files changed, 126 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1387,6 +1387,127 @@ static const struct net_device_ops bgmac
-  * ethtool_ops
-  **************************************************/
- 
-+struct bgmac_stat {
-+	u8 size;
-+	u32 offset;
-+	const char *name;
-+};
-+
-+static struct bgmac_stat bgmac_get_strings_stats[] = {
-+	{ 8, BGMAC_TX_GOOD_OCTETS, "tx_good_octets" },
-+	{ 4, BGMAC_TX_GOOD_PKTS, "tx_good" },
-+	{ 8, BGMAC_TX_OCTETS, "tx_octets" },
-+	{ 4, BGMAC_TX_PKTS, "tx_pkts" },
-+	{ 4, BGMAC_TX_BROADCAST_PKTS, "tx_broadcast" },
-+	{ 4, BGMAC_TX_MULTICAST_PKTS, "tx_multicast" },
-+	{ 4, BGMAC_TX_LEN_64, "tx_64" },
-+	{ 4, BGMAC_TX_LEN_65_TO_127, "tx_65_127" },
-+	{ 4, BGMAC_TX_LEN_128_TO_255, "tx_128_255" },
-+	{ 4, BGMAC_TX_LEN_256_TO_511, "tx_256_511" },
-+	{ 4, BGMAC_TX_LEN_512_TO_1023, "tx_512_1023" },
-+	{ 4, BGMAC_TX_LEN_1024_TO_1522, "tx_1024_1522" },
-+	{ 4, BGMAC_TX_LEN_1523_TO_2047, "tx_1523_2047" },
-+	{ 4, BGMAC_TX_LEN_2048_TO_4095, "tx_2048_4095" },
-+	{ 4, BGMAC_TX_LEN_4096_TO_8191, "tx_4096_8191" },
-+	{ 4, BGMAC_TX_LEN_8192_TO_MAX, "tx_8192_max" },
-+	{ 4, BGMAC_TX_JABBER_PKTS, "tx_jabber" },
-+	{ 4, BGMAC_TX_OVERSIZE_PKTS, "tx_oversize" },
-+	{ 4, BGMAC_TX_FRAGMENT_PKTS, "tx_fragment" },
-+	{ 4, BGMAC_TX_UNDERRUNS, "tx_underruns" },
-+	{ 4, BGMAC_TX_TOTAL_COLS, "tx_total_cols" },
-+	{ 4, BGMAC_TX_SINGLE_COLS, "tx_single_cols" },
-+	{ 4, BGMAC_TX_MULTIPLE_COLS, "tx_multiple_cols" },
-+	{ 4, BGMAC_TX_EXCESSIVE_COLS, "tx_excessive_cols" },
-+	{ 4, BGMAC_TX_LATE_COLS, "tx_late_cols" },
-+	{ 4, BGMAC_TX_DEFERED, "tx_defered" },
-+	{ 4, BGMAC_TX_CARRIER_LOST, "tx_carrier_lost" },
-+	{ 4, BGMAC_TX_PAUSE_PKTS, "tx_pause" },
-+	{ 4, BGMAC_TX_UNI_PKTS, "tx_unicast" },
-+	{ 4, BGMAC_TX_Q0_PKTS, "tx_q0" },
-+	{ 8, BGMAC_TX_Q0_OCTETS, "tx_q0_octets" },
-+	{ 4, BGMAC_TX_Q1_PKTS, "tx_q1" },
-+	{ 8, BGMAC_TX_Q1_OCTETS, "tx_q1_octets" },
-+	{ 4, BGMAC_TX_Q2_PKTS, "tx_q2" },
-+	{ 8, BGMAC_TX_Q2_OCTETS, "tx_q2_octets" },
-+	{ 4, BGMAC_TX_Q3_PKTS, "tx_q3" },
-+	{ 8, BGMAC_TX_Q3_OCTETS, "tx_q3_octets" },
-+	{ 8, BGMAC_RX_GOOD_OCTETS, "rx_good_octets" },
-+	{ 4, BGMAC_RX_GOOD_PKTS, "rx_good" },
-+	{ 8, BGMAC_RX_OCTETS, "rx_octets" },
-+	{ 4, BGMAC_RX_PKTS, "rx_pkts" },
-+	{ 4, BGMAC_RX_BROADCAST_PKTS, "rx_broadcast" },
-+	{ 4, BGMAC_RX_MULTICAST_PKTS, "rx_multicast" },
-+	{ 4, BGMAC_RX_LEN_64, "rx_64" },
-+	{ 4, BGMAC_RX_LEN_65_TO_127, "rx_65_127" },
-+	{ 4, BGMAC_RX_LEN_128_TO_255, "rx_128_255" },
-+	{ 4, BGMAC_RX_LEN_256_TO_511, "rx_256_511" },
-+	{ 4, BGMAC_RX_LEN_512_TO_1023, "rx_512_1023" },
-+	{ 4, BGMAC_RX_LEN_1024_TO_1522, "rx_1024_1522" },
-+	{ 4, BGMAC_RX_LEN_1523_TO_2047, "rx_1523_2047" },
-+	{ 4, BGMAC_RX_LEN_2048_TO_4095, "rx_2048_4095" },
-+	{ 4, BGMAC_RX_LEN_4096_TO_8191, "rx_4096_8191" },
-+	{ 4, BGMAC_RX_LEN_8192_TO_MAX, "rx_8192_max" },
-+	{ 4, BGMAC_RX_JABBER_PKTS, "rx_jabber" },
-+	{ 4, BGMAC_RX_OVERSIZE_PKTS, "rx_oversize" },
-+	{ 4, BGMAC_RX_FRAGMENT_PKTS, "rx_fragment" },
-+	{ 4, BGMAC_RX_MISSED_PKTS, "rx_missed" },
-+	{ 4, BGMAC_RX_CRC_ALIGN_ERRS, "rx_crc_align" },
-+	{ 4, BGMAC_RX_UNDERSIZE, "rx_undersize" },
-+	{ 4, BGMAC_RX_CRC_ERRS, "rx_crc" },
-+	{ 4, BGMAC_RX_ALIGN_ERRS, "rx_align" },
-+	{ 4, BGMAC_RX_SYMBOL_ERRS, "rx_symbol" },
-+	{ 4, BGMAC_RX_PAUSE_PKTS, "rx_pause" },
-+	{ 4, BGMAC_RX_NONPAUSE_PKTS, "rx_nonpause" },
-+	{ 4, BGMAC_RX_SACHANGES, "rx_sa_changes" },
-+	{ 4, BGMAC_RX_UNI_PKTS, "rx_unicast" },
-+};
-+
-+#define BGMAC_STATS_LEN	ARRAY_SIZE(bgmac_get_strings_stats)
-+
-+static int bgmac_get_sset_count(struct net_device *dev, int string_set)
-+{
-+	switch (string_set) {
-+	case ETH_SS_STATS:
-+		return BGMAC_STATS_LEN;
-+	}
-+
-+	return -EOPNOTSUPP;
-+}
-+
-+static void bgmac_get_strings(struct net_device *dev, u32 stringset,
-+			      u8 *data)
-+{
-+	int i;
-+
-+	if (stringset != ETH_SS_STATS)
-+		return;
-+
-+	for (i = 0; i < BGMAC_STATS_LEN; i++)
-+		strlcpy(data + i * ETH_GSTRING_LEN,
-+			bgmac_get_strings_stats[i].name, ETH_GSTRING_LEN);
-+}
-+
-+static void bgmac_get_ethtool_stats(struct net_device *dev,
-+				    struct ethtool_stats *ss, uint64_t *data)
-+{
-+	struct bgmac *bgmac = netdev_priv(dev);
-+	const struct bgmac_stat *s;
-+	unsigned int i;
-+	u64 val;
-+
-+	if (!netif_running(dev))
-+		return;
-+
-+	for (i = 0; i < BGMAC_STATS_LEN; i++) {
-+		s = &bgmac_get_strings_stats[i];
-+		val = 0;
-+		if (s->size == 8)
-+			val = (u64)bgmac_read(bgmac, s->offset + 4) << 32;
-+		val |= bgmac_read(bgmac, s->offset);
-+		data[i] = val;
-+	}
-+}
-+
- static int bgmac_get_settings(struct net_device *net_dev,
- 			      struct ethtool_cmd *cmd)
- {
-@@ -1411,6 +1532,9 @@ static void bgmac_get_drvinfo(struct net
- }
- 
- static const struct ethtool_ops bgmac_ethtool_ops = {
-+	.get_strings		= bgmac_get_strings,
-+	.get_sset_count		= bgmac_get_sset_count,
-+	.get_ethtool_stats	= bgmac_get_ethtool_stats,
- 	.get_settings		= bgmac_get_settings,
- 	.set_settings		= bgmac_set_settings,
- 	.get_drvinfo		= bgmac_get_drvinfo,
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -123,7 +123,7 @@
- #define BGMAC_TX_LEN_1024_TO_1522		0x334
- #define BGMAC_TX_LEN_1523_TO_2047		0x338
- #define BGMAC_TX_LEN_2048_TO_4095		0x33c
--#define BGMAC_TX_LEN_4095_TO_8191		0x340
-+#define BGMAC_TX_LEN_4096_TO_8191		0x340
- #define BGMAC_TX_LEN_8192_TO_MAX		0x344
- #define BGMAC_TX_JABBER_PKTS			0x348		/* Error */
- #define BGMAC_TX_OVERSIZE_PKTS			0x34c		/* Error */
-@@ -166,7 +166,7 @@
- #define BGMAC_RX_LEN_1024_TO_1522		0x3e4
- #define BGMAC_RX_LEN_1523_TO_2047		0x3e8
- #define BGMAC_RX_LEN_2048_TO_4095		0x3ec
--#define BGMAC_RX_LEN_4095_TO_8191		0x3f0
-+#define BGMAC_RX_LEN_4096_TO_8191		0x3f0
- #define BGMAC_RX_LEN_8192_TO_MAX		0x3f4
- #define BGMAC_RX_JABBER_PKTS			0x3f8		/* Error */
- #define BGMAC_RX_OVERSIZE_PKTS			0x3fc		/* Error */

+ 0 - 68
target/linux/generic/patches-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch

@@ -1,68 +0,0 @@
-From 6d490f62a4c7f11c552591bdd08eda3636aa0db9 Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Tue, 7 Jun 2016 15:06:15 -0700
-Subject: [PATCH 3/3] bgmac: Maintain some netdev statistics
-
-Add a few netdev statistics to report transmitted and received bytes and
-packets and a few obvious errors.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -246,6 +246,8 @@ err_dma_head:
- 
- err_drop:
- 	dev_kfree_skb(skb);
-+	net_dev->stats.tx_dropped++;
-+	net_dev->stats.tx_errors++;
- 	return NETDEV_TX_OK;
- }
- 
-@@ -285,6 +287,8 @@ static void bgmac_dma_tx_free(struct bgm
- 				       DMA_TO_DEVICE);
- 
- 		if (slot->skb) {
-+			bgmac->net_dev->stats.tx_bytes += slot->skb->len;
-+			bgmac->net_dev->stats.tx_packets++;
- 			bytes_compl += slot->skb->len;
- 			pkts_compl++;
- 
-@@ -468,6 +472,7 @@ static int bgmac_dma_rx_read(struct bgma
- 				bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
- 					  ring->start);
- 				put_page(virt_to_head_page(buf));
-+				bgmac->net_dev->stats.rx_errors++;
- 				break;
- 			}
- 
-@@ -475,6 +480,8 @@ static int bgmac_dma_rx_read(struct bgma
- 				bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
- 					  ring->start);
- 				put_page(virt_to_head_page(buf));
-+				bgmac->net_dev->stats.rx_length_errors++;
-+				bgmac->net_dev->stats.rx_errors++;
- 				break;
- 			}
- 
-@@ -485,6 +492,7 @@ static int bgmac_dma_rx_read(struct bgma
- 			if (unlikely(!skb)) {
- 				bgmac_err(bgmac, "build_skb failed\n");
- 				put_page(virt_to_head_page(buf));
-+				bgmac->net_dev->stats.rx_errors++;
- 				break;
- 			}
- 			skb_put(skb, BGMAC_RX_FRAME_OFFSET +
-@@ -494,6 +502,8 @@ static int bgmac_dma_rx_read(struct bgma
- 
- 			skb_checksum_none_assert(skb);
- 			skb->protocol = eth_type_trans(skb, bgmac->net_dev);
-+			bgmac->net_dev->stats.rx_bytes += len;
-+			bgmac->net_dev->stats.rx_packets++;
- 			napi_gro_receive(&bgmac->napi, skb);
- 			handled++;
- 		} while (0);

+ 0 - 105
target/linux/generic/patches-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch

@@ -1,105 +0,0 @@
-From b21fcb259313bcf7d4f73ecd5e44948995c8957c Mon Sep 17 00:00:00 2001
-From: Philippe Reynes <tremyfr@gmail.com>
-Date: Sun, 19 Jun 2016 22:37:05 +0200
-Subject: [PATCH 1/2] net: ethernet: bgmac: use phydev from struct net_device
-
-The private structure contain a pointer to phydev, but the structure
-net_device already contain such pointer. So we can remove the pointer
-phydev in the private structure, and update the driver to use the
-one contained in struct net_device.
-
-Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 17 ++++++-----------
- drivers/net/ethernet/broadcom/bgmac.h |  1 -
- 2 files changed, 6 insertions(+), 12 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1324,7 +1324,7 @@ static int bgmac_open(struct net_device
- 	}
- 	napi_enable(&bgmac->napi);
- 
--	phy_start(bgmac->phy_dev);
-+	phy_start(net_dev->phydev);
- 
- 	netif_start_queue(net_dev);
- 
-@@ -1337,7 +1337,7 @@ static int bgmac_stop(struct net_device
- 
- 	netif_carrier_off(net_dev);
- 
--	phy_stop(bgmac->phy_dev);
-+	phy_stop(net_dev->phydev);
- 
- 	napi_disable(&bgmac->napi);
- 	bgmac_chip_intrs_off(bgmac);
-@@ -1375,12 +1375,10 @@ static int bgmac_set_mac_address(struct
- 
- static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
- {
--	struct bgmac *bgmac = netdev_priv(net_dev);
--
- 	if (!netif_running(net_dev))
- 		return -EINVAL;
- 
--	return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
-+	return phy_mii_ioctl(net_dev->phydev, ifr, cmd);
- }
- 
- static const struct net_device_ops bgmac_netdev_ops = {
-@@ -1523,7 +1521,7 @@ static int bgmac_get_settings(struct net
- {
- 	struct bgmac *bgmac = netdev_priv(net_dev);
- 
--	return phy_ethtool_gset(bgmac->phy_dev, cmd);
-+	return phy_ethtool_gset(net_dev->phydev, cmd);
- }
- 
- static int bgmac_set_settings(struct net_device *net_dev,
-@@ -1531,7 +1529,7 @@ static int bgmac_set_settings(struct net
- {
- 	struct bgmac *bgmac = netdev_priv(net_dev);
- 
--	return phy_ethtool_sset(bgmac->phy_dev, cmd);
-+	return phy_ethtool_sset(net_dev->phydev, cmd);
- }
- 
- static void bgmac_get_drvinfo(struct net_device *net_dev,
-@@ -1568,7 +1566,7 @@ static int bgmac_mii_write(struct mii_bu
- static void bgmac_adjust_link(struct net_device *net_dev)
- {
- 	struct bgmac *bgmac = netdev_priv(net_dev);
--	struct phy_device *phy_dev = bgmac->phy_dev;
-+	struct phy_device *phy_dev = net_dev->phydev;
- 	bool update = false;
- 
- 	if (phy_dev->link) {
-@@ -1612,8 +1610,6 @@ static int bgmac_fixed_phy_register(stru
- 		return err;
- 	}
- 
--	bgmac->phy_dev = phy_dev;
--
- 	return err;
- }
- 
-@@ -1666,7 +1662,6 @@ static int bgmac_mii_register(struct bgm
- 		err = PTR_ERR(phy_dev);
- 		goto err_unregister_bus;
- 	}
--	bgmac->phy_dev = phy_dev;
- 
- 	return err;
- 
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -441,7 +441,6 @@ struct bgmac {
- 	struct net_device *net_dev;
- 	struct napi_struct napi;
- 	struct mii_bus *mii_bus;
--	struct phy_device *phy_dev;
- 
- 	/* DMA */
- 	struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS];

+ 0 - 407
target/linux/generic/patches-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch

@@ -1,407 +0,0 @@
-From d00a8281bcc962027dfe409c2f3e3f0546be9200 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:53 -0400
-Subject: [PATCH 1/5] net: ethernet: bgmac: change bgmac_* prints to dev_*
- prints
-
-The bgmac_* print wrappers call dev_* prints with the dev pointer from
-the bcma core.  In anticipation of removing the bcma requirement for
-this driver, these must be changed to not reference that struct.  So,
-simply change all of the bgmac_* prints to their dev_* counterparts.  In
-some cases netdev_* prints are more appropriate, so change those as
-well.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 103 +++++++++++++++++-----------------
- drivers/net/ethernet/broadcom/bgmac.h |  14 +----
- 2 files changed, 55 insertions(+), 62 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -50,7 +50,7 @@ static bool bgmac_wait_value(struct bcma
- 			return true;
- 		udelay(10);
- 	}
--	pr_err("Timeout waiting for reg 0x%X\n", reg);
-+	dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg);
- 	return false;
- }
- 
-@@ -84,8 +84,8 @@ static void bgmac_dma_tx_reset(struct bg
- 		udelay(10);
- 	}
- 	if (i)
--		bgmac_err(bgmac, "Timeout suspending DMA TX ring 0x%X (BGMAC_DMA_TX_STAT: 0x%08X)\n",
--			  ring->mmio_base, val);
-+		dev_err(bgmac->dev, "Timeout suspending DMA TX ring 0x%X (BGMAC_DMA_TX_STAT: 0x%08X)\n",
-+			ring->mmio_base, val);
- 
- 	/* Remove SUSPEND bit */
- 	bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, 0);
-@@ -93,13 +93,13 @@ static void bgmac_dma_tx_reset(struct bg
- 			      ring->mmio_base + BGMAC_DMA_TX_STATUS,
- 			      BGMAC_DMA_TX_STAT, BGMAC_DMA_TX_STAT_DISABLED,
- 			      10000)) {
--		bgmac_warn(bgmac, "DMA TX ring 0x%X wasn't disabled on time, waiting additional 300us\n",
--			   ring->mmio_base);
-+		dev_warn(bgmac->dev, "DMA TX ring 0x%X wasn't disabled on time, waiting additional 300us\n",
-+			 ring->mmio_base);
- 		udelay(300);
- 		val = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
- 		if ((val & BGMAC_DMA_TX_STAT) != BGMAC_DMA_TX_STAT_DISABLED)
--			bgmac_err(bgmac, "Reset of DMA TX ring 0x%X failed\n",
--				  ring->mmio_base);
-+			dev_err(bgmac->dev, "Reset of DMA TX ring 0x%X failed\n",
-+				ring->mmio_base);
- 	}
- }
- 
-@@ -161,7 +161,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
- 	int i;
- 
- 	if (skb->len > BGMAC_DESC_CTL1_LEN) {
--		bgmac_err(bgmac, "Too long skb (%d)\n", skb->len);
-+		netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
- 		goto err_drop;
- 	}
- 
-@@ -174,7 +174,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
- 	 * even when ring->end overflows
- 	 */
- 	if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) {
--		bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n");
-+		netdev_err(bgmac->net_dev, "TX ring is full, queue should be stopped!\n");
- 		netif_stop_queue(net_dev);
- 		return NETDEV_TX_BUSY;
- 	}
-@@ -241,8 +241,8 @@ err_dma:
- 	}
- 
- err_dma_head:
--	bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n",
--		  ring->mmio_base);
-+	netdev_err(bgmac->net_dev, "Mapping error of skb on ring 0x%X\n",
-+		   ring->mmio_base);
- 
- err_drop:
- 	dev_kfree_skb(skb);
-@@ -321,8 +321,8 @@ static void bgmac_dma_rx_reset(struct bg
- 			      ring->mmio_base + BGMAC_DMA_RX_STATUS,
- 			      BGMAC_DMA_RX_STAT, BGMAC_DMA_RX_STAT_DISABLED,
- 			      10000))
--		bgmac_err(bgmac, "Reset of ring 0x%X RX failed\n",
--			  ring->mmio_base);
-+		dev_err(bgmac->dev, "Reset of ring 0x%X RX failed\n",
-+			ring->mmio_base);
- }
- 
- static void bgmac_dma_rx_enable(struct bgmac *bgmac,
-@@ -374,7 +374,7 @@ static int bgmac_dma_rx_skb_for_slot(str
- 	dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET,
- 				  BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
- 	if (dma_mapping_error(dma_dev, dma_addr)) {
--		bgmac_err(bgmac, "DMA mapping error\n");
-+		netdev_err(bgmac->net_dev, "DMA mapping error\n");
- 		put_page(virt_to_head_page(buf));
- 		return -ENOMEM;
- 	}
-@@ -469,16 +469,16 @@ static int bgmac_dma_rx_read(struct bgma
- 
- 			/* Check for poison and drop or pass the packet */
- 			if (len == 0xdead && flags == 0xbeef) {
--				bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
--					  ring->start);
-+				netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n",
-+					   ring->start);
- 				put_page(virt_to_head_page(buf));
- 				bgmac->net_dev->stats.rx_errors++;
- 				break;
- 			}
- 
- 			if (len > BGMAC_RX_ALLOC_SIZE) {
--				bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
--					  ring->start);
-+				netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
-+					   ring->start);
- 				put_page(virt_to_head_page(buf));
- 				bgmac->net_dev->stats.rx_length_errors++;
- 				bgmac->net_dev->stats.rx_errors++;
-@@ -490,7 +490,7 @@ static int bgmac_dma_rx_read(struct bgma
- 
- 			skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE);
- 			if (unlikely(!skb)) {
--				bgmac_err(bgmac, "build_skb failed\n");
-+				netdev_err(bgmac->net_dev, "build_skb failed\n");
- 				put_page(virt_to_head_page(buf));
- 				bgmac->net_dev->stats.rx_errors++;
- 				break;
-@@ -644,7 +644,7 @@ static int bgmac_dma_alloc(struct bgmac
- 	BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base));
- 
- 	if (!(bcma_aread32(bgmac->core, BCMA_IOST) & BCMA_IOST_DMA64)) {
--		bgmac_err(bgmac, "Core does not report 64-bit DMA\n");
-+		dev_err(bgmac->dev, "Core does not report 64-bit DMA\n");
- 		return -ENOTSUPP;
- 	}
- 
-@@ -658,8 +658,8 @@ static int bgmac_dma_alloc(struct bgmac
- 						     &ring->dma_base,
- 						     GFP_KERNEL);
- 		if (!ring->cpu_base) {
--			bgmac_err(bgmac, "Allocation of TX ring 0x%X failed\n",
--				  ring->mmio_base);
-+			dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n",
-+				ring->mmio_base);
- 			goto err_dma_free;
- 		}
- 
-@@ -683,8 +683,8 @@ static int bgmac_dma_alloc(struct bgmac
- 						     &ring->dma_base,
- 						     GFP_KERNEL);
- 		if (!ring->cpu_base) {
--			bgmac_err(bgmac, "Allocation of RX ring 0x%X failed\n",
--				  ring->mmio_base);
-+			dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n",
-+				ring->mmio_base);
- 			err = -ENOMEM;
- 			goto err_dma_free;
- 		}
-@@ -803,8 +803,8 @@ static u16 bgmac_phy_read(struct bgmac *
- 	bcma_write32(core, phy_access_addr, tmp);
- 
- 	if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--		bgmac_err(bgmac, "Reading PHY %d register 0x%X failed\n",
--			  phyaddr, reg);
-+		dev_err(bgmac->dev, "Reading PHY %d register 0x%X failed\n",
-+			phyaddr, reg);
- 		return 0xffff;
- 	}
- 
-@@ -836,7 +836,7 @@ static int bgmac_phy_write(struct bgmac
- 
- 	bgmac_write(bgmac, BGMAC_INT_STATUS, BGMAC_IS_MDIO);
- 	if (bgmac_read(bgmac, BGMAC_INT_STATUS) & BGMAC_IS_MDIO)
--		bgmac_warn(bgmac, "Error setting MDIO int\n");
-+		dev_warn(bgmac->dev, "Error setting MDIO int\n");
- 
- 	tmp = BGMAC_PA_START;
- 	tmp |= BGMAC_PA_WRITE;
-@@ -846,8 +846,8 @@ static int bgmac_phy_write(struct bgmac
- 	bcma_write32(core, phy_access_addr, tmp);
- 
- 	if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--		bgmac_err(bgmac, "Writing to PHY %d register 0x%X failed\n",
--			  phyaddr, reg);
-+		dev_err(bgmac->dev, "Writing to PHY %d register 0x%X failed\n",
-+			phyaddr, reg);
- 		return -ETIMEDOUT;
- 	}
- 
-@@ -900,7 +900,7 @@ static void bgmac_phy_reset(struct bgmac
- 	bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET);
- 	udelay(100);
- 	if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET)
--		bgmac_err(bgmac, "PHY reset failed\n");
-+		dev_err(bgmac->dev, "PHY reset failed\n");
- 	bgmac_phy_init(bgmac);
- }
- 
-@@ -1001,7 +1001,8 @@ static void bgmac_mac_speed(struct bgmac
- 		set |= BGMAC_CMDCFG_ES_2500;
- 		break;
- 	default:
--		bgmac_err(bgmac, "Unsupported speed: %d\n", bgmac->mac_speed);
-+		dev_err(bgmac->dev, "Unsupported speed: %d\n",
-+			bgmac->mac_speed);
- 	}
- 
- 	if (bgmac->mac_duplex == DUPLEX_HALF)
-@@ -1100,8 +1101,8 @@ static void bgmac_chip_reset(struct bgma
- 
- 		if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
- 			if (kstrtou8(buf, 0, &et_swtype))
--				bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n",
--					  buf);
-+				dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n",
-+					buf);
- 			et_swtype &= 0x0f;
- 			et_swtype <<= 4;
- 			sw_type = et_swtype;
-@@ -1264,7 +1265,7 @@ static irqreturn_t bgmac_interrupt(int i
- 
- 	int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX);
- 	if (int_status)
--		bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status);
-+		dev_err(bgmac->dev, "Unknown IRQs: 0x%08X\n", int_status);
- 
- 	/* Disable new interrupts until handling existing ones */
- 	bgmac_chip_intrs_off(bgmac);
-@@ -1318,7 +1319,7 @@ static int bgmac_open(struct net_device
- 	err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
- 			  KBUILD_MODNAME, net_dev);
- 	if (err < 0) {
--		bgmac_err(bgmac, "IRQ request error: %d!\n", err);
-+		dev_err(bgmac->dev, "IRQ request error: %d!\n", err);
- 		bgmac_dma_cleanup(bgmac);
- 		return err;
- 	}
-@@ -1599,14 +1600,14 @@ static int bgmac_fixed_phy_register(stru
- 
- 	phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL);
- 	if (!phy_dev || IS_ERR(phy_dev)) {
--		bgmac_err(bgmac, "Failed to register fixed PHY device\n");
-+		dev_err(bgmac->dev, "Failed to register fixed PHY device\n");
- 		return -ENODEV;
- 	}
- 
- 	err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
- 				 PHY_INTERFACE_MODE_MII);
- 	if (err) {
--		bgmac_err(bgmac, "Connecting PHY failed\n");
-+		dev_err(bgmac->dev, "Connecting PHY failed\n");
- 		return err;
- 	}
- 
-@@ -1646,7 +1647,7 @@ static int bgmac_mii_register(struct bgm
- 
- 	err = mdiobus_register(mii_bus);
- 	if (err) {
--		bgmac_err(bgmac, "Registration of mii bus failed\n");
-+		dev_err(bgmac->dev, "Registration of mii bus failed\n");
- 		goto err_free_irq;
- 	}
- 
-@@ -1658,7 +1659,7 @@ static int bgmac_mii_register(struct bgm
- 	phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link,
- 			      PHY_INTERFACE_MODE_MII);
- 	if (IS_ERR(phy_dev)) {
--		bgmac_err(bgmac, "PHY connecton failed\n");
-+		dev_err(bgmac->dev, "PHY connecton failed\n");
- 		err = PTR_ERR(phy_dev);
- 		goto err_unregister_bus;
- 	}
-@@ -1707,7 +1708,8 @@ static int bgmac_probe(struct bcma_devic
- 		mac = sprom->et2mac;
- 		break;
- 	default:
--		pr_err("Unsupported core_unit %d\n", core->core_unit);
-+		dev_err(&core->dev, "Unsupported core_unit %d\n",
-+			core->core_unit);
- 		return -ENOTSUPP;
- 	}
- 
-@@ -1730,6 +1732,7 @@ static int bgmac_probe(struct bcma_devic
- 	net_dev->irq = core->irq;
- 	net_dev->ethtool_ops = &bgmac_ethtool_ops;
- 	bgmac = netdev_priv(net_dev);
-+	bgmac->dev = &core->dev;
- 	bgmac->net_dev = net_dev;
- 	bgmac->core = core;
- 	bcma_set_drvdata(core, bgmac);
-@@ -1741,7 +1744,7 @@ static int bgmac_probe(struct bcma_devic
- 	/* On BCM4706 we need common core to access PHY */
- 	if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
- 	    !core->bus->drv_gmac_cmn.core) {
--		bgmac_err(bgmac, "GMAC CMN core not found (required for BCM4706)\n");
-+		dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n");
- 		err = -ENODEV;
- 		goto err_netdev_free;
- 	}
-@@ -1760,15 +1763,15 @@ static int bgmac_probe(struct bcma_devic
- 	}
- 	bgmac->phyaddr &= BGMAC_PHY_MASK;
- 	if (bgmac->phyaddr == BGMAC_PHY_MASK) {
--		bgmac_err(bgmac, "No PHY found\n");
-+		dev_err(bgmac->dev, "No PHY found\n");
- 		err = -ENODEV;
- 		goto err_netdev_free;
- 	}
--	bgmac_info(bgmac, "Found PHY addr: %d%s\n", bgmac->phyaddr,
--		   bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-+	dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
-+		 bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
- 
- 	if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
--		bgmac_err(bgmac, "PCI setup not implemented\n");
-+		dev_err(bgmac->dev, "PCI setup not implemented\n");
- 		err = -ENOTSUPP;
- 		goto err_netdev_free;
- 	}
-@@ -1797,7 +1800,7 @@ static int bgmac_probe(struct bcma_devic
- 
- 	err = bgmac_dma_alloc(bgmac);
- 	if (err) {
--		bgmac_err(bgmac, "Unable to alloc memory for DMA\n");
-+		dev_err(bgmac->dev, "Unable to alloc memory for DMA\n");
- 		goto err_netdev_free;
- 	}
- 
-@@ -1811,16 +1814,16 @@ static int bgmac_probe(struct bcma_devic
- 	bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
- 			       BGMAC_BFL_ENETROBO);
- 	if (bgmac->has_robosw)
--		bgmac_warn(bgmac, "Support for Roboswitch not implemented\n");
-+		dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n");
- 
- 	if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
--		bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n");
-+		dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
- 
- 	netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
- 
- 	err = bgmac_mii_register(bgmac);
- 	if (err) {
--		bgmac_err(bgmac, "Cannot register MDIO\n");
-+		dev_err(bgmac->dev, "Cannot connect to phy\n");
- 		goto err_dma_free;
- 	}
- 
-@@ -1830,7 +1833,7 @@ static int bgmac_probe(struct bcma_devic
- 
- 	err = register_netdev(bgmac->net_dev);
- 	if (err) {
--		bgmac_err(bgmac, "Cannot register net device\n");
-+		dev_err(bgmac->dev, "Cannot register net device\n");
- 		goto err_mii_unregister;
- 	}
- 
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -1,17 +1,6 @@
- #ifndef _BGMAC_H
- #define _BGMAC_H
- 
--#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
--
--#define bgmac_err(bgmac, fmt, ...) \
--	dev_err(&(bgmac)->core->dev, fmt, ##__VA_ARGS__)
--#define bgmac_warn(bgmac, fmt, ...) \
--	dev_warn(&(bgmac)->core->dev, fmt,  ##__VA_ARGS__)
--#define bgmac_info(bgmac, fmt, ...) \
--	dev_info(&(bgmac)->core->dev, fmt,  ##__VA_ARGS__)
--#define bgmac_dbg(bgmac, fmt, ...) \
--	dev_dbg(&(bgmac)->core->dev, fmt, ##__VA_ARGS__)
--
- #include <linux/bcma/bcma.h>
- #include <linux/brcmphy.h>
- #include <linux/netdevice.h>
-@@ -438,6 +427,8 @@ struct bgmac_rx_header {
- struct bgmac {
- 	struct bcma_device *core;
- 	struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
-+
-+	struct device *dev;
- 	struct net_device *net_dev;
- 	struct napi_struct napi;
- 	struct mii_bus *mii_bus;
-@@ -489,5 +480,4 @@ static inline void bgmac_set(struct bgma
- {
- 	bgmac_maskset(bgmac, offset, ~0, set);
- }
--
- #endif /* _BGMAC_H */

+ 0 - 112
target/linux/generic/patches-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch

@@ -1,112 +0,0 @@
-From a0b68486f6f680c7c0352a47c60042d7d95ffd87 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:54 -0400
-Subject: [PATCH 2/5] net: ethernet: bgmac: add dma_dev pointer
-
-The dma buffer allocation, etc references a dma_dev device pointer from
-the bcma core.  In anticipation of removing the bcma requirement for
-this driver, these must be changed to not reference that struct.  Add a
-dma_dev device pointer to the bgmac stuct and reference that instead.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 17 +++++++++--------
- drivers/net/ethernet/broadcom/bgmac.h |  1 +
- 2 files changed, 10 insertions(+), 8 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
- 				    struct bgmac_dma_ring *ring,
- 				    struct sk_buff *skb)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	struct net_device *net_dev = bgmac->net_dev;
- 	int index = ring->end % BGMAC_TX_RING_SLOTS;
- 	struct bgmac_slot_info *slot = &ring->slots[index];
-@@ -254,7 +254,7 @@ err_drop:
- /* Free transmitted packets */
- static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	int empty_slot;
- 	bool freed = false;
- 	unsigned bytes_compl = 0, pkts_compl = 0;
-@@ -355,7 +355,7 @@ static void bgmac_dma_rx_enable(struct b
- static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
- 				     struct bgmac_slot_info *slot)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	dma_addr_t dma_addr;
- 	struct bgmac_rx_header *rx;
- 	void *buf;
-@@ -444,7 +444,7 @@ static int bgmac_dma_rx_read(struct bgma
- 	end_slot /= sizeof(struct bgmac_dma_desc);
- 
- 	while (ring->start != end_slot) {
--		struct device *dma_dev = bgmac->core->dma_dev;
-+		struct device *dma_dev = bgmac->dma_dev;
- 		struct bgmac_slot_info *slot = &ring->slots[ring->start];
- 		struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET;
- 		struct sk_buff *skb;
-@@ -547,7 +547,7 @@ static bool bgmac_dma_unaligned(struct b
- static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
- 				   struct bgmac_dma_ring *ring)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	struct bgmac_dma_desc *dma_desc = ring->cpu_base;
- 	struct bgmac_slot_info *slot;
- 	int i;
-@@ -573,7 +573,7 @@ static void bgmac_dma_tx_ring_free(struc
- static void bgmac_dma_rx_ring_free(struct bgmac *bgmac,
- 				   struct bgmac_dma_ring *ring)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	struct bgmac_slot_info *slot;
- 	int i;
- 
-@@ -594,7 +594,7 @@ static void bgmac_dma_ring_desc_free(str
- 				     struct bgmac_dma_ring *ring,
- 				     int num_slots)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	int size;
- 
- 	if (!ring->cpu_base)
-@@ -632,7 +632,7 @@ static void bgmac_dma_free(struct bgmac
- 
- static int bgmac_dma_alloc(struct bgmac *bgmac)
- {
--	struct device *dma_dev = bgmac->core->dma_dev;
-+	struct device *dma_dev = bgmac->dma_dev;
- 	struct bgmac_dma_ring *ring;
- 	static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1,
- 					 BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, };
-@@ -1733,6 +1733,7 @@ static int bgmac_probe(struct bcma_devic
- 	net_dev->ethtool_ops = &bgmac_ethtool_ops;
- 	bgmac = netdev_priv(net_dev);
- 	bgmac->dev = &core->dev;
-+	bgmac->dma_dev = core->dma_dev;
- 	bgmac->net_dev = net_dev;
- 	bgmac->core = core;
- 	bcma_set_drvdata(core, bgmac);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -429,6 +429,7 @@ struct bgmac {
- 	struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
- 
- 	struct device *dev;
-+	struct device *dma_dev;
- 	struct net_device *net_dev;
- 	struct napi_struct napi;
- 	struct mii_bus *mii_bus;

+ 0 - 676
target/linux/generic/patches-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch

@@ -1,676 +0,0 @@
-From 55954f3bfdacc5908515b0c306cea23e77fab740 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:55 -0400
-Subject: [PATCH 3/5] net: ethernet: bgmac: move BCMA MDIO Phy code into a
- separate file
-
-Move the BCMA MDIO phy into a separate file, as it is very tightly
-coupled with the BCMA bus.  This will help with the upcoming BCMA
-removal from the bgmac driver.  Optimally, this should be moved into
-phy drivers, but it is too tightly coupled with the bgmac driver to
-effectively move it without more changes to the driver.
-
-Note: the phy_reset was intentionally removed, as the mdio phy subsystem
-automatically resets the phy if a reset function pointer is present.  In
-addition to the moving of the driver, this reset function is added.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/Makefile          |   2 +-
- drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 264 ++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.c           | 246 +++-------------------
- drivers/net/ethernet/broadcom/bgmac.h           |   3 +
- 4 files changed, 298 insertions(+), 217 deletions(-)
- create mode 100644 drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-
---- a/drivers/net/ethernet/broadcom/Makefile
-+++ b/drivers/net/ethernet/broadcom/Makefile
-@@ -10,6 +10,6 @@ obj-$(CONFIG_CNIC) += cnic.o
- obj-$(CONFIG_BNX2X) += bnx2x/
- obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
- obj-$(CONFIG_TIGON3) += tg3.o
--obj-$(CONFIG_BGMAC) += bgmac.o
-+obj-$(CONFIG_BGMAC) += bgmac.o bgmac-bcma-mdio.o
- obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
- obj-$(CONFIG_BNXT) += bnxt/
---- /dev/null
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-@@ -0,0 +1,275 @@
-+/*
-+ * Driver for (BCM4706)? GBit MAC core on BCMA bus.
-+ *
-+ * Copyright (C) 2012 Rafał Miłecki <zajec5@gmail.com>
-+ *
-+ * Licensed under the GNU/GPL. See COPYING for details.
-+ */
-+
-+#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
-+#include <linux/brcmphy.h>
-+#include "bgmac.h"
-+
-+struct bcma_mdio {
-+	struct bcma_device *core;
-+	u8 phyaddr;
-+};
-+
-+static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
-+				 u32 value, int timeout)
-+{
-+	u32 val;
-+	int i;
-+
-+	for (i = 0; i < timeout / 10; i++) {
-+		val = bcma_read32(core, reg);
-+		if ((val & mask) == value)
-+			return true;
-+		udelay(10);
-+	}
-+	dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg);
-+	return false;
-+}
-+
-+/**************************************************
-+ * PHY ops
-+ **************************************************/
-+
-+static u16 bcma_mdio_phy_read(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg)
-+{
-+	struct bcma_device *core;
-+	u16 phy_access_addr;
-+	u16 phy_ctl_addr;
-+	u32 tmp;
-+
-+	BUILD_BUG_ON(BGMAC_PA_DATA_MASK != BCMA_GMAC_CMN_PA_DATA_MASK);
-+	BUILD_BUG_ON(BGMAC_PA_ADDR_MASK != BCMA_GMAC_CMN_PA_ADDR_MASK);
-+	BUILD_BUG_ON(BGMAC_PA_ADDR_SHIFT != BCMA_GMAC_CMN_PA_ADDR_SHIFT);
-+	BUILD_BUG_ON(BGMAC_PA_REG_MASK != BCMA_GMAC_CMN_PA_REG_MASK);
-+	BUILD_BUG_ON(BGMAC_PA_REG_SHIFT != BCMA_GMAC_CMN_PA_REG_SHIFT);
-+	BUILD_BUG_ON(BGMAC_PA_WRITE != BCMA_GMAC_CMN_PA_WRITE);
-+	BUILD_BUG_ON(BGMAC_PA_START != BCMA_GMAC_CMN_PA_START);
-+	BUILD_BUG_ON(BGMAC_PC_EPA_MASK != BCMA_GMAC_CMN_PC_EPA_MASK);
-+	BUILD_BUG_ON(BGMAC_PC_MCT_MASK != BCMA_GMAC_CMN_PC_MCT_MASK);
-+	BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT);
-+	BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE);
-+
-+	if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+		core = bcma_mdio->core->bus->drv_gmac_cmn.core;
-+		phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
-+		phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
-+	} else {
-+		core = bcma_mdio->core;
-+		phy_access_addr = BGMAC_PHY_ACCESS;
-+		phy_ctl_addr = BGMAC_PHY_CNTL;
-+	}
-+
-+	tmp = bcma_read32(core, phy_ctl_addr);
-+	tmp &= ~BGMAC_PC_EPA_MASK;
-+	tmp |= phyaddr;
-+	bcma_write32(core, phy_ctl_addr, tmp);
-+
-+	tmp = BGMAC_PA_START;
-+	tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
-+	tmp |= reg << BGMAC_PA_REG_SHIFT;
-+	bcma_write32(core, phy_access_addr, tmp);
-+
-+	if (!bcma_mdio_wait_value(core, phy_access_addr, BGMAC_PA_START, 0,
-+				  1000)) {
-+		dev_err(&core->dev, "Reading PHY %d register 0x%X failed\n",
-+			phyaddr, reg);
-+		return 0xffff;
-+	}
-+
-+	return bcma_read32(core, phy_access_addr) & BGMAC_PA_DATA_MASK;
-+}
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */
-+static int bcma_mdio_phy_write(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg,
-+			       u16 value)
-+{
-+	struct bcma_device *core;
-+	u16 phy_access_addr;
-+	u16 phy_ctl_addr;
-+	u32 tmp;
-+
-+	if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+		core = bcma_mdio->core->bus->drv_gmac_cmn.core;
-+		phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
-+		phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
-+	} else {
-+		core = bcma_mdio->core;
-+		phy_access_addr = BGMAC_PHY_ACCESS;
-+		phy_ctl_addr = BGMAC_PHY_CNTL;
-+	}
-+
-+	tmp = bcma_read32(core, phy_ctl_addr);
-+	tmp &= ~BGMAC_PC_EPA_MASK;
-+	tmp |= phyaddr;
-+	bcma_write32(core, phy_ctl_addr, tmp);
-+
-+	bcma_write32(bcma_mdio->core, BGMAC_INT_STATUS, BGMAC_IS_MDIO);
-+	if (bcma_read32(bcma_mdio->core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO)
-+		dev_warn(&core->dev, "Error setting MDIO int\n");
-+
-+	tmp = BGMAC_PA_START;
-+	tmp |= BGMAC_PA_WRITE;
-+	tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
-+	tmp |= reg << BGMAC_PA_REG_SHIFT;
-+	tmp |= value;
-+	bcma_write32(core, phy_access_addr, tmp);
-+
-+	if (!bcma_mdio_wait_value(core, phy_access_addr, BGMAC_PA_START, 0,
-+				  1000)) {
-+		dev_err(&core->dev, "Writing to PHY %d register 0x%X failed\n",
-+			phyaddr, reg);
-+		return -ETIMEDOUT;
-+	}
-+
-+	return 0;
-+}
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */
-+static void bcma_mdio_phy_init(struct bcma_mdio *bcma_mdio)
-+{
-+	struct bcma_chipinfo *ci = &bcma_mdio->core->bus->chipinfo;
-+	u8 i;
-+
-+	if (ci->id == BCMA_CHIP_ID_BCM5356) {
-+		for (i = 0; i < 5; i++) {
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x008b);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x15, 0x0100);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x12, 0x2aaa);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b);
-+		}
-+	}
-+	if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) ||
-+	    (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) ||
-+	    (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) {
-+		struct bcma_drv_cc *cc = &bcma_mdio->core->bus->drv_cc;
-+
-+		bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0);
-+		bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0);
-+		for (i = 0; i < 5; i++) {
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5284);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x0010);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5296);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x1073);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9073);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x52b6);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9273);
-+			bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b);
-+		}
-+	}
-+}
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */
-+static int bcma_mdio_phy_reset(struct mii_bus *bus)
-+{
-+	struct bcma_mdio *bcma_mdio = bus->priv;
-+	u8 phyaddr = bcma_mdio->phyaddr;
-+
-+	if (bcma_mdio->phyaddr == BGMAC_PHY_NOREGS)
-+		return 0;
-+
-+	bcma_mdio_phy_write(bcma_mdio, phyaddr, MII_BMCR, BMCR_RESET);
-+	udelay(100);
-+	if (bcma_mdio_phy_read(bcma_mdio, phyaddr, MII_BMCR) & BMCR_RESET)
-+		dev_err(&bcma_mdio->core->dev, "PHY reset failed\n");
-+	bcma_mdio_phy_init(bcma_mdio);
-+
-+	return 0;
-+}
-+
-+/**************************************************
-+ * MII
-+ **************************************************/
-+
-+static int bcma_mdio_mii_read(struct mii_bus *bus, int mii_id, int regnum)
-+{
-+	return bcma_mdio_phy_read(bus->priv, mii_id, regnum);
-+}
-+
-+static int bcma_mdio_mii_write(struct mii_bus *bus, int mii_id, int regnum,
-+			       u16 value)
-+{
-+	return bcma_mdio_phy_write(bus->priv, mii_id, regnum, value);
-+}
-+
-+struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr)
-+{
-+	struct bcma_mdio *bcma_mdio;
-+	struct mii_bus *mii_bus;
-+	int i, err;
-+
-+	bcma_mdio = kzalloc(sizeof(*bcma_mdio), GFP_KERNEL);
-+	if (!bcma_mdio)
-+		return ERR_PTR(-ENOMEM);
-+
-+	mii_bus = mdiobus_alloc();
-+	if (!mii_bus) {
-+		err = -ENOMEM;
-+		goto err;
-+	}
-+
-+	mii_bus->name = "bcma_mdio mii bus";
-+	sprintf(mii_bus->id, "%s-%d-%d", "bcma_mdio", core->bus->num,
-+		core->core_unit);
-+	mii_bus->priv = bcma_mdio;
-+	mii_bus->read = bcma_mdio_mii_read;
-+	mii_bus->write = bcma_mdio_mii_write;
-+	mii_bus->reset = bcma_mdio_phy_reset;
-+	mii_bus->parent = &core->dev;
-+	mii_bus->phy_mask = ~(1 << phyaddr);
-+ 
-+	mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
-+	if (!mii_bus->irq) {
-+		err = -ENOMEM;
-+		goto err_free_bus;
-+	}
-+	for (i = 0; i < PHY_MAX_ADDR; i++)
-+		mii_bus->irq[i] = PHY_POLL;
-+
-+	bcma_mdio->core = core;
-+	bcma_mdio->phyaddr = phyaddr;
-+
-+	err = mdiobus_register(mii_bus);
-+	if (err) {
-+		dev_err(&core->dev, "Registration of mii bus failed\n");
-+		goto err_free_irq;
-+	}
-+
-+	return mii_bus;
-+
-+err_free_irq:
-+	kfree(mii_bus->irq);
-+err_free_bus:
-+	mdiobus_free(mii_bus);
-+err:
-+	kfree(bcma_mdio);
-+	return ERR_PTR(err);
-+}
-+
-+void bcma_mdio_mii_unregister(struct mii_bus *mii_bus)
-+{
-+	struct bcma_mdio *bcma_mdio;
-+
-+	if (!mii_bus)
-+		return;
-+
-+	bcma_mdio = mii_bus->priv;
-+
-+	mdiobus_unregister(mii_bus);
-+	kfree(mii_bus->irq);
-+	mdiobus_free(mii_bus);
-+	kfree(bcma_mdio);
-+}
-+
-+MODULE_AUTHOR("Rafał Miłecki");
-+MODULE_LICENSE("GPL");
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -759,150 +759,6 @@ error:
- 	return err;
- }
- 
--/**************************************************
-- * PHY ops
-- **************************************************/
--
--static u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg)
--{
--	struct bcma_device *core;
--	u16 phy_access_addr;
--	u16 phy_ctl_addr;
--	u32 tmp;
--
--	BUILD_BUG_ON(BGMAC_PA_DATA_MASK != BCMA_GMAC_CMN_PA_DATA_MASK);
--	BUILD_BUG_ON(BGMAC_PA_ADDR_MASK != BCMA_GMAC_CMN_PA_ADDR_MASK);
--	BUILD_BUG_ON(BGMAC_PA_ADDR_SHIFT != BCMA_GMAC_CMN_PA_ADDR_SHIFT);
--	BUILD_BUG_ON(BGMAC_PA_REG_MASK != BCMA_GMAC_CMN_PA_REG_MASK);
--	BUILD_BUG_ON(BGMAC_PA_REG_SHIFT != BCMA_GMAC_CMN_PA_REG_SHIFT);
--	BUILD_BUG_ON(BGMAC_PA_WRITE != BCMA_GMAC_CMN_PA_WRITE);
--	BUILD_BUG_ON(BGMAC_PA_START != BCMA_GMAC_CMN_PA_START);
--	BUILD_BUG_ON(BGMAC_PC_EPA_MASK != BCMA_GMAC_CMN_PC_EPA_MASK);
--	BUILD_BUG_ON(BGMAC_PC_MCT_MASK != BCMA_GMAC_CMN_PC_MCT_MASK);
--	BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT);
--	BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE);
--
--	if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
--		core = bgmac->core->bus->drv_gmac_cmn.core;
--		phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
--		phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
--	} else {
--		core = bgmac->core;
--		phy_access_addr = BGMAC_PHY_ACCESS;
--		phy_ctl_addr = BGMAC_PHY_CNTL;
--	}
--
--	tmp = bcma_read32(core, phy_ctl_addr);
--	tmp &= ~BGMAC_PC_EPA_MASK;
--	tmp |= phyaddr;
--	bcma_write32(core, phy_ctl_addr, tmp);
--
--	tmp = BGMAC_PA_START;
--	tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
--	tmp |= reg << BGMAC_PA_REG_SHIFT;
--	bcma_write32(core, phy_access_addr, tmp);
--
--	if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--		dev_err(bgmac->dev, "Reading PHY %d register 0x%X failed\n",
--			phyaddr, reg);
--		return 0xffff;
--	}
--
--	return bcma_read32(core, phy_access_addr) & BGMAC_PA_DATA_MASK;
--}
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */
--static int bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value)
--{
--	struct bcma_device *core;
--	u16 phy_access_addr;
--	u16 phy_ctl_addr;
--	u32 tmp;
--
--	if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) {
--		core = bgmac->core->bus->drv_gmac_cmn.core;
--		phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS;
--		phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL;
--	} else {
--		core = bgmac->core;
--		phy_access_addr = BGMAC_PHY_ACCESS;
--		phy_ctl_addr = BGMAC_PHY_CNTL;
--	}
--
--	tmp = bcma_read32(core, phy_ctl_addr);
--	tmp &= ~BGMAC_PC_EPA_MASK;
--	tmp |= phyaddr;
--	bcma_write32(core, phy_ctl_addr, tmp);
--
--	bgmac_write(bgmac, BGMAC_INT_STATUS, BGMAC_IS_MDIO);
--	if (bgmac_read(bgmac, BGMAC_INT_STATUS) & BGMAC_IS_MDIO)
--		dev_warn(bgmac->dev, "Error setting MDIO int\n");
--
--	tmp = BGMAC_PA_START;
--	tmp |= BGMAC_PA_WRITE;
--	tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT;
--	tmp |= reg << BGMAC_PA_REG_SHIFT;
--	tmp |= value;
--	bcma_write32(core, phy_access_addr, tmp);
--
--	if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
--		dev_err(bgmac->dev, "Writing to PHY %d register 0x%X failed\n",
--			phyaddr, reg);
--		return -ETIMEDOUT;
--	}
--
--	return 0;
--}
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */
--static void bgmac_phy_init(struct bgmac *bgmac)
--{
--	struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
--	struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
--	u8 i;
--
--	if (ci->id == BCMA_CHIP_ID_BCM5356) {
--		for (i = 0; i < 5; i++) {
--			bgmac_phy_write(bgmac, i, 0x1f, 0x008b);
--			bgmac_phy_write(bgmac, i, 0x15, 0x0100);
--			bgmac_phy_write(bgmac, i, 0x1f, 0x000f);
--			bgmac_phy_write(bgmac, i, 0x12, 0x2aaa);
--			bgmac_phy_write(bgmac, i, 0x1f, 0x000b);
--		}
--	}
--	if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) ||
--	    (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) ||
--	    (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) {
--		bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0);
--		bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0);
--		for (i = 0; i < 5; i++) {
--			bgmac_phy_write(bgmac, i, 0x1f, 0x000f);
--			bgmac_phy_write(bgmac, i, 0x16, 0x5284);
--			bgmac_phy_write(bgmac, i, 0x1f, 0x000b);
--			bgmac_phy_write(bgmac, i, 0x17, 0x0010);
--			bgmac_phy_write(bgmac, i, 0x1f, 0x000f);
--			bgmac_phy_write(bgmac, i, 0x16, 0x5296);
--			bgmac_phy_write(bgmac, i, 0x17, 0x1073);
--			bgmac_phy_write(bgmac, i, 0x17, 0x9073);
--			bgmac_phy_write(bgmac, i, 0x16, 0x52b6);
--			bgmac_phy_write(bgmac, i, 0x17, 0x9273);
--			bgmac_phy_write(bgmac, i, 0x1f, 0x000b);
--		}
--	}
--}
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */
--static void bgmac_phy_reset(struct bgmac *bgmac)
--{
--	if (bgmac->phyaddr == BGMAC_PHY_NOREGS)
--		return;
--
--	bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET);
--	udelay(100);
--	if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET)
--		dev_err(bgmac->dev, "PHY reset failed\n");
--	bgmac_phy_init(bgmac);
--}
- 
- /**************************************************
-  * Chip ops
-@@ -1159,7 +1015,8 @@ static void bgmac_chip_reset(struct bgma
- 	else
- 		bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE);
- 	bgmac_miiconfig(bgmac);
--	bgmac_phy_init(bgmac);
-+	if (bgmac->mii_bus)
-+		bgmac->mii_bus->reset(bgmac->mii_bus);
- 
- 	netdev_reset_queue(bgmac->net_dev);
- }
-@@ -1553,17 +1410,6 @@ static const struct ethtool_ops bgmac_et
-  * MII
-  **************************************************/
- 
--static int bgmac_mii_read(struct mii_bus *bus, int mii_id, int regnum)
--{
--	return bgmac_phy_read(bus->priv, mii_id, regnum);
--}
--
--static int bgmac_mii_write(struct mii_bus *bus, int mii_id, int regnum,
--			   u16 value)
--{
--	return bgmac_phy_write(bus->priv, mii_id, regnum, value);
--}
--
- static void bgmac_adjust_link(struct net_device *net_dev)
- {
- 	struct bgmac *bgmac = netdev_priv(net_dev);
-@@ -1588,7 +1434,7 @@ static void bgmac_adjust_link(struct net
- 	}
- }
- 
--static int bgmac_fixed_phy_register(struct bgmac *bgmac)
-+static int bgmac_phy_connect_direct(struct bgmac *bgmac)
- {
- 	struct fixed_phy_status fphy_status = {
- 		.link = 1,
-@@ -1614,81 +1460,24 @@ static int bgmac_fixed_phy_register(stru
- 	return err;
- }
- 
--static int bgmac_mii_register(struct bgmac *bgmac)
-+static int bgmac_phy_connect(struct bgmac *bgmac)
- {
--	struct mii_bus *mii_bus;
- 	struct phy_device *phy_dev;
- 	char bus_id[MII_BUS_ID_SIZE + 3];
--	int i, err = 0;
--
--	if (bgmac_is_bcm4707_family(bgmac))
--		return bgmac_fixed_phy_register(bgmac);
--
--	mii_bus = mdiobus_alloc();
--	if (!mii_bus)
--		return -ENOMEM;
--
--	mii_bus->name = "bgmac mii bus";
--	sprintf(mii_bus->id, "%s-%d-%d", "bgmac", bgmac->core->bus->num,
--		bgmac->core->core_unit);
--	mii_bus->priv = bgmac;
--	mii_bus->read = bgmac_mii_read;
--	mii_bus->write = bgmac_mii_write;
--	mii_bus->parent = &bgmac->core->dev;
--	mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
--
--	mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
--	if (!mii_bus->irq) {
--		err = -ENOMEM;
--		goto err_free_bus;
--	}
--	for (i = 0; i < PHY_MAX_ADDR; i++)
--		mii_bus->irq[i] = PHY_POLL;
--
--	err = mdiobus_register(mii_bus);
--	if (err) {
--		dev_err(bgmac->dev, "Registration of mii bus failed\n");
--		goto err_free_irq;
--	}
--
--	bgmac->mii_bus = mii_bus;
- 
- 	/* Connect to the PHY */
--	snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, mii_bus->id,
-+	snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
- 		 bgmac->phyaddr);
- 	phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link,
- 			      PHY_INTERFACE_MODE_MII);
- 	if (IS_ERR(phy_dev)) {
- 		dev_err(bgmac->dev, "PHY connecton failed\n");
--		err = PTR_ERR(phy_dev);
--		goto err_unregister_bus;
-+		return PTR_ERR(phy_dev);
- 	}
- 
--	return err;
--
--err_unregister_bus:
--	mdiobus_unregister(mii_bus);
--err_free_irq:
--	kfree(mii_bus->irq);
--err_free_bus:
--	mdiobus_free(mii_bus);
--	return err;
--}
--
--static void bgmac_mii_unregister(struct bgmac *bgmac)
--{
--	struct mii_bus *mii_bus = bgmac->mii_bus;
--
--	mdiobus_unregister(mii_bus);
--	kfree(mii_bus->irq);
--	mdiobus_free(mii_bus);
-+	return 0;
- }
- 
--/**************************************************
-- * BCMA bus ops
-- **************************************************/
--
--/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
- 	struct net_device *net_dev;
-@@ -1809,9 +1598,6 @@ static int bgmac_probe(struct bcma_devic
- 	if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0)
- 		bgmac->int_mask &= ~BGMAC_IS_TX_MASK;
- 
--	/* TODO: reset the external phy. Specs are needed */
--	bgmac_phy_reset(bgmac);
--
- 	bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
- 			       BGMAC_BFL_ENETROBO);
- 	if (bgmac->has_robosw)
-@@ -1822,10 +1608,25 @@ static int bgmac_probe(struct bcma_devic
- 
- 	netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
- 
--	err = bgmac_mii_register(bgmac);
-+	if (!bgmac_is_bcm4707_family(bgmac)) {
-+		struct mii_bus *mii_bus;
-+
-+		mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
-+		if (!IS_ERR(mii_bus)) {
-+			err = PTR_ERR(mii_bus);
-+			goto err_dma_free;
-+		}
-+
-+		bgmac->mii_bus = mii_bus;
-+	}
-+
-+	if (!bgmac->mii_bus)
-+		err = bgmac_phy_connect_direct(bgmac);
-+	else
-+		err = bgmac_phy_connect(bgmac);
- 	if (err) {
- 		dev_err(bgmac->dev, "Cannot connect to phy\n");
--		goto err_dma_free;
-+		goto err_mii_unregister;
- 	}
- 
- 	net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-@@ -1835,18 +1636,19 @@ static int bgmac_probe(struct bcma_devic
- 	err = register_netdev(bgmac->net_dev);
- 	if (err) {
- 		dev_err(bgmac->dev, "Cannot register net device\n");
--		goto err_mii_unregister;
-+		goto err_phy_disconnect;
- 	}
- 
- 	netif_carrier_off(net_dev);
- 
- 	return 0;
- 
-+err_phy_disconnect:
-+	phy_disconnect(net_dev->phydev);
- err_mii_unregister:
--	bgmac_mii_unregister(bgmac);
-+	bcma_mdio_mii_unregister(bgmac->mii_bus);
- err_dma_free:
- 	bgmac_dma_free(bgmac);
--
- err_netdev_free:
- 	bcma_set_drvdata(core, NULL);
- 	free_netdev(net_dev);
-@@ -1859,7 +1661,8 @@ static void bgmac_remove(struct bcma_dev
- 	struct bgmac *bgmac = bcma_get_drvdata(core);
- 
- 	unregister_netdev(bgmac->net_dev);
--	bgmac_mii_unregister(bgmac);
-+	phy_disconnect(bgmac->net_dev->phydev);
-+	bcma_mdio_mii_unregister(bgmac->mii_bus);
- 	netif_napi_del(&bgmac->napi);
- 	bgmac_dma_free(bgmac);
- 	bcma_set_drvdata(core, NULL);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -456,6 +456,9 @@ struct bgmac {
- 	bool loopback;
- };
- 
-+struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr);
-+void bcma_mdio_mii_unregister(struct mii_bus *mii_bus);
-+
- static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)
- {
- 	return bcma_read32(bgmac->core, offset);

+ 0 - 384
target/linux/generic/patches-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch

@@ -1,384 +0,0 @@
-From db791eb2970bad193b1dc95a4461b222dd22cb64 Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:56 -0400
-Subject: [PATCH 4/5] net: ethernet: bgmac: convert to feature flags
-
-The bgmac driver is using the bcma provides device ID and revision, as
-well as the SoC ID and package, to determine which features are
-necessary to enable, reset, etc in the driver.   In anticipation of
-removing the bcma requirement for this driver, these must be changed to
-not reference that struct.  In place of that, each "feature" has been
-given a flag, and the flags are enabled for their respective device and
-SoC.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 167 ++++++++++++++++++++++++----------
- drivers/net/ethernet/broadcom/bgmac.h |  21 ++++-
- 2 files changed, 140 insertions(+), 48 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -109,7 +109,7 @@ static void bgmac_dma_tx_enable(struct b
- 	u32 ctl;
- 
- 	ctl = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL);
--	if (bgmac->core->id.rev >= 4) {
-+	if (bgmac->feature_flags & BGMAC_FEAT_TX_MASK_SETUP) {
- 		ctl &= ~BGMAC_DMA_TX_BL_MASK;
- 		ctl |= BGMAC_DMA_TX_BL_128 << BGMAC_DMA_TX_BL_SHIFT;
- 
-@@ -335,7 +335,7 @@ static void bgmac_dma_rx_enable(struct b
- 	/* preserve ONLY bits 16-17 from current hardware value */
- 	ctl &= BGMAC_DMA_RX_ADDREXT_MASK;
- 
--	if (bgmac->core->id.rev >= 4) {
-+	if (bgmac->feature_flags & BGMAC_FEAT_RX_MASK_SETUP) {
- 		ctl &= ~BGMAC_DMA_RX_BL_MASK;
- 		ctl |= BGMAC_DMA_RX_BL_128 << BGMAC_DMA_RX_BL_SHIFT;
- 
-@@ -772,14 +772,20 @@ static void bgmac_cmdcfg_maskset(struct
- {
- 	u32 cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG);
- 	u32 new_val = (cmdcfg & mask) | set;
-+	u32 cmdcfg_sr;
- 
--	bgmac_set(bgmac, BGMAC_CMDCFG, BGMAC_CMDCFG_SR(bgmac->core->id.rev));
-+	if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4)
-+		cmdcfg_sr = BGMAC_CMDCFG_SR_REV4;
-+	else
-+		cmdcfg_sr = BGMAC_CMDCFG_SR_REV0;
-+
-+	bgmac_set(bgmac, BGMAC_CMDCFG, cmdcfg_sr);
- 	udelay(2);
- 
- 	if (new_val != cmdcfg || force)
- 		bgmac_write(bgmac, BGMAC_CMDCFG, new_val);
- 
--	bgmac_mask(bgmac, BGMAC_CMDCFG, ~BGMAC_CMDCFG_SR(bgmac->core->id.rev));
-+	bgmac_mask(bgmac, BGMAC_CMDCFG, ~cmdcfg_sr);
- 	udelay(2);
- }
- 
-@@ -808,7 +814,7 @@ static void bgmac_chip_stats_update(stru
- {
- 	int i;
- 
--	if (bgmac->core->id.id != BCMA_CORE_4706_MAC_GBIT) {
-+	if (!(bgmac->feature_flags & BGMAC_FEAT_NO_CLR_MIB)) {
- 		for (i = 0; i < BGMAC_NUM_MIB_TX_REGS; i++)
- 			bgmac->mib_tx_regs[i] =
- 				bgmac_read(bgmac,
-@@ -827,7 +833,7 @@ static void bgmac_clear_mib(struct bgmac
- {
- 	int i;
- 
--	if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT)
-+	if (bgmac->feature_flags & BGMAC_FEAT_NO_CLR_MIB)
- 		return;
- 
- 	bgmac_set(bgmac, BGMAC_DEV_CTL, BGMAC_DC_MROR);
-@@ -870,9 +876,8 @@ static void bgmac_mac_speed(struct bgmac
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
- 	struct bcma_device *core = bgmac->core;
--	u8 imode;
- 
--	if (bgmac_is_bcm4707_family(bgmac)) {
-+	if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) {
- 		bcma_awrite32(core, BCMA_IOCTL,
- 			      bcma_aread32(core, BCMA_IOCTL) | 0x40 |
- 			      BGMAC_BCMA_IOCTL_SW_CLKEN);
-@@ -880,6 +885,8 @@ static void bgmac_miiconfig(struct bgmac
- 		bgmac->mac_duplex = DUPLEX_FULL;
- 		bgmac_mac_speed(bgmac);
- 	} else {
-+		u8 imode;
-+
- 		imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) &
- 			BGMAC_DS_MM_MASK) >> BGMAC_DS_MM_SHIFT;
- 		if (imode == 0 || imode == 1) {
-@@ -894,9 +901,7 @@ static void bgmac_miiconfig(struct bgmac
- static void bgmac_chip_reset(struct bgmac *bgmac)
- {
- 	struct bcma_device *core = bgmac->core;
--	struct bcma_bus *bus = core->bus;
--	struct bcma_chipinfo *ci = &bus->chipinfo;
--	u32 flags;
-+	u32 cmdcfg_sr;
- 	u32 iost;
- 	int i;
- 
-@@ -919,15 +924,12 @@ static void bgmac_chip_reset(struct bgma
- 	}
- 
- 	iost = bcma_aread32(core, BCMA_IOST);
--	if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
--	    (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) ||
--	    (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
-+	if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED)
- 		iost &= ~BGMAC_BCMA_IOST_ATTACHED;
- 
- 	/* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
--	if (ci->id != BCMA_CHIP_ID_BCM4707 &&
--	    ci->id != BCMA_CHIP_ID_BCM47094) {
--		flags = 0;
-+	if (!(bgmac->feature_flags & BGMAC_FEAT_NO_RESET)) {
-+		u32 flags = 0;
- 		if (iost & BGMAC_BCMA_IOST_ATTACHED) {
- 			flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
- 			if (!bgmac->has_robosw)
-@@ -937,7 +939,7 @@ static void bgmac_chip_reset(struct bgma
- 	}
- 
- 	/* Request Misc PLL for corerev > 2 */
--	if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) {
-+	if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) {
- 		bgmac_set(bgmac, BCMA_CLKCTLST,
- 			  BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
- 		bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-@@ -946,9 +948,7 @@ static void bgmac_chip_reset(struct bgma
- 				 1000);
- 	}
- 
--	if (ci->id == BCMA_CHIP_ID_BCM5357 ||
--	    ci->id == BCMA_CHIP_ID_BCM4749 ||
--	    ci->id == BCMA_CHIP_ID_BCM53572) {
-+	if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_PHY) {
- 		struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
- 		u8 et_swtype = 0;
- 		u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY |
-@@ -962,11 +962,9 @@ static void bgmac_chip_reset(struct bgma
- 			et_swtype &= 0x0f;
- 			et_swtype <<= 4;
- 			sw_type = et_swtype;
--		} else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM5358) {
-+		} else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) {
- 			sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
--		} else if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
--			   (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) ||
--			   (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) {
-+		} else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) {
- 			sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
- 				  BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
- 		}
-@@ -986,6 +984,11 @@ static void bgmac_chip_reset(struct bgma
- 	 * BGMAC_CMDCFG is read _after_ putting chip in a reset. So it has to
- 	 * be keps until taking MAC out of the reset.
- 	 */
-+	if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4)
-+		cmdcfg_sr = BGMAC_CMDCFG_SR_REV4;
-+	else
-+		cmdcfg_sr = BGMAC_CMDCFG_SR_REV0;
-+
- 	bgmac_cmdcfg_maskset(bgmac,
- 			     ~(BGMAC_CMDCFG_TE |
- 			       BGMAC_CMDCFG_RE |
-@@ -1003,13 +1006,13 @@ static void bgmac_chip_reset(struct bgma
- 			     BGMAC_CMDCFG_PROM |
- 			     BGMAC_CMDCFG_NLC |
- 			     BGMAC_CMDCFG_CFE |
--			     BGMAC_CMDCFG_SR(core->id.rev),
-+			     cmdcfg_sr,
- 			     false);
- 	bgmac->mac_speed = SPEED_UNKNOWN;
- 	bgmac->mac_duplex = DUPLEX_UNKNOWN;
- 
- 	bgmac_clear_mib(bgmac);
--	if (core->id.id == BCMA_CORE_4706_MAC_GBIT)
-+	if (bgmac->feature_flags & BGMAC_FEAT_CMN_PHY_CTL)
- 		bcma_maskset32(bgmac->cmn, BCMA_GMAC_CMN_PHY_CTL, ~0,
- 			       BCMA_GMAC_CMN_PC_MTE);
- 	else
-@@ -1035,46 +1038,48 @@ static void bgmac_chip_intrs_off(struct
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_enable */
- static void bgmac_enable(struct bgmac *bgmac)
- {
--	struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
-+	u32 cmdcfg_sr;
- 	u32 cmdcfg;
- 	u32 mode;
--	u32 rxq_ctl;
--	u32 fl_ctl;
--	u16 bp_clk;
--	u8 mdp;
-+
-+	if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4)
-+		cmdcfg_sr = BGMAC_CMDCFG_SR_REV4;
-+	else
-+		cmdcfg_sr = BGMAC_CMDCFG_SR_REV0;
- 
- 	cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG);
- 	bgmac_cmdcfg_maskset(bgmac, ~(BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE),
--			     BGMAC_CMDCFG_SR(bgmac->core->id.rev), true);
-+			     cmdcfg_sr, true);
- 	udelay(2);
- 	cmdcfg |= BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE;
- 	bgmac_write(bgmac, BGMAC_CMDCFG, cmdcfg);
- 
- 	mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
- 		BGMAC_DS_MM_SHIFT;
--	if (ci->id != BCMA_CHIP_ID_BCM47162 || mode != 0)
-+	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
- 		bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
--	if (ci->id == BCMA_CHIP_ID_BCM47162 && mode == 2)
-+	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
- 		bcma_chipco_chipctl_maskset(&bgmac->core->bus->drv_cc, 1, ~0,
- 					    BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
- 
--	switch (ci->id) {
--	case BCMA_CHIP_ID_BCM5357:
--	case BCMA_CHIP_ID_BCM4749:
--	case BCMA_CHIP_ID_BCM53572:
--	case BCMA_CHIP_ID_BCM4716:
--	case BCMA_CHIP_ID_BCM47162:
--		fl_ctl = 0x03cb04cb;
--		if (ci->id == BCMA_CHIP_ID_BCM5357 ||
--		    ci->id == BCMA_CHIP_ID_BCM4749 ||
--		    ci->id == BCMA_CHIP_ID_BCM53572)
-+	if (bgmac->feature_flags & (BGMAC_FEAT_FLW_CTRL1 |
-+				    BGMAC_FEAT_FLW_CTRL2)) {
-+		u32 fl_ctl;
-+
-+		if (bgmac->feature_flags & BGMAC_FEAT_FLW_CTRL1)
- 			fl_ctl = 0x2300e1;
-+		else
-+			fl_ctl = 0x03cb04cb;
-+
- 		bgmac_write(bgmac, BGMAC_FLOW_CTL_THRESH, fl_ctl);
- 		bgmac_write(bgmac, BGMAC_PAUSE_CTL, 0x27fff);
--		break;
- 	}
- 
--	if (!bgmac_is_bcm4707_family(bgmac)) {
-+	if (bgmac->feature_flags & BGMAC_FEAT_SET_RXQ_CLK) {
-+		u32 rxq_ctl;
-+		u16 bp_clk;
-+		u8 mdp;
-+
- 		rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
- 		rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
- 		bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
-@@ -1606,6 +1611,74 @@ static int bgmac_probe(struct bcma_devic
- 	if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
- 		dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
- 
-+	/* Feature Flags */
-+	switch (core->bus->chipinfo.id) {
-+	case BCMA_CHIP_ID_BCM5357:
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) {
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+		}
-+		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358)
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
-+		break;
-+	case BCMA_CHIP_ID_BCM53572:
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) {
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+		}
-+		break;
-+	case BCMA_CHIP_ID_BCM4749:
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+		if (core->bus->chipinfo.pkg == 10) {
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+		}
-+		break;
-+	case BCMA_CHIP_ID_BCM4716:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		/* fallthrough */
-+	case BCMA_CHIP_ID_BCM47162:
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		break;
-+	/* bcm4707_family */
-+	case BCMA_CHIP_ID_BCM4707:
-+	case BCMA_CHIP_ID_BCM47094:
-+	case BCMA_CHIP_ID_BCM53018:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-+		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+		break;
-+	default:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+	}
-+
-+	if (!bgmac_is_bcm4707_family(bgmac) && core->id.rev > 2)
-+		bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ;
-+
-+	if (core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+		bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL;
-+		bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB;
-+	}
-+
-+	if (core->id.rev >= 4) {
-+		bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
-+		bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
-+		bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
-+	}
-+
- 	netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
- 
- 	if (!bgmac_is_bcm4707_family(bgmac)) {
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -190,7 +190,6 @@
- #define  BGMAC_CMDCFG_HD_SHIFT			10
- #define  BGMAC_CMDCFG_SR_REV0			0x00000800	/* Set to reset mode, for core rev 0-3 */
- #define  BGMAC_CMDCFG_SR_REV4			0x00002000	/* Set to reset mode, for core rev >= 4 */
--#define  BGMAC_CMDCFG_SR(rev)  ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
- #define  BGMAC_CMDCFG_ML			0x00008000	/* Set to activate mac loopback mode */
- #define  BGMAC_CMDCFG_AE			0x00400000
- #define  BGMAC_CMDCFG_CFE			0x00800000
-@@ -376,6 +375,24 @@
- 
- #define ETHER_MAX_LEN   1518
- 
-+/* Feature Flags */
-+#define BGMAC_FEAT_TX_MASK_SETUP	BIT(0)
-+#define BGMAC_FEAT_RX_MASK_SETUP	BIT(1)
-+#define BGMAC_FEAT_IOST_ATTACHED	BIT(2)
-+#define BGMAC_FEAT_NO_RESET		BIT(3)
-+#define BGMAC_FEAT_MISC_PLL_REQ		BIT(4)
-+#define BGMAC_FEAT_SW_TYPE_PHY		BIT(5)
-+#define BGMAC_FEAT_SW_TYPE_EPHYRMII	BIT(6)
-+#define BGMAC_FEAT_SW_TYPE_RGMII	BIT(7)
-+#define BGMAC_FEAT_CMN_PHY_CTL		BIT(8)
-+#define BGMAC_FEAT_FLW_CTRL1		BIT(9)
-+#define BGMAC_FEAT_FLW_CTRL2		BIT(10)
-+#define BGMAC_FEAT_SET_RXQ_CLK		BIT(11)
-+#define BGMAC_FEAT_CLKCTLST		BIT(12)
-+#define BGMAC_FEAT_NO_CLR_MIB		BIT(13)
-+#define BGMAC_FEAT_FORCE_SPEED_2500	BIT(14)
-+#define BGMAC_FEAT_CMDCFG_SR_REV4	BIT(15)
-+
- struct bgmac_slot_info {
- 	union {
- 		struct sk_buff *skb;
-@@ -430,6 +447,8 @@ struct bgmac {
- 
- 	struct device *dev;
- 	struct device *dma_dev;
-+	u32 feature_flags;
-+
- 	struct net_device *net_dev;
- 	struct napi_struct napi;
- 	struct mii_bus *mii_bus;

+ 0 - 1260
target/linux/generic/patches-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch

@@ -1,1260 +0,0 @@
-From f6a95a24957aec5bb488c3f978c4ed508177998f Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Thu, 7 Jul 2016 19:08:57 -0400
-Subject: [PATCH 5/5] net: ethernet: bgmac: Add platform device support
-
-The bcma portion of the driver has been split off into a bcma specific
-driver.  This has been mirrored for the platform driver.  The last
-references to the bcma core struct have been changed into a generic
-function call.  These function calls are wrappers to either the original
-bcma code or new platform functions that access the same areas via MMIO.
-This necessitated adding function pointers for both platform and bcma to
-hide which backend is being used from the generic bgmac code.
-
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/Kconfig           |  23 +-
- drivers/net/ethernet/broadcom/Makefile          |   4 +-
- drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c |   2 +
- drivers/net/ethernet/broadcom/bgmac-bcma.c      | 315 +++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac-platform.c  | 189 ++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.c           | 329 ++++--------------------
- drivers/net/ethernet/broadcom/bgmac.h           |  73 +++++-
- 7 files changed, 650 insertions(+), 285 deletions(-)
- create mode 100644 drivers/net/ethernet/broadcom/bgmac-bcma.c
- create mode 100644 drivers/net/ethernet/broadcom/bgmac-platform.c
-
---- a/drivers/net/ethernet/broadcom/Kconfig
-+++ b/drivers/net/ethernet/broadcom/Kconfig
-@@ -150,10 +150,18 @@ config BNX2X_VXLAN
- 	  Virtual eXtensible Local Area Network (VXLAN) in the driver.
- 
- config BGMAC
--	tristate "BCMA bus GBit core support"
-+	tristate
-+	help
-+	  This enables the integrated ethernet controller support for many
-+	  Broadcom (mostly iProc) SoCs. An appropriate bus interface driver
-+	  needs to be enabled to select this.
-+
-+config BGMAC_BCMA
-+	tristate "Broadcom iProc GBit BCMA support"
- 	depends on BCMA && BCMA_HOST_SOC
- 	depends on HAS_DMA
- 	depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST
-+	select BGMAC
- 	select PHYLIB
- 	select FIXED_PHY
- 	---help---
-@@ -162,6 +170,19 @@ config BGMAC
- 	  In case of using this driver on BCM4706 it's also requires to enable
- 	  BCMA_DRIVER_GMAC_CMN to make it work.
- 
-+config BGMAC_PLATFORM
-+	tristate "Broadcom iProc GBit platform support"
-+	depends on HAS_DMA
-+	depends on ARCH_BCM_IPROC || COMPILE_TEST
-+	depends on OF
-+	select BGMAC
-+	select PHYLIB
-+	select FIXED_PHY
-+	default ARCH_BCM_IPROC
-+	---help---
-+	  Say Y here if you want to use the Broadcom iProc Gigabit Ethernet
-+	  controller through the generic platform interface
-+
- config SYSTEMPORT
- 	tristate "Broadcom SYSTEMPORT internal MAC support"
- 	depends on OF
---- a/drivers/net/ethernet/broadcom/Makefile
-+++ b/drivers/net/ethernet/broadcom/Makefile
-@@ -10,6 +10,8 @@ obj-$(CONFIG_CNIC) += cnic.o
- obj-$(CONFIG_BNX2X) += bnx2x/
- obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
- obj-$(CONFIG_TIGON3) += tg3.o
--obj-$(CONFIG_BGMAC) += bgmac.o bgmac-bcma-mdio.o
-+obj-$(CONFIG_BGMAC) += bgmac.o
-+obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o
-+obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o
- obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
- obj-$(CONFIG_BNXT) += bnxt/
---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
-@@ -255,6 +255,7 @@ err:
- 	kfree(bcma_mdio);
- 	return ERR_PTR(err);
- }
-+EXPORT_SYMBOL_GPL(bcma_mdio_mii_register);
- 
- void bcma_mdio_mii_unregister(struct mii_bus *mii_bus)
- {
-@@ -270,6 +271,7 @@ void bcma_mdio_mii_unregister(struct mii
- 	mdiobus_free(mii_bus);
- 	kfree(bcma_mdio);
- }
-+EXPORT_SYMBOL_GPL(bcma_mdio_mii_unregister);
- 
- MODULE_AUTHOR("Rafał Miłecki");
- MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -0,0 +1,315 @@
-+/*
-+ * Driver for (BCM4706)? GBit MAC core on BCMA bus.
-+ *
-+ * Copyright (C) 2012 Rafał Miłecki <zajec5@gmail.com>
-+ *
-+ * Licensed under the GNU/GPL. See COPYING for details.
-+ */
-+
-+#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
-+#include <linux/brcmphy.h>
-+#include <linux/etherdevice.h>
-+#include "bgmac.h"
-+
-+static inline bool bgmac_is_bcm4707_family(struct bcma_device *core)
-+{
-+	switch (core->bus->chipinfo.id) {
-+	case BCMA_CHIP_ID_BCM4707:
-+	case BCMA_CHIP_ID_BCM47094:
-+	case BCMA_CHIP_ID_BCM53018:
-+		return true;
-+	default:
-+		return false;
-+	}
-+}
-+
-+/**************************************************
-+ * BCMA bus ops
-+ **************************************************/
-+
-+static u32 bcma_bgmac_read(struct bgmac *bgmac, u16 offset)
-+{
-+	return bcma_read32(bgmac->bcma.core, offset);
-+}
-+
-+static void bcma_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+	bcma_write32(bgmac->bcma.core, offset, value);
-+}
-+
-+static u32 bcma_bgmac_idm_read(struct bgmac *bgmac, u16 offset)
-+{
-+	return bcma_aread32(bgmac->bcma.core, offset);
-+}
-+
-+static void bcma_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+	return bcma_awrite32(bgmac->bcma.core, offset, value);
-+}
-+
-+static bool bcma_bgmac_clk_enabled(struct bgmac *bgmac)
-+{
-+	return bcma_core_is_enabled(bgmac->bcma.core);
-+}
-+
-+static void bcma_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
-+{
-+	bcma_core_enable(bgmac->bcma.core, flags);
-+}
-+
-+static void bcma_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset,
-+				       u32 mask, u32 set)
-+{
-+	struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc;
-+
-+	bcma_chipco_chipctl_maskset(cc, offset, mask, set);
-+}
-+
-+static u32 bcma_bgmac_get_bus_clock(struct bgmac *bgmac)
-+{
-+	struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc;
-+
-+	return bcma_pmu_get_bus_clock(cc);
-+}
-+
-+static void bcma_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, u32 mask,
-+				     u32 set)
-+{
-+	bcma_maskset32(bgmac->bcma.cmn, offset, mask, set);
-+}
-+
-+static const struct bcma_device_id bgmac_bcma_tbl[] = {
-+	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT,
-+		  BCMA_ANY_REV, BCMA_ANY_CLASS),
-+	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV,
-+		  BCMA_ANY_CLASS),
-+	{},
-+};
-+MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
-+
-+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
-+static int bgmac_probe(struct bcma_device *core)
-+{
-+	struct ssb_sprom *sprom = &core->bus->sprom;
-+	struct mii_bus *mii_bus;
-+	struct bgmac *bgmac;
-+	u8 *mac;
-+	int err;
-+
-+	bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL);
-+	if (!bgmac)
-+		return -ENOMEM;
-+
-+	bgmac->bcma.core = core;
-+	bgmac->dev = &core->dev;
-+	bgmac->dma_dev = core->dma_dev;
-+	bgmac->irq = core->irq;
-+
-+	bcma_set_drvdata(core, bgmac);
-+
-+	switch (core->core_unit) {
-+	case 0:
-+		mac = sprom->et0mac;
-+		break;
-+	case 1:
-+		mac = sprom->et1mac;
-+		break;
-+	case 2:
-+		mac = sprom->et2mac;
-+		break;
-+	default:
-+		dev_err(bgmac->dev, "Unsupported core_unit %d\n",
-+			core->core_unit);
-+		err = -ENOTSUPP;
-+		goto err;
-+	}
-+
-+	ether_addr_copy(bgmac->mac_addr, mac);
-+
-+	/* On BCM4706 we need common core to access PHY */
-+	if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
-+	    !core->bus->drv_gmac_cmn.core) {
-+		dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n");
-+		err = -ENODEV;
-+		goto err;
-+	}
-+	bgmac->bcma.cmn = core->bus->drv_gmac_cmn.core;
-+
-+	switch (core->core_unit) {
-+	case 0:
-+		bgmac->phyaddr = sprom->et0phyaddr;
-+		break;
-+	case 1:
-+		bgmac->phyaddr = sprom->et1phyaddr;
-+		break;
-+	case 2:
-+		bgmac->phyaddr = sprom->et2phyaddr;
-+		break;
-+	}
-+	bgmac->phyaddr &= BGMAC_PHY_MASK;
-+	if (bgmac->phyaddr == BGMAC_PHY_MASK) {
-+		dev_err(bgmac->dev, "No PHY found\n");
-+		err = -ENODEV;
-+		goto err;
-+	}
-+	dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
-+		 bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-+
-+	if (!bgmac_is_bcm4707_family(core)) {
-+		mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
-+		if (!IS_ERR(mii_bus)) {
-+			err = PTR_ERR(mii_bus);
-+			goto err;
-+		}
-+
-+		bgmac->mii_bus = mii_bus;
-+	}
-+
-+	if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
-+		dev_err(bgmac->dev, "PCI setup not implemented\n");
-+		err = -ENOTSUPP;
-+		goto err1;
-+	}
-+
-+	bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
-+			       BGMAC_BFL_ENETROBO);
-+	if (bgmac->has_robosw)
-+		dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n");
-+
-+	if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
-+		dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
-+
-+	/* Feature Flags */
-+	switch (core->bus->chipinfo.id) {
-+	case BCMA_CHIP_ID_BCM5357:
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) {
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+		}
-+		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358)
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
-+		break;
-+	case BCMA_CHIP_ID_BCM53572:
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) {
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+		}
-+		break;
-+	case BCMA_CHIP_ID_BCM4749:
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
-+		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
-+		if (core->bus->chipinfo.pkg == 10) {
-+			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+		}
-+		break;
-+	case BCMA_CHIP_ID_BCM4716:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		/* fallthrough */
-+	case BCMA_CHIP_ID_BCM47162:
-+		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		break;
-+	/* bcm4707_family */
-+	case BCMA_CHIP_ID_BCM4707:
-+	case BCMA_CHIP_ID_BCM47094:
-+	case BCMA_CHIP_ID_BCM53018:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-+		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+		break;
-+	default:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+	}
-+
-+	if (!bgmac_is_bcm4707_family(core) && core->id.rev > 2)
-+		bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ;
-+
-+	if (core->id.id == BCMA_CORE_4706_MAC_GBIT) {
-+		bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL;
-+		bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB;
-+	}
-+
-+	if (core->id.rev >= 4) {
-+		bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
-+		bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
-+		bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
-+	}
-+
-+	bgmac->read = bcma_bgmac_read;
-+	bgmac->write = bcma_bgmac_write;
-+	bgmac->idm_read = bcma_bgmac_idm_read;
-+	bgmac->idm_write = bcma_bgmac_idm_write;
-+	bgmac->clk_enabled = bcma_bgmac_clk_enabled;
-+	bgmac->clk_enable = bcma_bgmac_clk_enable;
-+	bgmac->cco_ctl_maskset = bcma_bgmac_cco_ctl_maskset;
-+	bgmac->get_bus_clock = bcma_bgmac_get_bus_clock;
-+	bgmac->cmn_maskset32 = bcma_bgmac_cmn_maskset32;
-+
-+	err = bgmac_enet_probe(bgmac);
-+	if (err)
-+		goto err1;
-+
-+	return 0;
-+
-+err1:
-+	bcma_mdio_mii_unregister(bgmac->mii_bus);
-+err:
-+	kfree(bgmac);
-+	bcma_set_drvdata(core, NULL);
-+
-+	return err;
-+}
-+
-+static void bgmac_remove(struct bcma_device *core)
-+{
-+	struct bgmac *bgmac = bcma_get_drvdata(core);
-+
-+	bcma_mdio_mii_unregister(bgmac->mii_bus);
-+	bgmac_enet_remove(bgmac);
-+	bcma_set_drvdata(core, NULL);
-+	kfree(bgmac);
-+}
-+
-+static struct bcma_driver bgmac_bcma_driver = {
-+	.name		= KBUILD_MODNAME,
-+	.id_table	= bgmac_bcma_tbl,
-+	.probe		= bgmac_probe,
-+	.remove		= bgmac_remove,
-+};
-+
-+static int __init bgmac_init(void)
-+{
-+	int err;
-+
-+	err = bcma_driver_register(&bgmac_bcma_driver);
-+	if (err)
-+		return err;
-+	pr_info("Broadcom 47xx GBit MAC driver loaded\n");
-+
-+	return 0;
-+}
-+
-+static void __exit bgmac_exit(void)
-+{
-+	bcma_driver_unregister(&bgmac_bcma_driver);
-+}
-+
-+module_init(bgmac_init)
-+module_exit(bgmac_exit)
-+
-+MODULE_AUTHOR("Rafał Miłecki");
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
-@@ -0,0 +1,189 @@
-+/*
-+ * Copyright (C) 2016 Broadcom
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation version 2.
-+ *
-+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
-+ * kind, whether express or implied; without even the implied warranty
-+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
-+#include <linux/etherdevice.h>
-+#include <linux/of_address.h>
-+#include <linux/of_net.h>
-+#include "bgmac.h"
-+
-+static u32 platform_bgmac_read(struct bgmac *bgmac, u16 offset)
-+{
-+	return readl(bgmac->plat.base + offset);
-+}
-+
-+static void platform_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+	writel(value, bgmac->plat.base + offset);
-+}
-+
-+static u32 platform_bgmac_idm_read(struct bgmac *bgmac, u16 offset)
-+{
-+	return readl(bgmac->plat.idm_base + offset);
-+}
-+
-+static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+	return writel(value, bgmac->plat.idm_base + offset);
-+}
-+
-+static bool platform_bgmac_clk_enabled(struct bgmac *bgmac)
-+{
-+	if ((bgmac_idm_read(bgmac, BCMA_IOCTL) &
-+	     (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC)) != BCMA_IOCTL_CLK)
-+		return false;
-+	if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
-+		return false;
-+	return true;
-+}
-+
-+static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
-+{
-+	bgmac_idm_write(bgmac, BCMA_IOCTL,
-+			(BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
-+	bgmac_idm_read(bgmac, BCMA_IOCTL);
-+
-+	bgmac_idm_write(bgmac, BCMA_RESET_CTL, 0);
-+	bgmac_idm_read(bgmac, BCMA_RESET_CTL);
-+	udelay(1);
-+
-+	bgmac_idm_write(bgmac, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
-+	bgmac_idm_read(bgmac, BCMA_IOCTL);
-+	udelay(1);
-+}
-+
-+static void platform_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset,
-+					   u32 mask, u32 set)
-+{
-+	/* This shouldn't be encountered */
-+	WARN_ON(1);
-+}
-+
-+static u32 platform_bgmac_get_bus_clock(struct bgmac *bgmac)
-+{
-+	/* This shouldn't be encountered */
-+	WARN_ON(1);
-+
-+	return 0;
-+}
-+
-+static void platform_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset,
-+					 u32 mask, u32 set)
-+{
-+	/* This shouldn't be encountered */
-+	WARN_ON(1);
-+}
-+
-+static int bgmac_probe(struct platform_device *pdev)
-+{
-+	struct device_node *np = pdev->dev.of_node;
-+	struct bgmac *bgmac;
-+	struct resource *regs;
-+	const u8 *mac_addr;
-+
-+	bgmac = devm_kzalloc(&pdev->dev, sizeof(*bgmac), GFP_KERNEL);
-+	if (!bgmac)
-+		return -ENOMEM;
-+
-+	platform_set_drvdata(pdev, bgmac);
-+
-+	/* Set the features of the 4707 family */
-+	bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+	bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-+	bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+	bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
-+	bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
-+	bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
-+
-+	bgmac->dev = &pdev->dev;
-+	bgmac->dma_dev = &pdev->dev;
-+
-+	mac_addr = of_get_mac_address(np);
-+	if (mac_addr)
-+		ether_addr_copy(bgmac->mac_addr, mac_addr);
-+	else
-+		dev_warn(&pdev->dev, "MAC address not present in device tree\n");
-+
-+	bgmac->irq = platform_get_irq(pdev, 0);
-+	if (bgmac->irq < 0) {
-+		dev_err(&pdev->dev, "Unable to obtain IRQ\n");
-+		return bgmac->irq;
-+	}
-+
-+	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "amac_base");
-+	if (!regs) {
-+		dev_err(&pdev->dev, "Unable to obtain base resource\n");
-+		return -EINVAL;
-+	}
-+
-+	bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs);
-+	if (IS_ERR(bgmac->plat.base)) {
-+		dev_err(&pdev->dev, "Unable to map base resource\n");
-+		return PTR_ERR(bgmac->plat.base);
-+	}
-+
-+	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
-+	if (!regs) {
-+		dev_err(&pdev->dev, "Unable to obtain idm resource\n");
-+		return -EINVAL;
-+	}
-+
-+	bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
-+	if (!bgmac->plat.idm_base) {
-+		dev_err(&pdev->dev, "Unable to map idm resource\n");
-+		return PTR_ERR(bgmac->plat.idm_base);
-+	}
-+
-+	bgmac->read = platform_bgmac_read;
-+	bgmac->write = platform_bgmac_write;
-+	bgmac->idm_read = platform_bgmac_idm_read;
-+	bgmac->idm_write = platform_bgmac_idm_write;
-+	bgmac->clk_enabled = platform_bgmac_clk_enabled;
-+	bgmac->clk_enable = platform_bgmac_clk_enable;
-+	bgmac->cco_ctl_maskset = platform_bgmac_cco_ctl_maskset;
-+	bgmac->get_bus_clock = platform_bgmac_get_bus_clock;
-+	bgmac->cmn_maskset32 = platform_bgmac_cmn_maskset32;
-+
-+	return bgmac_enet_probe(bgmac);
-+}
-+
-+static int bgmac_remove(struct platform_device *pdev)
-+{
-+	struct bgmac *bgmac = platform_get_drvdata(pdev);
-+
-+	bgmac_enet_remove(bgmac);
-+
-+	return 0;
-+}
-+
-+static const struct of_device_id bgmac_of_enet_match[] = {
-+	{.compatible = "brcm,amac",},
-+	{.compatible = "brcm,nsp-amac",},
-+	{},
-+};
-+
-+MODULE_DEVICE_TABLE(of, bgmac_of_enet_match);
-+
-+static struct platform_driver bgmac_enet_driver = {
-+	.driver = {
-+		.name  = "bgmac-enet",
-+		.of_match_table = bgmac_of_enet_match,
-+	},
-+	.probe = bgmac_probe,
-+	.remove = bgmac_remove,
-+};
-+
-+module_platform_driver(bgmac_enet_driver);
-+MODULE_LICENSE("GPL");
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -6,51 +6,27 @@
-  * Licensed under the GNU/GPL. See COPYING for details.
-  */
- 
--#include "bgmac.h"
- 
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/delay.h>
-+#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
-+
-+#include <linux/bcma/bcma.h>
- #include <linux/etherdevice.h>
--#include <linux/mii.h>
--#include <linux/phy.h>
--#include <linux/phy_fixed.h>
--#include <linux/interrupt.h>
--#include <linux/dma-mapping.h>
- #include <linux/bcm47xx_nvram.h>
-+#include "bgmac.h"
- 
--static const struct bcma_device_id bgmac_bcma_tbl[] = {
--	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
--	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
--	{},
--};
--MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
--
--static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac)
--{
--	switch (bgmac->core->bus->chipinfo.id) {
--	case BCMA_CHIP_ID_BCM4707:
--	case BCMA_CHIP_ID_BCM47094:
--	case BCMA_CHIP_ID_BCM53018:
--		return true;
--	default:
--		return false;
--	}
--}
--
--static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask,
-+static bool bgmac_wait_value(struct bgmac *bgmac, u16 reg, u32 mask,
- 			     u32 value, int timeout)
- {
- 	u32 val;
- 	int i;
- 
- 	for (i = 0; i < timeout / 10; i++) {
--		val = bcma_read32(core, reg);
-+		val = bgmac_read(bgmac, reg);
- 		if ((val & mask) == value)
- 			return true;
- 		udelay(10);
- 	}
--	dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg);
-+	dev_err(bgmac->dev, "Timeout waiting for reg 0x%X\n", reg);
- 	return false;
- }
- 
-@@ -89,7 +65,7 @@ static void bgmac_dma_tx_reset(struct bg
- 
- 	/* Remove SUSPEND bit */
- 	bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, 0);
--	if (!bgmac_wait_value(bgmac->core,
-+	if (!bgmac_wait_value(bgmac,
- 			      ring->mmio_base + BGMAC_DMA_TX_STATUS,
- 			      BGMAC_DMA_TX_STAT, BGMAC_DMA_TX_STAT_DISABLED,
- 			      10000)) {
-@@ -317,7 +293,7 @@ static void bgmac_dma_rx_reset(struct bg
- 		return;
- 
- 	bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_CTL, 0);
--	if (!bgmac_wait_value(bgmac->core,
-+	if (!bgmac_wait_value(bgmac,
- 			      ring->mmio_base + BGMAC_DMA_RX_STATUS,
- 			      BGMAC_DMA_RX_STAT, BGMAC_DMA_RX_STAT_DISABLED,
- 			      10000))
-@@ -643,7 +619,7 @@ static int bgmac_dma_alloc(struct bgmac
- 	BUILD_BUG_ON(BGMAC_MAX_TX_RINGS > ARRAY_SIZE(ring_base));
- 	BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base));
- 
--	if (!(bcma_aread32(bgmac->core, BCMA_IOST) & BCMA_IOST_DMA64)) {
-+	if (!(bgmac_idm_read(bgmac, BCMA_IOST) & BCMA_IOST_DMA64)) {
- 		dev_err(bgmac->dev, "Core does not report 64-bit DMA\n");
- 		return -ENOTSUPP;
- 	}
-@@ -875,12 +851,10 @@ static void bgmac_mac_speed(struct bgmac
- 
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
--	struct bcma_device *core = bgmac->core;
--
- 	if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) {
--		bcma_awrite32(core, BCMA_IOCTL,
--			      bcma_aread32(core, BCMA_IOCTL) | 0x40 |
--			      BGMAC_BCMA_IOCTL_SW_CLKEN);
-+		bgmac_idm_write(bgmac, BCMA_IOCTL,
-+				bgmac_idm_read(bgmac, BCMA_IOCTL) | 0x40 |
-+				BGMAC_BCMA_IOCTL_SW_CLKEN);
- 		bgmac->mac_speed = SPEED_2500;
- 		bgmac->mac_duplex = DUPLEX_FULL;
- 		bgmac_mac_speed(bgmac);
-@@ -900,12 +874,11 @@ static void bgmac_miiconfig(struct bgmac
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipreset */
- static void bgmac_chip_reset(struct bgmac *bgmac)
- {
--	struct bcma_device *core = bgmac->core;
- 	u32 cmdcfg_sr;
- 	u32 iost;
- 	int i;
- 
--	if (bcma_core_is_enabled(core)) {
-+	if (bgmac_clk_enabled(bgmac)) {
- 		if (!bgmac->stats_grabbed) {
- 			/* bgmac_chip_stats_update(bgmac); */
- 			bgmac->stats_grabbed = true;
-@@ -923,7 +896,7 @@ static void bgmac_chip_reset(struct bgma
- 		/* TODO: Clear software multicast filter list */
- 	}
- 
--	iost = bcma_aread32(core, BCMA_IOST);
-+	iost = bgmac_idm_read(bgmac, BCMA_IOST);
- 	if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED)
- 		iost &= ~BGMAC_BCMA_IOST_ATTACHED;
- 
-@@ -935,21 +908,20 @@ static void bgmac_chip_reset(struct bgma
- 			if (!bgmac->has_robosw)
- 				flags |= BGMAC_BCMA_IOCTL_SW_RESET;
- 		}
--		bcma_core_enable(core, flags);
-+		bgmac_clk_enable(bgmac, flags);
- 	}
- 
- 	/* Request Misc PLL for corerev > 2 */
- 	if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) {
- 		bgmac_set(bgmac, BCMA_CLKCTLST,
- 			  BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
--		bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-+		bgmac_wait_value(bgmac, BCMA_CLKCTLST,
- 				 BGMAC_BCMA_CLKCTLST_MISC_PLL_ST,
- 				 BGMAC_BCMA_CLKCTLST_MISC_PLL_ST,
- 				 1000);
- 	}
- 
- 	if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_PHY) {
--		struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
- 		u8 et_swtype = 0;
- 		u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY |
- 			     BGMAC_CHIPCTL_1_IF_TYPE_MII;
-@@ -968,16 +940,15 @@ static void bgmac_chip_reset(struct bgma
- 			sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
- 				  BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
- 		}
--		bcma_chipco_chipctl_maskset(cc, 1,
--					    ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
--					      BGMAC_CHIPCTL_1_SW_TYPE_MASK),
--					    sw_type);
-+		bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
-+						  BGMAC_CHIPCTL_1_SW_TYPE_MASK),
-+				      sw_type);
- 	}
- 
- 	if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
--		bcma_awrite32(core, BCMA_IOCTL,
--			      bcma_aread32(core, BCMA_IOCTL) &
--			      ~BGMAC_BCMA_IOCTL_SW_RESET);
-+		bgmac_idm_write(bgmac, BCMA_IOCTL,
-+				bgmac_idm_read(bgmac, BCMA_IOCTL) &
-+				~BGMAC_BCMA_IOCTL_SW_RESET);
- 
- 	/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_reset
- 	 * Specs don't say about using BGMAC_CMDCFG_SR, but in this routine
-@@ -1013,8 +984,8 @@ static void bgmac_chip_reset(struct bgma
- 
- 	bgmac_clear_mib(bgmac);
- 	if (bgmac->feature_flags & BGMAC_FEAT_CMN_PHY_CTL)
--		bcma_maskset32(bgmac->cmn, BCMA_GMAC_CMN_PHY_CTL, ~0,
--			       BCMA_GMAC_CMN_PC_MTE);
-+		bgmac_cmn_maskset32(bgmac, BCMA_GMAC_CMN_PHY_CTL, ~0,
-+				    BCMA_GMAC_CMN_PC_MTE);
- 	else
- 		bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE);
- 	bgmac_miiconfig(bgmac);
-@@ -1059,8 +1030,8 @@ static void bgmac_enable(struct bgmac *b
- 	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
- 		bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
- 	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
--		bcma_chipco_chipctl_maskset(&bgmac->core->bus->drv_cc, 1, ~0,
--					    BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
-+		bgmac_cco_ctl_maskset(bgmac, 1, ~0,
-+				      BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
- 
- 	if (bgmac->feature_flags & (BGMAC_FEAT_FLW_CTRL1 |
- 				    BGMAC_FEAT_FLW_CTRL2)) {
-@@ -1082,8 +1053,7 @@ static void bgmac_enable(struct bgmac *b
- 
- 		rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
- 		rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
--		bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
--				1000000;
-+		bp_clk = bgmac_get_bus_clock(bgmac) / 1000000;
- 		mdp = (bp_clk * 128 / 1000) - 3;
- 		rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
- 		bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
-@@ -1178,7 +1148,7 @@ static int bgmac_open(struct net_device
- 	/* Specs say about reclaiming rings here, but we do that in DMA init */
- 	bgmac_chip_init(bgmac);
- 
--	err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
-+	err = request_irq(bgmac->irq, bgmac_interrupt, IRQF_SHARED,
- 			  KBUILD_MODNAME, net_dev);
- 	if (err < 0) {
- 		dev_err(bgmac->dev, "IRQ request error: %d!\n", err);
-@@ -1204,7 +1174,7 @@ static int bgmac_stop(struct net_device
- 
- 	napi_disable(&bgmac->napi);
- 	bgmac_chip_intrs_off(bgmac);
--	free_irq(bgmac->core->irq, net_dev);
-+	free_irq(bgmac->irq, net_dev);
- 
- 	bgmac_chip_reset(bgmac);
- 	bgmac_dma_cleanup(bgmac);
-@@ -1399,7 +1369,7 @@ static void bgmac_get_drvinfo(struct net
- 			      struct ethtool_drvinfo *info)
- {
- 	strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
--	strlcpy(info->bus_info, "BCMA", sizeof(info->bus_info));
-+	strlcpy(info->bus_info, "AXI", sizeof(info->bus_info));
- }
- 
- static const struct ethtool_ops bgmac_ethtool_ops = {
-@@ -1483,116 +1453,41 @@ static int bgmac_phy_connect(struct bgma
- 	return 0;
- }
- 
--static int bgmac_probe(struct bcma_device *core)
-+int bgmac_enet_probe(struct bgmac *info)
- {
- 	struct net_device *net_dev;
- 	struct bgmac *bgmac;
--	struct ssb_sprom *sprom = &core->bus->sprom;
--	u8 *mac;
- 	int err;
- 
--	switch (core->core_unit) {
--	case 0:
--		mac = sprom->et0mac;
--		break;
--	case 1:
--		mac = sprom->et1mac;
--		break;
--	case 2:
--		mac = sprom->et2mac;
--		break;
--	default:
--		dev_err(&core->dev, "Unsupported core_unit %d\n",
--			core->core_unit);
--		return -ENOTSUPP;
--	}
--
--	if (!is_valid_ether_addr(mac)) {
--		dev_err(&core->dev, "Invalid MAC addr: %pM\n", mac);
--		eth_random_addr(mac);
--		dev_warn(&core->dev, "Using random MAC: %pM\n", mac);
--	}
--
--	/* This (reset &) enable is not preset in specs or reference driver but
--	 * Broadcom does it in arch PCI code when enabling fake PCI device.
--	 */
--	bcma_core_enable(core, 0);
--
- 	/* Allocation and references */
- 	net_dev = alloc_etherdev(sizeof(*bgmac));
- 	if (!net_dev)
- 		return -ENOMEM;
-+
- 	net_dev->netdev_ops = &bgmac_netdev_ops;
--	net_dev->irq = core->irq;
- 	net_dev->ethtool_ops = &bgmac_ethtool_ops;
- 	bgmac = netdev_priv(net_dev);
--	bgmac->dev = &core->dev;
--	bgmac->dma_dev = core->dma_dev;
-+	memcpy(bgmac, info, sizeof(*bgmac));
- 	bgmac->net_dev = net_dev;
--	bgmac->core = core;
--	bcma_set_drvdata(core, bgmac);
--	SET_NETDEV_DEV(net_dev, &core->dev);
--
--	/* Defaults */
--	memcpy(bgmac->net_dev->dev_addr, mac, ETH_ALEN);
--
--	/* On BCM4706 we need common core to access PHY */
--	if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
--	    !core->bus->drv_gmac_cmn.core) {
--		dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n");
--		err = -ENODEV;
--		goto err_netdev_free;
--	}
--	bgmac->cmn = core->bus->drv_gmac_cmn.core;
-+	net_dev->irq = bgmac->irq;
-+	SET_NETDEV_DEV(net_dev, bgmac->dev);
- 
--	switch (core->core_unit) {
--	case 0:
--		bgmac->phyaddr = sprom->et0phyaddr;
--		break;
--	case 1:
--		bgmac->phyaddr = sprom->et1phyaddr;
--		break;
--	case 2:
--		bgmac->phyaddr = sprom->et2phyaddr;
--		break;
-+	if (!is_valid_ether_addr(bgmac->mac_addr)) {
-+		dev_err(bgmac->dev, "Invalid MAC addr: %pM\n",
-+			bgmac->mac_addr);
-+		eth_random_addr(bgmac->mac_addr);
-+		dev_warn(bgmac->dev, "Using random MAC: %pM\n",
-+			 bgmac->mac_addr);
- 	}
--	bgmac->phyaddr &= BGMAC_PHY_MASK;
--	if (bgmac->phyaddr == BGMAC_PHY_MASK) {
--		dev_err(bgmac->dev, "No PHY found\n");
--		err = -ENODEV;
--		goto err_netdev_free;
--	}
--	dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
--		 bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
-+	ether_addr_copy(net_dev->dev_addr, bgmac->mac_addr);
- 
--	if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
--		dev_err(bgmac->dev, "PCI setup not implemented\n");
--		err = -ENOTSUPP;
--		goto err_netdev_free;
--	}
-+	/* This (reset &) enable is not preset in specs or reference driver but
-+	 * Broadcom does it in arch PCI code when enabling fake PCI device.
-+	 */
-+	bgmac_clk_enable(bgmac, 0);
- 
- 	bgmac_chip_reset(bgmac);
- 
--	/* For Northstar, we have to take all GMAC core out of reset */
--	if (bgmac_is_bcm4707_family(bgmac)) {
--		struct bcma_device *ns_core;
--		int ns_gmac;
--
--		/* Northstar has 4 GMAC cores */
--		for (ns_gmac = 0; ns_gmac < 4; ns_gmac++) {
--			/* As Northstar requirement, we have to reset all GMACs
--			 * before accessing one. bgmac_chip_reset() call
--			 * bcma_core_enable() for this core. Then the other
--			 * three GMACs didn't reset.  We do it here.
--			 */
--			ns_core = bcma_find_core_unit(core->bus,
--						      BCMA_CORE_MAC_GBIT,
--						      ns_gmac);
--			if (ns_core && !bcma_core_is_enabled(ns_core))
--				bcma_core_enable(ns_core, 0);
--		}
--	}
--
- 	err = bgmac_dma_alloc(bgmac);
- 	if (err) {
- 		dev_err(bgmac->dev, "Unable to alloc memory for DMA\n");
-@@ -1603,103 +1498,15 @@ static int bgmac_probe(struct bcma_devic
- 	if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0)
- 		bgmac->int_mask &= ~BGMAC_IS_TX_MASK;
- 
--	bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
--			       BGMAC_BFL_ENETROBO);
--	if (bgmac->has_robosw)
--		dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n");
--
--	if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM)
--		dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n");
--
--	/* Feature Flags */
--	switch (core->bus->chipinfo.id) {
--	case BCMA_CHIP_ID_BCM5357:
--		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
--		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
--		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) {
--			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
--			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
--		}
--		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358)
--			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
--		break;
--	case BCMA_CHIP_ID_BCM53572:
--		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
--		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
--		if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) {
--			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
--			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
--		}
--		break;
--	case BCMA_CHIP_ID_BCM4749:
--		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
--		bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
--		if (core->bus->chipinfo.pkg == 10) {
--			bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
--			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
--		}
--		break;
--	case BCMA_CHIP_ID_BCM4716:
--		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--		/* fallthrough */
--	case BCMA_CHIP_ID_BCM47162:
--		bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
--		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--		break;
--	/* bcm4707_family */
--	case BCMA_CHIP_ID_BCM4707:
--	case BCMA_CHIP_ID_BCM47094:
--	case BCMA_CHIP_ID_BCM53018:
--		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--		bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
--		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
--		break;
--	default:
--		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
--		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
--	}
--
--	if (!bgmac_is_bcm4707_family(bgmac) && core->id.rev > 2)
--		bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ;
--
--	if (core->id.id == BCMA_CORE_4706_MAC_GBIT) {
--		bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL;
--		bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB;
--	}
--
--	if (core->id.rev >= 4) {
--		bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
--		bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
--		bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
--	}
--
- 	netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT);
- 
--	if (!bgmac_is_bcm4707_family(bgmac)) {
--		struct mii_bus *mii_bus;
--
--		mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
--		if (!IS_ERR(mii_bus)) {
--			err = PTR_ERR(mii_bus);
--			goto err_dma_free;
--		}
--
--		bgmac->mii_bus = mii_bus;
--	}
--
- 	if (!bgmac->mii_bus)
- 		err = bgmac_phy_connect_direct(bgmac);
- 	else
- 		err = bgmac_phy_connect(bgmac);
- 	if (err) {
- 		dev_err(bgmac->dev, "Cannot connect to phy\n");
--		goto err_mii_unregister;
-+		goto err_dma_free;
- 	}
- 
- 	net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-@@ -1718,56 +1525,24 @@ static int bgmac_probe(struct bcma_devic
- 
- err_phy_disconnect:
- 	phy_disconnect(net_dev->phydev);
--err_mii_unregister:
--	bcma_mdio_mii_unregister(bgmac->mii_bus);
- err_dma_free:
- 	bgmac_dma_free(bgmac);
- err_netdev_free:
--	bcma_set_drvdata(core, NULL);
- 	free_netdev(net_dev);
- 
- 	return err;
- }
-+EXPORT_SYMBOL_GPL(bgmac_enet_probe);
- 
--static void bgmac_remove(struct bcma_device *core)
-+void bgmac_enet_remove(struct bgmac *bgmac)
- {
--	struct bgmac *bgmac = bcma_get_drvdata(core);
--
- 	unregister_netdev(bgmac->net_dev);
- 	phy_disconnect(bgmac->net_dev->phydev);
--	bcma_mdio_mii_unregister(bgmac->mii_bus);
- 	netif_napi_del(&bgmac->napi);
- 	bgmac_dma_free(bgmac);
--	bcma_set_drvdata(core, NULL);
- 	free_netdev(bgmac->net_dev);
- }
--
--static struct bcma_driver bgmac_bcma_driver = {
--	.name		= KBUILD_MODNAME,
--	.id_table	= bgmac_bcma_tbl,
--	.probe		= bgmac_probe,
--	.remove		= bgmac_remove,
--};
--
--static int __init bgmac_init(void)
--{
--	int err;
--
--	err = bcma_driver_register(&bgmac_bcma_driver);
--	if (err)
--		return err;
--	pr_info("Broadcom 47xx GBit MAC driver loaded\n");
--
--	return 0;
--}
--
--static void __exit bgmac_exit(void)
--{
--	bcma_driver_unregister(&bgmac_bcma_driver);
--}
--
--module_init(bgmac_init)
--module_exit(bgmac_exit)
-+EXPORT_SYMBOL_GPL(bgmac_enet_remove);
- 
- MODULE_AUTHOR("Rafał Miłecki");
- MODULE_LICENSE("GPL");
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -1,8 +1,6 @@
- #ifndef _BGMAC_H
- #define _BGMAC_H
- 
--#include <linux/bcma/bcma.h>
--#include <linux/brcmphy.h>
- #include <linux/netdevice.h>
- 
- #define BGMAC_DEV_CTL				0x000
-@@ -442,11 +440,21 @@ struct bgmac_rx_header {
- };
- 
- struct bgmac {
--	struct bcma_device *core;
--	struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
-+	union {
-+		struct {
-+			void *base;
-+			void *idm_base;
-+		} plat;
-+		struct {
-+			struct bcma_device *core;
-+			/* Reference to CMN core for BCM4706 */
-+			struct bcma_device *cmn;
-+		} bcma;
-+	};
- 
- 	struct device *dev;
- 	struct device *dma_dev;
-+	unsigned char mac_addr[ETH_ALEN];
- 	u32 feature_flags;
- 
- 	struct net_device *net_dev;
-@@ -463,6 +471,7 @@ struct bgmac {
- 	u32 mib_rx_regs[BGMAC_NUM_MIB_RX_REGS];
- 
- 	/* Int */
-+	int irq;
- 	u32 int_mask;
- 
- 	/* Current MAC state */
-@@ -473,19 +482,71 @@ struct bgmac {
- 	bool has_robosw;
- 
- 	bool loopback;
-+
-+	u32 (*read)(struct bgmac *bgmac, u16 offset);
-+	void (*write)(struct bgmac *bgmac, u16 offset, u32 value);
-+	u32 (*idm_read)(struct bgmac *bgmac, u16 offset);
-+	void (*idm_write)(struct bgmac *bgmac, u16 offset, u32 value);
-+	bool (*clk_enabled)(struct bgmac *bgmac);
-+	void (*clk_enable)(struct bgmac *bgmac, u32 flags);
-+	void (*cco_ctl_maskset)(struct bgmac *bgmac, u32 offset, u32 mask,
-+				u32 set);
-+	u32 (*get_bus_clock)(struct bgmac *bgmac);
-+	void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
-+			      u32 set);
- };
- 
-+int bgmac_enet_probe(struct bgmac *info);
-+void bgmac_enet_remove(struct bgmac *bgmac);
-+
- struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr);
- void bcma_mdio_mii_unregister(struct mii_bus *mii_bus);
- 
- static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)
- {
--	return bcma_read32(bgmac->core, offset);
-+	return bgmac->read(bgmac, offset);
- }
- 
- static inline void bgmac_write(struct bgmac *bgmac, u16 offset, u32 value)
- {
--	bcma_write32(bgmac->core, offset, value);
-+	bgmac->write(bgmac, offset, value);
-+}
-+
-+static inline u32 bgmac_idm_read(struct bgmac *bgmac, u16 offset)
-+{
-+	return bgmac->idm_read(bgmac, offset);
-+}
-+
-+static inline void bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
-+{
-+	bgmac->idm_write(bgmac, offset, value);
-+}
-+
-+static inline bool bgmac_clk_enabled(struct bgmac *bgmac)
-+{
-+	return bgmac->clk_enabled(bgmac);
-+}
-+
-+static inline void bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
-+{
-+	bgmac->clk_enable(bgmac, flags);
-+}
-+
-+static inline void bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset,
-+					 u32 mask, u32 set)
-+{
-+	bgmac->cco_ctl_maskset(bgmac, offset, mask, set);
-+}
-+
-+static inline u32 bgmac_get_bus_clock(struct bgmac *bgmac)
-+{
-+	return bgmac->get_bus_clock(bgmac);
-+}
-+
-+static inline void bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset,
-+				       u32 mask, u32 set)
-+{
-+	bgmac->cmn_maskset32(bgmac, offset, mask, set);
- }
- 
- static inline void bgmac_maskset(struct bgmac *bgmac, u16 offset, u32 mask,

+ 0 - 26
target/linux/generic/patches-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch

@@ -1,26 +0,0 @@
-From 12c2e32f14da857b58af281b029d4549d24c3292 Mon Sep 17 00:00:00 2001
-From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Date: Tue, 12 Jul 2016 00:17:28 +0000
-Subject: [PATCH] net: ethernet: bgmac: Fix return value check in bgmac_probe()
-
-In case of error, the function devm_ioremap_resource() returns ERR_PTR()
-and never returns NULL. The NULL test in the return value check should be
-replaced with IS_ERR().
-
-Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-platform.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-platform.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
-@@ -141,7 +141,7 @@ static int bgmac_probe(struct platform_d
- 	}
- 
- 	bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
--	if (!bgmac->plat.idm_base) {
-+	if (IS_ERR(bgmac->plat.idm_base)) {
- 		dev_err(&pdev->dev, "Unable to map idm resource\n");
- 		return PTR_ERR(bgmac->plat.idm_base);
- 	}

+ 0 - 42
target/linux/generic/patches-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch

@@ -1,42 +0,0 @@
-From ce3a380dddd0cb16cb3d8d947b69657d7646c121 Mon Sep 17 00:00:00 2001
-From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Date: Wed, 13 Jul 2016 12:46:57 +0000
-Subject: [PATCH] net: ethernet: bgmac: Remove redundant dev_err call in
- bgmac_probe()
-
-There is a error message within devm_ioremap_resource
-already, so remove the dev_err call to avoid redundant
-error message.
-
-Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-platform.c | 8 ++------
- 1 file changed, 2 insertions(+), 6 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-platform.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
-@@ -129,10 +129,8 @@ static int bgmac_probe(struct platform_d
- 	}
- 
- 	bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs);
--	if (IS_ERR(bgmac->plat.base)) {
--		dev_err(&pdev->dev, "Unable to map base resource\n");
-+	if (IS_ERR(bgmac->plat.base))
- 		return PTR_ERR(bgmac->plat.base);
--	}
- 
- 	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
- 	if (!regs) {
-@@ -141,10 +139,8 @@ static int bgmac_probe(struct platform_d
- 	}
- 
- 	bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
--	if (IS_ERR(bgmac->plat.idm_base)) {
--		dev_err(&pdev->dev, "Unable to map idm resource\n");
-+	if (IS_ERR(bgmac->plat.idm_base))
- 		return PTR_ERR(bgmac->plat.idm_base);
--	}
- 
- 	bgmac->read = platform_bgmac_read;
- 	bgmac->write = platform_bgmac_write;

+ 0 - 28
target/linux/generic/patches-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch

@@ -1,28 +0,0 @@
-From b9f63ae7ba2de2ba19137c5757c0607ce40f3ed5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 15:37:14 +0200
-Subject: [PATCH] net: bgmac: fix reversed check for MII registration error
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It was failing on successful registration returning meaningless errors.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Fixes: 55954f3bfdac ("net: ethernet: bgmac: move BCMA MDIO Phy code into a separate file")
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_devic
- 
- 	if (!bgmac_is_bcm4707_family(core)) {
- 		mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
--		if (!IS_ERR(mii_bus)) {
-+		if (IS_ERR(mii_bus)) {
- 			err = PTR_ERR(mii_bus);
- 			goto err;
- 		}

+ 0 - 161
target/linux/generic/patches-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch

@@ -1,161 +0,0 @@
-From 1cb94db3d1bfe0075bde78fb2989f17e0a8a3936 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 23:00:30 +0200
-Subject: [PATCH] net: bgmac: support Ethernet core on BCM53573 SoCs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and can
-be found in two packages (versions): BCM53573 and BCM47189. It shares
-some code with the Northstar family, but also requires some new quirks.
-
-First of all there can be up to 2 Ethernet cores on this SoC. If that is
-the case, they are connected to two different switch ports allowing some
-more complex/optimized setups. It seems the second unit doesn't come
-fully configured and requires some IRQ quirk.
-
-Other than that only the first core is connected to the PHY. For the
-second one we have to register fixed PHY (similarly to the Northstar),
-otherwise generic PHY driver would get some invalid info.
-
-This has been successfully tested on Tenda AC9 (BCM47189B0).
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac-bcma.c | 19 ++++++++++++++++++-
- drivers/net/ethernet/broadcom/bgmac.c      | 25 +++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.h      | 19 +++++++++++++++++++
- include/linux/bcma/bcma.h                  |  3 +++
- include/linux/bcma/bcma_regs.h             |  1 +
- 5 files changed, 66 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
-+	struct bcma_chipinfo *ci = &core->bus->chipinfo;
- 	struct ssb_sprom *sprom = &core->bus->sprom;
- 	struct mii_bus *mii_bus;
- 	struct bgmac *bgmac;
-@@ -157,7 +158,8 @@ static int bgmac_probe(struct bcma_devic
- 	dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
- 		 bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
- 
--	if (!bgmac_is_bcm4707_family(core)) {
-+	if (!bgmac_is_bcm4707_family(core) &&
-+	    !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
- 		mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
- 		if (IS_ERR(mii_bus)) {
- 			err = PTR_ERR(mii_bus);
-@@ -230,6 +232,21 @@ static int bgmac_probe(struct bcma_devic
- 		bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
- 		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
- 		break;
-+	case BCMA_CHIP_ID_BCM53573:
-+		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+		if (ci->pkg == BCMA_PKG_ID_BCM47189)
-+			bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+		if (core->core_unit == 0) {
-+			bgmac->feature_flags |= BGMAC_FEAT_CC4_IF_SW_TYPE;
-+			if (ci->pkg == BCMA_PKG_ID_BCM47189)
-+				bgmac->feature_flags |=
-+					BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII;
-+		} else if (core->core_unit == 1) {
-+			bgmac->feature_flags |= BGMAC_FEAT_IRQ_ID_OOB_6;
-+			bgmac->feature_flags |= BGMAC_FEAT_CC7_IF_TYPE_RGMII;
-+		}
-+		break;
- 	default:
- 		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
- 		bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -943,6 +943,27 @@ static void bgmac_chip_reset(struct bgma
- 		bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
- 						  BGMAC_CHIPCTL_1_SW_TYPE_MASK),
- 				      sw_type);
-+	} else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE) {
-+		u32 sw_type = BGMAC_CHIPCTL_4_IF_TYPE_MII |
-+			      BGMAC_CHIPCTL_4_SW_TYPE_EPHY;
-+		u8 et_swtype = 0;
-+		char buf[4];
-+
-+		if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
-+			if (kstrtou8(buf, 0, &et_swtype))
-+				dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n",
-+					buf);
-+			sw_type = (et_swtype & 0x0f) << 12;
-+		} else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII) {
-+			sw_type = BGMAC_CHIPCTL_4_IF_TYPE_RGMII |
-+				  BGMAC_CHIPCTL_4_SW_TYPE_RGMII;
-+		}
-+		bgmac_cco_ctl_maskset(bgmac, 4, ~(BGMAC_CHIPCTL_4_IF_TYPE_MASK |
-+						  BGMAC_CHIPCTL_4_SW_TYPE_MASK),
-+				      sw_type);
-+	} else if (bgmac->feature_flags & BGMAC_FEAT_CC7_IF_TYPE_RGMII) {
-+		bgmac_cco_ctl_maskset(bgmac, 7, ~BGMAC_CHIPCTL_7_IF_TYPE_MASK,
-+				      BGMAC_CHIPCTL_7_IF_TYPE_RGMII);
- 	}
- 
- 	if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
-@@ -1486,6 +1507,10 @@ int bgmac_enet_probe(struct bgmac *info)
- 	 */
- 	bgmac_clk_enable(bgmac, 0);
- 
-+	/* This seems to be fixing IRQ by assigning OOB #6 to the core */
-+	if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)
-+		bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86);
-+
- 	bgmac_chip_reset(bgmac);
- 
- 	err = bgmac_dma_alloc(bgmac);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -369,6 +369,21 @@
- #define BGMAC_CHIPCTL_1_SW_TYPE_RGMII		0x000000C0
- #define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS		0x00010000
- 
-+#define BGMAC_CHIPCTL_4_IF_TYPE_MASK		0x00003000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_RMII		0x00000000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_MII		0x00001000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_RGMII		0x00002000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_MASK		0x0000C000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHY		0x00000000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYMII		0x00004000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYRMII	0x00008000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_RGMII		0x0000C000
-+
-+#define BGMAC_CHIPCTL_7_IF_TYPE_MASK		0x000000C0
-+#define BGMAC_CHIPCTL_7_IF_TYPE_RMII		0x00000000
-+#define BGMAC_CHIPCTL_7_IF_TYPE_MII		0x00000040
-+#define BGMAC_CHIPCTL_7_IF_TYPE_RGMII		0x00000080
-+
- #define BGMAC_WEIGHT	64
- 
- #define ETHER_MAX_LEN   1518
-@@ -390,6 +405,10 @@
- #define BGMAC_FEAT_NO_CLR_MIB		BIT(13)
- #define BGMAC_FEAT_FORCE_SPEED_2500	BIT(14)
- #define BGMAC_FEAT_CMDCFG_SR_REV4	BIT(15)
-+#define BGMAC_FEAT_IRQ_ID_OOB_6		BIT(16)
-+#define BGMAC_FEAT_CC4_IF_SW_TYPE	BIT(17)
-+#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII	BIT(18)
-+#define BGMAC_FEAT_CC7_IF_TYPE_RGMII	BIT(19)
- 
- struct bgmac_slot_info {
- 	union {
---- a/include/linux/bcma/bcma_regs.h
-+++ b/include/linux/bcma/bcma_regs.h
-@@ -23,6 +23,7 @@
- #define  BCMA_CLKCTLST_4328A0_HAVEALP	0x00020000 /* 4328a0 has reversed bits */
- 
- /* Agent registers (common for every core) */
-+#define BCMA_OOB_SEL_OUT_A30		0x0100
- #define BCMA_IOCTL			0x0408 /* IO control */
- #define  BCMA_IOCTL_CLK			0x0001
- #define  BCMA_IOCTL_FGC			0x0002

+ 0 - 31
target/linux/generic/patches-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch

@@ -1,31 +0,0 @@
-From e2d8f646c79f26e094bfaf9b21be614d1e148a67 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 23:11:52 +0200
-Subject: [PATCH] net: bgmac: make it clear when setting interface type to RMII
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It doesn't really change anything as BGMAC_CHIPCTL_1_IF_TYPE_RMII is
-equal to 0. It make code a bit clener, so far when reading it one could
-think we forgot to set a proper mode. It also keeps this mode code in
-sync with other ones.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -935,7 +935,8 @@ static void bgmac_chip_reset(struct bgma
- 			et_swtype <<= 4;
- 			sw_type = et_swtype;
- 		} else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) {
--			sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
-+			sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RMII |
-+				  BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
- 		} else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) {
- 			sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
- 				  BGMAC_CHIPCTL_1_SW_TYPE_RGMII;

+ 0 - 33
target/linux/generic/patches-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch

@@ -1,33 +0,0 @@
-From 4af1474e6198b10fee7bb20e81f7e033ad1b586c Mon Sep 17 00:00:00 2001
-From: Jon Mason <jon.mason@broadcom.com>
-Date: Wed, 5 Oct 2016 15:36:49 -0400
-Subject: [PATCH] net: bgmac: Fix errant feature flag check
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-During the conversion to the feature flags, a check against
-ci->id != BCMA_CHIP_ID_BCM47162
-became
-bgmac->feature_flags & BGMAC_FEAT_CLKCTLS
-instead of
-!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLS)
-
-Reported-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: Jon Mason <jon.mason@broadcom.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1049,7 +1049,7 @@ static void bgmac_enable(struct bgmac *b
- 
- 	mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
- 		BGMAC_DS_MM_SHIFT;
--	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
-+	if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) || mode != 0)
- 		bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
- 	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
- 		bgmac_cco_ctl_maskset(bgmac, 1, ~0,

+ 0 - 25
target/linux/generic/patches-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch

@@ -1,25 +0,0 @@
-From c121f72a66c5f92fbe2fc53baa274eef39875cec Mon Sep 17 00:00:00 2001
-From: Colin Ian King <colin.king@canonical.com>
-Date: Mon, 24 Oct 2016 23:46:18 +0100
-Subject: [PATCH] net: bgmac: fix spelling mistake: "connecton" -> "connection"
-
-trivial fix to spelling mistake in dev_err message
-
-Signed-off-by: Colin Ian King <colin.king@canonical.com>
-Acked-by: Jon Mason <jon.mason@broadcom.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1468,7 +1468,7 @@ static int bgmac_phy_connect(struct bgma
- 	phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link,
- 			      PHY_INTERFACE_MODE_MII);
- 	if (IS_ERR(phy_dev)) {
--		dev_err(bgmac->dev, "PHY connecton failed\n");
-+		dev_err(bgmac->dev, "PHY connection failed\n");
- 		return PTR_ERR(phy_dev);
- 	}
- 

+ 0 - 35
target/linux/generic/patches-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch

@@ -1,35 +0,0 @@
-From cdb26d3387f0cdf7b2a2eea581385173547ef21f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 7 Nov 2016 13:53:27 +0100
-Subject: [PATCH] net: bgmac: fix reversed checks for clock control flag
-
-This fixes regression introduced by patch adding feature flags. It was
-already reported and patch followed (it got accepted) but it appears it
-was incorrect. Instead of fixing reversed condition it broke a good one.
-
-This patch was verified to actually fix SoC hanges caused by bgmac on
-BCM47186B0.
-
-Fixes: db791eb2970b ("net: ethernet: bgmac: convert to feature flags")
-Fixes: 4af1474e6198 ("net: bgmac: Fix errant feature flag check")
-Cc: Jon Mason <jon.mason@broadcom.com>
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1049,9 +1049,9 @@ static void bgmac_enable(struct bgmac *b
- 
- 	mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
- 		BGMAC_DS_MM_SHIFT;
--	if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) || mode != 0)
-+	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0)
- 		bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
--	if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2)
-+	if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) && mode == 2)
- 		bgmac_cco_ctl_maskset(bgmac, 1, ~0,
- 				      BGMAC_CHIPCTL_1_RXC_DLL_BYPASS);
- 

+ 28 - 0
target/linux/generic/patches-4.4/087-Revert-led-core-Fix-brightness-setting-when-setting-.patch

@@ -0,0 +1,28 @@
+From 4b98deaa353d8f7af3f7543d0b59497fe1275599 Mon Sep 17 00:00:00 2001
+Message-Id: <4b98deaa353d8f7af3f7543d0b59497fe1275599.1520544136.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Thu, 8 Mar 2018 22:22:08 +0100
+Subject: [PATCH] Revert "led: core: Fix brightness setting when setting
+ delay_off=0"
+
+This reverts commit 20ac8f72514b3af8b62c520d55656ded865eff00.
+---
+ drivers/leds/led-core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
+index 92b6798ef5b3..c1c3af089634 100644
+--- a/drivers/leds/led-core.c
++++ b/drivers/leds/led-core.c
+@@ -149,7 +149,7 @@ void led_blink_set(struct led_classdev *led_cdev,
+ 		   unsigned long *delay_on,
+ 		   unsigned long *delay_off)
+ {
+-	led_stop_software_blink(led_cdev);
++	del_timer_sync(&led_cdev->blink_timer);
+ 
+ 	led_cdev->flags &= ~LED_BLINK_ONESHOT;
+ 	led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP;
+-- 
+2.16.2
+

+ 1 - 1
target/linux/generic/patches-4.4/201-extra_optimization.patch

@@ -1,6 +1,6 @@
 --- a/Makefile
 --- a/Makefile
 +++ b/Makefile
 +++ b/Makefile
-@@ -624,12 +624,12 @@ KBUILD_CFLAGS	+= $(call cc-disable-warni
+@@ -626,12 +626,12 @@ KBUILD_CFLAGS	+= $(call cc-disable-warni
  KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)
  KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)
  
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE

+ 1 - 1
target/linux/generic/patches-4.4/202-reduce_module_size.patch

@@ -1,6 +1,6 @@
 --- a/Makefile
 --- a/Makefile
 +++ b/Makefile
 +++ b/Makefile
-@@ -403,7 +403,7 @@ KBUILD_CFLAGS_KERNEL :=
+@@ -405,7 +405,7 @@ KBUILD_CFLAGS_KERNEL :=
  KBUILD_AFLAGS   := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
  KBUILD_AFLAGS   := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
  KBUILD_AFLAGS_MODULE  := -DMODULE
  KBUILD_AFLAGS_MODULE  := -DMODULE
  KBUILD_CFLAGS_MODULE  := -DMODULE
  KBUILD_CFLAGS_MODULE  := -DMODULE

+ 11 - 8
target/linux/generic/patches-4.4/204-module_strip.patch

@@ -89,7 +89,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  
 --- a/init/Kconfig
 --- a/init/Kconfig
 +++ b/init/Kconfig
 +++ b/init/Kconfig
-@@ -2026,6 +2026,13 @@ config MODULE_COMPRESS_XZ
+@@ -2033,6 +2033,13 @@ config MODULE_COMPRESS_XZ
  
  
  endchoice
  endchoice
  
  
@@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  config MODULES_TREE_LOOKUP
  config MODULES_TREE_LOOKUP
 --- a/kernel/module.c
 --- a/kernel/module.c
 +++ b/kernel/module.c
 +++ b/kernel/module.c
-@@ -2864,6 +2864,7 @@ static struct module *setup_load_info(st
+@@ -2880,6 +2880,7 @@ static void check_modinfo_retpoline(stru
  
  
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  {
  {
@@ -113,7 +113,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	const char *modmagic = get_modinfo(info, "vermagic");
  	const char *modmagic = get_modinfo(info, "vermagic");
  	int err;
  	int err;
  
  
-@@ -2889,6 +2890,7 @@ static int check_modinfo(struct module *
+@@ -2911,6 +2912,7 @@ static int check_modinfo(struct module *
  		pr_warn("%s: module is from the staging directory, the quality "
  		pr_warn("%s: module is from the staging directory, the quality "
  			"is unknown, you have been warned.\n", mod->name);
  			"is unknown, you have been warned.\n", mod->name);
  	}
  	}
@@ -123,7 +123,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	set_license(mod, get_modinfo(info, "license"));
  	set_license(mod, get_modinfo(info, "license"));
 --- a/scripts/mod/modpost.c
 --- a/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
-@@ -1963,7 +1963,9 @@ static void read_symbols(char *modname)
+@@ -1964,7 +1964,9 @@ static void read_symbols(char *modname)
  		symname = remove_dot(info.strtab + sym->st_name);
  		symname = remove_dot(info.strtab + sym->st_name);
  
  
  		handle_modversions(mod, &info, sym, symname);
  		handle_modversions(mod, &info, sym, symname);
@@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	}
  	}
  	if (!is_vmlinux(modname) ||
  	if (!is_vmlinux(modname) ||
  	     (is_vmlinux(modname) && vmlinux_section_warnings))
  	     (is_vmlinux(modname) && vmlinux_section_warnings))
-@@ -2107,7 +2109,9 @@ static void add_header(struct buffer *b,
+@@ -2108,7 +2110,9 @@ static void add_header(struct buffer *b,
  	buf_printf(b, "#include <linux/vermagic.h>\n");
  	buf_printf(b, "#include <linux/vermagic.h>\n");
  	buf_printf(b, "#include <linux/compiler.h>\n");
  	buf_printf(b, "#include <linux/compiler.h>\n");
  	buf_printf(b, "\n");
  	buf_printf(b, "\n");
@@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	buf_printf(b, "\n");
  	buf_printf(b, "\n");
  	buf_printf(b, "__visible struct module __this_module\n");
  	buf_printf(b, "__visible struct module __this_module\n");
  	buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
  	buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
-@@ -2124,16 +2128,20 @@ static void add_header(struct buffer *b,
+@@ -2125,8 +2129,10 @@ static void add_header(struct buffer *b,
  
  
  static void add_intree_flag(struct buffer *b, int is_intree)
  static void add_intree_flag(struct buffer *b, int is_intree)
  {
  {
@@ -153,6 +153,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +#endif
 +#endif
  }
  }
  
  
+ /* Cannot check for assembler */
+@@ -2139,10 +2145,12 @@ static void add_retpoline(struct buffer
+ 
  static void add_staging_flag(struct buffer *b, const char *name)
  static void add_staging_flag(struct buffer *b, const char *name)
  {
  {
 +#ifndef CONFIG_MODULE_STRIPPED
 +#ifndef CONFIG_MODULE_STRIPPED
@@ -164,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  }
  
  
  /* In kernel, this size is defined in linux/module.h;
  /* In kernel, this size is defined in linux/module.h;
-@@ -2237,11 +2245,13 @@ static void add_depends(struct buffer *b
+@@ -2246,11 +2254,13 @@ static void add_depends(struct buffer *b
  
  
  static void add_srcversion(struct buffer *b, struct module *mod)
  static void add_srcversion(struct buffer *b, struct module *mod)
  {
  {
@@ -178,7 +181,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  }
  
  
  static void write_if_changed(struct buffer *b, const char *fname)
  static void write_if_changed(struct buffer *b, const char *fname)
-@@ -2475,7 +2485,9 @@ int main(int argc, char **argv)
+@@ -2485,7 +2495,9 @@ int main(int argc, char **argv)
  		add_staging_flag(&buf, mod->name);
  		add_staging_flag(&buf, mod->name);
  		err |= add_versions(&buf, mod);
  		err |= add_versions(&buf, mod);
  		add_depends(&buf, mod, modules);
  		add_depends(&buf, mod, modules);

+ 1 - 1
target/linux/generic/patches-4.4/221-module_exports.patch

@@ -54,7 +54,7 @@
  	}
  	}
 --- a/scripts/Makefile.build
 --- a/scripts/Makefile.build
 +++ b/scripts/Makefile.build
 +++ b/scripts/Makefile.build
-@@ -299,7 +299,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
+@@ -372,7 +372,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
  # Linker scripts preprocessor (.lds.S -> .lds)
  # Linker scripts preprocessor (.lds.S -> .lds)
  # ---------------------------------------------------------------------------
  # ---------------------------------------------------------------------------
  quiet_cmd_cpp_lds_S = LDS     $@
  quiet_cmd_cpp_lds_S = LDS     $@

+ 2 - 2
target/linux/generic/patches-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch

@@ -11,7 +11,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 
 
 --- a/drivers/mtd/ubi/block.c
 --- a/drivers/mtd/ubi/block.c
 +++ b/drivers/mtd/ubi/block.c
 +++ b/drivers/mtd/ubi/block.c
-@@ -628,6 +628,44 @@ static void __init ubiblock_create_from_
+@@ -636,6 +636,44 @@ static void __init ubiblock_create_from_
  	}
  	}
  }
  }
  
  
@@ -56,7 +56,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  static void ubiblock_remove_all(void)
  static void ubiblock_remove_all(void)
  {
  {
  	struct ubiblock *next;
  	struct ubiblock *next;
-@@ -658,6 +696,10 @@ int __init ubiblock_init(void)
+@@ -668,6 +706,10 @@ int __init ubiblock_init(void)
  	 */
  	 */
  	ubiblock_create_from_param();
  	ubiblock_create_from_param();
  
  

+ 2 - 2
target/linux/generic/patches-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch

@@ -19,7 +19,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
  
  #include "ubi-media.h"
  #include "ubi-media.h"
  #include "ubi.h"
  #include "ubi.h"
-@@ -448,6 +449,15 @@ int ubiblock_create(struct ubi_volume_in
+@@ -447,6 +448,15 @@ int ubiblock_create(struct ubi_volume_in
  	add_disk(dev->gd);
  	add_disk(dev->gd);
  	dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
  	dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
  		 dev->ubi_num, dev->vol_id, vi->name);
  		 dev->ubi_num, dev->vol_id, vi->name);
@@ -32,6 +32,6 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 +		ROOT_DEV = MKDEV(gd->major, gd->first_minor);
 +		ROOT_DEV = MKDEV(gd->major, gd->first_minor);
 +	}
 +	}
 +
 +
+ 	mutex_unlock(&devices_mutex);
  	return 0;
  	return 0;
  
  
- out_free_queue:

+ 11 - 2
target/linux/generic/patches-4.4/610-netfilter_match_bypass_default_checks.patch

@@ -50,7 +50,16 @@
  static bool
  static bool
  ip_checkentry(const struct ipt_ip *ip)
  ip_checkentry(const struct ipt_ip *ip)
  {
  {
-@@ -953,6 +979,7 @@ copy_entries_to_user(unsigned int total_
+@@ -655,6 +681,8 @@ find_check_entry(struct ipt_entry *e, st
+ 	struct xt_entry_match *ematch;
+ 	unsigned long pcnt;
+ 
++	ip_checkdefault(&e->ip);
++
+ 	pcnt = xt_percpu_counter_alloc();
+ 	if (IS_ERR_VALUE(pcnt))
+ 		return -ENOMEM;
+@@ -953,6 +981,7 @@ copy_entries_to_user(unsigned int total_
  	const struct xt_table_info *private = table->private;
  	const struct xt_table_info *private = table->private;
  	int ret = 0;
  	int ret = 0;
  	const void *loc_cpu_entry;
  	const void *loc_cpu_entry;
@@ -58,7 +67,7 @@
  
  
  	counters = alloc_counters(table);
  	counters = alloc_counters(table);
  	if (IS_ERR(counters))
  	if (IS_ERR(counters))
-@@ -979,6 +1006,14 @@ copy_entries_to_user(unsigned int total_
+@@ -979,6 +1008,14 @@ copy_entries_to_user(unsigned int total_
  			ret = -EFAULT;
  			ret = -EFAULT;
  			goto free_counters;
  			goto free_counters;
  		}
  		}

+ 86 - 0
target/linux/generic/patches-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch

@@ -0,0 +1,86 @@
+From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Date: Mon, 21 Aug 2017 11:14:14 +0300
+Subject: [PATCH] net_sched/codel: do not defer queue length update
+
+When codel wants to drop last packet in ->dequeue() it cannot call
+qdisc_tree_reduce_backlog() right away - it will notify parent qdisc
+about zero qlen and HTB/HFSC will deactivate class. The same class will
+be deactivated second time by caller of ->dequeue(). Currently codel and
+fq_codel defer update. This triggers warning in HFSC when it's qlen != 0
+but there is no active classes.
+
+This patch update parent queue length immediately: just temporary increase
+qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation
+if we have skb to return.
+
+This might open another problem in HFSC - now operation peek could fail and
+deactivate parent class.
+
+Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581
+---
+
+--- a/net/sched/sch_codel.c
++++ b/net/sched/sch_codel.c
+@@ -79,11 +79,17 @@ static struct sk_buff *codel_qdisc_deque
+ 
+ 	skb = codel_dequeue(sch, &q->params, &q->vars, &q->stats, dequeue);
+ 
+-	/* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
+-	 * or HTB crashes. Defer it for next round.
++	/* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate
++	 * parent class, dequeue in parent qdisc will do the same if we
++	 * return skb. Temporary increment qlen if we have skb.
+ 	 */
+-	if (q->stats.drop_count && sch->q.qlen) {
+-		qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len);
++	if (q->stats.drop_count) {
++		if (skb)
++			sch->q.qlen++;
++		qdisc_tree_reduce_backlog(sch, q->stats.drop_count,
++					  q->stats.drop_len);
++		if (skb)
++			sch->q.qlen--;
+ 		q->stats.drop_count = 0;
+ 		q->stats.drop_len = 0;
+ 	}
+--- a/net/sched/sch_fq_codel.c
++++ b/net/sched/sch_fq_codel.c
+@@ -311,6 +311,21 @@ begin:
+ 	flow->dropped += q->cstats.drop_count - prev_drop_count;
+ 	flow->dropped += q->cstats.ecn_mark - prev_ecn_mark;
+ 
++	/* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate
++	 * parent class, dequeue in parent qdisc will do the same if we
++	 * return skb. Temporary increment qlen if we have skb.
++	 */
++	if (q->cstats.drop_count) {
++		if (skb)
++			sch->q.qlen++;
++		qdisc_tree_reduce_backlog(sch, q->cstats.drop_count,
++					  q->cstats.drop_len);
++		if (skb)
++			sch->q.qlen--;
++		q->cstats.drop_count = 0;
++		q->cstats.drop_len = 0;
++	}
++
+ 	if (!skb) {
+ 		/* force a pass through old_flows to prevent starvation */
+ 		if ((head == &q->new_flows) && !list_empty(&q->old_flows))
+@@ -321,15 +336,6 @@ begin:
+ 	}
+ 	qdisc_bstats_update(sch, skb);
+ 	flow->deficit -= qdisc_pkt_len(skb);
+-	/* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
+-	 * or HTB crashes. Defer it for next round.
+-	 */
+-	if (q->cstats.drop_count && sch->q.qlen) {
+-		qdisc_tree_reduce_backlog(sch, q->cstats.drop_count,
+-					  q->cstats.drop_len);
+-		q->cstats.drop_count = 0;
+-		q->cstats.drop_len = 0;
+-	}
+ 	return skb;
+ }
+ 

+ 1 - 1
target/linux/generic/patches-4.4/653-disable_netlink_trim.patch

@@ -1,6 +1,6 @@
 --- a/net/netlink/af_netlink.c
 --- a/net/netlink/af_netlink.c
 +++ b/net/netlink/af_netlink.c
 +++ b/net/netlink/af_netlink.c
-@@ -1228,24 +1228,7 @@ void netlink_detachskb(struct sock *sk,
+@@ -1231,24 +1231,7 @@ void netlink_detachskb(struct sock *sk,
  
  
  static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
  static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
  {
  {

+ 1 - 1
target/linux/generic/patches-4.4/660-fq_codel_defaults.patch

@@ -1,6 +1,6 @@
 --- a/net/sched/sch_fq_codel.c
 --- a/net/sched/sch_fq_codel.c
 +++ b/net/sched/sch_fq_codel.c
 +++ b/net/sched/sch_fq_codel.c
-@@ -471,7 +471,7 @@ static int fq_codel_init(struct Qdisc *s
+@@ -477,7 +477,7 @@ static int fq_codel_init(struct Qdisc *s
  
  
  	sch->limit = 10*1024;
  	sch->limit = 10*1024;
  	q->flows_cnt = 1024;
  	q->flows_cnt = 1024;

+ 2 - 2
target/linux/generic/patches-4.4/662-use_fq_codel_by_default.patch

@@ -13,7 +13,7 @@
  	  device, it has to decide which ones to send first, which ones to
  	  device, it has to decide which ones to send first, which ones to
 --- a/net/sched/sch_fq_codel.c
 --- a/net/sched/sch_fq_codel.c
 +++ b/net/sched/sch_fq_codel.c
 +++ b/net/sched/sch_fq_codel.c
-@@ -688,7 +688,7 @@ static const struct Qdisc_class_ops fq_c
+@@ -694,7 +694,7 @@ static const struct Qdisc_class_ops fq_c
  	.walk		=	fq_codel_walk,
  	.walk		=	fq_codel_walk,
  };
  };
  
  
@@ -22,7 +22,7 @@
  	.cl_ops		=	&fq_codel_class_ops,
  	.cl_ops		=	&fq_codel_class_ops,
  	.id		=	"fq_codel",
  	.id		=	"fq_codel",
  	.priv_size	=	sizeof(struct fq_codel_sched_data),
  	.priv_size	=	sizeof(struct fq_codel_sched_data),
-@@ -704,6 +704,7 @@ static struct Qdisc_ops fq_codel_qdisc_o
+@@ -710,6 +710,7 @@ static struct Qdisc_ops fq_codel_qdisc_o
  	.dump_stats =	fq_codel_dump_stats,
  	.dump_stats =	fq_codel_dump_stats,
  	.owner		=	THIS_MODULE,
  	.owner		=	THIS_MODULE,
  };
  };

+ 20 - 20
target/linux/generic/patches-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch

@@ -16,7 +16,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
 
 
 --- a/include/net/ip6_tunnel.h
 --- a/include/net/ip6_tunnel.h
 +++ b/include/net/ip6_tunnel.h
 +++ b/include/net/ip6_tunnel.h
-@@ -15,6 +15,18 @@
+@@ -17,6 +17,18 @@
  /* determine capability on a per-packet basis */
  /* determine capability on a per-packet basis */
  #define IP6_TNL_F_CAP_PER_PACKET 0x40000
  #define IP6_TNL_F_CAP_PER_PACKET 0x40000
  
  
@@ -35,7 +35,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  struct __ip6_tnl_parm {
  struct __ip6_tnl_parm {
  	char name[IFNAMSIZ];	/* name of tunnel device */
  	char name[IFNAMSIZ];	/* name of tunnel device */
  	int link;		/* ifindex of underlying L2 interface */
  	int link;		/* ifindex of underlying L2 interface */
-@@ -25,6 +37,7 @@ struct __ip6_tnl_parm {
+@@ -27,6 +39,7 @@ struct __ip6_tnl_parm {
  	__u32 flags;		/* tunnel flags */
  	__u32 flags;		/* tunnel flags */
  	struct in6_addr laddr;	/* local tunnel end-point address */
  	struct in6_addr laddr;	/* local tunnel end-point address */
  	struct in6_addr raddr;	/* remote tunnel end-point address */
  	struct in6_addr raddr;	/* remote tunnel end-point address */
@@ -94,7 +94,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  }
  }
  
  
  static int ip6_tnl_dev_init(struct net_device *dev);
  static int ip6_tnl_dev_init(struct net_device *dev);
-@@ -230,20 +230,29 @@ EXPORT_SYMBOL_GPL(ip6_tnl_dst_init);
+@@ -139,20 +139,29 @@ static struct net_device_stats *ip6_get_
  static struct ip6_tnl *
  static struct ip6_tnl *
  ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local)
  ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local)
  {
  {
@@ -129,7 +129,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
  	for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
  		if (ipv6_addr_equal(local, &t->parms.laddr) &&
  		if (ipv6_addr_equal(local, &t->parms.laddr) &&
  		    ipv6_addr_any(&t->parms.raddr) &&
  		    ipv6_addr_any(&t->parms.raddr) &&
-@@ -251,7 +260,7 @@ ip6_tnl_lookup(struct net *net, const st
+@@ -160,7 +169,7 @@ ip6_tnl_lookup(struct net *net, const st
  			return t;
  			return t;
  	}
  	}
  
  
@@ -138,7 +138,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
  	for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
  		if (ipv6_addr_equal(remote, &t->parms.raddr) &&
  		if (ipv6_addr_equal(remote, &t->parms.raddr) &&
  		    ipv6_addr_any(&t->parms.laddr) &&
  		    ipv6_addr_any(&t->parms.laddr) &&
-@@ -287,7 +296,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n,
+@@ -196,7 +205,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n,
  
  
  	if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) {
  	if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) {
  		prio = 1;
  		prio = 1;
@@ -147,7 +147,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	}
  	}
  	return &ip6n->tnls[prio][h];
  	return &ip6n->tnls[prio][h];
  }
  }
-@@ -460,6 +469,12 @@ ip6_tnl_dev_uninit(struct net_device *de
+@@ -369,6 +378,12 @@ ip6_tnl_dev_uninit(struct net_device *de
  	struct net *net = t->net;
  	struct net *net = t->net;
  	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
  	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
  
  
@@ -160,7 +160,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	if (dev == ip6n->fb_tnl_dev)
  	if (dev == ip6n->fb_tnl_dev)
  		RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);
  		RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);
  	else
  	else
-@@ -856,6 +871,108 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
+@@ -765,6 +780,108 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
  }
  }
  EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl);
  EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl);
  
  
@@ -269,7 +269,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  /**
  /**
   * ip6_tnl_rcv - decapsulate IPv6 packet and retransmit it locally
   * ip6_tnl_rcv - decapsulate IPv6 packet and retransmit it locally
   *   @skb: received socket buffer
   *   @skb: received socket buffer
-@@ -901,6 +1018,26 @@ static int ip6_tnl_rcv(struct sk_buff *s
+@@ -810,6 +927,26 @@ static int ip6_tnl_rcv(struct sk_buff *s
  		skb_reset_network_header(skb);
  		skb_reset_network_header(skb);
  		skb->protocol = htons(protocol);
  		skb->protocol = htons(protocol);
  		memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
  		memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
@@ -296,7 +296,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
  
  		__skb_tunnel_rx(skb, t->dev, t->net);
  		__skb_tunnel_rx(skb, t->dev, t->net);
  
  
-@@ -1247,6 +1384,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1145,6 +1282,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  	__u32 mtu;
  	__u32 mtu;
  	u8 tproto;
  	u8 tproto;
  	int err;
  	int err;
@@ -304,7 +304,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
  
  	tproto = ACCESS_ONCE(t->parms.proto);
  	tproto = ACCESS_ONCE(t->parms.proto);
  	if ((tproto != IPPROTO_IPV6 && tproto != 0) ||
  	if ((tproto != IPPROTO_IPV6 && tproto != 0) ||
-@@ -1277,6 +1415,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1175,6 +1313,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
  	if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
  		fl6.flowi6_mark = skb->mark;
  		fl6.flowi6_mark = skb->mark;
  
  
@@ -323,7 +323,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
  	err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
  	if (err != 0) {
  	if (err != 0) {
  		if (err == -EMSGSIZE)
  		if (err == -EMSGSIZE)
-@@ -1391,6 +1541,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
+@@ -1289,6 +1439,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
  	t->parms.flowinfo = p->flowinfo;
  	t->parms.flowinfo = p->flowinfo;
  	t->parms.link = p->link;
  	t->parms.link = p->link;
  	t->parms.proto = p->proto;
  	t->parms.proto = p->proto;
@@ -335,10 +335,10 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
 +	}
 +	}
 +	t->parms.fmrs = p->fmrs;
 +	t->parms.fmrs = p->fmrs;
 +
 +
- 	ip6_tnl_dst_reset(t);
+ 	dst_cache_reset(&t->dst_cache);
  	ip6_tnl_link_config(t);
  	ip6_tnl_link_config(t);
  	return 0;
  	return 0;
-@@ -1429,6 +1587,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
+@@ -1327,6 +1485,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
  	p->flowinfo = u->flowinfo;
  	p->flowinfo = u->flowinfo;
  	p->link = u->link;
  	p->link = u->link;
  	p->proto = u->proto;
  	p->proto = u->proto;
@@ -346,7 +346,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	memcpy(p->name, u->name, sizeof(u->name));
  	memcpy(p->name, u->name, sizeof(u->name));
  }
  }
  
  
-@@ -1724,6 +1883,15 @@ static int ip6_tnl_validate(struct nlatt
+@@ -1622,6 +1781,15 @@ static int ip6_tnl_validate(struct nlatt
  	return 0;
  	return 0;
  }
  }
  
  
@@ -362,7 +362,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  static void ip6_tnl_netlink_parms(struct nlattr *data[],
  static void ip6_tnl_netlink_parms(struct nlattr *data[],
  				  struct __ip6_tnl_parm *parms)
  				  struct __ip6_tnl_parm *parms)
  {
  {
-@@ -1755,6 +1923,46 @@ static void ip6_tnl_netlink_parms(struct
+@@ -1653,6 +1821,46 @@ static void ip6_tnl_netlink_parms(struct
  
  
  	if (data[IFLA_IPTUN_PROTO])
  	if (data[IFLA_IPTUN_PROTO])
  		parms->proto = nla_get_u8(data[IFLA_IPTUN_PROTO]);
  		parms->proto = nla_get_u8(data[IFLA_IPTUN_PROTO]);
@@ -409,7 +409,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  }
  }
  
  
  static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,
  static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,
-@@ -1807,6 +2015,12 @@ static void ip6_tnl_dellink(struct net_d
+@@ -1705,6 +1913,12 @@ static void ip6_tnl_dellink(struct net_d
  
  
  static size_t ip6_tnl_get_size(const struct net_device *dev)
  static size_t ip6_tnl_get_size(const struct net_device *dev)
  {
  {
@@ -422,7 +422,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	return
  	return
  		/* IFLA_IPTUN_LINK */
  		/* IFLA_IPTUN_LINK */
  		nla_total_size(4) +
  		nla_total_size(4) +
-@@ -1824,6 +2038,24 @@ static size_t ip6_tnl_get_size(const str
+@@ -1722,6 +1936,24 @@ static size_t ip6_tnl_get_size(const str
  		nla_total_size(4) +
  		nla_total_size(4) +
  		/* IFLA_IPTUN_PROTO */
  		/* IFLA_IPTUN_PROTO */
  		nla_total_size(1) +
  		nla_total_size(1) +
@@ -447,7 +447,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  		0;
  		0;
  }
  }
  
  
-@@ -1831,6 +2063,9 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -1729,6 +1961,9 @@ static int ip6_tnl_fill_info(struct sk_b
  {
  {
  	struct ip6_tnl *tunnel = netdev_priv(dev);
  	struct ip6_tnl *tunnel = netdev_priv(dev);
  	struct __ip6_tnl_parm *parm = &tunnel->parms;
  	struct __ip6_tnl_parm *parm = &tunnel->parms;
@@ -457,7 +457,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  
  
  	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
  	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
  	    nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
  	    nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
-@@ -1839,8 +2074,27 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -1737,8 +1972,27 @@ static int ip6_tnl_fill_info(struct sk_b
  	    nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) ||
  	    nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) ||
  	    nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
  	    nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
  	    nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) ||
  	    nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) ||
@@ -486,7 +486,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
  	return 0;
  	return 0;
  
  
  nla_put_failure:
  nla_put_failure:
-@@ -1864,6 +2118,7 @@ static const struct nla_policy ip6_tnl_p
+@@ -1762,6 +2016,7 @@ static const struct nla_policy ip6_tnl_p
  	[IFLA_IPTUN_FLOWINFO]		= { .type = NLA_U32 },
  	[IFLA_IPTUN_FLOWINFO]		= { .type = NLA_U32 },
  	[IFLA_IPTUN_FLAGS]		= { .type = NLA_U32 },
  	[IFLA_IPTUN_FLAGS]		= { .type = NLA_U32 },
  	[IFLA_IPTUN_PROTO]		= { .type = NLA_U8 },
  	[IFLA_IPTUN_PROTO]		= { .type = NLA_U8 },

+ 9 - 9
target/linux/generic/patches-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch

@@ -143,7 +143,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  static const struct rt6_info ip6_blk_hole_entry_template = {
  static const struct rt6_info ip6_blk_hole_entry_template = {
  	.dst = {
  	.dst = {
  		.__refcnt	= ATOMIC_INIT(1),
  		.__refcnt	= ATOMIC_INIT(1),
-@@ -1898,6 +1915,11 @@ static struct rt6_info *ip6_route_info_c
+@@ -1899,6 +1916,11 @@ static struct rt6_info *ip6_route_info_c
  			rt->dst.output = ip6_pkt_prohibit_out;
  			rt->dst.output = ip6_pkt_prohibit_out;
  			rt->dst.input = ip6_pkt_prohibit;
  			rt->dst.input = ip6_pkt_prohibit;
  			break;
  			break;
@@ -155,7 +155,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		case RTN_THROW:
  		case RTN_THROW:
  		case RTN_UNREACHABLE:
  		case RTN_UNREACHABLE:
  		default:
  		default:
-@@ -2501,6 +2523,17 @@ static int ip6_pkt_prohibit_out(struct n
+@@ -2502,6 +2524,17 @@ static int ip6_pkt_prohibit_out(struct n
  	return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
  	return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
  }
  }
  
  
@@ -173,7 +173,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  /*
  /*
   *	Allocate a dst for local (unicast / anycast) address.
   *	Allocate a dst for local (unicast / anycast) address.
   */
   */
-@@ -2743,7 +2776,8 @@ static int rtm_to_fib6_config(struct sk_
+@@ -2744,7 +2777,8 @@ static int rtm_to_fib6_config(struct sk_
  	if (rtm->rtm_type == RTN_UNREACHABLE ||
  	if (rtm->rtm_type == RTN_UNREACHABLE ||
  	    rtm->rtm_type == RTN_BLACKHOLE ||
  	    rtm->rtm_type == RTN_BLACKHOLE ||
  	    rtm->rtm_type == RTN_PROHIBIT ||
  	    rtm->rtm_type == RTN_PROHIBIT ||
@@ -183,7 +183,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		cfg->fc_flags |= RTF_REJECT;
  		cfg->fc_flags |= RTF_REJECT;
  
  
  	if (rtm->rtm_type == RTN_LOCAL)
  	if (rtm->rtm_type == RTN_LOCAL)
-@@ -3096,6 +3130,9 @@ static int rt6_fill_node(struct net *net
+@@ -3097,6 +3131,9 @@ static int rt6_fill_node(struct net *net
  		case -EACCES:
  		case -EACCES:
  			rtm->rtm_type = RTN_PROHIBIT;
  			rtm->rtm_type = RTN_PROHIBIT;
  			break;
  			break;
@@ -193,7 +193,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		case -EAGAIN:
  		case -EAGAIN:
  			rtm->rtm_type = RTN_THROW;
  			rtm->rtm_type = RTN_THROW;
  			break;
  			break;
-@@ -3375,6 +3412,8 @@ static int ip6_route_dev_notify(struct n
+@@ -3376,6 +3413,8 @@ static int ip6_route_dev_notify(struct n
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  		net->ipv6.ip6_prohibit_entry->dst.dev = dev;
  		net->ipv6.ip6_prohibit_entry->dst.dev = dev;
  		net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
  		net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
@@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
  		net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
  		net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
  		net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
  #endif
  #endif
-@@ -3601,6 +3640,17 @@ static int __net_init ip6_route_net_init
+@@ -3602,6 +3641,17 @@ static int __net_init ip6_route_net_init
  	net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
  	net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
  	dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
  	dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
  			 ip6_template_metrics, true);
  			 ip6_template_metrics, true);
@@ -220,7 +220,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  #endif
  
  
  	net->ipv6.sysctl.flush_delay = 0;
  	net->ipv6.sysctl.flush_delay = 0;
-@@ -3619,6 +3669,8 @@ out:
+@@ -3620,6 +3670,8 @@ out:
  	return ret;
  	return ret;
  
  
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -229,7 +229,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  out_ip6_prohibit_entry:
  out_ip6_prohibit_entry:
  	kfree(net->ipv6.ip6_prohibit_entry);
  	kfree(net->ipv6.ip6_prohibit_entry);
  out_ip6_null_entry:
  out_ip6_null_entry:
-@@ -3636,6 +3688,7 @@ static void __net_exit ip6_route_net_exi
+@@ -3637,6 +3689,7 @@ static void __net_exit ip6_route_net_exi
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  	kfree(net->ipv6.ip6_prohibit_entry);
  	kfree(net->ipv6.ip6_prohibit_entry);
  	kfree(net->ipv6.ip6_blk_hole_entry);
  	kfree(net->ipv6.ip6_blk_hole_entry);
@@ -237,7 +237,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  #endif
  	dst_entries_destroy(&net->ipv6.ip6_dst_ops);
  	dst_entries_destroy(&net->ipv6.ip6_dst_ops);
  }
  }
-@@ -3709,6 +3762,9 @@ void __init ip6_route_init_special_entri
+@@ -3710,6 +3763,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_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->dst.dev = init_net.loopback_dev;
  	init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
  	init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);

+ 5 - 5
target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch

@@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 
 --- a/net/core/dev.c
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -4260,6 +4260,9 @@ static enum gro_result dev_gro_receive(s
+@@ -4271,6 +4271,9 @@ static enum gro_result dev_gro_receive(s
  	enum gro_result ret;
  	enum gro_result ret;
  	int grow;
  	int grow;
  
  
@@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	if (!(skb->dev->features & NETIF_F_GRO))
  	if (!(skb->dev->features & NETIF_F_GRO))
  		goto normal;
  		goto normal;
  
  
-@@ -5426,6 +5429,48 @@ static void __netdev_adjacent_dev_unlink
+@@ -5437,6 +5440,48 @@ static void __netdev_adjacent_dev_unlink
  					   &upper_dev->adj_list.lower);
  					   &upper_dev->adj_list.lower);
  }
  }
  
  
@@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static int __netdev_upper_dev_link(struct net_device *dev,
  static int __netdev_upper_dev_link(struct net_device *dev,
  				   struct net_device *upper_dev, bool master,
  				   struct net_device *upper_dev, bool master,
  				   void *private)
  				   void *private)
-@@ -5497,6 +5542,7 @@ static int __netdev_upper_dev_link(struc
+@@ -5508,6 +5553,7 @@ static int __netdev_upper_dev_link(struc
  			goto rollback_lower_mesh;
  			goto rollback_lower_mesh;
  	}
  	}
  
  
@@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  				      &changeupper_info.info);
  	return 0;
  	return 0;
-@@ -5623,6 +5669,7 @@ void netdev_upper_dev_unlink(struct net_
+@@ -5634,6 +5680,7 @@ void netdev_upper_dev_unlink(struct net_
  	list_for_each_entry(i, &upper_dev->all_adj_list.upper, list)
  	list_for_each_entry(i, &upper_dev->all_adj_list.upper, list)
  		__netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr);
  		__netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr);
  
  
@@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  				      &changeupper_info.info);
  }
  }
-@@ -6163,6 +6210,7 @@ int dev_set_mac_address(struct net_devic
+@@ -6174,6 +6221,7 @@ int dev_set_mac_address(struct net_devic
  	if (err)
  	if (err)
  		return err;
  		return err;
  	dev->addr_assign_type = NET_ADDR_SET;
  	dev->addr_assign_type = NET_ADDR_SET;

+ 1 - 1
target/linux/generic/patches-4.4/701-phy_extension.patch

@@ -53,7 +53,7 @@
   * @phydev: the phy_device struct
   * @phydev: the phy_device struct
 --- a/include/linux/phy.h
 --- a/include/linux/phy.h
 +++ b/include/linux/phy.h
 +++ b/include/linux/phy.h
-@@ -796,6 +796,7 @@ void phy_start_machine(struct phy_device
+@@ -807,6 +807,7 @@ void phy_start_machine(struct phy_device
  void phy_stop_machine(struct phy_device *phydev);
  void phy_stop_machine(struct phy_device *phydev);
  int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);

+ 1 - 1
target/linux/generic/patches-4.4/710-phy-add-mdio_register_board_info.patch

@@ -46,7 +46,7 @@
  		phy_device_free(phydev);
  		phy_device_free(phydev);
 --- a/include/linux/phy.h
 --- a/include/linux/phy.h
 +++ b/include/linux/phy.h
 +++ b/include/linux/phy.h
-@@ -835,6 +835,23 @@ void mdio_bus_exit(void);
+@@ -846,6 +846,23 @@ void mdio_bus_exit(void);
  
  
  extern struct bus_type mdio_bus_type;
  extern struct bus_type mdio_bus_type;
  
  

+ 0 - 88
target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch

@@ -1,88 +0,0 @@
-Register switch connected to srab
-
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -11,6 +11,7 @@
- 
- #include <linux/bcma/bcma.h>
- #include <linux/etherdevice.h>
-+#include <linux/platform_data/b53.h>
- #include <linux/bcm47xx_nvram.h>
- #include "bgmac.h"
- 
-@@ -1403,6 +1404,17 @@ static const struct ethtool_ops bgmac_et
- 	.get_drvinfo		= bgmac_get_drvinfo,
- };
- 
-+static struct b53_platform_data bgmac_b53_pdata = {
-+};
-+
-+static struct platform_device bgmac_b53_dev = {
-+	.name		= "b53-srab-switch",
-+	.id		= -1,
-+	.dev		= {
-+		.platform_data = &bgmac_b53_pdata,
-+	},
-+};
-+
- /**************************************************
-  * MII
-  **************************************************/
-@@ -1549,6 +1561,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
- 	net_dev->hw_features = net_dev->features;
- 	net_dev->vlan_features = net_dev->features;
- 
-+	if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
-+		bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
-+
-+		err = platform_device_register(&bgmac_b53_dev);
-+		if (!err)
-+			bgmac->b53_device = &bgmac_b53_dev;
-+	}
-+
- 	err = register_netdev(bgmac->net_dev);
- 	if (err) {
- 		dev_err(bgmac->dev, "Cannot register net device\n");
-@@ -1571,6 +1591,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
- 
- void bgmac_enet_remove(struct bgmac *bgmac)
- {
-+	if (bgmac->b53_device)
-+		platform_device_unregister(&bgmac_b53_dev);
-+	bgmac->b53_device = NULL;
-+
- 	unregister_netdev(bgmac->net_dev);
- 	phy_disconnect(bgmac->net_dev->phydev);
- 	netif_napi_del(&bgmac->napi);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -409,6 +409,7 @@
- #define BGMAC_FEAT_CC4_IF_SW_TYPE	BIT(17)
- #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII	BIT(18)
- #define BGMAC_FEAT_CC7_IF_TYPE_RGMII	BIT(19)
-+#define BGMAC_FEAT_SRAB			BIT(20)
- 
- struct bgmac_slot_info {
- 	union {
-@@ -513,6 +514,9 @@ struct bgmac {
- 	u32 (*get_bus_clock)(struct bgmac *bgmac);
- 	void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
- 			      u32 set);
-+
-+	/* platform device for associated switch */
-+	struct platform_device *b53_device;
- };
- 
- struct bgmac *bgmac_alloc(struct device *dev);
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -236,6 +236,7 @@ static int bgmac_probe(struct bcma_devic
- 		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
- 		bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
- 		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-+		bgmac->feature_flags |= BGMAC_FEAT_SRAB;
- 		break;
- 	case BCMA_CHIP_ID_BCM53573:
- 		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;

+ 4 - 4
target/linux/generic/patches-4.4/834-ledtrig-libata.patch

@@ -69,7 +69,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  /**
  /**
   *	ata_build_rw_tf - Build ATA taskfile for given read/write request
   *	ata_build_rw_tf - Build ATA taskfile for given read/write request
   *	@tf: Target ATA taskfile
   *	@tf: Target ATA taskfile
-@@ -4780,6 +4793,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
+@@ -4781,6 +4794,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
  		if (tag < 0)
  		if (tag < 0)
  			return NULL;
  			return NULL;
  	}
  	}
@@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
  
  	qc = __ata_qc_from_tag(ap, tag);
  	qc = __ata_qc_from_tag(ap, tag);
  	qc->tag = tag;
  	qc->tag = tag;
-@@ -5677,6 +5693,9 @@ struct ata_port *ata_port_alloc(struct a
+@@ -5678,6 +5694,9 @@ struct ata_port *ata_port_alloc(struct a
  	ap->stats.unhandled_irq = 1;
  	ap->stats.unhandled_irq = 1;
  	ap->stats.idle_irq = 1;
  	ap->stats.idle_irq = 1;
  #endif
  #endif
@@ -89,7 +89,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  	ata_sff_port_init(ap);
  	ata_sff_port_init(ap);
  
  
  	return ap;
  	return ap;
-@@ -5698,6 +5717,12 @@ static void ata_host_release(struct devi
+@@ -5699,6 +5718,12 @@ static void ata_host_release(struct devi
  
  
  		kfree(ap->pmp_link);
  		kfree(ap->pmp_link);
  		kfree(ap->slave_link);
  		kfree(ap->slave_link);
@@ -102,7 +102,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  		kfree(ap);
  		kfree(ap);
  		host->ports[i] = NULL;
  		host->ports[i] = NULL;
  	}
  	}
-@@ -6144,7 +6169,23 @@ int ata_host_register(struct ata_host *h
+@@ -6145,7 +6170,23 @@ int ata_host_register(struct ata_host *h
  		host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
  		host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
  		host->ports[i]->local_port_no = i + 1;
  		host->ports[i]->local_port_no = i + 1;
  	}
  	}

+ 1 - 1
target/linux/generic/patches-4.4/901-debloat_sock_diag.patch

@@ -39,7 +39,7 @@
  
  
 --- a/net/ipv4/Kconfig
 --- a/net/ipv4/Kconfig
 +++ b/net/ipv4/Kconfig
 +++ b/net/ipv4/Kconfig
-@@ -414,6 +414,7 @@ config INET_LRO
+@@ -415,6 +415,7 @@ config INET_LRO
  
  
  config INET_DIAG
  config INET_DIAG
  	tristate "INET: socket monitoring interface"
  	tristate "INET: socket monitoring interface"

+ 3 - 3
target/linux/generic/patches-4.4/902-debloat_proc.patch

@@ -1,6 +1,6 @@
 --- a/fs/locks.c
 --- a/fs/locks.c
 +++ b/fs/locks.c
 +++ b/fs/locks.c
-@@ -2712,6 +2712,8 @@ static const struct file_operations proc
+@@ -2716,6 +2716,8 @@ static const struct file_operations proc
  
  
  static int __init proc_locks_init(void)
  static int __init proc_locks_init(void)
  {
  {
@@ -133,7 +133,7 @@
  }
  }
 --- a/mm/vmstat.c
 --- a/mm/vmstat.c
 +++ b/mm/vmstat.c
 +++ b/mm/vmstat.c
-@@ -1555,10 +1555,12 @@ static int __init setup_vmstat(void)
+@@ -1558,10 +1558,12 @@ static int __init setup_vmstat(void)
  	cpu_notifier_register_done();
  	cpu_notifier_register_done();
  #endif
  #endif
  #ifdef CONFIG_PROC_FS
  #ifdef CONFIG_PROC_FS
@@ -251,7 +251,7 @@
  
  
 --- a/ipc/msg.c
 --- a/ipc/msg.c
 +++ b/ipc/msg.c
 +++ b/ipc/msg.c
-@@ -1068,6 +1068,9 @@ void __init msg_init(void)
+@@ -1071,6 +1071,9 @@ void __init msg_init(void)
  {
  {
  	msg_init_ns(&init_ipc_ns);
  	msg_init_ns(&init_ipc_ns);
  
  

+ 0 - 80
target/linux/generic/patches-4.4/903-debloat_direct_io.patch

@@ -1,80 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -74,6 +74,11 @@ config FILE_LOCKING
-           for filesystems like NFS and for the flock() system
-           call. Disabling this option saves about 11k.
- 
-+config DIRECT_IO
-+	bool "Enable O_DIRECT support" if EXPERT
-+	depends on BLOCK
-+	default y
-+
- source "fs/notify/Kconfig"
- 
- source "fs/quota/Kconfig"
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -14,7 +14,8 @@ obj-y :=	open.o read_write.o file_table.
- 		stack.o fs_struct.o statfs.o fs_pin.o nsfs.o
- 
- ifeq ($(CONFIG_BLOCK),y)
--obj-y +=	buffer.o block_dev.o direct-io.o mpage.o
-+obj-y +=	buffer.o block_dev.o mpage.o
-+obj-$(CONFIG_DIRECT_IO) += direct-io.o
- else
- obj-y +=	no-block.o
- endif
---- a/include/linux/fs.h
-+++ b/include/linux/fs.h
-@@ -2722,6 +2722,7 @@ enum {
- 	DIO_SKIP_DIO_COUNT = 0x08,
- };
- 
-+#ifdef CONFIG_DIRECT_IO
- void dio_end_io(struct bio *bio, int error);
- 
- ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-@@ -2729,6 +2730,18 @@ ssize_t __blockdev_direct_IO(struct kioc
- 			     loff_t offset, get_block_t get_block,
- 			     dio_iodone_t end_io, dio_submit_t submit_io,
- 			     int flags);
-+#else
-+static inline void dio_end_io(struct bio *bio, int error)
-+{
-+}
-+static inline ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-+	struct block_device *bdev, struct iov_iter *iter, loff_t offset,
-+	get_block_t get_block, dio_iodone_t end_io,
-+	dio_submit_t submit_io,	int flags)
-+{
-+	return -EOPNOTSUPP;
-+}
-+#endif
- 
- static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
- 					 struct inode *inode,
---- a/fs/fcntl.c
-+++ b/fs/fcntl.c
-@@ -52,8 +52,10 @@ static int setfl(int fd, struct file * f
- 		   arg |= O_NONBLOCK;
- 
- 	if (arg & O_DIRECT) {
-+#ifdef CONFIG_DIRECT_IO
- 		if (!filp->f_mapping || !filp->f_mapping->a_ops ||
- 			!filp->f_mapping->a_ops->direct_IO)
-+#endif
- 				return -EINVAL;
- 	}
- 
---- a/fs/open.c
-+++ b/fs/open.c
-@@ -673,7 +673,9 @@ int open_check_o_direct(struct file *f)
- {
- 	/* NB: we're sure to have correct a_ops only after f_op->open */
- 	if (f->f_flags & O_DIRECT) {
-+#ifdef CONFIG_DIRECT_IO
- 		if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO)
-+#endif
- 			return -EINVAL;
- 	}
- 	return 0;

+ 2 - 2
target/linux/generic/patches-4.4/904-debloat_dma_buf.patch

@@ -1,6 +1,6 @@
 --- a/drivers/base/Kconfig
 --- a/drivers/base/Kconfig
 +++ b/drivers/base/Kconfig
 +++ b/drivers/base/Kconfig
-@@ -229,7 +229,7 @@ config SOC_BUS
+@@ -232,7 +232,7 @@ config SOC_BUS
  source "drivers/base/regmap/Kconfig"
  source "drivers/base/regmap/Kconfig"
  
  
  config DMA_SHARED_BUFFER
  config DMA_SHARED_BUFFER
@@ -34,7 +34,7 @@
 +MODULE_LICENSE("GPL");
 +MODULE_LICENSE("GPL");
 --- a/kernel/sched/core.c
 --- a/kernel/sched/core.c
 +++ b/kernel/sched/core.c
 +++ b/kernel/sched/core.c
-@@ -2097,6 +2097,7 @@ int wake_up_state(struct task_struct *p,
+@@ -2096,6 +2096,7 @@ int wake_up_state(struct task_struct *p,
  {
  {
  	return try_to_wake_up(p, state, 0);
  	return try_to_wake_up(p, state, 0);
  }
  }

+ 0 - 12
target/linux/generic/patches-4.4/920-cve-2018-5333-fix.patch

@@ -1,12 +0,0 @@
---- a/net/rds/rdma.c
-+++ b/net/rds/rdma.c
-@@ -517,6 +517,9 @@ int rds_rdma_extra_size(struct rds_rdma_
- 
- 	local_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;
- 
-+	if (args->nr_local == 0)
-+		return -EINVAL;
-+
- 	/* figure out the number of pages in the vector */
- 	for (i = 0; i < args->nr_local; i++) {
- 		if (copy_from_user(&vec, &local_vec[i],

+ 1 - 1
target/linux/generic/patches-4.4/921-use_preinit_as_init.patch

@@ -1,6 +1,6 @@
 --- a/init/main.c
 --- a/init/main.c
 +++ b/init/main.c
 +++ b/init/main.c
-@@ -964,7 +964,8 @@ static int __ref kernel_init(void *unuse
+@@ -966,7 +966,8 @@ static int __ref kernel_init(void *unuse
  		panic("Requested init %s failed (error %d).",
  		panic("Requested init %s failed (error %d).",
  		      execute_command, ret);
  		      execute_command, ret);
  	}
  	}

+ 3 - 3
target/linux/generic/patches-4.4/995-mangle_bootargs.patch

@@ -1,6 +1,6 @@
 --- a/init/main.c
 --- a/init/main.c
 +++ b/init/main.c
 +++ b/init/main.c
-@@ -355,6 +355,29 @@ static inline void setup_nr_cpu_ids(void
+@@ -356,6 +356,29 @@ static inline void setup_nr_cpu_ids(void
  static inline void smp_prepare_cpus(unsigned int maxcpus) { }
  static inline void smp_prepare_cpus(unsigned int maxcpus) { }
  #endif
  #endif
  
  
@@ -30,7 +30,7 @@
  /*
  /*
   * We need to store the untouched command line for future reference.
   * We need to store the untouched command line for future reference.
   * We also need to store the touched command line since the parameter
   * We also need to store the touched command line since the parameter
-@@ -527,6 +550,7 @@ asmlinkage __visible void __init start_k
+@@ -529,6 +552,7 @@ asmlinkage __visible void __init start_k
  	pr_notice("%s", linux_banner);
  	pr_notice("%s", linux_banner);
  	setup_arch(&command_line);
  	setup_arch(&command_line);
  	mm_init_cpumask(&init_mm);
  	mm_init_cpumask(&init_mm);
@@ -40,7 +40,7 @@
  	setup_per_cpu_areas();
  	setup_per_cpu_areas();
 --- a/init/Kconfig
 --- a/init/Kconfig
 +++ b/init/Kconfig
 +++ b/init/Kconfig
-@@ -1648,6 +1648,15 @@ config EMBEDDED
+@@ -1655,6 +1655,15 @@ config EMBEDDED
  	  an embedded system so certain expert options are available
  	  an embedded system so certain expert options are available
  	  for configuration.
  	  for configuration.
  
  

+ 25 - 29
target/linux/x86/config-4.4

@@ -31,6 +31,7 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
 CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y
 CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y
+CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y
 CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
 CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
 CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
@@ -82,6 +83,7 @@ CONFIG_CPU_SUP_TRANSMETA_32=y
 CONFIG_CPU_SUP_UMC_32=y
 CONFIG_CPU_SUP_UMC_32=y
 # CONFIG_CRASHLOG is not set
 # CONFIG_CRASHLOG is not set
 CONFIG_CRC16=y
 CONFIG_CRC16=y
+CONFIG_CRYPTO_AES_586=y
 CONFIG_CRYPTO_CRC32C=y
 CONFIG_CRYPTO_CRC32C=y
 # CONFIG_CRYPTO_CRC32_PCLMUL is not set
 # CONFIG_CRYPTO_CRC32_PCLMUL is not set
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH=y
@@ -124,7 +126,6 @@ CONFIG_F2FS_STAT_FS=y
 CONFIG_FIRMWARE_IN_KERNEL=y
 CONFIG_FIRMWARE_IN_KERNEL=y
 CONFIG_FIRMWARE_MEMMAP=y
 CONFIG_FIRMWARE_MEMMAP=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FIX_EARLYCON_MEM=y
-# CONFIG_FLATMEM_MANUAL is not set
 CONFIG_FS_MBCACHE=y
 CONFIG_FS_MBCACHE=y
 CONFIG_FUSION=y
 CONFIG_FUSION=y
 # CONFIG_FUSION_CTL is not set
 # CONFIG_FUSION_CTL is not set
@@ -137,7 +138,6 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
 CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_GENERIC_CMOS_UPDATE=y
-# CONFIG_GENERIC_CPU is not set
 CONFIG_GENERIC_CPU_AUTOPROBE=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
 CONFIG_GENERIC_CPU_VULNERABILITIES=y
 CONFIG_GENERIC_CPU_VULNERABILITIES=y
 CONFIG_GENERIC_EARLY_IOREMAP=y
 CONFIG_GENERIC_EARLY_IOREMAP=y
@@ -200,7 +200,6 @@ CONFIG_HAVE_KVM=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_HAVE_MEMBLOCK=y
 CONFIG_HAVE_MEMBLOCK=y
 CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
 CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MEMORY_PRESENT=y
 CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
 CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
 CONFIG_HAVE_MMIOTRACE_SUPPORT=y
 CONFIG_HAVE_MMIOTRACE_SUPPORT=y
 CONFIG_HAVE_NET_DSA=y
 CONFIG_HAVE_NET_DSA=y
@@ -219,7 +218,6 @@ CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
 CONFIG_HAVE_USER_RETURN_NOTIFIER=y
 CONFIG_HAVE_USER_RETURN_NOTIFIER=y
 CONFIG_HIGHMEM=y
 CONFIG_HIGHMEM=y
 CONFIG_HIGHMEM4G=y
 CONFIG_HIGHMEM4G=y
-# CONFIG_HIGHMEM64G is not set
 # CONFIG_HIGHPTE is not set
 # CONFIG_HIGHPTE is not set
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 CONFIG_HPET_TIMER=y
@@ -228,6 +226,7 @@ CONFIG_HT_IRQ=y
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLBFS is not set
 CONFIG_HW_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_GEODE=y
 CONFIG_HW_RANDOM_VIA=y
 CONFIG_HW_RANDOM_VIA=y
 # CONFIG_HYPERVISOR_GUEST is not set
 # CONFIG_HYPERVISOR_GUEST is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_HZ_PERIODIC=y
@@ -270,14 +269,11 @@ CONFIG_KEXEC=y
 CONFIG_KEXEC_CORE=y
 CONFIG_KEXEC_CORE=y
 CONFIG_KEYBOARD_ATKBD=y
 CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_LEDS_CLEVO_MAIL is not set
 # CONFIG_LEDS_CLEVO_MAIL is not set
-# CONFIG_LEGACY_VSYSCALL_EMULATE is not set
-# CONFIG_LEGACY_VSYSCALL_NATIVE is not set
-# CONFIG_LEGACY_VSYSCALL_NONE is not set
-# CONFIG_M486 is not set
+CONFIG_M486=y
 # CONFIG_M586 is not set
 # CONFIG_M586 is not set
 # CONFIG_M586MMX is not set
 # CONFIG_M586MMX is not set
 # CONFIG_M586TSC is not set
 # CONFIG_M586TSC is not set
-CONFIG_M686=y
+# CONFIG_M686 is not set
 # CONFIG_MACHZ_WDT is not set
 # CONFIG_MACHZ_WDT is not set
 # CONFIG_MATOM is not set
 # CONFIG_MATOM is not set
 # CONFIG_MCORE2 is not set
 # CONFIG_MCORE2 is not set
@@ -285,11 +281,13 @@ CONFIG_M686=y
 # CONFIG_MCYRIXIII is not set
 # CONFIG_MCYRIXIII is not set
 # CONFIG_MEFFICEON is not set
 # CONFIG_MEFFICEON is not set
 # CONFIG_MELAN is not set
 # CONFIG_MELAN is not set
-# CONFIG_MEMORY_HOTPLUG is not set
 # CONFIG_MFD_INTEL_LPSS_PCI is not set
 # CONFIG_MFD_INTEL_LPSS_PCI is not set
 # CONFIG_MGEODEGX1 is not set
 # CONFIG_MGEODEGX1 is not set
 # CONFIG_MGEODE_LX is not set
 # CONFIG_MGEODE_LX is not set
-# CONFIG_MICROCODE is not set
+CONFIG_MICROCODE=y
+CONFIG_MICROCODE_AMD=y
+CONFIG_MICROCODE_INTEL=y
+CONFIG_MICROCODE_OLD_INTERFACE=y
 # CONFIG_MK6 is not set
 # CONFIG_MK6 is not set
 # CONFIG_MK7 is not set
 # CONFIG_MK7 is not set
 # CONFIG_MK8 is not set
 # CONFIG_MK8 is not set
@@ -300,7 +298,6 @@ CONFIG_MODULES_USE_ELF_REL=y
 # CONFIG_MPENTIUMII is not set
 # CONFIG_MPENTIUMII is not set
 # CONFIG_MPENTIUMIII is not set
 # CONFIG_MPENTIUMIII is not set
 # CONFIG_MPENTIUMM is not set
 # CONFIG_MPENTIUMM is not set
-# CONFIG_MPSC is not set
 # CONFIG_MTD is not set
 # CONFIG_MTD is not set
 CONFIG_MTRR=y
 CONFIG_MTRR=y
 # CONFIG_MTRR_SANITIZER is not set
 # CONFIG_MTRR_SANITIZER is not set
@@ -309,7 +306,6 @@ CONFIG_MTRR=y
 # CONFIG_MWINCHIP3D is not set
 # CONFIG_MWINCHIP3D is not set
 # CONFIG_MWINCHIPC6 is not set
 # CONFIG_MWINCHIPC6 is not set
 CONFIG_NAMESPACES=y
 CONFIG_NAMESPACES=y
-CONFIG_NEED_NODE_MEMMAP_SIZE=y
 CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
 CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
 CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
@@ -347,7 +343,7 @@ CONFIG_PCSPKR_PLATFORM=y
 CONFIG_PERF_EVENTS=y
 CONFIG_PERF_EVENTS=y
 CONFIG_PERF_EVENTS_INTEL_UNCORE=y
 CONFIG_PERF_EVENTS_INTEL_UNCORE=y
 CONFIG_PGTABLE_LEVELS=2
 CONFIG_PGTABLE_LEVELS=2
-CONFIG_PHYSICAL_ALIGN=0x200000
+CONFIG_PHYSICAL_ALIGN=0x100000
 CONFIG_PHYSICAL_START=0x1000000
 CONFIG_PHYSICAL_START=0x1000000
 CONFIG_PMC_ATOM=y
 CONFIG_PMC_ATOM=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_POWER_SUPPLY=y
@@ -367,11 +363,13 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 # CONFIG_SBC8360_WDT is not set
 # CONFIG_SBC8360_WDT is not set
 # CONFIG_SBC_EPX_C3_WATCHDOG is not set
 # CONFIG_SBC_EPX_C3_WATCHDOG is not set
 # CONFIG_SC1200_WDT is not set
 # CONFIG_SC1200_WDT is not set
-CONFIG_SCHED_HRTICK=y
 # CONFIG_SCHED_INFO is not set
 # CONFIG_SCHED_INFO is not set
 CONFIG_SCSI=y
 CONFIG_SCSI=y
 CONFIG_SCSI_SPI_ATTRS=y
 CONFIG_SCSI_SPI_ATTRS=y
-# CONFIG_SCx200 is not set
+CONFIG_SCx200=y
+CONFIG_SCx200HR_TIMER=y
+# CONFIG_SCx200_GPIO is not set
+# CONFIG_SCx200_WDT is not set
 # CONFIG_SERIAL_8250_FSL is not set
 # CONFIG_SERIAL_8250_FSL is not set
 CONFIG_SERIAL_8250_PCI=y
 CONFIG_SERIAL_8250_PCI=y
 CONFIG_SERIO=y
 CONFIG_SERIO=y
@@ -381,8 +379,6 @@ CONFIG_SERIO_LIBPS2=y
 CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_SERPORT=y
 # CONFIG_SMSC37B787_WDT is not set
 # CONFIG_SMSC37B787_WDT is not set
 # CONFIG_SMSC_SCH311X_WDT is not set
 # CONFIG_SMSC_SCH311X_WDT is not set
-CONFIG_SPARSEMEM=y
-CONFIG_SPARSEMEM_MANUAL=y
 CONFIG_SPARSEMEM_STATIC=y
 CONFIG_SPARSEMEM_STATIC=y
 CONFIG_SPARSE_IRQ=y
 CONFIG_SPARSE_IRQ=y
 CONFIG_SRCU=y
 CONFIG_SRCU=y
@@ -413,23 +409,24 @@ CONFIG_X86=y
 CONFIG_X86_32=y
 CONFIG_X86_32=y
 # CONFIG_X86_32_IRIS is not set
 # CONFIG_X86_32_IRIS is not set
 CONFIG_X86_32_LAZY_GS=y
 CONFIG_X86_32_LAZY_GS=y
+CONFIG_X86_ALIGNMENT_16=y
 # CONFIG_X86_ANCIENT_MCE is not set
 # CONFIG_X86_ANCIENT_MCE is not set
 # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
 # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
-CONFIG_X86_CMOV=y
-CONFIG_X86_CMPXCHG64=y
 # CONFIG_X86_CPUFREQ_NFORCE2 is not set
 # CONFIG_X86_CPUFREQ_NFORCE2 is not set
 # CONFIG_X86_CPUID is not set
 # CONFIG_X86_CPUID is not set
-CONFIG_X86_DEBUGCTLMSR=y
 # CONFIG_X86_DEBUG_FPU is not set
 # CONFIG_X86_DEBUG_FPU is not set
 # CONFIG_X86_EXTENDED_PLATFORM is not set
 # CONFIG_X86_EXTENDED_PLATFORM is not set
+CONFIG_X86_F00F_BUG=y
 CONFIG_X86_FEATURE_NAMES=y
 CONFIG_X86_FEATURE_NAMES=y
-# CONFIG_X86_GENERIC is not set
+CONFIG_X86_GENERIC=y
 # CONFIG_X86_GX_SUSPMOD is not set
 # CONFIG_X86_GX_SUSPMOD is not set
 # CONFIG_X86_INTEL_MPX is not set
 # CONFIG_X86_INTEL_MPX is not set
 # CONFIG_X86_INTEL_PSTATE is not set
 # CONFIG_X86_INTEL_PSTATE is not set
-CONFIG_X86_INTERNODE_CACHE_SHIFT=5
+CONFIG_X86_INTEL_USERCOPY=y
+CONFIG_X86_INTERNODE_CACHE_SHIFT=6
+CONFIG_X86_INVD_BUG=y
 CONFIG_X86_IO_APIC=y
 CONFIG_X86_IO_APIC=y
-CONFIG_X86_L1_CACHE_SHIFT=5
+CONFIG_X86_L1_CACHE_SHIFT=6
 # CONFIG_X86_LEGACY_VM86 is not set
 # CONFIG_X86_LEGACY_VM86 is not set
 CONFIG_X86_LOCAL_APIC=y
 CONFIG_X86_LOCAL_APIC=y
 # CONFIG_X86_LONGRUN is not set
 # CONFIG_X86_LONGRUN is not set
@@ -438,7 +435,7 @@ CONFIG_X86_MCE_AMD=y
 # CONFIG_X86_MCE_INJECT is not set
 # CONFIG_X86_MCE_INJECT is not set
 CONFIG_X86_MCE_INTEL=y
 CONFIG_X86_MCE_INTEL=y
 CONFIG_X86_MCE_THRESHOLD=y
 CONFIG_X86_MCE_THRESHOLD=y
-CONFIG_X86_MINIMUM_CPU_FAMILY=5
+CONFIG_X86_MINIMUM_CPU_FAMILY=4
 CONFIG_X86_MPPARSE=y
 CONFIG_X86_MPPARSE=y
 CONFIG_X86_MSR=y
 CONFIG_X86_MSR=y
 # CONFIG_X86_P4_CLOCKMOD is not set
 # CONFIG_X86_P4_CLOCKMOD is not set
@@ -446,7 +443,7 @@ CONFIG_X86_PAT=y
 CONFIG_X86_PLATFORM_DEVICES=y
 CONFIG_X86_PLATFORM_DEVICES=y
 # CONFIG_X86_POWERNOW_K6 is not set
 # CONFIG_X86_POWERNOW_K6 is not set
 # CONFIG_X86_POWERNOW_K7 is not set
 # CONFIG_X86_POWERNOW_K7 is not set
-# CONFIG_X86_PPRO_FENCE is not set
+CONFIG_X86_PPRO_FENCE=y
 # CONFIG_X86_PTDUMP is not set
 # CONFIG_X86_PTDUMP is not set
 # CONFIG_X86_PTDUMP_CORE is not set
 # CONFIG_X86_PTDUMP_CORE is not set
 # CONFIG_X86_REBOOTFIXUPS is not set
 # CONFIG_X86_REBOOTFIXUPS is not set
@@ -457,11 +454,10 @@ CONFIG_X86_RESERVE_LOW=64
 # CONFIG_X86_SPEEDSTEP_ICH is not set
 # CONFIG_X86_SPEEDSTEP_ICH is not set
 # CONFIG_X86_SPEEDSTEP_LIB is not set
 # CONFIG_X86_SPEEDSTEP_LIB is not set
 # CONFIG_X86_SPEEDSTEP_SMI is not set
 # CONFIG_X86_SPEEDSTEP_SMI is not set
+CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
 CONFIG_X86_THERMAL_VECTOR=y
 CONFIG_X86_THERMAL_VECTOR=y
-CONFIG_X86_TSC=y
 CONFIG_X86_UP_APIC=y
 CONFIG_X86_UP_APIC=y
-# CONFIG_X86_UP_IOAPIC is not set
-CONFIG_X86_USE_PPRO_CHECKSUM=y
+CONFIG_X86_UP_IOAPIC=y
 CONFIG_X86_VERBOSE_BOOTUP=y
 CONFIG_X86_VERBOSE_BOOTUP=y
 CONFIG_XZ_DEC_BCJ=y
 CONFIG_XZ_DEC_BCJ=y
 CONFIG_XZ_DEC_X86=y
 CONFIG_XZ_DEC_X86=y

+ 1 - 1
tools/e2fsprogs/Makefile

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=e2fsprogs
 PKG_NAME:=e2fsprogs
 PKG_VERSION:=1.43.3
 PKG_VERSION:=1.43.3
 PKG_HASH:=ce8ef1bbb0d4730f170167284fda156ac9d6bf18db2750eb94af619a81b19927
 PKG_HASH:=ce8ef1bbb0d4730f170167284fda156ac9d6bf18db2750eb94af619a81b19927
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/e2fsprogs
 PKG_SOURCE_URL:=@SF/e2fsprogs

+ 53 - 0
tools/e2fsprogs/patches/005-misc-rename-copy_file_range-to-copy_file_chunk.patch

@@ -0,0 +1,53 @@
+From 01551bdba16ab16512a01affe02ade32c41ede8a Mon Sep 17 00:00:00 2001
+From: Palmer Dabbelt <palmer@dabbelt.com>
+Date: Fri, 29 Dec 2017 10:19:51 -0800
+Subject: [PATCH] misc: rename copy_file_range to copy_file_chunk
+
+As of 2.27, glibc will have a copy_file_range library call to wrap the
+new copy_file_range system call.  This conflicts with the function in
+misc/create_inode.c, which this patch renames _copy_file_range.
+
+Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ misc/create_inode.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/misc/create_inode.c
++++ b/misc/create_inode.c
+@@ -392,7 +392,7 @@ static ssize_t my_pread(int fd, void *bu
+ }
+ #endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
+ 
+-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
++static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
+ 				 off_t start, off_t end, char *buf,
+ 				 char *zerobuf)
+ {
+@@ -466,7 +466,7 @@ static errcode_t try_lseek_copy(ext2_fil
+ 
+ 		data_blk = data & ~(fs->blocksize - 1);
+ 		hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
+-		err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
++		err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf,
+ 				      zerobuf);
+ 		if (err)
+ 			return err;
+@@ -516,7 +516,7 @@ static errcode_t try_fiemap_copy(ext2_fi
+ 		}
+ 		for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
+ 		     i++, ext++) {
+-			err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
++			err = copy_file_chunk(fs, fd, e2_file, ext->fe_logical,
+ 					      ext->fe_logical + ext->fe_length,
+ 					      buf, zerobuf);
+ 			if (err)
+@@ -569,7 +569,7 @@ static errcode_t copy_file(ext2_filsys f
+ 		goto out;
+ #endif
+ 
+-	err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
++	err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ 			      zerobuf);
+ out:
+ 	ext2fs_free_mem(&zerobuf);