From lede-commits at lists.infradead.org  Sat Apr  1 05:01:03 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 01 Apr 2017 08:01:03 -0400
Subject: [source]  odhcpd: update to git HEAD version (FS#635)
In-Reply-To: <20170401120103.4574.61099@git-01.infra.lede-project.org>
References: <20170401120103.4574.61099@git-01.infra.lede-project.org>
Message-ID: <mailman.21543.1491048090.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/15ca32795480ba1c81cd5fb1454b6013321ae632

commit 15ca32795480ba1c81cd5fb1454b6013321ae632
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Sat Apr 1 13:56:44 2017 +0200

    odhcpd: update to git HEAD version (FS#635)
    
    3d9f406 rework IPv6 dns address selection (FS#635)
    bc6c3ac ndp: keep an exact copy of IPv6 interface addresses
    6eb1e01 ndp: code cleanup
    eea7d03 rework IPv6 address dump logic
    24d21c7 ndp: add syslog debug tracing
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/odhcpd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index c11a3b8..322460c 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-02-28
-PKG_SOURCE_VERSION:=9eac2a8963415e6a74c2fc13a3c8d05cd0f81d4d
-PKG_MIRROR_HASH:=1f83a3e8722ad8145481ec976f7ce79b50d711f7cd0bcdad61c699b92ef4dca7
+PKG_SOURCE_DATE:=2017-03-29
+PKG_SOURCE_VERSION:=3d9f4067d56660a2c75ab2ce9b801ae1a4ff4cde
+PKG_MIRROR_HASH:=d4ffa35979dbba55a2ce1cc92085ed6a5fb4fa59c2da7412126db1b3a00599e8
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh at gmail.com>
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Sun Apr  2 00:11:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 02 Apr 2017 03:11:39 -0400
Subject: [source]  kernel: fix ubi auto attach logging
In-Reply-To: <20170402071139.18360.45224@git-01.infra.lede-project.org>
References: <20170402071139.18360.45224@git-01.infra.lede-project.org>
Message-ID: <mailman.21620.1491117127.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/97e6b67291036451683cb94ee6b91d07fdd10af5

commit 97e6b67291036451683cb94ee6b91d07fdd10af5
Author: John Crispin <john at phrozen.org>
AuthorDate: Sun Apr 2 07:50:41 2017 +0200

    kernel: fix ubi auto attach logging
    
    The patch is missing a trailing new line
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 ...490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
index 25ded53..52a208a 100644
--- a/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
+++ b/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
@@ -9,8 +9,10 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)
 
---- a/drivers/mtd/ubi/build.c
-+++ b/drivers/mtd/ubi/build.c
+Index: linux-4.9.17/drivers/mtd/ubi/build.c
+===================================================================
+--- linux-4.9.17.orig/drivers/mtd/ubi/build.c
++++ linux-4.9.17/drivers/mtd/ubi/build.c
 @@ -1212,6 +1212,49 @@ static struct mtd_info * __init open_mtd
  	return mtd;
  }
@@ -47,7 +49,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +		    mtd->type == MTD_DATAFLASH ||
 +		    mtd->type == MTD_MLCNANDFLASH) {
 +			mutex_lock(&ubi_devices_mutex);
-+			pr_notice("UBI: auto-attach mtd%d", mtd->index);
++			pr_notice("UBI: auto-attach mtd%d\n", mtd->index);
 +			err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0);
 +			mutex_unlock(&ubi_devices_mutex);
 +			if (err < 0) {


From lede-commits at lists.infradead.org  Sun Apr  2 05:04:22 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 02 Apr 2017 08:04:22 -0400
Subject: [source]  kernel: update kernel 4.4 to 4.4.59
In-Reply-To: <20170402120421.5212.89075@git-01.infra.lede-project.org>
References: <20170402120421.5212.89075@git-01.infra.lede-project.org>
Message-ID: <mailman.21641.1491134815.26984.lede-commits@lists.infradead.org>

hauke pushed a commit to source.git, branch master:
https://git.lede-project.org/c3778f2647aac67f019b38eb157c224b675d532f

commit c3778f2647aac67f019b38eb157c224b675d532f
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sun Apr 2 11:01:30 2017 +0200

    kernel: update kernel 4.4 to 4.4.59
    
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 include/kernel-version.mk                          |  4 +--
 ...ER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch |  2 +-
 .../patches-4.4/002-phy_drivers_backport.patch     |  2 +-
 .../811-pci_disable_usb_common_quirks.patch        |  2 +-
 .../patches-4.4/901-debloat_sock_diag.patch        |  2 +-
 .../generic/patches-4.4/902-debloat_proc.patch     |  2 +-
 ...-add-i210-i211-support-for-phy-read-write.patch | 12 ++++----
 ...-phy-read-write-functions-that-accept-phy.patch | 32 +++++++++++-----------
 .../0031-uvc-add-iPassion-iP2970-support.patch     |  2 +-
 9 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 61cc5fa..6f4a1a2 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -3,11 +3,11 @@
 LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.4 = .56
+LINUX_VERSION-4.4 = .59
 LINUX_VERSION-4.9 = .20
 
 LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
-LINUX_KERNEL_HASH-4.4.56 = 55181e24869e4b550ef756eecd1ab4f6774228c457f4830e9e779c6db4c2a2b6
+LINUX_KERNEL_HASH-4.4.59 = 64e9523c4c7fdaf391a16dd19541bb58e39943cb2151aa0c3d15b6aeaba996ca
 LINUX_KERNEL_HASH-4.9.20 = 48660806dd32fb8dcbcf5932291bf6cc7d29240070372230871e0f56fea81341
 
 ifdef KERNEL_PATCHVER
diff --git a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
index db2c29f..c1f565a 100644
--- a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
+++ b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
@@ -1,6 +1,6 @@
 --- a/drivers/pci/probe.c
 +++ b/drivers/pci/probe.c
-@@ -1966,7 +1966,8 @@ static void pcie_write_mrrs(struct pci_d
+@@ -1967,7 +1967,8 @@ static void pcie_write_mrrs(struct pci_d
  	/* In the "safe" case, do not configure the MRRS.  There appear to be
  	 * issues with setting MRRS to 0 on a number of devices.
  	 */
diff --git a/target/linux/generic/patches-4.4/002-phy_drivers_backport.patch b/target/linux/generic/patches-4.4/002-phy_drivers_backport.patch
index 9250891..8cf4eb3 100644
--- a/target/linux/generic/patches-4.4/002-phy_drivers_backport.patch
+++ b/target/linux/generic/patches-4.4/002-phy_drivers_backport.patch
@@ -223,7 +223,7 @@
  MODULE_LICENSE("GPL");
 --- a/drivers/net/phy/ar8327.c
 +++ b/drivers/net/phy/ar8327.c
-@@ -619,11 +619,11 @@ ar8327_hw_init(struct ar8xxx_priv *priv)
+@@ -627,11 +627,11 @@ ar8327_hw_init(struct ar8xxx_priv *priv)
  	if (!priv->chip_data)
  		return -ENOMEM;
  
diff --git a/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
index a4b93df..f22bf80 100644
--- a/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
+++ b/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
@@ -84,7 +84,7 @@
  #endif  /*  __LINUX_USB_PCI_QUIRKS_H  */
 --- a/include/linux/usb/hcd.h
 +++ b/include/linux/usb/hcd.h
-@@ -459,7 +459,14 @@ extern int usb_hcd_pci_probe(struct pci_
+@@ -460,7 +460,14 @@ extern int usb_hcd_pci_probe(struct pci_
  extern void usb_hcd_pci_remove(struct pci_dev *dev);
  extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
  
diff --git a/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch b/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
index 30b0641..fa9f37b 100644
--- a/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
+++ b/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
@@ -25,7 +25,7 @@
  obj-$(CONFIG_PROC_FS) += net-procfs.o
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -1469,9 +1469,11 @@ void sk_destruct(struct sock *sk)
+@@ -1474,9 +1474,11 @@ void sk_destruct(struct sock *sk)
  
  static void __sk_free(struct sock *sk)
  {
diff --git a/target/linux/generic/patches-4.4/902-debloat_proc.patch b/target/linux/generic/patches-4.4/902-debloat_proc.patch
index 3123a4b..2f54db5 100644
--- a/target/linux/generic/patches-4.4/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.4/902-debloat_proc.patch
@@ -173,7 +173,7 @@
  		goto err;
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -3036,6 +3036,8 @@ static __net_initdata struct pernet_oper
+@@ -3042,6 +3042,8 @@ static __net_initdata struct pernet_oper
  
  static int __init proto_init(void)
  {
diff --git a/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch b/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch
index 6bc23c5..2649f05 100644
--- a/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch
+++ b/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch
@@ -10,7 +10,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
 
 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c
 +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
-@@ -129,7 +129,7 @@ out:
+@@ -133,7 +133,7 @@ out:
  s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
  {
  	struct e1000_phy_info *phy = &hw->phy;
@@ -19,7 +19,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  	s32 ret_val = 0;
  
  	if (offset > MAX_PHY_REG_ADDRESS) {
-@@ -142,11 +142,25 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
+@@ -146,11 +146,25 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
  	 * Control register.  The MAC will take care of interfacing with the
  	 * PHY to retrieve the desired data.
  	 */
@@ -48,7 +48,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  
  	/* Poll the ready bit to see if the MDI read completed
  	 * Increasing the time out as testing showed failures with
-@@ -171,6 +185,18 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
+@@ -175,6 +189,18 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
  	*data = (u16) mdic;
  
  out:
@@ -67,7 +67,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  	return ret_val;
  }
  
-@@ -185,7 +211,7 @@ out:
+@@ -189,7 +215,7 @@ out:
  s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
  {
  	struct e1000_phy_info *phy = &hw->phy;
@@ -76,7 +76,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  	s32 ret_val = 0;
  
  	if (offset > MAX_PHY_REG_ADDRESS) {
-@@ -198,12 +224,27 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -202,12 +228,27 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  	 * Control register.  The MAC will take care of interfacing with the
  	 * PHY to retrieve the desired data.
  	 */
@@ -108,7 +108,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  
  	/* Poll the ready bit to see if the MDI read completed
  	 * Increasing the time out as testing showed failures with
-@@ -227,6 +268,18 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -231,6 +272,18 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  	}
  
  out:
diff --git a/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch b/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch
index 48f6d0d..45a4a8b 100644
--- a/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch
+++ b/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch
@@ -36,7 +36,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c
 +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
-@@ -126,9 +126,8 @@ out:
+@@ -130,9 +130,8 @@ out:
   *  Reads the MDI control regsiter in the PHY at offset and stores the
   *  information read to data.
   **/
@@ -47,7 +47,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  	u32 i, mdicnfg, mdic = 0;
  	s32 ret_val = 0;
  
-@@ -147,14 +146,14 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
+@@ -151,14 +150,14 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
  	case e1000_i211:
  		mdicnfg = rd32(E1000_MDICNFG);
  		mdicnfg &= ~(E1000_MDICNFG_PHY_MASK);
@@ -64,7 +64,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  			(E1000_MDIC_OP_READ));
  		break;
  	}
-@@ -208,9 +207,8 @@ out:
+@@ -212,9 +211,8 @@ out:
   *
   *  Writes data to MDI control register in the PHY at offset.
   **/
@@ -75,7 +75,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  	u32 i, mdicnfg, mdic = 0;
  	s32 ret_val = 0;
  
-@@ -229,7 +227,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -233,7 +231,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  		case e1000_i211:
  			mdicnfg = rd32(E1000_MDICNFG);
  			mdicnfg &= ~(E1000_MDICNFG_PHY_MASK);
@@ -84,7 +84,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  			wr32(E1000_MDICNFG, mdicnfg);
  			mdic = (((u32)data) |
  				(offset << E1000_MDIC_REG_SHIFT) |
-@@ -238,7 +236,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -242,7 +240,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  		default:
  			mdic = (((u32)data) |
  				(offset << E1000_MDIC_REG_SHIFT) |
@@ -93,7 +93,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  				(E1000_MDIC_OP_WRITE));
  			break;
  	}
-@@ -458,7 +456,7 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
+@@ -462,7 +460,7 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
  		goto out;
  
  	if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -102,7 +102,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  						 IGP01E1000_PHY_PAGE_SELECT,
  						 (u16)offset);
  		if (ret_val) {
-@@ -467,8 +465,8 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
+@@ -471,8 +469,8 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
  		}
  	}
  
@@ -113,7 +113,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  	hw->phy.ops.release(hw);
  
-@@ -497,7 +495,7 @@ s32 igb_write_phy_reg_igp(struct e1000_h
+@@ -501,7 +499,7 @@ s32 igb_write_phy_reg_igp(struct e1000_h
  		goto out;
  
  	if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -122,7 +122,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  						 IGP01E1000_PHY_PAGE_SELECT,
  						 (u16)offset);
  		if (ret_val) {
-@@ -506,8 +504,8 @@ s32 igb_write_phy_reg_igp(struct e1000_h
+@@ -510,8 +508,8 @@ s32 igb_write_phy_reg_igp(struct e1000_h
  		}
  	}
  
@@ -133,7 +133,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  	hw->phy.ops.release(hw);
  
-@@ -2547,8 +2545,9 @@ out:
+@@ -2551,8 +2549,9 @@ out:
  }
  
  /**
@@ -144,7 +144,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
   *  @offset: lower half is register offset to write to
   *     upper half is page to use.
   *  @data: data to write at register offset
-@@ -2556,7 +2555,7 @@ out:
+@@ -2560,7 +2559,7 @@ out:
   *  Acquires semaphore, if necessary, then writes the data to PHY register
   *  at the offset.  Release any acquired semaphores before exiting.
   **/
@@ -153,7 +153,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  {
  	s32 ret_val;
  	u16 page = offset >> GS40G_PAGE_SHIFT;
-@@ -2566,10 +2565,10 @@ s32 igb_write_phy_reg_gs40g(struct e1000
+@@ -2570,10 +2569,10 @@ s32 igb_write_phy_reg_gs40g(struct e1000
  	if (ret_val)
  		return ret_val;
  
@@ -166,7 +166,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  release:
  	hw->phy.ops.release(hw);
-@@ -2577,8 +2576,24 @@ release:
+@@ -2581,8 +2580,24 @@ release:
  }
  
  /**
@@ -192,7 +192,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
   *  @offset: lower half is register offset to read to
   *     upper half is page to use.
   *  @data: data to read at register offset
-@@ -2586,7 +2601,7 @@ release:
+@@ -2590,7 +2605,7 @@ release:
   *  Acquires semaphore, if necessary, then reads the data in the PHY register
   *  at the offset.  Release any acquired semaphores before exiting.
   **/
@@ -201,7 +201,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  {
  	s32 ret_val;
  	u16 page = offset >> GS40G_PAGE_SHIFT;
-@@ -2596,10 +2611,10 @@ s32 igb_read_phy_reg_gs40g(struct e1000_
+@@ -2600,10 +2615,10 @@ s32 igb_read_phy_reg_gs40g(struct e1000_
  	if (ret_val)
  		return ret_val;
  
@@ -214,7 +214,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  release:
  	hw->phy.ops.release(hw);
-@@ -2607,6 +2622,21 @@ release:
+@@ -2611,6 +2626,21 @@ release:
  }
  
  /**
diff --git a/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch
index c6a837d..cecca5b 100644
--- a/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch
+++ b/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch
@@ -13,7 +13,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 
 --- a/drivers/media/usb/uvc/uvc_driver.c
 +++ b/drivers/media/usb/uvc/uvc_driver.c
-@@ -2559,6 +2559,18 @@ static struct usb_device_id uvc_ids[] =
+@@ -2665,6 +2665,18 @@ static struct usb_device_id uvc_ids[] =
  	  .bInterfaceSubClass	= 1,
  	  .bInterfaceProtocol	= 0,
  	  .driver_info		= UVC_QUIRK_FORCE_Y8 },


From lede-commits at lists.infradead.org  Sun Apr  2 05:04:21 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 02 Apr 2017 08:04:21 -0400
Subject: [source]  kernel: update kernel 4.9 to 4.9.20
In-Reply-To: <20170402120421.5212.89075@git-01.infra.lede-project.org>
References: <20170402120421.5212.89075@git-01.infra.lede-project.org>
Message-ID: <mailman.21642.1491134816.26984.lede-commits@lists.infradead.org>

hauke pushed a commit to source.git, branch master:
https://git.lede-project.org/b26e34214c3d3aea9792c950d5e7fdb5bc5412b1

commit b26e34214c3d3aea9792c950d5e7fdb5bc5412b1
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sun Apr 2 10:29:55 2017 +0200

    kernel: update kernel 4.9 to 4.9.20
    
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 include/kernel-version.mk                          |  4 +-
 ...-a-mode-for-using-the-closed-firmware-for.patch |  2 +-
 ...-termination-of-the-initial-scan-for-bran.patch | 68 -------------------
 ...-support-for-rendering-with-ETC1-textures.patch |  4 +-
 ...-runtime-autosuspend-to-avoid-thrashing-V.patch | 78 ----------------------
 ...tach-mtd-device-named-ubi-or-data-on-boot.patch |  6 +-
 .../patches-4.9/901-debloat_sock_diag.patch        |  2 +-
 .../generic/patches-4.9/902-debloat_proc.patch     |  2 +-
 .../patches-4.9/0063-1-ipq806x-tsens-driver.patch  | 15 +----
 ...3-2-tsens-support-configurable-interrupts.patch | 54 ++++++---------
 ...om-use-scm_call-to-route-GPIO-irq-to-Apps.patch |  6 +-
 .../0004-MIPS-ralink-add-MT7621-pcie-driver.patch  | 10 +--
 12 files changed, 38 insertions(+), 213 deletions(-)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 587c25e..61cc5fa 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -4,11 +4,11 @@ LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
 LINUX_VERSION-4.4 = .56
-LINUX_VERSION-4.9 = .17
+LINUX_VERSION-4.9 = .20
 
 LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
 LINUX_KERNEL_HASH-4.4.56 = 55181e24869e4b550ef756eecd1ab4f6774228c457f4830e9e779c6db4c2a2b6
-LINUX_KERNEL_HASH-4.9.17 = 9095c16550ebae9cbe0979a706116d95fbd8d270c1068857c4a8788de0f9ac7f
+LINUX_KERNEL_HASH-4.9.20 = 48660806dd32fb8dcbcf5932291bf6cc7d29240070372230871e0f56fea81341
 
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
diff --git a/target/linux/brcm2708/patches-4.9/950-0105-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch b/target/linux/brcm2708/patches-4.9/950-0105-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch
index 789f001..f95d5aa 100644
--- a/target/linux/brcm2708/patches-4.9/950-0105-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch
+++ b/target/linux/brcm2708/patches-4.9/950-0105-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch
@@ -62,7 +62,7 @@ Signed-off-by: Eric Anholt <eric at anholt.net>
  
 --- a/drivers/gpu/drm/vc4/vc4_drv.c
 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
-@@ -292,6 +292,7 @@ static struct platform_driver *const com
+@@ -295,6 +295,7 @@ static struct platform_driver *const com
  	&vc4_dpi_driver,
  	&vc4_hvs_driver,
  	&vc4_crtc_driver,
diff --git a/target/linux/brcm2708/patches-4.9/950-0162-drm-vc4-Fix-termination-of-the-initial-scan-for-bran.patch b/target/linux/brcm2708/patches-4.9/950-0162-drm-vc4-Fix-termination-of-the-initial-scan-for-bran.patch
deleted file mode 100644
index 3326dca..0000000
--- a/target/linux/brcm2708/patches-4.9/950-0162-drm-vc4-Fix-termination-of-the-initial-scan-for-bran.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 57b0774967d7ea8d4173f82387100a84e4ba05d8 Mon Sep 17 00:00:00 2001
-From: Eric Anholt <eric at anholt.net>
-Date: Thu, 20 Oct 2016 16:48:12 -0700
-Subject: [PATCH] drm/vc4: Fix termination of the initial scan for branch
- targets.
-
-The loop is scanning until the original max_ip (size of the BO), but
-we want to not examine any code after the PROG_END's delay slots.
-There was a block trying to do that, except that we had some early
-continue statements if the signal wasn't a PROG_END or a BRANCH.
-
-The failure mode would be that a valid shader is rejected because some
-undefined memory after the PROG_END slots is parsed as a branch and
-the rest of its setup is illegal.  I haven't seen this in the wild,
-but valgrind was complaining when about this up in the userland
-simulator mode.
-
-Signed-off-by: Eric Anholt <eric at anholt.net>
-(cherry picked from commit 457e67a728696c4f8e6423c64e93def50530db9a)
----
- drivers/gpu/drm/vc4/vc4_validate_shaders.c | 19 ++++++++-----------
- 1 file changed, 8 insertions(+), 11 deletions(-)
-
---- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c
-+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
-@@ -608,9 +608,7 @@ static bool
- vc4_validate_branches(struct vc4_shader_validation_state *validation_state)
- {
- 	uint32_t max_branch_target = 0;
--	bool found_shader_end = false;
- 	int ip;
--	int shader_end_ip = 0;
- 	int last_branch = -2;
- 
- 	for (ip = 0; ip < validation_state->max_ip; ip++) {
-@@ -621,8 +619,13 @@ vc4_validate_branches(struct vc4_shader_
- 		uint32_t branch_target_ip;
- 
- 		if (sig == QPU_SIG_PROG_END) {
--			shader_end_ip = ip;
--			found_shader_end = true;
-+			/* There are two delay slots after program end is
-+			 * signaled that are still executed, then we're
-+			 * finished.  validation_state->max_ip is the
-+			 * instruction after the last valid instruction in the
-+			 * program.
-+			 */
-+			validation_state->max_ip = ip + 3;
- 			continue;
- 		}
- 
-@@ -676,15 +679,9 @@ vc4_validate_branches(struct vc4_shader_
- 		}
- 		set_bit(after_delay_ip, validation_state->branch_targets);
- 		max_branch_target = max(max_branch_target, after_delay_ip);
--
--		/* There are two delay slots after program end is signaled
--		 * that are still executed, then we're finished.
--		 */
--		if (found_shader_end && ip == shader_end_ip + 2)
--			break;
- 	}
- 
--	if (max_branch_target > shader_end_ip) {
-+	if (max_branch_target > validation_state->max_ip - 3) {
- 		DRM_ERROR("Branch landed after QPU_SIG_PROG_END");
- 		return false;
- 	}
diff --git a/target/linux/brcm2708/patches-4.9/950-0163-drm-vc4-Add-support-for-rendering-with-ETC1-textures.patch b/target/linux/brcm2708/patches-4.9/950-0163-drm-vc4-Add-support-for-rendering-with-ETC1-textures.patch
index 2b81578..bb472b3 100644
--- a/target/linux/brcm2708/patches-4.9/950-0163-drm-vc4-Add-support-for-rendering-with-ETC1-textures.patch
+++ b/target/linux/brcm2708/patches-4.9/950-0163-drm-vc4-Add-support-for-rendering-with-ETC1-textures.patch
@@ -19,8 +19,8 @@ Signed-off-by: Eric Anholt <eric at anholt.net>
 
 --- a/drivers/gpu/drm/vc4/vc4_drv.c
 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
-@@ -78,6 +78,7 @@ static int vc4_get_param_ioctl(struct dr
- 		pm_runtime_put(&vc4->v3d->pdev->dev);
+@@ -81,6 +81,7 @@ static int vc4_get_param_ioctl(struct dr
+ 		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
  		break;
  	case DRM_VC4_PARAM_SUPPORTS_BRANCHES:
 +	case DRM_VC4_PARAM_SUPPORTS_ETC1:
diff --git a/target/linux/brcm2708/patches-4.9/950-0164-drm-vc4-Use-runtime-autosuspend-to-avoid-thrashing-V.patch b/target/linux/brcm2708/patches-4.9/950-0164-drm-vc4-Use-runtime-autosuspend-to-avoid-thrashing-V.patch
deleted file mode 100644
index f6d738d..0000000
--- a/target/linux/brcm2708/patches-4.9/950-0164-drm-vc4-Use-runtime-autosuspend-to-avoid-thrashing-V.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 936dc8b00ccd5072c5d610b97199402275bfdf26 Mon Sep 17 00:00:00 2001
-From: Eric Anholt <eric at anholt.net>
-Date: Fri, 4 Nov 2016 15:58:38 -0700
-Subject: [PATCH] drm/vc4: Use runtime autosuspend to avoid thrashing V3D power
- state.
-
-The pm_runtime_put() we were using immediately released power on the
-device, which meant that we were generally turning the device off and
-on once per frame.  In many profiles I've looked at, that added up to
-about 1% of CPU time, but this could get worse in the case of frequent
-rendering and readback (as may happen in X rendering).  By keeping the
-device on until we've been idle for a couple of frames, we drop the
-overhead of runtime PM down to sub-.1%.
-
-Signed-off-by: Eric Anholt <eric at anholt.net>
-(cherry picked from commit 3a62234680d86efa0239665ed8a0e908f1aef147)
----
- drivers/gpu/drm/vc4/vc4_drv.c | 9 ++++++---
- drivers/gpu/drm/vc4/vc4_gem.c | 6 ++++--
- drivers/gpu/drm/vc4/vc4_v3d.c | 2 ++
- 3 files changed, 12 insertions(+), 5 deletions(-)
-
---- a/drivers/gpu/drm/vc4/vc4_drv.c
-+++ b/drivers/gpu/drm/vc4/vc4_drv.c
-@@ -61,21 +61,24 @@ static int vc4_get_param_ioctl(struct dr
- 		if (ret < 0)
- 			return ret;
- 		args->value = V3D_READ(V3D_IDENT0);
--		pm_runtime_put(&vc4->v3d->pdev->dev);
-+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
-+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
- 		break;
- 	case DRM_VC4_PARAM_V3D_IDENT1:
- 		ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
- 		if (ret < 0)
- 			return ret;
- 		args->value = V3D_READ(V3D_IDENT1);
--		pm_runtime_put(&vc4->v3d->pdev->dev);
-+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
-+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
- 		break;
- 	case DRM_VC4_PARAM_V3D_IDENT2:
- 		ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
- 		if (ret < 0)
- 			return ret;
- 		args->value = V3D_READ(V3D_IDENT2);
--		pm_runtime_put(&vc4->v3d->pdev->dev);
-+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
-+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
- 		break;
- 	case DRM_VC4_PARAM_SUPPORTS_BRANCHES:
- 	case DRM_VC4_PARAM_SUPPORTS_ETC1:
---- a/drivers/gpu/drm/vc4/vc4_gem.c
-+++ b/drivers/gpu/drm/vc4/vc4_gem.c
-@@ -711,8 +711,10 @@ vc4_complete_exec(struct drm_device *dev
- 	}
- 
- 	mutex_lock(&vc4->power_lock);
--	if (--vc4->power_refcount == 0)
--		pm_runtime_put(&vc4->v3d->pdev->dev);
-+	if (--vc4->power_refcount == 0) {
-+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
-+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
-+	}
- 	mutex_unlock(&vc4->power_lock);
- 
- 	kfree(exec);
---- a/drivers/gpu/drm/vc4/vc4_v3d.c
-+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
-@@ -222,6 +222,8 @@ static int vc4_v3d_bind(struct device *d
- 		return ret;
- 	}
- 
-+	pm_runtime_use_autosuspend(dev);
-+	pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */
- 	pm_runtime_enable(dev);
- 
- 	return 0;
diff --git a/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
index 52a208a..e4f9237 100644
--- a/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
+++ b/target/linux/generic/patches-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
@@ -9,10 +9,8 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)
 
-Index: linux-4.9.17/drivers/mtd/ubi/build.c
-===================================================================
---- linux-4.9.17.orig/drivers/mtd/ubi/build.c
-+++ linux-4.9.17/drivers/mtd/ubi/build.c
+--- a/drivers/mtd/ubi/build.c
++++ b/drivers/mtd/ubi/build.c
 @@ -1212,6 +1212,49 @@ static struct mtd_info * __init open_mtd
  	return mtd;
  }
diff --git a/target/linux/generic/patches-4.9/901-debloat_sock_diag.patch b/target/linux/generic/patches-4.9/901-debloat_sock_diag.patch
index dec8d2e..237bcea 100644
--- a/target/linux/generic/patches-4.9/901-debloat_sock_diag.patch
+++ b/target/linux/generic/patches-4.9/901-debloat_sock_diag.patch
@@ -25,7 +25,7 @@
  obj-$(CONFIG_PROC_FS) += net-procfs.o
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -1455,9 +1455,11 @@ void sk_destruct(struct sock *sk)
+@@ -1460,9 +1460,11 @@ void sk_destruct(struct sock *sk)
  
  static void __sk_free(struct sock *sk)
  {
diff --git a/target/linux/generic/patches-4.9/902-debloat_proc.patch b/target/linux/generic/patches-4.9/902-debloat_proc.patch
index aa85c6b..37ce4c2 100644
--- a/target/linux/generic/patches-4.9/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.9/902-debloat_proc.patch
@@ -173,7 +173,7 @@
  		goto err;
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -3083,6 +3083,8 @@ static __net_initdata struct pernet_oper
+@@ -3089,6 +3089,8 @@ static __net_initdata struct pernet_oper
  
  static int __init proto_init(void)
  {
diff --git a/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch b/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch
index 691f32c..685b0c3 100644
--- a/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch
+++ b/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch
@@ -32,8 +32,6 @@ Signed-off-by: Rajith Cherian <rajith at codeaurora.org>
  5 files changed, 558 insertions(+), 2 deletions(-)
  create mode 100644 drivers/thermal/qcom/tsens-ipq8064.c
 
-diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
-index 292ed89..f4a76f6 100644
 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
 +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
 @@ -5,6 +5,7 @@ Required properties:
@@ -44,8 +42,6 @@ index 292ed89..f4a76f6 100644
  
  - reg: Address range of the thermal registers
  - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
-diff --git a/drivers/thermal/qcom/Makefile b/drivers/thermal/qcom/Makefile
-index 2cc2193..cc07cf4 100644
 --- a/drivers/thermal/qcom/Makefile
 +++ b/drivers/thermal/qcom/Makefile
 @@ -1,2 +1,3 @@
@@ -53,9 +49,6 @@ index 2cc2193..cc07cf4 100644
 -qcom_tsens-y			+= tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o
 +qcom_tsens-y			+= tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o \
 +				tsens-ipq8064.o
-diff --git a/drivers/thermal/qcom/tsens-ipq8064.c b/drivers/thermal/qcom/tsens-ipq8064.c
-new file mode 100644
-index 0000000..c52888f
 --- /dev/null
 +++ b/drivers/thermal/qcom/tsens-ipq8064.c
 @@ -0,0 +1,551 @@
@@ -610,11 +603,9 @@ index 0000000..c52888f
 +	.num_sensors	= 11,
 +	.ops		= &ops_ipq8064,
 +};
-diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
-index 3f9fe6a..2d25593 100644
 --- a/drivers/thermal/qcom/tsens.c
 +++ b/drivers/thermal/qcom/tsens.c
-@@ -72,6 +72,9 @@ static const struct of_device_id tsens_table[] = {
+@@ -72,6 +72,9 @@ static const struct of_device_id tsens_t
  	}, {
  		.compatible = "qcom,msm8996-tsens",
  		.data = &data_8996,
@@ -624,11 +615,9 @@ index 3f9fe6a..2d25593 100644
  	},
  	{}
  };
-diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
-index 911c197..31279a2 100644
 --- a/drivers/thermal/qcom/tsens.h
 +++ b/drivers/thermal/qcom/tsens.h
-@@ -89,6 +89,6 @@ void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32);
+@@ -89,6 +89,6 @@ void compute_intercept_slope(struct tsen
  int init_common(struct tsens_device *);
  int get_temp_common(struct tsens_device *, int, int *);
  
diff --git a/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch b/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch
index de9a8f8..ca98970 100644
--- a/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch
+++ b/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch
@@ -21,8 +21,6 @@ Signed-off-by: Rajith Cherian <rajith at codeaurora.org>
  include/linux/thermal.h                            | 14 +++++
  6 files changed, 162 insertions(+), 17 deletions(-)
 
-diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
-index f4a76f6..7c0a6a7 100644
 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
 +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
 @@ -12,11 +12,15 @@ Required properties:
@@ -41,11 +39,9 @@ index f4a76f6..7c0a6a7 100644
 +		interrupts = <0 178 0>;
  		#thermal-sensor-cells = <1>;
  	};
-diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
-index d04ec3b..d83697e 100644
 --- a/drivers/thermal/of-thermal.c
 +++ b/drivers/thermal/of-thermal.c
-@@ -95,7 +95,7 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,
+@@ -95,7 +95,7 @@ static int of_thermal_get_temp(struct th
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -54,7 +50,7 @@ index d04ec3b..d83697e 100644
  		return -EINVAL;
  
  	return data->ops->get_temp(data->sensor_data, temp);
-@@ -106,7 +106,8 @@ static int of_thermal_set_trips(struct thermal_zone_device *tz,
+@@ -106,7 +106,8 @@ static int of_thermal_set_trips(struct t
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -64,7 +60,7 @@ index d04ec3b..d83697e 100644
  		return -EINVAL;
  
  	return data->ops->set_trips(data->sensor_data, low, high);
-@@ -192,6 +193,9 @@ static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
+@@ -192,6 +193,9 @@ static int of_thermal_set_emul_temp(stru
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -74,7 +70,7 @@ index d04ec3b..d83697e 100644
  	return data->ops->set_emul_temp(data->sensor_data, temp);
  }
  
-@@ -200,7 +204,7 @@ static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip,
+@@ -200,7 +204,7 @@ static int of_thermal_get_trend(struct t
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -83,7 +79,7 @@ index d04ec3b..d83697e 100644
  		return -EINVAL;
  
  	return data->ops->get_trend(data->sensor_data, trip, trend);
-@@ -286,7 +290,9 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz,
+@@ -286,7 +290,9 @@ static int of_thermal_set_mode(struct th
  	mutex_unlock(&tz->lock);
  
  	data->mode = mode;
@@ -94,7 +90,7 @@ index d04ec3b..d83697e 100644
  
  	return 0;
  }
-@@ -296,7 +302,8 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip,
+@@ -296,7 +302,8 @@ static int of_thermal_get_trip_type(stru
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -104,7 +100,7 @@ index d04ec3b..d83697e 100644
  		return -EDOM;
  
  	*type = data->trips[trip].type;
-@@ -304,12 +311,39 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip,
+@@ -304,12 +311,39 @@ static int of_thermal_get_trip_type(stru
  	return 0;
  }
  
@@ -145,7 +141,7 @@ index d04ec3b..d83697e 100644
  		return -EDOM;
  
  	*temp = data->trips[trip].temperature;
-@@ -322,7 +356,8 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
+@@ -322,7 +356,8 @@ static int of_thermal_set_trip_temp(stru
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -155,7 +151,7 @@ index d04ec3b..d83697e 100644
  		return -EDOM;
  
  	if (data->ops->set_trip_temp) {
-@@ -344,7 +379,8 @@ static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
+@@ -344,7 +379,8 @@ static int of_thermal_get_trip_hyst(stru
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -165,7 +161,7 @@ index d04ec3b..d83697e 100644
  		return -EDOM;
  
  	*hyst = data->trips[trip].hysteresis;
-@@ -357,7 +393,8 @@ static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
+@@ -357,7 +393,8 @@ static int of_thermal_set_trip_hyst(stru
  {
  	struct __thermal_zone *data = tz->devdata;
  
@@ -175,7 +171,7 @@ index d04ec3b..d83697e 100644
  		return -EDOM;
  
  	/* thermal framework should take care of data->mask & (1 << trip) */
-@@ -432,6 +469,9 @@ thermal_zone_of_add_sensor(struct device_node *zone,
+@@ -432,6 +469,9 @@ thermal_zone_of_add_sensor(struct device
  	if (ops->set_emul_temp)
  		tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
  
@@ -185,7 +181,7 @@ index d04ec3b..d83697e 100644
  	mutex_unlock(&tzd->lock);
  
  	return tzd;
-@@ -726,7 +766,10 @@ static const char * const trip_types[] = {
+@@ -726,7 +766,10 @@ static const char * const trip_types[] =
  	[THERMAL_TRIP_ACTIVE]	= "active",
  	[THERMAL_TRIP_PASSIVE]	= "passive",
  	[THERMAL_TRIP_HOT]	= "hot",
@@ -197,11 +193,9 @@ index d04ec3b..d83697e 100644
  };
  
  /**
-diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
-index 2d25593..ac68af3 100644
 --- a/drivers/thermal/qcom/tsens.c
 +++ b/drivers/thermal/qcom/tsens.c
-@@ -31,7 +31,7 @@ static int tsens_get_temp(void *data, int *temp)
+@@ -31,7 +31,7 @@ static int tsens_get_temp(void *data, in
  
  static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
  {
@@ -210,7 +204,7 @@ index 2d25593..ac68af3 100644
  	struct tsens_device *tmdev = s->tmdev;
  
  	if (tmdev->ops->get_trend)
-@@ -40,9 +40,10 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
+@@ -40,9 +40,10 @@ static int tsens_get_trend(void *p, int
  	return -ENOTSUPP;
  }
  
@@ -223,7 +217,7 @@ index 2d25593..ac68af3 100644
  
  	if (tmdev->ops && tmdev->ops->suspend)
  		return tmdev->ops->suspend(tmdev);
-@@ -50,9 +51,10 @@ static int  __maybe_unused tsens_suspend(struct device *dev)
+@@ -50,9 +51,10 @@ static int  __maybe_unused tsens_suspend
  	return 0;
  }
  
@@ -236,7 +230,7 @@ index 2d25593..ac68af3 100644
  
  	if (tmdev->ops && tmdev->ops->resume)
  		return tmdev->ops->resume(tmdev);
-@@ -60,6 +62,30 @@ static int __maybe_unused tsens_resume(struct device *dev)
+@@ -60,6 +62,30 @@ static int __maybe_unused tsens_resume(s
  	return 0;
  }
  
@@ -276,7 +270,7 @@ index 2d25593..ac68af3 100644
  };
  
  static int tsens_register(struct tsens_device *tmdev)
-@@ -131,7 +159,7 @@ static int tsens_probe(struct platform_device *pdev)
+@@ -131,7 +159,7 @@ static int tsens_probe(struct platform_d
  	if (id)
  		data = id->data;
  	else
@@ -285,7 +279,7 @@ index 2d25593..ac68af3 100644
  
  	if (data->num_sensors <= 0) {
  		dev_err(dev, "invalid number of sensors\n");
-@@ -146,6 +174,9 @@ static int tsens_probe(struct platform_device *pdev)
+@@ -146,6 +174,9 @@ static int tsens_probe(struct platform_d
  	tmdev->dev = dev;
  	tmdev->num_sensors = data->num_sensors;
  	tmdev->ops = data->ops;
@@ -295,8 +289,6 @@ index 2d25593..ac68af3 100644
  	for (i = 0;  i < tmdev->num_sensors; i++) {
  		if (data->hw_ids)
  			tmdev->sensor[i].hw_id = data->hw_ids[i];
-diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
-index 31279a2..54bbdc0 100644
 --- a/drivers/thermal/qcom/tsens.h
 +++ b/drivers/thermal/qcom/tsens.h
 @@ -24,9 +24,12 @@ struct tsens_device;
@@ -346,11 +338,9 @@ index 31279a2..54bbdc0 100644
  	struct tsens_sensor		sensor[0];
  };
  
-diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
-index 226b0b4..20bd624 100644
 --- a/drivers/thermal/thermal_core.c
 +++ b/drivers/thermal/thermal_core.c
-@@ -732,12 +732,48 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr,
+@@ -732,12 +732,48 @@ trip_point_type_show(struct device *dev,
  		return sprintf(buf, "passive\n");
  	case THERMAL_TRIP_ACTIVE:
  		return sprintf(buf, "active\n");
@@ -399,7 +389,7 @@ index 226b0b4..20bd624 100644
  trip_point_temp_store(struct device *dev, struct device_attribute *attr,
  		     const char *buf, size_t count)
  {
-@@ -1321,7 +1357,7 @@ thermal_cooling_device_weight_store(struct device *dev,
+@@ -1321,7 +1357,7 @@ thermal_cooling_device_weight_store(stru
   */
  int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
  				     int trip,
@@ -408,7 +398,7 @@ index 226b0b4..20bd624 100644
  				     unsigned long upper, unsigned long lower,
  				     unsigned int weight)
  {
-@@ -1772,6 +1808,12 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
+@@ -1772,6 +1808,12 @@ static int create_trip_attrs(struct ther
  		tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO;
  		tz->trip_type_attrs[indx].attr.show = trip_point_type_show;
  
@@ -421,8 +411,6 @@ index 226b0b4..20bd624 100644
  		device_create_file(&tz->device,
  				   &tz->trip_type_attrs[indx].attr);
  
-diff --git a/include/linux/thermal.h b/include/linux/thermal.h
-index 511182a..510a087 100644
 --- a/include/linux/thermal.h
 +++ b/include/linux/thermal.h
 @@ -77,11 +77,19 @@ enum thermal_device_mode {
diff --git a/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch b/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch
index 2eac44d..40656d1 100644
--- a/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch
+++ b/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch
@@ -105,7 +105,7 @@ Signed-off-by: Ajay Kishore <akisho at codeaurora.org>
  #include "../core.h"
  #include "../pinconf.h"
  #include "pinctrl-msm.h"
-@@ -639,6 +640,9 @@ static int msm_gpio_irq_set_type(struct
+@@ -635,6 +636,9 @@ static int msm_gpio_irq_set_type(struct
  	const struct msm_pingroup *g;
  	unsigned long flags;
  	u32 val;
@@ -115,7 +115,7 @@ Signed-off-by: Ajay Kishore <akisho at codeaurora.org>
  
  	g = &pctrl->soc->groups[d->hwirq];
  
-@@ -652,11 +656,30 @@ static int msm_gpio_irq_set_type(struct
+@@ -648,11 +652,30 @@ static int msm_gpio_irq_set_type(struct
  	else
  		clear_bit(d->hwirq, pctrl->dual_edge_irqs);
  
@@ -150,7 +150,7 @@ Signed-off-by: Ajay Kishore <akisho at codeaurora.org>
  
  	/* Update configuration for gpio.
  	 * RAW_STATUS_EN is left on for all gpio irqs. Due to the
-@@ -930,4 +953,3 @@ int msm_pinctrl_remove(struct platform_d
+@@ -926,4 +949,3 @@ int msm_pinctrl_remove(struct platform_d
  	return 0;
  }
  EXPORT_SYMBOL(msm_pinctrl_remove);
diff --git a/target/linux/ramips/patches-4.9/0004-MIPS-ralink-add-MT7621-pcie-driver.patch b/target/linux/ramips/patches-4.9/0004-MIPS-ralink-add-MT7621-pcie-driver.patch
index 9bc3a3e..da5239a 100644
--- a/target/linux/ramips/patches-4.9/0004-MIPS-ralink-add-MT7621-pcie-driver.patch
+++ b/target/linux/ramips/patches-4.9/0004-MIPS-ralink-add-MT7621-pcie-driver.patch
@@ -10,10 +10,8 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
  2 files changed, 814 insertions(+)
  create mode 100644 arch/mips/pci/pci-mt7621.c
 
-Index: linux-4.9.14/arch/mips/pci/Makefile
-===================================================================
---- linux-4.9.14.orig/arch/mips/pci/Makefile
-+++ linux-4.9.14/arch/mips/pci/Makefile
+--- a/arch/mips/pci/Makefile
++++ b/arch/mips/pci/Makefile
 @@ -46,6 +46,7 @@ obj-$(CONFIG_SNI_RM)		+= fixup-sni.o ops
  obj-$(CONFIG_LANTIQ)		+= fixup-lantiq.o
  obj-$(CONFIG_PCI_LANTIQ)	+= pci-lantiq.o ops-lantiq.o
@@ -22,10 +20,8 @@ Index: linux-4.9.14/arch/mips/pci/Makefile
  obj-$(CONFIG_SOC_RT288X)	+= pci-rt2880.o
  obj-$(CONFIG_SOC_RT3883)	+= pci-rt3883.o
  obj-$(CONFIG_TANBAC_TB0219)	+= fixup-tb0219.o
-Index: linux-4.9.14/arch/mips/pci/pci-mt7621.c
-===================================================================
 --- /dev/null
-+++ linux-4.9.14/arch/mips/pci/pci-mt7621.c
++++ b/arch/mips/pci/pci-mt7621.c
 @@ -0,0 +1,836 @@
 +/**************************************************************************
 + *


From lede-commits at lists.infradead.org  Sun Apr  2 05:50:56 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 02 Apr 2017 08:50:56 -0400
Subject: [source]  kernel: update kernel 4.4 to 4.4.59
In-Reply-To: <20170402125056.12270.14251@git-01.infra.lede-project.org>
References: <20170402125056.12270.14251@git-01.infra.lede-project.org>
Message-ID: <mailman.21648.1491137490.26984.lede-commits@lists.infradead.org>

hauke pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/0dcc4d239da78bc20b091d50c097c386e0e61902

commit 0dcc4d239da78bc20b091d50c097c386e0e61902
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sun Apr 2 11:53:42 2017 +0200

    kernel: update kernel 4.4 to 4.4.59
    
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 include/kernel-version.mk                          |  4 +-
 .../patches-4.4/910-unaligned_access_hacks.patch   |  4 +-
 .../patches-4.4/0551-kbuild-add-fno-PIE.patch      |  7 +--
 ...d-Steal-gcc-s-pie-from-the-very-beginning.patch |  7 +--
 ...RM-dts-Restore-dtbs_install-functionality.patch |  5 --
 ...4-BCM270X_DT-Update-UART0-clock-frequency.patch |  5 --
 ...M2835-v4l2-Fix-a-conformance-test-failure.patch |  7 +--
 ...M270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch | 17 ++-----
 ...i-Delete-vestigial-gpio_in_pull-parameter.patch |  5 --
 .../0558-BCM270X_DT-Add-i2c-sensor-overlay.patch   | 14 +-----
 ...-overlays-overlay.dtb-overlays-.dtbo-1752.patch |  5 --
 ...dragonrise-fix-HID-Descriptor-for-0x0006-.patch |  7 +--
 ...rng-Avoid-initialising-if-already-enabled.patch |  7 +--
 .../0562-Pisound-dynamic-overlay-1760.patch        |  9 +---
 ...-for-Silicon-Labs-Si7013-20-21-humidity-t.patch | 39 +++++++---------
 .../0564-pisound-improvements-1778.patch           | 19 +++-----
 ..._name-properties-to-JustBoom-drivers-1787.patch | 11 +----
 ...-Changes-for-allowing-asymmetric-sample-f.patch | 11 ++---
 ...7-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch | 10 ----
 ...move-ppos-increment-in-configfs_write_bin.patch |  7 +--
 .../0569-config-Add-CONFIG_DM_CACHE.patch          |  7 ---
 .../0570-BCM270X_DT-Add-spi0-cs-overlay.patch      | 10 ----
 ...835-i2s-Changes-for-allowing-asymmetric-s.patch | 11 ++---
 .../0572-BCM270X_DT-Enable-UART0-on-CM3.patch      |  5 --
 ...dd-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch |  7 ---
 ...-USB-config-options-for-bcm2709_defconfig.patch |  5 --
 ..._DT-Add-reference-to-audio_pins-to-CM-dtb.patch |  5 --
 .../0576-Add-overlay-for-mcp3008-adc-1818.patch    | 12 +----
 ...Restore-IO-APIC-irq_chip-retrigger-callba.patch |  9 +---
 .../0578-config-add-slcan-kernel-module.patch      |  7 ---
 ...-sending-of-page-flip-completion-events-i.patch |  7 +--
 ...clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch |  7 +--
 ...port-rate-change-propagation-on-bcm2835-c.patch |  9 +---
 ...ow-rate-change-propagation-to-PLLH_AUX-on.patch |  7 +--
 ...-maybe-uninitialized-warning-in-bcm2835_c.patch |  7 +--
 ...-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch | 33 ++++++--------
 ...m-Remove-unnecessary-dev_info-output-1830.patch |  7 +--
 ...fill-user-BO-creation-requests-from-the-k.patch |  7 +--
 ...-OOPSes-from-trying-to-cache-a-partially-.patch |  7 +--
 ...ify-at-boot-that-CMA-doesn-t-cross-a-256M.patch | 13 +-----
 .../patches-4.4/0589-Update-vfpmodule.c.patch      | 13 ++----
 ...-summarize-urb-actual_length-for-isochron.patch |  7 +--
 .../0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch  |  8 ----
 ...BCM47XX-Add-Luxul-devices-to-the-database.patch |  4 +-
 ...7xx-Fix-button-inversion-for-Asus-WL-500W.patch | 38 ----------------
 ...ER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch |  2 +-
 .../generic/patches-4.4/020-bcma-from-4.5.patch    |  4 +-
 .../generic/patches-4.4/025-bcma-from-4.11.patch   | 20 --------
 ...2-MIPS-Stack-unwinding-while-on-IRQ-stack.patch |  2 +-
 ...-bridge_allow_receiption_on_disabled_port.patch |  4 +-
 .../patches-4.4/630-packet_socket_type.patch       |  6 +--
 .../patches-4.4/640-bridge_no_eap_forward.patch    |  2 +-
 .../patches-4.4/641-bridge_always_accept_eap.patch |  2 +-
 .../patches-4.4/642-bridge_port_isolate.patch      |  2 +-
 .../patches-4.4/653-disable_netlink_trim.patch     |  5 +-
 ...80-NET-skip-GRO-for-foreign-MAC-addresses.patch | 10 ++--
 .../generic/patches-4.4/721-phy_packets.patch      |  2 +-
 .../811-pci_disable_usb_common_quirks.patch        |  2 +-
 .../patches-4.4/901-debloat_sock_diag.patch        |  4 +-
 .../generic/patches-4.4/902-debloat_proc.patch     |  2 +-
 ...-add-i210-i211-support-for-phy-read-write.patch | 12 ++---
 ...-phy-read-write-functions-that-accept-phy.patch | 32 ++++++-------
 ...-Lantiq-Keep-ethernet-enabled-during-boot.patch | 53 ----------------------
 ...0010-MIPS-ralink-Add-a-few-missing-clocks.patch |  4 +-
 .../0031-uvc-add-iPassion-iP2970-support.patch     |  2 +-
 .../ramips/patches-4.4/0068-fix-ralink-prom.c      | 30 ------------
 ...ralink-Fix-invalid-assignment-of-SoC-type.patch |  2 +-
 .../0720-arch-mips-ralink-add-i2c-clocks.patch     |  6 +--
 68 files changed, 135 insertions(+), 527 deletions(-)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 26c0bb8..757d9eb 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -3,10 +3,10 @@
 LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.4 = .52
+LINUX_VERSION-4.4 = .59
 
 LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
-LINUX_KERNEL_HASH-4.4.52 = e8d2ddaece73e1a34e045bbdcdcc1383f658e24537797f8d8e0dd520cf1b1f06
+LINUX_KERNEL_HASH-4.4.59 = 64e9523c4c7fdaf391a16dd19541bb58e39943cb2151aa0c3d15b6aeaba996ca
 
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
diff --git a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
index 1e68cf7..e7df08b 100644
--- a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
+++ b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
@@ -42,7 +42,7 @@
  	} while (word != stop);
  
  	return csum_fold(csum);
-@@ -212,73 +216,6 @@ static inline __sum16 ip_compute_csum(co
+@@ -214,73 +218,6 @@ static inline __sum16 ip_compute_csum(co
  	return csum_fold(csum_partial(buff, len, 0));
  }
  
@@ -214,7 +214,7 @@
  #include <linux/uaccess.h>
  #include <linux/ipv6.h>
  #include <linux/icmpv6.h>
-@@ -779,10 +780,10 @@ static void tcp_v6_send_response(const s
+@@ -781,10 +782,10 @@ static void tcp_v6_send_response(const s
  	topt = (__be32 *)(t1 + 1);
  
  	if (tsecr) {
diff --git a/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch b/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch
index 0d2c1a5..f76490b 100644
--- a/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch
+++ b/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch
@@ -27,8 +27,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
  Makefile | 2 ++
  1 file changed, 2 insertions(+)
 
-diff --git a/Makefile b/Makefile
-index 1099371..c17219e 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -619,6 +619,8 @@ include arch/$(SRCARCH)/Makefile
@@ -39,7 +37,4 @@ index 1099371..c17219e 100644
 +KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
- KBUILD_CFLAGS	+= -Os
--- 
-2.1.4
-
+ KBUILD_CFLAGS	+= -Os $(EXTRA_OPTIMIZATION)
diff --git a/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch b/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch
index 2361c75..ca8ff3d 100644
--- a/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch
+++ b/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch
@@ -36,8 +36,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
  Makefile | 2 --
  1 file changed, 2 deletions(-)
 
-diff --git a/Makefile b/Makefile
-index c17219e..1099371 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -619,8 +619,6 @@ include arch/$(SRCARCH)/Makefile
@@ -48,7 +46,4 @@ index c17219e..1099371 100644
 -KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
- KBUILD_CFLAGS	+= -Os
--- 
-2.1.4
-
+ KBUILD_CFLAGS	+= -Os $(EXTRA_OPTIMIZATION)
diff --git a/target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch b/target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch
index 2fe4b16..f794172 100644
--- a/target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch
+++ b/target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch
@@ -8,8 +8,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  arch/arm/boot/dts/Makefile | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index cbfc8ba..14a491c 100644
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
 @@ -806,10 +806,11 @@ dtstree		:= $(srctree)/$(src)
@@ -25,6 +23,3 @@ index cbfc8ba..14a491c 100644
  	DTC_FLAGS ?= -@ -H epapr
 +	dts-dirs += overlays
  endif
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch b/target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch
index 3d3f911..7379963 100644
--- a/target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch
+++ b/target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch
@@ -16,8 +16,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  arch/arm/boot/dts/bcm2708_common.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi
-index c449493..a9fd97e 100644
 --- a/arch/arm/boot/dts/bcm2708_common.dtsi
 +++ b/arch/arm/boot/dts/bcm2708_common.dtsi
 @@ -456,7 +456,7 @@
@@ -29,6 +27,3 @@ index c449493..a9fd97e 100644
  		};
  
  		clk_apb_p: clock at 3 {
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch b/target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
index 68dca0c..8397e22 100644
--- a/target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
+++ b/target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
@@ -13,11 +13,9 @@ Format ioctls:
  drivers/media/platform/bcm2835/bcm2835-camera.c | 1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c
-index a2cfff9..23ba458 100644
 --- a/drivers/media/platform/bcm2835/bcm2835-camera.c
 +++ b/drivers/media/platform/bcm2835/bcm2835-camera.c
-@@ -1397,6 +1397,7 @@ static int vidioc_s_parm(struct file *file, void *priv,
+@@ -1397,6 +1397,7 @@ static int vidioc_s_parm(struct file *fi
  	dev->capture.timeperframe = tpf;
  	parm->parm.capture.timeperframe = tpf;
  	parm->parm.capture.readbuffers  = 1;
@@ -25,6 +23,3 @@ index a2cfff9..23ba458 100644
  
  	fps_param.num = 0;	/* Select variable fps, and then use
  				 * FPS_RANGE to select the actual limits.
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch b/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch
index 8aea6e4..088eb09 100644
--- a/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch
+++ b/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch
@@ -11,8 +11,6 @@ Works on SPI2 for compute module
  3 files changed, 57 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
 
-diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
-index 57d60a4..c4186aa 100644
 --- a/arch/arm/boot/dts/overlays/Makefile
 +++ b/arch/arm/boot/dts/overlays/Makefile
 @@ -28,6 +28,7 @@ dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo
@@ -23,11 +21,9 @@ index 57d60a4..c4186aa 100644
  dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index 35c0cec1..4a77ee6 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
-@@ -344,13 +344,21 @@ Params: dr_mode                 Dual role mode: "host", "peripheral" or "otg"
+@@ -344,12 +344,20 @@ Params: dr_mode                 Dual rol
  
  
  Name:   enc28j60
@@ -38,7 +34,7 @@ index 35c0cec1..4a77ee6 100644
  
          speed                   SPI bus speed (default 12000000)
  
- 
++
 +Name:   enc28j60-spi2
 +Info:   Overlay for the Microchip ENC28J60 Ethernet Controller on SPI2
 +Load:   dtoverlay=enc28j60-spi2,<param>=<val>
@@ -46,13 +42,9 @@ index 35c0cec1..4a77ee6 100644
 +
 +        speed                   SPI bus speed (default 12000000)
 +
-+
+ 
  Name:   gpio-ir
  Info:   Use GPIO pin as rc-core style infrared receiver input. The rc-core-
-         based gpio_ir_recv driver maps received keys directly to a
-diff --git a/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
-new file mode 100644
-index 0000000..946c9d2
 --- /dev/null
 +++ b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
 @@ -0,0 +1,47 @@
@@ -103,6 +95,3 @@ index 0000000..946c9d2
 +		speed   = <&eth1>, "spi-max-frequency:0";
 +	};
 +};
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch b/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch
index 9ebcc22..5a80200 100644
--- a/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch
+++ b/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch
@@ -14,8 +14,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  drivers/staging/media/lirc/lirc_rpi.c | 6 ------
  1 file changed, 6 deletions(-)
 
-diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c
-index 6132896..ebbf0d6 100644
 --- a/drivers/staging/media/lirc/lirc_rpi.c
 +++ b/drivers/staging/media/lirc/lirc_rpi.c
 @@ -64,8 +64,6 @@
@@ -38,6 +36,3 @@ index 6132896..ebbf0d6 100644
  module_param(sense, int, S_IRUGO);
  MODULE_PARM_DESC(sense, "Override autodetection of IR receiver circuit"
  		 " (0 = active high, 1 = active low )");
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch b/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch
index 2248fe8..3a2f3e6 100644
--- a/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch
+++ b/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch
@@ -15,8 +15,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  3 files changed, 45 insertions(+), 2 deletions(-)
  create mode 100644 arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
 
-diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
-index c4186aa..bc7f4a9 100644
 --- a/arch/arm/boot/dts/overlays/Makefile
 +++ b/arch/arm/boot/dts/overlays/Makefile
 @@ -42,6 +42,7 @@ dtbo-$(RPI_DT_OVERLAYS) += i2c-gpio.dtbo
@@ -27,11 +25,9 @@ index c4186aa..bc7f4a9 100644
  dtbo-$(RPI_DT_OVERLAYS) += i2c0-bcm2708.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += i2c1-bcm2708.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += i2s-gpio28-31.dtbo
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index 4a77ee6..80ea3de 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
-@@ -283,8 +283,7 @@ Params: swap_lr                 Reverse the channel allocation, which will also
+@@ -283,8 +283,7 @@ Params: swap_lr                 Reverse
  
  
  Name:   bmp085_i2c-sensor
@@ -41,7 +37,7 @@ index 4a77ee6..80ea3de 100644
  Load:   dtoverlay=bmp085_i2c-sensor
  Params: <None>
  
-@@ -536,6 +535,15 @@ Params: abx80x                  Select one of the ABx80x family:
+@@ -536,6 +535,15 @@ Params: abx80x                  Select o
                                  source
  
  
@@ -57,9 +53,6 @@ index 4a77ee6..80ea3de 100644
  Name:   i2c0-bcm2708
  Info:   Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations
          are usable on all platforms.
-diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
-new file mode 100644
-index 0000000..f6d134c
 --- /dev/null
 +++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
 @@ -0,0 +1,34 @@
@@ -97,6 +90,3 @@ index 0000000..f6d134c
 +		bmp280 = <&bmp280>,"status";
 +	};
 +};
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch b/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch
index 4b40d64..dfec01b 100644
--- a/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch
+++ b/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch
@@ -8,8 +8,6 @@ We now create overlays as .dtbo files.
  arch/arm/boot/dts/overlays/README | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index 80ea3de..7aee1af 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
 @@ -61,7 +61,7 @@ this becomes a line in config.txt:
@@ -21,6 +19,3 @@ index 80ea3de..7aee1af 100644
  default it will use GPIOs 17 (out) and 18 (in), but this can be modified using
  DT parameters:
  
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch b/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch
index adfb1f6..57e52f2 100644
--- a/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch
+++ b/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch
@@ -23,8 +23,6 @@ Signed-off-by: Jiri Kosina <jkosina at suse.cz>
  drivers/hid/hid-dr.c | 58 ----------------------------------------------------
  1 file changed, 58 deletions(-)
 
-diff --git a/drivers/hid/hid-dr.c b/drivers/hid/hid-dr.c
-index 1d78ba3..ce06444 100644
 --- a/drivers/hid/hid-dr.c
 +++ b/drivers/hid/hid-dr.c
 @@ -234,58 +234,6 @@ static __u8 pid0011_rdesc_fixed[] = {
@@ -86,7 +84,7 @@ index 1d78ba3..ce06444 100644
  static __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  				unsigned int *rsize)
  {
-@@ -296,12 +244,6 @@ static __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+@@ -296,12 +244,6 @@ static __u8 *dr_report_fixup(struct hid_
  			*rsize = sizeof(pid0011_rdesc_fixed);
  		}
  		break;
@@ -99,6 +97,3 @@ index 1d78ba3..ce06444 100644
  	}
  	return rdesc;
  }
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch b/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch
index 2892aea..934bf6f 100644
--- a/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch
+++ b/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch
@@ -8,11 +8,9 @@ Avoids the 0x40000 cycles of warmup again if firmware has already used it
  drivers/char/hw_random/bcm2835-rng.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
 
-diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
-index 7192ec2..2ff49c1 100644
 --- a/drivers/char/hw_random/bcm2835-rng.c
 +++ b/drivers/char/hw_random/bcm2835-rng.c
-@@ -62,9 +62,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
+@@ -62,9 +62,10 @@ static int bcm2835_rng_probe(struct plat
  	bcm2835_rng_ops.priv = (unsigned long)rng_base;
  
  	/* set warm-up count & enable */
@@ -26,6 +24,3 @@ index 7192ec2..2ff49c1 100644
  	/* register driver */
  	err = hwrng_register(&bcm2835_rng_ops);
  	if (err) {
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch b/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch
index b1aa05f..81950df 100644
--- a/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch
+++ b/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch
@@ -11,8 +11,6 @@ Print a logline when the kernel module is removed.
  sound/soc/bcm/pisound.c                        |  2 +
  2 files changed, 52 insertions(+), 44 deletions(-)
 
-diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts
-index 7cdfc29..5197e65 100644
 --- a/arch/arm/boot/dts/overlays/pisound-overlay.dts
 +++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts
 @@ -26,6 +26,54 @@
@@ -133,11 +131,9 @@ index 7cdfc29..5197e65 100644
 -		};
 -	};
  };
-diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c
-index a3cd089..30903fcf 100644
 --- a/sound/soc/bcm/pisound.c
 +++ b/sound/soc/bcm/pisound.c
-@@ -954,6 +954,8 @@ static int pisnd_probe(struct platform_device *pdev)
+@@ -954,6 +954,8 @@ static int pisnd_probe(struct platform_d
  
  static int pisnd_remove(struct platform_device *pdev)
  {
@@ -146,6 +142,3 @@ index a3cd089..30903fcf 100644
  	if (pisnd_kobj) {
  		kobject_put(pisnd_kobj);
  		pisnd_kobj = NULL;
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch b/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch
index 574702a..a3c86df 100644
--- a/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch
+++ b/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch
@@ -9,11 +9,9 @@ Subject: [PATCH] Add support for Silicon Labs Si7013/20/21
  arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 49 +++++++++++++----------
  2 files changed, 31 insertions(+), 21 deletions(-)
 
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index 7aee1af..44ad21f 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
-@@ -543,6 +543,9 @@ Params: bmp085                  Select the Bosch sensortronic BMP085
+@@ -543,6 +543,9 @@ Params: bmp085                  Select t
  
          bmp280                  Select the Bosch sensortronic BMP280
  
@@ -23,8 +21,6 @@ index 7aee1af..44ad21f 100644
  
  Name:   i2c0-bcm2708
  Info:   Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations
-diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
-index f6d134c..31bda8d 100644
 --- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
 +++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
 @@ -1,34 +1,41 @@
@@ -43,26 +39,14 @@ index f6d134c..31bda8d 100644
 -                        #address-cells = <1>;
 -                        #size-cells = <0>;
 -                        status = "okay";
-+	fragment at 0 {
-+		target = <&i2c_arm>;
-+		__overlay__ {
-+			#address-cells = <1>;
-+			#size-cells = <0>;
-+			status = "okay";
- 
+-
 -                        bmp085: bmp085 at 77 {
 -                                compatible = "bosch,bmp085";
 -                                reg = <0x77>;
 -                                default-oversampling = <3>;
 -                                status = "disable";
 -                        };
-+			bmp085: bmp085 at 77 {
-+				compatible = "bosch,bmp085";
-+				reg = <0x77>;
-+				default-oversampling = <3>;
-+				status = "disable";
-+			};
- 
+-
 -                        bmp280: bmp280 at 76 {
 -                                compatible = "bosch,bmp280";
 -                                reg = <0x76>;
@@ -70,6 +54,20 @@ index f6d134c..31bda8d 100644
 -                        };
 -                };
 -        };
++	fragment at 0 {
++		target = <&i2c_arm>;
++		__overlay__ {
++			#address-cells = <1>;
++			#size-cells = <0>;
++			status = "okay";
++
++			bmp085: bmp085 at 77 {
++				compatible = "bosch,bmp085";
++				reg = <0x77>;
++				default-oversampling = <3>;
++				status = "disable";
++			};
++
 +			bmp280: bmp280 at 76 {
 +				compatible = "bosch,bmp280";
 +				reg = <0x76>;
@@ -90,6 +88,3 @@ index f6d134c..31bda8d 100644
 +		si7020 = <&si7020>,"status";
  	};
  };
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch b/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch
index 4b6c569..8fe127a 100644
--- a/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch
+++ b/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch
@@ -15,8 +15,6 @@ Signed-off-by: Giedrius Trainavicius <giedrius at blokas.io>
  sound/soc/bcm/pisound.c | 175 ++++++++++++++++++++++++++++++++++++++++++------
  1 file changed, 154 insertions(+), 21 deletions(-)
 
-diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c
-index 30903fcf..d317eb9 100644
 --- a/sound/soc/bcm/pisound.c
 +++ b/sound/soc/bcm/pisound.c
 @@ -36,6 +36,7 @@
@@ -37,7 +35,7 @@ index 30903fcf..d317eb9 100644
  DEFINE_KFIFO(spi_fifo_in,  uint8_t, FIFO_SIZE);
  DEFINE_KFIFO(spi_fifo_out, uint8_t, FIFO_SIZE);
  
-@@ -396,8 +400,13 @@ static void pisnd_work_handler(struct work_struct *work)
+@@ -396,8 +400,13 @@ static void pisnd_work_handler(struct wo
  			val = 0;
  			tx = 0;
  
@@ -52,7 +50,7 @@ index 30903fcf..d317eb9 100644
  
  			rx = spi_transfer16(tx);
  
-@@ -410,6 +419,7 @@ static void pisnd_work_handler(struct work_struct *work)
+@@ -410,6 +419,7 @@ static void pisnd_work_handler(struct wo
  		} while (rx != 0
  			|| !kfifo_is_empty(&spi_fifo_out)
  			|| pisnd_spi_has_more()
@@ -60,7 +58,7 @@ index 30903fcf..d317eb9 100644
  			);
  
  		if (!kfifo_is_empty(&spi_fifo_in) && g_recvCallback)
-@@ -569,7 +579,7 @@ static int pisnd_spi_init(struct device *dev)
+@@ -569,7 +579,7 @@ static int pisnd_spi_init(struct device
  	}
  
  	/* Flash the LEDs. */
@@ -84,7 +82,7 @@ index 30903fcf..d317eb9 100644
  static void pisnd_spi_send(uint8_t val)
  {
  	kfifo_put(&spi_fifo_out, val);
-@@ -658,6 +676,83 @@ static const struct of_device_id pisound_of_match[] = {
+@@ -658,6 +676,83 @@ static const struct of_device_id pisound
  	{},
  };
  
@@ -183,7 +181,7 @@ index 30903fcf..d317eb9 100644
  	printd("rate   = %d\n", params_rate(params));
  	printd("ch     = %d\n", params_channels(params));
  	printd("bits   = %u\n",
-@@ -711,16 +814,6 @@ static struct snd_pcm_hw_constraint_list constraints_rates = {
+@@ -711,16 +814,6 @@ static struct snd_pcm_hw_constraint_list
  	.mask = 0,
  };
  
@@ -200,7 +198,7 @@ index 30903fcf..d317eb9 100644
  static int pisnd_startup(struct snd_pcm_substream *substream)
  {
  	int err = snd_pcm_hw_constraint_list(
-@@ -733,11 +826,21 @@ static int pisnd_startup(struct snd_pcm_substream *substream)
+@@ -733,11 +826,21 @@ static int pisnd_startup(struct snd_pcm_
  	if (err < 0)
  		return err;
  
@@ -226,7 +224,7 @@ index 30903fcf..d317eb9 100644
  		);
  
  	if (err < 0)
-@@ -771,14 +874,23 @@ static int pisnd_card_probe(struct snd_soc_card *card)
+@@ -771,14 +874,23 @@ static int pisnd_card_probe(struct snd_s
  {
  	int err = pisnd_midi_init(card->snd_card);
  
@@ -294,6 +292,3 @@ index 30903fcf..d317eb9 100644
  	NULL
  };
  
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch b/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch
index cee6180..40f7fe1 100644
--- a/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch
+++ b/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch
@@ -10,11 +10,9 @@ and other Kodi based OSs
  sound/soc/bcm/justboom-digi.c | 1 +
  2 files changed, 2 insertions(+)
 
-diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c
-index 8fd50db..05a224e 100644
 --- a/sound/soc/bcm/justboom-dac.c
 +++ b/sound/soc/bcm/justboom-dac.c
-@@ -98,6 +98,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = {
+@@ -98,6 +98,7 @@ static struct snd_soc_dai_link snd_rpi_j
  /* audio machine driver */
  static struct snd_soc_card snd_rpi_justboom_dac = {
  	.name         = "snd_rpi_justboom_dac",
@@ -22,11 +20,9 @@ index 8fd50db..05a224e 100644
  	.owner        = THIS_MODULE,
  	.dai_link     = snd_rpi_justboom_dac_dai,
  	.num_links    = ARRAY_SIZE(snd_rpi_justboom_dac_dai),
-diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c
-index 91acb66..abfdc5c 100644
 --- a/sound/soc/bcm/justboom-digi.c
 +++ b/sound/soc/bcm/justboom-digi.c
-@@ -154,6 +154,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = {
+@@ -154,6 +154,7 @@ static struct snd_soc_dai_link snd_rpi_j
  /* audio machine driver */
  static struct snd_soc_card snd_rpi_justboom_digi = {
  	.name         = "snd_rpi_justboom_digi",
@@ -34,6 +30,3 @@ index 91acb66..abfdc5c 100644
  	.owner        = THIS_MODULE,
  	.dai_link     = snd_rpi_justboom_digi_dai,
  	.num_links    = ARRAY_SIZE(snd_rpi_justboom_digi_dai),
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch b/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch
index e435718..4605d5d 100644
--- a/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch
+++ b/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch
@@ -13,11 +13,9 @@ Signed-off-by: Giedrius Trainavicius <giedrius at blokas.io>
  sound/soc/bcm/bcm2835-i2s.c | 54 +++++++++++++++++++++++++++++++--------------
  1 file changed, 38 insertions(+), 16 deletions(-)
 
-diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
-index aedb01f..d2b0801 100644
 --- a/sound/soc/bcm/bcm2835-i2s.c
 +++ b/sound/soc/bcm/bcm2835-i2s.c
-@@ -310,6 +310,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -310,6 +310,7 @@ static int bcm2835_i2s_hw_params(struct
  	unsigned int sampling_rate = params_rate(params);
  	unsigned int data_length, data_delay, bclk_ratio;
  	unsigned int ch1pos, ch2pos, mode, format;
@@ -25,7 +23,7 @@ index aedb01f..d2b0801 100644
  	unsigned int mash = BCM2835_CLK_MASH_1;
  	unsigned int divi, divf, target_frequency;
  	int clk_src = -1;
-@@ -320,6 +321,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -320,6 +321,7 @@ static int bcm2835_i2s_hw_params(struct
  	bool frame_master =	(master == SND_SOC_DAIFMT_CBS_CFS
  					|| master == SND_SOC_DAIFMT_CBM_CFS);
  	uint32_t csreg;
@@ -33,7 +31,7 @@ index aedb01f..d2b0801 100644
  
  	/*
  	 * If a stream is already enabled,
-@@ -465,26 +467,46 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -465,26 +467,46 @@ static int bcm2835_i2s_hw_params(struct
  		return -EINVAL;
  	}
  
@@ -96,6 +94,3 @@ index aedb01f..d2b0801 100644
  	}
  
  	mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch b/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch
index 13aa1bd..25c3eb6 100644
--- a/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch
+++ b/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch
@@ -13,8 +13,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  3 files changed, 20 insertions(+)
  create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
 
-diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
-index bc7f4a9..05eda03 100644
 --- a/arch/arm/boot/dts/overlays/Makefile
 +++ b/arch/arm/boot/dts/overlays/Makefile
 @@ -61,6 +61,7 @@ dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo
@@ -25,8 +23,6 @@ index bc7f4a9..05eda03 100644
  dtbo-$(RPI_DT_OVERLAYS) += pi3-miniuart-bt.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += piscreen.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dtbo
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index 44ad21f..adb86bc 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
 @@ -793,6 +793,12 @@ Load:   dtoverlay=pi3-disable-bt
@@ -42,9 +38,6 @@ index 44ad21f..adb86bc 100644
  Name:   pi3-miniuart-bt
  Info:   Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore
          UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum
-diff --git a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
-new file mode 100644
-index 0000000..0171995
 --- /dev/null
 +++ b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
 @@ -0,0 +1,13 @@
@@ -61,6 +54,3 @@ index 0000000..0171995
 +		};
 +	};
 +};
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch b/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
index fcc2d60..8cc40da 100644
--- a/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
+++ b/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
@@ -36,11 +36,9 @@ Cc: Pantelis Antoniou <pantelis.antoniou at konsulko.com>
  fs/configfs/file.c | 2 --
  1 file changed, 2 deletions(-)
 
-diff --git a/fs/configfs/file.c b/fs/configfs/file.c
-index 3687187..6e322f2 100644
 --- a/fs/configfs/file.c
 +++ b/fs/configfs/file.c
-@@ -357,8 +357,6 @@ configfs_write_bin_file(struct file *file, const char __user *buf,
+@@ -357,8 +357,6 @@ configfs_write_bin_file(struct file *fil
  
  	len = simple_write_to_buffer(buffer->bin_buffer,
  			buffer->bin_buffer_size, ppos, buf, count);
@@ -49,6 +47,3 @@ index 3687187..6e322f2 100644
  out:
  	mutex_unlock(&buffer->mutex);
  	return len;
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch b/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch
index 929a12a..fd2ac80 100644
--- a/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch
+++ b/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch
@@ -9,8 +9,6 @@ Subject: [PATCH] config: Add CONFIG_DM_CACHE See:
  arch/arm/configs/bcmrpi_defconfig  | 1 +
  2 files changed, 2 insertions(+)
 
-diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
-index c7606f2..0d07eed 100644
 --- a/arch/arm/configs/bcm2709_defconfig
 +++ b/arch/arm/configs/bcm2709_defconfig
 @@ -438,6 +438,7 @@ CONFIG_BLK_DEV_DM=m
@@ -21,8 +19,6 @@ index c7606f2..0d07eed 100644
  CONFIG_DM_MIRROR=m
  CONFIG_DM_LOG_USERSPACE=m
  CONFIG_DM_RAID=m
-diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
-index 8121ad2..51640cb 100644
 --- a/arch/arm/configs/bcmrpi_defconfig
 +++ b/arch/arm/configs/bcmrpi_defconfig
 @@ -431,6 +431,7 @@ CONFIG_BLK_DEV_DM=m
@@ -33,6 +29,3 @@ index 8121ad2..51640cb 100644
  CONFIG_DM_MIRROR=m
  CONFIG_DM_LOG_USERSPACE=m
  CONFIG_DM_RAID=m
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch b/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch
index 3128cf2..8dee99d 100644
--- a/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch
+++ b/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch
@@ -12,8 +12,6 @@ using the cs0_pin and cs1_pin parameters.
  3 files changed, 38 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
 
-diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
-index 05eda03..72f2d90a 100644
 --- a/arch/arm/boot/dts/overlays/Makefile
 +++ b/arch/arm/boot/dts/overlays/Makefile
 @@ -93,6 +93,7 @@ dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo
@@ -24,8 +22,6 @@ index 05eda03..72f2d90a 100644
  dtbo-$(RPI_DT_OVERLAYS) += spi0-hw-cs.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index adb86bc..7f4bd29 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
 @@ -1131,7 +1131,7 @@ Params: <None>
@@ -51,9 +47,6 @@ index adb86bc..7f4bd29 100644
  Name:   spi0-hw-cs
  Info:   Re-enables hardware CS/CE (chip selects) for SPI0
  Load:   dtoverlay=spi0-hw-cs
-diff --git a/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts b/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
-new file mode 100644
-index 0000000..7f79029
 --- /dev/null
 +++ b/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
 @@ -0,0 +1,29 @@
@@ -86,6 +79,3 @@ index 0000000..7f79029
 +			   <&frag1>,"cs-gpios:16";
 +	};
 +};
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch b/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch
index 3904abb..5fc6874 100644
--- a/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch
+++ b/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch
@@ -13,11 +13,9 @@ See: https://github.com/raspberrypi/linux/issues/1799
  sound/soc/bcm/bcm2835-i2s.c | 54 ++++++++++++++-------------------------------
  1 file changed, 16 insertions(+), 38 deletions(-)
 
-diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
-index d2b0801..aedb01f 100644
 --- a/sound/soc/bcm/bcm2835-i2s.c
 +++ b/sound/soc/bcm/bcm2835-i2s.c
-@@ -310,7 +310,6 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -310,7 +310,6 @@ static int bcm2835_i2s_hw_params(struct
  	unsigned int sampling_rate = params_rate(params);
  	unsigned int data_length, data_delay, bclk_ratio;
  	unsigned int ch1pos, ch2pos, mode, format;
@@ -25,7 +23,7 @@ index d2b0801..aedb01f 100644
  	unsigned int mash = BCM2835_CLK_MASH_1;
  	unsigned int divi, divf, target_frequency;
  	int clk_src = -1;
-@@ -321,7 +320,6 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -321,7 +320,6 @@ static int bcm2835_i2s_hw_params(struct
  	bool frame_master =	(master == SND_SOC_DAIFMT_CBS_CFS
  					|| master == SND_SOC_DAIFMT_CBM_CFS);
  	uint32_t csreg;
@@ -33,7 +31,7 @@ index d2b0801..aedb01f 100644
  
  	/*
  	 * If a stream is already enabled,
-@@ -467,46 +465,26 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -467,46 +465,26 @@ static int bcm2835_i2s_hw_params(struct
  		return -EINVAL;
  	}
  
@@ -96,6 +94,3 @@ index d2b0801..aedb01f 100644
  	}
  
  	mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch b/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch
index a28b298..d9d0134 100644
--- a/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch
+++ b/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch
@@ -8,8 +8,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 4 ++++
  1 file changed, 4 insertions(+)
 
-diff --git a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
-index 98e6f92..7ceb16b 100644
 --- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
 +++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
 @@ -7,6 +7,10 @@
@@ -23,6 +21,3 @@ index 98e6f92..7ceb16b 100644
  &gpio {
  	sdhost_pins: sdhost_pins {
  		brcm,pins = <48 49 50 51 52 53>;
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch b/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch
index 8075f6c..b4e34ed 100644
--- a/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch
+++ b/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch
@@ -11,8 +11,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  arch/arm/configs/bcmrpi_defconfig  | 2 ++
  2 files changed, 4 insertions(+)
 
-diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
-index 0d07eed..1085058 100644
 --- a/arch/arm/configs/bcm2709_defconfig
 +++ b/arch/arm/configs/bcm2709_defconfig
 @@ -407,7 +407,9 @@ CONFIG_DMA_CMA=y
@@ -25,8 +23,6 @@ index 0d07eed..1085058 100644
  CONFIG_MTD_UBI=m
  CONFIG_OF_CONFIGFS=y
  CONFIG_ZRAM=m
-diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
-index 51640cb..ca52c36 100644
 --- a/arch/arm/configs/bcmrpi_defconfig
 +++ b/arch/arm/configs/bcmrpi_defconfig
 @@ -400,7 +400,9 @@ CONFIG_DMA_CMA=y
@@ -39,6 +35,3 @@ index 51640cb..ca52c36 100644
  CONFIG_MTD_UBI=m
  CONFIG_OF_CONFIGFS=y
  CONFIG_ZRAM=m
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch b/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch
index f9f3d48..81f3ad2 100644
--- a/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch
+++ b/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch
@@ -15,8 +15,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  arch/arm/configs/bcm2709_defconfig | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
 
-diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
-index 1085058..19daca4 100644
 --- a/arch/arm/configs/bcm2709_defconfig
 +++ b/arch/arm/configs/bcm2709_defconfig
 @@ -969,6 +969,7 @@ CONFIG_USB_MICROTEK=m
@@ -48,6 +46,3 @@ index 1085058..19daca4 100644
  CONFIG_MMC=y
  CONFIG_MMC_BLOCK_MINORS=32
  CONFIG_MMC_BCM2835=y
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch b/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch
index b1d8295..bd5f5ed 100644
--- a/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch
+++ b/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch
@@ -12,8 +12,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 5 +++++
  1 file changed, 5 insertions(+)
 
-diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
-index 0a3a962..ba0f316 100644
 --- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
 +++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
 @@ -36,6 +36,11 @@
@@ -28,6 +26,3 @@ index 0a3a962..ba0f316 100644
  / {
  	__overrides__ {
  		core_freq = <&clk_core>,"clock-frequency:0";
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch b/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch
index ba30583..5da5e8e 100644
--- a/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch
+++ b/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch
@@ -43,8 +43,6 @@ dtoverlay=mcp3008:spi0-0-present,spi0-0-speed=2000000
  3 files changed, 215 insertions(+)
  create mode 100755 arch/arm/boot/dts/overlays/mcp3008-overlay.dts
 
-diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
-index 72f2d90a..b13e340 100644
 --- a/arch/arm/boot/dts/overlays/Makefile
 +++ b/arch/arm/boot/dts/overlays/Makefile
 @@ -57,6 +57,7 @@ dtbo-$(RPI_DT_OVERLAYS) += mcp23017.dtbo
@@ -55,11 +53,9 @@ index 72f2d90a..b13e340 100644
  dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo
  dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo
-diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
-index 7f4bd29..72601f8 100644
 --- a/arch/arm/boot/dts/overlays/README
 +++ b/arch/arm/boot/dts/overlays/README
-@@ -736,6 +736,15 @@ Params: oscillator              Clock frequency for the CAN controller (Hz)
+@@ -736,6 +736,15 @@ Params: oscillator              Clock fr
          interrupt               GPIO for interrupt signal
  
  
@@ -75,9 +71,6 @@ index 7f4bd29..72601f8 100644
  Name:   mmc
  Info:   Selects the bcm2835-mmc SD/MMC driver, optionally with overclock
  Load:   dtoverlay=mmc,<param>=<val>
-diff --git a/arch/arm/boot/dts/overlays/mcp3008-overlay.dts b/arch/arm/boot/dts/overlays/mcp3008-overlay.dts
-new file mode 100755
-index 0000000..06bf426
 --- /dev/null
 +++ b/arch/arm/boot/dts/overlays/mcp3008-overlay.dts
 @@ -0,0 +1,205 @@
@@ -286,6 +279,3 @@ index 0000000..06bf426
 +		spi2-2-speed = <&mcp3008_22>, "spi-max-frequency:0";
 +	};
 +};
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch b/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch
index cacfc5d..48aeac9 100644
--- a/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch
+++ b/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch
@@ -26,11 +26,9 @@ Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
  arch/x86/kernel/apic/io_apic.c | 2 ++
  1 file changed, 2 insertions(+)
 
-diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index 8ca533b..1e5d2f0 100644
 --- a/arch/x86/kernel/apic/io_apic.c
 +++ b/arch/x86/kernel/apic/io_apic.c
-@@ -1875,6 +1875,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
+@@ -1875,6 +1875,7 @@ static struct irq_chip ioapic_chip __rea
  	.irq_ack		= irq_chip_ack_parent,
  	.irq_eoi		= ioapic_ack_level,
  	.irq_set_affinity	= ioapic_set_affinity,
@@ -38,7 +36,7 @@ index 8ca533b..1e5d2f0 100644
  	.flags			= IRQCHIP_SKIP_SET_WAKE,
  };
  
-@@ -1886,6 +1887,7 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
+@@ -1886,6 +1887,7 @@ static struct irq_chip ioapic_ir_chip __
  	.irq_ack		= irq_chip_ack_parent,
  	.irq_eoi		= ioapic_ir_ack_level,
  	.irq_set_affinity	= ioapic_set_affinity,
@@ -46,6 +44,3 @@ index 8ca533b..1e5d2f0 100644
  	.flags			= IRQCHIP_SKIP_SET_WAKE,
  };
  
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch b/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch
index 4330cb4..2a49af1 100644
--- a/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch
+++ b/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch
@@ -9,8 +9,6 @@ See: https://github.com/raspberrypi/linux/issues/1819
  arch/arm/configs/bcmrpi_defconfig  | 1 +
  2 files changed, 2 insertions(+)
 
-diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
-index 19daca4..783d2c2 100644
 --- a/arch/arm/configs/bcm2709_defconfig
 +++ b/arch/arm/configs/bcm2709_defconfig
 @@ -358,6 +358,7 @@ CONFIG_BAYCOM_SER_HDX=m
@@ -21,8 +19,6 @@ index 19daca4..783d2c2 100644
  CONFIG_CAN_MCP251X=m
  CONFIG_IRDA=m
  CONFIG_IRLAN=m
-diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
-index ca52c36..be7bf41 100644
 --- a/arch/arm/configs/bcmrpi_defconfig
 +++ b/arch/arm/configs/bcmrpi_defconfig
 @@ -351,6 +351,7 @@ CONFIG_BAYCOM_SER_HDX=m
@@ -33,6 +29,3 @@ index ca52c36..be7bf41 100644
  CONFIG_CAN_MCP251X=m
  CONFIG_IRDA=m
  CONFIG_IRLAN=m
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch b/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch
index c798546..0c6007e 100644
--- a/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch
+++ b/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch
@@ -16,11 +16,9 @@ Signed-off-by: Eric Anholt <eric at anholt.net>
  drivers/gpu/drm/vc4/vc4_firmware_kms.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
 
-diff --git a/drivers/gpu/drm/vc4/vc4_firmware_kms.c b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
-index a1b6511..8f74382 100644
 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
-@@ -312,6 +312,21 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
+@@ -312,6 +312,21 @@ static int vc4_crtc_atomic_check(struct
  static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
  				  struct drm_crtc_state *old_state)
  {
@@ -42,6 +40,3 @@ index a1b6511..8f74382 100644
  }
  
  static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc)
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch b/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch
index c7946e5..dcc1e82 100644
--- a/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch
+++ b/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch
@@ -14,11 +14,9 @@ Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
  drivers/clk/bcm/clk-bcm2835.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
-index e9e8c25..3fbd2e8 100644
 --- a/drivers/clk/bcm/clk-bcm2835.c
 +++ b/drivers/clk/bcm/clk-bcm2835.c
-@@ -1657,7 +1657,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1657,7 +1657,7 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLH_AUX,
  		.load_mask = CM_PLLH_LOADAUX,
  		.hold_mask = 0,
@@ -27,6 +25,3 @@ index e9e8c25..3fbd2e8 100644
  	[BCM2835_PLLH_PIX]	= REGISTER_PLL_DIV(
  		.name = "pllh_pix",
  		.source_pll = "pllh",
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch b/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch
index bd7405e..b973ae1 100644
--- a/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch
+++ b/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch
@@ -22,8 +22,6 @@ Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
  drivers/clk/bcm/clk-bcm2835.c | 67 ++++++++++++++++++++++++++++++++++++++++---
  1 file changed, 63 insertions(+), 4 deletions(-)
 
-diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
-index 3fbd2e8..5f0e2f3 100644
 --- a/drivers/clk/bcm/clk-bcm2835.c
 +++ b/drivers/clk/bcm/clk-bcm2835.c
 @@ -457,6 +457,9 @@ struct bcm2835_clock_data {
@@ -98,7 +96,7 @@ index 3fbd2e8..5f0e2f3 100644
  	struct clk_hw *parent, *best_parent = NULL;
  	bool current_parent_is_pllc;
  	unsigned long rate, best_rate = 0;
-@@ -1086,9 +1139,8 @@ static int bcm2835_clock_determine_rate(struct clk_hw *hw,
+@@ -1086,9 +1139,8 @@ static int bcm2835_clock_determine_rate(
  		if (bcm2835_clk_is_pllc(parent) && !current_parent_is_pllc)
  			continue;
  
@@ -110,7 +108,7 @@ index 3fbd2e8..5f0e2f3 100644
  		if (rate > best_rate && rate <= req->rate) {
  			best_parent = parent;
  			best_prate = prate;
-@@ -1308,6 +1360,13 @@ static struct clk *bcm2835_register_clock(struct bcm2835_cprman *cprman,
+@@ -1308,6 +1360,13 @@ static struct clk *bcm2835_register_cloc
  	if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0)
  		init.flags &= ~CLK_IS_CRITICAL;
  
@@ -124,6 +122,3 @@ index 3fbd2e8..5f0e2f3 100644
  	if (data->is_vpu_clock) {
  		init.ops = &bcm2835_vpu_clock_clk_ops;
  	} else {
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch b/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch
index a66653e..c3ab171 100644
--- a/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch
+++ b/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch
@@ -17,11 +17,9 @@ Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
  drivers/clk/bcm/clk-bcm2835.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
-diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
-index 5f0e2f3..d023e4a 100644
 --- a/drivers/clk/bcm/clk-bcm2835.c
 +++ b/drivers/clk/bcm/clk-bcm2835.c
-@@ -1920,7 +1920,12 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1920,7 +1920,12 @@ static const struct bcm2835_clk_desc clk
  		.ctl_reg = CM_VECCTL,
  		.div_reg = CM_VECDIV,
  		.int_bits = 4,
@@ -35,6 +33,3 @@ index 5f0e2f3..d023e4a 100644
  
  	/* dsi clocks */
  	[BCM2835_CLOCK_DSI0E]	= REGISTER_PER_CLK(
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch b/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch
index 5a004a6..1affce9 100644
--- a/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch
+++ b/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch
@@ -16,11 +16,9 @@ Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
  drivers/clk/bcm/clk-bcm2835.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
-index d023e4a..89dad97 100644
 --- a/drivers/clk/bcm/clk-bcm2835.c
 +++ b/drivers/clk/bcm/clk-bcm2835.c
-@@ -1067,7 +1067,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw,
+@@ -1067,7 +1067,7 @@ static unsigned long bcm2835_clock_choos
  	struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
  	struct bcm2835_cprman *cprman = clock->cprman;
  	const struct bcm2835_clock_data *data = clock->data;
@@ -29,6 +27,3 @@ index d023e4a..89dad97 100644
  	u32 curdiv, mindiv, maxdiv;
  	struct clk_hw *parent;
  
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch b/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch
index 94f4be6..2a6cfba 100644
--- a/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch
+++ b/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch
@@ -21,8 +21,6 @@ Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
  drivers/clk/bcm/clk-bcm2835.c | 42 ++++++++++++++++++++++++++++--------------
  1 file changed, 28 insertions(+), 14 deletions(-)
 
-diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
-index 89dad97..54cb4e1 100644
 --- a/drivers/clk/bcm/clk-bcm2835.c
 +++ b/drivers/clk/bcm/clk-bcm2835.c
 @@ -449,6 +449,7 @@ struct bcm2835_pll_divider_data {
@@ -33,7 +31,7 @@ index 89dad97..54cb4e1 100644
  };
  
  struct bcm2835_clock_data {
-@@ -1286,7 +1287,7 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
+@@ -1286,7 +1287,7 @@ bcm2835_register_pll_divider(struct bcm2
  	init.num_parents = 1;
  	init.name = divider_name;
  	init.ops = &bcm2835_pll_divider_clk_ops;
@@ -42,7 +40,7 @@ index 89dad97..54cb4e1 100644
  
  	divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
  	if (!divider)
-@@ -1525,7 +1526,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1525,7 +1526,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLA_CORE,
  		.load_mask = CM_PLLA_LOADCORE,
  		.hold_mask = CM_PLLA_HOLDCORE,
@@ -52,7 +50,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLA_PER]	= REGISTER_PLL_DIV(
  		.name = "plla_per",
  		.source_pll = "plla",
-@@ -1533,7 +1535,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1533,7 +1535,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLA_PER,
  		.load_mask = CM_PLLA_LOADPER,
  		.hold_mask = CM_PLLA_HOLDPER,
@@ -62,7 +60,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLA_DSI0]	= REGISTER_PLL_DIV(
  		.name = "plla_dsi0",
  		.source_pll = "plla",
-@@ -1549,7 +1552,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1549,7 +1552,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLA_CCP2,
  		.load_mask = CM_PLLA_LOADCCP2,
  		.hold_mask = CM_PLLA_HOLDCCP2,
@@ -72,7 +70,7 @@ index 89dad97..54cb4e1 100644
  
  	/* PLLB is used for the ARM's clock. */
  	[BCM2835_PLLB]		= REGISTER_PLL(
-@@ -1573,7 +1577,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1573,7 +1577,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLB_ARM,
  		.load_mask = CM_PLLB_LOADARM,
  		.hold_mask = CM_PLLB_HOLDARM,
@@ -82,7 +80,7 @@ index 89dad97..54cb4e1 100644
  
  	/*
  	 * PLLC is the core PLL, used to drive the core VPU clock.
-@@ -1602,7 +1607,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1602,7 +1607,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLC_CORE0,
  		.load_mask = CM_PLLC_LOADCORE0,
  		.hold_mask = CM_PLLC_HOLDCORE0,
@@ -92,7 +90,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLC_CORE1]	= REGISTER_PLL_DIV(
  		.name = "pllc_core1",
  		.source_pll = "pllc",
-@@ -1610,7 +1616,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1610,7 +1616,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLC_CORE1,
  		.load_mask = CM_PLLC_LOADCORE1,
  		.hold_mask = CM_PLLC_HOLDCORE1,
@@ -102,7 +100,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLC_CORE2]	= REGISTER_PLL_DIV(
  		.name = "pllc_core2",
  		.source_pll = "pllc",
-@@ -1618,7 +1625,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1618,7 +1625,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLC_CORE2,
  		.load_mask = CM_PLLC_LOADCORE2,
  		.hold_mask = CM_PLLC_HOLDCORE2,
@@ -112,7 +110,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLC_PER]	= REGISTER_PLL_DIV(
  		.name = "pllc_per",
  		.source_pll = "pllc",
-@@ -1626,7 +1634,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1626,7 +1634,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLC_PER,
  		.load_mask = CM_PLLC_LOADPER,
  		.hold_mask = CM_PLLC_HOLDPER,
@@ -122,7 +120,7 @@ index 89dad97..54cb4e1 100644
  
  	/*
  	 * PLLD is the display PLL, used to drive DSI display panels.
-@@ -1655,7 +1664,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1655,7 +1664,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLD_CORE,
  		.load_mask = CM_PLLD_LOADCORE,
  		.hold_mask = CM_PLLD_HOLDCORE,
@@ -132,7 +130,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLD_PER]	= REGISTER_PLL_DIV(
  		.name = "plld_per",
  		.source_pll = "plld",
-@@ -1663,7 +1673,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1663,7 +1673,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLD_PER,
  		.load_mask = CM_PLLD_LOADPER,
  		.hold_mask = CM_PLLD_HOLDPER,
@@ -142,7 +140,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLD_DSI0]	= REGISTER_PLL_DIV(
  		.name = "plld_dsi0",
  		.source_pll = "plld",
-@@ -1708,7 +1719,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1708,7 +1719,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLH_RCAL,
  		.load_mask = CM_PLLH_LOADRCAL,
  		.hold_mask = 0,
@@ -152,7 +150,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLH_AUX]	= REGISTER_PLL_DIV(
  		.name = "pllh_aux",
  		.source_pll = "pllh",
-@@ -1716,7 +1728,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1716,7 +1728,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLH_AUX,
  		.load_mask = CM_PLLH_LOADAUX,
  		.hold_mask = 0,
@@ -162,7 +160,7 @@ index 89dad97..54cb4e1 100644
  	[BCM2835_PLLH_PIX]	= REGISTER_PLL_DIV(
  		.name = "pllh_pix",
  		.source_pll = "pllh",
-@@ -1724,7 +1737,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+@@ -1724,7 +1737,8 @@ static const struct bcm2835_clk_desc clk
  		.a2w_reg = A2W_PLLH_PIX,
  		.load_mask = CM_PLLH_LOADPIX,
  		.hold_mask = 0,
@@ -172,6 +170,3 @@ index 89dad97..54cb4e1 100644
  
  	/* the clocks */
  
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch b/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch
index e440733..2f1ea2a 100644
--- a/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch
+++ b/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch
@@ -9,11 +9,9 @@ called, so have removed call completely.
  drivers/char/broadcom/bcm2835-gpiomem.c | 2 --
  1 file changed, 2 deletions(-)
 
-diff --git a/drivers/char/broadcom/bcm2835-gpiomem.c b/drivers/char/broadcom/bcm2835-gpiomem.c
-index 911f5b7..f5e7f1b 100644
 --- a/drivers/char/broadcom/bcm2835-gpiomem.c
 +++ b/drivers/char/broadcom/bcm2835-gpiomem.c
-@@ -76,8 +76,6 @@ static int bcm2835_gpiomem_open(struct inode *inode, struct file *file)
+@@ -76,8 +76,6 @@ static int bcm2835_gpiomem_open(struct i
  	int dev = iminor(inode);
  	int ret = 0;
  
@@ -22,6 +20,3 @@ index 911f5b7..f5e7f1b 100644
  	if (dev != DEVICE_MINOR) {
  		dev_err(inst->dev, "Unknown minor device: %d", dev);
  		ret = -ENXIO;
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch b/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch
index 2dab022..bc97964 100644
--- a/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch
+++ b/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch
@@ -20,11 +20,9 @@ Signed-off-by: Eric Anholt <eric at anholt.net>
  drivers/gpu/drm/vc4/vc4_bo.c | 13 +++++++------
  1 file changed, 7 insertions(+), 6 deletions(-)
 
-diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
-index 56b779c..ce8a5fd 100644
 --- a/drivers/gpu/drm/vc4/vc4_bo.c
 +++ b/drivers/gpu/drm/vc4/vc4_bo.c
-@@ -208,22 +208,23 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
+@@ -208,22 +208,23 @@ struct drm_gem_object *vc4_create_object
  }
  
  struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size,
@@ -54,6 +52,3 @@ index 56b779c..ce8a5fd 100644
  	}
  
  	/* Otherwise, make a new BO. */
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch b/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch
index c2381cb..d537016 100644
--- a/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch
+++ b/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch
@@ -15,11 +15,9 @@ Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.")
  drivers/gpu/drm/vc4/vc4_bo.c | 8 ++++++++
  1 file changed, 8 insertions(+)
 
-diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
-index ce8a5fd..d7474dd 100644
 --- a/drivers/gpu/drm/vc4/vc4_bo.c
 +++ b/drivers/gpu/drm/vc4/vc4_bo.c
-@@ -334,6 +334,14 @@ void vc4_free_object(struct drm_gem_object *gem_bo)
+@@ -334,6 +334,14 @@ void vc4_free_object(struct drm_gem_obje
  		goto out;
  	}
  
@@ -34,6 +32,3 @@ index ce8a5fd..d7474dd 100644
  	cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size);
  	if (!cache_list) {
  		vc4_bo_destroy(bo);
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch b/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch
index d09e6d3..cce4b11 100644
--- a/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch
+++ b/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch
@@ -14,8 +14,6 @@ Signed-off-by: Eric Anholt <eric at anholt.net>
  mm/cma.c                      |  2 ++
  3 files changed, 21 insertions(+)
 
-diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
-index e167a1e1..60f5c25 100644
 --- a/drivers/base/dma-contiguous.c
 +++ b/drivers/base/dma-contiguous.c
 @@ -35,6 +35,7 @@
@@ -26,8 +24,6 @@ index e167a1e1..60f5c25 100644
  
  /*
   * Default global CMA area size can be defined in kernel's .config.
-diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
-index 7cc346a..1d9e5a6 100644
 --- a/drivers/gpu/drm/vc4/vc4_v3d.c
 +++ b/drivers/gpu/drm/vc4/vc4_v3d.c
 @@ -16,7 +16,10 @@
@@ -41,7 +37,7 @@ index 7cc346a..1d9e5a6 100644
  #include "linux/pm_runtime.h"
  #include "vc4_drv.h"
  #include "vc4_regs.h"
-@@ -185,8 +188,23 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
+@@ -185,8 +188,23 @@ static int vc4_v3d_bind(struct device *d
  	struct drm_device *drm = dev_get_drvdata(master);
  	struct vc4_dev *vc4 = to_vc4_dev(drm);
  	struct vc4_v3d *v3d = NULL;
@@ -65,11 +61,9 @@ index 7cc346a..1d9e5a6 100644
  	v3d = devm_kzalloc(&pdev->dev, sizeof(*v3d), GFP_KERNEL);
  	if (!v3d)
  		return -ENOMEM;
-diff --git a/mm/cma.c b/mm/cma.c
-index bd0e141..efac29b 100644
 --- a/mm/cma.c
 +++ b/mm/cma.c
-@@ -47,11 +47,13 @@ phys_addr_t cma_get_base(const struct cma *cma)
+@@ -47,11 +47,13 @@ phys_addr_t cma_get_base(const struct cm
  {
  	return PFN_PHYS(cma->base_pfn);
  }
@@ -83,6 +77,3 @@ index bd0e141..efac29b 100644
  
  static unsigned long cma_bitmap_aligned_mask(const struct cma *cma,
  					     int align_order)
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch b/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch
index 8bdfe2e..97eb130 100644
--- a/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch
+++ b/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch
@@ -59,11 +59,9 @@ Signed-off-by: Christopher Alexander Tobias Schulze <cat.schulze at alice-dsl.net>
  arch/arm/vfp/vfpmodule.c | 27 ++++++++++++++++++++-------
  1 file changed, 20 insertions(+), 7 deletions(-)
 
-diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
-index 2a61e4b..7675518 100644
 --- a/arch/arm/vfp/vfpmodule.c
 +++ b/arch/arm/vfp/vfpmodule.c
-@@ -183,8 +183,11 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
+@@ -183,8 +183,11 @@ static int vfp_notifier(struct notifier_
  		 * case the thread migrates to a different CPU. The
  		 * restoring is done lazily.
  		 */
@@ -95,7 +93,7 @@ index 2a61e4b..7675518 100644
  		vfp_save_state(vfp_current_hw_state[ti->cpu], fpexc);
  		fmxr(FPEXC, fpexc);
  #endif
-@@ -536,7 +542,8 @@ void vfp_sync_hwstate(struct thread_info *thread)
+@@ -536,7 +542,8 @@ void vfp_sync_hwstate(struct thread_info
  		/*
  		 * Save the last VFP state on this CPU.
  		 */
@@ -105,7 +103,7 @@ index 2a61e4b..7675518 100644
  		vfp_save_state(&thread->vfpstate, fpexc | FPEXC_EN);
  		fmxr(FPEXC, fpexc);
  	}
-@@ -608,6 +615,7 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
+@@ -608,6 +615,7 @@ int vfp_restore_user_hwstate(struct user
  	struct vfp_hard_struct *hwstate = &thread->vfpstate.hard;
  	unsigned long fpexc;
  	int err = 0;
@@ -113,7 +111,7 @@ index 2a61e4b..7675518 100644
  
  	/* Disable VFP to avoid corrupting the new thread state. */
  	vfp_flush_hwstate(thread);
-@@ -631,8 +639,12 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
+@@ -631,8 +639,12 @@ int vfp_restore_user_hwstate(struct user
  	/* Ensure the VFP is enabled. */
  	fpexc |= FPEXC_EN;
  
@@ -138,6 +136,3 @@ index 2a61e4b..7675518 100644
  
  	/*
  	 * Save the userland NEON/VFP state. Under UP,
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch b/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch
index e799081..9ce0d3f 100644
--- a/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch
+++ b/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch
@@ -11,11 +11,9 @@ in urb->actual_length. Fixes raspberrypi/linux#903
  drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 2 ++
  1 file changed, 2 insertions(+)
 
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
-index 2ceed42..5011750 100644
 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
-@@ -325,10 +325,12 @@ static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
+@@ -325,10 +325,12 @@ static int _complete(dwc_otg_hcd_t * hcd
  		int i;
  
  		urb->error_count = dwc_otg_hcd_urb_get_error_count(dwc_otg_urb);
@@ -28,6 +26,3 @@ index 2ceed42..5011750 100644
  			urb->iso_frame_desc[i].status =
  			    dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i);
  		}
--- 
-2.1.4
-
diff --git a/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch b/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch
index b4e1879..deb09b6 100644
--- a/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch
+++ b/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch
@@ -13,8 +13,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
  2 files changed, 201 insertions(+)
  create mode 100644 arch/arm/boot/dts/bcm2708-rpi-0-w.dts
 
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index 14a491c..bd963ef 100644
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
 @@ -2,6 +2,7 @@ ifeq ($(CONFIG_OF),y)
@@ -25,9 +23,6 @@ index 14a491c..bd963ef 100644
  dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb
  dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb
  dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb
-diff --git a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
-new file mode 100644
-index 0000000..9f7de60
 --- /dev/null
 +++ b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
 @@ -0,0 +1,200 @@
@@ -231,6 +226,3 @@ index 0000000..9f7de60
 +		sd_debug     = <&sdhost>,"brcm,debug";
 +	};
 +};
--- 
-2.1.4
-
diff --git a/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch b/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch
index 402d936..49ba623 100644
--- a/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch
+++ b/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch
@@ -43,7 +43,7 @@ Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
  	{{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
 --- a/arch/mips/bcm47xx/buttons.c
 +++ b/arch/mips/bcm47xx/buttons.c
-@@ -302,6 +302,51 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __in
+@@ -308,6 +308,51 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __in
  /* Luxul */
  
  static const struct gpio_keys_button
@@ -95,7 +95,7 @@ Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
  bcm47xx_buttons_luxul_xwr_1750_v1[] = {
  	BCM47XX_GPIO_KEY(14, BTN_TASK),
  };
-@@ -561,6 +606,33 @@ int __init bcm47xx_buttons_register(void
+@@ -567,6 +612,33 @@ int __init bcm47xx_buttons_register(void
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
  		break;
  
diff --git a/target/linux/brcm47xx/patches-4.4/130-MIPS-bcm47xx-Fix-button-inversion-for-Asus-WL-500W.patch b/target/linux/brcm47xx/patches-4.4/130-MIPS-bcm47xx-Fix-button-inversion-for-Asus-WL-500W.patch
deleted file mode 100644
index 7d671cf..0000000
--- a/target/linux/brcm47xx/patches-4.4/130-MIPS-bcm47xx-Fix-button-inversion-for-Asus-WL-500W.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From: Mirko Parthey <mirko.parthey at web.de>
-Subject: [PATCH] MIPS: bcm47xx: Fix button inversion for Asus WL-500W
-
-The Asus WL-500W buttons are active high,
-but the software treats them as active low.
-Fix the inverted logic.
-
-Signed-off-by: Mirko Parthey <mirko.parthey at web.de>
----
- arch/mips/bcm47xx/buttons.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
---- a/arch/mips/bcm47xx/buttons.c
-+++ b/arch/mips/bcm47xx/buttons.c
-@@ -17,6 +17,12 @@
- 		.active_low	= 1,					\
- 	}
- 
-+#define BCM47XX_GPIO_KEY_H(_gpio, _code)				\
-+	{								\
-+		.code		= _code,				\
-+		.gpio		= _gpio,				\
-+	}
-+
- /* Asus */
- 
- static const struct gpio_keys_button
-@@ -79,8 +85,8 @@ bcm47xx_buttons_asus_wl500gpv2[] __initc
- 
- static const struct gpio_keys_button
- bcm47xx_buttons_asus_wl500w[] __initconst = {
--	BCM47XX_GPIO_KEY(6, KEY_RESTART),
--	BCM47XX_GPIO_KEY(7, KEY_WPS_BUTTON),
-+	BCM47XX_GPIO_KEY_H(6, KEY_RESTART),
-+	BCM47XX_GPIO_KEY_H(7, KEY_WPS_BUTTON),
- };
- 
- static const struct gpio_keys_button
diff --git a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
index db2c29f..c1f565a 100644
--- a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
+++ b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
@@ -1,6 +1,6 @@
 --- a/drivers/pci/probe.c
 +++ b/drivers/pci/probe.c
-@@ -1966,7 +1966,8 @@ static void pcie_write_mrrs(struct pci_d
+@@ -1967,7 +1967,8 @@ static void pcie_write_mrrs(struct pci_d
  	/* In the "safe" case, do not configure the MRRS.  There appear to be
  	 * issues with setting MRRS to 0 on a number of devices.
  	 */
diff --git a/target/linux/generic/patches-4.4/020-bcma-from-4.5.patch b/target/linux/generic/patches-4.4/020-bcma-from-4.5.patch
index 21ebff5..c5d7bc7 100644
--- a/target/linux/generic/patches-4.4/020-bcma-from-4.5.patch
+++ b/target/linux/generic/patches-4.4/020-bcma-from-4.5.patch
@@ -1,6 +1,6 @@
 --- a/drivers/bcma/main.c
 +++ b/drivers/bcma/main.c
-@@ -668,11 +668,36 @@ static int bcma_device_uevent(struct dev
+@@ -672,11 +672,36 @@ static int bcma_device_uevent(struct dev
  			      core->id.rev, core->id.class);
  }
  
@@ -38,7 +38,7 @@
  	if (err)
  		return err;
  
-@@ -691,7 +716,7 @@ static int __init bcma_modinit(void)
+@@ -695,7 +720,7 @@ static int __init bcma_modinit(void)
  
  	return err;
  }
diff --git a/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch b/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch
index d5bdd2d..a3b0321 100644
--- a/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch
+++ b/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch
@@ -83,23 +83,3 @@
  		} else {
  			core->dev.dma_mask = &core->dev.coherent_dma_mask;
  			core->dma_dev = &core->dev;
-@@ -633,8 +634,11 @@ static int bcma_device_probe(struct devi
- 					       drv);
- 	int err = 0;
- 
-+	get_device(dev);
- 	if (adrv->probe)
- 		err = adrv->probe(core);
-+	if (err)
-+		put_device(dev);
- 
- 	return err;
- }
-@@ -647,6 +651,7 @@ static int bcma_device_remove(struct dev
- 
- 	if (adrv->remove)
- 		adrv->remove(core);
-+	put_device(dev);
- 
- 	return 0;
- }
diff --git a/target/linux/generic/patches-4.4/062-02-MIPS-Stack-unwinding-while-on-IRQ-stack.patch b/target/linux/generic/patches-4.4/062-02-MIPS-Stack-unwinding-while-on-IRQ-stack.patch
index 513e904..fc559ee 100644
--- a/target/linux/generic/patches-4.4/062-02-MIPS-Stack-unwinding-while-on-IRQ-stack.patch
+++ b/target/linux/generic/patches-4.4/062-02-MIPS-Stack-unwinding-while-on-IRQ-stack.patch
@@ -19,7 +19,7 @@ Signed-off-by: Matt Redfearn <matt.redfearn at imgtec.com>
  #include <asm/msa.h>
  #include <asm/pgtable.h>
  #include <asm/mipsregs.h>
-@@ -507,7 +508,19 @@ EXPORT_SYMBOL(unwind_stack_by_address);
+@@ -552,7 +553,19 @@ EXPORT_SYMBOL(unwind_stack_by_address);
  unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
  			   unsigned long pc, unsigned long *ra)
  {
diff --git a/target/linux/generic/patches-4.4/120-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/patches-4.4/120-bridge_allow_receiption_on_disabled_port.patch
index 727ab75..bba6074 100644
--- a/target/linux/generic/patches-4.4/120-bridge_allow_receiption_on_disabled_port.patch
+++ b/target/linux/generic/patches-4.4/120-bridge_allow_receiption_on_disabled_port.patch
@@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/net/bridge/br_input.c
 +++ b/net/bridge/br_input.c
-@@ -217,11 +217,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish
+@@ -218,11 +218,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish
  static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
  {
  	struct net_bridge_port *p = br_port_get_rcu(skb->dev);
@@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	return 0;	 /* process further */
  }
  
-@@ -296,6 +298,18 @@ rx_handler_result_t br_handle_frame(stru
+@@ -297,6 +299,18 @@ rx_handler_result_t br_handle_frame(stru
  
  forward:
  	switch (p->state) {
diff --git a/target/linux/generic/patches-4.4/630-packet_socket_type.patch b/target/linux/generic/patches-4.4/630-packet_socket_type.patch
index 0c24863..c334418 100644
--- a/target/linux/generic/patches-4.4/630-packet_socket_type.patch
+++ b/target/linux/generic/patches-4.4/630-packet_socket_type.patch
@@ -83,7 +83,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	if (!net_eq(dev_net(dev), sock_net(sk)))
  		goto drop;
  
-@@ -3111,6 +3113,7 @@ static int packet_create(struct net *net
+@@ -3115,6 +3117,7 @@ static int packet_create(struct net *net
  	mutex_init(&po->pg_vec_lock);
  	po->rollover = NULL;
  	po->prot_hook.func = packet_rcv;
@@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  	if (sock->type == SOCK_PACKET)
  		po->prot_hook.func = packet_rcv_spkt;
-@@ -3733,6 +3736,16 @@ packet_setsockopt(struct socket *sock, i
+@@ -3737,6 +3740,16 @@ packet_setsockopt(struct socket *sock, i
  		po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
  		return 0;
  	}
@@ -108,7 +108,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	default:
  		return -ENOPROTOOPT;
  	}
-@@ -3785,6 +3798,13 @@ static int packet_getsockopt(struct sock
+@@ -3789,6 +3802,13 @@ static int packet_getsockopt(struct sock
  	case PACKET_VNET_HDR:
  		val = po->has_vnet_hdr;
  		break;
diff --git a/target/linux/generic/patches-4.4/640-bridge_no_eap_forward.patch b/target/linux/generic/patches-4.4/640-bridge_no_eap_forward.patch
index 24cc2b2..a6dfb4e 100644
--- a/target/linux/generic/patches-4.4/640-bridge_no_eap_forward.patch
+++ b/target/linux/generic/patches-4.4/640-bridge_no_eap_forward.patch
@@ -8,7 +8,7 @@ each other via bridges.
 ---
 --- a/net/bridge/br_input.c
 +++ b/net/bridge/br_input.c
-@@ -168,7 +168,11 @@ int br_handle_frame_finish(struct net *n
+@@ -169,7 +169,11 @@ int br_handle_frame_finish(struct net *n
  	if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP))
  		br_do_proxy_arp(skb, br, vid, p);
  
diff --git a/target/linux/generic/patches-4.4/641-bridge_always_accept_eap.patch b/target/linux/generic/patches-4.4/641-bridge_always_accept_eap.patch
index 5da6ab6..a4e2c03 100644
--- a/target/linux/generic/patches-4.4/641-bridge_always_accept_eap.patch
+++ b/target/linux/generic/patches-4.4/641-bridge_always_accept_eap.patch
@@ -6,7 +6,7 @@ issues with WDS.
 ---
 --- a/net/bridge/br_input.c
 +++ b/net/bridge/br_input.c
-@@ -152,7 +152,7 @@ int br_handle_frame_finish(struct net *n
+@@ -153,7 +153,7 @@ int br_handle_frame_finish(struct net *n
  	    br_multicast_rcv(br, p, skb, vid))
  		goto drop;
  
diff --git a/target/linux/generic/patches-4.4/642-bridge_port_isolate.patch b/target/linux/generic/patches-4.4/642-bridge_port_isolate.patch
index 3ece047..02dfea4 100644
--- a/target/linux/generic/patches-4.4/642-bridge_port_isolate.patch
+++ b/target/linux/generic/patches-4.4/642-bridge_port_isolate.patch
@@ -48,7 +48,7 @@ Isolating individual bridge ports
  
 --- a/net/bridge/br_input.c
 +++ b/net/bridge/br_input.c
-@@ -191,8 +191,8 @@ int br_handle_frame_finish(struct net *n
+@@ -192,8 +192,8 @@ int br_handle_frame_finish(struct net *n
  
  		unicast = false;
  		br->dev->stats.multicast++;
diff --git a/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch b/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch
index 073550c..cc19b8e 100644
--- a/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch
+++ b/target/linux/generic/patches-4.4/653-disable_netlink_trim.patch
@@ -1,15 +1,12 @@
 --- a/net/netlink/af_netlink.c
 +++ b/net/netlink/af_netlink.c
-@@ -1812,27 +1812,7 @@ void netlink_detachskb(struct sock *sk,
+@@ -1187,24 +1187,7 @@ void netlink_detachskb(struct sock *sk,
  
  static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
  {
 -	int delta;
 -
  	WARN_ON(skb->sk != NULL);
--	if (netlink_skb_is_mmaped(skb))
--		return skb;
--
 -	delta = skb->end - skb->tail;
 -	if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize)
 -		return skb;
diff --git a/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
index 0794d89..c1a076a 100644
--- a/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
+++ b/target/linux/generic/patches-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
@@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -4219,6 +4219,9 @@ static enum gro_result dev_gro_receive(s
+@@ -4246,6 +4246,9 @@ static enum gro_result dev_gro_receive(s
  	enum gro_result ret;
  	int grow;
  
@@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	if (!(skb->dev->features & NETIF_F_GRO))
  		goto normal;
  
-@@ -5378,6 +5381,48 @@ static void __netdev_adjacent_dev_unlink
+@@ -5405,6 +5408,48 @@ static void __netdev_adjacent_dev_unlink
  					   &upper_dev->adj_list.lower);
  }
  
@@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  static int __netdev_upper_dev_link(struct net_device *dev,
  				   struct net_device *upper_dev, bool master,
  				   void *private)
-@@ -5449,6 +5494,7 @@ static int __netdev_upper_dev_link(struc
+@@ -5476,6 +5521,7 @@ static int __netdev_upper_dev_link(struc
  			goto rollback_lower_mesh;
  	}
  
@@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  	return 0;
-@@ -5575,6 +5621,7 @@ void netdev_upper_dev_unlink(struct net_
+@@ -5602,6 +5648,7 @@ void netdev_upper_dev_unlink(struct net_
  	list_for_each_entry(i, &upper_dev->all_adj_list.upper, list)
  		__netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr);
  
@@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
  				      &changeupper_info.info);
  }
-@@ -6115,6 +6162,7 @@ int dev_set_mac_address(struct net_devic
+@@ -6142,6 +6189,7 @@ int dev_set_mac_address(struct net_devic
  	if (err)
  		return err;
  	dev->addr_assign_type = NET_ADDR_SET;
diff --git a/target/linux/generic/patches-4.4/721-phy_packets.patch b/target/linux/generic/patches-4.4/721-phy_packets.patch
index 8333dcc..d824642 100644
--- a/target/linux/generic/patches-4.4/721-phy_packets.patch
+++ b/target/linux/generic/patches-4.4/721-phy_packets.patch
@@ -86,7 +86,7 @@
  	help
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -2708,10 +2708,20 @@ static int xmit_one(struct sk_buff *skb,
+@@ -2735,10 +2735,20 @@ static int xmit_one(struct sk_buff *skb,
  	if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all))
  		dev_queue_xmit_nit(skb, dev);
  
diff --git a/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
index a4b93df..f22bf80 100644
--- a/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
+++ b/target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
@@ -84,7 +84,7 @@
  #endif  /*  __LINUX_USB_PCI_QUIRKS_H  */
 --- a/include/linux/usb/hcd.h
 +++ b/include/linux/usb/hcd.h
-@@ -459,7 +459,14 @@ extern int usb_hcd_pci_probe(struct pci_
+@@ -460,7 +460,14 @@ extern int usb_hcd_pci_probe(struct pci_
  extern void usb_hcd_pci_remove(struct pci_dev *dev);
  extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
  
diff --git a/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch b/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
index b70f44e..fa9f37b 100644
--- a/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
+++ b/target/linux/generic/patches-4.4/901-debloat_sock_diag.patch
@@ -25,7 +25,7 @@
  obj-$(CONFIG_PROC_FS) += net-procfs.o
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -1469,9 +1469,11 @@ void sk_destruct(struct sock *sk)
+@@ -1474,9 +1474,11 @@ void sk_destruct(struct sock *sk)
  
  static void __sk_free(struct sock *sk)
  {
@@ -59,7 +59,7 @@
  	  Support for UNIX socket monitoring interface used by the ss tool.
 --- a/net/netlink/Kconfig
 +++ b/net/netlink/Kconfig
-@@ -13,6 +13,7 @@ config NETLINK_MMAP
+@@ -4,6 +4,7 @@
  
  config NETLINK_DIAG
  	tristate "NETLINK: socket monitoring interface"
diff --git a/target/linux/generic/patches-4.4/902-debloat_proc.patch b/target/linux/generic/patches-4.4/902-debloat_proc.patch
index 3123a4b..2f54db5 100644
--- a/target/linux/generic/patches-4.4/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.4/902-debloat_proc.patch
@@ -173,7 +173,7 @@
  		goto err;
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -3036,6 +3036,8 @@ static __net_initdata struct pernet_oper
+@@ -3042,6 +3042,8 @@ static __net_initdata struct pernet_oper
  
  static int __init proto_init(void)
  {
diff --git a/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch b/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch
index 6bc23c5..2649f05 100644
--- a/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch
+++ b/target/linux/imx6/patches-4.4/202-net-igb-add-i210-i211-support-for-phy-read-write.patch
@@ -10,7 +10,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
 
 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c
 +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
-@@ -129,7 +129,7 @@ out:
+@@ -133,7 +133,7 @@ out:
  s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
  {
  	struct e1000_phy_info *phy = &hw->phy;
@@ -19,7 +19,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  	s32 ret_val = 0;
  
  	if (offset > MAX_PHY_REG_ADDRESS) {
-@@ -142,11 +142,25 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
+@@ -146,11 +146,25 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
  	 * Control register.  The MAC will take care of interfacing with the
  	 * PHY to retrieve the desired data.
  	 */
@@ -48,7 +48,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  
  	/* Poll the ready bit to see if the MDI read completed
  	 * Increasing the time out as testing showed failures with
-@@ -171,6 +185,18 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
+@@ -175,6 +189,18 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
  	*data = (u16) mdic;
  
  out:
@@ -67,7 +67,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  	return ret_val;
  }
  
-@@ -185,7 +211,7 @@ out:
+@@ -189,7 +215,7 @@ out:
  s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
  {
  	struct e1000_phy_info *phy = &hw->phy;
@@ -76,7 +76,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  	s32 ret_val = 0;
  
  	if (offset > MAX_PHY_REG_ADDRESS) {
-@@ -198,12 +224,27 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -202,12 +228,27 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  	 * Control register.  The MAC will take care of interfacing with the
  	 * PHY to retrieve the desired data.
  	 */
@@ -108,7 +108,7 @@ Date:   Thu May 15 00:12:26 2014 -0700
  
  	/* Poll the ready bit to see if the MDI read completed
  	 * Increasing the time out as testing showed failures with
-@@ -227,6 +268,18 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -231,6 +272,18 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  	}
  
  out:
diff --git a/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch b/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch
index 48f6d0d..45a4a8b 100644
--- a/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch
+++ b/target/linux/imx6/patches-4.4/203-net-igb-add-phy-read-write-functions-that-accept-phy.patch
@@ -36,7 +36,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c
 +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
-@@ -126,9 +126,8 @@ out:
+@@ -130,9 +130,8 @@ out:
   *  Reads the MDI control regsiter in the PHY at offset and stores the
   *  information read to data.
   **/
@@ -47,7 +47,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  	u32 i, mdicnfg, mdic = 0;
  	s32 ret_val = 0;
  
-@@ -147,14 +146,14 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
+@@ -151,14 +150,14 @@ s32 igb_read_phy_reg_mdic(struct e1000_h
  	case e1000_i211:
  		mdicnfg = rd32(E1000_MDICNFG);
  		mdicnfg &= ~(E1000_MDICNFG_PHY_MASK);
@@ -64,7 +64,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  			(E1000_MDIC_OP_READ));
  		break;
  	}
-@@ -208,9 +207,8 @@ out:
+@@ -212,9 +211,8 @@ out:
   *
   *  Writes data to MDI control register in the PHY at offset.
   **/
@@ -75,7 +75,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  	u32 i, mdicnfg, mdic = 0;
  	s32 ret_val = 0;
  
-@@ -229,7 +227,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -233,7 +231,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  		case e1000_i211:
  			mdicnfg = rd32(E1000_MDICNFG);
  			mdicnfg &= ~(E1000_MDICNFG_PHY_MASK);
@@ -84,7 +84,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  			wr32(E1000_MDICNFG, mdicnfg);
  			mdic = (((u32)data) |
  				(offset << E1000_MDIC_REG_SHIFT) |
-@@ -238,7 +236,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
+@@ -242,7 +240,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_
  		default:
  			mdic = (((u32)data) |
  				(offset << E1000_MDIC_REG_SHIFT) |
@@ -93,7 +93,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  				(E1000_MDIC_OP_WRITE));
  			break;
  	}
-@@ -458,7 +456,7 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
+@@ -462,7 +460,7 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
  		goto out;
  
  	if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -102,7 +102,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  						 IGP01E1000_PHY_PAGE_SELECT,
  						 (u16)offset);
  		if (ret_val) {
-@@ -467,8 +465,8 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
+@@ -471,8 +469,8 @@ s32 igb_read_phy_reg_igp(struct e1000_hw
  		}
  	}
  
@@ -113,7 +113,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  	hw->phy.ops.release(hw);
  
-@@ -497,7 +495,7 @@ s32 igb_write_phy_reg_igp(struct e1000_h
+@@ -501,7 +499,7 @@ s32 igb_write_phy_reg_igp(struct e1000_h
  		goto out;
  
  	if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -122,7 +122,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  						 IGP01E1000_PHY_PAGE_SELECT,
  						 (u16)offset);
  		if (ret_val) {
-@@ -506,8 +504,8 @@ s32 igb_write_phy_reg_igp(struct e1000_h
+@@ -510,8 +508,8 @@ s32 igb_write_phy_reg_igp(struct e1000_h
  		}
  	}
  
@@ -133,7 +133,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  	hw->phy.ops.release(hw);
  
-@@ -2547,8 +2545,9 @@ out:
+@@ -2551,8 +2549,9 @@ out:
  }
  
  /**
@@ -144,7 +144,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
   *  @offset: lower half is register offset to write to
   *     upper half is page to use.
   *  @data: data to write at register offset
-@@ -2556,7 +2555,7 @@ out:
+@@ -2560,7 +2559,7 @@ out:
   *  Acquires semaphore, if necessary, then writes the data to PHY register
   *  at the offset.  Release any acquired semaphores before exiting.
   **/
@@ -153,7 +153,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  {
  	s32 ret_val;
  	u16 page = offset >> GS40G_PAGE_SHIFT;
-@@ -2566,10 +2565,10 @@ s32 igb_write_phy_reg_gs40g(struct e1000
+@@ -2570,10 +2569,10 @@ s32 igb_write_phy_reg_gs40g(struct e1000
  	if (ret_val)
  		return ret_val;
  
@@ -166,7 +166,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  release:
  	hw->phy.ops.release(hw);
-@@ -2577,8 +2576,24 @@ release:
+@@ -2581,8 +2580,24 @@ release:
  }
  
  /**
@@ -192,7 +192,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
   *  @offset: lower half is register offset to read to
   *     upper half is page to use.
   *  @data: data to read at register offset
-@@ -2586,7 +2601,7 @@ release:
+@@ -2590,7 +2605,7 @@ release:
   *  Acquires semaphore, if necessary, then reads the data in the PHY register
   *  at the offset.  Release any acquired semaphores before exiting.
   **/
@@ -201,7 +201,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  {
  	s32 ret_val;
  	u16 page = offset >> GS40G_PAGE_SHIFT;
-@@ -2596,10 +2611,10 @@ s32 igb_read_phy_reg_gs40g(struct e1000_
+@@ -2600,10 +2615,10 @@ s32 igb_read_phy_reg_gs40g(struct e1000_
  	if (ret_val)
  		return ret_val;
  
@@ -214,7 +214,7 @@ Signed-off-by: Tim Harvey <tharvey at gateworks.com>
  
  release:
  	hw->phy.ops.release(hw);
-@@ -2607,6 +2622,21 @@ release:
+@@ -2611,6 +2626,21 @@ release:
  }
  
  /**
diff --git a/target/linux/lantiq/patches-4.4/0070-MIPS-Lantiq-Keep-ethernet-enabled-during-boot.patch b/target/linux/lantiq/patches-4.4/0070-MIPS-Lantiq-Keep-ethernet-enabled-during-boot.patch
deleted file mode 100644
index 67cf7d3..0000000
--- a/target/linux/lantiq/patches-4.4/0070-MIPS-Lantiq-Keep-ethernet-enabled-during-boot.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From: Felix Fietkau <nbd at nbd.name>
-Date: Thu, 19 Jan 2017 14:14:36 +0100
-Subject: [PATCH] MIPS: Lantiq: Keep ethernet enabled during boot
-
-Disabling ethernet during reboot (only to enable it again when the
-ethernet driver attaches) can put the chip into a faulty state where it
-corrupts the header of all incoming packets.
-
-This happens if packets arrive during the time window where the core is
-disabled, and it can be easily reproduced by rebooting while sending a
-flood ping to the broadcast address.
-
-Cc: john at phrozen.org
-Cc: hauke.mehrtens at lantiq.com
-Cc: stable at vger.kernel.org
-Fixes: 95135bfa7ead ("MIPS: Lantiq: Deactivate most of the devices by default")
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
----
-
---- a/arch/mips/lantiq/xway/sysctrl.c
-+++ b/arch/mips/lantiq/xway/sysctrl.c
-@@ -564,7 +564,7 @@ void __init ltq_soc_init(void)
- 		clkdev_add_pmu("1a800000.pcie", "msi", 1, 1, PMU1_PCIE2_MSI);
- 		clkdev_add_pmu("1a800000.pcie", "pdi", 1, 1, PMU1_PCIE2_PDI);
- 		clkdev_add_pmu("1a800000.pcie", "ctl", 1, 1, PMU1_PCIE2_CTL);
--		clkdev_add_pmu("1e108000.eth", NULL, 1, 0, PMU_SWITCH | PMU_PPE_DP);
-+		clkdev_add_pmu("1e108000.eth", NULL, 0, 0, PMU_SWITCH | PMU_PPE_DP);
- 		clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
- 		clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
- 	} else if (of_machine_is_compatible("lantiq,ar10")) {
-@@ -572,7 +572,7 @@ void __init ltq_soc_init(void)
- 				  ltq_ar10_fpi_hz(), ltq_ar10_pp32_hz());
- 		clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
- 		clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
--		clkdev_add_pmu("1e108000.eth", NULL, 1, 0, PMU_SWITCH |
-+		clkdev_add_pmu("1e108000.eth", NULL, 0, 0, PMU_SWITCH |
- 			       PMU_PPE_DP | PMU_PPE_TC);
- 		clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
- 		clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
-@@ -594,11 +594,11 @@ void __init ltq_soc_init(void)
- 		clkdev_add_pmu(NULL, "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
- 
- 		clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
--		clkdev_add_pmu("1e108000.eth", NULL, 1, 0,
-+		clkdev_add_pmu("1e108000.eth", NULL, 0, 0,
- 				PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |
- 				PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |
- 				PMU_PPE_QSB | PMU_PPE_TOP);
--		clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
-+		clkdev_add_pmu("1f203000.rcu", "gphy", 0, 0, PMU_GPHY);
- 		clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
- 		clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
- 		clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
diff --git a/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch b/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch
index 56bca78..a3f2677 100644
--- a/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch
+++ b/target/linux/ramips/patches-4.4/0010-MIPS-ralink-Add-a-few-missing-clocks.patch
@@ -28,7 +28,7 @@ Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
  	if (IS_ENABLED(CONFIG_USB) && is_mt76x8()) {
 --- a/arch/mips/ralink/rt305x.c
 +++ b/arch/mips/ralink/rt305x.c
-@@ -201,6 +201,7 @@ void __init ralink_clk_init(void)
+@@ -190,6 +190,7 @@ void __init ralink_clk_init(void)
  	ralink_clk_add("cpu", cpu_rate);
  	ralink_clk_add("sys", sys_rate);
  	ralink_clk_add("10000b00.spi", sys_rate);
@@ -38,7 +38,7 @@ Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
  	ralink_clk_add("10000500.uart", uart_rate);
 --- a/arch/mips/ralink/rt3883.c
 +++ b/arch/mips/ralink/rt3883.c
-@@ -109,6 +109,7 @@ void __init ralink_clk_init(void)
+@@ -99,6 +99,7 @@ void __init ralink_clk_init(void)
  	ralink_clk_add("10000120.watchdog", sys_rate);
  	ralink_clk_add("10000500.uart", 40000000);
  	ralink_clk_add("10000b00.spi", sys_rate);
diff --git a/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch
index c6a837d..cecca5b 100644
--- a/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch
+++ b/target/linux/ramips/patches-4.4/0031-uvc-add-iPassion-iP2970-support.patch
@@ -13,7 +13,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 
 --- a/drivers/media/usb/uvc/uvc_driver.c
 +++ b/drivers/media/usb/uvc/uvc_driver.c
-@@ -2559,6 +2559,18 @@ static struct usb_device_id uvc_ids[] =
+@@ -2665,6 +2665,18 @@ static struct usb_device_id uvc_ids[] =
  	  .bInterfaceSubClass	= 1,
  	  .bInterfaceProtocol	= 0,
  	  .driver_info		= UVC_QUIRK_FORCE_Y8 },
diff --git a/target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c b/target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c
deleted file mode 100644
index 728ce6f..0000000
--- a/target/linux/ramips/patches-4.4/0068-fix-ralink-prom.c
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/arch/mips/ralink/prom.c
-+++ b/arch/mips/ralink/prom.c
-@@ -30,8 +30,10 @@ const char *get_system_type(void)
- 	return soc_info.sys_type;
- }
- 
--static __init void prom_init_cmdline(int argc, char **argv)
-+static __init void prom_init_cmdline(void)
- {
-+	int argc;
-+	char **argv;
- 	int i;
- 
- 	pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
-@@ -60,14 +62,11 @@ static __init void prom_init_cmdline(int
- 
- void __init prom_init(void)
- {
--	int argc;
--	char **argv;
--
- 	prom_soc_init(&soc_info);
- 
- 	pr_info("SoC Type: %s\n", get_system_type());
- 
--	prom_init_cmdline(argc, argv);
-+	prom_init_cmdline();
- }
- 
- void __init prom_free_prom_memory(void)
diff --git a/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch b/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch
index 2c149cc..35065f5 100644
--- a/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch
+++ b/target/linux/ramips/patches-4.4/0081-MIPS-ralink-Fix-invalid-assignment-of-SoC-type.patch
@@ -16,7 +16,7 @@ Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
 
 --- a/arch/mips/ralink/rt288x.c
 +++ b/arch/mips/ralink/rt288x.c
-@@ -119,5 +119,5 @@ void prom_soc_init(struct ralink_soc_inf
+@@ -109,5 +109,5 @@ void prom_soc_init(struct ralink_soc_inf
  	soc_info->mem_size_max = RT2880_MEM_SIZE_MAX;
  
  	rt2880_pinmux_data = rt2880_pinmux_data_act;
diff --git a/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch b/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch
index e9e72ad..d711f57 100644
--- a/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch
+++ b/target/linux/ramips/patches-4.4/0720-arch-mips-ralink-add-i2c-clocks.patch
@@ -35,7 +35,7 @@
  	ralink_clk_add("10000c00.uartlite", periph_rate);
 --- a/arch/mips/ralink/rt288x.c
 +++ b/arch/mips/ralink/rt288x.c
-@@ -75,6 +75,7 @@ void __init ralink_clk_init(void)
+@@ -65,6 +65,7 @@ void __init ralink_clk_init(void)
  	ralink_clk_add("300100.timer", cpu_rate / 2);
  	ralink_clk_add("300120.watchdog", cpu_rate / 2);
  	ralink_clk_add("300500.uart", cpu_rate / 2);
@@ -45,7 +45,7 @@
  	ralink_clk_add("480000.wmac", wmac_rate);
 --- a/arch/mips/ralink/rt305x.c
 +++ b/arch/mips/ralink/rt305x.c
-@@ -200,6 +200,8 @@ void __init ralink_clk_init(void)
+@@ -189,6 +189,8 @@ void __init ralink_clk_init(void)
  
  	ralink_clk_add("cpu", cpu_rate);
  	ralink_clk_add("sys", sys_rate);
@@ -56,7 +56,7 @@
  	ralink_clk_add("10000100.timer", wdt_rate);
 --- a/arch/mips/ralink/rt3883.c
 +++ b/arch/mips/ralink/rt3883.c
-@@ -108,6 +108,8 @@ void __init ralink_clk_init(void)
+@@ -98,6 +98,8 @@ void __init ralink_clk_init(void)
  	ralink_clk_add("10000100.timer", sys_rate);
  	ralink_clk_add("10000120.watchdog", sys_rate);
  	ralink_clk_add("10000500.uart", 40000000);


From lede-commits at lists.infradead.org  Sun Apr  2 23:53:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 02:53:06 -0400
Subject: [source] build: allow specifying flow-control to grub on serial
 console
In-Reply-To: <20170403065303.5528.20293@git-01.infra.lede-project.org>
References: <20170403065303.5528.20293@git-01.infra.lede-project.org>
Message-ID: <mailman.21740.1491202409.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/7fe5963be023fd59a11652ecfb065d3405a91c48

commit 7fe5963be023fd59a11652ecfb065d3405a91c48
Author: Philip Prindeville <philipp at redfish-solutions.com>
AuthorDate: Mon Feb 6 20:33:36 2017 -0700

    build: allow specifying flow-control to grub on serial console
    
    On the more sophisticated (i.e. deeper FIFO) serial controllers,
    flow-control might be needed to avoid dropping output.
    
    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 config/Config-images.in         | 5 +++++
 target/linux/x86/image/Makefile | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/config/Config-images.in b/config/Config-images.in
index f59a336..95752f7 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -203,6 +203,11 @@ menu "Target Images"
 		default 38400 if TARGET_x86_generic
 		default 115200
 
+	config GRUB_FLOWCONTROL
+		bool "Use RTE/CTS on serial console"
+		depends on GRUB_SERIAL != ""
+		default n
+
 	config GRUB_BOOTOPTS
 		string "Extra kernel boot options"
 		depends on GRUB_IMAGES
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index f34788d..ca5d012 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -32,8 +32,8 @@ endif
 GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL))
 
 ifneq ($(GRUB_SERIAL),)
-  GRUB_CONSOLE_CMDLINE += console=$(GRUB_SERIAL),$(CONFIG_GRUB_BAUDRATE)n8
-  GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1 --rtscts=off
+  GRUB_CONSOLE_CMDLINE += console=$(GRUB_SERIAL),$(CONFIG_GRUB_BAUDRATE)n8$(if $(CONFIG_GRUB_FLOWCONTROL),r,)
+  GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1 --rtscts=$(if $(CONFIG_GRUB_FLOWCONTROL),on,off)
   GRUB_TERMINALS += serial
 endif
 


From lede-commits at lists.infradead.org  Sun Apr  2 23:53:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 02:53:04 -0400
Subject: [source] busybox: don't install NTP scripts if NTP isn't configured
In-Reply-To: <20170403065303.5528.20293@git-01.infra.lede-project.org>
References: <20170403065303.5528.20293@git-01.infra.lede-project.org>
Message-ID: <mailman.21741.1491202409.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/0b24850e97789818fadcbce4b8de4abc429fd9f2

commit 0b24850e97789818fadcbce4b8de4abc429fd9f2
Author: Philip Prindeville <philipp at redfish-solutions.com>
AuthorDate: Mon Feb 6 15:26:49 2017 -0700

    busybox: don't install NTP scripts if NTP isn't configured
    
    If you're using Chrony or NTPD you don't want the busybox NTP server
    as well.  Make it's installation truly conditional.
    
    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
    Signed-off-by: Felix Fietkau <nbd at nbd.name> [simplify]
---
 package/utils/busybox/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index b75b455..48d9457 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -112,9 +112,13 @@ endef
 define Package/busybox/install
 	$(INSTALL_DIR) $(1)/etc/init.d
 	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
+ifneq ($(CONFIG_BUSYBOX_CONFIG_CROND),)
 	$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
+endif
+ifneq ($(CONFIG_BUSYBOX_CONFIG_NTPD),)
 	$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
 	$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
+endif
 	-rm -rf $(1)/lib64
 endef
 


From lede-commits at lists.infradead.org  Sun Apr  2 23:53:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 02:53:07 -0400
Subject: [source]  build: move PKG_CONFIG_DEPENDS from feeds.mk to opkg
In-Reply-To: <20170403065303.5528.20293@git-01.infra.lede-project.org>
References: <20170403065303.5528.20293@git-01.infra.lede-project.org>
Message-ID: <mailman.21742.1491202411.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/6411a12de2c783bc8882f43d593d9fa63f9b0759

commit 6411a12de2c783bc8882f43d593d9fa63f9b0759
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Mar 27 10:21:24 2017 +0200

    build: move PKG_CONFIG_DEPENDS from feeds.mk to opkg
    
    Normal packages don't rely on the feed configuration variables for the
    build step
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/feeds.mk             | 6 ------
 package/system/opkg/Makefile | 9 ++++++++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/feeds.mk b/include/feeds.mk
index 054b5aa..f89687a 100644
--- a/include/feeds.mk
+++ b/include/feeds.mk
@@ -29,12 +29,6 @@ opkg_package_files = $(wildcard \
 	$(foreach dir,$(PACKAGE_SUBDIRS), \
 	  $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
 
-PKG_CONFIG_DEPENDS += \
-	CONFIG_PER_FEED_REPO \
-	CONFIG_PER_FEED_REPO_ADD_DISABLED \
-	CONFIG_PER_FEED_REPO_ADD_COMMENTED \
-	$(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed))
-
 # 1: package name
 define FeedPackageDir
 $(strip $(if $(CONFIG_PER_FEED_REPO), \
diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index 3bd2a03..132721d 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -26,7 +26,14 @@ PKG_LICENSE_FILES:=COPYING
 PKG_MAINTAINER:=Jo-Philipp Wich <jo at mein.io>
 
 PKG_FLAGS := nonshared
-PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH
+
+PKG_CONFIG_DEPENDS := \
+	CONFIG_SIGNED_PACKAGES \
+	CONFIG_TARGET_INIT_PATH \
+	CONFIG_PER_FEED_REPO \
+	CONFIG_PER_FEED_REPO_ADD_DISABLED \
+	CONFIG_PER_FEED_REPO_ADD_COMMENTED \
+	$(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed))
 
 PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1


From lede-commits at lists.infradead.org  Sun Apr  2 23:53:03 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 02:53:03 -0400
Subject: [source] modules: Add kmod-igbvf kernel module for Intel(R) 82576
 Virtual Function Ethernet adapters
In-Reply-To: <20170403065303.5528.20293@git-01.infra.lede-project.org>
References: <20170403065303.5528.20293@git-01.infra.lede-project.org>
Message-ID: <mailman.21743.1491202411.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/7a5257654c552e2ceeaaafacdff6062f27bd601e

commit 7a5257654c552e2ceeaaafacdff6062f27bd601e
Author: Ye Tao <tydus at hongo.wide.ad.jp>
AuthorDate: Sun Feb 19 21:57:11 2017 +0900

    modules: Add kmod-igbvf kernel module for Intel(R) 82576 Virtual Function Ethernet adapters
    
    Intel(R) 82576 is an adapter which supports SR-IOV. Thus the host can
    assign Virtual Functions (VFs) to different VMs by the PCI-E Passthrough
    (e.g. VFIO for KVM), to gain different advantages (performance, VF to VF
    communications, host kernel offload, etc.).
    
    The driver of the passthroughed VFs is the igbvf (igb is NOT
    compatible).
    
    This is essential for VM guests, to enable them to utilize this feature.
    
    Signed-off-by: Ye Tao <tydus at hongo.wide.ad.jp>
---
 package/kernel/linux/modules/netdevices.mk | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk
index 9d861d6..4af06c6 100644
--- a/package/kernel/linux/modules/netdevices.mk
+++ b/package/kernel/linux/modules/netdevices.mk
@@ -522,6 +522,24 @@ endef
 $(eval $(call KernelPackage,igb))
 
 
+define KernelPackage/igbvf
+  SUBMENU:=$(NETWORK_DEVICES_MENU)
+  TITLE:=Intel(R) 82576 Virtual Function Ethernet support
+  DEPENDS:=@PCI_SUPPORT @TARGET_x86 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp
+  KCONFIG:=CONFIG_IGBVF \
+    CONFIG_IGB_HWMON=n \
+    CONFIG_IGB_DCA=n
+  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/igbvf/igbvf.ko
+  AUTOLOAD:=$(call AutoLoad,35,igbvf)
+endef
+
+define KernelPackage/igbvf/description
+ Kernel modules for Intel(R) 82576 Virtual Function Ethernet adapters.
+endef
+
+$(eval $(call KernelPackage,igbvf))
+
+
 define KernelPackage/ixgbe
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Intel(R) 82598/82599 PCI-Express 10 Gigabit Ethernet support


From lede-commits at lists.infradead.org  Sun Apr  2 23:53:05 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 02:53:05 -0400
Subject: [source]  kexec-tools: get kexec running on MUSL and x86 hardware
In-Reply-To: <20170403065303.5528.20293@git-01.infra.lede-project.org>
References: <20170403065303.5528.20293@git-01.infra.lede-project.org>
Message-ID: <mailman.21744.1491202412.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/dfacdc6a99757fcf7804b38784fc24f9fad30650

commit dfacdc6a99757fcf7804b38784fc24f9fad30650
Author: Philip Prindeville <philipp at redfish-solutions.com>
AuthorDate: Tue Mar 21 21:55:23 2017 -0600

    kexec-tools: get kexec running on MUSL and x86 hardware
    
    Couple of important upstream patches (slated for 2.0.15) that
    are necessary for kexec to run on MUSL and on x86 hardware.
    
    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 .../patches/120-fail-to-get-symbol-debug.patch     |  33 ++++
 .../patches/130-dont-use-percentL.patch            | 178 +++++++++++++++++++++
 2 files changed, 211 insertions(+)

diff --git a/package/boot/kexec-tools/patches/120-fail-to-get-symbol-debug.patch b/package/boot/kexec-tools/patches/120-fail-to-get-symbol-debug.patch
new file mode 100644
index 0000000..d80c6db
--- /dev/null
+++ b/package/boot/kexec-tools/patches/120-fail-to-get-symbol-debug.patch
@@ -0,0 +1,33 @@
+commit 263e45ccf27b21e9862cc538ed28978533d04e4b
+Author: Baoquan He <bhe at redhat.com>
+Date:   Fri Mar 3 11:52:15 2017 +0800
+
+    Only print debug message when failed to serach for kernel symbol from /proc/kallsyms
+    
+    Kernel symbol page_offset_base could be unavailable when mm KASLR code is
+    not compiled in kernel. It's inappropriate to print out error message
+    when failed to search for page_offset_base from /proc/kallsyms. Seems now
+    there is not a way to find out if mm KASLR is compiled in or not. An
+    alternative approach is only printing out debug message in get_kernel_sym
+    if failed to search a expected kernel symbol.
+    
+    Do it in this patch, a simple fix.
+    
+    Signed-off-by: Baoquan He <bhe at redhat.com>
+    Reviewed-by: Pratyush Anand <panand at redhat.com>
+    Acked-by: Dave Young <dyoung at redhat.com>
+    Signed-off-by: Simon Horman <horms at verge.net.au>
+
+diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
+index 88aeee3..c4cf201 100644
+--- a/kexec/arch/i386/crashdump-x86.c
++++ b/kexec/arch/i386/crashdump-x86.c
+@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
+ 		}
+ 	}
+ 
+-	fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
++	dbgprintf("Cannot get kernel %s symbol address\n", symbol);
+ 	return 0;
+ }
+ 
diff --git a/package/boot/kexec-tools/patches/130-dont-use-percentL.patch b/package/boot/kexec-tools/patches/130-dont-use-percentL.patch
new file mode 100644
index 0000000..70a6873
--- /dev/null
+++ b/package/boot/kexec-tools/patches/130-dont-use-percentL.patch
@@ -0,0 +1,178 @@
+commit f14881e87b1426d2c439e2fad9a1e03a3b35e196
+Author: Philip Prindeville <philipp at redfish-solutions.com>
+Date:   Fri Mar 10 19:57:11 2017 -0700
+
+    Don't use %L width specifier with integer values
+    
+    MUSL doesn't support %L except for floating-point arguments; therefore,
+    %ll must be used instead with integer arguments.
+    
+    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
+
+diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c
+index 2194b7c..49f35b1 100644
+--- a/kexec/arch/arm/kexec-arm.c
++++ b/kexec/arch/arm/kexec-arm.c
+@@ -47,7 +47,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
+ 		int count;
+ 		if (memory_ranges >= MAX_MEMORY_RANGES)
+ 			break;
+-		count = sscanf(line, "%Lx-%Lx : %n",
++		count = sscanf(line, "%llx-%llx : %n",
+ 			&start, &end, &consumed);
+ 		if (count != 2)
+ 			continue;
+diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
+index c4cf201..285dea9 100644
+--- a/kexec/arch/i386/crashdump-x86.c
++++ b/kexec/arch/i386/crashdump-x86.c
+@@ -119,7 +119,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
+ 	}
+ 
+ 	while(fgets(line, sizeof(line), fp) != NULL) {
+-		if (sscanf(line, "%Lx %c %s", &vaddr, &type, sym) != 3)
++		if (sscanf(line, "%llx %c %s", &vaddr, &type, sym) != 3)
+ 			continue;
+ 		if (strcmp(sym, symbol) == 0) {
+ 			dbgprintf("kernel symbol %s vaddr = %16llx\n", symbol, vaddr);
+@@ -296,12 +296,12 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
+ 
+ 		if (memory_ranges >= CRASH_MAX_MEMORY_RANGES)
+ 			break;
+-		count = sscanf(line, "%Lx-%Lx : %n",
++		count = sscanf(line, "%llx-%llx : %n",
+ 			&start, &end, &consumed);
+ 		if (count != 2)
+ 			continue;
+ 		str = line + consumed;
+-		dbgprintf("%016Lx-%016Lx : %s",
++		dbgprintf("%016llx-%016llx : %s",
+ 			start, end, str);
+ 		/* Only Dumping memory of type System RAM. */
+ 		if (memcmp(str, "System RAM\n", 11) == 0) {
+@@ -778,7 +778,7 @@ static int get_crash_notes(int cpu, uint64_t *addr, uint64_t *len)
+ 		*addr = x86__pa(vaddr + (cpu * MAX_NOTE_BYTES));
+ 		*len = MAX_NOTE_BYTES;
+ 
+-		dbgprintf("crash_notes addr = %Lx\n",
++		dbgprintf("crash_notes addr = %llx\n",
+ 			  (unsigned long long)*addr);
+ 
+ 		fclose(fp);
+diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
+index 3e97239..be03618 100644
+--- a/kexec/arch/i386/kexec-x86-common.c
++++ b/kexec/arch/i386/kexec-x86-common.c
+@@ -81,7 +81,7 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
+ 		int count;
+ 		if (memory_ranges >= MAX_MEMORY_RANGES)
+ 			break;
+-		count = sscanf(line, "%Lx-%Lx : %n",
++		count = sscanf(line, "%llx-%llx : %n",
+ 			&start, &end, &consumed);
+ 		if (count != 2)
+ 			continue;
+diff --git a/kexec/arch/ia64/kexec-elf-rel-ia64.c b/kexec/arch/ia64/kexec-elf-rel-ia64.c
+index 7f7c08c..500f247 100644
+--- a/kexec/arch/ia64/kexec-elf-rel-ia64.c
++++ b/kexec/arch/ia64/kexec-elf-rel-ia64.c
+@@ -155,6 +155,6 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr,
+ 	}
+ 	return;
+ overflow:
+-	die("overflow in relocation type %lu val %Lx\n", 
++	die("overflow in relocation type %lu val %llx\n",
+ 			r_type, value);
+ }
+diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
+index 9c33599..6308ec8 100644
+--- a/kexec/arch/mips/crashdump-mips.c
++++ b/kexec/arch/mips/crashdump-mips.c
+@@ -173,7 +173,7 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
+ 		int type, consumed, count;
+ 		if (memory_ranges >= CRASH_MAX_MEMORY_RANGES)
+ 			break;
+-		count = sscanf(line, "%Lx-%Lx : %n",
++		count = sscanf(line, "%llx-%llx : %n",
+ 			&start, &end, &consumed);
+ 		if (count != 2)
+ 			continue;
+diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
+index ee3cd3a..2e5b700 100644
+--- a/kexec/arch/mips/kexec-mips.c
++++ b/kexec/arch/mips/kexec-mips.c
+@@ -48,7 +48,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
+ 	while (fgets(line, sizeof(line), fp) != 0) {
+ 		if (memory_ranges >= MAX_MEMORY_RANGES)
+ 			break;
+-		count = sscanf(line, "%Lx-%Lx : %n", &start, &end, &consumed);
++		count = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed);
+ 		if (count != 2)
+ 			continue;
+ 		str = line + consumed;
+diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c
+index f863483..33ba6b9 100644
+--- a/kexec/arch/s390/kexec-s390.c
++++ b/kexec/arch/s390/kexec-s390.c
+@@ -170,7 +170,7 @@ int get_memory_ranges_s390(struct memory_range memory_range[], int *ranges,
+ 		if (current_range == MAX_MEMORY_RANGES)
+ 			break;
+ 
+-		sscanf(line,"%Lx-%Lx : %n", &start, &end, &cons);
++		sscanf(line,"%llx-%llx : %n", &start, &end, &cons);
+ 		str = line+cons;
+ 		if ((memcmp(str, sys_ram, strlen(sys_ram)) == 0) ||
+ 		    ((memcmp(str, crash_kernel, strlen(crash_kernel)) == 0) &&
+diff --git a/kexec/crashdump.c b/kexec/crashdump.c
+index 15c1105..0b363c5 100644
+--- a/kexec/crashdump.c
++++ b/kexec/crashdump.c
+@@ -98,7 +98,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
+ 	}
+ 	if (!fgets(line, sizeof(line), fp))
+ 		die("Cannot parse %s: %s\n", crash_notes, strerror(errno));
+-	count = sscanf(line, "%Lx", &temp);
++	count = sscanf(line, "%llx", &temp);
+ 	if (count != 1)
+ 		die("Cannot parse %s: %s\n", crash_notes, strerror(errno));
+ 	*addr = (uint64_t) temp;
+@@ -112,7 +112,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
+ 		if (!fgets(line, sizeof(line), fp))
+ 			die("Cannot parse %s: %s\n",
+ 			    crash_notes_size, strerror(errno));
+-		count = sscanf(line, "%Lu", &temp);
++		count = sscanf(line, "%llu", &temp);
+ 		if (count != 1)
+ 			die("Cannot parse %s: %s\n",
+ 			    crash_notes_size, strerror(errno));
+@@ -120,7 +120,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
+ 		fclose(fp);
+ 	}
+ 
+-	dbgprintf("%s: crash_notes addr = %Lx, size = %Lu\n", __FUNCTION__,
++	dbgprintf("%s: crash_notes addr = %llx, size = %llu\n", __FUNCTION__,
+ 		  (unsigned long long)*addr, (unsigned long long)*len);
+ 
+ 	return 0;
+@@ -141,7 +141,7 @@ static int get_vmcoreinfo(const char *kdump_info, uint64_t *addr, uint64_t *len)
+ 
+ 	if (!fgets(line, sizeof(line), fp))
+ 		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
+-	count = sscanf(line, "%Lx %Lx", &temp, &temp2);
++	count = sscanf(line, "%llx %llx", &temp, &temp2);
+ 	if (count != 2)
+ 		die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
+ 
+diff --git a/kexec/kexec-iomem.c b/kexec/kexec-iomem.c
+index 485a2e8..7ec3853 100644
+--- a/kexec/kexec-iomem.c
++++ b/kexec/kexec-iomem.c
+@@ -44,7 +44,7 @@ int kexec_iomem_for_each_line(char *match,
+ 		die("Cannot open %s\n", iomem);
+ 
+ 	while(fgets(line, sizeof(line), fp) != 0) {
+-		count = sscanf(line, "%Lx-%Lx : %n", &start, &end, &consumed);
++		count = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed);
+ 		if (count != 2)
+ 			continue;
+ 		str = line + consumed;


From lede-commits at lists.infradead.org  Mon Apr  3 01:36:45 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 04:36:45 -0400
Subject: [source]  netifd: fix fw3 warnings in dhcp script
In-Reply-To: <20170403083645.22459.69388@git-01.infra.lede-project.org>
References: <20170403083645.22459.69388@git-01.infra.lede-project.org>
Message-ID: <mailman.21763.1491208755.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/20e40db524fb6c391f47619b18bf36bf7932478a

commit 20e40db524fb6c391f47619b18bf36bf7932478a
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Sun Apr 2 21:13:08 2017 +0200

    netifd: fix fw3 warnings in dhcp script
    
    Fix fw3 warnings in dhcp script in case fw3 is not enabled
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/config/netifd/files/lib/netifd/dhcp.script | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script
index b3a61e2..e841f91 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -60,7 +60,7 @@ setup_interface () {
 		ip6rd="${ip6rd#* }"
 		local ip6rdbr="${ip6rd%% *}"
 
-		[ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE)
+		[ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE 2>/dev/null)
 		[ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6
 
 		json_init


From lede-commits at lists.infradead.org  Mon Apr  3 03:38:19 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 06:38:19 -0400
Subject: [source]  ar71xx: add TP-LINK TL-WR841N/ND v12 image
In-Reply-To: <20170403103818.8942.79148@git-01.infra.lede-project.org>
References: <20170403103818.8942.79148@git-01.infra.lede-project.org>
Message-ID: <mailman.21808.1491215923.26984.lede-commits@lists.infradead.org>

pepe2k pushed a commit to source.git, branch master:
https://git.lede-project.org/539e2a78f08860ea37442639d52b5d3c62cdfb67

commit 539e2a78f08860ea37442639d52b5d3c62cdfb67
Author: Vittorio Gambaletta <openwrt at vittgam.net>
AuthorDate: Sun Mar 26 09:55:44 2017 +0200

    ar71xx: add TP-LINK TL-WR841N/ND v12 image
    
    This router has the same hardware as TP-LINK TL-WR841N/ND v11 (same FCC
    ID, same TFTP image name...).
    
    If the stock firmware web interface doesn't accept LEDE factory image,
    it can be flashed via the U-Boot TFTP recovery mode, by long-pressing
    the reset button after power on.
    
    The TFTP image name is wr841nv11_tp_recovery.bin (yes, v11, not v12).
    
    Signed-off-by: Vittorio Gambaletta <openwrt at vittgam.net>
---
 target/linux/ar71xx/image/tp-link.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index cf2e5e7..cea039d 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -736,6 +736,12 @@ define Device/tl-wr841-v11
   IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
 endef
 
+define Device/tl-wr841-v12
+  $(Device/tl-wr841-v11)
+  DEVICE_TITLE := TP-LINK TL-WR841N/ND v12
+  TPLINK_HWID := 0x08410012
+endef
+
 define Device/tl-wr842n-v1
   $(Device/tplink-8m)
   DEVICE_TITLE := TP-LINK TL-WR842N/ND v1
@@ -778,7 +784,7 @@ define Device/tl-wr847n-v8
   DEVICE_PROFILE := TLWR841
   TPLINK_HWID := 0x08470008
 endef
-TARGET_DEVICES += tl-wr840n-v2 tl-wr840n-v3 tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
+TARGET_DEVICES += tl-wr840n-v2 tl-wr840n-v3 tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr841-v12 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
 
 define Device/tl-wr941nd-v2
   $(Device/tplink-4m)


From lede-commits at lists.infradead.org  Mon Apr  3 03:38:20 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 06:38:20 -0400
Subject: [source]  ar71xx: add userspace support for Mikrotik RB2011iL
In-Reply-To: <20170403103818.8942.79148@git-01.infra.lede-project.org>
References: <20170403103818.8942.79148@git-01.infra.lede-project.org>
Message-ID: <mailman.21811.1491215923.26984.lede-commits@lists.infradead.org>

pepe2k pushed a commit to source.git, branch master:
https://git.lede-project.org/156d9255f2c621ffe58321d73b737613f70e0503

commit 156d9255f2c621ffe58321d73b737613f70e0503
Author: Ron Angeles <ronangeles at gmail.com>
AuthorDate: Mon Mar 27 18:55:48 2017 -0700

    ar71xx: add userspace support for Mikrotik RB2011iL
    
    Kernel/hardware support for this board has been implemented since
    Chaos Calmer. This set of patches is to get the board identified in
    userland. This will allow support for things like sysupgrade,
    configuring initial LED state, configuring initial switch state, etc.
    
    Signed-off-by: Ron Angeles <ronangeles at gmail.com>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds                   | 1 +
 target/linux/ar71xx/base-files/etc/board.d/02_network                | 1 +
 target/linux/ar71xx/base-files/etc/diag.sh                           | 1 +
 .../ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration  | 5 +++--
 target/linux/ar71xx/base-files/lib/ar71xx.sh                         | 3 +++
 target/linux/ar71xx/base-files/lib/upgrade/platform.sh               | 2 ++
 6 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 1a4b02c..1ac3dc4 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -256,6 +256,7 @@ rb-952ui-5ac2nd)
 rb-962uigs-5hact2hnt)
 	ucidef_set_led_timer "user" "USER/SFP" "rb:green:user" "1000" "1000"
 	;;
+rb-2011il|\
 rb-2011l|\
 rb-2011uas|\
 rb-2011uias|\
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index bf7c4dc..b0bf413 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -272,6 +272,7 @@ ar71xx_setup_interfaces()
 			"0 at eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1"
 	;;
 	db120|\
+	rb-2011il|\
 	rb-2011l|\
 	rb-2011uas|\
 	rb-2011uas-2hnd|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 3cde175..cea95b7 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -284,6 +284,7 @@ get_status_led() {
 	r602n)
 		status_led="$board:green:wan"
 		;;
+	rb-2011il|\
 	rb-2011l|\
 	rb-2011uas|\
 	rb-2011uas-2hnd)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
index 0558848..a99a4ec 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
@@ -86,8 +86,9 @@ rb-450)
 	migrate_switch_name "eth1" "switch0"
 	;;
 
-db120 |\
-rb-2011l | \
+db120|\
+rb-2011il|\
+rb-2011l|\
 rb-2011uas-2hnd)
 	migrate_switch_name "eth0" "switch0"
 	migrate_switch_name "eth1" "switch1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 25f6b01..547e0e4 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -824,6 +824,9 @@ ar71xx_board_detect() {
 	*"Rocket M XW")
 		name="rocket-m-xw"
 		;;
+	*"RouterBOARD 2011iL")
+		name="rb-2011il"
+		;;
 	*"RouterBOARD 2011L")
 		name="rb-2011l"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index fb58209..27b0f8a 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -508,6 +508,7 @@ platform_check_image() {
 	rb-951g-2hnd|\
 	rb-951ui-2hnd|\
 	rb-2011l|\
+	rb-2011il|\
 	rb-2011uas|\
 	rb-2011uias|\
 	rb-2011uas-2hnd|\
@@ -682,6 +683,7 @@ platform_pre_upgrade() {
 	rb-912uag-5hpnd|\
 	rb-951g-2hnd|\
 	rb-951ui-2hnd|\
+	rb-2011il|\
 	rb-2011l|\
 	rb-2011uas|\
 	rb-2011uias|\


From lede-commits at lists.infradead.org  Mon Apr  3 03:38:21 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 06:38:21 -0400
Subject: [source] ar71xx: tp-link.mk: always include device version in image
 and DEVICE_TITLE
In-Reply-To: <20170403103818.8942.79148@git-01.infra.lede-project.org>
References: <20170403103818.8942.79148@git-01.infra.lede-project.org>
Message-ID: <mailman.21812.1491215926.26984.lede-commits@lists.infradead.org>

pepe2k pushed a commit to source.git, branch master:
https://git.lede-project.org/190db43615f0f7aa1dfbb8638d055e2e751c1d80

commit 190db43615f0f7aa1dfbb8638d055e2e751c1d80
Author: Piotr Dymacz <pepe2k at gmail.com>
AuthorDate: Thu Mar 23 23:49:28 2017 +0100

    ar71xx: tp-link.mk: always include device version in image and DEVICE_TITLE
    
    There are currently several supported TP-Link devices without specified
    version number in image name and/or DEVICE_TITLE (e.g. WBS210, WBS510,
    TL-WR810N, TL-WA7510N, TL-WPA8630), but vendor website shows that there
    are already more than one version of them on the market.
    
    For devices like Archer C5, which second version is based on a total
    different platform, missing version number in DEVICE_TITLE (used in
    menuconfig) might be misleading for users.
    
    To make it less confusing for users and easier to maintain in future,
    include version number in image name and DEVICE_TITLE for all TP-Link
    devices, even if there is only one version of device at the moment.
    
    Also, keep DEVICE_TITLE in same format for all TP-Link devices.
    
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
    Acked-by: John Crispin <john at phrozen.org>
---
 target/linux/ar71xx/image/tp-link.mk | 108 +++++++++++++++++------------------
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index cea039d..6ddf052 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -134,8 +134,8 @@ define Device/archer-c60-v1
 endef
 TARGET_DEVICES += archer-c60-v1
 
-define Device/cpe510-520
-  DEVICE_TITLE := TP-LINK CPE510/520
+define Device/cpe510-520-v1
+  DEVICE_TITLE := TP-LINK CPE510/520 v1
   DEVICE_PACKAGES := rssileds
   MTDPARTS := spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),6144k(rootfs),192k(config)ro,64k(ART)ro,7680k at 0x40000(firmware)
   IMAGE_SIZE := 7680k
@@ -149,33 +149,33 @@ define Device/cpe510-520
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
 
-define Device/cpe210-220
-  $(Device/cpe510-520)
-  DEVICE_TITLE := TP-LINK CPE210/220
+define Device/cpe210-220-v1
+  $(Device/cpe510-520-v1)
+  DEVICE_TITLE := TP-LINK CPE210/220 v1
   DEVICE_PACKAGES := rssileds
   BOARDNAME := CPE210
   TPLINK_BOARD_NAME := CPE210
 endef
 
-define Device/wbs210
-  $(Device/cpe510-520)
-  DEVICE_TITLE := TP-LINK WBS210
+define Device/wbs210-v1
+  $(Device/cpe510-520-v1)
+  DEVICE_TITLE := TP-LINK WBS210 v1
   DEVICE_PACKAGES := rssileds
   BOARDNAME := WBS210
   TPLINK_BOARD_NAME := WBS210
 endef
 
-define Device/wbs510
-  $(Device/cpe510-520)
-  DEVICE_TITLE := TP-LINK WBS510
+define Device/wbs510-v1
+  $(Device/cpe510-520-v1)
+  DEVICE_TITLE := TP-LINK WBS510 v1
   DEVICE_PACKAGES := rssileds
   BOARDNAME := WBS510
   TPLINK_BOARD_NAME := WBS510
 endef
-TARGET_DEVICES += cpe210-220 cpe510-520 wbs210 wbs510
+TARGET_DEVICES += cpe210-220-v1 cpe510-520-v1 wbs210-v1 wbs510-v1
 
-define Device/re450
-  DEVICE_TITLE := TP-LINK RE450
+define Device/re450-v1
+  DEVICE_TITLE := TP-LINK RE450 v1
   DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
   MTDPARTS := spi0.0:128k(u-boot)ro,1344k(kernel),4672k(rootfs),64k(pation-table)ro,64k(product-info)ro,1856k(config)ro,64k(art)ro,6016k at 0x20000(firmware)
   IMAGE_SIZE := 7936k
@@ -188,10 +188,10 @@ define Device/re450
   IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
-TARGET_DEVICES += re450
+TARGET_DEVICES += re450-v1
 
-define Device/eap120
-  DEVICE_TITLE := TP-LINK EAP120
+define Device/eap120-v1
+  DEVICE_TITLE := TP-LINK EAP120 v1
   MTDPARTS := spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),14336k(rootfs),192k(config)ro,64k(ART)ro,15872k at 0x40000(firmware)
   IMAGE_SIZE := 15872k
   BOARDNAME := EAP120
@@ -203,7 +203,7 @@ define Device/eap120
   IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
-TARGET_DEVICES += eap120
+TARGET_DEVICES += eap120-v1
 
 define Device/tl-wdr4300-v1
   $(Device/tplink-8mlzma)
@@ -236,7 +236,7 @@ endef
 
 define Device/tl-wdr4300-v1-il
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WDR4300 v1 IL
+  DEVICE_TITLE := TP-LINK TL-WDR4300 v1 (IL)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-WDR4300
   DEVICE_PROFILE := TLWDR4300
@@ -261,7 +261,7 @@ TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-
 
 define Device/tl-wdr6500-v2
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WDR6500v2
+  DEVICE_TITLE := TP-LINK TL-WDR6500 v2
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x
   KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
   KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | mktplinkfw-combined
@@ -274,7 +274,7 @@ TARGET_DEVICES += tl-wdr6500-v2
 
 define Device/tl-wdr3320-v2
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WDR3320v2
+  DEVICE_TITLE := TP-LINK TL-WDR3320 v2
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME = TL-WDR3320-v2
   DEVICE_PROFILE = TLWDR3320V2
@@ -285,7 +285,7 @@ TARGET_DEVICES += tl-wdr3320-v2
 
 define Device/archer-c5-v1
   $(Device/tplink-16mlzma)
-  DEVICE_TITLE := TP-LINK Archer C5
+  DEVICE_TITLE := TP-LINK Archer C5 v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x
   BOARDNAME := ARCHER-C5
   DEVICE_PROFILE := ARCHERC7
@@ -315,7 +315,7 @@ endef
 
 define Device/archer-c7-v2-il
   $(Device/tplink-16mlzma)
-  DEVICE_TITLE := TP-LINK Archer C7 v2 IL
+  DEVICE_TITLE := TP-LINK Archer C7 v2 (IL)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x
   BOARDNAME := ARCHER-C7-V2
   DEVICE_PROFILE := ARCHERC7
@@ -335,7 +335,7 @@ TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 archer-c7-v2-il tl-wdr7
 
 define Device/tl-mr10u-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR10U
+  DEVICE_TITLE := TP-LINK TL-MR10U v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   BOARDNAME := TL-MR10U
   DEVICE_PROFILE := TLMR10U
@@ -345,7 +345,7 @@ endef
 
 define Device/tl-mr11u-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR11U
+  DEVICE_TITLE := TP-LINK TL-MR11U v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR11U
   DEVICE_PROFILE := TLMR11U
@@ -365,7 +365,7 @@ endef
 
 define Device/tl-mr12u-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR12U
+  DEVICE_TITLE := TP-LINK TL-MR12U v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR13U
   DEVICE_PROFILE := TLMR12U
@@ -375,7 +375,7 @@ endef
 
 define Device/tl-mr13u-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR13U
+  DEVICE_TITLE := TP-LINK TL-MR13U v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR13U
   DEVICE_PROFILE := TLMR13U
@@ -386,7 +386,7 @@ TARGET_DEVICES += tl-mr10u-v1 tl-mr11u-v1 tl-mr11u-v2 tl-mr12u-v1 tl-mr13u-v1
 
 define Device/tl-mr3020-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR3020
+  DEVICE_TITLE := TP-LINK TL-MR3020 v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR3020
   DEVICE_PROFILE := TLMR3020
@@ -396,7 +396,7 @@ endef
 
 define Device/tl-mr3040-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR3040
+  DEVICE_TITLE := TP-LINK TL-MR3040 v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR3040
   DEVICE_PROFILE := TLMR3040
@@ -406,7 +406,7 @@ endef
 
 define Device/tl-mr3040-v2
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-MR3040
+  DEVICE_TITLE := TP-LINK TL-MR3040 v2
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR3040-v2
   DEVICE_PROFILE := TLMR3040
@@ -416,7 +416,7 @@ endef
 
 define Device/tl-mr3220-v1
   $(Device/tplink-4m)
-  DEVICE_TITLE := TP-LINK TL-MR3220
+  DEVICE_TITLE := TP-LINK TL-MR3220 v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR3220
   DEVICE_PROFILE := TLMR3220
@@ -435,7 +435,7 @@ endef
 
 define Device/tl-mr3420-v1
   $(Device/tplink-4m)
-  DEVICE_TITLE := TP-LINK TL-MR3420
+  DEVICE_TITLE := TP-LINK TL-MR3420 v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-MR3420
   DEVICE_PROFILE := TLMR3420
@@ -452,19 +452,19 @@ define Device/tl-mr3420-v2
 endef
 TARGET_DEVICES += tl-mr3020-v1 tl-mr3040-v1 tl-mr3040-v2 tl-mr3220-v1 tl-mr3220-v2 tl-mr3420-v1 tl-mr3420-v2
 
-define Device/tl-wpa8630
+define Device/tl-wpa8630-v1
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WPA8630
+  DEVICE_TITLE := TP-LINK TL-WPA8630 v1
   DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
   BOARDNAME := TL-WPA8630
   DEVICE_PROFILE := TL-WPA8630
   TPLINK_HWID := 0x86300001
 endef
-TARGET_DEVICES += tl-wpa8630
+TARGET_DEVICES += tl-wpa8630-v1
 
 define Device/tl-wr703n-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WR703N
+  DEVICE_TITLE := TP-LINK TL-WR703N v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   BOARDNAME := TL-WR703N
   DEVICE_PROFILE := TLWR703
@@ -474,7 +474,7 @@ endef
 
 define Device/tl-wr710n-v1
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WR710N
+  DEVICE_TITLE := TP-LINK TL-WR710N v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   BOARDNAME := TL-WR710N
   DEVICE_PROFILE := TLWR710
@@ -600,15 +600,15 @@ define Device/tl-wr741nd-v5
   CONSOLE := ttyATH0,115200
 endef
 
-define Device/tl-wr810n
+define Device/tl-wr810n-v1
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WR810N
+  DEVICE_TITLE := TP-LINK TL-WR810N v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   BOARDNAME := TL-WR810N
   DEVICE_PROFILE := TLWR810
   TPLINK_HWID := 0x08100001
 endef
-TARGET_DEVICES += tl-wr810n
+TARGET_DEVICES += tl-wr810n-v1
 
 define Device/tl-wr743nd-v1
   $(Device/tplink-4m)
@@ -771,7 +771,7 @@ endef
 
 define Device/tl-wr843nd-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WR843N/ND
+  DEVICE_TITLE := TP-LINK TL-WR843N/ND v1
   BOARDNAME := TL-WR841N-v8
   DEVICE_PROFILE := TLWR843
   TPLINK_HWID := 0x08430001
@@ -851,7 +851,7 @@ TARGET_DEVICES += tl-wr941nd-v2 tl-wr941nd-v3 tl-wr941nd-v4 tl-wr941nd-v5 tl-wr9
 
 define Device/tl-wr1041n-v2
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WR1041N
+  DEVICE_TITLE := TP-LINK TL-WR1041N v2
   BOARDNAME := TL-WR1041N-v2
   DEVICE_PROFILE := TLWR1041
   TPLINK_HWID := 0x10410002
@@ -905,7 +905,7 @@ TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 tl-wr1043nd-v4
 
 define Device/tl-wr2543-v1
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WR2543N/ND
+  DEVICE_TITLE := TP-LINK TL-WR2543N/ND v1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-WR2543N
   DEVICE_PROFILE := TLWR2543
@@ -917,7 +917,7 @@ TARGET_DEVICES += tl-wr2543-v1
 
 define Device/tl-wdr4900-v2
   $(Device/tplink-8mlzma)
-  DEVICE_TITLE := TP-LINK TL-WDR4900v2
+  DEVICE_TITLE := TP-LINK TL-WDR4900 v2
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   BOARDNAME := TL-WDR4900-v2
   DEVICE_PROFILE := TLWDR4900V2
@@ -944,7 +944,7 @@ endef
 
 define Device/tl-wa730re-v1
   $(Device/tplink-4m)
-  DEVICE_TITLE := TP-LINK TL-WA730RE
+  DEVICE_TITLE := TP-LINK TL-WA730RE v1
   BOARDNAME := TL-WA901ND
   DEVICE_PROFILE := TLWA730RE
   TPLINK_HWID := 0x07300001
@@ -952,21 +952,21 @@ endef
 
 define Device/tl-wa750re-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WA750RE
+  DEVICE_TITLE := TP-LINK TL-WA750RE v1
   DEVICE_PACKAGES := rssileds
   BOARDNAME := TL-WA750RE
   DEVICE_PROFILE := TLWA750
   TPLINK_HWID := 0x07500001
 endef
 
-define Device/tl-wa7510n
+define Device/tl-wa7510n-v1
   $(Device/tplink-4m)
-  DEVICE_TITLE := TP-LINK TL-WA7510N
+  DEVICE_TITLE := TP-LINK TL-WA7510N v1
   BOARDNAME := TL-WA7510N
   DEVICE_PROFILE := TLWA7510
   TPLINK_HWID := 0x75100001
 endef
-TARGET_DEVICES += tl-wa701nd-v1 tl-wa701nd-v2 tl-wa730re-v1 tl-wa750re-v1 tl-wa7510n
+TARGET_DEVICES += tl-wa701nd-v1 tl-wa701nd-v2 tl-wa730re-v1 tl-wa750re-v1 tl-wa7510n-v1
 
 define Device/tl-wa801nd-v1
   $(Device/tplink-4m)
@@ -994,7 +994,7 @@ endef
 
 define Device/tl-wa830re-v1
   $(Device/tplink-4m)
-  DEVICE_TITLE := TP-LINK TL-WA830RE
+  DEVICE_TITLE := TP-LINK TL-WA830RE v1
   BOARDNAME := TL-WA901ND
   DEVICE_PROFILE := TLWA830
   TPLINK_HWID := 0x08300010
@@ -1002,7 +1002,7 @@ endef
 
 define Device/tl-wa830re-v2
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WA830RE
+  DEVICE_TITLE := TP-LINK TL-WA830RE v2
   BOARDNAME := TL-WA830RE-v2
   DEVICE_PROFILE := TLWA830
   TPLINK_HWID := 0x08300002
@@ -1010,7 +1010,7 @@ endef
 
 define Device/tl-wa850re-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WA850RE
+  DEVICE_TITLE := TP-LINK TL-WA850RE v1
   BOARDNAME := TL-WA850RE
   DEVICE_PROFILE := TLWA850
   TPLINK_HWID := 0x08500001
@@ -1032,7 +1032,7 @@ endef
 
 define Device/tl-wa860re-v1
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WA860RE
+  DEVICE_TITLE := TP-LINK TL-WA860RE v1
   BOARDNAME := TL-WA860RE
   DEVICE_PROFILE := TLWA860
   TPLINK_HWID := 0x08600001
@@ -1076,7 +1076,7 @@ TARGET_DEVICES += tl-wa901nd-v1 tl-wa901nd-v2 tl-wa901nd-v3 tl-wa901nd-v4
 
 define Device/tl-wa7210n-v2
   $(Device/tplink-4mlzma)
-  DEVICE_TITLE := TP-LINK TL-WA7210N
+  DEVICE_TITLE := TP-LINK TL-WA7210N v2
   DEVICE_PACKAGES := rssileds kmod-ledtrig-netdev
   BOARDNAME := TL-WA7210N-v2
   DEVICE_PROFILE := TLWA7210


From lede-commits at lists.infradead.org  Mon Apr  3 03:45:41 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 06:45:41 -0400
Subject: [source]  sysntpd: restore support for peer-less (standalone) mode
In-Reply-To: <20170403104539.11020.19824@git-01.infra.lede-project.org>
References: <20170403104539.11020.19824@git-01.infra.lede-project.org>
Message-ID: <mailman.21815.1491216370.26984.lede-commits@lists.infradead.org>

pepe2k pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/a49503bbc75da39a8a2b0a9da0053e7b968b5e8b

commit a49503bbc75da39a8a2b0a9da0053e7b968b5e8b
Author: Piotr Dymacz <pepe2k at gmail.com>
AuthorDate: Mon Mar 6 23:20:37 2017 +0100

    sysntpd: restore support for peer-less (standalone) mode
    
    ntpd from Busybox supports peer-less (standalone) mode when it's started
    with option -l and without any peer provided with option -p. In this
    mode ntpd uses local time as reference and acts as stratum 1 server.
    
    This mode can be used in isolated networks, where Internet access and/or
    other NTP server/s are not available, but the device has some other way
    of getting correct time, like e.g. GPS (ugps supports setting local time
    by default).
    
    Support for this mode was incorrectly disabled/removed in:
    1527f96ca6e196fa17c96fdb3ae520158fa5943f
    
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
    Acked-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/files/sysntpd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/utils/busybox/files/sysntpd b/package/utils/busybox/files/sysntpd
index 98260be..e693e40 100755
--- a/package/utils/busybox/files/sysntpd
+++ b/package/utils/busybox/files/sysntpd
@@ -45,7 +45,7 @@ start_service() {
 
 	[ $use_dhcp = 1 ] && get_dhcp_ntp_servers "$dhcp_interface"
 
-	[ -z "$server" ] && return
+	[ -z "$server" -a "$enable_server" = "0" ] && return
 
 	procd_open_instance
 	procd_set_param command "$PROG" -n -N


From lede-commits at lists.infradead.org  Mon Apr  3 03:45:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 06:45:39 -0400
Subject: [source]  ugps: fix and improve init script
In-Reply-To: <20170403104539.11020.19824@git-01.infra.lede-project.org>
References: <20170403104539.11020.19824@git-01.infra.lede-project.org>
Message-ID: <mailman.21816.1491216376.26984.lede-commits@lists.infradead.org>

pepe2k pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/0cb669b46976a83b94bba26b4a54424e513dafc4

commit 0cb669b46976a83b94bba26b4a54424e513dafc4
Author: Piotr Dymacz <pepe2k at gmail.com>
AuthorDate: Sun Mar 5 19:30:44 2017 +0100

    ugps: fix and improve init script
    
    The ugps tool expects device path in last argument. If it's provided
    before other options, they won't be processed at all.
    
    Additionally, make it possible to use absolute path for gps character
    device in related uci configuration.
    
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
---
 package/utils/ugps/Makefile        | 2 +-
 package/utils/ugps/files/ugps.init | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/package/utils/ugps/Makefile b/package/utils/ugps/Makefile
index 9dc33ca..0243b77 100644
--- a/package/utils/ugps/Makefile
+++ b/package/utils/ugps/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ugps
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL=$(LEDE_GIT)/project/ugps.git
 PKG_SOURCE_PROTO:=git
diff --git a/package/utils/ugps/files/ugps.init b/package/utils/ugps/files/ugps.init
index a7a88c2..157043c 100644
--- a/package/utils/ugps/files/ugps.init
+++ b/package/utils/ugps/files/ugps.init
@@ -14,11 +14,15 @@ start_service() {
 	local tty="$(uci get gps. at gps[-1].tty)"
 	local atime="$(uci get gps. at gps[-1].adjust_time)"
 
-	[ -d "/sys/class/tty/$tty/" ] || return
+	[ -c "$tty" ] || {
+		tty="/dev/$tty"
+		[ -c "$tty" ] || return
+	}
 
 	procd_open_instance
-	procd_set_param command "$PROG" "/dev/$tty"
+	procd_set_param command "$PROG"
 	[ "$atime" -eq 0 ] || procd_append_param command "-a"
+	procd_append_param command "$tty"
 	procd_set_param respawn
 	procd_close_instance
 }


From lede-commits at lists.infradead.org  Mon Apr  3 03:45:40 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 06:45:40 -0400
Subject: [source]  ar71xx: fix Wallys DR344 ethernet MAC addresses offsets
In-Reply-To: <20170403104539.11020.19824@git-01.infra.lede-project.org>
References: <20170403104539.11020.19824@git-01.infra.lede-project.org>
Message-ID: <mailman.21817.1491216377.26984.lede-commits@lists.infradead.org>

pepe2k pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/1bdd23231b9de6f98b5c51360167abc7b5e92716

commit 1bdd23231b9de6f98b5c51360167abc7b5e92716
Author: Piotr Dymacz <pepe2k at gmail.com>
AuthorDate: Sun Mar 12 23:50:36 2017 +0100

    ar71xx: fix Wallys DR344 ethernet MAC addresses offsets
    
    Without this fix, ethernet interfaces on Wallys DR344 use random MAC
    addresses.
    
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
---
 target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c
index e2155e3..c24e5aa 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c
@@ -134,6 +134,7 @@ static struct mdio_board_info dr344_mdio0_info[] = {
 static void __init dr344_setup(void)
 {
 	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+	u8 *mac = (u8 *) KSEG1ADDR(0x1f03f810);
 
 	ath79_register_m25p80(NULL);
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(dr344_leds_gpio),
@@ -158,8 +159,8 @@ static void __init dr344_setup(void)
 	ath79_register_mdio(1, 0x0);
 	ath79_register_mdio(0, 0x0);
 
-	ath79_init_mac(ath79_eth0_data.mac_addr, art + DR344_MAC0_OFFSET, 0);
-       ath79_init_mac(ath79_eth1_data.mac_addr, art + DR344_MAC1_OFFSET, 0);
+	ath79_init_mac(ath79_eth0_data.mac_addr, mac + DR344_MAC0_OFFSET, 0);
+	ath79_init_mac(ath79_eth1_data.mac_addr, mac + DR344_MAC1_OFFSET, 0);
 
 	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
 				   AR934X_ETH_CFG_SW_ONLY_MODE);


From lede-commits at lists.infradead.org  Mon Apr  3 06:12:21 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 09:12:21 -0400
Subject: [source] mac80211: backport an upstream fix for queue start/stop
 handling
In-Reply-To: <20170403131221.12141.58148@git-01.infra.lede-project.org>
References: <20170403131221.12141.58148@git-01.infra.lede-project.org>
Message-ID: <mailman.21848.1491225167.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/cffeb31107e27a48ddaf4953590acdefc66f2de9

commit cffeb31107e27a48ddaf4953590acdefc66f2de9
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Apr 3 15:08:28 2017 +0200

    mac80211: backport an upstream fix for queue start/stop handling
    
    Fixes issues with 802.11s
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...conditionally-start-new-netdev-queues-wit.patch | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch b/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch
new file mode 100644
index 0000000..ff7bbcb
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch
@@ -0,0 +1,29 @@
+From: Johannes Berg <johannes.berg at intel.com>
+Date: Wed, 29 Mar 2017 14:15:24 +0200
+Subject: [PATCH] mac80211: unconditionally start new netdev queues with iTXQ
+ support
+
+When internal mac80211 TXQs aren't supported, netdev queues must
+always started out started even when driver queues are stopped
+while the interface is added. This is necessary because with the
+internal TXQ support netdev queues are never stopped and packet
+scheduling/dropping is done in mac80211.
+
+Cc: stable at vger.kernel.org # 4.9+
+Fixes: 80a83cfc434b1 ("mac80211: skip netdev queue control with software queuing")
+Reported-and-tested-by: Sven Eckelmann <sven.eckelmann at openmesh.com>
+Signed-off-by: Johannes Berg <johannes.berg at intel.com>
+---
+
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -727,7 +727,8 @@ int ieee80211_do_open(struct wireless_de
+ 	ieee80211_recalc_ps(local);
+ 
+ 	if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
+-	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
++	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
++	    local->ops->wake_tx_queue) {
+ 		/* XXX: for AP_VLAN, actually track AP queues */
+ 		netif_tx_start_all_queues(dev);
+ 	} else if (dev) {


From lede-commits at lists.infradead.org  Mon Apr  3 06:13:01 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 03 Apr 2017 09:13:01 -0400
Subject: [source] mac80211: backport an upstream fix for queue start/stop
 handling
In-Reply-To: <20170403131301.12321.29378@git-01.infra.lede-project.org>
References: <20170403131301.12321.29378@git-01.infra.lede-project.org>
Message-ID: <mailman.21849.1491225205.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/47bf110cbbfbb425d7538c566332d2058fb45248

commit 47bf110cbbfbb425d7538c566332d2058fb45248
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Apr 3 15:08:28 2017 +0200

    mac80211: backport an upstream fix for queue start/stop handling
    
    Fixes issues with 802.11s
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...conditionally-start-new-netdev-queues-wit.patch | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch b/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch
new file mode 100644
index 0000000..ff7bbcb
--- /dev/null
+++ b/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch
@@ -0,0 +1,29 @@
+From: Johannes Berg <johannes.berg at intel.com>
+Date: Wed, 29 Mar 2017 14:15:24 +0200
+Subject: [PATCH] mac80211: unconditionally start new netdev queues with iTXQ
+ support
+
+When internal mac80211 TXQs aren't supported, netdev queues must
+always started out started even when driver queues are stopped
+while the interface is added. This is necessary because with the
+internal TXQ support netdev queues are never stopped and packet
+scheduling/dropping is done in mac80211.
+
+Cc: stable at vger.kernel.org # 4.9+
+Fixes: 80a83cfc434b1 ("mac80211: skip netdev queue control with software queuing")
+Reported-and-tested-by: Sven Eckelmann <sven.eckelmann at openmesh.com>
+Signed-off-by: Johannes Berg <johannes.berg at intel.com>
+---
+
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -727,7 +727,8 @@ int ieee80211_do_open(struct wireless_de
+ 	ieee80211_recalc_ps(local);
+ 
+ 	if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
+-	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
++	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
++	    local->ops->wake_tx_queue) {
+ 		/* XXX: for AP_VLAN, actually track AP queues */
+ 		netif_tx_start_all_queues(dev);
+ 	} else if (dev) {


From lede-commits at lists.infradead.org  Tue Apr  4 00:09:19 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 09:09:19 +0200
Subject: [source] busybox: don't install NTP scripts if NTP isn't
 configured
In-Reply-To: <mailman.21741.1491202409.26984.lede-commits@lists.infradead.org>
References: <20170403065303.5528.20293@git-01.infra.lede-project.org>
 <mailman.21741.1491202409.26984.lede-commits@lists.infradead.org>
Message-ID: <mailman.21988.1491289792.26984.lede-commits@lists.infradead.org>

Citeren LEDE Commits <lede-commits at lists.infradead.org>:

> nbd pushed a commit to source.git, branch master:
> https://git.lede-project.org/0b24850e97789818fadcbce4b8de4abc429fd9f2
>
> commit 0b24850e97789818fadcbce4b8de4abc429fd9f2
> Author: Philip Prindeville <philipp at redfish-solutions.com>
> AuthorDate: Mon Feb 6 15:26:49 2017 -0700
>
>     busybox: don't install NTP scripts if NTP isn't configured
>
>     If you're using Chrony or NTPD you don't want the busybox NTP server
>     as well.  Make it's installation truly conditional.

I guess somehow the logic is reversed here.

>     Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
>     Signed-off-by: Felix Fietkau <nbd at nbd.name> [simplify]
> ---
>  package/utils/busybox/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
> index b75b455..48d9457 100644
> --- a/package/utils/busybox/Makefile
> +++ b/package/utils/busybox/Makefile
> @@ -112,9 +112,13 @@ endef
>  define Package/busybox/install
>  	$(INSTALL_DIR) $(1)/etc/init.d
>  	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
> +ifneq ($(CONFIG_BUSYBOX_CONFIG_CROND),)
>  	$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
> +endif
> +ifneq ($(CONFIG_BUSYBOX_CONFIG_NTPD),)
>  	$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
>  	$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
> +endif
>  	-rm -rf $(1)/lib64
>  endef
>
>
> _______________________________________________
> lede-commits mailing list
> lede-commits at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-commits





From lede-commits at lists.infradead.org  Tue Apr  4 03:34:57 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 06:34:57 -0400
Subject: [source]  u-boot.mk: pass HOSTCC and HOST_CFLAGS into the build
In-Reply-To: <20170404103453.1857.49010@git-01.infra.lede-project.org>
References: <20170404103453.1857.49010@git-01.infra.lede-project.org>
Message-ID: <mailman.22026.1491302119.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/68139cc0e819b5f654c4f78468049eef035d28f7

commit 68139cc0e819b5f654c4f78468049eef035d28f7
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Mar 16 09:01:56 2017 +0100

    u-boot.mk: pass HOSTCC and HOST_CFLAGS into the build
    
    Cuts build time on Mac OS X in half by avoiding repeated $(shell) calls
    from the build system
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/u-boot.mk                  | 5 +++++
 package/boot/uboot-lantiq/Makefile | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/include/u-boot.mk b/include/u-boot.mk
index 0c28653..4b3ff69 100644
--- a/include/u-boot.mk
+++ b/include/u-boot.mk
@@ -40,6 +40,11 @@ endef
 
 TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
 
+UBOOT_MAKE_FLAGS = \
+	HOSTCC="$(HOSTCC)" \
+	HOSTCFLAGS='$(HOST_CFLAGS) $$$$(HOSTCPPFLAGS)' \
+	HOSTLDFLAGS=""
+
 define Build/U-Boot/Target
   $(eval $(call U-Boot/Init,$(1)))
   $(eval $(call U-Boot/Default,$(1)))
diff --git a/package/boot/uboot-lantiq/Makefile b/package/boot/uboot-lantiq/Makefile
index b16e7cd..94b604a 100644
--- a/package/boot/uboot-lantiq/Makefile
+++ b/package/boot/uboot-lantiq/Makefile
@@ -366,6 +366,8 @@ define Build/Prepare
 	$(call CompressVR9Firmware,22f,2)
 endef
 
+UBOOT_MAKE_FLAGS :=
+
 ifeq ($(SUBTARGET),xway)
   SOC:=danube
 else


From lede-commits at lists.infradead.org  Tue Apr  4 03:34:55 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 06:34:55 -0400
Subject: [source] ath10k-firmware: update the qca988x firmware to
 10.2.4-1.0-00029
In-Reply-To: <20170404103453.1857.49010@git-01.infra.lede-project.org>
References: <20170404103453.1857.49010@git-01.infra.lede-project.org>
Message-ID: <mailman.22027.1491302119.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/a1afee24a6e10054294923fa99938c5e5246ad14

commit a1afee24a6e10054294923fa99938c5e5246ad14
Author: Changmin Jang <ckdalsdk12 at gmail.com>
AuthorDate: Mon Apr 3 23:29:26 2017 +0900

    ath10k-firmware: update the qca988x firmware to 10.2.4-1.0-00029
    
    update the qca988x firmware to firmware-5.bin_10.2.4-1.0-00029.
    According to LEDE Forum, the new firmware supports mesh mode.
    Also, it seems to have several improvements.
    
    Signed-off-by: Changmin Jang <ckdalsdk12 at gmail.com>
---
 package/firmware/ath10k-firmware/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index febf7d2..b33e5d7 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ath10k-firmware
-PKG_SOURCE_DATE:=2017-03-13
-PKG_SOURCE_VERSION:=2209b0f8d41aef3435c7238b9eb99de7ed36fd5a
-PKG_MIRROR_HASH:=884e4678f6b6b5d8b367a90769784ef6449d6774b749104d7a20552b5601b041
+PKG_SOURCE_DATE:=2017-03-29
+PKG_SOURCE_VERSION:=956e2609b7e42c8c710bba10ef925a5be1be5137
+PKG_MIRROR_HASH:=25f724ff38c830281b3efba4a4ddffaae0c4bd8fea0f4c1061591229ff05535b
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
@@ -263,7 +263,7 @@ define Package/ath10k-firmware-qca988x/install
 		$(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
 	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00016 \
+		$(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00029 \
 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
 endef
 


From lede-commits at lists.infradead.org  Tue Apr  4 03:34:53 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 06:34:53 -0400
Subject: [source]  uboot-lantiq: fix build error on mac os x
In-Reply-To: <20170404103453.1857.49010@git-01.infra.lede-project.org>
References: <20170404103453.1857.49010@git-01.infra.lede-project.org>
Message-ID: <mailman.22028.1491302121.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/2526d150dc836b79caf4976413780bd77fc88c0a

commit 2526d150dc836b79caf4976413780bd77fc88c0a
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Apr 4 12:33:03 2017 +0200

    uboot-lantiq: fix build error on mac os x
    
    asm/* includes are not safe for the host build
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../boot/uboot-lantiq/patches/100-portability.patch    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/package/boot/uboot-lantiq/patches/100-portability.patch b/package/boot/uboot-lantiq/patches/100-portability.patch
new file mode 100644
index 0000000..4539e3e
--- /dev/null
+++ b/package/boot/uboot-lantiq/patches/100-portability.patch
@@ -0,0 +1,18 @@
+--- a/include/image.h
++++ b/include/image.h
+@@ -17,7 +17,6 @@
+ #define __IMAGE_H__
+ 
+ #include "compiler.h"
+-#include <asm/byteorder.h>
+ 
+ /* Define this to avoid #ifdefs later on */
+ struct lmb;
+@@ -36,6 +35,7 @@ struct lmb;
+ 
+ #include <lmb.h>
+ #include <asm/u-boot.h>
++#include <asm/byteorder.h>
+ #include <command.h>
+ 
+ /* Take notice of the 'ignore' property for hashes */


From lede-commits at lists.infradead.org  Tue Apr  4 03:34:54 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 06:34:54 -0400
Subject: [source]  scripts/download.pl: fix error message on hash mismatch
In-Reply-To: <20170404103453.1857.49010@git-01.infra.lede-project.org>
References: <20170404103453.1857.49010@git-01.infra.lede-project.org>
Message-ID: <mailman.22029.1491302121.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/2fd15033783a9dfa84d2a43fb81ff222ab865407

commit 2fd15033783a9dfa84d2a43fb81ff222ab865407
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Apr 4 11:44:22 2017 +0200

    scripts/download.pl: fix error message on hash mismatch
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 scripts/download.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/download.pl b/scripts/download.pl
index 7eb7c7e..3936f76 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -166,7 +166,7 @@ sub download
 		$sum = $1;
 
 		if ($sum ne $file_hash) {
-			print STDERR "MD5 sum of the downloaded file does not match (file: $sum, requested: $file_hash) - deleting download.\n";
+			print STDERR "Hash of the downloaded file does not match (file: $sum, requested: $file_hash) - deleting download.\n";
 			cleanup();
 			return;
 		}


From lede-commits at lists.infradead.org  Tue Apr  4 03:34:56 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 06:34:56 -0400
Subject: [source] target.mk: check that CPU_TYPE has known CPU_CFLAGS mapping
In-Reply-To: <20170404103453.1857.49010@git-01.infra.lede-project.org>
References: <20170404103453.1857.49010@git-01.infra.lede-project.org>
Message-ID: <mailman.22030.1491302121.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/d3bc11857af788e185e8a3ece26ce40757cf3965

commit d3bc11857af788e185e8a3ece26ce40757cf3965
Author: Philip Prindeville <philipp at redfish-solutions.com>
AuthorDate: Tue Jan 3 18:15:15 2017 -0700

    target.mk: check that CPU_TYPE has known CPU_CFLAGS mapping
    
    If someone creates a target and indicates a CPU_TYPE, but there's
    no corresponding support for that CPU_TYPE's flags in include/target.mk
    then that should probably be indicated rather than silently ignored.
    
    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 include/target.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/target.mk b/include/target.mk
index 61489ca..3523d04 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -218,6 +218,11 @@ ifeq ($(DUMP),1)
     CPU_CFLAGS_arc700 = -mcpu=arc700
     CPU_CFLAGS_archs = -mcpu=archs
   endif
+  ifneq ($(CPU_TYPE),)
+    ifndef CPU_CFLAGS_$(CPU_TYPE)
+      $(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type)
+    endif
+  endif
   DEFAULT_CFLAGS=$(strip $(CPU_CFLAGS) $(CPU_CFLAGS_$(CPU_TYPE)) $(CPU_CFLAGS_$(CPU_SUBTYPE)))
 
   ifneq ($(BOARD),)


From lede-commits at lists.infradead.org  Tue Apr  4 05:06:55 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 08:06:55 -0400
Subject: [source]  kernel: move initramfs's init script out of base-files
In-Reply-To: <20170404120655.2512.13046@git-01.infra.lede-project.org>
References: <20170404120655.2512.13046@git-01.infra.lede-project.org>
Message-ID: <mailman.22062.1491307774.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch master:
https://git.lede-project.org/f6433eede79db4f6276b68e815bb17a9364292c7

commit f6433eede79db4f6276b68e815bb17a9364292c7
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Mon Mar 27 11:03:01 2017 +0200

    kernel: move initramfs's init script out of base-files
    
    Keeping it in base-files was resulting in adding it to the base-files
    package. This file is meant to be included manually for initramfs
    images only.
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 include/kernel-defaults.mk                            | 2 +-
 target/linux/generic/{base-files => other-files}/init | 0
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 9fa5c1d..407c192 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -167,7 +167,7 @@ endef
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 define Kernel/CompileImage/Initramfs
 	$(call Kernel/Configure/Initramfs)
-	$(CP) $(GENERIC_PLATFORM_DIR)/base-files/init $(TARGET_DIR)/init
+	$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
 	rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
 	+$(MAKE) $(KERNEL_MAKEOPTS) $(if $(KERNELNAME),$(KERNELNAME),all) modules
 	$(call Kernel/CopyImage,-initramfs)
diff --git a/target/linux/generic/base-files/init b/target/linux/generic/other-files/init
similarity index 100%
rename from target/linux/generic/base-files/init
rename to target/linux/generic/other-files/init


From lede-commits at lists.infradead.org  Tue Apr  4 06:06:22 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 04 Apr 2017 09:06:22 -0400
Subject: [source] busybox: fix installation of cron and ntpd scripts in the
 default config
In-Reply-To: <20170404130622.22315.13134@git-01.infra.lede-project.org>
References: <20170404130622.22315.13134@git-01.infra.lede-project.org>
Message-ID: <mailman.22083.1491311205.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/3169a6a7ada17e2ea8ef4641edee68134c04b92b

commit 3169a6a7ada17e2ea8ef4641edee68134c04b92b
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Apr 4 15:05:11 2017 +0200

    busybox: fix installation of cron and ntpd scripts in the default config
    
    Fixes: 0b24850e9778 ("busybox: don't install NTP scripts if NTP isn't configured")
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/utils/busybox/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 48d9457..be4b967 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -112,10 +112,10 @@ endef
 define Package/busybox/install
 	$(INSTALL_DIR) $(1)/etc/init.d
 	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
-ifneq ($(CONFIG_BUSYBOX_CONFIG_CROND),)
+ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),)
 	$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
 endif
-ifneq ($(CONFIG_BUSYBOX_CONFIG_NTPD),)
+ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
 	$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
 	$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
 endif


From lede-commits at lists.infradead.org  Wed Apr  5 00:58:29 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 05 Apr 2017 03:58:29 -0400
Subject: [source] kernel: Fix the incorrect i_nlink count after jffs2's
 RENAME_EXCHANGE operations.
In-Reply-To: <20170405075829.20962.39645@git-01.infra.lede-project.org>
References: <20170405075829.20962.39645@git-01.infra.lede-project.org>
Message-ID: <mailman.22223.1491379479.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/638ca50f3b1d66fb165891552ed8cde31aa2f194

commit 638ca50f3b1d66fb165891552ed8cde31aa2f194
Author: Jing Qiu <aqiu0720 at gmail.com>
AuthorDate: Tue Mar 14 15:32:08 2017 +0800

    kernel: Fix the incorrect i_nlink count after jffs2's RENAME_EXCHANGE operations.
    
    The problem is caused by the incorrect handling of the parent inode's
    i_nlink count for the dentry to be RENAME_EXCHANGED. There are 3 cases
    to consider. Assume we want to RENAME_EXCHANGE struct dentry *a and
    struct dentry *b, and inode_a is pointed to by dentry_a, inode_b is
    pointed to by dentry_b:
    
    1. If inode_a is a directory, but inode_b isn't, then we must decrease
       the i_nlink count of old_dir_i, and increase the i_nlink of new_dir_i.
    2. If inode_a isn't a directory, but inode_b is a directory, then we
       must increase the i_nlink of old_dir_i, and decrease the i_nlink count
       of new_dir_i.
    3. If the types of inode_a and inode_b are the same, we don't change the
       i_nlink for either old_dir_i or new_dir_i.
    
    Signed-off-by: Jing Qiu <aqiu0720 at gmail.com>
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../111-jffs2-add-RENAME_EXCHANGE-support.patch    | 33 ++++++++++++++++++----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/target/linux/generic/patches-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/patches-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch
index b624087..37eb073 100644
--- a/target/linux/generic/patches-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch
+++ b/target/linux/generic/patches-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch
@@ -7,7 +7,12 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/fs/jffs2/dir.c
 +++ b/fs/jffs2/dir.c
-@@ -782,7 +782,7 @@ static int jffs2_rename (struct inode *o
+@@ -779,18 +779,31 @@ static int jffs2_rename (struct inode *o
+ 	int ret;
+ 	struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
+ 	struct jffs2_inode_info *victim_f = NULL;
++	struct inode *fst_inode = d_inode(old_dentry);
++	struct inode *snd_inode = d_inode(new_dentry);
  	uint8_t type;
  	uint32_t now;
  
@@ -15,8 +20,19 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +	if (flags & ~(RENAME_WHITEOUT | RENAME_EXCHANGE))
  		return -EINVAL;
  
++	if ((flags & RENAME_EXCHANGE) && (old_dir_i != new_dir_i)) {
++		if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) {
++			inc_nlink(new_dir_i);
++			drop_nlink(old_dir_i);
++		}
++		else if (!S_ISDIR(fst_inode->i_mode) && S_ISDIR(snd_inode->i_mode)) {
++			drop_nlink(new_dir_i);
++			inc_nlink(old_dir_i);
++		}
++	}
++
  	/* The VFS will check for us and prevent trying to rename a
-@@ -790,7 +790,7 @@ static int jffs2_rename (struct inode *o
+ 	 * file over a directory and vice versa, but if it's a directory,
  	 * the VFS can't check whether the victim is empty. The filesystem
  	 * needs to do that for itself.
  	 */
@@ -25,7 +41,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  		victim_f = JFFS2_INODE_INFO(d_inode(new_dentry));
  		if (d_is_dir(new_dentry)) {
  			struct jffs2_full_dirent *fd;
-@@ -825,7 +825,7 @@ static int jffs2_rename (struct inode *o
+@@ -825,7 +838,7 @@ static int jffs2_rename (struct inode *o
  	if (ret)
  		return ret;
  
@@ -34,7 +50,14 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  		/* There was a victim. Kill it off nicely */
  		if (d_is_dir(new_dentry))
  			clear_nlink(d_inode(new_dentry));
-@@ -851,6 +851,12 @@ static int jffs2_rename (struct inode *o
+@@ -845,12 +858,18 @@ static int jffs2_rename (struct inode *o
+ 
+ 	/* If it was a directory we moved, and there was no victim,
+ 	   increase i_nlink on its new parent */
+-	if (d_is_dir(old_dentry) && !victim_f)
++	if (d_is_dir(old_dentry) && !victim_f && !(flags & RENAME_EXCHANGE))
+ 		inc_nlink(new_dir_i);
+ 
  	if (flags & RENAME_WHITEOUT)
  		/* Replace with whiteout */
  		ret = jffs2_whiteout(old_dir_i, old_dentry);
@@ -47,7 +70,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	else
  		/* Unlink the original */
  		ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
-@@ -882,7 +888,7 @@ static int jffs2_rename (struct inode *o
+@@ -882,7 +901,7 @@ static int jffs2_rename (struct inode *o
  		return ret;
  	}
  


From lede-commits at lists.infradead.org  Wed Apr  5 01:08:45 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 05 Apr 2017 04:08:45 -0400
Subject: [source]  image.mk: force kernel rebuild on every run
In-Reply-To: <20170405080845.23106.93421@git-01.infra.lede-project.org>
References: <20170405080845.23106.93421@git-01.infra.lede-project.org>
Message-ID: <mailman.22230.1491380412.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/53fcaed1f78a4fa4073c96801e4a365e61866e62

commit 53fcaed1f78a4fa4073c96801e4a365e61866e62
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Mar 13 10:49:58 2017 +0100

    image.mk: force kernel rebuild on every run
    
    DTS dependencies are not processed correctly so makes it safer against
    poentially stale builds
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/image.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 81519cd..8f55627 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -420,7 +420,7 @@ define Device/Build/initramfs
   $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
 	cp $$^ $$@
 
-  $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS)
+  $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
 	@rm -f $$@
 	$$(call concat_cmd,$$(KERNEL_INITRAMFS))
 endef
@@ -444,7 +444,7 @@ define Device/Build/kernel
     ifdef CONFIG_IB
       install: $$(KDIR_KERNEL_IMAGE)
     endif
-    $$(KDIR_KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS)
+    $$(KDIR_KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
 	@rm -f $$@
 	$$(call concat_cmd,$$(KERNEL))
 	$$(if $$(KERNEL_SIZE),$$(call Build/check-size,$$(KERNEL_SIZE)))


From lede-commits at lists.infradead.org  Wed Apr  5 14:39:12 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 05 Apr 2017 17:39:12 -0400
Subject: [source]  mt76: ensure that the metapackage gets built as .ipk
In-Reply-To: <20170405213912.6016.52287@git-01.infra.lede-project.org>
References: <20170405213912.6016.52287@git-01.infra.lede-project.org>
Message-ID: <mailman.22417.1491428505.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/9613d97b29e4e2d79bd004613fd577c097adbe27

commit 9613d97b29e4e2d79bd004613fd577c097adbe27
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Apr 5 23:38:42 2017 +0200

    mt76: ensure that the metapackage gets built as .ipk
    
    Fixes errors during the image builder run
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/kernel/mt76/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index 552159a..5e68be2 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -82,6 +82,10 @@ define Build/Compile
 		modules
 endef
 
+define Package/kmod-mt76/install
+	true
+endef
+
 define KernelPackage/mt76x2/install
 	$(INSTALL_DIR) $(1)/lib/firmware
 	cp \


From lede-commits at lists.infradead.org  Wed Apr  5 14:39:30 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 05 Apr 2017 17:39:30 -0400
Subject: [source]  mt76: ensure that the metapackage gets built as .ipk
In-Reply-To: <20170405213930.6150.18865@git-01.infra.lede-project.org>
References: <20170405213930.6150.18865@git-01.infra.lede-project.org>
Message-ID: <mailman.22418.1491428522.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/7099bb19b50d74d3a400aa3a60e0b7ba0157bc1e

commit 7099bb19b50d74d3a400aa3a60e0b7ba0157bc1e
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Apr 5 23:38:42 2017 +0200

    mt76: ensure that the metapackage gets built as .ipk
    
    Fixes errors during the image builder run
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/kernel/mt76/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index 3d11cb5..8a6e414 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -82,6 +82,10 @@ define Build/Compile
 		modules
 endef
 
+define Package/kmod-mt76/install
+	true
+endef
+
 define KernelPackage/mt76x2/install
 	$(INSTALL_DIR) $(1)/lib/firmware
 	cp \


From lede-commits at lists.infradead.org  Thu Apr  6 07:25:32 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 06 Apr 2017 10:25:32 -0400
Subject: [source]  uboot-ar71xx: fix build error
In-Reply-To: <20170406142532.29343.33879@git-01.infra.lede-project.org>
References: <20170406142532.29343.33879@git-01.infra.lede-project.org>
Message-ID: <mailman.22551.1491488755.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/8b8ce566d9c0cccd3c74137a1ef4f060be4a7e75

commit 8b8ce566d9c0cccd3c74137a1ef4f060be4a7e75
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Apr 6 16:24:46 2017 +0200

    uboot-ar71xx: fix build error
    
    The HOSTCFLAGS override only works on newer u-boot versions
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/boot/uboot-ar71xx/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/boot/uboot-ar71xx/Makefile b/package/boot/uboot-ar71xx/Makefile
index e0bc39f..e6e6cbb 100644
--- a/package/boot/uboot-ar71xx/Makefile
+++ b/package/boot/uboot-ar71xx/Makefile
@@ -26,6 +26,8 @@ define U-Boot/nbg460n_550n_550nh
   HIDDEN:=y
 endef
 
+UBOOT_MAKE_FLAGS :=
+
 UBOOT_TARGETS:=nbg460n_550n_550nh
 
 $(eval $(call BuildPackage/U-Boot))


From lede-commits at lists.infradead.org  Fri Apr  7 08:42:23 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 07 Apr 2017 11:42:23 -0400
Subject: [source]  kernel: add thermal monitor for nct6775/6776
In-Reply-To: <20170407154223.26607.51791@git-01.infra.lede-project.org>
References: <20170407154223.26607.51791@git-01.infra.lede-project.org>
Message-ID: <mailman.22767.1491579769.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/43d06ec2c75199591f33943eb2f70e8aae80fd45

commit 43d06ec2c75199591f33943eb2f70e8aae80fd45
Author: Philip Prindeville <philipp at redfish-solutions.com>
AuthorDate: Sun Jan 8 21:08:47 2017 -0700

    kernel: add thermal monitor for nct6775/6776
    
    Support for the nct6775/6776 hwmon chips, and other compatibles
    in the family as well as the Intel on-chip thermal sensors.
    
    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 package/kernel/linux/modules/hwmon.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk
index b39a2e2..79c8184 100644
--- a/package/kernel/linux/modules/hwmon.mk
+++ b/package/kernel/linux/modules/hwmon.mk
@@ -93,6 +93,21 @@ endef
 $(eval $(call KernelPackage,hwmon-ina209))
 
 
+define KernelPackage/hwmon-nct6775
+  TITLE:=NCT6106D/6775F/6776F/6779D/6791D/6792D/6793D and compatibles monitoring support
+  KCONFIG:=CONFIG_SENSORS_NCT6775
+  FILES:=$(LINUX_DIR)/drivers/hwmon/nct6775.ko
+  AUTOLOAD:=$(call AutoProbe,nct6775)
+  $(call AddDepends/hwmon, at PCI_SUPPORT @TARGET_x86 +kmod-hwmon-vid)
+endef
+
+define KernelPackage/hwmon-nct6775/description
+ Kernel module for NCT6106D/6775F/6776F/6779D/6791D/6792D/6793D thermal monitor chip
+endef
+
+$(eval $(call KernelPackage,hwmon-nct6775))
+
+
 define KernelPackage/hwmon-ina2xx
   TITLE:=INA2XX monitoring support
   KCONFIG:=CONFIG_SENSORS_INA2XX


From lede-commits at lists.infradead.org  Fri Apr  7 08:42:24 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 07 Apr 2017 11:42:24 -0400
Subject: [source]  mediatek: various fixes for v4.9
In-Reply-To: <20170407154223.26607.51791@git-01.infra.lede-project.org>
References: <20170407154223.26607.51791@git-01.infra.lede-project.org>
Message-ID: <mailman.22768.1491579787.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/64175ffb7911f5fcd3907df09fdb9bfab53ee641

commit 64175ffb7911f5fcd3907df09fdb9bfab53ee641
Author: John Crispin <john at phrozen.org>
AuthorDate: Fri Apr 7 17:42:08 2017 +0200

    mediatek: various fixes for v4.9
    
    * adds MT7530 DSA support
    * backport latest ethernet driver
    * add PMIC leds
    * add auxadc support
    * add efuse support
    * add thermal sensor support
    * add irq affinity support for ethernet
    
    still todo
    * DSA multi cpu support
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 target/linux/mediatek/Makefile                     |    2 +-
 .../mediatek/base-files/etc/board.d/02_network     |   13 +-
 target/linux/mediatek/base-files/lib/mediatek.sh   |   39 -
 .../mediatek/base-files/lib/preinit/01_affinity    |    4 -
 .../lib/preinit/03_preinit_do_mediatek.sh          |   12 -
 .../base-files/lib/preinit/05_set_preinit_iface    |    9 +
 target/linux/mediatek/config-4.9                   |   22 +-
 .../mediatek/files/arch/arm/boot/dts/_mt7623.dtsi  |  206 +-
 .../files/arch/arm/boot/dts/mt7623-NAND.dts        |  105 +-
 .../files/arch/arm/boot/dts/mt7623-eMMC.dts        |   14 +-
 .../files/arch/arm/boot/dts/mt7623-evb.dts         |   50 +
 ...soc-mediatek-Add-MT2701-power-dt-bindings.patch |   79 +
 ...soc-mediatek-Add-MT2701-power-dt-bindings.patch |   44 -
 ...k-Refine-scpsys-to-support-multiple-platf.patch |  491 +++++
 ...015-soc-mediatek-Add-MT2701-scpsys-driver.patch |  198 ++
 .../patches-4.9/0071-pwm-add-pwm-mediatek.patch    |   44 +-
 .../linux/mediatek/patches-4.9/0083-mfd-led3.patch |   43 +
 .../mediatek/patches-4.9/0085-pmic-led0.patch      |   94 +
 .../mediatek/patches-4.9/0086-pmic-led1.patch      |   40 +
 .../mediatek/patches-4.9/0087-pmic-led2.patch      |  558 +++++
 .../mediatek/patches-4.9/0088-pmic-led3.patch      |   44 +
 target/linux/mediatek/patches-4.9/0091-dsa1.patch  |  127 ++
 .../0091-net-next-mediatek-fix-DQL-support.patch   |   95 +
 target/linux/mediatek/patches-4.9/0092-dsa2.patch  |  219 ++
 target/linux/mediatek/patches-4.9/0092-dsa3.patch  |   67 +
 target/linux/mediatek/patches-4.9/0092-dsa4.patch  |   46 +
 target/linux/mediatek/patches-4.9/0092-dsa5.patch  | 1608 ++++++++++++++
 .../mediatek/patches-4.9/0093-dsa-compat.patch     |   98 +
 .../mediatek/patches-4.9/0094-net-affinity.patch   |   40 +
 .../0101-net-mediatek-add-gsw-mt7530-driver.patch  | 2322 --------------------
 target/linux/mediatek/profiles/default.mk          |    3 -
 31 files changed, 4155 insertions(+), 2581 deletions(-)

diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile
index 0b495ef..f183693 100644
--- a/target/linux/mediatek/Makefile
+++ b/target/linux/mediatek/Makefile
@@ -16,7 +16,7 @@ KERNELNAME:=Image dtbs zImage
 
 include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
-	kmod-mt76 kmod-leds-gpio kmod-gpio-button-hotplug swconfig \
+	kmod-mt76 kmod-leds-gpio kmod-gpio-button-hotplug \
 	wpad-mini
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/mediatek/base-files/etc/board.d/02_network b/target/linux/mediatek/base-files/etc/board.d/02_network
index 2549ff9..d772ab0 100755
--- a/target/linux/mediatek/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/base-files/etc/board.d/02_network
@@ -1,7 +1,6 @@
 #!/bin/sh
 
 . /lib/functions.sh
-. /lib/mediatek.sh
 . /lib/functions/uci-defaults.sh
 . /lib/functions/system.sh
 
@@ -10,18 +9,16 @@ mediatek_setup_interfaces()
 	local board="$1"
 
 	case $board in
-	eMMC | \
-	NAND | \
-	mt7623_evb)
-		ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
-		ucidef_add_switch "switch0" \
-			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6 at eth0" "5 at eth1"
+	'mediatek,mt7623-rfb-emmc' | \
+	'mediatek,mt7623-rfb-nand')
+		ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
+		ucidef_set_interface_wan wan
 		;;
 	esac
 }
 
 board_config_update
-board=$(mediatek_board_name)
+board=$(board_name)
 mediatek_setup_interfaces $board
 board_config_flush
 
diff --git a/target/linux/mediatek/base-files/lib/mediatek.sh b/target/linux/mediatek/base-files/lib/mediatek.sh
deleted file mode 100644
index 490ee3e..0000000
--- a/target/linux/mediatek/base-files/lib/mediatek.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2016 OpenWrt.org
-#
-
-mediatek_board_detect() {
-	local machine
-	local name
-
-	machine=$(cat /proc/device-tree/model)
-
-	case "$machine" in
-	"MediaTek MT7623 evaluation board")
-		name="mt7623_evb"
-		;;
-	"MediaTek MT7623 eMMC evaluation board")
-		name="eMMC"
-		;;
-	"MediaTek MT7623 NAND evaluation board")
-		name="NAND"
-		;;
-	esac
-
-	[ -z "$name" ] && name="unknown"
-
-	[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
-
-	echo "$name" > /tmp/sysinfo/board_name
-	echo "$machine" > /tmp/sysinfo/model
-}
-
-mediatek_board_name() {
-	local name
-
-	[ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
-	[ -z "$name" ] && name="unknown"
-
-	echo "$name"
-}
diff --git a/target/linux/mediatek/base-files/lib/preinit/01_affinity b/target/linux/mediatek/base-files/lib/preinit/01_affinity
deleted file mode 100755
index 1141d6d..0000000
--- a/target/linux/mediatek/base-files/lib/preinit/01_affinity
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-echo 4 > /proc/irq/32/smp_affinity
-echo 8 > /proc/irq/33/smp_affinity
diff --git a/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh b/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh
deleted file mode 100644
index 9e5a18d..0000000
--- a/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2014 The Linux Foundation. All rights reserved.
-#
-
-do_mediatek() {
-	. /lib/mediatek.sh
-
-	mediatek_board_detect
-}
-
-boot_hook_add preinit_main do_mediatek
diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface
new file mode 100644
index 0000000..eb0bed8
--- /dev/null
+++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set_preinit_iface() {
+	ifconfig eth0 up
+	ifname=lan1
+}
+
+boot_hook_add preinit_main set_preinit_iface
+
diff --git a/target/linux/mediatek/config-4.9 b/target/linux/mediatek/config-4.9
index 5f959de..1d77275 100644
--- a/target/linux/mediatek/config-4.9
+++ b/target/linux/mediatek/config-4.9
@@ -60,7 +60,7 @@ CONFIG_CLKSRC_MMIO=y
 CONFIG_CLKSRC_OF=y
 CONFIG_CLKSRC_PROBE=y
 CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="earlyprintk console=ttyS0,115200 block2mtd.block2mtd=/dev/mmcblk0,65536,eMMC,5 mtdparts=eMMC:256k(mbr)ro,512k(uboot)ro,256k(config)ro,256k(factory)ro,32M(kernel),32M(recovery),1024M(rootfs),2048M(usrdata),-(bmtpool) rootfstype=squashfs,jffs2"
+CONFIG_CMDLINE="earlyprintk console=ttyS0,115200 rootfstype=squashfs,jffs2"
 CONFIG_CMDLINE_FORCE=y
 CONFIG_COMMON_CLK=y
 CONFIG_COMMON_CLK_MEDIATEK=y
@@ -95,6 +95,7 @@ CONFIG_CPU_HAS_ASID=y
 CONFIG_CPU_PABRT_V7=y
 CONFIG_CPU_PM=y
 CONFIG_CPU_RMAP=y
+# CONFIG_CPU_THERMAL is not set
 CONFIG_CPU_TLB_V7=y
 CONFIG_CPU_V7=y
 CONFIG_CRC16=y
@@ -217,6 +218,9 @@ CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_MT65XX=y
+CONFIG_IIO=y
+# CONFIG_IIO_BUFFER is not set
+# CONFIG_IIO_TRIGGER is not set
 CONFIG_INITRAMFS_ROOT_GID=1000
 CONFIG_INITRAMFS_ROOT_UID=1000
 CONFIG_INITRAMFS_SOURCE="/openwrt/trunk/build_dir/target-arm_cortex-a7_musl-1.1.14_eabi/root-mediatek /openwrt/trunk/target/linux/generic/image/initramfs-base-files.txt"
@@ -230,6 +234,7 @@ CONFIG_IRQ_DOMAIN_HIERARCHY=y
 CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_WORK=y
 CONFIG_KALLSYMS=y
+CONFIG_LEDS_MT6323=y
 CONFIG_LIBFDT=y
 CONFIG_LOCKUP_DETECTOR=y
 CONFIG_LOCK_SPIN_ON_OWNER=y
@@ -245,8 +250,7 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_MDIO_BITBANG=y
 CONFIG_MDIO_BOARDINFO=y
 CONFIG_MDIO_GPIO=y
-# CONFIG_MTK_EFUSE is not set
-# CONFIG_MEDIATEK_MT6577_AUXADC is not set
+CONFIG_MEDIATEK_MT6577_AUXADC=y
 CONFIG_MEDIATEK_WATCHDOG=y
 CONFIG_MFD_CORE=y
 # CONFIG_MFD_MAX77620 is not set
@@ -278,18 +282,25 @@ CONFIG_MTD_UBI_BLOCK=y
 # CONFIG_MTD_UBI_FASTMAP is not set
 # CONFIG_MTD_UBI_GLUEBI is not set
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MTK_EFUSE=y
 CONFIG_MTK_INFRACFG=y
 # CONFIG_MTK_IOMMU is not set
 # CONFIG_MTK_IOMMU_V1 is not set
 CONFIG_MTK_PMIC_WRAP=y
 CONFIG_MTK_SCPSYS=y
+CONFIG_MTK_THERMAL=y
 CONFIG_MTK_TIMER=y
 CONFIG_MULTI_IRQ_HANDLER=y
 CONFIG_MUTEX_SPIN_ON_OWNER=y
 CONFIG_NEED_DMA_MAP_STATE=y
 # CONFIG_NEON is not set
+CONFIG_NET_DSA=y
+# CONFIG_NET_DSA_HWMON is not set
+CONFIG_NET_DSA_MT7530=y
+CONFIG_NET_DSA_TAG_MTK=y
 CONFIG_NET_FLOW_LIMIT=y
 CONFIG_NET_MEDIATEK_SOC=y
+CONFIG_NET_SWITCHDEV=y
 # CONFIG_NET_VENDOR_AURORA is not set
 CONFIG_NET_VENDOR_MEDIATEK=y
 # CONFIG_NET_VENDOR_WIZNET is not set
@@ -299,6 +310,7 @@ CONFIG_NO_HZ=y
 CONFIG_NO_HZ_COMMON=y
 CONFIG_NO_HZ_IDLE=y
 CONFIG_NR_CPUS=4
+CONFIG_NVMEM=y
 CONFIG_OF=y
 CONFIG_OF_ADDRESS=y
 CONFIG_OF_ADDRESS_PCI=y
@@ -403,6 +415,10 @@ CONFIG_SWIOTLB=y
 CONFIG_SWPHY=y
 CONFIG_SWP_EMULATE=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_THERMAL=y
+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
+CONFIG_THERMAL_GOV_STEP_WISE=y
+CONFIG_THERMAL_OF=y
 # CONFIG_THUMB2_KERNEL is not set
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TIMER_STATS=y
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/_mt7623.dtsi b/target/linux/mediatek/files/arch/arm/boot/dts/_mt7623.dtsi
index 0f91194..7093d35 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/_mt7623.dtsi
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/_mt7623.dtsi
@@ -151,7 +151,7 @@
 	};
 
 	pio: pinctrl at 10005000 {
-		compatible = "mediatek,mt7623-pinctrl";
+		compatible = "mediatek,mt2701-pinctrl";
 		reg = <0 0x1000b000 0 0x1000>;
 		mediatek,pctl-regmap = <&syscfg_pctl_a>;
 		pins-are-numbered;
@@ -165,7 +165,9 @@
 	};
 
 	syscfg_pctl_a: syscfg at 10005000 {
-		compatible = "mediatek,mt7623-pctl-a-syscfg", "syscon";
+		compatible = "mediatek,mt7623-pctl-a-syscfg",
+			     "mediatek,mt2701-pctl-a-syscfg",
+			     "syscon";
 		reg = <0 0x10005000 0 0x1000>;
 	};
 
@@ -176,8 +178,9 @@
 		reg = <0 0x10006000 0 0x1000>;
 		infracfg = <&infracfg>;
 		clocks = <&clk26m>,
-			 <&topckgen CLK_TOP_MM_SEL>;
-		clock-names = "mfg", "mm";
+			 <&topckgen CLK_TOP_MM_SEL>,
+			 <&topckgen CLK_TOP_ETHIF_SEL>;
+		clock-names = "mfg", "mm", "ethif";
 	};
 
 	watchdog: watchdog at 10007000 {
@@ -217,6 +220,19 @@
 		reg = <0 0x10200100 0 0x1c>;
 	};
 
+	efuse: efuse at 10206000 {
+		compatible = "mediatek,mt7623-efuse",
+			     "mediatek,efuse";
+		reg	   = <0 0x10206000 0 0x1000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		/* Data cells */
+		thermal_calibration: calib at 424 {
+			reg = <0x424 0xc>;
+		};
+	};
+
 	apmixedsys: apmixedsys at 10209000 {
 		compatible = "mediatek,mt7623-apmixedsys",
 			     "mediatek,mt2701-apmixedsys";
@@ -235,49 +251,13 @@
 		      <0 0x10216000 0 0x2000>;
 	};
 
-	i2c0: i2c at 11007000 {
-		compatible = "mediatek,mt7623-i2c",
-			     "mediatek,mt6577-i2c";
-		reg = <0 0x11007000 0 0x70>,
-		      <0 0x11000200 0 0x80>;
-		interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_LOW>;
-		clock-div = <16>;
-		clocks = <&pericfg CLK_PERI_I2C0>,
-			 <&pericfg CLK_PERI_AP_DMA>;
-		clock-names = "main", "dma";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "disabled";
-	};
-
-	i2c1: i2c at 11008000 {
-		compatible = "mediatek,mt7623-i2c",
-			     "mediatek,mt6577-i2c";
-		reg = <0 0x11008000 0 0x70>,
-		      <0 0x11000280 0 0x80>;
-		interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_LOW>;
-		clock-div = <16>;
-		clocks = <&pericfg CLK_PERI_I2C1>,
-			 <&pericfg CLK_PERI_AP_DMA>;
-		clock-names = "main", "dma";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "disabled";
-	};
-
-	i2c2: i2c at 11009000 {
-		compatible = "mediatek,mt7623-i2c",
-			     "mediatek,mt6577-i2c";
-		reg = <0 0x11009000 0 0x70>,
-		      <0 0x11000300 0 0x80>;
-		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_LOW>;
-		clock-div = <16>;
-		clocks = <&pericfg CLK_PERI_I2C2>,
-			 <&pericfg CLK_PERI_AP_DMA>;
-		clock-names = "main", "dma";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "disabled";
+	auxadc: adc at 11001000 {
+		compatible = "mediatek,mt7623-auxadc",
+			     "mediatek,mt2701-auxadc";
+		reg = <0 0x11001000 0 0x1000>;
+		clocks = <&pericfg CLK_PERI_AUXADC>;
+		clock-names = "main";
+		#io-channel-cells = <1>;
 	};
 
 	uart0: serial at 11002000 {
@@ -326,9 +306,8 @@
 
 	pwm: pwm at 11006000 {
 		compatible = "mediatek,mt7623-pwm";
-	
+
 		reg = <0 0x11006000 0 0x1000>;
-		
 		resets = <&pericfg MT2701_PERI_PWM_SW_RST>;
 		reset-names = "pwm";
 
@@ -342,12 +321,58 @@
 			 <&pericfg CLK_PERI_PWM5>;
 		clock-names = "top", "main", "pwm1", "pwm2",
 			      "pwm3", "pwm4", "pwm5";
-	
+
+		status = "disabled";
+	};
+
+	i2c0: i2c at 11007000 {
+		compatible = "mediatek,mt7623-i2c",
+			     "mediatek,mt6577-i2c";
+		reg = <0 0x11007000 0 0x70>,
+		      <0 0x11000200 0 0x80>;
+		interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_LOW>;
+		clock-div = <16>;
+		clocks = <&pericfg CLK_PERI_I2C0>,
+			 <&pericfg CLK_PERI_AP_DMA>;
+		clock-names = "main", "dma";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
+
+	i2c1: i2c at 11008000 {
+		compatible = "mediatek,mt7623-i2c",
+			     "mediatek,mt6577-i2c";
+		reg = <0 0x11008000 0 0x70>,
+		      <0 0x11000280 0 0x80>;
+		interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_LOW>;
+		clock-div = <16>;
+		clocks = <&pericfg CLK_PERI_I2C1>,
+			 <&pericfg CLK_PERI_AP_DMA>;
+		clock-names = "main", "dma";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
+
+	i2c2: i2c at 11009000 {
+		compatible = "mediatek,mt7623-i2c",
+			     "mediatek,mt6577-i2c";
+		reg = <0 0x11009000 0 0x70>,
+		      <0 0x11000300 0 0x80>;
+		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_LOW>;
+		clock-div = <16>;
+		clocks = <&pericfg CLK_PERI_I2C2>,
+			 <&pericfg CLK_PERI_AP_DMA>;
+		clock-names = "main", "dma";
+		#address-cells = <1>;
+		#size-cells = <0>;
 		status = "disabled";
 	};
 
 	spi: spi at 1100a000 {
-		compatible = "mediatek,mt7623-spi", "mediatek,mt6589-spi";
+		compatible = "mediatek,mt7623-spi",
+			     "mediatek,mt6589-spi";
 		reg = <0 0x1100a000 0 0x1000>;
 		interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&pericfg CLK_PERI_SPI0>;
@@ -356,8 +381,27 @@
 		status = "disabled";
 	};
 
+	thermal: thermal at 1100b000 {
+		#thermal-sensor-cells = <1>;
+		compatible = "mediatek,mt2701-thermal",
+			     "mediatek,mt2701-thermal";
+		reg = <0 0x1100b000 0 0x1000>;
+		interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&pericfg CLK_PERI_THERM>,
+			 <&pericfg CLK_PERI_AUXADC>;
+		clock-names = "therm", "auxadc";
+		resets = <&pericfg MT2701_PERI_THERM_SW_RST>;
+		reset-names = "therm";
+		mediatek,auxadc = <&auxadc>;
+		mediatek,apmixedsys = <&apmixedsys>;
+
+		nvmem-cells = <&thermal_calibration>;
+		nvmem-cell-names = "calibration-data";
+	};
+
 	nandc: nfi at 1100d000 {
-		compatible = "mediatek,mt2701-nfc";
+		compatible = "mediatek,mt7623-nfc",
+			     "mediatek,mt2701-nfc";
 		reg = <0 0x1100d000 0 0x1000>;
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
 		interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
@@ -371,7 +415,8 @@
 	};
 
 	bch: ecc at 1100e000 {
-		compatible = "mediatek,mt2701-ecc";
+		compatible = "mediatek,mt7623-ecc",
+			     "mediatek,mt2701-ecc";
 		reg = <0 0x1100e000 0 0x1000>;
 		interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&pericfg CLK_PERI_NFI_ECC>;
@@ -402,7 +447,7 @@
 	};
 
 	usb1: usb at 1a1c0000 {
-		compatible = "mediatek,mt2701-xhci",
+		compatible = "mediatek,mt7623-xhci",
 			     "mediatek,mt8173-xhci";
 		reg = <0 0x1a1c0000 0 0x1000>,
 		      <0 0x1a1c4700 0 0x0100>;
@@ -528,21 +573,26 @@
 	};
 
 	ethsys: syscon at 1b000000 {
-		compatible = "mediatek,mt2701-ethsys", "syscon";
+		compatible = "mediatek,mt7623-ethsys",
+			     "mediatek,mt2701-ethsys",
+			     "syscon";
 		reg = <0 0x1b000000 0 0x1000>;
 		#reset-cells = <1>;
 		#clock-cells = <1>;
 	};
 
 	eth: ethernet at 1b100000 {
-		compatible = "mediatek,mt2701-eth";
+		compatible = "mediatek,mt7623-eth",
+			     "mediatek,mt2701-eth",
+			     "syscon";
 		reg = <0 0x1b100000 0 0x20000>;
-	
+
 		clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
 			 <&ethsys CLK_ETHSYS_ESW>,
 			 <&ethsys CLK_ETHSYS_GP2>,
-			 <&ethsys CLK_ETHSYS_GP1>;
-		clock-names = "ethif", "esw", "gp2", "gp1";
+			 <&ethsys CLK_ETHSYS_GP1>,
+			 <&apmixedsys CLK_APMIXED_TRGPLL>;
+		clock-names = "ethif", "esw", "gp2", "gp1", "trgpll";
 		interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_LOW
 			      GIC_SPI 199 IRQ_TYPE_LEVEL_LOW
 			      GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>;
@@ -554,11 +604,9 @@
 		mediatek,ethsys = <&ethsys>;
 		mediatek,pctl = <&syscfg_pctl_a>;
 
-		mediatek,switch = <&gsw>;
-
 		#address-cells = <1>;
 		#size-cells = <0>;
-	
+
 		status = "disabled";
 
 		gmac1: mac at 0 {
@@ -566,9 +614,9 @@
 			reg = <0>;
 
 			status = "disabled";
-			
-			phy-mode = "rgmii";
-			
+
+			phy-mode = "trgmii";
+
 			fixed-link {
 				speed = <1000>;
 				full-duplex;
@@ -582,34 +630,10 @@
 
 			status = "disabled";
 		};
-	
-		mdio-bus {
+
+		mdio0: mdio-bus {
 			#address-cells = <1>;
 			#size-cells = <0>;
-
-			phy5: ethernet-phy at 5 {
-				reg = <5>;
-				phy-mode = "rgmii-rxid";
-			};
-
-			phy1f: ethernet-phy at 1f {
-				reg = <0x1f>;
-				phy-mode = "rgmii";
-			};
 		};
 	};
-
-	gsw: switch at 1b100000 {
-		compatible = "mediatek,mt7623-gsw";
-		interrupt-parent = <&pio>;
-		interrupts = <168 IRQ_TYPE_EDGE_RISING>;
-		resets = <&ethsys 2>;
-		reset-names = "eth";
-		clocks = <&apmixedsys CLK_APMIXED_TRGPLL>;
-		clock-names = "trgpll";
-		mt7530-supply = <&mt6323_vpa_reg>;
-		mediatek,pctl-regmap = <&syscfg_pctl_a>;
-		mediatek,ethsys = <&ethsys>;
-		status = "disabled";
-	};
 };
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
index 15b7da9..d90e0fb 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
@@ -18,8 +18,8 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	model = "MediaTek MT7623 NAND evaluation board";
-	compatible = "mediatek,mt7623-evb", "mediatek,mt7623";
+	model = "MediaTek MT7623 NAND reference board";
+	compatible = "mediatek,mt7623-rfb-nand", "mediatek,mt7623";
 
 	chosen {
 		stdout-path = &uart2;
@@ -280,6 +280,34 @@
 				regulator-enable-ramp-delay = <216>;
 			};
 		};
+
+		mt6323led: leds {
+			compatible = "mediatek,mt6323-led";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led at 0 {
+				reg = <0>;
+				label = "LED0";
+				linux,default-trigger = "timer";
+				default-state = "on";
+			};
+			led at 1 {
+				reg = <1>;
+				label = "LED1";
+				default-state = "off";
+			};
+			led at 2 {
+				reg = <2>;
+				label = "LED2";
+				default-state = "on";
+			};
+			led at 3 {
+				reg = <3>;
+				label = "LED3";
+				default-state = "on";
+			};
+		};
 	};
 };
 
@@ -332,10 +360,16 @@
 				 <MT7623_PIN_270_G2_RXD1_FUNC_G2_RXD1>,
 				 <MT7623_PIN_271_G2_RXD2_FUNC_G2_RXD2>,
 				 <MT7623_PIN_272_G2_RXD3_FUNC_G2_RXD3>,
-				 <MT7623_PIN_273_ESW_INT_FUNC_ESW_INT>,
 				 <MT7623_PIN_274_G2_RXDV_FUNC_G2_RXDV>;
 		};
-		
+
+		pins_eth_esw {
+			pinmux = <MT7623_PIN_273_ESW_INT_FUNC_ESW_INT>;
+			input-enable;
+			drive-strength = <MTK_DRIVE_8mA>;
+			bias-pull-up;
+		};
+
 		pins_eth_rst {
 			pinmux = <MT7623_PIN_15_GPIO15_FUNC_GPIO15>;
 			output-low;
@@ -426,7 +460,7 @@
 	mac-address = [00 11 22 33 44 55];
 	status = "okay";
 
-	phy-mode = "rgmii";
+	phy-mode = "trgmii";
 
 	fixed-link {
 		speed = <1000>;
@@ -435,13 +469,64 @@
 	};
 };
 
-&gsw {
-	pinctrl-names = "default";
-	pinctrl-0 = <&eth_default>;
-	mediatek,reset-pin = <&pio 15 0>;
-	status = "okay";
+&mdio0 {
+	switch at 0 {
+		compatible = "mediatek,mt7530";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&eth_default>;
+
+		core-supply = <&mt6323_vpa_reg>;
+		io-supply = <&mt6323_vemc3v3_reg>;
+		reset-gpios = <&pio 33 0>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0>;
+			port at 0 {
+				reg = <0>;
+				label = "lan0";
+			};
+
+			port at 1 {
+				reg = <1>;
+				label = "lan1";
+			};
+
+			port at 2 {
+				reg = <2>;
+				label = "lan2";
+			};
+
+			port at 3 {
+				reg = <3>;
+				label = "lan3";
+			};
+
+			port at 4 {
+				reg = <4>;
+				label = "wan";
+			};
+
+			port at 6 {
+				reg = <6>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "trgmii";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+		};
+	};
 };
 
+
 &pwm {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pwm_pins>;
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
index 630240c..86c4dd5 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
@@ -18,8 +18,8 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	model = "MediaTek MT7623 eMMC evaluation board";
-	compatible = "mediatek,mt7623-evb", "mediatek,mt7623";
+	model = "MediaTek MT7623 eMMC reference board";
+	compatible = "mediatek,mt7623-rfb-emmc", "mediatek,mt7623";
 
 	chosen {
 		stdout-path = &uart2;
@@ -430,7 +430,7 @@
 				 <MT7623_PIN_273_ESW_INT_FUNC_ESW_INT>,
 				 <MT7623_PIN_274_G2_RXDV_FUNC_G2_RXDV>;
 		};
-		
+
 		pins_eth_rst {
 			pinmux = <MT7623_PIN_15_GPIO15_FUNC_GPIO15>;
 			output-low;
@@ -474,14 +474,6 @@
 &gmac2 {
 	mac-address = [00 11 22 33 44 55];
 	status = "okay";
-	phy-handle = <&phy5>;
-};
-
-&gsw {
-	pinctrl-names = "default";
-	pinctrl-0 = <&eth_default>;
-	mediatek,reset-pin = <&pio 15 0>;
-	status = "okay";
 };
 
 &pwm {
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-evb.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-evb.dts
new file mode 100644
index 0000000..ad2a38b
--- /dev/null
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-evb.dts
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: John Crispin <blogic at openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+#include "mt7623.dtsi"
+
+/ {
+	model = "MediaTek MT7623 evaluation board";
+	compatible = "mediatek,mt7623-evb", "mediatek,mt7623";
+
+	chosen {
+		stdout-path = &uart2;
+	};
+
+	memory {
+		reg = <0 0x80000000 0 0x40000000>;
+	};
+/*
+	pwm_pins: pwm {
+		pins_pwm1 {
+			pinmux = <MT7623_PIN_204_PWM1_FUNC_PWM1>;
+		};
+
+		pins_pwm2 {
+			pinmux = <MT7623_PIN_205_PWM2_FUNC_PWM2>;
+		};
+	};*/
+
+};
+
+&uart2 {
+	status = "okay";
+};
+
+/*&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm_pins>;
+	status = "okay";
+};*/
diff --git a/target/linux/mediatek/patches-4.9/00013-soc-mediatek-Add-MT2701-power-dt-bindings.patch b/target/linux/mediatek/patches-4.9/00013-soc-mediatek-Add-MT2701-power-dt-bindings.patch
new file mode 100644
index 0000000..28b3d7f
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/00013-soc-mediatek-Add-MT2701-power-dt-bindings.patch
@@ -0,0 +1,79 @@
+From 3e96c653372d8852c45dcd3bd856975157a0fd6a Mon Sep 17 00:00:00 2001
+From: Shunli Wang <shunli.wang at mediatek.com>
+Date: Thu, 20 Oct 2016 16:56:37 +0800
+Subject: [PATCH] soc: mediatek: Add MT2701 power dt-bindings
+
+Add power dt-bindings for MT2701.
+
+Signed-off-by: Shunli Wang <shunli.wang at mediatek.com>
+Signed-off-by: James Liao <jamesjj.liao at mediatek.com>
+Acked-by: Rob Herring <robh at kernel.org>
+Reviewed-by: Kevin Hilman <khilman at baylibre.com>
+Signed-off-by: Matthias Brugger <matthias.bgg at gmail.com>
+---
+ .../devicetree/bindings/soc/mediatek/scpsys.txt    | 13 +++++++----
+ include/dt-bindings/power/mt2701-power.h           | 27 ++++++++++++++++++++++
+ 2 files changed, 35 insertions(+), 5 deletions(-)
+ create mode 100644 include/dt-bindings/power/mt2701-power.h
+
+Index: linux-4.9.14/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
+===================================================================
+--- linux-4.9.14.orig/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
++++ linux-4.9.14/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
+@@ -9,17 +9,20 @@ domain control.
+ 
+ The driver implements the Generic PM domain bindings described in
+ power/power_domain.txt. It provides the power domains defined in
+-include/dt-bindings/power/mt8173-power.h.
++include/dt-bindings/power/mt8173-power.h and mt2701-power.h.
+ 
+ Required properties:
+-- compatible: Must be "mediatek,mt8173-scpsys"
++- compatible: Should be one of:
++	- "mediatek,mt2701-scpsys"
++	- "mediatek,mt8173-scpsys"
+ - #power-domain-cells: Must be 1
+ - reg: Address range of the SCPSYS unit
+ - infracfg: must contain a phandle to the infracfg controller
+ - clock, clock-names: clocks according to the common clock binding.
+-                      The clocks needed "mm", "mfg", "venc" and "venc_lt".
+-		      These are the clocks which hardware needs to be enabled
+-		      before enabling certain power domains.
++                      These are clocks which hardware needs to be
++                      enabled before enabling certain power domains.
++	Required clocks for MT2701: "mm", "mfg", "ethif"
++	Required clocks for MT8173: "mm", "mfg", "venc", "venc_lt"
+ 
+ Optional properties:
+ - vdec-supply: Power supply for the vdec power domain
+Index: linux-4.9.14/include/dt-bindings/power/mt2701-power.h
+===================================================================
+--- /dev/null
++++ linux-4.9.14/include/dt-bindings/power/mt2701-power.h
+@@ -0,0 +1,26 @@
++/*
++ * Copyright (C) 2015 MediaTek Inc.
++ *
++ * This program is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ */
++
++#ifndef _DT_BINDINGS_POWER_MT2701_POWER_H
++#define _DT_BINDINGS_POWER_MT2701_POWER_H
++
++#define MT2701_POWER_DOMAIN_CONN	0
++#define MT2701_POWER_DOMAIN_DISP	1
++#define MT2701_POWER_DOMAIN_IFR_MSC	2
++#define MT2701_POWER_DOMAIN_VDEC	3
++#define MT2701_POWER_DOMAIN_ISP		4
++#define MT2701_POWER_DOMAIN_BDP		5
++#define MT2701_POWER_DOMAIN_ETH		6
++#define MT2701_POWER_DOMAIN_HIF		7
++
++#endif /* _DT_BINDINGS_POWER_MT2701_POWER_H */
diff --git a/target/linux/mediatek/patches-4.9/0004-soc-mediatek-Add-MT2701-power-dt-bindings.patch b/target/linux/mediatek/patches-4.9/0004-soc-mediatek-Add-MT2701-power-dt-bindings.patch
deleted file mode 100644
index 132d6c8..0000000
--- a/target/linux/mediatek/patches-4.9/0004-soc-mediatek-Add-MT2701-power-dt-bindings.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 7c5b29de78f1b15c5bde40a6ca4510fc09588457 Mon Sep 17 00:00:00 2001
-From: Shunli Wang <shunli.wang at mediatek.com>
-Date: Wed, 30 Dec 2015 14:41:45 +0800
-Subject: [PATCH 004/102] soc: mediatek: Add MT2701 power dt-bindings
-
-Add power dt-bindings for MT2701.
-
-Signed-off-by: Shunli Wang <shunli.wang at mediatek.com>
-Signed-off-by: James Liao <jamesjj.liao at mediatek.com>
----
- include/dt-bindings/power/mt2701-power.h |   27 +++++++++++++++++++++++++++
- 1 file changed, 27 insertions(+)
- create mode 100644 include/dt-bindings/power/mt2701-power.h
-
---- /dev/null
-+++ b/include/dt-bindings/power/mt2701-power.h
-@@ -0,0 +1,27 @@
-+/*
-+ * Copyright (C) 2015 MediaTek Inc.
-+ *
-+ * This program is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#ifndef _DT_BINDINGS_POWER_MT2701_POWER_H
-+#define _DT_BINDINGS_POWER_MT2701_POWER_H
-+
-+#define MT2701_POWER_DOMAIN_CONN	0
-+#define MT2701_POWER_DOMAIN_DISP	1
-+#define MT2701_POWER_DOMAIN_MFG		2
-+#define MT2701_POWER_DOMAIN_VDEC	3
-+#define MT2701_POWER_DOMAIN_ISP		4
-+#define MT2701_POWER_DOMAIN_BDP		5
-+#define MT2701_POWER_DOMAIN_ETH		6
-+#define MT2701_POWER_DOMAIN_HIF		7
-+#define MT2701_POWER_DOMAIN_IFR_MSC	8
-+
-+#endif /* _DT_BINDINGS_POWER_MT2701_POWER_H */
diff --git a/target/linux/mediatek/patches-4.9/0014-soc-mediatek-Refine-scpsys-to-support-multiple-platf.patch b/target/linux/mediatek/patches-4.9/0014-soc-mediatek-Refine-scpsys-to-support-multiple-platf.patch
new file mode 100644
index 0000000..4c9e790
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0014-soc-mediatek-Refine-scpsys-to-support-multiple-platf.patch
@@ -0,0 +1,491 @@
+From 6078c651947a148c1de543b54fe55af43a63043a Mon Sep 17 00:00:00 2001
+From: James Liao <jamesjj.liao at mediatek.com>
+Date: Thu, 20 Oct 2016 16:56:35 +0800
+Subject: [PATCH 1/2] soc: mediatek: Refine scpsys to support multiple platform
+
+Refine scpsys driver common code to support multiple SoC / platform.
+
+Signed-off-by: James Liao <jamesjj.liao at mediatek.com>
+Reviewed-by: Kevin Hilman <khilman at baylibre.com>
+Signed-off-by: Matthias Brugger <matthias.bgg at gmail.com>
+---
+ drivers/soc/mediatek/mtk-scpsys.c | 348 +++++++++++++++++++++++---------------
+ 1 file changed, 210 insertions(+), 138 deletions(-)
+
+diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
+index 837effe19907..722aac80e611 100644
+--- a/drivers/soc/mediatek/mtk-scpsys.c
++++ b/drivers/soc/mediatek/mtk-scpsys.c
+@@ -11,17 +11,15 @@
+  * GNU General Public License for more details.
+  */
+ #include <linux/clk.h>
+-#include <linux/delay.h>
++#include <linux/init.h>
+ #include <linux/io.h>
+-#include <linux/kernel.h>
+ #include <linux/mfd/syscon.h>
+-#include <linux/init.h>
+ #include <linux/of_device.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_domain.h>
+-#include <linux/regmap.h>
+-#include <linux/soc/mediatek/infracfg.h>
+ #include <linux/regulator/consumer.h>
++#include <linux/soc/mediatek/infracfg.h>
++
+ #include <dt-bindings/power/mt8173-power.h>
+ 
+ #define SPM_VDE_PWR_CON			0x0210
+@@ -34,6 +32,7 @@
+ #define SPM_MFG_2D_PWR_CON		0x02c0
+ #define SPM_MFG_ASYNC_PWR_CON		0x02c4
+ #define SPM_USB_PWR_CON			0x02cc
++
+ #define SPM_PWR_STATUS			0x060c
+ #define SPM_PWR_STATUS_2ND		0x0610
+ 
+@@ -55,12 +54,21 @@
+ #define PWR_STATUS_USB			BIT(25)
+ 
+ enum clk_id {
+-	MT8173_CLK_NONE,
+-	MT8173_CLK_MM,
+-	MT8173_CLK_MFG,
+-	MT8173_CLK_VENC,
+-	MT8173_CLK_VENC_LT,
+-	MT8173_CLK_MAX,
++	CLK_NONE,
++	CLK_MM,
++	CLK_MFG,
++	CLK_VENC,
++	CLK_VENC_LT,
++	CLK_MAX,
++};
++
++static const char * const clk_names[] = {
++	NULL,
++	"mm",
++	"mfg",
++	"venc",
++	"venc_lt",
++	NULL,
+ };
+ 
+ #define MAX_CLKS	2
+@@ -76,98 +84,6 @@ struct scp_domain_data {
+ 	bool active_wakeup;
+ };
+ 
+-static const struct scp_domain_data scp_domain_data[] = {
+-	[MT8173_POWER_DOMAIN_VDEC] = {
+-		.name = "vdec",
+-		.sta_mask = PWR_STATUS_VDEC,
+-		.ctl_offs = SPM_VDE_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(12, 12),
+-		.clk_id = {MT8173_CLK_MM},
+-	},
+-	[MT8173_POWER_DOMAIN_VENC] = {
+-		.name = "venc",
+-		.sta_mask = PWR_STATUS_VENC,
+-		.ctl_offs = SPM_VEN_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(15, 12),
+-		.clk_id = {MT8173_CLK_MM, MT8173_CLK_VENC},
+-	},
+-	[MT8173_POWER_DOMAIN_ISP] = {
+-		.name = "isp",
+-		.sta_mask = PWR_STATUS_ISP,
+-		.ctl_offs = SPM_ISP_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(13, 12),
+-		.clk_id = {MT8173_CLK_MM},
+-	},
+-	[MT8173_POWER_DOMAIN_MM] = {
+-		.name = "mm",
+-		.sta_mask = PWR_STATUS_DISP,
+-		.ctl_offs = SPM_DIS_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(12, 12),
+-		.clk_id = {MT8173_CLK_MM},
+-		.bus_prot_mask = MT8173_TOP_AXI_PROT_EN_MM_M0 |
+-			MT8173_TOP_AXI_PROT_EN_MM_M1,
+-	},
+-	[MT8173_POWER_DOMAIN_VENC_LT] = {
+-		.name = "venc_lt",
+-		.sta_mask = PWR_STATUS_VENC_LT,
+-		.ctl_offs = SPM_VEN2_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(15, 12),
+-		.clk_id = {MT8173_CLK_MM, MT8173_CLK_VENC_LT},
+-	},
+-	[MT8173_POWER_DOMAIN_AUDIO] = {
+-		.name = "audio",
+-		.sta_mask = PWR_STATUS_AUDIO,
+-		.ctl_offs = SPM_AUDIO_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(15, 12),
+-		.clk_id = {MT8173_CLK_NONE},
+-	},
+-	[MT8173_POWER_DOMAIN_USB] = {
+-		.name = "usb",
+-		.sta_mask = PWR_STATUS_USB,
+-		.ctl_offs = SPM_USB_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(15, 12),
+-		.clk_id = {MT8173_CLK_NONE},
+-		.active_wakeup = true,
+-	},
+-	[MT8173_POWER_DOMAIN_MFG_ASYNC] = {
+-		.name = "mfg_async",
+-		.sta_mask = PWR_STATUS_MFG_ASYNC,
+-		.ctl_offs = SPM_MFG_ASYNC_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = 0,
+-		.clk_id = {MT8173_CLK_MFG},
+-	},
+-	[MT8173_POWER_DOMAIN_MFG_2D] = {
+-		.name = "mfg_2d",
+-		.sta_mask = PWR_STATUS_MFG_2D,
+-		.ctl_offs = SPM_MFG_2D_PWR_CON,
+-		.sram_pdn_bits = GENMASK(11, 8),
+-		.sram_pdn_ack_bits = GENMASK(13, 12),
+-		.clk_id = {MT8173_CLK_NONE},
+-	},
+-	[MT8173_POWER_DOMAIN_MFG] = {
+-		.name = "mfg",
+-		.sta_mask = PWR_STATUS_MFG,
+-		.ctl_offs = SPM_MFG_PWR_CON,
+-		.sram_pdn_bits = GENMASK(13, 8),
+-		.sram_pdn_ack_bits = GENMASK(21, 16),
+-		.clk_id = {MT8173_CLK_NONE},
+-		.bus_prot_mask = MT8173_TOP_AXI_PROT_EN_MFG_S |
+-			MT8173_TOP_AXI_PROT_EN_MFG_M0 |
+-			MT8173_TOP_AXI_PROT_EN_MFG_M1 |
+-			MT8173_TOP_AXI_PROT_EN_MFG_SNOOP_OUT,
+-	},
+-};
+-
+-#define NUM_DOMAINS	ARRAY_SIZE(scp_domain_data)
+-
+ struct scp;
+ 
+ struct scp_domain {
+@@ -179,7 +95,7 @@ struct scp_domain {
+ };
+ 
+ struct scp {
+-	struct scp_domain domains[NUM_DOMAINS];
++	struct scp_domain *domains;
+ 	struct genpd_onecell_data pd_data;
+ 	struct device *dev;
+ 	void __iomem *base;
+@@ -408,57 +324,55 @@ static bool scpsys_active_wakeup(struct device *dev)
+ 	return scpd->data->active_wakeup;
+ }
+ 
+-static int scpsys_probe(struct platform_device *pdev)
++static void init_clks(struct platform_device *pdev, struct clk **clk)
++{
++	int i;
++
++	for (i = CLK_NONE + 1; i < CLK_MAX; i++)
++		clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
++}
++
++static struct scp *init_scp(struct platform_device *pdev,
++			const struct scp_domain_data *scp_domain_data, int num)
+ {
+ 	struct genpd_onecell_data *pd_data;
+ 	struct resource *res;
+-	int i, j, ret;
++	int i, j;
+ 	struct scp *scp;
+-	struct clk *clk[MT8173_CLK_MAX];
++	struct clk *clk[CLK_MAX];
+ 
+ 	scp = devm_kzalloc(&pdev->dev, sizeof(*scp), GFP_KERNEL);
+ 	if (!scp)
+-		return -ENOMEM;
++		return ERR_PTR(-ENOMEM);
+ 
+ 	scp->dev = &pdev->dev;
+ 
+ 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ 	scp->base = devm_ioremap_resource(&pdev->dev, res);
+ 	if (IS_ERR(scp->base))
+-		return PTR_ERR(scp->base);
++		return ERR_CAST(scp->base);
++
++	scp->domains = devm_kzalloc(&pdev->dev,
++				sizeof(*scp->domains) * num, GFP_KERNEL);
++	if (!scp->domains)
++		return ERR_PTR(-ENOMEM);
+ 
+ 	pd_data = &scp->pd_data;
+ 
+ 	pd_data->domains = devm_kzalloc(&pdev->dev,
+-			sizeof(*pd_data->domains) * NUM_DOMAINS, GFP_KERNEL);
++			sizeof(*pd_data->domains) * num, GFP_KERNEL);
+ 	if (!pd_data->domains)
+-		return -ENOMEM;
+-
+-	clk[MT8173_CLK_MM] = devm_clk_get(&pdev->dev, "mm");
+-	if (IS_ERR(clk[MT8173_CLK_MM]))
+-		return PTR_ERR(clk[MT8173_CLK_MM]);
+-
+-	clk[MT8173_CLK_MFG] = devm_clk_get(&pdev->dev, "mfg");
+-	if (IS_ERR(clk[MT8173_CLK_MFG]))
+-		return PTR_ERR(clk[MT8173_CLK_MFG]);
+-
+-	clk[MT8173_CLK_VENC] = devm_clk_get(&pdev->dev, "venc");
+-	if (IS_ERR(clk[MT8173_CLK_VENC]))
+-		return PTR_ERR(clk[MT8173_CLK_VENC]);
+-
+-	clk[MT8173_CLK_VENC_LT] = devm_clk_get(&pdev->dev, "venc_lt");
+-	if (IS_ERR(clk[MT8173_CLK_VENC_LT]))
+-		return PTR_ERR(clk[MT8173_CLK_VENC_LT]);
++		return ERR_PTR(-ENOMEM);
+ 
+ 	scp->infracfg = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+ 			"infracfg");
+ 	if (IS_ERR(scp->infracfg)) {
+ 		dev_err(&pdev->dev, "Cannot find infracfg controller: %ld\n",
+ 				PTR_ERR(scp->infracfg));
+-		return PTR_ERR(scp->infracfg);
++		return ERR_CAST(scp->infracfg);
+ 	}
+ 
+-	for (i = 0; i < NUM_DOMAINS; i++) {
++	for (i = 0; i < num; i++) {
+ 		struct scp_domain *scpd = &scp->domains[i];
+ 		const struct scp_domain_data *data = &scp_domain_data[i];
+ 
+@@ -467,13 +381,15 @@ static int scpsys_probe(struct platform_device *pdev)
+ 			if (PTR_ERR(scpd->supply) == -ENODEV)
+ 				scpd->supply = NULL;
+ 			else
+-				return PTR_ERR(scpd->supply);
++				return ERR_CAST(scpd->supply);
+ 		}
+ 	}
+ 
+-	pd_data->num_domains = NUM_DOMAINS;
++	pd_data->num_domains = num;
+ 
+-	for (i = 0; i < NUM_DOMAINS; i++) {
++	init_clks(pdev, clk);
++
++	for (i = 0; i < num; i++) {
+ 		struct scp_domain *scpd = &scp->domains[i];
+ 		struct generic_pm_domain *genpd = &scpd->genpd;
+ 		const struct scp_domain_data *data = &scp_domain_data[i];
+@@ -482,13 +398,37 @@ static int scpsys_probe(struct platform_device *pdev)
+ 		scpd->scp = scp;
+ 
+ 		scpd->data = data;
+-		for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++)
+-			scpd->clk[j] = clk[data->clk_id[j]];
++
++		for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) {
++			struct clk *c = clk[data->clk_id[j]];
++
++			if (IS_ERR(c)) {
++				dev_err(&pdev->dev, "%s: clk unavailable\n",
++					data->name);
++				return ERR_CAST(c);
++			}
++
++			scpd->clk[j] = c;
++		}
+ 
+ 		genpd->name = data->name;
+ 		genpd->power_off = scpsys_power_off;
+ 		genpd->power_on = scpsys_power_on;
+ 		genpd->dev_ops.active_wakeup = scpsys_active_wakeup;
++	}
++
++	return scp;
++}
++
++static void mtk_register_power_domains(struct platform_device *pdev,
++				struct scp *scp, int num)
++{
++	struct genpd_onecell_data *pd_data;
++	int i, ret;
++
++	for (i = 0; i < num; i++) {
++		struct scp_domain *scpd = &scp->domains[i];
++		struct generic_pm_domain *genpd = &scpd->genpd;
+ 
+ 		/*
+ 		 * Initially turn on all domains to make the domains usable
+@@ -507,6 +447,123 @@ static int scpsys_probe(struct platform_device *pdev)
+ 	 * valid.
+ 	 */
+ 
++	pd_data = &scp->pd_data;
++
++	ret = of_genpd_add_provider_onecell(pdev->dev.of_node, pd_data);
++	if (ret)
++		dev_err(&pdev->dev, "Failed to add OF provider: %d\n", ret);
++}
++
++/*
++ * MT8173 power domain support
++ */
++
++static const struct scp_domain_data scp_domain_data_mt8173[] = {
++	[MT8173_POWER_DOMAIN_VDEC] = {
++		.name = "vdec",
++		.sta_mask = PWR_STATUS_VDEC,
++		.ctl_offs = SPM_VDE_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(12, 12),
++		.clk_id = {CLK_MM},
++	},
++	[MT8173_POWER_DOMAIN_VENC] = {
++		.name = "venc",
++		.sta_mask = PWR_STATUS_VENC,
++		.ctl_offs = SPM_VEN_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(15, 12),
++		.clk_id = {CLK_MM, CLK_VENC},
++	},
++	[MT8173_POWER_DOMAIN_ISP] = {
++		.name = "isp",
++		.sta_mask = PWR_STATUS_ISP,
++		.ctl_offs = SPM_ISP_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(13, 12),
++		.clk_id = {CLK_MM},
++	},
++	[MT8173_POWER_DOMAIN_MM] = {
++		.name = "mm",
++		.sta_mask = PWR_STATUS_DISP,
++		.ctl_offs = SPM_DIS_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(12, 12),
++		.clk_id = {CLK_MM},
++		.bus_prot_mask = MT8173_TOP_AXI_PROT_EN_MM_M0 |
++			MT8173_TOP_AXI_PROT_EN_MM_M1,
++	},
++	[MT8173_POWER_DOMAIN_VENC_LT] = {
++		.name = "venc_lt",
++		.sta_mask = PWR_STATUS_VENC_LT,
++		.ctl_offs = SPM_VEN2_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(15, 12),
++		.clk_id = {CLK_MM, CLK_VENC_LT},
++	},
++	[MT8173_POWER_DOMAIN_AUDIO] = {
++		.name = "audio",
++		.sta_mask = PWR_STATUS_AUDIO,
++		.ctl_offs = SPM_AUDIO_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(15, 12),
++		.clk_id = {CLK_NONE},
++	},
++	[MT8173_POWER_DOMAIN_USB] = {
++		.name = "usb",
++		.sta_mask = PWR_STATUS_USB,
++		.ctl_offs = SPM_USB_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(15, 12),
++		.clk_id = {CLK_NONE},
++		.active_wakeup = true,
++	},
++	[MT8173_POWER_DOMAIN_MFG_ASYNC] = {
++		.name = "mfg_async",
++		.sta_mask = PWR_STATUS_MFG_ASYNC,
++		.ctl_offs = SPM_MFG_ASYNC_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = 0,
++		.clk_id = {CLK_MFG},
++	},
++	[MT8173_POWER_DOMAIN_MFG_2D] = {
++		.name = "mfg_2d",
++		.sta_mask = PWR_STATUS_MFG_2D,
++		.ctl_offs = SPM_MFG_2D_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(13, 12),
++		.clk_id = {CLK_NONE},
++	},
++	[MT8173_POWER_DOMAIN_MFG] = {
++		.name = "mfg",
++		.sta_mask = PWR_STATUS_MFG,
++		.ctl_offs = SPM_MFG_PWR_CON,
++		.sram_pdn_bits = GENMASK(13, 8),
++		.sram_pdn_ack_bits = GENMASK(21, 16),
++		.clk_id = {CLK_NONE},
++		.bus_prot_mask = MT8173_TOP_AXI_PROT_EN_MFG_S |
++			MT8173_TOP_AXI_PROT_EN_MFG_M0 |
++			MT8173_TOP_AXI_PROT_EN_MFG_M1 |
++			MT8173_TOP_AXI_PROT_EN_MFG_SNOOP_OUT,
++	},
++};
++
++#define NUM_DOMAINS_MT8173	ARRAY_SIZE(scp_domain_data_mt8173)
++
++static int __init scpsys_probe_mt8173(struct platform_device *pdev)
++{
++	struct scp *scp;
++	struct genpd_onecell_data *pd_data;
++	int ret;
++
++	scp = init_scp(pdev, scp_domain_data_mt8173, NUM_DOMAINS_MT8173);
++	if (IS_ERR(scp))
++		return PTR_ERR(scp);
++
++	mtk_register_power_domains(pdev, scp, NUM_DOMAINS_MT8173);
++
++	pd_data = &scp->pd_data;
++
+ 	ret = pm_genpd_add_subdomain(pd_data->domains[MT8173_POWER_DOMAIN_MFG_ASYNC],
+ 		pd_data->domains[MT8173_POWER_DOMAIN_MFG_2D]);
+ 	if (ret && IS_ENABLED(CONFIG_PM))
+@@ -517,21 +574,36 @@ static int scpsys_probe(struct platform_device *pdev)
+ 	if (ret && IS_ENABLED(CONFIG_PM))
+ 		dev_err(&pdev->dev, "Failed to add subdomain: %d\n", ret);
+ 
+-	ret = of_genpd_add_provider_onecell(pdev->dev.of_node, pd_data);
+-	if (ret)
+-		dev_err(&pdev->dev, "Failed to add OF provider: %d\n", ret);
+-
+ 	return 0;
+ }
+ 
++/*
++ * scpsys driver init
++ */
++
+ static const struct of_device_id of_scpsys_match_tbl[] = {
+ 	{
+ 		.compatible = "mediatek,mt8173-scpsys",
++		.data = scpsys_probe_mt8173,
+ 	}, {
+ 		/* sentinel */
+ 	}
+ };
+ 
++static int scpsys_probe(struct platform_device *pdev)
++{
++	int (*probe)(struct platform_device *);
++	const struct of_device_id *of_id;
++
++	of_id = of_match_node(of_scpsys_match_tbl, pdev->dev.of_node);
++	if (!of_id || !of_id->data)
++		return -EINVAL;
++
++	probe = of_id->data;
++
++	return probe(pdev);
++}
++
+ static struct platform_driver scpsys_drv = {
+ 	.probe = scpsys_probe,
+ 	.driver = {
+-- 
+2.11.0
+
diff --git a/target/linux/mediatek/patches-4.9/0015-soc-mediatek-Add-MT2701-scpsys-driver.patch b/target/linux/mediatek/patches-4.9/0015-soc-mediatek-Add-MT2701-scpsys-driver.patch
new file mode 100644
index 0000000..c56a8a9
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0015-soc-mediatek-Add-MT2701-scpsys-driver.patch
@@ -0,0 +1,198 @@
+From 112ef1882e12094c823937f9d72f2f598db02df7 Mon Sep 17 00:00:00 2001
+From: Shunli Wang <shunli.wang at mediatek.com>
+Date: Thu, 20 Oct 2016 16:56:38 +0800
+Subject: [PATCH 2/2] soc: mediatek: Add MT2701 scpsys driver
+
+Add scpsys driver for MT2701.
+
+mtk-scpsys now supports MT8173 (arm64) and MT2701 (arm). So it should
+be enabled on both arm64 and arm platforms.
+
+Signed-off-by: Shunli Wang <shunli.wang at mediatek.com>
+Signed-off-by: James Liao <jamesjj.liao at mediatek.com>
+Reviewed-by: Kevin Hilman <khilman at baylibre.com>
+Signed-off-by: Matthias Brugger <matthias.bgg at gmail.com>
+---
+ drivers/soc/mediatek/Kconfig      |   2 +-
+ drivers/soc/mediatek/mtk-scpsys.c | 117 +++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 117 insertions(+), 2 deletions(-)
+
+Index: linux-4.9.14/drivers/soc/mediatek/Kconfig
+===================================================================
+--- linux-4.9.14.orig/drivers/soc/mediatek/Kconfig
++++ linux-4.9.14/drivers/soc/mediatek/Kconfig
+@@ -23,7 +23,7 @@ config MTK_PMIC_WRAP
+ config MTK_SCPSYS
+ 	bool "MediaTek SCPSYS Support"
+ 	depends on ARCH_MEDIATEK || COMPILE_TEST
+-	default ARM64 && ARCH_MEDIATEK
++	default ARCH_MEDIATEK
+ 	select REGMAP
+ 	select MTK_INFRACFG
+ 	select PM_GENERIC_DOMAINS if PM
+Index: linux-4.9.14/drivers/soc/mediatek/mtk-scpsys.c
+===================================================================
+--- linux-4.9.14.orig/drivers/soc/mediatek/mtk-scpsys.c
++++ linux-4.9.14/drivers/soc/mediatek/mtk-scpsys.c
+@@ -20,6 +20,7 @@
+ #include <linux/regulator/consumer.h>
+ #include <linux/soc/mediatek/infracfg.h>
+ 
++#include <dt-bindings/power/mt2701-power.h>
+ #include <dt-bindings/power/mt8173-power.h>
+ 
+ #define SPM_VDE_PWR_CON			0x0210
+@@ -27,8 +28,13 @@
+ #define SPM_VEN_PWR_CON			0x0230
+ #define SPM_ISP_PWR_CON			0x0238
+ #define SPM_DIS_PWR_CON			0x023c
++#define SPM_CONN_PWR_CON		0x0280
+ #define SPM_VEN2_PWR_CON		0x0298
+-#define SPM_AUDIO_PWR_CON		0x029c
++#define SPM_AUDIO_PWR_CON		0x029c	/* MT8173 */
++#define SPM_BDP_PWR_CON			0x029c	/* MT2701 */
++#define SPM_ETH_PWR_CON			0x02a0
++#define SPM_HIF_PWR_CON			0x02a4
++#define SPM_IFR_MSC_PWR_CON		0x02a8
+ #define SPM_MFG_2D_PWR_CON		0x02c0
+ #define SPM_MFG_ASYNC_PWR_CON		0x02c4
+ #define SPM_USB_PWR_CON			0x02cc
+@@ -42,10 +48,15 @@
+ #define PWR_ON_2ND_BIT			BIT(3)
+ #define PWR_CLK_DIS_BIT			BIT(4)
+ 
++#define PWR_STATUS_CONN			BIT(1)
+ #define PWR_STATUS_DISP			BIT(3)
+ #define PWR_STATUS_MFG			BIT(4)
+ #define PWR_STATUS_ISP			BIT(5)
+ #define PWR_STATUS_VDEC			BIT(7)
++#define PWR_STATUS_BDP			BIT(14)
++#define PWR_STATUS_ETH			BIT(15)
++#define PWR_STATUS_HIF			BIT(16)
++#define PWR_STATUS_IFR_MSC		BIT(17)
+ #define PWR_STATUS_VENC_LT		BIT(20)
+ #define PWR_STATUS_VENC			BIT(21)
+ #define PWR_STATUS_MFG_2D		BIT(22)
+@@ -59,6 +70,7 @@ enum clk_id {
+ 	CLK_MFG,
+ 	CLK_VENC,
+ 	CLK_VENC_LT,
++	CLK_ETHIF,
+ 	CLK_MAX,
+ };
+ 
+@@ -68,6 +80,7 @@ static const char * const clk_names[] =
+ 	"mfg",
+ 	"venc",
+ 	"venc_lt",
++	"ethif",
+ 	NULL,
+ };
+ 
+@@ -455,6 +468,96 @@ static void mtk_register_power_domains(s
+ }
+ 
+ /*
++ * MT2701 power domain support
++ */
++
++static const struct scp_domain_data scp_domain_data_mt2701[] = {
++	[MT2701_POWER_DOMAIN_CONN] = {
++		.name = "conn",
++		.sta_mask = PWR_STATUS_CONN,
++		.ctl_offs = SPM_CONN_PWR_CON,
++		.bus_prot_mask = 0x0104,
++		.clk_id = {CLK_NONE},
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_DISP] = {
++		.name = "disp",
++		.sta_mask = PWR_STATUS_DISP,
++		.ctl_offs = SPM_DIS_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.clk_id = {CLK_MM},
++		.bus_prot_mask = 0x0002,
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_VDEC] = {
++		.name = "vdec",
++		.sta_mask = PWR_STATUS_VDEC,
++		.ctl_offs = SPM_VDE_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(12, 12),
++		.clk_id = {CLK_MM},
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_ISP] = {
++		.name = "isp",
++		.sta_mask = PWR_STATUS_ISP,
++		.ctl_offs = SPM_ISP_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(13, 12),
++		.clk_id = {CLK_MM},
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_BDP] = {
++		.name = "bdp",
++		.sta_mask = PWR_STATUS_BDP,
++		.ctl_offs = SPM_BDP_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.clk_id = {CLK_NONE},
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_ETH] = {
++		.name = "eth",
++		.sta_mask = PWR_STATUS_ETH,
++		.ctl_offs = SPM_ETH_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(15, 12),
++		.clk_id = {CLK_ETHIF},
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_HIF] = {
++		.name = "hif",
++		.sta_mask = PWR_STATUS_HIF,
++		.ctl_offs = SPM_HIF_PWR_CON,
++		.sram_pdn_bits = GENMASK(11, 8),
++		.sram_pdn_ack_bits = GENMASK(15, 12),
++		.clk_id = {CLK_ETHIF},
++		.active_wakeup = true,
++	},
++	[MT2701_POWER_DOMAIN_IFR_MSC] = {
++		.name = "ifr_msc",
++		.sta_mask = PWR_STATUS_IFR_MSC,
++		.ctl_offs = SPM_IFR_MSC_PWR_CON,
++		.clk_id = {CLK_NONE},
++		.active_wakeup = true,
++	},
++};
++
++#define NUM_DOMAINS_MT2701	ARRAY_SIZE(scp_domain_data_mt2701)
++
++static int __init scpsys_probe_mt2701(struct platform_device *pdev)
++{
++	struct scp *scp;
++
++	scp = init_scp(pdev, scp_domain_data_mt2701, NUM_DOMAINS_MT2701);
++	if (IS_ERR(scp))
++		return PTR_ERR(scp);
++
++	mtk_register_power_domains(pdev, scp, NUM_DOMAINS_MT2701);
++
++	return 0;
++}
++
++/*
+  * MT8173 power domain support
+  */
+ 
+@@ -583,6 +686,9 @@ static int __init scpsys_probe_mt8173(st
+ 
+ static const struct of_device_id of_scpsys_match_tbl[] = {
+ 	{
++		.compatible = "mediatek,mt2701-scpsys",
++		.data = scpsys_probe_mt2701,
++	}, {
+ 		.compatible = "mediatek,mt8173-scpsys",
+ 		.data = scpsys_probe_mt8173,
+ 	}, {
diff --git a/target/linux/mediatek/patches-4.9/0071-pwm-add-pwm-mediatek.patch b/target/linux/mediatek/patches-4.9/0071-pwm-add-pwm-mediatek.patch
index 24437cf..cf604f4 100644
--- a/target/linux/mediatek/patches-4.9/0071-pwm-add-pwm-mediatek.patch
+++ b/target/linux/mediatek/patches-4.9/0071-pwm-add-pwm-mediatek.patch
@@ -13,36 +13,10 @@ Signed-off-by: John Crispin <john at phrozen.org>
  5 files changed, 279 insertions(+)
  create mode 100644 drivers/pwm/pwm-mediatek.c
 
---- a/arch/arm/boot/dts/mt7623-evb.dts
-+++ b/arch/arm/boot/dts/mt7623-evb.dts
-@@ -26,8 +26,25 @@
- 	memory {
- 		reg = <0 0x80000000 0 0x40000000>;
- 	};
-+/*
-+	pwm_pins: pwm {
-+		pins_pwm1 {
-+			pinmux = <MT7623_PIN_204_PWM1_FUNC_PWM1>;
-+		};
-+
-+		pins_pwm2 {
-+			pinmux = <MT7623_PIN_205_PWM2_FUNC_PWM2>;
-+		};
-+	};*/
-+
- };
- 
- &uart2 {
- 	status = "okay";
- };
-+
-+/*&pwm {
-+	pinctrl-names = "default";
-+	pinctrl-0 = <&pwm_pins>;
-+	status = "okay";
-+};*/
---- a/drivers/pwm/Kconfig
-+++ b/drivers/pwm/Kconfig
+Index: linux-4.9.17/drivers/pwm/Kconfig
+===================================================================
+--- linux-4.9.17.orig/drivers/pwm/Kconfig
++++ linux-4.9.17/drivers/pwm/Kconfig
 @@ -282,6 +282,15 @@ config PWM_MTK_DISP
  	  To compile this driver as a module, choose M here: the module
  	  will be called pwm-mtk-disp.
@@ -59,8 +33,10 @@ Signed-off-by: John Crispin <john at phrozen.org>
  config PWM_MXS
  	tristate "Freescale MXS PWM support"
  	depends on ARCH_MXS && OF
---- a/drivers/pwm/Makefile
-+++ b/drivers/pwm/Makefile
+Index: linux-4.9.17/drivers/pwm/Makefile
+===================================================================
+--- linux-4.9.17.orig/drivers/pwm/Makefile
++++ linux-4.9.17/drivers/pwm/Makefile
 @@ -25,6 +25,7 @@ obj-$(CONFIG_PWM_LPSS)		+= pwm-lpss.o
  obj-$(CONFIG_PWM_LPSS_PCI)	+= pwm-lpss-pci.o
  obj-$(CONFIG_PWM_LPSS_PLATFORM)	+= pwm-lpss-platform.o
@@ -69,8 +45,10 @@ Signed-off-by: John Crispin <john at phrozen.org>
  obj-$(CONFIG_PWM_MTK_DISP)	+= pwm-mtk-disp.o
  obj-$(CONFIG_PWM_MXS)		+= pwm-mxs.o
  obj-$(CONFIG_PWM_OMAP_DMTIMER)	+= pwm-omap-dmtimer.o
+Index: linux-4.9.17/drivers/pwm/pwm-mediatek.c
+===================================================================
 --- /dev/null
-+++ b/drivers/pwm/pwm-mediatek.c
++++ linux-4.9.17/drivers/pwm/pwm-mediatek.c
 @@ -0,0 +1,230 @@
 +/*
 + * Mediatek Pulse Width Modulator driver
diff --git a/target/linux/mediatek/patches-4.9/0083-mfd-led3.patch b/target/linux/mediatek/patches-4.9/0083-mfd-led3.patch
new file mode 100644
index 0000000..a72da69
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0083-mfd-led3.patch
@@ -0,0 +1,43 @@
+From patchwork Fri Feb 24 18:47:21 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v4,4/4] mfd: mt6397: Add MT6323 LED support into MT6397 driver
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9591021
+Message-Id: <1487962041-6548-5-git-send-email-sean.wang at mediatek.com>
+To: <rpurdie at rpsys.net>, <jacek.anaszewski at gmail.com>, <lee.jones at linaro.org>, 
+ <matthias.bgg at gmail.com>, <pavel at ucw.cz>, <robh+dt at kernel.org>,
+ <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, keyhaede at gmail.com,
+ Sean Wang <sean.wang at mediatek.com>, linux-kernel at vger.kernel.org,
+ linux-mediatek at lists.infradead.org, linux-leds at vger.kernel.org,
+ linux-arm-kernel at lists.infradead.org
+Date: Sat, 25 Feb 2017 02:47:21 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+Add compatible string as "mt6323-led" that will make
+the OF core spawn child devices for the LED subnode
+of that MT6323 MFD device.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+---
+ drivers/mfd/mt6397-core.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
+index e14d8b0..8e601c8 100644
+--- a/drivers/mfd/mt6397-core.c
++++ b/drivers/mfd/mt6397-core.c
+@@ -48,6 +48,10 @@
+ 		.name = "mt6323-regulator",
+ 		.of_compatible = "mediatek,mt6323-regulator"
+ 	},
++	{
++		.name = "mt6323-led",
++		.of_compatible = "mediatek,mt6323-led"
++	},
+ };
+ 
+ static const struct mfd_cell mt6397_devs[] = {
diff --git a/target/linux/mediatek/patches-4.9/0085-pmic-led0.patch b/target/linux/mediatek/patches-4.9/0085-pmic-led0.patch
new file mode 100644
index 0000000..96662dd
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0085-pmic-led0.patch
@@ -0,0 +1,94 @@
+From patchwork Mon Mar 20 06:47:24 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v6,1/4] dt-bindings: leds: Add document bindings for leds-mt6323
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9633073
+Message-Id: <1489992447-13007-2-git-send-email-sean.wang at mediatek.com>
+To: <rpurdie at rpsys.net>, <jacek.anaszewski at gmail.com>, <lee.jones at linaro.org>, 
+ <matthias.bgg at gmail.com>, <pavel at ucw.cz>, <robh+dt at kernel.org>,
+ <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, keyhaede at gmail.com,
+ Sean Wang <sean.wang at mediatek.com>, linux-kernel at vger.kernel.org,
+ linux-mediatek at lists.infradead.org, linux-leds at vger.kernel.org,
+ linux-arm-kernel at lists.infradead.org
+Date: Mon, 20 Mar 2017 14:47:24 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+This patch adds documentation for devicetree bindings for LED support on
+MT6323 PMIC.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+---
+ .../devicetree/bindings/leds/leds-mt6323.txt       | 60 ++++++++++++++++++++++
+ 1 file changed, 60 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt
+
+diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
+new file mode 100644
+index 0000000..ac38472
+--- /dev/null
++++ b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
+@@ -0,0 +1,60 @@
++Device Tree Bindings for LED support on MT6323 PMIC
++
++MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
++controllers are defined as the subnode of the function node provided by MT6323
++PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
++using shared bus called PMIC wrapper for each subfunction to access remote
++MT6323 PMIC hardware.
++
++For MT6323 MFD bindings see:
++Documentation/devicetree/bindings/mfd/mt6397.txt
++For MediaTek PMIC wrapper bindings see:
++Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
++
++Required properties:
++- compatible : Must be "mediatek,mt6323-led"
++- address-cells : Must be 1
++- size-cells : Must be 0
++
++Each led is represented as a child node of the mediatek,mt6323-led that
++describes the initial behavior for each LED physically and currently only four
++LED child nodes can be supported.
++
++Required properties for the LED child node:
++- reg : LED channel number (0..3)
++
++Optional properties for the LED child node:
++- label : See Documentation/devicetree/bindings/leds/common.txt
++- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
++- default-state: See Documentation/devicetree/bindings/leds/common.txt
++
++Example:
++
++	mt6323: pmic {
++		compatible = "mediatek,mt6323";
++
++		...
++
++		mt6323led: leds {
++			compatible = "mediatek,mt6323-led";
++			#address-cells = <1>;
++			#size-cells = <0>;
++
++			led at 0 {
++				reg = <0>;
++				label = "LED0";
++				linux,default-trigger = "timer";
++				default-state = "on";
++			};
++			led at 1 {
++				reg = <1>;
++				label = "LED1";
++				default-state = "off";
++			};
++			led at 2 {
++				reg = <2>;
++				label = "LED2";
++				default-state = "on";
++			};
++		};
++	};
diff --git a/target/linux/mediatek/patches-4.9/0086-pmic-led1.patch b/target/linux/mediatek/patches-4.9/0086-pmic-led1.patch
new file mode 100644
index 0000000..215b1b0
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0086-pmic-led1.patch
@@ -0,0 +1,40 @@
+From patchwork Mon Mar 20 06:47:25 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v6,
+ 2/4] dt-bindings: mfd: Add the description for LED as the sub module
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9633089
+Message-Id: <1489992447-13007-3-git-send-email-sean.wang at mediatek.com>
+To: <rpurdie at rpsys.net>, <jacek.anaszewski at gmail.com>, <lee.jones at linaro.org>, 
+ <matthias.bgg at gmail.com>, <pavel at ucw.cz>, <robh+dt at kernel.org>,
+ <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, keyhaede at gmail.com,
+ Sean Wang <sean.wang at mediatek.com>, linux-kernel at vger.kernel.org,
+ linux-mediatek at lists.infradead.org, linux-leds at vger.kernel.org,
+ linux-arm-kernel at lists.infradead.org
+Date: Mon, 20 Mar 2017 14:47:25 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+This patch adds description for LED as the sub-module on MT6397/MT6323
+multifunction device.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+---
+ Documentation/devicetree/bindings/mfd/mt6397.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
+index c568d52..522a3bb 100644
+--- a/Documentation/devicetree/bindings/mfd/mt6397.txt
++++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
+@@ -6,6 +6,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules:
+ - Audio codec
+ - GPIO
+ - Clock
++- LED
+ 
+ It is interfaced to host controller using SPI interface by a proprietary hardware
+ called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
diff --git a/target/linux/mediatek/patches-4.9/0087-pmic-led2.patch b/target/linux/mediatek/patches-4.9/0087-pmic-led2.patch
new file mode 100644
index 0000000..f3bc921
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0087-pmic-led2.patch
@@ -0,0 +1,558 @@
+From patchwork Mon Mar 20 06:47:26 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v6,3/4] leds: Add LED support for MT6323 PMIC
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9633081
+Message-Id: <1489992447-13007-4-git-send-email-sean.wang at mediatek.com>
+To: <rpurdie at rpsys.net>, <jacek.anaszewski at gmail.com>, <lee.jones at linaro.org>, 
+ <matthias.bgg at gmail.com>, <pavel at ucw.cz>, <robh+dt at kernel.org>,
+ <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, keyhaede at gmail.com,
+ Sean Wang <sean.wang at mediatek.com>, linux-kernel at vger.kernel.org,
+ linux-mediatek at lists.infradead.org, linux-leds at vger.kernel.org,
+ linux-arm-kernel at lists.infradead.org
+Date: Mon, 20 Mar 2017 14:47:26 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+MT6323 PMIC is a multi-function device that includes LED function.
+It allows attaching up to 4 LEDs which can either be on, off or dimmed
+and/or blinked with the controller.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Reviewed-by: Jacek Anaszewski <jacek.anaszewski at gmail.com>
+---
+ drivers/leds/Kconfig       |   8 +
+ drivers/leds/Makefile      |   1 +
+ drivers/leds/leds-mt6323.c | 502 +++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 511 insertions(+)
+ create mode 100644 drivers/leds/leds-mt6323.c
+
+Index: linux-4.9.17/drivers/leds/Kconfig
+===================================================================
+--- linux-4.9.17.orig/drivers/leds/Kconfig
++++ linux-4.9.17/drivers/leds/Kconfig
+@@ -117,6 +117,14 @@ config LEDS_MIKROTIK_RB532
+ 	  This option enables support for the so called "User LED" of
+ 	  Mikrotik's Routerboard 532.
+ 
++config LEDS_MT6323
++	tristate "LED Support for Mediatek MT6323 PMIC"
++	depends on LEDS_CLASS
++	depends on MFD_MT6397
++	help
++	  This option enables support for on-chip LED drivers found on
++	  Mediatek MT6323 PMIC.
++
+ config LEDS_S3C24XX
+ 	tristate "LED Support for Samsung S3C24XX GPIO LEDs"
+ 	depends on LEDS_CLASS
+Index: linux-4.9.17/drivers/leds/leds-mt6323.c
+===================================================================
+--- /dev/null
++++ linux-4.9.17/drivers/leds/leds-mt6323.c
+@@ -0,0 +1,502 @@
++/*
++ * LED driver for Mediatek MT6323 PMIC
++ *
++ * Copyright (C) 2017 Sean Wang <sean.wang at mediatek.com>
++ *
++ * 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; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ */
++#include <linux/kernel.h>
++#include <linux/leds.h>
++#include <linux/mfd/mt6323/registers.h>
++#include <linux/mfd/mt6397/core.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/platform_device.h>
++#include <linux/regmap.h>
++
++/*
++ * Register field for MT6323_TOP_CKPDN0 to enable
++ * 32K clock common for LED device.
++ */
++#define MT6323_RG_DRV_32K_CK_PDN	BIT(11)
++#define MT6323_RG_DRV_32K_CK_PDN_MASK	BIT(11)
++
++/*
++ * Register field for MT6323_TOP_CKPDN2 to enable
++ * individual clock for LED device.
++ */
++#define MT6323_RG_ISINK_CK_PDN(i)	BIT(i)
++#define MT6323_RG_ISINK_CK_PDN_MASK(i)	BIT(i)
++
++/*
++ * Register field for MT6323_TOP_CKCON1 to select
++ * clock source.
++ */
++#define MT6323_RG_ISINK_CK_SEL_MASK(i)	(BIT(10) << (i))
++
++/*
++ * Register for MT6323_ISINK_CON0 to setup the
++ * duty cycle of the blink.
++ */
++#define MT6323_ISINK_CON0(i)		(MT6323_ISINK0_CON0 + 0x8 * (i))
++#define MT6323_ISINK_DIM_DUTY_MASK	(0x1f << 8)
++#define MT6323_ISINK_DIM_DUTY(i)	(((i) << 8) & \
++					MT6323_ISINK_DIM_DUTY_MASK)
++
++/* Register to setup the period of the blink. */
++#define MT6323_ISINK_CON1(i)		(MT6323_ISINK0_CON1 + 0x8 * (i))
++#define MT6323_ISINK_DIM_FSEL_MASK	(0xffff)
++#define MT6323_ISINK_DIM_FSEL(i)	((i) & MT6323_ISINK_DIM_FSEL_MASK)
++
++/* Register to control the brightness. */
++#define MT6323_ISINK_CON2(i)		(MT6323_ISINK0_CON2 + 0x8 * (i))
++#define MT6323_ISINK_CH_STEP_SHIFT	12
++#define MT6323_ISINK_CH_STEP_MASK	(0x7 << 12)
++#define MT6323_ISINK_CH_STEP(i)		(((i) << 12) & \
++					MT6323_ISINK_CH_STEP_MASK)
++#define MT6323_ISINK_SFSTR0_TC_MASK	(0x3 << 1)
++#define MT6323_ISINK_SFSTR0_TC(i)	(((i) << 1) & \
++					MT6323_ISINK_SFSTR0_TC_MASK)
++#define MT6323_ISINK_SFSTR0_EN_MASK	BIT(0)
++#define MT6323_ISINK_SFSTR0_EN		BIT(0)
++
++/* Register to LED channel enablement. */
++#define MT6323_ISINK_CH_EN_MASK(i)	BIT(i)
++#define MT6323_ISINK_CH_EN(i)		BIT(i)
++
++#define MT6323_MAX_PERIOD		10000
++#define MT6323_MAX_LEDS			4
++#define MT6323_MAX_BRIGHTNESS		6
++#define MT6323_UNIT_DUTY		3125
++#define MT6323_CAL_HW_DUTY(o, p)	DIV_ROUND_CLOSEST((o) * 100000ul,\
++					(p) * MT6323_UNIT_DUTY)
++
++struct mt6323_leds;
++
++/**
++ * struct mt6323_led - state container for the LED device
++ * @id:			the identifier in MT6323 LED device
++ * @parent:		the pointer to MT6323 LED controller
++ * @cdev:		LED class device for this LED device
++ * @current_brightness: current state of the LED device
++ */
++struct mt6323_led {
++	int			id;
++	struct mt6323_leds	*parent;
++	struct led_classdev	cdev;
++	enum led_brightness	current_brightness;
++};
++
++/**
++ * struct mt6323_leds -	state container for holding LED controller
++ *			of the driver
++ * @dev:		the device pointer
++ * @hw:			the underlying hardware providing shared
++ *			bus for the register operations
++ * @lock:		the lock among process context
++ * @led:		the array that contains the state of individual
++ *			LED device
++ */
++struct mt6323_leds {
++	struct device		*dev;
++	struct mt6397_chip	*hw;
++	/* protect among process context */
++	struct mutex		lock;
++	struct mt6323_led	*led[MT6323_MAX_LEDS];
++};
++
++static int mt6323_led_hw_brightness(struct led_classdev *cdev,
++				    enum led_brightness brightness)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	struct mt6323_leds *leds = led->parent;
++	struct regmap *regmap = leds->hw->regmap;
++	u32 con2_mask = 0, con2_val = 0;
++	int ret;
++
++	/*
++	 * Setup current output for the corresponding
++	 * brightness level.
++	 */
++	con2_mask |= MT6323_ISINK_CH_STEP_MASK |
++		     MT6323_ISINK_SFSTR0_TC_MASK |
++		     MT6323_ISINK_SFSTR0_EN_MASK;
++	con2_val |=  MT6323_ISINK_CH_STEP(brightness - 1) |
++		     MT6323_ISINK_SFSTR0_TC(2) |
++		     MT6323_ISINK_SFSTR0_EN;
++
++	ret = regmap_update_bits(regmap, MT6323_ISINK_CON2(led->id),
++				 con2_mask, con2_val);
++	return ret;
++}
++
++static int mt6323_led_hw_off(struct led_classdev *cdev)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	struct mt6323_leds *leds = led->parent;
++	struct regmap *regmap = leds->hw->regmap;
++	unsigned int status;
++	int ret;
++
++	status = MT6323_ISINK_CH_EN(led->id);
++	ret = regmap_update_bits(regmap, MT6323_ISINK_EN_CTRL,
++				 MT6323_ISINK_CH_EN_MASK(led->id), ~status);
++	if (ret < 0)
++		return ret;
++
++	usleep_range(100, 300);
++	ret = regmap_update_bits(regmap, MT6323_TOP_CKPDN2,
++				 MT6323_RG_ISINK_CK_PDN_MASK(led->id),
++				 MT6323_RG_ISINK_CK_PDN(led->id));
++	if (ret < 0)
++		return ret;
++
++	return 0;
++}
++
++static enum led_brightness
++mt6323_get_led_hw_brightness(struct led_classdev *cdev)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	struct mt6323_leds *leds = led->parent;
++	struct regmap *regmap = leds->hw->regmap;
++	unsigned int status;
++	int ret;
++
++	ret = regmap_read(regmap, MT6323_TOP_CKPDN2, &status);
++	if (ret < 0)
++		return ret;
++
++	if (status & MT6323_RG_ISINK_CK_PDN_MASK(led->id))
++		return 0;
++
++	ret = regmap_read(regmap, MT6323_ISINK_EN_CTRL, &status);
++	if (ret < 0)
++		return ret;
++
++	if (!(status & MT6323_ISINK_CH_EN(led->id)))
++		return 0;
++
++	ret = regmap_read(regmap, MT6323_ISINK_CON2(led->id), &status);
++	if (ret < 0)
++		return ret;
++
++	return  ((status & MT6323_ISINK_CH_STEP_MASK)
++		  >> MT6323_ISINK_CH_STEP_SHIFT) + 1;
++}
++
++static int mt6323_led_hw_on(struct led_classdev *cdev,
++			    enum led_brightness brightness)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	struct mt6323_leds *leds = led->parent;
++	struct regmap *regmap = leds->hw->regmap;
++	unsigned int status;
++	int ret;
++
++	/*
++	 * Setup required clock source, enable the corresponding
++	 * clock and channel and let work with continuous blink as
++	 * the default.
++	 */
++	ret = regmap_update_bits(regmap, MT6323_TOP_CKCON1,
++				 MT6323_RG_ISINK_CK_SEL_MASK(led->id), 0);
++	if (ret < 0)
++		return ret;
++
++	status = MT6323_RG_ISINK_CK_PDN(led->id);
++	ret = regmap_update_bits(regmap, MT6323_TOP_CKPDN2,
++				 MT6323_RG_ISINK_CK_PDN_MASK(led->id),
++				 ~status);
++	if (ret < 0)
++		return ret;
++
++	usleep_range(100, 300);
++
++	ret = regmap_update_bits(regmap, MT6323_ISINK_EN_CTRL,
++				 MT6323_ISINK_CH_EN_MASK(led->id),
++				 MT6323_ISINK_CH_EN(led->id));
++	if (ret < 0)
++		return ret;
++
++	ret = mt6323_led_hw_brightness(cdev, brightness);
++	if (ret < 0)
++		return ret;
++
++	ret = regmap_update_bits(regmap, MT6323_ISINK_CON0(led->id),
++				 MT6323_ISINK_DIM_DUTY_MASK,
++				 MT6323_ISINK_DIM_DUTY(31));
++	if (ret < 0)
++		return ret;
++
++	ret = regmap_update_bits(regmap, MT6323_ISINK_CON1(led->id),
++				 MT6323_ISINK_DIM_FSEL_MASK,
++				 MT6323_ISINK_DIM_FSEL(1000));
++	if (ret < 0)
++		return ret;
++
++	return 0;
++}
++
++static int mt6323_led_set_blink(struct led_classdev *cdev,
++				unsigned long *delay_on,
++				unsigned long *delay_off)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	struct mt6323_leds *leds = led->parent;
++	struct regmap *regmap = leds->hw->regmap;
++	unsigned long period;
++	u8 duty_hw;
++	int ret;
++
++	/*
++	 * Units are in ms, if over the hardware able
++	 * to support, fallback into software blink
++	 */
++	period = *delay_on + *delay_off;
++
++	if (period > MT6323_MAX_PERIOD)
++		return -EINVAL;
++
++	/*
++	 * LED subsystem requires a default user
++	 * friendly blink pattern for the LED so using
++	 * 1Hz duty cycle 50% here if without specific
++	 * value delay_on and delay off being assigned.
++	 */
++	if (!*delay_on && !*delay_off) {
++		*delay_on = 500;
++		*delay_off = 500;
++	}
++
++	/*
++	 * Calculate duty_hw based on the percentage of period during
++	 * which the led is ON.
++	 */
++	duty_hw = MT6323_CAL_HW_DUTY(*delay_on, period);
++
++	/* hardware doesn't support zero duty cycle. */
++	if (!duty_hw)
++		return -EINVAL;
++
++	mutex_lock(&leds->lock);
++	/*
++	 * Set max_brightness as the software blink behavior
++	 * when no blink brightness.
++	 */
++	if (!led->current_brightness) {
++		ret = mt6323_led_hw_on(cdev, cdev->max_brightness);
++		if (ret < 0)
++			goto out;
++		led->current_brightness = cdev->max_brightness;
++	}
++
++	ret = regmap_update_bits(regmap, MT6323_ISINK_CON0(led->id),
++				 MT6323_ISINK_DIM_DUTY_MASK,
++				 MT6323_ISINK_DIM_DUTY(duty_hw - 1));
++	if (ret < 0)
++		goto out;
++
++	ret = regmap_update_bits(regmap, MT6323_ISINK_CON1(led->id),
++				 MT6323_ISINK_DIM_FSEL_MASK,
++				 MT6323_ISINK_DIM_FSEL(period - 1));
++out:
++	mutex_unlock(&leds->lock);
++
++	return ret;
++}
++
++static int mt6323_led_set_brightness(struct led_classdev *cdev,
++				     enum led_brightness brightness)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	struct mt6323_leds *leds = led->parent;
++	int ret;
++
++	mutex_lock(&leds->lock);
++
++	if (!led->current_brightness && brightness) {
++		ret = mt6323_led_hw_on(cdev, brightness);
++		if (ret < 0)
++			goto out;
++	} else if (brightness) {
++		ret = mt6323_led_hw_brightness(cdev, brightness);
++		if (ret < 0)
++			goto out;
++	} else {
++		ret = mt6323_led_hw_off(cdev);
++		if (ret < 0)
++			goto out;
++	}
++
++	led->current_brightness = brightness;
++out:
++	mutex_unlock(&leds->lock);
++
++	return ret;
++}
++
++static int mt6323_led_set_dt_default(struct led_classdev *cdev,
++				     struct device_node *np)
++{
++	struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
++	const char *state;
++	int ret = 0;
++
++	led->cdev.name = of_get_property(np, "label", NULL) ? : np->name;
++	led->cdev.default_trigger = of_get_property(np,
++						    "linux,default-trigger",
++						    NULL);
++
++	state = of_get_property(np, "default-state", NULL);
++	if (state) {
++		if (!strcmp(state, "keep")) {
++			ret = mt6323_get_led_hw_brightness(cdev);
++			if (ret < 0)
++				return ret;
++			led->current_brightness = ret;
++			ret = 0;
++		} else if (!strcmp(state, "on")) {
++			ret =
++			mt6323_led_set_brightness(cdev, cdev->max_brightness);
++		} else  {
++			ret = mt6323_led_set_brightness(cdev, LED_OFF);
++		}
++	}
++
++	return ret;
++}
++
++static int mt6323_led_probe(struct platform_device *pdev)
++{
++	struct device *dev = &pdev->dev;
++	struct device_node *np = pdev->dev.of_node;
++	struct device_node *child;
++	struct mt6397_chip *hw = dev_get_drvdata(pdev->dev.parent);
++	struct mt6323_leds *leds;
++	struct mt6323_led *led;
++	int ret;
++	unsigned int status;
++	u32 reg;
++
++	leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL);
++	if (!leds)
++		return -ENOMEM;
++
++	platform_set_drvdata(pdev, leds);
++	leds->dev = dev;
++
++	/*
++	 * leds->hw points to the underlying bus for the register
++	 * controlled.
++	 */
++	leds->hw = hw;
++	mutex_init(&leds->lock);
++
++	status = MT6323_RG_DRV_32K_CK_PDN;
++	ret = regmap_update_bits(leds->hw->regmap, MT6323_TOP_CKPDN0,
++				 MT6323_RG_DRV_32K_CK_PDN_MASK, ~status);
++	if (ret < 0) {
++		dev_err(leds->dev,
++			"Failed to update MT6323_TOP_CKPDN0 Register\n");
++		return ret;
++	}
++
++	for_each_available_child_of_node(np, child) {
++		ret = of_property_read_u32(child, "reg", &reg);
++		if (ret) {
++			dev_err(dev, "Failed to read led 'reg' property\n");
++			goto put_child_node;
++		}
++
++		if (reg < 0 || reg > MT6323_MAX_LEDS || leds->led[reg]) {
++			dev_err(dev, "Invalid led reg %u\n", reg);
++			ret = -EINVAL;
++			goto put_child_node;
++		}
++
++		led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
++		if (!led) {
++			ret = -ENOMEM;
++			goto put_child_node;
++		}
++
++		leds->led[reg] = led;
++		leds->led[reg]->id = reg;
++		leds->led[reg]->cdev.max_brightness = MT6323_MAX_BRIGHTNESS;
++		leds->led[reg]->cdev.brightness_set_blocking =
++					mt6323_led_set_brightness;
++		leds->led[reg]->cdev.blink_set = mt6323_led_set_blink;
++		leds->led[reg]->cdev.brightness_get =
++					mt6323_get_led_hw_brightness;
++		leds->led[reg]->parent = leds;
++
++		ret = mt6323_led_set_dt_default(&leds->led[reg]->cdev, child);
++		if (ret < 0) {
++			dev_err(leds->dev,
++				"Failed to LED set default from devicetree\n");
++			goto put_child_node;
++		}
++
++		ret = devm_led_classdev_register(dev, &leds->led[reg]->cdev);
++		if (ret) {
++			dev_err(&pdev->dev, "Failed to register LED: %d\n",
++				ret);
++			goto put_child_node;
++		}
++		leds->led[reg]->cdev.dev->of_node = child;
++	}
++
++	return 0;
++
++put_child_node:
++	of_node_put(child);
++	return ret;
++}
++
++static int mt6323_led_remove(struct platform_device *pdev)
++{
++	struct mt6323_leds *leds = platform_get_drvdata(pdev);
++	int i;
++
++	/* Turn the LEDs off on driver removal. */
++	for (i = 0 ; leds->led[i] ; i++)
++		mt6323_led_hw_off(&leds->led[i]->cdev);
++
++	regmap_update_bits(leds->hw->regmap, MT6323_TOP_CKPDN0,
++			   MT6323_RG_DRV_32K_CK_PDN_MASK,
++			   MT6323_RG_DRV_32K_CK_PDN);
++
++	mutex_destroy(&leds->lock);
++
++	return 0;
++}
++
++static const struct of_device_id mt6323_led_dt_match[] = {
++	{ .compatible = "mediatek,mt6323-led" },
++	{},
++};
++MODULE_DEVICE_TABLE(of, mt6323_led_dt_match);
++
++static struct platform_driver mt6323_led_driver = {
++	.probe		= mt6323_led_probe,
++	.remove		= mt6323_led_remove,
++	.driver		= {
++		.name	= "mt6323-led",
++		.of_match_table = mt6323_led_dt_match,
++	},
++};
++
++module_platform_driver(mt6323_led_driver);
++
++MODULE_DESCRIPTION("LED driver for Mediatek MT6323 PMIC");
++MODULE_AUTHOR("Sean Wang <sean.wang at mediatek.com>");
++MODULE_LICENSE("GPL");
diff --git a/target/linux/mediatek/patches-4.9/0088-pmic-led3.patch b/target/linux/mediatek/patches-4.9/0088-pmic-led3.patch
new file mode 100644
index 0000000..701dcec
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0088-pmic-led3.patch
@@ -0,0 +1,44 @@
+From patchwork Mon Mar 20 06:47:27 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v6,
+ 4/4] mfd: mt6397: Align the placement at which the mfd_cell of LED is
+ defined
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9633079
+Message-Id: <1489992447-13007-5-git-send-email-sean.wang at mediatek.com>
+To: <rpurdie at rpsys.net>, <jacek.anaszewski at gmail.com>, <lee.jones at linaro.org>, 
+ <matthias.bgg at gmail.com>, <pavel at ucw.cz>, <robh+dt at kernel.org>,
+ <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, keyhaede at gmail.com,
+ Sean Wang <sean.wang at mediatek.com>, linux-kernel at vger.kernel.org,
+ linux-mediatek at lists.infradead.org, linux-leds at vger.kernel.org,
+ linux-arm-kernel at lists.infradead.org
+Date: Mon, 20 Mar 2017 14:47:27 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+Align the placement as which the mfd_cell of LED is defined as the other
+members done on the structure.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Acked-by: Lee Jones <lee.jones at linaro.org>
+---
+ drivers/mfd/mt6397-core.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
+index 8e601c8..04a601f 100644
+--- a/drivers/mfd/mt6397-core.c
++++ b/drivers/mfd/mt6397-core.c
+@@ -47,8 +47,7 @@
+ 	{
+ 		.name = "mt6323-regulator",
+ 		.of_compatible = "mediatek,mt6323-regulator"
+-	},
+-	{
++	}, {
+ 		.name = "mt6323-led",
+ 		.of_compatible = "mediatek,mt6323-led"
+ 	},
diff --git a/target/linux/mediatek/patches-4.9/0091-dsa1.patch b/target/linux/mediatek/patches-4.9/0091-dsa1.patch
new file mode 100644
index 0000000..c9bad93
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0091-dsa1.patch
@@ -0,0 +1,127 @@
+From patchwork Wed Mar 29 09:38:19 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [net-next,v3,1/5] dt-bindings: net: dsa: add Mediatek MT7530 binding
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9651093
+Message-Id: <1490780303-18598-2-git-send-email-sean.wang at mediatek.com>
+To: <andrew at lunn.ch>, <f.fainelli at gmail.com>,
+ <vivien.didelot at savoirfairelinux.com>, <matthias.bgg at gmail.com>,
+ <robh+dt at kernel.org>, <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, Landen.Chao at mediatek.com, keyhaede at gmail.com, 
+ netdev at vger.kernel.org, sean.wang at mediatek.com,
+ linux-kernel at vger.kernel.org, 
+ linux-mediatek at lists.infradead.org, objelf at gmail.com, davem at davemloft.net
+Date: Wed, 29 Mar 2017 17:38:19 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+Add device-tree binding for Mediatek MT7530 switch.
+
+Cc: devicetree at vger.kernel.org
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Acked-by: Rob Herring <robh at kernel.org>
+---
+ .../devicetree/bindings/net/dsa/mt7530.txt         | 92 ++++++++++++++++++++++
+ 1 file changed, 92 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/net/dsa/mt7530.txt
+
+diff --git a/Documentation/devicetree/bindings/net/dsa/mt7530.txt b/Documentation/devicetree/bindings/net/dsa/mt7530.txt
+new file mode 100644
+index 0000000..a9bc27b
+--- /dev/null
++++ b/Documentation/devicetree/bindings/net/dsa/mt7530.txt
+@@ -0,0 +1,92 @@
++Mediatek MT7530 Ethernet switch
++================================
++
++Required properties:
++
++- compatible: Must be compatible = "mediatek,mt7530";
++- #address-cells: Must be 1.
++- #size-cells: Must be 0.
++- mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part
++	on multi-chip module belong to MT7623A has or the remotely standalone
++	chip as the function MT7623N reference board provided for.
++- core-supply: Phandle to the regulator node necessary for the core power.
++- io-supply: Phandle to the regulator node necessary for the I/O power.
++	See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt
++	for details for the regulator setup on these boards.
++
++If the property mediatek,mcm isn't defined, following property is required
++
++- reset-gpios: Should be a gpio specifier for a reset line.
++
++Else, following properties are required
++
++- resets : Phandle pointing to the system reset controller with
++	line index for the ethsys.
++- reset-names : Should be set to "mcm".
++
++Required properties for the child nodes within ports container:
++
++- reg: Port address described must be 6 for CPU port and from 0 to 5 for
++	user ports.
++- phy-mode: String, must be either "trgmii" or "rgmii" for port labeled
++	 "cpu".
++
++See Documentation/devicetree/bindings/dsa/dsa.txt for a list of additional
++required, optional properties and how the integrated switch subnodes must
++be specified.
++
++Example:
++
++	&mdio0 {
++		switch at 0 {
++			compatible = "mediatek,mt7530";
++			#address-cells = <1>;
++			#size-cells = <0>;
++			reg = <0>;
++
++			core-supply = <&mt6323_vpa_reg>;
++			io-supply = <&mt6323_vemc3v3_reg>;
++			reset-gpios = <&pio 33 0>;
++
++			ports {
++				#address-cells = <1>;
++				#size-cells = <0>;
++				reg = <0>;
++				port at 0 {
++					reg = <0>;
++					label = "lan0";
++				};
++
++				port at 1 {
++					reg = <1>;
++					label = "lan1";
++				};
++
++				port at 2 {
++					reg = <2>;
++					label = "lan2";
++				};
++
++				port at 3 {
++					reg = <3>;
++					label = "lan3";
++				};
++
++				port at 4 {
++					reg = <4>;
++					label = "wan";
++				};
++
++				port at 6 {
++					reg = <6>;
++					label = "cpu";
++					ethernet = <&gmac0>;
++					phy-mode = "trgmii";
++					fixed-link {
++						speed = <1000>;
++						full-duplex;
++					};
++				};
++			};
++		};
++	};
diff --git a/target/linux/mediatek/patches-4.9/0091-net-next-mediatek-fix-DQL-support.patch b/target/linux/mediatek/patches-4.9/0091-net-next-mediatek-fix-DQL-support.patch
new file mode 100644
index 0000000..5ae90e3
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0091-net-next-mediatek-fix-DQL-support.patch
@@ -0,0 +1,95 @@
+From 81cdbda2a08375b9d5915567d2210bf2433e7332 Mon Sep 17 00:00:00 2001
+From: John Crispin <john at phrozen.org>
+Date: Sat, 23 Apr 2016 11:57:21 +0200
+Subject: [PATCH 081/102] net-next: mediatek: fix DQL support
+
+The MTK ethernet core has 2 MACs both sitting on the same DMA ring. The
+current code will assign the TX traffic of each MAC to its own DQL. This
+results in the amount of data, that DQL says is in the queue incorrect. As
+the data from multiple devices is infact enqueued. This makes any decision
+based on these value non deterministic. Fix this by tracking all TX
+traffic, regardless of the MAC it belongs to in the DQL of all devices
+using the DMA.
+
+Signed-off-by: John Crispin <john at phrozen.org>
+---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c |   33 ++++++++++++++++-----------
+ 1 file changed, 20 insertions(+), 13 deletions(-)
+
+Index: linux-4.9.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+===================================================================
+--- linux-4.9.14.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ linux-4.9.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -706,7 +706,16 @@ static int mtk_tx_map(struct sk_buff *sk
+ 	WRITE_ONCE(itxd->txd3, (TX_DMA_SWC | TX_DMA_PLEN0(skb_headlen(skb)) |
+ 				(!nr_frags * TX_DMA_LS0)));
+ 
+-	netdev_sent_queue(dev, skb->len);
++	/* we have a single DMA ring so BQL needs to be updated for all devices
++	 * sitting on this ring
++	 */
++	for (i = 0; i < MTK_MAC_COUNT; i++) {
++		if (!eth->netdev[i])
++			continue;
++
++		netdev_sent_queue(eth->netdev[i], skb->len);
++	}
++
+ 	skb_tx_timestamp(skb);
+ 
+ 	ring->next_free = mtk_qdma_phys_to_virt(ring, txd->txd2);
+@@ -998,21 +1007,18 @@ static int mtk_poll_tx(struct mtk_eth *e
+ 	struct mtk_tx_dma *desc;
+ 	struct sk_buff *skb;
+ 	struct mtk_tx_buf *tx_buf;
+-	unsigned int done[MTK_MAX_DEVS];
+-	unsigned int bytes[MTK_MAX_DEVS];
++	int total = 0, done = 0;
++	unsigned int bytes = 0;
+ 	u32 cpu, dma;
+ 	static int condition;
+-	int total = 0, i;
+-
+-	memset(done, 0, sizeof(done));
+-	memset(bytes, 0, sizeof(bytes));
++	int i;
+ 
+ 	cpu = mtk_r32(eth, MTK_QTX_CRX_PTR);
+ 	dma = mtk_r32(eth, MTK_QTX_DRX_PTR);
+ 
+ 	desc = mtk_qdma_phys_to_virt(ring, cpu);
+ 
+-	while ((cpu != dma) && budget) {
++	while ((cpu != dma) && done < budget) {
+ 		u32 next_cpu = desc->txd2;
+ 		int mac;
+ 
+@@ -1032,9 +1038,8 @@ static int mtk_poll_tx(struct mtk_eth *e
+ 		}
+ 
+ 		if (skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC) {
+-			bytes[mac] += skb->len;
+-			done[mac]++;
+-			budget--;
++			bytes += skb->len;
++			done++;
+ 		}
+ 		mtk_tx_unmap(eth, tx_buf);
+ 
+@@ -1046,11 +1051,13 @@ static int mtk_poll_tx(struct mtk_eth *e
+ 
+ 	mtk_w32(eth, cpu, MTK_QTX_CRX_PTR);
+ 
++	/* we have a single DMA ring so BQL needs to be updated for all devices
++	 * sitting on this ring
++	 */
+ 	for (i = 0; i < MTK_MAC_COUNT; i++) {
+-		if (!eth->netdev[i] || !done[i])
++		if (!eth->netdev[i])
+ 			continue;
+-		netdev_completed_queue(eth->netdev[i], done[i], bytes[i]);
+-		total += done[i];
++		netdev_completed_queue(eth->netdev[i], done, bytes);
+ 	}
+ 
+ 	if (mtk_queue_stopped(eth) &&
diff --git a/target/linux/mediatek/patches-4.9/0092-dsa2.patch b/target/linux/mediatek/patches-4.9/0092-dsa2.patch
new file mode 100644
index 0000000..84e5cb4
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0092-dsa2.patch
@@ -0,0 +1,219 @@
+From patchwork Wed Mar 29 09:38:20 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [net-next,v3,2/5] net-next: dsa: add Mediatek tag RX/TX handler
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9651099
+Message-Id: <1490780303-18598-3-git-send-email-sean.wang at mediatek.com>
+To: <andrew at lunn.ch>, <f.fainelli at gmail.com>,
+ <vivien.didelot at savoirfairelinux.com>, <matthias.bgg at gmail.com>,
+ <robh+dt at kernel.org>, <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, Landen.Chao at mediatek.com, keyhaede at gmail.com, 
+ netdev at vger.kernel.org, sean.wang at mediatek.com,
+ linux-kernel at vger.kernel.org, 
+ linux-mediatek at lists.infradead.org, objelf at gmail.com, davem at davemloft.net
+Date: Wed, 29 Mar 2017 17:38:20 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+Add the support for the 4-bytes tag for DSA port distinguishing inserted
+allowing receiving and transmitting the packet via the particular port.
+The tag is being added after the source MAC address in the ethernet
+header.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Signed-off-by: Landen Chao <Landen.Chao at mediatek.com>
+Reviewed-by: Andrew Lunn <andrew at lunn.ch>
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ include/net/dsa.h  |   1 +
+ net/dsa/Kconfig    |   2 +
+ net/dsa/Makefile   |   1 +
+ net/dsa/dsa.c      |   3 ++
+ net/dsa/dsa_priv.h |   3 ++
+ net/dsa/tag_mtk.c  | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 6 files changed, 127 insertions(+)
+ create mode 100644 net/dsa/tag_mtk.c
+
+diff --git a/include/net/dsa.h b/include/net/dsa.h
+index 4e13e69..3276547 100644
+--- a/include/net/dsa.h
++++ b/include/net/dsa.h
+@@ -31,6 +31,7 @@ enum dsa_tag_protocol {
+ 	DSA_TAG_PROTO_EDSA,
+ 	DSA_TAG_PROTO_BRCM,
+ 	DSA_TAG_PROTO_QCA,
++	DSA_TAG_PROTO_MTK,
+ 	DSA_TAG_LAST,		/* MUST BE LAST */
+ };
+ 
+diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
+index 9649238..d78789b 100644
+--- a/net/dsa/Kconfig
++++ b/net/dsa/Kconfig
+@@ -31,4 +31,6 @@ config NET_DSA_TAG_TRAILER
+ config NET_DSA_TAG_QCA
+ 	bool
+ 
++config NET_DSA_TAG_MTK
++	bool
+ endif
+diff --git a/net/dsa/Makefile b/net/dsa/Makefile
+index 31d3437..9b1d478 100644
+--- a/net/dsa/Makefile
++++ b/net/dsa/Makefile
+@@ -8,3 +8,4 @@ dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
+ dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
+ dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
+ dsa_core-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
++dsa_core-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
+diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
+index b6d4f6a..617f736 100644
+--- a/net/dsa/dsa.c
++++ b/net/dsa/dsa.c
+@@ -53,6 +53,9 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
+ #ifdef CONFIG_NET_DSA_TAG_QCA
+ 	[DSA_TAG_PROTO_QCA] = &qca_netdev_ops,
+ #endif
++#ifdef CONFIG_NET_DSA_TAG_MTK
++	[DSA_TAG_PROTO_MTK] = &mtk_netdev_ops,
++#endif
+ 	[DSA_TAG_PROTO_NONE] = &none_ops,
+ };
+ 
+diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
+index 0706a51..2a31399 100644
+--- a/net/dsa/dsa_priv.h
++++ b/net/dsa/dsa_priv.h
+@@ -85,4 +85,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
+ /* tag_qca.c */
+ extern const struct dsa_device_ops qca_netdev_ops;
+ 
++/* tag_mtk.c */
++extern const struct dsa_device_ops mtk_netdev_ops;
++
+ #endif
+diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
+new file mode 100644
+index 0000000..833a9d6
+--- /dev/null
++++ b/net/dsa/tag_mtk.c
+@@ -0,0 +1,117 @@
++/*
++ * Mediatek DSA Tag support
++ * Copyright (C) 2017 Landen Chao <landen.chao at mediatek.com>
++ *		      Sean Wang <sean.wang at mediatek.com>
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 and
++ * only version 2 as published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ */
++
++#include <linux/etherdevice.h>
++#include "dsa_priv.h"
++
++#define MTK_HDR_LEN		4
++#define MTK_HDR_RECV_SOURCE_PORT_MASK	GENMASK(2, 0)
++#define MTK_HDR_XMIT_DP_BIT_MASK	GENMASK(5, 0)
++
++static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
++				    struct net_device *dev)
++{
++	struct dsa_slave_priv *p = netdev_priv(dev);
++	u8 *mtk_tag;
++
++	if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
++		goto out_free;
++
++	skb_push(skb, MTK_HDR_LEN);
++
++	memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
++
++	/* Build the tag after the MAC Source Address */
++	mtk_tag = skb->data + 2 * ETH_ALEN;
++	mtk_tag[0] = 0;
++	mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
++	mtk_tag[2] = 0;
++	mtk_tag[3] = 0;
++
++	return skb;
++
++out_free:
++	kfree_skb(skb);
++	return NULL;
++}
++
++static int mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
++		       struct packet_type *pt, struct net_device *orig_dev)
++{
++	struct dsa_switch_tree *dst = dev->dsa_ptr;
++	struct dsa_switch *ds;
++	int port;
++	__be16 *phdr, hdr;
++
++	if (unlikely(!dst))
++		goto out_drop;
++
++	skb = skb_unshare(skb, GFP_ATOMIC);
++	if (!skb)
++		goto out;
++
++	if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
++		goto out_drop;
++
++	/* The MTK header is added by the switch between src addr
++	 * and ethertype at this point, skb->data points to 2 bytes
++	 * after src addr so header should be 2 bytes right before.
++	 */
++	phdr = (__be16 *)(skb->data - 2);
++	hdr = ntohs(*phdr);
++
++	/* Remove MTK tag and recalculate checksum. */
++	skb_pull_rcsum(skb, MTK_HDR_LEN);
++
++	memmove(skb->data - ETH_HLEN,
++		skb->data - ETH_HLEN - MTK_HDR_LEN,
++		2 * ETH_ALEN);
++
++	/* This protocol doesn't support cascading multiple
++	 * switches so it's safe to assume the switch is first
++	 * in the tree.
++	 */
++	ds = dst->ds[0];
++	if (!ds)
++		goto out_drop;
++
++	/* Get source port information */
++	port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);
++	if (!ds->ports[port].netdev)
++		goto out_drop;
++
++	/* Update skb & forward the frame accordingly */
++	skb_push(skb, ETH_HLEN);
++
++	skb->pkt_type = PACKET_HOST;
++	skb->dev = ds->ports[port].netdev;
++	skb->protocol = eth_type_trans(skb, skb->dev);
++
++	skb->dev->stats.rx_packets++;
++	skb->dev->stats.rx_bytes += skb->len;
++
++	netif_receive_skb(skb);
++
++	return 0;
++
++out_drop:
++	kfree_skb(skb);
++out:
++	return 0;
++}
++
++const struct dsa_device_ops mtk_netdev_ops = {
++	.xmit	= mtk_tag_xmit,
++	.rcv	= mtk_tag_rcv,
++};
diff --git a/target/linux/mediatek/patches-4.9/0092-dsa3.patch b/target/linux/mediatek/patches-4.9/0092-dsa3.patch
new file mode 100644
index 0000000..7c4dc4f
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0092-dsa3.patch
@@ -0,0 +1,67 @@
+From patchwork Wed Mar 29 09:38:21 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [net-next, v3,
+ 3/5] net-next: ethernet: mediatek: add CDM able to recognize the tag
+ for DSA
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9651091
+Message-Id: <1490780303-18598-4-git-send-email-sean.wang at mediatek.com>
+To: <andrew at lunn.ch>, <f.fainelli at gmail.com>,
+ <vivien.didelot at savoirfairelinux.com>, <matthias.bgg at gmail.com>,
+ <robh+dt at kernel.org>, <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, Landen.Chao at mediatek.com, keyhaede at gmail.com, 
+ netdev at vger.kernel.org, sean.wang at mediatek.com,
+ linux-kernel at vger.kernel.org, 
+ linux-mediatek at lists.infradead.org, objelf at gmail.com, davem at davemloft.net
+Date: Wed, 29 Mar 2017 17:38:21 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+The patch adds the setup for allowing CDM can recognize these packets with
+carrying port-distinguishing tag. Otherwise, these tagging packets will be
+handled incorrectly by CDM. The setup is also working out for general
+untag packets as well.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Signed-off-by: Landen Chao <Landen.Chao at mediatek.com>
+Reviewed-by: Andrew Lunn <andrew at lunn.ch>
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++++
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+index 9e75768..c21ed99 100644
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -1846,6 +1846,12 @@ static int mtk_hw_init(struct mtk_eth *eth)
+ 	/* GE2, Force 1000M/FD, FC ON */
+ 	mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(1));
+ 
++	/* Indicates CDM to parse the MTK special tag from CPU
++	 * which also is working out for untag packets.
++	 */
++	val = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
++	mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
++
+ 	/* Enable RX VLan Offloading */
+ 	mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
+ 
+diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+index 99b1c8e..996024d 100644
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+@@ -70,6 +70,10 @@
+ /* Frame Engine Interrupt Grouping Register */
+ #define MTK_FE_INT_GRP		0x20
+ 
++/* CDMP Ingress Control Register */
++#define MTK_CDMQ_IG_CTRL	0x1400
++#define MTK_CDMQ_STAG_EN	BIT(0)
++
+ /* CDMP Exgress Control Register */
+ #define MTK_CDMP_EG_CTRL	0x404
+ 
diff --git a/target/linux/mediatek/patches-4.9/0092-dsa4.patch b/target/linux/mediatek/patches-4.9/0092-dsa4.patch
new file mode 100644
index 0000000..d67b4a9
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0092-dsa4.patch
@@ -0,0 +1,46 @@
+From patchwork Wed Mar 29 09:38:22 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [net-next, v3,
+ 4/5] net-next: ethernet: mediatek: add device_node of GMAC pointing
+ into the netdev instance
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9651097
+Message-Id: <1490780303-18598-5-git-send-email-sean.wang at mediatek.com>
+To: <andrew at lunn.ch>, <f.fainelli at gmail.com>,
+ <vivien.didelot at savoirfairelinux.com>, <matthias.bgg at gmail.com>,
+ <robh+dt at kernel.org>, <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, Landen.Chao at mediatek.com, keyhaede at gmail.com, 
+ netdev at vger.kernel.org, sean.wang at mediatek.com,
+ linux-kernel at vger.kernel.org, 
+ linux-mediatek at lists.infradead.org, objelf at gmail.com, davem at davemloft.net
+Date: Wed, 29 Mar 2017 17:38:22 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+the patch adds the setup of the corresponding device node of GMAC into the
+netdev instance which could allow other modules such as DSA to find the
+instance through the node in dt-bindings using of_find_net_device_by_node()
+call.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Reviewed-by: Andrew Lunn <andrew at lunn.ch>
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+index c21ed99..84b09a4 100644
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -2323,6 +2323,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
+ 	eth->netdev[id]->ethtool_ops = &mtk_ethtool_ops;
+ 
+ 	eth->netdev[id]->irq = eth->irq[0];
++	eth->netdev[id]->dev.of_node = np;
++
+ 	return 0;
+ 
+ free_netdev:
diff --git a/target/linux/mediatek/patches-4.9/0092-dsa5.patch b/target/linux/mediatek/patches-4.9/0092-dsa5.patch
new file mode 100644
index 0000000..6c10137
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0092-dsa5.patch
@@ -0,0 +1,1608 @@
+From patchwork Wed Mar 29 09:38:23 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [net-next, v3,
+ 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch
+From: sean.wang at mediatek.com
+X-Patchwork-Id: 9651095
+Message-Id: <1490780303-18598-6-git-send-email-sean.wang at mediatek.com>
+To: <andrew at lunn.ch>, <f.fainelli at gmail.com>,
+ <vivien.didelot at savoirfairelinux.com>, <matthias.bgg at gmail.com>,
+ <robh+dt at kernel.org>, <mark.rutland at arm.com>
+Cc: devicetree at vger.kernel.org, Landen.Chao at mediatek.com, keyhaede at gmail.com, 
+ netdev at vger.kernel.org, sean.wang at mediatek.com,
+ linux-kernel at vger.kernel.org, 
+ linux-mediatek at lists.infradead.org, objelf at gmail.com, davem at davemloft.net
+Date: Wed, 29 Mar 2017 17:38:23 +0800
+
+From: Sean Wang <sean.wang at mediatek.com>
+
+MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on
+Mediatek router platforms such as MT7623A or MT7623N platform which
+includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY.
+Among these ports, The port from 0 to 4 are the user ports connecting
+with the remote devices while the port 5 and 6 are the CPU ports
+connecting into Mediatek Ethernet GMAC.
+
+For port 6, it can communicate with the CPU via Mediatek Ethernet GMAC
+through either the TRGMII or RGMII which could be controlled by phy-mode
+in the dt-bindings to specify which mode is preferred to use. And for
+port 5, only RGMII can be specified. However, currently, only port 6 is
+being supported in this DSA driver.
+
+The driver is made with the reference to qca8k and other existing DSA
+driver. The most of the essential callbacks of the DSA are already
+support in the driver, including tag insert for user port distinguishing,
+port control, bridge offloading, STP setup and ethtool operation to allow
+DSA to model each user port into a standalone netdevice as the other DSA
+driver had done.
+
+Signed-off-by: Sean Wang <sean.wang at mediatek.com>
+Signed-off-by: Landen Chao <Landen.Chao at mediatek.com>
+---
+ drivers/net/dsa/Kconfig  |    8 +
+ drivers/net/dsa/Makefile |    2 +-
+ drivers/net/dsa/mt7530.c | 1126 ++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/net/dsa/mt7530.h |  390 ++++++++++++++++
+ 4 files changed, 1525 insertions(+), 1 deletion(-)
+ create mode 100644 drivers/net/dsa/mt7530.c
+ create mode 100644 drivers/net/dsa/mt7530.h
+
+diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
+index 0659846..5b322b4 100644
+--- a/drivers/net/dsa/Kconfig
++++ b/drivers/net/dsa/Kconfig
+@@ -34,4 +34,12 @@ config NET_DSA_QCA8K
+ 	  This enables support for the Qualcomm Atheros QCA8K Ethernet
+ 	  switch chips.
+ 
++config NET_DSA_MT7530
++	tristate "Mediatek MT7530 Ethernet switch support"
++	depends on NET_DSA
++	select NET_DSA_TAG_MTK
++	---help---
++	  This enables support for the Mediatek MT7530 Ethernet switch
++	  chip.
++
+ endmenu
+diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile
+index a3c9416..8e629c1 100644
+--- a/drivers/net/dsa/Makefile
++++ b/drivers/net/dsa/Makefile
+@@ -2,6 +2,6 @@ obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
+ obj-$(CONFIG_NET_DSA_BCM_SF2)	+= bcm-sf2.o
+ bcm-sf2-objs			:= bcm_sf2.o bcm_sf2_cfp.o
+ obj-$(CONFIG_NET_DSA_QCA8K)	+= qca8k.o
+-
++obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o
+ obj-y				+= b53/
+ obj-y				+= mv88e6xxx/
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+new file mode 100644
+index 0000000..ad2e6f8
+--- /dev/null
++++ b/drivers/net/dsa/mt7530.c
+@@ -0,0 +1,1126 @@
++/*
++ * Mediatek MT7530 DSA Switch driver
++ * Copyright (C) 2017 Sean Wang <sean.wang at mediatek.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ */
++#include <linux/etherdevice.h>
++#include <linux/if_bridge.h>
++#include <linux/iopoll.h>
++#include <linux/mdio.h>
++#include <linux/mfd/syscon.h>
++#include <linux/module.h>
++#include <linux/netdevice.h>
++#include <linux/of_gpio.h>
++#include <linux/of_mdio.h>
++#include <linux/of_net.h>
++#include <linux/of_platform.h>
++#include <linux/phy.h>
++#include <linux/regmap.h>
++#include <linux/regulator/consumer.h>
++#include <linux/reset.h>
++#include <net/dsa.h>
++#include <net/switchdev.h>
++
++#include "mt7530.h"
++
++/* String, offset, and register size in bytes if different from 4 bytes */
++static const struct mt7530_mib_desc mt7530_mib[] = {
++	MIB_DESC(1, 0x00, "TxDrop"),
++	MIB_DESC(1, 0x04, "TxCrcErr"),
++	MIB_DESC(1, 0x08, "TxUnicast"),
++	MIB_DESC(1, 0x0c, "TxMulticast"),
++	MIB_DESC(1, 0x10, "TxBroadcast"),
++	MIB_DESC(1, 0x14, "TxCollision"),
++	MIB_DESC(1, 0x18, "TxSingleCollision"),
++	MIB_DESC(1, 0x1c, "TxMultipleCollision"),
++	MIB_DESC(1, 0x20, "TxDeferred"),
++	MIB_DESC(1, 0x24, "TxLateCollision"),
++	MIB_DESC(1, 0x28, "TxExcessiveCollistion"),
++	MIB_DESC(1, 0x2c, "TxPause"),
++	MIB_DESC(1, 0x30, "TxPktSz64"),
++	MIB_DESC(1, 0x34, "TxPktSz65To127"),
++	MIB_DESC(1, 0x38, "TxPktSz128To255"),
++	MIB_DESC(1, 0x3c, "TxPktSz256To511"),
++	MIB_DESC(1, 0x40, "TxPktSz512To1023"),
++	MIB_DESC(1, 0x44, "Tx1024ToMax"),
++	MIB_DESC(2, 0x48, "TxBytes"),
++	MIB_DESC(1, 0x60, "RxDrop"),
++	MIB_DESC(1, 0x64, "RxFiltering"),
++	MIB_DESC(1, 0x6c, "RxMulticast"),
++	MIB_DESC(1, 0x70, "RxBroadcast"),
++	MIB_DESC(1, 0x74, "RxAlignErr"),
++	MIB_DESC(1, 0x78, "RxCrcErr"),
++	MIB_DESC(1, 0x7c, "RxUnderSizeErr"),
++	MIB_DESC(1, 0x80, "RxFragErr"),
++	MIB_DESC(1, 0x84, "RxOverSzErr"),
++	MIB_DESC(1, 0x88, "RxJabberErr"),
++	MIB_DESC(1, 0x8c, "RxPause"),
++	MIB_DESC(1, 0x90, "RxPktSz64"),
++	MIB_DESC(1, 0x94, "RxPktSz65To127"),
++	MIB_DESC(1, 0x98, "RxPktSz128To255"),
++	MIB_DESC(1, 0x9c, "RxPktSz256To511"),
++	MIB_DESC(1, 0xa0, "RxPktSz512To1023"),
++	MIB_DESC(1, 0xa4, "RxPktSz1024ToMax"),
++	MIB_DESC(2, 0xa8, "RxBytes"),
++	MIB_DESC(1, 0xb0, "RxCtrlDrop"),
++	MIB_DESC(1, 0xb4, "RxIngressDrop"),
++	MIB_DESC(1, 0xb8, "RxArlDrop"),
++};
++
++static struct mt7530_priv *lpriv;
++static void mt7530_port_disable(struct dsa_switch *ds, int port,
++				struct phy_device *phy);
++static int mt7530_cpu_port_enable(struct mt7530_priv *priv,
++				  int port);
++
++static int
++mt7623_trgmii_write(struct mt7530_priv *priv,  u32 reg, u32 val)
++{
++	int ret;
++
++	ret =  regmap_write(priv->ethernet, TRGMII_BASE(reg), val);
++	if (ret < 0)
++		dev_err(priv->dev,
++			"failed to priv write register\n");
++	return ret;
++}
++
++static u32
++mt7623_trgmii_read(struct mt7530_priv *priv, u32 reg)
++{
++	int ret;
++	u32 val;
++
++	ret = regmap_read(priv->ethernet, TRGMII_BASE(reg), &val);
++	if (ret < 0) {
++		dev_err(priv->dev,
++			"failed to priv read register\n");
++		return ret;
++	}
++
++	return val;
++}
++
++static void
++mt7623_trgmii_rmw(struct mt7530_priv *priv, u32 reg,
++		  u32 mask, u32 set)
++{
++	u32 val;
++
++	val = mt7623_trgmii_read(priv, reg);
++	val &= ~mask;
++	val |= set;
++	mt7623_trgmii_write(priv, reg, val);
++}
++
++static void
++mt7623_trgmii_set(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	mt7623_trgmii_rmw(priv, reg, 0, val);
++}
++
++static void
++mt7623_trgmii_clear(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	mt7623_trgmii_rmw(priv, reg, val, 0);
++}
++
++static int
++core_read_mmd_indirect(struct mt7530_priv *priv, int prtad, int devad)
++{
++	struct mii_bus *bus = priv->bus;
++	int value, ret;
++
++	/* Write the desired MMD Devad */
++	ret = bus->write(bus, 0, MII_MMD_CTRL, devad);
++	if (ret < 0)
++		goto err;
++
++	/* Write the desired MMD register address */
++	ret = bus->write(bus, 0, MII_MMD_DATA, prtad);
++	if (ret < 0)
++		goto err;
++
++	/* Select the Function : DATA with no post increment */
++	ret = bus->write(bus, 0, MII_MMD_CTRL, (devad | MII_MMD_CTRL_NOINCR));
++	if (ret < 0)
++		goto err;
++
++	/* Read the content of the MMD's selected register */
++	value = bus->read(bus, 0, MII_MMD_DATA);
++
++	return value;
++err:
++	dev_err(&bus->dev,  "failed to read mmd register\n");
++
++	return ret;
++}
++
++static int
++core_write_mmd_indirect(struct mt7530_priv *priv, int prtad,
++			int devad, u32 data)
++{
++	struct mii_bus *bus = priv->bus;
++	int ret;
++
++	/* Write the desired MMD Devad */
++	ret = bus->write(bus, 0, MII_MMD_CTRL, devad);
++	if (ret < 0)
++		goto err;
++
++	/* Write the desired MMD register address */
++	ret = bus->write(bus, 0, MII_MMD_DATA, prtad);
++	if (ret < 0)
++		goto err;
++
++	/* Select the Function : DATA with no post increment */
++	ret = bus->write(bus, 0, MII_MMD_CTRL, (devad | MII_MMD_CTRL_NOINCR));
++	if (ret < 0)
++		goto err;
++
++	/* Write the data into MMD's selected register */
++	ret = bus->write(bus, 0, MII_MMD_DATA, data);
++err:
++	if (ret < 0)
++		dev_err(&bus->dev,
++			"failed to write mmd register\n");
++	return ret;
++}
++
++static void
++core_write(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	struct mii_bus *bus = priv->bus;
++
++	mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
++
++	core_write_mmd_indirect(priv, reg, MDIO_MMD_VEND2, val);
++
++	mutex_unlock(&bus->mdio_lock);
++}
++
++static void
++core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
++{
++	struct mii_bus *bus = priv->bus;
++	u32 val;
++
++	mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
++
++	val = core_read_mmd_indirect(priv, reg, MDIO_MMD_VEND2);
++	val &= ~mask;
++	val |= set;
++	core_write_mmd_indirect(priv, reg, MDIO_MMD_VEND2, val);
++
++	mutex_unlock(&bus->mdio_lock);
++}
++
++static void
++core_set(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	core_rmw(priv, reg, 0, val);
++}
++
++static void
++core_clear(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	core_rmw(priv, reg, val, 0);
++}
++
++static int
++mt7530_mii_write(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	struct mii_bus *bus = priv->bus;
++	u16 page, r, lo, hi;
++	int ret;
++
++	page = (reg >> 6) & 0x3ff;
++	r  = (reg >> 2) & 0xf;
++	lo = val & 0xffff;
++	hi = val >> 16;
++
++	/* MT7530 uses 31 as the pseudo port */
++	ret = bus->write(bus, 0x1f, 0x1f, page);
++	if (ret < 0)
++		goto err;
++
++	ret = bus->write(bus, 0x1f, r,  lo);
++	if (ret < 0)
++		goto err;
++
++	ret = bus->write(bus, 0x1f, 0x10, hi);
++err:
++	if (ret < 0)
++		dev_err(&bus->dev,
++			"failed to write mt7530 register\n");
++	return ret;
++}
++
++static u32
++mt7530_mii_read(struct mt7530_priv *priv, u32 reg)
++{
++	struct mii_bus *bus = priv->bus;
++	u16 page, r, lo, hi;
++	int ret;
++
++	page = (reg >> 6) & 0x3ff;
++	r = (reg >> 2) & 0xf;
++
++	/* MT7530 uses 31 as the pseudo port */
++	ret = bus->write(bus, 0x1f, 0x1f, page);
++	if (ret < 0) {
++		dev_err(&bus->dev,
++			"failed to read mt7530 register\n");
++		return ret;
++	}
++
++	lo = bus->read(bus, 0x1f, r);
++	hi = bus->read(bus, 0x1f, 0x10);
++
++	return (hi << 16) | (lo & 0xffff);
++}
++
++static void
++mt7530_write(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	struct mii_bus *bus = priv->bus;
++
++	mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
++
++	mt7530_mii_write(priv, reg, val);
++
++	mutex_unlock(&bus->mdio_lock);
++}
++
++static u32
++_mt7530_read(u32 reg)
++{
++	struct mt7530_priv	*priv = lpriv;
++	struct mii_bus		*bus = priv->bus;
++	u32 val;
++
++	mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
++
++	val = mt7530_mii_read(priv, reg);
++
++	mutex_unlock(&bus->mdio_lock);
++
++	return val;
++}
++
++static u32
++mt7530_read(struct mt7530_priv *priv, u32 reg)
++{
++	return _mt7530_read(reg);
++}
++
++static void
++mt7530_rmw(struct mt7530_priv *priv, u32 reg,
++	   u32 mask, u32 set)
++{
++	struct mii_bus *bus = priv->bus;
++	u32 val;
++
++	mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
++
++	val = mt7530_mii_read(priv, reg);
++	val &= ~mask;
++	val |= set;
++	mt7530_mii_write(priv, reg, val);
++
++	mutex_unlock(&bus->mdio_lock);
++}
++
++static void
++mt7530_set(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	mt7530_rmw(priv, reg, 0, val);
++}
++
++static void
++mt7530_clear(struct mt7530_priv *priv, u32 reg, u32 val)
++{
++	mt7530_rmw(priv, reg, val, 0);
++}
++
++static int
++mt7530_fdb_cmd(struct mt7530_priv *priv, enum mt7530_fdb_cmd cmd, u32 *rsp)
++{
++	u32 val;
++	int ret;
++
++	/* Set the command operating upon the MAC address entries */
++	val = ATC_BUSY | ATC_MAT(0) | cmd;
++	mt7530_write(priv, MT7530_ATC, val);
++
++	ret = readx_poll_timeout(_mt7530_read, MT7530_ATC, val,
++				 !(val & ATC_BUSY), 20, 20000);
++	if (ret < 0) {
++		dev_err(priv->dev, "reset timeout\n");
++		return ret;
++	}
++
++	/* Additional sanity for read command if the specified
++	 * entry is invalid
++	 */
++	val = mt7530_read(priv, MT7530_ATC);
++	if ((cmd == MT7530_FDB_READ) && (val & ATC_INVALID))
++		return -EINVAL;
++
++	if (rsp)
++		*rsp = val;
++
++	return 0;
++}
++
++static void
++mt7530_fdb_read(struct mt7530_priv *priv, struct mt7530_fdb *fdb)
++{
++	u32 reg[3];
++	int i;
++
++	/* Read from ARL table into an array */
++	for (i = 0; i < 3; i++) {
++		reg[i] = mt7530_read(priv, MT7530_TSRA1 + (i * 4));
++
++		dev_dbg(priv->dev, "%s(%d) reg[%d]=0x%x\n",
++			__func__, __LINE__, i, reg[i]);
++	}
++
++	fdb->vid = (reg[1] >> CVID) & CVID_MASK;
++	fdb->aging = (reg[2] >> AGE_TIMER) & AGE_TIMER_MASK;
++	fdb->port_mask = (reg[2] >> PORT_MAP) & PORT_MAP_MASK;
++	fdb->mac[0] = (reg[0] >> MAC_BYTE_0) & MAC_BYTE_MASK;
++	fdb->mac[1] = (reg[0] >> MAC_BYTE_1) & MAC_BYTE_MASK;
++	fdb->mac[2] = (reg[0] >> MAC_BYTE_2) & MAC_BYTE_MASK;
++	fdb->mac[3] = (reg[0] >> MAC_BYTE_3) & MAC_BYTE_MASK;
++	fdb->mac[4] = (reg[1] >> MAC_BYTE_4) & MAC_BYTE_MASK;
++	fdb->mac[5] = (reg[1] >> MAC_BYTE_5) & MAC_BYTE_MASK;
++	fdb->noarp = ((reg[2] >> ENT_STATUS) & ENT_STATUS_MASK) == STATIC_ENT;
++}
++
++static void
++mt7530_fdb_write(struct mt7530_priv *priv, u16 vid,
++		 u8 port_mask, const u8 *mac,
++		 u8 aging, u8 type)
++{
++	u32 reg[3] = { 0 };
++	int i;
++
++	reg[1] |= vid & CVID_MASK;
++	reg[2] |= (aging & AGE_TIMER_MASK) << AGE_TIMER;
++	reg[2] |= (port_mask & PORT_MAP_MASK) << PORT_MAP;
++	/* STATIC_ENT indicate that entry is static wouldn't
++	 * be aged out and STATIC_EMP specified as erasing an
++	 * entry
++	 */
++	reg[2] |= (type & ENT_STATUS_MASK) << ENT_STATUS;
++	reg[1] |= mac[5] << MAC_BYTE_5;
++	reg[1] |= mac[4] << MAC_BYTE_4;
++	reg[0] |= mac[3] << MAC_BYTE_3;
++	reg[0] |= mac[2] << MAC_BYTE_2;
++	reg[0] |= mac[1] << MAC_BYTE_1;
++	reg[0] |= mac[0] << MAC_BYTE_0;
++
++	/* Write array into the ARL table */
++	for (i = 0; i < 3; i++)
++		mt7530_write(priv, MT7530_ATA1 + (i * 4), reg[i]);
++}
++
++static int
++mt7530_pad_clk_setup(struct dsa_switch *ds, int mode)
++{
++	struct mt7530_priv *priv = ds->priv;
++	u32 ncpo1, ssc_delta, trgint, i;
++
++	switch (mode) {
++	case PHY_INTERFACE_MODE_RGMII:
++		trgint = 0;
++		ncpo1 = 0x0c80;
++		ssc_delta = 0x87;
++		break;
++	case PHY_INTERFACE_MODE_TRGMII:
++		trgint = 1;
++		ncpo1 = 0x1400;
++		ssc_delta = 0x57;
++		break;
++	default:
++		dev_err(priv->dev, "xMII mode %d not supported\n", mode);
++		return -EINVAL;
++	}
++
++	mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK,
++		   P6_INTF_MODE(trgint));
++
++	/* Lower Tx Driving for TRGMII path */
++	for (i = 0 ; i < NUM_TRGMII_CTRL ; i++)
++		mt7530_write(priv, MT7530_TRGMII_TD_ODT(i),
++			     TD_DM_DRVP(8) | TD_DM_DRVN(8));
++
++	/* Setup core clock for MT7530 */
++	if (!trgint) {
++		/* Disable MT7530 core clock */
++		core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
++
++		/* Disable PLL, since phy_device has not yet been created
++		 * provided for phy_[read,write]_mmd_indirect is called, we
++		 * provide our own core_write_mmd_indirect to complete this
++		 * function.
++		 */
++		core_write_mmd_indirect(priv,
++					CORE_GSWPLL_GRP1,
++					MDIO_MMD_VEND2,
++					0);
++
++		/* Set core clock into 500Mhz */
++		core_write(priv, CORE_GSWPLL_GRP2,
++			   RG_GSWPLL_POSDIV_500M(1) |
++			   RG_GSWPLL_FBKDIV_500M(25));
++
++		/* Enable PLL */
++		core_write(priv, CORE_GSWPLL_GRP1,
++			   RG_GSWPLL_EN_PRE |
++			   RG_GSWPLL_POSDIV_200M(2) |
++			   RG_GSWPLL_FBKDIV_200M(32));
++
++		/* Enable MT7530 core clock */
++		core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
++	}
++
++	/* Setup the MT7530 TRGMII Tx Clock */
++	core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
++	core_write(priv, CORE_PLL_GROUP5, RG_LCDDS_PCW_NCPO1(ncpo1));
++	core_write(priv, CORE_PLL_GROUP6, RG_LCDDS_PCW_NCPO0(0));
++	core_write(priv, CORE_PLL_GROUP10, RG_LCDDS_SSC_DELTA(ssc_delta));
++	core_write(priv, CORE_PLL_GROUP11, RG_LCDDS_SSC_DELTA1(ssc_delta));
++	core_write(priv, CORE_PLL_GROUP4,
++		   RG_SYSPLL_DDSFBK_EN | RG_SYSPLL_BIAS_EN |
++		   RG_SYSPLL_BIAS_LPF_EN);
++	core_write(priv, CORE_PLL_GROUP2,
++		   RG_SYSPLL_EN_NORMAL | RG_SYSPLL_VODEN |
++		   RG_SYSPLL_POSDIV(1));
++	core_write(priv, CORE_PLL_GROUP7,
++		   RG_LCDDS_PCW_NCPO_CHG | RG_LCCDS_C(3) |
++		   RG_LCDDS_PWDB | RG_LCDDS_ISO_EN);
++	core_set(priv, CORE_TRGMII_GSW_CLK_CG,
++		 REG_GSWCK_EN | REG_TRGMIICK_EN);
++
++	if (!trgint)
++		for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
++			mt7530_rmw(priv, MT7530_TRGMII_RD(i),
++				   RD_TAP_MASK, RD_TAP(16));
++	else
++		mt7623_trgmii_set(priv, GSW_INTF_MODE, INTF_MODE_TRGMII);
++
++	return 0;
++}
++
++static int
++mt7623_pad_clk_setup(struct dsa_switch *ds)
++{
++	struct mt7530_priv *priv = ds->priv;
++	int i;
++
++	for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
++		mt7623_trgmii_write(priv, GSW_TRGMII_TD_ODT(i),
++				    TD_DM_DRVP(8) | TD_DM_DRVN(8));
++
++	mt7623_trgmii_set(priv, GSW_TRGMII_RCK_CTRL, RX_RST | RXC_DQSISEL);
++	mt7623_trgmii_clear(priv, GSW_TRGMII_RCK_CTRL, RX_RST);
++
++	return 0;
++}
++
++static void
++mt7530_mib_reset(struct dsa_switch *ds)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	mt7530_write(priv, MT7530_MIB_CCR, CCR_MIB_FLUSH);
++	mt7530_write(priv, MT7530_MIB_CCR, CCR_MIB_ACTIVATE);
++}
++
++static void
++mt7530_port_set_status(struct mt7530_priv *priv, int port, int enable)
++{
++	u32 mask = PMCR_TX_EN | PMCR_RX_EN;
++
++	if (enable)
++		mt7530_set(priv, MT7530_PMCR_P(port), mask);
++	else
++		mt7530_clear(priv, MT7530_PMCR_P(port), mask);
++}
++
++static int
++mt7530_setup(struct dsa_switch *ds)
++{
++	struct mt7530_priv *priv = ds->priv;
++	int ret, i;
++	u32 id, val;
++	struct device_node *dn;
++
++	/* The parent node of master_netdev which holds the common system
++	 * controller also is the container for two GMACs nodes representing
++	 * as two netdev instances.
++	 */
++	dn = ds->master_netdev->dev.of_node->parent;
++	priv->ethernet = syscon_node_to_regmap(dn);
++	if (IS_ERR(priv->ethernet))
++		return PTR_ERR(priv->ethernet);
++
++	regulator_set_voltage(priv->core_pwr, 1000000, 1000000);
++	ret = regulator_enable(priv->core_pwr);
++	if (ret < 0) {
++		dev_err(priv->dev,
++			"Failed to enable core power: %d\n", ret);
++		return ret;
++	}
++
++	regulator_set_voltage(priv->io_pwr, 3300000, 3300000);
++	ret = regulator_enable(priv->io_pwr);
++	if (ret < 0) {
++		dev_err(priv->dev, "Failed to enable io pwr: %d\n",
++			ret);
++		return ret;
++	}
++
++	/* Reset whole chip through gpio pin or memory-mapped registers for
++	 * different type of hardware
++	 */
++	if (priv->mcm) {
++		reset_control_assert(priv->rstc);
++		usleep_range(1000, 1100);
++		reset_control_deassert(priv->rstc);
++	} else {
++		gpiod_set_value_cansleep(priv->reset, 0);
++		usleep_range(1000, 1100);
++		gpiod_set_value_cansleep(priv->reset, 1);
++	}
++
++	/* Waiting for MT7530 got to stable */
++	ret = readx_poll_timeout(_mt7530_read, MT7530_HWTRAP, val, val != 0,
++				 20, 1000000);
++	if (ret < 0) {
++		dev_err(priv->dev, "reset timeout\n");
++		return ret;
++	}
++
++	id = mt7530_read(priv, MT7530_CREV);
++	id >>= CHIP_NAME_SHIFT;
++	if (id != MT7530_ID) {
++		dev_err(priv->dev, "chip %x can't be supported\n", id);
++		return -ENODEV;
++	}
++
++	/* Reset the switch through internal reset */
++	mt7530_write(priv, MT7530_SYS_CTRL,
++		     SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
++		     SYS_CTRL_REG_RST);
++
++	/* Enable Port 6 only; P5 as GMAC5 which currently is not supported */
++	val = mt7530_read(priv, MT7530_MHWTRAP);
++	val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
++	val |= MHWTRAP_MANUAL;
++	mt7530_write(priv, MT7530_MHWTRAP, val);
++
++	/* Enable and reset MIB counters */
++	mt7530_mib_reset(ds);
++
++	mt7530_clear(priv, MT7530_MFC, UNU_FFP_MASK);
++
++	for (i = 0; i < MT7530_NUM_PORTS; i++) {
++		/* Disable forwarding by default on all ports */
++		mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
++			   PCR_MATRIX_CLR);
++
++		if (dsa_is_cpu_port(ds, i))
++			mt7530_cpu_port_enable(priv, i);
++		else
++			mt7530_port_disable(ds, i, NULL);
++	}
++
++	/* Flush the FDB table */
++	ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, 0);
++	if (ret < 0)
++		return ret;
++
++	return 0;
++}
++
++static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	return mdiobus_read_nested(priv->bus, port, regnum);
++}
++
++int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	return mdiobus_write_nested(priv->bus, port, regnum, val);
++}
++
++static void
++mt7530_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
++{
++	int i;
++
++	for (i = 0; i < ARRAY_SIZE(mt7530_mib); i++)
++		strncpy(data + i * ETH_GSTRING_LEN, mt7530_mib[i].name,
++			ETH_GSTRING_LEN);
++}
++
++static void
++mt7530_get_ethtool_stats(struct dsa_switch *ds, int port,
++			 uint64_t *data)
++{
++	struct mt7530_priv *priv = ds->priv;
++	const struct mt7530_mib_desc *mib;
++	u32 reg, i;
++	u64 hi;
++
++	for (i = 0; i < ARRAY_SIZE(mt7530_mib); i++) {
++		mib = &mt7530_mib[i];
++		reg = MT7530_PORT_MIB_COUNTER(port) + mib->offset;
++
++		data[i] = mt7530_read(priv, reg);
++		if (mib->size == 2) {
++			hi = mt7530_read(priv, reg + 4);
++			data[i] |= hi << 32;
++		}
++	}
++}
++
++static int
++mt7530_get_sset_count(struct dsa_switch *ds)
++{
++	return ARRAY_SIZE(mt7530_mib);
++}
++
++static void mt7530_adjust_link(struct dsa_switch *ds, int port,
++			       struct phy_device *phydev)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	if (phy_is_pseudo_fixed_link(phydev)) {
++		dev_dbg(priv->dev, "phy-mode for master device = %x\n",
++			phydev->interface);
++
++		/* Setup TX circuit incluing relevant PAD and driving */
++		mt7530_pad_clk_setup(ds, phydev->interface);
++
++		/* Setup RX circuit, relevant PAD and driving on the host
++		 * which must be placed after the setup on the device side is
++		 * all finished.
++		 */
++		mt7623_pad_clk_setup(ds);
++	}
++}
++
++static int
++mt7530_cpu_port_enable(struct mt7530_priv *priv,
++		       int port)
++{
++	/* Enable Mediatek header mode on the cpu port */
++	mt7530_write(priv, MT7530_PVC_P(port),
++		     PORT_SPEC_TAG);
++
++	/* Setup the MAC by default for the cpu port */
++	mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPUP_LINK);
++
++	/* Disable auto learning on the cpu port */
++	mt7530_set(priv, MT7530_PSC_P(port), SA_DIS);
++
++	/* Unknown unicast frame fordwarding to the cpu port */
++	mt7530_set(priv, MT7530_MFC, UNU_FFP(BIT(port)));
++
++	/* CPU port gets connected to all user ports of
++	 * the switch
++	 */
++	mt7530_write(priv, MT7530_PCR_P(port),
++		     PCR_MATRIX(priv->ds->enabled_port_mask));
++
++	return 0;
++}
++
++static int
++mt7530_port_enable(struct dsa_switch *ds, int port,
++		   struct phy_device *phy)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	mutex_lock(&priv->reg_mutex);
++
++	/* Setup the MAC for the user port */
++	mt7530_write(priv, MT7530_PMCR_P(port), PMCR_USERP_LINK);
++
++	/* Allow the user port gets connected to the cpu port and also
++	 * restore the port matrix if the port is the member of a certain
++	 * bridge.
++	 */
++	priv->ports[port].pm |= PCR_MATRIX(BIT(MT7530_CPU_PORT));
++	priv->ports[port].enable = true;
++	mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
++		   priv->ports[port].pm);
++	mt7530_port_set_status(priv, port, 1);
++
++	mutex_unlock(&priv->reg_mutex);
++
++	return 0;
++}
++
++static void
++mt7530_port_disable(struct dsa_switch *ds, int port,
++		    struct phy_device *phy)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	mutex_lock(&priv->reg_mutex);
++
++	/* Clear up all port matrix which could be restored in the next
++	 * enablement for the port.
++	 */
++	priv->ports[port].enable = false;
++	mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
++		   PCR_MATRIX_CLR);
++	mt7530_port_set_status(priv, port, 0);
++
++	mutex_unlock(&priv->reg_mutex);
++}
++
++static void
++mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state)
++{
++	struct mt7530_priv *priv = ds->priv;
++	u32 stp_state;
++
++	switch (state) {
++	case BR_STATE_DISABLED:
++		stp_state = MT7530_STP_DISABLED;
++		break;
++	case BR_STATE_BLOCKING:
++		stp_state = MT7530_STP_BLOCKING;
++		break;
++	case BR_STATE_LISTENING:
++		stp_state = MT7530_STP_LISTENING;
++		break;
++	case BR_STATE_LEARNING:
++		stp_state = MT7530_STP_LEARNING;
++		break;
++	case BR_STATE_FORWARDING:
++	default:
++		stp_state = MT7530_STP_FORWARDING;
++		break;
++	}
++
++	mt7530_rmw(priv, MT7530_SSP_P(port), FID_PST_MASK, stp_state);
++}
++
++static int
++mt7530_port_bridge_join(struct dsa_switch *ds, int port,
++			struct net_device *bridge)
++{
++	struct mt7530_priv *priv = ds->priv;
++	u32 port_bitmap = BIT(MT7530_CPU_PORT);
++	int i;
++
++	mutex_lock(&priv->reg_mutex);
++
++	for (i = 0; i < MT7530_NUM_PORTS; i++) {
++		/* Add this port to the port matrix of the other ports in the
++		 * same bridge. If the port is disabled, port matrix is kept
++		 * and not being setup until the port becomes enabled.
++		 */
++		if (ds->enabled_port_mask & BIT(i) && i != port) {
++			if (ds->ports[i].bridge_dev != bridge)
++				continue;
++			if (priv->ports[i].enable)
++				mt7530_set(priv, MT7530_PCR_P(i),
++					   PCR_MATRIX(BIT(port)));
++			priv->ports[i].pm |= PCR_MATRIX(BIT(port));
++
++			port_bitmap |= BIT(i);
++		}
++	}
++
++	/* Add the all other ports to this port matrix. */
++	if (priv->ports[port].enable)
++		mt7530_rmw(priv, MT7530_PCR_P(port),
++			   PCR_MATRIX_MASK, PCR_MATRIX(port_bitmap));
++	priv->ports[port].pm |= PCR_MATRIX(port_bitmap);
++
++	mutex_unlock(&priv->reg_mutex);
++
++	return 0;
++}
++
++static void
++mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
++			 struct net_device *bridge)
++{
++	struct mt7530_priv *priv = ds->priv;
++	int i;
++
++	mutex_lock(&priv->reg_mutex);
++
++	for (i = 0; i < MT7530_NUM_PORTS; i++) {
++		/* Remove this port from the port matrix of the other ports
++		 * in the same bridge. If the port is disabled, port matrix
++		 * is kept and not being setup until the port becomes enabled.
++		 */
++		if (ds->enabled_port_mask & BIT(i) && i != port) {
++			if (ds->ports[i].bridge_dev != bridge)
++				continue;
++			if (priv->ports[i].enable)
++				mt7530_clear(priv, MT7530_PCR_P(i),
++					     PCR_MATRIX(BIT(port)));
++			priv->ports[i].pm &= ~PCR_MATRIX(BIT(port));
++		}
++	}
++
++	/* Set the cpu port to be the only one in the port matrix of
++	 * this port.
++	 */
++	if (priv->ports[port].enable)
++		mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
++			   PCR_MATRIX(BIT(MT7530_CPU_PORT)));
++	priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT));
++
++	mutex_unlock(&priv->reg_mutex);
++}
++
++static int
++mt7530_port_fdb_prepare(struct dsa_switch *ds, int port,
++			const struct switchdev_obj_port_fdb *fdb,
++			struct switchdev_trans *trans)
++{
++	struct mt7530_priv *priv = ds->priv;
++	int ret;
++
++	/* Because auto-learned entrie shares the same FDB table.
++	 * an entry is reserved with no port_mask to make sure fdb_add
++	 * is called while the entry is still available.
++	 */
++	mutex_lock(&priv->reg_mutex);
++	mt7530_fdb_write(priv, fdb->vid, 0, fdb->addr, -1, STATIC_ENT);
++	ret = mt7530_fdb_cmd(priv, MT7530_FDB_WRITE, 0);
++	mutex_unlock(&priv->reg_mutex);
++
++	return ret;
++}
++
++static void
++mt7530_port_fdb_add(struct dsa_switch *ds, int port,
++		    const struct switchdev_obj_port_fdb *fdb,
++		    struct switchdev_trans *trans)
++{
++	struct mt7530_priv *priv = ds->priv;
++	u8 port_mask = BIT(port);
++
++	mutex_lock(&priv->reg_mutex);
++	mt7530_fdb_write(priv, fdb->vid, port_mask, fdb->addr, -1, STATIC_ENT);
++	mt7530_fdb_cmd(priv, MT7530_FDB_WRITE, 0);
++	mutex_unlock(&priv->reg_mutex);
++}
++
++static int
++mt7530_port_fdb_del(struct dsa_switch *ds, int port,
++		    const struct switchdev_obj_port_fdb *fdb)
++{
++	struct mt7530_priv *priv = ds->priv;
++	int ret;
++	u8 port_mask = BIT(port);
++
++	mutex_lock(&priv->reg_mutex);
++	mt7530_fdb_write(priv, fdb->vid, port_mask, fdb->addr, -1, STATIC_EMP);
++	ret = mt7530_fdb_cmd(priv, MT7530_FDB_WRITE, 0);
++	mutex_unlock(&priv->reg_mutex);
++
++	return ret;
++}
++
++static int
++mt7530_port_fdb_dump(struct dsa_switch *ds, int port,
++		     struct switchdev_obj_port_fdb *fdb,
++		     int (*cb)(struct switchdev_obj *obj))
++{
++	struct mt7530_priv *priv = ds->priv;
++	struct mt7530_fdb _fdb = { 0 };
++	int cnt = MT7530_NUM_FDB_RECORDS;
++	int ret = 0;
++	u32 rsp = 0;
++
++	mutex_lock(&priv->reg_mutex);
++
++	ret = mt7530_fdb_cmd(priv, MT7530_FDB_START, &rsp);
++	if (ret < 0)
++		goto err;
++
++	do {
++		if (rsp & ATC_SRCH_HIT) {
++			mt7530_fdb_read(priv, &_fdb);
++			if (_fdb.port_mask & BIT(port)) {
++				ether_addr_copy(fdb->addr, _fdb.mac);
++				fdb->vid = _fdb.vid;
++				fdb->ndm_state = _fdb.noarp ?
++						NUD_NOARP : NUD_REACHABLE;
++				ret = cb(&fdb->obj);
++				if (ret < 0)
++					break;
++			}
++		}
++	} while (--cnt &&
++		 !(rsp & ATC_SRCH_END) &&
++		 !mt7530_fdb_cmd(priv, MT7530_FDB_NEXT, &rsp));
++err:
++	mutex_unlock(&priv->reg_mutex);
++
++	return 0;
++}
++
++static enum dsa_tag_protocol
++mtk_get_tag_protocol(struct dsa_switch *ds)
++{
++	struct mt7530_priv *priv = ds->priv;
++
++	if (!dsa_is_cpu_port(ds, MT7530_CPU_PORT)) {
++		dev_warn(priv->dev,
++			 "port not matched with tagging CPU port\n");
++		return DSA_TAG_PROTO_NONE;
++	} else {
++		return DSA_TAG_PROTO_MTK;
++	}
++}
++
++static struct dsa_switch_ops mt7530_switch_ops = {
++	.get_tag_protocol	= mtk_get_tag_protocol,
++	.setup			= mt7530_setup,
++	.get_strings		= mt7530_get_strings,
++	.phy_read		= mt7530_phy_read,
++	.phy_write		= mt7530_phy_write,
++	.get_ethtool_stats	= mt7530_get_ethtool_stats,
++	.get_sset_count		= mt7530_get_sset_count,
++	.adjust_link		= mt7530_adjust_link,
++	.port_enable		= mt7530_port_enable,
++	.port_disable		= mt7530_port_disable,
++	.port_stp_state_set	= mt7530_stp_state_set,
++	.port_bridge_join	= mt7530_port_bridge_join,
++	.port_bridge_leave	= mt7530_port_bridge_leave,
++	.port_fdb_prepare	= mt7530_port_fdb_prepare,
++	.port_fdb_add		= mt7530_port_fdb_add,
++	.port_fdb_del		= mt7530_port_fdb_del,
++	.port_fdb_dump		= mt7530_port_fdb_dump,
++};
++
++static int
++mt7530_probe(struct mdio_device *mdiodev)
++{
++	struct mt7530_priv *priv;
++	struct device_node *dn;
++
++	dn = mdiodev->dev.of_node;
++
++	priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL);
++	if (!priv)
++		return -ENOMEM;
++
++	priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
++	if (!priv->ds)
++		return -ENOMEM;
++
++	/* Use medatek,mcm property to distinguish hardware type that would
++	 * casues a little bit differences on power-on sequence.
++	 */
++	priv->mcm = of_property_read_bool(dn, "mediatek,mcm");
++	if (priv->mcm) {
++		dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n");
++
++		priv->rstc = devm_reset_control_get(&mdiodev->dev, "mcm");
++		if (IS_ERR(priv->rstc)) {
++			dev_err(&mdiodev->dev, "Couldn't get our reset line\n");
++			return PTR_ERR(priv->rstc);
++		}
++	}
++
++	priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core");
++	if (IS_ERR(priv->core_pwr))
++		return PTR_ERR(priv->core_pwr);
++
++	priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io");
++	if (IS_ERR(priv->io_pwr))
++		return PTR_ERR(priv->io_pwr);
++
++	/* Not MCM that indicates switch works as the remote standalone
++	 * integrated circuit so the GPIO pin would be used to complete
++	 * the reset, otherwise memory-mapped register accessing used
++	 * through syscon provides in the case of MCM.
++	 */
++	if (!priv->mcm) {
++		priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset",
++						      GPIOD_OUT_LOW);
++		if (IS_ERR(priv->reset)) {
++			dev_err(&mdiodev->dev, "Couldn't get our reset line\n");
++			return PTR_ERR(priv->reset);
++		}
++	}
++
++	priv->bus = mdiodev->bus;
++	priv->dev = &mdiodev->dev;
++	priv->ds->priv = priv;
++	priv->ds->ops = &mt7530_switch_ops;
++	mutex_init(&priv->reg_mutex);
++	lpriv = priv;
++	dev_set_drvdata(&mdiodev->dev, priv);
++
++	return dsa_register_switch(priv->ds, &mdiodev->dev);
++}
++
++static void
++mt7530_remove(struct mdio_device *mdiodev)
++{
++	struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
++	int ret = 0;
++
++	ret = regulator_disable(priv->core_pwr);
++	if (ret < 0)
++		dev_err(priv->dev,
++			"Failed to disable core power: %d\n", ret);
++
++	ret = regulator_disable(priv->io_pwr);
++	if (ret < 0)
++		dev_err(priv->dev, "Failed to disable io pwr: %d\n",
++			ret);
++
++	dsa_unregister_switch(priv->ds);
++	mutex_destroy(&priv->reg_mutex);
++}
++
++static const struct of_device_id mt7530_of_match[] = {
++	{ .compatible = "mediatek,mt7530" },
++	{ /* sentinel */ },
++};
++
++static struct mdio_driver mt7530_mdio_driver = {
++	.probe  = mt7530_probe,
++	.remove = mt7530_remove,
++	.mdiodrv.driver = {
++		.name = "mt7530",
++		.of_match_table = mt7530_of_match,
++	},
++};
++
++mdio_module_driver(mt7530_mdio_driver);
++
++MODULE_AUTHOR("Sean Wang <sean.wang at mediatek.com>");
++MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch");
++MODULE_LICENSE("GPL");
++MODULE_ALIAS("platform:mediatek-mt7530");
+diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
+new file mode 100644
+index 0000000..05a612f
+--- /dev/null
++++ b/drivers/net/dsa/mt7530.h
+@@ -0,0 +1,390 @@
++/*
++ * Copyright (C) 2017 Sean Wang <sean.wang at mediatek.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ */
++
++#ifndef __MT7530_H
++#define __MT7530_H
++
++#define MT7530_NUM_PORTS		7
++#define MT7530_CPU_PORT			6
++#define MT7530_NUM_FDB_RECORDS		2048
++
++#define	NUM_TRGMII_CTRL			5
++
++#define TRGMII_BASE(x)			(0x10000 + (x))
++
++/* Registers to ethsys access */
++#define ETHSYS_CLKCFG0			0x2c
++#define  ETHSYS_TRGMII_CLK_SEL362_5	BIT(11)
++
++#define SYSC_REG_RSTCTRL		0x34
++#define  RESET_MCM			BIT(2)
++
++/* Registers to mac forward control for unknown frames */
++#define MT7530_MFC			0x10
++#define  BC_FFP(x)			(((x) & 0xff) << 24)
++#define  UNM_FFP(x)			(((x) & 0xff) << 16)
++#define  UNU_FFP(x)			(((x) & 0xff) << 8)
++#define  UNU_FFP_MASK			UNU_FFP(~0)
++
++/* Registers for address table access */
++#define MT7530_ATA1			0x74
++#define  STATIC_EMP			0
++#define  STATIC_ENT			3
++#define MT7530_ATA2			0x78
++
++/* Register for address table write data */
++#define MT7530_ATWD			0x7c
++
++/* Register for address table control */
++#define MT7530_ATC			0x80
++#define  ATC_HASH			(((x) & 0xfff) << 16)
++#define  ATC_BUSY			BIT(15)
++#define  ATC_SRCH_END			BIT(14)
++#define  ATC_SRCH_HIT			BIT(13)
++#define  ATC_INVALID			BIT(12)
++#define  ATC_MAT(x)			(((x) & 0xf) << 8)
++#define  ATC_MAT_MACTAB			ATC_MAT(0)
++
++enum mt7530_fdb_cmd {
++	MT7530_FDB_READ	= 0,
++	MT7530_FDB_WRITE = 1,
++	MT7530_FDB_FLUSH = 2,
++	MT7530_FDB_START = 4,
++	MT7530_FDB_NEXT = 5,
++};
++
++/* Registers for table search read address */
++#define MT7530_TSRA1			0x84
++#define  MAC_BYTE_0			24
++#define  MAC_BYTE_1			16
++#define  MAC_BYTE_2			8
++#define  MAC_BYTE_3			0
++#define  MAC_BYTE_MASK			0xff
++
++#define MT7530_TSRA2			0x88
++#define  MAC_BYTE_4			24
++#define  MAC_BYTE_5			16
++#define  CVID				0
++#define  CVID_MASK			0xfff
++
++#define MT7530_ATRD			0x8C
++#define	 AGE_TIMER			24
++#define  AGE_TIMER_MASK			0xff
++#define  PORT_MAP			4
++#define  PORT_MAP_MASK			0xff
++#define  ENT_STATUS			2
++#define  ENT_STATUS_MASK		0x3
++
++/* Register for vlan table control */
++#define MT7530_VTCR			0x90
++#define  VTCR_BUSY			BIT(31)
++#define  VTCR_FUNC			(((x) & 0xf) << 12)
++#define  VTCR_FUNC_RD_VID		0x1
++#define  VTCR_FUNC_WR_VID		0x2
++#define  VTCR_FUNC_INV_VID		0x3
++#define  VTCR_FUNC_VAL_VID		0x4
++#define  VTCR_VID			((x) & 0xfff)
++
++/* Register for setup vlan and acl write data */
++#define MT7530_VAWD1			0x94
++#define  PORT_STAG			BIT(31)
++#define  IVL_MAC			BIT(30)
++#define  PORT_MEM(x)			(((x) & 0xff) << 16)
++#define  VALID				BIT(1)
++
++#define MT7530_VAWD2			0x98
++
++/* Register for port STP state control */
++#define MT7530_SSP_P(x)			(0x2000 + ((x) * 0x100))
++#define  FID_PST(x)			((x) & 0x3)
++#define  FID_PST_MASK			FID_PST(0x3)
++
++enum mt7530_stp_state {
++	MT7530_STP_DISABLED = 0,
++	MT7530_STP_BLOCKING = 1,
++	MT7530_STP_LISTENING = 1,
++	MT7530_STP_LEARNING = 2,
++	MT7530_STP_FORWARDING  = 3
++};
++
++/* Register for port control */
++#define MT7530_PCR_P(x)			(0x2004 + ((x) * 0x100))
++#define  PORT_VLAN(x)			((x) & 0x3)
++#define  PCR_MATRIX(x)			(((x) & 0xff) << 16)
++#define  PORT_PRI(x)			(((x) & 0x7) << 24)
++#define  EG_TAG(x)			(((x) & 0x3) << 28)
++#define  PCR_MATRIX_MASK		PCR_MATRIX(0xff)
++#define  PCR_MATRIX_CLR			PCR_MATRIX(0)
++
++/* Register for port security control */
++#define MT7530_PSC_P(x)			(0x200c + ((x) * 0x100))
++#define  SA_DIS				BIT(4)
++
++/* Register for port vlan control */
++#define MT7530_PVC_P(x)			(0x2010 + ((x) * 0x100))
++#define  PORT_SPEC_TAG			BIT(5)
++#define  VLAN_ATTR(x)			(((x) & 0x3) << 6)
++#define  STAG_VPID			(((x) & 0xffff) << 16)
++
++/* Register for port port-and-protocol based vlan 1 control */
++#define MT7530_PPBV1_P(x)		(0x2014 + ((x) * 0x100))
++
++/* Register for port MAC control register */
++#define MT7530_PMCR_P(x)		(0x3000 + ((x) * 0x100))
++#define  PMCR_IFG_XMIT(x)		(((x) & 0x3) << 18)
++#define  PMCR_MAC_MODE			BIT(16)
++#define  PMCR_FORCE_MODE		BIT(15)
++#define  PMCR_TX_EN			BIT(14)
++#define  PMCR_RX_EN			BIT(13)
++#define  PMCR_BACKOFF_EN		BIT(9)
++#define  PMCR_BACKPR_EN			BIT(8)
++#define  PMCR_TX_FC_EN			BIT(5)
++#define  PMCR_RX_FC_EN			BIT(4)
++#define  PMCR_FORCE_SPEED_1000		BIT(3)
++#define  PMCR_FORCE_FDX			BIT(1)
++#define  PMCR_FORCE_LNK			BIT(0)
++#define  PMCR_COMMON_LINK		(PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | \
++					 PMCR_BACKOFF_EN | PMCR_BACKPR_EN | \
++					 PMCR_TX_EN | PMCR_RX_EN | \
++					 PMCR_TX_FC_EN | PMCR_RX_FC_EN)
++#define  PMCR_CPUP_LINK			(PMCR_COMMON_LINK | PMCR_FORCE_MODE | \
++					 PMCR_FORCE_SPEED_1000 | \
++					 PMCR_FORCE_FDX | \
++					 PMCR_FORCE_LNK)
++#define  PMCR_USERP_LINK		PMCR_COMMON_LINK
++#define  PMCR_FIXED_LINK		(PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | \
++					 PMCR_FORCE_MODE | PMCR_TX_EN | \
++					 PMCR_RX_EN | PMCR_BACKPR_EN | \
++					 PMCR_BACKOFF_EN | \
++					 PMCR_FORCE_SPEED_1000 | \
++					 PMCR_FORCE_FDX | \
++					 PMCR_FORCE_LNK)
++#define PMCR_FIXED_LINK_FC		(PMCR_FIXED_LINK | \
++					 PMCR_TX_FC_EN | PMCR_RX_FC_EN)
++
++#define MT7530_PMSR_P(x)		(0x3008 + (x) * 0x100)
++
++/* Register for MIB */
++#define MT7530_PORT_MIB_COUNTER(x)	(0x4000 + (x) * 0x100)
++#define MT7530_MIB_CCR			0x4fe0
++#define  CCR_MIB_ENABLE			BIT(31)
++#define  CCR_RX_OCT_CNT_GOOD		BIT(7)
++#define  CCR_RX_OCT_CNT_BAD		BIT(6)
++#define  CCR_TX_OCT_CNT_GOOD		BIT(5)
++#define  CCR_TX_OCT_CNT_BAD		BIT(4)
++#define  CCR_MIB_FLUSH			(CCR_RX_OCT_CNT_GOOD | \
++					 CCR_RX_OCT_CNT_BAD | \
++					 CCR_TX_OCT_CNT_GOOD | \
++					 CCR_TX_OCT_CNT_BAD)
++#define  CCR_MIB_ACTIVATE		(CCR_MIB_ENABLE | \
++					 CCR_RX_OCT_CNT_GOOD | \
++					 CCR_RX_OCT_CNT_BAD | \
++					 CCR_TX_OCT_CNT_GOOD | \
++					 CCR_TX_OCT_CNT_BAD)
++/* Register for system reset */
++#define MT7530_SYS_CTRL			0x7000
++#define  SYS_CTRL_PHY_RST		BIT(2)
++#define  SYS_CTRL_SW_RST		BIT(1)
++#define  SYS_CTRL_REG_RST		BIT(0)
++
++/* Register for hw trap status */
++#define MT7530_HWTRAP			0x7800
++
++/* Register for hw trap modification */
++#define MT7530_MHWTRAP			0x7804
++#define  MHWTRAP_MANUAL			BIT(16)
++#define  MHWTRAP_P5_MAC_SEL		BIT(13)
++#define  MHWTRAP_P6_DIS			BIT(8)
++#define  MHWTRAP_P5_RGMII_MODE		BIT(7)
++#define  MHWTRAP_P5_DIS			BIT(6)
++#define  MHWTRAP_PHY_ACCESS		BIT(5)
++
++/* Register for TOP signal control */
++#define MT7530_TOP_SIG_CTRL		0x7808
++#define  TOP_SIG_CTRL_NORMAL		(BIT(17) | BIT(16))
++
++#define MT7530_IO_DRV_CR		0x7810
++#define  P5_IO_CLK_DRV(x)		((x) & 0x3)
++#define  P5_IO_DATA_DRV(x)		(((x) & 0x3) << 4)
++
++#define MT7530_P6ECR			0x7830
++#define  P6_INTF_MODE_MASK		0x3
++#define  P6_INTF_MODE(x)		((x) & 0x3)
++
++/* Registers for TRGMII on the both side */
++#define MT7530_TRGMII_RCK_CTRL		0x7a00
++#define GSW_TRGMII_RCK_CTRL		0x300
++#define  RX_RST				BIT(31)
++#define  RXC_DQSISEL			BIT(30)
++#define  DQSI1_TAP_MASK			(0x7f << 8)
++#define  DQSI0_TAP_MASK			0x7f
++#define  DQSI1_TAP(x)			(((x) & 0x7f) << 8)
++#define  DQSI0_TAP(x)			((x) & 0x7f)
++
++#define MT7530_TRGMII_RCK_RTT		0x7a04
++#define GSW_TRGMII_RCK_RTT		0x304
++#define  DQS1_GATE			BIT(31)
++#define  DQS0_GATE			BIT(30)
++
++#define MT7530_TRGMII_RD(x)		(0x7a10 + (x) * 8)
++#define GSW_TRGMII_RD(x)		(0x310 + (x) * 8)
++#define  BSLIP_EN			BIT(31)
++#define  EDGE_CHK			BIT(30)
++#define  RD_TAP_MASK			0x7f
++#define  RD_TAP(x)			((x) & 0x7f)
++
++#define GSW_TRGMII_TXCTRL		0x340
++#define MT7530_TRGMII_TXCTRL		0x7a40
++#define  TRAIN_TXEN			BIT(31)
++#define  TXC_INV			BIT(30)
++#define  TX_RST				BIT(28)
++
++#define MT7530_TRGMII_TD_ODT(i)		(0x7a54 + 8 * (i))
++#define GSW_TRGMII_TD_ODT(i)		(0x354 + 8 * (i))
++#define  TD_DM_DRVP(x)			((x) & 0xf)
++#define  TD_DM_DRVN(x)			(((x) & 0xf) << 4)
++
++#define GSW_INTF_MODE			0x390
++#define  INTF_MODE_TRGMII		BIT(1)
++
++#define MT7530_TRGMII_TCK_CTRL		0x7a78
++#define  TCK_TAP(x)			(((x) & 0xf) << 8)
++
++#define MT7530_P5RGMIIRXCR		0x7b00
++#define  CSR_RGMII_EDGE_ALIGN		BIT(8)
++#define  CSR_RGMII_RXC_0DEG_CFG(x)	((x) & 0xf)
++
++#define MT7530_P5RGMIITXCR		0x7b04
++#define  CSR_RGMII_TXC_CFG(x)		((x) & 0x1f)
++
++#define MT7530_CREV			0x7ffc
++#define  CHIP_NAME_SHIFT		16
++#define  MT7530_ID			0x7530
++
++/* Registers for core PLL access through mmd indirect */
++#define CORE_PLL_GROUP2			0x401
++#define  RG_SYSPLL_EN_NORMAL		BIT(15)
++#define  RG_SYSPLL_VODEN		BIT(14)
++#define  RG_SYSPLL_LF			BIT(13)
++#define  RG_SYSPLL_RST_DLY(x)		(((x) & 0x3) << 12)
++#define  RG_SYSPLL_LVROD_EN		BIT(10)
++#define  RG_SYSPLL_PREDIV(x)		(((x) & 0x3) << 8)
++#define  RG_SYSPLL_POSDIV(x)		(((x) & 0x3) << 5)
++#define  RG_SYSPLL_FBKSEL		BIT(4)
++#define  RT_SYSPLL_EN_AFE_OLT		BIT(0)
++
++#define CORE_PLL_GROUP4			0x403
++#define  RG_SYSPLL_DDSFBK_EN		BIT(12)
++#define  RG_SYSPLL_BIAS_EN		BIT(11)
++#define  RG_SYSPLL_BIAS_LPF_EN		BIT(10)
++
++#define CORE_PLL_GROUP5			0x404
++#define  RG_LCDDS_PCW_NCPO1(x)		((x) & 0xffff)
++
++#define CORE_PLL_GROUP6			0x405
++#define  RG_LCDDS_PCW_NCPO0(x)		((x) & 0xffff)
++
++#define CORE_PLL_GROUP7			0x406
++#define  RG_LCDDS_PWDB			BIT(15)
++#define  RG_LCDDS_ISO_EN		BIT(13)
++#define  RG_LCCDS_C(x)			(((x) & 0x7) << 4)
++#define  RG_LCDDS_PCW_NCPO_CHG		BIT(3)
++
++#define CORE_PLL_GROUP10		0x409
++#define  RG_LCDDS_SSC_DELTA(x)		((x) & 0xfff)
++
++#define CORE_PLL_GROUP11		0x40a
++#define  RG_LCDDS_SSC_DELTA1(x)		((x) & 0xfff)
++
++#define CORE_GSWPLL_GRP1		0x40d
++#define  RG_GSWPLL_PREDIV(x)		(((x) & 0x3) << 14)
++#define  RG_GSWPLL_POSDIV_200M(x)	(((x) & 0x3) << 12)
++#define  RG_GSWPLL_EN_PRE		BIT(11)
++#define  RG_GSWPLL_FBKSEL		BIT(10)
++#define  RG_GSWPLL_BP			BIT(9)
++#define  RG_GSWPLL_BR			BIT(8)
++#define  RG_GSWPLL_FBKDIV_200M(x)	((x) & 0xff)
++
++#define CORE_GSWPLL_GRP2		0x40e
++#define  RG_GSWPLL_POSDIV_500M(x)	(((x) & 0x3) << 8)
++#define  RG_GSWPLL_FBKDIV_500M(x)	((x) & 0xff)
++
++#define CORE_TRGMII_GSW_CLK_CG		0x410
++#define  REG_GSWCK_EN			BIT(0)
++#define  REG_TRGMIICK_EN		BIT(1)
++
++#define MIB_DESC(_s, _o, _n)	\
++	{			\
++		.size = (_s),	\
++		.offset = (_o),	\
++		.name = (_n),	\
++	}
++
++struct mt7530_mib_desc {
++	unsigned int size;
++	unsigned int offset;
++	const char *name;
++};
++
++struct mt7530_fdb {
++	u16 vid;
++	u8 port_mask;
++	u8 aging;
++	u8 mac[6];
++	bool noarp;
++};
++
++struct mt7530_port {
++	bool enable;
++	u32 pm;
++};
++
++/* struct mt7530_priv -	This is the main data structure for holding the state
++ *			of the driver
++ * @dev:		The device pointer
++ * @ds:			The pointer to the dsa core structure
++ * @bus:		The bus used for the device and built-in PHY
++ * @rstc:		The pointer to reset control used by MCM
++ * @ethernet:		The regmap used for access TRGMII-based registers
++ * @core_pwr:		The power supplied into the core
++ * @io_pwr:		The power supplied into the I/O
++ * @reset:		The descriptor for GPIO line tied to its reset pin
++ * @mcm:		Flag for distinguishing if standalone IC or module
++ *			coupling
++ * @ports:		Holding the state among ports
++ * @reg_mutex:		The lock for protecting among process accessing
++ *			registers
++ */
++struct mt7530_priv {
++	struct device		*dev;
++	struct dsa_switch	*ds;
++	struct mii_bus		*bus;
++	struct reset_control	*rstc;
++	struct regmap		*ethernet;
++	struct regulator	*core_pwr;
++	struct regulator	*io_pwr;
++	struct gpio_desc	*reset;
++	bool			mcm;
++
++	struct mt7530_port	ports[MT7530_NUM_PORTS];
++	/* protect among processes for registers access*/
++	struct mutex reg_mutex;
++};
++
++struct mt7530_hw_stats {
++	const char	*string;
++	u16		reg;
++	u8		sizeof_stat;
++};
++
++#endif /* __MT7530_H */
diff --git a/target/linux/mediatek/patches-4.9/0093-dsa-compat.patch b/target/linux/mediatek/patches-4.9/0093-dsa-compat.patch
new file mode 100644
index 0000000..ca36d4c
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0093-dsa-compat.patch
@@ -0,0 +1,98 @@
+Index: linux-4.9.17/drivers/net/dsa/mt7530.c
+===================================================================
+--- linux-4.9.17.orig/drivers/net/dsa/mt7530.c
++++ linux-4.9.17/drivers/net/dsa/mt7530.c
+@@ -834,6 +834,7 @@ mt7530_port_bridge_join(struct dsa_switc
+ 	int i;
+ 
+ 	mutex_lock(&priv->reg_mutex);
++	priv->bridge_dev[port] = bridge;
+ 
+ 	for (i = 0; i < MT7530_NUM_PORTS; i++) {
+ 		/* Add this port to the port matrix of the other ports in the
+@@ -841,7 +842,7 @@ mt7530_port_bridge_join(struct dsa_switc
+ 		 * and not being setup until the port becomes enabled.
+ 		 */
+ 		if (ds->enabled_port_mask & BIT(i) && i != port) {
+-			if (ds->ports[i].bridge_dev != bridge)
++			if (priv->bridge_dev[i] != bridge)
+ 				continue;
+ 			if (priv->ports[i].enable)
+ 				mt7530_set(priv, MT7530_PCR_P(i),
+@@ -864,8 +865,7 @@ mt7530_port_bridge_join(struct dsa_switc
+ }
+ 
+ static void
+-mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
+-			 struct net_device *bridge)
++mt7530_port_bridge_leave(struct dsa_switch *ds, int port)
+ {
+ 	struct mt7530_priv *priv = ds->priv;
+ 	int i;
+@@ -878,7 +878,7 @@ mt7530_port_bridge_leave(struct dsa_swit
+ 		 * is kept and not being setup until the port becomes enabled.
+ 		 */
+ 		if (ds->enabled_port_mask & BIT(i) && i != port) {
+-			if (ds->ports[i].bridge_dev != bridge)
++			if (priv->bridge_dev[i] != priv->bridge_dev[port])
+ 				continue;
+ 			if (priv->ports[i].enable)
+ 				mt7530_clear(priv, MT7530_PCR_P(i),
+@@ -890,6 +890,7 @@ mt7530_port_bridge_leave(struct dsa_swit
+ 	/* Set the cpu port to be the only one in the port matrix of
+ 	 * this port.
+ 	 */
++	priv->bridge_dev[port] = NULL;
+ 	if (priv->ports[port].enable)
+ 		mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
+ 			   PCR_MATRIX(BIT(MT7530_CPU_PORT)));
+@@ -1033,7 +1034,7 @@ mt7530_probe(struct mdio_device *mdiodev
+ 	if (!priv)
+ 		return -ENOMEM;
+ 
+-	priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
++	priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL);
+ 	if (!priv->ds)
+ 		return -ENOMEM;
+ 
+@@ -1076,12 +1077,13 @@ mt7530_probe(struct mdio_device *mdiodev
+ 	priv->bus = mdiodev->bus;
+ 	priv->dev = &mdiodev->dev;
+ 	priv->ds->priv = priv;
++	priv->ds->dev = &mdiodev->dev;
+ 	priv->ds->ops = &mt7530_switch_ops;
+ 	mutex_init(&priv->reg_mutex);
+ 	lpriv = priv;
+ 	dev_set_drvdata(&mdiodev->dev, priv);
+ 
+-	return dsa_register_switch(priv->ds, &mdiodev->dev);
++	return dsa_register_switch(priv->ds, priv->ds->dev->of_node);
+ }
+ 
+ static void
+Index: linux-4.9.17/drivers/net/dsa/mt7530.h
+===================================================================
+--- linux-4.9.17.orig/drivers/net/dsa/mt7530.h
++++ linux-4.9.17/drivers/net/dsa/mt7530.h
+@@ -379,6 +379,8 @@ struct mt7530_priv {
+ 	struct mt7530_port	ports[MT7530_NUM_PORTS];
+ 	/* protect among processes for registers access*/
+ 	struct mutex reg_mutex;
++
++	struct net_device *bridge_dev[MT7530_NUM_PORTS];
+ };
+ 
+ struct mt7530_hw_stats {
+Index: linux-4.9.17/net/dsa/tag_mtk.c
+===================================================================
+--- linux-4.9.17.orig/net/dsa/tag_mtk.c
++++ linux-4.9.17/net/dsa/tag_mtk.c
+@@ -35,7 +35,7 @@ static struct sk_buff *mtk_tag_xmit(stru
+ 	/* Build the tag after the MAC Source Address */
+ 	mtk_tag = skb->data + 2 * ETH_ALEN;
+ 	mtk_tag[0] = 0;
+-	mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
++	mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK;
+ 	mtk_tag[2] = 0;
+ 	mtk_tag[3] = 0;
+ 
diff --git a/target/linux/mediatek/patches-4.9/0094-net-affinity.patch b/target/linux/mediatek/patches-4.9/0094-net-affinity.patch
new file mode 100644
index 0000000..8e51bdd
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0094-net-affinity.patch
@@ -0,0 +1,40 @@
+Index: linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+===================================================================
+--- linux-4.9.17.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -2459,15 +2459,23 @@ static int mtk_probe(struct platform_dev
+ 			goto err_deinit_hw;
+ 	}
+ 
++	for (i = 0; i < 3; i++) {
++		int cpu = i % num_online_cpus();
++
++		cpumask_set_cpu(cpu, &eth->affinity_mask[i]);
++	}
++
+ 	err = devm_request_irq(eth->dev, eth->irq[1], mtk_handle_irq_tx, 0,
+ 			       dev_name(eth->dev), eth);
+ 	if (err)
+ 		goto err_free_dev;
++	irq_set_affinity_hint(eth->irq[1], &eth->affinity_mask[1]);
+ 
+ 	err = devm_request_irq(eth->dev, eth->irq[2], mtk_handle_irq_rx, 0,
+ 			       dev_name(eth->dev), eth);
+ 	if (err)
+ 		goto err_free_dev;
++	irq_set_affinity_hint(eth->irq[2], &eth->affinity_mask[2]);
+ 
+ 	err = mtk_mdio_init(eth);
+ 	if (err)
+Index: linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+===================================================================
+--- linux-4.9.17.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.h
++++ linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+@@ -539,6 +539,7 @@ struct mtk_eth {
+ 	struct net_device		*netdev[MTK_MAX_DEVS];
+ 	struct mtk_mac			*mac[MTK_MAX_DEVS];
+ 	int				irq[3];
++	cpumask_t			affinity_mask[3];
+ 	u32				msg_enable;
+ 	unsigned long			sysclk;
+ 	struct regmap			*ethsys;
diff --git a/target/linux/mediatek/patches-4.9/0101-net-mediatek-add-gsw-mt7530-driver.patch b/target/linux/mediatek/patches-4.9/0101-net-mediatek-add-gsw-mt7530-driver.patch
deleted file mode 100644
index d351192..0000000
--- a/target/linux/mediatek/patches-4.9/0101-net-mediatek-add-gsw-mt7530-driver.patch
+++ /dev/null
@@ -1,2322 +0,0 @@
-From 6b8a7257e7bcb56782c3f8048311670fe6a80209 Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic at openwrt.org>
-Date: Mon, 11 Apr 2016 03:11:54 +0200
-Subject: [PATCH 101/102] net: mediatek add gsw/mt7530 driver
-
-Signed-off-by: John Crispin <blogic at openwrt.org>
----
- drivers/net/ethernet/mediatek/Makefile      |    2 +-
- drivers/net/ethernet/mediatek/gsw_mt7620.h  |  251 +++++++
- drivers/net/ethernet/mediatek/gsw_mt7623.c  | 1084 +++++++++++++++++++++++++++
- drivers/net/ethernet/mediatek/mt7530.c      |  808 ++++++++++++++++++++
- drivers/net/ethernet/mediatek/mt7530.h      |   20 +
- drivers/net/ethernet/mediatek/mtk_eth_soc.c |   59 +-
- drivers/net/ethernet/mediatek/mtk_eth_soc.h |    5 +
- 7 files changed, 2199 insertions(+), 30 deletions(-)
- create mode 100644 drivers/net/ethernet/mediatek/gsw_mt7620.h
- create mode 100644 drivers/net/ethernet/mediatek/gsw_mt7623.c
- create mode 100644 drivers/net/ethernet/mediatek/mt7530.c
- create mode 100644 drivers/net/ethernet/mediatek/mt7530.h
-
---- a/drivers/net/ethernet/mediatek/Makefile
-+++ b/drivers/net/ethernet/mediatek/Makefile
-@@ -2,4 +2,4 @@
- # Makefile for the Mediatek SoCs built-in ethernet macs
- #
- 
--obj-$(CONFIG_NET_MEDIATEK_SOC)			+= mtk_eth_soc.o
-+obj-$(CONFIG_NET_MEDIATEK_SOC)			+= mt7530.o gsw_mt7623.o mtk_eth_soc.o
---- /dev/null
-+++ b/drivers/net/ethernet/mediatek/gsw_mt7620.h
-@@ -0,0 +1,251 @@
-+/*   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 of the License
-+ *
-+ *   This program is distributed in the hope that it will be useful,
-+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *   GNU General Public License for more details.
-+ *
-+ *   Copyright (C) 2009-2016 John Crispin <blogic at openwrt.org>
-+ *   Copyright (C) 2009-2016 Felix Fietkau <nbd at nbd.name>
-+ *   Copyright (C) 2013-2016 Michael Lee <igvtee at gmail.com>
-+ */
-+
-+#ifndef _RALINK_GSW_MT7620_H__
-+#define _RALINK_GSW_MT7620_H__
-+
-+#define GSW_REG_PHY_TIMEOUT	(5 * HZ)
-+
-+#define MT7620_GSW_REG_PIAC	0x0004
-+
-+#define GSW_NUM_VLANS		16
-+#define GSW_NUM_VIDS		4096
-+#define GSW_NUM_PORTS		7
-+#define GSW_PORT6		6
-+
-+#define GSW_MDIO_ACCESS		BIT(31)
-+#define GSW_MDIO_READ		BIT(19)
-+#define GSW_MDIO_WRITE		BIT(18)
-+#define GSW_MDIO_START		BIT(16)
-+#define GSW_MDIO_ADDR_SHIFT	20
-+#define GSW_MDIO_REG_SHIFT	25
-+
-+#define GSW_REG_PORT_PMCR(x)	(0x3000 + (x * 0x100))
-+#define GSW_REG_PORT_STATUS(x)	(0x3008 + (x * 0x100))
-+#define GSW_REG_SMACCR0		0x3fE4
-+#define GSW_REG_SMACCR1		0x3fE8
-+#define GSW_REG_CKGCR		0x3ff0
-+
-+#define GSW_REG_IMR		0x7008
-+#define GSW_REG_ISR		0x700c
-+#define GSW_REG_GPC1		0x7014
-+
-+#define SYSC_REG_CHIP_REV_ID	0x0c
-+#define SYSC_REG_CFG		0x10
-+#define SYSC_REG_CFG1		0x14
-+#define RST_CTRL_MCM		BIT(2)
-+#define SYSC_PAD_RGMII2_MDIO	0x58
-+#define SYSC_GPIO_MODE		0x60
-+
-+#define PORT_IRQ_ST_CHG		0x7f
-+
-+#define MT7621_ESW_PHY_POLLING	0x0000
-+#define MT7620_ESW_PHY_POLLING	0x7000
-+
-+#define	PMCR_IPG		BIT(18)
-+#define	PMCR_MAC_MODE		BIT(16)
-+#define	PMCR_FORCE		BIT(15)
-+#define	PMCR_TX_EN		BIT(14)
-+#define	PMCR_RX_EN		BIT(13)
-+#define	PMCR_BACKOFF		BIT(9)
-+#define	PMCR_BACKPRES		BIT(8)
-+#define	PMCR_RX_FC		BIT(5)
-+#define	PMCR_TX_FC		BIT(4)
-+#define	PMCR_SPEED(_x)		(_x << 2)
-+#define	PMCR_DUPLEX		BIT(1)
-+#define	PMCR_LINK		BIT(0)
-+
-+#define PHY_AN_EN		BIT(31)
-+#define PHY_PRE_EN		BIT(30)
-+#define PMY_MDC_CONF(_x)	((_x & 0x3f) << 24)
-+
-+/* ethernet subsystem config register */
-+#define ETHSYS_SYSCFG0		0x14
-+/* ethernet subsystem clock register */
-+#define ETHSYS_CLKCFG0		0x2c
-+#define ETHSYS_TRGMII_CLK_SEL362_5	BIT(11)
-+
-+/* p5 RGMII wrapper TX clock control register */
-+#define MT7530_P5RGMIITXCR	0x7b04
-+/* p5 RGMII wrapper RX clock control register */
-+#define MT7530_P5RGMIIRXCR	0x7b00
-+/* TRGMII TDX ODT registers */
-+#define MT7530_TRGMII_TD0_ODT	0x7a54
-+#define MT7530_TRGMII_TD1_ODT	0x7a5c
-+#define MT7530_TRGMII_TD2_ODT	0x7a64
-+#define MT7530_TRGMII_TD3_ODT	0x7a6c
-+#define MT7530_TRGMII_TD4_ODT	0x7a74
-+#define MT7530_TRGMII_TD5_ODT	0x7a7c
-+/* TRGMII TCK ctrl register */
-+#define MT7530_TRGMII_TCK_CTRL	0x7a78
-+/* TRGMII Tx ctrl register */
-+#define MT7530_TRGMII_TXCTRL	0x7a40
-+/* port 6 extended control register */
-+#define MT7530_P6ECR            0x7830
-+/* IO driver control register */
-+#define MT7530_IO_DRV_CR	0x7810
-+/* top signal control register */
-+#define MT7530_TOP_SIG_CTRL	0x7808
-+/* modified hwtrap register */
-+#define MT7530_MHWTRAP		0x7804
-+/* hwtrap status register */
-+#define MT7530_HWTRAP		0x7800
-+/* status interrupt register */
-+#define MT7530_SYS_INT_STS	0x700c
-+/* system nterrupt register */
-+#define MT7530_SYS_INT_EN	0x7008
-+/* system control register */
-+#define MT7530_SYS_CTRL		0x7000
-+/* port MAC status register */
-+#define MT7530_PMSR_P(x)	(0x3008 + (x * 0x100))
-+/* port MAC control register */
-+#define MT7530_PMCR_P(x)	(0x3000 + (x * 0x100))
-+
-+#define MT7621_XTAL_SHIFT	6
-+#define MT7621_XTAL_MASK	0x7
-+#define MT7621_XTAL_25		6
-+#define MT7621_XTAL_40		3
-+#define MT7621_MDIO_DRV_MASK	(3 << 4)
-+#define MT7621_GE1_MODE_MASK	(3 << 12)
-+
-+#define TRGMII_TXCTRL_TXC_INV	BIT(30)
-+#define P6ECR_INTF_MODE_RGMII	BIT(1)
-+#define P5RGMIIRXCR_C_ALIGN	BIT(8)
-+#define P5RGMIIRXCR_DELAY_2	BIT(1)
-+#define P5RGMIITXCR_DELAY_2	(BIT(8) | BIT(2))
-+
-+/* TOP_SIG_CTRL bits */
-+#define TOP_SIG_CTRL_NORMAL	(BIT(17) | BIT(16))
-+
-+/* MHWTRAP bits */
-+#define MHWTRAP_MANUAL		BIT(16)
-+#define MHWTRAP_P5_MAC_SEL	BIT(13)
-+#define MHWTRAP_P6_DIS		BIT(8)
-+#define MHWTRAP_P5_RGMII_MODE	BIT(7)
-+#define MHWTRAP_P5_DIS		BIT(6)
-+#define MHWTRAP_PHY_ACCESS	BIT(5)
-+
-+/* HWTRAP bits */
-+#define HWTRAP_XTAL_SHIFT	9
-+#define HWTRAP_XTAL_MASK	0x3
-+
-+/* SYS_CTRL bits */
-+#define SYS_CTRL_SW_RST		BIT(1)
-+#define SYS_CTRL_REG_RST	BIT(0)
-+
-+/* PMCR bits */
-+#define PMCR_IFG_XMIT_96	BIT(18)
-+#define PMCR_MAC_MODE		BIT(16)
-+#define PMCR_FORCE_MODE		BIT(15)
-+#define PMCR_TX_EN		BIT(14)
-+#define PMCR_RX_EN		BIT(13)
-+#define PMCR_BACK_PRES_EN	BIT(9)
-+#define PMCR_BACKOFF_EN		BIT(8)
-+#define PMCR_TX_FC_EN		BIT(5)
-+#define PMCR_RX_FC_EN		BIT(4)
-+#define PMCR_FORCE_SPEED_1000	BIT(3)
-+#define PMCR_FORCE_FDX		BIT(1)
-+#define PMCR_FORCE_LNK		BIT(0)
-+#define PMCR_FIXED_LINK		(PMCR_IFG_XMIT_96 | PMCR_MAC_MODE | \
-+				 PMCR_FORCE_MODE | PMCR_TX_EN | PMCR_RX_EN | \
-+				 PMCR_BACK_PRES_EN | PMCR_BACKOFF_EN | \
-+				 PMCR_FORCE_SPEED_1000 | PMCR_FORCE_FDX | \
-+				 PMCR_FORCE_LNK)
-+
-+#define PMCR_FIXED_LINK_FC	(PMCR_FIXED_LINK | \
-+				 PMCR_TX_FC_EN | PMCR_RX_FC_EN)
-+
-+/* TRGMII control registers */
-+#define GSW_INTF_MODE		0x390
-+#define GSW_TRGMII_TD0_ODT	0x354
-+#define GSW_TRGMII_TD1_ODT	0x35c
-+#define GSW_TRGMII_TD2_ODT	0x364
-+#define GSW_TRGMII_TD3_ODT	0x36c
-+#define GSW_TRGMII_TXCTL_ODT	0x374
-+#define GSW_TRGMII_TCK_ODT	0x37c
-+#define GSW_TRGMII_RCK_CTRL	0x300
-+
-+#define INTF_MODE_TRGMII	BIT(1)
-+#define TRGMII_RCK_CTRL_RX_RST	BIT(31)
-+
-+
-+/* possible XTAL speed */
-+#define	MT7623_XTAL_40		0
-+#define MT7623_XTAL_20		1
-+#define MT7623_XTAL_25		3
-+
-+/* GPIO port control registers */
-+#define	GPIO_OD33_CTRL8		0x4c0
-+#define	GPIO_BIAS_CTRL		0xed0
-+#define GPIO_DRV_SEL10		0xf00
-+
-+/* on MT7620 the functio of port 4 can be software configured */
-+enum {
-+	PORT4_EPHY = 0,
-+	PORT4_EXT,
-+};
-+
-+/* struct mt7620_gsw -	the structure that holds the SoC specific data
-+ * @dev:		The Device struct
-+ * @base:		The base address
-+ * @piac_offset:	The PIAC base may change depending on SoC
-+ * @irq:		The IRQ we are using
-+ * @port4:		The port4 mode on MT7620
-+ * @autopoll:		Is MDIO autopolling enabled
-+ * @ethsys:		The ethsys register map
-+ * @pctl:		The pin control register map
-+ * @clk_trgpll:		The trgmii pll clock
-+ */
-+struct mt7620_gsw {
-+	struct mtk_eth		*eth;
-+	struct device		*dev;
-+	void __iomem		*base;
-+	u32			piac_offset;
-+	int			irq;
-+	int			port4;
-+	unsigned long int	autopoll;
-+
-+	struct regmap		*ethsys;
-+	struct regmap		*pctl;
-+
-+	struct clk		*clk_trgpll;
-+
-+	int			trgmii_force;
-+	bool			wllll;
-+};
-+
-+/* switch register I/O wrappers */
-+void mtk_switch_w32(struct mt7620_gsw *gsw, u32 val, unsigned reg);
-+u32 mtk_switch_r32(struct mt7620_gsw *gsw, unsigned reg);
-+
-+/* the callback used by the driver core to bringup the switch */
-+int mtk_gsw_init(struct mtk_eth *eth);
-+
-+/* MDIO access wrappers */
-+int mt7620_mdio_write(struct mii_bus *bus, int phy_addr, int phy_reg, u16 val);
-+int mt7620_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg);
-+void mt7620_mdio_link_adjust(struct mtk_eth *eth, int port);
-+int mt7620_has_carrier(struct mtk_eth *eth);
-+void mt7620_print_link_state(struct mtk_eth *eth, int port, int link,
-+			     int speed, int duplex);
-+void mt7530_mdio_w32(struct mt7620_gsw *gsw, u32 reg, u32 val);
-+u32 mt7530_mdio_r32(struct mt7620_gsw *gsw, u32 reg);
-+void mt7530_mdio_m32(struct mt7620_gsw *gsw, u32 mask, u32 set, u32 reg);
-+
-+u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr,
-+		      u32 phy_register, u32 write_data);
-+u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg);
-+void mt7620_handle_carrier(struct mtk_eth *eth);
-+
-+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/mediatek/gsw_mt7623.c
-@@ -0,0 +1,1084 @@
-+/*   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 of the License
-+ *
-+ *   This program is distributed in the hope that it will be useful,
-+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *   GNU General Public License for more details.
-+ *
-+ *   Copyright (C) 2009-2016 John Crispin <blogic at openwrt.org>
-+ *   Copyright (C) 2009-2016 Felix Fietkau <nbd at nbd.name>
-+ *   Copyright (C) 2013-2016 Michael Lee <igvtee at gmail.com>
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/types.h>
-+#include <linux/platform_device.h>
-+#include <linux/of_device.h>
-+#include <linux/of_irq.h>
-+#include <linux/of_gpio.h>
-+#include <linux/of_mdio.h>
-+#include <linux/clk.h>
-+#include <linux/mfd/syscon.h>
-+#include <linux/regulator/consumer.h>
-+#include <linux/pm_runtime.h>
-+#include <linux/regmap.h>
-+#include <linux/reset.h>
-+#include <linux/mii.h>
-+#include <linux/interrupt.h>
-+#include <linux/netdevice.h>
-+#include <linux/dma-mapping.h>
-+#include <linux/phy.h>
-+#include <linux/ethtool.h>
-+#include <linux/version.h>
-+#include <linux/atomic.h>
-+
-+#include "mtk_eth_soc.h"
-+#include "gsw_mt7620.h"
-+#include "mt7530.h"
-+
-+#define ETHSYS_CLKCFG0			0x2c
-+#define ETHSYS_TRGMII_CLK_SEL362_5	BIT(11)
-+
-+void mt7530_mdio_w32(struct mt7620_gsw *gsw, u32 reg, u32 val)
-+{
-+	_mtk_mdio_write(gsw->eth, 0x1f, 0x1f, (reg >> 6) & 0x3ff);
-+	_mtk_mdio_write(gsw->eth, 0x1f, (reg >> 2) & 0xf,  val & 0xffff);
-+	_mtk_mdio_write(gsw->eth, 0x1f, 0x10, val >> 16);
-+}
-+
-+u32 mt7530_mdio_r32(struct mt7620_gsw *gsw, u32 reg)
-+{
-+	u16 high, low;
-+
-+	_mtk_mdio_write(gsw->eth, 0x1f, 0x1f, (reg >> 6) & 0x3ff);
-+	low = _mtk_mdio_read(gsw->eth, 0x1f, (reg >> 2) & 0xf);
-+	high = _mtk_mdio_read(gsw->eth, 0x1f, 0x10);
-+
-+	return (high << 16) | (low & 0xffff);
-+}
-+
-+void mt7530_mdio_m32(struct mt7620_gsw *gsw, u32 mask, u32 set, u32 reg)
-+{
-+	u32 val = mt7530_mdio_r32(gsw, reg);
-+
-+	val &= mask;
-+	val |= set;
-+	mt7530_mdio_w32(gsw, reg, val);
-+}
-+
-+void mtk_switch_w32(struct mt7620_gsw *gsw, u32 val, unsigned reg)
-+{
-+	mtk_w32(gsw->eth, val, reg + 0x10000);
-+}
-+
-+u32 mtk_switch_r32(struct mt7620_gsw *gsw, unsigned reg)
-+{
-+	return mtk_r32(gsw->eth, reg + 0x10000);
-+}
-+
-+void mtk_switch_m32(struct mt7620_gsw *gsw, u32 mask, u32 set, unsigned reg)
-+{
-+	u32 val = mtk_switch_r32(gsw, reg);
-+
-+	val &= mask;
-+	val |= set;
-+
-+	mtk_switch_w32(gsw, val, reg);
-+}
-+
-+int mt7623_gsw_config(struct mtk_eth *eth)
-+{
-+	if (eth->mii_bus && mdiobus_get_phy(eth->mii_bus, 0x1f))
-+		mt7530_probe(eth->dev, NULL, eth->mii_bus, 1);
-+
-+	return 0;
-+}
-+
-+static irqreturn_t gsw_interrupt_mt7623(int irq, void *_eth)
-+{
-+	struct mtk_eth *eth = (struct mtk_eth *)_eth;
-+	struct mt7620_gsw *gsw = (struct mt7620_gsw *)eth->sw_priv;
-+	u32 reg, i;
-+
-+	reg = mt7530_mdio_r32(gsw, 0x700c);
-+
-+	for (i = 0; i < 5; i++)
-+		if (reg & BIT(i)) {
-+			unsigned int link;
-+
-+			link = mt7530_mdio_r32(gsw,
-+					       0x3008 + (i * 0x100)) & 0x1;
-+
-+			if (link)
-+				dev_info(gsw->dev,
-+					 "port %d link up\n", i);
-+			else
-+				dev_info(gsw->dev,
-+					 "port %d link down\n", i);
-+		}
-+
-+//	mt7620_handle_carrier(eth);
-+	mt7530_mdio_w32(gsw, 0x700c, 0x1f);
-+
-+	return IRQ_HANDLED;
-+}
-+
-+static void wait_loop(struct mt7620_gsw *gsw)
-+{
-+	int i;
-+	int read_data;
-+
-+	for (i = 0; i < 320; i = i + 1)
-+		read_data = mtk_switch_r32(gsw, 0x610);
-+}
-+
-+static void trgmii_calibration_7623(struct mt7620_gsw *gsw)
-+{
-+
-+	unsigned int tap_a[5] = { 0, 0, 0, 0, 0 };	/* minumum delay for all correct */
-+	unsigned int tap_b[5] = { 0, 0, 0, 0, 0 };	/* maximum delay for all correct */
-+	unsigned int final_tap[5];
-+	unsigned int rxc_step_size;
-+	unsigned int rxd_step_size;
-+	unsigned int read_data;
-+	unsigned int tmp;
-+	unsigned int rd_wd;
-+	int i;
-+	unsigned int err_cnt[5];
-+	unsigned int init_toggle_data;
-+	unsigned int err_flag[5];
-+	unsigned int err_total_flag;
-+	unsigned int training_word;
-+	unsigned int rd_tap;
-+	u32 val;
-+
-+	u32 TRGMII_7623_base;
-+	u32 TRGMII_7623_RD_0;
-+	u32 TRGMII_RCK_CTRL;
-+
-+	TRGMII_7623_base = 0x300;	/* 0xFB110300 */
-+	TRGMII_7623_RD_0 = TRGMII_7623_base + 0x10;
-+	TRGMII_RCK_CTRL = TRGMII_7623_base;
-+	rxd_step_size = 0x1;
-+	rxc_step_size = 0x4;
-+	init_toggle_data = 0x00000055;
-+	training_word = 0x000000AC;
-+
-+	/* RX clock gating in MT7623 */
-+	mtk_switch_m32(gsw, 0x3fffffff, 0, TRGMII_7623_base + 0x04);
-+
-+	/* Assert RX  reset in MT7623 */
-+	mtk_switch_m32(gsw, 0, 0x80000000, TRGMII_7623_base + 0x00);
-+
-+	/* Set TX OE edge in  MT7623 */
-+	mtk_switch_m32(gsw, 0, 0x00002000, TRGMII_7623_base + 0x78);
-+
-+	/* Disable RX clock gating in MT7623 */
-+	mtk_switch_m32(gsw, 0, 0xC0000000, TRGMII_7623_base + 0x04);
-+
-+	/* Release RX reset in MT7623 */
-+	mtk_switch_m32(gsw, 0x7fffffff, 0, TRGMII_7623_base);
-+
-+	for (i = 0; i < 5; i++)
-+		mtk_switch_m32(gsw, 0, 0x80000000, TRGMII_7623_RD_0 + i * 8);
-+
-+	pr_err("Enable Training Mode in MT7530\n");
-+	read_data = mt7530_mdio_r32(gsw, 0x7A40);
-+	read_data |= 0xC0000000;
-+	mt7530_mdio_w32(gsw, 0x7A40, read_data);	/* Enable Training Mode in MT7530 */
-+	err_total_flag = 0;
-+	pr_err("Adjust RXC delay in MT7623\n");
-+	read_data = 0x0;
-+	while (err_total_flag == 0 && read_data != 0x68) {
-+		pr_err("2nd Enable EDGE CHK in MT7623\n");
-+		/* Enable EDGE CHK in MT7623 */
-+		for (i = 0; i < 5; i++)
-+			    mtk_switch_m32(gsw, 0x4fffffff, 0x40000000, TRGMII_7623_RD_0 + i * 8);
-+
-+		wait_loop(gsw);
-+		err_total_flag = 1;
-+		for (i = 0; i < 5; i++) {
-+			err_cnt[i] =
-+			    mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8) >> 8;
-+			err_cnt[i] &= 0x0000000f;
-+			rd_wd = mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8) >> 16;
-+			rd_wd &= 0x000000ff;
-+			val = mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8);
-+			pr_err("ERR_CNT = %d, RD_WD =%x, TRGMII_7623_RD_0=%x\n",
-+			       err_cnt[i], rd_wd, val);
-+			if (err_cnt[i] != 0) {
-+				err_flag[i] = 1;
-+			} else if (rd_wd != 0x55) {
-+				err_flag[i] = 1;
-+			} else {
-+				err_flag[i] = 0;
-+			}
-+			err_total_flag = err_flag[i] & err_total_flag;
-+		}
-+
-+		pr_err("2nd Disable EDGE CHK in MT7623\n");
-+		/* Disable EDGE CHK in MT7623 */
-+		for (i = 0; i < 5; i++)
-+			    mtk_switch_m32(gsw, 0x4fffffff, 0x40000000, TRGMII_7623_RD_0 + i * 8);
-+		wait_loop(gsw);
-+		pr_err("2nd Disable EDGE CHK in MT7623\n");
-+		/* Adjust RXC delay */
-+		/* RX clock gating in MT7623 */
-+		mtk_switch_m32(gsw, 0x3fffffff, 0, TRGMII_7623_base + 0x04);
-+		read_data = mtk_switch_r32(gsw, TRGMII_7623_base);
-+		if (err_total_flag == 0) {
-+			tmp = (read_data & 0x0000007f) + rxc_step_size;
-+			pr_err(" RXC delay = %d\n", tmp); 
-+			read_data >>= 8;
-+			read_data &= 0xffffff80;
-+			read_data |= tmp;
-+			read_data <<= 8;
-+			read_data &= 0xffffff80;
-+			read_data |= tmp;
-+			mtk_switch_w32(gsw, read_data, TRGMII_7623_base);
-+		} else {
-+			tmp = (read_data & 0x0000007f) + 16;
-+			pr_err(" RXC delay = %d\n", tmp); 
-+			read_data >>= 8;
-+			read_data &= 0xffffff80;
-+			read_data |= tmp;
-+			read_data <<= 8;
-+			read_data &= 0xffffff80;
-+			read_data |= tmp;
-+			mtk_switch_w32(gsw, read_data, TRGMII_7623_base);
-+		}
-+		read_data &= 0x000000ff;
-+
-+		/* Disable RX clock gating in MT7623 */
-+		mtk_switch_m32(gsw, 0, 0xC0000000, TRGMII_7623_base + 0x04);
-+		for (i = 0; i < 5; i++)
-+			mtk_switch_m32(gsw, 0, 0x80000000, TRGMII_7623_RD_0 + i * 8);
-+	}
-+
-+	/* Read RD_WD MT7623 */
-+	for (i = 0; i < 5; i++) {
-+		rd_tap = 0;
-+		while (err_flag[i] != 0 && rd_tap != 128) {
-+			/* Enable EDGE CHK in MT7623 */
-+			mtk_switch_m32(gsw, 0x4fffffff, 0x40000000, TRGMII_7623_RD_0 + i * 8);
-+			wait_loop(gsw);
-+
-+			read_data = mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8);
-+			err_cnt[i] = (read_data >> 8) & 0x0000000f;	/* Read MT7623 Errcnt */
-+			rd_wd = (read_data >> 16) & 0x000000ff;
-+			if (err_cnt[i] != 0 || rd_wd != 0x55) {
-+				err_flag[i] = 1;
-+			} else {
-+				err_flag[i] = 0;
-+			}
-+			/* Disable EDGE CHK in MT7623 */
-+			mtk_switch_m32(gsw, 0x4fffffff, 0x40000000, TRGMII_7623_RD_0 + i * 8);
-+			wait_loop(gsw);
-+			if (err_flag[i] != 0) {
-+				rd_tap = (read_data & 0x0000007f) + rxd_step_size;	/* Add RXD delay in MT7623 */
-+				read_data = (read_data & 0xffffff80) | rd_tap;
-+				mtk_switch_w32(gsw, read_data,
-+					TRGMII_7623_RD_0 + i * 8);
-+				tap_a[i] = rd_tap;
-+			} else {
-+				rd_tap = (read_data & 0x0000007f) + 48;
-+				read_data = (read_data & 0xffffff80) | rd_tap;
-+				mtk_switch_w32(gsw, read_data,
-+					TRGMII_7623_RD_0 + i * 8);
-+			}
-+
-+		}
-+		pr_err("MT7623 %dth bit  Tap_a = %d\n", i, tap_a[i]);
-+	}
-+	/* pr_err("Last While Loop\n"); */
-+	for (i = 0; i < 5; i++) {
-+		while ((err_flag[i] == 0) && (rd_tap != 128)) {
-+			read_data = mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8);
-+			rd_tap = (read_data & 0x0000007f) + rxd_step_size;	/* Add RXD delay in MT7623 */
-+			read_data = (read_data & 0xffffff80) | rd_tap;
-+			mtk_switch_w32(gsw, read_data, TRGMII_7623_RD_0 + i * 8);
-+			/* Enable EDGE CHK in MT7623 */
-+			val =
-+			    mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8) | 0x40000000;
-+			val &= 0x4fffffff;
-+			mtk_switch_w32(gsw, val, TRGMII_7623_RD_0 + i * 8);
-+			wait_loop(gsw);
-+			read_data = mtk_switch_r32(gsw, TRGMII_7623_RD_0 + i * 8);
-+			err_cnt[i] = (read_data >> 8) & 0x0000000f;	/* Read MT7623 Errcnt */
-+			rd_wd = (read_data >> 16) & 0x000000ff;
-+			if (err_cnt[i] != 0 || rd_wd != 0x55) {
-+				err_flag[i] = 1;
-+			} else {
-+				err_flag[i] = 0;
-+			}
-+
-+			/* Disable EDGE CHK in MT7623 */
-+			mtk_switch_m32(gsw, 0x4fffffff, 0x40000000, TRGMII_7623_RD_0 + i * 8);
-+			wait_loop(gsw);
-+
-+		}
-+
-+		tap_b[i] = rd_tap;	/* -rxd_step_size; */
-+		pr_err("MT7623 %dth bit  Tap_b = %d\n", i, tap_b[i]);
-+		final_tap[i] = (tap_a[i] + tap_b[i]) / 2;	/* Calculate RXD delay = (TAP_A + TAP_B)/2 */
-+		read_data = (read_data & 0xffffff80) | final_tap[i];
-+		mtk_switch_w32(gsw, read_data, TRGMII_7623_RD_0 + i * 8);
-+	}
-+
-+	read_data = mt7530_mdio_r32(gsw, 0x7A40);
-+	read_data &= 0x3fffffff;
-+	mt7530_mdio_w32(gsw, 0x7A40, read_data);
-+}
-+
-+static void trgmii_calibration_7530(struct mt7620_gsw *gsw)
-+{
-+
-+	unsigned int tap_a[5] = { 0, 0, 0, 0, 0 };
-+	unsigned int tap_b[5] = { 0, 0, 0, 0, 0 };
-+	unsigned int final_tap[5];
-+	unsigned int rxc_step_size;
-+	unsigned int rxd_step_size;
-+	unsigned int read_data;
-+	unsigned int tmp = 0;
-+	int i;
-+	unsigned int err_cnt[5];
-+	unsigned int rd_wd;
-+	unsigned int init_toggle_data;
-+	unsigned int err_flag[5];
-+	unsigned int err_total_flag;
-+	unsigned int training_word;
-+	unsigned int rd_tap;
-+
-+	u32 TRGMII_7623_base;
-+	u32 TRGMII_7530_RD_0;
-+	u32 TRGMII_RCK_CTRL;
-+	u32 TRGMII_7530_base;
-+	u32 TRGMII_7530_TX_base;
-+	u32 val;
-+
-+	TRGMII_7623_base = 0x300;
-+	TRGMII_7530_base = 0x7A00;
-+	TRGMII_7530_RD_0 = TRGMII_7530_base + 0x10;
-+	TRGMII_RCK_CTRL = TRGMII_7623_base;
-+	rxd_step_size = 0x1;
-+	rxc_step_size = 0x8;
-+	init_toggle_data = 0x00000055;
-+	training_word = 0x000000AC;
-+
-+	TRGMII_7530_TX_base = TRGMII_7530_base + 0x50;
-+
-+	/* pr_err("Calibration begin ........\n"); */
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x40) | 0x80000000;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x40);
-+	read_data = mt7530_mdio_r32(gsw, 0x7a10);
-+	/* pr_err("TRGMII_7530_RD_0 is %x\n", read_data); */
-+
-+	read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base + 0x04);
-+	read_data &= 0x3fffffff;
-+	mt7530_mdio_w32(gsw, TRGMII_7530_base + 0x04, read_data);	/* RX clock gating in MT7530 */
-+
-+	read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base + 0x78);
-+	read_data |= 0x00002000;
-+	mt7530_mdio_w32(gsw, TRGMII_7530_base + 0x78, read_data);	/* Set TX OE edge in  MT7530 */
-+
-+	read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base);
-+	read_data |= 0x80000000;
-+	mt7530_mdio_w32(gsw, TRGMII_7530_base, read_data);	/* Assert RX  reset in MT7530 */
-+
-+	read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base);
-+	read_data &= 0x7fffffff;
-+	mt7530_mdio_w32(gsw, TRGMII_7530_base, read_data);	/* Release RX reset in MT7530 */
-+
-+	read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base + 0x04);
-+	read_data |= 0xC0000000;
-+	mt7530_mdio_w32(gsw, TRGMII_7530_base + 0x04, read_data);	/* Disable RX clock gating in MT7530 */
-+
-+	/* pr_err("Enable Training Mode in MT7623\n"); */
-+	/*Enable Training Mode in MT7623 */
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x40) | 0x80000000;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x40);
-+	if (gsw->trgmii_force == 2000) {
-+		val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x40) | 0xC0000000;
-+		mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x40);
-+	} else {
-+		val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x40) | 0x80000000;
-+		mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x40);
-+	}
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x078) & 0xfffff0ff;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x078);
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x50) & 0xfffff0ff;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x50);
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x58) & 0xfffff0ff;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x58);
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x60) & 0xfffff0ff;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x60);
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x68) & 0xfffff0ff;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x68);
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x70) & 0xfffff0ff;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x70);
-+	val = mtk_switch_r32(gsw, TRGMII_7623_base + 0x78) & 0x00000800;
-+	mtk_switch_w32(gsw, val, TRGMII_7623_base + 0x78);
-+	err_total_flag = 0;
-+	/* pr_err("Adjust RXC delay in MT7530\n"); */
-+	read_data = 0x0;
-+	while (err_total_flag == 0 && (read_data != 0x68)) {
-+		/* pr_err("2nd Enable EDGE CHK in MT7530\n"); */
-+		/* Enable EDGE CHK in MT7530 */
-+		for (i = 0; i < 5; i++) {
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			read_data |= 0x40000000;
-+			read_data &= 0x4fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+					read_data);
-+			wait_loop(gsw);
-+			/* pr_err("2nd Disable EDGE CHK in MT7530\n"); */
-+			err_cnt[i] =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			/* pr_err("***** MT7530 %dth bit ERR_CNT =%x\n",i, err_cnt[i]); */
-+			/* pr_err("MT7530 %dth bit ERR_CNT =%x\n",i, err_cnt[i]); */
-+			err_cnt[i] >>= 8;
-+			err_cnt[i] &= 0x0000ff0f;
-+			rd_wd = err_cnt[i] >> 8;
-+			rd_wd &= 0x000000ff;
-+			err_cnt[i] &= 0x0000000f;
-+			/* read_data = mt7530_mdio_r32(gsw,0x7a10,&read_data); */
-+			if (err_cnt[i] != 0) {
-+				err_flag[i] = 1;
-+			} else if (rd_wd != 0x55) {
-+				err_flag[i] = 1;
-+			} else {
-+				err_flag[i] = 0;
-+			}
-+			if (i == 0) {
-+				err_total_flag = err_flag[i];
-+			} else {
-+				err_total_flag = err_flag[i] & err_total_flag;
-+			}
-+			/* Disable EDGE CHK in MT7530 */
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			read_data |= 0x40000000;
-+			read_data &= 0x4fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+					read_data);
-+			wait_loop(gsw);
-+		}
-+		/*Adjust RXC delay */
-+		if (err_total_flag == 0) {
-+			read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base);
-+			read_data |= 0x80000000;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_base, read_data);	/* Assert RX  reset in MT7530 */
-+
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_base + 0x04);
-+			read_data &= 0x3fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_base + 0x04, read_data);	/* RX clock gating in MT7530 */
-+
-+			read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base);
-+			tmp = read_data;
-+			tmp &= 0x0000007f;
-+			tmp += rxc_step_size;
-+			/* pr_err("Current rxc delay = %d\n", tmp); */
-+			read_data &= 0xffffff80;
-+			read_data |= tmp;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_base, read_data);
-+			read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base);
-+			/* pr_err("Current RXC delay = %x\n", read_data); */
-+
-+			read_data = mt7530_mdio_r32(gsw, TRGMII_7530_base);
-+			read_data &= 0x7fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_base, read_data);	/* Release RX reset in MT7530 */
-+
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_base + 0x04);
-+			read_data |= 0xc0000000;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_base + 0x04, read_data);	/* Disable RX clock gating in MT7530 */
-+			pr_err("####### MT7530 RXC delay is %d\n", tmp);
-+		}
-+		read_data = tmp;
-+	}
-+	pr_err("Finish RXC Adjustment while loop\n");
-+
-+	/* pr_err("Read RD_WD MT7530\n"); */
-+	/* Read RD_WD MT7530 */
-+	for (i = 0; i < 5; i++) {
-+		rd_tap = 0;
-+		while (err_flag[i] != 0 && rd_tap != 128) {
-+			/* Enable EDGE CHK in MT7530 */
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			read_data |= 0x40000000;
-+			read_data &= 0x4fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+					read_data);
-+			wait_loop(gsw);
-+			err_cnt[i] = (read_data >> 8) & 0x0000000f;
-+			rd_wd = (read_data >> 16) & 0x000000ff;
-+			if (err_cnt[i] != 0 || rd_wd != 0x55) {
-+				err_flag[i] = 1;
-+			} else {
-+				err_flag[i] = 0;
-+			}
-+			if (err_flag[i] != 0) {
-+				rd_tap = (read_data & 0x0000007f) + rxd_step_size;	/* Add RXD delay in MT7530 */
-+				read_data = (read_data & 0xffffff80) | rd_tap;
-+				mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+						read_data);
-+				tap_a[i] = rd_tap;
-+			} else {
-+				tap_a[i] = (read_data & 0x0000007f);	/* Record the min delay TAP_A */
-+				rd_tap = tap_a[i] + 0x4;
-+				read_data = (read_data & 0xffffff80) | rd_tap;
-+				mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+						read_data);
-+			}
-+
-+			/* Disable EDGE CHK in MT7530 */
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			read_data |= 0x40000000;
-+			read_data &= 0x4fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+					read_data);
-+			wait_loop(gsw);
-+
-+		}
-+		pr_err("MT7530 %dth bit  Tap_a = %d\n", i, tap_a[i]);
-+	}
-+
-+	/* pr_err("Last While Loop\n"); */
-+	for (i = 0; i < 5; i++) {
-+		rd_tap = 0;
-+		while (err_flag[i] == 0 && (rd_tap != 128)) {
-+			/* Enable EDGE CHK in MT7530 */
-+			read_data = mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			read_data |= 0x40000000;
-+			read_data &= 0x4fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+					read_data);
-+			wait_loop(gsw);
-+			err_cnt[i] = (read_data >> 8) & 0x0000000f;
-+			rd_wd = (read_data >> 16) & 0x000000ff;
-+			if (err_cnt[i] != 0 || rd_wd != 0x55)
-+				err_flag[i] = 1;
-+			else
-+				err_flag[i] = 0;
-+
-+			if (err_flag[i] == 0 && (rd_tap != 128)) {
-+				/* Add RXD delay in MT7530 */
-+				rd_tap = (read_data & 0x0000007f) + rxd_step_size;
-+				read_data = (read_data & 0xffffff80) | rd_tap;
-+				mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+						read_data);
-+			}
-+			/* Disable EDGE CHK in MT7530 */
-+			read_data =
-+			    mt7530_mdio_r32(gsw, TRGMII_7530_RD_0 + i * 8);
-+			read_data |= 0x40000000;
-+			read_data &= 0x4fffffff;
-+			mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8,
-+					read_data);
-+			wait_loop(gsw);
-+		}
-+		tap_b[i] = rd_tap;	/* - rxd_step_size; */
-+		pr_err("MT7530 %dth bit  Tap_b = %d\n", i, tap_b[i]);
-+		/* Calculate RXD delay = (TAP_A + TAP_B)/2 */
-+		final_tap[i] = (tap_a[i] + tap_b[i]) / 2;	
-+		/* pr_err("########****** MT7530 %dth bit Final Tap = %d\n", i, final_tap[i]); */
-+
-+		read_data = (read_data & 0xffffff80) | final_tap[i];
-+		mt7530_mdio_w32(gsw, TRGMII_7530_RD_0 + i * 8, read_data);
-+	}
-+
-+	if (gsw->trgmii_force == 2000)
-+		mtk_switch_m32(gsw, 0x7fffffff, 0, TRGMII_7623_base + 0x40);
-+	else
-+		mtk_switch_m32(gsw, 0x3fffffff, 0, TRGMII_7623_base + 0x40);
-+
-+}
-+
-+static void mt7530_trgmii_clock_setting(struct mt7620_gsw *gsw, u32 xtal_mode)
-+{
-+
-+	u32 regValue;
-+
-+	/* TRGMII Clock */
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x410);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x1);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x404);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+
-+	if (xtal_mode == 1) {
-+		/* 25MHz */
-+		if (gsw->trgmii_force == 2600)
-+			/* 325MHz */
-+			_mtk_mdio_write(gsw->eth, 0, 14, 0x1a00);
-+		else if (gsw->trgmii_force == 2000)
-+			/* 250MHz */
-+			_mtk_mdio_write(gsw->eth, 0, 14, 0x1400);
-+	} else if (xtal_mode == 2) {
-+		/* 40MHz */
-+		if (gsw->trgmii_force == 2600)
-+			/* 325MHz */
-+			_mtk_mdio_write(gsw->eth, 0, 14, 0x1040);
-+		else if (gsw->trgmii_force == 2000)
-+			/* 250MHz */
-+			_mtk_mdio_write(gsw->eth, 0, 14, 0x0c80);
-+	}
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x405);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x0);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x409);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	if (xtal_mode == 1)
-+		/* 25MHz */
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x0057);
-+	else
-+		/* 40MHz */
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x0087);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x40a);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	if (xtal_mode == 1)
-+		/* 25MHz */
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x0057);
-+	else
-+		/* 40MHz */
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x0087);
-+
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x403);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x1800);
-+
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x403);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x1c00);
-+
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x401);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0xc020);
-+
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x406);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0xa030);
-+
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x406);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0xa038);
-+
-+//	udelay(120);		/* for MT7623 bring up test */
-+
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x410);
-+	_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x3);
-+
-+	regValue = mt7530_mdio_r32(gsw, 0x7830);
-+	regValue &= 0xFFFFFFFC;
-+	regValue |= 0x00000001;
-+	mt7530_mdio_w32(gsw, 0x7830, regValue);
-+
-+	regValue = mt7530_mdio_r32(gsw, 0x7a40);
-+	regValue &= ~(0x1 << 30);
-+	regValue &= ~(0x1 << 28);
-+	mt7530_mdio_w32(gsw, 0x7a40, regValue);
-+
-+	mt7530_mdio_w32(gsw, 0x7a78, 0x55);
-+//	udelay(100);		/* for mt7623 bring up test */
-+
-+	mtk_switch_m32(gsw, 0x7fffffff, 0, 0x300);
-+
-+	trgmii_calibration_7623(gsw);
-+	trgmii_calibration_7530(gsw);
-+
-+	mtk_switch_m32(gsw, 0, 0x80000000, 0x300);
-+	mtk_switch_m32(gsw, 0, 0x7fffffff, 0x300);
-+
-+	/*MT7530 RXC reset */
-+	regValue = mt7530_mdio_r32(gsw, 0x7a00);
-+	regValue |= (0x1 << 31);
-+	mt7530_mdio_w32(gsw, 0x7a00, regValue);
-+	mdelay(1);
-+	regValue &= ~(0x1 << 31);
-+	mt7530_mdio_w32(gsw, 0x7a00, regValue);
-+	mdelay(100);
-+}
-+
-+static void mt7623_hw_init(struct mtk_eth *eth, struct mt7620_gsw *gsw, struct device_node *np)
-+{
-+       u32     i;
-+       u32     val;
-+       u32     xtal_mode;
-+
-+	regmap_update_bits(gsw->ethsys, ETHSYS_CLKCFG0,
-+			   ETHSYS_TRGMII_CLK_SEL362_5,
-+			   ETHSYS_TRGMII_CLK_SEL362_5);
-+
-+	/* reset the TRGMII core */
-+	mtk_switch_m32(gsw, 0, INTF_MODE_TRGMII, GSW_INTF_MODE);
-+	/* Assert MT7623 RXC reset */
-+	mtk_switch_m32(gsw, 0, TRGMII_RCK_CTRL_RX_RST, GSW_TRGMII_RCK_CTRL);
-+
-+	/* Hardware reset Switch */
-+	device_reset(eth->dev);
-+
-+	/* Wait for Switch Reset Completed*/
-+	for (i = 0; i < 100; i++) {
-+		mdelay(10);
-+		if (mt7530_mdio_r32(gsw, MT7530_HWTRAP))
-+			break;
-+	}
-+
-+	/* turn off all PHYs */
-+	for (i = 0; i <= 4; i++) {
-+		val = _mtk_mdio_read(gsw->eth, i, 0x0);
-+		val |= BIT(11);
-+		_mtk_mdio_write(gsw->eth, i, 0x0, val);
-+	}
-+
-+	/* reset the switch */
-+	mt7530_mdio_w32(gsw, MT7530_SYS_CTRL,
-+			SYS_CTRL_SW_RST | SYS_CTRL_REG_RST);
-+	udelay(100);
-+
-+	/* GE1, Force 1000M/FD, FC ON */
-+	mt7530_mdio_w32(gsw, MT7530_PMCR_P(6), PMCR_FIXED_LINK_FC);
-+
-+	/* GE2, Force 1000M/FD, FC ON */
-+	mt7530_mdio_w32(gsw, MT7530_PMCR_P(5), PMCR_FIXED_LINK_FC);
-+
-+	/* Enable Port 6, P5 as GMAC5, P5 disable */
-+	val = mt7530_mdio_r32(gsw, MT7530_MHWTRAP);
-+	if (gsw->eth->mac[0] &&
-+	    of_phy_is_fixed_link(gsw->eth->mac[0]->of_node))
-+		/* Enable Port 6 */
-+		val &= ~MHWTRAP_P6_DIS;
-+	else
-+		/* Disable Port 6 */
-+		val |= MHWTRAP_P6_DIS;
-+	if (gsw->eth->mac[1] &&
-+	    of_phy_is_fixed_link(gsw->eth->mac[1]->of_node)) {
-+		/* Enable Port 5 */
-+		val &= ~MHWTRAP_P5_DIS;
-+		/* Port 5 as PHY */
-+		val &= ~MHWTRAP_P5_MAC_SEL;
-+	} else {
-+		/* Disable Port 5 */
-+		val |= MHWTRAP_P5_DIS;
-+		/* Port 5 as GMAC */
-+		val |= MHWTRAP_P5_MAC_SEL;
-+		val |= BIT(7);
-+		mt7530_mdio_w32(gsw, MT7530_PMCR_P(5), 0x8000);
-+	}
-+	/* gphy to port 0/4 */
-+	if (gsw->wllll)
-+		val |= BIT(20);
-+	else
-+		val &= ~BIT(20);
-+
-+	/* Set MT7530 phy direct access mode**/
-+	val &= ~MHWTRAP_PHY_ACCESS;
-+	/* manual override of HW-Trap */
-+	val |= MHWTRAP_MANUAL;
-+	mt7530_mdio_w32(gsw, MT7530_MHWTRAP, val);
-+	dev_info(gsw->dev, "Setting MHWTRAP to 0x%08x\n", val);
-+
-+	val = mt7530_mdio_r32(gsw, 0x7800);
-+	val = (val >> 9) & 0x3;
-+	if (val == 0x3) {
-+		xtal_mode = 1;
-+		/* 25Mhz Xtal - do nothing */
-+	} else if (val == 0x2) {
-+		/* 40Mhz */
-+		xtal_mode = 2;
-+
-+		/* disable MT7530 core clock */
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x410);
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x0);
-+
-+		/* disable MT7530 PLL */
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x40d);
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x2020);
-+
-+		/* for MT7530 core clock = 500Mhz */
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x40e);
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x119);
-+
-+		/* enable MT7530 PLL */
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x40d);
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x2820);
-+
-+		udelay(20);
-+
-+		/* enable MT7530 core clock */
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x1f);
-+		_mtk_mdio_write(gsw->eth, 0, 14, 0x410);
-+		_mtk_mdio_write(gsw->eth, 0, 13, 0x401f);
-+	} else {
-+		xtal_mode = 3;
-+		/* 20Mhz Xtal - TODO */
-+	}
-+
-+	/* RGMII */
-+	_mtk_mdio_write(gsw->eth, 0, 14, 0x1);
-+
-+	/* set MT7530 central align */
-+	val = mt7530_mdio_r32(gsw, 0x7830);
-+	val &= ~1;
-+	val |= 1<<1;
-+	mt7530_mdio_w32(gsw, 0x7830, val);
-+
-+	val = mt7530_mdio_r32(gsw, 0x7a40);
-+	val &= ~(1<<30);
-+	mt7530_mdio_w32(gsw, 0x7a40, val);
-+
-+	mt7530_mdio_w32(gsw, 0x7a78, 0x855);
-+
-+	/* delay setting for 10/1000M */
-+	mt7530_mdio_w32(gsw, 0x7b00, 0x104);
-+	mt7530_mdio_w32(gsw, 0x7b04, 0x10);
-+
-+	/* lower Tx Driving */
-+	mt7530_mdio_w32(gsw, 0x7a54, 0x88);
-+	mt7530_mdio_w32(gsw, 0x7a5c, 0x88);
-+	mt7530_mdio_w32(gsw, 0x7a64, 0x88);
-+	mt7530_mdio_w32(gsw, 0x7a6c, 0x88);
-+	mt7530_mdio_w32(gsw, 0x7a74, 0x88);
-+	mt7530_mdio_w32(gsw, 0x7a7c, 0x88);
-+	mt7530_mdio_w32(gsw, 0x7810, 0x11);
-+
-+	/* Set MT7623/MT7683 TX Driving */
-+	mtk_switch_w32(gsw, 0x88, 0x354);
-+	mtk_switch_w32(gsw, 0x88, 0x35c);
-+	mtk_switch_w32(gsw, 0x88, 0x364);
-+	mtk_switch_w32(gsw, 0x88, 0x36c);
-+	mtk_switch_w32(gsw, 0x88, 0x374);
-+	mtk_switch_w32(gsw, 0x88, 0x37c);
-+
-+	/* Set GE2 driving and slew rate */
-+	regmap_write(gsw->pctl, 0xF00, 0xe00);
-+	/* set GE2 TDSEL */
-+	regmap_write(gsw->pctl, 0x4C0, 0x5);
-+	/* set GE2 TUNE */
-+	regmap_write(gsw->pctl, 0xED0, 0x0);
-+
-+	regmap_write(gsw->pctl, 0xb70, 0);
-+	regmap_write(gsw->pctl, 0x250, 0xffff);
-+	regmap_write(gsw->pctl, 0x260, 0xff);
-+	regmap_write(gsw->pctl, 0x380, 0x37);
-+	regmap_write(gsw->pctl, 0x390, 0x40);
-+
-+	mt7530_trgmii_clock_setting(gsw, xtal_mode);
-+
-+	//LANWANPartition(gsw);
-+
-+	/* disable EEE */
-+	for (i = 0; i <= 4; i++) {
-+		_mtk_mdio_write(gsw->eth, i, 13, 0x7);
-+		_mtk_mdio_write(gsw->eth, i, 14, 0x3C);
-+		_mtk_mdio_write(gsw->eth, i, 13, 0x4007);
-+		_mtk_mdio_write(gsw->eth, i, 14, 0x0);
-+
-+		/* Increase SlvDPSready time */
-+		_mtk_mdio_write(gsw->eth, i, 31, 0x52b5);
-+		_mtk_mdio_write(gsw->eth, i, 16, 0xafae);
-+		_mtk_mdio_write(gsw->eth, i, 18, 0x2f);
-+		_mtk_mdio_write(gsw->eth, i, 16, 0x8fae);
-+
-+		/* Incease post_update_timer */
-+		_mtk_mdio_write(gsw->eth, i, 31, 0x3);
-+		_mtk_mdio_write(gsw->eth, i, 17, 0x4b);
-+
-+		/* Adjust 100_mse_threshold */
-+		_mtk_mdio_write(gsw->eth, i, 13, 0x1e);
-+		_mtk_mdio_write(gsw->eth, i, 14, 0x123);
-+		_mtk_mdio_write(gsw->eth, i, 13, 0x401e);
-+		_mtk_mdio_write(gsw->eth, i, 14, 0xffff);
-+
-+		/* Disable mcc */
-+		_mtk_mdio_write(gsw->eth, i, 13, 0x1e);
-+		_mtk_mdio_write(gsw->eth, i, 14, 0xa6);
-+		_mtk_mdio_write(gsw->eth, i, 13, 0x401e);
-+		_mtk_mdio_write(gsw->eth, i, 14, 0x300);
-+
-+		/* Disable HW auto downshift*/
-+		_mtk_mdio_write(gsw->eth, i, 31, 0x1);
-+		val = _mtk_mdio_read(gsw->eth, i, 0x14);
-+		val &= ~(1<<4);
-+		_mtk_mdio_write(gsw->eth, i, 0x14, val);
-+	}
-+
-+	/* turn on all PHYs */
-+	for (i = 0; i <= 4; i++) {
-+		val = _mtk_mdio_read(gsw->eth, i, 0);
-+		val &= ~BIT(11);
-+		_mtk_mdio_write(gsw->eth, i, 0, val);
-+	}
-+
-+	/* enable irq */
-+	mt7530_mdio_m32(gsw, 0, TOP_SIG_CTRL_NORMAL, MT7530_TOP_SIG_CTRL);
-+}
-+
-+static const struct of_device_id mediatek_gsw_match[] = {
-+	{ .compatible = "mediatek,mt7623-gsw" },
-+	{},
-+};
-+MODULE_DEVICE_TABLE(of, mediatek_gsw_match);
-+
-+int mtk_gsw_init(struct mtk_eth *eth)
-+{
-+	struct device_node *np = eth->switch_np;
-+	struct platform_device *pdev = of_find_device_by_node(np);
-+	struct mt7620_gsw *gsw;
-+
-+	if (!pdev)
-+		return -ENODEV;
-+
-+	if (!of_device_is_compatible(np, mediatek_gsw_match->compatible))
-+		return -EINVAL;
-+
-+	gsw = platform_get_drvdata(pdev);
-+	if (!gsw)
-+		return -ENODEV;
-+	gsw->eth = eth;
-+	eth->sw_priv = gsw;
-+
-+	mt7623_hw_init(eth, gsw, np);
-+
-+	if (request_threaded_irq(gsw->irq, gsw_interrupt_mt7623, NULL, 0,
-+				 "gsw", eth))
-+		pr_err("fail to request irq\n");
-+	mt7530_mdio_w32(gsw, 0x7008, 0x1f);
-+
-+	return 0;
-+}
-+
-+static int mt7623_gsw_probe(struct platform_device *pdev)
-+{
-+	struct device_node *np = pdev->dev.of_node;
-+	struct device_node *pctl;
-+	int reset_pin, ret;
-+	struct mt7620_gsw *gsw;
-+	struct regulator *supply;
-+
-+	gsw = devm_kzalloc(&pdev->dev, sizeof(struct mt7620_gsw), GFP_KERNEL);
-+	if (!gsw)
-+		return -ENOMEM;
-+
-+	gsw->dev = &pdev->dev;
-+	gsw->trgmii_force = 2000;
-+	gsw->irq = irq_of_parse_and_map(np, 0);
-+	if (gsw->irq < 0)
-+		return -EINVAL;
-+
-+	gsw->ethsys = syscon_regmap_lookup_by_phandle(np, "mediatek,ethsys");
-+	if (IS_ERR(gsw->ethsys))
-+		return PTR_ERR(gsw->ethsys);
-+
-+	reset_pin = of_get_named_gpio(np, "mediatek,reset-pin", 0);
-+	if (reset_pin < 0)
-+		return reset_pin;
-+
-+	pctl = of_parse_phandle(np, "mediatek,pctl-regmap", 0);
-+	if (IS_ERR(pctl))
-+		return PTR_ERR(pctl);
-+
-+	gsw->pctl = syscon_node_to_regmap(pctl);
-+	if (IS_ERR(pctl))
-+		return PTR_ERR(pctl);
-+
-+	ret = devm_gpio_request(&pdev->dev, reset_pin, "mt7530-reset");
-+	if (ret)
-+		return ret;
-+
-+	gsw->clk_trgpll = devm_clk_get(&pdev->dev, "trgpll");
-+
-+	if (IS_ERR(gsw->clk_trgpll))
-+		return -ENODEV;
-+
-+	supply = devm_regulator_get(&pdev->dev, "mt7530");
-+	if (IS_ERR(supply))
-+		return PTR_ERR(supply);
-+
-+	regulator_set_voltage(supply, 1000000, 1000000);
-+	ret = regulator_enable(supply);
-+	if (ret) {
-+		dev_err(&pdev->dev, "Failed to enable reg-7530: %d\n", ret);
-+		return ret;
-+	}
-+
-+	gsw->wllll = of_property_read_bool(np, "mediatek,wllll");
-+
-+	pm_runtime_enable(&pdev->dev);
-+	pm_runtime_get_sync(&pdev->dev);
-+
-+	ret = clk_set_rate(gsw->clk_trgpll, 500000000);
-+	if (ret)
-+		return ret;
-+
-+	regmap_write(gsw->ethsys, 0x34, 0x800000);
-+	regmap_write(gsw->ethsys, 0x34, 0x0);
-+
-+	clk_prepare_enable(gsw->clk_trgpll);
-+
-+	gpio_direction_output(reset_pin, 0);
-+	udelay(1000);
-+	gpio_set_value(reset_pin, 1);
-+	mdelay(100);
-+
-+	platform_set_drvdata(pdev, gsw);
-+
-+	return 0;
-+}
-+
-+static int mt7623_gsw_remove(struct platform_device *pdev)
-+{
-+	struct mt7620_gsw *gsw = platform_get_drvdata(pdev);
-+
-+	clk_disable_unprepare(gsw->clk_trgpll);
-+
-+	pm_runtime_put_sync(&pdev->dev);
-+        pm_runtime_disable(&pdev->dev);
-+
-+	platform_set_drvdata(pdev, NULL);
-+
-+	return 0;
-+}
-+
-+static struct platform_driver gsw_driver = {
-+	.probe = mt7623_gsw_probe,
-+	.remove = mt7623_gsw_remove,
-+	.driver = {
-+		.name = "mt7623-gsw",
-+		.owner = THIS_MODULE,
-+		.of_match_table = mediatek_gsw_match,
-+	},
-+};
-+
-+module_platform_driver(gsw_driver);
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("John Crispin <blogic at openwrt.org>");
-+MODULE_DESCRIPTION("GBit switch driver for Mediatek MT7623 SoC");
---- /dev/null
-+++ b/drivers/net/ethernet/mediatek/mt7530.c
-@@ -0,0 +1,808 @@
-+/*
-+ * 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; either version 2
-+ * of the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * Copyright (C) 2013 John Crispin <blogic at openwrt.org>
-+ */
-+
-+#include <linux/if.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/list.h>
-+#include <linux/if_ether.h>
-+#include <linux/skbuff.h>
-+#include <linux/netdevice.h>
-+#include <linux/netlink.h>
-+#include <linux/bitops.h>
-+#include <net/genetlink.h>
-+#include <linux/switch.h>
-+#include <linux/delay.h>
-+#include <linux/phy.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/lockdep.h>
-+#include <linux/workqueue.h>
-+#include <linux/of_device.h>
-+
-+#include "mt7530.h"
-+
-+#define MT7530_CPU_PORT		6
-+#define MT7530_NUM_PORTS	8
-+#define MT7530_NUM_VLANS	16
-+#define MT7530_MAX_VID		4095
-+#define MT7530_MIN_VID		0
-+
-+/* registers */
-+#define REG_ESW_VLAN_VTCR		0x90
-+#define REG_ESW_VLAN_VAWD1		0x94
-+#define REG_ESW_VLAN_VAWD2		0x98
-+#define REG_ESW_VLAN_VTIM(x)	(0x100 + 4 * ((x) / 2))
-+
-+#define REG_ESW_VLAN_VAWD1_IVL_MAC	BIT(30)
-+#define REG_ESW_VLAN_VAWD1_VTAG_EN	BIT(28)
-+#define REG_ESW_VLAN_VAWD1_VALID	BIT(0)
-+
-+/* vlan egress mode */
-+enum {
-+	ETAG_CTRL_UNTAG	= 0,
-+	ETAG_CTRL_TAG	= 2,
-+	ETAG_CTRL_SWAP	= 1,
-+	ETAG_CTRL_STACK	= 3,
-+};
-+
-+#define REG_ESW_PORT_PCR(x)	(0x2004 | ((x) << 8))
-+#define REG_ESW_PORT_PVC(x)	(0x2010 | ((x) << 8))
-+#define REG_ESW_PORT_PPBV1(x)	(0x2014 | ((x) << 8))
-+
-+#define REG_HWTRAP		0x7804
-+
-+#define MIB_DESC(_s , _o, _n)   \
-+	{                       \
-+		.size = (_s),   \
-+		.offset = (_o), \
-+		.name = (_n),   \
-+	}
-+
-+struct mt7xxx_mib_desc {
-+	unsigned int size;
-+	unsigned int offset;
-+	const char *name;
-+};
-+
-+#define MT7621_MIB_COUNTER_BASE	0x4000
-+#define MT7621_MIB_COUNTER_PORT_OFFSET	0x100
-+#define MT7621_STATS_TDPC	0x00
-+#define MT7621_STATS_TCRC	0x04
-+#define MT7621_STATS_TUPC	0x08
-+#define MT7621_STATS_TMPC	0x0C
-+#define MT7621_STATS_TBPC	0x10
-+#define MT7621_STATS_TCEC	0x14
-+#define MT7621_STATS_TSCEC	0x18
-+#define MT7621_STATS_TMCEC	0x1C
-+#define MT7621_STATS_TDEC	0x20
-+#define MT7621_STATS_TLCEC	0x24
-+#define MT7621_STATS_TXCEC	0x28
-+#define MT7621_STATS_TPPC	0x2C
-+#define MT7621_STATS_TL64PC	0x30
-+#define MT7621_STATS_TL65PC	0x34
-+#define MT7621_STATS_TL128PC	0x38
-+#define MT7621_STATS_TL256PC	0x3C
-+#define MT7621_STATS_TL512PC	0x40
-+#define MT7621_STATS_TL1024PC	0x44
-+#define MT7621_STATS_TOC	0x48
-+#define MT7621_STATS_RDPC	0x60
-+#define MT7621_STATS_RFPC	0x64
-+#define MT7621_STATS_RUPC	0x68
-+#define MT7621_STATS_RMPC	0x6C
-+#define MT7621_STATS_RBPC	0x70
-+#define MT7621_STATS_RAEPC	0x74
-+#define MT7621_STATS_RCEPC	0x78
-+#define MT7621_STATS_RUSPC	0x7C
-+#define MT7621_STATS_RFEPC	0x80
-+#define MT7621_STATS_ROSPC	0x84
-+#define MT7621_STATS_RJEPC	0x88
-+#define MT7621_STATS_RPPC	0x8C
-+#define MT7621_STATS_RL64PC	0x90
-+#define MT7621_STATS_RL65PC	0x94
-+#define MT7621_STATS_RL128PC	0x98
-+#define MT7621_STATS_RL256PC	0x9C
-+#define MT7621_STATS_RL512PC	0xA0
-+#define MT7621_STATS_RL1024PC	0xA4
-+#define MT7621_STATS_ROC	0xA8
-+#define MT7621_STATS_RDPC_CTRL	0xB0
-+#define MT7621_STATS_RDPC_ING	0xB4
-+#define MT7621_STATS_RDPC_ARL	0xB8
-+
-+static const struct mt7xxx_mib_desc mt7621_mibs[] = {
-+	MIB_DESC(1, MT7621_STATS_TDPC, "TxDrop"),
-+	MIB_DESC(1, MT7621_STATS_TCRC, "TxCRC"),
-+	MIB_DESC(1, MT7621_STATS_TUPC, "TxUni"),
-+	MIB_DESC(1, MT7621_STATS_TMPC, "TxMulti"),
-+	MIB_DESC(1, MT7621_STATS_TBPC, "TxBroad"),
-+	MIB_DESC(1, MT7621_STATS_TCEC, "TxCollision"),
-+	MIB_DESC(1, MT7621_STATS_TSCEC, "TxSingleCol"),
-+	MIB_DESC(1, MT7621_STATS_TMCEC, "TxMultiCol"),
-+	MIB_DESC(1, MT7621_STATS_TDEC, "TxDefer"),
-+	MIB_DESC(1, MT7621_STATS_TLCEC, "TxLateCol"),
-+	MIB_DESC(1, MT7621_STATS_TXCEC, "TxExcCol"),
-+	MIB_DESC(1, MT7621_STATS_TPPC, "TxPause"),
-+	MIB_DESC(1, MT7621_STATS_TL64PC, "Tx64Byte"),
-+	MIB_DESC(1, MT7621_STATS_TL65PC, "Tx65Byte"),
-+	MIB_DESC(1, MT7621_STATS_TL128PC, "Tx128Byte"),
-+	MIB_DESC(1, MT7621_STATS_TL256PC, "Tx256Byte"),
-+	MIB_DESC(1, MT7621_STATS_TL512PC, "Tx512Byte"),
-+	MIB_DESC(1, MT7621_STATS_TL1024PC, "Tx1024Byte"),
-+	MIB_DESC(2, MT7621_STATS_TOC, "TxByte"),
-+	MIB_DESC(1, MT7621_STATS_RDPC, "RxDrop"),
-+	MIB_DESC(1, MT7621_STATS_RFPC, "RxFiltered"),
-+	MIB_DESC(1, MT7621_STATS_RUPC, "RxUni"),
-+	MIB_DESC(1, MT7621_STATS_RMPC, "RxMulti"),
-+	MIB_DESC(1, MT7621_STATS_RBPC, "RxBroad"),
-+	MIB_DESC(1, MT7621_STATS_RAEPC, "RxAlignErr"),
-+	MIB_DESC(1, MT7621_STATS_RCEPC, "RxCRC"),
-+	MIB_DESC(1, MT7621_STATS_RUSPC, "RxUnderSize"),
-+	MIB_DESC(1, MT7621_STATS_RFEPC, "RxFragment"),
-+	MIB_DESC(1, MT7621_STATS_ROSPC, "RxOverSize"),
-+	MIB_DESC(1, MT7621_STATS_RJEPC, "RxJabber"),
-+	MIB_DESC(1, MT7621_STATS_RPPC, "RxPause"),
-+	MIB_DESC(1, MT7621_STATS_RL64PC, "Rx64Byte"),
-+	MIB_DESC(1, MT7621_STATS_RL65PC, "Rx65Byte"),
-+	MIB_DESC(1, MT7621_STATS_RL128PC, "Rx128Byte"),
-+	MIB_DESC(1, MT7621_STATS_RL256PC, "Rx256Byte"),
-+	MIB_DESC(1, MT7621_STATS_RL512PC, "Rx512Byte"),
-+	MIB_DESC(1, MT7621_STATS_RL1024PC, "Rx1024Byte"),
-+	MIB_DESC(2, MT7621_STATS_ROC, "RxByte"),
-+	MIB_DESC(1, MT7621_STATS_RDPC_CTRL, "RxCtrlDrop"),
-+	MIB_DESC(1, MT7621_STATS_RDPC_ING, "RxIngDrop"),
-+	MIB_DESC(1, MT7621_STATS_RDPC_ARL, "RxARLDrop")
-+};
-+
-+enum {
-+	/* Global attributes. */
-+	MT7530_ATTR_ENABLE_VLAN,
-+};
-+
-+struct mt7530_port_entry {
-+	u16	pvid;
-+};
-+
-+struct mt7530_vlan_entry {
-+	u16	vid;
-+	u8	member;
-+	u8	etags;
-+};
-+
-+struct mt7530_priv {
-+	void __iomem		*base;
-+	struct mii_bus		*bus;
-+	struct switch_dev	swdev;
-+
-+	bool			global_vlan_enable;
-+	struct mt7530_vlan_entry	vlan_entries[MT7530_NUM_VLANS];
-+	struct mt7530_port_entry	port_entries[MT7530_NUM_PORTS];
-+};
-+
-+struct mt7530_mapping {
-+	char	*name;
-+	u16	pvids[MT7530_NUM_PORTS];
-+	u8	members[MT7530_NUM_VLANS];
-+	u8	etags[MT7530_NUM_VLANS];
-+	u16	vids[MT7530_NUM_VLANS];
-+} mt7530_defaults[] = {
-+	{
-+		.name = "llllw",
-+		.pvids = { 1, 1, 1, 1, 2, 1, 1 },
-+		.members = { 0, 0x6f, 0x50 },
-+		.etags = { 0, 0x40, 0x40 },
-+		.vids = { 0, 1, 2 },
-+	}, {
-+		.name = "wllll",
-+		.pvids = { 2, 1, 1, 1, 1, 1, 1 },
-+		.members = { 0, 0x7e, 0x41 },
-+		.etags = { 0, 0x40, 0x40 },
-+		.vids = { 0, 1, 2 },
-+	},
-+};
-+
-+struct mt7530_mapping*
-+mt7530_find_mapping(struct device_node *np)
-+{
-+	const char *map;
-+	int i;
-+
-+	if (of_property_read_string(np, "mediatek,portmap", &map))
-+		return NULL;
-+
-+	for (i = 0; i < ARRAY_SIZE(mt7530_defaults); i++)
-+		if (!strcmp(map, mt7530_defaults[i].name))
-+			return &mt7530_defaults[i];
-+
-+	return NULL;
-+}
-+
-+static void
-+mt7530_apply_mapping(struct mt7530_priv *mt7530, struct mt7530_mapping *map)
-+{
-+	int i = 0;
-+
-+	for (i = 0; i < MT7530_NUM_PORTS; i++)
-+		mt7530->port_entries[i].pvid = map->pvids[i];
-+
-+	for (i = 0; i < MT7530_NUM_VLANS; i++) {
-+		mt7530->vlan_entries[i].member = map->members[i];
-+		mt7530->vlan_entries[i].etags = map->etags[i];
-+		mt7530->vlan_entries[i].vid = map->vids[i];
-+	}
-+}
-+
-+static int
-+mt7530_reset_switch(struct switch_dev *dev)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	int i;
-+
-+	memset(eth->port_entries, 0, sizeof(eth->port_entries));
-+	memset(eth->vlan_entries, 0, sizeof(eth->vlan_entries));
-+
-+	/* set default vid of each vlan to the same number of vlan, so the vid
-+	 * won't need be set explicitly.
-+	 */
-+	for (i = 0; i < MT7530_NUM_VLANS; i++) {
-+		eth->vlan_entries[i].vid = i;
-+	}
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_get_vlan_enable(struct switch_dev *dev,
-+			   const struct switch_attr *attr,
-+			   struct switch_val *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+
-+	val->value.i = eth->global_vlan_enable;
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_set_vlan_enable(struct switch_dev *dev,
-+			   const struct switch_attr *attr,
-+			   struct switch_val *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+
-+	eth->global_vlan_enable = val->value.i != 0;
-+
-+	return 0;
-+}
-+
-+static u32
-+mt7530_r32(struct mt7530_priv *eth, u32 reg)
-+{
-+	u32 val;
-+	if (eth->bus) {
-+		u16 high, low;
-+
-+		mdiobus_write(eth->bus, 0x1f, 0x1f, (reg >> 6) & 0x3ff);
-+		low = mdiobus_read(eth->bus, 0x1f, (reg >> 2) & 0xf);
-+		high = mdiobus_read(eth->bus, 0x1f, 0x10);
-+
-+		return (high << 16) | (low & 0xffff);
-+	}
-+
-+	val = ioread32(eth->base + reg);
-+	pr_debug("MT7530 MDIO Read [%04x]=%08x\n", reg, val);
-+
-+	return val;
-+}
-+
-+static void
-+mt7530_w32(struct mt7530_priv *eth, u32 reg, u32 val)
-+{
-+	if (eth->bus) {
-+		mdiobus_write(eth->bus, 0x1f, 0x1f, (reg >> 6) & 0x3ff);
-+		mdiobus_write(eth->bus, 0x1f, (reg >> 2) & 0xf,  val & 0xffff);
-+		mdiobus_write(eth->bus, 0x1f, 0x10, val >> 16);
-+		return;
-+	}
-+
-+	pr_debug("MT7530 MDIO Write[%04x]=%08x\n", reg, val);
-+	iowrite32(val, eth->base + reg);
-+}
-+
-+static void
-+mt7530_vtcr(struct mt7530_priv *eth, u32 cmd, u32 val)
-+{
-+	int i;
-+
-+	mt7530_w32(eth, REG_ESW_VLAN_VTCR, BIT(31) | (cmd << 12) | val);
-+
-+	for (i = 0; i < 20; i++) {
-+		u32 val = mt7530_r32(eth, REG_ESW_VLAN_VTCR);
-+
-+		if ((val & BIT(31)) == 0)
-+			break;
-+
-+		udelay(1000);
-+	}
-+	if (i == 20)
-+		printk("mt7530: vtcr timeout\n");
-+}
-+
-+static int
-+mt7530_get_port_pvid(struct switch_dev *dev, int port, int *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+
-+	if (port >= MT7530_NUM_PORTS)
-+		return -EINVAL;
-+
-+	*val = mt7530_r32(eth, REG_ESW_PORT_PPBV1(port));
-+	*val &= 0xfff;
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_set_port_pvid(struct switch_dev *dev, int port, int pvid)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+
-+	if (port >= MT7530_NUM_PORTS)
-+		return -EINVAL;
-+
-+	if (pvid < MT7530_MIN_VID || pvid > MT7530_MAX_VID)
-+		return -EINVAL;
-+
-+	eth->port_entries[port].pvid = pvid;
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_get_vlan_ports(struct switch_dev *dev, struct switch_val *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	u32 member;
-+	u32 etags;
-+	int i;
-+
-+	val->len = 0;
-+
-+	if (val->port_vlan < 0 || val->port_vlan >= MT7530_NUM_VLANS)
-+		return -EINVAL;
-+
-+	mt7530_vtcr(eth, 0, val->port_vlan);
-+
-+	member = mt7530_r32(eth, REG_ESW_VLAN_VAWD1);
-+	member >>= 16;
-+	member &= 0xff;
-+
-+	etags = mt7530_r32(eth, REG_ESW_VLAN_VAWD2);
-+
-+	for (i = 0; i < MT7530_NUM_PORTS; i++) {
-+		struct switch_port *p;
-+		int etag;
-+
-+		if (!(member & BIT(i)))
-+			continue;
-+
-+		p = &val->value.ports[val->len++];
-+		p->id = i;
-+
-+		etag = (etags >> (i * 2)) & 0x3;
-+
-+		if (etag == ETAG_CTRL_TAG)
-+			p->flags |= BIT(SWITCH_PORT_FLAG_TAGGED);
-+		else if (etag != ETAG_CTRL_UNTAG)
-+			printk("vlan egress tag control neither untag nor tag.\n");
-+	}
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	u8 member = 0;
-+	u8 etags = 0;
-+	int i;
-+
-+	if (val->port_vlan < 0 || val->port_vlan >= MT7530_NUM_VLANS ||
-+			val->len > MT7530_NUM_PORTS)
-+		return -EINVAL;
-+
-+	for (i = 0; i < val->len; i++) {
-+		struct switch_port *p = &val->value.ports[i];
-+
-+		if (p->id >= MT7530_NUM_PORTS)
-+			return -EINVAL;
-+
-+		member |= BIT(p->id);
-+
-+		if (p->flags & BIT(SWITCH_PORT_FLAG_TAGGED))
-+			etags |= BIT(p->id);
-+	}
-+	eth->vlan_entries[val->port_vlan].member = member;
-+	eth->vlan_entries[val->port_vlan].etags = etags;
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_set_vid(struct switch_dev *dev, const struct switch_attr *attr,
-+		struct switch_val *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	int vlan;
-+	u16 vid;
-+
-+	vlan = val->port_vlan;
-+	vid = (u16)val->value.i;
-+
-+	if (vlan < 0 || vlan >= MT7530_NUM_VLANS)
-+		return -EINVAL;
-+
-+	if (vid < MT7530_MIN_VID || vid > MT7530_MAX_VID)
-+		return -EINVAL;
-+
-+	eth->vlan_entries[vlan].vid = vid;
-+	return 0;
-+}
-+
-+static int
-+mt7530_get_vid(struct switch_dev *dev, const struct switch_attr *attr,
-+		struct switch_val *val)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	u32 vid;
-+	int vlan;
-+
-+	vlan = val->port_vlan;
-+
-+	vid = mt7530_r32(eth, REG_ESW_VLAN_VTIM(vlan));
-+	if (vlan & 1)
-+		vid = vid >> 12;
-+	vid &= 0xfff;
-+
-+	val->value.i = vid;
-+	return 0;
-+}
-+
-+static int
-+mt7530_apply_config(struct switch_dev *dev)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	int i, j;
-+	u8 tag_ports;
-+	u8 untag_ports;
-+
-+	if (!eth->global_vlan_enable) {
-+		for (i = 0; i < MT7530_NUM_PORTS; i++)
-+			mt7530_w32(eth, REG_ESW_PORT_PCR(i), 0x00ff0000);
-+
-+		for (i = 0; i < MT7530_NUM_PORTS; i++)
-+			mt7530_w32(eth, REG_ESW_PORT_PVC(i), 0x810000c0);
-+
-+		return 0;
-+	}
-+
-+	/* set all ports as security mode */
-+	for (i = 0; i < MT7530_NUM_PORTS; i++)
-+		mt7530_w32(eth, REG_ESW_PORT_PCR(i), 0x00ff0003);
-+
-+	/* check if a port is used in tag/untag vlan egress mode */
-+	tag_ports = 0;
-+	untag_ports = 0;
-+
-+	for (i = 0; i < MT7530_NUM_VLANS; i++) {
-+		u8 member = eth->vlan_entries[i].member;
-+		u8 etags = eth->vlan_entries[i].etags;
-+
-+		if (!member)
-+			continue;
-+
-+		for (j = 0; j < MT7530_NUM_PORTS; j++) {
-+			if (!(member & BIT(j)))
-+				continue;
-+
-+			if (etags & BIT(j))
-+				tag_ports |= 1u << j;
-+			else
-+				untag_ports |= 1u << j;
-+		}
-+	}
-+
-+	/* set all untag-only ports as transparent and the rest as user port */
-+	for (i = 0; i < MT7530_NUM_PORTS; i++) {
-+		u32 pvc_mode = 0x81000000;
-+
-+		if (untag_ports & BIT(i) && !(tag_ports & BIT(i)))
-+			pvc_mode = 0x810000c0;
-+
-+		mt7530_w32(eth, REG_ESW_PORT_PVC(i), pvc_mode);
-+	}
-+
-+	for (i = 0; i < MT7530_NUM_VLANS; i++) {
-+		u16 vid = eth->vlan_entries[i].vid;
-+		u8 member = eth->vlan_entries[i].member;
-+		u8 etags = eth->vlan_entries[i].etags;
-+		u32 val;
-+
-+		/* vid of vlan */
-+		val = mt7530_r32(eth, REG_ESW_VLAN_VTIM(i));
-+		if (i % 2 == 0) {
-+			val &= 0xfff000;
-+			val |= vid;
-+		} else {
-+			val &= 0xfff;
-+			val |= (vid << 12);
-+		}
-+		mt7530_w32(eth, REG_ESW_VLAN_VTIM(i), val);
-+
-+		/* vlan port membership */
-+		if (member)
-+			mt7530_w32(eth, REG_ESW_VLAN_VAWD1, REG_ESW_VLAN_VAWD1_IVL_MAC |
-+				REG_ESW_VLAN_VAWD1_VTAG_EN | (member << 16) |
-+				REG_ESW_VLAN_VAWD1_VALID);
-+		else
-+			mt7530_w32(eth, REG_ESW_VLAN_VAWD1, 0);
-+
-+		/* egress mode */
-+		val = 0;
-+		for (j = 0; j < MT7530_NUM_PORTS; j++) {
-+			if (etags & BIT(j))
-+				val |= ETAG_CTRL_TAG << (j * 2);
-+			else
-+				val |= ETAG_CTRL_UNTAG << (j * 2);
-+		}
-+		mt7530_w32(eth, REG_ESW_VLAN_VAWD2, val);
-+
-+		/* write to vlan table */
-+		mt7530_vtcr(eth, 1, i);
-+	}
-+
-+	/* Port Default PVID */
-+	for (i = 0; i < MT7530_NUM_PORTS; i++) {
-+		u32 val;
-+		val = mt7530_r32(eth, REG_ESW_PORT_PPBV1(i));
-+		val &= ~0xfff;
-+		val |= eth->port_entries[i].pvid;
-+		mt7530_w32(eth, REG_ESW_PORT_PPBV1(i), val);
-+	}
-+
-+	return 0;
-+}
-+
-+static int
-+mt7530_get_port_link(struct switch_dev *dev,  int port,
-+			struct switch_port_link *link)
-+{
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	u32 speed, pmsr;
-+
-+	if (port < 0 || port >= MT7530_NUM_PORTS)
-+		return -EINVAL;
-+
-+	pmsr = mt7530_r32(eth, 0x3008 + (0x100 * port));
-+
-+	link->link = pmsr & 1;
-+	link->duplex = (pmsr >> 1) & 1;
-+	speed = (pmsr >> 2) & 3;
-+
-+	switch (speed) {
-+	case 0:
-+		link->speed = SWITCH_PORT_SPEED_10;
-+		break;
-+	case 1:
-+		link->speed = SWITCH_PORT_SPEED_100;
-+		break;
-+	case 2:
-+	case 3: /* forced gige speed can be 2 or 3 */
-+		link->speed = SWITCH_PORT_SPEED_1000;
-+		break;
-+	default:
-+		link->speed = SWITCH_PORT_SPEED_UNKNOWN;
-+		break;
-+	}
-+
-+	return 0;
-+}
-+
-+static const struct switch_attr mt7530_global[] = {
-+	{
-+		.type = SWITCH_TYPE_INT,
-+		.name = "enable_vlan",
-+		.description = "VLAN mode (1:enabled)",
-+		.max = 1,
-+		.id = MT7530_ATTR_ENABLE_VLAN,
-+		.get = mt7530_get_vlan_enable,
-+		.set = mt7530_set_vlan_enable,
-+	},
-+};
-+
-+static u64 get_mib_counter(struct mt7530_priv *eth, int i, int port)
-+{
-+	unsigned int port_base;
-+	u64 t;
-+
-+	port_base = MT7621_MIB_COUNTER_BASE +
-+		    MT7621_MIB_COUNTER_PORT_OFFSET * port;
-+
-+	t = mt7530_r32(eth, port_base + mt7621_mibs[i].offset);
-+	if (mt7621_mibs[i].size == 2) {
-+		u64 hi;
-+
-+		hi = mt7530_r32(eth, port_base + mt7621_mibs[i].offset + 4);
-+		t |= hi << 32;
-+	}
-+
-+	return t;
-+}
-+
-+static int mt7621_sw_get_port_mib(struct switch_dev *dev,
-+				  const struct switch_attr *attr,
-+				  struct switch_val *val)
-+{
-+	static char buf[4096];
-+	struct mt7530_priv *eth = container_of(dev, struct mt7530_priv, swdev);
-+	int i, len = 0;
-+
-+	if (val->port_vlan >= MT7530_NUM_PORTS)
-+		return -EINVAL;
-+
-+	len += snprintf(buf + len, sizeof(buf) - len,
-+			"Port %d MIB counters\n", val->port_vlan);
-+
-+	for (i = 0; i < sizeof(mt7621_mibs) / sizeof(*mt7621_mibs); ++i) {
-+		u64 counter;
-+		len += snprintf(buf + len, sizeof(buf) - len,
-+				"%-11s: ", mt7621_mibs[i].name);
-+		counter = get_mib_counter(eth, i, val->port_vlan);
-+		len += snprintf(buf + len, sizeof(buf) - len, "%llu\n",
-+				counter);
-+	}
-+
-+	val->value.s = buf;
-+	val->len = len;
-+	return 0;
-+}
-+
-+static const struct switch_attr mt7621_port[] = {
-+	{
-+		.type = SWITCH_TYPE_STRING,
-+		.name = "mib",
-+		.description = "Get MIB counters for port",
-+		.get = mt7621_sw_get_port_mib,
-+		.set = NULL,
-+	},
-+};
-+
-+static const struct switch_attr mt7530_port[] = {
-+};
-+
-+static const struct switch_attr mt7530_vlan[] = {
-+	{
-+		.type = SWITCH_TYPE_INT,
-+		.name = "vid",
-+		.description = "VLAN ID (0-4094)",
-+		.set = mt7530_set_vid,
-+		.get = mt7530_get_vid,
-+		.max = 4094,
-+	},
-+};
-+
-+static const struct switch_dev_ops mt7621_ops = {
-+	.attr_global = {
-+		.attr = mt7530_global,
-+		.n_attr = ARRAY_SIZE(mt7530_global),
-+	},
-+/*	.attr_port = {
-+		.attr = mt7621_port,
-+		.n_attr = ARRAY_SIZE(mt7621_port),
-+	},*/
-+	.attr_vlan = {
-+		.attr = mt7530_vlan,
-+		.n_attr = ARRAY_SIZE(mt7530_vlan),
-+	},
-+	.get_vlan_ports = mt7530_get_vlan_ports,
-+	.set_vlan_ports = mt7530_set_vlan_ports,
-+	.get_port_pvid = mt7530_get_port_pvid,
-+	.set_port_pvid = mt7530_set_port_pvid,
-+	.get_port_link = mt7530_get_port_link,
-+	.apply_config = mt7530_apply_config,
-+	.reset_switch = mt7530_reset_switch,
-+};
-+
-+static const struct switch_dev_ops mt7530_ops = {
-+	.attr_global = {
-+		.attr = mt7530_global,
-+		.n_attr = ARRAY_SIZE(mt7530_global),
-+	},
-+	.attr_port = {
-+		.attr = mt7530_port,
-+		.n_attr = ARRAY_SIZE(mt7530_port),
-+	},
-+	.attr_vlan = {
-+		.attr = mt7530_vlan,
-+		.n_attr = ARRAY_SIZE(mt7530_vlan),
-+	},
-+	.get_vlan_ports = mt7530_get_vlan_ports,
-+	.set_vlan_ports = mt7530_set_vlan_ports,
-+	.get_port_pvid = mt7530_get_port_pvid,
-+	.set_port_pvid = mt7530_set_port_pvid,
-+	.get_port_link = mt7530_get_port_link,
-+	.apply_config = mt7530_apply_config,
-+	.reset_switch = mt7530_reset_switch,
-+};
-+
-+int
-+mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus, int vlan)
-+{
-+	struct switch_dev *swdev;
-+	struct mt7530_priv *mt7530;
-+	struct mt7530_mapping *map;
-+	int ret;
-+
-+	mt7530 = devm_kzalloc(dev, sizeof(struct mt7530_priv), GFP_KERNEL);
-+	if (!mt7530)
-+		return -ENOMEM;
-+
-+	mt7530->base = base;
-+	mt7530->bus = bus;
-+	mt7530->global_vlan_enable = vlan;
-+
-+	swdev = &mt7530->swdev;
-+	if (bus) {
-+		swdev->alias = "mt7530";
-+		swdev->name = "mt7530";
-+	} else if (IS_ENABLED(CONFIG_MACH_MT7623)) {
-+		swdev->alias = "mt7623";
-+		swdev->name = "mt7623";
-+	} else if (IS_ENABLED(CONFIG_SOC_MT7621)) {
-+		swdev->alias = "mt7621";
-+		swdev->name = "mt7621";
-+	} else {
-+		swdev->alias = "mt7620";
-+		swdev->name = "mt7620";
-+	}
-+	swdev->cpu_port = MT7530_CPU_PORT;
-+	swdev->ports = MT7530_NUM_PORTS;
-+	swdev->vlans = MT7530_NUM_VLANS;
-+	if (IS_ENABLED(CONFIG_SOC_MT7621) || IS_ENABLED(CONFIG_MACH_MT7623))
-+		swdev->ops = &mt7621_ops;
-+	else
-+		swdev->ops = &mt7530_ops;
-+
-+	ret = register_switch(swdev, NULL);
-+	if (ret) {
-+		dev_err(dev, "failed to register mt7530\n");
-+		return ret;
-+	}
-+
-+	mt7530_reset_switch(swdev);
-+
-+	map = mt7530_find_mapping(dev->of_node);
-+	if (map)
-+		mt7530_apply_mapping(mt7530, map);
-+	mt7530_apply_config(swdev);
-+
-+	/* magic vodoo */
-+	if (!(IS_ENABLED(CONFIG_SOC_MT7621) || IS_ENABLED(CONFIG_MACH_MT7623)) && bus && mt7530_r32(mt7530, REG_HWTRAP) !=  0x1117edf) {
-+	        dev_info(dev, "fixing up MHWTRAP register - bootloader probably played with it\n");
-+		mt7530_w32(mt7530, REG_HWTRAP, 0x1117edf);
-+	}
-+	dev_info(dev, "loaded %s driver\n", swdev->name);
-+
-+	return 0;
-+}
---- /dev/null
-+++ b/drivers/net/ethernet/mediatek/mt7530.h
-@@ -0,0 +1,20 @@
-+/*
-+ * 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; either version 2
-+ * of the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * Copyright (C) 2013 John Crispin <blogic at openwrt.org>
-+ */
-+
-+#ifndef _MT7530_H__
-+#define _MT7530_H__
-+
-+int mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus, int vlan);
-+
-+#endif
---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -25,6 +25,9 @@
- 
- #include "mtk_eth_soc.h"
- 
-+/* the callback used by the driver core to bringup the switch */
-+int mtk_gsw_init(struct mtk_eth *eth);
-+
- static int mtk_msg_level = -1;
- module_param_named(msg_level, mtk_msg_level, int, 0);
- MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)");
-@@ -74,14 +77,14 @@ static int mtk_mdio_busy_wait(struct mtk
- 			return 0;
- 		if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
- 			break;
--		usleep_range(10, 20);
-+//		usleep_range(10, 20);
- 	}
- 
- 	dev_err(eth->dev, "mdio: MDIO timeout\n");
- 	return -1;
- }
- 
--static u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr,
-+u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr,
- 			   u32 phy_register, u32 write_data)
- {
- 	if (mtk_mdio_busy_wait(eth))
-@@ -100,7 +103,7 @@ static u32 _mtk_mdio_write(struct mtk_et
- 	return 0;
- }
- 
--static u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg)
-+u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg)
- {
- 	u32 d;
- 
-@@ -155,7 +158,7 @@ static void mtk_gmac0_rgmii_adjust(struc
- 
- 	val = (speed == SPEED_1000) ?
- 		RCK_CTRL_RGMII_1000 : RCK_CTRL_RGMII_10_100;
--	mtk_w32(eth, val, TRGMII_RCK_CTRL);
-+	mtk_w32(eth, val, _TRGMII_RCK_CTRL);
- 
- 	val = (speed == SPEED_1000) ?
- 		TCK_CTRL_RGMII_1000 : TCK_CTRL_RGMII_10_100;
-@@ -1833,15 +1836,6 @@ static int mtk_hw_init(struct mtk_eth *e
- 	}
- 	regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
- 
--	/* Set GE2 driving and slew rate */
--	regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
--
--	/* set GE2 TDSEL */
--	regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
--
--	/* set GE2 TUNE */
--	regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
--
- 	/* GE1, Force 1000M/FD, FC ON */
- 	mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(0));
- 
-@@ -1851,6 +1845,8 @@ static int mtk_hw_init(struct mtk_eth *e
- 	/* Enable RX VLan Offloading */
- 	mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
- 
-+	mtk_gsw_init(eth);
-+
- 	/* disable delay and normal interrupt */
- 	mtk_w32(eth, 0, MTK_QDMA_DELAY_INT);
- 	mtk_w32(eth, 0, MTK_PDMA_DELAY_INT);
-@@ -1879,6 +1875,8 @@ static int mtk_hw_init(struct mtk_eth *e
- 		mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i));
- 	}
- 
-+	mt7623_gsw_config(eth);
-+
- 	return 0;
- }
- 
-@@ -2379,6 +2377,9 @@ static int mtk_probe(struct platform_dev
- 	if (!eth)
- 		return -ENOMEM;
- 
-+	eth->switch_np = of_parse_phandle(pdev->dev.of_node,
-+					  "mediatek,switch", 0);
-+
- 	eth->dev = &pdev->dev;
- 	eth->base = devm_ioremap_resource(&pdev->dev, res);
- 	if (IS_ERR(eth->base))
---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -314,7 +314,7 @@
- 				 MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_LINK)
- 
- /* TRGMII RXC control register */
--#define TRGMII_RCK_CTRL		0x10300
-+#define _TRGMII_RCK_CTRL		0x10300
- #define DQSI0(x)		((x << 0) & GENMASK(6, 0))
- #define DQSI1(x)		((x << 8) & GENMASK(14, 8))
- #define RXCTL_DMWTLAT(x)	((x << 16) & GENMASK(18, 16))
-@@ -554,6 +554,9 @@ struct mtk_eth {
- 	struct mii_bus			*mii_bus;
- 	struct work_struct		pending_work;
- 	unsigned long			state;
-+
-+	struct device_node		*switch_np;
-+	void				*sw_priv;
- };
- 
- /* struct mtk_mac -	the structure that holds the info about the MACs of the
-@@ -586,4 +589,6 @@ void mtk_stats_update_mac(struct mtk_mac
- void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg);
- u32 mtk_r32(struct mtk_eth *eth, unsigned reg);
- 
-+int mt7623_gsw_config(struct mtk_eth *eth);
-+
- #endif /* MTK_ETH_H */
diff --git a/target/linux/mediatek/profiles/default.mk b/target/linux/mediatek/profiles/default.mk
index c713ba0..2ef570b 100644
--- a/target/linux/mediatek/profiles/default.mk
+++ b/target/linux/mediatek/profiles/default.mk
@@ -7,9 +7,6 @@
 
 define Profile/Default
 	NAME:=Default Profile (minimum package set)
-	PACKAGES:= \
-		kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
-		kmod-usb3
 endef
 
 define Profile/Default/Description


From lede-commits at lists.infradead.org  Sat Apr  8 05:20:52 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:20:52 -0400
Subject: [source]  mdadm: extend uci config support
In-Reply-To: <20170408122051.10167.72460@git-01.infra.lede-project.org>
References: <20170408122051.10167.72460@git-01.infra.lede-project.org>
Message-ID: <mailman.22871.1491654075.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/813efe57e434037fb58bd3e16ebd3a1cfd6ceb82

commit 813efe57e434037fb58bd3e16ebd3a1cfd6ceb82
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Feb 9 13:22:47 2017 +0100

    mdadm: extend uci config support
    
    Extend the mdadm package to allow to explicitely configure arrays as
    well as device list entries.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/mdadm/Makefile           |  2 +-
 package/utils/mdadm/files/mdadm.config | 15 +++++++
 package/utils/mdadm/files/mdadm.init   | 72 +++++++++++++++++++++++++++++++---
 3 files changed, 82 insertions(+), 7 deletions(-)

diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
index 8f0fcf0..32544cc 100644
--- a/package/utils/mdadm/Makefile
+++ b/package/utils/mdadm/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mdadm
 PKG_VERSION:=3.2.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
diff --git a/package/utils/mdadm/files/mdadm.config b/package/utils/mdadm/files/mdadm.config
index 536228f..50afbc2 100644
--- a/package/utils/mdadm/files/mdadm.config
+++ b/package/utils/mdadm/files/mdadm.config
@@ -1,3 +1,18 @@
 config mdadm
 	option email root
+	# list devices /dev/hd*
+	# list devices /dev/sd*
+	# list devices partitions
 
+config array
+	option uuid 52c5c44a:d2162820:f75d3464:799750f8
+	option device /dev/md0
+	# option name raid:0
+	# option super_minor 0
+	# list devices /dev/sda1
+	# list devices /dev/sdb1
+	# option spares 0
+	# option spare_group spares
+	# option bitmap /bitmap.md
+	# option container 00000000:00000000:00000000:00000000
+	# option member 1
diff --git a/package/utils/mdadm/files/mdadm.init b/package/utils/mdadm/files/mdadm.init
index 9da4684..e6624a7 100644
--- a/package/utils/mdadm/files/mdadm.init
+++ b/package/utils/mdadm/files/mdadm.init
@@ -7,24 +7,84 @@ USE_PROCD=1
 PROG=/sbin/mdadm
 NAME=mdadm
 
-mdadm_email() {
+CONF="/var/etc/mdadm.conf"
+
+append_list_item() {
+	append "$2" "$1" "$3"
+}
+
+append_option() {
+	local var="$1"
+	local cfg="$2"
+	local opt="$3"
+	local name="$4"
+	local sep="$5"
+	local str
+
+	if [ -n "$sep" ]; then
+		config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
+	else
+		config_get str "$cfg" "$opt"
+	fi
+
+	[ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
+}
+
+mdadm_common() {
+	local cfg="$1"
+	local email devices
+
+	if [ -x /sbin/sendmail ]; then
+		append_option email "$cfg" email "MAILADDR"
+
+	fi
+
+	append_option devices "$cfg" devices DEVICE " "
+
+	printf "%s\n%s\n" "$email" "$devices" >> $CONF
+}
+
+mdadm_array() {
 	local cfg="$1"
-	if [ ! -x /sbin/sendmail ]; then
+	local uuid device devices name array
+
+	config_get uuid "$cfg" uuid
+	config_get name "$cfg" name
+	config_get device "$cfg" device
+
+	if [ -z "$device" ] || [ -z "$uuid$name" ]; then
+		echo "Skipping array without device, uuid or name" >&2
 		return
 	fi
-	config_get email "$cfg" email
+
+	[ -n "$uuid" ] && append array "uuid=$uuid"
+	[ -n "$name" ] && append array "name=$name"
+
+	append_option array "$cfg" super_minor
+	append_option array "$cfg" spares
+	append_option array "$cfg" spare_group
+	append_option array "$cfg" bitmap
+	append_option array "$cfg" container
+	append_option array "$cfg" member
+	append_option array "$cfg" devices devices ","
+
+	printf "ARRAY %s %s\n" "$device" "$array" >> $CONF
 }
 
 start_service() {
 	local email
 
+	mkdir -p "${CONF%/*}"
+	printf "# Autogenerated from /etc/config/mdadm, do not edit!\n" > $CONF
+
 	config_load mdadm
-	config_foreach mdadm_email mdadm
+	config_foreach mdadm_common mdadm
+	config_foreach mdadm_array array
 
-	$PROG --assemble --scan
+	$PROG --assemble --scan --config="$CONF"
 
 	procd_open_instance
-	procd_set_param command "$PROG" --monitor ${email:+--mail=$email} --syslog --scan
+	procd_set_param command "$PROG" --monitor --syslog --scan --config="$CONF"
 	procd_close_instance
 }
 


From lede-commits at lists.infradead.org  Sat Apr  8 05:20:51 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:20:51 -0400
Subject: [source]  opkg: backport upstream fixes, code cleanups
In-Reply-To: <20170408122051.10167.72460@git-01.infra.lede-project.org>
References: <20170408122051.10167.72460@git-01.infra.lede-project.org>
Message-ID: <mailman.22872.1491654080.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/1449b52f021f1aa4fb9447035a7809dac43cacbe

commit 1449b52f021f1aa4fb9447035a7809dac43cacbe
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Sat Apr 1 14:34:57 2017 +0200

    opkg: backport upstream fixes, code cleanups
    
    Update to latest Git in order to import the following fixes:
    
    1d0263b check_data_file_clashes_change: remove duplicated offline root in paths
    a00a6a9 buildReplaces: do not add duplicated replacees
    9fbedd8 opkg: compare-versions doesn't need any state
    45b54f6 opkg_cmd: fix segmentation fault in opkg_compare_versions_cmd()
    93de62b opkg_cmd: fix return of opkg compare-versions
    51275a8 pkg_src_list_push: remove unused function
    947d3d4 pkg_src_list_pop: remove unused function
    980cfb2 str_list_push: remove unused function
    52c31c1 str_list_prev: remove unused function
    7d24212 str_list_last: remove unused function
    48142a3 conffile_list_pop: remove unused function
    46c5de5 pkg_dest_list_push: remove unused functions
    368bb62 nv_pair_list_prev: remove unused function
    2985c00 nv_pair_list_last: remove unused function
    f5082ac conffile_list_pop: remove unused function
    89bf8b9 conffile_list_push: remove unused function
    23d31fb active_list_sort: remove unused function
    7fe45f2 active_list_add_depend: remove unused function
    86b584d pkg_dependence_satisfied: remove unused function
    816d330 Fix typo in pkg_hash_fetch_best_installation_candidate.
    07f3b02 set_flags_from_control: remove function
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/system/opkg/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index 132721d..4760e5d 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -16,9 +16,9 @@ PKG_FLAGS:=essential
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://git.lede-project.org/project/opkg-lede.git
-PKG_SOURCE_DATE:=2017-03-15
-PKG_SOURCE_VERSION:=cfe46c7d5787df0bd643d44e8f985107b562300e
-PKG_MIRROR_HASH:=abc0c125c856318a457add3d2c5ec668464ed962ccfc688ea1cbd5047b435f23
+PKG_SOURCE_DATE:=2017-03-23
+PKG_SOURCE_VERSION:=1d0263bb40e3c099501fc1f2431907636230e7f2
+PKG_MIRROR_HASH:=1f527179e60b9404affa5f3c9c506d4249e085bf521f770819b8648273a1010c
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:36 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:36 -0400
Subject: [source]  ath9k: enable GPIO chip only if requested via DT
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22874.1491654659.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/20b45df7ebcd18802d56f51893d40af43b687cb3

commit 20b45df7ebcd18802d56f51893d40af43b687cb3
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Mar 22 07:29:32 2017 +0100

    ath9k: enable GPIO chip only if requested via DT
    
    In case that the atheros device tree binding is used, enable access to
    the GPIO chip only if the gpio-controller device tree parameter is used
    for the ath9k node.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../patches/548-ath9k_enable_gpio_chip.patch       | 25 ++++++++++++++++------
 .../patches/549-ath9k_enable_gpio_buttons.patch    |  6 +++---
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
index 4e28abb..10047a7 100644
--- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
+++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
@@ -196,7 +196,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	return 0;
  }
  
-@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
+@@ -136,17 +264,24 @@ void ath_deinit_leds(struct ath_softc *s
  
  	while (!list_empty(&sc->leds)) {
  		led = list_first_entry(&sc->leds, struct ath_led, list);
@@ -215,16 +215,27 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  }
  
  void ath_init_leds(struct ath_softc *sc)
-@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
+ {
+ 	struct ath9k_platform_data *pdata = sc->dev->platform_data;
++	struct device_node *np = sc->dev->of_node;
+ 	char led_name[32];
+ 	const char *trigger;
+ 	int i;
+@@ -156,6 +291,13 @@ void ath_init_leds(struct ath_softc *sc)
+ 	if (AR_SREV_9100(sc->sc_ah))
+ 		return;
  
++	if (!np)
++		ath9k_register_gpio_chip(sc);
++
++	/* setup gpio controller only if requested */
++	if (of_property_read_bool(np, "gpio-controller"))
++		ath9k_register_gpio_chip(sc);
++
  	ath_fill_led_pin(sc);
  
-+	ath9k_register_gpio_chip(sc);
-+
  	if (pdata && pdata->leds && pdata->num_leds)
- 		for (i = 0; i < pdata->num_leds; i++) {
- 			if (pdata->leds[i].gpio == sc->sc_ah->led_pin)
-@@ -183,6 +319,7 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -183,6 +325,7 @@ void ath_init_leds(struct ath_softc *sc)
  	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  			   !sc->sc_ah->config.led_active_high);
  }
diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
index 8aefcf4..1d1efe5 100644
--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
+++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
@@ -117,10 +117,10 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	while (!list_empty(&sc->leds)) {
  		led = list_first_entry(&sc->leds, struct ath_led, list);
  #ifdef CONFIG_GPIOLIB
-@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
- 	ath_fill_led_pin(sc);
+@@ -299,6 +368,7 @@ void ath_init_leds(struct ath_softc *sc)
+ 		ath9k_register_gpio_chip(sc);
  
- 	ath9k_register_gpio_chip(sc);
+ 	ath_fill_led_pin(sc);
 +	ath9k_init_buttons(sc);
  
  	if (pdata && pdata->leds && pdata->num_leds)


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:37 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:37 -0400
Subject: [source] ath9k: ignore led_pin if ath9k GPIO controller is used
 with DT
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22875.1491654661.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/b06559e5b76adfbafb16965098994cd30e8ded9c

commit b06559e5b76adfbafb16965098994cd30e8ded9c
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Mar 22 08:04:16 2017 +0100

    ath9k: ignore led_pin if ath9k GPIO controller is used with DT
    
    Don't setup the default led pin if the ath9k GPIO controller is used
    via device tree to prevent collision. In case any of the pins exposed
    by the ath9k is used, the phyNtpt trigger needs to be set in userspace.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch   | 10 ++++++----
 .../mac80211/patches/549-ath9k_enable_gpio_buttons.patch       |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
index 10047a7..86917eb 100644
--- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
+++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
@@ -221,21 +221,23 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	char led_name[32];
  	const char *trigger;
  	int i;
-@@ -156,6 +291,13 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -156,6 +291,15 @@ void ath_init_leds(struct ath_softc *sc)
  	if (AR_SREV_9100(sc->sc_ah))
  		return;
  
 +	if (!np)
 +		ath9k_register_gpio_chip(sc);
 +
-+	/* setup gpio controller only if requested */
-+	if (of_property_read_bool(np, "gpio-controller"))
++	/* setup gpio controller only if requested and skip the led_pin setup */
++	if (of_property_read_bool(np, "gpio-controller")) {
 +		ath9k_register_gpio_chip(sc);
++		return;
++	}
 +
  	ath_fill_led_pin(sc);
  
  	if (pdata && pdata->leds && pdata->num_leds)
-@@ -183,6 +325,7 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -183,6 +327,7 @@ void ath_init_leds(struct ath_softc *sc)
  	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  			   !sc->sc_ah->config.led_active_high);
  }
diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
index 1d1efe5..4e165dd 100644
--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
+++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
@@ -117,8 +117,8 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	while (!list_empty(&sc->leds)) {
  		led = list_first_entry(&sc->leds, struct ath_led, list);
  #ifdef CONFIG_GPIOLIB
-@@ -299,6 +368,7 @@ void ath_init_leds(struct ath_softc *sc)
- 		ath9k_register_gpio_chip(sc);
+@@ -301,6 +370,7 @@ void ath_init_leds(struct ath_softc *sc)
+ 	}
  
  	ath_fill_led_pin(sc);
 +	ath9k_init_buttons(sc);


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:33 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:33 -0400
Subject: [source]  firmware: rework fritz-tools package
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22876.1491654661.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/8b3fa168b49a4aad5797ef5083c17c348d99731b

commit 8b3fa168b49a4aad5797ef5083c17c348d99731b
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Mar 25 18:09:37 2017 +0100

    firmware: rework fritz-tools package
    
    Split the fritz-tools into subpackages. fritz_tffs_read is usefull for
    all Fritz boards where fritz-cal_extract is only required for the
    Fritz 4040 at the moment.
    
    Rename the tffs related binary to the more catchy name fritz_tffs and
    move the whole package to utilities since the package doesn't really
    provide a firmware file.
    
    Make the fritz-tools available for all targets and build them shared.
    The tffs is used by avm on lantiq and ar71xx as well.
    
    Tested-by: Christian Lamparter <chunkeey at googlemail.com>
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 package/firmware/fritz-tools/Makefile              | 30 ---------------
 package/utils/fritz-tools/Makefile                 | 45 ++++++++++++++++++++++
 package/{firmware => utils}/fritz-tools/README.md  |  0
 .../fritz-tools/src/CMakeLists.txt                 |  0
 .../fritz-tools/src/fritz_cal_extract.c            |  0
 .../fritz-tools/src/fritz_tffs_read.c              |  0
 target/linux/ipq806x/image/Makefile                |  2 +-
 7 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/package/firmware/fritz-tools/Makefile b/package/firmware/fritz-tools/Makefile
deleted file mode 100644
index 4891dca..0000000
--- a/package/firmware/fritz-tools/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=fritz-tools
-PKG_RELEASE:=1
-CMAKE_INSTALL:=1
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
-
-define Package/fritz-tools
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  DEPENDS:=@TARGET_ipq806x +zlib
-  TITLE:=Utilites for accessing AVM Calibration data and TFFS
-endef
-
-define Package/fritz-tools/description
- This package contains:
- fritz_cal_extract.c: tool to extract WLAN calibration data.
- fritz_tffs_read.c: partially read the TFFS filesystems.
-endef
-
-define Package/fritz-tools/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_cal_extract $(1)/usr/bin/
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_tffs_read $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,fritz-tools))
diff --git a/package/utils/fritz-tools/Makefile b/package/utils/fritz-tools/Makefile
new file mode 100644
index 0000000..7c547e6
--- /dev/null
+++ b/package/utils/fritz-tools/Makefile
@@ -0,0 +1,45 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fritz-tools
+PKG_RELEASE:=1
+CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/fritz-tools/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+endef
+
+define Package/fritz-tffs
+  $(call Package/fritz-tools/Default)
+  TITLE:=Utility to partially read the TFFS filesystems
+endef
+
+define Package/fritz-tffs/description
+ Utility to partially read the TFFS filesystems.
+endef
+
+define Package/fritz-caldata
+  $(call Package/fritz-tools/Default)
+  DEPENDS:=+zlib
+  TITLE:=Utility to extract WLAN calibration data
+endef
+
+define Package/fritz-caldata/description
+ Utility to extract the zlib compress calibration data from flash.
+endef
+
+define Package/fritz-tffs/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_tffs_read $(1)/usr/bin/fritz_tffs
+endef
+
+define Package/fritz-caldata/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_cal_extract $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,fritz-tffs))
+$(eval $(call BuildPackage,fritz-caldata))
diff --git a/package/firmware/fritz-tools/README.md b/package/utils/fritz-tools/README.md
similarity index 100%
rename from package/firmware/fritz-tools/README.md
rename to package/utils/fritz-tools/README.md
diff --git a/package/firmware/fritz-tools/src/CMakeLists.txt b/package/utils/fritz-tools/src/CMakeLists.txt
similarity index 100%
rename from package/firmware/fritz-tools/src/CMakeLists.txt
rename to package/utils/fritz-tools/src/CMakeLists.txt
diff --git a/package/firmware/fritz-tools/src/fritz_cal_extract.c b/package/utils/fritz-tools/src/fritz_cal_extract.c
similarity index 100%
rename from package/firmware/fritz-tools/src/fritz_cal_extract.c
rename to package/utils/fritz-tools/src/fritz_cal_extract.c
diff --git a/package/firmware/fritz-tools/src/fritz_tffs_read.c b/package/utils/fritz-tools/src/fritz_tffs_read.c
similarity index 100%
rename from package/firmware/fritz-tools/src/fritz_tffs_read.c
rename to package/utils/fritz-tools/src/fritz_tffs_read.c
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index f67e6b2..de6ddb6 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -181,7 +181,7 @@ define Device/FRITZ4040
 	IMAGE_SIZE := 29753344
 	IMAGES = sysupgrade.bin
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
-	DEVICE_PACKAGES := kmod-usb-phy-qcom-ipq4019 ipq-wifi-fritz4040 fritz-tools u-boot-fritz4040
+	DEVICE_PACKAGES := kmod-usb-phy-qcom-ipq4019 ipq-wifi-fritz4040 fritz-tffs fritz-caldata u-boot-fritz4040
 endef
 
 define Device/R7500


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:38 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:38 -0400
Subject: [source] ar71xx: add correct named default wireless led by using
 platform leds
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22877.1491654661.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/1f5ea4eae46e46a87353a751637ccb5d5cd5f60b

commit 1f5ea4eae46e46a87353a751637ccb5d5cd5f60b
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Mar 22 21:59:49 2017 +0100

    ar71xx: add correct named default wireless led by using platform leds
    
    Instead of renaming the default wireless led attached to the wireless
    chip, add a new led using the platform leds with the phy0tpt trigger
    set in userspace.
    
    When switching ar71xx to device tree, the same can be done by using the
    build in GPIO controller and without adding new bindings.
    
    Drop the now unused platform code.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |  6 ++--
 .../ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c    | 12 -------
 .../ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h    |  3 --
 .../ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c | 41 +++++++++++-----------
 .../ar71xx/files/arch/mips/ath79/mach-wnr2200.c    |  9 +++--
 5 files changed, 28 insertions(+), 43 deletions(-)

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 1ac3dc4..44d06fc 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -788,7 +788,7 @@ wnr1000-v2|\
 wnr2000-v3)
 	ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
 	ucidef_set_led_default "wan-green" "WAN (green)" "netgear:green:wan" "0"
-	ucidef_set_led_netdev "wlan" "WLAN" "netgear:blue:wlan" "wlan0"
+	ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy0tpt"
 	ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
 	ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
 	ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
@@ -810,7 +810,7 @@ wnr2000-v4)
 wnr2200)
 	ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
 	ucidef_set_led_default "wan-green" "WAN (green)" "netgear:green:wan" "0"
-	ucidef_set_led_netdev "wlan" "WLAN" "netgear:blue:wlan" "wlan0"
+	ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy0tpt"
 	ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
 	ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
 	ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
@@ -823,7 +823,7 @@ wnr2200)
 	;;
 wnr612-v2)
 	ucidef_set_led_netdev "wan" "WAN" "netgear:green:wan" "eth0"
-	ucidef_set_led_netdev "wlan" "WLAN" "netgear:green:wlan" "wlan0"
+	ucidef_set_led_wlan "wlan" "WLAN" "netgear:green:wlan" "phy0tpt"
 	ucidef_set_led_switch "lan1" "LAN1" "netgear:green:lan1" "switch0" "0x02" "0x0f"
 	ucidef_set_led_switch "lan2" "LAN2" "netgear:green:lan2" "switch0" "0x04" "0x0f"
 	;;
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
index 20bb06e..483aed7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
@@ -39,18 +39,6 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
 	}
 }
 
-__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
-{
-	switch (wmac) {
-	case 0:
-		ap9x_wmac0_data.led_name = led_name;
-		break;
-	case 1:
-		ap9x_wmac1_data.led_name = led_name;
-		break;
-	}
-}
-
 __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
 {
 	switch (wmac) {
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
index d7c0185..d2a045f 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
@@ -20,7 +20,6 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
 void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
 void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
 			      int num_leds);
-void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
 void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
 			      unsigned num_btns, unsigned poll_interval);
 struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
@@ -37,8 +36,6 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
 static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
 					    struct gpio_led *leds,
 					    int num_leds) {}
-static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
-						const char *led_name) {}
 static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
 					    struct gpio_keys_button *btns,
 					    unsigned num_btns,
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
index 4961026..6c18dc6 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
@@ -170,12 +170,13 @@ static struct gpio_led wnr2000v3_wmac_leds_gpio[] = {
 		.name		= "netgear:amber:test",
 		.gpio		= WNR2000V3_GPIO_WMAC_LED_TEST_AMBER,
 		.active_low	= 1,
+	}, {
+		.name		= "netgear:blue:wlan",
+		.gpio		= WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE,
+		.active_low	= 1,
 	}
 };
 
-/* Blue WLAN LED for: WNR2000v3, WNR1000v2, WPN824N */
-static const char *wnr2000v3_wmac_led_name = "netgear:blue:wlan";
-
 static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
 	{
 		.name		= "netgear:green:power",
@@ -196,7 +197,13 @@ static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
 	}
 };
 
-static const char *wnr612v2_wmac_led_name = "netgear:green:wlan";
+static struct gpio_led wnr612v2_wmac_leds_gpio[] __initdata = {
+	{
+		.name		= "netgear:green:wlan",
+		.gpio		= WNR612V2_GPIO_WMAC_LED_WLAN_GREEN,
+		.active_low	= 1,
+	}
+};
 
 static struct gpio_led wnr1000v2_leds_gpio[] __initdata = {
 	{
@@ -255,6 +262,10 @@ static struct gpio_led wnr1000v2_wmac_leds_gpio[] = {
 		.name		= "netgear:green:wps",
 		.gpio		= WNR1000V2_GPIO_WMAC_LED_WPS_GREEN,
 		.active_low	= 1,
+	}, {
+		.name		= "netgear:blue:wlan",
+		.gpio		= WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE,
+		.active_low	= 1,
 	}
 };
 
@@ -323,6 +334,10 @@ static struct gpio_led wpn824n_wmac_leds_gpio[] = {
 		.name		= "netgear:amber:test",
 		.gpio		= WPN824N_WGPIO_LED_TEST_AMBER,
 		.active_low	= 1,
+	}, {
+		.name		= "netgear:blue:wlan",
+		.gpio		= WPN824N_WGPIO_LED_WLAN_BLUE,
+		.active_low	= 1,
 	}
 };
 
@@ -504,9 +519,6 @@ static void __init wnr2000v3_setup(void)
 					ARRAY_SIZE(wnr2000v3_keys_gpio),
 					wnr2000v3_keys_gpio);
 
-	ap9x_pci_setup_wmac_led_pin(0, WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE);
-	ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
-
 	ap9x_pci_setup_wmac_leds(0, wnr2000v3_wmac_leds_gpio,
 				 ARRAY_SIZE(wnr2000v3_wmac_leds_gpio));
 
@@ -548,14 +560,8 @@ static void __init wnr612v2_setup(void)
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr612v2_leds_gpio),
 				 wnr612v2_leds_gpio);
 
-	/*
-	 * This device has no buttons on AR7241 GPIO and no extra LEDs
-	 * connected to AR9285 so setup is simpler than for WNR2000v3.
-	 */
-	ap9x_pci_setup_wmac_led_pin(0, WNR612V2_GPIO_WMAC_LED_WLAN_GREEN);
-	ap9x_pci_setup_wmac_led_name(0, wnr612v2_wmac_led_name);
-
-	ap9x_pci_setup_wmac_leds(0, NULL, 0);
+	ap9x_pci_setup_wmac_leds(0, wnr612v2_wmac_leds_gpio,
+				 ARRAY_SIZE(wnr612v2_leds_gpio));
 
 	ap9x_pci_setup_wmac_btns(0, wnr612v2_wmac_keys_gpio,
 				 ARRAY_SIZE(wnr612v2_wmac_keys_gpio),
@@ -595,9 +601,6 @@ static void __init wnr1000v2_setup(void)
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr1000v2_leds_gpio),
 				 wnr1000v2_leds_gpio);
 
-	ap9x_pci_setup_wmac_led_pin(0, WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE);
-	ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
-
 	ap9x_pci_setup_wmac_leds(0, wnr1000v2_wmac_leds_gpio,
 				 ARRAY_SIZE(wnr1000v2_wmac_leds_gpio));
 
@@ -624,8 +627,6 @@ static void __init wpn824n_setup(void)
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(wpn824n_leds_gpio),
 				 wpn824n_leds_gpio);
 
-	ap9x_pci_setup_wmac_led_pin(0, WPN824N_WGPIO_LED_WLAN_BLUE);
-	ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
 	ap9x_pci_setup_wmac_leds(0, wpn824n_wmac_leds_gpio,
 				 ARRAY_SIZE(wpn824n_wmac_leds_gpio));
 	ap9x_pci_setup_wmac_btns(0, wpn824n_wmac_keys_gpio,
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
index 258d254..5421722 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
@@ -109,8 +109,6 @@ static struct gpio_led wnr2200_leds_gpio[] __initdata = {
 	}
 };
 
-static const char *wnr2200_wmac_led_name = "netgear:blue:wlan";
-
 static struct gpio_led wnr2200_wmac_leds_gpio[] = {
 	{
 		.name		= "netgear:amber:test",
@@ -121,6 +119,10 @@ static struct gpio_led wnr2200_wmac_leds_gpio[] = {
 		.gpio		= WNR2200_GPIO_WMAC_LED_POWER_GREEN,
 		.active_low	= 1,
 		.default_state	= LEDS_GPIO_DEFSTATE_ON,
+	}, {
+		.name		= "netgear:blue:wlan",
+		.gpio		= WNR2200_GPIO_WMAC_LED_WLAN_BLUE,
+		.active_low	= 1,
 	}
 };
 
@@ -225,9 +227,6 @@ static void __init wnr2200_setup(void)
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio),
 				 wnr2200_leds_gpio);
 
-	ap9x_pci_setup_wmac_led_pin(0, WNR2200_GPIO_WMAC_LED_WLAN_BLUE);
-	ap9x_pci_setup_wmac_led_name(0, wnr2200_wmac_led_name);
-
 	ap9x_pci_setup_wmac_leds(0, wnr2200_wmac_leds_gpio,
 				 ARRAY_SIZE(wnr2200_wmac_leds_gpio));
 


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:39 -0400
Subject: [source]  ath9k: drop obsolete patch
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22880.1491654661.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/4a4c00e7c4bd3c752fdfecb2c10dc16277e63856

commit 4a4c00e7c4bd3c752fdfecb2c10dc16277e63856
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Mar 25 11:48:02 2017 +0100

    ath9k: drop obsolete patch
    
    Now that the wireless LEDs are added via platform leds this patch isn't
    required any longer.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../patches/546-ath9k_platform_led_name.patch      | 39 ----------------------
 .../patches/548-ath9k_enable_gpio_chip.patch       |  2 +-
 .../patches/549-ath9k_enable_gpio_buttons.patch    |  4 +--
 .../patches/551-ath9k_ubnt_uap_plus_hsr.patch      |  2 +-
 .../generic/files/include/linux/ath9k_platform.h   |  1 -
 5 files changed, 4 insertions(+), 44 deletions(-)

diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
deleted file mode 100644
index ddb3fe6..0000000
--- a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
-Date: Sun, 31 Jan 2016 20:45:57 +0100
-Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
-
-Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
-'ath9k-phy*' label with string set during platform initialization.
-
-Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
----
- drivers/net/wireless/ath/ath9k/gpio.c | 7 +++++--
- include/linux/ath9k_platform.h        | 1 +
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/gpio.c
-+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -166,8 +166,11 @@ void ath_init_leds(struct ath_softc *sc)
- 	if (sc->sc_ah->led_pin < 0)
- 		return;
- 
--	snprintf(led_name, sizeof(led_name), "ath9k-%s",
--		 wiphy_name(sc->hw->wiphy));
-+	if (pdata && pdata->led_name)
-+		strncpy(led_name, pdata->led_name, sizeof(led_name));
-+	else
-+		snprintf(led_name, sizeof(led_name), "ath9k-%s",
-+			 wiphy_name(sc->hw->wiphy));
- 
- 	if (ath9k_led_blink)
- 		trigger = sc->led_default_trigger;
---- a/include/linux/ath9k_platform.h
-+++ b/include/linux/ath9k_platform.h
-@@ -49,6 +49,7 @@ struct ath9k_platform_data {
- 
- 	int num_leds;
- 	const struct gpio_led *leds;
-+	const char *led_name;
- };
- 
- #endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
index 86917eb..31dac29 100644
--- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
+++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
@@ -237,7 +237,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	ath_fill_led_pin(sc);
  
  	if (pdata && pdata->leds && pdata->num_leds)
-@@ -183,6 +327,7 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -180,6 +324,7 @@ void ath_init_leds(struct ath_softc *sc)
  	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  			   !sc->sc_ah->config.led_active_high);
  }
diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
index 4e165dd..f3fead0 100644
--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
+++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
@@ -127,10 +127,10 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  		for (i = 0; i < pdata->num_leds; i++) {
 --- a/include/linux/ath9k_platform.h
 +++ b/include/linux/ath9k_platform.h
-@@ -50,6 +50,10 @@ struct ath9k_platform_data {
+@@ -49,6 +49,10 @@ struct ath9k_platform_data {
+ 
  	int num_leds;
  	const struct gpio_led *leds;
- 	const char *led_name;
 +
 +	unsigned num_btns;
 +	const struct gpio_keys_button *btns;
diff --git a/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch
index 45284c7..bcb0026 100644
--- a/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch
+++ b/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch
@@ -375,7 +375,7 @@
  
 --- a/include/linux/ath9k_platform.h
 +++ b/include/linux/ath9k_platform.h
-@@ -54,6 +54,8 @@ struct ath9k_platform_data {
+@@ -53,6 +53,8 @@ struct ath9k_platform_data {
  	unsigned num_btns;
  	const struct gpio_keys_button *btns;
  	unsigned btn_poll_interval;
diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
index 558445f..f1f2ad4 100644
--- a/target/linux/generic/files/include/linux/ath9k_platform.h
+++ b/target/linux/generic/files/include/linux/ath9k_platform.h
@@ -49,7 +49,6 @@ struct ath9k_platform_data {
 
 	int num_leds;
 	const struct gpio_led *leds;
-	const char *led_name;
 
 	unsigned num_btns;
 	const struct gpio_keys_button *btns;


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:32 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:32 -0400
Subject: [source]  kernel: update MIPS pci fix to the accepted version
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22881.1491654662.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/136718a3d91bb392de8bc04d9fd59d86b4f460c0

commit 136718a3d91bb392de8bc04d9fd59d86b4f460c0
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Mar 25 12:18:56 2017 +0100

    kernel: update MIPS pci fix to the accepted version
    
    Fix the list order instead of adjusting the controller scan order.
    Revert the former required changes to the lantiq PCIe driver.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 ...add-controllers-before-the-specified-head.patch | 31 ++++++++++++++++++++++
 ...PCI-scan-PCI-controllers-in-reverse-order.patch | 31 ----------------------
 .../0001-MIPS-lantiq-add-pcie-driver.patch         |  5 ++--
 3 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/target/linux/generic/patches-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch b/target/linux/generic/patches-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch
new file mode 100644
index 0000000..b6db663
--- /dev/null
+++ b/target/linux/generic/patches-4.9/170-MIPS-PCI-add-controllers-before-the-specified-head.patch
@@ -0,0 +1,31 @@
+From: Mathias Kresin <dev at kresin.me>
+Date: Sun, 26 Mar 2017 19:05:36 +0200
+Subject: MIPS: PCI: add controllers before the specified head
+
+With commit 23dac14d058f ("MIPS: PCI: Use struct list_head lists") new
+controllers are added after the specified head where they were added
+before the specified head previously.
+
+Use list_add_tail to restore the former order.
+
+This patches fixes the following PCI error on lantiq:
+
+  pci 0000:01:00.0: BAR 0: error updating (0x1c000004 != 0x000000)
+
+Fixes: 23dac14d058f ("MIPS: PCI: Use struct list_head lists")
+Signed-off-by: Mathias Kresin <dev at kresin.me>
+---
+ arch/mips/pci/pci-legacy.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/pci/pci-legacy.c
++++ b/arch/mips/pci/pci-legacy.c
+@@ -190,7 +190,7 @@ void register_pci_controller(struct pci_
+ 	}
+ 
+ 	INIT_LIST_HEAD(&hose->list);
+-	list_add(&hose->list, &controllers);
++	list_add_tail(&hose->list, &controllers);
+ 
+ 	/*
+ 	 * Do not panic here but later - this might happen before console init.
diff --git a/target/linux/generic/patches-4.9/170-MIPS-PCI-scan-PCI-controllers-in-reverse-order.patch b/target/linux/generic/patches-4.9/170-MIPS-PCI-scan-PCI-controllers-in-reverse-order.patch
deleted file mode 100644
index 74b54e9..0000000
--- a/target/linux/generic/patches-4.9/170-MIPS-PCI-scan-PCI-controllers-in-reverse-order.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Mathias Kresin <dev at kresin.me>
-Date: Tue, 14 Mar 2017 22:12:12 +0100
-Subject: [PATCH v2] MIPS: PCI: scan PCI controllers in reverse order
-
-Commit 23dac14d058f ("MIPS: PCI: Use struct list_head lists") changed
-the controller list from reverse to straight order without taking care
-of the changed order for the scan of the recorded PCI controllers.
-
-Traverse the list in reverse order to restore the former behaviour.
-
-This patches fixes the following PCI error on lantiq:
-
-  pci 0000:01:00.0: BAR 0: error updating (0x1c000004 != 0x000000)
-
-Fixes: 23dac14d058f ("MIPS: PCI: Use struct list_head lists")
-Signed-off-by: Mathias Kresin <dev at kresin.me>
----
- arch/mips/pci/pci-legacy.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/mips/pci/pci-legacy.c
-+++ b/arch/mips/pci/pci-legacy.c
-@@ -222,7 +222,7 @@ static int __init pcibios_init(void)
- 	struct pci_controller *hose;
- 
- 	/* Scan all of the recorded PCI controllers.  */
--	list_for_each_entry(hose, &controllers, list)
-+	list_for_each_entry_reverse(hose, &controllers, list)
- 		pcibios_scanbus(hose);
- 
- 	pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
diff --git a/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch
index 16d3f55..59d29d8 100644
--- a/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch
+++ b/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch
@@ -4143,7 +4143,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 +
 --- a/arch/mips/pci/pci-legacy.c
 +++ b/arch/mips/pci/pci-legacy.c
-@@ -300,3 +300,31 @@ char *__init pcibios_setup(char *str)
+@@ -300,3 +300,30 @@ char *__init pcibios_setup(char *str)
  		return pcibios_plat_setup(str);
  	return str;
  }
@@ -4164,8 +4164,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 +    int bus_nr = 0;
 +    struct pci_controller *hose;
 +
-+    if (!list_empty(&controllers))
-+        hose = list_last_entry(&controllers, struct pci_controller, list);
++    hose = list_first_entry_or_null(&controllers, struct pci_controller, list);
 +
 +    if (hose != NULL) {
 +        if (hose->bus != NULL) {


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:34 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:34 -0400
Subject: [source]  lantiq: drop tffs patches
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22882.1491654664.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/af9afa2811f0cfb373071b27a03affd77f9e00eb

commit af9afa2811f0cfb373071b27a03affd77f9e00eb
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Mar 25 19:24:26 2017 +0100

    lantiq: drop tffs patches
    
    With the fritz-tools a userspace parser for the Tiny Flash File System
    is available and makes the tffs2 kernel patches obsolete.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../0007-MIPS-lantiq-add-basic-tffs-driver.patch   | 111 ---------------------
 .../0008-MIPS-lantiq-backport-old-timer-code.patch |   2 +-
 ...-lantiq-wifi-and-ethernet-eeprom-handling.patch |   2 +-
 .../0007-MIPS-lantiq-add-basic-tffs-driver.patch   | 111 ---------------------
 4 files changed, 2 insertions(+), 224 deletions(-)

diff --git a/target/linux/lantiq/patches-4.4/0007-MIPS-lantiq-add-basic-tffs-driver.patch b/target/linux/lantiq/patches-4.4/0007-MIPS-lantiq-add-basic-tffs-driver.patch
deleted file mode 100644
index 7081373..0000000
--- a/target/linux/lantiq/patches-4.4/0007-MIPS-lantiq-add-basic-tffs-driver.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From d27ec8bb97db0f60d81ab255d51ac4e967362067 Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic at openwrt.org>
-Date: Thu, 7 Aug 2014 18:34:19 +0200
-Subject: [PATCH 07/36] MIPS: lantiq: add basic tffs driver
-
-Signed-off-by: John Crispin <blogic at openwrt.org>
----
- arch/mips/lantiq/xway/Makefile |    2 +-
- arch/mips/lantiq/xway/tffs.c   |   87 ++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 88 insertions(+), 1 deletion(-)
- create mode 100644 arch/mips/lantiq/xway/tffs.c
-
---- a/arch/mips/lantiq/xway/Makefile
-+++ b/arch/mips/lantiq/xway/Makefile
-@@ -1,5 +1,5 @@
- obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o
- 
--obj-y += vmmc.o
-+obj-y += vmmc.o tffs.o
- 
- obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
---- /dev/null
-+++ b/arch/mips/lantiq/xway/tffs.c
-@@ -0,0 +1,87 @@
-+#include <linux/module.h>
-+#include <linux/mtd/mtd.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+
-+struct tffs_entry {
-+    uint16_t id;
-+    uint16_t len;
-+};
-+
-+static struct tffs_id {
-+	uint32_t id;
-+	char *name;
-+	unsigned char *val;
-+	uint32_t offset;
-+	uint32_t len;
-+} ids[] = {
-+	{ 0x01A9, "annex" },
-+	{ 0x0188, "maca" },
-+	{ 0x0189, "macb" },
-+	{ 0x018a, "macwlan" },
-+	{ 0x0195, "macwlan2" },
-+	{ 0x018b, "macdsl" },
-+	{ 0x01C2, "webgui_pass" },
-+	{ 0x01AB, "wlan_key" },
-+};
-+
-+static struct mtd_info *tffs1, *tffs2;
-+
-+static struct tffs_id* tffs_find_id(int id)
-+{
-+	int i;
-+
-+	for (i = 0; i < ARRAY_SIZE(ids); i++)
-+		if (id == ids[i].id)
-+			return &ids[i];
-+
-+	return NULL;
-+}
-+
-+static void tffs_index(void)
-+{
-+	struct tffs_entry *E = NULL;
-+	struct tffs_entry entry;
-+	int ret, retlen;
-+
-+	while ((unsigned int) E + sizeof(struct tffs_entry) < tffs2->size) {
-+		struct tffs_id *id;
-+		int len;
-+
-+		ret = mtd_read(tffs2, (unsigned int) E, sizeof(struct tffs_entry), &retlen, (unsigned char *)&entry);
-+		if (ret)
-+			return;
-+
-+		if (entry.id == 0xffff)
-+			return;
-+
-+		id = tffs_find_id(entry.id);
-+		if (id) {
-+			id->offset = (uint32_t) E;
-+			id->len = entry.len;
-+			id->val = kzalloc(entry.len + 1, GFP_KERNEL);
-+			mtd_read(tffs2, ((unsigned int) E) + sizeof(struct tffs_entry), entry.len, &retlen, id->val);
-+
-+		}
-+		//printk(KERN_INFO "found entry at 0x%08X-> [<0x%x> %u bytes]\n", (uint32_t) E, entry.id, entry.len);
-+		if (id && id->name)
-+			printk(KERN_INFO "found entry name -> %s=%s\n", id->name, id->val);
-+
-+		len = (entry.len + 3) & ~0x03;
-+		E = (struct tffs_entry *)(((unsigned int)E) + sizeof(struct tffs_entry) + len);
-+	}
-+}
-+
-+static int __init tffs_init(void)
-+{
-+	tffs1 = get_mtd_device_nm("tffs (1)");
-+	tffs2 = get_mtd_device_nm("tffs (2)");
-+	if (IS_ERR(tffs1) || IS_ERR(tffs2))
-+		return -1;
-+
-+	tffs_index();
-+
-+	return 0;
-+}
-+late_initcall(tffs_init);
-+
diff --git a/target/linux/lantiq/patches-4.4/0008-MIPS-lantiq-backport-old-timer-code.patch b/target/linux/lantiq/patches-4.4/0008-MIPS-lantiq-backport-old-timer-code.patch
index 5525503..f36a79a 100644
--- a/target/linux/lantiq/patches-4.4/0008-MIPS-lantiq-backport-old-timer-code.patch
+++ b/target/linux/lantiq/patches-4.4/0008-MIPS-lantiq-backport-old-timer-code.patch
@@ -176,7 +176,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 -obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o
 +obj-y := prom.o sysctrl.o clk.o reset.o dma.o timer.o dcdc.o
  
- obj-y += vmmc.o tffs.o
+ obj-y += vmmc.o
  
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/timer.c
diff --git a/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch b/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
index 73b3c3a..15ecdb3 100644
--- a/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ b/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -29,7 +29,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 +++ b/arch/mips/lantiq/xway/Makefile
 @@ -2,4 +2,7 @@ obj-y := prom.o sysctrl.o clk.o reset.o
  
- obj-y += vmmc.o tffs.o
+ obj-y += vmmc.o
  
 +obj-y += eth_mac.o
 +obj-$(CONFIG_PCI) += ath5k_eep.o
diff --git a/target/linux/lantiq/patches-4.9/0007-MIPS-lantiq-add-basic-tffs-driver.patch b/target/linux/lantiq/patches-4.9/0007-MIPS-lantiq-add-basic-tffs-driver.patch
deleted file mode 100644
index 7081373..0000000
--- a/target/linux/lantiq/patches-4.9/0007-MIPS-lantiq-add-basic-tffs-driver.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From d27ec8bb97db0f60d81ab255d51ac4e967362067 Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic at openwrt.org>
-Date: Thu, 7 Aug 2014 18:34:19 +0200
-Subject: [PATCH 07/36] MIPS: lantiq: add basic tffs driver
-
-Signed-off-by: John Crispin <blogic at openwrt.org>
----
- arch/mips/lantiq/xway/Makefile |    2 +-
- arch/mips/lantiq/xway/tffs.c   |   87 ++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 88 insertions(+), 1 deletion(-)
- create mode 100644 arch/mips/lantiq/xway/tffs.c
-
---- a/arch/mips/lantiq/xway/Makefile
-+++ b/arch/mips/lantiq/xway/Makefile
-@@ -1,5 +1,5 @@
- obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o
- 
--obj-y += vmmc.o
-+obj-y += vmmc.o tffs.o
- 
- obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
---- /dev/null
-+++ b/arch/mips/lantiq/xway/tffs.c
-@@ -0,0 +1,87 @@
-+#include <linux/module.h>
-+#include <linux/mtd/mtd.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+
-+struct tffs_entry {
-+    uint16_t id;
-+    uint16_t len;
-+};
-+
-+static struct tffs_id {
-+	uint32_t id;
-+	char *name;
-+	unsigned char *val;
-+	uint32_t offset;
-+	uint32_t len;
-+} ids[] = {
-+	{ 0x01A9, "annex" },
-+	{ 0x0188, "maca" },
-+	{ 0x0189, "macb" },
-+	{ 0x018a, "macwlan" },
-+	{ 0x0195, "macwlan2" },
-+	{ 0x018b, "macdsl" },
-+	{ 0x01C2, "webgui_pass" },
-+	{ 0x01AB, "wlan_key" },
-+};
-+
-+static struct mtd_info *tffs1, *tffs2;
-+
-+static struct tffs_id* tffs_find_id(int id)
-+{
-+	int i;
-+
-+	for (i = 0; i < ARRAY_SIZE(ids); i++)
-+		if (id == ids[i].id)
-+			return &ids[i];
-+
-+	return NULL;
-+}
-+
-+static void tffs_index(void)
-+{
-+	struct tffs_entry *E = NULL;
-+	struct tffs_entry entry;
-+	int ret, retlen;
-+
-+	while ((unsigned int) E + sizeof(struct tffs_entry) < tffs2->size) {
-+		struct tffs_id *id;
-+		int len;
-+
-+		ret = mtd_read(tffs2, (unsigned int) E, sizeof(struct tffs_entry), &retlen, (unsigned char *)&entry);
-+		if (ret)
-+			return;
-+
-+		if (entry.id == 0xffff)
-+			return;
-+
-+		id = tffs_find_id(entry.id);
-+		if (id) {
-+			id->offset = (uint32_t) E;
-+			id->len = entry.len;
-+			id->val = kzalloc(entry.len + 1, GFP_KERNEL);
-+			mtd_read(tffs2, ((unsigned int) E) + sizeof(struct tffs_entry), entry.len, &retlen, id->val);
-+
-+		}
-+		//printk(KERN_INFO "found entry at 0x%08X-> [<0x%x> %u bytes]\n", (uint32_t) E, entry.id, entry.len);
-+		if (id && id->name)
-+			printk(KERN_INFO "found entry name -> %s=%s\n", id->name, id->val);
-+
-+		len = (entry.len + 3) & ~0x03;
-+		E = (struct tffs_entry *)(((unsigned int)E) + sizeof(struct tffs_entry) + len);
-+	}
-+}
-+
-+static int __init tffs_init(void)
-+{
-+	tffs1 = get_mtd_device_nm("tffs (1)");
-+	tffs2 = get_mtd_device_nm("tffs (2)");
-+	if (IS_ERR(tffs1) || IS_ERR(tffs2))
-+		return -1;
-+
-+	tffs_index();
-+
-+	return 0;
-+}
-+late_initcall(tffs_init);
-+


From lede-commits at lists.infradead.org  Sat Apr  8 05:30:35 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:30:35 -0400
Subject: [source] ath9k: unset the default LED pin if used by platform leds
In-Reply-To: <20170408123032.12825.92106@git-01.infra.lede-project.org>
References: <20170408123032.12825.92106@git-01.infra.lede-project.org>
Message-ID: <mailman.22883.1491654664.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/192f0a3db8598fc6faa47788d0152bda54c5109a

commit 192f0a3db8598fc6faa47788d0152bda54c5109a
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Tue Mar 21 23:21:57 2017 +0100

    ath9k: unset the default LED pin if used by platform leds
    
    Unset the default LED gpio pin if the same gpio pin is used by a LED
    defined via platform LED. This prevents that the default led trigger
    gets assigned to this LED and the GPIO value gets changed on
    wifi up/down in case the led is not used for signaling the wifi state.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../patches/531-ath9k_extra_platform_leds.patch     | 21 +++++++++++++--------
 .../patches/546-ath9k_platform_led_name.patch       | 12 ++++++------
 .../patches/548-ath9k_enable_gpio_chip.patch        | 12 ++++++------
 .../patches/549-ath9k_enable_gpio_buttons.patch     | 13 ++-----------
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
index 35d8e8b..8ed7ad8 100644
--- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
+++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
@@ -56,16 +56,21 @@
  
  	INIT_LIST_HEAD(&sc->leds);
  
-@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc)
  
- 	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
- 			   !sc->sc_ah->config.led_active_high);
+ 	ath_fill_led_pin(sc);
+ 
++	if (pdata && pdata->leds && pdata->num_leds)
++		for (i = 0; i < pdata->num_leds; i++) {
++			if (pdata->leds[i].gpio == sc->sc_ah->led_pin)
++				sc->sc_ah->led_pin = -1;
++
++			ath_create_platform_led(sc, &pdata->leds[i]);
++		}
 +
-+	if (!pdata)
++	if (sc->sc_ah->led_pin < 0)
 +		return;
 +
-+	for (i = 0; i < pdata->num_leds; i++)
-+		ath_create_platform_led(sc, &pdata->leds[i]);
- }
- #endif
+ 	snprintf(led_name, sizeof(led_name), "ath9k-%s",
+ 		 wiphy_name(sc->hw->wiphy));
  
diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
index ced72c6..ddb3fe6 100644
--- a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
+++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
@@ -7,15 +7,15 @@ Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
 
 Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
 ---
- drivers/net/wireless/ath/ath9k/gpio.c |   10 +++++++---
- include/linux/ath9k_platform.h        |    1 +
- 2 files changed, 8 insertions(+), 3 deletions(-)
+ drivers/net/wireless/ath/ath9k/gpio.c | 7 +++++--
+ include/linux/ath9k_platform.h        | 1 +
+ 2 files changed, 6 insertions(+), 2 deletions(-)
 
 --- a/drivers/net/wireless/ath/ath9k/gpio.c
 +++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
- 
- 	ath_fill_led_pin(sc);
+@@ -166,8 +166,11 @@ void ath_init_leds(struct ath_softc *sc)
+ 	if (sc->sc_ah->led_pin < 0)
+ 		return;
  
 -	snprintf(led_name, sizeof(led_name), "ath9k-%s",
 -		 wiphy_name(sc->hw->wiphy));
diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
index d426928..4e28abb 100644
--- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
+++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
@@ -221,12 +221,12 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
 +	ath9k_register_gpio_chip(sc);
 +
- 	if (pdata && pdata->led_name)
- 		strncpy(led_name, pdata->led_name, sizeof(led_name));
- 	else
-@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
- 	for (i = 0; i < pdata->num_leds; i++)
- 		ath_create_platform_led(sc, &pdata->leds[i]);
+ 	if (pdata && pdata->leds && pdata->num_leds)
+ 		for (i = 0; i < pdata->num_leds; i++) {
+ 			if (pdata->leds[i].gpio == sc->sc_ah->led_pin)
+@@ -183,6 +319,7 @@ void ath_init_leds(struct ath_softc *sc)
+ 	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
+ 			   !sc->sc_ah->config.led_active_high);
  }
 +
  #endif
diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
index f40bac9..8aefcf4 100644
--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
+++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
@@ -123,17 +123,8 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	ath9k_register_gpio_chip(sc);
 +	ath9k_init_buttons(sc);
  
- 	if (pdata && pdata->led_name)
- 		strncpy(led_name, pdata->led_name, sizeof(led_name));
-@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
- 	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
- 			   !sc->sc_ah->config.led_active_high);
- 
--	if (!pdata)
-+	if (!pdata || !pdata->leds || !pdata->num_leds)
- 		return;
- 
- 	for (i = 0; i < pdata->num_leds; i++)
+ 	if (pdata && pdata->leds && pdata->num_leds)
+ 		for (i = 0; i < pdata->num_leds; i++) {
 --- a/include/linux/ath9k_platform.h
 +++ b/include/linux/ath9k_platform.h
 @@ -50,6 +50,10 @@ struct ath9k_platform_data {


From lede-commits at lists.infradead.org  Sat Apr  8 05:32:45 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:32:45 -0400
Subject: [source]  opkg: switch to LEDE fork (#120, #551, #571)
In-Reply-To: <20170408123245.13299.50978@git-01.infra.lede-project.org>
References: <20170408123245.13299.50978@git-01.infra.lede-project.org>
Message-ID: <mailman.22885.1491654795.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/5aa97e35dec1783c98d0f28502b2d16879ffc8ee

commit 5aa97e35dec1783c98d0f28502b2d16879ffc8ee
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Feb 16 17:36:47 2017 +0100

    opkg: switch to LEDE fork (#120, #551, #571)
    
    Cherry-pick the following commits from master to bump opkg in LEDE 17.01:
    
    b65dc04712 opkg: switch to own fork to improve memory usage
    55ffc38004 opkg: re-enable usign support
    19720a6f03 opkg: fix handling conffiles in status lists
    9e4555f58d opkg: fix stray printf() (#551)
    ebf846b005 opkg: mark as essential (FS#571)
    aedd5d5cb0 opkg: fix several package installation bugs
    48ae44d033 opkg: gracefully handle missing $PATH, fix build warnings
    1449b52f02 opkg: backport upstream fixes, code cleanups
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/system/opkg/Makefile                       |  92 +--
 package/system/opkg/patches/001-ship-pkg-m4.patch  | 168 -----
 package/system/opkg/patches/002-no-shave.patch     |  37 -
 package/system/opkg/patches/004-host_cpu.patch     |  20 -
 package/system/opkg/patches/007-force_static.patch |  71 --
 .../opkg/patches/009-remove-upgrade-all.patch      |  41 --
 .../opkg/patches/011-old-config-location.patch     |  12 -
 .../012-strip-trailing-conffiles-whitespace.patch  |  23 -
 .../system/opkg/patches/014-errors-to-stderr.patch |  15 -
 .../system/opkg/patches/020-avoid_getline.patch    | 317 --------
 .../system/opkg/patches/030-fix-double-free.patch  |  10 -
 .../040-wrap-descriptions-only-on-ttys.patch       |  31 -
 .../patches/050-add-case-insensitive-flag.patch    | 169 -----
 .../system/opkg/patches/060-add-find-command.patch |  58 --
 .../opkg/patches/070-use_external_gzip.patch       | 719 ------------------
 .../opkg/patches/071-use_gzipped_pkg_list.patch    | 124 ----
 .../080-suppress-blank-package-fields.patch        |  16 -
 .../090-suppress-blank-provides-field.patch        |  11 -
 .../opkg/patches/100-add-force-checksum.patch      |  85 ---
 package/system/opkg/patches/110-upgrade.patch      |  50 --
 .../system/opkg/patches/200-usign_support.patch    |  91 ---
 .../opkg/patches/210-add-force-signature.patch     |  70 --
 .../opkg/patches/220-drop-release-support.patch    | 812 ---------------------
 .../system/opkg/patches/230-drop_md5_support.patch | 192 -----
 .../240-fix-force-checksum-for-sha256.patch        |  31 -
 .../opkg/patches/250-add-lists-dir-switch.patch    |  39 -
 .../opkg/patches/260-add-print-package-size.patch  |  74 --
 .../opkg/patches/270-fix-use-after-free.patch      |  11 -
 ...-call-prerm-and-postrm-scripts-on-upgrade.patch |  73 --
 .../opkg/patches/290-clarify-download-errors.patch |  61 --
 30 files changed, 27 insertions(+), 3496 deletions(-)

diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index 39e6b4d..1101169 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -11,15 +11,14 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=opkg
-PKG_RELEASE:=17
+PKG_RELEASE:=1
+PKG_FLAGS:=essential
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
-PKG_SOURCE_DATE:=2011-04-08
-PKG_SOURCE_VERSION:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
-PKG_MIRROR_HASH:=55e05270f3eb2f3aff5d3791463ce3d13b8197ca7b301cd58e731a249552c48f
-PKG_FIXUP:=autoreconf
-PKG_REMOVE_FILES = autogen.sh aclocal.m4
+PKG_SOURCE_URL:=https://git.lede-project.org/project/opkg-lede.git
+PKG_SOURCE_DATE:=2017-03-23
+PKG_SOURCE_VERSION:=1d0263bb40e3c099501fc1f2431907636230e7f2
+PKG_MIRROR_HASH:=1f527179e60b9404affa5f3c9c506d4249e085bf521f770819b8648273a1010c
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
@@ -27,21 +26,24 @@ PKG_LICENSE_FILES:=COPYING
 PKG_MAINTAINER:=Jo-Philipp Wich <jo at mein.io>
 
 PKG_FLAGS := nonshared
-PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
+PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH
 
 PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
 
+HOST_BUILD_DEPENDS:=libubox/host
+
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
 
 define Package/opkg
   SECTION:=base
   CATEGORY:=Base system
   TITLE:=opkg package manager
-  DEPENDS:=+uclient-fetch +libpthread
-  URL:=http://wiki.openmoko.org/wiki/Opkg
+  DEPENDS:=+uclient-fetch +libpthread +libubox
+  URL:=https://git.lede-project.org/?p=project/opkg-lede.git
   MENU:=1
 endef
 
@@ -55,16 +57,6 @@ define Package/opkg/description
   opkg knows how to install both .ipk and .deb packages.
 endef
 
-define Package/opkg/config
-config OPKG_SUPPORT_MD5
-  bool
-  default n
-  depends on PACKAGE_opkg
-  prompt "Support reading old md5 hashes."
-  help
-	Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
-endef
-
 define Package/opkg/conffiles
 /etc/opkg.conf
 /etc/opkg/keys/
@@ -74,29 +66,20 @@ endef
 TARGET_CFLAGS += -ffunction-sections -fdata-sections
 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
 
-CONFIGURE_ARGS += \
-	--disable-curl \
-	--disable-gpg \
-	--enable-sha256 \
-	--with-opkgetcdir=/etc \
-	--with-opkglockfile=/var/lock/opkg.lock
-
-ifndef CONFIG_SIGNED_PACKAGES
-  CONFIGURE_ARGS += --disable-usign
-endif
-ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
-  CONFIGURE_ARGS += --enable-md5
-else
-  CONFIGURE_ARGS += --disable-md5
-endif
-
-MAKE_FLAGS = \
-		CC="$(TARGET_CC)" \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		HOST_CPU="$(PKGARCH)" \
-		LDFLAGS="-Wl,--gc-sections" \
-
-define Package/opkg/Default/install
+CMAKE_OPTIONS += \
+	-DBUILD_TESTS=OFF \
+	-DHOST_CPU=$(PKGARCH) \
+	-DPATH_SPEC="$(TARGET_INIT_PATH)" \
+	-DVERSION="$(PKG_SOURCE_VERSION) ($(PKG_SOURCE_DATE))"
+
+CMAKE_HOST_OPTIONS += \
+	-DSTATIC_UBOX=ON \
+	-DBUILD_TESTS=OFF \
+	-DHOST_CPU=$(PKGARCH) \
+	-DLOCK_FILE=/tmp/opkg.lock \
+	-DVERSION="$(PKG_SOURCE_VERSION) ($(PKG_SOURCE_DATE))"
+
+define Package/opkg/install
 	$(INSTALL_DIR) $(1)/usr/lib/opkg
 	$(INSTALL_DIR) $(1)/bin
 	$(INSTALL_DIR) $(1)/etc/opkg
@@ -107,34 +90,13 @@ define Package/opkg/Default/install
 	$(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
 	$(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
-endef
-
-define Package/opkg/install
-	$(call Package/opkg/Default/install,$(1),)
   ifneq ($(CONFIG_SIGNED_PACKAGES),)
 	echo "option check_signature 1" >> $(1)/etc/opkg.conf
   endif
-	mkdir $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
 endef
 
-define Build/InstallDev
-	mkdir -p $(1)/usr/include
-	$(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
-endef
-
-
-HOST_CONFIGURE_ARGS+= \
-	--disable-curl \
-	--disable-gpg \
-	--enable-sha256 \
-	--with-opkgetcdir=/etc \
-	--with-opkglockfile=/tmp/opkg.lock
-
-define Host/Compile
-	+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
-endef
-
 define Host/Install
 	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
 endef
diff --git a/package/system/opkg/patches/001-ship-pkg-m4.patch b/package/system/opkg/patches/001-ship-pkg-m4.patch
deleted file mode 100644
index 4ca0f88..0000000
--- a/package/system/opkg/patches/001-ship-pkg-m4.patch
+++ /dev/null
@@ -1,168 +0,0 @@
---- /dev/null
-+++ b/m4/pkg.m4
-@@ -0,0 +1,157 @@
-+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-+# 
-+# Copyright ? 2004 Scott James Remnant <scott at netsplit.com>.
-+#
-+# 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; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful, but
-+# WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+# General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+#
-+# As a special exception to the GNU General Public License, if you
-+# distribute this file as part of a program that contains a
-+# configuration script generated by Autoconf, you may include it under
-+# the same distribution terms that you use for the rest of that program.
-+
-+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-+# ----------------------------------
-+AC_DEFUN([PKG_PROG_PKG_CONFIG],
-+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-+fi
-+if test -n "$PKG_CONFIG"; then
-+	_pkg_min_version=m4_default([$1], [0.9.0])
-+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-+		AC_MSG_RESULT([yes])
-+	else
-+		AC_MSG_RESULT([no])
-+		PKG_CONFIG=""
-+	fi
-+		
-+fi[]dnl
-+])# PKG_PROG_PKG_CONFIG
-+
-+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-+#
-+# Check to see whether a particular set of modules exists.  Similar
-+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-+#
-+#
-+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-+# this or PKG_CHECK_MODULES is called, or make sure to call
-+# PKG_CHECK_EXISTS manually
-+# --------------------------------------------------------------
-+AC_DEFUN([PKG_CHECK_EXISTS],
-+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-+if test -n "$PKG_CONFIG" && \
-+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-+  m4_ifval([$2], [$2], [:])
-+m4_ifvaln([$3], [else
-+  $3])dnl
-+fi])
-+
-+
-+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-+# ---------------------------------------------
-+m4_define([_PKG_CONFIG],
-+[if test -n "$PKG_CONFIG"; then
-+    if test -n "$$1"; then
-+        pkg_cv_[]$1="$$1"
-+    else
-+        PKG_CHECK_EXISTS([$3],
-+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
-+			 [pkg_failed=yes])
-+    fi
-+else
-+	pkg_failed=untried
-+fi[]dnl
-+])# _PKG_CONFIG
-+
-+# _PKG_SHORT_ERRORS_SUPPORTED
-+# -----------------------------
-+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-+        _pkg_short_errors_supported=yes
-+else
-+        _pkg_short_errors_supported=no
-+fi[]dnl
-+])# _PKG_SHORT_ERRORS_SUPPORTED
-+
-+
-+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-+# [ACTION-IF-NOT-FOUND])
-+#
-+#
-+# Note that if there is a possibility the first call to
-+# PKG_CHECK_MODULES might not happen, you should be sure to include an
-+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-+#
-+#
-+# --------------------------------------------------------------
-+AC_DEFUN([PKG_CHECK_MODULES],
-+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-+
-+pkg_failed=no
-+AC_MSG_CHECKING([for $1])
-+
-+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-+
-+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-+and $1[]_LIBS to avoid the need to call pkg-config.
-+See the pkg-config man page for more details.])
-+
-+if test $pkg_failed = yes; then
-+        _PKG_SHORT_ERRORS_SUPPORTED
-+        if test $_pkg_short_errors_supported = yes; then
-+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
-+        else 
-+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-+        fi
-+	# Put the nasty error message in config.log where it belongs
-+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-+
-+	ifelse([$4], , [AC_MSG_ERROR(dnl
-+[Package requirements ($2) were not met:
-+
-+$$1_PKG_ERRORS
-+
-+Consider adjusting the PKG_CONFIG_PATH environment variable if you
-+installed software in a non-standard prefix.
-+
-+_PKG_TEXT
-+])],
-+		[AC_MSG_RESULT([no])
-+                $4])
-+elif test $pkg_failed = untried; then
-+	ifelse([$4], , [AC_MSG_FAILURE(dnl
-+[The pkg-config script could not be found or is too old.  Make sure it
-+is in your PATH or set the PKG_CONFIG environment variable to the full
-+path to pkg-config.
-+
-+_PKG_TEXT
-+
-+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
-+		[$4])
-+else
-+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-+        AC_MSG_RESULT([yes])
-+	ifelse([$3], , :, [$3])
-+fi[]dnl
-+])# PKG_CHECK_MODULES
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -1,4 +1,4 @@
--ACLOCAL_AMFLAGS = -I shave
-+ACLOCAL_AMFLAGS = -I shave -I m4
- 
- SUBDIRS = libbb libopkg src tests utils man
- 
diff --git a/package/system/opkg/patches/002-no-shave.patch b/package/system/opkg/patches/002-no-shave.patch
deleted file mode 100644
index 313aa71..0000000
--- a/package/system/opkg/patches/002-no-shave.patch
+++ /dev/null
@@ -1,37 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -4,7 +4,6 @@ AC_CONFIG_SRCDIR([libopkg/pkg.c])
- 
- AC_CONFIG_AUX_DIR([conf])
- AC_CONFIG_MACRO_DIR([m4])
--AC_CONFIG_MACRO_DIR([shave])
- 
- AM_INIT_AUTOMAKE
- AM_CONFIG_HEADER(libopkg/config.h)
-@@ -277,9 +276,6 @@ AC_SUBST(opkgetcdir)
- AC_SUBST(opkglockfile)
- AC_SUBST([CLEAN_DATE])
- 
--# Setup output beautifier.
--SHAVE_INIT([shave], [enable])
--
- AC_OUTPUT(
-     Makefile
-     libopkg/Makefile
-@@ -289,8 +285,6 @@ AC_OUTPUT(
-     utils/Makefile
-     utils/update-alternatives
-     libopkg.pc
--    shave/shave
--    shave/shave-libtool
-     man/Makefile
-     man/opkg-cl.1
-     man/opkg-key.1
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -1,4 +1,4 @@
--ACLOCAL_AMFLAGS = -I shave -I m4
-+ACLOCAL_AMFLAGS = -I m4
- 
- SUBDIRS = libbb libopkg src tests utils man
- 
diff --git a/package/system/opkg/patches/004-host_cpu.patch b/package/system/opkg/patches/004-host_cpu.patch
deleted file mode 100644
index d500d60..0000000
--- a/package/system/opkg/patches/004-host_cpu.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/libbb/Makefile.am
-+++ b/libbb/Makefile.am
-@@ -1,6 +1,6 @@
- HOST_CPU=@host_cpu@
- BUILD_CPU=@build_cpu@
--ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@
-+ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@
- 
- noinst_LTLIBRARIES = libbb.la
- 
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -1,5 +1,5 @@
--
--AM_CFLAGS=-Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DOPKGLOCKFILE=\"@opkglockfile@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
-+HOST_CPU=@host_cpu@
-+AM_CFLAGS=-Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DOPKGLOCKFILE=\"@opkglockfile@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
- 
- libopkg_includedir=$(includedir)/libopkg
- libopkg_include_HEADERS= *.h
diff --git a/package/system/opkg/patches/007-force_static.patch b/package/system/opkg/patches/007-force_static.patch
deleted file mode 100644
index 7497707..0000000
--- a/package/system/opkg/patches/007-force_static.patch
+++ /dev/null
@@ -1,71 +0,0 @@
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -38,16 +38,10 @@ if HAVE_SHA256
- opkg_util_sources += sha256.c sha256.h
- endif
- 
--lib_LTLIBRARIES = libopkg.la
--libopkg_la_SOURCES = \
-+noinst_LIBRARIES = libopkg.a
-+libopkg_a_SOURCES = \
- 	$(opkg_libcore_sources) \
- 	$(opkg_cmd_sources) $(opkg_db_sources) \
- 	$(opkg_util_sources) $(opkg_list_sources)
- 
--libopkg_la_LIBADD = $(top_builddir)/libbb/libbb.la $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
--
--# make sure we only export symbols that are for public use
--#libopkg_la_LDFLAGS = -export-symbols-regex "^opkg_.*"
--
--
--
-+libopkg_a_LIBADD = $(top_builddir)/libbb/libbb.a
---- a/libbb/Makefile.am
-+++ b/libbb/Makefile.am
-@@ -2,9 +2,9 @@ HOST_CPU=@host_cpu@
- BUILD_CPU=@build_cpu@
- ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@
- 
--noinst_LTLIBRARIES = libbb.la
-+noinst_LIBRARIES = libbb.a
- 
--libbb_la_SOURCES = gz_open.c \
-+libbb_a_SOURCES = gz_open.c \
- 	libbb.h \
- 	unzip.c \
- 	wfopen.c \
---- a/tests/Makefile.am
-+++ b/tests/Makefile.am
-@@ -4,11 +4,11 @@ AM_CFLAGS = $(ALL_CFLAGS) -Wall -g -O3 -
- #noinst_PROGRAMS = libopkg_test opkg_active_list_test
- noinst_PROGRAMS = libopkg_test
- 
--#opkg_hash_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la
-+#opkg_hash_test_LDADD = $(top_builddir)/libbb/libbb.a $(top_builddir)/libopkg/libopkg.a
- #opkg_hash_test_SOURCES = opkg_hash_test.c
- #opkg_hash_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
--#opkg_extract_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la
-+#opkg_extract_test_LDADD = $(top_builddir)/libbb/libbb.a $(top_builddir)/libopkg/libopkg.a
- #opkg_extract_test_SOURCES = opkg_extract_test.c
- #opkg_extract_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
-@@ -16,7 +16,7 @@ noinst_PROGRAMS = libopkg_test
- #opkg_active_list_test_SOURCES = opkg_active_list_test.c
- #opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
--libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.la
-+libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
- libopkg_test_SOURCE = libopkg_test.c
- libopkg_test_LDFLAGS = -static
- 
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -2,5 +2,5 @@ AM_CFLAGS = -I${top_srcdir}/libopkg ${AL
- bin_PROGRAMS = opkg-cl
- 
- opkg_cl_SOURCES = opkg-cl.c
--opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.la \
--                $(top_builddir)/libbb/libbb.la 
-+opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.a \
-+                $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
diff --git a/package/system/opkg/patches/009-remove-upgrade-all.patch b/package/system/opkg/patches/009-remove-upgrade-all.patch
deleted file mode 100644
index 395a2a6..0000000
--- a/package/system/opkg/patches/009-remove-upgrade-all.patch
+++ /dev/null
@@ -1,41 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -551,18 +551,6 @@ opkg_upgrade_cmd(int argc, char **argv)
- 			    err = -1;
-                }
- 	  }
--     } else {
--	  pkg_vec_t *installed = pkg_vec_alloc();
--
--	  pkg_info_preinstall_check();
--
--	  pkg_hash_fetch_all_installed(installed);
--	  for (i = 0; i < installed->len; i++) {
--	       pkg = installed->pkgs[i];
--	       if (opkg_upgrade_pkg(pkg))
--		       err = -1;
--	  }
--	  pkg_vec_free(installed);
-      }
- 
-      if (opkg_configure_packages(NULL))
-@@ -1258,7 +1246,7 @@ opkg_print_architecture_cmd(int argc, ch
-    array for easier maintenance */
- static opkg_cmd_t cmds[] = {
-      {"update", 0, (opkg_cmd_fun_t)opkg_update_cmd, PFM_DESCRIPTION|PFM_SOURCE},
--     {"upgrade", 0, (opkg_cmd_fun_t)opkg_upgrade_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-+     {"upgrade", 1, (opkg_cmd_fun_t)opkg_upgrade_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd, PFM_SOURCE},
-      {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE},
-      {"list-installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE},
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -221,7 +221,7 @@ usage()
- 
- 	printf("\nPackage Manipulation:\n");
- 	printf("\tupdate			Update list of available packages\n");
--	printf("\tupgrade			Upgrade installed packages\n");
-+	printf("\tupgrade <pkgs>		Upgrade packages\n");
- 	printf("\tinstall <pkgs>		Install package(s)\n");
- 	printf("\tconfigure <pkgs>	Configure unpacked package(s)\n");
- 	printf("\tremove <pkgs|regexp>	Remove package(s)\n");
diff --git a/package/system/opkg/patches/011-old-config-location.patch b/package/system/opkg/patches/011-old-config-location.patch
deleted file mode 100644
index 0555926..0000000
--- a/package/system/opkg/patches/011-old-config-location.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -207,6 +207,9 @@ args_parse(int argc, char *argv[])
- 		}
- 	}
- 
-+	if(!conf->conf_file && !conf->offline_root)
-+		conf->conf_file = xstrdup("/etc/opkg.conf");
-+
- 	if (parse_err)
- 		return parse_err;
- 	else
diff --git a/package/system/opkg/patches/012-strip-trailing-conffiles-whitespace.patch b/package/system/opkg/patches/012-strip-trailing-conffiles-whitespace.patch
deleted file mode 100644
index a47ae77..0000000
--- a/package/system/opkg/patches/012-strip-trailing-conffiles-whitespace.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -274,6 +274,7 @@ unpack_pkg_control_files(pkg_t *pkg)
-      while (1) {
- 	  char *cf_name;
- 	  char *cf_name_in_dest;
-+	  int i;
- 
- 	  cf_name = file_read_line_alloc(conffiles_file);
- 	  if (cf_name == NULL) {
-@@ -282,6 +283,12 @@ unpack_pkg_control_files(pkg_t *pkg)
- 	  if (cf_name[0] == '\0') {
- 	       continue;
- 	  }
-+	  for (i = strlen(cf_name) - 1;
-+	       (i >= 0) && (cf_name[i] == ' ' || cf_name[i] == '\t');
-+	       i--
-+	  ) {
-+	       cf_name[i] = '\0';
-+	  }
- 
- 	  /* Prepend dest->root_dir to conffile name.
- 	     Take pains to avoid multiple slashes. */
diff --git a/package/system/opkg/patches/014-errors-to-stderr.patch b/package/system/opkg/patches/014-errors-to-stderr.patch
deleted file mode 100644
index f0a93a8..0000000
--- a/package/system/opkg/patches/014-errors-to-stderr.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/libopkg/opkg_message.c
-+++ b/libopkg/opkg_message.c
-@@ -64,10 +64,10 @@ print_error_list(void)
- 	struct errlist *err = error_list_head;
- 
- 	if (err) {
--		printf("Collected errors:\n");
-+		fprintf(stderr, "Collected errors:\n");
- 		/* Here we print the errors collected and free the list */
- 		while (err != NULL) {
--			printf(" * %s", err->errmsg);
-+			fprintf(stderr, " * %s", err->errmsg);
- 			err = err->next;
- 		}
- 	}
diff --git a/package/system/opkg/patches/020-avoid_getline.patch b/package/system/opkg/patches/020-avoid_getline.patch
deleted file mode 100644
index 8a1a8f6..0000000
--- a/package/system/opkg/patches/020-avoid_getline.patch
+++ /dev/null
@@ -1,317 +0,0 @@
---- a/libopkg/parse_util.c
-+++ b/libopkg/parse_util.c
-@@ -22,6 +22,7 @@
- #include "libbb/libbb.h"
- 
- #include "parse_util.h"
-+#include "pkg_parse.h"
- 
- int
- is_field(const char *type, const char *line)
-@@ -86,3 +87,84 @@ parse_list(const char *raw, unsigned int
- 	*count = line_count;
- 	return depends;
- }
-+
-+int
-+parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE *fp, uint mask,
-+						char **buf0, size_t buf0len)
-+{
-+	int ret, lineno;
-+	char *buf, *nl;
-+	size_t buflen;
-+
-+	lineno = 1;
-+	ret = 0;
-+
-+	buflen = buf0len;
-+	buf = *buf0;
-+	buf[0] = '\0';
-+
-+	while (1) {
-+		if (fgets(buf, (int)buflen, fp) == NULL) {
-+			if (ferror(fp)) {
-+				opkg_perror(ERROR, "fgets");
-+				ret = -1;
-+			} else if (strlen(*buf0) == buf0len-1) {
-+				opkg_msg(ERROR, "Missing new line character"
-+						" at end of file!\n");
-+				parse_line(item, *buf0, mask);
-+			}
-+			break;
-+		}
-+
-+		nl = strchr(buf, '\n');
-+		if (nl == NULL) {
-+			if (strlen(buf) < buflen-1) {
-+				/*
-+				 * Line could be exactly buflen-1 long and
-+				 * missing a newline, but we won't know until
-+				 * fgets fails to read more data.
-+				 */
-+				opkg_msg(ERROR, "Missing new line character"
-+						" at end of file!\n");
-+				parse_line(item, *buf0, mask);
-+				break;
-+			}
-+			if (buf0len >= EXCESSIVE_LINE_LEN) {
-+				opkg_msg(ERROR, "Excessively long line at "
-+					"%d. Corrupt file?\n",
-+					lineno);
-+				ret = -1;
-+				break;
-+			}
-+
-+			/*
-+			 * Realloc and point buf past the data already read,
-+			 * at the NULL terminator inserted by fgets.
-+			 * |<--------------- buf0len ----------------->|
-+			 * |                     |<------- buflen ---->|
-+			 * |---------------------|---------------------|
-+			 * buf0                   buf
-+			 */
-+			buflen = buf0len +1;
-+			buf0len *= 2;
-+			*buf0 = xrealloc(*buf0, buf0len);
-+			buf = *buf0 + buflen -2;
-+
-+			continue;
-+		}
-+
-+		*nl = '\0';
-+
-+		lineno++;
-+
-+		if (parse_line(item, *buf0, mask))
-+			break;
-+
-+		buf = *buf0;
-+		buflen = buf0len;
-+		buf[0] = '\0';
-+	}
-+
-+	return ret;
-+}
-+
---- a/libopkg/parse_util.h
-+++ b/libopkg/parse_util.h
-@@ -22,4 +22,8 @@ int is_field(const char *type, const cha
- char *parse_simple(const char *type, const char *line);
- char **parse_list(const char *raw, unsigned int *count, const char sep, int skip_field);
- 
-+typedef int (*parse_line_t)(void *, const char *, uint);
-+int parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE *fp, uint mask,
-+						char **buf0, size_t buf0len);
-+
- #endif
---- a/libopkg/pkg_hash.c
-+++ b/libopkg/pkg_hash.c
-@@ -23,6 +23,7 @@
- #include "opkg_message.h"
- #include "pkg_vec.h"
- #include "pkg_hash.h"
-+#include "parse_util.h"
- #include "pkg_parse.h"
- #include "opkg_utils.h"
- #include "sprintf_alloc.h"
-@@ -119,8 +120,14 @@ pkg_hash_add_from_file(const char *file_
- 		pkg->src = src;
- 		pkg->dest = dest;
- 
--		ret = pkg_parse_from_stream_nomalloc(pkg, fp, 0,
-+		ret = parse_from_stream_nomalloc(pkg_parse_line, pkg, fp, 0,
- 				&buf, len);
-+
-+		if (pkg->name == NULL) {
-+			/* probably just a blank line */
-+			ret = 1;
-+		}
-+
- 		if (ret) {
- 			pkg_deinit (pkg);
- 			free(pkg);
---- a/libopkg/pkg_parse.c
-+++ b/libopkg/pkg_parse.c
-@@ -104,9 +104,11 @@ get_arch_priority(const char *arch)
- 	return 0;
- }
- 
--static int
--pkg_parse_line(pkg_t *pkg, const char *line, uint mask)
-+int
-+pkg_parse_line(void *ptr, const char *line, uint mask)
- {
-+	pkg_t *pkg = (pkg_t *) ptr;
-+
- 	/* these flags are a bit hackish... */
- 	static int reading_conffiles = 0, reading_description = 0;
- 	int ret = 0;
-@@ -266,91 +268,6 @@ dont_reset_flags:
- }
- 
- int
--pkg_parse_from_stream_nomalloc(pkg_t *pkg, FILE *fp, uint mask,
--						char **buf0, size_t buf0len)
--{
--	int ret, lineno;
--	char *buf, *nl;
--	size_t buflen;
--
--	lineno = 1;
--	ret = 0;
--
--	buflen = buf0len;
--	buf = *buf0;
--	buf[0] = '\0';
--
--	while (1) {
--		if (fgets(buf, (int)buflen, fp) == NULL) {
--			if (ferror(fp)) {
--				opkg_perror(ERROR, "fgets");
--				ret = -1;
--			} else if (strlen(*buf0) == buf0len-1) {
--				opkg_msg(ERROR, "Missing new line character"
--						" at end of file!\n");
--				pkg_parse_line(pkg, *buf0, mask);
--			}
--			break;
--		}
--
--		nl = strchr(buf, '\n');
--		if (nl == NULL) {
--			if (strlen(buf) < buflen-1) {
--				/*
--				 * Line could be exactly buflen-1 long and
--				 * missing a newline, but we won't know until
--				 * fgets fails to read more data.
--				 */
--				opkg_msg(ERROR, "Missing new line character"
--						" at end of file!\n");
--				pkg_parse_line(pkg, *buf0, mask);
--				break;
--			}
--			if (buf0len >= EXCESSIVE_LINE_LEN) {
--				opkg_msg(ERROR, "Excessively long line at "
--					"%d. Corrupt file?\n",
--					lineno);
--				ret = -1;
--				break;
--			}
--
--			/*
--			 * Realloc and point buf past the data already read,
--			 * at the NULL terminator inserted by fgets.
--			 * |<--------------- buf0len ----------------->|
--			 * |                     |<------- buflen ---->|
--			 * |---------------------|---------------------|
--			 * buf0                   buf
--			 */
--			buflen = buf0len +1;
--			buf0len *= 2;
--			*buf0 = xrealloc(*buf0, buf0len);
--			buf = *buf0 + buflen -2;
--
--			continue;
--		}
--
--		*nl = '\0';
--
--		lineno++;
--
--		if (pkg_parse_line(pkg, *buf0, mask))
--			break;
--
--		buf = *buf0;
--		buflen = buf0len;
--		buf[0] = '\0';
--	}
--
--	if (pkg->name == NULL) {
--		/* probably just a blank line */
--		ret = 1;
--	}
--
--	return ret;
--}
--
--int
- pkg_parse_from_stream(pkg_t *pkg, FILE *fp, uint mask)
- {
- 	int ret;
-@@ -358,8 +275,13 @@ pkg_parse_from_stream(pkg_t *pkg, FILE *
- 	const size_t len = 4096;
- 
- 	buf = xmalloc(len);
--	ret = pkg_parse_from_stream_nomalloc(pkg, fp, mask, &buf, len);
-+	ret = parse_from_stream_nomalloc(pkg_parse_line, pkg, fp, mask, &buf, len);
- 	free(buf);
- 
-+	if (pkg->name == NULL) {
-+		/* probably just a blank line */
-+		ret = 1;
-+	}
-+
- 	return ret;
- }
---- a/libopkg/pkg_parse.h
-+++ b/libopkg/pkg_parse.h
-@@ -18,10 +18,11 @@
- #ifndef PKG_PARSE_H
- #define PKG_PARSE_H
- 
-+#include "pkg.h"
-+
- int parse_version(pkg_t *pkg, const char *raw);
- int pkg_parse_from_stream(pkg_t *pkg, FILE *fp, uint mask);
--int pkg_parse_from_stream_nomalloc(pkg_t *pkg, FILE *fp, uint mask,
--						char **buf0, size_t buf0len);
-+int pkg_parse_line(void *ptr, const char *line, uint mask);
- 
- #define EXCESSIVE_LINE_LEN	(4096 << 8)
- 
---- a/libopkg/release_parse.c
-+++ b/libopkg/release_parse.c
-@@ -23,8 +23,10 @@
- #include "parse_util.h"
- 
- static int
--release_parse_line(release_t *release, const char *line)
-+release_parse_line(void *ptr, const char *line, uint mask)
- {
-+	release_t *release = (release_t *) ptr;
-+
- 	int ret = 0;
- 	unsigned int count = 0;
- 	char **list = 0;
-@@ -111,25 +113,14 @@ dont_reset_flags:
- int
- release_parse_from_stream(release_t *release, FILE *fp)
- {
--	int ret = 0;
--	char *buf = NULL;
--	size_t buflen, nread;
--
--	nread = getline(&buf, &buflen, fp);
--	while ( nread != -1 ) {
--		if (buf[nread-1] == '\n') buf[nread-1] = '\0';
--		if (release_parse_line(release, buf))
--                        opkg_msg(DEBUG, "Failed to parse release line for %s:\n\t%s\n",
--					release->name, buf);
--		nread = getline(&buf, &buflen, fp);
--	}
--
--	if (!feof(fp)) {
--		opkg_perror(ERROR, "Problems reading Release file for %sd\n", release->name);
--		ret = -1;
--	}
-+	int ret;
-+	char *buf;
-+	const size_t len = 4096;
- 
-+	buf = xmalloc(len);
-+	ret = parse_from_stream_nomalloc(release_parse_line, release, fp, 0, &buf, len);
- 	free(buf);
-+
- 	return ret;
- }
- 
diff --git a/package/system/opkg/patches/030-fix-double-free.patch b/package/system/opkg/patches/030-fix-double-free.patch
deleted file mode 100644
index 312e06c..0000000
--- a/package/system/opkg/patches/030-fix-double-free.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/libopkg/opkg_remove.c
-+++ b/libopkg/opkg_remove.c
-@@ -138,7 +138,6 @@ opkg_remove_dependent_pkgs(pkg_t *pkg, a
-     for (i = 0; i < dependent_pkgs->len; i++) {
-         err = opkg_remove_pkg(dependent_pkgs->pkgs[i],0);
-         if (err) {
--            pkg_vec_free(dependent_pkgs);
-             break;
- 	}
-     }
diff --git a/package/system/opkg/patches/040-wrap-descriptions-only-on-ttys.patch b/package/system/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
deleted file mode 100644
index 9540668..0000000
--- a/package/system/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/libopkg/pkg_parse.c
-+++ b/libopkg/pkg_parse.c
-@@ -20,6 +20,7 @@
- 
- #include <stdio.h>
- #include <ctype.h>
-+#include <unistd.h>
- 
- #include "pkg.h"
- #include "opkg_utils.h"
-@@ -239,10 +240,16 @@ pkg_parse_line(void *ptr, const char *li
- 
- 	case ' ':
- 		if ((mask & PFM_DESCRIPTION) && reading_description) {
--			pkg->description = xrealloc(pkg->description,
--						strlen(pkg->description)
--						+ 1 + strlen(line) + 1);
--			strcat(pkg->description, "\n");
-+			if (isatty(1)) {
-+				pkg->description = xrealloc(pkg->description,
-+							strlen(pkg->description)
-+							+ 1 + strlen(line) + 1);
-+				strcat(pkg->description, "\n");
-+			} else {
-+				pkg->description = xrealloc(pkg->description,
-+							strlen(pkg->description)
-+							+ 1 + strlen(line));
-+			}
- 			strcat(pkg->description, (line));
- 			goto dont_reset_flags;
- 		} else if ((mask & PFM_CONFFILES) && reading_conffiles) {
diff --git a/package/system/opkg/patches/050-add-case-insensitive-flag.patch b/package/system/opkg/patches/050-add-case-insensitive-flag.patch
deleted file mode 100644
index 4b9215b..0000000
--- a/package/system/opkg/patches/050-add-case-insensitive-flag.patch
+++ /dev/null
@@ -1,169 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -436,7 +436,7 @@ opkg_configure_packages(char *pkg_name)
-      for(i = 0; i < ordered->len; i++) {
- 	  pkg = ordered->pkgs[i];
- 
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	       continue;
- 
- 	  if (pkg->state_status == SS_UNPACKED) {
-@@ -610,7 +610,7 @@ opkg_list_cmd(int argc, char **argv)
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	       continue;
-           print_pkg(pkg);
-      }
-@@ -637,7 +637,7 @@ opkg_list_installed_cmd(int argc, char *
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	       continue;
-           print_pkg(pkg);
-      }
-@@ -666,7 +666,7 @@ opkg_list_changed_conffiles_cmd(int argc
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	    continue;
- 	  if (nv_pair_list_empty(&pkg->conffiles))
- 	    continue;
-@@ -722,7 +722,7 @@ opkg_info_status_cmd(int argc, char **ar
- 
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) {
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase)) {
- 	       continue;
- 	  }
- 
-@@ -792,7 +792,7 @@ opkg_remove_cmd(int argc, char **argv)
-      for (i=0; i<argc; i++) {
-         for (a=0; a<available->len; a++) {
-             pkg = available->pkgs[a];
--	    if (fnmatch(argv[i], pkg->name, 0)) {
-+	    if (fnmatch(argv[i], pkg->name, conf->nocase)) {
-                continue;
-             }
-             if (conf->restrict_to_default_dest) {
-@@ -926,7 +926,7 @@ opkg_depends_cmd(int argc, char **argv)
- 		for (j=0; j<available_pkgs->len; j++) {
- 			pkg = available_pkgs->pkgs[j];
- 
--			if (fnmatch(argv[i], pkg->name, 0) != 0)
-+			if (fnmatch(argv[i], pkg->name, conf->nocase) != 0)
- 				continue;
- 
- 			depends_count = pkg->depends_count +
-@@ -1147,9 +1147,9 @@ opkg_what_provides_replaces_cmd(enum wha
- 			      ((what_field_type == WHATPROVIDES)
- 			       ? pkg->provides[k]
- 			       : pkg->replaces[k]);
--			 if (fnmatch(target, apkg->name, 0) == 0) {
-+			 if (fnmatch(target, apkg->name, conf->nocase) == 0) {
- 			      opkg_msg(NOTICE, "    %s", pkg->name);
--			      if (strcmp(target, apkg->name) != 0)
-+			      if ((conf->nocase ? strcasecmp(target, apkg->name) : strcmp(target, apkg->name)) != 0)
- 				   opkg_msg(NOTICE, "\t%s %s\n",
- 						   rel_str, apkg->name);
- 			      opkg_message(NOTICE, "\n");
-@@ -1200,7 +1200,7 @@ opkg_search_cmd(int argc, char **argv)
- 
- 	  for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) {
- 	       installed_file = (char *)iter->data;
--	       if (fnmatch(argv[0], installed_file, 0)==0)
-+	       if (fnmatch(argv[0], installed_file, conf->nocase)==0)
- 	            print_pkg(pkg);
- 	  }
- 
---- a/libopkg/opkg_conf.c
-+++ b/libopkg/opkg_conf.c
-@@ -62,6 +62,7 @@ opkg_option_t options[] = {
- 	  { "noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction },
- 	  { "download_only", OPKG_OPT_TYPE_BOOL, &_conf.download_only },
- 	  { "nodeps", OPKG_OPT_TYPE_BOOL, &_conf.nodeps },
-+	  { "nocase", OPKG_OPT_TYPE_BOOL, &_conf.nocase },
- 	  { "offline_root", OPKG_OPT_TYPE_STRING, &_conf.offline_root },
- 	  { "overlay_root", OPKG_OPT_TYPE_STRING, &_conf.overlay_root },
- 	  { "proxy_passwd", OPKG_OPT_TYPE_STRING, &_conf.proxy_passwd },
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -24,6 +24,7 @@ extern opkg_conf_t *conf;
- #include "config.h"
- 
- #include <stdarg.h>
-+#include <fnmatch.h> /* FNM_CASEFOLD */
- 
- #include "hash_table.h"
- #include "pkg_src_list.h"
-@@ -79,6 +80,7 @@ struct opkg_conf
-      int force_remove;
-      int check_signature;
-      int nodeps; /* do not follow dependencies */
-+     int nocase; /* perform case insensitive matching */
-      char *offline_root;
-      char *overlay_root;
-      int query_all;
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -47,6 +47,7 @@ enum {
- 	ARGS_OPT_NOACTION,
- 	ARGS_OPT_DOWNLOAD_ONLY,
- 	ARGS_OPT_NODEPS,
-+	ARGS_OPT_NOCASE,
- 	ARGS_OPT_AUTOREMOVE,
- 	ARGS_OPT_CACHE,
- };
-@@ -86,6 +87,7 @@ static struct option long_options[] = {
- 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
- 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
- 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
-+	{"nocase", 0, 0, ARGS_OPT_NOCASE},
- 	{"offline", 1, 0, 'o'},
- 	{"offline-root", 1, 0, 'o'},
- 	{"add-arch", 1, 0, ARGS_OPT_ADD_ARCH},
-@@ -107,7 +109,7 @@ args_parse(int argc, char *argv[])
- 	char *tuple, *targ;
- 
- 	while (1) {
--		c = getopt_long_only(argc, argv, "Ad:f:no:p:t:vV::",
-+		c = getopt_long_only(argc, argv, "Ad:f:ino:p:t:vV::",
- 				long_options, &option_index);
- 		if (c == -1)
- 			break;
-@@ -122,6 +124,9 @@ args_parse(int argc, char *argv[])
- 		case 'f':
- 			conf->conf_file = xstrdup(optarg);
- 			break;
-+		case 'i':
-+			conf->nocase = FNM_CASEFOLD;
-+			break;
- 		case 'o':
- 			conf->offline_root = xstrdup(optarg);
- 			break;
-@@ -176,6 +181,9 @@ args_parse(int argc, char *argv[])
- 		case ARGS_OPT_NODEPS:
- 			conf->nodeps = 1;
- 			break;
-+		case ARGS_OPT_NOCASE:
-+			conf->nocase = FNM_CASEFOLD;
-+			break;
- 		case ARGS_OPT_ADD_ARCH:
- 		case ARGS_OPT_ADD_DEST:
- 			tuple = xstrdup(optarg);
-@@ -287,6 +295,7 @@ usage()
- 	printf("\t--noaction		No action -- test only\n");
- 	printf("\t--download-only	No action -- download only\n");
- 	printf("\t--nodeps		Do not follow dependencies\n");
-+	printf("\t--nocase		Perform case insensitive pattern matching\n");
- 	printf("\t--force-removal-of-dependent-packages\n");
- 	printf("\t			Remove package and all dependencies\n");
- 	printf("\t--autoremove		Remove packages that were installed\n");
diff --git a/package/system/opkg/patches/060-add-find-command.patch b/package/system/opkg/patches/060-add-find-command.patch
deleted file mode 100644
index 1762534..0000000
--- a/package/system/opkg/patches/060-add-find-command.patch
+++ /dev/null
@@ -1,58 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -594,7 +594,7 @@ opkg_download_cmd(int argc, char **argv)
- 
- 
- static int
--opkg_list_cmd(int argc, char **argv)
-+opkg_list_find_cmd(int argc, char **argv, int use_desc)
- {
-      int i;
-      pkg_vec_t *available;
-@@ -610,7 +610,8 @@ opkg_list_cmd(int argc, char **argv)
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase) &&
-+	      (!use_desc || !pkg->description || fnmatch(pkg_name, pkg->description, conf->nocase)))
- 	       continue;
-           print_pkg(pkg);
-      }
-@@ -619,6 +620,18 @@ opkg_list_cmd(int argc, char **argv)
-      return 0;
- }
- 
-+static int
-+opkg_list_cmd(int argc, char **argv)
-+{
-+	return opkg_list_find_cmd(argc, argv, 0);
-+}
-+
-+static int
-+opkg_find_cmd(int argc, char **argv)
-+{
-+	return opkg_list_find_cmd(argc, argv, 1);
-+}
-+
- 
- static int
- opkg_list_installed_cmd(int argc, char **argv)
-@@ -1262,6 +1275,7 @@ static opkg_cmd_t cmds[] = {
-      {"configure", 0, (opkg_cmd_fun_t)opkg_configure_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"files", 1, (opkg_cmd_fun_t)opkg_files_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"search", 1, (opkg_cmd_fun_t)opkg_search_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-+     {"find", 1, (opkg_cmd_fun_t)opkg_find_cmd, PFM_SOURCE},
-      {"download", 1, (opkg_cmd_fun_t)opkg_download_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"compare_versions", 1, (opkg_cmd_fun_t)opkg_compare_versions_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"compare-versions", 1, (opkg_cmd_fun_t)opkg_compare_versions_cmd, PFM_DESCRIPTION|PFM_SOURCE},
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -246,6 +246,7 @@ usage()
- 	printf("\tlist-changed-conffiles	List user modified configuration files\n");
- 	printf("\tfiles <pkg>		List files belonging to <pkg>\n");
- 	printf("\tsearch <file|regexp>	List package providing <file>\n");
-+	printf("\tfind <regexp>		List packages whose name or description matches <regexp>\n");
- 	printf("\tinfo [pkg|regexp]	Display all info for <pkg>\n");
- 	printf("\tstatus [pkg|regexp]	Display all status for <pkg>\n");
- 	printf("\tdownload <pkg>		Download <pkg> to current directory\n");
diff --git a/package/system/opkg/patches/070-use_external_gzip.patch b/package/system/opkg/patches/070-use_external_gzip.patch
deleted file mode 100644
index 9587359..0000000
--- a/package/system/opkg/patches/070-use_external_gzip.patch
+++ /dev/null
@@ -1,719 +0,0 @@
---- a/libbb/unarchive.c
-+++ b/libbb/unarchive.c
-@@ -28,6 +28,7 @@
- #include <libgen.h>
- 
- #include "libbb.h"
-+#include "gzip.h"
- 
- #define CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY 1
- #define CONFIG_FEATURE_TAR_GNU_EXTENSIONS
-@@ -39,38 +40,15 @@ static char *linkname = NULL;
- 
- off_t archive_offset;
- 
--#define SEEK_BUF 4096
- static ssize_t
--seek_by_read(FILE* fd, size_t len)
--{
--        ssize_t cc, total = 0;
--        char buf[SEEK_BUF];
--
--        while (len) {
--                cc = fread(buf, sizeof(buf[0]),
--                                len > SEEK_BUF ? SEEK_BUF : len,
--                                fd);
--
--                total += cc;
--                len -= cc;
--
--                if(feof(fd) || ferror(fd))
--                        break;
--        }
--        return total;
--}
--
--static void
--seek_sub_file(FILE *fd, const int count)
-+seek_forward(struct gzip_handle *zh, ssize_t len)
- {
--	archive_offset += count;
-+	ssize_t slen = gzip_seek(zh, len);
- 
--	/* Do not use fseek() on a pipe. It may fail with ESPIPE, leaving the
--	 * stream at an undefined location.
--	 */
--        seek_by_read(fd, count);
-+	if (slen == len)
-+		archive_offset += len;
- 
--	return;
-+	return slen;
- }
- 
- 
-@@ -87,7 +65,7 @@ seek_sub_file(FILE *fd, const int count)
-  * trailing '/' or else the last dir will be assumed to be the file prefix
-  */
- static char *
--extract_archive(FILE *src_stream, FILE *out_stream,
-+extract_archive(struct gzip_handle *src_stream, FILE *out_stream,
- 		const file_header_t *file_entry, const int function,
- 		const char *prefix,
- 		int *err)
-@@ -129,14 +107,14 @@ extract_archive(FILE *src_stream, FILE *
- 
- 	if (function & extract_to_stream) {
- 		if (S_ISREG(file_entry->mode)) {
--			*err = copy_file_chunk(src_stream, out_stream, file_entry->size);
-+			*err = gzip_copy(src_stream, out_stream, file_entry->size);
- 			archive_offset += file_entry->size;
- 		}
- 	}
- 	else if (function & extract_one_to_buffer) {
- 		if (S_ISREG(file_entry->mode)) {
- 			buffer = (char *) xmalloc(file_entry->size + 1);
--			fread(buffer, 1, file_entry->size, src_stream);
-+			gzip_read(src_stream, buffer, file_entry->size);
- 			buffer[file_entry->size] = '\0';
- 			archive_offset += file_entry->size;
- 			goto cleanup;
-@@ -156,7 +134,7 @@ extract_archive(FILE *src_stream, FILE *
- 					*err = -1;
- 					error_msg("%s not created: newer or same age file exists", file_entry->name);
- 				}
--				seek_sub_file(src_stream, file_entry->size);
-+				seek_forward(src_stream, file_entry->size);
- 				goto cleanup;
- 			}
- 		}
-@@ -185,11 +163,11 @@ extract_archive(FILE *src_stream, FILE *
- 				} else {
- 					if ((dst_stream = wfopen(full_name, "w")) == NULL) {
- 						*err = -1;
--						seek_sub_file(src_stream, file_entry->size);
-+						seek_forward(src_stream, file_entry->size);
- 						goto cleanup;
- 					}
- 					archive_offset += file_entry->size;
--					*err = copy_file_chunk(src_stream, dst_stream, file_entry->size);
-+					*err = gzip_copy(src_stream, dst_stream, file_entry->size);
- 					fclose(dst_stream);
- 				}
- 				break;
-@@ -250,7 +228,7 @@ extract_archive(FILE *src_stream, FILE *
- 		/* If we arent extracting data we have to skip it,
- 		 * if data size is 0 then then just do it anyway
- 		 * (saves testing for it) */
--		seek_sub_file(src_stream, file_entry->size);
-+		seek_forward(src_stream, file_entry->size);
- 	}
- 
- 	/* extract_list and extract_verbose_list can be used in conjunction
-@@ -274,8 +252,8 @@ cleanup:
- }
- 
- static char *
--unarchive(FILE *src_stream, FILE *out_stream,
--		file_header_t *(*get_headers)(FILE *),
-+unarchive(struct gzip_handle *src_stream, FILE *out_stream,
-+		file_header_t *(*get_headers)(struct gzip_handle *),
- 		void (*free_headers)(file_header_t *),
- 		const int extract_function,
- 		const char *prefix,
-@@ -329,7 +307,7 @@ unarchive(FILE *src_stream, FILE *out_st
- 			}
- 		} else {
- 			/* seek past the data entry */
--			seek_sub_file(src_stream, file_entry->size);
-+			seek_forward(src_stream, file_entry->size);
- 		}
- 		free_headers(file_entry);
- 	}
-@@ -337,108 +315,9 @@ unarchive(FILE *src_stream, FILE *out_st
- 	return buffer;
- }
- 
--static file_header_t *
--get_header_ar(FILE *src_stream)
--{
--	file_header_t *typed;
--	union {
--		char raw[60];
--	 	struct {
-- 			char name[16];
-- 			char date[12];
-- 			char uid[6];
-- 			char gid[6];
-- 			char mode[8];
-- 			char size[10];
-- 			char magic[2];
-- 		} formated;
--	} ar;
--	static char *ar_long_names;
--
--	if (fread(ar.raw, 1, 60, src_stream) != 60) {
--		return(NULL);
--	}
--	archive_offset += 60;
--	/* align the headers based on the header magic */
--	if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
--		/* some version of ar, have an extra '\n' after each data entry,
--		 * this puts the next header out by 1 */
--		if (ar.formated.magic[1] != '`') {
--			error_msg("Invalid magic");
--			return(NULL);
--		}
--		/* read the next char out of what would be the data section,
--		 * if its a '\n' then it is a valid header offset by 1*/
--		archive_offset++;
--		if (fgetc(src_stream) != '\n') {
--			error_msg("Invalid magic");
--			return(NULL);
--		}
--		/* fix up the header, we started reading 1 byte too early */
--		/* raw_header[60] wont be '\n' as it should, but it doesnt matter */
--		memmove(ar.raw, &ar.raw[1], 59);
--	}
--
--	typed = (file_header_t *) xcalloc(1, sizeof(file_header_t));
--
--	typed->size = (size_t) atoi(ar.formated.size);
--	/* long filenames have '/' as the first character */
--	if (ar.formated.name[0] == '/') {
--		if (ar.formated.name[1] == '/') {
--			/* If the second char is a '/' then this entries data section
--			 * stores long filename for multiple entries, they are stored
--			 * in static variable long_names for use in future entries */
--			ar_long_names = (char *) xrealloc(ar_long_names, typed->size);
--			fread(ar_long_names, 1, typed->size, src_stream);
--			archive_offset += typed->size;
--			/* This ar entries data section only contained filenames for other records
--			 * they are stored in the static ar_long_names for future reference */
--			return (get_header_ar(src_stream)); /* Return next header */
--		} else if (ar.formated.name[1] == ' ') {
--			/* This is the index of symbols in the file for compilers */
--			seek_sub_file(src_stream, typed->size);
--			return (get_header_ar(src_stream)); /* Return next header */
--		} else {
--			/* The number after the '/' indicates the offset in the ar data section
--			(saved in variable long_name) that conatains the real filename */
--			if (!ar_long_names) {
--				error_msg("Cannot resolve long file name");
--				return (NULL);
--			}
--			typed->name = xstrdup(ar_long_names + atoi(&ar.formated.name[1]));
--		}
--	} else {
--		/* short filenames */
--		typed->name = xcalloc(1, 16);
--		strncpy(typed->name, ar.formated.name, 16);
--	}
--	typed->name[strcspn(typed->name, " /")]='\0';
--
--	/* convert the rest of the now valid char header to its typed struct */
--	parse_mode(ar.formated.mode, &typed->mode);
--	typed->mtime = atoi(ar.formated.date);
--	typed->uid = atoi(ar.formated.uid);
--	typed->gid = atoi(ar.formated.gid);
--
--	return(typed);
--}
--
--static void
--free_header_ar(file_header_t *ar_entry)
--{
--	if (ar_entry == NULL)
--		return;
--
--	free(ar_entry->name);
--	if (ar_entry->link_name)
--		free(ar_entry->link_name);
--
--	free(ar_entry);
--}
--
- 
- static file_header_t *
--get_header_tar(FILE *tar_stream)
-+get_header_tar(struct gzip_handle *tar_stream)
- {
- 	union {
- 		unsigned char raw[512];
-@@ -467,10 +346,10 @@ get_header_tar(FILE *tar_stream)
- 	long sum = 0;
- 
- 	if (archive_offset % 512 != 0) {
--		seek_sub_file(tar_stream, 512 - (archive_offset % 512));
-+		seek_forward(tar_stream, 512 - (archive_offset % 512));
- 	}
- 
--	if (fread(tar.raw, 1, 512, tar_stream) != 512) {
-+	if (gzip_read(tar_stream, tar.raw, 512) != 512) {
- 		/* Unfortunately its common for tar files to have all sorts of
- 		 * trailing garbage, fail silently */
- //		error_msg("Couldnt read header");
-@@ -557,7 +436,7 @@ get_header_tar(FILE *tar_stream)
- # ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
- 	case 'L': {
- 			longname = xmalloc(tar_entry->size + 1);
--                        if(fread(longname, tar_entry->size, 1, tar_stream) != 1)
-+                        if(gzip_read(tar_stream, longname, tar_entry->size) != tar_entry->size)
-                                 return NULL;
- 			longname[tar_entry->size] = '\0';
- 			archive_offset += tar_entry->size;
-@@ -566,7 +445,7 @@ get_header_tar(FILE *tar_stream)
- 		}
- 	case 'K': {
- 			linkname = xmalloc(tar_entry->size + 1);
--                        if(fread(linkname, tar_entry->size, 1, tar_stream) != 1)
-+                        if(gzip_read(tar_stream, linkname, tar_entry->size) != tar_entry->size)
-                                 return NULL;
- 			linkname[tar_entry->size] = '\0';
- 			archive_offset += tar_entry->size;
-@@ -642,6 +521,9 @@ deb_extract(const char *package_filename
- 	char *ared_file = NULL;
- 	char ar_magic[8];
- 	int gz_err;
-+	struct gzip_handle tar_outer, tar_inner;
-+	file_header_t *tar_header;
-+	ssize_t len;
- 
- 	*err = 0;
- 
-@@ -672,111 +554,44 @@ deb_extract(const char *package_filename
- 	/* set the buffer size */
- 	setvbuf(deb_stream, NULL, _IOFBF, 0x8000);
- 
--	/* check ar magic */
--	fread(ar_magic, 1, 8, deb_stream);
--
--	if (strncmp(ar_magic,"!<arch>",7) == 0) {
--		archive_offset = 8;
-+	memset(&tar_outer, 0, sizeof(tar_outer));
-+	tar_outer.file = deb_stream;
-+	gzip_exec(&tar_outer, NULL);
- 
--		while ((ar_header = get_header_ar(deb_stream)) != NULL) {
--			if (strcmp(ared_file, ar_header->name) == 0) {
--				int gunzip_pid = 0;
--				FILE *uncompressed_stream;
--				/* open a stream of decompressed data */
--				uncompressed_stream = gz_open(deb_stream, &gunzip_pid);
--				if (uncompressed_stream == NULL) {
--					*err = -1;
--					goto cleanup;
--				}
-+	/* walk through outer tar file to find ared_file */
-+	while ((tar_header = get_header_tar(&tar_outer)) != NULL) {
-+                    int name_offset = 0;
-+                    if (strncmp(tar_header->name, "./", 2) == 0)
-+                            name_offset = 2;
- 
--				archive_offset = 0;
--				output_buffer = unarchive(uncompressed_stream,
--						out_stream, get_header_tar,
--						free_header_tar,
--						extract_function, prefix,
--						file_list, err);
--				fclose(uncompressed_stream);
--				gz_err = gz_close(gunzip_pid);
--				if (gz_err)
--					*err = -1;
--				free_header_ar(ar_header);
--				break;
--			}
--			if (fseek(deb_stream, ar_header->size, SEEK_CUR) == -1) {
--				opkg_perror(ERROR, "Couldn't fseek into %s", package_filename);
--				*err = -1;
--				free_header_ar(ar_header);
--				goto cleanup;
--			}
--			free_header_ar(ar_header);
--		}
--		goto cleanup;
--	} else if (strncmp(ar_magic, "\037\213", 2) == 0) {
--		/* it's a gz file, let's assume it's an opkg */
--		int unzipped_opkg_pid;
--		FILE *unzipped_opkg_stream;
--		file_header_t *tar_header;
--		archive_offset = 0;
--		if (fseek(deb_stream, 0, SEEK_SET) == -1) {
--			opkg_perror(ERROR, "Couldn't fseek into %s", package_filename);
--			*err = -1;
--			goto cleanup;
--		}
--		unzipped_opkg_stream = gz_open(deb_stream, &unzipped_opkg_pid);
--		if (unzipped_opkg_stream == NULL) {
--			*err = -1;
--			goto cleanup;
--		}
-+		if (strcmp(ared_file, tar_header->name+name_offset) == 0) {
-+			memset(&tar_inner, 0, sizeof(tar_inner));
-+			tar_inner.gzip = &tar_outer;
-+			gzip_exec(&tar_inner, NULL);
- 
--		/* walk through outer tar file to find ared_file */
--		while ((tar_header = get_header_tar(unzipped_opkg_stream)) != NULL) {
--                        int name_offset = 0;
--                        if (strncmp(tar_header->name, "./", 2) == 0)
--                                name_offset = 2;
--			if (strcmp(ared_file, tar_header->name+name_offset) == 0) {
--				int gunzip_pid = 0;
--				FILE *uncompressed_stream;
--				/* open a stream of decompressed data */
--				uncompressed_stream = gz_open(unzipped_opkg_stream, &gunzip_pid);
--				if (uncompressed_stream == NULL) {
--					*err = -1;
--					goto cleanup;
--				}
--				archive_offset = 0;
-+			archive_offset = 0;
- 
--				output_buffer = unarchive(uncompressed_stream,
--							  out_stream,
--							  get_header_tar,
--							  free_header_tar,
--							  extract_function,
--							  prefix,
--							  file_list,
--							  err);
-+			output_buffer = unarchive(&tar_inner,
-+						  out_stream,
-+						  get_header_tar,
-+						  free_header_tar,
-+						  extract_function,
-+						  prefix,
-+						  file_list,
-+						  err);
- 
--				free_header_tar(tar_header);
--				fclose(uncompressed_stream);
--				gz_err = gz_close(gunzip_pid);
--				if (gz_err)
--					*err = -1;
--				break;
--			}
--			seek_sub_file(unzipped_opkg_stream, tar_header->size);
- 			free_header_tar(tar_header);
-+			gzip_close(&tar_inner);
-+			break;
- 		}
--		fclose(unzipped_opkg_stream);
--		gz_err = gz_close(unzipped_opkg_pid);
--		if (gz_err)
--			*err = -1;
- 
--		goto cleanup;
--	} else {
--		*err = -1;
--		error_msg("%s: invalid magic", package_filename);
-+		seek_forward(&tar_outer, tar_header->size);
-+		free_header_tar(tar_header);
- 	}
- 
- cleanup:
--	if (deb_stream)
--		fclose(deb_stream);
-+	gzip_close(&tar_outer);
-+
- 	if (file_list)
- 		free(file_list);
- 
---- /dev/null
-+++ b/libbb/gzip.h
-@@ -0,0 +1,41 @@
-+/*
-+ *  Copyright (C) 2016 Jo-Philipp Wich <jo at mein.io>
-+ *
-+ *  Zlib decrompression utility routines.
-+ *
-+ *  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; either version 2 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  This program is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU Library General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program; if not, write to the Free Software
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ */
-+
-+#include <stdio.h>
-+#include <signal.h>
-+#include <pthread.h>
-+
-+struct gzip_handle {
-+	FILE *file;
-+	struct gzip_handle *gzip;
-+
-+	pid_t pid;
-+	int rfd, wfd;
-+	struct sigaction pipe_sa;
-+	pthread_t thread;
-+};
-+
-+int gzip_exec(struct gzip_handle *zh, const char *filename);
-+ssize_t gzip_read(struct gzip_handle *zh, char *buf, ssize_t len);
-+ssize_t gzip_copy(struct gzip_handle *zh, FILE *out, ssize_t len);
-+int gzip_close(struct gzip_handle *zh);
-+FILE *gzip_fdopen(struct gzip_handle *zh, const char *filename);
-+
-+#define gzip_seek(zh, len) gzip_copy(zh, NULL, len)
---- a/libbb/Makefile.am
-+++ b/libbb/Makefile.am
-@@ -4,9 +4,8 @@ ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"
- 
- noinst_LIBRARIES = libbb.a
- 
--libbb_a_SOURCES = gz_open.c \
-+libbb_a_SOURCES = \
- 	libbb.h \
--	unzip.c \
- 	wfopen.c \
- 	unarchive.c \
- 	copy_file.c \
-@@ -20,7 +19,8 @@ libbb_a_SOURCES = gz_open.c \
- 	parse_mode.c \
- 	time_string.c \
- 	all_read.c \
--	mode_string.c
-+	mode_string.c \
-+	gzip.c
- 
- libbb_la_CFLAGS = $(ALL_CFLAGS)
- #libbb_la_LDFLAGS = -static
---- /dev/null
-+++ b/libbb/gzip.c
-@@ -0,0 +1,208 @@
-+/*
-+ *  Copyright (C) 2016 Jo-Philipp Wich <jo at mein.io>
-+ *  Copyright (C) 2016 Felix Fietkau <nbd at nbd.name>
-+ *
-+ *  Zlib decrompression utility routines.
-+ *
-+ *  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; either version 2 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  This program is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU Library General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program; if not, write to the Free Software
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ */
-+
-+#include <string.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <poll.h>
-+#include <stdlib.h>
-+#include <sys/stat.h>
-+#include <sys/wait.h>
-+
-+#include "gzip.h"
-+
-+static void
-+to_devnull(int fd)
-+{
-+	int devnull = open("/dev/null", fd ? O_WRONLY : O_RDONLY);
-+
-+	if (devnull >= 0)
-+		dup2(devnull, fd);
-+
-+	if (devnull > STDERR_FILENO)
-+		close(devnull);
-+}
-+
-+void *
-+gzip_thread(void *ptr)
-+{
-+	struct gzip_handle *zh = ptr;
-+	char buf[4096];
-+	int len, ret;
-+
-+	while (1) {
-+		if (zh->file)
-+			len = fread(buf, 1, sizeof(buf), zh->file);
-+		else if (zh->gzip)
-+			len = gzip_read(zh->gzip, buf, sizeof(buf));
-+
-+		if (len <= 0)
-+			break;
-+
-+		do {
-+			ret = write(zh->wfd, buf, len);
-+		} while (ret == -1 && errno == EINTR);
-+	}
-+
-+	close(zh->wfd);
-+	zh->wfd = -1;
-+}
-+
-+int
-+gzip_exec(struct gzip_handle *zh, const char *filename)
-+{
-+	int rpipe[2] = { -1, -1 }, wpipe[2] = { -1, -1 };
-+	struct sigaction pipe_sa = { .sa_handler = SIG_IGN };
-+
-+	zh->rfd = -1;
-+	zh->wfd = -1;
-+
-+	if (sigaction(SIGPIPE, &pipe_sa, &zh->pipe_sa) < 0)
-+		return -1;
-+
-+	if (pipe(rpipe) < 0)
-+		return -1;
-+
-+	if (!filename && pipe(wpipe) < 0) {
-+		close(rpipe[0]);
-+		close(rpipe[1]);
-+		return -1;
-+	}
-+
-+	zh->pid = vfork();
-+
-+	switch (zh->pid) {
-+		case -1:
-+			return -1;
-+
-+		case 0:
-+			to_devnull(STDERR_FILENO);
-+
-+			if (filename) {
-+				to_devnull(STDIN_FILENO);
-+			}
-+			else {
-+				dup2(wpipe[0], STDIN_FILENO);
-+				close(wpipe[0]);
-+				close(wpipe[1]);
-+			}
-+
-+			dup2(rpipe[1], STDOUT_FILENO);
-+			close(rpipe[0]);
-+			close(rpipe[1]);
-+
-+			execlp("gzip", "gzip", "-d",  "-c", filename, NULL);
-+			exit(-1);
-+
-+		default:
-+			zh->rfd = rpipe[0];
-+			zh->wfd = wpipe[1];
-+
-+			fcntl(zh->rfd, F_SETFD, fcntl(zh->rfd, F_GETFD) | FD_CLOEXEC);
-+			close(rpipe[1]);
-+
-+			if (zh->wfd >= 0) {
-+				fcntl(zh->wfd, F_SETFD, fcntl(zh->wfd, F_GETFD) | FD_CLOEXEC);
-+				close(wpipe[0]);
-+				pthread_create(&zh->thread, NULL, gzip_thread, zh);
-+			}
-+	}
-+
-+	return 0;
-+}
-+
-+ssize_t
-+gzip_read(struct gzip_handle *zh, char *buf, ssize_t len)
-+{
-+	ssize_t ret;
-+
-+	do {
-+		ret = read(zh->rfd, buf, len);
-+	} while (ret == -1 && errno != EINTR);
-+
-+	return ret;
-+}
-+
-+ssize_t
-+gzip_copy(struct gzip_handle *zh, FILE *out, ssize_t len)
-+{
-+	char buf[4096];
-+	ssize_t rlen, total = 0;
-+
-+	while (len > 0) {
-+		rlen = gzip_read(zh, buf,
-+				    (len > sizeof(buf)) ? sizeof(buf) : len);
-+
-+		if (rlen <= 0)
-+			break;
-+
-+		if (out != NULL) {
-+			if (fwrite(buf, 1, rlen, out) != rlen)
-+				break;
-+		}
-+
-+		len -= rlen;
-+		total += rlen;
-+	}
-+
-+	return total;
-+}
-+
-+FILE *
-+gzip_fdopen(struct gzip_handle *zh, const char *filename)
-+{
-+	memset(zh, 0, sizeof(*zh));
-+
-+	if (!filename || gzip_exec(zh, filename) < 0)
-+		return NULL;
-+
-+	fcntl(zh->rfd, F_SETFL, fcntl(zh->rfd, F_GETFL) & ~O_NONBLOCK);
-+
-+	return fdopen(zh->rfd, "r");
-+}
-+
-+int
-+gzip_close(struct gzip_handle *zh)
-+{
-+	int code = -1;
-+
-+	if (zh->rfd >= 0)
-+		close(zh->rfd);
-+
-+	if (zh->wfd >= 0)
-+		close(zh->wfd);
-+
-+	if (zh->pid > 0) {
-+		kill(zh->pid, SIGKILL);
-+		waitpid(zh->pid, &code, 0);
-+	}
-+
-+	if (zh->file)
-+		fclose(zh->file);
-+
-+	if (zh->thread)
-+		pthread_join(zh->thread, NULL);
-+
-+	sigaction(SIGPIPE, &zh->pipe_sa, NULL);
-+
-+	return WIFEXITED(code) ? WEXITSTATUS(code) : -1;
-+}
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -3,4 +3,4 @@ bin_PROGRAMS = opkg-cl
- 
- opkg_cl_SOURCES = opkg-cl.c
- opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.a \
--                $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
-+                $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) -lpthread
---- a/tests/Makefile.am
-+++ b/tests/Makefile.am
-@@ -16,7 +16,7 @@ noinst_PROGRAMS = libopkg_test
- #opkg_active_list_test_SOURCES = opkg_active_list_test.c
- #opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
--libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
-+libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) -lpthread
- libopkg_test_SOURCE = libopkg_test.c
- libopkg_test_LDFLAGS = -static
- 
diff --git a/package/system/opkg/patches/071-use_gzipped_pkg_list.patch b/package/system/opkg/patches/071-use_gzipped_pkg_list.patch
deleted file mode 100644
index e102868..0000000
--- a/package/system/opkg/patches/071-use_gzipped_pkg_list.patch
+++ /dev/null
@@ -1,124 +0,0 @@
---- a/libopkg/opkg.c
-+++ b/libopkg/opkg.c
-@@ -592,49 +592,8 @@ opkg_update_package_lists(opkg_progress_
- 				      src->gzip ? "Packages.gz" : "Packages");
- 
- 		sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
--		if (src->gzip) {
--			FILE *in, *out;
--			struct _curl_cb_data cb_data;
--			char *tmp_file_name = NULL;
--
--			sprintf_alloc(&tmp_file_name, "%s/%s.gz", tmp,
--				      src->name);
--
--			opkg_msg(INFO, "Downloading %s to %s...\n", url,
--					tmp_file_name);
--
--			cb_data.cb = progress_callback;
--			cb_data.progress_data = &pdata;
--			cb_data.user_data = user_data;
--			cb_data.start_range =
--			    100 * sources_done / sources_list_count;
--			cb_data.finish_range =
--			    100 * (sources_done + 1) / sources_list_count;
--
--			err = opkg_download(url, tmp_file_name,
--					  (curl_progress_func) curl_progress_cb,
--					  &cb_data, 0);
- 
--			if (err == 0) {
--				opkg_msg(INFO, "Inflating %s...\n",
--						tmp_file_name);
--				in = fopen(tmp_file_name, "r");
--				out = fopen(list_file_name, "w");
--				if (in && out)
--					unzip(in, out);
--				else
--					err = 1;
--				if (in)
--					fclose(in);
--				if (out)
--					fclose(out);
--				unlink(tmp_file_name);
--			}
--			free(tmp_file_name);
--		} else
--			err = opkg_download(url, list_file_name, NULL, NULL, 0);
--
--		if (err) {
-+		if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
- 			opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
- 			result = -1;
- 		}
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -162,30 +162,7 @@ opkg_update_cmd(int argc, char **argv)
- 	      sprintf_alloc(&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
- 
- 	  sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
--	  if (src->gzip) {
--	      char *tmp_file_name;
--	      FILE *in, *out;
--
--	      sprintf_alloc (&tmp_file_name, "%s/%s.gz", tmp, src->name);
--	      err = opkg_download(url, tmp_file_name, NULL, NULL, 0);
--	      if (err == 0) {
--		   opkg_msg(NOTICE, "Inflating %s.\n", url);
--		   in = fopen (tmp_file_name, "r");
--		   out = fopen (list_file_name, "w");
--		   if (in && out)
--			unzip (in, out);
--		   else
--			err = 1;
--		   if (in)
--			fclose (in);
--		   if (out)
--			fclose (out);
--		   unlink (tmp_file_name);
--	      }
--	      free(tmp_file_name);
--	  } else
--	      err = opkg_download(url, list_file_name, NULL, NULL, 0);
--	  if (err) {
-+	  if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
- 	       failures++;
- 	  } else {
- 	       opkg_msg(NOTICE, "Updated list of available packages in %s.\n",
---- a/libopkg/pkg_hash.c
-+++ b/libopkg/pkg_hash.c
-@@ -29,6 +29,7 @@
- #include "sprintf_alloc.h"
- #include "file_util.h"
- #include "libbb/libbb.h"
-+#include "libbb/gzip.h"
- 
- void
- pkg_hash_init(void)
-@@ -106,8 +107,15 @@ pkg_hash_add_from_file(const char *file_
- 	char *buf;
- 	const size_t len = 4096;
- 	int ret = 0;
-+	struct gzip_handle zh;
-+
-+	if (src && src->gzip) {
-+		fp = gzip_fdopen(&zh, file_name);
-+	}
-+	else {
-+		fp = fopen(file_name, "r");
-+ 	}
- 
--	fp = fopen(file_name, "r");
- 	if (fp == NULL) {
- 		opkg_perror(ERROR, "Failed to open %s", file_name);
- 		return -1;
-@@ -155,6 +163,9 @@ pkg_hash_add_from_file(const char *file_
- 	free(buf);
- 	fclose(fp);
- 
-+	if (src && src->gzip)
-+		gzip_close(&zh);
-+
- 	return ret;
- }
- 
diff --git a/package/system/opkg/patches/080-suppress-blank-package-fields.patch b/package/system/opkg/patches/080-suppress-blank-package-fields.patch
deleted file mode 100644
index 976b97d..0000000
--- a/package/system/opkg/patches/080-suppress-blank-package-fields.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/libopkg/parse_util.c
-+++ b/libopkg/parse_util.c
-@@ -35,7 +35,12 @@ is_field(const char *type, const char *l
- char *
- parse_simple(const char *type, const char *line)
- {
--	return trim_xstrdup(line + strlen(type) + 1);
-+	char *field = trim_xstrdup(line + strlen(type) + 1);
-+	if (strlen(field) == 0) {
-+		free(field);
-+		return NULL;
-+	}
-+	return field;
- }
- 
- /*
diff --git a/package/system/opkg/patches/090-suppress-blank-provides-field.patch b/package/system/opkg/patches/090-suppress-blank-provides-field.patch
deleted file mode 100644
index 7adf922..0000000
--- a/package/system/opkg/patches/090-suppress-blank-provides-field.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libopkg/pkg.c
-+++ b/libopkg/pkg.c
-@@ -731,7 +731,7 @@ pkg_formatted_field(FILE *fp, pkg_t *pkg
- 	  } else if (strcasecmp(field, "Priority") == 0) {
-                fprintf(fp, "Priority: %s\n", pkg->priority);
- 	  } else if (strcasecmp(field, "Provides") == 0) {
--	       if (pkg->provides_count) {
-+	       if (pkg->provides_count > 1) {
-                   fprintf(fp, "Provides:");
- 		  for(i = 1; i < pkg->provides_count; i++) {
-                       fprintf(fp, "%s %s", i == 1 ? "" : ",",
diff --git a/package/system/opkg/patches/100-add-force-checksum.patch b/package/system/opkg/patches/100-add-force-checksum.patch
deleted file mode 100644
index 5f65a75..0000000
--- a/package/system/opkg/patches/100-add-force-checksum.patch
+++ /dev/null
@@ -1,85 +0,0 @@
---- a/libopkg/opkg_conf.c
-+++ b/libopkg/opkg_conf.c
-@@ -54,6 +54,7 @@ opkg_option_t options[] = {
- 	  { "force_reinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_reinstall },
- 	  { "force_space", OPKG_OPT_TYPE_BOOL, &_conf.force_space },
- 	  { "force_postinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_postinstall },
-+	  { "force_checksum", OPKG_OPT_TYPE_BOOL, &_conf.force_checksum },
-           { "check_signature", OPKG_OPT_TYPE_BOOL, &_conf.check_signature },
- 	  { "ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy },
- 	  { "http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy },
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -78,6 +78,7 @@ struct opkg_conf
-      int force_removal_of_essential_packages;
-      int force_postinstall;
-      int force_remove;
-+     int force_checksum;
-      int check_signature;
-      int nodeps; /* do not follow dependencies */
-      int nocase; /* perform case insensitive matching */
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1327,12 +1327,19 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-          file_md5 = file_md5sum_alloc(pkg->local_filename);
-          if (file_md5 && strcmp(file_md5, pkg->md5sum))
-          {
--              opkg_msg(ERROR, "Package %s md5sum mismatch. "
--			"Either the opkg or the package index are corrupt. "
--			"Try 'opkg update'.\n",
--			pkg->name);
--              free(file_md5);
--              return -1;
-+              if (!conf->force_checksum)
-+              {
-+                  opkg_msg(ERROR, "Package %s md5sum mismatch. "
-+			    "Either the opkg or the package index are corrupt. "
-+			    "Try 'opkg update'.\n",
-+			    pkg->name);
-+                  free(file_md5);
-+                  return -1;
-+              }
-+              else
-+              {
-+                  opkg_msg(NOTICE, "Ignored %s md5sum mismatch.\n", pkg->name);
-+              }
-          }
- 	 if (file_md5)
-               free(file_md5);
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -42,6 +42,7 @@ enum {
- 	ARGS_OPT_FORCE_SPACE,
- 	ARGS_OPT_FORCE_POSTINSTALL,
- 	ARGS_OPT_FORCE_REMOVE,
-+	ARGS_OPT_FORCE_CHECKSUM,
- 	ARGS_OPT_ADD_ARCH,
- 	ARGS_OPT_ADD_DEST,
- 	ARGS_OPT_NOACTION,
-@@ -84,6 +85,8 @@ static struct option long_options[] = {
- 	{"force_postinstall", 0, 0, ARGS_OPT_FORCE_POSTINSTALL},
- 	{"force-remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
- 	{"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
-+	{"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
-+	{"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
- 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
- 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
- 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
-@@ -178,6 +181,9 @@ args_parse(int argc, char *argv[])
- 		case ARGS_OPT_FORCE_REMOVE:
- 			conf->force_remove = 1;
- 			break;
-+		case ARGS_OPT_FORCE_CHECKSUM:
-+			conf->force_checksum = 1;
-+			break;
- 		case ARGS_OPT_NODEPS:
- 			conf->nodeps = 1;
- 			break;
-@@ -293,6 +299,7 @@ usage()
- 	printf("\t--force-space		Disable free space checks\n");
- 	printf("\t--force-postinstall	Run postinstall scripts even in offline mode\n");
- 	printf("\t--force-remove	Remove package even if prerm script fails\n");
-+	printf("\t--force-checksum	Don't fail on checksum mismatches\n");
- 	printf("\t--noaction		No action -- test only\n");
- 	printf("\t--download-only	No action -- download only\n");
- 	printf("\t--nodeps		Do not follow dependencies\n");
diff --git a/package/system/opkg/patches/110-upgrade.patch b/package/system/opkg/patches/110-upgrade.patch
deleted file mode 100644
index 61f454a..0000000
--- a/package/system/opkg/patches/110-upgrade.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1405,9 +1405,11 @@ opkg_install_pkg(pkg_t *pkg, int from_up
- 	  opkg_state_changed++;
- 	  pkg->state_flag |= SF_FILELIST_CHANGED;
- 
--	  if (old_pkg)
-+	  if (old_pkg) {
-                pkg_remove_orphan_dependent(pkg, old_pkg);
--
-+	       old_pkg->is_upgrade = 1;
-+	       pkg->is_upgrade = 1;
-+	  }
- 	  /* XXX: BUG: we really should treat replacement more like an upgrade
- 	   *      Instead, we're going to remove the replacees
- 	   */
-@@ -1466,7 +1468,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
- 	  }
- 
- 
--	  opkg_msg(INFO, "Installing maintainer scripts.\n");
-+	  opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
- 	  if (install_maintainer_scripts(pkg, old_pkg)) {
- 		opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
- 			       " Package debris may remain!\n",
---- a/libopkg/pkg.c
-+++ b/libopkg/pkg.c
-@@ -1285,6 +1285,12 @@ pkg_run_script(pkg_t *pkg, const char *s
-      setenv("PKG_ROOT",
- 	    pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
- 
-+	if (pkg->is_upgrade)
-+		setenv("PKG_UPGRADE", "1", 1);
-+	else
-+		setenv("PKG_UPGRADE", "0", 1);
-+
-+
-      if (! file_exists(path)) {
- 	  free(path);
- 	  return 0;
---- a/libopkg/pkg.h
-+++ b/libopkg/pkg.h
-@@ -184,6 +184,7 @@ struct pkg
-      /* this flag specifies whether the package was installed to satisfy another
-       * package's dependancies */
-      int auto_installed;
-+     int is_upgrade;
- };
- 
- pkg_t *pkg_new(void);
diff --git a/package/system/opkg/patches/200-usign_support.patch b/package/system/opkg/patches/200-usign_support.patch
deleted file mode 100644
index 6479d57..0000000
--- a/package/system/opkg/patches/200-usign_support.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -169,6 +169,15 @@ if test "x$want_gpgme" = "xyes"; then
-   fi
- fi
- 
-+AC_ARG_ENABLE(usign,
-+    AC_HELP_STRING([--enable-usign], [Enable signature checking with usign
-+      [[default=yes]] ]),
-+    [want_usign="$enableval"], [want_usign="yes"])
-+
-+if test "x$want_usign" = "xyes"; then
-+  AC_DEFINE(HAVE_USIGN, 1, [Define if you want usign support])
-+fi
-+
- AC_SUBST(GPGME_CFLAGS)
- AC_SUBST(GPGME_LIBS)
- 
---- a/libopkg/opkg.c
-+++ b/libopkg/opkg.c
-@@ -599,7 +599,7 @@ opkg_update_package_lists(opkg_progress_
- 		}
- 		free(url);
- 
--#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
-+#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
- 		if (conf->check_signature) {
- 			char *sig_file_name;
- 			/* download detached signitures to verify the package lists */
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -169,7 +169,7 @@ opkg_update_cmd(int argc, char **argv)
- 			    list_file_name);
- 	  }
- 	  free(url);
--#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
-+#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
-           if (conf->check_signature) {
-               /* download detached signitures to verify the package lists */
-               /* get the url for the sig file */
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1288,7 +1288,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-      }
- 
-      /* check that the repository is valid */
--     #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
-+     #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
-      char *list_file_name, *sig_file_name, *lists_dir;
- 
-      /* check to ensure the package has come from a repository */
---- a/libopkg/opkg_download.c
-+++ b/libopkg/opkg_download.c
-@@ -19,6 +19,7 @@
- 
- #include "config.h"
- 
-+#include <sys/wait.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <libgen.h>
-@@ -342,7 +343,28 @@ opkg_prepare_url_for_install(const char
- int
- opkg_verify_file (char *text_file, char *sig_file)
- {
--#if defined HAVE_GPGME
-+#if defined HAVE_USIGN
-+	int status = -1;
-+	int pid;
-+
-+    if (conf->check_signature == 0 )
-+        return 0;
-+
-+	pid = fork();
-+	if (pid < 0)
-+		return -1;
-+
-+	if (!pid) {
-+		execl("/usr/sbin/opkg-key", "opkg-key", "verify", sig_file, text_file, NULL);
-+		exit(255);
-+	}
-+
-+	waitpid(pid, &status, 0);
-+	if (!WIFEXITED(status) || WEXITSTATUS(status))
-+		return -1;
-+
-+	return 0;
-+#elif defined HAVE_GPGME
-     if (conf->check_signature == 0 )
-         return 0;
-     int status = -1;
diff --git a/package/system/opkg/patches/210-add-force-signature.patch b/package/system/opkg/patches/210-add-force-signature.patch
deleted file mode 100644
index c41eab0..0000000
--- a/package/system/opkg/patches/210-add-force-signature.patch
+++ /dev/null
@@ -1,70 +0,0 @@
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -80,6 +80,7 @@ struct opkg_conf
-      int force_remove;
-      int force_checksum;
-      int check_signature;
-+     int force_signature;
-      int nodeps; /* do not follow dependencies */
-      int nocase; /* perform case insensitive matching */
-      char *offline_root;
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -51,6 +51,7 @@ enum {
- 	ARGS_OPT_NOCASE,
- 	ARGS_OPT_AUTOREMOVE,
- 	ARGS_OPT_CACHE,
-+	ARGS_OPT_FORCE_SIGNATURE,
- };
- 
- static struct option long_options[] = {
-@@ -87,6 +88,8 @@ static struct option long_options[] = {
- 	{"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
- 	{"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
- 	{"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
-+	{"force-signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
-+	{"force_signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
- 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
- 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
- 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
-@@ -210,6 +213,9 @@ args_parse(int argc, char *argv[])
-         case ARGS_OPT_DOWNLOAD_ONLY:
- 			conf->download_only = 1;
- 			break;
-+		case ARGS_OPT_FORCE_SIGNATURE:
-+			conf->force_signature = 1;
-+			break;
- 		case ':':
- 			parse_err = -1;
- 			break;
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1306,13 +1306,15 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-          if (opkg_verify_file (list_file_name, sig_file_name)){
-            opkg_msg(ERROR, "Failed to verify the signature of %s.\n",
-                            list_file_name);
--           return -1;
-+           if (!conf->force_signature)
-+             return -1;
-          }
-        }else{
-          opkg_msg(ERROR, "Signature file is missing for %s. "
-                          "Perhaps you need to run 'opkg update'?\n",
- 			 pkg->name);
--         return -1;
-+         if (!conf->force_signature)
-+           return -1;
-        }
- 
-        free (lists_dir);
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -196,7 +196,7 @@ opkg_update_cmd(int argc, char **argv)
-                   else
-                       opkg_msg(NOTICE, "Signature check failed.\n");
-               }
--              if (err) {
-+              if (err && !conf->force_signature) {
-                   /* The signature was wrong so delete it */
-                   opkg_msg(NOTICE, "Remove wrong Signature file.\n");
-                   unlink (tmp_file_name);
diff --git a/package/system/opkg/patches/220-drop-release-support.patch b/package/system/opkg/patches/220-drop-release-support.patch
deleted file mode 100644
index b674e33..0000000
--- a/package/system/opkg/patches/220-drop-release-support.patch
+++ /dev/null
@@ -1,812 +0,0 @@
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -15,7 +15,6 @@ opkg_cmd_sources = opkg_cmd.c opkg_cmd.h
- 		   opkg_upgrade.c opkg_upgrade.h \
- 		   opkg_remove.c opkg_remove.h
- opkg_db_sources = opkg_conf.c opkg_conf.h \
--		  release.c release.h release_parse.c release_parse.h \
- 		  opkg_utils.c opkg_utils.h pkg.c pkg.h hash_table.h \
- 		  pkg_depends.c pkg_depends.h pkg_extract.c pkg_extract.h \
- 		  hash_table.c pkg_hash.c pkg_hash.h pkg_parse.c pkg_parse.h \
-@@ -28,7 +27,6 @@ opkg_list_sources = conffile.c conffile.
- 		    active_list.c active_list.h list.h 
- opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c md5.c md5.h \
- 		    parse_util.c parse_util.h \
--		    cksum_list.c cksum_list.h \
- 		    sprintf_alloc.c sprintf_alloc.h \
- 		    xregex.c xregex.h xsystem.c xsystem.h
- if HAVE_PATHFINDER
---- a/libopkg/cksum_list.c
-+++ /dev/null
-@@ -1,87 +0,0 @@
--/* cksum_lis.c - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   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; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#include "config.h"
--
--#include <stdio.h>
--
--#include "cksum_list.h"
--#include "libbb/libbb.h"
--
--
--int cksum_init(cksum_t *cksum, char **itemlist)
--{
--    cksum->value = xstrdup(*itemlist++);
--    cksum->size = atoi(*itemlist++);
--    cksum->name = xstrdup(*itemlist++);
--
--    return 0;
--}
--
--void cksum_deinit(cksum_t *cksum)
--{
--    free (cksum->name);
--    cksum->name = NULL;
--
--    free (cksum->value);
--    cksum->value = NULL;
--}
--
--void cksum_list_init(cksum_list_t *list)
--{
--    void_list_init((void_list_t *) list);
--}
--
--void cksum_list_deinit(cksum_list_t *list)
--{
--    cksum_list_elt_t *iter, *n;
--    cksum_t *cksum;
--
--    list_for_each_entry_safe(iter, n, &list->head, node) {
--      cksum = (cksum_t *)iter->data;
--      cksum_deinit(cksum);
--
--      /* malloced in cksum_list_append */
--      free(cksum);
--      iter->data = NULL;
--    }
--    void_list_deinit((void_list_t *) list);
--}
--
--cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist)
--{
--    /* freed in cksum_list_deinit */
--    cksum_t *cksum = xcalloc(1, sizeof(cksum_t));
--    cksum_init(cksum, itemlist);
--
--    void_list_append((void_list_t *) list, cksum);
--
--    return cksum;
--}
--
--const cksum_t *cksum_list_find(cksum_list_t *list, const char *name)
--{
--     cksum_list_elt_t *iter;
--     cksum_t *cksum;
--
--     list_for_each_entry(iter, &list->head, node) {
--	  cksum = (cksum_t *)iter->data;
--	  if (strcmp(cksum->name, name) == 0) {
--	       return cksum;
--	  }
--     }    
--     return NULL;
--}
--
---- a/libopkg/cksum_list.h
-+++ /dev/null
-@@ -1,46 +0,0 @@
--/* cksum_list.h - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   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; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#ifndef CKSUM_LIST_H
--#define CKSUM_LIST_H
--
--typedef struct 
--{
--  char *name;
--  char *value;
--  int size;
--} cksum_t;
--
--int cksum_init(cksum_t *cksum, char **itemlist);
--void cksum_deinit(cksum_t *cksum);
--
--#include "void_list.h"
--
--typedef struct void_list_elt cksum_list_elt_t;
--
--typedef struct void_list cksum_list_t;
--
--static inline int cksum_list_empty(cksum_list_t *list)
--{
--    return void_list_empty ((void_list_t *)list);
--}
--
--void cksum_list_init(cksum_list_t *list);
--void cksum_list_deinit(cksum_list_t *list);
--
--cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist);
--const cksum_t *cksum_list_find(cksum_list_t *list, const char *name);
--
--#endif
---- a/libopkg/release.c
-+++ /dev/null
-@@ -1,342 +0,0 @@
--/* release.c - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   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; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#include <unistd.h>
--#include <ctype.h>
--
--#include "release.h"
--#include "opkg_utils.h"
--#include "libbb/libbb.h"
--
--#include "opkg_download.h"
--#include "sprintf_alloc.h"
--
--#include "release_parse.h"
--
--#include "parse_util.h"
--#include "file_util.h"
--
--static void
--release_init(release_t *release)
--{
--     release->name = NULL;
--     release->datestring = NULL;
--     release->architectures = NULL;
--     release->architectures_count = 0;
--     release->components = NULL;
--     release->components_count = 0;
--     release->complist = NULL;
--     release->complist_count = 0;
--}
--
--release_t *
--release_new(void)
--{
--     release_t *release;
--
--     release = xcalloc(1, sizeof(release_t));
--     release_init(release);
--
--     return release;
--}
--
--void
--release_deinit(release_t *release)
--{
--    int i;
--
--    free(release->name);
--    free(release->datestring);
--
--    for(i = 0; i < release->architectures_count; i++){
--	free(release->architectures[i]);
--    }
--    free(release->architectures);
--
--    for(i = 0; i < release->components_count; i++){
--	free(release->components[i]);
--    }
--    free(release->components);
--
--    for(i = 0; i < release->complist_count; i++){
--	free(release->complist[i]);
--    }
--    free(release->complist);
--
--}
--
--int
--release_init_from_file(release_t *release, const char *filename)
--{
--	int err = 0;
--	FILE *release_file;
--
--	release_file = fopen(filename, "r");
--	if (release_file == NULL) {
--		opkg_perror(ERROR, "Failed to open %s", filename);
--		return -1;
--	}
--
--	err=release_parse_from_stream(release, release_file);
--	if (!err) {
--		if (!release_arch_supported(release)) {
--			opkg_msg(ERROR, "No valid architecture found on Release file.\n");
--			err = -1;
--		}
--	}
--
--	return err;
--}
--
--const char *
--item_in_list(const char *comp, char **complist, const unsigned int count)
--{
--     int i;
--
--     if (!complist)
--	  return comp;
--
--     for(i = 0; i < count; i++){
--	  if (strcmp(comp, complist[i]) == 0)
--		    return complist[i];
--     }
--
--     return NULL;
--}
--
--int
--release_arch_supported(release_t *release)
--{
--     nv_pair_list_elt_t *l;
--
--     list_for_each_entry(l , &conf->arch_list.head, node) {
--	  nv_pair_t *nv = (nv_pair_t *)l->data;
--	  if (item_in_list(nv->name, release->architectures, release->architectures_count)) {
--	       opkg_msg(DEBUG, "Arch %s (priority %s) supported for dist %s.\n",
--			       nv->name, nv->value, release->name);
--	       return 1;
--	  }
--     }
--
--     return 0;
--}
--
--int
--release_comps_supported(release_t *release, const char *complist)
--{
--     int ret = 1;
--     int i;
--
--     if (complist) {
--	  release->complist = parse_list(complist, &release->complist_count, ' ', 1);
--	  for(i = 0; i < release->complist_count; i++){
--	       if (!item_in_list(release->complist[i], release->components, release->components_count)) {
--		    opkg_msg(ERROR, "Component %s not supported for dist %s.\n",
--				    release->complist[i], release->name);
--		    ret = 0;
--	       }
--	  }
--     }
--
--     return ret;
--}
--
--const char **
--release_comps(release_t *release, unsigned int *count)
--{
--     char **comps = release->complist;
--
--     if (!comps) {
--	  comps = release->components;
--	  *count = release->components_count;
--     } else {
--	  *count = release->complist_count;
--     }
--
--     return (const char **)comps;
--}
--
--int
--release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir)
--{
--     int ret = 0;
--     unsigned int ncomp;
--     const char **comps = release_comps(release, &ncomp);
--     nv_pair_list_elt_t *l;
--     int i;
--
--     for(i = 0; i < ncomp; i++){
--	  int err = 0;
--	  char *prefix;
--
--	  sprintf_alloc(&prefix, "%s/dists/%s/%s/binary", dist->value, dist->name,
--			comps[i]);
--
--	  list_for_each_entry(l , &conf->arch_list.head, node) {
--	       char *url;
--	       char *tmp_file_name, *list_file_name;
--	       char *subpath = NULL;
--
--	       nv_pair_t *nv = (nv_pair_t *)l->data;
--
--	       sprintf_alloc(&list_file_name, "%s/%s-%s-%s", lists_dir, dist->name, comps[i], nv->name);
--
--	       sprintf_alloc(&tmp_file_name, "%s/%s-%s-%s%s", tmpdir, dist->name, comps[i], nv->name, ".gz");
--
--	       sprintf_alloc(&subpath, "%s/binary-%s/%s", comps[i], nv->name, dist->gzip ? "Packages.gz" : "Packages");
--
--	       if (dist->gzip) {
--	       sprintf_alloc(&url, "%s-%s/Packages.gz", prefix, nv->name);
--	       err = opkg_download(url, tmp_file_name, NULL, NULL, 1);
--	       if (!err) {
--		    err = release_verify_file(release, tmp_file_name, subpath);
--		    if (err) {
--			 unlink (tmp_file_name);
--			 unlink (list_file_name);
--		    }
--	       }
--	       if (!err) {
--		    FILE *in, *out;
--		    opkg_msg(NOTICE, "Inflating %s.\n", url);
--		    in = fopen (tmp_file_name, "r");
--		    out = fopen (list_file_name, "w");
--		    if (in && out) {
--			 err = unzip (in, out);
--			 if (err)
--			      opkg_msg(INFO, "Corrumpt file at %s.\n", url);
--		    } else
--			 err = 1;
--		    if (in)
--			 fclose (in);
--		    if (out)
--			 fclose (out);
--		    unlink (tmp_file_name);
--	       }
--	       free(url);
--	       }
--
--	       if (err) {
--		    sprintf_alloc(&url, "%s-%s/Packages", prefix, nv->name);
--		    err = opkg_download(url, list_file_name, NULL, NULL, 1);
--		    if (!err) {
--			 err = release_verify_file(release, tmp_file_name, subpath);
--			 if (err)
--			      unlink (list_file_name);
--		    }
--		    free(url);
--	       }
--
--	       free(tmp_file_name);
--	       free(list_file_name);
--	  }
--
--	  if(err)
--	       ret = 1;
--
--	  free(prefix);
--     }
--
--     return ret;
--}
--
--int
--release_get_size(release_t *release, const char *pathname)
--{
--     const cksum_t *cksum;
--
--     if (release->md5sums) {
--	  cksum = cksum_list_find(release->md5sums, pathname);
--	  return cksum->size;
--     }
--
--#ifdef HAVE_SHA256
--     if (release->sha256sums) {
--	  cksum = cksum_list_find(release->sha256sums, pathname);
--	  return cksum->size;
--     }
--#endif
--
--     return -1;
--}
--
--const char *
--release_get_md5(release_t *release, const char *pathname)
--{
--     const cksum_t *cksum;
--
--     if (release->md5sums) {
--	  cksum = cksum_list_find(release->md5sums, pathname);
--	  return cksum->value;
--     }
--
--     return '\0';
--}
--
--#ifdef HAVE_SHA256
--const char *
--release_get_sha256(release_t *release, const char *pathname)
--{
--     const cksum_t *cksum;
--
--     if (release->sha256sums) {
--	  cksum = cksum_list_find(release->sha256sums, pathname);
--	  return cksum->value;
--     }
--
--     return '\0';
--}
--#endif
--
--int
--release_verify_file(release_t *release, const char* file_name, const char *pathname)
--{
--     struct stat f_info;
--     char *f_md5 = NULL;
--     const char *md5 = release_get_md5(release, pathname);
--#ifdef HAVE_SHA256
--     char *f_sha256 = NULL;
--     const char *sha256 = release_get_sha256(release, pathname);
--#endif
--     int ret = 0;
--
--     if (stat(file_name, &f_info) || (f_info.st_size!=release_get_size(release, pathname))) {
--	  opkg_msg(ERROR, "Size verification failed for %s - %s.\n", release->name, pathname);
--	  ret = 1;
--     } else {
--
--     f_md5 = file_md5sum_alloc(file_name);
--#ifdef HAVE_SHA256
--     f_sha256 = file_sha256sum_alloc(file_name);
--#endif
--
--     if (md5 && strcmp(md5, f_md5)) {
--	  opkg_msg(ERROR, "MD5 verification failed for %s - %s.\n", release->name, pathname);
--	  ret = 1;
--#ifdef HAVE_SHA256
--     } else if (sha256 && strcmp(sha256, f_sha256)) {
--	  opkg_msg(ERROR, "SHA256 verification failed for %s - %s.\n", release->name, pathname);
--	  ret = 1;
--#endif
--     }
--
--     }
--
--     free(f_md5);
--#ifdef HAVE_SHA256
--     free(f_sha256);
--#endif
--
--     return ret;
--}
---- a/libopkg/release.h
-+++ /dev/null
-@@ -1,53 +0,0 @@
--/* release.h - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   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; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#ifndef RELEASE_H
--#define RELEASE_H
--
--#include <stdio.h>
--#include "pkg.h"
--#include "cksum_list.h"
--
--struct release
--{
--     char *name;
--     char *datestring;
--     char **architectures;
--     unsigned int architectures_count;
--     char **components;
--     unsigned int components_count;
--     cksum_list_t *md5sums;
--#ifdef HAVE_SHA256
--     cksum_list_t *sha256sums;
--#endif
--     char **complist;
--     unsigned int complist_count;
--};
--
--typedef struct release release_t;
--
--release_t *release_new(void);
--void release_deinit(release_t *release);
--int release_init_from_file(release_t *release, const char *filename);
--
--int release_arch_supported(release_t *release);
--int release_comps_supported(release_t *release, const char *complist);
--int release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir);
--
--const char **release_comps(release_t *release, unsigned int *count);
--
--int release_verify_file(release_t *release, const char *filename, const char *pathname);
--
--#endif
---- a/libopkg/release_parse.c
-+++ /dev/null
-@@ -1,126 +0,0 @@
--/* release_parse.c - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   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; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#include "config.h"
--
--#include <stdio.h>
--
--#include "release.h"
--#include "release_parse.h"
--#include "libbb/libbb.h"
--#include "parse_util.h"
--
--static int
--release_parse_line(void *ptr, const char *line, uint mask)
--{
--	release_t *release = (release_t *) ptr;
--
--	int ret = 0;
--	unsigned int count = 0;
--	char **list = 0;
--	static int reading_md5sums = 0;
--#ifdef HAVE_SHA256
--	static int reading_sha256sums = 0;
--#endif
--
--	switch (*line) {
--	case 'A':
--		if (is_field("Architectures", line)) {
--			release->architectures = parse_list(line, &release->architectures_count, ' ', 0);
--		}
--		break;
--
--	case 'C':
--		if (is_field("Codename", line)) {
--			release->name = parse_simple("Codename", line);
--	    	}
--		else if (is_field("Components", line)) {
--			release->components = parse_list(line, &release->components_count, ' ', 0);
--	    	}
--		break;
--
--	case 'D':
--		if (is_field("Date", line)) {
--			release->datestring = parse_simple("Date", line);
--		}
--		break;
--
--	case 'M':
--		if (is_field("MD5sum", line)) {
--			reading_md5sums = 1;
--			if (release->md5sums == NULL) {
--			     release->md5sums = xcalloc(1, sizeof(cksum_list_t));
--			     cksum_list_init(release->md5sums);
--			}
--			goto dont_reset_flags;
--	    	}
--		break;
--
--#ifdef HAVE_SHA256
--	case 'S':
--		if (is_field("SHA256", line)) {
--			reading_sha256sums = 1;
--			if (release->sha256sums == NULL) {
--			     release->sha256sums = xcalloc(1, sizeof(cksum_list_t));
--			     cksum_list_init(release->sha256sums);
--			}
--			goto dont_reset_flags;
--	    	}
--		break;
--#endif
--
--	case ' ':
--		if (reading_md5sums) {
--			list = parse_list(line, &count, ' ', 1);
--			cksum_list_append(release->md5sums, list);
--			goto dont_reset_flags;
--		}
--#ifdef HAVE_SHA256
--		else if (reading_sha256sums) {
--			list = parse_list(line, &count, ' ', 1);
--			cksum_list_append(release->sha256sums, list);
--			goto dont_reset_flags;
--		}
--#endif
--		break;
--
--	default:
--		ret = 1;
--	}
--
--	reading_md5sums = 0;
--#ifdef HAVE_SHA256
--	reading_sha256sums = 0;
--#endif
--
--dont_reset_flags:
--
--	return ret;
--}
--
--int
--release_parse_from_stream(release_t *release, FILE *fp)
--{
--	int ret;
--	char *buf;
--	const size_t len = 4096;
--
--	buf = xmalloc(len);
--	ret = parse_from_stream_nomalloc(release_parse_line, release, fp, 0, &buf, len);
--	free(buf);
--
--	return ret;
--}
--
---- a/libopkg/release_parse.h
-+++ /dev/null
-@@ -1,21 +0,0 @@
--/* release_parse.h - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   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; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#ifndef RELEASE_PARSE_H
--#define RELEASE_PARSE_H
--
--int release_parse_from_stream(release_t *release, FILE *fp);
--
--#endif
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -27,7 +27,6 @@
- #include "opkg_conf.h"
- #include "opkg_cmd.h"
- #include "opkg_message.h"
--#include "release.h"
- #include "pkg.h"
- #include "pkg_dest.h"
- #include "pkg_parse.h"
-@@ -114,39 +113,6 @@ opkg_update_cmd(int argc, char **argv)
-      }
- 
- 
--     for (iter = void_list_first(&conf->dist_src_list); iter; iter = void_list_next(&conf->dist_src_list, iter)) {
--	  char *url, *list_file_name;
--
--	  src = (pkg_src_t *)iter->data;
--
--	  sprintf_alloc(&url, "%s/dists/%s/Release", src->value, src->name);
--
--	  sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
--	  err = opkg_download(url, list_file_name, NULL, NULL, 0);
--	  if (!err) {
--	       opkg_msg(NOTICE, "Downloaded release files for dist %s.\n",
--			    src->name);
--	       release_t *release = release_new(); 
--	       err = release_init_from_file(release, list_file_name);
--	       if (!err) {
--		    if (!release_comps_supported(release, src->extra_data))
--			 err = -1;
--	       }
--	       if (!err) {
--		    err = release_download(release, src, lists_dir, tmp);
--	       }
--	       release_deinit(release); 
--	       if (err)
--		    unlink(list_file_name);
--	  }
--
--	  if (err)
--	       failures++;
--
--	  free(list_file_name);
--	  free(url);
--     }
--
-      for (iter = void_list_first(&conf->pkg_src_list); iter; iter = void_list_next(&conf->pkg_src_list, iter)) {
- 	  char *url, *list_file_name;
- 
---- a/libopkg/pkg_hash.c
-+++ b/libopkg/pkg_hash.c
-@@ -18,7 +18,6 @@
- #include <stdio.h>
- 
- #include "hash_table.h"
--#include "release.h"
- #include "pkg.h"
- #include "opkg_message.h"
- #include "pkg_vec.h"
-@@ -184,40 +183,6 @@ pkg_hash_load_feeds(void)
- 	lists_dir = conf->restrict_to_default_dest ?
- 		conf->default_dest->lists_dir : conf->lists_dir;
- 
--	for (iter = void_list_first(&conf->dist_src_list); iter;
--			iter = void_list_next(&conf->dist_src_list, iter)) {
--
--		src = (pkg_src_t *)iter->data;
--
--		sprintf_alloc(&list_file, "%s/%s", lists_dir, src->name);
--
--		if (file_exists(list_file)) {
--			int i;
--			release_t *release = release_new();
--			if(release_init_from_file(release, list_file)) {
--				free(list_file);
--				return -1;
--			}
--
--			unsigned int ncomp;
--			const char **comps = release_comps(release, &ncomp);
--			subdist = (pkg_src_t *) xmalloc(sizeof(pkg_src_t));
--			memcpy(subdist, src, sizeof(pkg_src_t));
--
--			for(i = 0; i < ncomp; i++){
--				subdist->name = NULL;
--				sprintf_alloc(&subdist->name, "%s-%s", src->name, comps[i]);
--				if (dist_hash_add_from_file(lists_dir, subdist)) {
--					free(subdist->name); free(subdist);
--					free(list_file);
--					return -1;
--				}
--			}
--			free(subdist->name); free(subdist);
--		}
--		free(list_file);
--	}
--
- 	for (iter = void_list_first(&conf->pkg_src_list); iter;
- 			iter = void_list_next(&conf->pkg_src_list, iter)) {
- 
diff --git a/package/system/opkg/patches/230-drop_md5_support.patch b/package/system/opkg/patches/230-drop_md5_support.patch
deleted file mode 100644
index 57546be..0000000
--- a/package/system/opkg/patches/230-drop_md5_support.patch
+++ /dev/null
@@ -1,192 +0,0 @@
---- a/libopkg/conffile.c
-+++ b/libopkg/conffile.c
-@@ -36,7 +36,7 @@ void conffile_deinit(conffile_t *conffil
- 
- int conffile_has_been_modified(conffile_t *conffile)
- {
--    char *md5sum;
-+    char *chksum;
-     char *filename = conffile->name;
-     char *root_filename;
-     int ret = 1;
-@@ -48,16 +48,23 @@ int conffile_has_been_modified(conffile_
- 
-     root_filename = root_filename_alloc(filename);
- 
--    md5sum = file_md5sum_alloc(root_filename);
--
--    if (md5sum && (ret = strcmp(md5sum, conffile->value))) {
--        opkg_msg(INFO, "Conffile %s:\n\told md5=%s\n\tnew md5=%s\n",
--		conffile->name, md5sum, conffile->value);
-+#ifdef HAVE_MD5
-+    if(conffile->value && strlen(conffile->value) > 33) {
-+        chksum = file_sha256sum_alloc(root_filename);
-+    } else {
-+        chksum = file_md5sum_alloc(root_filename);
-+    }
-+#else
-+    chksum = file_sha256sum_alloc(root_filename);
-+#endif
-+    if (chksum && (ret = strcmp(chksum, conffile->value))) {
-+        opkg_msg(INFO, "Conffile %s:\n\told chk=%s\n\tnew chk=%s\n",
-+		conffile->name, chksum, conffile->value);
-     }
- 
-     free(root_filename);
--    if (md5sum)
--        free(md5sum);
-+    if (chksum)
-+        free(chksum);
- 
-     return ret;
- }
---- a/libopkg/file_util.c
-+++ b/libopkg/file_util.c
-@@ -26,7 +26,9 @@
- 
- #include "sprintf_alloc.h"
- #include "file_util.h"
-+#ifdef HAVE_MD5
- #include "md5.h"
-+#endif
- #include "libbb/libbb.h"
- 
- #if defined HAVE_SHA256
-@@ -135,6 +137,7 @@ file_mkdir_hier(const char *path, long m
- 	return make_directory(path, mode, FILEUTILS_RECUR);
- }
- 
-+#ifdef HAVE_MD5
- char *file_md5sum_alloc(const char *file_name)
- {
-     static const int md5sum_bin_len = 16;
-@@ -180,6 +183,7 @@ char *file_md5sum_alloc(const char *file
- 
-     return md5sum_hex;
- }
-+#endif
- 
- #ifdef HAVE_SHA256
- char *file_sha256sum_alloc(const char *file_name)
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1082,7 +1082,7 @@ resolve_conffiles(pkg_t *pkg)
-      conffile_list_elt_t *iter;
-      conffile_t *cf;
-      char *cf_backup;
--     char *md5sum;
-+     char *chksum;
- 
-      if (conf->noaction) return 0;
- 
-@@ -1093,7 +1093,7 @@ resolve_conffiles(pkg_t *pkg)
- 
- 	  /* Might need to initialize the md5sum for each conffile */
- 	  if (cf->value == NULL) {
--	       cf->value = file_md5sum_alloc(root_filename);
-+	       cf->value = file_sha256sum_alloc(root_filename);
- 	  }
- 
- 	  if (!file_exists(root_filename)) {
-@@ -1105,8 +1105,16 @@ resolve_conffiles(pkg_t *pkg)
- 
-           if (file_exists(cf_backup)) {
-               /* Let's compute md5 to test if files are changed */
--              md5sum = file_md5sum_alloc(cf_backup);
--              if (md5sum && cf->value && strcmp(cf->value,md5sum) != 0 ) {
-+#ifdef HAVE_MD5
-+              if(cf->value && strlen(cf->value) > 33) {
-+                  chksum = file_sha256sum_alloc(cf_backup);
-+              } else {
-+                  chksum = file_md5sum_alloc(cf_backup);
-+              }
-+#else
-+              chksum = file_sha256sum_alloc(cf_backup);
-+#endif
-+              if (chksum && cf->value && strcmp(cf->value,chksum) != 0 ) {
-                   if (conf->force_maintainer) {
-                       opkg_msg(NOTICE, "Conffile %s using maintainer's setting.\n",
- 				      cf_backup);
-@@ -1123,8 +1131,8 @@ resolve_conffiles(pkg_t *pkg)
- 		  }
-               }
-               unlink(cf_backup);
--	      if (md5sum)
--                  free(md5sum);
-+	      if (chksum)
-+                  free(chksum);
-           }
- 
- 	  free(cf_backup);
-@@ -1323,6 +1331,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-      }
-      #endif
- 
-+#ifdef HAVE_MD5
-      /* Check for md5 values */
-      if (pkg->md5sum)
-      {
-@@ -1346,6 +1355,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
- 	 if (file_md5)
-               free(file_md5);
-      }
-+#endif
- 
- #ifdef HAVE_SHA256
-      /* Check for sha256 value */
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -25,13 +25,16 @@ opkg_list_sources = conffile.c conffile.
- 		    pkg_src.c pkg_src.h pkg_src_list.c pkg_src_list.h \
- 		    str_list.c str_list.h void_list.c void_list.h \
- 		    active_list.c active_list.h list.h 
--opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c md5.c md5.h \
-+opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c \
- 		    parse_util.c parse_util.h \
- 		    sprintf_alloc.c sprintf_alloc.h \
- 		    xregex.c xregex.h xsystem.c xsystem.h
- if HAVE_PATHFINDER
- opkg_util_sources += opkg_pathfinder.c opkg_pathfinder.h
- endif
-+if HAVE_MD5
-+opkg_util_sources += md5.c md5.h
-+endif
- if HAVE_SHA256
- opkg_util_sources += sha256.c sha256.h
- endif
---- a/configure.ac
-+++ b/configure.ac
-@@ -68,10 +68,19 @@ AC_ARG_ENABLE(sha256,
-       (sha256.{c,h} are GPLv3 licensed) [[default=no]] ]),
-     [want_sha256="$enableval"], [want_sha256="no"])
- 
-+AC_ARG_ENABLE(md5,
-+              AC_HELP_STRING([--enable-md5], [Enable md5sum check
-+      (md5.{c,h} are GPLv3 licensed) [[default=no]] ]),
-+    [want_md5="$enableval"], [want_md5="yes"])
-+
- if test "x$want_sha256" = "xyes"; then
-   AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
- fi
-+if test "x$want_md5" = "xyes"; then
-+  AC_DEFINE(HAVE_MD5, 1, [Define if you want md5 support])
-+fi
- AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
-+AM_CONDITIONAL(HAVE_MD5, test "x$want_md5" = "xyes")
- 
- # check for openssl
- AC_ARG_ENABLE(openssl,
---- a/libopkg/pkg_parse.c
-+++ b/libopkg/pkg_parse.c
-@@ -49,9 +49,9 @@ parse_status(pkg_t *pkg, const char *sst
- static void
- parse_conffiles(pkg_t *pkg, const char *cstr)
- {
--	char file_name[1024], md5sum[35];
-+	char file_name[1024], md5sum[85];
- 
--	if (sscanf(cstr, "%1023s %34s", file_name, md5sum) != 2) {
-+	if (sscanf(cstr, "%1023s %84s", file_name, md5sum) != 2) {
- 		opkg_msg(ERROR, "Failed to parse Conffiles line for %s\n",
- 				pkg->name);
- 		return;
diff --git a/package/system/opkg/patches/240-fix-force-checksum-for-sha256.patch b/package/system/opkg/patches/240-fix-force-checksum-for-sha256.patch
deleted file mode 100644
index 8af4d40..0000000
--- a/package/system/opkg/patches/240-fix-force-checksum-for-sha256.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1364,12 +1364,22 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-          file_sha256 = file_sha256sum_alloc(pkg->local_filename);
-          if (file_sha256 && strcmp(file_sha256, pkg->sha256sum))
-          {
--              opkg_msg(ERROR, "Package %s sha256sum mismatch. "
--			"Either the opkg or the package index are corrupt. "
--			"Try 'opkg update'.\n",
--			pkg->name);
--              free(file_sha256);
--              return -1;
-+              if (!conf->force_checksum)
-+              {
-+                  opkg_msg(ERROR,
-+                           "Package %s sha256sum mismatch. "
-+                           "Either the opkg or the package index are corrupt. "
-+                           "Try 'opkg update'.\n",
-+                           pkg->name);
-+                  free(file_sha256);
-+                  return -1;
-+              }
-+              else
-+              {
-+                  opkg_msg(NOTICE,
-+                           "Ignored %s sha256sum mismatch.\n",
-+                           pkg->name);
-+              }
-          }
- 	 if (file_sha256)
-               free(file_sha256);
diff --git a/package/system/opkg/patches/250-add-lists-dir-switch.patch b/package/system/opkg/patches/250-add-lists-dir-switch.patch
deleted file mode 100644
index d0d0707..0000000
--- a/package/system/opkg/patches/250-add-lists-dir-switch.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -101,6 +101,8 @@ static struct option long_options[] = {
- 	{"test", 0, 0, ARGS_OPT_NOACTION},
- 	{"tmp-dir", 1, 0, 't'},
- 	{"tmp_dir", 1, 0, 't'},
-+	{"lists-dir", 1, 0, 'l'},
-+	{"lists_dir", 1, 0, 'l'},
- 	{"verbosity", 2, 0, 'V'},
- 	{"version", 0, 0, 'v'},
- 	{0, 0, 0, 0}
-@@ -115,7 +117,7 @@ args_parse(int argc, char *argv[])
- 	char *tuple, *targ;
- 
- 	while (1) {
--		c = getopt_long_only(argc, argv, "Ad:f:ino:p:t:vV::",
-+		c = getopt_long_only(argc, argv, "Ad:f:ino:p:l:t:vV::",
- 				long_options, &option_index);
- 		if (c == -1)
- 			break;
-@@ -139,6 +141,9 @@ args_parse(int argc, char *argv[])
- 		case 't':
- 			conf->tmp_dir = xstrdup(optarg);
- 			break;
-+		case 'l':
-+			conf->lists_dir = xstrdup(optarg);
-+			break;
- 		case 'v':
- 			printf("opkg version %s\n", VERSION);
- 			exit(0);
-@@ -316,6 +321,8 @@ usage()
- 	printf("\t			automatically to satisfy dependencies\n");
- 	printf("\t-t			Specify tmp-dir.\n");
- 	printf("\t--tmp-dir		Specify tmp-dir.\n");
-+	printf("\t-l			Specify lists-dir.\n");
-+	printf("\t--lists-dir		Specify lists-dir.\n");
- 
- 	printf("\n");
- 
diff --git a/package/system/opkg/patches/260-add-print-package-size.patch b/package/system/opkg/patches/260-add-print-package-size.patch
deleted file mode 100644
index 4dce356..0000000
--- a/package/system/opkg/patches/260-add-print-package-size.patch
+++ /dev/null
@@ -1,74 +0,0 @@
---- a/libopkg/opkg_conf.c
-+++ b/libopkg/opkg_conf.c
-@@ -69,6 +69,7 @@ opkg_option_t options[] = {
- 	  { "proxy_passwd", OPKG_OPT_TYPE_STRING, &_conf.proxy_passwd },
- 	  { "proxy_user", OPKG_OPT_TYPE_STRING, &_conf.proxy_user },
- 	  { "query-all", OPKG_OPT_TYPE_BOOL, &_conf.query_all },
-+	  { "size", OPKG_OPT_TYPE_BOOL, &_conf.size },
- 	  { "tmp_dir", OPKG_OPT_TYPE_STRING, &_conf.tmp_dir },
- 	  { "verbosity", OPKG_OPT_TYPE_INT, &_conf.verbosity },
- #if defined(HAVE_OPENSSL)
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -88,6 +88,7 @@ struct opkg_conf
-      int query_all;
-      int verbosity;
-      int noaction;
-+     int size;
-      int download_only;
-      char *cache;
- 
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -52,6 +52,7 @@ enum {
- 	ARGS_OPT_AUTOREMOVE,
- 	ARGS_OPT_CACHE,
- 	ARGS_OPT_FORCE_SIGNATURE,
-+	ARGS_OPT_SIZE,
- };
- 
- static struct option long_options[] = {
-@@ -98,6 +99,7 @@ static struct option long_options[] = {
- 	{"offline-root", 1, 0, 'o'},
- 	{"add-arch", 1, 0, ARGS_OPT_ADD_ARCH},
- 	{"add-dest", 1, 0, ARGS_OPT_ADD_DEST},
-+	{"size", 0, 0, ARGS_OPT_SIZE},
- 	{"test", 0, 0, ARGS_OPT_NOACTION},
- 	{"tmp-dir", 1, 0, 't'},
- 	{"tmp_dir", 1, 0, 't'},
-@@ -212,6 +214,9 @@ args_parse(int argc, char *argv[])
- 			}
- 			free(tuple);
- 			break;
-+		case ARGS_OPT_SIZE:
-+			conf->size = 1;
-+			break;
- 		case ARGS_OPT_NOACTION:
- 			conf->noaction = 1;
- 			break;
-@@ -315,6 +320,7 @@ usage()
- 	printf("\t--download-only	No action -- download only\n");
- 	printf("\t--nodeps		Do not follow dependencies\n");
- 	printf("\t--nocase		Perform case insensitive pattern matching\n");
-+	printf("\t--size			Print package size when listing available packages\n");
- 	printf("\t--force-removal-of-dependent-packages\n");
- 	printf("\t			Remove package and all dependencies\n");
- 	printf("\t--autoremove		Remove packages that were installed\n");
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -47,10 +47,12 @@ static void
- print_pkg(pkg_t *pkg)
- {
- 	char *version = pkg_version_str_alloc(pkg);
-+	printf("%s - %s", pkg->name, version);
-+	if (conf->size)
-+		printf(" - %lu", pkg->size);
- 	if (pkg->description)
--		printf("%s - %s - %s\n", pkg->name, version, pkg->description);
--	else
--		printf("%s - %s\n", pkg->name, version);
-+		printf(" - %s", pkg->description);
-+	printf("\n");
- 	free(version);
- }
- 
diff --git a/package/system/opkg/patches/270-fix-use-after-free.patch b/package/system/opkg/patches/270-fix-use-after-free.patch
deleted file mode 100644
index 96e24b9..0000000
--- a/package/system/opkg/patches/270-fix-use-after-free.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libopkg/opkg_download.c
-+++ b/libopkg/opkg_download.c
-@@ -335,7 +335,7 @@ opkg_prepare_url_for_install(const char
-      hash_insert_pkg(pkg, 1);
- 
-      if (namep) {
--	  *namep = pkg->name;
-+	  *namep = xstrdup(pkg->name);
-      }
-      return 0;
- }
diff --git a/package/system/opkg/patches/280-call-prerm-and-postrm-scripts-on-upgrade.patch b/package/system/opkg/patches/280-call-prerm-and-postrm-scripts-on-upgrade.patch
deleted file mode 100644
index 6abbd5d..0000000
--- a/package/system/opkg/patches/280-call-prerm-and-postrm-scripts-on-upgrade.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From a8555d352d2851ee1482b74b57ba9eacfb354c18 Mon Sep 17 00:00:00 2001
-From: Peter Urbanec <peteru at urbanec.net>
-Date: Thu, 23 Oct 2014 01:05:35 +1100
-Subject: [PATCH] opkg_install: Call prerm and postrm scripts on package
- upgrade
-
-When upgrading a package from v1 to v2, run "v1-prerm upgrade v2" and
-"v1-postrm upgrade v2", similarly to what dpkg does.
-
-This patch fixes issue 104.
-
-Signed-off-by: Peter Urbanec <openembedded-devel at urbanec.net>
-Signed-off-by: Paul Barker <paul at paulbarker.me.uk>
----
- libopkg/opkg_install.c | 40 ++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 38 insertions(+), 2 deletions(-)
-
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -528,7 +528,25 @@ prerm_upgrade_old_pkg(pkg_t *pkg, pkg_t
- 	   Error unwind, for both the above cases:
- 	   old-postinst abort-upgrade new-version
-      */
--     return 0;
-+    int err;
-+    char *script_args;
-+    char *new_version;
-+
-+    if (!old_pkg || !pkg)
-+        return 0;
-+
-+    new_version = pkg_version_str_alloc(pkg);
-+
-+    sprintf_alloc(&script_args, "upgrade %s", new_version);
-+    free(new_version);
-+    err = pkg_run_script(old_pkg, "prerm", script_args);
-+    free(script_args);
-+    if (err != 0) {
-+        opkg_msg(ERROR, "prerm script for package \"%s\" failed\n",
-+                 old_pkg->name);
-+        return -1;
-+    }
-+    return 0;
- }
- 
- static int
-@@ -925,7 +943,25 @@ postrm_upgrade_old_pkg(pkg_t *pkg, pkg_t
- 	   new-postrm failed-upgrade old-version
- 	Error unwind, for both cases:
- 	   old-preinst abort-upgrade new-version    */
--     return 0;
-+    int err;
-+    char *script_args;
-+    char *new_version;
-+
-+    if (!old_pkg || !pkg)
-+        return 0;
-+
-+    new_version = pkg_version_str_alloc(pkg);
-+
-+    sprintf_alloc(&script_args, "upgrade %s", new_version);
-+    free(new_version);
-+    err = pkg_run_script(old_pkg, "postrm", script_args);
-+    free(script_args);
-+    if (err != 0) {
-+        opkg_msg(ERROR, "postrm script for package \"%s\" failed\n",
-+                 old_pkg->name);
-+        return -1;
-+    }
-+    return 0;
- }
- 
- static int
diff --git a/package/system/opkg/patches/290-clarify-download-errors.patch b/package/system/opkg/patches/290-clarify-download-errors.patch
deleted file mode 100644
index 5512f67..0000000
--- a/package/system/opkg/patches/290-clarify-download-errors.patch
+++ /dev/null
@@ -1,61 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -85,6 +85,7 @@ opkg_update_cmd(int argc, char **argv)
-      char *tmp;
-      int err;
-      int failures;
-+     int pkglist_dl_error;
-      char *lists_dir;
-      pkg_src_list_elt_t *iter;
-      pkg_src_t *src;
-@@ -130,15 +131,19 @@ opkg_update_cmd(int argc, char **argv)
- 	      sprintf_alloc(&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
- 
- 	  sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
-+	  pkglist_dl_error = 0;
- 	  if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
- 	       failures++;
-+	       pkglist_dl_error = 1;
-+	       opkg_msg(NOTICE, "*** Failed to download the package list from %s\n\n",
-+			    url);
- 	  } else {
--	       opkg_msg(NOTICE, "Updated list of available packages in %s.\n",
-+	       opkg_msg(NOTICE, "Updated list of available packages in %s\n",
- 			    list_file_name);
- 	  }
- 	  free(url);
- #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
--          if (conf->check_signature) {
-+          if (pkglist_dl_error == 0 && conf->check_signature) {
-               /* download detached signitures to verify the package lists */
-               /* get the url for the sig file */
-               if (src->extra_data)	/* debian style? */
-@@ -156,7 +161,7 @@ opkg_update_cmd(int argc, char **argv)
-               err = opkg_download(url, tmp_file_name, NULL, NULL, 0);
-               if (err) {
-                   failures++;
--                  opkg_msg(NOTICE, "Signature check failed.\n");
-+                  opkg_msg(NOTICE, "Signature file download failed.\n");
-               } else {
-                   err = opkg_verify_file (list_file_name, tmp_file_name);
-                   if (err == 0)
---- a/libopkg/opkg_download.c
-+++ b/libopkg/opkg_download.c
-@@ -91,7 +91,7 @@ opkg_download(const char *src, const cha
-     char *src_base = basename(src_basec);
-     char *tmp_file_location;
- 
--    opkg_msg(NOTICE,"Downloading %s.\n", src);
-+    opkg_msg(NOTICE,"Downloading %s\n", src);
- 
-     if (str_starts_with(src, "file:")) {
- 	const char *file_src = src + 5;
-@@ -175,6 +175,8 @@ opkg_download(const char *src, const cha
- 
-       if (res) {
- 	opkg_msg(ERROR, "Failed to download %s, wget returned %d.\n", src, res);
-+	if (res == 4)
-+	    opkg_msg(ERROR, "Check your network settings and connectivity.\n\n");
- 	free(tmp_file_location);
- 	return -1;
-       }


From lede-commits at lists.infradead.org  Sat Apr  8 05:49:47 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:49:47 -0400
Subject: [source]  libubox: fix host build on macOS
In-Reply-To: <20170408124945.16917.60506@git-01.infra.lede-project.org>
References: <20170408124945.16917.60506@git-01.infra.lede-project.org>
Message-ID: <mailman.22889.1491655811.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/5866ff8be8ef961cf17c4469f5afb54f91570b95

commit 5866ff8be8ef961cf17c4469f5afb54f91570b95
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Feb 20 12:32:45 2017 +0100

    libubox: fix host build on macOS
    
    Use the defaults instead of a custom non-portable Host/Install section
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/libs/libubox/Makefile | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
index 8eeb935..fa7107e 100644
--- a/package/libs/libubox/Makefile
+++ b/package/libs/libubox/Makefile
@@ -96,13 +96,6 @@ CMAKE_HOST_OPTIONS += \
 	-DBUILD_LUA=OFF \
 	-DBUILD_EXAMPLES=OFF \
 
-define Host/Install
-	$(INSTALL_DIR) $(STAGING_DIR_HOST)/include/libubox
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/*.h $(STAGING_DIR_HOST)/include/libubox/
-	$(INSTALL_DIR) $(STAGING_DIR_HOST)/lib
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/libubox.{a,so} $(STAGING_DIR_HOST)/lib/
-endef
-
 $(eval $(call BuildPackage,libubox))
 $(eval $(call BuildPackage,libblobmsg-json))
 $(eval $(call BuildPackage,jshn))


From lede-commits at lists.infradead.org  Sat Apr  8 05:49:46 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 08:49:46 -0400
Subject: [source]  libubox: add host build
In-Reply-To: <20170408124945.16917.60506@git-01.infra.lede-project.org>
References: <20170408124945.16917.60506@git-01.infra.lede-project.org>
Message-ID: <mailman.22890.1491655811.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/293c54c5677cb7db21a53df7fae0a1fd2f663b04

commit 293c54c5677cb7db21a53df7fae0a1fd2f663b04
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Fri Feb 17 10:49:14 2017 +0100

    libubox: add host build
    
    Our opkg fork requires libubox to build, so add a host build for it.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/libs/libubox/Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
index 71c53ae..8eeb935 100644
--- a/package/libs/libubox/Makefile
+++ b/package/libs/libubox/Makefile
@@ -18,6 +18,7 @@ PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
 PKG_BUILD_DEPENDS:=lua
 
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/cmake.mk
 
 define Package/libubox
@@ -90,8 +91,21 @@ define Package/libubox-lua/install
 	$(CP) $(PKG_BUILD_DIR)/lua/uloop.so $(1)/usr/lib/lua/
 endef
 
+
+CMAKE_HOST_OPTIONS += \
+	-DBUILD_LUA=OFF \
+	-DBUILD_EXAMPLES=OFF \
+
+define Host/Install
+	$(INSTALL_DIR) $(STAGING_DIR_HOST)/include/libubox
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/*.h $(STAGING_DIR_HOST)/include/libubox/
+	$(INSTALL_DIR) $(STAGING_DIR_HOST)/lib
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/libubox.{a,so} $(STAGING_DIR_HOST)/lib/
+endef
+
 $(eval $(call BuildPackage,libubox))
 $(eval $(call BuildPackage,libblobmsg-json))
 $(eval $(call BuildPackage,jshn))
 $(eval $(call BuildPackage,libjson-script))
 $(eval $(call BuildPackage,libubox-lua))
+$(eval $(call HostBuild))


From lede-commits at lists.infradead.org  Sat Apr  8 08:23:20 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 11:23:20 -0400
Subject: [source]  dnsmasq: peacefully coexist with ISC DHCPd
In-Reply-To: <20170408152320.15897.90170@git-01.infra.lede-project.org>
References: <20170408152320.15897.90170@git-01.infra.lede-project.org>
Message-ID: <mailman.22905.1491665023.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/1c42598b7da843f11d5777cecd24be84469952cc

commit 1c42598b7da843f11d5777cecd24be84469952cc
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Wed Apr 5 20:31:01 2017 +0200

    dnsmasq: peacefully coexist with ISC DHCPd
    
    Similar to odhcpd, allow using ISC DHCPd instead of dnsmasq.
    Disable DHCP and/or DHCP6 in case ISC DHCP is present and
    enabled.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 5f69be7..83553f1 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -720,6 +720,15 @@ dnsmasq_start()
 		DNSMASQ_DHCP_VER=4
 	fi
 
+	# Allow DHCP/DHCPv6 to be handled by ISC DHCPD
+	if [ -x /usr/sbin/dhcpd ] ; then
+		if [ -x /etc/init.d/dhcpd ] ; then
+			/etc/init.d/dhcpd enabled && DNSMASQ_DHCP_VER=0
+		fi
+		if [ -x /etc/init.d/dhcpd6 -a "$DNSMASQ_DHCP_VER" -gt 0 ] ; then
+			/etc/init.d/dhcpd6 enabled && DNSMASQ_DHCP_VER=4
+		fi
+	fi
 
 	append_bool "$cfg" authoritative "--dhcp-authoritative"
 	append_bool "$cfg" nodaemon "--no-daemon"


From lede-commits at lists.infradead.org  Sat Apr  8 11:54:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 08 Apr 2017 14:54:09 -0400
Subject: [source] iproute2: add libgenl.h and ll_map.h to InstallDev section
In-Reply-To: <20170408185409.21827.78192@git-01.infra.lede-project.org>
References: <20170408185409.21827.78192@git-01.infra.lede-project.org>
Message-ID: <mailman.22944.1491677680.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/fc859fb44b4e7a38a1f1825b05b72b81e80f82a8

commit fc859fb44b4e7a38a1f1825b05b72b81e80f82a8
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Sat Apr 8 20:40:56 2017 +0200

    iproute2: add libgenl.h and ll_map.h to InstallDev section
    
    Commit f4e312ddf855375667f43c842c7187934b8aca92 adds libnetlink to
    staging dir but did not add the header files libgenl.h and ll_map.h
    which define functions belonging to libnetlink lib
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/utils/iproute2/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile
index 1c1ee3f..0fa88b6 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -97,7 +97,7 @@ endef
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
-	$(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
+	$(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
 endef


From lede-commits at lists.infradead.org  Sun Apr  9 06:45:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 09 Apr 2017 09:45:09 -0400
Subject: [source]  build: fix triggering opkg/host compilation
In-Reply-To: <20170409134509.22919.81195@git-01.infra.lede-project.org>
References: <20170409134509.22919.81195@git-01.infra.lede-project.org>
Message-ID: <mailman.22994.1491745659.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/c6e79980b87e918fec5020bf91207ef51c24924d

commit c6e79980b87e918fec5020bf91207ef51c24924d
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Jan 19 02:41:02 2017 +0100

    build: fix triggering opkg/host compilation
    
    Commit 131db36 "build: remove separate /install step for host builds" dropped
    the package/*/host/install targets in favor to performing the install steps
    within the compile target instead.
    
    Adjust package/Makefile accordingly in order to prevent a missing
    staging_dir/host/bin/opkg when staging package archives into the rootfs.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/Makefile b/package/Makefile
index 3250e7b..cc1e9d4 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -56,7 +56,7 @@ $(curdir)/merge:
 $(curdir)/merge-index: $(curdir)/merge
 	(cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; )
 
-$(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
+$(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/compile $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
 	- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
 	rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
 	[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp


From lede-commits at lists.infradead.org  Mon Apr 10 02:24:16 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 10 Apr 2017 05:24:16 -0400
Subject: [source]  kernel: make kmod-mmc unavailable on UML
In-Reply-To: <20170410092416.21904.21010@git-01.infra.lede-project.org>
References: <20170410092416.21904.21010@git-01.infra.lede-project.org>
Message-ID: <mailman.23094.1491816282.26984.lede-commits@lists.infradead.org>

jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/ac388ad83ae39c6871958d9092d6225be45f9ceb

commit ac388ad83ae39c6871958d9092d6225be45f9ceb
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Mon Apr 10 10:56:10 2017 +0200

    kernel: make kmod-mmc unavailable on UML
    
    MMC requires IOMEM support, which UML doesn't have.
    
    Fixes mac80211 build, as mwifiex-sdio depends on MMC support.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 package/kernel/linux/modules/other.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk
index b8b2241..e7e98e8 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -349,6 +349,7 @@ $(eval $(call KernelPackage,lp))
 define KernelPackage/mmc
   SUBMENU:=$(OTHER_MENU)
   TITLE:=MMC/SD Card Support
+  DEPENDS:=@!TARGET_uml
   KCONFIG:= \
 	CONFIG_MMC \
 	CONFIG_MMC_BLOCK \


From lede-commits at lists.infradead.org  Mon Apr 10 04:20:52 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 10 Apr 2017 07:20:52 -0400
Subject: [source]  busybox: add musl compatible nslookup replacement
In-Reply-To: <20170410112052.14297.751@git-01.infra.lede-project.org>
References: <20170410112052.14297.751@git-01.infra.lede-project.org>
Message-ID: <mailman.23115.1491823276.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/de5b8e5d2fe1fb43bad25dc13c7caf4158933eb5

commit de5b8e5d2fe1fb43bad25dc13c7caf4158933eb5
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Mar 14 22:38:59 2017 +0100

    busybox: add musl compatible nslookup replacement
    
    Add an alternative nslookup applet implementation which is compatible with
    musl libc wrt. name server selection and which supports a number of additional
    features such as query type selection.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Config-defaults.in           |   3 +
 package/utils/busybox/config/networking/Config.in  |  15 +-
 .../busybox/patches/230-add_nslookup_lede.patch    | 914 +++++++++++++++++++++
 3 files changed, 931 insertions(+), 1 deletion(-)

diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in
index 7f2c33a..29cc475 100644
--- a/package/utils/busybox/Config-defaults.in
+++ b/package/utils/busybox/Config-defaults.in
@@ -2271,6 +2271,9 @@ config BUSYBOX_DEFAULT_FEATURE_NETSTAT_PRG
 	default y
 config BUSYBOX_DEFAULT_NSLOOKUP
 	bool
+	default n
+config BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+	bool
 	default y
 config BUSYBOX_DEFAULT_NTPD
 	bool
diff --git a/package/utils/busybox/config/networking/Config.in b/package/utils/busybox/config/networking/Config.in
index bc2f127..4ae8779 100644
--- a/package/utils/busybox/config/networking/Config.in
+++ b/package/utils/busybox/config/networking/Config.in
@@ -704,6 +704,19 @@ config BUSYBOX_CONFIG_NSLOOKUP
 	default BUSYBOX_DEFAULT_NSLOOKUP
 	help
 	  nslookup is a tool to query Internet name servers.
+config BUSYBOX_CONFIG_NSLOOKUP_LEDE
+	bool "nslookup_lede"
+	depends on !BUSYBOX_CONFIG_NSLOOKUP
+	default BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+	help
+	  nslookup is a tool to query Internet name servers (LEDE flavor).
+
+config BUSYBOX_CONFIG_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
+       bool "Enable long options"
+       default BUSYBOX_DEFAULT_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
+       depends on BUSYBOX_CONFIG_NSLOOKUP_LEDE && BUSYBOX_CONFIG_LONG_OPTS
+       help
+         Support long options for the nslookup applet.
 config BUSYBOX_CONFIG_NTPD
 	bool "ntpd"
 	default BUSYBOX_DEFAULT_NTPD
@@ -1091,7 +1104,7 @@ source udhcp/Config.in
 config BUSYBOX_CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS
 	string "ifup udhcpc command line options"
 	default BUSYBOX_DEFAULT_IFUPDOWN_UDHCPC_CMD_OPTIONS
-	depends on BUSYBOX_CONFIG_IFUPDOWN && BUSYBOX_CONFIG_UDHCPC
+	depends on BUSYBOX_CONFIG_IFUP || BUSYBOX_CONFIG_IFDOWN
 	help
 	  Command line options to pass to udhcpc from ifup.
 	  Intended to alter options not available in /etc/network/interfaces.
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
new file mode 100644
index 0000000..bff88a6
--- /dev/null
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -0,0 +1,914 @@
+From 8c1440a0934dd8b3ad6aae48d6653b5ba6fce8a1 Mon Sep 17 00:00:00 2001
+From: Jo-Philipp Wich <jo at mein.io>
+Date: Tue, 14 Mar 2017 22:21:34 +0100
+Subject: [PATCH] networking: add LEDE nslookup applet
+
+Add a new LEDE nslookup applet which is compatible with musl libc
+and providing more features like ability to specify query type.
+
+In contrast to busybox' builtin nslookup applet, this variant does
+not rely on libc resolver internals but uses explicit send logic
+and the libresolv primitives to parse received DNS responses.
+
+Signed-off-by: Jo-Philipp Wich <jo at mein.io>
+---
+ Makefile.flags             |   6 +
+ networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 875 insertions(+)
+ create mode 100644 networking/nslookup_lede.c
+
+diff --git a/Makefile.flags b/Makefile.flags
+index 65021de..096ab77 100644
+--- a/Makefile.flags
++++ b/Makefile.flags
+@@ -134,6 +134,12 @@ else
+ LDLIBS += m
+ endif
+ 
++# nslookup_lede might need the resolv library
++RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
++ifeq ($(RESOLV_AVAILABLE),y)
++LDLIBS += resolv
++endif
++
+ # libpam may use libpthread, libdl and/or libaudit.
+ # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
+ # However, on *other platforms* it fails when some of those flags
+diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
+new file mode 100644
+index 0000000..fe927ad
+--- /dev/null
++++ b/networking/nslookup_lede.c
+@@ -0,0 +1,869 @@
++/*
++ * nslookup_lede - musl compatible replacement for busybox nslookup
++ *
++ * Copyright (C) 2017 Jo-Philipp Wich <jo at mein.io>
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++//config:config NSLOOKUP_LEDE
++//config:	bool "nslookup_lede"
++//config:	depends on !NSLOOKUP
++//config:	default y
++//config:	help
++//config:	  nslookup is a tool to query Internet name servers (LEDE flavor).
++//config:
++//config:config FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++//config:       bool "Enable long options"
++//config:       default y
++//config:       depends on NSLOOKUP_LEDE && LONG_OPTS
++//config:       help
++//config:         Support long options for the nslookup applet.
++
++//applet:IF_NSLOOKUP_LEDE(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP))
++
++//kbuild:lib-$(CONFIG_NSLOOKUP_LEDE) += nslookup_lede.o
++
++//usage:#define nslookup_lede_trivial_usage
++//usage:       "[HOST] [SERVER]"
++//usage:#define nslookup_lede_full_usage "\n\n"
++//usage:       "Query the nameserver for the IP address of the given HOST\n"
++//usage:       "optionally using a specified DNS server"
++//usage:
++//usage:#define nslookup_lede_example_usage
++//usage:       "$ nslookup localhost\n"
++//usage:       "Server:     default\n"
++//usage:       "Address:    default\n"
++//usage:       "\n"
++//usage:       "Name:       debian\n"
++//usage:       "Address:    127.0.0.1\n"
++
++#include <stdio.h>
++#include <resolv.h>
++#include <string.h>
++#include <errno.h>
++#include <time.h>
++#include <poll.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <sys/socket.h>
++#include <arpa/inet.h>
++#include <net/if.h>
++#include <netdb.h>
++
++#include "libbb.h"
++
++struct ns {
++	const char *name;
++	len_and_sockaddr addr;
++	int failures;
++	int replies;
++};
++
++struct query {
++	const char *name;
++	size_t qlen, rlen;
++	unsigned char query[512], reply[512];
++	unsigned long latency;
++	int rcode, n_ns;
++};
++
++static struct {
++	int type;
++	const char *name;
++} qtypes[] = {
++	{ ns_t_soa,   "SOA"   },
++	{ ns_t_ns,    "NS"    },
++	{ ns_t_a,     "A"     },
++	{ ns_t_aaaa,  "AAAA"  },
++	{ ns_t_cname, "CNAME" },
++	{ ns_t_mx,    "MX"    },
++	{ ns_t_txt,   "TXT"   },
++	{ ns_t_ptr,   "PTR"   },
++	{ ns_t_any,   "ANY"   },
++	{ }
++};
++
++static const char *rcodes[] = {
++	"NOERROR",
++	"FORMERR",
++	"SERVFAIL",
++	"NXDOMAIN",
++	"NOTIMP",
++	"REFUSED",
++	"YXDOMAIN",
++	"YXRRSET",
++	"NXRRSET",
++	"NOTAUTH",
++	"NOTZONE",
++	"RESERVED11",
++	"RESERVED12",
++	"RESERVED13",
++	"RESERVED14",
++	"RESERVED15",
++	"BADVERS"
++};
++
++static unsigned int default_port = 53;
++static unsigned int default_retry = 2;
++static unsigned int default_timeout = 5;
++
++
++static int parse_reply(const unsigned char *msg, size_t len)
++{
++	ns_msg handle;
++	ns_rr rr;
++	int i, n, rdlen;
++	const char *format = NULL;
++	char astr[INET6_ADDRSTRLEN], dname[MAXDNAME];
++	const unsigned char *cp;
++
++	if (ns_initparse(msg, len, &handle) != 0) {
++		//fprintf(stderr, "Unable to parse reply: %s\n", strerror(errno));
++		return -1;
++	}
++
++	for (i = 0; i < ns_msg_count(handle, ns_s_an); i++) {
++		if (ns_parserr(&handle, ns_s_an, i, &rr) != 0) {
++			//fprintf(stderr, "Unable to parse resource record: %s\n", strerror(errno));
++			return -1;
++		}
++
++		rdlen = ns_rr_rdlen(rr);
++
++		switch (ns_rr_type(rr))
++		{
++		case ns_t_a:
++			if (rdlen != 4) {
++				//fprintf(stderr, "Unexpected A record length\n");
++				return -1;
++			}
++			inet_ntop(AF_INET, ns_rr_rdata(rr), astr, sizeof(astr));
++			printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
++			break;
++
++		case ns_t_aaaa:
++			if (rdlen != 16) {
++				//fprintf(stderr, "Unexpected AAAA record length\n");
++				return -1;
++			}
++			inet_ntop(AF_INET6, ns_rr_rdata(rr), astr, sizeof(astr));
++			printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
++			break;
++
++		case ns_t_ns:
++			if (!format)
++				format = "%s\tnameserver = %s\n";
++			/* fall through */
++
++		case ns_t_cname:
++			if (!format)
++				format = "%s\tcanonical name = %s\n";
++			/* fall through */
++
++		case ns_t_ptr:
++			if (!format)
++				format = "%s\tname = %s\n";
++			if (ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++				ns_rr_rdata(rr), dname, sizeof(dname)) < 0) {
++				//fprintf(stderr, "Unable to uncompress domain: %s\n", strerror(errno));
++				return -1;
++			}
++			printf(format, ns_rr_name(rr), dname);
++			break;
++
++		case ns_t_mx:
++			if (rdlen < 2) {
++				fprintf(stderr, "MX record too short\n");
++				return -1;
++			}
++			n = ns_get16(ns_rr_rdata(rr));
++			if (ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++				ns_rr_rdata(rr) + 2, dname, sizeof(dname)) < 0) {
++				//fprintf(stderr, "Cannot uncompress MX domain: %s\n", strerror(errno));
++				return -1;
++			}
++			printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
++			break;
++
++		case ns_t_txt:
++			if (rdlen < 1) {
++				//fprintf(stderr, "TXT record too short\n");
++				return -1;
++			}
++			n = *(unsigned char *)ns_rr_rdata(rr);
++			if (n > 0) {
++				memset(dname, 0, sizeof(dname));
++				memcpy(dname, ns_rr_rdata(rr) + 1, n);
++				printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
++			}
++			break;
++
++		case ns_t_soa:
++			if (rdlen < 20) {
++				//fprintf(stderr, "SOA record too short\n");
++				return -1;
++			}
++
++			printf("%s\n", ns_rr_name(rr));
++
++			cp = ns_rr_rdata(rr);
++			n = ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++			                       cp, dname, sizeof(dname));
++
++			if (n < 0) {
++				//fprintf(stderr, "Unable to uncompress domain: %s\n", strerror(errno));
++				return -1;
++			}
++
++			printf("\torigin = %s\n", dname);
++			cp += n;
++
++			n = ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++			                       cp, dname, sizeof(dname));
++
++			if (n < 0) {
++				//fprintf(stderr, "Unable to uncompress domain: %s\n", strerror(errno));
++				return -1;
++			}
++
++			printf("\tmail addr = %s\n", dname);
++			cp += n;
++
++			printf("\tserial = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\trefresh = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\tretry = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\texpire = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\tminimum = %lu\n", ns_get32(cp));
++			break;
++
++		default:
++			break;
++		}
++	}
++
++	return i;
++}
++
++static int parse_nsaddr(const char *addrstr, len_and_sockaddr *lsa)
++{
++	char *eptr, *hash, ifname[IFNAMSIZ];
++	unsigned int port = default_port;
++	unsigned int scope = 0;
++
++	hash = strchr(addrstr, '#');
++
++	if (hash) {
++		*hash++ = '\0';
++		port = strtoul(hash, &eptr, 10);
++
++		if (eptr == hash || *eptr != '\0' || port > 65535) {
++			errno = EINVAL;
++			return -1;
++		}
++	}
++
++	hash = strchr(addrstr, '%');
++
++	if (hash) {
++		for (eptr = ++hash; *eptr != '\0' && *eptr != '#'; eptr++) {
++			if ((eptr - hash) >= IFNAMSIZ) {
++				errno = ENODEV;
++				return -1;
++			}
++
++			ifname[eptr - hash] = *eptr;
++		}
++
++		ifname[eptr - hash] = '\0';
++		scope = if_nametoindex(ifname);
++
++		if (scope == 0) {
++			errno = ENODEV;
++			return -1;
++		}
++	}
++
++	if (inet_pton(AF_INET6, addrstr, &lsa->u.sin6.sin6_addr)) {
++		lsa->u.sin6.sin6_family = AF_INET6;
++		lsa->u.sin6.sin6_port = htons(port);
++		lsa->u.sin6.sin6_scope_id = scope;
++		lsa->len = sizeof(lsa->u.sin6);
++		return 0;
++	}
++
++	if (!scope && inet_pton(AF_INET, addrstr, &lsa->u.sin.sin_addr)) {
++		lsa->u.sin.sin_family = AF_INET;
++		lsa->u.sin.sin_port = htons(port);
++		lsa->len = sizeof(lsa->u.sin);
++		return 0;
++	}
++
++	errno = EINVAL;
++	return -1;
++}
++
++static char *make_ptr(const char *addrstr)
++{
++	const char *hexdigit = "0123456789abcdef";
++	static char ptrstr[73];
++	unsigned char addr[16];
++	char *ptr = ptrstr;
++	int i;
++
++	if (inet_pton(AF_INET6, addrstr, addr)) {
++		if (memcmp(addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12) != 0) {
++			for (i = 0; i < 16; i++) {
++				*ptr++ = hexdigit[(unsigned char)addr[15 - i] & 0xf];
++				*ptr++ = '.';
++				*ptr++ = hexdigit[(unsigned char)addr[15 - i] >> 4];
++				*ptr++ = '.';
++			}
++			strcpy(ptr, "ip6.arpa");
++		}
++		else {
++			sprintf(ptr, "%u.%u.%u.%u.in-addr.arpa",
++			        addr[15], addr[14], addr[13], addr[12]);
++		}
++
++		return ptrstr;
++	}
++
++	if (inet_pton(AF_INET, addrstr, addr)) {
++		sprintf(ptr, "%u.%u.%u.%u.in-addr.arpa",
++		        addr[3], addr[2], addr[1], addr[0]);
++		return ptrstr;
++	}
++
++	return NULL;
++}
++
++static unsigned long mtime(void)
++{
++	struct timespec ts;
++	clock_gettime(CLOCK_REALTIME, &ts);
++	return (unsigned long)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
++}
++
++static void to_v4_mapped(len_and_sockaddr *a)
++{
++	if (a->u.sa.sa_family != AF_INET)
++		return;
++
++	memcpy(a->u.sin6.sin6_addr.s6_addr + 12,
++	       &a->u.sin.sin_addr, 4);
++
++	memcpy(a->u.sin6.sin6_addr.s6_addr,
++	       "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
++
++	a->u.sin6.sin6_family = AF_INET6;
++	a->u.sin6.sin6_flowinfo = 0;
++	a->u.sin6.sin6_scope_id = 0;
++	a->len = sizeof(a->u.sin6);
++}
++
++
++/*
++ * Function logic borrowed & modified from musl libc, res_msend.c
++ */
++
++static int send_queries(struct ns *ns, int n_ns, struct query *queries, int n_queries)
++{
++	int fd;
++	int timeout = default_timeout * 1000, retry_interval, servfail_retry = 0;
++	len_and_sockaddr from = { };
++	int one = 1;
++	int recvlen = 0;
++	int n_replies = 0;
++	struct pollfd pfd;
++	unsigned long t0, t1, t2;
++	int nn, qn, next_query = 0;
++
++	from.u.sa.sa_family = AF_INET;
++	from.len = sizeof(from.u.sin);
++
++	for (nn = 0; nn < n_ns; nn++) {
++		if (ns[nn].addr.u.sa.sa_family == AF_INET6) {
++			from.u.sa.sa_family = AF_INET6;
++			from.len = sizeof(from.u.sin6);
++			break;
++		}
++	}
++
++	/* Get local address and open/bind a socket */
++	fd = socket(from.u.sa.sa_family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
++
++	/* Handle case where system lacks IPv6 support */
++	if (fd < 0 && from.u.sa.sa_family == AF_INET6 && errno == EAFNOSUPPORT) {
++		fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
++		from.u.sa.sa_family = AF_INET;
++	}
++
++	if (fd < 0)
++		return -1;
++
++	if (bind(fd, &from.u.sa, from.len) < 0) {
++		close(fd);
++		return -1;
++	}
++
++	/* Convert any IPv4 addresses in a mixed environment to v4-mapped */
++	if (from.u.sa.sa_family == AF_INET6) {
++		setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
++
++		for (nn = 0; nn < n_ns; nn++)
++			to_v4_mapped(&ns[nn].addr);
++	}
++
++	pfd.fd = fd;
++	pfd.events = POLLIN;
++	retry_interval = timeout / default_retry;
++	t0 = t2 = mtime();
++	t1 = t2 - retry_interval;
++
++	for (; t2 - t0 < timeout; t2 = mtime()) {
++		if (t2 - t1 >= retry_interval) {
++			for (qn = 0; qn < n_queries; qn++) {
++				if (queries[qn].rlen)
++					continue;
++
++				for (nn = 0; nn < n_ns; nn++) {
++					sendto(fd, queries[qn].query, queries[qn].qlen,
++					       MSG_NOSIGNAL, &ns[nn].addr.u.sa, ns[nn].addr.len);
++				}
++			}
++
++			t1 = t2;
++			servfail_retry = 2 * n_queries;
++		}
++
++		/* Wait for a response, or until time to retry */
++		if (poll(&pfd, 1, t1+retry_interval-t2) <= 0)
++			continue;
++
++		while (1) {
++			recvlen = recvfrom(fd, queries[next_query].reply,
++			                   sizeof(queries[next_query].reply), 0,
++			                   &from.u.sa, &from.len);
++
++			/* read error */
++			if (recvlen < 0)
++				break;
++
++			/* Ignore non-identifiable packets */
++			if (recvlen < 4)
++				continue;
++
++			/* Ignore replies from addresses we didn't send to */
++			for (nn = 0; nn < n_ns; nn++)
++				if (memcmp(&from.u.sa, &ns[nn].addr.u.sa, from.len) == 0)
++					break;
++
++			if (nn >= n_ns)
++				continue;
++
++			/* Find which query this answer goes with, if any */
++			for (qn = next_query; qn < n_queries; qn++)
++				if (!memcmp(queries[next_query].reply, queries[qn].query, 2))
++					break;
++
++			if (qn >= n_queries || queries[qn].rlen)
++				continue;
++
++			queries[qn].rcode = queries[next_query].reply[3] & 15;
++			queries[qn].latency = mtime() - t0;
++			queries[qn].n_ns = nn;
++
++			ns[nn].replies++;
++
++			/* Only accept positive or negative responses;
++			 * retry immediately on server failure, and ignore
++			 * all other codes such as refusal. */
++			switch (queries[qn].rcode) {
++			case 0:
++			case 3:
++				break;
++
++			case 2:
++				if (servfail_retry && servfail_retry--) {
++					ns[nn].failures++;
++					sendto(fd, queries[qn].query, queries[qn].qlen,
++					       MSG_NOSIGNAL, &ns[nn].addr.u.sa, ns[nn].addr.len);
++				}
++				/* fall through */
++
++			default:
++				continue;
++			}
++
++			/* Store answer */
++			n_replies++;
++
++			queries[qn].rlen = recvlen;
++
++			if (qn == next_query) {
++				while (next_query < n_queries) {
++					if (!queries[next_query].rlen)
++						break;
++
++					next_query++;
++				}
++			}
++			else {
++				memcpy(queries[qn].reply, queries[next_query].reply, recvlen);
++			}
++
++			if (next_query >= n_queries)
++				return n_replies;
++		}
++	}
++
++	return n_replies;
++}
++
++static struct ns *add_ns(struct ns **ns, int *n_ns, const char *addr)
++{
++	char portstr[sizeof("65535")], *p;
++	len_and_sockaddr a = { };
++	struct ns *tmp;
++	struct addrinfo *ai, *aip, hints = {
++		.ai_flags = AI_NUMERICSERV,
++		.ai_socktype = SOCK_DGRAM
++	};
++
++	if (parse_nsaddr(addr, &a)) {
++		/* Maybe we got a domain name, attempt to resolve it using the standard
++		 * resolver routines */
++
++		p = strchr(addr, '#');
++		snprintf(portstr, sizeof(portstr), "%hu",
++		         (unsigned short)(p ? strtoul(p, NULL, 10) : default_port));
++
++		if (!getaddrinfo(addr, portstr, &hints, &ai)) {
++			for (aip = ai; aip; aip = aip->ai_next) {
++				if (aip->ai_addr->sa_family != AF_INET &&
++				    aip->ai_addr->sa_family != AF_INET6)
++				    continue;
++
++				tmp = realloc(*ns, sizeof(**ns) * (*n_ns + 1));
++
++				if (!tmp)
++					return NULL;
++
++				*ns = tmp;
++
++				(*ns)[*n_ns].name = addr;
++				(*ns)[*n_ns].replies = 0;
++				(*ns)[*n_ns].failures = 0;
++				(*ns)[*n_ns].addr.len = aip->ai_addrlen;
++
++				memcpy(&(*ns)[*n_ns].addr.u.sa, aip->ai_addr, aip->ai_addrlen);
++
++				(*n_ns)++;
++			}
++
++			freeaddrinfo(ai);
++
++			return &(*ns)[*n_ns];
++		}
++
++		return NULL;
++	}
++
++	tmp = realloc(*ns, sizeof(**ns) * (*n_ns + 1));
++
++	if (!tmp)
++		return NULL;
++
++	*ns = tmp;
++
++	(*ns)[*n_ns].addr = a;
++	(*ns)[*n_ns].name = addr;
++	(*ns)[*n_ns].replies = 0;
++	(*ns)[*n_ns].failures = 0;
++
++	return &(*ns)[(*n_ns)++];
++}
++
++static int parse_resolvconf(struct ns **ns, int *n_ns)
++{
++	int prev_n_ns = *n_ns;
++	char line[128], *p;
++	FILE *resolv;
++
++	if ((resolv = fopen("/etc/resolv.conf", "r")) != NULL) {
++		while (fgets(line, sizeof(line), resolv)) {
++			p = strtok(line, " \t\n");
++
++			if (!p || strcmp(p, "nameserver"))
++				continue;
++
++			p = strtok(NULL, " \t\n");
++
++			if (!p)
++				continue;
++
++			if (!add_ns(ns, n_ns, strdup(p))) {
++				free(p);
++				break;
++			}
++		}
++
++		fclose(resolv);
++	}
++
++	return *n_ns - prev_n_ns;
++}
++
++static struct query *add_query(struct query **queries, int *n_queries,
++                               int type, const char *dname)
++{
++	struct query *tmp;
++	ssize_t qlen;
++
++	tmp = realloc(*queries, sizeof(**queries) * (*n_queries + 1));
++
++	if (!tmp)
++		return NULL;
++
++	memset(&tmp[*n_queries], 0, sizeof(*tmp));
++
++	qlen = res_mkquery(QUERY, dname, C_IN, type, NULL, 0, NULL,
++	                   tmp[*n_queries].query, sizeof(tmp[*n_queries].query));
++
++	tmp[*n_queries].qlen = qlen;
++	tmp[*n_queries].name = dname;
++	*queries = tmp;
++
++	return &tmp[(*n_queries)++];
++}
++
++static char *sal2str(len_and_sockaddr *a)
++{
++	static char buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ + 1 + 5 + 1];
++	char *p = buf;
++
++	if (a->u.sa.sa_family == AF_INET6) {
++		inet_ntop(AF_INET6, &a->u.sin6.sin6_addr, buf, sizeof(buf));
++		p += strlen(p);
++
++		if (a->u.sin6.sin6_scope_id) {
++			if (if_indextoname(a->u.sin6.sin6_scope_id, p + 1)) {
++				*p++ = '%';
++				p += strlen(p);
++			}
++		}
++	}
++	else {
++		inet_ntop(AF_INET, &a->u.sin.sin_addr, buf, sizeof(buf));
++		p += strlen(p);
++	}
++
++	sprintf(p, "#%hu", ntohs(a->u.sin6.sin6_port));
++
++	return buf;
++}
++
++
++#if ENABLE_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++static const char nslookup_longopts[] ALIGN1 =
++		"type\0"		Required_argument	"q"
++		"querytype\0"	Required_argument	"q"
++		"port\0"		Required_argument	"p"
++		"retry\0"		Required_argument	"r"
++		"timeout\0"		Required_argument	"t"
++		"stats\0"		Required_argument	"s"
++    ;
++#endif
++
++int nslookup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
++int nslookup_main(int argc, char **argv)
++{
++	int rc = 1;
++	char *ptr, *chr;
++	struct ns *ns = NULL;
++	struct query *queries = NULL;
++	llist_t *type_strings = NULL;
++	int n_ns = 0, n_queries = 0;
++	int c, opts, option_index = 0;
++	int stats = 0;
++	unsigned int types = 0;
++	HEADER *header;
++
++#if ENABLE_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++	applet_long_options = nslookup_longopts;
++#endif
++
++	opts = getopt32(argv, "+q:*p:+r:+t:+s",
++	                &type_strings, &default_port,
++	                &default_retry, &default_timeout);
++
++	while (type_strings) {
++		ptr = llist_pop(&type_strings);
++
++		/* skip leading text, e.g. when invoked with -querytype=AAAA */
++		if ((chr = strchr(ptr, '=')) != NULL) {
++			ptr = chr;
++			*ptr++ = 0;
++		}
++
++		for (c = 0; qtypes[c].name; c++)
++			if (!strcmp(qtypes[c].name, ptr))
++				break;
++
++		if (!qtypes[c].name) {
++			fprintf(stderr, "Invalid query type \"%s\"\n", ptr);
++			goto out;
++		}
++
++		types |= (1 << c);
++	}
++
++	if (default_port > 65535) {
++		fprintf(stderr, "Invalid server port\n");
++		goto out;
++	}
++
++	if (!default_retry) {
++		fprintf(stderr, "Invalid retry value\n");
++		goto out;
++	}
++
++	if (!default_timeout) {
++		fprintf(stderr, "Invalid timeout value\n");
++		goto out;
++	}
++
++	stats = (opts & 16);
++
++	if (optind >= argc)
++		bb_show_usage();
++
++	for (option_index = optind;
++	     option_index < ((argc - optind) > 1 ? argc - 1 : argc);
++	     option_index++) {
++
++		/* No explicit type given, guess query type.
++		 * If we can convert the domain argument into a ptr (means that
++		 * inet_pton() could read it) we assume a PTR request, else
++		 * we issue A queries. */
++		if (types == 0) {
++			ptr = make_ptr(argv[option_index]);
++
++			if (ptr)
++				add_query(&queries, &n_queries, T_PTR, ptr);
++			else
++				add_query(&queries, &n_queries, T_A, argv[option_index]);
++		}
++		else {
++			for (c = 0; qtypes[c].name; c++)
++				if (types & (1 << c))
++					add_query(&queries, &n_queries, qtypes[c].type,
++					          argv[option_index]);
++		}
++	}
++
++	/* Use given DNS server if present */
++	if (option_index < argc) {
++		if (!add_ns(&ns, &n_ns, argv[option_index])) {
++			fprintf(stderr, "Invalid NS server address \"%s\": %s\n",
++			        argv[option_index], strerror(errno));
++			goto out;
++		}
++	}
++	else {
++		parse_resolvconf(&ns, &n_ns);
++	}
++
++	/* Fall back to localhost if we could not find NS in resolv.conf */
++	if (n_ns == 0) {
++		add_ns(&ns, &n_ns, "127.0.0.1");
++	}
++
++	for (c = 0; c < n_ns; c++) {
++		rc = send_queries(&ns[c], 1, queries, n_queries);
++
++		if (rc < 0) {
++			fprintf(stderr, "Failed to send queries: %s\n", strerror(errno));
++			goto out;
++		} else if (rc > 0) {
++			break;
++		}
++	}
++
++	if (c >= n_ns) {
++		fprintf(stderr,
++			    ";; connection timed out; no servers could be reached\n\n");
++
++		return 1;
++	}
++
++	printf("Server:\t\t%s\n", ns[c].name);
++	printf("Address:\t%s\n", sal2str(&ns[c].addr));
++
++	if (stats) {
++		printf("Replies:\t%d\n", ns[c].replies);
++		printf("Failures:\t%d\n", ns[c].failures);
++	}
++
++	printf("\n");
++
++	for (rc = 0; rc < n_queries; rc++) {
++		if (stats) {
++			printf("Query #%d completed in %lums:\n", rc, queries[rc].latency);
++		}
++
++		if (queries[rc].rcode != 0) {
++			printf("** server can't find %s: %s\n", queries[rc].name,
++			       rcodes[queries[rc].rcode]);
++			continue;
++		}
++
++		c = 0;
++
++		if (queries[rc].rlen) {
++			header = (HEADER *)queries[rc].reply;
++
++			if (!header->aa)
++				printf("Non-authoritative answer:\n");
++
++			c = parse_reply(queries[rc].reply, queries[rc].rlen);
++		}
++
++		if (c == 0)
++			printf("*** Can't find %s: No answer\n", queries[rc].name);
++		else if (c < 0)
++			printf("*** Can't find %s: Parse error\n", queries[rc].name);
++
++		printf("\n");
++	}
++
++	rc = 0;
++
++out:
++	if (n_ns)
++		free(ns);
++
++	if (n_queries)
++		free(queries);
++
++	return rc;
++}
+-- 
+2.1.4
+


From lede-commits at lists.infradead.org  Tue Apr 11 10:34:22 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 13:34:22 -0400
Subject: [source]  util-linux: unconditionally enable ncursesw support
In-Reply-To: <20170411173421.18680.93465@git-01.infra.lede-project.org>
References: <20170411173421.18680.93465@git-01.infra.lede-project.org>
Message-ID: <mailman.23437.1491932215.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/0faf921a016fde64687e8fcdb8eace7854ce5876

commit 0faf921a016fde64687e8fcdb8eace7854ce5876
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Mar 22 13:49:05 2017 +0100

    util-linux: unconditionally enable ncursesw support
    
    The build dependency is unconditional, and some components might fail if
    ncurses is not available
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/utils/util-linux/Makefile | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
index f85f48e..a3c59c0 100644
--- a/package/utils/util-linux/Makefile
+++ b/package/utils/util-linux/Makefile
@@ -27,11 +27,6 @@ PKG_LICENSE_FILES:=	COPYING					\
 
 PKG_BUILD_PARALLEL:=0
 
-PKG_CONFIG_DEPENDS:= \
-	CONFIG_PACKAGE_cal \
-	CONFIG_PACKAGE_cfdisk \
-	CONFIG_PACKAGE_setterm
-
 PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1
 
@@ -441,7 +436,7 @@ CONFIGURE_ARGS += \
 	--without-udev		\
 	--without-readline	\
 	--disable-more		\
-	$(if $(CONFIG_PACKAGE_cal)$(CONFIG_PACKAGE_cfdisk)$(CONFIG_PACKAGE_setterm),--with-ncursesw,--without-ncurses)
+	--with-ncursesw
 
 TARGET_CFLAGS += $(FPIC) -std=gnu99
 


From lede-commits at lists.infradead.org  Tue Apr 11 10:34:23 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 13:34:23 -0400
Subject: [source]  util-linux: re-enable parallel builds
In-Reply-To: <20170411173421.18680.93465@git-01.infra.lede-project.org>
References: <20170411173421.18680.93465@git-01.infra.lede-project.org>
Message-ID: <mailman.23438.1491932217.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/caaa214eae5ddf25fd0796724331c217deb3f845

commit caaa214eae5ddf25fd0796724331c217deb3f845
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Mar 22 13:22:57 2017 +0100

    util-linux: re-enable parallel builds
    
    The original build error in 'more' seems to be gone
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/utils/util-linux/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
index a3c59c0..aea13ac 100644
--- a/package/utils/util-linux/Makefile
+++ b/package/utils/util-linux/Makefile
@@ -25,7 +25,7 @@ PKG_LICENSE_FILES:=	COPYING					\
 			libuuid/COPYING				\
 			Documentation/licenses/COPYING.BSD-3
 
-PKG_BUILD_PARALLEL:=0
+PKG_BUILD_PARALLEL:=1
 
 PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1


From lede-commits at lists.infradead.org  Tue Apr 11 10:34:21 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 13:34:21 -0400
Subject: [source]  utils/util-linux: Update to 2.29.2
In-Reply-To: <20170411173421.18680.93465@git-01.infra.lede-project.org>
References: <20170411173421.18680.93465@git-01.infra.lede-project.org>
Message-ID: <mailman.23439.1491932217.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/f2a365388250f62d86f5b1905316e3b3262b3874

commit f2a365388250f62d86f5b1905316e3b3262b3874
Author: Daniel Engberg <daniel.engberg.lists at pyret.net>
AuthorDate: Mon Mar 20 09:51:26 2017 +0100

    utils/util-linux: Update to 2.29.2
    
    Update util-linux to 2.29.2
    Remote 0001-fix-uClibc-ng-scanf-check.patch as it's been merged upstream.
    Refresh patches
    Change ncurses to ncursesw to fix compilation and avoid confusion
    
    Signed-off-by: Daniel Engberg <daniel.engberg.lists at pyret.net>
    Signed-off-by: Felix Fietkau <nbd at nbd.name> [remove faulty dependency changes]
---
 package/utils/util-linux/Makefile                  |  9 +++---
 .../patches/0001-fix-uClibc-ng-scanf-check.patch   | 34 ----------------------
 .../patches/003-fix_pkgconfig_files.patch          |  2 +-
 3 files changed, 6 insertions(+), 39 deletions(-)

diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
index 17f22e1..f85f48e 100644
--- a/package/utils/util-linux/Makefile
+++ b/package/utils/util-linux/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=util-linux
-PKG_VERSION:=2.28
+PKG_VERSION:=2.29.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.28
-PKG_HASH:=395847e2a18a2c317170f238892751e73a57104565344f8644090c8b091014bb
+PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.29
+PKG_HASH:=accea4d678209f97f634f40a93b7e9fcad5915d1f4749f6c47bee6bf110fe8e3
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=	COPYING					\
@@ -440,7 +440,8 @@ CONFIGURE_ARGS += \
 	--without-python	\
 	--without-udev		\
 	--without-readline	\
-	$(if $(CONFIG_PACKAGE_cal)$(CONFIG_PACKAGE_cfdisk)$(CONFIG_PACKAGE_setterm),--with-ncurses,--without-ncurses)
+	--disable-more		\
+	$(if $(CONFIG_PACKAGE_cal)$(CONFIG_PACKAGE_cfdisk)$(CONFIG_PACKAGE_setterm),--with-ncursesw,--without-ncurses)
 
 TARGET_CFLAGS += $(FPIC) -std=gnu99
 
diff --git a/package/utils/util-linux/patches/0001-fix-uClibc-ng-scanf-check.patch b/package/utils/util-linux/patches/0001-fix-uClibc-ng-scanf-check.patch
deleted file mode 100644
index 2da95f6..0000000
--- a/package/utils/util-linux/patches/0001-fix-uClibc-ng-scanf-check.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 180c908e2e80552b19bf3552667fc197d6edf7b3 Mon Sep 17 00:00:00 2001
-From: Waldemar Brodkorb <wbx at uclibc-ng.org>
-Date: Fri, 3 Jun 2016 04:13:08 +0200
-Subject: [PATCH] fix uClibc-ng scanf check
-
-uClibc-ng tries to be compatible with GNU libc and defines
-__GLIBC__ and pretend to be version 2.2.
-We once changed it to 2.10, but then some hard to fix problems
-in different software packages (gcc) occured.
-It would be better if we disable the special GNU libc checks
-for uClibc-ng here. uClibc-ng implements the required scanf
-functionality.
-
-Signed-off-by: Waldemar Brodkorb <wbx at uclibc-ng.org>
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index f36b18c..4661c0d 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -581,7 +581,7 @@ AC_CACHE_VAL([scanf_cv_alloc_modifier],
-      #include <stdio.h>
-      #include <unistd.h>
- 
--     #ifdef __GLIBC__
-+     #if defined(__GLIBC__) && !defined(__UCLIBC__)
- 
-      #if !(__GLIBC_PREREQ(2, 7))
-      #error %m is not available
--- 
-2.1.4
-
diff --git a/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch b/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch
index cc9cd11..16ba14a 100644
--- a/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch
+++ b/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch
@@ -10,7 +10,7 @@
  endif # BUILD_LIBUUID
 --- a/configure.ac
 +++ b/configure.ac
-@@ -2122,18 +2122,23 @@ AC_CONFIG_HEADERS([config.h])
+@@ -2165,18 +2165,23 @@ AC_CONFIG_HEADERS([config.h])
  #
  AC_CONFIG_FILES([
  Makefile


From lede-commits at lists.infradead.org  Tue Apr 11 15:20:41 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 18:20:41 -0400
Subject: [source]  kernel: Add various arm64-related symbols
In-Reply-To: <20170411222038.2908.61271@git-01.infra.lede-project.org>
References: <20170411222038.2908.61271@git-01.infra.lede-project.org>
Message-ID: <mailman.23516.1491949261.26984.lede-commits@lists.infradead.org>

florian pushed a commit to source.git, branch master:
https://git.lede-project.org/c47a769a30c7d6c5566a1da6a8ee1542995eb3e5

commit c47a769a30c7d6c5566a1da6a8ee1542995eb3e5
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Tue Apr 11 15:16:15 2017 -0700

    kernel: Add various arm64-related symbols
    
    In preparation for bumping arm64 to 4.9, add a bunch of configuration
    symbols that are available under arm64.
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 target/linux/generic/config-4.9 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9
index ef56ccf..1b0bae6 100644
--- a/target/linux/generic/config-4.9
+++ b/target/linux/generic/config-4.9
@@ -122,6 +122,7 @@ CONFIG_ALLOW_DEV_COREDUMP=y
 # CONFIG_ALX is not set
 # CONFIG_AM2315 is not set
 # CONFIG_AM335X_PHY_USB is not set
+# CONFIG_AMBA_PL08X is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_AMD_PHY is not set
 # CONFIG_AMD_XGBE is not set
@@ -1668,6 +1669,7 @@ CONFIG_HZ_100=y
 # CONFIG_I2C_SMBUS is not set
 # CONFIG_I2C_STUB is not set
 # CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_THUNDERX is not set
 # CONFIG_I2C_TINY_USB is not set
 # CONFIG_I2C_VERSATILE is not set
 # CONFIG_I2C_VIA is not set
@@ -2647,6 +2649,7 @@ CONFIG_MULTIUSER=y
 # CONFIG_MVNETA_BM is not set
 # CONFIG_MVSW61XX_PHY is not set
 # CONFIG_MVSWITCH_PHY is not set
+# CONFIG_MV_XOR_V2 is not set
 # CONFIG_MWAVE is not set
 # CONFIG_MWL8K is not set
 # CONFIG_MXC4005 is not set
@@ -3258,6 +3261,7 @@ CONFIG_PINCTRL_SINGLE=y
 CONFIG_PINMUX=y
 # CONFIG_PKCS7_MESSAGE_PARSER is not set
 # CONFIG_PL320_MBOX is not set
+# CONFIG_PL330_DMA is not set
 # CONFIG_PLATFORM_MHU is not set
 # CONFIG_PLAT_SPEAR is not set
 # CONFIG_PLIP is not set
@@ -3677,6 +3681,7 @@ CONFIG_SCSI_DMA=y
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_GENERIC_NCR5380 is not set
 # CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
+# CONFIG_SCSI_HISI_SAS is not set
 # CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_HPTIOP is not set
 # CONFIG_SCSI_IN2000 is not set
@@ -4343,6 +4348,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # CONFIG_SPI_ROCKCHIP is not set
 # CONFIG_SPI_SC18IS602 is not set
 # CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_THUNDERX is not set
 # CONFIG_SPI_TI_QSPI is not set
 # CONFIG_SPI_TLE62X0 is not set
 # CONFIG_SPI_TOPCLIFF_PCH is not set


From lede-commits at lists.infradead.org  Tue Apr 11 15:20:40 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 18:20:40 -0400
Subject: [source]  arm64: Update README
In-Reply-To: <20170411222038.2908.61271@git-01.infra.lede-project.org>
References: <20170411222038.2908.61271@git-01.infra.lede-project.org>
Message-ID: <mailman.23517.1491949262.26984.lede-commits@lists.infradead.org>

florian pushed a commit to source.git, branch master:
https://git.lede-project.org/b48682157cd10b9973511f6251aff1c45c2466ff

commit b48682157cd10b9973511f6251aff1c45c2466ff
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Tue Apr 11 15:15:43 2017 -0700

    arm64: Update README
    
    Drop sample command line to use against the ARM Foundation v8 model and
    replace the path to something that matches LEDE's directory structure.
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 target/linux/arm64/README | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/target/linux/arm64/README b/target/linux/arm64/README
index 0328ca1..ab26934 100644
--- a/target/linux/arm64/README
+++ b/target/linux/arm64/README
@@ -1,13 +1,8 @@
-This multi-platform ARMv8 target can be used either with ARM Ltd.'s Foundation_V8
-fast-model doing the following:
-
-Foundation_v8 --image bin/arm64-eglibc/openwrt-arm64-vexpress-foundation.axf
-
-or you can also use QEMU:
+This multi-platform ARMv8 target can be used with QEMU:
 
 qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic \
 	-smp 1 -m 2048 \
-	-kernel bin/arm64-eglibc/openwrt-arm64-qemu-virt-initramfs.Image \
+	-kernel bin/targets/arm64/generic/lede-arm64-qemu-virt-initramfs.Image \
 	--append "console=ttyAMA0"
 
 and enjoy the system booting.


From lede-commits at lists.infradead.org  Tue Apr 11 15:20:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 18:20:39 -0400
Subject: [source]  arm64: Remove Vexpress Foundation support
In-Reply-To: <20170411222038.2908.61271@git-01.infra.lede-project.org>
References: <20170411222038.2908.61271@git-01.infra.lede-project.org>
Message-ID: <mailman.23518.1491949265.26984.lede-commits@lists.infradead.org>

florian pushed a commit to source.git, branch master:
https://git.lede-project.org/b319e304c8d394e44f45ca3ade9df0b3c880d1bd

commit b319e304c8d394e44f45ca3ade9df0b3c880d1bd
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Fri Apr 7 14:49:15 2017 -0700

    arm64: Remove Vexpress Foundation support
    
    This required us to both download the Foundation emulator but also build
    a boot wrapper. QEMU is now fully usable and is a much better
    replacement.
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 target/linux/arm64/image/Makefile              | 12 ---------
 target/linux/arm64/image/boot-wrapper/Makefile | 37 --------------------------
 2 files changed, 49 deletions(-)

diff --git a/target/linux/arm64/image/Makefile b/target/linux/arm64/image/Makefile
index cc04b18..d529368 100644
--- a/target/linux/arm64/image/Makefile
+++ b/target/linux/arm64/image/Makefile
@@ -8,14 +8,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
 define Image/Prepare
-	-rm -rf $(KDIR)/linux-system.axf
 	cp $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/Image $(KDIR)/Image
-	$(MAKE) -C boot-wrapper clean
-	$(MAKE) -C boot-wrapper compile
-endef
-
-define Build/Clean
-	$(MAKE) -C boot-wrapper clean
 endef
 
 define Image/Build/QemuVirt
@@ -25,13 +18,8 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 endif
 endef
 
-define Image/Build/VexpressFoundation
-	$(CP) $(KDIR)/linux-system.axf $(BIN_DIR)/$(IMG_PREFIX)-vexpress-foundation.axf
-endef
-
 define Image/BuildKernel
 	$(call Image/Build/QemuVirt)
-	$(call Image/Build/VexpressFoundation)
 endef
 
 define Image/Build/squashfs
diff --git a/target/linux/arm64/image/boot-wrapper/Makefile b/target/linux/arm64/image/boot-wrapper/Makefile
deleted file mode 100644
index cf16f80..0000000
--- a/target/linux/arm64/image/boot-wrapper/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Copyright (C) 2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=aarch64-boot-wrapper
-PKG_RELEASE:=1
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git
-PKG_SOURCE_DATE:=2013-01-10
-PKG_SOURCE_VERSION:=c51dde817b5ed5b8f741b67ac51bd67bd87b4a2a
-PKG_MIRROR_HASH:=2f029a20c906af68e9fe067c1b0ed394e4c455e142454a039f41d1d82d6e17c8
-PKG_MAINTAINER:=Florian Fainelli <florian at openwrt.org>
-
-include $(INCLUDE_DIR)/kernel.mk
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Build/Compile
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		KERNEL="../Image" \
-		DTC="$(LINUX_DIR)/scripts/dtc/dtc" \
-		FDT_SRC="$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts/arm/foundation-v8.dts" \
-		CROSS_COMPILE="$(TARGET_CROSS)" \
-		BOOTARGS="console=ttyAMA0 earlyprintk"
-endef
-
-define Build/InstallDev
-	$(CP) $(PKG_BUILD_DIR)/linux-system.axf $(KDIR)/linux-system.axf
-endef
-
-$(eval $(call Build/DefaultTargets))


From lede-commits at lists.infradead.org  Tue Apr 11 15:20:42 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 18:20:42 -0400
Subject: [source]  arm64: Switch to 4.9 kernel
In-Reply-To: <20170411222038.2908.61271@git-01.infra.lede-project.org>
References: <20170411222038.2908.61271@git-01.infra.lede-project.org>
Message-ID: <mailman.23519.1491949265.26984.lede-commits@lists.infradead.org>

florian pushed a commit to source.git, branch master:
https://git.lede-project.org/fc28830b6f0cd5fe9650d6c9cc750e19665d3a59

commit fc28830b6f0cd5fe9650d6c9cc750e19665d3a59
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Tue Apr 11 12:11:16 2017 -0700

    arm64: Switch to 4.9 kernel
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 target/linux/arm64/Makefile   |   2 +-
 target/linux/arm64/config-4.9 | 307 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 308 insertions(+), 1 deletion(-)

diff --git a/target/linux/arm64/Makefile b/target/linux/arm64/Makefile
index 6bf89a7..5257b89 100644
--- a/target/linux/arm64/Makefile
+++ b/target/linux/arm64/Makefile
@@ -13,7 +13,7 @@ FEATURES:=fpu ramdisk
 CFLAGS:=-Os -pipe -fno-caller-saves
 MAINTAINER:=Florian Fainelli <florian at openwrt.org>
 
-KERNEL_PATCHVER:=4.4
+KERNEL_PATCHVER:=4.9
 
 DEVICE_TYPE:=developerboard
 
diff --git a/target/linux/arm64/config-4.9 b/target/linux/arm64/config-4.9
new file mode 100644
index 0000000..91a8f97
--- /dev/null
+++ b/target/linux/arm64/config-4.9
@@ -0,0 +1,307 @@
+CONFIG_64BIT=y
+# CONFIG_ACPI is not set
+CONFIG_ARCH_CLOCKSOURCE_DATA=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y
+CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
+CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
+CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
+CONFIG_ARCH_HAS_GIGANTIC_PAGE=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+CONFIG_ARCH_HAS_KCOV=y
+CONFIG_ARCH_HAS_SG_CHAIN=y
+CONFIG_ARCH_HAS_TICK_BROADCAST=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=24
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
+CONFIG_ARCH_VEXPRESS=y
+CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
+CONFIG_ARCH_WANT_FRAME_POINTERS=y
+CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
+CONFIG_ARM64=y
+# CONFIG_ARM64_16K_PAGES is not set
+CONFIG_ARM64_4K_PAGES=y
+# CONFIG_ARM64_64K_PAGES is not set
+# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set
+CONFIG_ARM64_CONT_SHIFT=4
+CONFIG_ARM64_CRYPTO=y
+CONFIG_ARM64_ERRATUM_819472=y
+CONFIG_ARM64_ERRATUM_824069=y
+CONFIG_ARM64_ERRATUM_826319=y
+CONFIG_ARM64_ERRATUM_827319=y
+CONFIG_ARM64_ERRATUM_832075=y
+CONFIG_ARM64_ERRATUM_843419=y
+CONFIG_ARM64_ERRATUM_845719=y
+CONFIG_ARM64_HW_AFDBM=y
+# CONFIG_ARM64_LSE_ATOMICS is not set
+CONFIG_ARM64_MODULE_CMODEL_LARGE=y
+CONFIG_ARM64_PAGE_SHIFT=12
+CONFIG_ARM64_PAN=y
+# CONFIG_ARM64_PTDUMP is not set
+# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set
+CONFIG_ARM64_UAO=y
+CONFIG_ARM64_VA_BITS=39
+CONFIG_ARM64_VA_BITS_39=y
+# CONFIG_ARM64_VA_BITS_48 is not set
+CONFIG_ARM64_VHE=y
+# CONFIG_ARMV8_DEPRECATED is not set
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V2M=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_PSCI_FW=y
+# CONFIG_ARM_SBSA_WATCHDOG is not set
+# CONFIG_ARM_SP805_WATCHDOG is not set
+CONFIG_ATOMIC64_SELFTEST=y
+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
+CONFIG_BLOCK_COMPAT=y
+CONFIG_BOUNCE=y
+CONFIG_BUILD_BIN2C=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLKSRC_ACPI=y
+CONFIG_CLKSRC_MMIO=y
+CONFIG_CLKSRC_OF=y
+CONFIG_CLKSRC_PROBE=y
+CONFIG_CLKSRC_VERSATILE=y
+CONFIG_CLK_SP810=y
+CONFIG_CLK_VEXPRESS_OSC=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMDLINE="console=ttyAMA0"
+CONFIG_COMMON_CLK=y
+CONFIG_COMMON_CLK_VERSATILE=y
+# CONFIG_COMMON_CLK_XGENE is not set
+CONFIG_COMPAT=y
+CONFIG_COMPAT_BINFMT_ELF=y
+CONFIG_COMPAT_NETLINK_MESSAGES=y
+CONFIG_COMPAT_OLD_SIGACTION=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+CONFIG_CPU_IDLE=y
+# CONFIG_CPU_IDLE_GOV_LADDER is not set
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRYPTO_SHA1_ARM64_CE=y
+CONFIG_CRYPTO_SHA2_ARM64_CE=y
+CONFIG_CRYPTO_GHASH_ARM64_CE=y
+CONFIG_CRYPTO_AES_ARM64_CE=y
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
+CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y
+CONFIG_CRYPTO_CRC32_ARM64=y
+CONFIG_DCACHE_WORD_ACCESS=y
+# CONFIG_DEBUG_ALIGN_RODATA is not set
+CONFIG_DTC=y
+CONFIG_FB=y
+CONFIG_FB_ARMCLCD=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_CMDLINE=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FIX_EARLYCON_MEM=y
+CONFIG_FRAME_POINTER=y
+CONFIG_FSL_ERRATUM_A008585=y
+# CONFIG_FSL_MC_BUS is not set
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_CSUM=y
+CONFIG_GENERIC_EARLY_IOREMAP=y
+CONFIG_GENERIC_IDLE_POLL_SETUP=y
+CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_MSI_IRQ=y
+CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_SCHED_CLOCK=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GPIOLIB=y
+# CONFIG_GPIO_AMDPT is not set
+CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+CONFIG_GRACE_PERIOD=y
+CONFIG_HANDLE_DOMAIN_IRQ=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
+CONFIG_HAVE_ARCH_AUDITSYSCALL=y
+CONFIG_HAVE_ARCH_BITREVERSE=y
+CONFIG_HAVE_ARCH_HUGE_VMAP=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KASAN=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
+CONFIG_HAVE_ARM_SMCCC=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_CC_STACKPROTECTOR=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_CLK_PREPARE=y
+CONFIG_HAVE_CMPXCHG_DOUBLE=y
+CONFIG_HAVE_CMPXCHG_LOCAL=y
+CONFIG_HAVE_CONTEXT_TRACKING=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DEBUG_BUGVERBOSE=y
+CONFIG_HAVE_DEBUG_KMEMLEAK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_EBPF_JIT=y
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_RCU_GUP=y
+CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_HAVE_NET_DSA=y
+CONFIG_HAVE_PATA_PLATFORM=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HAVE_PERF_REGS=y
+CONFIG_HAVE_PERF_USER_STACK_DUMP=y
+CONFIG_HAVE_RCU_TABLE_FREE=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_HAVE_UID16=y
+CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
+# CONFIG_HPET is not set
+# CONFIG_HUGETLBFS is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_CAVIUM is not set
+CONFIG_HW_RANDOM_VIRTIO=y
+CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
+CONFIG_IOMMU_HELPER=y
+CONFIG_IRQCHIP=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_DOMAIN_HIERARCHY=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_IRQ_WORK=y
+# CONFIG_KASAN is not set
+CONFIG_LIBFDT=y
+# CONFIG_LIQUIDIO is not set
+CONFIG_MFD_CORE=y
+CONFIG_MFD_SYSCON=y
+CONFIG_MFD_VEXPRESS_SYSREG=y
+CONFIG_MMC=y
+CONFIG_MMC_ARMMMCI=y
+# CONFIG_MMC_TIFM_SD is not set
+CONFIG_MODULES_USE_ELF_RELA=y
+# CONFIG_MTD_PHYSMAP_OF is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_SG_DMA_LENGTH=y
+CONFIG_NET_FLOW_LIMIT=y
+CONFIG_NO_BOOTMEM=y
+CONFIG_NO_HZ=y
+CONFIG_NO_HZ_COMMON=y
+CONFIG_NO_HZ_IDLE=y
+CONFIG_NR_CPUS=4
+# CONFIG_NUMA is not set
+CONFIG_OF=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_ADDRESS_PCI=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_NET=y
+CONFIG_OF_PCI=y
+CONFIG_OF_PCI_IRQ=y
+CONFIG_OF_RESERVED_MEM=y
+CONFIG_OLD_SIGSUSPEND3=y
+# CONFIG_PADATA is not set
+CONFIG_PARTITION_PERCPU=y
+CONFIG_PCI=y
+CONFIG_PCI_BUS_ADDR_T_64BIT=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_DOMAINS_GENERIC=y
+CONFIG_PCI_ECAM=y
+# CONFIG_PCI_HISI is not set
+# CONFIG_PCI_HOST_THUNDER_ECAM is not set
+# CONFIG_PCI_HOST_THUNDER_PEM is not set
+CONFIG_PCI_LABEL=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_MSI_IRQ_DOMAIN=y
+CONFIG_PGTABLE_LEVELS=3
+CONFIG_PHYS_ADDR_T_64BIT=y
+# CONFIG_PHY_XGENE is not set
+CONFIG_PM=y
+# CONFIG_PMIC_OPREGION is not set
+CONFIG_PM_CLK=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_GENERIC_DOMAINS=y
+CONFIG_PM_GENERIC_DOMAINS_OF=y
+CONFIG_PNP=y
+CONFIG_PNP_DEBUG_MESSAGES=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_VEXPRESS=y
+CONFIG_POWER_SUPPLY=y
+# CONFIG_RANDOMIZE_BASE is not set
+CONFIG_RATIONAL=y
+CONFIG_REGMAP=y
+CONFIG_REGMAP_MMIO=y
+CONFIG_RWSEM_SPIN_ON_OWNER=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+# CONFIG_SCHED_INFO is not set
+CONFIG_SERIAL_8250_FSL=y
+CONFIG_SERIAL_8250_PNP=y
+# CONFIG_SERIAL_AMBA_PL010 is not set
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_SMC91X=y
+CONFIG_SMP=y
+CONFIG_SPARSEMEM=y
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM_VMEMMAP=y
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_SRCU=y
+CONFIG_SWIOTLB=y
+CONFIG_SYSCTL_EXCEPTION_TRACE=y
+CONFIG_SYSVIPC_COMPAT=y
+CONFIG_SYS_SUPPORTS_HUGETLBFS=y
+# CONFIG_THUNDER_NIC_BGX is not set
+# CONFIG_THUNDER_NIC_PF is not set
+# CONFIG_THUNDER_NIC_RGX is not set
+# CONFIG_THUNDER_NIC_VF is not set
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_TREE_RCU=y
+CONFIG_VEXPRESS_CONFIG=y
+CONFIG_VEXPRESS_SYSCFG=y
+CONFIG_VIRTIO=y
+CONFIG_VIRTIO_BLK=y
+# CONFIG_VIRTIO_CONSOLE is not set
+CONFIG_VIRTIO_MMIO=y
+# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set
+CONFIG_VIRTIO_NET=y


From lede-commits at lists.infradead.org  Tue Apr 11 17:59:47 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 11 Apr 2017 17:59:47 -0700
Subject: [source] busybox: add musl compatible nslookup replacement
In-Reply-To: <mailman.23115.1491823276.26984.lede-commits@lists.infradead.org>
References: <20170410112052.14297.751@git-01.infra.lede-project.org>
 <mailman.23115.1491823276.26984.lede-commits@lists.infradead.org>
Message-ID: <mailman.23530.1491958817.26984.lede-commits@lists.infradead.org>

Hi Jo,

On 04/10/2017 04:20 AM, LEDE Commits wrote:
> +---
> + Makefile.flags             |   6 +
> + networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
> + 2 files changed, 875 insertions(+)
> + create mode 100644 networking/nslookup_lede.c
> +
> +diff --git a/Makefile.flags b/Makefile.flags
> +index 65021de..096ab77 100644
> +--- a/Makefile.flags
> ++++ b/Makefile.flags
> +@@ -134,6 +134,12 @@ else
> + LDLIBS += m
> + endif
> + 
> ++# nslookup_lede might need the resolv library
> ++RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
> ++ifeq ($(RESOLV_AVAILABLE),y)
> ++LDLIBS += resolv
> ++endif

This is not working with external toolchains that require TARGET_LDFLAGS
(and possibly TARGET_CPPFLAGS) to be specified. How about the following:

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index be4b967a47d4..c87243b93c1f 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -85,6 +85,12 @@ ifdef CONFIG_BUSYBOX_CONFIG_PAM
   LDLIBS += pam pam_misc pthread
 endif

+ifdef CONFIG_BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+  ifeq ($(CONFIG_USE_GLIBC),y)
+       LDLIBS += resolv
+  endif
+endif
+
 define Build/Compile
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CC)" \

This is already a LEDE specific patch, so it we can use existing
knowledge about the toolchain we have in the Makefile, what do you
think? I verified the patch with an external glibc toolchain, aarch64
musl and armvirt glibc to make sure it was working correctly.

Thanks!
-- 
Florian


From lede-commits at lists.infradead.org  Wed Apr 12 00:52:38 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:52:38 -0400
Subject: [source]  arm64: remove linux 4.4 support
In-Reply-To: <20170412075236.24091.42206@git-01.infra.lede-project.org>
References: <20170412075236.24091.42206@git-01.infra.lede-project.org>
Message-ID: <mailman.23552.1491983708.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/2c6b8e4631176dfd403829e3adac9188f65954c6

commit 2c6b8e4631176dfd403829e3adac9188f65954c6
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Apr 12 09:52:14 2017 +0200

    arm64: remove linux 4.4 support
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/arm64/config-4.4 | 350 ------------------------------------------
 1 file changed, 350 deletions(-)

diff --git a/target/linux/arm64/config-4.4 b/target/linux/arm64/config-4.4
deleted file mode 100644
index d3f7f75..0000000
--- a/target/linux/arm64/config-4.4
+++ /dev/null
@@ -1,350 +0,0 @@
-CONFIG_64BIT=y
-CONFIG_ACPI=y
-CONFIG_ACPI_CCA_REQUIRED=y
-# CONFIG_ACPI_CONTAINER is not set
-# CONFIG_ACPI_CUSTOM_DSDT is not set
-# CONFIG_ACPI_DEBUG is not set
-# CONFIG_ACPI_DEBUGGER is not set
-# CONFIG_ACPI_DOCK is not set
-# CONFIG_ACPI_EC_DEBUGFS is not set
-CONFIG_ACPI_FAN=y
-CONFIG_ACPI_GENERIC_GSI=y
-# CONFIG_ACPI_PCI_SLOT is not set
-CONFIG_ACPI_PROCESSOR=y
-CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y
-CONFIG_ACPI_THERMAL=y
-# CONFIG_ARCH_BCM_IPROC is not set
-CONFIG_ARCH_DMA_ADDR_T_64BIT=y
-# CONFIG_ARCH_EXYNOS7 is not set
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
-CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_TICK_BROADCAST=y
-# CONFIG_ARCH_LAYERSCAPE is not set
-CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SEATTLE is not set
-CONFIG_ARCH_SELECT_MEMORY_MODEL=y
-CONFIG_ARCH_SPARSEMEM_DEFAULT=y
-CONFIG_ARCH_SPARSEMEM_ENABLE=y
-# CONFIG_ARCH_SPRD is not set
-# CONFIG_ARCH_STRATIX10 is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-# CONFIG_ARCH_THUNDER is not set
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_VEXPRESS=y
-CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_FRAME_POINTERS=y
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-# CONFIG_ARCH_XGENE is not set
-# CONFIG_ARCH_ZYNQMP is not set
-CONFIG_ARM64=y
-# CONFIG_ARM64_16K_PAGES is not set
-CONFIG_ARM64_4K_PAGES=y
-# CONFIG_ARM64_64K_PAGES is not set
-# CONFIG_ARM64_CRYPTO is not set
-CONFIG_ARM64_ERRATUM_819472=y
-CONFIG_ARM64_ERRATUM_824069=y
-CONFIG_ARM64_ERRATUM_826319=y
-CONFIG_ARM64_ERRATUM_827319=y
-CONFIG_ARM64_ERRATUM_832075=y
-CONFIG_ARM64_ERRATUM_843419=y
-CONFIG_ARM64_ERRATUM_845719=y
-CONFIG_ARM64_HW_AFDBM=y
-# CONFIG_ARM64_LSE_ATOMICS is not set
-CONFIG_ARM64_PAN=y
-# CONFIG_ARM64_PTDUMP is not set
-# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set
-CONFIG_ARM64_VA_BITS=39
-CONFIG_ARM64_VA_BITS_39=y
-# CONFIG_ARM64_VA_BITS_48 is not set
-# CONFIG_ARMV8_DEPRECATED is not set
-CONFIG_ARM_AMBA=y
-CONFIG_ARM_ARCH_TIMER=y
-CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
-CONFIG_ARM_GIC=y
-CONFIG_ARM_GIC_V3=y
-CONFIG_ARM_PSCI_FW=y
-# CONFIG_ARM_SP805_WATCHDOG is not set
-CONFIG_ATOMIC64_SELFTEST=y
-CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_BLOCK_COMPAT=y
-CONFIG_BOUNCE=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_BSD_PROCESS_ACCT_V3=y
-CONFIG_BUILD_BIN2C=y
-# CONFIG_CAVIUM_ERRATUM_22375 is not set
-# CONFIG_CAVIUM_ERRATUM_23144 is not set
-# CONFIG_CAVIUM_ERRATUM_23154 is not set
-# CONFIG_CAVIUM_ERRATUM_27456 is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_ACPI=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CLKSRC_OF=y
-CONFIG_CLKSRC_PROBE=y
-CONFIG_CLK_SP810=y
-CONFIG_CLK_VEXPRESS_OSC=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyAMA0"
-CONFIG_COMMON_CLK=y
-CONFIG_COMMON_CLK_VERSATILE=y
-CONFIG_COMMON_CLK_XGENE=y
-CONFIG_COMPAT=y
-CONFIG_COMPAT_BINFMT_ELF=y
-CONFIG_COMPAT_NETLINK_MESSAGES=y
-CONFIG_COMPAT_OLD_SIGACTION=y
-# CONFIG_CPU_BIG_ENDIAN is not set
-CONFIG_CPU_RMAP=y
-CONFIG_CRC16=y
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CUSE=y
-CONFIG_DCACHE_WORD_ACCESS=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DEFAULT_IOSCHED="noop"
-CONFIG_DEFAULT_NOOP=y
-CONFIG_DTC=y
-CONFIG_EDAC_SUPPORT=y
-# CONFIG_EFI is not set
-CONFIG_EXT4_FS=y
-CONFIG_FAT_FS=y
-CONFIG_FB=y
-CONFIG_FB_ARMCLCD=y
-CONFIG_FB_CFB_COPYAREA=y
-CONFIG_FB_CFB_FILLRECT=y
-CONFIG_FB_CFB_IMAGEBLIT=y
-CONFIG_FB_CMDLINE=y
-CONFIG_FB_MODE_HELPERS=y
-CONFIG_FIX_EARLYCON_MEM=y
-CONFIG_FRAME_POINTER=y
-# CONFIG_FSL_MC_BUS is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_FUSE_FS=y
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
-CONFIG_GENERIC_CPU_AUTOPROBE=y
-CONFIG_GENERIC_CSUM=y
-CONFIG_GENERIC_EARLY_IOREMAP=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GENERIC_TIME_VSYSCALL=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_ACPI=y
-# CONFIG_GPIO_AMDPT is not set
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_GENERIC=y
-CONFIG_GPIO_GENERIC_PLATFORM=y
-# CONFIG_GPIO_XGENE is not set
-CONFIG_GRACE_PERIOD=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_BITREVERSE=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KASAN=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
-CONFIG_HAVE_CMPXCHG_DOUBLE=y
-CONFIG_HAVE_CMPXCHG_LOCAL=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_BUGVERBOSE=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_GENERIC_RCU_GUP=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMORY_PRESENT=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_PATA_PLATFORM=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_RCU_TABLE_FREE=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-# CONFIG_HPET is not set
-# CONFIG_HUGETLBFS is not set
-CONFIG_HW_RANDOM=y
-CONFIG_HW_RANDOM_VIRTIO=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IOMMU_HELPER=y
-# CONFIG_IOSCHED_DEADLINE is not set
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_DHCP=y
-# CONFIG_IP_PNP_RARP is not set
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_DOMAIN_HIERARCHY=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_JBD2=y
-CONFIG_LIBFDT=y
-# CONFIG_LIQUIDIO is not set
-CONFIG_LOCKD=y
-CONFIG_LOCK_SPIN_ON_OWNER=y
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_CLUT224=y
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_LZO_COMPRESS=y
-CONFIG_LZO_DECOMPRESS=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_MFD_CORE=y
-CONFIG_MFD_SYSCON=y
-CONFIG_MFD_VEXPRESS_SYSREG=y
-# CONFIG_MISC_FILESYSTEMS is not set
-CONFIG_MMC=y
-CONFIG_MMC_ARMMMCI=y
-# CONFIG_MMC_TIFM_SD is not set
-CONFIG_MODULES_USE_ELF_RELA=y
-# CONFIG_MTD_PHYSMAP_OF is not set
-CONFIG_MUTEX_SPIN_ON_OWNER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_SG_DMA_LENGTH=y
-CONFIG_NET_FLOW_LIMIT=y
-CONFIG_NFS_FS=y
-CONFIG_NLS=y
-CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_ISO8859_1=y
-CONFIG_NO_BOOTMEM=y
-CONFIG_NO_HZ=y
-CONFIG_NO_HZ_COMMON=y
-CONFIG_NO_HZ_IDLE=y
-CONFIG_NR_CPUS=4
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_PCI=y
-CONFIG_PCI_BUS_ADDR_T_64BIT=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_DOMAINS_GENERIC=y
-# CONFIG_PCI_HISI is not set
-CONFIG_PCI_LABEL=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=3
-CONFIG_PHYS_ADDR_T_64BIT=y
-# CONFIG_PHY_XGENE is not set
-# CONFIG_PMIC_OPREGION is not set
-CONFIG_PNP=y
-CONFIG_PNPACPI=y
-CONFIG_PNP_DEBUG_MESSAGES=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_POSIX_MQUEUE_SYSCTL=y
-CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_VEXPRESS=y
-# CONFIG_POWER_RESET_XGENE is not set
-CONFIG_POWER_SUPPLY=y
-# CONFIG_PREEMPT_NONE is not set
-CONFIG_PREEMPT_VOLUNTARY=y
-CONFIG_PROFILING=y
-CONFIG_RATIONAL=y
-CONFIG_RCU_STALL_COMMON=y
-CONFIG_REGMAP=y
-CONFIG_REGMAP_MMIO=y
-CONFIG_RFS_ACCEL=y
-CONFIG_ROOT_NFS=y
-CONFIG_RPS=y
-CONFIG_RWSEM_SPIN_ON_OWNER=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCHED_INFO is not set
-CONFIG_SCSI=y
-# CONFIG_SCSI_LOWLEVEL is not set
-# CONFIG_SCSI_PROC_FS is not set
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_PNP=y
-# CONFIG_SERIAL_AMBA_PL010 is not set
-CONFIG_SERIAL_AMBA_PL011=y
-CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
-CONFIG_SMC91X=y
-CONFIG_SMP=y
-CONFIG_SPARSEMEM=y
-CONFIG_SPARSEMEM_EXTREME=y
-CONFIG_SPARSEMEM_MANUAL=y
-CONFIG_SPARSEMEM_VMEMMAP=y
-CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
-CONFIG_SPARSE_IRQ=y
-CONFIG_SRCU=y
-CONFIG_SUNRPC=y
-# CONFIG_SWAP is not set
-CONFIG_SWIOTLB=y
-CONFIG_SYSCTL_EXCEPTION_TRACE=y
-CONFIG_SYSVIPC_COMPAT=y
-CONFIG_SYS_SUPPORTS_HUGETLBFS=y
-CONFIG_THERMAL=y
-CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
-CONFIG_THERMAL_GOV_STEP_WISE=y
-CONFIG_THERMAL_OF=y
-# CONFIG_THUNDER_NIC_BGX is not set
-# CONFIG_THUNDER_NIC_PF is not set
-# CONFIG_THUNDER_NIC_VF is not set
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TREE_RCU=y
-CONFIG_VEXPRESS_CONFIG=y
-CONFIG_VEXPRESS_SYSCFG=y
-CONFIG_VFAT_FS=y
-CONFIG_VIDEOMODE_HELPERS=y
-CONFIG_VIRTIO=y
-CONFIG_VIRTIO_BLK=y
-# CONFIG_VIRTIO_CONSOLE is not set
-CONFIG_VIRTIO_MMIO=y
-# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set
-CONFIG_VIRTIO_NET=y
-CONFIG_XPS=y


From lede-commits at lists.infradead.org  Wed Apr 12 00:52:37 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:52:37 -0400
Subject: [source]  apm821xx: remove 4.4 kernel support
In-Reply-To: <20170412075236.24091.42206@git-01.infra.lede-project.org>
References: <20170412075236.24091.42206@git-01.infra.lede-project.org>
Message-ID: <mailman.23555.1491983720.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/cead8f9dfd8395577c6274e34fd592bcf76afe1c

commit cead8f9dfd8395577c6274e34fd592bcf76afe1c
Author: Christian Lamparter <chunkeey at googlemail.com>
AuthorDate: Fri Feb 10 17:44:44 2017 +0100

    apm821xx: remove 4.4 kernel support
    
    Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
---
 target/linux/apm821xx/config-4.4                   |  331 -----
 ...to4xx-integrate-ppc4xx-rng-into-crypto4xx.patch |  481 -------
 .../002-powerpc_ibm_phy_add_ar8035.patch           |   57 -
 ...dd-transfer-termination-synchronization-s.patch |  138 --
 ...ore-Introduce-new-universal-API-to-reques.patch |  335 -----
 ...dd-transfer-termination-synchronization-s.patch |  282 ----
 .../patches-4.4/015-dmaengine-dw-fixed.patch       | 1517 --------------------
 .../linux/apm821xx/patches-4.4/020-sata-dwc.patch  | 1083 --------------
 ...onvert-IDE-trigger-to-common-disk-trigger.patch |  209 ---
 .../200-add-meraki-mr24-ikarem-support.patch       |   32 -
 .../201-add-amcc-apollo3g-support.patch            |   30 -
 .../202-add-netgear-wndr4700-support.patch         |   32 -
 .../203-add-meraki-mx60-buckminster-support.patch  |   32 -
 .../300-fix-atheros-nics-on-apm82181.patch         |   51 -
 .../patches-4.4/301-fix-memory-map-wndr4700.patch  |   14 -
 .../701-powerpc_ibm_apm82181_phyclk_fix.patch      |   52 -
 .../702-powerpc_ibm_phy_add_dt_parser.patch        |  328 -----
 ...d-firmware-loader-for-uPD720201-and-uPD72.patch |  545 -------
 .../802-usb-xhci-force-msi-renesas-xhci.patch      |   54 -
 .../804-usb-dwc2-add-amcc-usb-otg-405ex.patch      |   48 -
 ...river-for-Microchip-TC654-TC655-PWM-fan-c.patch | 1027 -------------
 ...0-split-set-and-show-temp-as-common-codes.patch |  292 ----
 ...12-hwmon-lm90-expose-to-thermal-fw-via-DT.patch |  149 --
 23 files changed, 7119 deletions(-)

diff --git a/target/linux/apm821xx/config-4.4 b/target/linux/apm821xx/config-4.4
deleted file mode 100644
index 68e22ec..0000000
--- a/target/linux/apm821xx/config-4.4
+++ /dev/null
@@ -1,331 +0,0 @@
-# CONFIG_40x is not set
-CONFIG_44x=y
-CONFIG_4xx=y
-CONFIG_4xx_SOC=y
-# CONFIG_ADVANCED_OPTIONS is not set
-CONFIG_APM821xx=y
-# CONFIG_APOLLO3G is not set
-# CONFIG_ARCHES is not set
-CONFIG_ARCH_DMA_ADDR_T_64BIT=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
-CONFIG_ARCH_HAS_ILOG2_U32=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_WALK_MEMORY=y
-CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MAY_HAVE_PC_FDC=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
-# CONFIG_ARCH_RANDOM is not set
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_AUDIT_ARCH=y
-# CONFIG_BAMBOO is not set
-CONFIG_BCH=y
-# CONFIG_BLUESTONE is not set
-CONFIG_BUCKMINSTER=y
-CONFIG_BOOKE=y
-CONFIG_BOOKE_WDT=y
-CONFIG_BOUNCE=y
-# CONFIG_CANYONLANDS is not set
-# CONFIG_IKAREM is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CONSISTENT_SIZE=0x00200000
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CRC16=y
-CONFIG_CRYPTO_DEFLATE=y
-CONFIG_CRYPTO_DEV_PPC4XX=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_HW=y
-CONFIG_CRYPTO_LZO=y
-CONFIG_CRYPTO_MD5_PPC=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_SHA1_PPC=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_DECOMPRESS_GZIP=y
-# CONFIG_DEFAULT_UIMAGE is not set
-CONFIG_DTC=y
-# CONFIG_E200 is not set
-CONFIG_EARLY_PRINTK=y
-# CONFIG_EBONY is not set
-CONFIG_EDAC_ATOMIC_SCRUB=y
-CONFIG_EDAC_SUPPORT=y
-# CONFIG_EIGER is not set
-# CONFIG_EPAPR_BOOT is not set
-CONFIG_EXTRA_TARGETS="uImage"
-CONFIG_FREEZER=y
-# CONFIG_FSL_ULI1575 is not set
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-# CONFIG_GENERIC_CSUM is not set
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_ISA_DMA=y
-CONFIG_GENERIC_MSI_IRQ=y
-CONFIG_GENERIC_NVRAM=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-# CONFIG_GENERIC_TBSYNC is not set
-CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_GE_FPGA is not set
-# CONFIG_GLACIER is not set
-CONFIG_GLOB=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_GENERIC=y
-CONFIG_GPIO_GENERIC_PLATFORM=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAS_RAPIDIO is not set
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-# CONFIG_HAVE_ARCH_BITREVERSE is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
-CONFIG_HAVE_GENERIC_RCU_GUP=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IOREMAP_PROT=y
-CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HW_RANDOM=y
-CONFIG_HW_RANDOM_PPC4XX=y
-CONFIG_HZ=1000
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_1000=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_I2C=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_IBM_IIC=y
-CONFIG_IBM_EMAC=y
-CONFIG_IBM_EMAC_EMAC4=y
-CONFIG_IBM_EMAC_POLL_WEIGHT=32
-CONFIG_IBM_EMAC_RGMII=y
-CONFIG_IBM_EMAC_RXB=128
-CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256
-CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0
-CONFIG_IBM_EMAC_TAH=y
-CONFIG_IBM_EMAC_TXB=128
-# CONFIG_ICON is not set
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_IOMMU_HELPER is not set
-# CONFIG_IPIC is not set
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_ISA_DMA_API=y
-# CONFIG_KATMAI is not set
-CONFIG_KERNEL_START=0xc0000000
-CONFIG_LIBFDT=y
-CONFIG_LOWMEM_SIZE=0x30000000
-CONFIG_LZO_COMPRESS=y
-CONFIG_LZO_DECOMPRESS=y
-# CONFIG_MATH_EMULATION is not set
-CONFIG_MDIO_BOARDINFO=y
-# CONFIG_MMIO_NVRAM is not set
-CONFIG_MODULES_USE_ELF_RELA=y
-# CONFIG_MPIC is not set
-# CONFIG_MPIC_U3_HT_IRQS is not set
-# CONFIG_MPIC_WEIRD is not set
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_BCH=y
-CONFIG_MTD_NAND_ECC=y
-CONFIG_MTD_NAND_ECC_BCH=y
-CONFIG_MTD_NAND_ECC_SMC=y
-CONFIG_MTD_NAND_NDFC=y
-# CONFIG_MTD_SPLIT is not set
-# CONFIG_MTD_SPLIT_FIRMWARE_NAME is not set
-# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set
-# CONFIG_MTD_SPLIT_SUPPORT is not set
-# CONFIG_MTD_UBI is not set
-# CONFIG_MTD_UBI_BEB_LIMIT is not set
-# CONFIG_MTD_UBI_BLOCK is not set
-# CONFIG_MTD_UBI_FASTMAP is not set
-# CONFIG_MTD_UBI_GLUEBI is not set
-# CONFIG_MTD_UBI_WL_THRESHOLD is not set
-CONFIG_NEED_DMA_MAP_STATE=y
-# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NEED_SG_DMA_LENGTH=y
-# CONFIG_NONSTATIC_KERNEL is not set
-CONFIG_NOT_COHERENT_CACHE=y
-CONFIG_NO_BOOTMEM=y
-CONFIG_NR_IRQS=512
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MDIO=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND=y
-CONFIG_PAGE_OFFSET=0xc0000000
-CONFIG_PCI=y
-CONFIG_PCIEAER=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCIE_PME=y
-CONFIG_PCI_BUS_ADDR_T_64BIT=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_MSI=y
-CONFIG_PGTABLE_LEVELS=2
-CONFIG_PHYLIB=y
-CONFIG_PHYSICAL_START=0x00000000
-CONFIG_PHYS_64BIT=y
-CONFIG_PHYS_ADDR_T_64BIT=y
-CONFIG_PM=y
-CONFIG_PM_AUTOSLEEP=y
-# CONFIG_PM_DEBUG is not set
-CONFIG_PM_SLEEP=y
-CONFIG_PM_WAKELOCKS=y
-CONFIG_PM_WAKELOCKS_GC=y
-CONFIG_PM_WAKELOCKS_LIMIT=100
-CONFIG_PPC=y
-CONFIG_PPC32=y
-# CONFIG_PPC44x_SIMPLE is not set
-CONFIG_PPC4xx_CPM=y
-CONFIG_PPC4xx_GPIO=y
-# CONFIG_PPC4xx_HSTA_MSI is not set
-# CONFIG_PPC4xx_MSI is not set
-CONFIG_PPC4xx_OCM=y
-# CONFIG_PPC4xx_PCI_EXPRESS is not set
-# CONFIG_PPC64 is not set
-# CONFIG_PPC_47x is not set
-# CONFIG_PPC_85xx is not set
-# CONFIG_PPC_8xx is not set
-# CONFIG_PPC_970_NAP is not set
-CONFIG_PPC_ADV_DEBUG_DACS=2
-CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y
-CONFIG_PPC_ADV_DEBUG_DVCS=2
-CONFIG_PPC_ADV_DEBUG_IACS=4
-CONFIG_PPC_ADV_DEBUG_REGS=y
-# CONFIG_PPC_BOOK3S_32 is not set
-# CONFIG_PPC_CELL is not set
-# CONFIG_PPC_CELL_NATIVE is not set
-# CONFIG_PPC_COPRO_BASE is not set
-CONFIG_PPC_DCR=y
-# CONFIG_PPC_DCR_MMIO is not set
-CONFIG_PPC_DCR_NATIVE=y
-# CONFIG_PPC_DOORBELL is not set
-# CONFIG_PPC_EARLY_DEBUG is not set
-# CONFIG_PPC_EPAPR_HV_PIC is not set
-CONFIG_PPC_FPU=y
-# CONFIG_PPC_I8259 is not set
-# CONFIG_PPC_ICP_HV is not set
-# CONFIG_PPC_ICP_NATIVE is not set
-# CONFIG_PPC_ICS_RTAS is not set
-CONFIG_PPC_INDIRECT_PCI=y
-CONFIG_PPC_LIB_RHEAP=y
-CONFIG_PPC_MMU_NOHASH=y
-# CONFIG_PPC_MM_SLICES is not set
-# CONFIG_PPC_MPC106 is not set
-# CONFIG_PPC_MSI_BITMAP is not set
-# CONFIG_PPC_P7_NAP is not set
-CONFIG_PPC_PCI_CHOICE=y
-# CONFIG_PPC_RTAS is not set
-CONFIG_PPC_UDBG_16550=y
-CONFIG_PPC_WERROR=y
-# CONFIG_PPC_XICS is not set
-# CONFIG_PQ2ADS is not set
-CONFIG_PTE_64BIT=y
-# CONFIG_RAINIER is not set
-CONFIG_RAS=y
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_RD_GZIP=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-# CONFIG_SAM440EP is not set
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCHED_INFO is not set
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SEQUOIA is not set
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_OF_PLATFORM=y
-CONFIG_SIMPLE_GPIO=y
-CONFIG_SPARSE_IRQ=y
-CONFIG_SRCU=y
-# CONFIG_STRICT_MM_TYPECHECKS is not set
-CONFIG_SUSPEND=y
-CONFIG_SUSPEND_FREEZER=y
-# CONFIG_SWIOTLB is not set
-CONFIG_SYSCTL_EXCEPTION_TRACE=y
-# CONFIG_TAISHAN is not set
-CONFIG_TASK_SIZE=0xc0000000
-CONFIG_TICK_CPU_ACCOUNTING=y
-# CONFIG_UBIFS_FS is not set
-# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
-# CONFIG_UBIFS_FS_LZO is not set
-# CONFIG_UBIFS_FS_ZLIB is not set
-CONFIG_USB_SUPPORT=y
-CONFIG_VDSO32=y
-# CONFIG_WARP is not set
-# CONFIG_WNDR4700 is not set
-CONFIG_WORD_SIZE=32
-# CONFIG_XILINX_SYSACE is not set
-# CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_XZ_DEC_POWERPC=y
-# CONFIG_YOSEMITE is not set
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
-# CONFIG_JFFS2_FS is not set
-# CONFIG_SENSORS_TC654 is not set
diff --git a/target/linux/apm821xx/patches-4.4/001-crypto4xx-integrate-ppc4xx-rng-into-crypto4xx.patch b/target/linux/apm821xx/patches-4.4/001-crypto4xx-integrate-ppc4xx-rng-into-crypto4xx.patch
deleted file mode 100644
index 324c695..0000000
--- a/target/linux/apm821xx/patches-4.4/001-crypto4xx-integrate-ppc4xx-rng-into-crypto4xx.patch
+++ /dev/null
@@ -1,481 +0,0 @@
-From 5343e674f32fb82b7a80a24b5a84eee62d3fe624 Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey at googlemail.com>
-Date: Mon, 18 Apr 2016 12:57:41 +0200
-Subject: [PATCH] crypto4xx: integrate ppc4xx-rng into crypto4xx
-
-This patch integrates the ppc4xx-rng driver into the existing
-crypto4xx. This is because the true random number generator
-is controlled and part of the security core.
-
-Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
-Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
----
- drivers/char/hw_random/Kconfig          |  13 ---
- drivers/char/hw_random/Makefile         |   1 -
- drivers/char/hw_random/ppc4xx-rng.c     | 147 --------------------------------
- drivers/crypto/Kconfig                  |   8 ++
- drivers/crypto/amcc/Makefile            |   1 +
- drivers/crypto/amcc/crypto4xx_core.c    |   7 +-
- drivers/crypto/amcc/crypto4xx_core.h    |   4 +
- drivers/crypto/amcc/crypto4xx_reg_def.h |   1 +
- drivers/crypto/amcc/crypto4xx_trng.c    | 131 ++++++++++++++++++++++++++++
- drivers/crypto/amcc/crypto4xx_trng.h    |  34 ++++++++
- 10 files changed, 184 insertions(+), 163 deletions(-)
- delete mode 100644 drivers/char/hw_random/ppc4xx-rng.c
- create mode 100644 drivers/crypto/amcc/crypto4xx_trng.c
- create mode 100644 drivers/crypto/amcc/crypto4xx_trng.h
-
---- a/drivers/char/hw_random/Kconfig
-+++ b/drivers/char/hw_random/Kconfig
-@@ -268,19 +268,6 @@ config HW_RANDOM_NOMADIK
- 
- 	  If unsure, say Y.
- 
--config HW_RANDOM_PPC4XX
--	tristate "PowerPC 4xx generic true random number generator support"
--	depends on PPC && 4xx
--	default HW_RANDOM
--	---help---
--	 This driver provides the kernel-side support for the TRNG hardware
--	 found in the security function of some PowerPC 4xx SoCs.
--
--	 To compile this driver as a module, choose M here: the
--	 module will be called ppc4xx-rng.
--
--	 If unsure, say N.
--
- config HW_RANDOM_PSERIES
- 	tristate "pSeries HW Random Number Generator support"
- 	depends on PPC64 && IBMVIO
---- a/drivers/char/hw_random/Makefile
-+++ b/drivers/char/hw_random/Makefile
-@@ -22,7 +22,6 @@ obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939
- obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o
- obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
- obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
--obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o
- obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o
- obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o
- obj-$(CONFIG_HW_RANDOM_EXYNOS)	+= exynos-rng.o
---- a/drivers/char/hw_random/ppc4xx-rng.c
-+++ /dev/null
-@@ -1,147 +0,0 @@
--/*
-- * Generic PowerPC 44x RNG driver
-- *
-- * Copyright 2011 IBM Corporation
-- *
-- * 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 of the License.
-- */
--
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/platform_device.h>
--#include <linux/hw_random.h>
--#include <linux/delay.h>
--#include <linux/of_address.h>
--#include <linux/of_platform.h>
--#include <asm/io.h>
--
--#define PPC4XX_TRNG_DEV_CTRL 0x60080
--
--#define PPC4XX_TRNGE 0x00020000
--#define PPC4XX_TRNG_CTRL 0x0008
--#define PPC4XX_TRNG_CTRL_DALM 0x20
--#define PPC4XX_TRNG_STAT 0x0004
--#define PPC4XX_TRNG_STAT_B 0x1
--#define PPC4XX_TRNG_DATA 0x0000
--
--#define MODULE_NAME "ppc4xx_rng"
--
--static int ppc4xx_rng_data_present(struct hwrng *rng, int wait)
--{
--	void __iomem *rng_regs = (void __iomem *) rng->priv;
--	int busy, i, present = 0;
--
--	for (i = 0; i < 20; i++) {
--		busy = (in_le32(rng_regs + PPC4XX_TRNG_STAT) & PPC4XX_TRNG_STAT_B);
--		if (!busy || !wait) {
--			present = 1;
--			break;
--		}
--		udelay(10);
--	}
--	return present;
--}
--
--static int ppc4xx_rng_data_read(struct hwrng *rng, u32 *data)
--{
--	void __iomem *rng_regs = (void __iomem *) rng->priv;
--	*data = in_le32(rng_regs + PPC4XX_TRNG_DATA);
--	return 4;
--}
--
--static int ppc4xx_rng_enable(int enable)
--{
--	struct device_node *ctrl;
--	void __iomem *ctrl_reg;
--	int err = 0;
--	u32 val;
--
--	/* Find the main crypto device node and map it to turn the TRNG on */
--	ctrl = of_find_compatible_node(NULL, NULL, "amcc,ppc4xx-crypto");
--	if (!ctrl)
--		return -ENODEV;
--
--	ctrl_reg = of_iomap(ctrl, 0);
--	if (!ctrl_reg) {
--		err = -ENODEV;
--		goto out;
--	}
--
--	val = in_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL);
--
--	if (enable)
--		val |= PPC4XX_TRNGE;
--	else
--		val = val & ~PPC4XX_TRNGE;
--
--	out_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL, val);
--	iounmap(ctrl_reg);
--
--out:
--	of_node_put(ctrl);
--
--	return err;
--}
--
--static struct hwrng ppc4xx_rng = {
--	.name = MODULE_NAME,
--	.data_present = ppc4xx_rng_data_present,
--	.data_read = ppc4xx_rng_data_read,
--};
--
--static int ppc4xx_rng_probe(struct platform_device *dev)
--{
--	void __iomem *rng_regs;
--	int err = 0;
--
--	rng_regs = of_iomap(dev->dev.of_node, 0);
--	if (!rng_regs)
--		return -ENODEV;
--
--	err = ppc4xx_rng_enable(1);
--	if (err)
--		return err;
--
--	out_le32(rng_regs + PPC4XX_TRNG_CTRL, PPC4XX_TRNG_CTRL_DALM);
--	ppc4xx_rng.priv = (unsigned long) rng_regs;
--
--	err = hwrng_register(&ppc4xx_rng);
--
--	return err;
--}
--
--static int ppc4xx_rng_remove(struct platform_device *dev)
--{
--	void __iomem *rng_regs = (void __iomem *) ppc4xx_rng.priv;
--
--	hwrng_unregister(&ppc4xx_rng);
--	ppc4xx_rng_enable(0);
--	iounmap(rng_regs);
--
--	return 0;
--}
--
--static const struct of_device_id ppc4xx_rng_match[] = {
--	{ .compatible = "ppc4xx-rng", },
--	{ .compatible = "amcc,ppc460ex-rng", },
--	{ .compatible = "amcc,ppc440epx-rng", },
--	{},
--};
--MODULE_DEVICE_TABLE(of, ppc4xx_rng_match);
--
--static struct platform_driver ppc4xx_rng_driver = {
--	.driver = {
--		.name = MODULE_NAME,
--		.of_match_table = ppc4xx_rng_match,
--	},
--	.probe = ppc4xx_rng_probe,
--	.remove = ppc4xx_rng_remove,
--};
--
--module_platform_driver(ppc4xx_rng_driver);
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Josh Boyer <jwboyer at linux.vnet.ibm.com>");
--MODULE_DESCRIPTION("HW RNG driver for PPC 4xx processors");
---- a/drivers/crypto/Kconfig
-+++ b/drivers/crypto/Kconfig
-@@ -277,6 +277,14 @@ config CRYPTO_DEV_PPC4XX
- 	help
- 	  This option allows you to have support for AMCC crypto acceleration.
- 
-+config HW_RANDOM_PPC4XX
-+	bool "PowerPC 4xx generic true random number generator support"
-+	depends on CRYPTO_DEV_PPC4XX && HW_RANDOM
-+	default y
-+	---help---
-+	 This option provides the kernel-side support for the TRNG hardware
-+	 found in the security function of some PowerPC 4xx SoCs.
-+
- config CRYPTO_DEV_OMAP_SHAM
- 	tristate "Support for OMAP MD5/SHA1/SHA2 hw accelerator"
- 	depends on ARCH_OMAP2PLUS
---- a/drivers/crypto/amcc/Makefile
-+++ b/drivers/crypto/amcc/Makefile
-@@ -1,2 +1,3 @@
- obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += crypto4xx.o
- crypto4xx-y :=  crypto4xx_core.o crypto4xx_alg.o crypto4xx_sa.o
-+crypto4xx-$(CONFIG_HW_RANDOM_PPC4XX) += crypto4xx_trng.o
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -40,6 +40,7 @@
- #include "crypto4xx_reg_def.h"
- #include "crypto4xx_core.h"
- #include "crypto4xx_sa.h"
-+#include "crypto4xx_trng.h"
- 
- #define PPC4XX_SEC_VERSION_STR			"0.5"
- 
-@@ -1221,6 +1222,7 @@ static int crypto4xx_probe(struct platfo
- 	if (rc)
- 		goto err_start_dev;
- 
-+	ppc4xx_trng_probe(core_dev);
- 	return 0;
- 
- err_start_dev:
-@@ -1248,6 +1250,8 @@ static int crypto4xx_remove(struct platf
- 	struct device *dev = &ofdev->dev;
- 	struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
- 
-+	ppc4xx_trng_remove(core_dev);
-+
- 	free_irq(core_dev->irq, dev);
- 	irq_dispose_mapping(core_dev->irq);
- 
-@@ -1268,7 +1272,7 @@ MODULE_DEVICE_TABLE(of, crypto4xx_match)
- 
- static struct platform_driver crypto4xx_driver = {
- 	.driver = {
--		.name = "crypto4xx",
-+		.name = MODULE_NAME,
- 		.of_match_table = crypto4xx_match,
- 	},
- 	.probe		= crypto4xx_probe,
-@@ -1280,4 +1284,3 @@ module_platform_driver(crypto4xx_driver)
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("James Hsiao <jhsiao at amcc.com>");
- MODULE_DESCRIPTION("Driver for AMCC PPC4xx crypto accelerator");
--
---- a/drivers/crypto/amcc/crypto4xx_core.h
-+++ b/drivers/crypto/amcc/crypto4xx_core.h
-@@ -24,6 +24,8 @@
- 
- #include <crypto/internal/hash.h>
- 
-+#define MODULE_NAME "crypto4xx"
-+
- #define PPC460SX_SDR0_SRST                      0x201
- #define PPC405EX_SDR0_SRST                      0x200
- #define PPC460EX_SDR0_SRST                      0x201
-@@ -72,6 +74,7 @@ struct crypto4xx_device {
- 	char *name;
- 	u64  ce_phy_address;
- 	void __iomem *ce_base;
-+	void __iomem *trng_base;
- 
- 	void *pdr;			/* base address of packet
- 					descriptor ring */
-@@ -106,6 +109,7 @@ struct crypto4xx_core_device {
- 	struct device *device;
- 	struct platform_device *ofdev;
- 	struct crypto4xx_device *dev;
-+	struct hwrng *trng;
- 	u32 int_status;
- 	u32 irq;
- 	struct tasklet_struct tasklet;
---- a/drivers/crypto/amcc/crypto4xx_reg_def.h
-+++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
-@@ -125,6 +125,7 @@
- #define PPC4XX_INTERRUPT_CLR			0x3ffff
- #define PPC4XX_PRNG_CTRL_AUTO_EN		0x3
- #define PPC4XX_DC_3DES_EN			1
-+#define PPC4XX_TRNG_EN				0x00020000
- #define PPC4XX_INT_DESCR_CNT			4
- #define PPC4XX_INT_TIMEOUT_CNT			0
- #define PPC4XX_INT_CFG				1
---- /dev/null
-+++ b/drivers/crypto/amcc/crypto4xx_trng.c
-@@ -0,0 +1,131 @@
-+/*
-+ * Generic PowerPC 44x RNG driver
-+ *
-+ * Copyright 2011 IBM Corporation
-+ *
-+ * 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 of the License.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/interrupt.h>
-+#include <linux/platform_device.h>
-+#include <linux/hw_random.h>
-+#include <linux/delay.h>
-+#include <linux/of_address.h>
-+#include <linux/of_platform.h>
-+#include <linux/io.h>
-+
-+#include "crypto4xx_core.h"
-+#include "crypto4xx_trng.h"
-+#include "crypto4xx_reg_def.h"
-+
-+#define PPC4XX_TRNG_CTRL	0x0008
-+#define PPC4XX_TRNG_CTRL_DALM	0x20
-+#define PPC4XX_TRNG_STAT	0x0004
-+#define PPC4XX_TRNG_STAT_B	0x1
-+#define PPC4XX_TRNG_DATA	0x0000
-+
-+static int ppc4xx_trng_data_present(struct hwrng *rng, int wait)
-+{
-+	struct crypto4xx_device *dev = (void *)rng->priv;
-+	int busy, i, present = 0;
-+
-+	for (i = 0; i < 20; i++) {
-+		busy = (in_le32(dev->trng_base + PPC4XX_TRNG_STAT) &
-+			PPC4XX_TRNG_STAT_B);
-+		if (!busy || !wait) {
-+			present = 1;
-+			break;
-+		}
-+		udelay(10);
-+	}
-+	return present;
-+}
-+
-+static int ppc4xx_trng_data_read(struct hwrng *rng, u32 *data)
-+{
-+	struct crypto4xx_device *dev = (void *)rng->priv;
-+	*data = in_le32(dev->trng_base + PPC4XX_TRNG_DATA);
-+	return 4;
-+}
-+
-+static void ppc4xx_trng_enable(struct crypto4xx_device *dev, bool enable)
-+{
-+	u32 device_ctrl;
-+
-+	device_ctrl = readl(dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
-+	if (enable)
-+		device_ctrl |= PPC4XX_TRNG_EN;
-+	else
-+		device_ctrl &= ~PPC4XX_TRNG_EN;
-+	writel(device_ctrl, dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
-+}
-+
-+static const struct of_device_id ppc4xx_trng_match[] = {
-+	{ .compatible = "ppc4xx-rng", },
-+	{ .compatible = "amcc,ppc460ex-rng", },
-+	{ .compatible = "amcc,ppc440epx-rng", },
-+	{},
-+};
-+
-+void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev)
-+{
-+	struct crypto4xx_device *dev = core_dev->dev;
-+	struct device_node *trng = NULL;
-+	struct hwrng *rng = NULL;
-+	int err;
-+
-+	/* Find the TRNG device node and map it */
-+	trng = of_find_matching_node(NULL, ppc4xx_trng_match);
-+	if (!trng || !of_device_is_available(trng))
-+		return;
-+
-+	dev->trng_base = of_iomap(trng, 0);
-+	of_node_put(trng);
-+	if (!dev->trng_base)
-+		goto err_out;
-+
-+	rng = kzalloc(sizeof(*rng), GFP_KERNEL);
-+	if (!rng)
-+		goto err_out;
-+
-+	rng->name = MODULE_NAME;
-+	rng->data_present = ppc4xx_trng_data_present;
-+	rng->data_read = ppc4xx_trng_data_read;
-+	rng->priv = (unsigned long) dev;
-+	core_dev->trng = rng;
-+	ppc4xx_trng_enable(dev, true);
-+	out_le32(dev->trng_base + PPC4XX_TRNG_CTRL, PPC4XX_TRNG_CTRL_DALM);
-+	err = devm_hwrng_register(core_dev->device, core_dev->trng);
-+	if (err) {
-+		ppc4xx_trng_enable(dev, false);
-+		dev_err(core_dev->device, "failed to register hwrng (%d).\n",
-+			err);
-+		goto err_out;
-+	}
-+	return;
-+
-+err_out:
-+	of_node_put(trng);
-+	iounmap(dev->trng_base);
-+	kfree(rng);
-+	dev->trng_base = NULL;
-+	core_dev->trng = NULL;
-+}
-+
-+void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev)
-+{
-+	if (core_dev && core_dev->trng) {
-+		struct crypto4xx_device *dev = core_dev->dev;
-+
-+		devm_hwrng_unregister(core_dev->device, core_dev->trng);
-+		ppc4xx_trng_enable(dev, false);
-+		iounmap(dev->trng_base);
-+		kfree(core_dev->trng);
-+	}
-+}
-+
-+MODULE_ALIAS("ppc4xx_rng");
---- /dev/null
-+++ b/drivers/crypto/amcc/crypto4xx_trng.h
-@@ -0,0 +1,34 @@
-+/**
-+ * AMCC SoC PPC4xx Crypto Driver
-+ *
-+ * Copyright (c) 2008 Applied Micro Circuits Corporation.
-+ * All rights reserved. James Hsiao <jhsiao at amcc.com>
-+ *
-+ * 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; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * This file defines the security context
-+ * associate format.
-+ */
-+
-+#ifndef __CRYPTO4XX_TRNG_H__
-+#define __CRYPTO4XX_TRNG_H__
-+
-+#ifdef CONFIG_HW_RANDOM_PPC4XX
-+void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev);
-+void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev);
-+#else
-+static inline void ppc4xx_trng_probe(
-+	struct crypto4xx_device *dev __maybe_unused) { }
-+static inline void ppc4xx_trng_remove(
-+	struct crypto4xx_device *dev __maybe_unused) { }
-+#endif
-+
-+#endif
diff --git a/target/linux/apm821xx/patches-4.4/002-powerpc_ibm_phy_add_ar8035.patch b/target/linux/apm821xx/patches-4.4/002-powerpc_ibm_phy_add_ar8035.patch
deleted file mode 100644
index f885167..0000000
--- a/target/linux/apm821xx/patches-4.4/002-powerpc_ibm_phy_add_ar8035.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 0c13957a43a90b1522eb616f3c9967ec44e4da1d Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey at googlemail.com>
-Date: Tue, 3 May 2016 13:58:24 +0200
-Subject: [PATCH] drivers: net: emac: add Atheros AR8035 phy initialization
- code
-To: netdev at vger.kernel.org
-
-This patch adds the phy initialization code for Qualcomm
-Atheros AR8035 phy. This configuration is found in the
-Cisco Meraki MR24.
-
-Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
----
- drivers/net/ethernet/ibm/emac/phy.c | 26 ++++++++++++++++++++++++++
- 1 file changed, 26 insertions(+)
-
---- a/drivers/net/ethernet/ibm/emac/phy.c
-+++ b/drivers/net/ethernet/ibm/emac/phy.c
-@@ -470,12 +470,38 @@ static struct mii_phy_def m88e1112_phy_d
- 	.ops		= &m88e1112_phy_ops,
- };
- 
-+static int ar8035_init(struct mii_phy *phy)
-+{
-+	phy_write(phy, 0x1d, 0x5); /* Address debug register 5 */
-+	phy_write(phy, 0x1e, 0x2d47); /* Value copied from u-boot */
-+	phy_write(phy, 0x1d, 0xb);    /* Address hib ctrl */
-+	phy_write(phy, 0x1e, 0xbc20); /* Value copied from u-boot */
-+
-+	return 0;
-+}
-+
-+static struct mii_phy_ops ar8035_phy_ops = {
-+	.init		= ar8035_init,
-+	.setup_aneg	= genmii_setup_aneg,
-+	.setup_forced	= genmii_setup_forced,
-+	.poll_link	= genmii_poll_link,
-+	.read_link	= genmii_read_link,
-+};
-+
-+static struct mii_phy_def ar8035_phy_def = {
-+	.phy_id		= 0x004dd070,
-+	.phy_id_mask	= 0xfffffff0,
-+	.name		= "Atheros 8035 Gigabit Ethernet",
-+	.ops		= &ar8035_phy_ops,
-+};
-+
- static struct mii_phy_def *mii_phy_table[] = {
- 	&et1011c_phy_def,
- 	&cis8201_phy_def,
- 	&bcm5248_phy_def,
- 	&m88e1111_phy_def,
- 	&m88e1112_phy_def,
-+	&ar8035_phy_def,
- 	&genmii_phy_def,
- 	NULL
- };
diff --git a/target/linux/apm821xx/patches-4.4/010-dmaengine-Add-transfer-termination-synchronization-s.patch b/target/linux/apm821xx/patches-4.4/010-dmaengine-Add-transfer-termination-synchronization-s.patch
deleted file mode 100644
index 89bdd49..0000000
--- a/target/linux/apm821xx/patches-4.4/010-dmaengine-Add-transfer-termination-synchronization-s.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From 7bd903c5ca47fde5ad52370a47776491813c772e Mon Sep 17 00:00:00 2001
-From: Peter Ujfalusi <peter.ujfalusi at ti.com>
-Date: Mon, 14 Dec 2015 22:47:39 +0200
-Subject: [PATCH 1/3] dmaengine: core: Move and merge the code paths using
- private_candidate
-
-Channel matching with private_candidate() is used in two paths, the error
-checking is slightly different in them and they are duplicating code also.
-Move the code under find_candidate() to provide consistent execution and
-going to allow us to reuse this mode of channel lookup later.
-
-Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
-Reviewed-by: Andy Shevchenko <andy.shevchenko at gmail.com>
-Reviewed-by: Arnd Bergmann <arnd at arndb.de>
-Signed-off-by: Vinod Koul <vinod.koul at intel.com>
----
- drivers/dma/dmaengine.c | 81 +++++++++++++++++++++++++------------------------
- 1 file changed, 42 insertions(+), 39 deletions(-)
-
---- a/drivers/dma/dmaengine.c
-+++ b/drivers/dma/dmaengine.c
-@@ -542,6 +542,42 @@ static struct dma_chan *private_candidat
- 	return NULL;
- }
- 
-+static struct dma_chan *find_candidate(struct dma_device *device,
-+				       const dma_cap_mask_t *mask,
-+				       dma_filter_fn fn, void *fn_param)
-+{
-+	struct dma_chan *chan = private_candidate(mask, device, fn, fn_param);
-+	int err;
-+
-+	if (chan) {
-+		/* Found a suitable channel, try to grab, prep, and return it.
-+		 * We first set DMA_PRIVATE to disable balance_ref_count as this
-+		 * channel will not be published in the general-purpose
-+		 * allocator
-+		 */
-+		dma_cap_set(DMA_PRIVATE, device->cap_mask);
-+		device->privatecnt++;
-+		err = dma_chan_get(chan);
-+
-+		if (err) {
-+			if (err == -ENODEV) {
-+				pr_debug("%s: %s module removed\n", __func__,
-+					 dma_chan_name(chan));
-+				list_del_rcu(&device->global_node);
-+			} else
-+				pr_debug("%s: failed to get %s: (%d)\n",
-+					 __func__, dma_chan_name(chan), err);
-+
-+			if (--device->privatecnt == 0)
-+				dma_cap_clear(DMA_PRIVATE, device->cap_mask);
-+
-+			chan = ERR_PTR(err);
-+		}
-+	}
-+
-+	return chan ? chan : ERR_PTR(-EPROBE_DEFER);
-+}
-+
- /**
-  * dma_get_slave_channel - try to get specific channel exclusively
-  * @chan: target channel
-@@ -580,7 +616,6 @@ struct dma_chan *dma_get_any_slave_chann
- {
- 	dma_cap_mask_t mask;
- 	struct dma_chan *chan;
--	int err;
- 
- 	dma_cap_zero(mask);
- 	dma_cap_set(DMA_SLAVE, mask);
-@@ -588,23 +623,11 @@ struct dma_chan *dma_get_any_slave_chann
- 	/* lock against __dma_request_channel */
- 	mutex_lock(&dma_list_mutex);
- 
--	chan = private_candidate(&mask, device, NULL, NULL);
--	if (chan) {
--		dma_cap_set(DMA_PRIVATE, device->cap_mask);
--		device->privatecnt++;
--		err = dma_chan_get(chan);
--		if (err) {
--			pr_debug("%s: failed to get %s: (%d)\n",
--				__func__, dma_chan_name(chan), err);
--			chan = NULL;
--			if (--device->privatecnt == 0)
--				dma_cap_clear(DMA_PRIVATE, device->cap_mask);
--		}
--	}
-+	chan = find_candidate(device, &mask, NULL, NULL);
- 
- 	mutex_unlock(&dma_list_mutex);
- 
--	return chan;
-+	return IS_ERR(chan) ? NULL : chan;
- }
- EXPORT_SYMBOL_GPL(dma_get_any_slave_channel);
- 
-@@ -621,35 +644,15 @@ struct dma_chan *__dma_request_channel(c
- {
- 	struct dma_device *device, *_d;
- 	struct dma_chan *chan = NULL;
--	int err;
- 
- 	/* Find a channel */
- 	mutex_lock(&dma_list_mutex);
- 	list_for_each_entry_safe(device, _d, &dma_device_list, global_node) {
--		chan = private_candidate(mask, device, fn, fn_param);
--		if (chan) {
--			/* Found a suitable channel, try to grab, prep, and
--			 * return it.  We first set DMA_PRIVATE to disable
--			 * balance_ref_count as this channel will not be
--			 * published in the general-purpose allocator
--			 */
--			dma_cap_set(DMA_PRIVATE, device->cap_mask);
--			device->privatecnt++;
--			err = dma_chan_get(chan);
-+		chan = find_candidate(device, mask, fn, fn_param);
-+		if (!IS_ERR(chan))
-+			break;
- 
--			if (err == -ENODEV) {
--				pr_debug("%s: %s module removed\n",
--					 __func__, dma_chan_name(chan));
--				list_del_rcu(&device->global_node);
--			} else if (err)
--				pr_debug("%s: failed to get %s: (%d)\n",
--					 __func__, dma_chan_name(chan), err);
--			else
--				break;
--			if (--device->privatecnt == 0)
--				dma_cap_clear(DMA_PRIVATE, device->cap_mask);
--			chan = NULL;
--		}
-+		chan = NULL;
- 	}
- 	mutex_unlock(&dma_list_mutex);
- 
diff --git a/target/linux/apm821xx/patches-4.4/011-dmaengine-core-Introduce-new-universal-API-to-reques.patch b/target/linux/apm821xx/patches-4.4/011-dmaengine-core-Introduce-new-universal-API-to-reques.patch
deleted file mode 100644
index 7a0e26f..0000000
--- a/target/linux/apm821xx/patches-4.4/011-dmaengine-core-Introduce-new-universal-API-to-reques.patch
+++ /dev/null
@@ -1,335 +0,0 @@
-From a8135d0d79e9d0ad3a4ff494fceeaae838becf38 Mon Sep 17 00:00:00 2001
-From: Peter Ujfalusi <peter.ujfalusi at ti.com>
-Date: Mon, 14 Dec 2015 22:47:40 +0200
-Subject: [PATCH 2/3] dmaengine: core: Introduce new, universal API to request
- a channel
-
-The two API function can cover most, if not all current APIs used to
-request a channel. With minimal effort dmaengine drivers, platforms and
-dmaengine user drivers can be converted to use the two function.
-
-struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
-
-To request any channel matching with the requested capabilities, can be
-used to request channel for memcpy, memset, xor, etc where no hardware
-synchronization is needed.
-
-struct dma_chan *dma_request_chan(struct device *dev, const char *name);
-To request a slave channel. The dma_request_chan() will try to find the
-channel via DT, ACPI or in case if the kernel booted in non DT/ACPI mode
-it will use a filter lookup table and retrieves the needed information from
-the dma_slave_map provided by the DMA drivers.
-This legacy mode needs changes in platform code, in dmaengine drivers and
-finally the dmaengine user drivers can be converted:
-
-For each dmaengine driver an array of DMA device, slave and the parameter
-for the filter function needs to be added:
-
-static const struct dma_slave_map da830_edma_map[] = {
-	{ "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
-	{ "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
-	{ "davinci-mcasp.1", "rx", EDMA_FILTER_PARAM(0, 2) },
-	{ "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 3) },
-	{ "davinci-mcasp.2", "rx", EDMA_FILTER_PARAM(0, 4) },
-	{ "davinci-mcasp.2", "tx", EDMA_FILTER_PARAM(0, 5) },
-	{ "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
-	{ "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
-	{ "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
-	{ "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
-	{ "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
-	{ "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
-};
-
-This information is going to be needed by the dmaengine driver, so
-modification to the platform_data is needed, and the driver map should be
-added to the pdata of the DMA driver:
-
-da8xx_edma0_pdata.slave_map = da830_edma_map;
-da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da830_edma_map);
-
-The DMA driver then needs to configure the needed device -> filter_fn
-mapping before it registers with dma_async_device_register() :
-
-ecc->dma_slave.filter_map.map = info->slave_map;
-ecc->dma_slave.filter_map.mapcnt = info->slavecnt;
-ecc->dma_slave.filter_map.fn = edma_filter_fn;
-
-When neither DT or ACPI lookup is available the dma_request_chan() will
-try to match the requester's device name with the filter_map's list of
-device names, when a match found it will use the information from the
-dma_slave_map to get the channel with the dma_get_channel() internal
-function.
-
-Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
-Reviewed-by: Arnd Bergmann <arnd at arndb.de>
-Signed-off-by: Vinod Koul <vinod.koul at intel.com>
----
- Documentation/dmaengine/client.txt | 23 +++-------
- drivers/dma/dmaengine.c            | 89 +++++++++++++++++++++++++++++++++-----
- include/linux/dmaengine.h          | 51 +++++++++++++++++++---
- 3 files changed, 127 insertions(+), 36 deletions(-)
-
---- a/Documentation/dmaengine/client.txt
-+++ b/Documentation/dmaengine/client.txt
-@@ -22,25 +22,14 @@ The slave DMA usage consists of followin
-    Channel allocation is slightly different in the slave DMA context,
-    client drivers typically need a channel from a particular DMA
-    controller only and even in some cases a specific channel is desired.
--   To request a channel dma_request_channel() API is used.
-+   To request a channel dma_request_chan() API is used.
- 
-    Interface:
--	struct dma_chan *dma_request_channel(dma_cap_mask_t mask,
--			dma_filter_fn filter_fn,
--			void *filter_param);
--   where dma_filter_fn is defined as:
--	typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
-+	struct dma_chan *dma_request_chan(struct device *dev, const char *name);
- 
--   The 'filter_fn' parameter is optional, but highly recommended for
--   slave and cyclic channels as they typically need to obtain a specific
--   DMA channel.
--
--   When the optional 'filter_fn' parameter is NULL, dma_request_channel()
--   simply returns the first channel that satisfies the capability mask.
--
--   Otherwise, the 'filter_fn' routine will be called once for each free
--   channel which has a capability in 'mask'.  'filter_fn' is expected to
--   return 'true' when the desired DMA channel is found.
-+   Which will find and return the 'name' DMA channel associated with the 'dev'
-+   device. The association is done via DT, ACPI or board file based
-+   dma_slave_map matching table.
- 
-    A channel allocated via this interface is exclusive to the caller,
-    until dma_release_channel() is called.
---- a/drivers/dma/dmaengine.c
-+++ b/drivers/dma/dmaengine.c
-@@ -43,6 +43,7 @@
- 
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
- 
-+#include <linux/platform_device.h>
- #include <linux/dma-mapping.h>
- #include <linux/init.h>
- #include <linux/module.h>
-@@ -665,27 +666,73 @@ struct dma_chan *__dma_request_channel(c
- }
- EXPORT_SYMBOL_GPL(__dma_request_channel);
- 
-+static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
-+						    const char *name,
-+						    struct device *dev)
-+{
-+	int i;
-+
-+	if (!device->filter.mapcnt)
-+		return NULL;
-+
-+	for (i = 0; i < device->filter.mapcnt; i++) {
-+		const struct dma_slave_map *map = &device->filter.map[i];
-+
-+		if (!strcmp(map->devname, dev_name(dev)) &&
-+		    !strcmp(map->slave, name))
-+			return map;
-+	}
-+
-+	return NULL;
-+}
-+
- /**
-- * dma_request_slave_channel_reason - try to allocate an exclusive slave channel
-+ * dma_request_chan - try to allocate an exclusive slave channel
-  * @dev:	pointer to client device structure
-  * @name:	slave channel name
-  *
-  * Returns pointer to appropriate DMA channel on success or an error pointer.
-  */
--struct dma_chan *dma_request_slave_channel_reason(struct device *dev,
--						  const char *name)
-+struct dma_chan *dma_request_chan(struct device *dev, const char *name)
- {
-+	struct dma_device *d, *_d;
-+	struct dma_chan *chan = NULL;
-+
- 	/* If device-tree is present get slave info from here */
- 	if (dev->of_node)
--		return of_dma_request_slave_channel(dev->of_node, name);
-+		chan = of_dma_request_slave_channel(dev->of_node, name);
- 
- 	/* If device was enumerated by ACPI get slave info from here */
--	if (ACPI_HANDLE(dev))
--		return acpi_dma_request_slave_chan_by_name(dev, name);
-+	if (has_acpi_companion(dev) && !chan)
-+		chan = acpi_dma_request_slave_chan_by_name(dev, name);
-+
-+	if (chan) {
-+		/* Valid channel found or requester need to be deferred */
-+		if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER)
-+			return chan;
-+	}
-+
-+	/* Try to find the channel via the DMA filter map(s) */
-+	mutex_lock(&dma_list_mutex);
-+	list_for_each_entry_safe(d, _d, &dma_device_list, global_node) {
-+		dma_cap_mask_t mask;
-+		const struct dma_slave_map *map = dma_filter_match(d, name, dev);
-+
-+		if (!map)
-+			continue;
-+
-+		dma_cap_zero(mask);
-+		dma_cap_set(DMA_SLAVE, mask);
- 
--	return ERR_PTR(-ENODEV);
-+		chan = find_candidate(d, &mask, d->filter.fn, map->param);
-+		if (!IS_ERR(chan))
-+			break;
-+	}
-+	mutex_unlock(&dma_list_mutex);
-+
-+	return chan ? chan : ERR_PTR(-EPROBE_DEFER);
- }
--EXPORT_SYMBOL_GPL(dma_request_slave_channel_reason);
-+EXPORT_SYMBOL_GPL(dma_request_chan);
- 
- /**
-  * dma_request_slave_channel - try to allocate an exclusive slave channel
-@@ -697,17 +744,35 @@ EXPORT_SYMBOL_GPL(dma_request_slave_chan
- struct dma_chan *dma_request_slave_channel(struct device *dev,
- 					   const char *name)
- {
--	struct dma_chan *ch = dma_request_slave_channel_reason(dev, name);
-+	struct dma_chan *ch = dma_request_chan(dev, name);
- 	if (IS_ERR(ch))
- 		return NULL;
- 
--	dma_cap_set(DMA_PRIVATE, ch->device->cap_mask);
--	ch->device->privatecnt++;
--
- 	return ch;
- }
- EXPORT_SYMBOL_GPL(dma_request_slave_channel);
- 
-+/**
-+ * dma_request_chan_by_mask - allocate a channel satisfying certain capabilities
-+ * @mask: capabilities that the channel must satisfy
-+ *
-+ * Returns pointer to appropriate DMA channel on success or an error pointer.
-+ */
-+struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask)
-+{
-+	struct dma_chan *chan;
-+
-+	if (!mask)
-+		return ERR_PTR(-ENODEV);
-+
-+	chan = __dma_request_channel(mask, NULL, NULL);
-+	if (!chan)
-+		chan = ERR_PTR(-ENODEV);
-+
-+	return chan;
-+}
-+EXPORT_SYMBOL_GPL(dma_request_chan_by_mask);
-+
- void dma_release_channel(struct dma_chan *chan)
- {
- 	mutex_lock(&dma_list_mutex);
---- a/include/linux/dmaengine.h
-+++ b/include/linux/dmaengine.h
-@@ -607,11 +607,38 @@ enum dmaengine_alignment {
- };
- 
- /**
-+ * struct dma_slave_map - associates slave device and it's slave channel with
-+ * parameter to be used by a filter function
-+ * @devname: name of the device
-+ * @slave: slave channel name
-+ * @param: opaque parameter to pass to struct dma_filter.fn
-+ */
-+struct dma_slave_map {
-+	const char *devname;
-+	const char *slave;
-+	void *param;
-+};
-+
-+/**
-+ * struct dma_filter - information for slave device/channel to filter_fn/param
-+ * mapping
-+ * @fn: filter function callback
-+ * @mapcnt: number of slave device/channel in the map
-+ * @map: array of channel to filter mapping data
-+ */
-+struct dma_filter {
-+	dma_filter_fn fn;
-+	int mapcnt;
-+	const struct dma_slave_map *map;
-+};
-+
-+/**
-  * struct dma_device - info on the entity supplying DMA services
-  * @chancnt: how many DMA channels are supported
-  * @privatecnt: how many DMA channels are requested by dma_request_channel
-  * @channels: the list of struct dma_chan
-  * @global_node: list_head for global dma_device_list
-+ * @filter: information for device/slave to filter function/param mapping
-  * @cap_mask: one or more dma_capability flags
-  * @max_xor: maximum number of xor sources, 0 if no capability
-  * @max_pq: maximum number of PQ sources and PQ-continue capability
-@@ -666,6 +693,7 @@ struct dma_device {
- 	unsigned int privatecnt;
- 	struct list_head channels;
- 	struct list_head global_node;
-+	struct dma_filter filter;
- 	dma_cap_mask_t  cap_mask;
- 	unsigned short max_xor;
- 	unsigned short max_pq;
-@@ -1140,9 +1168,11 @@ enum dma_status dma_wait_for_async_tx(st
- void dma_issue_pending_all(void);
- struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
- 					dma_filter_fn fn, void *fn_param);
--struct dma_chan *dma_request_slave_channel_reason(struct device *dev,
--						  const char *name);
- struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
-+
-+struct dma_chan *dma_request_chan(struct device *dev, const char *name);
-+struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
-+
- void dma_release_channel(struct dma_chan *chan);
- int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps);
- #else
-@@ -1166,16 +1196,21 @@ static inline struct dma_chan *__dma_req
- {
- 	return NULL;
- }
--static inline struct dma_chan *dma_request_slave_channel_reason(
--					struct device *dev, const char *name)
--{
--	return ERR_PTR(-ENODEV);
--}
- static inline struct dma_chan *dma_request_slave_channel(struct device *dev,
- 							 const char *name)
- {
- 	return NULL;
- }
-+static inline struct dma_chan *dma_request_chan(struct device *dev,
-+						const char *name)
-+{
-+	return ERR_PTR(-ENODEV);
-+}
-+static inline struct dma_chan *dma_request_chan_by_mask(
-+						const dma_cap_mask_t *mask)
-+{
-+	return ERR_PTR(-ENODEV);
-+}
- static inline void dma_release_channel(struct dma_chan *chan)
- {
- }
-@@ -1186,6 +1221,8 @@ static inline int dma_get_slave_caps(str
- }
- #endif
- 
-+#define dma_request_slave_channel_reason(dev, name) dma_request_chan(dev, name)
-+
- static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
- {
- 	struct dma_slave_caps caps;
diff --git a/target/linux/apm821xx/patches-4.4/012-dmaengine-Add-transfer-termination-synchronization-s.patch b/target/linux/apm821xx/patches-4.4/012-dmaengine-Add-transfer-termination-synchronization-s.patch
deleted file mode 100644
index 21efb04..0000000
--- a/target/linux/apm821xx/patches-4.4/012-dmaengine-Add-transfer-termination-synchronization-s.patch
+++ /dev/null
@@ -1,282 +0,0 @@
-From b36f09c3c441a6e59eab9315032e7d546571de3f Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars at metafoo.de>
-Date: Tue, 20 Oct 2015 11:46:28 +0200
-Subject: [PATCH] dmaengine: Add transfer termination synchronization support
-
-The DMAengine API has a long standing race condition that is inherent to
-the API itself. Calling dmaengine_terminate_all() is supposed to stop and
-abort any pending or active transfers that have previously been submitted.
-Unfortunately it is possible that this operation races against a currently
-running (or with some drivers also scheduled) completion callback.
-
-Since the API allows dmaengine_terminate_all() to be called from atomic
-context as well as from within a completion callback it is not possible to
-synchronize to the execution of the completion callback from within
-dmaengine_terminate_all() itself.
-
-This means that a user of the DMAengine API does not know when it is safe
-to free resources used in the completion callback, which can result in a
-use-after-free race condition.
-
-This patch addresses the issue by introducing an explicit synchronization
-primitive to the DMAengine API called dmaengine_synchronize().
-
-The existing dmaengine_terminate_all() is deprecated in favor of
-dmaengine_terminate_sync() and dmaengine_terminate_async(). The former
-aborts all pending and active transfers and synchronizes to the current
-context, meaning it will wait until all running completion callbacks have
-finished. This means it is only possible to call this function from
-non-atomic context. The later function does not synchronize, but can still
-be used in atomic context or from within a complete callback. It has to be
-followed up by dmaengine_synchronize() before a client can free the
-resources used in a completion callback.
-
-In addition to this the semantics of the device_terminate_all() callback
-are slightly relaxed by this patch. It is now OK for a driver to only
-schedule the termination of the active transfer, but does not necessarily
-have to wait until the DMA controller has completely stopped. The driver
-must ensure though that the controller has stopped and no longer accesses
-any memory when the device_synchronize() callback returns.
-
-This was in part done since most drivers do not pay attention to this
-anyway at the moment and to emphasize that this needs to be done when the
-device_synchronize() callback is implemented. But it also helps with
-implementing support for devices where stopping the controller can require
-operations that may sleep.
-
-Signed-off-by: Lars-Peter Clausen <lars at metafoo.de>
-Signed-off-by: Vinod Koul <vinod.koul at intel.com>
----
- Documentation/dmaengine/client.txt   | 38 ++++++++++++++-
- Documentation/dmaengine/provider.txt | 20 +++++++-
- drivers/dma/dmaengine.c              |  5 +-
- include/linux/dmaengine.h            | 90 ++++++++++++++++++++++++++++++++++++
- 4 files changed, 148 insertions(+), 5 deletions(-)
-
---- a/Documentation/dmaengine/client.txt
-+++ b/Documentation/dmaengine/client.txt
-@@ -117,7 +117,7 @@ The slave DMA usage consists of followin
- 	transaction.
- 
- 	For cyclic DMA, a callback function may wish to terminate the
--	DMA via dmaengine_terminate_all().
-+	DMA via dmaengine_terminate_async().
- 
- 	Therefore, it is important that DMA engine drivers drop any
- 	locks before calling the callback function which may cause a
-@@ -155,12 +155,29 @@ The slave DMA usage consists of followin
- 
- Further APIs:
- 
--1. int dmaengine_terminate_all(struct dma_chan *chan)
-+1. int dmaengine_terminate_sync(struct dma_chan *chan)
-+   int dmaengine_terminate_async(struct dma_chan *chan)
-+   int dmaengine_terminate_all(struct dma_chan *chan) /* DEPRECATED */
- 
-    This causes all activity for the DMA channel to be stopped, and may
-    discard data in the DMA FIFO which hasn't been fully transferred.
-    No callback functions will be called for any incomplete transfers.
- 
-+   Two variants of this function are available.
-+
-+   dmaengine_terminate_async() might not wait until the DMA has been fully
-+   stopped or until any running complete callbacks have finished. But it is
-+   possible to call dmaengine_terminate_async() from atomic context or from
-+   within a complete callback. dmaengine_synchronize() must be called before it
-+   is safe to free the memory accessed by the DMA transfer or free resources
-+   accessed from within the complete callback.
-+
-+   dmaengine_terminate_sync() will wait for the transfer and any running
-+   complete callbacks to finish before it returns. But the function must not be
-+   called from atomic context or from within a complete callback.
-+
-+   dmaengine_terminate_all() is deprecated and should not be used in new code.
-+
- 2. int dmaengine_pause(struct dma_chan *chan)
- 
-    This pauses activity on the DMA channel without data loss.
-@@ -186,3 +203,20 @@ Further APIs:
- 	a running DMA channel.  It is recommended that DMA engine users
- 	pause or stop (via dmaengine_terminate_all()) the channel before
- 	using this API.
-+
-+5. void dmaengine_synchronize(struct dma_chan *chan)
-+
-+  Synchronize the termination of the DMA channel to the current context.
-+
-+  This function should be used after dmaengine_terminate_async() to synchronize
-+  the termination of the DMA channel to the current context. The function will
-+  wait for the transfer and any running complete callbacks to finish before it
-+  returns.
-+
-+  If dmaengine_terminate_async() is used to stop the DMA channel this function
-+  must be called before it is safe to free memory accessed by previously
-+  submitted descriptors or to free any resources accessed within the complete
-+  callback of previously submitted descriptors.
-+
-+  The behavior of this function is undefined if dma_async_issue_pending() has
-+  been called between dmaengine_terminate_async() and this function.
---- a/Documentation/dmaengine/provider.txt
-+++ b/Documentation/dmaengine/provider.txt
-@@ -327,8 +327,24 @@ supported.
- 
-    * device_terminate_all
-      - Aborts all the pending and ongoing transfers on the channel
--     - This command should operate synchronously on the channel,
--       terminating right away all the channels
-+     - For aborted transfers the complete callback should not be called
-+     - Can be called from atomic context or from within a complete
-+       callback of a descriptor. Must not sleep. Drivers must be able
-+       to handle this correctly.
-+     - Termination may be asynchronous. The driver does not have to
-+       wait until the currently active transfer has completely stopped.
-+       See device_synchronize.
-+
-+   * device_synchronize
-+     - Must synchronize the termination of a channel to the current
-+       context.
-+     - Must make sure that memory for previously submitted
-+       descriptors is no longer accessed by the DMA controller.
-+     - Must make sure that all complete callbacks for previously
-+       submitted descriptors have finished running and none are
-+       scheduled to run.
-+     - May sleep.
-+
- 
- Misc notes (stuff that should be documented, but don't really know
- where to put them)
---- a/drivers/dma/dmaengine.c
-+++ b/drivers/dma/dmaengine.c
-@@ -266,8 +266,11 @@ static void dma_chan_put(struct dma_chan
- 	module_put(dma_chan_to_owner(chan));
- 
- 	/* This channel is not in use anymore, free it */
--	if (!chan->client_count && chan->device->device_free_chan_resources)
-+	if (!chan->client_count && chan->device->device_free_chan_resources) {
-+		/* Make sure all operations have completed */
-+		dmaengine_synchronize(chan);
- 		chan->device->device_free_chan_resources(chan);
-+	}
- 
- 	/* If the channel is used via a DMA request router, free the mapping */
- 	if (chan->router && chan->router->route_free) {
---- a/include/linux/dmaengine.h
-+++ b/include/linux/dmaengine.h
-@@ -681,6 +681,8 @@ struct dma_filter {
-  *	paused. Returns 0 or an error code
-  * @device_terminate_all: Aborts all transfers on a channel. Returns 0
-  *	or an error code
-+ * @device_synchronize: Synchronizes the termination of a transfers to the
-+ *  current context.
-  * @device_tx_status: poll for transaction completion, the optional
-  *	txstate parameter can be supplied with a pointer to get a
-  *	struct with auxiliary transfer status information, otherwise the call
-@@ -765,6 +767,7 @@ struct dma_device {
- 	int (*device_pause)(struct dma_chan *chan);
- 	int (*device_resume)(struct dma_chan *chan);
- 	int (*device_terminate_all)(struct dma_chan *chan);
-+	void (*device_synchronize)(struct dma_chan *chan);
- 
- 	enum dma_status (*device_tx_status)(struct dma_chan *chan,
- 					    dma_cookie_t cookie,
-@@ -856,6 +859,13 @@ static inline struct dma_async_tx_descri
- 			src_sg, src_nents, flags);
- }
- 
-+/**
-+ * dmaengine_terminate_all() - Terminate all active DMA transfers
-+ * @chan: The channel for which to terminate the transfers
-+ *
-+ * This function is DEPRECATED use either dmaengine_terminate_sync() or
-+ * dmaengine_terminate_async() instead.
-+ */
- static inline int dmaengine_terminate_all(struct dma_chan *chan)
- {
- 	if (chan->device->device_terminate_all)
-@@ -864,6 +874,86 @@ static inline int dmaengine_terminate_al
- 	return -ENOSYS;
- }
- 
-+/**
-+ * dmaengine_terminate_async() - Terminate all active DMA transfers
-+ * @chan: The channel for which to terminate the transfers
-+ *
-+ * Calling this function will terminate all active and pending descriptors
-+ * that have previously been submitted to the channel. It is not guaranteed
-+ * though that the transfer for the active descriptor has stopped when the
-+ * function returns. Furthermore it is possible the complete callback of a
-+ * submitted transfer is still running when this function returns.
-+ *
-+ * dmaengine_synchronize() needs to be called before it is safe to free
-+ * any memory that is accessed by previously submitted descriptors or before
-+ * freeing any resources accessed from within the completion callback of any
-+ * perviously submitted descriptors.
-+ *
-+ * This function can be called from atomic context as well as from within a
-+ * complete callback of a descriptor submitted on the same channel.
-+ *
-+ * If none of the two conditions above apply consider using
-+ * dmaengine_terminate_sync() instead.
-+ */
-+static inline int dmaengine_terminate_async(struct dma_chan *chan)
-+{
-+	if (chan->device->device_terminate_all)
-+		return chan->device->device_terminate_all(chan);
-+
-+	return -EINVAL;
-+}
-+
-+/**
-+ * dmaengine_synchronize() - Synchronize DMA channel termination
-+ * @chan: The channel to synchronize
-+ *
-+ * Synchronizes to the DMA channel termination to the current context. When this
-+ * function returns it is guaranteed that all transfers for previously issued
-+ * descriptors have stopped and and it is safe to free the memory assoicated
-+ * with them. Furthermore it is guaranteed that all complete callback functions
-+ * for a previously submitted descriptor have finished running and it is safe to
-+ * free resources accessed from within the complete callbacks.
-+ *
-+ * The behavior of this function is undefined if dma_async_issue_pending() has
-+ * been called between dmaengine_terminate_async() and this function.
-+ *
-+ * This function must only be called from non-atomic context and must not be
-+ * called from within a complete callback of a descriptor submitted on the same
-+ * channel.
-+ */
-+static inline void dmaengine_synchronize(struct dma_chan *chan)
-+{
-+	if (chan->device->device_synchronize)
-+		chan->device->device_synchronize(chan);
-+}
-+
-+/**
-+ * dmaengine_terminate_sync() - Terminate all active DMA transfers
-+ * @chan: The channel for which to terminate the transfers
-+ *
-+ * Calling this function will terminate all active and pending transfers
-+ * that have previously been submitted to the channel. It is similar to
-+ * dmaengine_terminate_async() but guarantees that the DMA transfer has actually
-+ * stopped and that all complete callbacks have finished running when the
-+ * function returns.
-+ *
-+ * This function must only be called from non-atomic context and must not be
-+ * called from within a complete callback of a descriptor submitted on the same
-+ * channel.
-+ */
-+static inline int dmaengine_terminate_sync(struct dma_chan *chan)
-+{
-+	int ret;
-+
-+	ret = dmaengine_terminate_async(chan);
-+	if (ret)
-+		return ret;
-+
-+	dmaengine_synchronize(chan);
-+
-+	return 0;
-+}
-+
- static inline int dmaengine_pause(struct dma_chan *chan)
- {
- 	if (chan->device->device_pause)
diff --git a/target/linux/apm821xx/patches-4.4/015-dmaengine-dw-fixed.patch b/target/linux/apm821xx/patches-4.4/015-dmaengine-dw-fixed.patch
deleted file mode 100644
index 0380088..0000000
--- a/target/linux/apm821xx/patches-4.4/015-dmaengine-dw-fixed.patch
+++ /dev/null
@@ -1,1517 +0,0 @@
-From: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
-Subject: [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems)
-Date: Mon, 25 Apr 2016 15:35:05 +0300
-
-This patch series (v3: http://www.spinics.net/lists/kernel/msg2215303.html)
-contains a number of mostly minor fixes and cleanups for the DW DMA driver. A
-couple of them affect the DT binding so these may need to be updated to
-maintain compatibility (old format is still supported though). The rest should
-be relatively straight-forward.
-
-This version has been tested on the following bare metal platforms:
-- ATNGW100 (avr32 based platform) with dmatest
-- Sam460ex (powerpc 44x based platform) with SATA
-- Intel Braswell with UART
-- Intel Galileo (Intel Quark based platform) with UART
-
-(SATA driver and Intel Galileo UART support are based on this series and just
- published recently for a review)
-
-Vinod, there are few patch sets developed on top of this one, so, the idea is
-to keep this in an immuutable branch / tag.
-
-Changes since v5:
-- fixed an issue found by kbuildbot
-
-Changes since v4:
-- send proper set of patches
-- add changelog
-
-Changes since v3:
-- add patch 1 to check value of dma-masters property
-- drop the upstreamed patches
-- update patch 2 to keep an array for data-width property as well
-
-Changes since v2:
-- add patch 1 to fix master selection which was broken for long time
-- remove "use field-by-field initialization" patch since like Mans metioned in
-  has mostly no value and even might increase error prone
-- rebase on top of recent linux-next
-- wide testing on several platforms
-
-Changes since v1:
-- zeroing struct dw_dma_slave before use
-- fall back to old data_width property if data-width is not found
-- append tags for few patches
-- correct title of cover letter
-- rebase on top of recent linux-next
-
-Andy Shevchenko (4):
-  dmaengine: dw: platform: check nr_masters to be non-zero
-  dmaengine: dw: revisit data_width property
-  dmaengine: dw: keep entire platform data in struct dw_dma
-  dmaengine: dw: pass platform data via struct dw_dma_chip
-
- Documentation/devicetree/bindings/dma/snps-dma.txt |  6 +-
- arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
- arch/arm/boot/dts/spear13xx.dtsi                   |  4 +-
- drivers/ata/sata_dwc_460ex.c                       |  2 +-
- drivers/dma/dw/core.c                              | 75 ++++++++--------------
- drivers/dma/dw/pci.c                               |  5 +-
- drivers/dma/dw/platform.c                          | 32 +++++----
- drivers/dma/dw/regs.h                              |  5 +-
- include/linux/dma/dw.h                             |  5 +-
- include/linux/platform_data/dma-dw.h               |  4 +-
- sound/soc/intel/common/sst-firmware.c              |  2 +-
- 11 files changed, 64 insertions(+), 78 deletions(-)
-
---- a/drivers/dma/dw/core.c
-+++ b/drivers/dma/dw/core.c
-@@ -45,22 +45,19 @@
- 			DW_DMA_MSIZE_16;			\
- 		u8 _dmsize = _is_slave ? _sconfig->dst_maxburst :	\
- 			DW_DMA_MSIZE_16;			\
-+		u8 _dms = (_dwc->direction == DMA_MEM_TO_DEV) ?		\
-+			_dwc->p_master : _dwc->m_master;		\
-+		u8 _sms = (_dwc->direction == DMA_DEV_TO_MEM) ?		\
-+			_dwc->p_master : _dwc->m_master;		\
- 								\
- 		(DWC_CTLL_DST_MSIZE(_dmsize)			\
- 		 | DWC_CTLL_SRC_MSIZE(_smsize)			\
- 		 | DWC_CTLL_LLP_D_EN				\
- 		 | DWC_CTLL_LLP_S_EN				\
--		 | DWC_CTLL_DMS(_dwc->dst_master)		\
--		 | DWC_CTLL_SMS(_dwc->src_master));		\
-+		 | DWC_CTLL_DMS(_dms)				\
-+		 | DWC_CTLL_SMS(_sms));				\
- 	})
- 
--/*
-- * Number of descriptors to allocate for each channel. This should be
-- * made configurable somehow; preferably, the clients (at least the
-- * ones using slave transfers) should be able to give us a hint.
-- */
--#define NR_DESCS_PER_CHANNEL	64
--
- /* The set of bus widths supported by the DMA controller */
- #define DW_DMA_BUSWIDTHS			  \
- 	BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED)	| \
-@@ -80,51 +77,65 @@ static struct dw_desc *dwc_first_active(
- 	return to_dw_desc(dwc->active_list.next);
- }
- 
--static struct dw_desc *dwc_desc_get(struct dw_dma_chan *dwc)
-+static dma_cookie_t dwc_tx_submit(struct dma_async_tx_descriptor *tx)
- {
--	struct dw_desc *desc, *_desc;
--	struct dw_desc *ret = NULL;
--	unsigned int i = 0;
--	unsigned long flags;
-+	struct dw_desc		*desc = txd_to_dw_desc(tx);
-+	struct dw_dma_chan	*dwc = to_dw_dma_chan(tx->chan);
-+	dma_cookie_t		cookie;
-+	unsigned long		flags;
- 
- 	spin_lock_irqsave(&dwc->lock, flags);
--	list_for_each_entry_safe(desc, _desc, &dwc->free_list, desc_node) {
--		i++;
--		if (async_tx_test_ack(&desc->txd)) {
--			list_del(&desc->desc_node);
--			ret = desc;
--			break;
--		}
--		dev_dbg(chan2dev(&dwc->chan), "desc %p not ACKed\n", desc);
--	}
-+	cookie = dma_cookie_assign(tx);
-+
-+	/*
-+	 * REVISIT: We should attempt to chain as many descriptors as
-+	 * possible, perhaps even appending to those already submitted
-+	 * for DMA. But this is hard to do in a race-free manner.
-+	 */
-+
-+	list_add_tail(&desc->desc_node, &dwc->queue);
- 	spin_unlock_irqrestore(&dwc->lock, flags);
-+	dev_vdbg(chan2dev(tx->chan), "%s: queued %u\n",
-+		 __func__, desc->txd.cookie);
- 
--	dev_vdbg(chan2dev(&dwc->chan), "scanned %u descriptors on freelist\n", i);
-+	return cookie;
-+}
- 
--	return ret;
-+static struct dw_desc *dwc_desc_get(struct dw_dma_chan *dwc)
-+{
-+	struct dw_dma *dw = to_dw_dma(dwc->chan.device);
-+	struct dw_desc *desc;
-+	dma_addr_t phys;
-+
-+	desc = dma_pool_zalloc(dw->desc_pool, GFP_ATOMIC, &phys);
-+	if (!desc)
-+		return NULL;
-+
-+	dwc->descs_allocated++;
-+	INIT_LIST_HEAD(&desc->tx_list);
-+	dma_async_tx_descriptor_init(&desc->txd, &dwc->chan);
-+	desc->txd.tx_submit = dwc_tx_submit;
-+	desc->txd.flags = DMA_CTRL_ACK;
-+	desc->txd.phys = phys;
-+	return desc;
- }
- 
--/*
-- * Move a descriptor, including any children, to the free list.
-- * `desc' must not be on any lists.
-- */
- static void dwc_desc_put(struct dw_dma_chan *dwc, struct dw_desc *desc)
- {
--	unsigned long flags;
-+	struct dw_dma *dw = to_dw_dma(dwc->chan.device);
-+	struct dw_desc *child, *_next;
- 
--	if (desc) {
--		struct dw_desc *child;
-+	if (unlikely(!desc))
-+		return;
- 
--		spin_lock_irqsave(&dwc->lock, flags);
--		list_for_each_entry(child, &desc->tx_list, desc_node)
--			dev_vdbg(chan2dev(&dwc->chan),
--					"moving child desc %p to freelist\n",
--					child);
--		list_splice_init(&desc->tx_list, &dwc->free_list);
--		dev_vdbg(chan2dev(&dwc->chan), "moving desc %p to freelist\n", desc);
--		list_add(&desc->desc_node, &dwc->free_list);
--		spin_unlock_irqrestore(&dwc->lock, flags);
-+	list_for_each_entry_safe(child, _next, &desc->tx_list, desc_node) {
-+		list_del(&child->desc_node);
-+		dma_pool_free(dw->desc_pool, child, child->txd.phys);
-+		dwc->descs_allocated--;
- 	}
-+
-+	dma_pool_free(dw->desc_pool, desc, desc->txd.phys);
-+	dwc->descs_allocated--;
- }
- 
- static void dwc_initialize(struct dw_dma_chan *dwc)
-@@ -133,7 +144,7 @@ static void dwc_initialize(struct dw_dma
- 	u32 cfghi = DWC_CFGH_FIFO_MODE;
- 	u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority);
- 
--	if (dwc->initialized == true)
-+	if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags))
- 		return;
- 
- 	cfghi |= DWC_CFGH_DST_PER(dwc->dst_id);
-@@ -146,26 +157,11 @@ static void dwc_initialize(struct dw_dma
- 	channel_set_bit(dw, MASK.XFER, dwc->mask);
- 	channel_set_bit(dw, MASK.ERROR, dwc->mask);
- 
--	dwc->initialized = true;
-+	set_bit(DW_DMA_IS_INITIALIZED, &dwc->flags);
- }
- 
- /*----------------------------------------------------------------------*/
- 
--static inline unsigned int dwc_fast_ffs(unsigned long long v)
--{
--	/*
--	 * We can be a lot more clever here, but this should take care
--	 * of the most common optimization.
--	 */
--	if (!(v & 7))
--		return 3;
--	else if (!(v & 3))
--		return 2;
--	else if (!(v & 1))
--		return 1;
--	return 0;
--}
--
- static inline void dwc_dump_chan_regs(struct dw_dma_chan *dwc)
- {
- 	dev_err(chan2dev(&dwc->chan),
-@@ -197,12 +193,12 @@ static inline void dwc_do_single_block(s
- 	 * Software emulation of LLP mode relies on interrupts to continue
- 	 * multi block transfer.
- 	 */
--	ctllo = desc->lli.ctllo | DWC_CTLL_INT_EN;
-+	ctllo = lli_read(desc, ctllo) | DWC_CTLL_INT_EN;
- 
--	channel_writel(dwc, SAR, desc->lli.sar);
--	channel_writel(dwc, DAR, desc->lli.dar);
-+	channel_writel(dwc, SAR, lli_read(desc, sar));
-+	channel_writel(dwc, DAR, lli_read(desc, dar));
- 	channel_writel(dwc, CTL_LO, ctllo);
--	channel_writel(dwc, CTL_HI, desc->lli.ctlhi);
-+	channel_writel(dwc, CTL_HI, lli_read(desc, ctlhi));
- 	channel_set_bit(dw, CH_EN, dwc->mask);
- 
- 	/* Move pointer to next descriptor */
-@@ -213,6 +209,7 @@ static inline void dwc_do_single_block(s
- static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
- {
- 	struct dw_dma	*dw = to_dw_dma(dwc->chan.device);
-+	u8		lms = DWC_LLP_LMS(dwc->m_master);
- 	unsigned long	was_soft_llp;
- 
- 	/* ASSERT:  channel is idle */
-@@ -237,7 +234,7 @@ static void dwc_dostart(struct dw_dma_ch
- 
- 		dwc_initialize(dwc);
- 
--		dwc->residue = first->total_len;
-+		first->residue = first->total_len;
- 		dwc->tx_node_active = &first->tx_list;
- 
- 		/* Submit first block */
-@@ -248,9 +245,8 @@ static void dwc_dostart(struct dw_dma_ch
- 
- 	dwc_initialize(dwc);
- 
--	channel_writel(dwc, LLP, first->txd.phys);
--	channel_writel(dwc, CTL_LO,
--			DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN);
-+	channel_writel(dwc, LLP, first->txd.phys | lms);
-+	channel_writel(dwc, CTL_LO, DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN);
- 	channel_writel(dwc, CTL_HI, 0);
- 	channel_set_bit(dw, CH_EN, dwc->mask);
- }
-@@ -293,11 +289,7 @@ dwc_descriptor_complete(struct dw_dma_ch
- 	list_for_each_entry(child, &desc->tx_list, desc_node)
- 		async_tx_ack(&child->txd);
- 	async_tx_ack(&desc->txd);
--
--	list_splice_init(&desc->tx_list, &dwc->free_list);
--	list_move(&desc->desc_node, &dwc->free_list);
--
--	dma_descriptor_unmap(txd);
-+	dwc_desc_put(dwc, desc);
- 	spin_unlock_irqrestore(&dwc->lock, flags);
- 
- 	if (callback)
-@@ -368,11 +360,11 @@ static void dwc_scan_descriptors(struct
- 
- 			head = &desc->tx_list;
- 			if (active != head) {
--				/* Update desc to reflect last sent one */
--				if (active != head->next)
--					desc = to_dw_desc(active->prev);
--
--				dwc->residue -= desc->len;
-+				/* Update residue to reflect last sent descriptor */
-+				if (active == head->next)
-+					desc->residue -= desc->len;
-+				else
-+					desc->residue -= to_dw_desc(active->prev)->len;
- 
- 				child = to_dw_desc(active);
- 
-@@ -387,8 +379,6 @@ static void dwc_scan_descriptors(struct
- 			clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags);
- 		}
- 
--		dwc->residue = 0;
--
- 		spin_unlock_irqrestore(&dwc->lock, flags);
- 
- 		dwc_complete_all(dw, dwc);
-@@ -396,7 +386,6 @@ static void dwc_scan_descriptors(struct
- 	}
- 
- 	if (list_empty(&dwc->active_list)) {
--		dwc->residue = 0;
- 		spin_unlock_irqrestore(&dwc->lock, flags);
- 		return;
- 	}
-@@ -411,31 +400,31 @@ static void dwc_scan_descriptors(struct
- 
- 	list_for_each_entry_safe(desc, _desc, &dwc->active_list, desc_node) {
- 		/* Initial residue value */
--		dwc->residue = desc->total_len;
-+		desc->residue = desc->total_len;
- 
- 		/* Check first descriptors addr */
--		if (desc->txd.phys == llp) {
-+		if (desc->txd.phys == DWC_LLP_LOC(llp)) {
- 			spin_unlock_irqrestore(&dwc->lock, flags);
- 			return;
- 		}
- 
- 		/* Check first descriptors llp */
--		if (desc->lli.llp == llp) {
-+		if (lli_read(desc, llp) == llp) {
- 			/* This one is currently in progress */
--			dwc->residue -= dwc_get_sent(dwc);
-+			desc->residue -= dwc_get_sent(dwc);
- 			spin_unlock_irqrestore(&dwc->lock, flags);
- 			return;
- 		}
- 
--		dwc->residue -= desc->len;
-+		desc->residue -= desc->len;
- 		list_for_each_entry(child, &desc->tx_list, desc_node) {
--			if (child->lli.llp == llp) {
-+			if (lli_read(child, llp) == llp) {
- 				/* Currently in progress */
--				dwc->residue -= dwc_get_sent(dwc);
-+				desc->residue -= dwc_get_sent(dwc);
- 				spin_unlock_irqrestore(&dwc->lock, flags);
- 				return;
- 			}
--			dwc->residue -= child->len;
-+			desc->residue -= child->len;
- 		}
- 
- 		/*
-@@ -457,10 +446,14 @@ static void dwc_scan_descriptors(struct
- 	spin_unlock_irqrestore(&dwc->lock, flags);
- }
- 
--static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
-+static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_desc *desc)
- {
- 	dev_crit(chan2dev(&dwc->chan), "  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
--		 lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
-+		 lli_read(desc, sar),
-+		 lli_read(desc, dar),
-+		 lli_read(desc, llp),
-+		 lli_read(desc, ctlhi),
-+		 lli_read(desc, ctllo));
- }
- 
- static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
-@@ -496,9 +489,9 @@ static void dwc_handle_error(struct dw_d
- 	 */
- 	dev_WARN(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n"
- 				       "  cookie: %d\n", bad_desc->txd.cookie);
--	dwc_dump_lli(dwc, &bad_desc->lli);
-+	dwc_dump_lli(dwc, bad_desc);
- 	list_for_each_entry(child, &bad_desc->tx_list, desc_node)
--		dwc_dump_lli(dwc, &child->lli);
-+		dwc_dump_lli(dwc, child);
- 
- 	spin_unlock_irqrestore(&dwc->lock, flags);
- 
-@@ -549,7 +542,7 @@ static void dwc_handle_cyclic(struct dw_
- 	 */
- 	if (unlikely(status_err & dwc->mask) ||
- 			unlikely(status_xfer & dwc->mask)) {
--		int i;
-+		unsigned int i;
- 
- 		dev_err(chan2dev(&dwc->chan),
- 			"cyclic DMA unexpected %s interrupt, stopping DMA transfer\n",
-@@ -571,7 +564,7 @@ static void dwc_handle_cyclic(struct dw_
- 		dma_writel(dw, CLEAR.XFER, dwc->mask);
- 
- 		for (i = 0; i < dwc->cdesc->periods; i++)
--			dwc_dump_lli(dwc, &dwc->cdesc->desc[i]->lli);
-+			dwc_dump_lli(dwc, dwc->cdesc->desc[i]);
- 
- 		spin_unlock_irqrestore(&dwc->lock, flags);
- 	}
-@@ -589,7 +582,7 @@ static void dw_dma_tasklet(unsigned long
- 	u32 status_block;
- 	u32 status_xfer;
- 	u32 status_err;
--	int i;
-+	unsigned int i;
- 
- 	status_block = dma_readl(dw, RAW.BLOCK);
- 	status_xfer = dma_readl(dw, RAW.XFER);
-@@ -616,12 +609,17 @@ static void dw_dma_tasklet(unsigned long
- static irqreturn_t dw_dma_interrupt(int irq, void *dev_id)
- {
- 	struct dw_dma *dw = dev_id;
--	u32 status = dma_readl(dw, STATUS_INT);
-+	u32 status;
-+
-+	/* Check if we have any interrupt from the DMAC which is not in use */
-+	if (!dw->in_use)
-+		return IRQ_NONE;
- 
-+	status = dma_readl(dw, STATUS_INT);
- 	dev_vdbg(dw->dma.dev, "%s: status=0x%x\n", __func__, status);
- 
- 	/* Check if we have any interrupt from the DMAC */
--	if (!status || !dw->in_use)
-+	if (!status)
- 		return IRQ_NONE;
- 
- 	/*
-@@ -653,30 +651,6 @@ static irqreturn_t dw_dma_interrupt(int
- 
- /*----------------------------------------------------------------------*/
- 
--static dma_cookie_t dwc_tx_submit(struct dma_async_tx_descriptor *tx)
--{
--	struct dw_desc		*desc = txd_to_dw_desc(tx);
--	struct dw_dma_chan	*dwc = to_dw_dma_chan(tx->chan);
--	dma_cookie_t		cookie;
--	unsigned long		flags;
--
--	spin_lock_irqsave(&dwc->lock, flags);
--	cookie = dma_cookie_assign(tx);
--
--	/*
--	 * REVISIT: We should attempt to chain as many descriptors as
--	 * possible, perhaps even appending to those already submitted
--	 * for DMA. But this is hard to do in a race-free manner.
--	 */
--
--	dev_vdbg(chan2dev(tx->chan), "%s: queued %u\n", __func__, desc->txd.cookie);
--	list_add_tail(&desc->desc_node, &dwc->queue);
--
--	spin_unlock_irqrestore(&dwc->lock, flags);
--
--	return cookie;
--}
--
- static struct dma_async_tx_descriptor *
- dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
- 		size_t len, unsigned long flags)
-@@ -688,10 +662,12 @@ dwc_prep_dma_memcpy(struct dma_chan *cha
- 	struct dw_desc		*prev;
- 	size_t			xfer_count;
- 	size_t			offset;
-+	u8			m_master = dwc->m_master;
- 	unsigned int		src_width;
- 	unsigned int		dst_width;
--	unsigned int		data_width;
-+	unsigned int		data_width = dw->pdata->data_width[m_master];
- 	u32			ctllo;
-+	u8			lms = DWC_LLP_LMS(m_master);
- 
- 	dev_vdbg(chan2dev(chan),
- 			"%s: d%pad s%pad l0x%zx f0x%lx\n", __func__,
-@@ -704,11 +680,7 @@ dwc_prep_dma_memcpy(struct dma_chan *cha
- 
- 	dwc->direction = DMA_MEM_TO_MEM;
- 
--	data_width = min_t(unsigned int, dw->data_width[dwc->src_master],
--			   dw->data_width[dwc->dst_master]);
--
--	src_width = dst_width = min_t(unsigned int, data_width,
--				      dwc_fast_ffs(src | dest | len));
-+	src_width = dst_width = __ffs(data_width | src | dest | len);
- 
- 	ctllo = DWC_DEFAULT_CTLLO(chan)
- 			| DWC_CTLL_DST_WIDTH(dst_width)
-@@ -726,27 +698,27 @@ dwc_prep_dma_memcpy(struct dma_chan *cha
- 		if (!desc)
- 			goto err_desc_get;
- 
--		desc->lli.sar = src + offset;
--		desc->lli.dar = dest + offset;
--		desc->lli.ctllo = ctllo;
--		desc->lli.ctlhi = xfer_count;
-+		lli_write(desc, sar, src + offset);
-+		lli_write(desc, dar, dest + offset);
-+		lli_write(desc, ctllo, ctllo);
-+		lli_write(desc, ctlhi, xfer_count);
- 		desc->len = xfer_count << src_width;
- 
- 		if (!first) {
- 			first = desc;
- 		} else {
--			prev->lli.llp = desc->txd.phys;
--			list_add_tail(&desc->desc_node,
--					&first->tx_list);
-+			lli_write(prev, llp, desc->txd.phys | lms);
-+			list_add_tail(&desc->desc_node, &first->tx_list);
- 		}
- 		prev = desc;
- 	}
- 
- 	if (flags & DMA_PREP_INTERRUPT)
- 		/* Trigger interrupt after last block */
--		prev->lli.ctllo |= DWC_CTLL_INT_EN;
-+		lli_set(prev, ctllo, DWC_CTLL_INT_EN);
- 
- 	prev->lli.llp = 0;
-+	lli_clear(prev, ctllo, DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN);
- 	first->txd.flags = flags;
- 	first->total_len = len;
- 
-@@ -768,10 +740,12 @@ dwc_prep_slave_sg(struct dma_chan *chan,
- 	struct dw_desc		*prev;
- 	struct dw_desc		*first;
- 	u32			ctllo;
-+	u8			m_master = dwc->m_master;
-+	u8			lms = DWC_LLP_LMS(m_master);
- 	dma_addr_t		reg;
- 	unsigned int		reg_width;
- 	unsigned int		mem_width;
--	unsigned int		data_width;
-+	unsigned int		data_width = dw->pdata->data_width[m_master];
- 	unsigned int		i;
- 	struct scatterlist	*sg;
- 	size_t			total_len = 0;
-@@ -797,8 +771,6 @@ dwc_prep_slave_sg(struct dma_chan *chan,
- 		ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_M2P) :
- 			DWC_CTLL_FC(DW_DMA_FC_D_M2P);
- 
--		data_width = dw->data_width[dwc->src_master];
--
- 		for_each_sg(sgl, sg, sg_len, i) {
- 			struct dw_desc	*desc;
- 			u32		len, dlen, mem;
-@@ -806,17 +778,16 @@ dwc_prep_slave_sg(struct dma_chan *chan,
- 			mem = sg_dma_address(sg);
- 			len = sg_dma_len(sg);
- 
--			mem_width = min_t(unsigned int,
--					  data_width, dwc_fast_ffs(mem | len));
-+			mem_width = __ffs(data_width | mem | len);
- 
- slave_sg_todev_fill_desc:
- 			desc = dwc_desc_get(dwc);
- 			if (!desc)
- 				goto err_desc_get;
- 
--			desc->lli.sar = mem;
--			desc->lli.dar = reg;
--			desc->lli.ctllo = ctllo | DWC_CTLL_SRC_WIDTH(mem_width);
-+			lli_write(desc, sar, mem);
-+			lli_write(desc, dar, reg);
-+			lli_write(desc, ctllo, ctllo | DWC_CTLL_SRC_WIDTH(mem_width));
- 			if ((len >> mem_width) > dwc->block_size) {
- 				dlen = dwc->block_size << mem_width;
- 				mem += dlen;
-@@ -826,15 +797,14 @@ slave_sg_todev_fill_desc:
- 				len = 0;
- 			}
- 
--			desc->lli.ctlhi = dlen >> mem_width;
-+			lli_write(desc, ctlhi, dlen >> mem_width);
- 			desc->len = dlen;
- 
- 			if (!first) {
- 				first = desc;
- 			} else {
--				prev->lli.llp = desc->txd.phys;
--				list_add_tail(&desc->desc_node,
--						&first->tx_list);
-+				lli_write(prev, llp, desc->txd.phys | lms);
-+				list_add_tail(&desc->desc_node, &first->tx_list);
- 			}
- 			prev = desc;
- 			total_len += dlen;
-@@ -854,8 +824,6 @@ slave_sg_todev_fill_desc:
- 		ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_P2M) :
- 			DWC_CTLL_FC(DW_DMA_FC_D_P2M);
- 
--		data_width = dw->data_width[dwc->dst_master];
--
- 		for_each_sg(sgl, sg, sg_len, i) {
- 			struct dw_desc	*desc;
- 			u32		len, dlen, mem;
-@@ -863,17 +831,16 @@ slave_sg_todev_fill_desc:
- 			mem = sg_dma_address(sg);
- 			len = sg_dma_len(sg);
- 
--			mem_width = min_t(unsigned int,
--					  data_width, dwc_fast_ffs(mem | len));
-+			mem_width = __ffs(data_width | mem | len);
- 
- slave_sg_fromdev_fill_desc:
- 			desc = dwc_desc_get(dwc);
- 			if (!desc)
- 				goto err_desc_get;
- 
--			desc->lli.sar = reg;
--			desc->lli.dar = mem;
--			desc->lli.ctllo = ctllo | DWC_CTLL_DST_WIDTH(mem_width);
-+			lli_write(desc, sar, reg);
-+			lli_write(desc, dar, mem);
-+			lli_write(desc, ctllo, ctllo | DWC_CTLL_DST_WIDTH(mem_width));
- 			if ((len >> reg_width) > dwc->block_size) {
- 				dlen = dwc->block_size << reg_width;
- 				mem += dlen;
-@@ -882,15 +849,14 @@ slave_sg_fromdev_fill_desc:
- 				dlen = len;
- 				len = 0;
- 			}
--			desc->lli.ctlhi = dlen >> reg_width;
-+			lli_write(desc, ctlhi, dlen >> reg_width);
- 			desc->len = dlen;
- 
- 			if (!first) {
- 				first = desc;
- 			} else {
--				prev->lli.llp = desc->txd.phys;
--				list_add_tail(&desc->desc_node,
--						&first->tx_list);
-+				lli_write(prev, llp, desc->txd.phys | lms);
-+				list_add_tail(&desc->desc_node, &first->tx_list);
- 			}
- 			prev = desc;
- 			total_len += dlen;
-@@ -905,9 +871,10 @@ slave_sg_fromdev_fill_desc:
- 
- 	if (flags & DMA_PREP_INTERRUPT)
- 		/* Trigger interrupt after last block */
--		prev->lli.ctllo |= DWC_CTLL_INT_EN;
-+		lli_set(prev, ctllo, DWC_CTLL_INT_EN);
- 
- 	prev->lli.llp = 0;
-+	lli_clear(prev, ctllo, DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN);
- 	first->total_len = total_len;
- 
- 	return &first->txd;
-@@ -932,8 +899,8 @@ bool dw_dma_filter(struct dma_chan *chan
- 	dwc->src_id = dws->src_id;
- 	dwc->dst_id = dws->dst_id;
- 
--	dwc->src_master = dws->src_master;
--	dwc->dst_master = dws->dst_master;
-+	dwc->m_master = dws->m_master;
-+	dwc->p_master = dws->p_master;
- 
- 	return true;
- }
-@@ -986,7 +953,7 @@ static int dwc_pause(struct dma_chan *ch
- 	while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY) && count--)
- 		udelay(2);
- 
--	dwc->paused = true;
-+	set_bit(DW_DMA_IS_PAUSED, &dwc->flags);
- 
- 	spin_unlock_irqrestore(&dwc->lock, flags);
- 
-@@ -999,7 +966,7 @@ static inline void dwc_chan_resume(struc
- 
- 	channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP);
- 
--	dwc->paused = false;
-+	clear_bit(DW_DMA_IS_PAUSED, &dwc->flags);
- }
- 
- static int dwc_resume(struct dma_chan *chan)
-@@ -1007,12 +974,10 @@ static int dwc_resume(struct dma_chan *c
- 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
- 	unsigned long		flags;
- 
--	if (!dwc->paused)
--		return 0;
--
- 	spin_lock_irqsave(&dwc->lock, flags);
- 
--	dwc_chan_resume(dwc);
-+	if (test_bit(DW_DMA_IS_PAUSED, &dwc->flags))
-+		dwc_chan_resume(dwc);
- 
- 	spin_unlock_irqrestore(&dwc->lock, flags);
- 
-@@ -1048,16 +1013,37 @@ static int dwc_terminate_all(struct dma_
- 	return 0;
- }
- 
--static inline u32 dwc_get_residue(struct dw_dma_chan *dwc)
-+static struct dw_desc *dwc_find_desc(struct dw_dma_chan *dwc, dma_cookie_t c)
-+{
-+	struct dw_desc *desc;
-+
-+	list_for_each_entry(desc, &dwc->active_list, desc_node)
-+		if (desc->txd.cookie == c)
-+			return desc;
-+
-+	return NULL;
-+}
-+
-+static u32 dwc_get_residue(struct dw_dma_chan *dwc, dma_cookie_t cookie)
- {
-+	struct dw_desc *desc;
- 	unsigned long flags;
- 	u32 residue;
- 
- 	spin_lock_irqsave(&dwc->lock, flags);
- 
--	residue = dwc->residue;
--	if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags) && residue)
--		residue -= dwc_get_sent(dwc);
-+	desc = dwc_find_desc(dwc, cookie);
-+	if (desc) {
-+		if (desc == dwc_first_active(dwc)) {
-+			residue = desc->residue;
-+			if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags) && residue)
-+				residue -= dwc_get_sent(dwc);
-+		} else {
-+			residue = desc->total_len;
-+		}
-+	} else {
-+		residue = 0;
-+	}
- 
- 	spin_unlock_irqrestore(&dwc->lock, flags);
- 	return residue;
-@@ -1078,10 +1064,12 @@ dwc_tx_status(struct dma_chan *chan,
- 	dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
- 
- 	ret = dma_cookie_status(chan, cookie, txstate);
--	if (ret != DMA_COMPLETE)
--		dma_set_residue(txstate, dwc_get_residue(dwc));
-+	if (ret == DMA_COMPLETE)
-+		return ret;
-+
-+	dma_set_residue(txstate, dwc_get_residue(dwc, cookie));
- 
--	if (dwc->paused && ret == DMA_IN_PROGRESS)
-+	if (test_bit(DW_DMA_IS_PAUSED, &dwc->flags) && ret == DMA_IN_PROGRESS)
- 		return DMA_PAUSED;
- 
- 	return ret;
-@@ -1102,7 +1090,7 @@ static void dwc_issue_pending(struct dma
- 
- static void dw_dma_off(struct dw_dma *dw)
- {
--	int i;
-+	unsigned int i;
- 
- 	dma_writel(dw, CFG, 0);
- 
-@@ -1116,7 +1104,7 @@ static void dw_dma_off(struct dw_dma *dw
- 		cpu_relax();
- 
- 	for (i = 0; i < dw->dma.chancnt; i++)
--		dw->chan[i].initialized = false;
-+		clear_bit(DW_DMA_IS_INITIALIZED, &dw->chan[i].flags);
- }
- 
- static void dw_dma_on(struct dw_dma *dw)
-@@ -1128,9 +1116,6 @@ static int dwc_alloc_chan_resources(stru
- {
- 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
- 	struct dw_dma		*dw = to_dw_dma(chan->device);
--	struct dw_desc		*desc;
--	int			i;
--	unsigned long		flags;
- 
- 	dev_vdbg(chan2dev(chan), "%s\n", __func__);
- 
-@@ -1161,48 +1146,13 @@ static int dwc_alloc_chan_resources(stru
- 		dw_dma_on(dw);
- 	dw->in_use |= dwc->mask;
- 
--	spin_lock_irqsave(&dwc->lock, flags);
--	i = dwc->descs_allocated;
--	while (dwc->descs_allocated < NR_DESCS_PER_CHANNEL) {
--		dma_addr_t phys;
--
--		spin_unlock_irqrestore(&dwc->lock, flags);
--
--		desc = dma_pool_alloc(dw->desc_pool, GFP_ATOMIC, &phys);
--		if (!desc)
--			goto err_desc_alloc;
--
--		memset(desc, 0, sizeof(struct dw_desc));
--
--		INIT_LIST_HEAD(&desc->tx_list);
--		dma_async_tx_descriptor_init(&desc->txd, chan);
--		desc->txd.tx_submit = dwc_tx_submit;
--		desc->txd.flags = DMA_CTRL_ACK;
--		desc->txd.phys = phys;
--
--		dwc_desc_put(dwc, desc);
--
--		spin_lock_irqsave(&dwc->lock, flags);
--		i = ++dwc->descs_allocated;
--	}
--
--	spin_unlock_irqrestore(&dwc->lock, flags);
--
--	dev_dbg(chan2dev(chan), "%s: allocated %d descriptors\n", __func__, i);
--
--	return i;
--
--err_desc_alloc:
--	dev_info(chan2dev(chan), "only allocated %d descriptors\n", i);
--
--	return i;
-+	return 0;
- }
- 
- static void dwc_free_chan_resources(struct dma_chan *chan)
- {
- 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
- 	struct dw_dma		*dw = to_dw_dma(chan->device);
--	struct dw_desc		*desc, *_desc;
- 	unsigned long		flags;
- 	LIST_HEAD(list);
- 
-@@ -1215,17 +1165,15 @@ static void dwc_free_chan_resources(stru
- 	BUG_ON(dma_readl(to_dw_dma(chan->device), CH_EN) & dwc->mask);
- 
- 	spin_lock_irqsave(&dwc->lock, flags);
--	list_splice_init(&dwc->free_list, &list);
--	dwc->descs_allocated = 0;
- 
- 	/* Clear custom channel configuration */
- 	dwc->src_id = 0;
- 	dwc->dst_id = 0;
- 
--	dwc->src_master = 0;
--	dwc->dst_master = 0;
-+	dwc->m_master = 0;
-+	dwc->p_master = 0;
- 
--	dwc->initialized = false;
-+	clear_bit(DW_DMA_IS_INITIALIZED, &dwc->flags);
- 
- 	/* Disable interrupts */
- 	channel_clear_bit(dw, MASK.XFER, dwc->mask);
-@@ -1239,11 +1187,6 @@ static void dwc_free_chan_resources(stru
- 	if (!dw->in_use)
- 		dw_dma_off(dw);
- 
--	list_for_each_entry_safe(desc, _desc, &list, desc_node) {
--		dev_vdbg(chan2dev(chan), "  freeing descriptor %p\n", desc);
--		dma_pool_free(dw->desc_pool, desc, desc->txd.phys);
--	}
--
- 	dev_vdbg(chan2dev(chan), "%s: done\n", __func__);
- }
- 
-@@ -1321,6 +1264,7 @@ struct dw_cyclic_desc *dw_dma_cyclic_pre
- 	struct dw_cyclic_desc		*retval = NULL;
- 	struct dw_desc			*desc;
- 	struct dw_desc			*last = NULL;
-+	u8				lms = DWC_LLP_LMS(dwc->m_master);
- 	unsigned long			was_cyclic;
- 	unsigned int			reg_width;
- 	unsigned int			periods;
-@@ -1374,9 +1318,6 @@ struct dw_cyclic_desc *dw_dma_cyclic_pre
- 
- 	retval = ERR_PTR(-ENOMEM);
- 
--	if (periods > NR_DESCS_PER_CHANNEL)
--		goto out_err;
--
- 	cdesc = kzalloc(sizeof(struct dw_cyclic_desc), GFP_KERNEL);
- 	if (!cdesc)
- 		goto out_err;
-@@ -1392,50 +1333,50 @@ struct dw_cyclic_desc *dw_dma_cyclic_pre
- 
- 		switch (direction) {
- 		case DMA_MEM_TO_DEV:
--			desc->lli.dar = sconfig->dst_addr;
--			desc->lli.sar = buf_addr + (period_len * i);
--			desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan)
--					| DWC_CTLL_DST_WIDTH(reg_width)
--					| DWC_CTLL_SRC_WIDTH(reg_width)
--					| DWC_CTLL_DST_FIX
--					| DWC_CTLL_SRC_INC
--					| DWC_CTLL_INT_EN);
--
--			desc->lli.ctllo |= sconfig->device_fc ?
--				DWC_CTLL_FC(DW_DMA_FC_P_M2P) :
--				DWC_CTLL_FC(DW_DMA_FC_D_M2P);
-+			lli_write(desc, dar, sconfig->dst_addr);
-+			lli_write(desc, sar, buf_addr + period_len * i);
-+			lli_write(desc, ctllo, (DWC_DEFAULT_CTLLO(chan)
-+				| DWC_CTLL_DST_WIDTH(reg_width)
-+				| DWC_CTLL_SRC_WIDTH(reg_width)
-+				| DWC_CTLL_DST_FIX
-+				| DWC_CTLL_SRC_INC
-+				| DWC_CTLL_INT_EN));
-+
-+			lli_set(desc, ctllo, sconfig->device_fc ?
-+					DWC_CTLL_FC(DW_DMA_FC_P_M2P) :
-+					DWC_CTLL_FC(DW_DMA_FC_D_M2P));
- 
- 			break;
- 		case DMA_DEV_TO_MEM:
--			desc->lli.dar = buf_addr + (period_len * i);
--			desc->lli.sar = sconfig->src_addr;
--			desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan)
--					| DWC_CTLL_SRC_WIDTH(reg_width)
--					| DWC_CTLL_DST_WIDTH(reg_width)
--					| DWC_CTLL_DST_INC
--					| DWC_CTLL_SRC_FIX
--					| DWC_CTLL_INT_EN);
--
--			desc->lli.ctllo |= sconfig->device_fc ?
--				DWC_CTLL_FC(DW_DMA_FC_P_P2M) :
--				DWC_CTLL_FC(DW_DMA_FC_D_P2M);
-+			lli_write(desc, dar, buf_addr + period_len * i);
-+			lli_write(desc, sar, sconfig->src_addr);
-+			lli_write(desc, ctllo, (DWC_DEFAULT_CTLLO(chan)
-+				| DWC_CTLL_SRC_WIDTH(reg_width)
-+				| DWC_CTLL_DST_WIDTH(reg_width)
-+				| DWC_CTLL_DST_INC
-+				| DWC_CTLL_SRC_FIX
-+				| DWC_CTLL_INT_EN));
-+
-+			lli_set(desc, ctllo, sconfig->device_fc ?
-+					DWC_CTLL_FC(DW_DMA_FC_P_P2M) :
-+					DWC_CTLL_FC(DW_DMA_FC_D_P2M));
- 
- 			break;
- 		default:
- 			break;
- 		}
- 
--		desc->lli.ctlhi = (period_len >> reg_width);
-+		lli_write(desc, ctlhi, period_len >> reg_width);
- 		cdesc->desc[i] = desc;
- 
- 		if (last)
--			last->lli.llp = desc->txd.phys;
-+			lli_write(last, llp, desc->txd.phys | lms);
- 
- 		last = desc;
- 	}
- 
- 	/* Let's make a cyclic list */
--	last->lli.llp = cdesc->desc[0]->txd.phys;
-+	lli_write(last, llp, cdesc->desc[0]->txd.phys | lms);
- 
- 	dev_dbg(chan2dev(&dwc->chan),
- 			"cyclic prepared buf %pad len %zu period %zu periods %d\n",
-@@ -1466,7 +1407,7 @@ void dw_dma_cyclic_free(struct dma_chan
- 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
- 	struct dw_dma		*dw = to_dw_dma(dwc->chan.device);
- 	struct dw_cyclic_desc	*cdesc = dwc->cdesc;
--	int			i;
-+	unsigned int		i;
- 	unsigned long		flags;
- 
- 	dev_dbg(chan2dev(&dwc->chan), "%s\n", __func__);
-@@ -1490,32 +1431,38 @@ void dw_dma_cyclic_free(struct dma_chan
- 	kfree(cdesc->desc);
- 	kfree(cdesc);
- 
-+	dwc->cdesc = NULL;
-+
- 	clear_bit(DW_DMA_IS_CYCLIC, &dwc->flags);
- }
- EXPORT_SYMBOL(dw_dma_cyclic_free);
- 
- /*----------------------------------------------------------------------*/
- 
--int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
-+int dw_dma_probe(struct dw_dma_chip *chip)
- {
-+	struct dw_dma_platform_data *pdata;
- 	struct dw_dma		*dw;
- 	bool			autocfg = false;
- 	unsigned int		dw_params;
--	unsigned int		max_blk_size = 0;
-+	unsigned int		i;
- 	int			err;
--	int			i;
- 
- 	dw = devm_kzalloc(chip->dev, sizeof(*dw), GFP_KERNEL);
- 	if (!dw)
- 		return -ENOMEM;
- 
-+	dw->pdata = devm_kzalloc(chip->dev, sizeof(*dw->pdata), GFP_KERNEL);
-+	if (!dw->pdata)
-+		return -ENOMEM;
-+
- 	dw->regs = chip->regs;
- 	chip->dw = dw;
- 
- 	pm_runtime_get_sync(chip->dev);
- 
--	if (!pdata) {
--		dw_params = dma_read_byaddr(chip->regs, DW_PARAMS);
-+	if (!chip->pdata) {
-+		dw_params = dma_readl(dw, DW_PARAMS);
- 		dev_dbg(chip->dev, "DW_PARAMS: 0x%08x\n", dw_params);
- 
- 		autocfg = dw_params >> DW_PARAMS_EN & 1;
-@@ -1524,29 +1471,31 @@ int dw_dma_probe(struct dw_dma_chip *chi
- 			goto err_pdata;
- 		}
- 
--		pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL);
--		if (!pdata) {
--			err = -ENOMEM;
--			goto err_pdata;
--		}
-+		/* Reassign the platform data pointer */
-+		pdata = dw->pdata;
- 
- 		/* Get hardware configuration parameters */
- 		pdata->nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 7) + 1;
- 		pdata->nr_masters = (dw_params >> DW_PARAMS_NR_MASTER & 3) + 1;
- 		for (i = 0; i < pdata->nr_masters; i++) {
- 			pdata->data_width[i] =
--				(dw_params >> DW_PARAMS_DATA_WIDTH(i) & 3) + 2;
-+				4 << (dw_params >> DW_PARAMS_DATA_WIDTH(i) & 3);
- 		}
--		max_blk_size = dma_readl(dw, MAX_BLK_SIZE);
-+		pdata->block_size = dma_readl(dw, MAX_BLK_SIZE);
- 
- 		/* Fill platform data with the default values */
- 		pdata->is_private = true;
- 		pdata->is_memcpy = true;
- 		pdata->chan_allocation_order = CHAN_ALLOCATION_ASCENDING;
- 		pdata->chan_priority = CHAN_PRIORITY_ASCENDING;
--	} else if (pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
-+	} else if (chip->pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
- 		err = -EINVAL;
- 		goto err_pdata;
-+	} else {
-+		memcpy(dw->pdata, chip->pdata, sizeof(*dw->pdata));
-+
-+		/* Reassign the platform data pointer */
-+		pdata = dw->pdata;
- 	}
- 
- 	dw->chan = devm_kcalloc(chip->dev, pdata->nr_channels, sizeof(*dw->chan),
-@@ -1556,11 +1505,6 @@ int dw_dma_probe(struct dw_dma_chip *chi
- 		goto err_pdata;
- 	}
- 
--	/* Get hardware configuration parameters */
--	dw->nr_masters = pdata->nr_masters;
--	for (i = 0; i < dw->nr_masters; i++)
--		dw->data_width[i] = pdata->data_width[i];
--
- 	/* Calculate all channel mask before DMA setup */
- 	dw->all_chan_mask = (1 << pdata->nr_channels) - 1;
- 
-@@ -1607,7 +1551,6 @@ int dw_dma_probe(struct dw_dma_chip *chi
- 
- 		INIT_LIST_HEAD(&dwc->active_list);
- 		INIT_LIST_HEAD(&dwc->queue);
--		INIT_LIST_HEAD(&dwc->free_list);
- 
- 		channel_clear_bit(dw, CH_EN, dwc->mask);
- 
-@@ -1615,11 +1558,9 @@ int dw_dma_probe(struct dw_dma_chip *chi
- 
- 		/* Hardware configuration */
- 		if (autocfg) {
--			unsigned int dwc_params;
- 			unsigned int r = DW_DMA_MAX_NR_CHANNELS - i - 1;
--			void __iomem *addr = chip->regs + r * sizeof(u32);
--
--			dwc_params = dma_read_byaddr(addr, DWC_PARAMS);
-+			void __iomem *addr = &__dw_regs(dw)->DWC_PARAMS[r];
-+			unsigned int dwc_params = dma_readl_native(addr);
- 
- 			dev_dbg(chip->dev, "DWC_PARAMS[%d]: 0x%08x\n", i,
- 					   dwc_params);
-@@ -1630,16 +1571,15 @@ int dw_dma_probe(struct dw_dma_chip *chi
- 			 * up to 0x0a for 4095.
- 			 */
- 			dwc->block_size =
--				(4 << ((max_blk_size >> 4 * i) & 0xf)) - 1;
-+				(4 << ((pdata->block_size >> 4 * i) & 0xf)) - 1;
- 			dwc->nollp =
- 				(dwc_params >> DWC_PARAMS_MBLK_EN & 0x1) == 0;
- 		} else {
- 			dwc->block_size = pdata->block_size;
- 
- 			/* Check if channel supports multi block transfer */
--			channel_writel(dwc, LLP, 0xfffffffc);
--			dwc->nollp =
--				(channel_readl(dwc, LLP) & 0xfffffffc) == 0;
-+			channel_writel(dwc, LLP, DWC_LLP_LOC(0xffffffff));
-+			dwc->nollp = DWC_LLP_LOC(channel_readl(dwc, LLP)) == 0;
- 			channel_writel(dwc, LLP, 0);
- 		}
- 	}
---- a/drivers/dma/dw/pci.c
-+++ b/drivers/dma/dw/pci.c
-@@ -17,8 +17,8 @@
- 
- static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
- {
-+	const struct dw_dma_platform_data *pdata = (void *)pid->driver_data;
- 	struct dw_dma_chip *chip;
--	struct dw_dma_platform_data *pdata = (void *)pid->driver_data;
- 	int ret;
- 
- 	ret = pcim_enable_device(pdev);
-@@ -49,8 +49,9 @@ static int dw_pci_probe(struct pci_dev *
- 	chip->dev = &pdev->dev;
- 	chip->regs = pcim_iomap_table(pdev)[0];
- 	chip->irq = pdev->irq;
-+	chip->pdata = pdata;
- 
--	ret = dw_dma_probe(chip, pdata);
-+	ret = dw_dma_probe(chip);
- 	if (ret)
- 		return ret;
- 
-@@ -108,6 +109,10 @@ static const struct pci_device_id dw_pci
- 
- 	/* Haswell */
- 	{ PCI_VDEVICE(INTEL, 0x9c60) },
-+
-+	/* Broadwell */
-+	{ PCI_VDEVICE(INTEL, 0x9ce0) },
-+
- 	{ }
- };
- MODULE_DEVICE_TABLE(pci, dw_pci_id_table);
---- a/drivers/dma/dw/platform.c
-+++ b/drivers/dma/dw/platform.c
-@@ -42,13 +42,13 @@ static struct dma_chan *dw_dma_of_xlate(
- 
- 	slave.src_id = dma_spec->args[0];
- 	slave.dst_id = dma_spec->args[0];
--	slave.src_master = dma_spec->args[1];
--	slave.dst_master = dma_spec->args[2];
-+	slave.m_master = dma_spec->args[1];
-+	slave.p_master = dma_spec->args[2];
- 
- 	if (WARN_ON(slave.src_id >= DW_DMA_MAX_NR_REQUESTS ||
- 		    slave.dst_id >= DW_DMA_MAX_NR_REQUESTS ||
--		    slave.src_master >= dw->nr_masters ||
--		    slave.dst_master >= dw->nr_masters))
-+		    slave.m_master >= dw->pdata->nr_masters ||
-+		    slave.p_master >= dw->pdata->nr_masters))
- 		return NULL;
- 
- 	dma_cap_zero(cap);
-@@ -66,8 +66,8 @@ static bool dw_dma_acpi_filter(struct dm
- 		.dma_dev = dma_spec->dev,
- 		.src_id = dma_spec->slave_id,
- 		.dst_id = dma_spec->slave_id,
--		.src_master = 1,
--		.dst_master = 0,
-+		.m_master = 0,
-+		.p_master = 1,
- 	};
- 
- 	return dw_dma_filter(chan, &slave);
-@@ -103,18 +103,28 @@ dw_dma_parse_dt(struct platform_device *
- 	struct device_node *np = pdev->dev.of_node;
- 	struct dw_dma_platform_data *pdata;
- 	u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
-+	u32 nr_masters;
-+	u32 nr_channels;
- 
- 	if (!np) {
- 		dev_err(&pdev->dev, "Missing DT data\n");
- 		return NULL;
- 	}
- 
-+	if (of_property_read_u32(np, "dma-masters", &nr_masters))
-+		return NULL;
-+	if (nr_masters < 1 || nr_masters > DW_DMA_MAX_NR_MASTERS)
-+		return NULL;
-+
-+	if (of_property_read_u32(np, "dma-channels", &nr_channels))
-+		return NULL;
-+
- 	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
- 	if (!pdata)
- 		return NULL;
- 
--	if (of_property_read_u32(np, "dma-channels", &pdata->nr_channels))
--		return NULL;
-+	pdata->nr_masters = nr_masters;
-+	pdata->nr_channels = nr_channels;
- 
- 	if (of_property_read_bool(np, "is_private"))
- 		pdata->is_private = true;
-@@ -128,17 +138,13 @@ dw_dma_parse_dt(struct platform_device *
- 	if (!of_property_read_u32(np, "block_size", &tmp))
- 		pdata->block_size = tmp;
- 
--	if (!of_property_read_u32(np, "dma-masters", &tmp)) {
--		if (tmp > DW_DMA_MAX_NR_MASTERS)
--			return NULL;
--
--		pdata->nr_masters = tmp;
--	}
--
--	if (!of_property_read_u32_array(np, "data_width", arr,
--				pdata->nr_masters))
--		for (tmp = 0; tmp < pdata->nr_masters; tmp++)
-+	if (!of_property_read_u32_array(np, "data-width", arr, nr_masters)) {
-+		for (tmp = 0; tmp < nr_masters; tmp++)
- 			pdata->data_width[tmp] = arr[tmp];
-+	} else if (!of_property_read_u32_array(np, "data_width", arr, nr_masters)) {
-+		for (tmp = 0; tmp < nr_masters; tmp++)
-+			pdata->data_width[tmp] = BIT(arr[tmp] & 0x07);
-+	}
- 
- 	return pdata;
- }
-@@ -155,8 +161,7 @@ static int dw_probe(struct platform_devi
- 	struct dw_dma_chip *chip;
- 	struct device *dev = &pdev->dev;
- 	struct resource *mem;
--	const struct acpi_device_id *id;
--	struct dw_dma_platform_data *pdata;
-+	const struct dw_dma_platform_data *pdata;
- 	int err;
- 
- 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
-@@ -179,13 +184,9 @@ static int dw_probe(struct platform_devi
- 	pdata = dev_get_platdata(dev);
- 	if (!pdata)
- 		pdata = dw_dma_parse_dt(pdev);
--	if (!pdata && has_acpi_companion(dev)) {
--		id = acpi_match_device(dev->driver->acpi_match_table, dev);
--		if (id)
--			pdata = (struct dw_dma_platform_data *)id->driver_data;
--	}
- 
- 	chip->dev = dev;
-+	chip->pdata = pdata;
- 
- 	chip->clk = devm_clk_get(chip->dev, "hclk");
- 	if (IS_ERR(chip->clk))
-@@ -196,7 +197,7 @@ static int dw_probe(struct platform_devi
- 
- 	pm_runtime_enable(&pdev->dev);
- 
--	err = dw_dma_probe(chip, pdata);
-+	err = dw_dma_probe(chip);
- 	if (err)
- 		goto err_dw_dma_probe;
- 
-@@ -239,7 +240,19 @@ static void dw_shutdown(struct platform_
- {
- 	struct dw_dma_chip *chip = platform_get_drvdata(pdev);
- 
-+	/*
-+	 * We have to call dw_dma_disable() to stop any ongoing transfer. On
-+	 * some platforms we can't do that since DMA device is powered off.
-+	 * Moreover we have no possibility to check if the platform is affected
-+	 * or not. That's why we call pm_runtime_get_sync() / pm_runtime_put()
-+	 * unconditionally. On the other hand we can't use
-+	 * pm_runtime_suspended() because runtime PM framework is not fully
-+	 * used by the driver.
-+	 */
-+	pm_runtime_get_sync(chip->dev);
- 	dw_dma_disable(chip);
-+	pm_runtime_put_sync_suspend(chip->dev);
-+
- 	clk_disable_unprepare(chip->clk);
- }
- 
-@@ -252,17 +265,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_of_id_tab
- #endif
- 
- #ifdef CONFIG_ACPI
--static struct dw_dma_platform_data dw_dma_acpi_pdata = {
--	.nr_channels = 8,
--	.is_private = true,
--	.chan_allocation_order = CHAN_ALLOCATION_ASCENDING,
--	.chan_priority = CHAN_PRIORITY_ASCENDING,
--	.block_size = 4095,
--	.nr_masters = 2,
--};
--
- static const struct acpi_device_id dw_dma_acpi_id_table[] = {
--	{ "INTL9C60", (kernel_ulong_t)&dw_dma_acpi_pdata },
-+	{ "INTL9C60", 0 },
- 	{ }
- };
- MODULE_DEVICE_TABLE(acpi, dw_dma_acpi_id_table);
---- a/drivers/dma/dw/regs.h
-+++ b/drivers/dma/dw/regs.h
-@@ -114,10 +114,6 @@ struct dw_dma_regs {
- #define dma_writel_native writel
- #endif
- 
--/* To access the registers in early stage of probe */
--#define dma_read_byaddr(addr, name) \
--	dma_readl_native((addr) + offsetof(struct dw_dma_regs, name))
--
- /* Bitfields in DW_PARAMS */
- #define DW_PARAMS_NR_CHAN	8		/* number of channels */
- #define DW_PARAMS_NR_MASTER	11		/* number of AHB masters */
-@@ -143,6 +139,10 @@ enum dw_dma_msize {
- 	DW_DMA_MSIZE_256,
- };
- 
-+/* Bitfields in LLP */
-+#define DWC_LLP_LMS(x)		((x) & 3)	/* list master select */
-+#define DWC_LLP_LOC(x)		((x) & ~3)	/* next lli */
-+
- /* Bitfields in CTL_LO */
- #define DWC_CTLL_INT_EN		(1 << 0)	/* irqs enabled? */
- #define DWC_CTLL_DST_WIDTH(n)	((n)<<1)	/* bytes per element */
-@@ -150,7 +150,7 @@ enum dw_dma_msize {
- #define DWC_CTLL_DST_INC	(0<<7)		/* DAR update/not */
- #define DWC_CTLL_DST_DEC	(1<<7)
- #define DWC_CTLL_DST_FIX	(2<<7)
--#define DWC_CTLL_SRC_INC	(0<<7)		/* SAR update/not */
-+#define DWC_CTLL_SRC_INC	(0<<9)		/* SAR update/not */
- #define DWC_CTLL_SRC_DEC	(1<<9)
- #define DWC_CTLL_SRC_FIX	(2<<9)
- #define DWC_CTLL_DST_MSIZE(n)	((n)<<11)	/* burst, #elements */
-@@ -216,6 +216,8 @@ enum dw_dma_msize {
- enum dw_dmac_flags {
- 	DW_DMA_IS_CYCLIC = 0,
- 	DW_DMA_IS_SOFT_LLP = 1,
-+	DW_DMA_IS_PAUSED = 2,
-+	DW_DMA_IS_INITIALIZED = 3,
- };
- 
- struct dw_dma_chan {
-@@ -224,8 +226,6 @@ struct dw_dma_chan {
- 	u8				mask;
- 	u8				priority;
- 	enum dma_transfer_direction	direction;
--	bool				paused;
--	bool				initialized;
- 
- 	/* software emulation of the LLP transfers */
- 	struct list_head	*tx_node_active;
-@@ -236,8 +236,6 @@ struct dw_dma_chan {
- 	unsigned long		flags;
- 	struct list_head	active_list;
- 	struct list_head	queue;
--	struct list_head	free_list;
--	u32			residue;
- 	struct dw_cyclic_desc	*cdesc;
- 
- 	unsigned int		descs_allocated;
-@@ -249,8 +247,8 @@ struct dw_dma_chan {
- 	/* custom slave configuration */
- 	u8			src_id;
- 	u8			dst_id;
--	u8			src_master;
--	u8			dst_master;
-+	u8			m_master;
-+	u8			p_master;
- 
- 	/* configuration passed via .device_config */
- 	struct dma_slave_config dma_sconfig;
-@@ -283,9 +281,8 @@ struct dw_dma {
- 	u8			all_chan_mask;
- 	u8			in_use;
- 
--	/* hardware configuration */
--	unsigned char		nr_masters;
--	unsigned char		data_width[DW_DMA_MAX_NR_MASTERS];
-+	/* platform data */
-+	struct dw_dma_platform_data	*pdata;
- };
- 
- static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
-@@ -308,32 +305,51 @@ static inline struct dw_dma *to_dw_dma(s
- 	return container_of(ddev, struct dw_dma, dma);
- }
- 
-+#ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
-+typedef __be32 __dw32;
-+#else
-+typedef __le32 __dw32;
-+#endif
-+
- /* LLI == Linked List Item; a.k.a. DMA block descriptor */
- struct dw_lli {
- 	/* values that are not changed by hardware */
--	u32		sar;
--	u32		dar;
--	u32		llp;		/* chain to next lli */
--	u32		ctllo;
-+	__dw32		sar;
-+	__dw32		dar;
-+	__dw32		llp;		/* chain to next lli */
-+	__dw32		ctllo;
- 	/* values that may get written back: */
--	u32		ctlhi;
-+	__dw32		ctlhi;
- 	/* sstat and dstat can snapshot peripheral register state.
- 	 * silicon config may discard either or both...
- 	 */
--	u32		sstat;
--	u32		dstat;
-+	__dw32		sstat;
-+	__dw32		dstat;
- };
- 
- struct dw_desc {
- 	/* FIRST values the hardware uses */
- 	struct dw_lli			lli;
- 
-+#ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
-+#define lli_set(d, reg, v)		((d)->lli.reg |= cpu_to_be32(v))
-+#define lli_clear(d, reg, v)		((d)->lli.reg &= ~cpu_to_be32(v))
-+#define lli_read(d, reg)		be32_to_cpu((d)->lli.reg)
-+#define lli_write(d, reg, v)		((d)->lli.reg = cpu_to_be32(v))
-+#else
-+#define lli_set(d, reg, v)		((d)->lli.reg |= cpu_to_le32(v))
-+#define lli_clear(d, reg, v)		((d)->lli.reg &= ~cpu_to_le32(v))
-+#define lli_read(d, reg)		le32_to_cpu((d)->lli.reg)
-+#define lli_write(d, reg, v)		((d)->lli.reg = cpu_to_le32(v))
-+#endif
-+
- 	/* THEN values for driver housekeeping */
- 	struct list_head		desc_node;
- 	struct list_head		tx_list;
- 	struct dma_async_tx_descriptor	txd;
- 	size_t				len;
- 	size_t				total_len;
-+	u32				residue;
- };
- 
- #define to_dw_desc(h)	list_entry(h, struct dw_desc, desc_node)
---- a/include/linux/dma/dw.h
-+++ b/include/linux/dma/dw.h
-@@ -27,6 +27,7 @@ struct dw_dma;
-  * @regs:		memory mapped I/O space
-  * @clk:		hclk clock
-  * @dw:			struct dw_dma that is filed by dw_dma_probe()
-+ * @pdata:		pointer to platform data
-  */
- struct dw_dma_chip {
- 	struct device	*dev;
-@@ -34,10 +35,12 @@ struct dw_dma_chip {
- 	void __iomem	*regs;
- 	struct clk	*clk;
- 	struct dw_dma	*dw;
-+
-+	const struct dw_dma_platform_data	*pdata;
- };
- 
- /* Export to the platform drivers */
--int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
-+int dw_dma_probe(struct dw_dma_chip *chip);
- int dw_dma_remove(struct dw_dma_chip *chip);
- 
- /* DMA API extensions */
---- a/include/linux/platform_data/dma-dw.h
-+++ b/include/linux/platform_data/dma-dw.h
-@@ -21,15 +21,15 @@
-  * @dma_dev:	required DMA master device
-  * @src_id:	src request line
-  * @dst_id:	dst request line
-- * @src_master: src master for transfers on allocated channel.
-- * @dst_master: dest master for transfers on allocated channel.
-+ * @m_master:	memory master for transfers on allocated channel
-+ * @p_master:	peripheral master for transfers on allocated channel
-  */
- struct dw_dma_slave {
- 	struct device		*dma_dev;
- 	u8			src_id;
- 	u8			dst_id;
--	u8			src_master;
--	u8			dst_master;
-+	u8			m_master;
-+	u8			p_master;
- };
- 
- /**
-@@ -43,7 +43,7 @@ struct dw_dma_slave {
-  * @block_size: Maximum block size supported by the controller
-  * @nr_masters: Number of AHB masters supported by the controller
-  * @data_width: Maximum data width supported by hardware per AHB master
-- *		(0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
-+ *		(in bytes, power of 2)
-  */
- struct dw_dma_platform_data {
- 	unsigned int	nr_channels;
-@@ -55,7 +55,7 @@ struct dw_dma_platform_data {
- #define CHAN_PRIORITY_ASCENDING		0	/* chan0 highest */
- #define CHAN_PRIORITY_DESCENDING	1	/* chan7 highest */
- 	unsigned char	chan_priority;
--	unsigned short	block_size;
-+	unsigned int	block_size;
- 	unsigned char	nr_masters;
- 	unsigned char	data_width[DW_DMA_MAX_NR_MASTERS];
- };
diff --git a/target/linux/apm821xx/patches-4.4/020-sata-dwc.patch b/target/linux/apm821xx/patches-4.4/020-sata-dwc.patch
deleted file mode 100644
index 1a6ce05..0000000
--- a/target/linux/apm821xx/patches-4.4/020-sata-dwc.patch
+++ /dev/null
@@ -1,1083 +0,0 @@
-From: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
-Date: Sat, 21 May 2016 22:46:32 +0200
-Subject:  [PATCH v2 00/23] ata: sata_dwc_460ex: make it working again
-
-The last approach in the commit 8b3444852a2b ("sata_dwc_460ex: move to generic
-DMA driver") to switch to generic DMA engine API wasn't tested on bare metal.
-Besides that we expecting new board support coming with the same SATA IP but
-with different DMA.
-
-This series is targetting the following things:
-- a few bug fixes to the original driver
-- a part to fix the DMA engine usage and in particularly dw_dmac driver
-- move driver to use generic PHY and "dmas" property which leads to update in DTS
-
-The driver has been tested myself on Sam460ex and WD MyBookLive (apollo3g)
-boards. In any case I ask Christian, M?ns, and Julian to independently test and
-provide Tested-by tag or an error report.
-
-Series depends on previously published but not yet fully applied series [1].
-
-The patches are also available via public branch [2].
-
-[1] http://www.spinics.net/lists/dmaengine/msg09250.html
-[2] https://bitbucket.org/andy-shev/linux/branch/topic%2Fdw%2Fsata
-
-Since v1:
-- simplify patch 8 (David Laight)
-- add Tested-by and Acked-by tags
-
-Andy Shevchenko (11):
-  ata: sata_dwc_460ex: set dma_boundary to 0x1fff
-  ata: sata_dwc_460ex: burst size must be in items not bytes
-  ata: sata_dwc_460ex: DMA is always a flow controller
-  ata: sata_dwc_460ex: select only core part of DMA driver
-  ata: sata_dwc_460ex: don't call ata_sff_qc_issue() on DMA commands
-  ata: sata_dwc_460ex: correct HOSTDEV{P}_FROM_*() macros
-  ata: sata_dwc_460ex: supply physical address of FIFO to DMA
-  ata: sata_dwc_460ex: switch to new dmaengine_terminate_* API
-  ata: sata_dwc_460ex: use devm_ioremap
-  ata: sata_dwc_460ex: make debug messages neat
-  powerpc/4xx: Device tree update for the 460ex DWC SATA
-
-Christian Lamparter (1):
-  ata: sata_dwc_460ex: fix crash on offline links without an attached
-    drive
-
-Mans Rullgard (11):
-  ata: sata_dwc_460ex: remove incorrect locking
-  ata: sata_dwc_460ex: skip dma setup for non-dma commands
-  ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
-  ata: sata_dwc_460ex: add phy support
-  ata: sata_dwc_460ex: get rid of global data
-  ata: sata_dwc_460ex: remove empty libata callback
-  ata: sata_dwc_460ex: get rid of some pointless casts
-  ata: sata_dwc_460ex: get rid of incorrect cast
-  ata: sata_dwc_460ex: add __iomem to register base pointer
-  ata: sata_dwc_460ex: use readl/writel_relaxed()
-  ata: sata_dwc_460ex: tidy up sata_dwc_clear_dmacr()
-
- arch/powerpc/boot/dts/canyonlands.dts |  15 +-
- drivers/ata/Kconfig                   |  12 +-
- drivers/ata/sata_dwc_460ex.c          | 552 +++++++++++++++++-----------------
- 3 files changed, 305 insertions(+), 274 deletions(-)
-
----
- drivers/ata/sata_dwc_460ex.c | 552 ++++++++++++++++++++++---------------------
- 1 file changed, 283 insertions(+), 269 deletions(-)
-
---- a/drivers/ata/sata_dwc_460ex.c
-+++ b/drivers/ata/sata_dwc_460ex.c
-@@ -30,10 +30,12 @@
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/device.h>
-+#include <linux/dmaengine.h>
- #include <linux/of_address.h>
- #include <linux/of_irq.h>
- #include <linux/of_platform.h>
- #include <linux/platform_device.h>
-+#include <linux/phy/phy.h>
- #include <linux/libata.h>
- #include <linux/slab.h>
- 
-@@ -42,10 +44,6 @@
- #include <scsi/scsi_host.h>
- #include <scsi/scsi_cmnd.h>
- 
--/* Supported DMA engine drivers */
--#include <linux/platform_data/dma-dw.h>
--#include <linux/dma/dw.h>
--
- /* These two are defined in "libata.h" */
- #undef	DRV_NAME
- #undef	DRV_VERSION
-@@ -53,19 +51,14 @@
- #define DRV_NAME        "sata-dwc"
- #define DRV_VERSION     "1.3"
- 
--#ifndef out_le32
--#define out_le32(a, v)	__raw_writel(__cpu_to_le32(v), (void __iomem *)(a))
--#endif
--
--#ifndef in_le32
--#define in_le32(a)	__le32_to_cpu(__raw_readl((void __iomem *)(a)))
--#endif
-+#define sata_dwc_writel(a, v)	writel_relaxed(v, a)
-+#define sata_dwc_readl(a)	readl_relaxed(a)
- 
- #ifndef NO_IRQ
- #define NO_IRQ		0
- #endif
- 
--#define AHB_DMA_BRST_DFLT	64	/* 16 data items burst length*/
-+#define AHB_DMA_BRST_DFLT	64	/* 16 data items burst length */
- 
- enum {
- 	SATA_DWC_MAX_PORTS = 1,
-@@ -102,7 +95,7 @@ struct sata_dwc_regs {
- 	u32 versionr;		/* Version Register */
- 	u32 idr;		/* ID Register */
- 	u32 unimpl[192];	/* Unimplemented */
--	u32 dmadr[256];	/* FIFO Locations in DMA Mode */
-+	u32 dmadr[256];		/* FIFO Locations in DMA Mode */
- };
- 
- enum {
-@@ -146,9 +139,14 @@ struct sata_dwc_device {
- 	struct device		*dev;		/* generic device struct */
- 	struct ata_probe_ent	*pe;		/* ptr to probe-ent */
- 	struct ata_host		*host;
--	u8 __iomem		*reg_base;
--	struct sata_dwc_regs	*sata_dwc_regs;	/* DW Synopsys SATA specific */
-+	struct sata_dwc_regs __iomem *sata_dwc_regs;	/* DW SATA specific */
-+	u32			sactive_issued;
-+	u32			sactive_queued;
-+	struct phy		*phy;
-+	phys_addr_t		dmadr;
-+#ifdef CONFIG_SATA_DWC_OLD_DMA
- 	struct dw_dma_chip	*dma;
-+#endif
- };
- 
- #define SATA_DWC_QCMD_MAX	32
-@@ -159,25 +157,19 @@ struct sata_dwc_device_port {
- 	int			dma_pending[SATA_DWC_QCMD_MAX];
- 
- 	/* DMA info */
--	struct dw_dma_slave		*dws;
- 	struct dma_chan			*chan;
- 	struct dma_async_tx_descriptor	*desc[SATA_DWC_QCMD_MAX];
- 	u32				dma_interrupt_count;
- };
- 
- /*
-- * Commonly used DWC SATA driver Macros
-+ * Commonly used DWC SATA driver macros
-  */
--#define HSDEV_FROM_HOST(host)  ((struct sata_dwc_device *)\
--					(host)->private_data)
--#define HSDEV_FROM_AP(ap)  ((struct sata_dwc_device *)\
--					(ap)->host->private_data)
--#define HSDEVP_FROM_AP(ap)   ((struct sata_dwc_device_port *)\
--					(ap)->private_data)
--#define HSDEV_FROM_QC(qc)	((struct sata_dwc_device *)\
--					(qc)->ap->host->private_data)
--#define HSDEV_FROM_HSDEVP(p)	((struct sata_dwc_device *)\
--						(hsdevp)->hsdev)
-+#define HSDEV_FROM_HOST(host)	((struct sata_dwc_device *)(host)->private_data)
-+#define HSDEV_FROM_AP(ap)	((struct sata_dwc_device *)(ap)->host->private_data)
-+#define HSDEVP_FROM_AP(ap)	((struct sata_dwc_device_port *)(ap)->private_data)
-+#define HSDEV_FROM_QC(qc)	((struct sata_dwc_device *)(qc)->ap->host->private_data)
-+#define HSDEV_FROM_HSDEVP(p)	((struct sata_dwc_device *)(p)->hsdev)
- 
- enum {
- 	SATA_DWC_CMD_ISSUED_NOT		= 0,
-@@ -190,21 +182,6 @@ enum {
- 	SATA_DWC_DMA_PENDING_RX		= 2,
- };
- 
--struct sata_dwc_host_priv {
--	void	__iomem	 *scr_addr_sstatus;
--	u32	sata_dwc_sactive_issued ;
--	u32	sata_dwc_sactive_queued ;
--};
--
--static struct sata_dwc_host_priv host_pvt;
--
--static struct dw_dma_slave sata_dwc_dma_dws = {
--	.src_id = 0,
--	.dst_id = 0,
--	.src_master = 0,
--	.dst_master = 1,
--};
--
- /*
-  * Prototypes
-  */
-@@ -215,6 +192,93 @@ static void sata_dwc_dma_xfer_complete(s
- static void sata_dwc_port_stop(struct ata_port *ap);
- static void sata_dwc_clear_dmacr(struct sata_dwc_device_port *hsdevp, u8 tag);
- 
-+#ifdef CONFIG_SATA_DWC_OLD_DMA
-+
-+#include <linux/platform_data/dma-dw.h>
-+#include <linux/dma/dw.h>
-+
-+static struct dw_dma_slave sata_dwc_dma_dws = {
-+	.src_id = 0,
-+	.dst_id = 0,
-+	.m_master = 1,
-+	.p_master = 0,
-+};
-+
-+static bool sata_dwc_dma_filter(struct dma_chan *chan, void *param)
-+{
-+	struct dw_dma_slave *dws = &sata_dwc_dma_dws;
-+
-+	if (dws->dma_dev != chan->device->dev)
-+		return false;
-+
-+	chan->private = dws;
-+	return true;
-+}
-+
-+static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp)
-+{
-+	struct sata_dwc_device *hsdev = hsdevp->hsdev;
-+	struct dw_dma_slave *dws = &sata_dwc_dma_dws;
-+	dma_cap_mask_t mask;
-+
-+	dws->dma_dev = hsdev->dev;
-+
-+	dma_cap_zero(mask);
-+	dma_cap_set(DMA_SLAVE, mask);
-+
-+	/* Acquire DMA channel */
-+	hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp);
-+	if (!hsdevp->chan) {
-+		dev_err(hsdev->dev, "%s: dma channel unavailable\n",
-+			 __func__);
-+		return -EAGAIN;
-+	}
-+
-+	return 0;
-+}
-+
-+static int sata_dwc_dma_init_old(struct platform_device *pdev,
-+				 struct sata_dwc_device *hsdev)
-+{
-+	struct device_node *np = pdev->dev.of_node;
-+	struct resource *res;
-+
-+	hsdev->dma = devm_kzalloc(&pdev->dev, sizeof(*hsdev->dma), GFP_KERNEL);
-+	if (!hsdev->dma)
-+		return -ENOMEM;
-+
-+	hsdev->dma->dev = &pdev->dev;
-+
-+	/* Get SATA DMA interrupt number */
-+	hsdev->dma->irq = irq_of_parse_and_map(np, 1);
-+	if (hsdev->dma->irq == NO_IRQ) {
-+		dev_err(&pdev->dev, "no SATA DMA irq\n");
-+		return -ENODEV;
-+	}
-+
-+	/* Get physical SATA DMA register base address */
-+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-+	hsdev->dma->regs = devm_ioremap_resource(&pdev->dev, res);
-+	if (IS_ERR(hsdev->dma->regs)) {
-+		dev_err(&pdev->dev,
-+			"ioremap failed for AHBDMA register address\n");
-+		return PTR_ERR(hsdev->dma->regs);
-+	}
-+
-+	/* Initialize AHB DMAC */
-+	return dw_dma_probe(hsdev->dma);
-+}
-+
-+static void sata_dwc_dma_exit_old(struct sata_dwc_device *hsdev)
-+{
-+	if (!hsdev->dma)
-+		return;
-+
-+	dw_dma_remove(hsdev->dma);
-+}
-+
-+#endif
-+
- static const char *get_prot_descript(u8 protocol)
- {
- 	switch ((enum ata_tf_protocols)protocol) {
-@@ -305,21 +369,20 @@ static struct dma_async_tx_descriptor *d
- 	struct ata_port *ap = qc->ap;
- 	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
- 	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
--	dma_addr_t addr = (dma_addr_t)&hsdev->sata_dwc_regs->dmadr;
- 	struct dma_slave_config sconf;
- 	struct dma_async_tx_descriptor *desc;
- 
- 	if (qc->dma_dir == DMA_DEV_TO_MEM) {
--		sconf.src_addr = addr;
--		sconf.device_fc = true;
-+		sconf.src_addr = hsdev->dmadr;
-+		sconf.device_fc = false;
- 	} else {	/* DMA_MEM_TO_DEV */
--		sconf.dst_addr = addr;
-+		sconf.dst_addr = hsdev->dmadr;
- 		sconf.device_fc = false;
- 	}
- 
- 	sconf.direction = qc->dma_dir;
--	sconf.src_maxburst = AHB_DMA_BRST_DFLT;
--	sconf.dst_maxburst = AHB_DMA_BRST_DFLT;
-+	sconf.src_maxburst = AHB_DMA_BRST_DFLT / 4;	/* in items */
-+	sconf.dst_maxburst = AHB_DMA_BRST_DFLT / 4;	/* in items */
- 	sconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
- 	sconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
- 
-@@ -336,8 +399,8 @@ static struct dma_async_tx_descriptor *d
- 	desc->callback = dma_dwc_xfer_done;
- 	desc->callback_param = hsdev;
- 
--	dev_dbg(hsdev->dev, "%s sg: 0x%p, count: %d addr: %pad\n",
--		__func__, qc->sg, qc->n_elem, &addr);
-+	dev_dbg(hsdev->dev, "%s sg: 0x%p, count: %d addr: %pa\n", __func__,
-+		qc->sg, qc->n_elem, &hsdev->dmadr);
- 
- 	return desc;
- }
-@@ -350,48 +413,38 @@ static int sata_dwc_scr_read(struct ata_
- 		return -EINVAL;
- 	}
- 
--	*val = in_le32(link->ap->ioaddr.scr_addr + (scr * 4));
--	dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=val=0x%08x\n",
--		__func__, link->ap->print_id, scr, *val);
-+	*val = sata_dwc_readl(link->ap->ioaddr.scr_addr + (scr * 4));
-+	dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=0x%08x\n", __func__,
-+		link->ap->print_id, scr, *val);
- 
- 	return 0;
- }
- 
- static int sata_dwc_scr_write(struct ata_link *link, unsigned int scr, u32 val)
- {
--	dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=val=0x%08x\n",
--		__func__, link->ap->print_id, scr, val);
-+	dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=0x%08x\n", __func__,
-+		link->ap->print_id, scr, val);
- 	if (scr > SCR_NOTIFICATION) {
- 		dev_err(link->ap->dev, "%s: Incorrect SCR offset 0x%02x\n",
- 			 __func__, scr);
- 		return -EINVAL;
- 	}
--	out_le32(link->ap->ioaddr.scr_addr + (scr * 4), val);
-+	sata_dwc_writel(link->ap->ioaddr.scr_addr + (scr * 4), val);
- 
- 	return 0;
- }
- 
--static u32 core_scr_read(unsigned int scr)
--{
--	return in_le32(host_pvt.scr_addr_sstatus + (scr * 4));
--}
--
--static void core_scr_write(unsigned int scr, u32 val)
--{
--	out_le32(host_pvt.scr_addr_sstatus + (scr * 4), val);
--}
--
--static void clear_serror(void)
-+static void clear_serror(struct ata_port *ap)
- {
- 	u32 val;
--	val = core_scr_read(SCR_ERROR);
--	core_scr_write(SCR_ERROR, val);
-+	sata_dwc_scr_read(&ap->link, SCR_ERROR, &val);
-+	sata_dwc_scr_write(&ap->link, SCR_ERROR, val);
- }
- 
- static void clear_interrupt_bit(struct sata_dwc_device *hsdev, u32 bit)
- {
--	out_le32(&hsdev->sata_dwc_regs->intpr,
--		 in_le32(&hsdev->sata_dwc_regs->intpr));
-+	sata_dwc_writel(&hsdev->sata_dwc_regs->intpr,
-+			sata_dwc_readl(&hsdev->sata_dwc_regs->intpr));
- }
- 
- static u32 qcmd_tag_to_mask(u8 tag)
-@@ -412,7 +465,7 @@ static void sata_dwc_error_intr(struct a
- 
- 	ata_ehi_clear_desc(ehi);
- 
--	serror = core_scr_read(SCR_ERROR);
-+	sata_dwc_scr_read(&ap->link, SCR_ERROR, &serror);
- 	status = ap->ops->sff_check_status(ap);
- 
- 	tag = ap->link.active_tag;
-@@ -423,7 +476,7 @@ static void sata_dwc_error_intr(struct a
- 		hsdevp->dma_pending[tag], hsdevp->cmd_issued[tag]);
- 
- 	/* Clear error register and interrupt bit */
--	clear_serror();
-+	clear_serror(ap);
- 	clear_interrupt_bit(hsdev, SATA_DWC_INTPR_ERR);
- 
- 	/* This is the only error happening now.  TODO check for exact error */
-@@ -462,12 +515,12 @@ static irqreturn_t sata_dwc_isr(int irq,
- 	int handled, num_processed, port = 0;
- 	uint intpr, sactive, sactive2, tag_mask;
- 	struct sata_dwc_device_port *hsdevp;
--	host_pvt.sata_dwc_sactive_issued = 0;
-+	hsdev->sactive_issued = 0;
- 
- 	spin_lock_irqsave(&host->lock, flags);
- 
- 	/* Read the interrupt register */
--	intpr = in_le32(&hsdev->sata_dwc_regs->intpr);
-+	intpr = sata_dwc_readl(&hsdev->sata_dwc_regs->intpr);
- 
- 	ap = host->ports[port];
- 	hsdevp = HSDEVP_FROM_AP(ap);
-@@ -486,12 +539,12 @@ static irqreturn_t sata_dwc_isr(int irq,
- 	if (intpr & SATA_DWC_INTPR_NEWFP) {
- 		clear_interrupt_bit(hsdev, SATA_DWC_INTPR_NEWFP);
- 
--		tag = (u8)(in_le32(&hsdev->sata_dwc_regs->fptagr));
-+		tag = (u8)(sata_dwc_readl(&hsdev->sata_dwc_regs->fptagr));
- 		dev_dbg(ap->dev, "%s: NEWFP tag=%d\n", __func__, tag);
- 		if (hsdevp->cmd_issued[tag] != SATA_DWC_CMD_ISSUED_PEND)
- 			dev_warn(ap->dev, "CMD tag=%d not pending?\n", tag);
- 
--		host_pvt.sata_dwc_sactive_issued |= qcmd_tag_to_mask(tag);
-+		hsdev->sactive_issued |= qcmd_tag_to_mask(tag);
- 
- 		qc = ata_qc_from_tag(ap, tag);
- 		/*
-@@ -505,11 +558,11 @@ static irqreturn_t sata_dwc_isr(int irq,
- 		handled = 1;
- 		goto DONE;
- 	}
--	sactive = core_scr_read(SCR_ACTIVE);
--	tag_mask = (host_pvt.sata_dwc_sactive_issued | sactive) ^ sactive;
-+	sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive);
-+	tag_mask = (hsdev->sactive_issued | sactive) ^ sactive;
- 
- 	/* If no sactive issued and tag_mask is zero then this is not NCQ */
--	if (host_pvt.sata_dwc_sactive_issued == 0 && tag_mask == 0) {
-+	if (hsdev->sactive_issued == 0 && tag_mask == 0) {
- 		if (ap->link.active_tag == ATA_TAG_POISON)
- 			tag = 0;
- 		else
-@@ -579,22 +632,19 @@ DRVSTILLBUSY:
- 	 */
- 
- 	 /* process completed commands */
--	sactive = core_scr_read(SCR_ACTIVE);
--	tag_mask = (host_pvt.sata_dwc_sactive_issued | sactive) ^ sactive;
-+	sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive);
-+	tag_mask = (hsdev->sactive_issued | sactive) ^ sactive;
- 
--	if (sactive != 0 || (host_pvt.sata_dwc_sactive_issued) > 1 || \
--							tag_mask > 1) {
-+	if (sactive != 0 || hsdev->sactive_issued > 1 || tag_mask > 1) {
- 		dev_dbg(ap->dev,
- 			"%s NCQ:sactive=0x%08x  sactive_issued=0x%08x tag_mask=0x%08x\n",
--			__func__, sactive, host_pvt.sata_dwc_sactive_issued,
--			tag_mask);
-+			__func__, sactive, hsdev->sactive_issued, tag_mask);
- 	}
- 
--	if ((tag_mask | (host_pvt.sata_dwc_sactive_issued)) != \
--					(host_pvt.sata_dwc_sactive_issued)) {
-+	if ((tag_mask | hsdev->sactive_issued) != hsdev->sactive_issued) {
- 		dev_warn(ap->dev,
--			 "Bad tag mask?  sactive=0x%08x (host_pvt.sata_dwc_sactive_issued)=0x%08x  tag_mask=0x%08x\n",
--			 sactive, host_pvt.sata_dwc_sactive_issued, tag_mask);
-+			 "Bad tag mask?  sactive=0x%08x sactive_issued=0x%08x  tag_mask=0x%08x\n",
-+			 sactive, hsdev->sactive_issued, tag_mask);
- 	}
- 
- 	/* read just to clear ... not bad if currently still busy */
-@@ -656,7 +706,7 @@ STILLBUSY:
- 	 * we were processing --we read status as part of processing a completed
- 	 * command).
- 	 */
--	sactive2 = core_scr_read(SCR_ACTIVE);
-+	sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive2);
- 	if (sactive2 != sactive) {
- 		dev_dbg(ap->dev,
- 			"More completed - sactive=0x%x sactive2=0x%x\n",
-@@ -672,15 +722,14 @@ DONE:
- static void sata_dwc_clear_dmacr(struct sata_dwc_device_port *hsdevp, u8 tag)
- {
- 	struct sata_dwc_device *hsdev = HSDEV_FROM_HSDEVP(hsdevp);
-+	u32 dmacr = sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr);
- 
- 	if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_RX) {
--		out_le32(&(hsdev->sata_dwc_regs->dmacr),
--			 SATA_DWC_DMACR_RX_CLEAR(
--				 in_le32(&(hsdev->sata_dwc_regs->dmacr))));
-+		dmacr = SATA_DWC_DMACR_RX_CLEAR(dmacr);
-+		sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, dmacr);
- 	} else if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_TX) {
--		out_le32(&(hsdev->sata_dwc_regs->dmacr),
--			 SATA_DWC_DMACR_TX_CLEAR(
--				 in_le32(&(hsdev->sata_dwc_regs->dmacr))));
-+		dmacr = SATA_DWC_DMACR_TX_CLEAR(dmacr);
-+		sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, dmacr);
- 	} else {
- 		/*
- 		 * This should not happen, it indicates the driver is out of
-@@ -688,10 +737,9 @@ static void sata_dwc_clear_dmacr(struct
- 		 */
- 		dev_err(hsdev->dev,
- 			"%s DMA protocol RX and TX DMA not pending tag=0x%02x pending=%d dmacr: 0x%08x\n",
--			__func__, tag, hsdevp->dma_pending[tag],
--			in_le32(&hsdev->sata_dwc_regs->dmacr));
--		out_le32(&(hsdev->sata_dwc_regs->dmacr),
--			SATA_DWC_DMACR_TXRXCH_CLEAR);
-+			__func__, tag, hsdevp->dma_pending[tag], dmacr);
-+		sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr,
-+				SATA_DWC_DMACR_TXRXCH_CLEAR);
- 	}
- }
- 
-@@ -716,7 +764,7 @@ static void sata_dwc_dma_xfer_complete(s
- 			 __func__, qc->tag, qc->tf.command,
- 			 get_dma_dir_descript(qc->dma_dir),
- 			 get_prot_descript(qc->tf.protocol),
--			 in_le32(&(hsdev->sata_dwc_regs->dmacr)));
-+			 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
- 	}
- #endif
- 
-@@ -725,7 +773,7 @@ static void sata_dwc_dma_xfer_complete(s
- 			dev_err(ap->dev,
- 				"%s DMA protocol RX and TX DMA not pending dmacr: 0x%08x\n",
- 				__func__,
--				in_le32(&(hsdev->sata_dwc_regs->dmacr)));
-+				sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
- 		}
- 
- 		hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE;
-@@ -742,8 +790,9 @@ static int sata_dwc_qc_complete(struct a
- 	u8 status = 0;
- 	u32 mask = 0x0;
- 	u8 tag = qc->tag;
-+	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
- 	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
--	host_pvt.sata_dwc_sactive_queued = 0;
-+	hsdev->sactive_queued = 0;
- 	dev_dbg(ap->dev, "%s checkstatus? %x\n", __func__, check_status);
- 
- 	if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_TX)
-@@ -756,10 +805,8 @@ static int sata_dwc_qc_complete(struct a
- 
- 	/* clear active bit */
- 	mask = (~(qcmd_tag_to_mask(tag)));
--	host_pvt.sata_dwc_sactive_queued = (host_pvt.sata_dwc_sactive_queued) \
--						& mask;
--	host_pvt.sata_dwc_sactive_issued = (host_pvt.sata_dwc_sactive_issued) \
--						& mask;
-+	hsdev->sactive_queued = hsdev->sactive_queued & mask;
-+	hsdev->sactive_issued = hsdev->sactive_issued & mask;
- 	ata_qc_complete(qc);
- 	return 0;
- }
-@@ -767,54 +814,62 @@ static int sata_dwc_qc_complete(struct a
- static void sata_dwc_enable_interrupts(struct sata_dwc_device *hsdev)
- {
- 	/* Enable selective interrupts by setting the interrupt maskregister*/
--	out_le32(&hsdev->sata_dwc_regs->intmr,
--		 SATA_DWC_INTMR_ERRM |
--		 SATA_DWC_INTMR_NEWFPM |
--		 SATA_DWC_INTMR_PMABRTM |
--		 SATA_DWC_INTMR_DMATM);
-+	sata_dwc_writel(&hsdev->sata_dwc_regs->intmr,
-+			SATA_DWC_INTMR_ERRM |
-+			SATA_DWC_INTMR_NEWFPM |
-+			SATA_DWC_INTMR_PMABRTM |
-+			SATA_DWC_INTMR_DMATM);
- 	/*
- 	 * Unmask the error bits that should trigger an error interrupt by
- 	 * setting the error mask register.
- 	 */
--	out_le32(&hsdev->sata_dwc_regs->errmr, SATA_DWC_SERROR_ERR_BITS);
-+	sata_dwc_writel(&hsdev->sata_dwc_regs->errmr, SATA_DWC_SERROR_ERR_BITS);
- 
- 	dev_dbg(hsdev->dev, "%s: INTMR = 0x%08x, ERRMR = 0x%08x\n",
--		 __func__, in_le32(&hsdev->sata_dwc_regs->intmr),
--		in_le32(&hsdev->sata_dwc_regs->errmr));
-+		 __func__, sata_dwc_readl(&hsdev->sata_dwc_regs->intmr),
-+		sata_dwc_readl(&hsdev->sata_dwc_regs->errmr));
- }
- 
--static bool sata_dwc_dma_filter(struct dma_chan *chan, void *param)
-+static void sata_dwc_setup_port(struct ata_ioports *port, void __iomem *base)
- {
--	struct sata_dwc_device_port *hsdevp = param;
--	struct dw_dma_slave *dws = hsdevp->dws;
-+	port->cmd_addr		= base + 0x00;
-+	port->data_addr		= base + 0x00;
- 
--	if (dws->dma_dev != chan->device->dev)
--		return false;
-+	port->error_addr	= base + 0x04;
-+	port->feature_addr	= base + 0x04;
- 
--	chan->private = dws;
--	return true;
--}
-+	port->nsect_addr	= base + 0x08;
- 
--static void sata_dwc_setup_port(struct ata_ioports *port, unsigned long base)
--{
--	port->cmd_addr = (void __iomem *)base + 0x00;
--	port->data_addr = (void __iomem *)base + 0x00;
-+	port->lbal_addr		= base + 0x0c;
-+	port->lbam_addr		= base + 0x10;
-+	port->lbah_addr		= base + 0x14;
-+
-+	port->device_addr	= base + 0x18;
-+	port->command_addr	= base + 0x1c;
-+	port->status_addr	= base + 0x1c;
- 
--	port->error_addr = (void __iomem *)base + 0x04;
--	port->feature_addr = (void __iomem *)base + 0x04;
-+	port->altstatus_addr	= base + 0x20;
-+	port->ctl_addr		= base + 0x20;
-+}
- 
--	port->nsect_addr = (void __iomem *)base + 0x08;
-+static int sata_dwc_dma_get_channel(struct sata_dwc_device_port *hsdevp)
-+{
-+	struct sata_dwc_device *hsdev = hsdevp->hsdev;
-+	struct device *dev = hsdev->dev;
- 
--	port->lbal_addr = (void __iomem *)base + 0x0c;
--	port->lbam_addr = (void __iomem *)base + 0x10;
--	port->lbah_addr = (void __iomem *)base + 0x14;
-+#ifdef CONFIG_SATA_DWC_OLD_DMA
-+	if (!of_find_property(dev->of_node, "dmas", NULL))
-+		return sata_dwc_dma_get_channel_old(hsdevp);
-+#endif
- 
--	port->device_addr = (void __iomem *)base + 0x18;
--	port->command_addr = (void __iomem *)base + 0x1c;
--	port->status_addr = (void __iomem *)base + 0x1c;
-+	hsdevp->chan = dma_request_chan(dev, "sata-dma");
-+	if (IS_ERR(hsdevp->chan)) {
-+		dev_err(dev, "failed to allocate dma channel: %ld\n",
-+			PTR_ERR(hsdevp->chan));
-+		return PTR_ERR(hsdevp->chan);
-+	}
- 
--	port->altstatus_addr = (void __iomem *)base + 0x20;
--	port->ctl_addr = (void __iomem *)base + 0x20;
-+	return 0;
- }
- 
- /*
-@@ -829,7 +884,6 @@ static int sata_dwc_port_start(struct at
- 	struct sata_dwc_device *hsdev;
- 	struct sata_dwc_device_port *hsdevp = NULL;
- 	struct device *pdev;
--	dma_cap_mask_t mask;
- 	int i;
- 
- 	hsdev = HSDEV_FROM_AP(ap);
-@@ -853,20 +907,13 @@ static int sata_dwc_port_start(struct at
- 	}
- 	hsdevp->hsdev = hsdev;
- 
--	hsdevp->dws = &sata_dwc_dma_dws;
--	hsdevp->dws->dma_dev = hsdev->dev;
--
--	dma_cap_zero(mask);
--	dma_cap_set(DMA_SLAVE, mask);
-+	err = sata_dwc_dma_get_channel(hsdevp);
-+	if (err)
-+		goto CLEANUP_ALLOC;
- 
--	/* Acquire DMA channel */
--	hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp);
--	if (!hsdevp->chan) {
--		dev_err(hsdev->dev, "%s: dma channel unavailable\n",
--			 __func__);
--		err = -EAGAIN;
-+	err = phy_power_on(hsdev->phy);
-+	if (err)
- 		goto CLEANUP_ALLOC;
--	}
- 
- 	for (i = 0; i < SATA_DWC_QCMD_MAX; i++)
- 		hsdevp->cmd_issued[i] = SATA_DWC_CMD_ISSUED_NOT;
-@@ -877,18 +924,18 @@ static int sata_dwc_port_start(struct at
- 	if (ap->port_no == 0)  {
- 		dev_dbg(ap->dev, "%s: clearing TXCHEN, RXCHEN in DMAC\n",
- 			__func__);
--		out_le32(&hsdev->sata_dwc_regs->dmacr,
--			 SATA_DWC_DMACR_TXRXCH_CLEAR);
-+		sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr,
-+				SATA_DWC_DMACR_TXRXCH_CLEAR);
- 
- 		dev_dbg(ap->dev, "%s: setting burst size in DBTSR\n",
- 			 __func__);
--		out_le32(&hsdev->sata_dwc_regs->dbtsr,
--			 (SATA_DWC_DBTSR_MWR(AHB_DMA_BRST_DFLT) |
--			  SATA_DWC_DBTSR_MRD(AHB_DMA_BRST_DFLT)));
-+		sata_dwc_writel(&hsdev->sata_dwc_regs->dbtsr,
-+				(SATA_DWC_DBTSR_MWR(AHB_DMA_BRST_DFLT) |
-+				 SATA_DWC_DBTSR_MRD(AHB_DMA_BRST_DFLT)));
- 	}
- 
- 	/* Clear any error bits before libata starts issuing commands */
--	clear_serror();
-+	clear_serror(ap);
- 	ap->private_data = hsdevp;
- 	dev_dbg(ap->dev, "%s: done\n", __func__);
- 	return 0;
-@@ -903,11 +950,13 @@ CLEANUP:
- static void sata_dwc_port_stop(struct ata_port *ap)
- {
- 	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
-+	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
- 
- 	dev_dbg(ap->dev, "%s: ap->id = %d\n", __func__, ap->print_id);
- 
--	dmaengine_terminate_all(hsdevp->chan);
-+	dmaengine_terminate_sync(hsdevp->chan);
- 	dma_release_channel(hsdevp->chan);
-+	phy_power_off(hsdev->phy);
- 
- 	kfree(hsdevp);
- 	ap->private_data = NULL;
-@@ -924,22 +973,20 @@ static void sata_dwc_exec_command_by_tag
- 					 struct ata_taskfile *tf,
- 					 u8 tag, u32 cmd_issued)
- {
--	unsigned long flags;
- 	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
- 
- 	dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command,
- 		ata_get_cmd_descript(tf->command), tag);
- 
--	spin_lock_irqsave(&ap->host->lock, flags);
- 	hsdevp->cmd_issued[tag] = cmd_issued;
--	spin_unlock_irqrestore(&ap->host->lock, flags);
-+
- 	/*
- 	 * Clear SError before executing a new command.
- 	 * sata_dwc_scr_write and read can not be used here. Clearing the PM
- 	 * managed SError register for the disk needs to be done before the
- 	 * task file is loaded.
- 	 */
--	clear_serror();
-+	clear_serror(ap);
- 	ata_sff_exec_command(ap, tf);
- }
- 
-@@ -992,18 +1039,18 @@ static void sata_dwc_bmdma_start_by_tag(
- 	sata_dwc_tf_dump(ap, &qc->tf);
- 
- 	if (start_dma) {
--		reg = core_scr_read(SCR_ERROR);
-+		sata_dwc_scr_read(&ap->link, SCR_ERROR, &reg);
- 		if (reg & SATA_DWC_SERROR_ERR_BITS) {
- 			dev_err(ap->dev, "%s: ****** SError=0x%08x ******\n",
- 				__func__, reg);
- 		}
- 
- 		if (dir == DMA_TO_DEVICE)
--			out_le32(&hsdev->sata_dwc_regs->dmacr,
--				SATA_DWC_DMACR_TXCHEN);
-+			sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr,
-+					SATA_DWC_DMACR_TXCHEN);
- 		else
--			out_le32(&hsdev->sata_dwc_regs->dmacr,
--				SATA_DWC_DMACR_RXCHEN);
-+			sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr,
-+					SATA_DWC_DMACR_RXCHEN);
- 
- 		/* Enable AHB DMA transfer on the specified channel */
- 		dmaengine_submit(desc);
-@@ -1025,36 +1072,12 @@ static void sata_dwc_bmdma_start(struct
- 	sata_dwc_bmdma_start_by_tag(qc, tag);
- }
- 
--/*
-- * Function : sata_dwc_qc_prep_by_tag
-- * arguments : ata_queued_cmd *qc, u8 tag
-- * Return value : None
-- * qc_prep for a particular queued command based on tag
-- */
--static void sata_dwc_qc_prep_by_tag(struct ata_queued_cmd *qc, u8 tag)
--{
--	struct dma_async_tx_descriptor *desc;
--	struct ata_port *ap = qc->ap;
--	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
--
--	dev_dbg(ap->dev, "%s: port=%d dma dir=%s n_elem=%d\n",
--		__func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
--		 qc->n_elem);
--
--	desc = dma_dwc_xfer_setup(qc);
--	if (!desc) {
--		dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",
--			__func__);
--		return;
--	}
--	hsdevp->desc[tag] = desc;
--}
--
- static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc)
- {
- 	u32 sactive;
- 	u8 tag = qc->tag;
- 	struct ata_port *ap = qc->ap;
-+	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
- 
- #ifdef DEBUG_NCQ
- 	if (qc->tag > 0 || ap->link.sactive > 1)
-@@ -1068,47 +1091,33 @@ static unsigned int sata_dwc_qc_issue(st
- 
- 	if (!ata_is_ncq(qc->tf.protocol))
- 		tag = 0;
--	sata_dwc_qc_prep_by_tag(qc, tag);
-+
-+	if (ata_is_dma(qc->tf.protocol)) {
-+		hsdevp->desc[tag] = dma_dwc_xfer_setup(qc);
-+		if (!hsdevp->desc[tag])
-+			return AC_ERR_SYSTEM;
-+	} else {
-+		hsdevp->desc[tag] = NULL;
-+	}
- 
- 	if (ata_is_ncq(qc->tf.protocol)) {
--		sactive = core_scr_read(SCR_ACTIVE);
-+		sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive);
- 		sactive |= (0x00000001 << tag);
--		core_scr_write(SCR_ACTIVE, sactive);
-+		sata_dwc_scr_write(&ap->link, SCR_ACTIVE, sactive);
- 
- 		dev_dbg(qc->ap->dev,
- 			"%s: tag=%d ap->link.sactive = 0x%08x sactive=0x%08x\n",
- 			__func__, tag, qc->ap->link.sactive, sactive);
- 
- 		ap->ops->sff_tf_load(ap, &qc->tf);
--		sata_dwc_exec_command_by_tag(ap, &qc->tf, qc->tag,
-+		sata_dwc_exec_command_by_tag(ap, &qc->tf, tag,
- 					     SATA_DWC_CMD_ISSUED_PEND);
- 	} else {
--		ata_sff_qc_issue(qc);
-+		return ata_bmdma_qc_issue(qc);
- 	}
- 	return 0;
- }
- 
--/*
-- * Function : sata_dwc_qc_prep
-- * arguments : ata_queued_cmd *qc
-- * Return value : None
-- * qc_prep for a particular queued command
-- */
--
--static void sata_dwc_qc_prep(struct ata_queued_cmd *qc)
--{
--	if ((qc->dma_dir == DMA_NONE) || (qc->tf.protocol == ATA_PROT_PIO))
--		return;
--
--#ifdef DEBUG_NCQ
--	if (qc->tag > 0)
--		dev_info(qc->ap->dev, "%s: qc->tag=%d ap->active_tag=0x%08x\n",
--			 __func__, qc->tag, qc->ap->link.active_tag);
--
--	return ;
--#endif
--}
--
- static void sata_dwc_error_handler(struct ata_port *ap)
- {
- 	ata_sff_error_handler(ap);
-@@ -1125,17 +1134,22 @@ static int sata_dwc_hardreset(struct ata
- 	sata_dwc_enable_interrupts(hsdev);
- 
- 	/* Reconfigure the DMA control register */
--	out_le32(&hsdev->sata_dwc_regs->dmacr,
--		 SATA_DWC_DMACR_TXRXCH_CLEAR);
-+	sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr,
-+			SATA_DWC_DMACR_TXRXCH_CLEAR);
- 
- 	/* Reconfigure the DMA Burst Transaction Size register */
--	out_le32(&hsdev->sata_dwc_regs->dbtsr,
--		 SATA_DWC_DBTSR_MWR(AHB_DMA_BRST_DFLT) |
--		 SATA_DWC_DBTSR_MRD(AHB_DMA_BRST_DFLT));
-+	sata_dwc_writel(&hsdev->sata_dwc_regs->dbtsr,
-+			SATA_DWC_DBTSR_MWR(AHB_DMA_BRST_DFLT) |
-+			SATA_DWC_DBTSR_MRD(AHB_DMA_BRST_DFLT));
- 
- 	return ret;
- }
- 
-+static void sata_dwc_dev_select(struct ata_port *ap, unsigned int device)
-+{
-+	/* SATA DWC is master only */
-+}
-+
- /*
-  * scsi mid-layer and libata interface structures
-  */
-@@ -1148,7 +1162,13 @@ static struct scsi_host_template sata_dw
- 	 */
- 	.sg_tablesize		= LIBATA_MAX_PRD,
- 	/* .can_queue		= ATA_MAX_QUEUE, */
--	.dma_boundary		= ATA_DMA_BOUNDARY,
-+	/*
-+	 * Make sure a LLI block is not created that will span 8K max FIS
-+	 * boundary. If the block spans such a FIS boundary, there is a chance
-+	 * that a DMA burst will cross that boundary -- this results in an
-+	 * error in the host controller.
-+	 */
-+	.dma_boundary		= 0x1fff /* ATA_DMA_BOUNDARY */,
- };
- 
- static struct ata_port_operations sata_dwc_ops = {
-@@ -1157,7 +1177,6 @@ static struct ata_port_operations sata_d
- 	.error_handler		= sata_dwc_error_handler,
- 	.hardreset		= sata_dwc_hardreset,
- 
--	.qc_prep		= sata_dwc_qc_prep,
- 	.qc_issue		= sata_dwc_qc_issue,
- 
- 	.scr_read		= sata_dwc_scr_read,
-@@ -1166,6 +1185,8 @@ static struct ata_port_operations sata_d
- 	.port_start		= sata_dwc_port_start,
- 	.port_stop		= sata_dwc_port_stop,
- 
-+	.sff_dev_select		= sata_dwc_dev_select,
-+
- 	.bmdma_setup		= sata_dwc_bmdma_setup,
- 	.bmdma_start		= sata_dwc_bmdma_start,
- };
-@@ -1184,13 +1205,14 @@ static int sata_dwc_probe(struct platfor
- 	struct sata_dwc_device *hsdev;
- 	u32 idr, versionr;
- 	char *ver = (char *)&versionr;
--	u8 __iomem *base;
-+	void __iomem *base;
- 	int err = 0;
- 	int irq;
- 	struct ata_host *host;
- 	struct ata_port_info pi = sata_dwc_port_info[0];
- 	const struct ata_port_info *ppi[] = { &pi, NULL };
- 	struct device_node *np = ofdev->dev.of_node;
-+	struct resource *res;
- 
- 	/* Allocate DWC SATA device */
- 	host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_DWC_MAX_PORTS);
-@@ -1201,57 +1223,33 @@ static int sata_dwc_probe(struct platfor
- 	host->private_data = hsdev;
- 
- 	/* Ioremap SATA registers */
--	base = of_iomap(np, 0);
--	if (!base) {
-+	res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-+	base = devm_ioremap_resource(&ofdev->dev, res);
-+	if (IS_ERR(base)) {
- 		dev_err(&ofdev->dev,
- 			"ioremap failed for SATA register address\n");
--		return -ENODEV;
-+		return PTR_ERR(base);
- 	}
--	hsdev->reg_base = base;
- 	dev_dbg(&ofdev->dev, "ioremap done for SATA register address\n");
- 
- 	/* Synopsys DWC SATA specific Registers */
--	hsdev->sata_dwc_regs = (void *__iomem)(base + SATA_DWC_REG_OFFSET);
-+	hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET;
-+	hsdev->dmadr = res->start + SATA_DWC_REG_OFFSET + offsetof(struct sata_dwc_regs, dmadr);
- 
- 	/* Setup port */
- 	host->ports[0]->ioaddr.cmd_addr = base;
- 	host->ports[0]->ioaddr.scr_addr = base + SATA_DWC_SCR_OFFSET;
--	host_pvt.scr_addr_sstatus = base + SATA_DWC_SCR_OFFSET;
--	sata_dwc_setup_port(&host->ports[0]->ioaddr, (unsigned long)base);
-+	sata_dwc_setup_port(&host->ports[0]->ioaddr, base);
- 
- 	/* Read the ID and Version Registers */
--	idr = in_le32(&hsdev->sata_dwc_regs->idr);
--	versionr = in_le32(&hsdev->sata_dwc_regs->versionr);
-+	idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr);
-+	versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr);
- 	dev_notice(&ofdev->dev, "id %d, controller version %c.%c%c\n",
- 		   idr, ver[0], ver[1], ver[2]);
- 
--	/* Get SATA DMA interrupt number */
--	hsdev->dma->irq = irq_of_parse_and_map(np, 1);
--	if (hsdev->dma->irq == NO_IRQ) {
--		dev_err(&ofdev->dev, "no SATA DMA irq\n");
--		err = -ENODEV;
--		goto error_iomap;
--	}
--
--	/* Get physical SATA DMA register base address */
--	hsdev->dma->regs = of_iomap(np, 1);
--	if (!hsdev->dma->regs) {
--		dev_err(&ofdev->dev,
--			"ioremap failed for AHBDMA register address\n");
--		err = -ENODEV;
--		goto error_iomap;
--	}
--
- 	/* Save dev for later use in dev_xxx() routines */
- 	hsdev->dev = &ofdev->dev;
- 
--	hsdev->dma->dev = &ofdev->dev;
--
--	/* Initialize AHB DMAC */
--	err = dw_dma_probe(hsdev->dma, NULL);
--	if (err)
--		goto error_dma_iomap;
--
- 	/* Enable SATA Interrupts */
- 	sata_dwc_enable_interrupts(hsdev);
- 
-@@ -1263,6 +1261,25 @@ static int sata_dwc_probe(struct platfor
- 		goto error_out;
- 	}
- 
-+#ifdef CONFIG_SATA_DWC_OLD_DMA
-+	if (!of_find_property(np, "dmas", NULL)) {
-+		err = sata_dwc_dma_init_old(ofdev, hsdev);
-+		if (err)
-+			goto error_out;
-+	}
-+#endif
-+
-+	hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy");
-+	if (IS_ERR(hsdev->phy)) {
-+		err = PTR_ERR(hsdev->phy);
-+		hsdev->phy = NULL;
-+		goto error_out;
-+	}
-+
-+	err = phy_init(hsdev->phy);
-+	if (err)
-+		goto error_out;
-+
- 	/*
- 	 * Now, register with libATA core, this will also initiate the
- 	 * device discovery process, invoking our port_start() handler &
-@@ -1276,12 +1293,7 @@ static int sata_dwc_probe(struct platfor
- 	return 0;
- 
- error_out:
--	/* Free SATA DMA resources */
--	dw_dma_remove(hsdev->dma);
--error_dma_iomap:
--	iounmap(hsdev->dma->regs);
--error_iomap:
--	iounmap(base);
-+	phy_exit(hsdev->phy);
- 	return err;
- }
- 
-@@ -1293,11 +1305,13 @@ static int sata_dwc_remove(struct platfo
- 
- 	ata_host_detach(host);
- 
-+	phy_exit(hsdev->phy);
-+
-+#ifdef CONFIG_SATA_DWC_OLD_DMA
- 	/* Free SATA DMA resources */
--	dw_dma_remove(hsdev->dma);
-+	sata_dwc_dma_exit_old(hsdev);
-+#endif
- 
--	iounmap(hsdev->dma->regs);
--	iounmap(hsdev->reg_base);
- 	dev_dbg(&ofdev->dev, "done\n");
- 	return 0;
- }
diff --git a/target/linux/apm821xx/patches-4.4/040-backport_leds-convert-IDE-trigger-to-common-disk-trigger.patch b/target/linux/apm821xx/patches-4.4/040-backport_leds-convert-IDE-trigger-to-common-disk-trigger.patch
deleted file mode 100644
index 48714aa..0000000
--- a/target/linux/apm821xx/patches-4.4/040-backport_leds-convert-IDE-trigger-to-common-disk-trigger.patch
+++ /dev/null
@@ -1,209 +0,0 @@
-From eb25cb9956cc9384b7fa0d75dec908c9fac8c444 Mon Sep 17 00:00:00 2001
-From: Stephan Linz <linz at li-pro.net>
-Date: Fri, 10 Jun 2016 07:59:56 +0200
-Subject: [PATCH] leds: convert IDE trigger to common disk trigger
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This patch converts the IDE specific LED trigger to a generic disk
-activity LED trigger. The libata core is now a trigger source just
-like before the IDE disk driver. It's merely a replacement of the
-string ide by disk.
-
-The patch is taken from http://dev.gentoo.org/~josejx/ata.patch and is
-widely used by any ibook/powerbook owners with great satisfaction.
-Likewise, it is very often used successfully on different ARM platforms.
-
-Unlike the original patch, the existing 'ide-disk' trigger is still
-available for backward compatibility. That reduce the amount of patches
-in affected device trees out of the mainline kernel. For further
-development, the new name 'disk-activity' should be used.
-
-Cc: Joseph Jezak <josejx at gentoo.org>
-Cc: J?rg Sommer <joerg at alea.gnuu.de>
-Cc: Richard Purdie <rpurdie at rpsys.net>
-Signed-off-by: Stephan Linz <linz at li-pro.net>
-Signed-off-by: Jacek Anaszewski <j.anaszewski at samsung.com>
----
- drivers/ata/libata-core.c               |  4 ++++
- drivers/ide/ide-disk.c                  |  2 +-
- drivers/leds/trigger/Kconfig            |  8 +++----
- drivers/leds/trigger/Makefile           |  2 +-
- drivers/leds/trigger/ledtrig-disk.c     | 41 +++++++++++++++++++++++++++++++++
- drivers/leds/trigger/ledtrig-ide-disk.c | 36 -----------------------------
- include/linux/leds.h                    |  6 ++---
- 8 files changed, 55 insertions(+), 46 deletions(-)
- create mode 100644 drivers/leds/trigger/ledtrig-disk.c
- delete mode 100644 drivers/leds/trigger/ledtrig-ide-disk.c
-
---- a/drivers/ata/libata-core.c
-+++ b/drivers/ata/libata-core.c
-@@ -67,6 +67,7 @@
- #include <asm/byteorder.h>
- #include <linux/cdrom.h>
- #include <linux/ratelimit.h>
-+#include <linux/leds.h>
- #include <linux/pm_runtime.h>
- #include <linux/platform_device.h>
- 
-@@ -4914,6 +4915,9 @@ void ata_qc_complete(struct ata_queued_c
- {
- 	struct ata_port *ap = qc->ap;
- 
-+	/* Trigger the LED (if available) */
-+	ledtrig_disk_activity();
-+
- 	/* XXX: New EH and old EH use different mechanisms to
- 	 * synchronize EH with regular execution path.
- 	 *
---- a/drivers/ide/ide-disk.c
-+++ b/drivers/ide/ide-disk.c
-@@ -186,7 +186,7 @@ static ide_startstop_t ide_do_rw_disk(id
- 	BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED);
- 	BUG_ON(rq->cmd_type != REQ_TYPE_FS);
- 
--	ledtrig_ide_activity();
-+	ledtrig_disk_activity();
- 
- 	pr_debug("%s: %sing: block=%llu, sectors=%u\n",
- 		 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
---- a/drivers/leds/trigger/Kconfig
-+++ b/drivers/leds/trigger/Kconfig
-@@ -33,12 +33,12 @@ config LEDS_TRIGGER_ONESHOT
- 
- 	  If unsure, say Y.
- 
--config LEDS_TRIGGER_IDE_DISK
--	bool "LED IDE Disk Trigger"
--	depends on IDE_GD_ATA
-+config LEDS_TRIGGER_DISK
-+	bool "LED Disk Trigger"
-+	depends on IDE_GD_ATA || ATA
- 	depends on LEDS_TRIGGERS
- 	help
--	  This allows LEDs to be controlled by IDE disk activity.
-+	  This allows LEDs to be controlled by disk activity.
- 	  If unsure, say Y.
- 
- config LEDS_TRIGGER_HEARTBEAT
---- a/drivers/leds/trigger/Makefile
-+++ b/drivers/leds/trigger/Makefile
-@@ -1,6 +1,6 @@
- obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
- obj-$(CONFIG_LEDS_TRIGGER_ONESHOT)	+= ledtrig-oneshot.o
--obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
-+obj-$(CONFIG_LEDS_TRIGGER_DISK)		+= ledtrig-disk.o
- obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
- obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT)	+= ledtrig-backlight.o
- obj-$(CONFIG_LEDS_TRIGGER_GPIO)		+= ledtrig-gpio.o
---- /dev/null
-+++ b/drivers/leds/trigger/ledtrig-disk.c
-@@ -0,0 +1,41 @@
-+/*
-+ * LED Disk Activity Trigger
-+ *
-+ * Copyright 2006 Openedhand Ltd.
-+ *
-+ * Author: Richard Purdie <rpurdie at openedhand.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/leds.h>
-+
-+#define BLINK_DELAY 30
-+
-+DEFINE_LED_TRIGGER(ledtrig_disk);
-+DEFINE_LED_TRIGGER(ledtrig_ide);
-+
-+void ledtrig_disk_activity(void)
-+{
-+	unsigned long blink_delay = BLINK_DELAY;
-+
-+	led_trigger_blink_oneshot(ledtrig_disk,
-+				  &blink_delay, &blink_delay, 0);
-+	led_trigger_blink_oneshot(ledtrig_ide,
-+				  &blink_delay, &blink_delay, 0);
-+}
-+EXPORT_SYMBOL(ledtrig_disk_activity);
-+
-+static int __init ledtrig_disk_init(void)
-+{
-+	led_trigger_register_simple("disk-activity", &ledtrig_disk);
-+	led_trigger_register_simple("ide-disk", &ledtrig_ide);
-+
-+	return 0;
-+}
-+device_initcall(ledtrig_disk_init);
---- a/drivers/leds/trigger/ledtrig-ide-disk.c
-+++ /dev/null
-@@ -1,47 +0,0 @@
--/*
-- * LED IDE-Disk Activity Trigger
-- *
-- * Copyright 2006 Openedhand Ltd.
-- *
-- * Author: Richard Purdie <rpurdie at openedhand.com>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License version 2 as
-- * published by the Free Software Foundation.
-- *
-- */
--
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/init.h>
--#include <linux/leds.h>
--
--#define BLINK_DELAY 30
--
--DEFINE_LED_TRIGGER(ledtrig_ide);
--static unsigned long ide_blink_delay = BLINK_DELAY;
--
--void ledtrig_ide_activity(void)
--{
--	led_trigger_blink_oneshot(ledtrig_ide,
--				  &ide_blink_delay, &ide_blink_delay, 0);
--}
--EXPORT_SYMBOL(ledtrig_ide_activity);
--
--static int __init ledtrig_ide_init(void)
--{
--	led_trigger_register_simple("ide-disk", &ledtrig_ide);
--	return 0;
--}
--
--static void __exit ledtrig_ide_exit(void)
--{
--	led_trigger_unregister_simple(ledtrig_ide);
--}
--
--module_init(ledtrig_ide_init);
--module_exit(ledtrig_ide_exit);
--
--MODULE_AUTHOR("Richard Purdie <rpurdie at openedhand.com>");
--MODULE_DESCRIPTION("LED IDE Disk Activity Trigger");
--MODULE_LICENSE("GPL");
---- a/include/linux/leds.h
-+++ b/include/linux/leds.h
-@@ -308,10 +308,10 @@ static inline void *led_get_trigger_data
- #endif /* CONFIG_LEDS_TRIGGERS */
- 
- /* Trigger specific functions */
--#ifdef CONFIG_LEDS_TRIGGER_IDE_DISK
--extern void ledtrig_ide_activity(void);
-+#ifdef CONFIG_LEDS_TRIGGER_DISK
-+extern void ledtrig_disk_activity(void);
- #else
--static inline void ledtrig_ide_activity(void) {}
-+static inline void ledtrig_disk_activity(void) {}
- #endif
- 
- #if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE)
diff --git a/target/linux/apm821xx/patches-4.4/200-add-meraki-mr24-ikarem-support.patch b/target/linux/apm821xx/patches-4.4/200-add-meraki-mr24-ikarem-support.patch
deleted file mode 100644
index 018bcf2..0000000
--- a/target/linux/apm821xx/patches-4.4/200-add-meraki-mr24-ikarem-support.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/powerpc/platforms/44x/Kconfig
-+++ b/arch/powerpc/platforms/44x/Kconfig
-@@ -40,6 +40,19 @@ config EBONY
- 	help
- 	  This option enables support for the IBM PPC440GP evaluation board.
- 
-+config IKAREM
-+	bool "Ikarem"
-+	depends on 44x
-+	default n
-+	select PPC44x_SIMPLE
-+	select APM821xx
-+	select PCI_MSI
-+	select PPC4xx_MSI
-+	select PPC4xx_PCI_EXPRESS
-+	select IBM_EMAC_RGMII
-+	help
-+	  This option enables support for the Cisco Meraki MR24 (Ikarem) Access Point.
-+
- config SAM440EP
-         bool "Sam440ep"
- 	depends on 44x
---- a/arch/powerpc/platforms/44x/ppc44x_simple.c
-+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
-@@ -62,6 +62,7 @@ static char *board[] __initdata = {
- 	"amcc,sequoia",
- 	"amcc,taishan",
- 	"amcc,yosemite",
-+	"meraki,ikarem",
- 	"mosaixtech,icon"
- };
- 
diff --git a/target/linux/apm821xx/patches-4.4/201-add-amcc-apollo3g-support.patch b/target/linux/apm821xx/patches-4.4/201-add-amcc-apollo3g-support.patch
deleted file mode 100644
index 0581a43..0000000
--- a/target/linux/apm821xx/patches-4.4/201-add-amcc-apollo3g-support.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/arch/powerpc/platforms/44x/Kconfig
-+++ b/arch/powerpc/platforms/44x/Kconfig
-@@ -143,6 +143,17 @@ config CANYONLANDS
- 	help
- 	  This option enables support for the AMCC PPC460EX evaluation board.
- 
-+config APOLLO3G
-+	bool "Apollo3G"
-+	depends on 44x
-+	default n
-+	select PPC44x_SIMPLE
-+	select APM821xx
-+	select IBM_EMAC_RGMII
-+	select 460EX
-+	help
-+	  This option enables support for the AMCC Apollo 3G board.
-+
- config GLACIER
- 	bool "Glacier"
- 	depends on 44x
---- a/arch/powerpc/platforms/44x/ppc44x_simple.c
-+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
-@@ -50,6 +50,7 @@ machine_device_initcall(ppc44x_simple, p
-  * board.c file for it rather than adding it to this list.
-  */
- static char *board[] __initdata = {
-+	"amcc,apollo3g",
- 	"amcc,arches",
- 	"amcc,bamboo",
- 	"apm,bluestone",
diff --git a/target/linux/apm821xx/patches-4.4/202-add-netgear-wndr4700-support.patch b/target/linux/apm821xx/patches-4.4/202-add-netgear-wndr4700-support.patch
deleted file mode 100644
index 6b6db1d..0000000
--- a/target/linux/apm821xx/patches-4.4/202-add-netgear-wndr4700-support.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/powerpc/platforms/44x/Makefile
-+++ b/arch/powerpc/platforms/44x/Makefile
-@@ -3,6 +3,7 @@ ifneq ($(CONFIG_PPC4xx_CPM),y)
- obj-$(CONFIG_44x)	+= idle.o
- endif
- obj-$(CONFIG_PPC44x_SIMPLE) += ppc44x_simple.o
-+obj-$(CONFIG_WNDR4700) += wndr4700.o
- obj-$(CONFIG_EBONY)	+= ebony.o
- obj-$(CONFIG_SAM440EP) 	+= sam440ep.o
- obj-$(CONFIG_WARP)	+= warp.o
---- a/arch/powerpc/platforms/44x/Kconfig
-+++ b/arch/powerpc/platforms/44x/Kconfig
-@@ -260,6 +260,19 @@ config ICON
- 	help
- 	  This option enables support for the AMCC PPC440SPe evaluation board.
- 
-+config WNDR4700
-+	bool "WNDR4700"
-+	depends on 44x
-+	default n
-+	select APM821xx
-+	select PCI_MSI
-+	select PPC4xx_MSI
-+	select PPC4xx_PCI_EXPRESS
-+	select IBM_EMAC_RGMII
-+	select 460EX
-+	help
-+	  This option enables support for the Netgear WNDR4700/WNDR4720 board.
-+
- config XILINX_VIRTEX440_GENERIC_BOARD
- 	bool "Generic Xilinx Virtex 5 FXT board support"
- 	depends on 44x
diff --git a/target/linux/apm821xx/patches-4.4/203-add-meraki-mx60-buckminster-support.patch b/target/linux/apm821xx/patches-4.4/203-add-meraki-mx60-buckminster-support.patch
deleted file mode 100644
index 8c07238..0000000
--- a/target/linux/apm821xx/patches-4.4/203-add-meraki-mx60-buckminster-support.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/powerpc/platforms/44x/Kconfig
-+++ b/arch/powerpc/platforms/44x/Kconfig
-@@ -30,6 +30,19 @@ config BLUESTONE
- 	help
- 	  This option enables support for the APM APM821xx Evaluation board.
- 
-+config BUCKMINSTER
-+	bool "Buckminster"
-+	depends on 44x
-+	default n
-+	select APM821xx
-+	select PCI_MSI
-+	select PPC4xx_MSI
-+	select PPC4xx_PCI_EXPRESS
-+	select IBM_EMAC_RGMII
-+	select 460EX
-+	help
-+	  This option enables support for the Cisco Meraki MX60/MX60W (Buckminster) Security Appliance
-+
- config EBONY
- 	bool "Ebony"
- 	depends on 44x
---- a/arch/powerpc/platforms/44x/ppc44x_simple.c
-+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
-@@ -63,6 +63,7 @@ static char *board[] __initdata = {
- 	"amcc,sequoia",
- 	"amcc,taishan",
- 	"amcc,yosemite",
-+	"meraki,buckminster",
- 	"meraki,ikarem",
- 	"mosaixtech,icon"
- };
diff --git a/target/linux/apm821xx/patches-4.4/300-fix-atheros-nics-on-apm82181.patch b/target/linux/apm821xx/patches-4.4/300-fix-atheros-nics-on-apm82181.patch
deleted file mode 100644
index 0b1affc..0000000
--- a/target/linux/apm821xx/patches-4.4/300-fix-atheros-nics-on-apm82181.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- a/arch/powerpc/sysdev/ppc4xx_pci.c
-+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
-@@ -1066,15 +1066,24 @@ static int __init apm821xx_pciex_init_po
- 	u32 val;
- 
- 	/*
--	 * Do a software reset on PCIe ports.
--	 * This code is to fix the issue that pci drivers doesn't re-assign
--	 * bus number for PCIE devices after Uboot
--	 * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000
--	 * PT quad port, SAS LSI 1064E)
-+	 * Only reset the PHY when no link is currently established.
-+	 * This is for the Atheros PCIe board which has problems to establish
-+	 * the link (again) after this PHY reset. All other currently tested
-+	 * PCIe boards don't show this problem.
- 	 */
--
--	mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0);
--	mdelay(10);
-+	val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP);
-+	if (!(val & 0x00001000)) {
-+		/*
-+		 * Do a software reset on PCIe ports.
-+		 * This code is to fix the issue that pci drivers doesn't re-assign
-+		 * bus number for PCIE devices after Uboot
-+		 * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000
-+		 * PT quad port, SAS LSI 1064E)
-+		 */
-+
-+		mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0);
-+		mdelay(10);
-+	}
- 
- 	if (port->endpoint)
- 		val = PTYPE_LEGACY_ENDPOINT << 20;
-@@ -1091,9 +1100,12 @@ static int __init apm821xx_pciex_init_po
- 	mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000130);
- 	mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006);
- 
--	mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000);
--	mdelay(50);
--	mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000);
-+	val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP);
-+	if (!(val & 0x00001000)) {
-+		mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000);
-+		mdelay(50);
-+		mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000);
-+	}
- 
- 	mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
- 		mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) |
diff --git a/target/linux/apm821xx/patches-4.4/301-fix-memory-map-wndr4700.patch b/target/linux/apm821xx/patches-4.4/301-fix-memory-map-wndr4700.patch
deleted file mode 100644
index d6a1006..0000000
--- a/target/linux/apm821xx/patches-4.4/301-fix-memory-map-wndr4700.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/arch/powerpc/sysdev/ppc4xx_pci.c
-+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
-@@ -1913,9 +1913,9 @@ static void __init ppc4xx_configure_pcie
- 		 * if it works
- 		 */
- 		out_le32(mbase + PECFG_PIM0LAL, 0x00000000);
--		out_le32(mbase + PECFG_PIM0LAH, 0x00000000);
-+		out_le32(mbase + PECFG_PIM0LAH, 0x00000008);
- 		out_le32(mbase + PECFG_PIM1LAL, 0x00000000);
--		out_le32(mbase + PECFG_PIM1LAH, 0x00000000);
-+		out_le32(mbase + PECFG_PIM1LAH, 0x0000000c);
- 		out_le32(mbase + PECFG_PIM01SAH, 0xffff0000);
- 		out_le32(mbase + PECFG_PIM01SAL, 0x00000000);
- 
diff --git a/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch b/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch
deleted file mode 100644
index 011e785..0000000
--- a/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch
+++ /dev/null
@@ -1,52 +0,0 @@
---- a/drivers/net/ethernet/ibm/emac/core.c
-+++ b/drivers/net/ethernet/ibm/emac/core.c
-@@ -129,6 +129,7 @@ static inline void emac_report_timeout_e
- {
- 	if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX |
- 				  EMAC_FTR_460EX_PHY_CLK_FIX |
-+				  EMAC_FTR_APM821XX_PHY_CLK_FIX |
- 				  EMAC_FTR_440EP_PHY_CLK_FIX))
- 		DBG(dev, "%s" NL, error);
- 	else if (net_ratelimit())
-@@ -146,6 +147,10 @@ static inline void emac_rx_clk_tx(struct
- 	if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
- 		dcri_clrset(SDR0, SDR0_MFR,
- 			    0, SDR0_MFR_ECS >> dev->cell_index);
-+
-+	if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX))
-+                dcri_clrset(SDR0, SDR0_ETH_CFG,
-+                        0, 0x00000100 >> dev->cell_index);
- #endif
- }
- 
-@@ -155,6 +160,10 @@ static inline void emac_rx_clk_default(s
- 	if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
- 		dcri_clrset(SDR0, SDR0_MFR,
- 			    SDR0_MFR_ECS >> dev->cell_index, 0);
-+
-+	if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX))
-+		dcri_clrset(SDR0, SDR0_ETH_CFG,
-+			    0x00000100 >> dev->cell_index, 0);
- #endif
- }
- 
-@@ -2587,7 +2596,7 @@ static int emac_init_config(struct emac_
- 		if (of_device_is_compatible(np, "ibm,emac-apm821xx")) {
- 			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
- 					  EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
--					  EMAC_FTR_460EX_PHY_CLK_FIX);
-+					  EMAC_FTR_APM821XX_PHY_CLK_FIX);
- 		}
- 	} else if (of_device_is_compatible(np, "ibm,emac4")) {
- 		dev->features |= EMAC_FTR_EMAC4;
---- a/drivers/net/ethernet/ibm/emac/core.h
-+++ b/drivers/net/ethernet/ibm/emac/core.h
-@@ -333,6 +333,8 @@ struct emac_instance {
-  */
- #define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
- 
-+#define EMAC_FTR_APM821XX_PHY_CLK_FIX	0x000002000
-+
- /* Right now, we don't quite handle the always/possible masks on the
-  * most optimal way as we don't have a way to say something like
-  * always EMAC4. Patches welcome.
diff --git a/target/linux/apm821xx/patches-4.4/702-powerpc_ibm_phy_add_dt_parser.patch b/target/linux/apm821xx/patches-4.4/702-powerpc_ibm_phy_add_dt_parser.patch
deleted file mode 100644
index c84e761..0000000
--- a/target/linux/apm821xx/patches-4.4/702-powerpc_ibm_phy_add_dt_parser.patch
+++ /dev/null
@@ -1,328 +0,0 @@
-From 59b394d0d2b2e11687e757820c52d6470d15a9c5 Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey at gmail.com>
-Date: Mon, 13 Jun 2016 15:42:21 +0200
-Subject: [PATCH] phy device tree support for emac
-
----
- drivers/net/ethernet/ibm/emac/core.c | 261 +++++++++++++++++++++++++++++++++++
- drivers/net/ethernet/ibm/emac/core.h |   4 +
- 2 files changed, 265 insertions(+)
-
---- a/drivers/net/ethernet/ibm/emac/core.c
-+++ b/drivers/net/ethernet/ibm/emac/core.c
-@@ -42,6 +42,7 @@
- #include <linux/of_address.h>
- #include <linux/of_irq.h>
- #include <linux/of_net.h>
-+#include <linux/of_mdio.h>
- #include <linux/slab.h>
- 
- #include <asm/processor.h>
-@@ -2392,6 +2393,246 @@ static int emac_read_uint_prop(struct de
- 	return 0;
- }
- 
-+static void emac_adjust_link(struct net_device *ndev)
-+{
-+	struct emac_instance *dev = netdev_priv(ndev);
-+	struct phy_device *phy = dev->phy_dev;
-+
-+	dev->phy.autoneg = phy->autoneg;
-+	dev->phy.speed = phy->speed;
-+	dev->phy.duplex = phy->duplex;
-+	dev->phy.pause = phy->pause;
-+	dev->phy.asym_pause = phy->asym_pause;
-+	dev->phy.advertising = phy->advertising;
-+}
-+
-+static int emac_mii_bus_read(struct mii_bus *bus, int addr, int regnum)
-+{
-+	return emac_mdio_read(bus->priv, addr, regnum);
-+}
-+
-+static int emac_mii_bus_write(struct mii_bus *bus, int addr, int regnum, u16 val)
-+{
-+	emac_mdio_write(bus->priv, addr, regnum, val);
-+	return 0;
-+}
-+
-+static int emac_mii_bus_reset(struct mii_bus *bus)
-+{
-+	struct emac_instance *dev = netdev_priv(bus->priv);
-+
-+	emac_mii_reset_phy(&dev->phy);
-+	return 0;
-+}
-+
-+static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise)
-+{
-+	struct net_device *ndev = phy->dev;
-+	struct emac_instance *dev = netdev_priv(ndev);
-+
-+	dev->phy.autoneg = AUTONEG_ENABLE;
-+	dev->phy.speed = SPEED_1000;
-+	dev->phy.duplex = DUPLEX_FULL;
-+	dev->phy.advertising = advertise;
-+	phy->autoneg = AUTONEG_ENABLE;
-+	phy->speed = dev->phy.speed;
-+	phy->duplex = dev->phy.duplex;
-+	phy->advertising = advertise;
-+	return phy_start_aneg(dev->phy_dev);
-+}
-+
-+static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd)
-+{
-+	struct net_device *ndev = phy->dev;
-+	struct emac_instance *dev = netdev_priv(ndev);
-+
-+	dev->phy.autoneg =  AUTONEG_DISABLE;
-+	dev->phy.speed = speed;
-+	dev->phy.duplex = fd;
-+	phy->autoneg = AUTONEG_DISABLE;
-+	phy->speed = speed;
-+	phy->duplex = fd;
-+	return phy_start_aneg(dev->phy_dev);
-+}
-+
-+static int emac_mdio_poll_link(struct mii_phy *phy)
-+{
-+	struct net_device *ndev = phy->dev;
-+	struct emac_instance *dev = netdev_priv(ndev);
-+	int res;
-+
-+	res = phy_read_status(dev->phy_dev);
-+	if (res) {
-+		dev_err(&dev->ndev->dev, "link update failed (%d).", res);
-+		return ethtool_op_get_link(ndev);
-+	}
-+
-+	return dev->phy_dev->link;
-+}
-+
-+static int emac_mdio_read_link(struct mii_phy *phy)
-+{
-+	struct net_device *ndev = phy->dev;
-+	struct emac_instance *dev = netdev_priv(ndev);
-+	int res;
-+
-+	res = phy_read_status(dev->phy_dev);
-+	if (res)
-+		return res;
-+
-+	dev->phy.speed = phy->speed;
-+	dev->phy.duplex = phy->duplex;
-+	dev->phy.pause = phy->pause;
-+	dev->phy.asym_pause = phy->asym_pause;
-+	return 0;
-+}
-+
-+static int emac_mdio_init_phy(struct mii_phy *phy)
-+{
-+	struct net_device *ndev = phy->dev;
-+	struct emac_instance *dev = netdev_priv(ndev);
-+
-+	phy_start(dev->phy_dev);
-+	dev->phy.autoneg = phy->autoneg;
-+	dev->phy.speed = phy->speed;
-+	dev->phy.duplex = phy->duplex;
-+	dev->phy.advertising = phy->advertising;
-+	dev->phy.pause = phy->pause;
-+	dev->phy.asym_pause = phy->asym_pause;
-+
-+	return phy_init_hw(dev->phy_dev);
-+}
-+
-+static const struct mii_phy_ops emac_dt_mdio_phy_ops = {
-+	.init		= emac_mdio_init_phy,
-+	.setup_aneg	= emac_mdio_setup_aneg,
-+	.setup_forced	= emac_mdio_setup_forced,
-+	.poll_link	= emac_mdio_poll_link,
-+	.read_link	= emac_mdio_read_link,
-+};
-+
-+static void emac_dt_phy_mdio_cleanup(struct emac_instance *dev)
-+{
-+	if (dev->mii_bus) {
-+		if (dev->mii_bus->state == MDIOBUS_REGISTERED)
-+			mdiobus_unregister(dev->mii_bus);
-+		mdiobus_free(dev->mii_bus);
-+		dev->mii_bus = NULL;
-+	}
-+	kfree(dev->phy.def);
-+	dev->phy.def = NULL;
-+}
-+
-+static int emac_dt_mdio_probe(struct emac_instance *dev)
-+{
-+	struct device_node *mii_np;
-+	int res;
-+
-+	mii_np = of_get_child_by_name(dev->ofdev->dev.of_node, "mdio");
-+	if (!mii_np) {
-+		dev_err(&dev->ndev->dev, "no mdio definition found.");
-+		return -ENODEV;
-+	}
-+
-+	if (!of_device_is_available(mii_np)) {
-+		res = 1;
-+		goto err_put_node;
-+	}
-+
-+	dev->mii_bus = mdiobus_alloc();
-+	if (!dev->mii_bus) {
-+		res = -ENOMEM;
-+		goto err_cleanup_mdio;
-+	}
-+
-+	dev->mii_bus->priv = dev->ndev;
-+	dev->mii_bus->parent = dev->ndev->dev.parent;
-+	dev->mii_bus->name = "emac_mdio";
-+	dev->mii_bus->read = &emac_mii_bus_read;
-+	dev->mii_bus->write = &emac_mii_bus_write;
-+	dev->mii_bus->reset = &emac_mii_bus_reset;
-+	snprintf(dev->mii_bus->id, MII_BUS_ID_SIZE, "%s", dev->mii_bus->name);
-+
-+	res = of_mdiobus_register(dev->mii_bus, mii_np);
-+	if (res) {
-+		dev_err(&dev->ndev->dev, "cannot register MDIO bus %s (%d)",
-+			dev->mii_bus->name, res);
-+		goto err_cleanup_mdio;
-+	}
-+	of_node_put(mii_np);
-+	return 0;
-+
-+ err_cleanup_mdio:
-+	emac_dt_phy_mdio_cleanup(dev);
-+ err_put_node:
-+	of_node_put(mii_np);
-+	return res;
-+}
-+
-+static int emac_dt_phy_probe(struct emac_instance *dev,
-+			     struct device_node *phy_handle)
-+{
-+	u32 phy_flags = 0;
-+	int res;
-+
-+	res = of_property_read_u32(phy_handle, "phy-flags", &phy_flags);
-+	if (res < 0 && res != -EINVAL)
-+		return res;
-+
-+	dev->phy.def = kzalloc(sizeof(*dev->phy.def), GFP_KERNEL);
-+	if (!dev->phy.def)
-+		return -ENOMEM;
-+
-+	dev->phy_dev = of_phy_connect(dev->ndev, phy_handle,
-+				      &emac_adjust_link, phy_flags,
-+				      PHY_INTERFACE_MODE_RGMII);
-+	if (!dev->phy_dev) {
-+		dev_err(&dev->ndev->dev, "failed to connect to PHY.");
-+		kfree(dev->phy.dev);
-+		dev->phy.dev = NULL;
-+		return -ENODEV;
-+	}
-+
-+	dev->phy.def->phy_id = dev->phy_dev->drv->phy_id;
-+	dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask;
-+	dev->phy.def->name = dev->phy_dev->drv->name;
-+	dev->phy.def->ops = &emac_dt_mdio_phy_ops;
-+	dev->phy.features = dev->phy_dev->supported;
-+	dev->phy.address = dev->phy_dev->addr;
-+	dev->phy.mode = dev->phy_dev->interface;
-+	return 0;
-+}
-+
-+static int emac_probe_dt_phy(struct emac_instance *dev)
-+{
-+	struct device_node *np = dev->ofdev->dev.of_node;
-+	struct device_node *phy_handle;
-+	int res = 0;
-+
-+	phy_handle = of_parse_phandle(np, "phy-handle", 0);
-+
-+	if (phy_handle) {
-+		res = emac_dt_mdio_probe(dev);
-+		if (res)
-+			goto out;
-+
-+		res = emac_dt_phy_probe(dev, phy_handle);
-+		if (res) {
-+			emac_dt_phy_mdio_cleanup(dev);
-+			goto out;
-+		}
-+
-+		return 1;
-+	}
-+
-+ out:
-+	of_node_put(phy_handle);
-+	/* if no phy device was specifie in the device tree, then we fallback
-+	 * to the old emac_phy.c probe code for compatibility reasons.
-+	 */
-+	return res;
-+}
-+
- static int emac_init_phy(struct emac_instance *dev)
- {
- 	struct device_node *np = dev->ofdev->dev.of_node;
-@@ -2462,6 +2703,18 @@ static int emac_init_phy(struct emac_ins
- 
- 	emac_configure(dev);
- 
-+	if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) {
-+		int res = emac_probe_dt_phy(dev);
-+
-+		if (res == 1)
-+			goto init_phy;
-+		if (res < 0)
-+			dev_err(&dev->ndev->dev, "failed to attach dt phy (%d).",
-+				res);
-+
-+		/* continue with old code */
-+	}
-+
- 	if (dev->phy_address != 0xffffffff)
- 		phy_map = ~(1 << dev->phy_address);
- 
-@@ -2489,6 +2742,7 @@ static int emac_init_phy(struct emac_ins
- 		return -ENXIO;
- 	}
- 
-+ init_phy:
- 	/* Init PHY */
- 	if (dev->phy.def->ops->init)
- 		dev->phy.def->ops->init(&dev->phy);
-@@ -2907,6 +3161,8 @@ static int emac_probe(struct platform_de
- 	/* I have a bad feeling about this ... */
- 
-  err_detach_tah:
-+	emac_dt_phy_mdio_cleanup(dev);
-+
- 	if (emac_has_feature(dev, EMAC_FTR_HAS_TAH))
- 		tah_detach(dev->tah_dev, dev->tah_port);
-  err_detach_rgmii:
-@@ -2957,6 +3213,11 @@ static int emac_remove(struct platform_d
- 	if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII))
- 		zmii_detach(dev->zmii_dev, dev->zmii_port);
- 
-+	if (dev->phy_dev)
-+		phy_disconnect(dev->phy_dev);
-+
-+	emac_dt_phy_mdio_cleanup(dev);
-+
- 	busy_phy_map &= ~(1 << dev->phy.address);
- 	DBG(dev, "busy_phy_map now %#x" NL, busy_phy_map);
- 
---- a/drivers/net/ethernet/ibm/emac/core.h
-+++ b/drivers/net/ethernet/ibm/emac/core.h
-@@ -199,6 +199,10 @@ struct emac_instance {
- 	struct emac_instance		*mdio_instance;
- 	struct mutex			mdio_lock;
- 
-+	/* Device-tree based phy configuration */
-+	struct mii_bus			*mii_bus;
-+	struct phy_device		*phy_dev;
-+
- 	/* ZMII infos if any */
- 	u32				zmii_ph;
- 	u32				zmii_port;
diff --git a/target/linux/apm821xx/patches-4.4/801-usb-xhci-add-firmware-loader-for-uPD720201-and-uPD72.patch b/target/linux/apm821xx/patches-4.4/801-usb-xhci-add-firmware-loader-for-uPD720201-and-uPD72.patch
deleted file mode 100644
index 5d63ddd..0000000
--- a/target/linux/apm821xx/patches-4.4/801-usb-xhci-add-firmware-loader-for-uPD720201-and-uPD72.patch
+++ /dev/null
@@ -1,545 +0,0 @@
-From 419992bae5aaa4e06402e0b7c79fcf7bcb6b4764 Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey at googlemail.com>
-Date: Thu, 2 Jun 2016 00:48:46 +0200
-Subject: [PATCH] usb: xhci: add firmware loader for uPD720201 and uPD720202
- w/o ROM
-
-This patch adds a firmware loader for the uPD720201K8-711-BAC-A
-and uPD720202K8-711-BAA-A variant. Both of these chips are listed
-in Renesas' R19UH0078EJ0500 Rev.5.00 "User's Manual: Hardware" as
-devices which need the firmware loader on page 2 in order to
-work as they "do not support the External ROM".
-
-The "Firmware Download Sequence" is describe in chapter
-"7.1 FW Download Interface" R19UH0078EJ0500 Rev.5.00 page 131.
-
-The firmware "K2013080.mem" is available from a USB3.0 Host to
-PCIe Adapter (PP2U-E card) "Firmware download" archive. An
-alternative version can be sourced from Netgear's WNDR4700 GPL
-archives.
-
-The release notes of the PP2U-E's "Firmware Download" ver 2.0.1.3
-(2012-06-15) state that the firmware is for the following devices:
- - uPD720201 ES 2.0 sample whose revision ID is 2.
- - uPD720201 ES 2.1 sample & CS sample & Mass product, ID is 3.
- - uPD720202 ES 2.0 sample & CS sample & Mass product, ID is 2.
-
-If someone from Renesas is listening: It would be great, if these
-firmwares could be added to linux-firmware.git.
-
-Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>
-Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
----
- drivers/usb/host/xhci-pci.c | 492 ++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 492 insertions(+)
-
---- a/drivers/usb/host/xhci-pci.c
-+++ b/drivers/usb/host/xhci-pci.c
-@@ -24,6 +24,8 @@
- #include <linux/slab.h>
- #include <linux/module.h>
- #include <linux/acpi.h>
-+#include <linux/firmware.h>
-+#include <asm/unaligned.h>
- 
- #include "xhci.h"
- #include "xhci-trace.h"
-@@ -218,6 +220,458 @@ static void xhci_pme_acpi_rtd3_enable(st
- static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }
- #endif /* CONFIG_ACPI */
- 
-+static const struct renesas_fw_entry {
-+	const char *firmware_name;
-+	u16 device;
-+	u8 revision;
-+	u16 expected_version;
-+} renesas_fw_table[] = {
-+	/*
-+	 * Only the uPD720201K8-711-BAC-A or uPD720202K8-711-BAA-A
-+	 * are listed in R19UH0078EJ0500 Rev.5.00 as devices which
-+	 * need the software loader.
-+	 *
-+	 * PP2U/ReleaseNote_USB3-201-202-FW.txt:
-+	 *
-+	 * Note: This firmware is for the following devices.
-+	 *  - uPD720201 ES 2.0 sample whose revision ID is 2.
-+	 *  - uPD720201 ES 2.1 sample & CS sample & Mass product, ID is 3.
-+	 *  - uPD720202 ES 2.0 sample & CS sample & Mass product, ID is 2.
-+	 */
-+	{ "K2013080.mem", 0x0014, 0x02, 0x2013 },
-+	{ "K2013080.mem", 0x0014, 0x03, 0x2013 },
-+	{ "K2013080.mem", 0x0015, 0x02, 0x2013 },
-+};
-+
-+static const struct renesas_fw_entry *renesas_needs_fw_dl(struct pci_dev *dev)
-+{
-+	const struct renesas_fw_entry *entry;
-+	size_t i;
-+
-+	/* This loader will only work with a RENESAS device. */
-+	if (!(dev->vendor == PCI_VENDOR_ID_RENESAS))
-+		return NULL;
-+
-+	for (i = 0; i < ARRAY_SIZE(renesas_fw_table); i++) {
-+		entry = &renesas_fw_table[i];
-+		if (entry->device == dev->device &&
-+		    entry->revision == dev->revision)
-+			return entry;
-+	}
-+
-+	return NULL;
-+}
-+
-+static int renesas_fw_download_image(struct pci_dev *dev,
-+				     const u32 *fw,
-+				     size_t step)
-+{
-+	size_t i;
-+	int err;
-+	u8 fw_status;
-+	bool data0_or_data1;
-+
-+	/*
-+	 * The hardware does alternate between two 32-bit pages.
-+	 * (This is because each row of the firmware is 8 bytes).
-+	 *
-+	 * for even steps we use DATA0, for odd steps DATA1.
-+	 */
-+	data0_or_data1 = (step & 1) == 1;
-+
-+	/* step+1. Read "Set DATAX" and confirm it is cleared. */
-+	for (i = 0; i < 10000; i++) {
-+		err = pci_read_config_byte(dev, 0xF5, &fw_status);
-+		if (err)
-+			return pcibios_err_to_errno(err);
-+		if (!(fw_status & BIT(data0_or_data1)))
-+			break;
-+
-+		udelay(1);
-+	}
-+	if (i == 10000)
-+		return -ETIMEDOUT;
-+
-+	/*
-+	 * step+2. Write FW data to "DATAX".
-+	 * "LSB is left" => force little endian
-+	 */
-+	err = pci_write_config_dword(dev, data0_or_data1 ? 0xFC : 0xF8,
-+				     (__force u32) cpu_to_le32(fw[step]));
-+	if (err)
-+		return pcibios_err_to_errno(err);
-+
-+	udelay(100);
-+
-+	/* step+3. Set "Set DATAX". */
-+	err = pci_write_config_byte(dev, 0xF5, BIT(data0_or_data1));
-+	if (err)
-+		return pcibios_err_to_errno(err);
-+
-+	return 0;
-+}
-+
-+static int renesas_fw_verify(struct pci_dev *dev,
-+			     const void *fw_data,
-+			     size_t length)
-+{
-+	const struct renesas_fw_entry *entry = renesas_needs_fw_dl(dev);
-+	u16 fw_version_pointer;
-+	u16 fw_version;
-+
-+	if (!entry)
-+		return -EINVAL;
-+
-+	/*
-+	 * The Firmware's Data Format is describe in
-+	 * "6.3 Data Format" R19UH0078EJ0500 Rev.5.00 page 124
-+	 */
-+
-+	/* "Each row is 8 bytes". => firmware size must be a multiple of 8. */
-+	if (length % 8 != 0) {
-+		dev_err(&dev->dev, "firmware size is not a multipe of 8.");
-+		return -EINVAL;
-+	}
-+
-+	/*
-+	 * The bootrom chips of the big brother have sizes up to 64k, let's
-+	 * assume that's the biggest the firmware can get.
-+	 */
-+	if (length < 0x1000 || length >= 0x10000) {
-+		dev_err(&dev->dev, "firmware is size %zd is not (4k - 64k).",
-+			length);
-+		return -EINVAL;
-+	}
-+
-+	/* The First 2 bytes are fixed value (55aa). "LSB on Left" */
-+	if (get_unaligned_le16(fw_data) != 0x55aa) {
-+		dev_err(&dev->dev, "no valid firmware header found.");
-+		return -EINVAL;
-+	}
-+
-+	/* verify the firmware version position and print it. */
-+	fw_version_pointer = get_unaligned_le16(fw_data + 4);
-+	if (fw_version_pointer + 2 >= length) {
-+		dev_err(&dev->dev, "firmware version pointer is outside of the firmware image.");
-+		return -EINVAL;
-+	}
-+
-+	fw_version = get_unaligned_le16(fw_data + fw_version_pointer);
-+	dev_dbg(&dev->dev, "got firmware version: %02x.", fw_version);
-+
-+	if (fw_version != entry->expected_version) {
-+		dev_err(&dev->dev, "firmware version mismatch, expected version: %02x.",
-+			 entry->expected_version);
-+		return -EINVAL;
-+	}
-+
-+	return 0;
-+}
-+
-+static int renesas_fw_check_running(struct pci_dev *pdev)
-+{
-+	int err;
-+	u8 fw_state;
-+
-+	/*
-+	 * Test if the device is actually needing the firmware. As most
-+	 * BIOSes will initialize the device for us. If the device is
-+	 * initialized.
-+	 */
-+	err = pci_read_config_byte(pdev, 0xF4, &fw_state);
-+	if (err)
-+		return pcibios_err_to_errno(err);
-+
-+	/*
-+	 * Check if "FW Download Lock" is locked. If it is and the FW is
-+	 * ready we can simply continue. If the FW is not ready, we have
-+	 * to give up.
-+	 */
-+	if (fw_state & BIT(1)) {
-+		dev_dbg(&pdev->dev, "FW Download Lock is engaged.");
-+
-+		if (fw_state & BIT(4))
-+			return 0;
-+
-+		dev_err(&pdev->dev, "FW Download Lock is set and FW is not ready. Giving Up.");
-+		return -EIO;
-+	}
-+
-+	/*
-+	 * Check if "FW Download Enable" is set. If someone (us?) tampered
-+	 * with it and it can't be resetted, we have to give up too... and
-+	 * ask for a forgiveness and a reboot.
-+	 */
-+	if (fw_state & BIT(0)) {
-+		dev_err(&pdev->dev, "FW Download Enable is stale. Giving Up (poweroff/reboot needed).");
-+		return -EIO;
-+	}
-+
-+	/* Otherwise, Check the "Result Code" Bits (6:4) and act accordingly */
-+	switch ((fw_state & 0x70)) {
-+	case 0: /* No result yet */
-+		dev_dbg(&pdev->dev, "FW is not ready/loaded yet.");
-+
-+		/* tell the caller, that this device needs the firmware. */
-+		return 1;
-+
-+	case BIT(4): /* Success, device should be working. */
-+		dev_dbg(&pdev->dev, "FW is ready.");
-+		return 0;
-+
-+	case BIT(5): /* Error State */
-+		dev_err(&pdev->dev, "hardware is in an error state. Giving up (poweroff/reboot needed).");
-+		return -ENODEV;
-+
-+	default: /* All other states are marked as "Reserved states" */
-+		dev_err(&pdev->dev, "hardware is in an invalid state %x. Giving up (poweroff/reboot needed).",
-+			(fw_state & 0x70) >> 4);
-+		return -EINVAL;
-+	}
-+}
-+
-+static int renesas_hw_check_run_stop_busy(struct pci_dev *pdev)
-+{
-+#if 0
-+	u32 val;
-+
-+	/*
-+	 * 7.1.3 Note 3: "... must not set 'FW Download Enable' when
-+	 * 'RUN/STOP' of USBCMD Register is set"
-+	 */
-+	val = readl(hcd->regs + 0x20);
-+	if (val & BIT(0)) {
-+		dev_err(&pdev->dev, "hardware is busy and can't receive a FW.");
-+		return -EBUSY;
-+	}
-+#endif
-+	return 0;
-+}
-+
-+static int renesas_fw_download(struct pci_dev *pdev,
-+	const struct firmware *fw, unsigned int retry_counter)
-+{
-+	const u32 *fw_data = (const u32 *) fw->data;
-+	size_t i;
-+	int err;
-+	u8 fw_status;
-+
-+	/*
-+	 * For more information and the big picture: please look at the
-+	 * "Firmware Download Sequence" in "7.1 FW Download Interface"
-+	 * of R19UH0078EJ0500 Rev.5.00 page 131
-+	 */
-+	err = renesas_hw_check_run_stop_busy(pdev);
-+	if (err)
-+		return err;
-+
-+	/*
-+	 * 0. Set "FW Download Enable" bit in the
-+	 * "FW Download Control & Status Register" at 0xF4
-+	 */
-+	err = pci_write_config_byte(pdev, 0xF4, BIT(0));
-+	if (err)
-+		return pcibios_err_to_errno(err);
-+
-+	/* 1 - 10 follow one step after the other. */
-+	for (i = 0; i < fw->size / 4; i++) {
-+		err = renesas_fw_download_image(pdev, fw_data, i);
-+		if (err) {
-+			dev_err(&pdev->dev, "Firmware Download Step %zd failed at position %zd bytes with (%d).",
-+				 i, i * 4, err);
-+			return err;
-+		}
-+	}
-+
-+	/*
-+	 * This sequence continues until the last data is written to
-+	 * "DATA0" or "DATA1". Naturally, we wait until "SET DATA0/1"
-+	 * is cleared by the hardware beforehand.
-+	 */
-+	for (i = 0; i < 10000; i++) {
-+		err = pci_read_config_byte(pdev, 0xF5, &fw_status);
-+		if (err)
-+			return pcibios_err_to_errno(err);
-+		if (!(fw_status & (BIT(0) | BIT(1))))
-+			break;
-+
-+		udelay(1);
-+	}
-+	if (i == 10000)
-+		dev_warn(&pdev->dev, "Final Firmware Download step timed out.");
-+
-+	/*
-+	 * 11. After finishing writing the last data of FW, the
-+	 * System Software must clear "FW Download Enable"
-+	 */
-+	err = pci_write_config_byte(pdev, 0xF4, 0);
-+	if (err)
-+		return pcibios_err_to_errno(err);
-+
-+	/* 12. Read "Result Code" and confirm it is good. */
-+	for (i = 0; i < 10000; i++) {
-+		err = pci_read_config_byte(pdev, 0xF4, &fw_status);
-+		if (err)
-+			return pcibios_err_to_errno(err);
-+		if (fw_status & BIT(4))
-+			break;
-+
-+		udelay(1);
-+	}
-+	if (i == 10000) {
-+		/* Timed out / Error - let's see if we can fix this */
-+		err = renesas_fw_check_running(pdev);
-+		switch (err) {
-+		case 0: /*
-+			 * we shouldn't end up here.
-+			 * maybe it took a little bit longer.
-+			 * But all should be well?
-+			 */
-+			break;
-+
-+		case 1: /* (No result yet? - we can try to retry) */
-+			if (retry_counter < 10) {
-+				retry_counter++;
-+				dev_warn(&pdev->dev, "Retry Firmware download: %d try.",
-+					  retry_counter);
-+				return renesas_fw_download(pdev, fw,
-+							   retry_counter);
-+			}
-+			return -ETIMEDOUT;
-+
-+		default:
-+			return err;
-+		}
-+	}
-+	/*
-+	 * Optional last step: Engage Firmware Lock
-+	 *
-+	 * err = pci_write_config_byte(pdev, 0xF4, BIT(2));
-+	 * if (err)
-+	 *	return pcibios_err_to_errno(err);
-+	 */
-+
-+	return 0;
-+}
-+
-+struct renesas_fw_ctx {
-+	struct pci_dev *pdev;
-+	const struct pci_device_id *id;
-+	bool resume;
-+};
-+
-+static int xhci_pci_probe(struct pci_dev *pdev,
-+			  const struct pci_device_id *id);
-+
-+static void renesas_fw_callback(const struct firmware *fw,
-+				void *context)
-+{
-+	struct renesas_fw_ctx *ctx = context;
-+	struct pci_dev *pdev = ctx->pdev;
-+	struct device *parent = pdev->dev.parent;
-+	int err = -ENOENT;
-+
-+	if (fw) {
-+		err = renesas_fw_verify(pdev, fw->data, fw->size);
-+		if (!err) {
-+			err = renesas_fw_download(pdev, fw, 0);
-+			release_firmware(fw);
-+			if (!err) {
-+				if (ctx->resume)
-+					return;
-+
-+				err = xhci_pci_probe(pdev, ctx->id);
-+				if (!err) {
-+					/* everything worked */
-+					devm_kfree(&pdev->dev, ctx);
-+					return;
-+				}
-+
-+				/* in case of an error - fall through */
-+			} else {
-+				dev_err(&pdev->dev, "firmware failed to download (%d).",
-+					err);
-+			}
-+		}
-+	} else {
-+		dev_err(&pdev->dev, "firmware failed to load (%d).", err);
-+	}
-+
-+	dev_info(&pdev->dev, "Unloading driver");
-+
-+	if (parent)
-+		device_lock(parent);
-+
-+	device_release_driver(&pdev->dev);
-+
-+	if (parent)
-+		device_unlock(parent);
-+
-+	pci_dev_put(pdev);
-+}
-+
-+static int renesas_fw_alive_check(struct pci_dev *pdev)
-+{
-+	const struct renesas_fw_entry *entry;
-+	int err;
-+
-+	/* check if we have a eligible RENESAS' uPD720201/2 w/o FW. */
-+	entry = renesas_needs_fw_dl(pdev);
-+	if (!entry)
-+		return 0;
-+
-+	err = renesas_fw_check_running(pdev);
-+	/* Also go ahead, if the firmware is running */
-+	if (err == 0)
-+		return 0;
-+
-+	/* At this point, we can be sure that the FW isn't ready. */
-+	return err;
-+}
-+
-+static int renesas_fw_download_to_hw(struct pci_dev *pdev,
-+				     const struct pci_device_id *id,
-+				     bool do_resume)
-+{
-+	const struct renesas_fw_entry *entry;
-+	struct renesas_fw_ctx *ctx;
-+	int err;
-+
-+	/* check if we have a eligible RENESAS' uPD720201/2 w/o FW. */
-+	entry = renesas_needs_fw_dl(pdev);
-+	if (!entry)
-+		return 0;
-+
-+	err = renesas_fw_check_running(pdev);
-+	/* Continue ahead, if the firmware is already running. */
-+	if (err == 0)
-+		return 0;
-+
-+	if (err != 1)
-+		return err;
-+
-+	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
-+	if (!ctx)
-+		return -ENOMEM;
-+	ctx->pdev = pdev;
-+	ctx->resume = do_resume;
-+	ctx->id = id;
-+
-+	pci_dev_get(pdev);
-+	err = request_firmware_nowait(THIS_MODULE, 1, entry->firmware_name,
-+		&pdev->dev, GFP_KERNEL, ctx, renesas_fw_callback);
-+	if (err) {
-+		pci_dev_put(pdev);
-+		return err;
-+	}
-+
-+	/*
-+	 * The renesas_fw_callback() callback will continue the probe
-+	 * process, once it aquires the firmware.
-+	 */
-+	return 1;
-+}
-+
- /* called during probe() after chip reset completes */
- static int xhci_pci_setup(struct usb_hcd *hcd)
- {
-@@ -257,6 +711,22 @@ static int xhci_pci_probe(struct pci_dev
- 	struct hc_driver *driver;
- 	struct usb_hcd *hcd;
- 
-+	/*
-+	 * Check if this device is a RENESAS uPD720201/2 device.
-+	 * Otherwise, we can continue with xhci_pci_probe as usual.
-+	 */
-+	retval = renesas_fw_download_to_hw(dev, id, false);
-+	switch (retval) {
-+	case 0:
-+		break;
-+
-+	case 1: /* let it load the firmware and recontinue the probe. */
-+		return 0;
-+
-+	default:
-+		return retval;
-+	};
-+
- 	driver = (struct hc_driver *)id->driver_data;
- 
- 	/* Prevent runtime suspending between USB-2 and USB-3 initialization */
-@@ -314,6 +784,16 @@ static void xhci_pci_remove(struct pci_d
- {
- 	struct xhci_hcd *xhci;
- 
-+	if (renesas_fw_alive_check(dev)) {
-+		/*
-+		 * bail out early, if this was a renesas device w/o FW.
-+		 * Else we might hit the NMI watchdog in xhci_handsake
-+		 * during xhci_reset as part of the driver's unloading.
-+		 * which we forced in the renesas_fw_callback().
-+		 */
-+		return;
-+	}
-+
- 	xhci = hcd_to_xhci(pci_get_drvdata(dev));
- 	xhci->xhc_state |= XHCI_STATE_REMOVING;
- 	if (xhci->shared_hcd) {
diff --git a/target/linux/apm821xx/patches-4.4/802-usb-xhci-force-msi-renesas-xhci.patch b/target/linux/apm821xx/patches-4.4/802-usb-xhci-force-msi-renesas-xhci.patch
deleted file mode 100644
index 5395cab..0000000
--- a/target/linux/apm821xx/patches-4.4/802-usb-xhci-force-msi-renesas-xhci.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From a0dc613140bab907a3d5787a7ae7b0638bf674d0 Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey at gmail.com>
-Date: Thu, 23 Jun 2016 20:28:20 +0200
-Subject: [PATCH] usb: xhci: force MSI for uPD720201 and
- uPD720202
-
-The APM82181 does not support MSI-X. When probed, it will
-produce a noisy warning.
-
----
- drivers/usb/host/pci-quirks.c | 362 ++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 362 insertions(+)
-
---- a/drivers/usb/host/xhci-pci.c
-+++ b/drivers/usb/host/xhci-pci.c
-@@ -185,7 +185,7 @@ static void xhci_pci_quirks(struct devic
- 	}
- 	if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
- 			pdev->device == 0x0015)
--		xhci->quirks |= XHCI_RESET_ON_RESUME;
-+		xhci->quirks |= XHCI_RESET_ON_RESUME | XHCI_FORCE_MSI;
- 	if (pdev->vendor == PCI_VENDOR_ID_VIA)
- 		xhci->quirks |= XHCI_RESET_ON_RESUME;
- 
---- a/drivers/usb/host/xhci.c
-+++ b/drivers/usb/host/xhci.c
-@@ -388,10 +388,14 @@ static int xhci_try_enable_msi(struct us
- 		free_irq(hcd->irq, hcd);
- 	hcd->irq = 0;
- 
--	ret = xhci_setup_msix(xhci);
--	if (ret)
--		/* fall back to msi*/
-+	if (xhci->quirks & XHCI_FORCE_MSI) {
- 		ret = xhci_setup_msi(xhci);
-+	} else {
-+		ret = xhci_setup_msix(xhci);
-+		if (ret)
-+			/* fall back to msi*/
-+			ret = xhci_setup_msi(xhci);
-+	}
- 
- 	if (!ret)
- 		/* hcd->irq is 0, we have MSI */
---- a/drivers/usb/host/xhci.h
-+++ b/drivers/usb/host/xhci.h
-@@ -1652,6 +1652,7 @@ struct xhci_hcd {
- 	/* support xHCI 0.96 spec USB2 software LPM */
- 	unsigned		sw_lpm_support:1;
- 	/* support xHCI 1.0 spec USB2 hardware LPM */
-+#define XHCI_FORCE_MSI		(1 << 24)
- 	unsigned		hw_lpm_support:1;
- 	/* cached usb2 extened protocol capabilites */
- 	u32                     *ext_caps;
diff --git a/target/linux/apm821xx/patches-4.4/804-usb-dwc2-add-amcc-usb-otg-405ex.patch b/target/linux/apm821xx/patches-4.4/804-usb-dwc2-add-amcc-usb-otg-405ex.patch
deleted file mode 100644
index fb353be..0000000
--- a/target/linux/apm821xx/patches-4.4/804-usb-dwc2-add-amcc-usb-otg-405ex.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/drivers/usb/dwc2/platform.c
-+++ b/drivers/usb/dwc2/platform.c
-@@ -115,6 +115,37 @@ static const struct dwc2_core_params par
- 	.hibernation			= -1,
- };
- 
-+static const struct dwc2_core_params params_amcc_dwc_otg = {
-+	.otg_cap			= DWC2_CAP_PARAM_HNP_SRP_CAPABLE,
-+	.otg_ver			= -1,
-+	.dma_enable			= -1,
-+	.dma_desc_enable		= -1,
-+	.speed				= -1,
-+	.enable_dynamic_fifo		= -1,
-+	.en_multiple_tx_fifo		= -1,
-+	.host_rx_fifo_size		= -1,
-+	.host_nperio_tx_fifo_size	= -1,
-+	.host_perio_tx_fifo_size	= -1,
-+	.max_transfer_size		= -1,
-+	.max_packet_count		= -1,
-+	.host_channels			= -1,
-+	.phy_type			= -1,
-+	.phy_utmi_width			= -1,
-+	.phy_ulpi_ddr			= -1,
-+	.phy_ulpi_ext_vbus		= -1,
-+	.i2c_enable			= -1,
-+	.ulpi_fs_ls			= -1,
-+	.host_support_fs_ls_low_power	= -1,
-+	.host_ls_low_power_phy_clk	= -1,
-+	.ts_dline			= -1,
-+	.reload_ctl			= -1,
-+	.ahbcfg				= GAHBCFG_HBSTLEN_INCR16 <<
-+					  GAHBCFG_HBSTLEN_SHIFT,
-+	.uframe_sched			= -1,
-+	.external_id_pin_ctl		= -1,
-+	.hibernation			= -1,
-+};
-+
- static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
- {
- 	struct platform_device *pdev = to_platform_device(hsotg->dev);
-@@ -307,6 +338,7 @@ static int dwc2_driver_remove(struct pla
- }
- 
- static const struct of_device_id dwc2_of_match_table[] = {
-+	{ .compatible = "amcc,usb-otg-405ex", .data = &params_amcc_dwc_otg },
- 	{ .compatible = "brcm,bcm2835-usb", .data = &params_bcm2835 },
- 	{ .compatible = "rockchip,rk3066-usb", .data = &params_rk3066 },
- 	{ .compatible = "snps,dwc2", .data = NULL },
diff --git a/target/linux/apm821xx/patches-4.4/901-hwmon-add-driver-for-Microchip-TC654-TC655-PWM-fan-c.patch b/target/linux/apm821xx/patches-4.4/901-hwmon-add-driver-for-Microchip-TC654-TC655-PWM-fan-c.patch
deleted file mode 100644
index 41f3370..0000000
--- a/target/linux/apm821xx/patches-4.4/901-hwmon-add-driver-for-Microchip-TC654-TC655-PWM-fan-c.patch
+++ /dev/null
@@ -1,1027 +0,0 @@
-From 5ea2e152d846bf60901107fefd81a58f792f3bc2 Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey at gmail.com>
-Date: Fri, 10 Jun 2016 03:00:46 +0200
-Subject: [PATCH] hwmon: add driver for Microchip TC654/TC655 PWM fan
- controllers
-
-This patch adds a hwmon driver for the Microchip TC654 and TC655
-Dual SMBus PWM Fan Speed Controllers with Fan Fault detection.
-
-The chip is described in the DS2001734C Spec Document from Microchip.
-It supports:
-	- Shared PWM Fan Drive for two fans
-	- Provides RPM
-	- automatic PWM controller (needs additional
-	  NTC/PTC Thermistors.)
-	- Overtemperature alarm (when using NTC/PTC
-	  Thermistors)
-
-Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
----
- drivers/hwmon/Kconfig  |  10 +
- drivers/hwmon/Makefile |   1 +
- drivers/hwmon/tc654.c  | 969 +++++++++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 980 insertions(+)
- create mode 100644 drivers/hwmon/tc654.c
-
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -1484,6 +1484,16 @@ config SENSORS_INA2XX
- 	  This driver can also be built as a module.  If so, the module
- 	  will be called ina2xx.
- 
-+config SENSORS_TC654
-+	tristate "Microchip TC654 and TC655"
-+	depends on I2C
-+	help
-+	  If you say yes here you get support for Microchip TC655 and TC654
-+	  Dual PWM Fan Speed Controllers and sensor chips.
-+
-+	  This driver can also be built as a module.  If so, the module
-+	  will be called tc654.
-+
- config SENSORS_TC74
- 	tristate "Microchip TC74"
- 	depends on I2C
---- a/drivers/hwmon/Makefile
-+++ b/drivers/hwmon/Makefile
-@@ -143,6 +143,7 @@ obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc4
- obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
- obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
- obj-$(CONFIG_SENSORS_AMC6821)	+= amc6821.o
-+obj-$(CONFIG_SENSORS_TC654)	+= tc654.o
- obj-$(CONFIG_SENSORS_TC74)	+= tc74.o
- obj-$(CONFIG_SENSORS_THMC50)	+= thmc50.o
- obj-$(CONFIG_SENSORS_TMP102)	+= tmp102.o
---- /dev/null
-+++ b/drivers/hwmon/tc654.c
-@@ -0,0 +1,969 @@
-+/*
-+ * tc654.c - Support for Microchip TC654/TC655
-+ * "A Dual SMBus PWM FAN Speed Controllers with Fan Fault Detection"
-+ *
-+ * Copyright (c) 2016 Christian Lamparter <chunkeey at gmail.com>
-+ *
-+ * 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 of the License.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * The chip is described in the DS2001734C Spec Document from Microchip.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/jiffies.h>
-+#include <linux/i2c.h>
-+#include <linux/hwmon.h>
-+#include <linux/hwmon-sysfs.h>
-+#include <linux/err.h>
-+#include <linux/mutex.h>
-+#include <linux/thermal.h>
-+
-+/* Hardware definitions */
-+/* 5.1.4 Address Byte stats that TC654/TC655 are fixed at 0x1b */
-+static const unsigned short normal_i2c[] = { 0x1b, I2C_CLIENT_END };
-+
-+enum TC654_REGS {
-+	TC654_REG_RPM1 = 0x00,
-+	TC654_REG_RPM2,
-+	TC654_REG_FAN1_FAULT_THRESH,
-+	TC654_REG_FAN2_FAULT_THRESH,
-+	TC654_REG_CONFIG,
-+	TC654_REG_STATUS,
-+	TC654_REG_DUTY_CYCLE,
-+	TC654_REG_MFR_ID,
-+	TC654_REG_VER_ID,
-+
-+	/* keep last */
-+	__TC654_REG_NUM,
-+};
-+
-+#define TC654_MFR_ID_MICROCHIP		0x84
-+#define TC654_VER_ID			0x00
-+#define TC655_VER_ID			0x01
-+
-+enum TC654_CONTROL_BITS {
-+	TC654_CTRL_SDM		= BIT(0),
-+	TC654_CTRL_F1PPR_S	= 1,
-+	TC654_CTRL_F1PPR_M	= (BIT(1) | BIT(2)),
-+	TC654_CTRL_F2PPR_S	= 3,
-+	TC654_CTRL_F2PPR_M	= (BIT(3) | BIT(4)),
-+	TC654_CTRL_DUTYC	= BIT(5),
-+	TC654_CTRL_RES		= BIT(6),
-+	TC654_CTRL_FFCLR	= BIT(7),
-+};
-+
-+enum TC654_STATUS_BITS {
-+	TC654_STATUS_F1F	= BIT(0),
-+	TC654_STATUS_F2F	= BIT(1),
-+	TC654_STATUS_VSTAT	= BIT(2),
-+	TC654_STATUS_R1CO	= BIT(3),
-+	TC654_STATUS_R2CO	= BIT(4),
-+	TC654_STATUS_OTF	= BIT(5),
-+};
-+
-+enum TC654_FAN {
-+	TC654_FAN1 = 0,
-+	TC654_FAN2,
-+
-+	/* keep last */
-+	__NUM_TC654_FAN,
-+};
-+
-+enum TC654_FAN_MODE {
-+	TC654_PWM_OFF,	/* Shutdown Mode - switch of both fans */
-+	TC654_PWM_VIN,	/* Fans will be controlled via V_in analog input pin */
-+	TC654_PWM_3000,	/* sets fans to 30% duty cycle */
-+	TC654_PWM_3467,
-+	TC654_PWM_3933, /* default case - if V_in pin is open */
-+	TC654_PWM_4400,
-+	TC654_PWM_4867,
-+	TC654_PWM_5333,
-+	TC654_PWM_5800,
-+	TC654_PWM_6267,
-+	TC654_PWM_6733,
-+	TC654_PWM_7200,
-+	TC654_PWM_7667,
-+	TC654_PWM_8133,
-+	TC654_PWM_8600,
-+	TC654_PWM_9067,
-+	TC654_PWM_9533,
-+	TC654_PWM_10000, /* sets fans to 100% duty cycle */
-+};
-+
-+enum TC654_ALARMS {
-+	TC654_ALARM_FAN1_FAULT,
-+	TC654_ALARM_FAN2_FAULT,
-+	TC654_ALARM_FAN1_COUNTER_OVERFLOW,
-+	TC654_ALARM_FAN2_COUNTER_OVERFLOW,
-+	TC654_ALARM_OVER_TEMPERATURE,
-+
-+	/* KEEP LAST */
-+	__NUM_TC654_ALARMS,
-+};
-+
-+static const struct pwm_table_entry {
-+	u8 min;
-+	enum TC654_FAN_MODE mode;
-+} pwm_table[] = {
-+	{  0, TC654_PWM_OFF  },
-+	{  1, TC654_PWM_3000 },
-+	{ 88, TC654_PWM_3467 },
-+	{101, TC654_PWM_3933 },
-+	{113, TC654_PWM_4400 },
-+	{125, TC654_PWM_4867 },
-+	{137, TC654_PWM_5333 },
-+	{148, TC654_PWM_5800 },
-+	{160, TC654_PWM_6267 },
-+	{172, TC654_PWM_6733 },
-+	{184, TC654_PWM_7200 },
-+	{196, TC654_PWM_7667 },
-+	{208, TC654_PWM_8133 },
-+	{220, TC654_PWM_8600 },
-+	{232, TC654_PWM_9067 },
-+	{244, TC654_PWM_9533 },
-+	{255, TC654_PWM_10000 },
-+};
-+
-+/* driver context */
-+struct tc654 {
-+	struct i2c_client	*client;
-+
-+	struct mutex		update_lock;
-+
-+	unsigned long		last_updated;	/* in jiffies */
-+	u8			cached_regs[__TC654_REG_NUM];
-+
-+	bool			valid;	/* monitored registers are valid */
-+	u16			fan_input[__NUM_TC654_FAN];
-+	bool			alarms[__NUM_TC654_ALARMS];
-+	bool			vin_status;
-+	bool			pwm_manual;
-+
-+	/* optional cooling device */
-+	struct thermal_cooling_device *cdev;
-+};
-+
-+/* hardware accessors and functions */
-+static int read_tc(struct tc654 *tc, u8 reg)
-+{
-+	s32 status;
-+
-+	if (reg <= TC654_REG_VER_ID) {
-+		/* Table 6.1 states that all registers are readable */
-+		status = i2c_smbus_read_byte_data(tc->client, reg);
-+	} else
-+		status = -EINVAL;
-+
-+	if (status < 0) {
-+		dev_warn(&tc->client->dev, "can't read register 0x%02x due to error (%d)",
-+			 reg, status);
-+	} else {
-+		tc->cached_regs[reg] = status;
-+	}
-+
-+	return status;
-+}
-+
-+static int write_tc(struct tc654 *tc, u8 i2c_reg, u8 val)
-+{
-+	s32 status;
-+
-+	/*
-+	 * Table 6.1 states that both fan threshold registers,
-+	 * the Config and Duty Cycle are writeable.
-+	 */
-+	switch (i2c_reg) {
-+	case TC654_REG_FAN1_FAULT_THRESH:
-+	case TC654_REG_FAN2_FAULT_THRESH:
-+	case TC654_REG_DUTY_CYCLE:
-+	case TC654_REG_CONFIG:
-+		status = i2c_smbus_write_byte_data(tc->client, i2c_reg, val);
-+		break;
-+
-+	default:
-+		return -EINVAL;
-+	}
-+
-+	if (status < 0) {
-+		dev_warn(&tc->client->dev, "can't write register 0x%02x with value 0x%02x due to error (%d)",
-+			 i2c_reg, val, status);
-+	} else {
-+		tc->cached_regs[i2c_reg] = val;
-+	}
-+
-+	return status;
-+}
-+
-+static int mod_config(struct tc654 *tc, u8 set, u8 clear)
-+{
-+	u8 val = 0;
-+
-+	/* a bit can't be set and cleared on the same time. */
-+	if (set & clear)
-+		return -EINVAL;
-+
-+	/* invalidate data to force re-read from hardware */
-+	tc->valid = false;
-+	val = (tc->cached_regs[TC654_REG_CONFIG] | set) & (~clear);
-+	return write_tc(tc, TC654_REG_CONFIG, val);
-+}
-+
-+static int read_fan_rpm(struct tc654 *tc, enum TC654_FAN fan)
-+{
-+	int ret;
-+
-+	/* 6.1 RPM-OUTPUT1 and RPM-OUTPUT2 registers */
-+	ret = read_tc(tc, fan == TC654_FAN1 ? TC654_REG_RPM1 : TC654_REG_RPM2);
-+	if (ret < 0)
-+		return ret;
-+
-+	/*
-+	 * The Resolution Selection Bit in 6.3 CONFIGURATION REGISTER
-+	 * is needed to convert the raw value to the RPM.
-+	 * 0 = RPM1 and RPM2 use (8-Bit) resolution => * 50 RPM
-+	 * 1 = RPM1 and RPM2 use (9-Bit) resolution => * 25 RPM
-+	 */
-+	return ret * (25 <<
-+		!(tc->cached_regs[TC654_REG_CONFIG] & TC654_CTRL_RES));
-+}
-+
-+static int write_fan_fault_thresh(struct tc654 *tc, enum TC654_FAN fan,
-+				  u16 rpm)
-+{
-+	u8 converted_rpm;
-+
-+	if (rpm > 12750)
-+		return -EINVAL;
-+
-+	/*
-+	 * 6.2 FAN_FAULT1 and FAN_FAULT2 Threshold registers
-+	 *
-+	 * Both registers operate in 50 RPM mode exclusively.
-+	 */
-+	converted_rpm = rpm / 50;
-+
-+	/* invalidate data to force re-read from hardware */
-+	tc->valid = false;
-+	return write_tc(tc, fan == TC654_FAN1 ? TC654_REG_FAN1_FAULT_THRESH :
-+		TC654_REG_FAN2_FAULT_THRESH, converted_rpm);
-+}
-+
-+
-+static int read_fan_fault_thresh(struct tc654 *tc, enum TC654_FAN fan)
-+{
-+	/*
-+	 * 6.2 FAN_FAULT1 and FAN_FAULT2 Threshold registers
-+	 *
-+	 * Both registers operate in 50 RPM mode exclusively.
-+	 */
-+	return read_tc(tc, fan == TC654_FAN1 ? TC654_REG_FAN1_FAULT_THRESH :
-+		TC654_REG_FAN2_FAULT_THRESH) * 50;
-+}
-+
-+static enum TC654_FAN_MODE get_fan_mode(struct tc654 *tc)
-+{
-+	if (tc->cached_regs[TC654_REG_CONFIG] & TC654_CTRL_SDM) {
-+		return TC654_PWM_OFF;
-+	} else if (tc->cached_regs[TC654_REG_CONFIG] & TC654_CTRL_DUTYC) {
-+		return TC654_PWM_3000 + tc->cached_regs[TC654_REG_DUTY_CYCLE];
-+	} else if (tc->vin_status == 0)
-+		return TC654_PWM_VIN;
-+
-+	return -EINVAL;
-+}
-+
-+static int write_fan_mode(struct tc654 *tc, enum TC654_FAN_MODE mode)
-+{
-+	int err;
-+	u8 pwm_mode;
-+	bool in_sdm;
-+
-+	in_sdm = !!(tc->cached_regs[TC654_REG_CONFIG] &
-+		TC654_CTRL_SDM);
-+
-+	switch (mode) {
-+	case TC654_PWM_OFF:
-+		if (in_sdm)
-+			return 0;
-+
-+		/* Enter Shutdown Mode - Switches off all fans */
-+		err = mod_config(tc, TC654_CTRL_SDM, TC654_CTRL_DUTYC);
-+		if (err)
-+			return err;
-+
-+		return 0;
-+
-+	case TC654_PWM_VIN:
-+		if (tc->vin_status) {
-+			dev_err(&tc->client->dev,
-+				"V_in pin is open, can't enable automatic mode.");
-+			return -EINVAL;
-+		}
-+
-+		err = mod_config(tc, 0, TC654_CTRL_SDM | TC654_CTRL_DUTYC);
-+		if (err)
-+			return err;
-+
-+		tc->pwm_manual = false;
-+		return 0;
-+
-+	case TC654_PWM_3000:
-+	case TC654_PWM_3467:
-+	case TC654_PWM_3933:
-+	case TC654_PWM_4400:
-+	case TC654_PWM_4867:
-+	case TC654_PWM_5333:
-+	case TC654_PWM_5800:
-+	case TC654_PWM_6267:
-+	case TC654_PWM_6733:
-+	case TC654_PWM_7200:
-+	case TC654_PWM_7667:
-+	case TC654_PWM_8133:
-+	case TC654_PWM_8600:
-+	case TC654_PWM_9067:
-+	case TC654_PWM_9533:
-+	case TC654_PWM_10000:
-+		pwm_mode = mode - TC654_PWM_3000;
-+		if (!in_sdm) {
-+			err = write_tc(tc, TC654_REG_DUTY_CYCLE, pwm_mode);
-+			if (err)
-+				return err;
-+		}
-+
-+		err = mod_config(tc, TC654_CTRL_DUTYC, TC654_CTRL_SDM);
-+		if (err)
-+			return err;
-+
-+		tc->pwm_manual = true;
-+
-+		if (in_sdm) {
-+			/*
-+			 * In case the TC654/TC655 was in SDM mode, the write
-+			 * above into the TC654_REG_DUTY_CYCLE register will
-+			 * have no effect because the chip was switched off.
-+			 *
-+			 * Note: The TC654/TC655 have a special "power-on"
-+			 * feature where the PWM will be forced to 100% for
-+			 * one full second in order to spin-up a resting fan.
-+			 */
-+			err = write_tc(tc, TC654_REG_DUTY_CYCLE, pwm_mode);
-+			if (err)
-+				return err;
-+		}
-+
-+		return 0;
-+
-+	default:
-+		return -EINVAL;
-+	}
-+}
-+
-+static struct tc654 *tc654_update_device(struct device *dev)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+
-+	mutex_lock(&tc->update_lock);
-+
-+	/*
-+	 * In Chapter "1.0 Electrical Characteristics",
-+	 * the "Fault Output Response Time" is specified as 2.4 seconds.
-+	 */
-+	if (time_after(jiffies, tc->last_updated + 2 * HZ + (HZ * 2) / 5)
-+	    || !tc->valid) {
-+		size_t i;
-+		int ret;
-+		bool alarm_triggered;
-+
-+		tc->valid = false;
-+
-+		for (i = 0; i < __NUM_TC654_FAN; i++) {
-+			ret = read_fan_rpm(tc, i);
-+			if (ret < 0)
-+				goto out;
-+
-+			tc->fan_input[i] = ret;
-+		}
-+
-+		ret = read_tc(tc, TC654_REG_STATUS);
-+		if (ret < 0)
-+			goto out;
-+
-+		alarm_triggered = !!(ret & (TC654_STATUS_F1F |
-+			TC654_STATUS_F2F | TC654_STATUS_R1CO |
-+			TC654_STATUS_R2CO | TC654_STATUS_OTF));
-+
-+		tc->alarms[TC654_ALARM_FAN1_FAULT] = !!(ret & TC654_STATUS_F1F);
-+		tc->alarms[TC654_ALARM_FAN2_FAULT] = !!(ret & TC654_STATUS_F2F);
-+		tc->alarms[TC654_ALARM_FAN1_COUNTER_OVERFLOW] =
-+			!!(ret & TC654_STATUS_R1CO);
-+		tc->alarms[TC654_ALARM_FAN2_COUNTER_OVERFLOW] =
-+			!!(ret & TC654_STATUS_R2CO);
-+		tc->alarms[TC654_ALARM_OVER_TEMPERATURE] =
-+			!!(ret & TC654_STATUS_OTF);
-+		tc->vin_status = !!(ret & TC654_STATUS_VSTAT);
-+
-+		/*
-+		 * From 4.5 and 6.3
-+		 *
-+		 * ... "If the V_in pin is open when TC654_CTRL_DUTYC is not
-+		 * selected, then V_out duty cycle will default to 39.33%.".
-+		 *
-+		 * and most importantly 6.5:
-+		 * ... "V_in pin is open, the duty cycle will go to the default
-+		 * setting of this register, which is 0010 (39.33%)."
-+		 */
-+		tc->pwm_manual |= tc->vin_status &&
-+			(tc->cached_regs[TC654_REG_CONFIG] &
-+			 TC654_CTRL_DUTYC);
-+
-+		if (alarm_triggered) {
-+			/*
-+			 * as the name implies, this FLAG needs to be
-+			 * set in order to clear the FAN Fault error.
-+			 */
-+			ret = mod_config(tc, TC654_CTRL_FFCLR, 0);
-+			if (ret < 0)
-+				goto out;
-+		}
-+
-+		tc->last_updated = jiffies;
-+		tc->valid = true;
-+	}
-+
-+out:
-+	mutex_unlock(&tc->update_lock);
-+	return tc;
-+}
-+
-+static u8 get_fan_pulse(struct tc654 *tc, enum TC654_FAN fan)
-+{
-+	u8 fan_pulse_mask = fan == TC654_FAN1 ?
-+		TC654_CTRL_F1PPR_M : TC654_CTRL_F2PPR_M;
-+	u8 fan_pulse_shift = fan  == TC654_FAN1 ?
-+		TC654_CTRL_F1PPR_S : TC654_CTRL_F2PPR_S;
-+
-+	return 1 << ((tc->cached_regs[TC654_REG_CONFIG] & fan_pulse_mask) >>
-+		     fan_pulse_shift);
-+}
-+
-+static int
-+set_fan_pulse(struct tc654 *tc, enum TC654_FAN fan, int pulses)
-+{
-+	int old_pulses;
-+	int err;
-+	u8 new_pulse_per_rotation;
-+	u8 fan_pulse_mask = fan == TC654_FAN1 ?
-+		TC654_CTRL_F1PPR_M : TC654_CTRL_F2PPR_M;
-+	u8 fan_pulse_shift = fan  == TC654_FAN1 ?
-+		TC654_CTRL_F1PPR_S : TC654_CTRL_F2PPR_S;
-+
-+	switch (pulses) {
-+	case 1:
-+		new_pulse_per_rotation = 0;
-+		break;
-+	case 2:
-+		new_pulse_per_rotation = 1;
-+		break;
-+	case 4:
-+		new_pulse_per_rotation = 2;
-+		break;
-+	case 8:
-+		new_pulse_per_rotation = 3;
-+		break;
-+	default:
-+		return -EINVAL;
-+	}
-+
-+	new_pulse_per_rotation <<= fan_pulse_shift;
-+	new_pulse_per_rotation &= fan_pulse_mask;
-+
-+	old_pulses = tc->cached_regs[TC654_REG_CONFIG];
-+	old_pulses &= fan_pulse_mask;
-+
-+	if (new_pulse_per_rotation == old_pulses)
-+		return 0;
-+
-+	mutex_lock(&tc->update_lock);
-+	err = mod_config(tc, new_pulse_per_rotation,
-+			    old_pulses & (~new_pulse_per_rotation));
-+	mutex_unlock(&tc->update_lock);
-+
-+	/* invalidate RPM data to force re-read from hardware */
-+	tc->valid = false;
-+
-+	return err;
-+}
-+
-+static int get_fan_speed(struct tc654 *tc)
-+{
-+	enum TC654_FAN_MODE mode;
-+	size_t i;
-+
-+	mode = get_fan_mode(tc);
-+	for (i = 0; i < ARRAY_SIZE(pwm_table); i++) {
-+		if (mode == pwm_table[i].mode)
-+			return pwm_table[i].min;
-+	}
-+
-+	return -EINVAL;
-+}
-+
-+static int set_fan_speed(struct tc654 *tc, int new_value)
-+{
-+	int result;
-+	size_t i;
-+
-+	if (new_value > pwm_table[ARRAY_SIZE(pwm_table) - 1].min ||
-+	    new_value < pwm_table[0].min)
-+		return -EINVAL;
-+
-+	for (i = 0; i < ARRAY_SIZE(pwm_table); i++) {
-+		/* exact match */
-+		if (pwm_table[i].min == new_value)
-+			break;
-+
-+		/* a little bit too big - go with the previous entry */
-+		if (pwm_table[i].min > new_value) {
-+			--i;
-+			break;
-+		}
-+	}
-+
-+	mutex_lock(&tc->update_lock);
-+	result = write_fan_mode(tc, pwm_table[i].mode);
-+	mutex_unlock(&tc->update_lock);
-+	if (result < 0)
-+		return result;
-+
-+	return 0;
-+}
-+
-+/* sysfs */
-+
-+static ssize_t
-+show_fan_input(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+	int nr = to_sensor_dev_attr(da)->index;
-+
-+	return sprintf(buf, "%d\n", tc->fan_input[nr]);
-+}
-+
-+static ssize_t
-+show_fan_min(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	int nr = to_sensor_dev_attr(da)->index;
-+
-+	return sprintf(buf, "%d\n", read_fan_fault_thresh(tc, nr));
-+}
-+
-+static ssize_t
-+show_fan_min_alarm(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+	int nr = to_sensor_dev_attr(da)->index;
-+
-+	return sprintf(buf, "%d\n", nr == TC654_FAN1 ?
-+		       tc->alarms[TC654_ALARM_FAN1_FAULT] :
-+		       tc->alarms[TC654_ALARM_FAN2_FAULT]);
-+}
-+
-+static ssize_t
-+show_fan_max_alarm(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+	int nr = to_sensor_dev_attr(da)->index;
-+
-+	return sprintf(buf, "%d\n", nr == TC654_FAN1 ?
-+		       tc->alarms[TC654_ALARM_FAN1_COUNTER_OVERFLOW] :
-+		       tc->alarms[TC654_ALARM_FAN2_COUNTER_OVERFLOW]);
-+}
-+
-+static ssize_t
-+set_fan_min(struct device *dev, struct device_attribute *da,
-+	    const char *buf, size_t count)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	long new_min;
-+	int nr = to_sensor_dev_attr(da)->index;
-+	int old_min = read_fan_fault_thresh(tc, nr);
-+	int status = kstrtol(buf, 10, &new_min);
-+
-+	if (status < 0)
-+		return status;
-+
-+	new_min = (new_min / 50) * 50;
-+	if (new_min == old_min) /* No change */
-+		return count;
-+
-+	if (new_min < 0 || new_min > 12750)
-+		return -EINVAL;
-+
-+	mutex_lock(&tc->update_lock);
-+	status = write_fan_fault_thresh(tc, nr, new_min);
-+	mutex_unlock(&tc->update_lock);
-+	return count;
-+}
-+
-+static ssize_t
-+show_fan_max(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	int max_rpm = tc->cached_regs[TC654_REG_CONFIG] & TC654_CTRL_RES ?
-+		(((1 << 9) - 1) * 25) /* ((2**9) - 1) * 25 RPM */:
-+		(((1 << 8) - 1) * 50) /* ((2**8) - 1) * 50 RPM */;
-+
-+	return sprintf(buf, "%d\n", max_rpm);
-+}
-+
-+static ssize_t
-+show_fan_fault(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+	int nr = to_sensor_dev_attr(da)->index;
-+	u8 fan_fault_mask = nr == TC654_FAN1 ?
-+		TC654_STATUS_F1F : TC654_STATUS_F2F;
-+
-+	return sprintf(buf, "%d\n",
-+		!!(tc->cached_regs[TC654_REG_STATUS] & fan_fault_mask));
-+}
-+
-+static ssize_t
-+show_fan_pulses(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	int nr = to_sensor_dev_attr(da)->index;
-+
-+	return sprintf(buf, "%d\n", get_fan_pulse(tc, nr));
-+}
-+
-+static ssize_t
-+set_fan_pulses(struct device *dev, struct device_attribute *da,
-+	      const char *buf, size_t count)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	long new_pulse;
-+	int nr = to_sensor_dev_attr(da)->index;
-+	int status = kstrtol(buf, 10, &new_pulse);
-+
-+	if (status < 0)
-+		return status;
-+
-+	status = set_fan_pulse(tc, nr, new_pulse);
-+	if (status < 0)
-+		return status;
-+
-+	return count;
-+}
-+
-+static ssize_t
-+show_pwm_enable(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+	int pwm_enabled;
-+
-+	if ((tc->cached_regs[TC654_REG_CONFIG] & TC654_CTRL_SDM) &&
-+	    !tc->pwm_manual) {
-+		pwm_enabled = 0; /* full off */
-+	} else {
-+		if (tc->valid && tc->vin_status == 0)
-+			pwm_enabled = 2; /* automatic fan speed control */
-+
-+		pwm_enabled = 1; /* PWM Mode */
-+	}
-+
-+	return sprintf(buf, "%d\n", pwm_enabled);
-+}
-+
-+static ssize_t
-+set_pwm_enable(struct device *dev, struct device_attribute *da,
-+	       const char *buf, size_t count)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	long new_value;
-+
-+	int result = kstrtol(buf, 10, &new_value);
-+
-+	if (result < 0)
-+		return result;
-+
-+	mutex_lock(&tc->update_lock);
-+	switch (new_value) {
-+	case 0: /* no fan control (i.e. is OFF) */
-+		result = write_fan_mode(tc, TC654_PWM_OFF);
-+		tc->pwm_manual = false;
-+		break;
-+
-+	case 1: /* manual fan control enabled (using pwm) */
-+		result = write_fan_mode(tc, TC654_PWM_10000);
-+		break;
-+
-+	case 2: /* automatic fan speed control enabled */
-+		result = write_fan_mode(tc, TC654_PWM_VIN);
-+		break;
-+
-+	default:
-+		result = -EINVAL;
-+	}
-+
-+	mutex_unlock(&tc->update_lock);
-+	return result < 0 ? result : count;
-+}
-+
-+static ssize_t
-+show_pwm(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+	int ret;
-+
-+	ret = get_fan_speed(tc);
-+	if (ret < 0)
-+		return ret;
-+
-+	return sprintf(buf, "%d\n", ret);
-+}
-+
-+static ssize_t
-+set_pwm(struct device *dev, struct device_attribute *da,
-+	const char *buf, size_t count)
-+{
-+	struct tc654 *tc = dev_get_drvdata(dev);
-+	long new_value = -1;
-+	int result = kstrtol(buf, 10, &new_value);
-+
-+	if (result < 0)
-+		return result;
-+
-+	if (new_value < 0 || new_value > INT_MAX)
-+		return -EINVAL;
-+
-+	if (!tc->pwm_manual)
-+		return -EINVAL;
-+
-+	result = set_fan_speed(tc, new_value);
-+	if (result < 0)
-+		return result;
-+
-+	return count;
-+}
-+
-+static ssize_t
-+show_temp_alarm_otf(struct device *dev, struct device_attribute *da, char *buf)
-+{
-+	struct tc654 *tc = tc654_update_device(dev);
-+
-+	return sprintf(buf, "%d\n", tc->alarms[TC654_ALARM_OVER_TEMPERATURE]);
-+}
-+
-+static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input,
-+			  NULL, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO | S_IWUSR, show_fan_min,
-+			  set_fan_min, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan1_min_alarm, S_IRUGO, show_fan_min_alarm,
-+			  NULL, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan1_max_alarm, S_IRUGO, show_fan_max_alarm,
-+			  NULL, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan1_max, S_IRUGO, show_fan_max, NULL, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault,
-+			  NULL, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan1_pulses, S_IRUGO | S_IWUSR, show_fan_pulses,
-+			  set_fan_pulses, TC654_FAN1);
-+static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input,
-+			  NULL, TC654_FAN2);
-+static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO | S_IWUSR, show_fan_min,
-+			  set_fan_min, TC654_FAN2);
-+static SENSOR_DEVICE_ATTR(fan2_max, S_IRUGO, show_fan_max,
-+			  NULL, TC654_FAN2);
-+static SENSOR_DEVICE_ATTR(fan2_min_alarm, S_IRUGO, show_fan_min_alarm,
-+			  NULL, TC654_FAN2);
-+static SENSOR_DEVICE_ATTR(fan2_max_alarm, S_IRUGO, show_fan_max_alarm,
-+			  NULL, TC654_FAN2);
-+static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault,
-+			  NULL, TC654_FAN2);
-+static SENSOR_DEVICE_ATTR(fan2_pulses, S_IRUGO | S_IWUSR, show_fan_pulses,
-+			  set_fan_pulses, TC654_FAN2);
-+
-+static DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_pwm_enable,
-+	set_pwm_enable);
-+static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm);
-+
-+static DEVICE_ATTR(temp1_emergency_alarm, S_IRUGO, show_temp_alarm_otf, NULL);
-+
-+/* sensors present on all models */
-+static struct attribute *tc654_attrs[] = {
-+	&sensor_dev_attr_fan1_input.dev_attr.attr,
-+	&sensor_dev_attr_fan1_min.dev_attr.attr,
-+	&sensor_dev_attr_fan1_max.dev_attr.attr,
-+	&sensor_dev_attr_fan1_min_alarm.dev_attr.attr,
-+	&sensor_dev_attr_fan1_max_alarm.dev_attr.attr,
-+	&sensor_dev_attr_fan1_fault.dev_attr.attr,
-+	&sensor_dev_attr_fan1_pulses.dev_attr.attr,
-+	&sensor_dev_attr_fan2_input.dev_attr.attr,
-+	&sensor_dev_attr_fan2_min.dev_attr.attr,
-+	&sensor_dev_attr_fan2_max.dev_attr.attr,
-+	&sensor_dev_attr_fan2_min_alarm.dev_attr.attr,
-+	&sensor_dev_attr_fan2_max_alarm.dev_attr.attr,
-+	&sensor_dev_attr_fan2_fault.dev_attr.attr,
-+	&sensor_dev_attr_fan2_pulses.dev_attr.attr,
-+
-+	&dev_attr_pwm1_enable.attr,
-+	&dev_attr_pwm1.attr,
-+
-+	&dev_attr_temp1_emergency_alarm.attr,
-+	NULL
-+};
-+
-+ATTRIBUTE_GROUPS(tc654);
-+
-+/* cooling device */
-+
-+static int tc654_get_max_state(struct thermal_cooling_device *cdev,
-+			       unsigned long *state)
-+{
-+	*state = 255;
-+	return 0;
-+}
-+
-+static int tc654_get_cur_state(struct thermal_cooling_device *cdev,
-+			       unsigned long *state)
-+{
-+	struct tc654 *tc = cdev->devdata;
-+	int ret;
-+
-+	if (!tc)
-+		return -EINVAL;
-+
-+	ret = get_fan_speed(tc);
-+	if (ret < 0)
-+		return ret;
-+
-+	*state = ret;
-+	return 0;
-+}
-+
-+static int tc654_set_cur_state(struct thermal_cooling_device *cdev,
-+			       unsigned long state)
-+{
-+	struct tc654 *tc = cdev->devdata;
-+
-+	if (!tc)
-+		return -EINVAL;
-+
-+	if (state > INT_MAX)
-+		return -EINVAL;
-+
-+	return set_fan_speed(tc, state);
-+}
-+
-+static const struct thermal_cooling_device_ops tc654_fan_cool_ops = {
-+	.get_max_state = tc654_get_max_state,
-+	.get_cur_state = tc654_get_cur_state,
-+	.set_cur_state = tc654_set_cur_state,
-+};
-+
-+
-+/* hardware probe and detection */
-+
-+static int
-+tc654_probe(struct i2c_client *client, const struct i2c_device_id *id)
-+{
-+	struct tc654 *tc;
-+	struct device *hwmon_dev;
-+	int ret, i;
-+
-+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-+		return -EIO;
-+
-+	tc = devm_kzalloc(&client->dev, sizeof(*tc), GFP_KERNEL);
-+	if (!tc)
-+		return -ENOMEM;
-+
-+	i2c_set_clientdata(client, tc);
-+	tc->client = client;
-+	mutex_init(&tc->update_lock);
-+
-+	/* cache all 8 registers */
-+	for (i = 0; i < __TC654_REG_NUM; i++) {
-+		ret = read_tc(tc, i);
-+		if (ret < 0)
-+			return ret;
-+	}
-+
-+	/* sysfs hooks */
-+	hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
-+							   client->name, tc,
-+							   tc654_groups);
-+	if (IS_ERR(hwmon_dev))
-+		return PTR_ERR(hwmon_dev);
-+
-+#if IS_ENABLED(CONFIG_OF)
-+	/* Optional cooling device register for Device tree platforms */
-+	tc->cdev = thermal_of_cooling_device_register(client->dev.of_node,
-+						      "tc654", tc,
-+						      &tc654_fan_cool_ops);
-+#else /* CONFIG_OF */
-+	/* Optional cooling device register for non Device tree platforms */
-+	tc->cdev = thermal_cooling_device_register("tc654", tc,
-+						   &tc654_fan_cool_ops);
-+#endif /* CONFIG_OF */
-+
-+	dev_info(&client->dev, "%s: sensor '%s'\n",
-+		 dev_name(hwmon_dev), client->name);
-+
-+	return 0;
-+}
-+
-+static const struct i2c_device_id tc654_ids[] = {
-+	{ "tc654", 0, },
-+	{ }
-+};
-+MODULE_DEVICE_TABLE(i2c, tc654_ids);
-+
-+/* Return 0 if detection is successful, -ENODEV otherwise */
-+static int
-+tc654_detect(struct i2c_client *new_client, struct i2c_board_info *info)
-+{
-+	struct i2c_adapter *adapter = new_client->adapter;
-+	int manufacturer, product;
-+
-+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-+		return -ENODEV;
-+
-+	manufacturer = i2c_smbus_read_byte_data(new_client, TC654_REG_MFR_ID);
-+	if (manufacturer != TC654_MFR_ID_MICROCHIP)
-+		return -ENODEV;
-+
-+	product = i2c_smbus_read_byte_data(new_client, TC654_REG_VER_ID);
-+	if (!((product == TC654_VER_ID) || (product == TC655_VER_ID)))
-+		return -ENODEV;
-+
-+	strlcpy(info->type, "tc654", I2C_NAME_SIZE);
-+	return 0;
-+}
-+
-+static struct i2c_driver tc654_driver = {
-+	.class		= I2C_CLASS_HWMON,
-+	.driver = {
-+		.name	= "tc654",
-+	},
-+	.probe		= tc654_probe,
-+	.id_table	= tc654_ids,
-+	.detect		= tc654_detect,
-+	.address_list	= normal_i2c,
-+};
-+
-+module_i2c_driver(tc654_driver);
-+
-+MODULE_AUTHOR("Christian Lamparter <chunkeey at gmail.com>");
-+MODULE_DESCRIPTION("Microchip TC654/TC655 hwmon driver");
-+MODULE_LICENSE("GPL");
diff --git a/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch b/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch
deleted file mode 100644
index e450f90..0000000
--- a/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-From: Wei Ni <wni at nvidia.com>
-Subject: hwmon: lm90: split set and show temp as common codes
-
-Split set and show temp codes as common functions, so we can use
-it directly when implement linux thermal framework.
-And handle error return value for the lm90_select_remote_channel
-and write_tempx, then set_temp8 and set_temp11 could return it
-to user-space.
-
-Discussed in:
-http://www.spinics.net/lists/linux-tegra/msg14020.html .
-Applied with Jean.
-
-BUG=chrome-os-partner:30834
-TEST=None
-
-Signed-off-by: Wei Ni <wni at nvidia.com>
-Signed-off-by: Jean Delvare <khali at linux-fr.org>
-Reviewed-on: https://chromium-review.googlesource.com/175114
-Tested-by: Wei Ni <wni.nvidia at gmail.com>
-Commit-Queue: Dylan Reid <dgreid at chromium.org>
-Reviewed-by: Dylan Reid <dgreid at chromium.org>
-(cherry picked from commit 614a96decdc7a3784128c9f21c5471367e2c627d)
-Change-Id: Idbe3948812c6737cba94810cd147c29cc527c3cf
-Reviewed-on: https://chromium-review.googlesource.com/212413
-Reviewed-by: Olof Johansson <olofj at chromium.org>
-Commit-Queue: Olof Johansson <olofj at chromium.org>
----
---- a/drivers/hwmon/lm90.c
-+++ b/drivers/hwmon/lm90.c
-@@ -473,20 +473,29 @@ static int lm90_read16(struct i2c_client
-  * various registers have different meanings as a result of selecting a
-  * non-default remote channel.
-  */
--static inline void lm90_select_remote_channel(struct i2c_client *client,
--					      struct lm90_data *data,
--					      int channel)
-+static inline int lm90_select_remote_channel(struct i2c_client *client,
-+					     struct lm90_data *data,
-+					     int channel)
- {
- 	u8 config;
-+	int err;
- 
- 	if (data->kind == max6696) {
- 		lm90_read_reg(client, LM90_REG_R_CONFIG1, &config);
- 		config &= ~0x08;
- 		if (channel)
- 			config |= 0x08;
--		i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
--					  config);
-+		err = i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
-+						config);
-+		if (err < 0) {
-+			dev_err(&client->dev,
-+				"Failed to select remote channel %d, err %d\n",
-+				channel, err);
-+			return err;
-+		}
- 	}
-+
-+	return 0;
- }
- 
- /*
-@@ -759,29 +768,34 @@ static u16 temp_to_u16_adt7461(struct lm
-  * Sysfs stuff
-  */
- 
--static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr,
--			  char *buf)
-+static int read_temp8(struct device *dev, int index)
- {
--	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- 	struct lm90_data *data = lm90_update_device(dev);
- 	int temp;
- 
- 	if (data->kind == adt7461 || data->kind == tmp451)
--		temp = temp_from_u8_adt7461(data, data->temp8[attr->index]);
-+		temp = temp_from_u8_adt7461(data, data->temp8[index]);
- 	else if (data->kind == max6646)
--		temp = temp_from_u8(data->temp8[attr->index]);
-+		temp = temp_from_u8(data->temp8[index]);
- 	else
--		temp = temp_from_s8(data->temp8[attr->index]);
-+		temp = temp_from_s8(data->temp8[index]);
- 
- 	/* +16 degrees offset for temp2 for the LM99 */
--	if (data->kind == lm99 && attr->index == 3)
-+	if (data->kind == lm99 && index == 3)
- 		temp += 16000;
- 
--	return sprintf(buf, "%d\n", temp);
-+	return temp;
- }
- 
--static ssize_t set_temp8(struct device *dev, struct device_attribute *devattr,
--			 const char *buf, size_t count)
-+static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr,
-+			  char *buf)
-+{
-+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-+
-+	return sprintf(buf, "%d\n", read_temp8(dev, attr->index));
-+}
-+
-+static int write_temp8(struct device *dev, int index, long val)
- {
- 	static const u8 reg[TEMP8_REG_NUM] = {
- 		LM90_REG_W_LOCAL_LOW,
-@@ -794,60 +808,79 @@ static ssize_t set_temp8(struct device *
- 		MAX6659_REG_W_REMOTE_EMERG,
- 	};
- 
--	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- 	struct lm90_data *data = dev_get_drvdata(dev);
- 	struct i2c_client *client = data->client;
--	int nr = attr->index;
--	long val;
- 	int err;
- 
--	err = kstrtol(buf, 10, &val);
--	if (err < 0)
--		return err;
--
- 	/* +16 degrees offset for temp2 for the LM99 */
--	if (data->kind == lm99 && attr->index == 3)
-+	if (data->kind == lm99 && index == 3)
- 		val -= 16000;
- 
- 	mutex_lock(&data->update_lock);
- 	if (data->kind == adt7461 || data->kind == tmp451)
--		data->temp8[nr] = temp_to_u8_adt7461(data, val);
-+		data->temp8[index] = temp_to_u8_adt7461(data, val);
- 	else if (data->kind == max6646)
--		data->temp8[nr] = temp_to_u8(val);
-+		data->temp8[index] = temp_to_u8(val);
- 	else
--		data->temp8[nr] = temp_to_s8(val);
--
--	lm90_select_remote_channel(client, data, nr >= 6);
--	i2c_smbus_write_byte_data(client, reg[nr], data->temp8[nr]);
--	lm90_select_remote_channel(client, data, 0);
-+		data->temp8[index] = temp_to_s8(val);
- 
-+	if ((err = lm90_select_remote_channel(client, data, index >= 6)) ||
-+	    (err = i2c_smbus_write_byte_data(client, reg[index],
-+					     data->temp8[index])) ||
-+	    (err = lm90_select_remote_channel(client, data, 0)))
-+		dev_err(dev, "write_temp8 failed, err %d\n", err);
- 	mutex_unlock(&data->update_lock);
-+
-+	return err;
-+}
-+
-+static ssize_t set_temp8(struct device *dev, struct device_attribute *devattr,
-+			 const char *buf, size_t count)
-+{
-+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-+	int index = attr->index;
-+	long val;
-+	int err;
-+
-+	err = kstrtol(buf, 10, &val);
-+	if (err < 0)
-+		return err;
-+
-+	err = write_temp8(dev, index, val);
-+	if (err < 0)
-+		return err;
-+
- 	return count;
- }
- 
--static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr,
--			   char *buf)
-+static int read_temp11(struct device *dev, int index)
- {
--	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
- 	struct lm90_data *data = lm90_update_device(dev);
- 	int temp;
- 
- 	if (data->kind == adt7461 || data->kind == tmp451)
--		temp = temp_from_u16_adt7461(data, data->temp11[attr->index]);
-+		temp = temp_from_u16_adt7461(data, data->temp11[index]);
- 	else if (data->kind == max6646)
--		temp = temp_from_u16(data->temp11[attr->index]);
-+		temp = temp_from_u16(data->temp11[index]);
- 	else
--		temp = temp_from_s16(data->temp11[attr->index]);
-+		temp = temp_from_s16(data->temp11[index]);
- 
- 	/* +16 degrees offset for temp2 for the LM99 */
--	if (data->kind == lm99 &&  attr->index <= 2)
-+	if (data->kind == lm99 && index <= 2)
- 		temp += 16000;
- 
--	return sprintf(buf, "%d\n", temp);
-+	return temp;
- }
- 
--static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
--			  const char *buf, size_t count)
-+static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr,
-+			   char *buf)
-+{
-+	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
-+
-+	return sprintf(buf, "%d\n", read_temp11(dev, attr->index));
-+}
-+
-+static int write_temp11(struct device *dev, int nr, int index, long val)
- {
- 	struct {
- 		u8 high;
-@@ -861,18 +894,10 @@ static ssize_t set_temp11(struct device
- 		{ LM90_REG_W_REMOTE_HIGHH, LM90_REG_W_REMOTE_HIGHL, 1 }
- 	};
- 
--	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
- 	struct lm90_data *data = dev_get_drvdata(dev);
- 	struct i2c_client *client = data->client;
--	int nr = attr->nr;
--	int index = attr->index;
--	long val;
- 	int err;
- 
--	err = kstrtol(buf, 10, &val);
--	if (err < 0)
--		return err;
--
- 	/* +16 degrees offset for temp2 for the LM99 */
- 	if (data->kind == lm99 && index <= 2)
- 		val -= 16000;
-@@ -887,15 +912,50 @@ static ssize_t set_temp11(struct device
- 	else
- 		data->temp11[index] = temp_to_s8(val) << 8;
- 
--	lm90_select_remote_channel(client, data, reg[nr].channel);
--	i2c_smbus_write_byte_data(client, reg[nr].high,
--				  data->temp11[index] >> 8);
--	if (data->flags & LM90_HAVE_REM_LIMIT_EXT)
--		i2c_smbus_write_byte_data(client, reg[nr].low,
--					  data->temp11[index] & 0xff);
--	lm90_select_remote_channel(client, data, 0);
-+	err = lm90_select_remote_channel(client, data, reg[nr].channel);
-+	if (err)
-+		goto error;
-+
-+	err = i2c_smbus_write_byte_data(client, reg[nr].high,
-+					data->temp11[index] >> 8);
-+	if (err)
-+		goto error;
-+
-+	if (data->flags & LM90_HAVE_REM_LIMIT_EXT) {
-+		err = i2c_smbus_write_byte_data(client, reg[nr].low,
-+						data->temp11[index] & 0xff);
-+		if (err)
-+			goto error;
-+	}
-+
-+	err = lm90_select_remote_channel(client, data, 0);
-+
-+error:
-+	if (err)
-+		dev_err(dev, "write_temp11 failed, err %d\n", err);
- 
- 	mutex_unlock(&data->update_lock);
-+
-+	return err;
-+}
-+
-+static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
-+			  const char *buf, size_t count)
-+{
-+	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
-+	int nr = attr->nr;
-+	int index = attr->index;
-+	long val;
-+	int err;
-+
-+	err = kstrtol(buf, 10, &val);
-+	if (err < 0)
-+		return err;
-+
-+	err = write_temp11(dev, nr, index, val);
-+	if (err < 0)
-+		return err;
-+
- 	return count;
- }
- 
diff --git a/target/linux/apm821xx/patches-4.4/912-hwmon-lm90-expose-to-thermal-fw-via-DT.patch b/target/linux/apm821xx/patches-4.4/912-hwmon-lm90-expose-to-thermal-fw-via-DT.patch
deleted file mode 100644
index 9eb9cee..0000000
--- a/target/linux/apm821xx/patches-4.4/912-hwmon-lm90-expose-to-thermal-fw-via-DT.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From: Wei Ni <wni at nvidia.com>
-Subject: hwmon: lm90: expose to thermal fw via DT nodes
-
-This patch adds to lm90 temperature sensor the possibility
-to expose itself as thermal zone device, registered on the
-thermal framework.
-
-The thermal zone is built only if a device tree node
-describing a thermal zone for this sensor is present
-inside the lm90 DT node. Otherwise, the driver behavior
-will be the same.
-
-Discussed in:
-http://www.gossamer-threads.com/lists/linux/kernel/1992853
-
-BUG=chrome-os-partner:30834
-TEST=Verified. Build and boot up system.
-
-Signed-off-by: Wei Ni <wni at nvidia.com>
-Reviewed-on: https://chromium-review.googlesource.com/181447
-Reviewed-by: Dylan Reid <dgreid at chromium.org>
-Tested-by: Dylan Reid <dgreid at chromium.org>
-Commit-Queue: Dylan Reid <dgreid at chromium.org>
-Change-Id: Id356b94d7e8f4b49ec15e46b17a1fa2ff0cbf8cf
-Reviewed-on: https://chromium-review.googlesource.com/212414
-Tested-by: Wei Ni <wni.nvidia at gmail.com>
-Reviewed-by: Olof Johansson <olofj at chromium.org>
-Commit-Queue: Olof Johansson <olofj at chromium.org>
----
---- a/drivers/hwmon/lm90.c
-+++ b/drivers/hwmon/lm90.c
-@@ -96,6 +96,8 @@
- #include <linux/sysfs.h>
- #include <linux/interrupt.h>
- #include <linux/regulator/consumer.h>
-+#include <linux/of.h>
-+#include <linux/thermal.h>
- 
- /*
-  * Addresses to scan
-@@ -119,6 +121,13 @@ static const unsigned short normal_i2c[]
- enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
- 	max6646, w83l771, max6696, sa56004, g781, tmp451 };
- 
-+enum sensor_id {
-+	LOCAL = 0,
-+	REMOTE,
-+	REMOTE2,
-+	SENSOR_ID_END,
-+};
-+
- /*
-  * The LM90 registers
-  */
-@@ -368,6 +377,7 @@ struct lm90_data {
- 	struct i2c_client *client;
- 	struct device *hwmon_dev;
- 	const struct attribute_group *groups[6];
-+	struct thermal_zone_device *tz[SENSOR_ID_END];
- 	struct mutex update_lock;
- 	struct regulator *regulator;
- 	char valid; /* zero until following fields are valid */
-@@ -880,6 +890,24 @@ static ssize_t show_temp11(struct device
- 	return sprintf(buf, "%d\n", read_temp11(dev, attr->index));
- }
- 
-+static int lm90_read_local_temp(void *dev, int *temp)
-+{
-+	*temp = read_temp11(dev, 4);
-+	return 0;
-+}
-+
-+static int lm90_read_remote_temp(void *dev, int *temp)
-+{
-+	*temp = read_temp11(dev, 0);
-+	return 0;
-+}
-+
-+static int lm90_read_remote2_temp(void *dev, int *temp)
-+{
-+	*temp = read_temp11(dev, 5);
-+	return 0;
-+}
-+
- static int write_temp11(struct device *dev, int nr, int index, long val)
- {
- 	struct {
-@@ -1210,6 +1238,18 @@ static const struct attribute_group lm90
- 	.attrs = lm90_temp3_attributes,
- };
- 
-+static const struct thermal_zone_of_device_ops local_temp_sensor = {
-+	.get_temp = lm90_read_local_temp,
-+};
-+
-+static const struct thermal_zone_of_device_ops remote_temp_sensor = {
-+	.get_temp = lm90_read_remote_temp,
-+};
-+
-+static const struct thermal_zone_of_device_ops remote2_temp_sensor = {
-+	.get_temp = lm90_read_remote2_temp,
-+};
-+
- /* pec used for ADM1032 only */
- static ssize_t show_pec(struct device *dev, struct device_attribute *dummy,
- 			char *buf)
-@@ -1659,6 +1699,30 @@ static int lm90_probe(struct i2c_client
- 		}
- 	}
- 
-+	data->tz[LOCAL] = thermal_zone_of_sensor_register(&client->dev,
-+							LOCAL,
-+							&client->dev,
-+							&local_temp_sensor);
-+	if (IS_ERR(data->tz[LOCAL]))
-+		data->tz[LOCAL] = NULL;
-+
-+	data->tz[REMOTE] = thermal_zone_of_sensor_register(&client->dev,
-+							REMOTE,
-+							&client->dev,
-+							&remote_temp_sensor);
-+	if (IS_ERR(data->tz[REMOTE]))
-+		data->tz[REMOTE] = NULL;
-+
-+	if (data->flags & LM90_HAVE_TEMP3) {
-+		data->tz[REMOTE2] = thermal_zone_of_sensor_register(
-+							&client->dev,
-+							REMOTE2,
-+							&client->dev,
-+							&remote2_temp_sensor);
-+		if (IS_ERR(data->tz[REMOTE2]))
-+			data->tz[REMOTE2] = NULL;
-+	}
-+
- 	return 0;
- 
- exit_unregister:
-@@ -1674,8 +1738,11 @@ exit_restore:
- 
- static int lm90_remove(struct i2c_client *client)
- {
-+	int i;
- 	struct lm90_data *data = i2c_get_clientdata(client);
- 
-+	for (i = 0; i < SENSOR_ID_END; i++)
-+		thermal_zone_of_sensor_unregister(&client->dev, data->tz[i]);
- 	hwmon_device_unregister(data->hwmon_dev);
- 	device_remove_file(&client->dev, &dev_attr_pec);
- 	lm90_restore_conf(client, data);


From lede-commits at lists.infradead.org  Wed Apr 12 00:55:05 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:55:05 -0400
Subject: [source]  openvpn: add myself as maintainer
In-Reply-To: <20170412075504.25162.99463@git-01.infra.lede-project.org>
References: <20170412075504.25162.99463@git-01.infra.lede-project.org>
Message-ID: <mailman.23561.1491983853.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/a7f8564b0fe358e04b03e87566e8be54c2e48c9b

commit a7f8564b0fe358e04b03e87566e8be54c2e48c9b
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Apr 3 09:00:32 2017 +0200

    openvpn: add myself as maintainer
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/services/openvpn/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/openvpn/Makefile b/package/network/services/openvpn/Makefile
index 0d3e023..adce897 100644
--- a/package/network/services/openvpn/Makefile
+++ b/package/network/services/openvpn/Makefile
@@ -19,6 +19,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_HASH:=fde9e22c6df7a335d2d58c6a4d5967be76df173c766a5c51ece57fd044c76ee5
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
 
 PKG_INSTALL:=1
 PKG_FIXUP:=autoreconf
@@ -41,7 +42,6 @@ ifeq ($(1),nossl)
 else
   PROVIDES:=openvpn openvpn-crypto
 endif
-  MAINTAINER:=Mirko Vogt <mirko at openwrt.org>
 endef
 
 Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl)


From lede-commits at lists.infradead.org  Wed Apr 12 00:55:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:55:07 -0400
Subject: [source]  ath10k-firmware: update to latest version
In-Reply-To: <20170412075504.25162.99463@git-01.infra.lede-project.org>
References: <20170412075504.25162.99463@git-01.infra.lede-project.org>
Message-ID: <mailman.23562.1491983854.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/a124f0739b451037fce0f94a4298b48299011e0b

commit a124f0739b451037fce0f94a4298b48299011e0b
Author: Pavel Kubelun <be.dissent at gmail.com>
AuthorDate: Wed Mar 29 17:41:31 2017 +0300

    ath10k-firmware: update to latest version
    
    Kvalo's repo has a newer version of qca9984 firmware. Use it instead.
    
    Signed-off-by: Pavel Kubelun <be.dissent at gmail.com>
---
 package/firmware/ath10k-firmware/Makefile | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index b33e5d7..218dbd3 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -210,29 +210,6 @@ define Download/qca99x0-board
 endef
 $(eval $(call Download,qca99x0-board))
 
-QCA9984_BOARD_REV:=719c0127e52bd70559e71b85ab0331790e1bf66c
-QCA9984_BOARD_FILE:=board-2.bin
-QCA9984_BOARD_FILE_DL:=$(QCA9984_BOARD_FILE).$(QCA9984_BOARD_REV)
-QCA9984_FIRMWARE_REV:=7090001487d567ca1bef3ec26d1299a6e90fd1ad
-QCA9984_FIRMWARE_FILE:=firmware-5.bin_10.4-3.4-00074
-QCA9984_FIRMWARE_FILE_DL:=$(QCA9984_FIRMWARE_FILE).$(QCA9984_FIRMWARE_REV)
-
-define Download/ath10k-qca9984-board
-  URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA9984/hw1.0/
-  URL_FILE:=$(QCA9984_BOARD_FILE)?id=$(QCA9984_BOARD_REV)
-  FILE:=$(QCA9984_BOARD_FILE_DL)
-  HASH:=e968b214fd76d5b7859f71841ce40fbd5f47336c3ccbaf95e23f902f5e569aef
-endef
-$(eval $(call Download,ath10k-qca9984-board))
-
-define Download/ath10k-qca9984-firmware
-  URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA9984/hw1.0/
-  URL_FILE:=$(QCA9984_FIRMWARE_FILE)?id=$(QCA9984_FIRMWARE_REV)
-  FILE:=$(QCA9984_FIRMWARE_FILE_DL)
-  HASH:=368119af56a851bb26f6f4f9cd0e90488cb67de3fe68133ccc061b825618c0ee
-endef
-$(eval $(call Download,ath10k-qca9984-firmware))
-
 define Build/Compile
 
 endef
@@ -324,10 +301,10 @@ define Package/ath10k-firmware-qca9984/install
 		../../cal-pci-0000:01:00.0.bin \
 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
 	$(INSTALL_DATA) \
-		$(DL_DIR)/$(QCA9984_BOARD_FILE_DL) \
+		$(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
 	$(INSTALL_DATA) \
-		$(DL_DIR)/$(QCA9984_FIRMWARE_FILE_DL) \
+		$(PKG_BUILD_DIR)/QCA9984/hw1.0/3.4/firmware-5.bin_10.4-3.4-00082 \
 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
 endef
 


From lede-commits at lists.infradead.org  Wed Apr 12 00:55:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:55:06 -0400
Subject: [source]  build: remove package makefile overlay functionality
In-Reply-To: <20170412075504.25162.99463@git-01.infra.lede-project.org>
References: <20170412075504.25162.99463@git-01.infra.lede-project.org>
Message-ID: <mailman.23563.1491983856.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/b044bd5921e9644c9df9655bef10cee0af730724

commit b044bd5921e9644c9df9655bef10cee0af730724
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Apr 3 12:36:35 2017 +0200

    build: remove package makefile overlay functionality
    
    Recent attempts to use it have shown that it does not work properly
    except for a few undocumented cases. It's better to remove this now to
    avoid having more people fall into the same trap
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/package.mk  | 7 -------
 include/toplevel.mk | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/include/package.mk b/include/package.mk
index c5c335a..7047b5c 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -232,14 +232,7 @@ define Build/DefaultTargets
   endef
 endef
 
-define Build/IncludeOverlay
-  $(eval -include $(wildcard $(TOPDIR)/overlay/*/$(PKG_DIR_NAME).mk))
-  define Build/IncludeOverlay
-  endef
-endef
-
 define BuildPackage
-  $(Build/IncludeOverlay)
   $(eval $(Package/Default))
   $(eval $(Package/$(1)))
 
diff --git a/include/toplevel.mk b/include/toplevel.mk
index 0f68580..ceafffb 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -81,7 +81,7 @@ _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
 prepare-tmpinfo: FORCE
 	@+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK)
 	mkdir -p tmp/info
-	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk $(TOPDIR)/overlay/*/*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
+	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
 	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
 	for type in package target; do \
 		f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \


From lede-commits at lists.infradead.org  Wed Apr 12 00:55:08 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:55:08 -0400
Subject: [source]  base-files: use restart if no reload hook for service
In-Reply-To: <20170412075504.25162.99463@git-01.infra.lede-project.org>
References: <20170412075504.25162.99463@git-01.infra.lede-project.org>
Message-ID: <mailman.23564.1491983856.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/6713694fe4377f0988e2d558a6cd9b05ca9b18f1

commit 6713694fe4377f0988e2d558a6cd9b05ca9b18f1
Author: Alexandru Ardelean <ardeleanalex at gmail.com>
AuthorDate: Fri Mar 31 09:44:19 2017 +0300

    base-files: use restart if no reload hook for service
    
    This was also working before, with a slightly
    different semantic.
    
    [ Original semantic ]
    If no reload hooks was implemented, the default one would
    kick in, it would return fail, and restart would happen.
    
    This would happen also in the case where a reload hook
    would be implemented, it would fail, and it would restart
    the service.
    
    [ New semantic ]
    The default reload hook calls restart.
    Services can implement their own reload.
    
    If reload fails, then the '/etc/init.d/<service> reload'
    would return a non-zero code, and the caller can choose
    a way to handle this.
    
    Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 package/base-files/files/etc/rc.common | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index 95cf956..af7bed4 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -17,7 +17,7 @@ stop() {
 }
 
 reload() {
-	return 1
+	restart
 }
 
 restart() {
@@ -68,7 +68,7 @@ Available commands:
 	start	Start the service
 	stop	Stop the service
 	restart	Restart the service
-	reload	Reload configuration files (or restart if that fails)
+	reload	Reload configuration files (or restart if service does not implement reload)
 	enable	Enable service autostart
 	disable	Disable service autostart
 $EXTRA_HELP
@@ -130,7 +130,7 @@ ${INIT_TRACE:+set -x}
 		if eval "type reload_service" 2>/dev/null >/dev/null; then
 			reload_service "$@"
 		else
-			start
+			restart
 		fi
 	}
 
@@ -141,5 +141,4 @@ ${INIT_TRACE:+set -x}
 
 ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
 list_contains ALL_COMMANDS "$action" || action=help
-[ "$action" = "reload" ] && action='eval reload "$@" || restart "$@" && :'
 $action "$@"


From lede-commits at lists.infradead.org  Wed Apr 12 00:55:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:55:04 -0400
Subject: [source]  OpenVPN: Update to 2.4.1
In-Reply-To: <20170412075504.25162.99463@git-01.infra.lede-project.org>
References: <20170412075504.25162.99463@git-01.infra.lede-project.org>
Message-ID: <mailman.23565.1491983859.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/210e96d4cfb6ba501c4ece5b7c7824183f7d3842

commit 210e96d4cfb6ba501c4ece5b7c7824183f7d3842
Author: Daniel Engberg <daniel.engberg.lists at pyret.net>
AuthorDate: Mon Mar 27 14:51:44 2017 +0200

    OpenVPN: Update to 2.4.1
    
    Update OpenVPN to 2.4.1
    Remove 200-small_build_enable_occ.patch as it's included upstream.
    Refresh patches
    Add mirror and switch to HTTPS
    
    Signed-off-by: Daniel Engberg <daniel.engberg.lists at pyret.net>
---
 package/network/services/openvpn/Makefile                    | 10 ++++++----
 .../patches/100-mbedtls-disable-runtime-version-check.patch  |  2 +-
 .../openvpn/patches/200-small_build_enable_occ.patch         | 12 ------------
 .../openvpn/patches/210-build_always_use_internal_lz4.patch  |  8 +++++---
 4 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/package/network/services/openvpn/Makefile b/package/network/services/openvpn/Makefile
index ebfc51f..0d3e023 100644
--- a/package/network/services/openvpn/Makefile
+++ b/package/network/services/openvpn/Makefile
@@ -9,12 +9,14 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openvpn
 
-PKG_VERSION:=2.4.0
-PKG_RELEASE:=4
+PKG_VERSION:=2.4.1
+PKG_RELEASE:=1
 
-PKG_SOURCE_URL:=http://swupdate.openvpn.net/community/releases
+PKG_SOURCE_URL:=\
+	https://build.openvpn.net/downloads/releases/ \
+	https://swupdate.openvpn.net/community/releases/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=6f23ba49a1dbeb658f49c7ae17d9ea979de6d92c7357de3d55cd4525e1b2f87e
+PKG_HASH:=fde9e22c6df7a335d2d58c6a4d5967be76df173c766a5c51ece57fd044c76ee5
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 
diff --git a/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch b/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch
index 3b8248d..75e3062 100644
--- a/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch
+++ b/package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch
@@ -1,6 +1,6 @@
 --- a/src/openvpn/ssl_mbedtls.c
 +++ b/src/openvpn/ssl_mbedtls.c
-@@ -1333,7 +1333,7 @@ const char *
+@@ -1337,7 +1337,7 @@ const char *
  get_ssl_library_version(void)
  {
      static char mbedtls_version[30];
diff --git a/package/network/services/openvpn/patches/200-small_build_enable_occ.patch b/package/network/services/openvpn/patches/200-small_build_enable_occ.patch
deleted file mode 100644
index 96276d4..0000000
--- a/package/network/services/openvpn/patches/200-small_build_enable_occ.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/openvpn/syshead.h
-+++ b/src/openvpn/syshead.h
-@@ -589,9 +589,7 @@ socket_defined (const socket_descriptor_
- /*
-  * Should we include OCC (options consistency check) code?
-  */
--#ifndef ENABLE_SMALL
- #define ENABLE_OCC
--#endif
- 
- /*
-  * Should we include NTLM proxy functionality
diff --git a/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch b/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch
index 6719107..45a0207 100644
--- a/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch
+++ b/package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch
@@ -1,12 +1,12 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1014,37 +1014,14 @@ dnl
+@@ -1058,37 +1058,14 @@ dnl
  AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4])
  AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
  if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then
 -    AC_CHECKING([for LZ4 Library and Header files])
 -    havelz4lib=1
-
+ 
 -    # if LZ4_LIBS is set, we assume it will work, otherwise test
 -    if test -z "${LZ4_LIBS}"; then
 -	AC_CHECK_LIB(lz4, LZ4_compress,
@@ -19,7 +19,7 @@
 +    AC_MSG_RESULT([Using LZ4 library in src/compat/compat-lz4.*])
 +    AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
 +    LZ4_LIBS=""
-
+ 
 -    saved_CFLAGS="${CFLAGS}"
 -    CFLAGS="${CFLAGS} ${LZ4_CFLAGS}"
 -    AC_CHECK_HEADERS(lz4.h,
@@ -39,3 +39,5 @@
      AC_DEFINE(ENABLE_LZ4, 1, [Enable LZ4 compression library])
 -    CFLAGS="${saved_CFLAGS}"
  fi
+ 
+ 


From lede-commits at lists.infradead.org  Wed Apr 12 00:55:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:55:09 -0400
Subject: [source]  binutils: fix build with host gcc < 4.9
In-Reply-To: <20170412075504.25162.99463@git-01.infra.lede-project.org>
References: <20170412075504.25162.99463@git-01.infra.lede-project.org>
Message-ID: <mailman.23566.1491983859.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/efb22b6f06d44bd156ea42d39779dabd356c7181

commit efb22b6f06d44bd156ea42d39779dabd356c7181
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sun Apr 2 17:40:43 2017 +0200

    binutils: fix build with host gcc < 4.9
    
    binutils 2.27 checks if the target compiler supports -Wstack-
    usage=262144, and also uses this setting for the host compiler. If the
    host compiler is gcc < 4.9 binutils build will fail. This backports 2
    commits which are fixing this problem for binutils 2.28.
    
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 ...-host-compiler-sanitization-flags-on-to-l.patch |   65 +
 ...ng-target-binaries-ensure-that-the-warnin.patch | 1258 ++++++++++++++++++++
 2 files changed, 1323 insertions(+)

diff --git a/package/devel/binutils/patches/0001-Do-not-pass-host-compiler-sanitization-flags-on-to-l.patch b/package/devel/binutils/patches/0001-Do-not-pass-host-compiler-sanitization-flags-on-to-l.patch
new file mode 100644
index 0000000..823527a
--- /dev/null
+++ b/package/devel/binutils/patches/0001-Do-not-pass-host-compiler-sanitization-flags-on-to-l.patch
@@ -0,0 +1,65 @@
+From 183eb37e25d903ccd68cc2d8f8a37e75872c03d2 Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc at redhat.com>
+Date: Tue, 6 Sep 2016 17:35:35 +0100
+Subject: [PATCH 1/2] Do not pass host compiler sanitization flags on to linker
+ testsuite.
+
+	* Makefile.am (CFLAGS_FOR_TARGET): Define as a copy of CFLAGS but
+	without any sanitization options.
+	(CXXFLAGS_FOR_TARGET): Define as a copy of CXXFLAGS but	without
+	any sanitization options.
+	(check-DEJAGNU): Pass CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET
+	as CFLAGS and CXXFLAGS respectively.
+---
+ ld/Makefile.am | 8 ++++++--
+ ld/Makefile.in | 8 ++++++--
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+--- a/ld/Makefile.am
++++ b/ld/Makefile.am
+@@ -136,6 +136,10 @@ CXX_FOR_TARGET = ` \
+     fi; \
+   fi`
+ 
++# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
++CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
++CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
++
+ transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
+ bin_PROGRAMS = ld-new
+ info_TEXINFOS = ld.texinfo
+@@ -2075,8 +2079,8 @@ check-DEJAGNU: site.exp
+ 	runtest=$(RUNTEST); \
+ 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+-		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
+-		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
++		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS_FOR_TARGET)" \
++		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+ 		CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
+ 		OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
+ 		LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
+--- a/ld/Makefile.in
++++ b/ld/Makefile.in
+@@ -507,6 +507,10 @@ CXX_FOR_TARGET = ` \
+     fi; \
+   fi`
+ 
++
++# Strip out sanitization options as they require special host libraries.
++CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
++CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
+ info_TEXINFOS = ld.texinfo
+ ld_TEXINFOS = configdoc.texi
+ noinst_TEXINFOS = ldint.texinfo
+@@ -3644,8 +3648,8 @@ check-DEJAGNU: site.exp
+ 	runtest=$(RUNTEST); \
+ 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+-		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
+-		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
++		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS_FOR_TARGET)" \
++		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+ 		CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
+ 		OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
+ 		LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
diff --git a/package/devel/binutils/patches/0002-When-building-target-binaries-ensure-that-the-warnin.patch b/package/devel/binutils/patches/0002-When-building-target-binaries-ensure-that-the-warnin.patch
new file mode 100644
index 0000000..b87c58e
--- /dev/null
+++ b/package/devel/binutils/patches/0002-When-building-target-binaries-ensure-that-the-warnin.patch
@@ -0,0 +1,1258 @@
+From b8ff24c72174effd5c5527866313982e28507275 Mon Sep 17 00:00:00 2001
+From: Vlad Zakharov <vzakhar at synopsys.com>
+Date: Mon, 26 Sep 2016 16:36:08 +0100
+Subject: [PATCH 2/2] When building target binaries, ensure that the warning
+ flags selected for the command line match the target compiler.
+
+bfd	* warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro
+	to verify CC_FOR_BUILD compiler.
+	(AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable
+	and add CC_FOR_BUILD compiler checks.
+	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* doc/Makefile.in: Likewise.
+
+binutils	* Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD
+	when building with CC_FOR_BUILD compiler.
+	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* doc/Makefile.in: Likewise.
+
+gas	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* doc/Makefile.in: Likewise.
+
+gold	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* testsuite/Makefile.in: Likewise.
+
+gprof	* Makefile.in: Regenerate.
+	* configure: Likewise.
+
+ld	* Makefile.in: Regenerate.
+	* configure: Likewise.
+
+opcodes	* Makefile.in: Regenerate.
+	* configure: Likewise.
+---
+ bfd/Makefile.in            |  1 +
+ bfd/configure              | 56 +++++++++++++++++++++++++++++++++++++++++-----
+ bfd/doc/Makefile.in        |  1 +
+ bfd/warning.m4             | 47 ++++++++++++++++++++++++++++++++++----
+ binutils/Makefile.am       | 10 +++++----
+ binutils/Makefile.in       | 10 +++++----
+ binutils/configure         | 56 +++++++++++++++++++++++++++++++++++++++++-----
+ binutils/doc/Makefile.in   |  1 +
+ gas/Makefile.in            |  1 +
+ gas/configure              | 56 +++++++++++++++++++++++++++++++++++++++++-----
+ gas/doc/Makefile.in        |  1 +
+ gold/Makefile.in           |  5 +++--
+ gold/configure             | 52 ++++++++++++++++++++++++++++++++++++++----
+ gold/testsuite/Makefile.in |  1 +
+ gprof/Makefile.in          |  1 +
+ gprof/configure            | 56 +++++++++++++++++++++++++++++++++++++++++-----
+ ld/Makefile.in             |  3 ++-
+ ld/configure               | 56 +++++++++++++++++++++++++++++++++++++++++-----
+ opcodes/Makefile.in        |  1 +
+ opcodes/configure          | 56 +++++++++++++++++++++++++++++++++++++++++-----
+ 20 files changed, 416 insertions(+), 55 deletions(-)
+
+--- a/bfd/Makefile.in
++++ b/bfd/Makefile.in
+@@ -288,6 +288,7 @@ TDEFINES = @TDEFINES@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ abs_builddir = @abs_builddir@
+--- a/bfd/configure
++++ b/bfd/configure
+@@ -659,6 +659,7 @@ MAINTAINER_MODE_FALSE
+ MAINTAINER_MODE_TRUE
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ REPORT_BUGS_TEXI
+ REPORT_BUGS_TO
+@@ -11427,7 +11428,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11430 "configure"
++#line 11431 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11533,7 +11534,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11536 "configure"
++#line 11537 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -12240,8 +12241,12 @@ fi
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -12286,6 +12291,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -12301,6 +12336,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -12314,25 +12350,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -12343,6 +12386,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ 
+--- a/bfd/doc/Makefile.in
++++ b/bfd/doc/Makefile.in
+@@ -248,6 +248,7 @@ TDEFINES = @TDEFINES@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ abs_builddir = @abs_builddir@
+--- a/bfd/warning.m4
++++ b/bfd/warning.m4
+@@ -17,12 +17,34 @@ dnl along with this program; see the fil
+ dnl <http://www.gnu.org/licenses/>.
+ dnl
+ 
++# AC_EGREP_CPP_FOR_BUILD(PATTERN, PROGRAM,
++#              [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
++# ------------------------------------------------------
++AC_DEFUN([AC_EGREP_CPP_FOR_BUILD],
++[AC_LANG_PREPROC_REQUIRE()dnl
++AC_REQUIRE([AC_PROG_EGREP])dnl
++AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
++AS_IF([dnl eval is necessary to expand ac_cpp.
++dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
++(eval "$ac_cpp_for_build conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
++dnl Quote $1 to prevent m4 from eating character classes
++  $EGREP "[$1]" >/dev/null 2>&1],
++  [$3],
++  [$4])
++rm -f conftest*
++])# AC_EGREP_CPP_FOR_BUILD
++
++
+ AC_DEFUN([AM_BINUTILS_WARNINGS],[
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
+@@ -34,6 +56,14 @@ AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_W
+ WARN_WRITE_STRINGS=""
+ AC_EGREP_CPP([^[0-3]$],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-strings")
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++AC_EGREP_CPP_FOR_BUILD([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow")
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++AC_EGREP_CPP_FOR_BUILD([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144")
++
+ AC_ARG_ENABLE(werror,
+   [  --enable-werror         treat compile warnings as errors],
+   [case "${enableval}" in
+@@ -47,6 +77,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -60,25 +91,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings enable build-time compiler warnings],
+ [case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}" 
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w" 
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac])
+ 
+ if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
+@@ -86,6 +124,7 @@ if test x"$silent" != x"yes" && test x"$
+ fi
+ 
+ AC_SUBST(WARN_CFLAGS)
++AC_SUBST(WARN_CFLAGS_FOR_BUILD)
+ AC_SUBST(NO_WERROR)
+      AC_SUBST(WARN_WRITE_STRINGS)
+ ])
+--- a/binutils/Makefile.am
++++ b/binutils/Makefile.am
+@@ -47,8 +47,10 @@ ZLIB = @zlibdir@ -lz
+ ZLIBINC = @zlibinc@
+ 
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ NO_WERROR = @NO_WERROR@
+ AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
++AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
+ LIBICONV = @LIBICONV@
+ 
+ # these two are almost the same program
+@@ -305,17 +307,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo. at OBJ
+ 	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo. at OBJEXT@ syslex_wrap. at OBJEXT@
+ 
+ syslex_wrap. at OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
+-	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
++	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
+ 
+ sysinfo. at OBJEXT@: sysinfo.c
+ 	if [ -r sysinfo.c ]; then \
+-	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
++	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
+ 	else \
+-	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
++	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
+ 	fi
+ 
+ bin2c$(EXEEXT_FOR_BUILD): bin2c.c
+-	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
++	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
+ 
+ embedspu: embedspu.sh Makefile
+ 	awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
+--- a/binutils/Makefile.in
++++ b/binutils/Makefile.in
+@@ -401,6 +401,7 @@ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
+@@ -478,6 +479,7 @@ am__skipyacc =
+ ZLIB = @zlibdir@ -lz
+ ZLIBINC = @zlibinc@
+ AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
++AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
+ 
+ # these two are almost the same program
+ AR_PROG = ar
+@@ -1370,17 +1372,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo. at OBJ
+ 	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo. at OBJEXT@ syslex_wrap. at OBJEXT@
+ 
+ syslex_wrap. at OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
+-	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
++	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
+ 
+ sysinfo. at OBJEXT@: sysinfo.c
+ 	if [ -r sysinfo.c ]; then \
+-	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
++	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
+ 	else \
+-	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
++	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
+ 	fi
+ 
+ bin2c$(EXEEXT_FOR_BUILD): bin2c.c
+-	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
++	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
+ 
+ embedspu: embedspu.sh Makefile
+ 	awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
+--- a/binutils/configure
++++ b/binutils/configure
+@@ -652,6 +652,7 @@ YFLAGS
+ YACC
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ OTOOL64
+ OTOOL
+@@ -11225,7 +11226,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11228 "configure"
++#line 11229 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11331,7 +11332,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11334 "configure"
++#line 11335 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11945,8 +11946,12 @@ _ACEOF
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -11991,6 +11996,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -12006,6 +12041,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -12019,25 +12055,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -12048,6 +12091,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ 
+--- a/binutils/doc/Makefile.in
++++ b/binutils/doc/Makefile.in
+@@ -249,6 +249,7 @@ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ YACC = @YACC@
+--- a/gas/Makefile.in
++++ b/gas/Makefile.in
+@@ -255,6 +255,7 @@ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
+--- a/gas/configure
++++ b/gas/configure
+@@ -642,6 +642,7 @@ cgen_cpu_prefix
+ GDBINIT
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ OTOOL64
+ OTOOL
+@@ -10985,7 +10986,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 10988 "configure"
++#line 10989 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11091,7 +11092,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11094 "configure"
++#line 11095 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11721,8 +11722,12 @@ using_cgen=no
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -11767,6 +11772,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -11782,6 +11817,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -11795,25 +11831,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -11824,6 +11867,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ 
+--- a/gas/doc/Makefile.in
++++ b/gas/doc/Makefile.in
+@@ -230,6 +230,7 @@ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ YACC = @YACC@
+--- a/gold/Makefile.in
++++ b/gold/Makefile.in
+@@ -87,8 +87,8 @@ subdir = .
+ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
+ 	$(srcdir)/Makefile.am $(top_srcdir)/configure \
+ 	$(am__configure_deps) $(srcdir)/config.in \
+-	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in \
+-	ftruncate.c pread.c mremap.c ffsll.c yyscript.h yyscript.c \
++	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
++	mremap.c ftruncate.c pread.c yyscript.h yyscript.c \
+ 	$(srcdir)/../depcomp $(srcdir)/../ylwrap
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+@@ -409,6 +409,7 @@ TARGETOBJS = @TARGETOBJS@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_CXXFLAGS = @WARN_CXXFLAGS@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+--- a/gold/configure
++++ b/gold/configure
+@@ -609,6 +609,7 @@ GOLD_LDFLAGS
+ WARN_CXXFLAGS
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ IFUNC_STATIC_FALSE
+ IFUNC_STATIC_TRUE
+@@ -6723,8 +6724,12 @@ fi
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -6769,6 +6774,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -6784,6 +6819,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -6797,25 +6833,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -6826,6 +6869,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ 
+--- a/gold/testsuite/Makefile.in
++++ b/gold/testsuite/Makefile.in
+@@ -2568,6 +2568,7 @@ TARGETOBJS = @TARGETOBJS@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_CXXFLAGS = @WARN_CXXFLAGS@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+--- a/gprof/Makefile.in
++++ b/gprof/Makefile.in
+@@ -267,6 +267,7 @@ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ abs_builddir = @abs_builddir@
+--- a/gprof/configure
++++ b/gprof/configure
+@@ -604,6 +604,7 @@ LTLIBOBJS
+ LIBOBJS
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ GENINSRC_NEVER_FALSE
+ GENINSRC_NEVER_TRUE
+@@ -10901,7 +10902,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 10904 "configure"
++#line 10905 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11007,7 +11008,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11010 "configure"
++#line 11011 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -12101,8 +12102,12 @@ fi
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -12147,6 +12152,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -12162,6 +12197,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -12175,25 +12211,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -12204,6 +12247,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ 
+--- a/ld/Makefile.in
++++ b/ld/Makefile.in
+@@ -354,6 +354,7 @@ TESTBFDLIB = @TESTBFDLIB@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
+@@ -508,7 +509,7 @@ CXX_FOR_TARGET = ` \
+   fi`
+ 
+ 
+-# Strip out sanitization options as they require special host libraries.
++# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
+ CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
+ CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
+ info_TEXINFOS = ld.texinfo
+--- a/ld/configure
++++ b/ld/configure
+@@ -646,6 +646,7 @@ LIBINTL
+ USE_NLS
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ installed_linker
+ install_as_default
+@@ -11723,7 +11724,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11726 "configure"
++#line 11727 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11829,7 +11830,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11832 "configure"
++#line 11833 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -15558,8 +15559,12 @@ fi
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -15604,6 +15609,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -15619,6 +15654,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -15632,25 +15668,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -15661,6 +15704,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ 
+--- a/opcodes/Makefile.in
++++ b/opcodes/Makefile.in
+@@ -267,6 +267,7 @@ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
+ WARN_CFLAGS = @WARN_CFLAGS@
++WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
+ WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
+ XGETTEXT = @XGETTEXT@
+ abs_builddir = @abs_builddir@
+--- a/opcodes/configure
++++ b/opcodes/configure
+@@ -643,6 +643,7 @@ MAINTAINER_MODE_TRUE
+ NO_WMISSING_FIELD_INITIALIZERS
+ WARN_WRITE_STRINGS
+ NO_WERROR
++WARN_CFLAGS_FOR_BUILD
+ WARN_CFLAGS
+ OTOOL64
+ OTOOL
+@@ -11150,7 +11151,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11153 "configure"
++#line 11154 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11256,7 +11257,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11259 "configure"
++#line 11260 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11508,8 +11509,12 @@ fi
+ # Set the 'development' global.
+ . $srcdir/../bfd/development.sh
+ 
++# Set acp_cpp_for_build variable
++ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
++
+ # Default set of GCC warnings to enable.
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
++GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ 
+ # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -11554,6 +11559,36 @@ fi
+ rm -f conftest*
+ 
+ 
++# Verify CC_FOR_BUILD to be compatible with waring flags
++
++# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
++fi
++rm -f conftest*
++
++
++# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++__GNUC__
++_ACEOF
++if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
++  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
++
++else
++  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
++fi
++rm -f conftest*
++
++
+ # Check whether --enable-werror was given.
+ if test "${enable_werror+set}" = set; then :
+   enableval=$enable_werror; case "${enableval}" in
+@@ -11569,6 +11604,7 @@ case "${host}" in
+   *-*-mingw32*)
+     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
++      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
+     fi
+     ;;
+   *) ;;
+@@ -11582,25 +11618,32 @@ fi
+ NO_WERROR=
+ if test "${ERROR_ON_WARNING}" = yes ; then
+     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
++    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
+     NO_WERROR="-Wno-error"
+ fi
+ 
+ if test "${GCC}" = yes ; then
+   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
+ fi
+ 
+ # Check whether --enable-build-warnings was given.
+ if test "${enable_build_warnings+set}" = set; then :
+   enableval=$enable_build_warnings; case "${enableval}" in
+-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
++  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
+   no)	if test "${GCC}" = yes ; then
+ 	  WARN_CFLAGS="-w"
++      WARN_CFLAGS_FOR_BUILD="-w"
+ 	fi;;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
++        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
++        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
++        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
++        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
++  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
++        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ fi
+ 
+@@ -11611,6 +11654,7 @@ fi
+ 
+ 
+ 
++
+ 
+ 
+ ac_ext=c


From lede-commits at lists.infradead.org  Wed Apr 12 01:52:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 04:52:07 -0400
Subject: [source] iptables: set ABI_VERSION to force rebuild of dependent
 packages
In-Reply-To: <20170412085206.6086.72467@git-01.infra.lede-project.org>
References: <20170412085206.6086.72467@git-01.infra.lede-project.org>
Message-ID: <mailman.23577.1491987149.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/5e2d15b4a6fc979497b252c617c4b353d6c84fa2

commit 5e2d15b4a6fc979497b252c617c4b353d6c84fa2
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Apr 7 13:20:11 2017 +0200

    iptables: set ABI_VERSION to force rebuild of dependent packages
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/utils/iptables/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index 2fef0ab..ae2377e 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -402,6 +402,7 @@ $(call Package/iptables/Default)
   SECTION:=libs
   CATEGORY:=Libraries
   DEPENDS:=+libip4tc +libip6tc +libxtables
+  ABI_VERSION:=$(PKG_VERSION)
   TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
 endef
 
@@ -410,6 +411,7 @@ $(call Package/iptables/Default)
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=IPv4 firewall - shared libiptc library
+  ABI_VERSION:=$(PKG_VERSION)
   DEPENDS:=+libxtables
 endef
 
@@ -418,6 +420,7 @@ $(call Package/iptables/Default)
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=IPv6 firewall - shared libiptc library
+  ABI_VERSION:=$(PKG_VERSION)
   DEPENDS:=+libxtables
 endef
 
@@ -426,6 +429,7 @@ define Package/libxtables
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=IPv4/IPv6 firewall - shared xtables library
+ ABI_VERSION:=$(PKG_VERSION)
  DEPENDS:= \
 	+IPTABLES_CONNLABEL:libnetfilter-conntrack \
 	+IPTABLES_NFTABLES:libnfnetlink


From lede-commits at lists.infradead.org  Wed Apr 12 01:52:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 04:52:06 -0400
Subject: [source]  iptables: bump to 1.6.1
In-Reply-To: <20170412085206.6086.72467@git-01.infra.lede-project.org>
References: <20170412085206.6086.72467@git-01.infra.lede-project.org>
Message-ID: <mailman.23578.1491987151.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/98e43b13a7f0f747d4625ba0209ba37ae22f3b48

commit 98e43b13a7f0f747d4625ba0209ba37ae22f3b48
Author: Ansuel Smith <ansuelsmth at gmail.com>
AuthorDate: Wed Mar 22 16:02:09 2017 +0100

    iptables: bump to 1.6.1
    
    Switch to git repo
    Removed musl patch
    Refreshed existing patch
    
    Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
    Signed-off-by: Felix Fietkau <nbd at nbd.name> [cleanup]
---
 package/network/utils/iptables/Makefile            |  36 ++++--
 .../patches/020-iptables-disable-modprobe.patch    |   4 +-
 .../iptables/patches/030-no-libnfnetlink.patch     |  94 ---------------
 .../utils/iptables/patches/050-optional-xml.patch  |   2 +-
 .../utils/iptables/patches/100-bash-location.patch |   8 --
 .../patches/200-configurable_builtin.patch         |  45 +++++---
 .../utils/iptables/patches/300-musl_fixes.patch    | 127 ---------------------
 .../utils/iptables/patches/600-shared-libext.patch |  40 ++++---
 .../patches/700-disable-legacy-revisions.patch     |  51 +++------
 9 files changed, 103 insertions(+), 304 deletions(-)

diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index ac869f0..2fef0ab 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -9,17 +9,16 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=iptables
-PKG_VERSION:=1.4.21
-PKG_RELEASE:=2
+PKG_VERSION:=1.6.1
+PKG_RELEASE:=1
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
-	ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
-	ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
-	ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
-PKG_HASH:=52004c68021da9a599feed27f65defcfb22128f7da2c0531c0f75de0f479d3e0
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://git.netfilter.org/iptables
+PKG_SOURCE_VERSION:=7df66f1c13563cfbab75246b009ce36f69ee4487
+PKG_MIRROR_HASH:=22f15ef41fd8e3724bedcee666b7b6a3491d2d038d580ef1fb032718dcb73f14
 
 PKG_FIXUP:=autoreconf
+
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=GPL-2.0
@@ -51,6 +50,20 @@ $(call Package/iptables/Default)
   DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libxtables
 endef
 
+define Package/iptables/config
+  config IPTABLES_CONNLABEL
+	bool "Enable Connlabel support"
+	default n
+	help
+		This enable connlabel support in iptables.
+
+  config IPTABLES_NFTABLES
+	bool "Enable Nftables support"
+	default n
+	help
+		This enable nftables support in iptables.
+endef
+
 define Package/iptables/description
 IP firewall administration tool.
 
@@ -413,6 +426,9 @@ define Package/libxtables
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=IPv4/IPv6 firewall - shared xtables library
+ DEPENDS:= \
+	+IPTABLES_CONNLABEL:libnetfilter-conntrack \
+	+IPTABLES_NFTABLES:libnfnetlink
 endef
 
 TARGET_CPPFLAGS := \
@@ -431,10 +447,12 @@ TARGET_LDFLAGS += \
 
 CONFIGURE_ARGS += \
 	--enable-shared \
+	--enable-static \
 	--enable-devel \
 	--with-kernel="$(LINUX_DIR)/user_headers" \
 	--with-xtlibdir=/usr/lib/iptables \
-	--enable-static \
+	$(if $(CONFIG_IPTABLES_CONNLABEL),,--disable-connlabel) \
+	$(if $(CONFIG_IPTABLES_NFTABLES),,--disable-nftables) \
 	$(if $(CONFIG_IPV6),,--disable-ipv6)
 
 MAKE_FLAGS := \
diff --git a/package/network/utils/iptables/patches/020-iptables-disable-modprobe.patch b/package/network/utils/iptables/patches/020-iptables-disable-modprobe.patch
index 2b6c57e..4add4ea 100644
--- a/package/network/utils/iptables/patches/020-iptables-disable-modprobe.patch
+++ b/package/network/utils/iptables/patches/020-iptables-disable-modprobe.patch
@@ -1,6 +1,6 @@
 --- a/libxtables/xtables.c
 +++ b/libxtables/xtables.c
-@@ -336,6 +336,7 @@ static char *get_modprobe(void)
+@@ -355,6 +355,7 @@ static char *get_modprobe(void)
  
  int xtables_insmod(const char *modname, const char *modprobe, bool quiet)
  {
@@ -8,7 +8,7 @@
  	char *buf = NULL;
  	char *argv[4];
  	int status;
-@@ -380,6 +381,7 @@ int xtables_insmod(const char *modname, 
+@@ -395,6 +396,7 @@ int xtables_insmod(const char *modname,
  	free(buf);
  	if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
  		return 0;
diff --git a/package/network/utils/iptables/patches/030-no-libnfnetlink.patch b/package/network/utils/iptables/patches/030-no-libnfnetlink.patch
deleted file mode 100644
index 50542ac..0000000
--- a/package/network/utils/iptables/patches/030-no-libnfnetlink.patch
+++ /dev/null
@@ -1,94 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -12367,77 +12367,7 @@ fi
- fi
- 
- 
--pkg_failed=no
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnfnetlink" >&5
--$as_echo_n "checking for libnfnetlink... " >&6; }
--
--if test -n "$libnfnetlink_CFLAGS"; then
--    pkg_cv_libnfnetlink_CFLAGS="$libnfnetlink_CFLAGS"
-- elif test -n "$PKG_CONFIG"; then
--    if test -n "$PKG_CONFIG" && \
--    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnfnetlink >= 1.0\""; } >&5
--  ($PKG_CONFIG --exists --print-errors "libnfnetlink >= 1.0") 2>&5
--  ac_status=$?
--  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
--  test $ac_status = 0; }; then
--  pkg_cv_libnfnetlink_CFLAGS=`$PKG_CONFIG --cflags "libnfnetlink >= 1.0" 2>/dev/null`
--		      test "x$?" != "x0" && pkg_failed=yes
--else
--  pkg_failed=yes
--fi
-- else
--    pkg_failed=untried
--fi
--if test -n "$libnfnetlink_LIBS"; then
--    pkg_cv_libnfnetlink_LIBS="$libnfnetlink_LIBS"
-- elif test -n "$PKG_CONFIG"; then
--    if test -n "$PKG_CONFIG" && \
--    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnfnetlink >= 1.0\""; } >&5
--  ($PKG_CONFIG --exists --print-errors "libnfnetlink >= 1.0") 2>&5
--  ac_status=$?
--  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
--  test $ac_status = 0; }; then
--  pkg_cv_libnfnetlink_LIBS=`$PKG_CONFIG --libs "libnfnetlink >= 1.0" 2>/dev/null`
--		      test "x$?" != "x0" && pkg_failed=yes
--else
--  pkg_failed=yes
--fi
-- else
--    pkg_failed=untried
--fi
--
--
--
--if test $pkg_failed = yes; then
--   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--
--if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
--        _pkg_short_errors_supported=yes
--else
--        _pkg_short_errors_supported=no
--fi
--        if test $_pkg_short_errors_supported = yes; then
--	        libnfnetlink_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnfnetlink >= 1.0" 2>&1`
--        else
--	        libnfnetlink_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnfnetlink >= 1.0" 2>&1`
--        fi
--	# Put the nasty error message in config.log where it belongs
--	echo "$libnfnetlink_PKG_ERRORS" >&5
--
--	nfnetlink=0
--elif test $pkg_failed = untried; then
--     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--	nfnetlink=0
--else
--	libnfnetlink_CFLAGS=$pkg_cv_libnfnetlink_CFLAGS
--	libnfnetlink_LIBS=$pkg_cv_libnfnetlink_LIBS
--        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
--$as_echo "yes" >&6; }
--	nfnetlink=1
--fi
-- if test "$nfnetlink" = 1; then
-+if false; then
-   HAVE_LIBNFNETLINK_TRUE=
-   HAVE_LIBNFNETLINK_FALSE='#'
- else
---- a/configure.ac
-+++ b/configure.ac
-@@ -111,9 +111,7 @@ if test "x$enable_bpfc" = "xyes" || test
- 	AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool))
- fi
- 
--PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
--	[nfnetlink=1], [nfnetlink=0])
--AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
-+AM_CONDITIONAL([HAVE_LIBNFNETLINK], [false])
- 
- regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
- 	-Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
diff --git a/package/network/utils/iptables/patches/050-optional-xml.patch b/package/network/utils/iptables/patches/050-optional-xml.patch
index 11311dd..b782bbf 100644
--- a/package/network/utils/iptables/patches/050-optional-xml.patch
+++ b/package/network/utils/iptables/patches/050-optional-xml.patch
@@ -1,6 +1,6 @@
 --- a/iptables/xtables-multi.c
 +++ b/iptables/xtables-multi.c
-@@ -22,8 +22,10 @@ static const struct subcommand multi_sub
+@@ -26,8 +26,10 @@ static const struct subcommand multi_sub
  	{"iptables-restore",    iptables_restore_main},
  	{"restore4",            iptables_restore_main},
  #endif
diff --git a/package/network/utils/iptables/patches/100-bash-location.patch b/package/network/utils/iptables/patches/100-bash-location.patch
deleted file mode 100644
index 02ee45b..0000000
--- a/package/network/utils/iptables/patches/100-bash-location.patch
+++ /dev/null
@@ -1,8 +0,0 @@
---- a/iptables/iptables-apply
-+++ b/iptables/iptables-apply
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/usr/bin/env bash
- #
- # iptables-apply -- a safer way to update iptables remotely
- #
diff --git a/package/network/utils/iptables/patches/200-configurable_builtin.patch b/package/network/utils/iptables/patches/200-configurable_builtin.patch
index d35bc5a..9c53c2b 100644
--- a/package/network/utils/iptables/patches/200-configurable_builtin.patch
+++ b/package/network/utils/iptables/patches/200-configurable_builtin.patch
@@ -1,58 +1,75 @@
 --- a/extensions/GNUmakefile.in
 +++ b/extensions/GNUmakefile.in
-@@ -45,9 +45,24 @@ pfx_symlinks  := NOTRACK state
- pfx_build_mod := $(filter-out @blacklist_modules@,${pfx_build_mod})
- pf4_build_mod := $(filter-out @blacklist_modules@,${pf4_build_mod})
- pf6_build_mod := $(filter-out @blacklist_modules@,${pf6_build_mod})
+@@ -50,11 +50,31 @@ pfb_build_mod := $(filter-out @blacklist
+ pfa_build_mod := $(filter-out @blacklist_modules@ @blacklist_a_modules@,${pfa_build_mod})
+ pf4_build_mod := $(filter-out @blacklist_modules@ @blacklist_4_modules@,${pf4_build_mod})
+ pf6_build_mod := $(filter-out @blacklist_modules@ @blacklist_6_modules@,${pf6_build_mod})
 -pfx_objs      := $(patsubst %,libxt_%.o,${pfx_build_mod})
+-pfb_objs      := $(patsubst %,libebt_%.o,${pfb_build_mod})
+-pfa_objs      := $(patsubst %,libarpt_%.o,${pfa_build_mod})
 -pf4_objs      := $(patsubst %,libipt_%.o,${pf4_build_mod})
 -pf6_objs      := $(patsubst %,libip6t_%.o,${pf6_build_mod})
-+
 +ifdef BUILTIN_MODULES
 +pfx_build_static := $(filter $(BUILTIN_MODULES),${pfx_build_mod})
++pfb_build_static := $(filter $(BUILTIN_MODULES),${pfb_build_mod})
++pfa_build_static := $(filter $(BUILTIN_MODULES),${pfa_build_mod})
 +pf4_build_static := $(filter $(BUILTIN_MODULES),${pf4_build_mod})
 +pf6_build_static := $(filter $(BUILTIN_MODULES),${pf6_build_mod})
 +else
 + at ENABLE_STATIC_TRUE@ pfx_build_static := $(pfx_build_mod)
++ at ENABLE_STATIC_TRUE@ pfb_build_static := $(pfb_build_mod)
++ at ENABLE_STATIC_TRUE@ pfa_build_static := $(pfa_build_mod)
 + at ENABLE_STATIC_TRUE@ pf4_build_static := $(pf4_build_mod)
 + at ENABLE_STATIC_TRUE@ pf6_build_static := $(pf6_build_mod)
 +endif
 +
 +pfx_build_mod := $(filter-out $(pfx_build_static),$(pfx_build_mod))
++pfb_build_mod := $(filter-out $(pfb_build_static),$(pfb_build_mod))
++pfa_build_mod := $(filter-out $(pfa_build_static),$(pfa_build_mod))
 +pf4_build_mod := $(filter-out $(pf4_build_static),$(pf4_build_mod))
 +pf6_build_mod := $(filter-out $(pf6_build_static),$(pf6_build_mod))
 +
 +pfx_objs      := $(patsubst %,libxt_%.o,${pfx_build_static})
++pfb_objs      := $(patsubst %,libebt_%.o,${pfb_build_static})
++pfa_objs      := $(patsubst %,libarpt_%.o,${pfa_build_static})
 +pf4_objs      := $(patsubst %,libipt_%.o,${pf4_build_static})
 +pf6_objs      := $(patsubst %,libip6t_%.o,${pf6_build_static})
  pfx_solibs    := $(patsubst %,libxt_%.so,${pfx_build_mod} ${pfx_symlinks})
- pf4_solibs    := $(patsubst %,libipt_%.so,${pf4_build_mod})
- pf6_solibs    := $(patsubst %,libip6t_%.so,${pf6_build_mod})
-@@ -58,11 +73,11 @@ pf6_solibs    := $(patsubst %,libip6t_%.
+ pfb_solibs    := $(patsubst %,libebt_%.so,${pfb_build_mod})
+ pfa_solibs    := $(patsubst %,libarpt_%.so,${pfa_build_mod})
+@@ -67,13 +87,13 @@ pf6_solibs    := $(patsubst %,libip6t_%.
  #
- targets := libext.a libext4.a libext6.a matches.man targets.man
+ targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man
  targets_install :=
 - at ENABLE_STATIC_TRUE@ libext_objs := ${pfx_objs}
+- at ENABLE_STATIC_TRUE@ libext_ebt_objs := ${pfb_objs}
+- at ENABLE_STATIC_TRUE@ libext_arpt_objs := ${pfa_objs}
 - at ENABLE_STATIC_TRUE@ libext4_objs := ${pf4_objs}
 - at ENABLE_STATIC_TRUE@ libext6_objs := ${pf6_objs}
-- at ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
-- at ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
+- at ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs}
+- at ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs}
 +libext_objs := ${pfx_objs}
++libext_ebt_objs := ${pfb_objs}
++libext_arpt_objs := ${pfa_objs}
 +libext4_objs := ${pf4_objs}
 +libext6_objs := ${pf6_objs}
-+targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
-+targets_install := $(strip ${targets_install} ${pfx_solibs} ${pf4_solibs} ${pf6_solibs})
++targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs}
++targets_install := $(strip ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs})
  
  .SECONDARY:
  
-@@ -126,9 +141,9 @@ libext4.a: initext4.o ${libext4_objs}
+@@ -141,11 +161,11 @@ libext4.a: initext4.o ${libext4_objs}
  libext6.a: initext6.o ${libext6_objs}
  	${AM_VERBOSE_AR} ${AR} crs $@ $^;
  
 -initext_func  := $(addprefix xt_,${pfx_build_mod})
+-initextb_func := $(addprefix ebt_,${pfb_build_mod})
+-initexta_func := $(addprefix arpt_,${pfa_build_mod})
 -initext4_func := $(addprefix ipt_,${pf4_build_mod})
 -initext6_func := $(addprefix ip6t_,${pf6_build_mod})
 +initext_func  := $(addprefix xt_,${pfx_build_static})
++initextb_func := $(addprefix ebt_,${pfb_build_static})
++initexta_func := $(addprefix arpt_,${pfa_build_static})
 +initext4_func := $(addprefix ipt_,${pf4_build_static})
 +initext6_func := $(addprefix ip6t_,${pf6_build_static})
  
diff --git a/package/network/utils/iptables/patches/300-musl_fixes.patch b/package/network/utils/iptables/patches/300-musl_fixes.patch
deleted file mode 100644
index a78eda7..0000000
--- a/package/network/utils/iptables/patches/300-musl_fixes.patch
+++ /dev/null
@@ -1,127 +0,0 @@
---- a/extensions/libip6t_ipv6header.c
-+++ b/extensions/libip6t_ipv6header.c
-@@ -10,6 +10,9 @@ on whether they contain certain headers 
- #include <netdb.h>
- #include <xtables.h>
- #include <linux/netfilter_ipv6/ip6t_ipv6header.h>
-+#ifndef IPPROTO_HOPOPTS
-+#	define IPPROTO_HOPOPTS 0
-+#endif
- 
- enum {
- 	O_HEADER = 0,
---- a/extensions/libxt_TCPOPTSTRIP.c
-+++ b/extensions/libxt_TCPOPTSTRIP.c
-@@ -12,6 +12,21 @@
- #ifndef TCPOPT_MD5SIG
- #	define TCPOPT_MD5SIG 19
- #endif
-+#ifndef TCPOPT_MAXSEG
-+#	define TCPOPT_MAXSEG 2
-+#endif
-+#ifndef TCPOPT_WINDOW
-+#	define TCPOPT_WINDOW 3
-+#endif
-+#ifndef TCPOPT_SACK_PERMITTED
-+#	define TCPOPT_SACK_PERMITTED 4
-+#endif
-+#ifndef TCPOPT_SACK
-+#	define TCPOPT_SACK 5
-+#endif
-+#ifndef TCPOPT_TIMESTAMP
-+#	define TCPOPT_TIMESTAMP 8
-+#endif
- 
- enum {
- 	O_STRIP_OPTION = 0,
---- a/include/libiptc/ipt_kernel_headers.h
-+++ b/include/libiptc/ipt_kernel_headers.h
-@@ -5,7 +5,6 @@
- 
- #include <limits.h>
- 
--#if defined(__GLIBC__) && __GLIBC__ == 2
- #include <netinet/ip.h>
- #include <netinet/in.h>
- #include <netinet/ip_icmp.h>
-@@ -13,15 +12,4 @@
- #include <netinet/udp.h>
- #include <net/if.h>
- #include <sys/types.h>
--#else /* libc5 */
--#include <sys/socket.h>
--#include <linux/ip.h>
--#include <linux/in.h>
--#include <linux/if.h>
--#include <linux/icmp.h>
--#include <linux/tcp.h>
--#include <linux/udp.h>
--#include <linux/types.h>
--#include <linux/in6.h>
--#endif
- #endif
---- a/include/linux/netfilter_ipv4/ip_tables.h
-+++ b/include/linux/netfilter_ipv4/ip_tables.h
-@@ -16,6 +16,7 @@
- #define _IPTABLES_H
- 
- #include <linux/types.h>
-+#include <sys/types.h>
- 
- #include <linux/netfilter_ipv4.h>
- 
---- a/iptables/ip6tables-restore.c
-+++ b/iptables/ip6tables-restore.c
-@@ -9,7 +9,7 @@
-  */
- 
- #include <getopt.h>
--#include <sys/errno.h>
-+#include <errno.h>
- #include <stdbool.h>
- #include <string.h>
- #include <stdio.h>
---- a/iptables/ip6tables-save.c
-+++ b/iptables/ip6tables-save.c
-@@ -6,7 +6,7 @@
-  * This code is distributed under the terms of GNU GPL v2
-  */
- #include <getopt.h>
--#include <sys/errno.h>
-+#include <errno.h>
- #include <stdio.h>
- #include <fcntl.h>
- #include <stdlib.h>
---- a/iptables/iptables-restore.c
-+++ b/iptables/iptables-restore.c
-@@ -6,7 +6,7 @@
-  */
- 
- #include <getopt.h>
--#include <sys/errno.h>
-+#include <errno.h>
- #include <stdbool.h>
- #include <string.h>
- #include <stdio.h>
---- a/iptables/iptables-save.c
-+++ b/iptables/iptables-save.c
-@@ -6,7 +6,7 @@
-  *
-  */
- #include <getopt.h>
--#include <sys/errno.h>
-+#include <errno.h>
- #include <stdio.h>
- #include <fcntl.h>
- #include <stdlib.h>
---- a/iptables/iptables-xml.c
-+++ b/iptables/iptables-xml.c
-@@ -7,7 +7,7 @@
-  */
- 
- #include <getopt.h>
--#include <sys/errno.h>
-+#include <errno.h>
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
diff --git a/package/network/utils/iptables/patches/600-shared-libext.patch b/package/network/utils/iptables/patches/600-shared-libext.patch
index 92f5485..2071ebd 100644
--- a/package/network/utils/iptables/patches/600-shared-libext.patch
+++ b/package/network/utils/iptables/patches/600-shared-libext.patch
@@ -1,17 +1,15 @@
-Index: iptables-1.4.21/extensions/GNUmakefile.in
-===================================================================
---- iptables-1.4.21.orig/extensions/GNUmakefile.in
-+++ iptables-1.4.21/extensions/GNUmakefile.in
-@@ -71,7 +71,7 @@ pf6_solibs    := $(patsubst %,libip6t_%.
+--- a/extensions/GNUmakefile.in
++++ b/extensions/GNUmakefile.in
+@@ -85,7 +85,7 @@ pf6_solibs    := $(patsubst %,libip6t_%.
  #
  # Building blocks
  #
--targets := libext.a libext4.a libext6.a matches.man targets.man
-+targets := libiptext.so libiptext4.so libiptext6.so matches.man targets.man
+-targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man
++targets := libiptext.so libiptext4.so libiptext6.so libiptext_ebt.so libiptext_arpt.so matches.man targets.man
  targets_install :=
  libext_objs := ${pfx_objs}
- libext4_objs := ${pf4_objs}
-@@ -96,7 +96,7 @@ clean:
+ libext_ebt_objs := ${pfb_objs}
+@@ -112,7 +112,7 @@ clean:
  distclean: clean
  
  init%.o: init%.c
@@ -20,7 +18,7 @@ Index: iptables-1.4.21/extensions/GNUmakefile.in
  
  -include .*.d
  
-@@ -130,16 +130,16 @@ xt_statistic_LIBADD = -lm
+@@ -144,22 +144,22 @@ xt_connlabel_LIBADD = @libnetfilter_conn
  #	handling code in the Makefiles.
  #
  lib%.o: ${srcdir}/lib%.c
@@ -32,6 +30,16 @@ Index: iptables-1.4.21/extensions/GNUmakefile.in
 +libiptext.so: initext.o ${libext_objs}
 +	${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
  
+-libext_ebt.a: initextb.o ${libext_ebt_objs}
+-	${AM_VERBOSE_AR} ${AR} crs $@ $^;
++libiptext_ebt.so: initextb.o ${libext_ebt__objs}
++	${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
+ 
+-libext_arpt.a: initexta.o ${libext_arpt_objs}
+-	${AM_VERBOSE_AR} ${AR} crs $@ $^;
++libiptext_arpt.so: initexta.o ${libext_arpt__objs}
++	${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
+ 
 -libext4.a: initext4.o ${libext4_objs}
 -	${AM_VERBOSE_AR} ${AR} crs $@ $^;
 +libiptext4.so: initext4.o ${libext4_objs}
@@ -43,12 +51,10 @@ Index: iptables-1.4.21/extensions/GNUmakefile.in
 +	${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
  
  initext_func  := $(addprefix xt_,${pfx_build_static})
- initext4_func := $(addprefix ipt_,${pf4_build_static})
-Index: iptables-1.4.21/iptables/Makefile.am
-===================================================================
---- iptables-1.4.21.orig/iptables/Makefile.am
-+++ iptables-1.4.21/iptables/Makefile.am
-@@ -5,7 +5,8 @@ AM_CPPFLAGS      = ${regular_CPPFLAGS} -
+ initextb_func := $(addprefix ebt_,${pfb_build_static})
+--- a/iptables/Makefile.am
++++ b/iptables/Makefile.am
+@@ -8,7 +8,8 @@ BUILT_SOURCES =
  
  xtables_multi_SOURCES  = xtables-multi.c iptables-xml.c
  xtables_multi_CFLAGS   = ${AM_CFLAGS}
@@ -58,7 +64,7 @@ Index: iptables-1.4.21/iptables/Makefile.am
  if ENABLE_STATIC
  xtables_multi_CFLAGS  += -DALL_INCLUSIVE
  endif
-@@ -13,13 +14,15 @@ if ENABLE_IPV4
+@@ -16,13 +17,15 @@ if ENABLE_IPV4
  xtables_multi_SOURCES += iptables-save.c iptables-restore.c \
                           iptables-standalone.c iptables.c
  xtables_multi_CFLAGS  += -DENABLE_IPV4
diff --git a/package/network/utils/iptables/patches/700-disable-legacy-revisions.patch b/package/network/utils/iptables/patches/700-disable-legacy-revisions.patch
index 342c3b0..6800ca5 100644
--- a/package/network/utils/iptables/patches/700-disable-legacy-revisions.patch
+++ b/package/network/utils/iptables/patches/700-disable-legacy-revisions.patch
@@ -1,8 +1,6 @@
-Index: iptables-1.4.21/extensions/libxt_conntrack.c
-===================================================================
---- iptables-1.4.21.orig/extensions/libxt_conntrack.c
-+++ iptables-1.4.21/extensions/libxt_conntrack.c
-@@ -1157,6 +1157,7 @@ static void state_save(const void *ip, c
+--- a/extensions/libxt_conntrack.c
++++ b/extensions/libxt_conntrack.c
+@@ -1397,6 +1397,7 @@ static int conntrack3_mt6_xlate(struct x
  }
  
  static struct xtables_match conntrack_mt_reg[] = {
@@ -10,7 +8,7 @@ Index: iptables-1.4.21/extensions/libxt_conntrack.c
  	{
  		.version       = XTABLES_VERSION,
  		.name          = "conntrack",
-@@ -1232,6 +1233,7 @@ static struct xtables_match conntrack_mt
+@@ -1472,6 +1473,7 @@ static struct xtables_match conntrack_mt
  		.alias	       = conntrack_print_name_alias,
  		.x6_options    = conntrack2_mt_opts,
  	},
@@ -18,31 +16,24 @@ Index: iptables-1.4.21/extensions/libxt_conntrack.c
  	{
  		.version       = XTABLES_VERSION,
  		.name          = "conntrack",
-@@ -1262,6 +1264,7 @@ static struct xtables_match conntrack_mt
- 		.alias	       = conntrack_print_name_alias,
+@@ -1504,6 +1506,7 @@ static struct xtables_match conntrack_mt
  		.x6_options    = conntrack3_mt_opts,
+ 		.xlate	       = conntrack3_mt6_xlate,
  	},
 +#ifndef NO_LEGACY
  	{
  		.family        = NFPROTO_UNSPEC,
  		.name          = "state",
-@@ -1292,6 +1295,7 @@ static struct xtables_match conntrack_mt
+@@ -1534,6 +1537,8 @@ static struct xtables_match conntrack_mt
  		.x6_parse      = state_ct23_parse,
  		.x6_options    = state_opts,
  	},
 +#endif
- 	{
- 		.family        = NFPROTO_UNSPEC,
- 		.name          = "state",
-@@ -1307,6 +1311,7 @@ static struct xtables_match conntrack_mt
- 		.x6_parse      = state_ct23_parse,
- 		.x6_options    = state_opts,
- 	},
 +#ifndef NO_LEGACY
  	{
  		.family        = NFPROTO_UNSPEC,
  		.name          = "state",
-@@ -1320,6 +1325,7 @@ static struct xtables_match conntrack_mt
+@@ -1563,6 +1568,7 @@ static struct xtables_match conntrack_mt
  		.x6_parse      = state_parse,
  		.x6_options    = state_opts,
  	},
@@ -50,11 +41,9 @@ Index: iptables-1.4.21/extensions/libxt_conntrack.c
  };
  
  void _init(void)
-Index: iptables-1.4.21/extensions/libxt_CT.c
-===================================================================
---- iptables-1.4.21.orig/extensions/libxt_CT.c
-+++ iptables-1.4.21/extensions/libxt_CT.c
-@@ -290,6 +290,7 @@ static void notrack_ct2_tg_init(struct x
+--- a/extensions/libxt_CT.c
++++ b/extensions/libxt_CT.c
+@@ -349,6 +349,7 @@ static void notrack_ct2_tg_init(struct x
  }
  
  static struct xtables_target ct_target_reg[] = {
@@ -62,7 +51,7 @@ Index: iptables-1.4.21/extensions/libxt_CT.c
  	{
  		.family		= NFPROTO_UNSPEC,
  		.name		= "CT",
-@@ -315,6 +316,7 @@ static struct xtables_target ct_target_r
+@@ -374,6 +375,7 @@ static struct xtables_target ct_target_r
  		.x6_parse	= ct_parse_v1,
  		.x6_options	= ct_opts_v1,
  	},
@@ -70,7 +59,7 @@ Index: iptables-1.4.21/extensions/libxt_CT.c
  	{
  		.family		= NFPROTO_UNSPEC,
  		.name		= "CT",
-@@ -329,6 +331,7 @@ static struct xtables_target ct_target_r
+@@ -388,6 +390,7 @@ static struct xtables_target ct_target_r
  		.x6_parse	= ct_parse_v1,
  		.x6_options	= ct_opts_v1,
  	},
@@ -78,7 +67,7 @@ Index: iptables-1.4.21/extensions/libxt_CT.c
  	{
  		.family        = NFPROTO_UNSPEC,
  		.name          = "NOTRACK",
-@@ -366,6 +369,7 @@ static struct xtables_target ct_target_r
+@@ -425,6 +428,7 @@ static struct xtables_target ct_target_r
  		.revision      = 0,
  		.version       = XTABLES_VERSION,
  	},
@@ -86,11 +75,9 @@ Index: iptables-1.4.21/extensions/libxt_CT.c
  };
  
  void _init(void)
-Index: iptables-1.4.21/extensions/libxt_multiport.c
-===================================================================
---- iptables-1.4.21.orig/extensions/libxt_multiport.c
-+++ iptables-1.4.21/extensions/libxt_multiport.c
-@@ -469,6 +469,7 @@ static void multiport_save6_v1(const voi
+--- a/extensions/libxt_multiport.c
++++ b/extensions/libxt_multiport.c
+@@ -571,6 +571,7 @@ static int multiport_xlate6_v1(struct xt
  }
  
  static struct xtables_match multiport_mt_reg[] = {
@@ -98,9 +85,9 @@ Index: iptables-1.4.21/extensions/libxt_multiport.c
  	{
  		.family        = NFPROTO_IPV4,
  		.name          = "multiport",
-@@ -497,6 +498,7 @@ static struct xtables_match multiport_mt
- 		.save          = multiport_save6,
+@@ -601,6 +602,7 @@ static struct xtables_match multiport_mt
  		.x6_options    = multiport_opts,
+ 		.xlate         = multiport_xlate6,
  	},
 +#endif
  	{


From lede-commits at lists.infradead.org  Wed Apr 12 01:58:05 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 04:58:05 -0400
Subject: [source]  mac80211: conistent wireless.wiki.kernel.org
In-Reply-To: <20170412085803.8287.59076@git-01.infra.lede-project.org>
References: <20170412085803.8287.59076@git-01.infra.lede-project.org>
Message-ID: <mailman.23581.1491987509.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/796629207b3326ba8939eb2bd84012e82e71f76d

commit 796629207b3326ba8939eb2bd84012e82e71f76d
Author: Matthias Fritzsche <txt.file at txtfile.eu>
AuthorDate: Thu Apr 6 00:14:17 2017 +0200

    mac80211: conistent wireless.wiki.kernel.org
    
    Change all the URLs to wireless.wiki.kernel.org to have
    the same protocol, domain and path.
    
    Signed-off-by: Matthias Fritzsche <txt.file at txtfile.eu>
---
 package/kernel/mac80211/Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 679ea18..545ecdd 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -276,7 +276,7 @@ endef
 define KernelPackage/ath10k
   $(call KernelPackage/mac80211/Default)
   TITLE:=Atheros 802.11ac wireless cards support
-  URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k
   DEPENDS+= @PCI_SUPPORT +kmod-ath + at DRIVER_11N_SUPPORT + at DRIVER_11AC_SUPPORT + at DRIVER_11W_SUPPORT + at KERNEL_RELAY
   FILES:= \
 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
@@ -1040,7 +1040,7 @@ endef
 define KernelPackage/mwl8k
   $(call KernelPackage/mac80211/Default)
   TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
-  URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwl8k
   DEPENDS+= @PCI_SUPPORT +kmod-mac80211 + at DRIVER_11N_SUPPORT +mwl8k-firmware
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwl8k.ko
   AUTOLOAD:=$(call AutoProbe,mwl8k)
@@ -1054,7 +1054,7 @@ endef
 define KernelPackage/mwifiex-pcie
   $(call KernelPackage/mac80211/Default)
   TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
-  URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex
   DEPENDS+= @PCI_SUPPORT +kmod-mac80211 + at DRIVER_11N_SUPPORT + at DRIVER_11AC_SUPPORT +mwifiex-pcie-firmware
   FILES:= \
 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \
@@ -1069,7 +1069,7 @@ endef
 define KernelPackage/mwifiex-sdio
   $(call KernelPackage/mac80211/Default)
   TITLE:=Driver for Marvell 802.11n/802.11ac SDIO Wireless cards
-  URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex
   DEPENDS+= +kmod-mmc +kmod-mac80211 + at DRIVER_11N_SUPPORT + at DRIVER_11AC_SUPPORT +mwifiex-sdio-firmware
   FILES:= \
 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \
@@ -1266,7 +1266,7 @@ endef
 define KernelPackage/rtl818x/Default
   $(call KernelPackage/mac80211/Default)
   TITLE:=Realtek Drivers for RTL818x devices
-  URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/rtl8187
   DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
 endef
 
@@ -1412,7 +1412,7 @@ endef
 define KernelPackage/wl12xx
   $(call KernelPackage/mac80211/Default)
   TITLE:=Driver for TI WL12xx
-  URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/wl12xx
   DEPENDS+= +kmod-wlcore +wl12xx-firmware
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
   AUTOLOAD:=$(call AutoProbe,wl12xx)
@@ -1425,7 +1425,7 @@ endef
 define KernelPackage/wl18xx
   $(call KernelPackage/mac80211/Default)
   TITLE:=Driver for TI WL18xx
-  URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
+  URL:=https://wireless.wiki.kernel.org/en/users/drivers/wl18xx
   DEPENDS+= +kmod-wlcore +wl18xx-firmware
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
   AUTOLOAD:=$(call AutoProbe,wl18xx)


From lede-commits at lists.infradead.org  Wed Apr 12 02:25:02 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 05:25:02 -0400
Subject: [source]  grub2: update to 2.02~rc2
In-Reply-To: <20170412092502.14994.56597@git-01.infra.lede-project.org>
References: <20170412092502.14994.56597@git-01.infra.lede-project.org>
Message-ID: <mailman.23586.1491989128.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/ffd055d5bbc1a223c80eb5bbc03a6465d0ac0bb4

commit ffd055d5bbc1a223c80eb5bbc03a6465d0ac0bb4
Author: Alif M. Ahmad <alive4ever at live.com>
AuthorDate: Wed Mar 22 21:29:12 2017 +0700

    grub2: update to 2.02~rc2
    
    Update to version 2.02~rc2.
    
    Signed-off-by: Alif M. Ahmad <alive4ever at live.com>
---
 package/boot/grub2/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile
index fde4b12..ca65b93 100644
--- a/package/boot/grub2/Makefile
+++ b/package/boot/grub2/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=grub
-PKG_VERSION:=2.02~rc1
+PKG_VERSION:=2.02~rc2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@@ -17,7 +17,7 @@ PKG_SOURCE_URL:=http://alpha.gnu.org/gnu/grub \
 	http://gnualpha.uib.no/grub/ \
 	http://mirrors.fe.up.pt/pub/gnu-alpha/grub/ \
 	http://www.nic.funet.fi/pub/gnu/alpha/gnu/grub/
-PKG_HASH:=445239e9b96d1143c194c1d37851cf4196b83701c60172e49665e9d453d80278
+PKG_HASH:=053bfcbe366733e4f5a1baf4eb15e1efd977225bdd323b78087ce5fa172fc246
 
 PKG_FIXUP:=autoreconf
 HOST_BUILD_PARALLEL:=1


From lede-commits at lists.infradead.org  Wed Apr 12 03:14:08 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 06:14:08 -0400
Subject: [source]  cns3xxx: refresh kernel config
In-Reply-To: <20170412101407.32350.36544@git-01.infra.lede-project.org>
References: <20170412101407.32350.36544@git-01.infra.lede-project.org>
Message-ID: <mailman.23598.1491992072.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/6f8a552796cb53dc232b66ada8d6b91fa8ce0ef9

commit 6f8a552796cb53dc232b66ada8d6b91fa8ce0ef9
Author: Koen Vandeputte <koen.vandeputte at ncentric.com>
AuthorDate: Wed Apr 12 11:10:58 2017 +0200

    cns3xxx: refresh kernel config
    
    Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
---
 target/linux/cns3xxx/config-4.9 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/linux/cns3xxx/config-4.9 b/target/linux/cns3xxx/config-4.9
index c8c029b..8ae9714 100644
--- a/target/linux/cns3xxx/config-4.9
+++ b/target/linux/cns3xxx/config-4.9
@@ -170,7 +170,6 @@ CONFIG_IRQ_DOMAIN_HIERARCHY=y
 CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_WORK=y
 CONFIG_LEDS_GPIO=y
-# CONFIG_LEDS_TRIGGER_MTD is not set
 # CONFIG_LEDS_TRIGGER_NETDEV is not set
 CONFIG_LIBFDT=y
 CONFIG_LOCK_SPIN_ON_OWNER=y


From lede-commits at lists.infradead.org  Wed Apr 12 03:14:10 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 06:14:10 -0400
Subject: [source]  cns3xxx: enable mpcore watchdog
In-Reply-To: <20170412101407.32350.36544@git-01.infra.lede-project.org>
References: <20170412101407.32350.36544@git-01.infra.lede-project.org>
Message-ID: <mailman.23599.1491992073.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/06997d2635f57ef455601e77301f7ab3320bc7a4

commit 06997d2635f57ef455601e77301f7ab3320bc7a4
Author: Koen Vandeputte <koen.vandeputte at ncentric.com>
AuthorDate: Wed Apr 12 11:11:00 2017 +0200

    cns3xxx: enable mpcore watchdog
    
    Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
---
 target/linux/cns3xxx/config-4.9 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/cns3xxx/config-4.9 b/target/linux/cns3xxx/config-4.9
index 8ae9714..2fec4f0 100644
--- a/target/linux/cns3xxx/config-4.9
+++ b/target/linux/cns3xxx/config-4.9
@@ -189,7 +189,7 @@ CONFIG_MMC_SDHCI_CNS3XXX=y
 CONFIG_MMC_SDHCI_PLTFM=y
 # CONFIG_MMC_TIFM_SD is not set
 CONFIG_MODULES_USE_ELF_REL=y
-# CONFIG_MPCORE_WATCHDOG is not set
+CONFIG_MPCORE_WATCHDOG=y
 CONFIG_MTD_M25P80=y
 # CONFIG_MTD_OF_PARTS is not set
 CONFIG_MTD_PHYSMAP=y


From lede-commits at lists.infradead.org  Wed Apr 12 03:14:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 06:14:09 -0400
Subject: [source]  cns3xxx: fix mpcore watchdog
In-Reply-To: <20170412101407.32350.36544@git-01.infra.lede-project.org>
References: <20170412101407.32350.36544@git-01.infra.lede-project.org>
Message-ID: <mailman.23600.1491992075.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/84acff2865660d361283eaa4d995913c955d826b

commit 84acff2865660d361283eaa4d995913c955d826b
Author: Koen Vandeputte <koen.vandeputte at ncentric.com>
AuthorDate: Wed Apr 12 11:10:59 2017 +0200

    cns3xxx: fix mpcore watchdog
    
    The original implementation loaded the count register with (wrong) semi-
    random values due to its implemenation nature.
    
    If the wrongly calulated value was below the kickrate,
    the WD was triggered and rebooted the system.
    
    Rework this, partly based on upstream patches, to dynamically fetch the
    current clockrate and calculate the proper offset for the WD countdown
    register.
    
    Before:
    
    [  143.800000] count val: 27219720
    [  148.820000] count val: 50623201
    [  153.830000] count val: 96425250
    [  158.830000] count val: 89735401
    [  163.840000] count val: 4756110
    
    After:
    
    [    0.700000] MPCore WD init. clockrate: 299984500 prescaler: 256
    countrate: 1171814 timeout: 60s
    [  358.530000] count val: 35154751
    [  363.540000] count val: 35154750
    [  368.540000] count val: 35154751
    [  373.550000] count val: 35154750
    
    Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
---
 .../cns3xxx/patches-4.9/020-watchdog_support.patch | 45 +++++++++++++++++++---
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/target/linux/cns3xxx/patches-4.9/020-watchdog_support.patch b/target/linux/cns3xxx/patches-4.9/020-watchdog_support.patch
index 8707bf9..4f9f3e6 100644
--- a/target/linux/cns3xxx/patches-4.9/020-watchdog_support.patch
+++ b/target/linux/cns3xxx/patches-4.9/020-watchdog_support.patch
@@ -30,13 +30,14 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  obj-$(CONFIG_SAMA5D4_WATCHDOG) += sama5d4_wdt.o
 --- /dev/null
 +++ b/drivers/watchdog/mpcore_wdt.c
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,118 @@
 +/*
 + * Watchdog driver for ARM MPcore
 + *
 + * Copyright (C) 2017 Felix Fietkau <nbd at nbd.name>
 + */
 +
++#include <linux/export.h>
 +#include <linux/module.h>
 +#include <linux/kernel.h>
 +#include <linux/watchdog.h>
@@ -52,10 +53,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +	static int perturb;
 +	u32 count;
 +
-+	count = ioread32(wdt_base + TWD_WDOG_COUNTER);
-+	count = (~0U - count) * HZ / 5;
-+	count /= 256; /* prescale */
-+	count *= wdt_timeout;
++	count = (twd_timer_get_rate() / 256) * wdt_timeout;
 +
 +	/* Reload register needs a different value on each refresh */
 +	count += perturb;
@@ -118,6 +116,9 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +static int mpcore_wdt_probe(struct platform_device *pdev)
 +{
 +	struct resource *res;
++	unsigned long rate = twd_timer_get_rate();
++
++	pr_info("MPCore WD init. clockrate: %u prescaler: %u countrate: %u timeout: %us\n", rate, 256, rate / 256, wdt_timeout);
 +
 +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +	if (!res)
@@ -148,3 +149,37 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +module_platform_driver(mpcore_wdt_driver);
 +MODULE_AUTHOR("Felix Fietkau <nbd at nbd.name>");
 +MODULE_LICENSE("GPL");
+--- a/arch/arm/include/asm/smp_twd.h
++++ b/arch/arm/include/asm/smp_twd.h
+@@ -33,5 +33,6 @@ struct twd_local_timer name __initdata =
+ };
+ 
+ int twd_local_timer_register(struct twd_local_timer *);
++unsigned long twd_timer_get_rate(void);
+ 
+ #endif
+--- a/arch/arm/kernel/smp_twd.c
++++ b/arch/arm/kernel/smp_twd.c
+@@ -15,6 +15,7 @@
+ #include <linux/delay.h>
+ #include <linux/device.h>
+ #include <linux/err.h>
++#include <linux/export.h>
+ #include <linux/smp.h>
+ #include <linux/jiffies.h>
+ #include <linux/clockchips.h>
+@@ -380,6 +381,14 @@ int __init twd_local_timer_register(stru
+ 	return twd_local_timer_common_register(NULL);
+ }
+ 
++/* Needed by mpcore_wdt */
++unsigned long twd_timer_get_rate(void)
++{
++	return twd_timer_rate;
++}
++EXPORT_SYMBOL_GPL(twd_timer_get_rate);
++
++
+ #ifdef CONFIG_OF
+ static int __init twd_local_timer_of_register(struct device_node *np)
+ {


From lede-commits at lists.infradead.org  Wed Apr 12 03:14:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 06:14:07 -0400
Subject: [source]  cns3xxx: remove linux 4.4 support
In-Reply-To: <20170412101407.32350.36544@git-01.infra.lede-project.org>
References: <20170412101407.32350.36544@git-01.infra.lede-project.org>
Message-ID: <mailman.23601.1491992076.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/2611f67423a2be18f6fe825e6aef3f1cc956eb65

commit 2611f67423a2be18f6fe825e6aef3f1cc956eb65
Author: Koen Vandeputte <koen.vandeputte at ncentric.com>
AuthorDate: Wed Feb 8 09:44:14 2017 +0100

    cns3xxx: remove linux 4.4 support
    
    Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
---
 target/linux/cns3xxx/config-4.4                    | 291 ---------------------
 .../patches-4.4/000-cns3xxx_arch_include.patch     |   8 -
 .../patches-4.4/001-arm_openwrt_machtypes.patch    |   7 -
 .../010-arm_introduce-dma-fiq-irq-broadcast.patch  |  80 ------
 .../cns3xxx/patches-4.4/020-watchdog_support.patch |  59 -----
 .../cns3xxx/patches-4.4/025-smp_support.patch      |  30 ---
 .../linux/cns3xxx/patches-4.4/030-pcie_clock.patch |  11 -
 .../cns3xxx/patches-4.4/040-fiq_support.patch      |  40 ---
 .../linux/cns3xxx/patches-4.4/045-twd_base.patch   |  43 ---
 target/linux/cns3xxx/patches-4.4/055-pcie_io.patch |  19 --
 .../linux/cns3xxx/patches-4.4/060-pcie_abort.patch | 109 --------
 .../patches-4.4/065-pcie_skip_inactive.patch       |  11 -
 .../cns3xxx/patches-4.4/070-i2c_support.patch      |  31 ---
 .../cns3xxx/patches-4.4/075-spi_support.patch      |  51 ----
 .../cns3xxx/patches-4.4/080-sata_support.patch     |  26 --
 target/linux/cns3xxx/patches-4.4/090-timers.patch  | 103 --------
 .../cns3xxx/patches-4.4/095-gpio_support.patch     |  67 -----
 .../patches-4.4/097-l2x0_cmdline_disable.patch     |  69 -----
 .../cns3xxx/patches-4.4/100-laguna_support.patch   |  46 ----
 .../patches-4.4/101-laguna_sdhci_card_detect.patch |  14 -
 .../patches-4.4/110-pci_isolated_interrupts.patch  |  95 -------
 ...ER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch |  23 --
 .../patches-4.4/200-broadcom_phy_reinit.patch      |  14 -
 .../cns3xxx/patches-4.4/210-dwc2_defaults.patch    |  47 ----
 24 files changed, 1294 deletions(-)

diff --git a/target/linux/cns3xxx/config-4.4 b/target/linux/cns3xxx/config-4.4
deleted file mode 100644
index 4745f4e..0000000
--- a/target/linux/cns3xxx/config-4.4
+++ /dev/null
@@ -1,291 +0,0 @@
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_CNS3XXX=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_TICK_BROADCAST=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MULTIPLATFORM=y
-# CONFIG_ARCH_MULTI_CPU_AUTO is not set
-CONFIG_ARCH_MULTI_V6=y
-CONFIG_ARCH_MULTI_V6_V7=y
-CONFIG_ARCH_NR_GPIO=0
-# CONFIG_ARCH_OMAP2 is not set
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-# CONFIG_ARCH_WM8750 is not set
-CONFIG_ARM=y
-# CONFIG_ARM_CPU_SUSPEND is not set
-CONFIG_ARM_GIC=y
-CONFIG_ARM_HAS_SG_CHAIN=y
-CONFIG_ARM_HEAVY_MB=y
-CONFIG_ARM_L1_CACHE_SHIFT=5
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-CONFIG_ARM_THUMB=y
-CONFIG_ATA=y
-CONFIG_ATAGS=y
-# CONFIG_ATA_SFF is not set
-CONFIG_ATA_VERBOSE_ERROR=y
-CONFIG_AUTO_ZRELADDR=y
-CONFIG_BCM_NET_PHYLIB=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_BROADCOM_PHY=y
-CONFIG_CACHE_L2X0=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_OF=y
-CONFIG_CLKSRC_PROBE=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyS0,115200"
-CONFIG_CMDLINE_FORCE=y
-CONFIG_CNS3XXX_ETH=y
-CONFIG_COMMON_CLK=y
-CONFIG_CPU_32v6=y
-CONFIG_CPU_32v6K=y
-CONFIG_CPU_ABRT_EV6=y
-# CONFIG_CPU_BPREDICT_DISABLE is not set
-CONFIG_CPU_CACHE_V6=y
-CONFIG_CPU_CACHE_VIPT=y
-CONFIG_CPU_COPY_V6=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_HAS_ASID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_PABRT_V6=y
-CONFIG_CPU_RMAP=y
-# CONFIG_CPU_SW_DOMAIN_PAN is not set
-CONFIG_CPU_TLB_V6=y
-CONFIG_CPU_V6K=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_DCACHE_WORD_ACCESS=y
-CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_UART_8250 is not set
-# CONFIG_DEBUG_USER is not set
-CONFIG_DMA_CACHE_FIQ_BROADCAST=y
-CONFIG_DTC=y
-CONFIG_EDAC_ATOMIC_SCRUB=y
-CONFIG_EDAC_SUPPORT=y
-CONFIG_EEPROM_AT24=y
-CONFIG_FIQ=y
-CONFIG_FIX_EARLYCON_MEM=y
-CONFIG_FRAME_POINTER=y
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GLOB=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIOLIB_IRQCHIP=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_PCA953X=y
-CONFIG_GPIO_PCA953X_IRQ=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-# CONFIG_HAVE_ARCH_BITREVERSE is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-CONFIG_HAVE_ARM_SCU=y
-CONFIG_HAVE_ARM_TWD=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_OPTPROBES=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SMP=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HWMON=y
-CONFIG_HZ_FIXED=0
-CONFIG_HZ_PERIODIC=y
-CONFIG_I2C=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_CNS3XXX=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IOMMU_HELPER=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_DOMAIN_HIERARCHY=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_LEDS_GPIO=y
-# CONFIG_LEDS_TRIGGER_NETDEV is not set
-CONFIG_LIBFDT=y
-CONFIG_LOCK_SPIN_ON_OWNER=y
-# CONFIG_MACH_CNS3420VB is not set
-CONFIG_MACH_GW2388=y
-CONFIG_MDIO_BOARDINFO=y
-CONFIG_MIGHT_HAVE_CACHE_L2X0=y
-CONFIG_MIGHT_HAVE_PCI=y
-CONFIG_MMC=y
-CONFIG_MMC_BLOCK=y
-CONFIG_MMC_SDHCI=y
-CONFIG_MMC_SDHCI_CNS3XXX=y
-# CONFIG_MMC_SDHCI_PCI is not set
-CONFIG_MMC_SDHCI_PLTFM=y
-# CONFIG_MMC_TIFM_SD is not set
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MTD_M25P80=y
-# CONFIG_MTD_OF_PARTS is not set
-CONFIG_MTD_PHYSMAP=y
-# CONFIG_MTD_PHYSMAP_OF is not set
-CONFIG_MTD_SPI_NOR=y
-CONFIG_MTD_SPLIT_FIRMWARE=y
-CONFIG_MTD_SPLIT_UIMAGE_FW=y
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_MUTEX_SPIN_ON_OWNER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NET_FLOW_LIMIT=y
-CONFIG_NLS=y
-CONFIG_NO_BOOTMEM=y
-CONFIG_NR_CPUS=2
-CONFIG_NTP_PPS=y
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MDIO=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_OUTER_CACHE=y
-CONFIG_OUTER_CACHE_SYNC=y
-CONFIG_PAGE_OFFSET=0xC0000000
-CONFIG_PCI=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_DOMAINS_GENERIC=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=2
-CONFIG_PHYLIB=y
-CONFIG_PL310_ERRATA_588369=y
-CONFIG_PL310_ERRATA_727915=y
-CONFIG_PL310_ERRATA_753970=y
-CONFIG_PL310_ERRATA_769419=y
-CONFIG_PPS=y
-CONFIG_PPS_CLIENT_GPIO=y
-CONFIG_RAID_ATTRS=y
-CONFIG_RATIONAL=y
-CONFIG_RCU_STALL_COMMON=y
-CONFIG_RFS_ACCEL=y
-CONFIG_RPS=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1672=y
-CONFIG_RWSEM_SPIN_ON_OWNER=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_SATA_AHCI=y
-CONFIG_SATA_AHCI_PLATFORM=y
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCHED_INFO is not set
-CONFIG_SCSI=y
-CONFIG_SENSORS_AD7418=y
-CONFIG_SENSORS_GSC=y
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_NR_UARTS=3
-CONFIG_SERIAL_8250_RUNTIME_UARTS=3
-CONFIG_SMP=y
-CONFIG_SMP_ON_UP=y
-CONFIG_SPARSE_IRQ=y
-CONFIG_SPI=y
-CONFIG_SPI_BITBANG=y
-CONFIG_SPI_CNS3XXX=y
-CONFIG_SPI_MASTER=y
-CONFIG_SRCU=y
-# CONFIG_STAGING is not set
-CONFIG_SWIOTLB=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TREE_RCU=y
-CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
-CONFIG_USB=y
-CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
-CONFIG_USB_CNS3XXX_EHCI=y
-CONFIG_USB_CNS3XXX_OHCI=y
-CONFIG_USB_COMMON=y
-CONFIG_USB_DWC2=y
-CONFIG_USB_DWC2_HOST=y
-# CONFIG_USB_DWC2_PCI is not set
-# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_HCD_PLATFORM=y
-CONFIG_USB_EHCI_PCI=y
-# CONFIG_USB_ETH is not set
-CONFIG_USB_GADGET=y
-CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_OHCI_HCD_PLATFORM=y
-CONFIG_USB_SUPPORT=y
-# CONFIG_USB_UHCI_HCD is not set
-CONFIG_USE_OF=y
-CONFIG_VECTORS_BASE=0xffff0000
-CONFIG_VFP=y
-CONFIG_WATCHDOG_NOWAYOUT=y
-CONFIG_XPS=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0
-CONFIG_ZBOOT_ROM_TEXT=0
-CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/cns3xxx/patches-4.4/000-cns3xxx_arch_include.patch b/target/linux/cns3xxx/patches-4.4/000-cns3xxx_arch_include.patch
deleted file mode 100644
index f98fe0c..0000000
--- a/target/linux/cns3xxx/patches-4.4/000-cns3xxx_arch_include.patch
+++ /dev/null
@@ -1,8 +0,0 @@
---- a/arch/arm/mach-cns3xxx/Makefile
-+++ b/arch/arm/mach-cns3xxx/Makefile
-@@ -1,3 +1,5 @@
-+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
-+
- obj-$(CONFIG_ARCH_CNS3XXX)		+= cns3xxx.o
- cns3xxx-y				+= core.o pm.o
- cns3xxx-$(CONFIG_ATAGS)			+= devices.o
diff --git a/target/linux/cns3xxx/patches-4.4/001-arm_openwrt_machtypes.patch b/target/linux/cns3xxx/patches-4.4/001-arm_openwrt_machtypes.patch
deleted file mode 100644
index 32f977f..0000000
--- a/target/linux/cns3xxx/patches-4.4/001-arm_openwrt_machtypes.patch
+++ /dev/null
@@ -1,7 +0,0 @@
---- a/arch/arm/tools/mach-types
-+++ b/arch/arm/tools/mach-types
-@@ -1006,3 +1006,4 @@ eco5_bx2		MACH_ECO5_BX2		ECO5_BX2		4572
- eukrea_cpuimx28sd	MACH_EUKREA_CPUIMX28SD	EUKREA_CPUIMX28SD	4573
- domotab			MACH_DOMOTAB		DOMOTAB			4574
- pfla03			MACH_PFLA03		PFLA03			4575
-+gw2388			MACH_GW2388		GW2388			2635
diff --git a/target/linux/cns3xxx/patches-4.4/010-arm_introduce-dma-fiq-irq-broadcast.patch b/target/linux/cns3xxx/patches-4.4/010-arm_introduce-dma-fiq-irq-broadcast.patch
deleted file mode 100644
index 024675e..0000000
--- a/target/linux/cns3xxx/patches-4.4/010-arm_introduce-dma-fiq-irq-broadcast.patch
+++ /dev/null
@@ -1,80 +0,0 @@
---- a/arch/arm/include/asm/glue-cache.h
-+++ b/arch/arm/include/asm/glue-cache.h
-@@ -156,9 +156,15 @@ static inline void nop_dma_unmap_area(co
- #define __cpuc_flush_user_range		__glue(_CACHE,_flush_user_cache_range)
- #define __cpuc_coherent_kern_range	__glue(_CACHE,_coherent_kern_range)
- #define __cpuc_coherent_user_range	__glue(_CACHE,_coherent_user_range)
--#define __cpuc_flush_dcache_area	__glue(_CACHE,_flush_kern_dcache_area)
- 
--#define dmac_flush_range		__glue(_CACHE,_dma_flush_range)
-+#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
-+# define __cpuc_flush_dcache_area	__glue(_CACHE,_flush_kern_dcache_area)
-+# define dmac_flush_range		__glue(_CACHE,_dma_flush_range)
-+#else
-+# define __cpuc_flush_dcache_area	__glue(fiq,_flush_kern_dcache_area)
-+# define dmac_flush_range		__glue(fiq,_dma_flush_range)
-+#endif
-+
- #endif
- 
- #endif
---- a/arch/arm/mm/Kconfig
-+++ b/arch/arm/mm/Kconfig
-@@ -866,6 +866,17 @@ config DMA_CACHE_RWFO
- 	  in hardware, other workarounds are needed (e.g. cache
- 	  maintenance broadcasting in software via FIQ).
- 
-+config DMA_CACHE_FIQ_BROADCAST
-+	bool "Enable fiq broadcast DMA cache maintenance"
-+	depends on CPU_V6K && SMP
-+	select FIQ
-+	help
-+	  The Snoop Control Unit on ARM11MPCore does not detect the
-+	  cache maintenance operations and the dma_{map,unmap}_area()
-+	  functions may leave stale cache entries on other CPUs. By
-+	  enabling this option, fiq broadcast in the ARMv6
-+	  DMA cache maintenance functions is performed.
-+
- config OUTER_CACHE
- 	bool
- 
---- a/arch/arm/mm/flush.c
-+++ b/arch/arm/mm/flush.c
-@@ -319,6 +319,7 @@ void __sync_icache_dcache(pte_t pteval)
- void flush_dcache_page(struct page *page)
- {
- 	struct address_space *mapping;
-+	bool skip_broadcast = true;
- 
- 	/*
- 	 * The zero page is never written to, so never has any dirty
-@@ -329,7 +330,10 @@ void flush_dcache_page(struct page *page
- 
- 	mapping = page_mapping(page);
- 
--	if (!cache_ops_need_broadcast() &&
-+#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
-+	skip_broadcast = !cache_ops_need_broadcast();
-+#endif
-+	if (skip_broadcast &&
- 	    mapping && !page_mapped(page))
- 		clear_bit(PG_dcache_clean, &page->flags);
- 	else {
---- a/arch/arm/mm/dma.h
-+++ b/arch/arm/mm/dma.h
-@@ -4,8 +4,13 @@
- #include <asm/glue-cache.h>
- 
- #ifndef MULTI_CACHE
--#define dmac_map_area			__glue(_CACHE,_dma_map_area)
--#define dmac_unmap_area 		__glue(_CACHE,_dma_unmap_area)
-+#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
-+# define dmac_map_area			__glue(_CACHE,_dma_map_area)
-+# define dmac_unmap_area 		__glue(_CACHE,_dma_unmap_area)
-+#else
-+# define dmac_map_area			__glue(fiq,_dma_map_area)
-+# define dmac_unmap_area			__glue(fiq,_dma_unmap_area)
-+#endif
- 
- /*
-  * These are private to the dma-mapping API.  Do not use directly.
diff --git a/target/linux/cns3xxx/patches-4.4/020-watchdog_support.patch b/target/linux/cns3xxx/patches-4.4/020-watchdog_support.patch
deleted file mode 100644
index 74ffcc3..0000000
--- a/target/linux/cns3xxx/patches-4.4/020-watchdog_support.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-1. Made the connection between CNS3xxx SOCs(ARCH_CNS3xxx) and MPcore watchdog
-   since the CNS3xxx SOCs have ARM11 MPcore CPU.
-2. Enable mpcore_watchdog option as module to default configuration at
-   arch/arm/configs/cns3420vb_defconfig.
-
-Signed-off-by: Tommy Lin <tommy.lin at caviumnetworks.com>
-
----
-arch/arm/Kconfig                     |    1 +
- arch/arm/configs/cns3420vb_defconfig |    2 ++
- arch/arm/mach-cns3xxx/cns3420vb.c    |   22 ++++++++++++++++++++++
- 3 files changed, 25 insertions(+), 0 deletions(-)
-
---- a/arch/arm/configs/cns3420vb_defconfig
-+++ b/arch/arm/configs/cns3420vb_defconfig
-@@ -56,6 +56,8 @@ CONFIG_LEGACY_PTY_COUNT=16
- # CONFIG_HW_RANDOM is not set
- # CONFIG_HWMON is not set
- # CONFIG_VGA_CONSOLE is not set
-+CONFIG_WATCHDOG=y
-+CONFIG_MPCORE_WATCHDOG=m
- # CONFIG_HID_SUPPORT is not set
- # CONFIG_USB_SUPPORT is not set
- CONFIG_MMC=y
---- a/arch/arm/mach-cns3xxx/cns3420vb.c
-+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
-@@ -206,10 +206,32 @@ static struct platform_device cns3xxx_us
- 	},
- };
- 
-+/* Watchdog */
-+static struct resource cns3xxx_watchdog_resources[] = {
-+	[0] = {
-+		.start = CNS3XXX_TC11MP_TWD_BASE,
-+		.end   = CNS3XXX_TC11MP_TWD_BASE + PAGE_SIZE - 1,
-+		.flags = IORESOURCE_MEM,
-+	},
-+	[1] = {
-+		.start = IRQ_LOCALWDOG,
-+		.end   = IRQ_LOCALWDOG,
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct platform_device cns3xxx_watchdog_device = {
-+	.name		= "mpcore_wdt",
-+	.id		= -1,
-+	.num_resources	= ARRAY_SIZE(cns3xxx_watchdog_resources),
-+	.resource	= cns3xxx_watchdog_resources,
-+};
-+
- /*
-  * Initialization
-  */
- static struct platform_device *cns3420_pdevs[] __initdata = {
-+	&cns3xxx_watchdog_device,
- 	&cns3420_nor_pdev,
- 	&cns3xxx_usb_ehci_device,
- 	&cns3xxx_usb_ohci_device,
diff --git a/target/linux/cns3xxx/patches-4.4/025-smp_support.patch b/target/linux/cns3xxx/patches-4.4/025-smp_support.patch
deleted file mode 100644
index 2a9d997..0000000
--- a/target/linux/cns3xxx/patches-4.4/025-smp_support.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/arch/arm/mach-cns3xxx/Makefile
-+++ b/arch/arm/mach-cns3xxx/Makefile
-@@ -5,3 +5,5 @@ cns3xxx-y				+= core.o pm.o
- cns3xxx-$(CONFIG_ATAGS)			+= devices.o
- cns3xxx-$(CONFIG_PCI)			+= pcie.o
- cns3xxx-$(CONFIG_MACH_CNS3420VB)	+= cns3420vb.o
-+cns3xxx-$(CONFIG_SMP)			+= platsmp.o headsmp.o
-+cns3xxx-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
---- a/arch/arm/mach-cns3xxx/Kconfig
-+++ b/arch/arm/mach-cns3xxx/Kconfig
-@@ -2,6 +2,9 @@ menuconfig ARCH_CNS3XXX
- 	bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6
- 	select ARM_GIC
- 	select PCI_DOMAINS if PCI
-+	select HAVE_ARM_SCU if SMP
-+	select HAVE_ARM_TWD
-+	select HAVE_SMP
- 	help
- 	  Support for Cavium Networks CNS3XXX platform.
- 
---- a/arch/arm/mach-cns3xxx/core.h
-+++ b/arch/arm/mach-cns3xxx/core.h
-@@ -13,6 +13,7 @@
- 
- #include <linux/reboot.h>
- 
-+extern struct smp_operations cns3xxx_smp_ops;
- extern void cns3xxx_timer_init(void);
- 
- #ifdef CONFIG_CACHE_L2X0
diff --git a/target/linux/cns3xxx/patches-4.4/030-pcie_clock.patch b/target/linux/cns3xxx/patches-4.4/030-pcie_clock.patch
deleted file mode 100644
index 66c3a99..0000000
--- a/target/linux/cns3xxx/patches-4.4/030-pcie_clock.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/arch/arm/mach-cns3xxx/pcie.c
-+++ b/arch/arm/mach-cns3xxx/pcie.c
-@@ -281,8 +281,6 @@ void __init cns3xxx_pcie_init_late(void)
- 			"imprecise external abort");
- 
- 	for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
--		cns3xxx_pwr_clk_en(0x1 << PM_CLK_GATE_REG_OFFSET_PCIE(i));
--		cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i));
- 		cns3xxx_pcie_check_link(&cns3xxx_pcie[i]);
- 		cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
- 		private_data = &cns3xxx_pcie[i];
diff --git a/target/linux/cns3xxx/patches-4.4/040-fiq_support.patch b/target/linux/cns3xxx/patches-4.4/040-fiq_support.patch
deleted file mode 100644
index 3c0d23b..0000000
--- a/target/linux/cns3xxx/patches-4.4/040-fiq_support.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/arch/arm/mach-cns3xxx/Kconfig
-+++ b/arch/arm/mach-cns3xxx/Kconfig
-@@ -5,6 +5,7 @@ menuconfig ARCH_CNS3XXX
- 	select HAVE_ARM_SCU if SMP
- 	select HAVE_ARM_TWD
- 	select HAVE_SMP
-+	select FIQ
- 	help
- 	  Support for Cavium Networks CNS3XXX platform.
- 
---- a/arch/arm/mach-cns3xxx/Makefile
-+++ b/arch/arm/mach-cns3xxx/Makefile
-@@ -5,5 +5,5 @@ cns3xxx-y				+= core.o pm.o
- cns3xxx-$(CONFIG_ATAGS)			+= devices.o
- cns3xxx-$(CONFIG_PCI)			+= pcie.o
- cns3xxx-$(CONFIG_MACH_CNS3420VB)	+= cns3420vb.o
--cns3xxx-$(CONFIG_SMP)			+= platsmp.o headsmp.o
-+cns3xxx-$(CONFIG_SMP)			+= platsmp.o headsmp.o cns3xxx_fiq.o
- cns3xxx-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
---- a/arch/arm/mach-cns3xxx/cns3xxx.h
-+++ b/arch/arm/mach-cns3xxx/cns3xxx.h
-@@ -267,6 +267,7 @@
- #define MISC_PCIE_INT_MASK(x)			MISC_MEM_MAP(0x978 + (x) * 0x100)
- #define MISC_PCIE_INT_STATUS(x)			MISC_MEM_MAP(0x97C + (x) * 0x100)
- 
-+#define MISC_FIQ_CPU(x)				MISC_MEM_MAP(0xA58 - (x) * 0x4)
- /*
-  * Power management and clock control
-  */
---- a/arch/arm/mm/Kconfig
-+++ b/arch/arm/mm/Kconfig
-@@ -849,7 +849,7 @@ config VDSO
- 
- config DMA_CACHE_RWFO
- 	bool "Enable read/write for ownership DMA cache maintenance"
--	depends on CPU_V6K && SMP
-+	depends on CPU_V6K && SMP && !ARCH_CNS3XXX
- 	default y
- 	help
- 	  The Snoop Control Unit on ARM11MPCore does not detect the
diff --git a/target/linux/cns3xxx/patches-4.4/045-twd_base.patch b/target/linux/cns3xxx/patches-4.4/045-twd_base.patch
deleted file mode 100644
index e722b01..0000000
--- a/target/linux/cns3xxx/patches-4.4/045-twd_base.patch
+++ /dev/null
@@ -1,43 +0,0 @@
---- a/arch/arm/mach-cns3xxx/core.c
-+++ b/arch/arm/mach-cns3xxx/core.c
-@@ -17,6 +17,7 @@
- #include <linux/platform_device.h>
- #include <linux/usb/ehci_pdriver.h>
- #include <linux/usb/ohci_pdriver.h>
-+#include <asm/smp_twd.h>
- #include <asm/mach/arch.h>
- #include <asm/mach/map.h>
- #include <asm/mach/time.h>
-@@ -26,6 +27,8 @@
- #include "core.h"
- #include "pm.h"
- 
-+#define IRQ_LOCALTIMER 29
-+
- static struct map_desc cns3xxx_io_desc[] __initdata = {
- 	{
- 		.virtual	= CNS3XXX_TC11MP_SCU_BASE_VIRT,
-@@ -198,6 +201,15 @@ static struct irqaction cns3xxx_timer_ir
- 	.handler	= cns3xxx_timer_interrupt,
- };
- 
-+static void __init cns3xxx_init_twd(void)
-+{
-+	static DEFINE_TWD_LOCAL_TIMER(cns3xx_twd_local_timer,
-+		CNS3XXX_TC11MP_TWD_BASE,
-+		IRQ_LOCALTIMER);
-+
-+	twd_local_timer_register(&cns3xx_twd_local_timer);
-+}
-+
- /*
-  * Set up the clock source and clock events devices
-  */
-@@ -251,6 +263,7 @@ static void __init __cns3xxx_timer_init(
- 	setup_irq(timer_irq, &cns3xxx_timer_irq);
- 
- 	cns3xxx_clockevents_init(timer_irq);
-+	cns3xxx_init_twd();
- }
- 
- void __init cns3xxx_timer_init(void)
diff --git a/target/linux/cns3xxx/patches-4.4/055-pcie_io.patch b/target/linux/cns3xxx/patches-4.4/055-pcie_io.patch
deleted file mode 100644
index 4680853..0000000
--- a/target/linux/cns3xxx/patches-4.4/055-pcie_io.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/arch/arm/mach-cns3xxx/core.c
-+++ b/arch/arm/mach-cns3xxx/core.c
-@@ -81,6 +81,16 @@ static struct map_desc cns3xxx_io_desc[]
- 		.pfn		= __phys_to_pfn(CNS3XXX_PCIE1_CFG1_BASE),
- 		.length		= SZ_16M,
- 		.type		= MT_DEVICE,
-+	}, {
-+		.virtual	= CNS3XXX_PCIE0_IO_BASE_VIRT,
-+		.pfn		= __phys_to_pfn(CNS3XXX_PCIE0_IO_BASE),
-+		.length		= SZ_16M,
-+		.type		= MT_DEVICE,
-+	}, {
-+		.virtual	= CNS3XXX_PCIE1_IO_BASE_VIRT,
-+		.pfn		= __phys_to_pfn(CNS3XXX_PCIE1_IO_BASE),
-+		.length		= SZ_16M,
-+		.type		= MT_DEVICE,
- #endif
- 	},
- };
diff --git a/target/linux/cns3xxx/patches-4.4/060-pcie_abort.patch b/target/linux/cns3xxx/patches-4.4/060-pcie_abort.patch
deleted file mode 100644
index 7a3a8e4..0000000
--- a/target/linux/cns3xxx/patches-4.4/060-pcie_abort.patch
+++ /dev/null
@@ -1,109 +0,0 @@
---- a/arch/arm/mach-cns3xxx/pcie.c
-+++ b/arch/arm/mach-cns3xxx/pcie.c
-@@ -86,6 +86,79 @@ static void __iomem *cns3xxx_pci_map_bus
- 	return base + (where & 0xffc) + (devfn << 12);
- }
- 
-+static inline int check_master_abort(struct pci_bus *bus, unsigned int devfn, int where)
-+{
-+	struct cns3xxx_pcie *cnspci = pbus_to_cnspci(bus);
-+
-+  /* check PCI-compatible status register after access */
-+	if (cnspci->linked) {
-+		void __iomem *host_base;
-+		u32 sreg, ereg;
-+
-+		host_base = (void __iomem *) cnspci->cfg_bases[CNS3XXX_HOST_TYPE].virtual;
-+		sreg = __raw_readw(host_base + 0x6) & 0xF900;
-+		ereg = __raw_readl(host_base + 0x104); // Uncorrectable Error Status Reg
-+
-+		if (sreg | ereg) {
-+			/* SREG:
-+			 *  BIT15 - Detected Parity Error
-+			 *  BIT14 - Signaled System Error
-+			 *  BIT13 - Received Master Abort
-+			 *  BIT12 - Received Target Abort
-+			 *  BIT11 - Signaled Target Abort
-+			 *  BIT08 - Master Data Parity Error
-+			 *
-+			 * EREG:
-+			 *  BIT20 - Unsupported Request
-+			 *  BIT19 - ECRC
-+			 *  BIT18 - Malformed TLP
-+			 *  BIT17 - Receiver Overflow
-+			 *  BIT16 - Unexpected Completion
-+			 *  BIT15 - Completer Abort
-+			 *  BIT14 - Completion Timeout
-+			 *  BIT13 - Flow Control Protocol Error
-+			 *  BIT12 - Poisoned TLP
-+			 *  BIT04 - Data Link Protocol Error
-+			 *
-+			 * TODO: see Documentation/pci-error-recovery.txt
-+			 *    implement error_detected handler
-+			 */
-+/*
-+			printk("pci error: %04d:%02x:%02x.%02x sreg=0x%04x ereg=0x%08x", pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), sreg, ereg);
-+			if (sreg & BIT(15)) printk(" <PERR");
-+			if (sreg & BIT(14)) printk(" >SERR");
-+			if (sreg & BIT(13)) printk(" <MABRT");
-+			if (sreg & BIT(12)) printk(" <TABRT");
-+			if (sreg & BIT(11)) printk(" >TABRT");
-+			if (sreg & BIT( 8)) printk(" MPERR");
-+
-+			if (ereg & BIT(20)) printk(" Unsup");
-+			if (ereg & BIT(19)) printk(" ECRC");
-+			if (ereg & BIT(18)) printk(" MTLP");
-+			if (ereg & BIT(17)) printk(" OFLOW");
-+			if (ereg & BIT(16)) printk(" Unex");
-+			if (ereg & BIT(15)) printk(" ABRT");
-+			if (ereg & BIT(14)) printk(" COMPTO");
-+			if (ereg & BIT(13)) printk(" FLOW");
-+			if (ereg & BIT(12)) printk(" PTLP");
-+			if (ereg & BIT( 4)) printk(" DLINK");
-+			printk("\n");
-+*/
-+			pr_debug("%s failed port%d sreg=0x%04x\n", __func__,
-+				pci_domain_nr(bus), sreg);
-+
-+			/* make sure the status bits are reset */
-+			__raw_writew(sreg, host_base + 6);
-+			__raw_writel(ereg, host_base + 0x104);
-+			return 1;
-+		}
-+	}
-+	else
-+		return 1;
-+
-+  return 0;
-+}
-+
- static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
- 				   int where, int size, u32 *val)
- {
-@@ -95,6 +168,11 @@ static int cns3xxx_pci_read_config(struc
- 
- 	ret = pci_generic_config_read32(bus, devfn, where, size, val);
- 
-+	if (check_master_abort(bus, devfn, where)) {
-+		printk(KERN_ERR "pci error: %04d:%02x:%02x.%02x %02x(%d)= master_abort on read\n", pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), where, size);
-+		return PCIBIOS_DEVICE_NOT_FOUND;
-+	}
-+
- 	if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn &&
- 	    (where & 0xffc) == PCI_CLASS_REVISION)
- 		/*
-@@ -257,8 +335,14 @@ static void __init cns3xxx_pcie_hw_init(
- static int cns3xxx_pcie_abort_handler(unsigned long addr, unsigned int fsr,
- 				      struct pt_regs *regs)
- {
-+#if 0
-+/* R14_ABORT = PC+4 for XSCALE but not ARM11MPCORE
-+ * ignore imprecise aborts and use PCI-compatible Status register to
-+ * determine errors instead
-+ */
- 	if (fsr & (1 << 10))
- 		regs->ARM_pc += 4;
-+#endif
- 	return 0;
- }
- 
diff --git a/target/linux/cns3xxx/patches-4.4/065-pcie_skip_inactive.patch b/target/linux/cns3xxx/patches-4.4/065-pcie_skip_inactive.patch
deleted file mode 100644
index b8b5f27..0000000
--- a/target/linux/cns3xxx/patches-4.4/065-pcie_skip_inactive.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/arch/arm/mach-cns3xxx/pcie.c
-+++ b/arch/arm/mach-cns3xxx/pcie.c
-@@ -366,6 +366,8 @@ void __init cns3xxx_pcie_init_late(void)
- 
- 	for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
- 		cns3xxx_pcie_check_link(&cns3xxx_pcie[i]);
-+		if (!cns3xxx_pcie[i].linked)
-+			continue;
- 		cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
- 		private_data = &cns3xxx_pcie[i];
- 		pci_common_init(&hw_pci);
diff --git a/target/linux/cns3xxx/patches-4.4/070-i2c_support.patch b/target/linux/cns3xxx/patches-4.4/070-i2c_support.patch
deleted file mode 100644
index 6645ff6..0000000
--- a/target/linux/cns3xxx/patches-4.4/070-i2c_support.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/drivers/i2c/busses/Kconfig
-+++ b/drivers/i2c/busses/Kconfig
-@@ -440,6 +440,18 @@ config I2C_CBUS_GPIO
- 	  This driver can also be built as a module.  If so, the module
- 	  will be called i2c-cbus-gpio.
- 
-+config I2C_CNS3XXX
-+	tristate "Cavium CNS3xxx I2C driver"
-+	depends on ARCH_CNS3XXX
-+	help
-+	  Support for Cavium CNS3xxx I2C controller driver.
-+
-+	  This driver can also be built as a module.  If so, the module
-+	  will be called i2c-cns3xxx.
-+
-+	  Please note that this driver might be needed to bring up other
-+	  devices such as Cavium CNS3xxx Ethernet.
-+
- config I2C_CPM
- 	tristate "Freescale CPM1 or CPM2 (MPC8xx/826x)"
- 	depends on CPM1 || CPM2
---- a/drivers/i2c/busses/Makefile
-+++ b/drivers/i2c/busses/Makefile
-@@ -111,6 +111,7 @@ obj-$(CONFIG_I2C_VIPERBOARD)	+= i2c-vipe
- obj-$(CONFIG_I2C_ACORN)		+= i2c-acorn.o
- obj-$(CONFIG_I2C_BCM_KONA)	+= i2c-bcm-kona.o
- obj-$(CONFIG_I2C_BRCMSTB)	+= i2c-brcmstb.o
-+obj-$(CONFIG_I2C_CNS3XXX)	+= i2c-cns3xxx.o
- obj-$(CONFIG_I2C_CROS_EC_TUNNEL)	+= i2c-cros-ec-tunnel.o
- obj-$(CONFIG_I2C_ELEKTOR)	+= i2c-elektor.o
- obj-$(CONFIG_I2C_OPAL)		+= i2c-opal.o
diff --git a/target/linux/cns3xxx/patches-4.4/075-spi_support.patch b/target/linux/cns3xxx/patches-4.4/075-spi_support.patch
deleted file mode 100644
index 9011073..0000000
--- a/target/linux/cns3xxx/patches-4.4/075-spi_support.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- a/drivers/spi/Kconfig
-+++ b/drivers/spi/Kconfig
-@@ -183,6 +183,13 @@ config SPI_CLPS711X
- 	  This enables dedicated general purpose SPI/Microwire1-compatible
- 	  master mode interface (SSI1) for CLPS711X-based CPUs.
- 
-+config SPI_CNS3XXX
-+	tristate "CNS3XXX SPI controller"
-+	depends on ARCH_CNS3XXX && SPI_MASTER
-+	select SPI_BITBANG
-+	help
-+	  This enables using the CNS3XXX SPI controller in master mode.
-+
- config SPI_COLDFIRE_QSPI
- 	tristate "Freescale Coldfire QSPI controller"
- 	depends on (M520x || M523x || M5249 || M525x || M527x || M528x || M532x)
---- a/drivers/spi/Makefile
-+++ b/drivers/spi/Makefile
-@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_BITBANG)		+= spi-bitban
- obj-$(CONFIG_SPI_BUTTERFLY)		+= spi-butterfly.o
- obj-$(CONFIG_SPI_CADENCE)		+= spi-cadence.o
- obj-$(CONFIG_SPI_CLPS711X)		+= spi-clps711x.o
-+obj-$(CONFIG_SPI_CNS3XXX)		+= spi-cns3xxx.o
- obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= spi-coldfire-qspi.o
- obj-$(CONFIG_SPI_DAVINCI)		+= spi-davinci.o
- obj-$(CONFIG_SPI_DLN2)			+= spi-dln2.o
---- a/include/linux/spi/spi.h
-+++ b/include/linux/spi/spi.h
-@@ -703,6 +703,10 @@ struct spi_transfer {
- 	u32		speed_hz;
- 
- 	struct list_head transfer_list;
-+
-+#ifdef CONFIG_ARCH_CNS3XXX
-+	unsigned	last_in_message_list;
-+#endif
- };
- 
- /**
---- a/drivers/spi/spi.c
-+++ b/drivers/spi/spi.c
-@@ -933,6 +933,9 @@ static int spi_transfer_one_message(stru
- 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
- 		trace_spi_transfer_start(msg, xfer);
- 
-+		xfer->last_in_message_list =
-+			list_is_last(&xfer->transfer_list, &msg->transfers);
-+
- 		spi_statistics_add_transfer_stats(statm, xfer, master);
- 		spi_statistics_add_transfer_stats(stats, xfer, master);
- 
diff --git a/target/linux/cns3xxx/patches-4.4/080-sata_support.patch b/target/linux/cns3xxx/patches-4.4/080-sata_support.patch
deleted file mode 100644
index 479a9b6..0000000
--- a/target/linux/cns3xxx/patches-4.4/080-sata_support.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/drivers/ata/ahci_platform.c
-+++ b/drivers/ata/ahci_platform.c
-@@ -37,12 +37,23 @@ static struct scsi_host_template ahci_pl
- 	AHCI_SHT(DRV_NAME),
- };
- 
-+static const struct ata_port_info cns3xxx_port_info = {
-+	.flags		= AHCI_FLAG_COMMON,
-+	.pio_mask	= ATA_PIO4,
-+	.udma_mask	= ATA_UDMA6,
-+	.port_ops	= &ahci_pmp_retry_srst_ops,
-+};
-+
- static int ahci_probe(struct platform_device *pdev)
- {
- 	struct device *dev = &pdev->dev;
- 	struct ahci_host_priv *hpriv;
-+	const struct ata_port_info *info = &ahci_port_info;
- 	int rc;
- 
-+	if (IS_ENABLED(CONFIG_ARCH_CNS3XXX))
-+		info = &cns3xxx_port_info;
-+
- 	hpriv = ahci_platform_get_resources(pdev);
- 	if (IS_ERR(hpriv))
- 		return PTR_ERR(hpriv);
diff --git a/target/linux/cns3xxx/patches-4.4/090-timers.patch b/target/linux/cns3xxx/patches-4.4/090-timers.patch
deleted file mode 100644
index 6f7713f..0000000
--- a/target/linux/cns3xxx/patches-4.4/090-timers.patch
+++ /dev/null
@@ -1,103 +0,0 @@
---- a/arch/arm/mach-cns3xxx/core.c
-+++ b/arch/arm/mach-cns3xxx/core.c
-@@ -138,6 +138,7 @@ static int cns3xxx_set_oneshot(struct cl
- 
- 	/* period set, and timer enabled in 'next_event' hook */
- 	ctrl |= (1 << 2) | (1 << 9);
-+	writel(0, cns3xxx_tmr1 + TIMER1_AUTO_RELOAD_OFFSET);
- 	writel(ctrl, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
- 	return 0;
- }
-@@ -148,7 +149,7 @@ static int cns3xxx_set_periodic(struct c
- 	int pclk = cns3xxx_cpu_clock() / 8;
- 	int reload;
- 
--	reload = pclk * 20 / (3 * HZ) * 0x25000;
-+	reload = pclk * 1000000 / HZ;
- 	writel(reload, cns3xxx_tmr1 + TIMER1_AUTO_RELOAD_OFFSET);
- 	ctrl |= (1 << 0) | (1 << 2) | (1 << 9);
- 	writel(ctrl, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
-@@ -175,7 +176,7 @@ static struct clock_event_device cns3xxx
- 	.set_state_oneshot	= cns3xxx_set_oneshot,
- 	.tick_resume		= cns3xxx_shutdown,
- 	.set_next_event		= cns3xxx_timer_set_next_event,
--	.rating			= 350,
-+	.rating			= 300,
- 	.cpumask		= cpu_all_mask,
- };
- 
-@@ -220,6 +221,32 @@ static void __init cns3xxx_init_twd(void
- 	twd_local_timer_register(&cns3xx_twd_local_timer);
- }
- 
-+static cycle_t cns3xxx_get_cycles(struct clocksource *cs)
-+{
-+  u64 val;
-+
-+  val = readl(cns3xxx_tmr1 + TIMER_FREERUN_CONTROL_OFFSET);
-+  val &= 0xffff;
-+
-+  return ((val << 32) | readl(cns3xxx_tmr1 + TIMER_FREERUN_OFFSET));
-+}
-+
-+static struct clocksource clocksource_cns3xxx = {
-+	.name = "freerun",
-+	.rating = 200,
-+	.read = cns3xxx_get_cycles,
-+	.mask = CLOCKSOURCE_MASK(48),
-+	.flags  = CLOCK_SOURCE_IS_CONTINUOUS,
-+};
-+
-+static void __init cns3xxx_clocksource_init(void)
-+{
-+	/* Reset the FreeRunning counter */
-+	writel((1 << 16), cns3xxx_tmr1 + TIMER_FREERUN_CONTROL_OFFSET);
-+
-+	clocksource_register_khz(&clocksource_cns3xxx, 100);
-+}
-+
- /*
-  * Set up the clock source and clock events devices
-  */
-@@ -237,13 +264,12 @@ static void __init __cns3xxx_timer_init(
- 	/* stop free running timer3 */
- 	writel(0, cns3xxx_tmr1 + TIMER_FREERUN_CONTROL_OFFSET);
- 
--	/* timer1 */
--	writel(0x5C800, cns3xxx_tmr1 + TIMER1_COUNTER_OFFSET);
--	writel(0x5C800, cns3xxx_tmr1 + TIMER1_AUTO_RELOAD_OFFSET);
--
- 	writel(0, cns3xxx_tmr1 + TIMER1_MATCH_V1_OFFSET);
- 	writel(0, cns3xxx_tmr1 + TIMER1_MATCH_V2_OFFSET);
- 
-+	val = (cns3xxx_cpu_clock() >> 3) * 1000000 / HZ;
-+	writel(val, cns3xxx_tmr1 + TIMER1_COUNTER_OFFSET);
-+
- 	/* mask irq, non-mask timer1 overflow */
- 	irq_mask = readl(cns3xxx_tmr1 + TIMER1_2_INTERRUPT_MASK_OFFSET);
- 	irq_mask &= ~(1 << 2);
-@@ -255,23 +281,9 @@ static void __init __cns3xxx_timer_init(
- 	val |= (1 << 9);
- 	writel(val, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
- 
--	/* timer2 */
--	writel(0, cns3xxx_tmr1 + TIMER2_MATCH_V1_OFFSET);
--	writel(0, cns3xxx_tmr1 + TIMER2_MATCH_V2_OFFSET);
--
--	/* mask irq */
--	irq_mask = readl(cns3xxx_tmr1 + TIMER1_2_INTERRUPT_MASK_OFFSET);
--	irq_mask |= ((1 << 3) | (1 << 4) | (1 << 5));
--	writel(irq_mask, cns3xxx_tmr1 + TIMER1_2_INTERRUPT_MASK_OFFSET);
--
--	/* down counter */
--	val = readl(cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
--	val |= (1 << 10);
--	writel(val, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
--
--	/* Make irqs happen for the system timer */
- 	setup_irq(timer_irq, &cns3xxx_timer_irq);
- 
-+	cns3xxx_clocksource_init();
- 	cns3xxx_clockevents_init(timer_irq);
- 	cns3xxx_init_twd();
- }
diff --git a/target/linux/cns3xxx/patches-4.4/095-gpio_support.patch b/target/linux/cns3xxx/patches-4.4/095-gpio_support.patch
deleted file mode 100644
index 79a937a..0000000
--- a/target/linux/cns3xxx/patches-4.4/095-gpio_support.patch
+++ /dev/null
@@ -1,67 +0,0 @@
---- a/arch/arm/mach-cns3xxx/cns3420vb.c
-+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
-@@ -245,6 +245,10 @@ static void __init cns3420_init(void)
- 
- 	cns3xxx_ahci_init();
- 	cns3xxx_sdhci_init();
-+	cns3xxx_gpio_init( 0, 32, CNS3XXX_GPIOA_BASE_VIRT, IRQ_CNS3XXX_GPIOA,
-+		NR_IRQS_CNS3XXX);
-+	cns3xxx_gpio_init(32, 32, CNS3XXX_GPIOB_BASE_VIRT, IRQ_CNS3XXX_GPIOB,
-+		NR_IRQS_CNS3XXX + 32);
- 
- 	pm_power_off = cns3xxx_power_off;
- }
---- a/arch/arm/mach-cns3xxx/Kconfig
-+++ b/arch/arm/mach-cns3xxx/Kconfig
-@@ -1,6 +1,8 @@
- menuconfig ARCH_CNS3XXX
- 	bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6
- 	select ARM_GIC
-+	select ARCH_REQUIRE_GPIOLIB
-+	select GENERIC_IRQ_CHIP
- 	select PCI_DOMAINS if PCI
- 	select HAVE_ARM_SCU if SMP
- 	select HAVE_ARM_TWD
---- a/arch/arm/mach-cns3xxx/Makefile
-+++ b/arch/arm/mach-cns3xxx/Makefile
-@@ -1,7 +1,7 @@
- ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
- 
- obj-$(CONFIG_ARCH_CNS3XXX)		+= cns3xxx.o
--cns3xxx-y				+= core.o pm.o
-+cns3xxx-y				+= core.o pm.o gpio.o
- cns3xxx-$(CONFIG_ATAGS)			+= devices.o
- cns3xxx-$(CONFIG_PCI)			+= pcie.o
- cns3xxx-$(CONFIG_MACH_CNS3420VB)	+= cns3420vb.o
---- a/arch/arm/mach-cns3xxx/cns3xxx.h
-+++ b/arch/arm/mach-cns3xxx/cns3xxx.h
-@@ -68,8 +68,10 @@
- #define SMC_PCELL_ID_3_OFFSET			0xFFC
- 
- #define CNS3XXX_GPIOA_BASE			0x74000000	/* GPIO port A */
-+#define CNS3XXX_GPIOA_BASE_VIRT			0xFB006000
- 
- #define CNS3XXX_GPIOB_BASE			0x74800000	/* GPIO port B */
-+#define CNS3XXX_GPIOB_BASE_VIRT			0xFB007000
- 
- #define CNS3XXX_RTC_BASE			0x75000000	/* Real Time Clock */
- 
---- a/arch/arm/mach-cns3xxx/core.c
-+++ b/arch/arm/mach-cns3xxx/core.c
-@@ -50,6 +50,16 @@ static struct map_desc cns3xxx_io_desc[]
- 		.pfn		= __phys_to_pfn(CNS3XXX_PM_BASE),
- 		.length		= SZ_4K,
- 		.type		= MT_DEVICE,
-+	}, {
-+		.virtual	= CNS3XXX_GPIOA_BASE_VIRT,
-+		.pfn		= __phys_to_pfn(CNS3XXX_GPIOA_BASE),
-+		.length		= SZ_4K,
-+		.type		= MT_DEVICE,
-+	}, {
-+		.virtual	= CNS3XXX_GPIOB_BASE_VIRT,
-+		.pfn		= __phys_to_pfn(CNS3XXX_GPIOB_BASE),
-+		.length		= SZ_4K,
-+		.type		= MT_DEVICE,
- #ifdef CONFIG_PCI
- 	}, {
- 		.virtual	= CNS3XXX_PCIE0_HOST_BASE_VIRT,
diff --git a/target/linux/cns3xxx/patches-4.4/097-l2x0_cmdline_disable.patch b/target/linux/cns3xxx/patches-4.4/097-l2x0_cmdline_disable.patch
deleted file mode 100644
index 25d3005..0000000
--- a/target/linux/cns3xxx/patches-4.4/097-l2x0_cmdline_disable.patch
+++ /dev/null
@@ -1,69 +0,0 @@
---- a/arch/arm/mach-cns3xxx/core.c
-+++ b/arch/arm/mach-cns3xxx/core.c
-@@ -307,13 +307,26 @@ void __init cns3xxx_timer_init(void)
- 
- #ifdef CONFIG_CACHE_L2X0
- 
--void __init cns3xxx_l2x0_init(void)
-+static int cns3xxx_l2x0_enable = 1;
-+
-+static int __init cns3xxx_l2x0_disable(char *s)
-+{
-+	cns3xxx_l2x0_enable = 0;
-+	return 1;
-+}
-+__setup("nol2x0", cns3xxx_l2x0_disable);
-+
-+static int __init cns3xxx_l2x0_init(void)
- {
--	void __iomem *base = ioremap(CNS3XXX_L2C_BASE, SZ_4K);
-+	void __iomem *base;
- 	u32 val;
- 
-+	if (!cns3xxx_l2x0_enable)
-+		return 0;
-+
-+	base = ioremap(CNS3XXX_L2C_BASE, SZ_4K);
- 	if (WARN_ON(!base))
--		return;
-+		return 0;
- 
- 	/*
- 	 * Tag RAM Control register
-@@ -343,7 +356,10 @@ void __init cns3xxx_l2x0_init(void)
- 
- 	/* 32 KiB, 8-way, parity disable */
- 	l2x0_init(base, 0x00500000, 0xfe0f0fff);
-+
-+	return 0;
- }
-+arch_initcall(cns3xxx_l2x0_init);
- 
- #endif /* CONFIG_CACHE_L2X0 */
- 
---- a/arch/arm/mach-cns3xxx/cns3420vb.c
-+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
-@@ -239,8 +239,6 @@ static struct platform_device *cns3420_p
- 
- static void __init cns3420_init(void)
- {
--	cns3xxx_l2x0_init();
--
- 	platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
- 
- 	cns3xxx_ahci_init();
---- a/arch/arm/mach-cns3xxx/core.h
-+++ b/arch/arm/mach-cns3xxx/core.h
-@@ -16,12 +16,6 @@
- extern struct smp_operations cns3xxx_smp_ops;
- extern void cns3xxx_timer_init(void);
- 
--#ifdef CONFIG_CACHE_L2X0
--void __init cns3xxx_l2x0_init(void);
--#else
--static inline void cns3xxx_l2x0_init(void) {}
--#endif /* CONFIG_CACHE_L2X0 */
--
- #ifdef CONFIG_PCI
- extern void __init cns3xxx_pcie_init_late(void);
- #else
diff --git a/target/linux/cns3xxx/patches-4.4/100-laguna_support.patch b/target/linux/cns3xxx/patches-4.4/100-laguna_support.patch
deleted file mode 100644
index 3c0bba4..0000000
--- a/target/linux/cns3xxx/patches-4.4/100-laguna_support.patch
+++ /dev/null
@@ -1,46 +0,0 @@
---- a/arch/arm/mach-cns3xxx/Kconfig
-+++ b/arch/arm/mach-cns3xxx/Kconfig
-@@ -22,4 +22,12 @@ config MACH_CNS3420VB
- 	  This is a platform with an on-board ARM11 MPCore and has support
- 	  for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc.
- 
-+config MACH_GW2388
-+	bool "Support for Gateworks Laguna Platform"
-+	help
-+	  Include support for the Gateworks Laguna Platform
-+
-+	  This is a platform with an on-board ARM11 MPCore and has support
-+	  for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, I2C, GIG, etc.
-+
- endif
---- a/arch/arm/mach-cns3xxx/Makefile
-+++ b/arch/arm/mach-cns3xxx/Makefile
-@@ -7,3 +7,5 @@ cns3xxx-$(CONFIG_PCI)			+= pcie.o
- cns3xxx-$(CONFIG_MACH_CNS3420VB)	+= cns3420vb.o
- cns3xxx-$(CONFIG_SMP)			+= platsmp.o headsmp.o cns3xxx_fiq.o
- cns3xxx-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
-+cns3xxx-$(CONFIG_MACH_GW2388)		+= laguna.o
-+
---- a/arch/arm/mach-cns3xxx/devices.c
-+++ b/arch/arm/mach-cns3xxx/devices.c
-@@ -16,6 +16,7 @@
- #include <linux/compiler.h>
- #include <linux/dma-mapping.h>
- #include <linux/platform_device.h>
-+#include <asm/mach-types.h>
- #include "cns3xxx.h"
- #include "pm.h"
- #include "core.h"
-@@ -101,7 +102,11 @@ void __init cns3xxx_sdhci_init(void)
- 	u32 gpioa_pins = __raw_readl(gpioa);
- 
- 	/* MMC/SD pins share with GPIOA */
--	gpioa_pins |= 0x1fff0004;
-+	if (machine_is_gw2388()) {
-+		gpioa_pins |= 0x1fff0000;
-+	} else {
-+		gpioa_pins |= 0x1fff0004;
-+	}
- 	__raw_writel(gpioa_pins, gpioa);
- 
- 	cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO));
diff --git a/target/linux/cns3xxx/patches-4.4/101-laguna_sdhci_card_detect.patch b/target/linux/cns3xxx/patches-4.4/101-laguna_sdhci_card_detect.patch
deleted file mode 100644
index 72648a5..0000000
--- a/target/linux/cns3xxx/patches-4.4/101-laguna_sdhci_card_detect.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/drivers/mmc/host/sdhci-cns3xxx.c
-+++ b/drivers/mmc/host/sdhci-cns3xxx.c
-@@ -88,9 +88,9 @@ static const struct sdhci_pltfm_data sdh
- 	.ops = &sdhci_cns3xxx_ops,
- 	.quirks = SDHCI_QUIRK_BROKEN_DMA |
- 		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
--		  SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
- 		  SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
--		  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
-+		  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
-+		  SDHCI_QUIRK_BROKEN_CARD_DETECTION,
- };
- 
- static int sdhci_cns3xxx_probe(struct platform_device *pdev)
diff --git a/target/linux/cns3xxx/patches-4.4/110-pci_isolated_interrupts.patch b/target/linux/cns3xxx/patches-4.4/110-pci_isolated_interrupts.patch
deleted file mode 100644
index 800be81..0000000
--- a/target/linux/cns3xxx/patches-4.4/110-pci_isolated_interrupts.patch
+++ /dev/null
@@ -1,95 +0,0 @@
---- a/arch/arm/mach-cns3xxx/pcie.c
-+++ b/arch/arm/mach-cns3xxx/pcie.c
-@@ -18,6 +18,7 @@
- #include <linux/io.h>
- #include <linux/ioport.h>
- #include <linux/interrupt.h>
-+#include <linux/irq.h>
- #include <linux/ptrace.h>
- #include <asm/mach/map.h>
- #include "cns3xxx.h"
-@@ -27,7 +28,7 @@ struct cns3xxx_pcie {
- 	void __iomem *host_regs; /* PCI config registers for host bridge */
- 	void __iomem *cfg0_regs; /* PCI Type 0 config registers */
- 	void __iomem *cfg1_regs; /* PCI Type 1 config registers */
--	unsigned int irqs[2];
-+	unsigned int irqs[5];
- 	struct resource res_io;
- 	struct resource res_mem;
- 	int port;
-@@ -95,7 +96,7 @@ static inline int check_master_abort(str
- 		void __iomem *host_base;
- 		u32 sreg, ereg;
- 
--		host_base = (void __iomem *) cnspci->cfg_bases[CNS3XXX_HOST_TYPE].virtual;
-+		host_base = (void __iomem *) cnspci->host_regs;
- 		sreg = __raw_readw(host_base + 0x6) & 0xF900;
- 		ereg = __raw_readl(host_base + 0x104); // Uncorrectable Error Status Reg
- 
-@@ -209,7 +210,7 @@ static struct pci_ops cns3xxx_pcie_ops =
- static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
- {
- 	struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev);
--	int irq = cnspci->irqs[!!dev->bus->number];
-+	int irq = cnspci->irqs[!!dev->bus->number + pin - 1];
- 
- 	pr_info("PCIe map irq: %04d:%02x:%02x.%02x slot %d, pin %d, irq: %d\n",
- 		pci_domain_nr(dev->bus), dev->bus->number, PCI_SLOT(dev->devfn),
-@@ -235,7 +236,13 @@ static struct cns3xxx_pcie cns3xxx_pcie[
- 			.end = CNS3XXX_PCIE0_HOST_BASE - 1, /* 176 MiB */
- 			.flags = IORESOURCE_MEM,
- 		},
--		.irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, },
-+		.irqs = {
-+			IRQ_CNS3XXX_PCIE0_RC,
-+			IRQ_CNS3XXX_PCIE0_DEVICE,
-+			IRQ_CNS3XXX_PCIE0_DEVICE,
-+			IRQ_CNS3XXX_PCIE0_DEVICE,
-+			IRQ_CNS3XXX_PCIE0_DEVICE,
-+		},
- 		.port = 0,
- 	},
- 	[1] = {
-@@ -254,7 +261,13 @@ static struct cns3xxx_pcie cns3xxx_pcie[
- 			.end = CNS3XXX_PCIE1_HOST_BASE - 1, /* 176 MiB */
- 			.flags = IORESOURCE_MEM,
- 		},
--		.irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, },
-+		.irqs = {
-+			IRQ_CNS3XXX_PCIE1_RC,
-+			IRQ_CNS3XXX_PCIE1_DEVICE,
-+			IRQ_CNS3XXX_PCIE1_DEVICE,
-+			IRQ_CNS3XXX_PCIE1_DEVICE,
-+			IRQ_CNS3XXX_PCIE1_DEVICE,
-+		},
- 		.port = 1,
- 	},
- };
-@@ -346,6 +359,14 @@ static int cns3xxx_pcie_abort_handler(un
- 	return 0;
- }
- 
-+void __init cns3xxx_pcie_set_irqs(int bus, int *irqs)
-+{
-+	int i;
-+
-+	for (i = 0; i < 4; i++)
-+		cns3xxx_pcie[bus].irqs[i + 1] = irqs[i];
-+}
-+
- void __init cns3xxx_pcie_init_late(void)
- {
- 	int i;
---- a/arch/arm/mach-cns3xxx/core.h
-+++ b/arch/arm/mach-cns3xxx/core.h
-@@ -18,8 +18,10 @@ extern void cns3xxx_timer_init(void);
- 
- #ifdef CONFIG_PCI
- extern void __init cns3xxx_pcie_init_late(void);
-+extern void __init cns3xxx_pcie_set_irqs(int bus, int *irqs);
- #else
- static inline void __init cns3xxx_pcie_init_late(void) {}
-+static inline void cns3xxx_pcie_set_irqs(int bus, int *irqs) {}
- #endif
- 
- void __init cns3xxx_map_io(void);
diff --git a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
deleted file mode 100644
index c1f565a..0000000
--- a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/drivers/pci/probe.c
-+++ b/drivers/pci/probe.c
-@@ -1967,7 +1967,8 @@ static void pcie_write_mrrs(struct pci_d
- 	/* In the "safe" case, do not configure the MRRS.  There appear to be
- 	 * issues with setting MRRS to 0 on a number of devices.
- 	 */
--	if (pcie_bus_config != PCIE_BUS_PERFORMANCE)
-+	if (pcie_bus_config != PCIE_BUS_PERFORMANCE &&
-+	    pcie_bus_config != PCIE_BUS_PEER2PEER)
- 		return;
- 
- 	/* For Max performance, the MRRS must be set to the largest supported
---- a/include/linux/pci.h
-+++ b/include/linux/pci.h
-@@ -757,7 +757,7 @@ enum pcie_bus_config_types {
- 	PCIE_BUS_DEFAULT,	/* ensure MPS matches upstream bridge */
- 	PCIE_BUS_SAFE,		/* use largest MPS boot-time devices support */
- 	PCIE_BUS_PERFORMANCE,	/* use MPS and MRRS for best performance */
--	PCIE_BUS_PEER2PEER,	/* set MPS = 128 for all devices */
-+	PCIE_BUS_PEER2PEER,	/* set MPS and MRSS to 128 for all devices */
- };
- 
- extern enum pcie_bus_config_types pcie_bus_config;
diff --git a/target/linux/cns3xxx/patches-4.4/200-broadcom_phy_reinit.patch b/target/linux/cns3xxx/patches-4.4/200-broadcom_phy_reinit.patch
deleted file mode 100644
index f3ae5e6..0000000
--- a/target/linux/cns3xxx/patches-4.4/200-broadcom_phy_reinit.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/drivers/net/phy/broadcom.c
-+++ b/drivers/net/phy/broadcom.c
-@@ -414,6 +414,11 @@ static int bcm5481_config_aneg(struct ph
- 		/* Write bits 14:0. */
- 		reg |= (1 << 15);
- 		phy_write(phydev, 0x18, reg);
-+	} else {
-+		phy_write(phydev, 0x18, 0xf1e7);
-+		phy_write(phydev, 0x1c, 0x8e00);
-+
-+		phy_write(phydev, 0x1c, 0xa41f);
- 	}
- 
- 	if (of_property_read_bool(np, "enet-phy-lane-swap")) {
diff --git a/target/linux/cns3xxx/patches-4.4/210-dwc2_defaults.patch b/target/linux/cns3xxx/patches-4.4/210-dwc2_defaults.patch
deleted file mode 100644
index b75d2e4..0000000
--- a/target/linux/cns3xxx/patches-4.4/210-dwc2_defaults.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/drivers/usb/dwc2/platform.c
-+++ b/drivers/usb/dwc2/platform.c
-@@ -144,6 +144,34 @@ static int __dwc2_lowlevel_hw_enable(str
- 	return ret;
- }
- 
-+static const struct dwc2_core_params params_cns3xxx = {
-+	.otg_cap			= 2,	/* non-HNP/non-SRP capable */
-+	.otg_ver			= 0,	/* 1.3 */
-+	.dma_enable			= 1,
-+	.dma_desc_enable		= 0,
-+	.speed				= 0,	/* High Speed */
-+	.enable_dynamic_fifo		= 1,
-+	.en_multiple_tx_fifo		= 1,
-+	.host_rx_fifo_size		= 658,	/* 774 DWORDs */
-+	.host_nperio_tx_fifo_size	= 128,	/* 256 DWORDs */
-+	.host_perio_tx_fifo_size	= 658,	/* 512 DWORDs */
-+	.max_transfer_size		= 65535,
-+	.max_packet_count		= 511,
-+	.host_channels			= 16,
-+	.phy_type			= 1,	/* UTMI */
-+	.phy_utmi_width			= 16,	/* 8 bits */
-+	.phy_ulpi_ddr			= 0,	/* Single */
-+	.phy_ulpi_ext_vbus		= 0,
-+	.i2c_enable			= 0,
-+	.ulpi_fs_ls			= 0,
-+	.host_support_fs_ls_low_power	= 0,
-+	.host_ls_low_power_phy_clk	= 0,	/* 48 MHz */
-+	.ts_dline			= 0,
-+	.reload_ctl			= 0,
-+	.ahbcfg				= 0x10,
-+	.uframe_sched			= 0,
-+};
-+
- /**
-  * dwc2_lowlevel_hw_enable - enable platform lowlevel hw resources
-  * @hsotg: The driver state
-@@ -344,6 +372,9 @@ static int dwc2_driver_probe(struct plat
- 		/* Default all params to autodetect */
- 		dwc2_set_all_params(&defparams, -1);
- 		params = &defparams;
-+#ifdef CONFIG_ARCH_CNS3XXX
-+		params = &params_cns3xxx;
-+#endif
- 
- 		/*
- 		 * Disable descriptor dma mode by default as the HW can support


From lede-commits at lists.infradead.org  Wed Apr 12 03:49:26 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 06:49:26 -0400
Subject: [source]  mac80211: add rt2x00 debug symbols to PKG_CONFIG_DEPENDS
In-Reply-To: <20170412104925.10269.23935@git-01.infra.lede-project.org>
References: <20170412104925.10269.23935@git-01.infra.lede-project.org>
Message-ID: <mailman.23613.1491994188.26984.lede-commits@lists.infradead.org>

jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/7d4147d86908b36dd8915bfeeb1c48c2a40941a5

commit 7d4147d86908b36dd8915bfeeb1c48c2a40941a5
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Wed Apr 12 12:44:12 2017 +0200

    mac80211: add rt2x00 debug symbols to PKG_CONFIG_DEPENDS
    
    Chaning these symbols require a recompilation of the modules, so make the
    system aware of it.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 package/kernel/mac80211/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 60efdaa..c5a2577 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -68,6 +68,8 @@ PKG_CONFIG_DEPENDS:= \
 	CONFIG_PACKAGE_BRCM80211_DEBUG \
 	CONFIG_PACKAGE_IWLWIFI_DEBUG \
 	CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
+	CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS \
+	CONFIG_PACKAGE_RT2X00_DEBUG \
 	CONFIG_PACKAGE_RTLWIFI_DEBUG \
 	CONFIG_ATH9K_SUPPORT_PCOEM \
 	CONFIG_ATH9K_TX99 \


From lede-commits at lists.infradead.org  Wed Apr 12 03:49:25 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 06:49:25 -0400
Subject: [source] mac80211: manually apply dependencies to prevent a
 recoursive one
In-Reply-To: <20170412104925.10269.23935@git-01.infra.lede-project.org>
References: <20170412104925.10269.23935@git-01.infra.lede-project.org>
Message-ID: <mailman.23614.1491994188.26984.lede-commits@lists.infradead.org>

jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/5ba8185866a8d9b2e963551737533eb6208e504b

commit 5ba8185866a8d9b2e963551737533eb6208e504b
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Wed Apr 12 12:44:12 2017 +0200

    mac80211: manually apply dependencies to prevent a recoursive one
    
    Apply the !UML dependency to both the symbol and the DEPENDS so there is
    no recursive dependency anymore.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 package/kernel/mac80211/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 545ecdd..60efdaa 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -687,7 +687,7 @@ define KernelPackage/brcmfmac
   TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
   DEPENDS+= @USB_SUPPORT +kmod-cfg80211 + at DRIVER_11N_SUPPORT + at DRIVER_11AC_SUPPORT +kmod-brcmutil \
-	+BRCMFMAC_SDIO:kmod-mmc \
+	+BRCMFMAC_SDIO&&!TARGET_uml:kmod-mmc \
 	+BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
   AUTOLOAD:=$(call AutoProbe,brcmfmac)
@@ -702,6 +702,7 @@ define KernelPackage/brcmfmac/config
 
 	config BRCMFMAC_SDIO
 		bool "Enable SDIO bus interface support"
+		depends on !TARGET_uml
 		default y if TARGET_brcm2708
 		default n
 		help


From lede-commits at lists.infradead.org  Wed Apr 12 10:14:17 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 13:14:17 -0400
Subject: [source]  busybox: Move libresolv detection to LEDE Makefile
In-Reply-To: <20170412171417.27373.64924@git-01.infra.lede-project.org>
References: <20170412171417.27373.64924@git-01.infra.lede-project.org>
Message-ID: <mailman.23687.1492017280.26984.lede-commits@lists.infradead.org>

florian pushed a commit to source.git, branch master:
https://git.lede-project.org/7ae58bebc811a0ac6734405e9bc47533939d61d7

commit 7ae58bebc811a0ac6734405e9bc47533939d61d7
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Wed Apr 12 09:02:30 2017 -0700

    busybox: Move libresolv detection to LEDE Makefile
    
    Since the LEDE nslookup applet is already specific to LEDE, move the
    libresolv detection into the busybox Makefile that LEDE uses.
    
    This fixes builds with external toolchains that don't automatically
    search for headers and/or libraries without being told so.
    
    Fixes: de5b8e5d2fe1 ("busybox: add musl compatible nslookup replacement")
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 package/utils/busybox/Makefile                         |  6 ++++++
 .../utils/busybox/patches/230-add_nslookup_lede.patch  | 18 ------------------
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index be4b967..c87243b 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -85,6 +85,12 @@ ifdef CONFIG_BUSYBOX_CONFIG_PAM
   LDLIBS += pam pam_misc pthread
 endif
 
+ifdef CONFIG_BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+  ifeq ($(CONFIG_USE_GLIBC),y)
+	LDLIBS += resolv
+  endif
+endif
+
 define Build/Compile
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
 		CC="$(TARGET_CC)" \
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index bff88a6..9e89837 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -12,28 +12,10 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- Makefile.flags             |   6 +
  networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 875 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
-diff --git a/Makefile.flags b/Makefile.flags
-index 65021de..096ab77 100644
---- a/Makefile.flags
-+++ b/Makefile.flags
-@@ -134,6 +134,12 @@ else
- LDLIBS += m
- endif
- 
-+# nslookup_lede might need the resolv library
-+RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
-+ifeq ($(RESOLV_AVAILABLE),y)
-+LDLIBS += resolv
-+endif
-+
- # libpam may use libpthread, libdl and/or libaudit.
- # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
- # However, on *other platforms* it fails when some of those flags
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
 index 0000000..fe927ad


From lede-commits at lists.infradead.org  Wed Apr 12 23:22:22 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:22:22 -0400
Subject: [source]  ramips: add RP-N53 pcie wireless eeprom
In-Reply-To: <20170413062220.29086.62928@git-01.infra.lede-project.org>
References: <20170413062220.29086.62928@git-01.infra.lede-project.org>
Message-ID: <mailman.23732.1492064692.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/b4be4617b5f33b47a5eb00756f939a23cf368145

commit b4be4617b5f33b47a5eb00756f939a23cf368145
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sun Apr 9 09:14:52 2017 +0200

    ramips: add RP-N53 pcie wireless eeprom
    
    Fix the PCIe 5GHz wireless by using the on flash eeprom/caldata.
    Disable the 2.4GHz band as this band has no antennas attached but is
    enabled in the eeprom/caldata.
    
    Fixes: FS#691
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/RP-N53.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/target/linux/ramips/dts/RP-N53.dts b/target/linux/ramips/dts/RP-N53.dts
index 8e9b136..466a072 100644
--- a/target/linux/ramips/dts/RP-N53.dts
+++ b/target/linux/ramips/dts/RP-N53.dts
@@ -162,4 +162,13 @@
 
 &pcie {
 	status = "okay";
+
+	pcie-bridge {
+		wifi at 1814,5592 {
+			compatible = "pci1814,5592";
+			reg = <0x0000 0 0 0 0>;
+			ralink,2ghz = <0>;
+			ralink,mtd-eeprom = <&factory 0x8000>;
+		};
+	};
 };


From lede-commits at lists.infradead.org  Wed Apr 12 23:22:23 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:22:23 -0400
Subject: [source]  ramips: fix Netgear R6220 package selection
In-Reply-To: <20170413062220.29086.62928@git-01.infra.lede-project.org>
References: <20170413062220.29086.62928@git-01.infra.lede-project.org>
Message-ID: <mailman.23733.1492064693.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/ae0facdf1da51bf55942d9f59ee400bf77ee431f

commit ae0facdf1da51bf55942d9f59ee400bf77ee431f
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sun Apr 9 09:58:51 2017 +0200

    ramips: fix Netgear R6220 package selection
    
    The Netgear R6220 requires the kmod-usb3 package and misses
    kmod-usb-ledtrig-usbport package to setup the configured usb led
    trigger.
    
    Drop the already target selected kmod-mt76.
    
    Fixes: FS#686
    
    Fixes: 38bee61dab02 ("ramips: add support for Netgear R6220")
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/image/mt7621.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index a90cf17..8e4ac40 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -131,7 +131,7 @@ define Device/r6220
   IMAGE/kernel.bin := append-kernel
   IMAGE/rootfs.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
   DEVICE_TITLE := Netgear R6220
-  DEVICE_PACKAGES := kmod-usb2 kmod-mt76
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += r6220
 


From lede-commits at lists.infradead.org  Wed Apr 12 23:22:20 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:22:20 -0400
Subject: [source]  ramips: drop rt-n56u factory image
In-Reply-To: <20170413062220.29086.62928@git-01.infra.lede-project.org>
References: <20170413062220.29086.62928@git-01.infra.lede-project.org>
Message-ID: <mailman.23734.1492064694.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/1b5ae141629d15e4c64c01ac82a374039117d69f

commit 1b5ae141629d15e4c64c01ac82a374039117d69f
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Mon Mar 27 21:47:05 2017 +0200

    ramips: drop rt-n56u factory image
    
    The factory image has an uImage header covering the entire image and
    not only the kernel. The original uImage header which covers only the
    kernel is appended to the end of the image.
    
    During LEDE boot the uImage rootfs splitter skips the whole filesystem,
    can't find a valid filesystem magic and panics.
    
    The last known working version was OpenWrt 14.07, which simply kept on
    searching for an uImage header if the first found didn't resulted into
    a working rootfs. This behaviour is kind of error prone since it could
    produce false positives.
    
    Since the sysupgrade image works fine in combination with the tftp
    recovery for doing the initial installation of LEDE, simply drop the
    factory image.
    
    Related: FS#462
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/image/rt3883.mk | 2 --
 1 file changed, 2 deletions(-)

diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk
index 5802689..973eab9 100644
--- a/target/linux/ramips/image/rt3883.mk
+++ b/target/linux/ramips/image/rt3883.mk
@@ -74,8 +74,6 @@ define Device/rt-n56u
   BLOCKSIZE := 64k
   IMAGES += factory.bin
   IMAGE/sysupgrade.bin += | mkrtn56uimg -s
-  IMAGE/factory.bin := 	$$(sysupgrade_bin) | \
-	check-size $$$$(IMAGE_SIZE) | mkrtn56uimg -f
   DEVICE_TITLE := Asus RT-N56U
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
 endef


From lede-commits at lists.infradead.org  Wed Apr 12 23:22:24 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:22:24 -0400
Subject: [source]  ar71xx: fix ath9k default LED changes fallout
In-Reply-To: <20170413062220.29086.62928@git-01.infra.lede-project.org>
References: <20170413062220.29086.62928@git-01.infra.lede-project.org>
Message-ID: <mailman.23735.1492064694.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/e20965811db65eab98adbd0b73c64f94325dfa23

commit e20965811db65eab98adbd0b73c64f94325dfa23
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Apr 12 08:45:19 2017 +0200

    ar71xx: fix ath9k default LED changes fallout
    
    Since 192f0a3db859 ("ath9k: unset the default LED pin if used by
    platform leds") the default ath9k wireless LED is not set as soon as
    any pin of the ath ath9k gpio controller is used.
    
    All touched boards have leds defined which are using the gpio pins
    exposed by the ath9k driver but rely on a default set wireless led
    trigger.
    
    Add the wireless leds were missing and setup the wireless phy trigger
    in userspace.
    
    Signed-off-by: Russell Senior <russell at personaltelco.net>
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds       |  7 +++++++
 .../linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c | 16 +++++-----------
 .../ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c   |  6 +++++-
 .../ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c     |  6 +++++-
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 44d06fc..2f3e5ef 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -743,6 +743,7 @@ tl-wr1043nd-v4)
 	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
 	;;
 tl-wr2543n)
+	ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:green:wlan2g" "phy0tpt"
 	ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
 	;;
 tube2h)
@@ -847,6 +848,8 @@ wpn824n)
 wzr-hp-ag300h)
 	ucidef_set_led_default "diag" "DIAG" "buffalo:red:diag" "0"
 	ucidef_set_led_netdev "router" "ROUTER" "buffalo:green:router" "eth1"
+	ucidef_set_led_wlan "wlan2g" "WLAN2G" "buffalo:amber:band2g" "phy0tpt"
+	ucidef_set_led_wlan "wlan5g" "WLAN5G" "buffalo:amber:band5g" "phy1tpt"
 	ucidef_set_led_usbdev "usb" "USB" "buffalo:green:usb" "1-1"
 	;;
 wzr-hp-g300nh)
@@ -854,6 +857,10 @@ wzr-hp-g300nh)
 	ucidef_set_led_netdev "router" "Router" "buffalo:green:router" "eth1"
 	ucidef_set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1"
 	;;
+wzr-hp-g300nh2|\
+wzr-hp-g450h)
+	ucidef_set_led_wlan "wlan" "Wireless" "buffalo:green:wireless" "phy0tpt"
+	;;
 xd3200)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:blue:wlan2g" "phy1tpt"
 	;;
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c
index 8f6db5e..141914a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c
@@ -60,6 +60,11 @@ static struct gpio_led tl_wr2543n_leds_gpio[] __initdata = {
 
 static struct gpio_led tl_wr2543n_wmac_leds_gpio[] = {
 	{
+		.name		= "tp-link:green:wlan2g",
+		.gpio		= TL_WR2543N_GPIO_WMAC_LED_WLAN2G,
+		.active_low	= 1,
+	},
+	{
 		.name		= "tp-link:green:wlan5g",
 		.gpio		= TL_WR2543N_GPIO_WMAC_LED_WLAN5G,
 		.active_low	= 1,
@@ -125,17 +130,6 @@ static void __init tl_wr2543n_setup(void)
 					tl_wr2543n_gpio_keys);
 	ath79_register_usb();
 
-	/*
-	 * The ath9k driver uses this pin for its default led device, which is
-	 * named ath9k-phy0, and reflects activity on either the 2 GHz or 5 GHz
-	 * bands. This pin is connected to the WR2543's 2GHz WLAN LED.
-	 */
-	ap9x_pci_setup_wmac_led_pin(0, TL_WR2543N_GPIO_WMAC_LED_WLAN2G);
-
-	/*
-	 * We also have the driver set up an led device for the WR2543's
-	 * separate 5 GHz WLAN LED in case the user wants it.
-	 */
 	ap9x_pci_setup_wmac_leds(0, tl_wr2543n_wmac_leds_gpio,
 				 ARRAY_SIZE(tl_wr2543n_wmac_leds_gpio));
 	ap91_pci_init(eeprom, mac);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c
index 2965513..c44a9cf 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c
@@ -75,6 +75,11 @@ static struct gpio_led wzrhpg300nh2_wmac_leds_gpio[] = {
 		.active_low     = 1,
 	},
 	{
+		.name           = "buffalo:green:wireless",
+		.gpio           = 5,
+		.active_low     = 1,
+	},
+	{
 		.name           = "buffalo:orange:security",
 		.gpio           = 6,
 		.active_low     = 1,
@@ -159,7 +164,6 @@ static void __init wzrhpg300nh2_setup(void)
 	ath79_register_gpio_keys_polled(-1, WZRHPG300NH2_KEYS_POLL_INTERVAL,
 					ARRAY_SIZE(wzrhpg300nh2_gpio_keys),
 					wzrhpg300nh2_gpio_keys);
-	ap9x_pci_setup_wmac_led_pin(0, 5);
 	ap9x_pci_setup_wmac_leds(0, wzrhpg300nh2_wmac_leds_gpio,
 				ARRAY_SIZE(wzrhpg300nh2_wmac_leds_gpio));
 
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c
index 53f37b0..5d235c4 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c
@@ -84,6 +84,11 @@ static struct gpio_led wzrhpg450h_wmac_leds_gpio[] = {
 		.gpio		= 14,
 		.active_low	= 1,
 	},
+	{
+		.name		= "buffalo:green:wireless",
+		.gpio		= 15,
+		.active_low	= 1,
+	},
 };
 
 static struct gpio_keys_button wzrhpg450h_gpio_keys[] __initdata = {
@@ -156,7 +161,6 @@ static void __init wzrhpg450h_init(void)
 	ap91_pci_init(ee, NULL);
 	ap9x_pci_get_wmac_data(0)->tx_gain_buffalo = true;
 	ap9x_pci_get_wmac_data(1)->tx_gain_buffalo = true;
-	ap9x_pci_setup_wmac_led_pin(0, 15);
 	ap9x_pci_setup_wmac_leds(0, wzrhpg450h_wmac_leds_gpio,
 				 ARRAY_SIZE(wzrhpg450h_wmac_leds_gpio));
 }


From lede-commits at lists.infradead.org  Wed Apr 12 23:22:21 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:22:21 -0400
Subject: [source]  ramips: fix WHR-600D eeprom dt property
In-Reply-To: <20170413062220.29086.62928@git-01.infra.lede-project.org>
References: <20170413062220.29086.62928@git-01.infra.lede-project.org>
Message-ID: <mailman.23736.1492064694.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/21abb7492c217e7d9959f578a7aab98457e3820a

commit 21abb7492c217e7d9959f578a7aab98457e3820a
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sun Apr 9 09:12:55 2017 +0200

    ramips: fix WHR-600D eeprom dt property
    
    Fix the PCIe 5GHz wireless by using the ralink mtd-eeprom property as
    this board have a RT5592 and uses the rt2x00 driver. The mediathek
    device tree bindings do not work here.
    
    Fixes: FS#691
    
    Fixes: d8dd207ea6f2 ("ramips: use the ralink,mtd-eeprom device tree property")
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/WHR-600D.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/ramips/dts/WHR-600D.dts b/target/linux/ramips/dts/WHR-600D.dts
index 9370d15..1100261 100644
--- a/target/linux/ramips/dts/WHR-600D.dts
+++ b/target/linux/ramips/dts/WHR-600D.dts
@@ -148,10 +148,10 @@
 	status = "okay";
 
 	pcie-bridge {
-		wifi at 1814,3091 {
-			compatible = "pci1814,3091";
+		wifi at 1814,5592 {
+			compatible = "pci1814,5592";
 			reg = <0x0000 0 0 0 0>;
-			mediatek,mtd-eeprom = <&factory 0x8000>;
+			ralink,mtd-eeprom = <&factory 0x8000>;
 		};
 	};
 };


From lede-commits at lists.infradead.org  Wed Apr 12 23:23:10 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:23:10 -0400
Subject: [source]  ramips: fix WHR-600D eeprom dt property
In-Reply-To: <20170413062310.29253.70490@git-01.infra.lede-project.org>
References: <20170413062310.29253.70490@git-01.infra.lede-project.org>
Message-ID: <mailman.23737.1492064740.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/f3dc2ffdd4462dd08220fbafc4ac2971f7ef43b0

commit f3dc2ffdd4462dd08220fbafc4ac2971f7ef43b0
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sun Apr 9 09:12:55 2017 +0200

    ramips: fix WHR-600D eeprom dt property
    
    Fix the PCIe 5GHz wireless by using the ralink mtd-eeprom property as
    this board have a RT5592 and uses the rt2x00 driver. The mediathek
    device tree bindings do not work here.
    
    Fixes: FS#691
    
    Fixes: d8dd207ea6f2 ("ramips: use the ralink,mtd-eeprom device tree property")
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/WHR-600D.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/ramips/dts/WHR-600D.dts b/target/linux/ramips/dts/WHR-600D.dts
index bea67a9..ec91989 100644
--- a/target/linux/ramips/dts/WHR-600D.dts
+++ b/target/linux/ramips/dts/WHR-600D.dts
@@ -149,10 +149,10 @@
 	status = "okay";
 
 	pcie-bridge {
-		wifi at 1814,3091 {
-			compatible = "pci1814,3091";
+		wifi at 1814,5592 {
+			compatible = "pci1814,5592";
 			reg = <0x0000 0 0 0 0>;
-			mediatek,mtd-eeprom = <&factory 0x8000>;
+			ralink,mtd-eeprom = <&factory 0x8000>;
 		};
 	};
 };


From lede-commits at lists.infradead.org  Wed Apr 12 23:23:11 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 02:23:11 -0400
Subject: [source]  ramips: add RP-N53 pcie wireless eeprom
In-Reply-To: <20170413062310.29253.70490@git-01.infra.lede-project.org>
References: <20170413062310.29253.70490@git-01.infra.lede-project.org>
Message-ID: <mailman.23738.1492064740.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/f2f672c32ca32643c6985ff4f7f994934725cd40

commit f2f672c32ca32643c6985ff4f7f994934725cd40
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sun Apr 9 09:14:52 2017 +0200

    ramips: add RP-N53 pcie wireless eeprom
    
    Fix the PCIe 5GHz wireless by using the on flash eeprom/caldata.
    Disable the 2.4GHz band as this band has no antennas attached but is
    enabled in the eeprom/caldata.
    
    Fixes: FS#691
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/RP-N53.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/target/linux/ramips/dts/RP-N53.dts b/target/linux/ramips/dts/RP-N53.dts
index 514481b..fe18b6f 100644
--- a/target/linux/ramips/dts/RP-N53.dts
+++ b/target/linux/ramips/dts/RP-N53.dts
@@ -163,4 +163,13 @@
 
 &pcie {
 	status = "okay";
+
+	pcie-bridge {
+		wifi at 1814,5592 {
+			compatible = "pci1814,5592";
+			reg = <0x0000 0 0 0 0>;
+			ralink,2ghz = <0>;
+			ralink,mtd-eeprom = <&factory 0x8000>;
+		};
+	};
 };


From lede-commits at lists.infradead.org  Thu Apr 13 04:56:16 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 07:56:16 -0400
Subject: [source]  odhcpd: update to version 2017-03-29 (FS#635)
In-Reply-To: <20170413115614.31010.37047@git-01.infra.lede-project.org>
References: <20170413115614.31010.37047@git-01.infra.lede-project.org>
Message-ID: <mailman.23783.1492084597.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/c2999ef592cd130a722c15c7d885ef3ca32a151b

commit c2999ef592cd130a722c15c7d885ef3ca32a151b
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Sat Apr 1 13:56:44 2017 +0200

    odhcpd: update to version 2017-03-29 (FS#635)
    
    3d9f406 rework IPv6 dns address selection (FS#635)
    bc6c3ac ndp: keep an exact copy of IPv6 interface addresses
    6eb1e01 ndp: code cleanup
    eea7d03 rework IPv6 address dump logic
    24d21c7 ndp: add syslog debug tracing
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/odhcpd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index c11a3b8..322460c 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-02-28
-PKG_SOURCE_VERSION:=9eac2a8963415e6a74c2fc13a3c8d05cd0f81d4d
-PKG_MIRROR_HASH:=1f83a3e8722ad8145481ec976f7ce79b50d711f7cd0bcdad61c699b92ef4dca7
+PKG_SOURCE_DATE:=2017-03-29
+PKG_SOURCE_VERSION:=3d9f4067d56660a2c75ab2ce9b801ae1a4ff4cde
+PKG_MIRROR_HASH:=d4ffa35979dbba55a2ce1cc92085ed6a5fb4fa59c2da7412126db1b3a00599e8
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh at gmail.com>
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Thu Apr 13 04:56:14 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 07:56:14 -0400
Subject: [source]  odhcpd: update to version 2017-02-21
In-Reply-To: <20170413115614.31010.37047@git-01.infra.lede-project.org>
References: <20170413115614.31010.37047@git-01.infra.lede-project.org>
Message-ID: <mailman.23784.1492084597.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/425c6d0462ddbe66a93744e39972ff55464be160

commit 425c6d0462ddbe66a93744e39972ff55464be160
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Thu Feb 23 21:56:15 2017 +0100

    odhcpd: update to version 2017-02-21
    
    1b630f8 router: don't announce prefixes with valid lifetime equal to 0
    ba0cac0 router: fix arithmetic exception fault
    3495f17 router: allow RA prefix lifetime being set to leasetime value (FS#397)
    e437ce9 treewide: simplify dhcp leasetime checking
    942fb33 router: support ra_mininterval and ra_lifetime uci parameters (FS#397)
    f913337 router.h: fix alignment style
    4dc7edb Revert "odhcpd.h: fix alignment style"
    62ea54f odhcpd.h: fix alignment style
    a898ee5 config: make loglevel configurable via uci (FS#481)
    51c756c odhcpd: display correct default log level in usage text
    68ee0b5 treewide: define and use macro IN6_IS_ADDR_ULA
    fa57225 ndp: deregister netlink event socket for non recoverable errors
    ac70d28 odhcpd: fix white space errors
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/odhcpd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index b4acb35..bc80ce7 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-02-09
-PKG_SOURCE_VERSION:=8df4253ba73246d31f2e65f2004da3f9890c22c5
-PKG_MIRROR_HASH:=972d0dc4cc99a901eb710313fb0f3908396767952d19cc56b264f83a0a05016d
+PKG_SOURCE_DATE:=2017-02-21
+PKG_SOURCE_VERSION:=1b630f8bc59978884c9caccebca3b6d8e9b045a1
+PKG_MIRROR_HASH:=6bdf164af1e1893f8d34b296e6c50fd433e3a8de5d17394eeb91f38bf2205ff2
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh at gmail.com>
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Thu Apr 13 04:56:15 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 07:56:15 -0400
Subject: [source]  odhcpd: update to version 2017-02-28
In-Reply-To: <20170413115614.31010.37047@git-01.infra.lede-project.org>
References: <20170413115614.31010.37047@git-01.infra.lede-project.org>
Message-ID: <mailman.23787.1492084600.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/a532aaa2aaea71e05487a4248ca948107e9abc5c

commit a532aaa2aaea71e05487a4248ca948107e9abc5c
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Sat Mar 4 13:22:50 2017 -0800

    odhcpd: update to version 2017-02-28
    
    Brings in the following change:
    
    9eac2a896341 dhcpv6-ia: Check lockf return value
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 package/network/services/odhcpd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index bc80ce7..c11a3b8 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-02-21
-PKG_SOURCE_VERSION:=1b630f8bc59978884c9caccebca3b6d8e9b045a1
-PKG_MIRROR_HASH:=6bdf164af1e1893f8d34b296e6c50fd433e3a8de5d17394eeb91f38bf2205ff2
+PKG_SOURCE_DATE:=2017-02-28
+PKG_SOURCE_VERSION:=9eac2a8963415e6a74c2fc13a3c8d05cd0f81d4d
+PKG_MIRROR_HASH:=1f83a3e8722ad8145481ec976f7ce79b50d711f7cd0bcdad61c699b92ef4dca7
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh at gmail.com>
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Thu Apr 13 10:25:35 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 13 Apr 2017 13:25:35 -0400
Subject: [source]  ramips: really drop the rt-n56u factory image
In-Reply-To: <20170413172535.22181.2188@git-01.infra.lede-project.org>
References: <20170413172535.22181.2188@git-01.infra.lede-project.org>
Message-ID: <mailman.23838.1492104357.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/8322dba029034b0a8a2c2dd57250cd225aa5abc9

commit 8322dba029034b0a8a2c2dd57250cd225aa5abc9
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Apr 13 19:20:07 2017 +0200

    ramips: really drop the rt-n56u factory image
    
    Remove the stale reference to the factory image.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/image/rt3883.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk
index 973eab9..2cd60f3 100644
--- a/target/linux/ramips/image/rt3883.mk
+++ b/target/linux/ramips/image/rt3883.mk
@@ -72,7 +72,6 @@ TARGET_DEVICES += hpm
 define Device/rt-n56u
   DTS := RT-N56U
   BLOCKSIZE := 64k
-  IMAGES += factory.bin
   IMAGE/sysupgrade.bin += | mkrtn56uimg -s
   DEVICE_TITLE := Asus RT-N56U
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig


From lede-commits at lists.infradead.org  Fri Apr 14 14:22:34 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 14 Apr 2017 17:22:34 -0400
Subject: [source]  kernel: backport Broadcom thermal drivers
In-Reply-To: <20170414212234.2242.20798@git-01.infra.lede-project.org>
References: <20170414212234.2242.20798@git-01.infra.lede-project.org>
Message-ID: <mailman.24096.1492204984.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch master:
https://git.lede-project.org/74b69ffea7445eb01a95004ae5e33721dc268948

commit 74b69ffea7445eb01a95004ae5e33721dc268948
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Fri Apr 14 18:18:36 2017 +0200

    kernel: backport Broadcom thermal drivers
    
    This includes driver for Northstar and for Raspberry Pi.
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ...thermal-Add-devm-version-of-thermal_zone_.patch | 143 ++++++++
 ...-core-export-apis-to-get-slope-and-offset.patch | 101 ++++++
 ...cm2835-add-thermal-driver-for-bcm2835-SoC.patch | 365 +++++++++++++++++++++
 ...mal-broadcom-add-Northstar-thermal-driver.patch | 173 ++++++++++
 ...adcom-fix-compilation-of-Northstar-driver.patch |  19 ++
 ...cm2835-add-thermal-driver-for-bcm2835-SoC.patch | 365 +++++++++++++++++++++
 ...mal-broadcom-add-Northstar-thermal-driver.patch | 173 ++++++++++
 7 files changed, 1339 insertions(+)

diff --git a/target/linux/generic/patches-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch b/target/linux/generic/patches-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch
new file mode 100644
index 0000000..b551bac
--- /dev/null
+++ b/target/linux/generic/patches-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch
@@ -0,0 +1,143 @@
+From e498b4984db82b4ba3ceea7dba813222a31e9c2e Mon Sep 17 00:00:00 2001
+From: Laxman Dewangan <ldewangan at nvidia.com>
+Date: Wed, 9 Mar 2016 18:40:06 +0530
+Subject: [PATCH] thermal: of-thermal: Add devm version of
+ thermal_zone_of_sensor_register
+
+Add resource managed version of thermal_zone_of_sensor_register() and
+thermal_zone_of_sensor_unregister().
+
+This helps in reducing the code size in error path, remove of
+driver remove callbacks and making proper sequence for deallocations.
+
+Signed-off-by: Laxman Dewangan <ldewangan at nvidia.com>
+Signed-off-by: Eduardo Valentin <edubezval at gmail.com>
+---
+ drivers/thermal/of-thermal.c | 81 ++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/thermal.h      | 18 ++++++++++
+ 2 files changed, 99 insertions(+)
+
+--- a/drivers/thermal/of-thermal.c
++++ b/drivers/thermal/of-thermal.c
+@@ -559,6 +559,87 @@ void thermal_zone_of_sensor_unregister(s
+ }
+ EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_unregister);
+ 
++static void devm_thermal_zone_of_sensor_release(struct device *dev, void *res)
++{
++	thermal_zone_of_sensor_unregister(dev,
++					  *(struct thermal_zone_device **)res);
++}
++
++static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res,
++					     void *data)
++{
++	struct thermal_zone_device **r = res;
++
++	if (WARN_ON(!r || !*r))
++		return 0;
++
++	return *r == data;
++}
++
++/**
++ * devm_thermal_zone_of_sensor_register - Resource managed version of
++ *				thermal_zone_of_sensor_register()
++ * @dev: a valid struct device pointer of a sensor device. Must contain
++ *       a valid .of_node, for the sensor node.
++ * @sensor_id: a sensor identifier, in case the sensor IP has more
++ *	       than one sensors
++ * @data: a private pointer (owned by the caller) that will be passed
++ *	  back, when a temperature reading is needed.
++ * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp.
++ *
++ * Refer thermal_zone_of_sensor_register() for more details.
++ *
++ * Return: On success returns a valid struct thermal_zone_device,
++ * otherwise, it returns a corresponding ERR_PTR(). Caller must
++ * check the return value with help of IS_ERR() helper.
++ * Registered hermal_zone_device device will automatically be
++ * released when device is unbounded.
++ */
++struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
++	struct device *dev, int sensor_id,
++	void *data, const struct thermal_zone_of_device_ops *ops)
++{
++	struct thermal_zone_device **ptr, *tzd;
++
++	ptr = devres_alloc(devm_thermal_zone_of_sensor_release, sizeof(*ptr),
++			   GFP_KERNEL);
++	if (!ptr)
++		return ERR_PTR(-ENOMEM);
++
++	tzd = thermal_zone_of_sensor_register(dev, sensor_id, data, ops);
++	if (IS_ERR(tzd)) {
++		devres_free(ptr);
++		return tzd;
++	}
++
++	*ptr = tzd;
++	devres_add(dev, ptr);
++
++	return tzd;
++}
++EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register);
++
++/**
++ * devm_thermal_zone_of_sensor_unregister - Resource managed version of
++ *				thermal_zone_of_sensor_unregister().
++ * @dev: Device for which which resource was allocated.
++ * @tzd: a pointer to struct thermal_zone_device where the sensor is registered.
++ *
++ * This function removes the sensor callbacks and private data from the
++ * thermal zone device registered with devm_thermal_zone_of_sensor_register()
++ * API. It will also silent the zone by remove the .get_temp() and .get_trend()
++ * thermal zone device callbacks.
++ * Normally this function will not need to be called and the resource
++ * management code will ensure that the resource is freed.
++ */
++void devm_thermal_zone_of_sensor_unregister(struct device *dev,
++					    struct thermal_zone_device *tzd)
++{
++	WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release,
++			       devm_thermal_zone_of_sensor_match, tzd));
++}
++EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_unregister);
++
+ /***   functions parsing device tree nodes   ***/
+ 
+ /**
+--- a/include/linux/thermal.h
++++ b/include/linux/thermal.h
+@@ -364,6 +364,11 @@ thermal_zone_of_sensor_register(struct d
+ 				const struct thermal_zone_of_device_ops *ops);
+ void thermal_zone_of_sensor_unregister(struct device *dev,
+ 				       struct thermal_zone_device *tz);
++struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
++		struct device *dev, int id, void *data,
++		const struct thermal_zone_of_device_ops *ops);
++void devm_thermal_zone_of_sensor_unregister(struct device *dev,
++					    struct thermal_zone_device *tz);
+ #else
+ static inline struct thermal_zone_device *
+ thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
+@@ -378,6 +383,19 @@ void thermal_zone_of_sensor_unregister(s
+ {
+ }
+ 
++static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
++		struct device *dev, int id, void *data,
++		const struct thermal_zone_of_device_ops *ops)
++{
++	return ERR_PTR(-ENODEV);
++}
++
++static inline
++void devm_thermal_zone_of_sensor_unregister(struct device *dev,
++					    struct thermal_zone_device *tz)
++{
++}
++
+ #endif
+ 
+ #if IS_ENABLED(CONFIG_THERMAL)
diff --git a/target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch b/target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch
new file mode 100644
index 0000000..3fbe5f5
--- /dev/null
+++ b/target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch
@@ -0,0 +1,101 @@
+From 4a7069a32c99a81950de035535b0a064dcceaeba Mon Sep 17 00:00:00 2001
+From: Rajendra Nayak <rnayak at codeaurora.org>
+Date: Thu, 5 May 2016 14:21:42 +0530
+Subject: [PATCH] thermal: core: export apis to get slope and offset
+
+Add apis for platform thermal drivers to query for slope and offset
+attributes, which might be needed for temperature calculations.
+
+Signed-off-by: Rajendra Nayak <rnayak at codeaurora.org>
+Signed-off-by: Eduardo Valentin <edubezval at gmail.com>
+Signed-off-by: Zhang Rui <rui.zhang at intel.com>
+---
+ Documentation/thermal/sysfs-api.txt | 12 ++++++++++++
+ drivers/thermal/thermal_core.c      | 30 ++++++++++++++++++++++++++++++
+ include/linux/thermal.h             |  8 ++++++++
+ 3 files changed, 50 insertions(+)
+
+--- a/Documentation/thermal/sysfs-api.txt
++++ b/Documentation/thermal/sysfs-api.txt
+@@ -72,6 +72,18 @@ temperature) and throttle appropriate de
+     It deletes the corresponding entry form /sys/class/thermal folder and
+     unbind all the thermal cooling devices it uses.
+ 
++1.1.7 int thermal_zone_get_slope(struct thermal_zone_device *tz)
++
++	This interface is used to read the slope attribute value
++	for the thermal zone device, which might be useful for platform
++	drivers for temperature calculations.
++
++1.1.8 int thermal_zone_get_offset(struct thermal_zone_device *tz)
++
++	This interface is used to read the offset attribute value
++	for the thermal zone device, which might be useful for platform
++	drivers for temperature calculations.
++
+ 1.2 thermal cooling device interface
+ 1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name,
+ 		void *devdata, struct thermal_cooling_device_ops *)
+--- a/drivers/thermal/thermal_core.c
++++ b/drivers/thermal/thermal_core.c
+@@ -2061,6 +2061,36 @@ exit:
+ }
+ EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name);
+ 
++/**
++ * thermal_zone_get_slope - return the slope attribute of the thermal zone
++ * @tz: thermal zone device with the slope attribute
++ *
++ * Return: If the thermal zone device has a slope attribute, return it, else
++ * return 1.
++ */
++int thermal_zone_get_slope(struct thermal_zone_device *tz)
++{
++	if (tz && tz->tzp)
++		return tz->tzp->slope;
++	return 1;
++}
++EXPORT_SYMBOL_GPL(thermal_zone_get_slope);
++
++/**
++ * thermal_zone_get_offset - return the offset attribute of the thermal zone
++ * @tz: thermal zone device with the offset attribute
++ *
++ * Return: If the thermal zone device has a offset attribute, return it, else
++ * return 0.
++ */
++int thermal_zone_get_offset(struct thermal_zone_device *tz)
++{
++	if (tz && tz->tzp)
++		return tz->tzp->offset;
++	return 0;
++}
++EXPORT_SYMBOL_GPL(thermal_zone_get_offset);
++
+ #ifdef CONFIG_NET
+ static const struct genl_multicast_group thermal_event_mcgrps[] = {
+ 	{ .name = THERMAL_GENL_MCAST_GROUP_NAME, },
+--- a/include/linux/thermal.h
++++ b/include/linux/thermal.h
+@@ -432,6 +432,8 @@ thermal_of_cooling_device_register(struc
+ void thermal_cooling_device_unregister(struct thermal_cooling_device *);
+ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
+ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
++int thermal_zone_get_slope(struct thermal_zone_device *tz);
++int thermal_zone_get_offset(struct thermal_zone_device *tz);
+ 
+ int get_tz_trend(struct thermal_zone_device *, int);
+ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
+@@ -489,6 +491,12 @@ static inline struct thermal_zone_device
+ static inline int thermal_zone_get_temp(
+ 		struct thermal_zone_device *tz, int *temp)
+ { return -ENODEV; }
++static inline int thermal_zone_get_slope(
++		struct thermal_zone_device *tz)
++{ return -ENODEV; }
++static inline int thermal_zone_get_offset(
++		struct thermal_zone_device *tz)
++{ return -ENODEV; }
+ static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
+ { return -ENODEV; }
+ static inline struct thermal_instance *
diff --git a/target/linux/generic/patches-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch b/target/linux/generic/patches-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch
new file mode 100644
index 0000000..d606804
--- /dev/null
+++ b/target/linux/generic/patches-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch
@@ -0,0 +1,365 @@
+From bcb7dd9ef206f7d646ed8dac6fe7772083714253 Mon Sep 17 00:00:00 2001
+From: Stefan Wahren <stefan.wahren at i2se.com>
+Date: Fri, 31 Mar 2017 20:03:06 +0000
+Subject: [PATCH] thermal: bcm2835: add thermal driver for bcm2835 SoC
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add basic thermal driver for bcm2835 SoC.
+
+This driver currently make sure that tsense HW block is set up
+correctly.
+
+Tested-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Martin Sperl <kernel at martin.sperl.org>
+Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
+Acked-by: Eric Anholt <eric at anholt.net>
+Acked-by: Eduardo Valentin <edubezval at gmail.com>
+Signed-off-by: Eduardo Valentin <edubezval at gmail.com>
+---
+ drivers/thermal/Kconfig           |   8 +
+ drivers/thermal/Makefile          |   1 +
+ drivers/thermal/bcm2835_thermal.c | 314 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 323 insertions(+)
+ create mode 100644 drivers/thermal/bcm2835_thermal.c
+
+--- a/drivers/thermal/Kconfig
++++ b/drivers/thermal/Kconfig
+@@ -391,4 +391,12 @@ config QCOM_SPMI_TEMP_ALARM
+ 	  real time die temperature if an ADC is present or an estimate of the
+ 	  temperature based upon the over temperature stage value.
+ 
++config BCM2835_THERMAL
++	tristate "Thermal sensors on bcm2835 SoC"
++	depends on ARCH_BCM2835 || COMPILE_TEST
++	depends on HAS_IOMEM
++	depends on THERMAL_OF
++	help
++	  Support for thermal sensors on Broadcom bcm2835 SoCs.
++
+ endif
+--- a/drivers/thermal/Makefile
++++ b/drivers/thermal/Makefile
+@@ -48,3 +48,4 @@ obj-$(CONFIG_INTEL_PCH_THERMAL)	+= intel
+ obj-$(CONFIG_ST_THERMAL)	+= st/
+ obj-$(CONFIG_TEGRA_SOCTHERM)	+= tegra_soctherm.o
+ obj-$(CONFIG_HISI_THERMAL)     += hisi_thermal.o
++obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o
+--- /dev/null
++++ b/drivers/thermal/bcm2835_thermal.c
+@@ -0,0 +1,314 @@
++/*
++ * Driver for Broadcom BCM2835 SoC temperature sensor
++ *
++ * Copyright (C) 2016 Martin Sperl
++ *
++ * 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; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ */
++
++#include <linux/clk.h>
++#include <linux/debugfs.h>
++#include <linux/device.h>
++#include <linux/err.h>
++#include <linux/io.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/of_address.h>
++#include <linux/of_device.h>
++#include <linux/platform_device.h>
++#include <linux/thermal.h>
++
++#define BCM2835_TS_TSENSCTL			0x00
++#define BCM2835_TS_TSENSSTAT			0x04
++
++#define BCM2835_TS_TSENSCTL_PRWDW		BIT(0)
++#define BCM2835_TS_TSENSCTL_RSTB		BIT(1)
++
++/*
++ * bandgap reference voltage in 6 mV increments
++ * 000b = 1178 mV, 001b = 1184 mV, ... 111b = 1220 mV
++ */
++#define BCM2835_TS_TSENSCTL_CTRL_BITS		3
++#define BCM2835_TS_TSENSCTL_CTRL_SHIFT		2
++#define BCM2835_TS_TSENSCTL_CTRL_MASK		    \
++	GENMASK(BCM2835_TS_TSENSCTL_CTRL_BITS +     \
++		BCM2835_TS_TSENSCTL_CTRL_SHIFT - 1, \
++		BCM2835_TS_TSENSCTL_CTRL_SHIFT)
++#define BCM2835_TS_TSENSCTL_CTRL_DEFAULT	1
++#define BCM2835_TS_TSENSCTL_EN_INT		BIT(5)
++#define BCM2835_TS_TSENSCTL_DIRECT		BIT(6)
++#define BCM2835_TS_TSENSCTL_CLR_INT		BIT(7)
++#define BCM2835_TS_TSENSCTL_THOLD_SHIFT		8
++#define BCM2835_TS_TSENSCTL_THOLD_BITS		10
++#define BCM2835_TS_TSENSCTL_THOLD_MASK		     \
++	GENMASK(BCM2835_TS_TSENSCTL_THOLD_BITS +     \
++		BCM2835_TS_TSENSCTL_THOLD_SHIFT - 1, \
++		BCM2835_TS_TSENSCTL_THOLD_SHIFT)
++/*
++ * time how long the block to be asserted in reset
++ * which based on a clock counter (TSENS clock assumed)
++ */
++#define BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT	18
++#define BCM2835_TS_TSENSCTL_RSTDELAY_BITS	8
++#define BCM2835_TS_TSENSCTL_REGULEN		BIT(26)
++
++#define BCM2835_TS_TSENSSTAT_DATA_BITS		10
++#define BCM2835_TS_TSENSSTAT_DATA_SHIFT		0
++#define BCM2835_TS_TSENSSTAT_DATA_MASK		     \
++	GENMASK(BCM2835_TS_TSENSSTAT_DATA_BITS +     \
++		BCM2835_TS_TSENSSTAT_DATA_SHIFT - 1, \
++		BCM2835_TS_TSENSSTAT_DATA_SHIFT)
++#define BCM2835_TS_TSENSSTAT_VALID		BIT(10)
++#define BCM2835_TS_TSENSSTAT_INTERRUPT		BIT(11)
++
++struct bcm2835_thermal_data {
++	struct thermal_zone_device *tz;
++	void __iomem *regs;
++	struct clk *clk;
++	struct dentry *debugfsdir;
++};
++
++static int bcm2835_thermal_adc2temp(u32 adc, int offset, int slope)
++{
++	return offset + slope * adc;
++}
++
++static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)
++{
++	temp -= offset;
++	temp /= slope;
++
++	if (temp < 0)
++		temp = 0;
++	if (temp >= BIT(BCM2835_TS_TSENSSTAT_DATA_BITS))
++		temp = BIT(BCM2835_TS_TSENSSTAT_DATA_BITS) - 1;
++
++	return temp;
++}
++
++static int bcm2835_thermal_get_temp(void *d, int *temp)
++{
++	struct bcm2835_thermal_data *data = d;
++	u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT);
++
++	if (!(val & BCM2835_TS_TSENSSTAT_VALID))
++		return -EIO;
++
++	val &= BCM2835_TS_TSENSSTAT_DATA_MASK;
++
++	*temp = bcm2835_thermal_adc2temp(
++		val,
++		thermal_zone_get_offset(data->tz),
++		thermal_zone_get_slope(data->tz));
++
++	return 0;
++}
++
++static const struct debugfs_reg32 bcm2835_thermal_regs[] = {
++	{
++		.name = "ctl",
++		.offset = 0
++	},
++	{
++		.name = "stat",
++		.offset = 4
++	}
++};
++
++static void bcm2835_thermal_debugfs(struct platform_device *pdev)
++{
++	struct thermal_zone_device *tz = platform_get_drvdata(pdev);
++	struct bcm2835_thermal_data *data = tz->devdata;
++	struct debugfs_regset32 *regset;
++
++	data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL);
++	if (!data->debugfsdir)
++		return;
++
++	regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL);
++	if (!regset)
++		return;
++
++	regset->regs = bcm2835_thermal_regs;
++	regset->nregs = ARRAY_SIZE(bcm2835_thermal_regs);
++	regset->base = data->regs;
++
++	debugfs_create_regset32("regset", 0444, data->debugfsdir, regset);
++}
++
++static struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
++	.get_temp = bcm2835_thermal_get_temp,
++};
++
++/*
++ * Note: as per Raspberry Foundation FAQ
++ * (https://www.raspberrypi.org/help/faqs/#performanceOperatingTemperature)
++ * the recommended temperature range for the SoC -40C to +85C
++ * so the trip limit is set to 80C.
++ * this applies to all the BCM283X SoC
++ */
++
++static const struct of_device_id bcm2835_thermal_of_match_table[] = {
++	{
++		.compatible = "brcm,bcm2835-thermal",
++	},
++	{
++		.compatible = "brcm,bcm2836-thermal",
++	},
++	{
++		.compatible = "brcm,bcm2837-thermal",
++	},
++	{},
++};
++MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table);
++
++static int bcm2835_thermal_probe(struct platform_device *pdev)
++{
++	const struct of_device_id *match;
++	struct thermal_zone_device *tz;
++	struct bcm2835_thermal_data *data;
++	struct resource *res;
++	int err = 0;
++	u32 val;
++	unsigned long rate;
++
++	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
++	if (!data)
++		return -ENOMEM;
++
++	match = of_match_device(bcm2835_thermal_of_match_table,
++				&pdev->dev);
++	if (!match)
++		return -EINVAL;
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++	data->regs = devm_ioremap_resource(&pdev->dev, res);
++	if (IS_ERR(data->regs)) {
++		err = PTR_ERR(data->regs);
++		dev_err(&pdev->dev, "Could not get registers: %d\n", err);
++		return err;
++	}
++
++	data->clk = devm_clk_get(&pdev->dev, NULL);
++	if (IS_ERR(data->clk)) {
++		err = PTR_ERR(data->clk);
++		if (err != -EPROBE_DEFER)
++			dev_err(&pdev->dev, "Could not get clk: %d\n", err);
++		return err;
++	}
++
++	err = clk_prepare_enable(data->clk);
++	if (err)
++		return err;
++
++	rate = clk_get_rate(data->clk);
++	if ((rate < 1920000) || (rate > 5000000))
++		dev_warn(&pdev->dev,
++			 "Clock %pCn running at %pCr Hz is outside of the recommended range: 1.92 to 5MHz\n",
++			 data->clk, data->clk);
++
++	/* register of thermal sensor and get info from DT */
++	tz = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
++					     &bcm2835_thermal_ops);
++	if (IS_ERR(tz)) {
++		err = PTR_ERR(tz);
++		dev_err(&pdev->dev,
++			"Failed to register the thermal device: %d\n",
++			err);
++		goto err_clk;
++	}
++
++	/*
++	 * right now the FW does set up the HW-block, so we are not
++	 * touching the configuration registers.
++	 * But if the HW is not enabled, then set it up
++	 * using "sane" values used by the firmware right now.
++	 */
++	val = readl(data->regs + BCM2835_TS_TSENSCTL);
++	if (!(val & BCM2835_TS_TSENSCTL_RSTB)) {
++		int trip_temp, offset, slope;
++
++		slope = thermal_zone_get_slope(tz);
++		offset = thermal_zone_get_offset(tz);
++		/*
++		 * For now we deal only with critical, otherwise
++		 * would need to iterate
++		 */
++		err = tz->ops->get_trip_temp(tz, 0, &trip_temp);
++		if (err < 0) {
++			err = PTR_ERR(tz);
++			dev_err(&pdev->dev,
++				"Not able to read trip_temp: %d\n",
++				err);
++			goto err_tz;
++		}
++
++		/* set bandgap reference voltage and enable voltage regulator */
++		val = (BCM2835_TS_TSENSCTL_CTRL_DEFAULT <<
++		       BCM2835_TS_TSENSCTL_CTRL_SHIFT) |
++		      BCM2835_TS_TSENSCTL_REGULEN;
++
++		/* use the recommended reset duration */
++		val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT);
++
++		/*  trip_adc value from info */
++		val |= bcm2835_thermal_temp2adc(trip_temp,
++						offset,
++						slope)
++			<< BCM2835_TS_TSENSCTL_THOLD_SHIFT;
++
++		/* write the value back to the register as 2 steps */
++		writel(val, data->regs + BCM2835_TS_TSENSCTL);
++		val |= BCM2835_TS_TSENSCTL_RSTB;
++		writel(val, data->regs + BCM2835_TS_TSENSCTL);
++	}
++
++	data->tz = tz;
++
++	platform_set_drvdata(pdev, tz);
++
++	bcm2835_thermal_debugfs(pdev);
++
++	return 0;
++err_tz:
++	thermal_zone_of_sensor_unregister(&pdev->dev, tz);
++err_clk:
++	clk_disable_unprepare(data->clk);
++
++	return err;
++}
++
++static int bcm2835_thermal_remove(struct platform_device *pdev)
++{
++	struct thermal_zone_device *tz = platform_get_drvdata(pdev);
++	struct bcm2835_thermal_data *data = tz->devdata;
++
++	debugfs_remove_recursive(data->debugfsdir);
++	thermal_zone_of_sensor_unregister(&pdev->dev, tz);
++	clk_disable_unprepare(data->clk);
++
++	return 0;
++}
++
++static struct platform_driver bcm2835_thermal_driver = {
++	.probe = bcm2835_thermal_probe,
++	.remove = bcm2835_thermal_remove,
++	.driver = {
++		.name = "bcm2835_thermal",
++		.of_match_table = bcm2835_thermal_of_match_table,
++	},
++};
++module_platform_driver(bcm2835_thermal_driver);
++
++MODULE_AUTHOR("Martin Sperl");
++MODULE_DESCRIPTION("Thermal driver for bcm2835 chip");
++MODULE_LICENSE("GPL");
diff --git a/target/linux/generic/patches-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch b/target/linux/generic/patches-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch
new file mode 100644
index 0000000..1821096
--- /dev/null
+++ b/target/linux/generic/patches-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch
@@ -0,0 +1,173 @@
+From a94cb7eeecc4104a6874339f90c5d0647359c102 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Mon, 3 Apr 2017 17:48:29 +0200
+Subject: [PATCH] thermal: broadcom: add Northstar thermal driver
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Northstar is a SoC family commonly used in home routers. This commit
+adds a driver for checking CPU temperature. As Northstar Plus seems to
+also have this IP block this new symbol gets ARCH_BCM_IPROC dependency.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Jon Mason <jon.mason at broadcom.com>
+Signed-off-by: Eduardo Valentin <edubezval at gmail.com>
+---
+ drivers/thermal/Kconfig               |   5 ++
+ drivers/thermal/Makefile              |   1 +
+ drivers/thermal/broadcom/Kconfig      |   8 +++
+ drivers/thermal/broadcom/Makefile     |   1 +
+ drivers/thermal/broadcom/ns-thermal.c | 105 ++++++++++++++++++++++++++++++++++
+ 5 files changed, 120 insertions(+)
+ create mode 100644 drivers/thermal/broadcom/Kconfig
+ create mode 100644 drivers/thermal/broadcom/Makefile
+ create mode 100644 drivers/thermal/broadcom/ns-thermal.c
+
+--- a/drivers/thermal/Kconfig
++++ b/drivers/thermal/Kconfig
+@@ -365,6 +365,11 @@ config INTEL_PCH_THERMAL
+ 	  Thermal reporting device will provide temperature reading,
+ 	  programmable trip points and other information.
+ 
++menu "Broadcom thermal drivers"
++depends on ARCH_BCM || COMPILE_TEST
++source "drivers/thermal/broadcom/Kconfig"
++endmenu
++
+ menu "Texas Instruments thermal drivers"
+ depends on ARCH_HAS_BANDGAP || COMPILE_TEST
+ source "drivers/thermal/ti-soc-thermal/Kconfig"
+--- a/drivers/thermal/Makefile
++++ b/drivers/thermal/Makefile
+@@ -26,6 +26,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL)	+= c
+ thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
+ 
+ # platform thermal drivers
++obj-y				+= broadcom/
+ obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM)	+= qcom-spmi-temp-alarm.o
+ obj-$(CONFIG_SPEAR_THERMAL)	+= spear_thermal.o
+ obj-$(CONFIG_ROCKCHIP_THERMAL)	+= rockchip_thermal.o
+--- /dev/null
++++ b/drivers/thermal/broadcom/Kconfig
+@@ -0,0 +1,8 @@
++config BCM_NS_THERMAL
++	tristate "Northstar thermal driver"
++	depends on ARCH_BCM_IPROC || COMPILE_TEST
++	help
++	  Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
++	  BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
++	  with a thermal sensor that allows checking CPU temperature. This
++	  driver provides support for it.
+--- /dev/null
++++ b/drivers/thermal/broadcom/Makefile
+@@ -0,0 +1 @@
++obj-$(CONFIG_BCM_NS_THERMAL)		+= ns-thermal.o
+--- /dev/null
++++ b/drivers/thermal/broadcom/ns-thermal.c
+@@ -0,0 +1,105 @@
++/*
++ * Copyright (C) 2017 Rafa? Mi?ecki <rafal at milecki.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++
++#include <linux/module.h>
++#include <linux/of_address.h>
++#include <linux/platform_device.h>
++#include <linux/thermal.h>
++
++#define PVTMON_CONTROL0					0x00
++#define PVTMON_CONTROL0_SEL_MASK			0x0000000e
++#define PVTMON_CONTROL0_SEL_TEMP_MONITOR		0x00000000
++#define PVTMON_CONTROL0_SEL_TEST_MODE			0x0000000e
++#define PVTMON_STATUS					0x08
++
++struct ns_thermal {
++	struct thermal_zone_device *tz;
++	void __iomem *pvtmon;
++};
++
++static int ns_thermal_get_temp(void *data, int *temp)
++{
++	struct ns_thermal *ns_thermal = data;
++	int offset = thermal_zone_get_offset(ns_thermal->tz);
++	int slope = thermal_zone_get_slope(ns_thermal->tz);
++	u32 val;
++
++	val = readl(ns_thermal->pvtmon + PVTMON_CONTROL0);
++	if ((val & PVTMON_CONTROL0_SEL_MASK) != PVTMON_CONTROL0_SEL_TEMP_MONITOR) {
++		/* Clear current mode selection */
++		val &= ~PVTMON_CONTROL0_SEL_MASK;
++
++		/* Set temp monitor mode (it's the default actually) */
++		val |= PVTMON_CONTROL0_SEL_TEMP_MONITOR;
++
++		writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0);
++	}
++
++	val = readl(ns_thermal->pvtmon + PVTMON_STATUS);
++	*temp = slope * val + offset;
++
++	return 0;
++}
++
++static const struct thermal_zone_of_device_ops ns_thermal_ops = {
++	.get_temp = ns_thermal_get_temp,
++};
++
++static int ns_thermal_probe(struct platform_device *pdev)
++{
++	struct device *dev = &pdev->dev;
++	struct ns_thermal *ns_thermal;
++
++	ns_thermal = devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL);
++	if (!ns_thermal)
++		return -ENOMEM;
++
++	ns_thermal->pvtmon = of_iomap(dev_of_node(dev), 0);
++	if (WARN_ON(!ns_thermal->pvtmon))
++		return -ENOENT;
++
++	ns_thermal->tz = devm_thermal_zone_of_sensor_register(dev, 0,
++							      ns_thermal,
++							      &ns_thermal_ops);
++	if (IS_ERR(ns_thermal->tz)) {
++		iounmap(ns_thermal->pvtmon);
++		return PTR_ERR(ns_thermal->tz);
++	}
++
++	platform_set_drvdata(pdev, ns_thermal);
++
++	return 0;
++}
++
++static int ns_thermal_remove(struct platform_device *pdev)
++{
++	struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
++
++	iounmap(ns_thermal->pvtmon);
++
++	return 0;
++}
++
++static const struct of_device_id ns_thermal_of_match[] = {
++	{ .compatible = "brcm,ns-thermal", },
++	{},
++};
++MODULE_DEVICE_TABLE(of, ns_thermal_of_match);
++
++static struct platform_driver ns_thermal_driver = {
++	.probe		= ns_thermal_probe,
++	.remove		= ns_thermal_remove,
++	.driver = {
++		.name = "ns-thermal",
++		.of_match_table = ns_thermal_of_match,
++	},
++};
++module_platform_driver(ns_thermal_driver);
++
++MODULE_DESCRIPTION("Northstar thermal driver");
++MODULE_LICENSE("GPL v2");
diff --git a/target/linux/generic/patches-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch b/target/linux/generic/patches-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch
new file mode 100644
index 0000000..62bfffe
--- /dev/null
+++ b/target/linux/generic/patches-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch
@@ -0,0 +1,19 @@
+From d44264c8735f79da3253520024841311c555ca31 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Fri, 14 Apr 2017 22:25:12 +0200
+Subject: [PATCH] thermal: broadcom: fix compilation of Northstar driver
+
+---
+ drivers/thermal/broadcom/ns-thermal.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/thermal/broadcom/ns-thermal.c
++++ b/drivers/thermal/broadcom/ns-thermal.c
+@@ -6,6 +6,7 @@
+  * published by the Free Software Foundation.
+  */
+ 
++#include <asm/io.h>
+ #include <linux/module.h>
+ #include <linux/of_address.h>
+ #include <linux/platform_device.h>
diff --git a/target/linux/generic/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch b/target/linux/generic/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch
new file mode 100644
index 0000000..d1ef21e
--- /dev/null
+++ b/target/linux/generic/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch
@@ -0,0 +1,365 @@
+From bcb7dd9ef206f7d646ed8dac6fe7772083714253 Mon Sep 17 00:00:00 2001
+From: Stefan Wahren <stefan.wahren at i2se.com>
+Date: Fri, 31 Mar 2017 20:03:06 +0000
+Subject: [PATCH] thermal: bcm2835: add thermal driver for bcm2835 SoC
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add basic thermal driver for bcm2835 SoC.
+
+This driver currently make sure that tsense HW block is set up
+correctly.
+
+Tested-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Martin Sperl <kernel at martin.sperl.org>
+Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
+Acked-by: Eric Anholt <eric at anholt.net>
+Acked-by: Eduardo Valentin <edubezval at gmail.com>
+Signed-off-by: Eduardo Valentin <edubezval at gmail.com>
+---
+ drivers/thermal/Kconfig           |   8 +
+ drivers/thermal/Makefile          |   1 +
+ drivers/thermal/bcm2835_thermal.c | 314 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 323 insertions(+)
+ create mode 100644 drivers/thermal/bcm2835_thermal.c
+
+--- a/drivers/thermal/Kconfig
++++ b/drivers/thermal/Kconfig
+@@ -434,4 +434,12 @@ depends on (ARCH_QCOM && OF) || COMPILE_
+ source "drivers/thermal/qcom/Kconfig"
+ endmenu
+ 
++config BCM2835_THERMAL
++	tristate "Thermal sensors on bcm2835 SoC"
++	depends on ARCH_BCM2835 || COMPILE_TEST
++	depends on HAS_IOMEM
++	depends on THERMAL_OF
++	help
++	  Support for thermal sensors on Broadcom bcm2835 SoCs.
++
+ endif
+--- a/drivers/thermal/Makefile
++++ b/drivers/thermal/Makefile
+@@ -55,3 +55,4 @@ obj-$(CONFIG_TEGRA_SOCTHERM)	+= tegra/
+ obj-$(CONFIG_HISI_THERMAL)     += hisi_thermal.o
+ obj-$(CONFIG_MTK_THERMAL)	+= mtk_thermal.o
+ obj-$(CONFIG_GENERIC_ADC_THERMAL)	+= thermal-generic-adc.o
++obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o
+--- /dev/null
++++ b/drivers/thermal/bcm2835_thermal.c
+@@ -0,0 +1,314 @@
++/*
++ * Driver for Broadcom BCM2835 SoC temperature sensor
++ *
++ * Copyright (C) 2016 Martin Sperl
++ *
++ * 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; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ */
++
++#include <linux/clk.h>
++#include <linux/debugfs.h>
++#include <linux/device.h>
++#include <linux/err.h>
++#include <linux/io.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/of_address.h>
++#include <linux/of_device.h>
++#include <linux/platform_device.h>
++#include <linux/thermal.h>
++
++#define BCM2835_TS_TSENSCTL			0x00
++#define BCM2835_TS_TSENSSTAT			0x04
++
++#define BCM2835_TS_TSENSCTL_PRWDW		BIT(0)
++#define BCM2835_TS_TSENSCTL_RSTB		BIT(1)
++
++/*
++ * bandgap reference voltage in 6 mV increments
++ * 000b = 1178 mV, 001b = 1184 mV, ... 111b = 1220 mV
++ */
++#define BCM2835_TS_TSENSCTL_CTRL_BITS		3
++#define BCM2835_TS_TSENSCTL_CTRL_SHIFT		2
++#define BCM2835_TS_TSENSCTL_CTRL_MASK		    \
++	GENMASK(BCM2835_TS_TSENSCTL_CTRL_BITS +     \
++		BCM2835_TS_TSENSCTL_CTRL_SHIFT - 1, \
++		BCM2835_TS_TSENSCTL_CTRL_SHIFT)
++#define BCM2835_TS_TSENSCTL_CTRL_DEFAULT	1
++#define BCM2835_TS_TSENSCTL_EN_INT		BIT(5)
++#define BCM2835_TS_TSENSCTL_DIRECT		BIT(6)
++#define BCM2835_TS_TSENSCTL_CLR_INT		BIT(7)
++#define BCM2835_TS_TSENSCTL_THOLD_SHIFT		8
++#define BCM2835_TS_TSENSCTL_THOLD_BITS		10
++#define BCM2835_TS_TSENSCTL_THOLD_MASK		     \
++	GENMASK(BCM2835_TS_TSENSCTL_THOLD_BITS +     \
++		BCM2835_TS_TSENSCTL_THOLD_SHIFT - 1, \
++		BCM2835_TS_TSENSCTL_THOLD_SHIFT)
++/*
++ * time how long the block to be asserted in reset
++ * which based on a clock counter (TSENS clock assumed)
++ */
++#define BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT	18
++#define BCM2835_TS_TSENSCTL_RSTDELAY_BITS	8
++#define BCM2835_TS_TSENSCTL_REGULEN		BIT(26)
++
++#define BCM2835_TS_TSENSSTAT_DATA_BITS		10
++#define BCM2835_TS_TSENSSTAT_DATA_SHIFT		0
++#define BCM2835_TS_TSENSSTAT_DATA_MASK		     \
++	GENMASK(BCM2835_TS_TSENSSTAT_DATA_BITS +     \
++		BCM2835_TS_TSENSSTAT_DATA_SHIFT - 1, \
++		BCM2835_TS_TSENSSTAT_DATA_SHIFT)
++#define BCM2835_TS_TSENSSTAT_VALID		BIT(10)
++#define BCM2835_TS_TSENSSTAT_INTERRUPT		BIT(11)
++
++struct bcm2835_thermal_data {
++	struct thermal_zone_device *tz;
++	void __iomem *regs;
++	struct clk *clk;
++	struct dentry *debugfsdir;
++};
++
++static int bcm2835_thermal_adc2temp(u32 adc, int offset, int slope)
++{
++	return offset + slope * adc;
++}
++
++static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)
++{
++	temp -= offset;
++	temp /= slope;
++
++	if (temp < 0)
++		temp = 0;
++	if (temp >= BIT(BCM2835_TS_TSENSSTAT_DATA_BITS))
++		temp = BIT(BCM2835_TS_TSENSSTAT_DATA_BITS) - 1;
++
++	return temp;
++}
++
++static int bcm2835_thermal_get_temp(void *d, int *temp)
++{
++	struct bcm2835_thermal_data *data = d;
++	u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT);
++
++	if (!(val & BCM2835_TS_TSENSSTAT_VALID))
++		return -EIO;
++
++	val &= BCM2835_TS_TSENSSTAT_DATA_MASK;
++
++	*temp = bcm2835_thermal_adc2temp(
++		val,
++		thermal_zone_get_offset(data->tz),
++		thermal_zone_get_slope(data->tz));
++
++	return 0;
++}
++
++static const struct debugfs_reg32 bcm2835_thermal_regs[] = {
++	{
++		.name = "ctl",
++		.offset = 0
++	},
++	{
++		.name = "stat",
++		.offset = 4
++	}
++};
++
++static void bcm2835_thermal_debugfs(struct platform_device *pdev)
++{
++	struct thermal_zone_device *tz = platform_get_drvdata(pdev);
++	struct bcm2835_thermal_data *data = tz->devdata;
++	struct debugfs_regset32 *regset;
++
++	data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL);
++	if (!data->debugfsdir)
++		return;
++
++	regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL);
++	if (!regset)
++		return;
++
++	regset->regs = bcm2835_thermal_regs;
++	regset->nregs = ARRAY_SIZE(bcm2835_thermal_regs);
++	regset->base = data->regs;
++
++	debugfs_create_regset32("regset", 0444, data->debugfsdir, regset);
++}
++
++static struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
++	.get_temp = bcm2835_thermal_get_temp,
++};
++
++/*
++ * Note: as per Raspberry Foundation FAQ
++ * (https://www.raspberrypi.org/help/faqs/#performanceOperatingTemperature)
++ * the recommended temperature range for the SoC -40C to +85C
++ * so the trip limit is set to 80C.
++ * this applies to all the BCM283X SoC
++ */
++
++static const struct of_device_id bcm2835_thermal_of_match_table[] = {
++	{
++		.compatible = "brcm,bcm2835-thermal",
++	},
++	{
++		.compatible = "brcm,bcm2836-thermal",
++	},
++	{
++		.compatible = "brcm,bcm2837-thermal",
++	},
++	{},
++};
++MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table);
++
++static int bcm2835_thermal_probe(struct platform_device *pdev)
++{
++	const struct of_device_id *match;
++	struct thermal_zone_device *tz;
++	struct bcm2835_thermal_data *data;
++	struct resource *res;
++	int err = 0;
++	u32 val;
++	unsigned long rate;
++
++	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
++	if (!data)
++		return -ENOMEM;
++
++	match = of_match_device(bcm2835_thermal_of_match_table,
++				&pdev->dev);
++	if (!match)
++		return -EINVAL;
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++	data->regs = devm_ioremap_resource(&pdev->dev, res);
++	if (IS_ERR(data->regs)) {
++		err = PTR_ERR(data->regs);
++		dev_err(&pdev->dev, "Could not get registers: %d\n", err);
++		return err;
++	}
++
++	data->clk = devm_clk_get(&pdev->dev, NULL);
++	if (IS_ERR(data->clk)) {
++		err = PTR_ERR(data->clk);
++		if (err != -EPROBE_DEFER)
++			dev_err(&pdev->dev, "Could not get clk: %d\n", err);
++		return err;
++	}
++
++	err = clk_prepare_enable(data->clk);
++	if (err)
++		return err;
++
++	rate = clk_get_rate(data->clk);
++	if ((rate < 1920000) || (rate > 5000000))
++		dev_warn(&pdev->dev,
++			 "Clock %pCn running at %pCr Hz is outside of the recommended range: 1.92 to 5MHz\n",
++			 data->clk, data->clk);
++
++	/* register of thermal sensor and get info from DT */
++	tz = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
++					     &bcm2835_thermal_ops);
++	if (IS_ERR(tz)) {
++		err = PTR_ERR(tz);
++		dev_err(&pdev->dev,
++			"Failed to register the thermal device: %d\n",
++			err);
++		goto err_clk;
++	}
++
++	/*
++	 * right now the FW does set up the HW-block, so we are not
++	 * touching the configuration registers.
++	 * But if the HW is not enabled, then set it up
++	 * using "sane" values used by the firmware right now.
++	 */
++	val = readl(data->regs + BCM2835_TS_TSENSCTL);
++	if (!(val & BCM2835_TS_TSENSCTL_RSTB)) {
++		int trip_temp, offset, slope;
++
++		slope = thermal_zone_get_slope(tz);
++		offset = thermal_zone_get_offset(tz);
++		/*
++		 * For now we deal only with critical, otherwise
++		 * would need to iterate
++		 */
++		err = tz->ops->get_trip_temp(tz, 0, &trip_temp);
++		if (err < 0) {
++			err = PTR_ERR(tz);
++			dev_err(&pdev->dev,
++				"Not able to read trip_temp: %d\n",
++				err);
++			goto err_tz;
++		}
++
++		/* set bandgap reference voltage and enable voltage regulator */
++		val = (BCM2835_TS_TSENSCTL_CTRL_DEFAULT <<
++		       BCM2835_TS_TSENSCTL_CTRL_SHIFT) |
++		      BCM2835_TS_TSENSCTL_REGULEN;
++
++		/* use the recommended reset duration */
++		val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT);
++
++		/*  trip_adc value from info */
++		val |= bcm2835_thermal_temp2adc(trip_temp,
++						offset,
++						slope)
++			<< BCM2835_TS_TSENSCTL_THOLD_SHIFT;
++
++		/* write the value back to the register as 2 steps */
++		writel(val, data->regs + BCM2835_TS_TSENSCTL);
++		val |= BCM2835_TS_TSENSCTL_RSTB;
++		writel(val, data->regs + BCM2835_TS_TSENSCTL);
++	}
++
++	data->tz = tz;
++
++	platform_set_drvdata(pdev, tz);
++
++	bcm2835_thermal_debugfs(pdev);
++
++	return 0;
++err_tz:
++	thermal_zone_of_sensor_unregister(&pdev->dev, tz);
++err_clk:
++	clk_disable_unprepare(data->clk);
++
++	return err;
++}
++
++static int bcm2835_thermal_remove(struct platform_device *pdev)
++{
++	struct thermal_zone_device *tz = platform_get_drvdata(pdev);
++	struct bcm2835_thermal_data *data = tz->devdata;
++
++	debugfs_remove_recursive(data->debugfsdir);
++	thermal_zone_of_sensor_unregister(&pdev->dev, tz);
++	clk_disable_unprepare(data->clk);
++
++	return 0;
++}
++
++static struct platform_driver bcm2835_thermal_driver = {
++	.probe = bcm2835_thermal_probe,
++	.remove = bcm2835_thermal_remove,
++	.driver = {
++		.name = "bcm2835_thermal",
++		.of_match_table = bcm2835_thermal_of_match_table,
++	},
++};
++module_platform_driver(bcm2835_thermal_driver);
++
++MODULE_AUTHOR("Martin Sperl");
++MODULE_DESCRIPTION("Thermal driver for bcm2835 chip");
++MODULE_LICENSE("GPL");
diff --git a/target/linux/generic/patches-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch b/target/linux/generic/patches-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch
new file mode 100644
index 0000000..8ba8cb5
--- /dev/null
+++ b/target/linux/generic/patches-4.9/081-0002-thermal-broadcom-add-Northstar-thermal-driver.patch
@@ -0,0 +1,173 @@
+From a94cb7eeecc4104a6874339f90c5d0647359c102 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Mon, 3 Apr 2017 17:48:29 +0200
+Subject: [PATCH] thermal: broadcom: add Northstar thermal driver
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Northstar is a SoC family commonly used in home routers. This commit
+adds a driver for checking CPU temperature. As Northstar Plus seems to
+also have this IP block this new symbol gets ARCH_BCM_IPROC dependency.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Jon Mason <jon.mason at broadcom.com>
+Signed-off-by: Eduardo Valentin <edubezval at gmail.com>
+---
+ drivers/thermal/Kconfig               |   5 ++
+ drivers/thermal/Makefile              |   1 +
+ drivers/thermal/broadcom/Kconfig      |   8 +++
+ drivers/thermal/broadcom/Makefile     |   1 +
+ drivers/thermal/broadcom/ns-thermal.c | 105 ++++++++++++++++++++++++++++++++++
+ 5 files changed, 120 insertions(+)
+ create mode 100644 drivers/thermal/broadcom/Kconfig
+ create mode 100644 drivers/thermal/broadcom/Makefile
+ create mode 100644 drivers/thermal/broadcom/ns-thermal.c
+
+--- a/drivers/thermal/Kconfig
++++ b/drivers/thermal/Kconfig
+@@ -381,6 +381,11 @@ config MTK_THERMAL
+ 	  Enable this option if you want to have support for thermal management
+ 	  controller present in Mediatek SoCs
+ 
++menu "Broadcom thermal drivers"
++depends on ARCH_BCM || COMPILE_TEST
++source "drivers/thermal/broadcom/Kconfig"
++endmenu
++
+ menu "Texas Instruments thermal drivers"
+ depends on ARCH_HAS_BANDGAP || COMPILE_TEST
+ depends on HAS_IOMEM
+--- a/drivers/thermal/Makefile
++++ b/drivers/thermal/Makefile
+@@ -26,6 +26,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL)	+= c
+ thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
+ 
+ # platform thermal drivers
++obj-y				+= broadcom/
+ obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM)	+= qcom-spmi-temp-alarm.o
+ obj-$(CONFIG_SPEAR_THERMAL)	+= spear_thermal.o
+ obj-$(CONFIG_ROCKCHIP_THERMAL)	+= rockchip_thermal.o
+--- /dev/null
++++ b/drivers/thermal/broadcom/Kconfig
+@@ -0,0 +1,8 @@
++config BCM_NS_THERMAL
++	tristate "Northstar thermal driver"
++	depends on ARCH_BCM_IPROC || COMPILE_TEST
++	help
++	  Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
++	  BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
++	  with a thermal sensor that allows checking CPU temperature. This
++	  driver provides support for it.
+--- /dev/null
++++ b/drivers/thermal/broadcom/Makefile
+@@ -0,0 +1 @@
++obj-$(CONFIG_BCM_NS_THERMAL)		+= ns-thermal.o
+--- /dev/null
++++ b/drivers/thermal/broadcom/ns-thermal.c
+@@ -0,0 +1,105 @@
++/*
++ * Copyright (C) 2017 Rafa? Mi?ecki <rafal at milecki.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++
++#include <linux/module.h>
++#include <linux/of_address.h>
++#include <linux/platform_device.h>
++#include <linux/thermal.h>
++
++#define PVTMON_CONTROL0					0x00
++#define PVTMON_CONTROL0_SEL_MASK			0x0000000e
++#define PVTMON_CONTROL0_SEL_TEMP_MONITOR		0x00000000
++#define PVTMON_CONTROL0_SEL_TEST_MODE			0x0000000e
++#define PVTMON_STATUS					0x08
++
++struct ns_thermal {
++	struct thermal_zone_device *tz;
++	void __iomem *pvtmon;
++};
++
++static int ns_thermal_get_temp(void *data, int *temp)
++{
++	struct ns_thermal *ns_thermal = data;
++	int offset = thermal_zone_get_offset(ns_thermal->tz);
++	int slope = thermal_zone_get_slope(ns_thermal->tz);
++	u32 val;
++
++	val = readl(ns_thermal->pvtmon + PVTMON_CONTROL0);
++	if ((val & PVTMON_CONTROL0_SEL_MASK) != PVTMON_CONTROL0_SEL_TEMP_MONITOR) {
++		/* Clear current mode selection */
++		val &= ~PVTMON_CONTROL0_SEL_MASK;
++
++		/* Set temp monitor mode (it's the default actually) */
++		val |= PVTMON_CONTROL0_SEL_TEMP_MONITOR;
++
++		writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0);
++	}
++
++	val = readl(ns_thermal->pvtmon + PVTMON_STATUS);
++	*temp = slope * val + offset;
++
++	return 0;
++}
++
++static const struct thermal_zone_of_device_ops ns_thermal_ops = {
++	.get_temp = ns_thermal_get_temp,
++};
++
++static int ns_thermal_probe(struct platform_device *pdev)
++{
++	struct device *dev = &pdev->dev;
++	struct ns_thermal *ns_thermal;
++
++	ns_thermal = devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL);
++	if (!ns_thermal)
++		return -ENOMEM;
++
++	ns_thermal->pvtmon = of_iomap(dev_of_node(dev), 0);
++	if (WARN_ON(!ns_thermal->pvtmon))
++		return -ENOENT;
++
++	ns_thermal->tz = devm_thermal_zone_of_sensor_register(dev, 0,
++							      ns_thermal,
++							      &ns_thermal_ops);
++	if (IS_ERR(ns_thermal->tz)) {
++		iounmap(ns_thermal->pvtmon);
++		return PTR_ERR(ns_thermal->tz);
++	}
++
++	platform_set_drvdata(pdev, ns_thermal);
++
++	return 0;
++}
++
++static int ns_thermal_remove(struct platform_device *pdev)
++{
++	struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
++
++	iounmap(ns_thermal->pvtmon);
++
++	return 0;
++}
++
++static const struct of_device_id ns_thermal_of_match[] = {
++	{ .compatible = "brcm,ns-thermal", },
++	{},
++};
++MODULE_DEVICE_TABLE(of, ns_thermal_of_match);
++
++static struct platform_driver ns_thermal_driver = {
++	.probe		= ns_thermal_probe,
++	.remove		= ns_thermal_remove,
++	.driver = {
++		.name = "ns-thermal",
++		.of_match_table = ns_thermal_of_match,
++	},
++};
++module_platform_driver(ns_thermal_driver);
++
++MODULE_DESCRIPTION("Northstar thermal driver");
++MODULE_LICENSE("GPL v2");


From lede-commits at lists.infradead.org  Fri Apr 14 23:24:59 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 15 Apr 2017 02:24:59 -0400
Subject: [source]  brcm2708: disable CONFIG_BCM2835_THERMAL by default
In-Reply-To: <20170415062459.13635.73267@git-01.infra.lede-project.org>
References: <20170415062459.13635.73267@git-01.infra.lede-project.org>
Message-ID: <mailman.24111.1492237545.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch master:
https://git.lede-project.org/da529d54107b1c1fe281274c723ea4789838c54b

commit da529d54107b1c1fe281274c723ea4789838c54b
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Sat Apr 15 08:21:50 2017 +0200

    brcm2708: disable CONFIG_BCM2835_THERMAL by default
    
    This fixes:
      Thermal sensors on bcm2835 SoC (BCM2835_THERMAL) [N/m/y/?] (NEW) aborted!
    
    This symbol depends on ARCH_BCM2835 so it should be OK to disable it at
    brcm2708 target only.
    
    Fixes: 7d32caa61fb0 ("brcm2708: backport upstream sdhost controller driver")
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 target/linux/brcm2708/bcm2708/config-4.9 | 1 +
 target/linux/brcm2708/bcm2709/config-4.9 | 1 +
 target/linux/brcm2708/bcm2710/config-4.9 | 1 +
 3 files changed, 3 insertions(+)

diff --git a/target/linux/brcm2708/bcm2708/config-4.9 b/target/linux/brcm2708/bcm2708/config-4.9
index c1bed07..96d8735 100644
--- a/target/linux/brcm2708/bcm2708/config-4.9
+++ b/target/linux/brcm2708/bcm2708/config-4.9
@@ -45,6 +45,7 @@ CONFIG_BCM2708_VCMEM=y
 CONFIG_BCM2835_FAST_MEMCPY=y
 CONFIG_BCM2835_MBOX=y
 # CONFIG_BCM2835_SMI is not set
+# CONFIG_BCM2835_THERMAL is not set
 CONFIG_BCM2835_TIMER=y
 CONFIG_BCM2835_WDT=y
 CONFIG_BCM_VCIO=y
diff --git a/target/linux/brcm2708/bcm2709/config-4.9 b/target/linux/brcm2708/bcm2709/config-4.9
index 0c9adec..0d5f326 100644
--- a/target/linux/brcm2708/bcm2709/config-4.9
+++ b/target/linux/brcm2708/bcm2709/config-4.9
@@ -52,6 +52,7 @@ CONFIG_BCM2708_VCMEM=y
 # CONFIG_BCM2835_DEVGPIOMEM is not set
 CONFIG_BCM2835_MBOX=y
 # CONFIG_BCM2835_SMI is not set
+# CONFIG_BCM2835_THERMAL is not set
 CONFIG_BCM2835_TIMER=y
 CONFIG_BCM2835_WDT=y
 CONFIG_BCM_VCIO=y
diff --git a/target/linux/brcm2708/bcm2710/config-4.9 b/target/linux/brcm2708/bcm2710/config-4.9
index e07d8cf..b7ce579 100644
--- a/target/linux/brcm2708/bcm2710/config-4.9
+++ b/target/linux/brcm2708/bcm2710/config-4.9
@@ -71,6 +71,7 @@ CONFIG_BCM2708_VCMEM=y
 # CONFIG_BCM2835_DEVGPIOMEM is not set
 CONFIG_BCM2835_MBOX=y
 # CONFIG_BCM2835_SMI is not set
+# CONFIG_BCM2835_THERMAL is not set
 CONFIG_BCM2835_WDT=y
 # CONFIG_BCM_PDC_MBOX is not set
 # CONFIG_BCM_VCIO is not set


From lede-commits at lists.infradead.org  Sat Apr 15 08:21:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 15 Apr 2017 11:21:04 -0400
Subject: [source]  kernel: update kernel 4.4 to 4.4.61
In-Reply-To: <20170415152104.5314.62289@git-01.infra.lede-project.org>
References: <20170415152104.5314.62289@git-01.infra.lede-project.org>
Message-ID: <mailman.24127.1492269691.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/6ca5ccc62019cf9376b552c0635f4242dd4fae0f

commit 6ca5ccc62019cf9376b552c0635f4242dd4fae0f
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Sat Apr 15 17:00:49 2017 +0200

    kernel: update kernel 4.4 to 4.4.61
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 include/kernel-version.mk                          |  4 +-
 .../linux/brcm47xx/patches-4.4/159-cpu_fixes.patch | 10 +--
 .../linux/lantiq/patches-4.4/0047-irq-fixes.patch  |  4 +-
 .../0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch  | 87 ----------------------
 .../patches-4.4/200-rt3883-fix-pinctrl-typo.patch  | 21 ------
 5 files changed, 9 insertions(+), 117 deletions(-)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 757d9eb..b56bb23 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -3,10 +3,10 @@
 LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.4 = .59
+LINUX_VERSION-4.4 = .61
 
 LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
-LINUX_KERNEL_HASH-4.4.59 = 64e9523c4c7fdaf391a16dd19541bb58e39943cb2151aa0c3d15b6aeaba996ca
+LINUX_KERNEL_HASH-4.4.61 = 30dee7164615ad8184eba4ea6f4906b3ceb2fe462a8a4a929c8e9aab8d4a31da
 
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
diff --git a/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch b/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch
index 795969b..32a6518 100644
--- a/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch
+++ b/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch
@@ -416,7 +416,7 @@
  	/*
 --- a/arch/mips/mm/tlbex.c
 +++ b/arch/mips/mm/tlbex.c
-@@ -943,6 +943,9 @@ build_get_pgde32(u32 **p, unsigned int t
+@@ -960,6 +960,9 @@ build_get_pgde32(u32 **p, unsigned int t
  		uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
  		uasm_i_addu(p, ptr, tmp, ptr);
  #else
@@ -426,7 +426,7 @@
  		UASM_i_LA_mostly(p, ptr, pgdc);
  #endif
  		uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
-@@ -1284,6 +1287,9 @@ static void build_r4000_tlb_refill_handl
+@@ -1301,6 +1304,9 @@ static void build_r4000_tlb_refill_handl
  #ifdef CONFIG_64BIT
  		build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
  #else
@@ -436,7 +436,7 @@
  		build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
  #endif
  
-@@ -1295,6 +1301,9 @@ static void build_r4000_tlb_refill_handl
+@@ -1312,6 +1318,9 @@ static void build_r4000_tlb_refill_handl
  		build_update_entries(&p, K0, K1);
  		build_tlb_write_entry(&p, &l, &r, tlb_random);
  		uasm_l_leave(&l, p);
@@ -446,7 +446,7 @@
  		uasm_i_eret(&p); /* return from trap */
  	}
  #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
-@@ -1871,6 +1880,9 @@ build_r4000_tlbchange_handler_head(u32 *
+@@ -1888,6 +1897,9 @@ build_r4000_tlbchange_handler_head(u32 *
  #ifdef CONFIG_64BIT
  	build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
  #else
@@ -456,7 +456,7 @@
  	build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
  #endif
  
-@@ -1917,6 +1929,9 @@ build_r4000_tlbchange_handler_tail(u32 *
+@@ -1934,6 +1946,9 @@ build_r4000_tlbchange_handler_tail(u32 *
  	build_tlb_write_entry(p, l, r, tlb_indexed);
  	uasm_l_leave(l, *p);
  	build_restore_work_registers(p);
diff --git a/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch b/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch
index 9efa63d..f664deb 100644
--- a/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch
+++ b/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch
@@ -45,7 +45,7 @@
  			/* disable */
  			ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),
  				LTQ_EIU_EXIN_INEN);
-@@ -343,10 +343,10 @@ static int icu_map(struct irq_domain *d,
+@@ -344,10 +344,10 @@ static int icu_map(struct irq_domain *d,
  		return 0;
  
  	for (i = 0; i < exin_avail; i++)
@@ -58,7 +58,7 @@
  
  	return 0;
  }
-@@ -441,14 +441,14 @@ int __init icu_of_init(struct device_nod
+@@ -437,14 +437,14 @@ int __init icu_of_init(struct device_nod
  	eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
  	if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
  		/* find out how many external irq sources we have */
diff --git a/target/linux/lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch b/target/linux/lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch
deleted file mode 100644
index c0d7afc..0000000
--- a/target/linux/lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From: Felix Fietkau <nbd at nbd.name>
-Date: Thu, 19 Jan 2017 12:14:44 +0100
-Subject: [PATCH] MIPS: Lantiq: Fix cascaded IRQ setup
-
-With the IRQ stack changes integrated, the XRX200 devices started
-emitting a constant stream of kernel messages like this:
-
-[  565.415310] Spurious IRQ: CAUSE=0x1100c300
-
-This appears to be caused by IP0 firing for some reason without being
-handled. Fix this by setting up IP2-6 as a proper chained IRQ handler and
-calling do_IRQ for all MIPS CPU interrupts.
-
-Cc: john at phrozen.org
-Cc: stable at vger.kernel.org
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
----
-
---- a/arch/mips/lantiq/irq.c
-+++ b/arch/mips/lantiq/irq.c
-@@ -271,6 +271,11 @@ static void ltq_hw5_irqdispatch(void)
- DEFINE_HWx_IRQDISPATCH(5)
- #endif
- 
-+static void ltq_hw_irq_handler(struct irq_desc *desc)
-+{
-+	ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
-+}
-+
- #ifdef CONFIG_MIPS_MT_SMP
- void __init arch_init_ipiirq(int irq, struct irqaction *action)
- {
-@@ -315,23 +320,19 @@ static struct irqaction irq_call = {
- asmlinkage void plat_irq_dispatch(void)
- {
- 	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
--	unsigned int i;
-+	int irq;
- 
--	if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
--		do_IRQ(MIPS_CPU_TIMER_IRQ);
--		goto out;
--	} else {
--		for (i = 0; i < MAX_IM; i++) {
--			if (pending & (CAUSEF_IP2 << i)) {
--				ltq_hw_irqdispatch(i);
--				goto out;
--			}
--		}
-+	if (!pending) {
-+		spurious_interrupt();
-+		return;
- 	}
--	pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
- 
--out:
--	return;
-+	pending >>= CAUSEB_IP;
-+	while (pending) {
-+		irq = fls(pending) - 1;
-+		do_IRQ(MIPS_CPU_IRQ_BASE + irq);
-+		pending &= ~BIT(irq);
-+	}
- }
- 
- static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
-@@ -356,11 +357,6 @@ static const struct irq_domain_ops irq_d
- 	.map = icu_map,
- };
- 
--static struct irqaction cascade = {
--	.handler = no_action,
--	.name = "cascade",
--};
--
- int __init icu_of_init(struct device_node *node, struct device_node *parent)
- {
- 	struct device_node *eiu_node;
-@@ -392,7 +388,7 @@ int __init icu_of_init(struct device_nod
- 	mips_cpu_irq_init();
- 
- 	for (i = 0; i < MAX_IM; i++)
--		setup_irq(i + 2, &cascade);
-+		irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
- 
- 	if (cpu_has_vint) {
- 		pr_info("Setting up vectored interrupts\n");
diff --git a/target/linux/ramips/patches-4.4/200-rt3883-fix-pinctrl-typo.patch b/target/linux/ramips/patches-4.4/200-rt3883-fix-pinctrl-typo.patch
deleted file mode 100644
index aa55fd9..0000000
--- a/target/linux/ramips/patches-4.4/200-rt3883-fix-pinctrl-typo.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From 2583143af8111d430bdca0268b6cdb7ccc7c3f9d Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel at makrotopia.org>
-Date: Fri, 13 Jan 2017 05:40:04 +0100
-Subject: [PATCH] mips: ralink/rt3883: fix typo in pinctrl lna_g_func
-
-Signed-off-by: Daniel Golle <daniel at makrotopia.org>
----
- arch/mips/ralink/rt3883.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/mips/ralink/rt3883.c
-+++ b/arch/mips/ralink/rt3883.c
-@@ -36,7 +36,7 @@ static struct rt2880_pmx_func uartlite_f
- static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
- static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
- static struct rt2880_pmx_func lna_a_func[] = { FUNC("lna a", 0, 32, 3) };
--static struct rt2880_pmx_func lna_g_func[] = { FUNC("lna a", 0, 35, 3) };
-+static struct rt2880_pmx_func lna_g_func[] = { FUNC("lna g", 0, 35, 3) };
- static struct rt2880_pmx_func pci_func[] = {
- 	FUNC("pci-dev", 0, 40, 32),
- 	FUNC("pci-host2", 1, 40, 32),


From lede-commits at lists.infradead.org  Sat Apr 15 09:19:50 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 15 Apr 2017 12:19:50 -0400
Subject: [source]  busybox: add musl compatible nslookup replacement
In-Reply-To: <20170415161950.14492.50294@git-01.infra.lede-project.org>
References: <20170415161950.14492.50294@git-01.infra.lede-project.org>
Message-ID: <mailman.24130.1492273218.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/1d76542ccafe533bfef20074b115dbed4549c986

commit 1d76542ccafe533bfef20074b115dbed4549c986
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Mar 14 22:38:59 2017 +0100

    busybox: add musl compatible nslookup replacement
    
    Add an alternative nslookup applet implementation which is compatible with
    musl libc wrt. name server selection and which supports a number of additional
    features such as query type selection.
    
    Fixes #155, #217
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Config-defaults.in           |   3 +
 package/utils/busybox/config/networking/Config.in  |  14 +
 .../busybox/patches/230-add_nslookup_lede.patch    | 914 +++++++++++++++++++++
 3 files changed, 931 insertions(+)

diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in
index 11cce03..1977e7f 100644
--- a/package/utils/busybox/Config-defaults.in
+++ b/package/utils/busybox/Config-defaults.in
@@ -2262,6 +2262,9 @@ config BUSYBOX_DEFAULT_FEATURE_NETSTAT_PRG
 	default y
 config BUSYBOX_DEFAULT_NSLOOKUP
 	bool
+	default n
+config BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+	bool
 	default y
 config BUSYBOX_DEFAULT_NTPD
 	bool
diff --git a/package/utils/busybox/config/networking/Config.in b/package/utils/busybox/config/networking/Config.in
index 407ddd3..e58746b 100644
--- a/package/utils/busybox/config/networking/Config.in
+++ b/package/utils/busybox/config/networking/Config.in
@@ -850,6 +850,20 @@ config BUSYBOX_CONFIG_NSLOOKUP
 	help
 	  nslookup is a tool to query Internet name servers.
 
+config BUSYBOX_CONFIG_NSLOOKUP_LEDE
+	bool "nslookup_lede"
+	depends on !BUSYBOX_CONFIG_NSLOOKUP
+	default BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+	help
+	  nslookup is a tool to query Internet name servers (LEDE flavor).
+
+config BUSYBOX_CONFIG_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
+       bool "Enable long options"
+       default BUSYBOX_DEFAULT_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
+       depends on BUSYBOX_CONFIG_NSLOOKUP_LEDE && BUSYBOX_CONFIG_LONG_OPTS
+       help
+         Support long options for the nslookup applet.
+
 config BUSYBOX_CONFIG_NTPD
 	bool "ntpd"
 	default BUSYBOX_DEFAULT_NTPD
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
new file mode 100644
index 0000000..bff88a6
--- /dev/null
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -0,0 +1,914 @@
+From 8c1440a0934dd8b3ad6aae48d6653b5ba6fce8a1 Mon Sep 17 00:00:00 2001
+From: Jo-Philipp Wich <jo at mein.io>
+Date: Tue, 14 Mar 2017 22:21:34 +0100
+Subject: [PATCH] networking: add LEDE nslookup applet
+
+Add a new LEDE nslookup applet which is compatible with musl libc
+and providing more features like ability to specify query type.
+
+In contrast to busybox' builtin nslookup applet, this variant does
+not rely on libc resolver internals but uses explicit send logic
+and the libresolv primitives to parse received DNS responses.
+
+Signed-off-by: Jo-Philipp Wich <jo at mein.io>
+---
+ Makefile.flags             |   6 +
+ networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 875 insertions(+)
+ create mode 100644 networking/nslookup_lede.c
+
+diff --git a/Makefile.flags b/Makefile.flags
+index 65021de..096ab77 100644
+--- a/Makefile.flags
++++ b/Makefile.flags
+@@ -134,6 +134,12 @@ else
+ LDLIBS += m
+ endif
+ 
++# nslookup_lede might need the resolv library
++RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
++ifeq ($(RESOLV_AVAILABLE),y)
++LDLIBS += resolv
++endif
++
+ # libpam may use libpthread, libdl and/or libaudit.
+ # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
+ # However, on *other platforms* it fails when some of those flags
+diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
+new file mode 100644
+index 0000000..fe927ad
+--- /dev/null
++++ b/networking/nslookup_lede.c
+@@ -0,0 +1,869 @@
++/*
++ * nslookup_lede - musl compatible replacement for busybox nslookup
++ *
++ * Copyright (C) 2017 Jo-Philipp Wich <jo at mein.io>
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++//config:config NSLOOKUP_LEDE
++//config:	bool "nslookup_lede"
++//config:	depends on !NSLOOKUP
++//config:	default y
++//config:	help
++//config:	  nslookup is a tool to query Internet name servers (LEDE flavor).
++//config:
++//config:config FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++//config:       bool "Enable long options"
++//config:       default y
++//config:       depends on NSLOOKUP_LEDE && LONG_OPTS
++//config:       help
++//config:         Support long options for the nslookup applet.
++
++//applet:IF_NSLOOKUP_LEDE(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP))
++
++//kbuild:lib-$(CONFIG_NSLOOKUP_LEDE) += nslookup_lede.o
++
++//usage:#define nslookup_lede_trivial_usage
++//usage:       "[HOST] [SERVER]"
++//usage:#define nslookup_lede_full_usage "\n\n"
++//usage:       "Query the nameserver for the IP address of the given HOST\n"
++//usage:       "optionally using a specified DNS server"
++//usage:
++//usage:#define nslookup_lede_example_usage
++//usage:       "$ nslookup localhost\n"
++//usage:       "Server:     default\n"
++//usage:       "Address:    default\n"
++//usage:       "\n"
++//usage:       "Name:       debian\n"
++//usage:       "Address:    127.0.0.1\n"
++
++#include <stdio.h>
++#include <resolv.h>
++#include <string.h>
++#include <errno.h>
++#include <time.h>
++#include <poll.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <sys/socket.h>
++#include <arpa/inet.h>
++#include <net/if.h>
++#include <netdb.h>
++
++#include "libbb.h"
++
++struct ns {
++	const char *name;
++	len_and_sockaddr addr;
++	int failures;
++	int replies;
++};
++
++struct query {
++	const char *name;
++	size_t qlen, rlen;
++	unsigned char query[512], reply[512];
++	unsigned long latency;
++	int rcode, n_ns;
++};
++
++static struct {
++	int type;
++	const char *name;
++} qtypes[] = {
++	{ ns_t_soa,   "SOA"   },
++	{ ns_t_ns,    "NS"    },
++	{ ns_t_a,     "A"     },
++	{ ns_t_aaaa,  "AAAA"  },
++	{ ns_t_cname, "CNAME" },
++	{ ns_t_mx,    "MX"    },
++	{ ns_t_txt,   "TXT"   },
++	{ ns_t_ptr,   "PTR"   },
++	{ ns_t_any,   "ANY"   },
++	{ }
++};
++
++static const char *rcodes[] = {
++	"NOERROR",
++	"FORMERR",
++	"SERVFAIL",
++	"NXDOMAIN",
++	"NOTIMP",
++	"REFUSED",
++	"YXDOMAIN",
++	"YXRRSET",
++	"NXRRSET",
++	"NOTAUTH",
++	"NOTZONE",
++	"RESERVED11",
++	"RESERVED12",
++	"RESERVED13",
++	"RESERVED14",
++	"RESERVED15",
++	"BADVERS"
++};
++
++static unsigned int default_port = 53;
++static unsigned int default_retry = 2;
++static unsigned int default_timeout = 5;
++
++
++static int parse_reply(const unsigned char *msg, size_t len)
++{
++	ns_msg handle;
++	ns_rr rr;
++	int i, n, rdlen;
++	const char *format = NULL;
++	char astr[INET6_ADDRSTRLEN], dname[MAXDNAME];
++	const unsigned char *cp;
++
++	if (ns_initparse(msg, len, &handle) != 0) {
++		//fprintf(stderr, "Unable to parse reply: %s\n", strerror(errno));
++		return -1;
++	}
++
++	for (i = 0; i < ns_msg_count(handle, ns_s_an); i++) {
++		if (ns_parserr(&handle, ns_s_an, i, &rr) != 0) {
++			//fprintf(stderr, "Unable to parse resource record: %s\n", strerror(errno));
++			return -1;
++		}
++
++		rdlen = ns_rr_rdlen(rr);
++
++		switch (ns_rr_type(rr))
++		{
++		case ns_t_a:
++			if (rdlen != 4) {
++				//fprintf(stderr, "Unexpected A record length\n");
++				return -1;
++			}
++			inet_ntop(AF_INET, ns_rr_rdata(rr), astr, sizeof(astr));
++			printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
++			break;
++
++		case ns_t_aaaa:
++			if (rdlen != 16) {
++				//fprintf(stderr, "Unexpected AAAA record length\n");
++				return -1;
++			}
++			inet_ntop(AF_INET6, ns_rr_rdata(rr), astr, sizeof(astr));
++			printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
++			break;
++
++		case ns_t_ns:
++			if (!format)
++				format = "%s\tnameserver = %s\n";
++			/* fall through */
++
++		case ns_t_cname:
++			if (!format)
++				format = "%s\tcanonical name = %s\n";
++			/* fall through */
++
++		case ns_t_ptr:
++			if (!format)
++				format = "%s\tname = %s\n";
++			if (ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++				ns_rr_rdata(rr), dname, sizeof(dname)) < 0) {
++				//fprintf(stderr, "Unable to uncompress domain: %s\n", strerror(errno));
++				return -1;
++			}
++			printf(format, ns_rr_name(rr), dname);
++			break;
++
++		case ns_t_mx:
++			if (rdlen < 2) {
++				fprintf(stderr, "MX record too short\n");
++				return -1;
++			}
++			n = ns_get16(ns_rr_rdata(rr));
++			if (ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++				ns_rr_rdata(rr) + 2, dname, sizeof(dname)) < 0) {
++				//fprintf(stderr, "Cannot uncompress MX domain: %s\n", strerror(errno));
++				return -1;
++			}
++			printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
++			break;
++
++		case ns_t_txt:
++			if (rdlen < 1) {
++				//fprintf(stderr, "TXT record too short\n");
++				return -1;
++			}
++			n = *(unsigned char *)ns_rr_rdata(rr);
++			if (n > 0) {
++				memset(dname, 0, sizeof(dname));
++				memcpy(dname, ns_rr_rdata(rr) + 1, n);
++				printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
++			}
++			break;
++
++		case ns_t_soa:
++			if (rdlen < 20) {
++				//fprintf(stderr, "SOA record too short\n");
++				return -1;
++			}
++
++			printf("%s\n", ns_rr_name(rr));
++
++			cp = ns_rr_rdata(rr);
++			n = ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++			                       cp, dname, sizeof(dname));
++
++			if (n < 0) {
++				//fprintf(stderr, "Unable to uncompress domain: %s\n", strerror(errno));
++				return -1;
++			}
++
++			printf("\torigin = %s\n", dname);
++			cp += n;
++
++			n = ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
++			                       cp, dname, sizeof(dname));
++
++			if (n < 0) {
++				//fprintf(stderr, "Unable to uncompress domain: %s\n", strerror(errno));
++				return -1;
++			}
++
++			printf("\tmail addr = %s\n", dname);
++			cp += n;
++
++			printf("\tserial = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\trefresh = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\tretry = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\texpire = %lu\n", ns_get32(cp));
++			cp += 4;
++
++			printf("\tminimum = %lu\n", ns_get32(cp));
++			break;
++
++		default:
++			break;
++		}
++	}
++
++	return i;
++}
++
++static int parse_nsaddr(const char *addrstr, len_and_sockaddr *lsa)
++{
++	char *eptr, *hash, ifname[IFNAMSIZ];
++	unsigned int port = default_port;
++	unsigned int scope = 0;
++
++	hash = strchr(addrstr, '#');
++
++	if (hash) {
++		*hash++ = '\0';
++		port = strtoul(hash, &eptr, 10);
++
++		if (eptr == hash || *eptr != '\0' || port > 65535) {
++			errno = EINVAL;
++			return -1;
++		}
++	}
++
++	hash = strchr(addrstr, '%');
++
++	if (hash) {
++		for (eptr = ++hash; *eptr != '\0' && *eptr != '#'; eptr++) {
++			if ((eptr - hash) >= IFNAMSIZ) {
++				errno = ENODEV;
++				return -1;
++			}
++
++			ifname[eptr - hash] = *eptr;
++		}
++
++		ifname[eptr - hash] = '\0';
++		scope = if_nametoindex(ifname);
++
++		if (scope == 0) {
++			errno = ENODEV;
++			return -1;
++		}
++	}
++
++	if (inet_pton(AF_INET6, addrstr, &lsa->u.sin6.sin6_addr)) {
++		lsa->u.sin6.sin6_family = AF_INET6;
++		lsa->u.sin6.sin6_port = htons(port);
++		lsa->u.sin6.sin6_scope_id = scope;
++		lsa->len = sizeof(lsa->u.sin6);
++		return 0;
++	}
++
++	if (!scope && inet_pton(AF_INET, addrstr, &lsa->u.sin.sin_addr)) {
++		lsa->u.sin.sin_family = AF_INET;
++		lsa->u.sin.sin_port = htons(port);
++		lsa->len = sizeof(lsa->u.sin);
++		return 0;
++	}
++
++	errno = EINVAL;
++	return -1;
++}
++
++static char *make_ptr(const char *addrstr)
++{
++	const char *hexdigit = "0123456789abcdef";
++	static char ptrstr[73];
++	unsigned char addr[16];
++	char *ptr = ptrstr;
++	int i;
++
++	if (inet_pton(AF_INET6, addrstr, addr)) {
++		if (memcmp(addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12) != 0) {
++			for (i = 0; i < 16; i++) {
++				*ptr++ = hexdigit[(unsigned char)addr[15 - i] & 0xf];
++				*ptr++ = '.';
++				*ptr++ = hexdigit[(unsigned char)addr[15 - i] >> 4];
++				*ptr++ = '.';
++			}
++			strcpy(ptr, "ip6.arpa");
++		}
++		else {
++			sprintf(ptr, "%u.%u.%u.%u.in-addr.arpa",
++			        addr[15], addr[14], addr[13], addr[12]);
++		}
++
++		return ptrstr;
++	}
++
++	if (inet_pton(AF_INET, addrstr, addr)) {
++		sprintf(ptr, "%u.%u.%u.%u.in-addr.arpa",
++		        addr[3], addr[2], addr[1], addr[0]);
++		return ptrstr;
++	}
++
++	return NULL;
++}
++
++static unsigned long mtime(void)
++{
++	struct timespec ts;
++	clock_gettime(CLOCK_REALTIME, &ts);
++	return (unsigned long)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
++}
++
++static void to_v4_mapped(len_and_sockaddr *a)
++{
++	if (a->u.sa.sa_family != AF_INET)
++		return;
++
++	memcpy(a->u.sin6.sin6_addr.s6_addr + 12,
++	       &a->u.sin.sin_addr, 4);
++
++	memcpy(a->u.sin6.sin6_addr.s6_addr,
++	       "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
++
++	a->u.sin6.sin6_family = AF_INET6;
++	a->u.sin6.sin6_flowinfo = 0;
++	a->u.sin6.sin6_scope_id = 0;
++	a->len = sizeof(a->u.sin6);
++}
++
++
++/*
++ * Function logic borrowed & modified from musl libc, res_msend.c
++ */
++
++static int send_queries(struct ns *ns, int n_ns, struct query *queries, int n_queries)
++{
++	int fd;
++	int timeout = default_timeout * 1000, retry_interval, servfail_retry = 0;
++	len_and_sockaddr from = { };
++	int one = 1;
++	int recvlen = 0;
++	int n_replies = 0;
++	struct pollfd pfd;
++	unsigned long t0, t1, t2;
++	int nn, qn, next_query = 0;
++
++	from.u.sa.sa_family = AF_INET;
++	from.len = sizeof(from.u.sin);
++
++	for (nn = 0; nn < n_ns; nn++) {
++		if (ns[nn].addr.u.sa.sa_family == AF_INET6) {
++			from.u.sa.sa_family = AF_INET6;
++			from.len = sizeof(from.u.sin6);
++			break;
++		}
++	}
++
++	/* Get local address and open/bind a socket */
++	fd = socket(from.u.sa.sa_family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
++
++	/* Handle case where system lacks IPv6 support */
++	if (fd < 0 && from.u.sa.sa_family == AF_INET6 && errno == EAFNOSUPPORT) {
++		fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
++		from.u.sa.sa_family = AF_INET;
++	}
++
++	if (fd < 0)
++		return -1;
++
++	if (bind(fd, &from.u.sa, from.len) < 0) {
++		close(fd);
++		return -1;
++	}
++
++	/* Convert any IPv4 addresses in a mixed environment to v4-mapped */
++	if (from.u.sa.sa_family == AF_INET6) {
++		setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
++
++		for (nn = 0; nn < n_ns; nn++)
++			to_v4_mapped(&ns[nn].addr);
++	}
++
++	pfd.fd = fd;
++	pfd.events = POLLIN;
++	retry_interval = timeout / default_retry;
++	t0 = t2 = mtime();
++	t1 = t2 - retry_interval;
++
++	for (; t2 - t0 < timeout; t2 = mtime()) {
++		if (t2 - t1 >= retry_interval) {
++			for (qn = 0; qn < n_queries; qn++) {
++				if (queries[qn].rlen)
++					continue;
++
++				for (nn = 0; nn < n_ns; nn++) {
++					sendto(fd, queries[qn].query, queries[qn].qlen,
++					       MSG_NOSIGNAL, &ns[nn].addr.u.sa, ns[nn].addr.len);
++				}
++			}
++
++			t1 = t2;
++			servfail_retry = 2 * n_queries;
++		}
++
++		/* Wait for a response, or until time to retry */
++		if (poll(&pfd, 1, t1+retry_interval-t2) <= 0)
++			continue;
++
++		while (1) {
++			recvlen = recvfrom(fd, queries[next_query].reply,
++			                   sizeof(queries[next_query].reply), 0,
++			                   &from.u.sa, &from.len);
++
++			/* read error */
++			if (recvlen < 0)
++				break;
++
++			/* Ignore non-identifiable packets */
++			if (recvlen < 4)
++				continue;
++
++			/* Ignore replies from addresses we didn't send to */
++			for (nn = 0; nn < n_ns; nn++)
++				if (memcmp(&from.u.sa, &ns[nn].addr.u.sa, from.len) == 0)
++					break;
++
++			if (nn >= n_ns)
++				continue;
++
++			/* Find which query this answer goes with, if any */
++			for (qn = next_query; qn < n_queries; qn++)
++				if (!memcmp(queries[next_query].reply, queries[qn].query, 2))
++					break;
++
++			if (qn >= n_queries || queries[qn].rlen)
++				continue;
++
++			queries[qn].rcode = queries[next_query].reply[3] & 15;
++			queries[qn].latency = mtime() - t0;
++			queries[qn].n_ns = nn;
++
++			ns[nn].replies++;
++
++			/* Only accept positive or negative responses;
++			 * retry immediately on server failure, and ignore
++			 * all other codes such as refusal. */
++			switch (queries[qn].rcode) {
++			case 0:
++			case 3:
++				break;
++
++			case 2:
++				if (servfail_retry && servfail_retry--) {
++					ns[nn].failures++;
++					sendto(fd, queries[qn].query, queries[qn].qlen,
++					       MSG_NOSIGNAL, &ns[nn].addr.u.sa, ns[nn].addr.len);
++				}
++				/* fall through */
++
++			default:
++				continue;
++			}
++
++			/* Store answer */
++			n_replies++;
++
++			queries[qn].rlen = recvlen;
++
++			if (qn == next_query) {
++				while (next_query < n_queries) {
++					if (!queries[next_query].rlen)
++						break;
++
++					next_query++;
++				}
++			}
++			else {
++				memcpy(queries[qn].reply, queries[next_query].reply, recvlen);
++			}
++
++			if (next_query >= n_queries)
++				return n_replies;
++		}
++	}
++
++	return n_replies;
++}
++
++static struct ns *add_ns(struct ns **ns, int *n_ns, const char *addr)
++{
++	char portstr[sizeof("65535")], *p;
++	len_and_sockaddr a = { };
++	struct ns *tmp;
++	struct addrinfo *ai, *aip, hints = {
++		.ai_flags = AI_NUMERICSERV,
++		.ai_socktype = SOCK_DGRAM
++	};
++
++	if (parse_nsaddr(addr, &a)) {
++		/* Maybe we got a domain name, attempt to resolve it using the standard
++		 * resolver routines */
++
++		p = strchr(addr, '#');
++		snprintf(portstr, sizeof(portstr), "%hu",
++		         (unsigned short)(p ? strtoul(p, NULL, 10) : default_port));
++
++		if (!getaddrinfo(addr, portstr, &hints, &ai)) {
++			for (aip = ai; aip; aip = aip->ai_next) {
++				if (aip->ai_addr->sa_family != AF_INET &&
++				    aip->ai_addr->sa_family != AF_INET6)
++				    continue;
++
++				tmp = realloc(*ns, sizeof(**ns) * (*n_ns + 1));
++
++				if (!tmp)
++					return NULL;
++
++				*ns = tmp;
++
++				(*ns)[*n_ns].name = addr;
++				(*ns)[*n_ns].replies = 0;
++				(*ns)[*n_ns].failures = 0;
++				(*ns)[*n_ns].addr.len = aip->ai_addrlen;
++
++				memcpy(&(*ns)[*n_ns].addr.u.sa, aip->ai_addr, aip->ai_addrlen);
++
++				(*n_ns)++;
++			}
++
++			freeaddrinfo(ai);
++
++			return &(*ns)[*n_ns];
++		}
++
++		return NULL;
++	}
++
++	tmp = realloc(*ns, sizeof(**ns) * (*n_ns + 1));
++
++	if (!tmp)
++		return NULL;
++
++	*ns = tmp;
++
++	(*ns)[*n_ns].addr = a;
++	(*ns)[*n_ns].name = addr;
++	(*ns)[*n_ns].replies = 0;
++	(*ns)[*n_ns].failures = 0;
++
++	return &(*ns)[(*n_ns)++];
++}
++
++static int parse_resolvconf(struct ns **ns, int *n_ns)
++{
++	int prev_n_ns = *n_ns;
++	char line[128], *p;
++	FILE *resolv;
++
++	if ((resolv = fopen("/etc/resolv.conf", "r")) != NULL) {
++		while (fgets(line, sizeof(line), resolv)) {
++			p = strtok(line, " \t\n");
++
++			if (!p || strcmp(p, "nameserver"))
++				continue;
++
++			p = strtok(NULL, " \t\n");
++
++			if (!p)
++				continue;
++
++			if (!add_ns(ns, n_ns, strdup(p))) {
++				free(p);
++				break;
++			}
++		}
++
++		fclose(resolv);
++	}
++
++	return *n_ns - prev_n_ns;
++}
++
++static struct query *add_query(struct query **queries, int *n_queries,
++                               int type, const char *dname)
++{
++	struct query *tmp;
++	ssize_t qlen;
++
++	tmp = realloc(*queries, sizeof(**queries) * (*n_queries + 1));
++
++	if (!tmp)
++		return NULL;
++
++	memset(&tmp[*n_queries], 0, sizeof(*tmp));
++
++	qlen = res_mkquery(QUERY, dname, C_IN, type, NULL, 0, NULL,
++	                   tmp[*n_queries].query, sizeof(tmp[*n_queries].query));
++
++	tmp[*n_queries].qlen = qlen;
++	tmp[*n_queries].name = dname;
++	*queries = tmp;
++
++	return &tmp[(*n_queries)++];
++}
++
++static char *sal2str(len_and_sockaddr *a)
++{
++	static char buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ + 1 + 5 + 1];
++	char *p = buf;
++
++	if (a->u.sa.sa_family == AF_INET6) {
++		inet_ntop(AF_INET6, &a->u.sin6.sin6_addr, buf, sizeof(buf));
++		p += strlen(p);
++
++		if (a->u.sin6.sin6_scope_id) {
++			if (if_indextoname(a->u.sin6.sin6_scope_id, p + 1)) {
++				*p++ = '%';
++				p += strlen(p);
++			}
++		}
++	}
++	else {
++		inet_ntop(AF_INET, &a->u.sin.sin_addr, buf, sizeof(buf));
++		p += strlen(p);
++	}
++
++	sprintf(p, "#%hu", ntohs(a->u.sin6.sin6_port));
++
++	return buf;
++}
++
++
++#if ENABLE_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++static const char nslookup_longopts[] ALIGN1 =
++		"type\0"		Required_argument	"q"
++		"querytype\0"	Required_argument	"q"
++		"port\0"		Required_argument	"p"
++		"retry\0"		Required_argument	"r"
++		"timeout\0"		Required_argument	"t"
++		"stats\0"		Required_argument	"s"
++    ;
++#endif
++
++int nslookup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
++int nslookup_main(int argc, char **argv)
++{
++	int rc = 1;
++	char *ptr, *chr;
++	struct ns *ns = NULL;
++	struct query *queries = NULL;
++	llist_t *type_strings = NULL;
++	int n_ns = 0, n_queries = 0;
++	int c, opts, option_index = 0;
++	int stats = 0;
++	unsigned int types = 0;
++	HEADER *header;
++
++#if ENABLE_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++	applet_long_options = nslookup_longopts;
++#endif
++
++	opts = getopt32(argv, "+q:*p:+r:+t:+s",
++	                &type_strings, &default_port,
++	                &default_retry, &default_timeout);
++
++	while (type_strings) {
++		ptr = llist_pop(&type_strings);
++
++		/* skip leading text, e.g. when invoked with -querytype=AAAA */
++		if ((chr = strchr(ptr, '=')) != NULL) {
++			ptr = chr;
++			*ptr++ = 0;
++		}
++
++		for (c = 0; qtypes[c].name; c++)
++			if (!strcmp(qtypes[c].name, ptr))
++				break;
++
++		if (!qtypes[c].name) {
++			fprintf(stderr, "Invalid query type \"%s\"\n", ptr);
++			goto out;
++		}
++
++		types |= (1 << c);
++	}
++
++	if (default_port > 65535) {
++		fprintf(stderr, "Invalid server port\n");
++		goto out;
++	}
++
++	if (!default_retry) {
++		fprintf(stderr, "Invalid retry value\n");
++		goto out;
++	}
++
++	if (!default_timeout) {
++		fprintf(stderr, "Invalid timeout value\n");
++		goto out;
++	}
++
++	stats = (opts & 16);
++
++	if (optind >= argc)
++		bb_show_usage();
++
++	for (option_index = optind;
++	     option_index < ((argc - optind) > 1 ? argc - 1 : argc);
++	     option_index++) {
++
++		/* No explicit type given, guess query type.
++		 * If we can convert the domain argument into a ptr (means that
++		 * inet_pton() could read it) we assume a PTR request, else
++		 * we issue A queries. */
++		if (types == 0) {
++			ptr = make_ptr(argv[option_index]);
++
++			if (ptr)
++				add_query(&queries, &n_queries, T_PTR, ptr);
++			else
++				add_query(&queries, &n_queries, T_A, argv[option_index]);
++		}
++		else {
++			for (c = 0; qtypes[c].name; c++)
++				if (types & (1 << c))
++					add_query(&queries, &n_queries, qtypes[c].type,
++					          argv[option_index]);
++		}
++	}
++
++	/* Use given DNS server if present */
++	if (option_index < argc) {
++		if (!add_ns(&ns, &n_ns, argv[option_index])) {
++			fprintf(stderr, "Invalid NS server address \"%s\": %s\n",
++			        argv[option_index], strerror(errno));
++			goto out;
++		}
++	}
++	else {
++		parse_resolvconf(&ns, &n_ns);
++	}
++
++	/* Fall back to localhost if we could not find NS in resolv.conf */
++	if (n_ns == 0) {
++		add_ns(&ns, &n_ns, "127.0.0.1");
++	}
++
++	for (c = 0; c < n_ns; c++) {
++		rc = send_queries(&ns[c], 1, queries, n_queries);
++
++		if (rc < 0) {
++			fprintf(stderr, "Failed to send queries: %s\n", strerror(errno));
++			goto out;
++		} else if (rc > 0) {
++			break;
++		}
++	}
++
++	if (c >= n_ns) {
++		fprintf(stderr,
++			    ";; connection timed out; no servers could be reached\n\n");
++
++		return 1;
++	}
++
++	printf("Server:\t\t%s\n", ns[c].name);
++	printf("Address:\t%s\n", sal2str(&ns[c].addr));
++
++	if (stats) {
++		printf("Replies:\t%d\n", ns[c].replies);
++		printf("Failures:\t%d\n", ns[c].failures);
++	}
++
++	printf("\n");
++
++	for (rc = 0; rc < n_queries; rc++) {
++		if (stats) {
++			printf("Query #%d completed in %lums:\n", rc, queries[rc].latency);
++		}
++
++		if (queries[rc].rcode != 0) {
++			printf("** server can't find %s: %s\n", queries[rc].name,
++			       rcodes[queries[rc].rcode]);
++			continue;
++		}
++
++		c = 0;
++
++		if (queries[rc].rlen) {
++			header = (HEADER *)queries[rc].reply;
++
++			if (!header->aa)
++				printf("Non-authoritative answer:\n");
++
++			c = parse_reply(queries[rc].reply, queries[rc].rlen);
++		}
++
++		if (c == 0)
++			printf("*** Can't find %s: No answer\n", queries[rc].name);
++		else if (c < 0)
++			printf("*** Can't find %s: Parse error\n", queries[rc].name);
++
++		printf("\n");
++	}
++
++	rc = 0;
++
++out:
++	if (n_ns)
++		free(ns);
++
++	if (n_queries)
++		free(queries);
++
++	return rc;
++}
+-- 
+2.1.4
+


From lede-commits at lists.infradead.org  Sat Apr 15 09:26:49 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 15 Apr 2017 12:26:49 -0400
Subject: [source]  kernel: update kernel 4.4 to 4.4.61
In-Reply-To: <20170415162648.15749.81213@git-01.infra.lede-project.org>
References: <20170415162648.15749.81213@git-01.infra.lede-project.org>
Message-ID: <mailman.24133.1492273633.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/aefa195749c68aa21bf135a5ec944b91cabc47ca

commit aefa195749c68aa21bf135a5ec944b91cabc47ca
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Sat Apr 15 17:00:49 2017 +0200

    kernel: update kernel 4.4 to 4.4.61
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 include/kernel-version.mk                          |  4 +-
 .../linux/brcm47xx/patches-4.4/159-cpu_fixes.patch | 10 +--
 .../linux/lantiq/patches-4.4/0047-irq-fixes.patch  |  4 +-
 .../0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch  | 87 ----------------------
 .../patches-4.4/200-rt3883-fix-pinctrl-typo.patch  | 21 ------
 5 files changed, 9 insertions(+), 117 deletions(-)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 6f4a1a2..0a58a45 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -3,11 +3,11 @@
 LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.4 = .59
+LINUX_VERSION-4.4 = .61
 LINUX_VERSION-4.9 = .20
 
 LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
-LINUX_KERNEL_HASH-4.4.59 = 64e9523c4c7fdaf391a16dd19541bb58e39943cb2151aa0c3d15b6aeaba996ca
+LINUX_KERNEL_HASH-4.4.61 = 30dee7164615ad8184eba4ea6f4906b3ceb2fe462a8a4a929c8e9aab8d4a31da
 LINUX_KERNEL_HASH-4.9.20 = 48660806dd32fb8dcbcf5932291bf6cc7d29240070372230871e0f56fea81341
 
 ifdef KERNEL_PATCHVER
diff --git a/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch b/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch
index 795969b..32a6518 100644
--- a/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch
+++ b/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch
@@ -416,7 +416,7 @@
  	/*
 --- a/arch/mips/mm/tlbex.c
 +++ b/arch/mips/mm/tlbex.c
-@@ -943,6 +943,9 @@ build_get_pgde32(u32 **p, unsigned int t
+@@ -960,6 +960,9 @@ build_get_pgde32(u32 **p, unsigned int t
  		uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
  		uasm_i_addu(p, ptr, tmp, ptr);
  #else
@@ -426,7 +426,7 @@
  		UASM_i_LA_mostly(p, ptr, pgdc);
  #endif
  		uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
-@@ -1284,6 +1287,9 @@ static void build_r4000_tlb_refill_handl
+@@ -1301,6 +1304,9 @@ static void build_r4000_tlb_refill_handl
  #ifdef CONFIG_64BIT
  		build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
  #else
@@ -436,7 +436,7 @@
  		build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
  #endif
  
-@@ -1295,6 +1301,9 @@ static void build_r4000_tlb_refill_handl
+@@ -1312,6 +1318,9 @@ static void build_r4000_tlb_refill_handl
  		build_update_entries(&p, K0, K1);
  		build_tlb_write_entry(&p, &l, &r, tlb_random);
  		uasm_l_leave(&l, p);
@@ -446,7 +446,7 @@
  		uasm_i_eret(&p); /* return from trap */
  	}
  #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
-@@ -1871,6 +1880,9 @@ build_r4000_tlbchange_handler_head(u32 *
+@@ -1888,6 +1897,9 @@ build_r4000_tlbchange_handler_head(u32 *
  #ifdef CONFIG_64BIT
  	build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
  #else
@@ -456,7 +456,7 @@
  	build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
  #endif
  
-@@ -1917,6 +1929,9 @@ build_r4000_tlbchange_handler_tail(u32 *
+@@ -1934,6 +1946,9 @@ build_r4000_tlbchange_handler_tail(u32 *
  	build_tlb_write_entry(p, l, r, tlb_indexed);
  	uasm_l_leave(l, *p);
  	build_restore_work_registers(p);
diff --git a/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch b/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch
index 9efa63d..f664deb 100644
--- a/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch
+++ b/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch
@@ -45,7 +45,7 @@
  			/* disable */
  			ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),
  				LTQ_EIU_EXIN_INEN);
-@@ -343,10 +343,10 @@ static int icu_map(struct irq_domain *d,
+@@ -344,10 +344,10 @@ static int icu_map(struct irq_domain *d,
  		return 0;
  
  	for (i = 0; i < exin_avail; i++)
@@ -58,7 +58,7 @@
  
  	return 0;
  }
-@@ -441,14 +441,14 @@ int __init icu_of_init(struct device_nod
+@@ -437,14 +437,14 @@ int __init icu_of_init(struct device_nod
  	eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
  	if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
  		/* find out how many external irq sources we have */
diff --git a/target/linux/lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch b/target/linux/lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch
deleted file mode 100644
index c0d7afc..0000000
--- a/target/linux/lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From: Felix Fietkau <nbd at nbd.name>
-Date: Thu, 19 Jan 2017 12:14:44 +0100
-Subject: [PATCH] MIPS: Lantiq: Fix cascaded IRQ setup
-
-With the IRQ stack changes integrated, the XRX200 devices started
-emitting a constant stream of kernel messages like this:
-
-[  565.415310] Spurious IRQ: CAUSE=0x1100c300
-
-This appears to be caused by IP0 firing for some reason without being
-handled. Fix this by setting up IP2-6 as a proper chained IRQ handler and
-calling do_IRQ for all MIPS CPU interrupts.
-
-Cc: john at phrozen.org
-Cc: stable at vger.kernel.org
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
----
-
---- a/arch/mips/lantiq/irq.c
-+++ b/arch/mips/lantiq/irq.c
-@@ -271,6 +271,11 @@ static void ltq_hw5_irqdispatch(void)
- DEFINE_HWx_IRQDISPATCH(5)
- #endif
- 
-+static void ltq_hw_irq_handler(struct irq_desc *desc)
-+{
-+	ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
-+}
-+
- #ifdef CONFIG_MIPS_MT_SMP
- void __init arch_init_ipiirq(int irq, struct irqaction *action)
- {
-@@ -315,23 +320,19 @@ static struct irqaction irq_call = {
- asmlinkage void plat_irq_dispatch(void)
- {
- 	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
--	unsigned int i;
-+	int irq;
- 
--	if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
--		do_IRQ(MIPS_CPU_TIMER_IRQ);
--		goto out;
--	} else {
--		for (i = 0; i < MAX_IM; i++) {
--			if (pending & (CAUSEF_IP2 << i)) {
--				ltq_hw_irqdispatch(i);
--				goto out;
--			}
--		}
-+	if (!pending) {
-+		spurious_interrupt();
-+		return;
- 	}
--	pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
- 
--out:
--	return;
-+	pending >>= CAUSEB_IP;
-+	while (pending) {
-+		irq = fls(pending) - 1;
-+		do_IRQ(MIPS_CPU_IRQ_BASE + irq);
-+		pending &= ~BIT(irq);
-+	}
- }
- 
- static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
-@@ -356,11 +357,6 @@ static const struct irq_domain_ops irq_d
- 	.map = icu_map,
- };
- 
--static struct irqaction cascade = {
--	.handler = no_action,
--	.name = "cascade",
--};
--
- int __init icu_of_init(struct device_node *node, struct device_node *parent)
- {
- 	struct device_node *eiu_node;
-@@ -392,7 +388,7 @@ int __init icu_of_init(struct device_nod
- 	mips_cpu_irq_init();
- 
- 	for (i = 0; i < MAX_IM; i++)
--		setup_irq(i + 2, &cascade);
-+		irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
- 
- 	if (cpu_has_vint) {
- 		pr_info("Setting up vectored interrupts\n");
diff --git a/target/linux/ramips/patches-4.4/200-rt3883-fix-pinctrl-typo.patch b/target/linux/ramips/patches-4.4/200-rt3883-fix-pinctrl-typo.patch
deleted file mode 100644
index aa55fd9..0000000
--- a/target/linux/ramips/patches-4.4/200-rt3883-fix-pinctrl-typo.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From 2583143af8111d430bdca0268b6cdb7ccc7c3f9d Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel at makrotopia.org>
-Date: Fri, 13 Jan 2017 05:40:04 +0100
-Subject: [PATCH] mips: ralink/rt3883: fix typo in pinctrl lna_g_func
-
-Signed-off-by: Daniel Golle <daniel at makrotopia.org>
----
- arch/mips/ralink/rt3883.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/mips/ralink/rt3883.c
-+++ b/arch/mips/ralink/rt3883.c
-@@ -36,7 +36,7 @@ static struct rt2880_pmx_func uartlite_f
- static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
- static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
- static struct rt2880_pmx_func lna_a_func[] = { FUNC("lna a", 0, 32, 3) };
--static struct rt2880_pmx_func lna_g_func[] = { FUNC("lna a", 0, 35, 3) };
-+static struct rt2880_pmx_func lna_g_func[] = { FUNC("lna g", 0, 35, 3) };
- static struct rt2880_pmx_func pci_func[] = {
- 	FUNC("pci-dev", 0, 40, 32),
- 	FUNC("pci-host2", 1, 40, 32),


From lede-commits at lists.infradead.org  Mon Apr 17 04:10:37 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 17 Apr 2017 07:10:37 -0400
Subject: [source]  dnsmasq: fix uninitialized varname in init-script
In-Reply-To: <20170417111037.30260.7899@git-01.infra.lede-project.org>
References: <20170417111037.30260.7899@git-01.infra.lede-project.org>
Message-ID: <mailman.24229.1492427460.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/56457dbcb7fa868c4a306405c596138b845de077

commit 56457dbcb7fa868c4a306405c596138b845de077
Author: Bastian Bittorf <bb at npl.de>
AuthorDate: Sun Apr 16 18:21:49 2017 +0200

    dnsmasq: fix uninitialized varname in init-script
    
    minor/cosmetic: fixes the following misleading message:
    
    root at box:~ /etc/init.d/dnsmasq restart
    sh: out of range
    
    Signed-off-by: Bastian Bittorf <bb at npl.de>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 83553f1..448d3ee 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -698,7 +698,7 @@ dnsmasq_start()
 
 	if [ -x /usr/sbin/odhcpd -a -x /etc/init.d/odhcpd ] ; then
 		local odhcpd_is_main odhcpd_is_enabled
-		config_get odhcpd_is_main odhcpd maindhcp
+		config_get odhcpd_is_main odhcpd maindhcp 0
 		/etc/init.d/odhcpd enabled && odhcpd_is_enabled=1 || odhcpd_is_enabled=0
 
 


From lede-commits at lists.infradead.org  Mon Apr 17 09:16:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 17 Apr 2017 12:16:04 -0400
Subject: [source]  utils/f2fs-tools: Update to 1.8.0
In-Reply-To: <20170417161604.31395.84773@git-01.infra.lede-project.org>
References: <20170417161604.31395.84773@git-01.infra.lede-project.org>
Message-ID: <mailman.24252.1492445791.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/7eb58cf1090a6a0912c5cbdfd023555096a20cf3

commit 7eb58cf1090a6a0912c5cbdfd023555096a20cf3
Author: Daniel Engberg <daniel.engberg.lists at pyret.net>
AuthorDate: Wed Mar 15 17:14:55 2017 +0100

    utils/f2fs-tools: Update to 1.8.0
    
    Update f2fs-tools to 1.8.0
    Refresh patches
    Remove selinux patch, use configure argument instead.
    Switch to xz tarball
    Adjust url to avoid redirects
    
    Signed-off-by: Daniel Engberg <daniel.engberg.lists at pyret.net>
---
 package/utils/f2fs-tools/Makefile                  | 11 +++--
 .../utils/f2fs-tools/patches/020-no_selinux.patch  | 55 ----------------------
 2 files changed, 7 insertions(+), 59 deletions(-)

diff --git a/package/utils/f2fs-tools/Makefile b/package/utils/f2fs-tools/Makefile
index c0f4e3d..adafcff 100644
--- a/package/utils/f2fs-tools/Makefile
+++ b/package/utils/f2fs-tools/Makefile
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=f2fs-tools
-PKG_VERSION:=1.7.0
+PKG_VERSION:=1.8.0
 PKG_RELEASE:=1
 
 PKG_LICENSE:=GPLv2
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/
-PKG_HASH:=33d454c2e95aabef5659949c4fff15f6c9877b48349e64411de502bc62b0cbd4
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/
+PKG_HASH:=34790bccd74086e6b4f04fcac3a167ce1ca3319ce660454bceefc45c52906f94
 
 PKG_FIXUP:=autoreconf
 PKG_BUILD_PARALLEL:=1
@@ -56,6 +56,9 @@ define Package/libf2fs
   DEPENDS:=+libuuid
 endef
 
+CONFIGURE_ARGS += \
+	--without-selinux
+
 define Package/libf2fs/install
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) \
diff --git a/package/utils/f2fs-tools/patches/020-no_selinux.patch b/package/utils/f2fs-tools/patches/020-no_selinux.patch
deleted file mode 100644
index dcb3bd2..0000000
--- a/package/utils/f2fs-tools/patches/020-no_selinux.patch
+++ /dev/null
@@ -1,55 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -49,7 +49,7 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
- 
- # Checks for libraries.
- PKG_CHECK_MODULES([libuuid], [uuid])
--PKG_CHECK_MODULES([libselinux], [libselinux])
-+# PKG_CHECK_MODULES([libselinux], [libselinux])
- 
- # Checks for header files.
- AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \
---- a/fsck/sload.c
-+++ b/fsck/sload.c
-@@ -16,10 +16,11 @@
- #include <libgen.h>
- #include <dirent.h>
- #include <mntent.h>
-+
-+#ifdef WITH_ANDROID
- #include <selinux/selinux.h>
- #include <selinux/label.h>
- 
--#ifdef WITH_ANDROID
- #include <selinux/label.h>
- #include <private/android_filesystem_config.h>
- 
-@@ -110,10 +111,12 @@ static int build_directory(struct f2fs_s
- 		handle_selabel(dentries + i, S_ISDIR(stat.st_mode),
- 							target_out_dir);
- 
-+#ifdef WITH_ANDROID
- 		if (sehnd && selabel_lookup(sehnd, &dentries[i].secon,
- 					dentries[i].path, stat.st_mode) < 0)
- 			ERR_MSG("Cannot lookup security context for %s\n",
- 						dentries[i].path);
-+#endif
- 
- 		dentries[i].pino = dir_ino;
- 
-@@ -218,6 +221,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi,
- 		return ret;
- 	}
- 
-+#ifdef WITH_ANDROID
- 	if (sehnd) {
- 		char *secontext = NULL;
- 
-@@ -233,6 +237,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi,
- 		}
- 		free(secontext);
- 	}
-+#endif
- 
- 	/* update curseg info; can update sit->types */
- 	move_curseg_info(sbi, SM_I(sbi)->main_blkaddr);


From lede-commits at lists.infradead.org  Mon Apr 17 09:45:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 17 Apr 2017 12:45:39 -0400
Subject: [source]  LEDE v17.01.1: adjust config defaults
In-Reply-To: <20170417164538.5236.65888@git-01.infra.lede-project.org>
References: <20170417164538.5236.65888@git-01.infra.lede-project.org>
Message-ID: <mailman.24256.1492447570.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, annotated tag v17.01.1:
https://git.lede-project.org/48461b5abc382b26edd0d2637f0f7b952bed90ba

commit 48461b5abc382b26edd0d2637f0f7b952bed90ba
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Apr 17 18:42:34 2017 +0200

    LEDE v17.01.1: adjust config defaults
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 feeds.conf.default                 | 8 ++++----
 include/version.mk                 | 6 +++---
 package/base-files/image-config.in | 4 ++--
 version                            | 1 +
 version.date                       | 1 +
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/feeds.conf.default b/feeds.conf.default
index 6181dc6..28b0d14 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -1,4 +1,4 @@
-src-git packages https://git.lede-project.org/feed/packages.git;lede-17.01
-src-git luci https://git.lede-project.org/project/luci.git;lede-17.01
-src-git routing https://git.lede-project.org/feed/routing.git;lede-17.01
-src-git telephony https://git.lede-project.org/feed/telephony.git;lede-17.01
+src-git packages https://git.lede-project.org/feed/packages.git^f9e99848182fc7bc554e541ca133c22079d4041b
+src-git luci https://git.lede-project.org/project/luci.git^29fabe26399fbaecf9231e24f9ac1ee5773cafa6
+src-git routing https://git.lede-project.org/feed/routing.git^04a37ef4309c2b67c64901eb8fbf3800b4c7bb35
+src-git telephony https://git.lede-project.org/feed/telephony.git^1f0fb2538ba6fc306198fe2a9a4b976d63adb304
diff --git a/include/version.mk b/include/version.mk
index 8a6ab94..4987e56 100644
--- a/include/version.mk
+++ b/include/version.mk
@@ -31,16 +31,16 @@ qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
 
 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
-VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),17.01-SNAPSHOT)
+VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),17.01.1)
 
 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
-VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
+VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r3316-7eb58cf109)
 
 VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
 
 VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
-VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/releases/17.01-SNAPSHOT)
+VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/releases/17.01.1)
 
 VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),LEDE)
diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
index b600530..b6d6d40 100644
--- a/package/base-files/image-config.in
+++ b/package/base-files/image-config.in
@@ -190,7 +190,7 @@ if VERSIONOPT
 	config VERSION_REPO
 		string
 		prompt "Release repository"
-		default "http://downloads.lede-project.org/releases/17.01-SNAPSHOT"
+		default "http://downloads.lede-project.org/releases/17.01.1"
 		help
 			This is the repository address embedded in the image, it defaults
 			to the trunk snapshot repo; the url may contain the following placeholders:
@@ -262,7 +262,7 @@ if VERSIONOPT
 	config VERSION_CODE_FILENAMES
 		bool
 		prompt "Revision code in filenames"
-		default y
+		default n
 		help
 			Enable this to include the revision identifier or the configured
 			version code into the firmware image, SDK- and Image Builder archive
diff --git a/version b/version
new file mode 100644
index 0000000..86ed0a0
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+r3316-7eb58cf109
diff --git a/version.date b/version.date
new file mode 100644
index 0000000..de11e0b
--- /dev/null
+++ b/version.date
@@ -0,0 +1 @@
+1492445753


From lede-commits at lists.infradead.org  Mon Apr 17 12:40:17 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 17 Apr 2017 15:40:17 -0400
Subject: [source]  mac80211: rt2x00: fix MT7620 LNA gain and VCO-after-ALC
In-Reply-To: <20170417194017.12669.68137@git-01.infra.lede-project.org>
References: <20170417194017.12669.68137@git-01.infra.lede-project.org>
Message-ID: <mailman.24287.1492458167.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/97d1c49cacfea2d9f69d8e20d9f60e837293b1ff

commit 97d1c49cacfea2d9f69d8e20d9f60e837293b1ff
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Apr 17 21:38:32 2017 +0200

    mac80211: rt2x00: fix MT7620 LNA gain and VCO-after-ALC
    
    This should fix issues with bad RX as well as AP not coming up and/or
    scanning failing.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...rt2800-fix-LNA-gain-assignment-for-MT7620.patch | 54 ++++++++++++++++++++++
 ...-do-VCO-calibration-after-programming-ALC.patch | 34 ++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch b/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
new file mode 100644
index 0000000..3270ea2
--- /dev/null
+++ b/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
@@ -0,0 +1,54 @@
+From 0109238d62a99ea779a7e28e21868118e7b8d69d Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Mon, 10 Apr 2017 14:28:14 +0200
+Subject: [PATCH 1/2] rt2800: fix LNA gain assignment for MT7620
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+    linux-wireless at vger.kernel.org,
+    Kalle Valo <kvalo at codeaurora.org>
+
+The base value used for MT7620 differs from Rt5392 which resulted in
+quite bad RX signal quality. Fix this by using the correct base value as
+well as the LNA calibration values for HT20.
+
+Reported-by: Tom Psyborg <pozega.tomislav at gmail.com>
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index ba06ac2d876d..7135519a638c 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3806,11 +3806,25 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
+ 	}
+ 
+ 	if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
++		reg = 0x10;
++		if (!conf_is_ht40(conf)) {
++			if (rt2x00_rt(rt2x00dev, RT6352) &&
++			    rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++				reg |= 0x5;
++			} else {
++				reg |= 0xa;
++			}
++		}
+ 		rt2800_bbp_write(rt2x00dev, 195, 141);
+-		rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a);
++		rt2800_bbp_write(rt2x00dev, 196, reg);
+ 
+ 		/* AGC init */
+-		reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain;
++		if (rt2x00_rt(rt2x00dev, RT6352))
++			reg = 0x04;
++		else
++			reg = rf->channel <= 14 ? 0x1c : 0x24;
++
++		reg += 2 * rt2x00dev->lna_gain;
+ 		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
+ 
+ 		rt2800_iq_calibrate(rt2x00dev, rf->channel);
+-- 
+2.12.2
+
diff --git a/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch b/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch
new file mode 100644
index 0000000..1dafb78
--- /dev/null
+++ b/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch
@@ -0,0 +1,34 @@
+From feb608c7986c14bab153f31f8e96f251072e6578 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Mon, 10 Apr 2017 15:33:20 +0200
+Subject: [PATCH 2/2] rt2800: do VCO calibration after programming ALC
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+    linux-wireless at vger.kernel.org,
+    Kalle Valo <kvalo at codeaurora.org>
+
+Scanning fails if we don't do VCO calibration every time.
+The vendor driver duplicates the VCO calibration function into the
+channel switching logic, we can do the same with less duplication.
+
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index 7135519a638c..870bf315f98b 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3407,6 +3407,8 @@ static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
+ 			rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
+ 	}
+ 	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl);
++
++	rt2800_vco_calibration(rt2x00dev);
+ }
+ 
+ static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
+-- 
+2.12.2
+


From lede-commits at lists.infradead.org  Tue Apr 18 00:45:30 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 18 Apr 2017 03:45:30 -0400
Subject: [source]  mac80211: fix kconfig recursive dependency warning
In-Reply-To: <20170418074530.10020.9533@git-01.infra.lede-project.org>
References: <20170418074530.10020.9533@git-01.infra.lede-project.org>
Message-ID: <mailman.24349.1492501558.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/00b32b8326a4de676f55e4a59ac6e7c2c401f9b5

commit 00b32b8326a4de676f55e4a59ac6e7c2c401f9b5
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Apr 18 09:42:04 2017 +0200

    mac80211: fix kconfig recursive dependency warning
    
    Make brcmfmac depend on !TARGET_uml.
    Technically, brcmfmac could be built for uml because only SDIO support
    won't work on that target. However, selectively avoiding the dependency
    propagation of !TARGET_uml from kmod-mmc to avoid including a reference
    to BRCMFMAC_SDIO doesn't work.
    
    In practice, brcmfmac is completely useless on uml, so let's just
    disable it there.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/kernel/mac80211/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index c5a2577..39cda12 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -689,7 +689,7 @@ define KernelPackage/brcmfmac
   TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
   DEPENDS+= @USB_SUPPORT +kmod-cfg80211 + at DRIVER_11N_SUPPORT + at DRIVER_11AC_SUPPORT +kmod-brcmutil \
-	+BRCMFMAC_SDIO&&!TARGET_uml:kmod-mmc \
+	+BRCMFMAC_SDIO:kmod-mmc @!TARGET_uml \
 	+BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
   AUTOLOAD:=$(call AutoProbe,brcmfmac)
@@ -704,7 +704,6 @@ define KernelPackage/brcmfmac/config
 
 	config BRCMFMAC_SDIO
 		bool "Enable SDIO bus interface support"
-		depends on !TARGET_uml
 		default y if TARGET_brcm2708
 		default n
 		help


From lede-commits at lists.infradead.org  Tue Apr 18 02:33:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 18 Apr 2017 05:33:09 -0400
Subject: [source]  mac80211: rt2800: fix mt7620 vco calibration registers
In-Reply-To: <20170418093308.3345.22795@git-01.infra.lede-project.org>
References: <20170418093308.3345.22795@git-01.infra.lede-project.org>
Message-ID: <mailman.24376.1492508014.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/d2f864f7bf04124d34a55a826a0f1f18ff00e3d1

commit d2f864f7bf04124d34a55a826a0f1f18ff00e3d1
Author: Tomislav Po?ega <pozega.tomislav at gmail.com>
AuthorDate: Sun Apr 16 14:14:42 2017 +0200

    mac80211: rt2800: fix mt7620 vco calibration registers
    
    Use register values from init LNA function instead of the ones from
    restore LNA function. Apply register values based on rx path
    configuration.
    
    Signed-off-by: Tomislav Po?ega <pozega.tomislav at gmail.com>
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
    [daniel at makrotopia.org: moved changes into a separate patch]
---
 ...2800-fix-mt7620-vco-calibration-registers.patch | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch b/package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch
new file mode 100644
index 0000000..708b0b2
--- /dev/null
+++ b/package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch
@@ -0,0 +1,50 @@
+From 02c452f317b4a4d06c433c294e66896a389731c1 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Tue, 18 Apr 2017 11:09:53 +0200
+Subject: [PATCH] rt2800: fix mt7620 vco calibration registers
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+    linux-wireless at vger.kernel.org,
+    Kalle Valo <kvalo at codeaurora.org>,
+    Tom Psyborg <pozega.tomislav at gmail.com>
+
+Use register values from init LNA function instead of the ones from
+restore LNA function. Apply register values based on rx path
+configuration.
+
+Signed-off-by: Tomislav Po?ega <pozega.tomislav at gmail.com>
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index 870bf315f98b..86cffee6876a 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -4932,7 +4932,7 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev)
+ 	rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
+ 
+ 	if (rt2x00_rt(rt2x00dev, RT6352)) {
+-		if (rt2x00dev->default_ant.tx_chain_num == 1) {
++		if (rt2x00dev->default_ant.rx_chain_num == 1) {
+ 			rt2800_bbp_write(rt2x00dev, 91, 0x07);
+ 			rt2800_bbp_write(rt2x00dev, 95, 0x1A);
+ 			rt2800_bbp_write(rt2x00dev, 195, 128);
+@@ -4953,8 +4953,8 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev)
+ 		}
+ 
+ 		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+-			rt2800_bbp_write(rt2x00dev, 75, 0x60);
+-			rt2800_bbp_write(rt2x00dev, 76, 0x44);
++			rt2800_bbp_write(rt2x00dev, 75, 0x68);
++			rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+ 			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+ 			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+ 			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+-- 
+2.12.2
+


From lede-commits at lists.infradead.org  Tue Apr 18 03:01:17 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 18 Apr 2017 06:01:17 -0400
Subject: [source]  mac80211: rt2800: fix mt7620 E2 channel registers
In-Reply-To: <20170418100117.9148.22231@git-01.infra.lede-project.org>
References: <20170418100117.9148.22231@git-01.infra.lede-project.org>
Message-ID: <mailman.24381.1492509699.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/e209988a17d3ef67c75c8e337df7dc44675264af

commit e209988a17d3ef67c75c8e337df7dc44675264af
Author: Tomislav Po?ega <pozega.tomislav at gmail.com>
AuthorDate: Fri Apr 14 20:59:47 2017 +0200

    mac80211: rt2800: fix mt7620 E2 channel registers
    
    update RF register 47 and 54 values according to vendor driver
    
    Signed-off-by: Tomislav Po?ega <pozega.tomislav at gmail.com>
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
    [daniel at makrotopia.org: moved changes into a separate patch]
---
 ...04-rt2800-fix-mt7620-E2-channel-registers.patch | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch b/package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch
new file mode 100644
index 0000000..284a347
--- /dev/null
+++ b/package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch
@@ -0,0 +1,41 @@
+From c426cb0ed15ee12dfdc8c53ddd1449ac617023cf Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Tue, 18 Apr 2017 11:45:37 +0200
+Subject: [PATCH] rt2800: fix mt7620 E2 channel registers
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+    linux-wireless at vger.kernel.org,
+    Kalle Valo <kvalo at codeaurora.org>,
+    Tom Psyborg <pozega.tomislav at gmail.com>
+
+From: Tomislav Po?ega <pozega.tomislav at gmail.com>
+
+update RF register 47 and 54 values according to vendor driver
+
+Signed-off-by: Tomislav Po?ega <pozega.tomislav at gmail.com>
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index 86cffee6876a..8585cdc3de53 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -8145,9 +8145,11 @@ static void rt2800_init_rfcsr_6352(struct rt2x00_dev *rt2x00dev)
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3);
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
+-	rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x69);
++	rt2800_rfcsr_write_bank(rt2x00dev, 4, 47, 0x67);
++	rt2800_rfcsr_write_bank(rt2x00dev, 6, 47, 0x69);
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFF);
+-	rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x20);
++	rt2800_rfcsr_write_bank(rt2x00dev, 4, 54, 0x27);
++	rt2800_rfcsr_write_bank(rt2x00dev, 6, 54, 0x20);
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF);
+ 	rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C);
+-- 
+2.12.2
+


From lede-commits at lists.infradead.org  Wed Apr 19 12:03:10 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 19 Apr 2017 15:03:10 -0400
Subject: [source]  generic: mtd: backport mx25u25635f stateless 4b support
In-Reply-To: <20170419190310.23098.83393@git-01.infra.lede-project.org>
References: <20170419190310.23098.83393@git-01.infra.lede-project.org>
Message-ID: <mailman.24898.1492628614.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/226e194335c0d9a92402fbab772eac4f38786e45

commit 226e194335c0d9a92402fbab772eac4f38786e45
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Tue Apr 11 19:46:16 2017 +0200

    generic: mtd: backport mx25u25635f stateless 4b support
    
    Use the stateless 4-byte op codes for this flash chip to fix reboot
    hangs on SoCs expecting the flash chip in 3-byte mode.
    
    Fixes: FS#179
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 ...-enable-stateless-4b-op-codes-for-mx25u25.patch | 29 ++++++++++++++++++++++
 .../patches-4.9/105-mtd-nor-add-mx25l25635f.patch  |  2 +-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/target/linux/generic/patches-4.9/063-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch b/target/linux/generic/patches-4.9/063-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch
new file mode 100644
index 0000000..3395915
--- /dev/null
+++ b/target/linux/generic/patches-4.9/063-mtd-spi-nor-enable-stateless-4b-op-codes-for-mx25u25.patch
@@ -0,0 +1,29 @@
+From b0fcb4b413028376894feaaaf62bcb09ab1b52f2 Mon Sep 17 00:00:00 2001
+From: Mathias Kresin <dev at kresin.me>
+Date: Thu, 13 Apr 2017 09:23:54 +0200
+Subject: [PATCH] mtd: spi-nor: enable stateless 4b op codes for mx25u25635f
+
+All required stateless 4-byte op codes are supported by this flash
+chip. The stateless 4-byte support can't be autodetected due to a
+missing 4-byte Address Instruction Table in SFDP.
+
+Fixes hangs on reboot for SoCs expecting the flash chip in 3byte mode.
+
+Signed-off-by: Mathias Kresin <dev at kresin.me>
+Acked-by: Marek Vasut <marek.vasut at gmail.com>
+Signed-off-by: Cyrille Pitchen <cyrille.pitchen at atmel.com>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -1017,7 +1017,7 @@ static const struct flash_info spi_nor_i
+ 	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
+ 	{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
+ 	{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
+-	{ "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K) },
++	{ "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
+ 	{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
+ 	{ "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) },
+ 	{ "mx66l1g55g",  INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },
diff --git a/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch b/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch
index de54dba..edfafda 100644
--- a/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch
+++ b/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch
@@ -17,6 +17,6 @@ the ubi volume created by the other.
  	{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
 -	{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
 +	{ "mx25l25635f", INFO(0xc22019, 0, 64 * 1024, 512, SECT_4K) },
- 	{ "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K) },
+ 	{ "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
  	{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
  	{ "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) },


From lede-commits at lists.infradead.org  Thu Apr 20 07:55:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 10:55:06 -0400
Subject: [source]  ar71xx: add TP-LINK TL-WR841N/ND v12 image
In-Reply-To: <20170420145506.9970.79994@git-01.infra.lede-project.org>
References: <20170420145506.9970.79994@git-01.infra.lede-project.org>
Message-ID: <mailman.25104.1492700258.26984.lede-commits@lists.infradead.org>

neoraider pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/3dbc4175a82c0cfe6c8f435b49bd9370ab442a4f

commit 3dbc4175a82c0cfe6c8f435b49bd9370ab442a4f
Author: Vittorio Gambaletta <openwrt at vittgam.net>
AuthorDate: Sun Mar 26 09:55:44 2017 +0200

    ar71xx: add TP-LINK TL-WR841N/ND v12 image
    
    This router has the same hardware as TP-LINK TL-WR841N/ND v11 (same FCC
    ID, same TFTP image name...).
    
    If the stock firmware web interface doesn't accept LEDE factory image,
    it can be flashed via the U-Boot TFTP recovery mode, by long-pressing
    the reset button after power on.
    
    The TFTP image name is wr841nv11_tp_recovery.bin (yes, v11, not v12).
    
    Signed-off-by: Vittorio Gambaletta <openwrt at vittgam.net>
---
 target/linux/ar71xx/image/tp-link.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 480d9ad..1c88f43 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -668,6 +668,12 @@ define Device/tl-wr841-v11
    IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
 endef
 
+define Device/tl-wr841-v12
+  $(Device/tl-wr841-v11)
+  DEVICE_TITLE := TP-LINK TL-WR841N/ND v12
+  TPLINK_HWID := 0x08410012
+endef
+
 define Device/tl-wr842n-v1
     $(Device/tplink-8m)
     DEVICE_TITLE := TP-LINK TL-WR842N/ND v1
@@ -710,7 +716,7 @@ define Device/tl-wr847n-v8
     DEVICE_PROFILE := TLWR841
     TPLINK_HWID := 0x08470008
 endef
-TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
+TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr841-v12 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
 
 define Device/tl-wr941nd-v2
     $(Device/tplink-4m)


From lede-commits at lists.infradead.org  Wed Apr 12 00:52:36 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 12 Apr 2017 03:52:36 -0400
Subject: [source]  mvebu: remove linux 4.4 support
In-Reply-To: <20170412075236.24091.42206@git-01.infra.lede-project.org>
References: <20170412075236.24091.42206@git-01.infra.lede-project.org>
Message-ID: <mailman.25206.1492703054.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/51397d7d95d9f5e210a5557f65de1fa21e6f5921

commit 51397d7d95d9f5e210a5557f65de1fa21e6f5921
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Feb 13 11:02:06 2017 +0100

    mvebu: remove linux 4.4 support
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/mvebu/config-4.4                      |  437 -----
 .../mvebu/patches-4.4/002-add_powertables.patch    |  748 ---------
 .../mvebu/patches-4.4/003-add_switch_nodes.patch   |   40 -
 .../mvebu/patches-4.4/010-build_new_dtbs.patch     |   11 -
 ...xa3xx_nand-add-support-for-partial-chunks.patch |  428 -----
 ...a3xx_nand-Increase-the-initial-chunk-size.patch |   42 -
 ...nand-Fix-initial-controller-configuration.patch |  104 --
 ...bus-provide-api-for-obtaining-IO-and-DRAM.patch |   94 --
 .../030-mvneta-consolidate-autoneg-enabling.patch  |   55 -
 ...implement-ethtool-autonegotiation-control.patch |  165 --
 ...Make-the-default-queue-related-for-each-p.patch |  131 --
 ...-mvneta-Associate-RX-queues-with-each-CPU.patch |  278 ----
 .../034-net-mvneta-Add-naive-RSS-support.patch     |  191 ---
 .../035-net-mvneta-Configure-XPS-support.patch     |  124 --
 ...fix-trivial-cut-off-issue-in-mvneta_ethto.patch |   46 -
 ...net-mvneta-Fix-for_each_present_cpu-usage.patch |   55 -
 ...Fix-the-CPU-choice-in-mvneta_percpu_elect.patch |   57 -
 ...-net-mvneta-Use-on_each_cpu-when-possible.patch |   68 -
 ...Modify-the-queue-related-fields-from-each.patch |  179 ---
 ...The-mvneta_percpu_elect-function-should-b.patch |   68 -
 ...mvneta-Fix-race-condition-during-stopping.patch |  128 --
 ...neta-sort-the-headers-in-alphabetic-order.patch |   56 -
 ...d-a-hardware-buffer-management-helper-API.patch |  159 --
 ...bm-add-support-for-hardware-buffer-manage.patch | 1684 --------------------
 ...046-net-mvneta-Use-the-new-hwbm-framework.patch |  359 -----
 .../047-net-mvneta-Fix-spinlock-usage.patch        |   52 -
 ...fix-error-messages-in-mvneta_port_down-fu.patch |   33 -
 ...replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch |   56 -
 ...fix-changing-MTU-when-using-per-cpu-proce.patch |   75 -
 ...M-dts-armada-38x-add-buffer-manager-nodes.patch |   53 -
 ...RM-dts-armada-xp-add-buffer-manager-nodes.patch |   53 -
 ...d-SolidRun-Armada-388-Clearfog-A1-DT-file.patch |  611 -------
 ...ada-38x-enable-buffer-manager-support-on-.patch |  256 ---
 ...ada-388-clearfog-remove-duplicate-mdio-en.patch |   41 -
 .../mvebu/patches-4.4/100-find_active_root.patch   |   62 -
 .../mvebu/patches-4.4/102-revert_i2c_delay.patch   |   15 -
 .../patches-4.4/103-remove-nand-driver-bug.patch   |   13 -
 .../104-linksys_mamba_disable_keep_config.patch    |   10 -
 .../106-enable-bm-on-linksys-devices.patch         |  107 --
 .../110-pxa3xxx_revert_irq_thread.patch            |   69 -
 ...xed_phy-MII-register-generation-to-a-libr.patch |  306 ----
 ...-swphy-register-generation-to-tabular-for.patch |  203 ---
 ...e-swphy-state-validation-from-register-ge.patch |  138 --
 ...3-phy-generate-swphy-registers-on-the-fly.patch |  204 ---
 ...-safety-of-fixed-phy-MII-register-reading.patch |   92 --
 ...ovide-a-hook-for-link-up-link-down-events.patch |  183 ---
 ...-marvell-88E1512-add-flow-control-support.patch |   26 -
 ...-phy-export-phy_start_machine-for-phylink.patch |   25 -
 ...8-phy-export-phy_speed_to_str-for-phylink.patch |   44 -
 .../patches-4.4/129-phy-add-I2C-mdio-bus.patch     |  163 --
 .../130-phylink-add-phylink-infrastructure.patch   | 1005 ------------
 .../131-phylink-add-hooks-for-SFP-support.patch    |  156 --
 ...-sfp-add-phylink-based-SFP-module-support.patch | 1382 ----------------
 .../133-sfp-display-SFP-module-information.patch   |  283 ----
 .../134-net-mvneta-convert-to-phylink.patch        |  697 --------
 ...y-fixed-phy-remove-fixed_phy_update_state.patch |   80 -
 ...36-phylink-add-ethtool-nway_reset-support.patch |   48 -
 .../137-net-mvneta-add-nway_reset-support.patch    |   38 -
 .../138-phylink-add-flow-control-support.patch     |  262 ---
 ...neta-add-flow-control-support-via-phylink.patch |   66 -
 ...a-enable-flow-control-for-PHY-connections.patch |   32 -
 ...enable-flow-control-for-fixed-connections.patch |   53 -
 .../patches-4.4/142-phylink-add-EEE-support.patch  |  111 --
 .../143-net-mvneta-add-EEE-support.patch           |  182 ---
 .../144-phylink-add-module-EEPROM-support.patch    |  137 --
 ...-mvneta-add-module-EEPROM-reading-support.patch |   44 -
 .../146-sfp-phylink-hook-up-eeprom-functions.patch |   68 -
 .../147-net-mvneta-add-BQL-support.patch           |   83 -
 .../202-gpio_mvebu_add_limited_pwm_support.patch   |  433 -----
 ..._extend_mvebu_gpio_documentation_with_pwm.patch |   52 -
 ...mvebu_xp_add_pwm_properties_to_dtsi_files.patch |  149 --
 .../205-arm_mvebu_enable_pwm_in_defconfig.patch    |   18 -
 ...rt1900ac_use_pwm-fan_rather_than_gpio-fan.patch |   28 -
 .../207-armada-385-rd-mtd-partitions.patch         |   19 -
 .../208-ARM-mvebu-385-ap-Add-partitions.patch      |   34 -
 .../patches-4.4/209-clearfog_switch_node.patch     |   21 -
 ...armada388-clearfog-add-SFP-module-support.patch |   84 -
 .../mvebu/patches-4.4/300-reprobe_sfp_phy.patch    |   96 --
 .../400-mvneta-tx-queue-workaround.patch           |   36 -
 79 files changed, 14294 deletions(-)

diff --git a/target/linux/mvebu/config-4.4 b/target/linux/mvebu/config-4.4
deleted file mode 100644
index d819970..0000000
--- a/target/linux/mvebu/config-4.4
+++ /dev/null
@@ -1,437 +0,0 @@
-CONFIG_AHCI_MVEBU=y
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_TICK_BROADCAST=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MULTIPLATFORM=y
-# CONFIG_ARCH_MULTI_CPU_AUTO is not set
-CONFIG_ARCH_MULTI_V6_V7=y
-CONFIG_ARCH_MULTI_V7=y
-CONFIG_ARCH_MVEBU=y
-CONFIG_ARCH_NR_GPIO=0
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_ARM=y
-CONFIG_ARMADA_370_CLK=y
-CONFIG_ARMADA_370_XP_TIMER=y
-CONFIG_ARMADA_38X_CLK=y
-CONFIG_ARMADA_THERMAL=y
-CONFIG_ARMADA_XP_CLK=y
-CONFIG_ARM_APPENDED_DTB=y
-CONFIG_ARM_ATAG_DTB_COMPAT=y
-# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
-CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
-CONFIG_ARM_CPU_SUSPEND=y
-CONFIG_ARM_CRYPTO=y
-CONFIG_ARM_ERRATA_720789=y
-CONFIG_ARM_GIC=y
-CONFIG_ARM_HAS_SG_CHAIN=y
-CONFIG_ARM_HEAVY_MB=y
-CONFIG_ARM_L1_CACHE_SHIFT=6
-CONFIG_ARM_L1_CACHE_SHIFT_6=y
-# CONFIG_ARM_LPAE is not set
-CONFIG_ARM_MVEBU_V7_CPUIDLE=y
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-CONFIG_ARM_THUMB=y
-# CONFIG_ARM_THUMBEE is not set
-CONFIG_ARM_UNWIND=y
-CONFIG_ARM_VIRT_EXT=y
-CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
-CONFIG_ATA=y
-CONFIG_ATAGS=y
-CONFIG_AUTO_ZRELADDR=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BOUNCE=y
-# CONFIG_CACHE_FEROCEON_L2 is not set
-CONFIG_CACHE_L2X0=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CLKSRC_OF=y
-CONFIG_CLKSRC_PROBE=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_COMMON_CLK=y
-CONFIG_CPUFREQ_DT=y
-CONFIG_CPU_32v6K=y
-CONFIG_CPU_32v7=y
-CONFIG_CPU_ABRT_EV7=y
-# CONFIG_CPU_BIG_ENDIAN is not set
-# CONFIG_CPU_BPREDICT_DISABLE is not set
-CONFIG_CPU_CACHE_V7=y
-CONFIG_CPU_CACHE_VIPT=y
-CONFIG_CPU_COPY_V6=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CPU_FREQ_GOV_COMMON=y
-# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
-CONFIG_CPU_FREQ_GOV_ONDEMAND=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
-# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
-CONFIG_CPU_FREQ_STAT=y
-CONFIG_CPU_HAS_ASID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_IDLE=y
-CONFIG_CPU_IDLE_GOV_LADDER=y
-CONFIG_CPU_PABRT_V7=y
-CONFIG_CPU_PJ4B=y
-CONFIG_CPU_PM=y
-CONFIG_CPU_RMAP=y
-CONFIG_CPU_THERMAL=y
-CONFIG_CPU_TLB_V7=y
-CONFIG_CPU_V7=y
-CONFIG_CRC16=y
-CONFIG_CRYPTO_ABLK_HELPER=y
-CONFIG_CRYPTO_AEAD=y
-CONFIG_CRYPTO_AEAD2=y
-CONFIG_CRYPTO_AES_ARM=y
-CONFIG_CRYPTO_AES_ARM_BS=y
-# CONFIG_CRYPTO_AES_ARM_CE is not set
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_CRYPTD=y
-CONFIG_CRYPTO_DEFLATE=y
-CONFIG_CRYPTO_DES=y
-CONFIG_CRYPTO_DEV_MARVELL_CESA=y
-# CONFIG_CRYPTO_GHASH_ARM_CE is not set
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_HW=y
-CONFIG_CRYPTO_LZO=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_MANAGER2=y
-CONFIG_CRYPTO_NULL2=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_SHA1=y
-CONFIG_CRYPTO_SHA1_ARM=y
-# CONFIG_CRYPTO_SHA1_ARM_CE is not set
-CONFIG_CRYPTO_SHA1_ARM_NEON=y
-CONFIG_CRYPTO_SHA256_ARM=y
-# CONFIG_CRYPTO_SHA2_ARM_CE is not set
-CONFIG_CRYPTO_SHA512_ARM=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_DCACHE_WORD_ACCESS=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_LL=y
-CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
-CONFIG_DEBUG_MVEBU_UART0=y
-# CONFIG_DEBUG_MVEBU_UART0_ALTERNATE is not set
-# CONFIG_DEBUG_MVEBU_UART1_ALTERNATE is not set
-CONFIG_DEBUG_UART_8250=y
-# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set
-CONFIG_DEBUG_UART_8250_SHIFT=2
-# CONFIG_DEBUG_UART_8250_WORD is not set
-CONFIG_DEBUG_UART_PHYS=0xd0012000
-CONFIG_DEBUG_UART_VIRT=0xfec12000
-CONFIG_DEBUG_UNCOMPRESS=y
-CONFIG_DEBUG_USER=y
-CONFIG_DMADEVICES=y
-CONFIG_DMA_ENGINE=y
-CONFIG_DMA_ENGINE_RAID=y
-CONFIG_DMA_OF=y
-CONFIG_DTC=y
-# CONFIG_DW_DMAC_PCI is not set
-CONFIG_EARLY_PRINTK=y
-CONFIG_EDAC_ATOMIC_SCRUB=y
-CONFIG_EDAC_SUPPORT=y
-CONFIG_EXT4_FS=y
-# CONFIG_F2FS_CHECK_FS is not set
-CONFIG_F2FS_FS=y
-# CONFIG_F2FS_FS_SECURITY is not set
-CONFIG_F2FS_FS_XATTR=y
-CONFIG_F2FS_STAT_FS=y
-CONFIG_FIXED_PHY=y
-CONFIG_FIX_EARLYCON_MEM=y
-CONFIG_FS_MBCACHE=y
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_PHY=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GLOB=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_MVEBU=y
-CONFIG_GPIO_MVEBU_PWM=y
-CONFIG_GPIO_PCA953X=y
-# CONFIG_GPIO_PCA953X_IRQ is not set
-CONFIG_GPIO_SYSFS=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_BITREVERSE=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-CONFIG_HAVE_ARM_SCU=y
-CONFIG_HAVE_ARM_TWD=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_OPTPROBES=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SMP=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HIGHMEM=y
-# CONFIG_HIGHPTE is not set
-CONFIG_HOTPLUG_CPU=y
-CONFIG_HWBM=y
-CONFIG_HWMON=y
-CONFIG_HZ_FIXED=0
-CONFIG_HZ_PERIODIC=y
-CONFIG_I2C=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_MV64XXX=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IOMMU_HELPER=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_DOMAIN_DEBUG=y
-CONFIG_IRQ_DOMAIN_HIERARCHY=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-# CONFIG_IWMMXT is not set
-CONFIG_JBD2=y
-CONFIG_LEDS_GPIO=y
-CONFIG_LEDS_PCA963X=y
-CONFIG_LEDS_TLC591XX=y
-CONFIG_LIBFDT=y
-CONFIG_LOCK_SPIN_ON_OWNER=y
-CONFIG_LZO_COMPRESS=y
-CONFIG_LZO_DECOMPRESS=y
-CONFIG_MACH_ARMADA_370=y
-# CONFIG_MACH_ARMADA_375 is not set
-CONFIG_MACH_ARMADA_38X=y
-# CONFIG_MACH_ARMADA_39X is not set
-CONFIG_MACH_ARMADA_XP=y
-# CONFIG_MACH_DOVE is not set
-CONFIG_MACH_MVEBU_ANY=y
-CONFIG_MACH_MVEBU_V7=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_MANGLE_BOOTARGS=y
-CONFIG_MARVELL_PHY=y
-CONFIG_MDIO_BOARDINFO=y
-CONFIG_MDIO_I2C=y
-CONFIG_MEMORY=y
-CONFIG_MIGHT_HAVE_CACHE_L2X0=y
-CONFIG_MIGHT_HAVE_PCI=y
-CONFIG_MMC=y
-CONFIG_MMC_BLOCK=y
-CONFIG_MMC_MVSDIO=y
-CONFIG_MMC_SDHCI=y
-# CONFIG_MMC_SDHCI_PCI is not set
-CONFIG_MMC_SDHCI_PLTFM=y
-CONFIG_MMC_SDHCI_PXAV3=y
-# CONFIG_MMC_TIFM_SD is not set
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MTD_CFI_STAA=y
-CONFIG_MTD_M25P80=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_ECC=y
-CONFIG_MTD_NAND_PXA3xx=y
-CONFIG_MTD_SPI_NOR=y
-CONFIG_MTD_SPLIT_FIRMWARE=y
-CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_BEB_LIMIT=20
-CONFIG_MTD_UBI_BLOCK=y
-# CONFIG_MTD_UBI_FASTMAP is not set
-# CONFIG_MTD_UBI_GLUEBI is not set
-CONFIG_MTD_UBI_WL_THRESHOLD=4096
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_MUTEX_SPIN_ON_OWNER=y
-CONFIG_MVEBU_CLK_COMMON=y
-CONFIG_MVEBU_CLK_COREDIV=y
-CONFIG_MVEBU_CLK_CPU=y
-CONFIG_MVEBU_DEVBUS=y
-CONFIG_MVEBU_MBUS=y
-CONFIG_MVMDIO=y
-CONFIG_MVNETA=y
-CONFIG_MVNETA_BM=y
-CONFIG_MVSW61XX_PHY=y
-CONFIG_MV_XOR=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEON=y
-CONFIG_NET_FLOW_LIMIT=y
-CONFIG_NLS=y
-CONFIG_NOP_USB_XCEIV=y
-CONFIG_NO_BOOTMEM=y
-CONFIG_NR_CPUS=4
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MDIO=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_ORION_WATCHDOG=y
-CONFIG_OUTER_CACHE=y
-CONFIG_OUTER_CACHE_SYNC=y
-CONFIG_PAGE_OFFSET=0xC0000000
-CONFIG_PCI=y
-# CONFIG_PCI_DOMAINS_GENERIC is not set
-CONFIG_PCI_MVEBU=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=2
-CONFIG_PHYLIB=y
-CONFIG_PHYLINK=y
-CONFIG_PINCTRL=y
-CONFIG_PINCTRL_ARMADA_370=y
-CONFIG_PINCTRL_ARMADA_38X=y
-CONFIG_PINCTRL_ARMADA_XP=y
-CONFIG_PINCTRL_MVEBU=y
-# CONFIG_PINCTRL_SINGLE is not set
-CONFIG_PJ4B_ERRATA_4742=y
-# CONFIG_PL310_ERRATA_588369 is not set
-# CONFIG_PL310_ERRATA_727915 is not set
-# CONFIG_PL310_ERRATA_753970 is not set
-# CONFIG_PL310_ERRATA_769419 is not set
-CONFIG_PLAT_ORION=y
-CONFIG_PM_OPP=y
-CONFIG_PWM=y
-CONFIG_PWM_SYSFS=y
-CONFIG_RATIONAL=y
-CONFIG_RCU_STALL_COMMON=y
-CONFIG_REGMAP=y
-CONFIG_REGMAP_I2C=y
-CONFIG_REGULATOR=y
-CONFIG_REGULATOR_FIXED_VOLTAGE=y
-CONFIG_RFS_ACCEL=y
-CONFIG_RPS=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_ARMADA38X=y
-CONFIG_RTC_DRV_MV=y
-CONFIG_RWSEM_SPIN_ON_OWNER=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_SATA_AHCI_PLATFORM=y
-CONFIG_SATA_MV=y
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCHED_INFO is not set
-CONFIG_SCSI=y
-CONFIG_SENSORS_PWM_FAN=y
-CONFIG_SENSORS_TMP421=y
-CONFIG_SERIAL_8250_DW=y
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SFP=y
-CONFIG_SMP=y
-CONFIG_SMP_ON_UP=y
-CONFIG_SOC_BUS=y
-CONFIG_SPARSE_IRQ=y
-CONFIG_SPI=y
-CONFIG_SPI_MASTER=y
-CONFIG_SPI_ORION=y
-CONFIG_SRAM=y
-CONFIG_SRCU=y
-CONFIG_SWCONFIG=y
-CONFIG_SWIOTLB=y
-CONFIG_SWPHY=y
-CONFIG_SWP_EMULATE=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_THERMAL=y
-CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
-CONFIG_THERMAL_GOV_STEP_WISE=y
-CONFIG_THERMAL_HWMON=y
-CONFIG_THERMAL_OF=y
-# CONFIG_THUMB2_KERNEL is not set
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TIMER_STATS=y
-CONFIG_TREE_RCU=y
-CONFIG_UBIFS_FS=y
-# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
-CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_ZLIB=y
-CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
-CONFIG_USB=y
-CONFIG_USB_COMMON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_HCD_ORION=y
-CONFIG_USB_EHCI_HCD_PLATFORM=y
-CONFIG_USB_EHCI_PCI=y
-CONFIG_USB_LEDS_TRIGGER_USBPORT=y
-CONFIG_USB_PHY=y
-CONFIG_USB_STORAGE=y
-CONFIG_USB_SUPPORT=y
-# CONFIG_USB_UHCI_HCD is not set
-CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_MVEBU=y
-CONFIG_USB_XHCI_PCI=y
-CONFIG_USB_XHCI_PLATFORM=y
-CONFIG_USE_OF=y
-CONFIG_VECTORS_BASE=0xffff0000
-CONFIG_VFP=y
-CONFIG_VFPv3=y
-CONFIG_WATCHDOG_CORE=y
-CONFIG_XPS=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/mvebu/patches-4.4/002-add_powertables.patch b/target/linux/mvebu/patches-4.4/002-add_powertables.patch
deleted file mode 100644
index a5a47e4..0000000
--- a/target/linux/mvebu/patches-4.4/002-add_powertables.patch
+++ /dev/null
@@ -1,748 +0,0 @@
---- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-@@ -86,12 +86,100 @@
- 			pcie at 2,0 {
- 				/* Port 0, Lane 1 */
- 				status = "okay";
-+
-+				mwlwifi {
-+					marvell,5ghz = <0>;
-+					marvell,chainmask = <4 4>;
-+					marvell,powertable {
-+						FCC =
-+							<1 0 0x17 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0x17 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>;
-+
-+						ETSI =
-+							<1 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>;
-+					};
-+				};
- 			};
- 
- 			/* Second mini-PCIe port */
- 			pcie at 3,0 {
- 				/* Port 0, Lane 3 */
- 				status = "okay";
-+
-+				mwlwifi {
-+					marvell,2ghz = <0>;
-+					marvell,chainmask = <4 4>;
-+					marvell,powertable {
-+						FCC =
-+							<36 0 0x8 0x8 0x8 0x8 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<40 0 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<44 0 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<48 0 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<52 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
-+							<56 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
-+							<60 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
-+							<64 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
-+							<100 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<104 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<108 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<112 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<116 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<120 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<124 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<128 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<132 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<136 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<140 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<149 0 0x16 0x16 0x16 0x16 0x14 0x14 0x14 0x14 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
-+							<153 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
-+							<157 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
-+							<161 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
-+							<165 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>;
-+
-+						ETSI =
-+							<36 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<40 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<44 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<48 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<52 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<56 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<60 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<64 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<100 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<104 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<108 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<112 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<116 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<120 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<124 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<128 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<132 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<136 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<140 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
-+							<149 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>;
-+					};
-+				};
- 			};
- 		};
- 
---- a/arch/arm/boot/dts/armada-385-linksys-cobra.dts
-+++ b/arch/arm/boot/dts/armada-385-linksys-cobra.dts
-@@ -100,6 +100,212 @@
- 				};
- 			};
- 		};
-+
-+		pcie-controller {
-+			pcie at 1,0 {
-+				mwlwifi {
-+					marvell,2ghz = <0>;
-+					marvell,chainmask = <4 4>;
-+					marvell,powertable {
-+						AU =
-+							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<100 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<104 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<108 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<112 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<116 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<120 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<124 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<128 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<132 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<136 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<140 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<149 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<153 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<157 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<161 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<165 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>;
-+						CA =
-+							<36 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<40 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<44 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<48 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
-+						CN =
-+							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<149 0 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<165 0 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>;
-+						ETSI =
-+							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<149 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>;
-+						FCC =
-+							<36 0 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0 0xf>,
-+							<40 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
-+							<44 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
-+							<48 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
-+					};
-+				};
-+			};
-+
-+			pcie at 2,0 {
-+				mwlwifi {
-+					marvell,5ghz = <0>;
-+					marvell,chainmask = <4 4>;
-+					marvell,powertable {
-+						AU =
-+							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
-+						CA =
-+							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
-+						CN =
-+							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<14 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
-+						ETSI =
-+							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
-+						FCC =
-+							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
-+					};
-+				};
-+			};
-+		};
- 	};
- 
- 	gpio-leds {
---- a/arch/arm/boot/dts/armada-385-linksys-caiman.dts
-+++ b/arch/arm/boot/dts/armada-385-linksys-caiman.dts
-@@ -100,6 +100,212 @@
- 				};
- 			};
- 		};
-+
-+		pcie-controller {
-+			pcie at 1,0 {
-+				mwlwifi {
-+					marvell,2ghz = <0>;
-+					marvell,chainmask = <2 2>;
-+					marvell,powertable {
-+						AU =
-+							<36 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<40 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<44 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<48 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<100 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<104 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<108 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<112 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<116 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<120 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<124 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<128 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<132 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<136 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<140 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
-+							<149 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
-+							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
-+							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
-+							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
-+							<165 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>;
-+						CA =
-+							<36 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
-+							<40 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
-+							<44 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
-+							<48 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<149 0 0x1a 0x1a 0x18 0x17 0x19 0x19 0x17 0x15 0x18 0x18 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<165 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>;
-+						CN =
-+							<36 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<40 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<44 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<48 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<100 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<149 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x11 0x11 0x11 0x11 0 0xf>,
-+							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>,
-+							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>,
-+							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>,
-+							<165 0 0x15 0x15 0x15 0x15 0x16 0x16 0x16 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>;
-+						ETSI =
-+							<36 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<40 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<44 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<48 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<100 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
-+							<149 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>;
-+						FCC =
-+							<36 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<40 0 0x19 0x19 0x18 0x17 0x19 0x19 0x17 0x15 0x17 0x17 0x17 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<44 0 0x19 0x19 0x18 0x17 0x19 0x19 0x17 0x15 0x17 0x17 0x17 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<48 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x17 0x17 0x17 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<149 0 0x1a 0x1a 0x18 0x17 0x19 0x19 0x17 0x15 0x18 0x18 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
-+							<165 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>;
-+					};
-+				};
-+			};
-+
-+			pcie at 2,0 {
-+				mwlwifi {
-+					marvell,5ghz = <0>;
-+					marvell,chainmask = <2 2>;
-+					marvell,powertable {
-+						AU =
-+							<1 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>;
-+						CA =
-+							<1 0 0x19 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x10 0x10 0x10 0x10 0x00 0x00 0x00 0x00 0 0xf>,
-+							<2 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<3 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<4 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<5 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<6 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<7 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<8 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<9 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<10 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
-+							<11 0 0x19 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x00 0x00 0x00 0x00 0 0xf>;
-+						CN =
-+							<1 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<14 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>;
-+						ETSI =
-+							<1 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>;
-+						FCC =
-+							<1 0 0x19 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0x19 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x0 0x0 0x0 0x0 0 0xf>;
-+					};
-+				};
-+			};
-+		};
- 	};
- 
- 	gpio-leds {
---- a/arch/arm/boot/dts/armada-385-linksys-shelby.dts
-+++ b/arch/arm/boot/dts/armada-385-linksys-shelby.dts
-@@ -100,6 +100,212 @@
- 				};
- 			};
- 		};
-+
-+		pcie-controller {
-+			pcie at 1,0 {
-+				mwlwifi {
-+					marvell,2ghz = <0>;
-+					marvell,chainmask = <4 4>;
-+					marvell,powertable {
-+						AU =
-+							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<100 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<104 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<108 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<112 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<116 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<120 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<124 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<128 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<132 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<136 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<140 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
-+							<149 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<153 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<157 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<161 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
-+							<165 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>;
-+						CA =
-+							<36 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<40 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<44 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<48 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
-+						CN =
-+							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<149 0 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
-+							<165 0 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>;
-+						ETSI =
-+							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
-+							<149 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>;
-+						FCC =
-+							<36 0 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0 0xf>,
-+							<40 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
-+							<44 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
-+							<48 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
-+							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
-+							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
-+							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
-+							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
-+					};
-+				};
-+			};
-+
-+			pcie at 2,0 {
-+				mwlwifi {
-+					marvell,5ghz = <0>;
-+					marvell,chainmask = <4 4>;
-+					marvell,powertable {
-+						AU =
-+							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
-+						CA =
-+							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
-+						CN =
-+							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<14 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
-+						ETSI =
-+							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
-+							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
-+						FCC =
-+							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
-+							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
-+							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
-+					};
-+				};
-+			};
-+		};
- 	};
- 
- 	gpio-leds {
diff --git a/target/linux/mvebu/patches-4.4/003-add_switch_nodes.patch b/target/linux/mvebu/patches-4.4/003-add_switch_nodes.patch
deleted file mode 100644
index 1502b6b..0000000
--- a/target/linux/mvebu/patches-4.4/003-add_switch_nodes.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-@@ -467,6 +467,16 @@
- 			};
- 		};
- 	};
-+
-+	mvsw61xx {
-+		compatible = "marvell,88e6172";
-+		status = "okay";
-+		reg = <0x10>;
-+
-+		mii-bus = <&mdio>;
-+		cpu-port-0 = <5>;
-+		cpu-port-1 = <6>;
-+	};
- };
- 
- &pinctrl {
---- a/arch/arm/boot/dts/armada-385-linksys.dtsi
-+++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
-@@ -309,6 +309,18 @@
- 			};
- 		};
- 	};
-+
-+	mvsw61xx {
-+		#address-cells = <1>;
-+		#size-cells = <0>;
-+		compatible = "marvell,88e6176";
-+		status = "okay";
-+		reg = <0x10>;
-+
-+		mii-bus = <&mdio>;
-+		cpu-port-0 = <5>;
-+		cpu-port-1 = <6>;
-+	};
- };
- 
- &pinctrl {
diff --git a/target/linux/mvebu/patches-4.4/010-build_new_dtbs.patch b/target/linux/mvebu/patches-4.4/010-build_new_dtbs.patch
deleted file mode 100644
index 6ba9ee6..0000000
--- a/target/linux/mvebu/patches-4.4/010-build_new_dtbs.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -748,6 +748,8 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \
- 	armada-385-db-ap.dtb \
- 	armada-385-linksys-caiman.dtb \
- 	armada-385-linksys-cobra.dtb \
-+	armada-385-linksys-rango.dtb \
-+	armada-385-linksys-shelby.dtb \
- 	armada-388-db.dtb \
- 	armada-388-gp.dtb \
- 	armada-388-rd.dtb
diff --git a/target/linux/mvebu/patches-4.4/020-mtd-nand-pxa3xx_nand-add-support-for-partial-chunks.patch b/target/linux/mvebu/patches-4.4/020-mtd-nand-pxa3xx_nand-add-support-for-partial-chunks.patch
deleted file mode 100644
index 2e67097..0000000
--- a/target/linux/mvebu/patches-4.4/020-mtd-nand-pxa3xx_nand-add-support-for-partial-chunks.patch
+++ /dev/null
@@ -1,428 +0,0 @@
-From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Date: Wed, 10 Feb 2016 14:54:21 +0100
-Subject: [PATCH] mtd: nand: pxa3xx_nand: add support for partial chunks
-
-This commit is needed to properly support the 8-bits ECC configuration
-with 4KB pages.
-
-When pages larger than 2 KB are used on platforms using the PXA3xx
-NAND controller, the reading/programming operations need to be split
-in chunks of 2 KBs or less because the controller FIFO is limited to
-about 2 KB (i.e a bit more than 2 KB to accommodate OOB data). Due to
-this requirement, the data layout on NAND is a bit strange, with ECC
-interleaved with data, at the end of each chunk.
-
-When a 4-bits ECC configuration is used with 4 KB pages, the physical
-data layout on the NAND looks like this:
-
-| 2048 data | 32 spare | 30 ECC | 2048 data | 32 spare | 30 ECC |
-
-So the data chunks have an equal size, 2080 bytes for each chunk,
-which the driver supports properly.
-
-When a 8-bits ECC configuration is used with 4KB pages, the physical
-data layout on the NAND looks like this:
-
-| 1024 data | 30 ECC | 1024 data | 30 ECC | 1024 data | 30 ECC | 1024 data | 30 ECC | 64 spare | 30 ECC |
-
-So, the spare area is stored in its own chunk, which has a different
-size than the other chunks. Since OOB is not used by UBIFS, the initial
-implementation of the driver has chosen to not support reading this
-additional "spare" chunk of data.
-
-Unfortunately, Marvell has chosen to store the BBT signature in the
-OOB area. Therefore, if the driver doesn't read this spare area, Linux
-has no way of finding the BBT. It thinks there is no BBT, and rewrites
-one, which U-Boot does not recognize, causing compatibility problems
-between the bootloader and the kernel in terms of NAND usage.
-
-To fix this, this commit implements the support for reading a partial
-last chunk. This support is currently only useful for the case of 8
-bits ECC with 4 KB pages, but it will be useful in the future to
-enable other configurations such as 12 bits and 16 bits ECC with 4 KB
-pages, or 8 bits ECC with 8 KB pages, etc. All those configurations
-have a "last" chunk that doesn't have the same size as the other
-chunks.
-
-In order to implement reading of the last chunk, this commit:
-
- - Adds a number of new fields to the pxa3xx_nand_info to describe how
-   many full chunks and how many chunks we have, the size of full
-   chunks and partial chunks, both in terms of data area and spare
-   area.
-
- - Fills in the step_chunk_size and step_spare_size variables to
-   describe how much data and spare should be read/written for the
-   current read/program step.
-
- - Reworks the state machine to accommodate doing the additional read
-   or program step when a last partial chunk is used.
-
-This commit has been tested on a Marvell Armada 398 DB board, with a
-4KB page NAND, tested in both 4 bits ECC and 8 bits ECC
-configurations. Robert Jarzmik has tested on some PXA platforms.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Tested-by: Robert Jarzmik <robert.jarzmik at free.fr>
-Acked-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
-Signed-off-by: Brian Norris <computersforpeace at gmail.com>
----
-
---- a/drivers/mtd/nand/pxa3xx_nand.c
-+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -228,15 +228,44 @@ struct pxa3xx_nand_info {
- 	int			use_spare;	/* use spare ? */
- 	int			need_wait;
- 
--	unsigned int		data_size;	/* data to be read from FIFO */
--	unsigned int		chunk_size;	/* split commands chunk size */
--	unsigned int		oob_size;
-+	/* Amount of real data per full chunk */
-+	unsigned int		chunk_size;
-+
-+	/* Amount of spare data per full chunk */
- 	unsigned int		spare_size;
-+
-+	/* Number of full chunks (i.e chunk_size + spare_size) */
-+	unsigned int            nfullchunks;
-+
-+	/*
-+	 * Total number of chunks. If equal to nfullchunks, then there
-+	 * are only full chunks. Otherwise, there is one last chunk of
-+	 * size (last_chunk_size + last_spare_size)
-+	 */
-+	unsigned int            ntotalchunks;
-+
-+	/* Amount of real data in the last chunk */
-+	unsigned int		last_chunk_size;
-+
-+	/* Amount of spare data in the last chunk */
-+	unsigned int		last_spare_size;
-+
- 	unsigned int		ecc_size;
- 	unsigned int		ecc_err_cnt;
- 	unsigned int		max_bitflips;
- 	int 			retcode;
- 
-+	/*
-+	 * Variables only valid during command
-+	 * execution. step_chunk_size and step_spare_size is the
-+	 * amount of real data and spare data in the current
-+	 * chunk. cur_chunk is the current chunk being
-+	 * read/programmed.
-+	 */
-+	unsigned int		step_chunk_size;
-+	unsigned int		step_spare_size;
-+	unsigned int            cur_chunk;
-+
- 	/* cached register value */
- 	uint32_t		reg_ndcr;
- 	uint32_t		ndtr0cs0;
-@@ -531,25 +560,6 @@ static int pxa3xx_nand_init(struct pxa3x
- 	return 0;
- }
- 
--/*
-- * Set the data and OOB size, depending on the selected
-- * spare and ECC configuration.
-- * Only applicable to READ0, READOOB and PAGEPROG commands.
-- */
--static void pxa3xx_set_datasize(struct pxa3xx_nand_info *info,
--				struct mtd_info *mtd)
--{
--	int oob_enable = info->reg_ndcr & NDCR_SPARE_EN;
--
--	info->data_size = mtd->writesize;
--	if (!oob_enable)
--		return;
--
--	info->oob_size = info->spare_size;
--	if (!info->use_ecc)
--		info->oob_size += info->ecc_size;
--}
--
- /**
-  * NOTE: it is a must to set ND_RUN firstly, then write
-  * command buffer, otherwise, it does not work.
-@@ -665,28 +675,28 @@ static void drain_fifo(struct pxa3xx_nan
- 
- static void handle_data_pio(struct pxa3xx_nand_info *info)
- {
--	unsigned int do_bytes = min(info->data_size, info->chunk_size);
--
- 	switch (info->state) {
- 	case STATE_PIO_WRITING:
--		writesl(info->mmio_base + NDDB,
--			info->data_buff + info->data_buff_pos,
--			DIV_ROUND_UP(do_bytes, 4));
-+		if (info->step_chunk_size)
-+			writesl(info->mmio_base + NDDB,
-+				info->data_buff + info->data_buff_pos,
-+				DIV_ROUND_UP(info->step_chunk_size, 4));
- 
--		if (info->oob_size > 0)
-+		if (info->step_spare_size)
- 			writesl(info->mmio_base + NDDB,
- 				info->oob_buff + info->oob_buff_pos,
--				DIV_ROUND_UP(info->oob_size, 4));
-+				DIV_ROUND_UP(info->step_spare_size, 4));
- 		break;
- 	case STATE_PIO_READING:
--		drain_fifo(info,
--			   info->data_buff + info->data_buff_pos,
--			   DIV_ROUND_UP(do_bytes, 4));
-+		if (info->step_chunk_size)
-+			drain_fifo(info,
-+				   info->data_buff + info->data_buff_pos,
-+				   DIV_ROUND_UP(info->step_chunk_size, 4));
- 
--		if (info->oob_size > 0)
-+		if (info->step_spare_size)
- 			drain_fifo(info,
- 				   info->oob_buff + info->oob_buff_pos,
--				   DIV_ROUND_UP(info->oob_size, 4));
-+				   DIV_ROUND_UP(info->step_spare_size, 4));
- 		break;
- 	default:
- 		dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__,
-@@ -695,9 +705,8 @@ static void handle_data_pio(struct pxa3x
- 	}
- 
- 	/* Update buffer pointers for multi-page read/write */
--	info->data_buff_pos += do_bytes;
--	info->oob_buff_pos += info->oob_size;
--	info->data_size -= do_bytes;
-+	info->data_buff_pos += info->step_chunk_size;
-+	info->oob_buff_pos += info->step_spare_size;
- }
- 
- static void pxa3xx_nand_data_dma_irq(void *data)
-@@ -738,8 +747,9 @@ static void start_data_dma(struct pxa3xx
- 				info->state);
- 		BUG();
- 	}
--	info->sg.length = info->data_size +
--		(info->oob_size ? info->spare_size + info->ecc_size : 0);
-+	info->sg.length = info->chunk_size;
-+	if (info->use_spare)
-+		info->sg.length += info->spare_size + info->ecc_size;
- 	dma_map_sg(info->dma_chan->device->dev, &info->sg, 1, info->dma_dir);
- 
- 	tx = dmaengine_prep_slave_sg(info->dma_chan, &info->sg, 1, direction,
-@@ -900,9 +910,11 @@ static void prepare_start_command(struct
- 	/* reset data and oob column point to handle data */
- 	info->buf_start		= 0;
- 	info->buf_count		= 0;
--	info->oob_size		= 0;
- 	info->data_buff_pos	= 0;
- 	info->oob_buff_pos	= 0;
-+	info->step_chunk_size   = 0;
-+	info->step_spare_size   = 0;
-+	info->cur_chunk         = 0;
- 	info->use_ecc		= 0;
- 	info->use_spare		= 1;
- 	info->retcode		= ERR_NONE;
-@@ -914,8 +926,6 @@ static void prepare_start_command(struct
- 	case NAND_CMD_READ0:
- 	case NAND_CMD_PAGEPROG:
- 		info->use_ecc = 1;
--	case NAND_CMD_READOOB:
--		pxa3xx_set_datasize(info, mtd);
- 		break;
- 	case NAND_CMD_PARAM:
- 		info->use_spare = 0;
-@@ -974,6 +984,14 @@ static int prepare_set_command(struct px
- 		if (command == NAND_CMD_READOOB)
- 			info->buf_start += mtd->writesize;
- 
-+		if (info->cur_chunk < info->nfullchunks) {
-+			info->step_chunk_size = info->chunk_size;
-+			info->step_spare_size = info->spare_size;
-+		} else {
-+			info->step_chunk_size = info->last_chunk_size;
-+			info->step_spare_size = info->last_spare_size;
-+		}
-+
- 		/*
- 		 * Multiple page read needs an 'extended command type' field,
- 		 * which is either naked-read or last-read according to the
-@@ -985,8 +1003,8 @@ static int prepare_set_command(struct px
- 			info->ndcb0 |= NDCB0_DBC | (NAND_CMD_READSTART << 8)
- 					| NDCB0_LEN_OVRD
- 					| NDCB0_EXT_CMD_TYPE(ext_cmd_type);
--			info->ndcb3 = info->chunk_size +
--				      info->oob_size;
-+			info->ndcb3 = info->step_chunk_size +
-+				info->step_spare_size;
- 		}
- 
- 		set_command_address(info, mtd->writesize, column, page_addr);
-@@ -1006,8 +1024,6 @@ static int prepare_set_command(struct px
- 				| NDCB0_EXT_CMD_TYPE(ext_cmd_type)
- 				| addr_cycle
- 				| command;
--			/* No data transfer in this case */
--			info->data_size = 0;
- 			exec_cmd = 1;
- 		}
- 		break;
-@@ -1019,6 +1035,14 @@ static int prepare_set_command(struct px
- 			break;
- 		}
- 
-+		if (info->cur_chunk < info->nfullchunks) {
-+			info->step_chunk_size = info->chunk_size;
-+			info->step_spare_size = info->spare_size;
-+		} else {
-+			info->step_chunk_size = info->last_chunk_size;
-+			info->step_spare_size = info->last_spare_size;
-+		}
-+
- 		/* Second command setting for large pages */
- 		if (mtd->writesize > PAGE_CHUNK_SIZE) {
- 			/*
-@@ -1029,14 +1053,14 @@ static int prepare_set_command(struct px
- 			info->ndcb0 |= NDCB0_CMD_TYPE(0x1)
- 					| NDCB0_LEN_OVRD
- 					| NDCB0_EXT_CMD_TYPE(ext_cmd_type);
--			info->ndcb3 = info->chunk_size +
--				      info->oob_size;
-+			info->ndcb3 = info->step_chunk_size +
-+				      info->step_spare_size;
- 
- 			/*
- 			 * This is the command dispatch that completes a chunked
- 			 * page program operation.
- 			 */
--			if (info->data_size == 0) {
-+			if (info->cur_chunk == info->ntotalchunks) {
- 				info->ndcb0 = NDCB0_CMD_TYPE(0x1)
- 					| NDCB0_EXT_CMD_TYPE(ext_cmd_type)
- 					| command;
-@@ -1063,7 +1087,7 @@ static int prepare_set_command(struct px
- 				| command;
- 		info->ndcb1 = (column & 0xFF);
- 		info->ndcb3 = INIT_BUFFER_SIZE;
--		info->data_size = INIT_BUFFER_SIZE;
-+		info->step_chunk_size = INIT_BUFFER_SIZE;
- 		break;
- 
- 	case NAND_CMD_READID:
-@@ -1073,7 +1097,7 @@ static int prepare_set_command(struct px
- 				| command;
- 		info->ndcb1 = (column & 0xFF);
- 
--		info->data_size = 8;
-+		info->step_chunk_size = 8;
- 		break;
- 	case NAND_CMD_STATUS:
- 		info->buf_count = 1;
-@@ -1081,7 +1105,7 @@ static int prepare_set_command(struct px
- 				| NDCB0_ADDR_CYC(1)
- 				| command;
- 
--		info->data_size = 8;
-+		info->step_chunk_size = 8;
- 		break;
- 
- 	case NAND_CMD_ERASE1:
-@@ -1220,6 +1244,7 @@ static void nand_cmdfunc_extended(struct
- 	init_completion(&info->dev_ready);
- 	do {
- 		info->state = STATE_PREPARED;
-+
- 		exec_cmd = prepare_set_command(info, command, ext_cmd_type,
- 					       column, page_addr);
- 		if (!exec_cmd) {
-@@ -1239,22 +1264,30 @@ static void nand_cmdfunc_extended(struct
- 			break;
- 		}
- 
-+		/* Only a few commands need several steps */
-+		if (command != NAND_CMD_PAGEPROG &&
-+		    command != NAND_CMD_READ0    &&
-+		    command != NAND_CMD_READOOB)
-+			break;
-+
-+		info->cur_chunk++;
-+
- 		/* Check if the sequence is complete */
--		if (info->data_size == 0 && command != NAND_CMD_PAGEPROG)
-+		if (info->cur_chunk == info->ntotalchunks && command != NAND_CMD_PAGEPROG)
- 			break;
- 
- 		/*
- 		 * After a splitted program command sequence has issued
- 		 * the command dispatch, the command sequence is complete.
- 		 */
--		if (info->data_size == 0 &&
-+		if (info->cur_chunk == (info->ntotalchunks + 1) &&
- 		    command == NAND_CMD_PAGEPROG &&
- 		    ext_cmd_type == EXT_CMD_TYPE_DISPATCH)
- 			break;
- 
- 		if (command == NAND_CMD_READ0 || command == NAND_CMD_READOOB) {
- 			/* Last read: issue a 'last naked read' */
--			if (info->data_size == info->chunk_size)
-+			if (info->cur_chunk == info->ntotalchunks - 1)
- 				ext_cmd_type = EXT_CMD_TYPE_LAST_RW;
- 			else
- 				ext_cmd_type = EXT_CMD_TYPE_NAKED_RW;
-@@ -1264,7 +1297,7 @@ static void nand_cmdfunc_extended(struct
- 		 * the command dispatch must be issued to complete.
- 		 */
- 		} else if (command == NAND_CMD_PAGEPROG &&
--			   info->data_size == 0) {
-+			   info->cur_chunk == info->ntotalchunks) {
- 				ext_cmd_type = EXT_CMD_TYPE_DISPATCH;
- 		}
- 	} while (1);
-@@ -1514,6 +1547,8 @@ static int pxa_ecc_init(struct pxa3xx_na
- 			int strength, int ecc_stepsize, int page_size)
- {
- 	if (strength == 1 && ecc_stepsize == 512 && page_size == 2048) {
-+		info->nfullchunks = 1;
-+		info->ntotalchunks = 1;
- 		info->chunk_size = 2048;
- 		info->spare_size = 40;
- 		info->ecc_size = 24;
-@@ -1522,6 +1557,8 @@ static int pxa_ecc_init(struct pxa3xx_na
- 		ecc->strength = 1;
- 
- 	} else if (strength == 1 && ecc_stepsize == 512 && page_size == 512) {
-+		info->nfullchunks = 1;
-+		info->ntotalchunks = 1;
- 		info->chunk_size = 512;
- 		info->spare_size = 8;
- 		info->ecc_size = 8;
-@@ -1535,6 +1572,8 @@ static int pxa_ecc_init(struct pxa3xx_na
- 	 */
- 	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 2048) {
- 		info->ecc_bch = 1;
-+		info->nfullchunks = 1;
-+		info->ntotalchunks = 1;
- 		info->chunk_size = 2048;
- 		info->spare_size = 32;
- 		info->ecc_size = 32;
-@@ -1545,6 +1584,8 @@ static int pxa_ecc_init(struct pxa3xx_na
- 
- 	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) {
- 		info->ecc_bch = 1;
-+		info->nfullchunks = 2;
-+		info->ntotalchunks = 2;
- 		info->chunk_size = 2048;
- 		info->spare_size = 32;
- 		info->ecc_size = 32;
-@@ -1559,8 +1600,12 @@ static int pxa_ecc_init(struct pxa3xx_na
- 	 */
- 	} else if (strength == 8 && ecc_stepsize == 512 && page_size == 4096) {
- 		info->ecc_bch = 1;
-+		info->nfullchunks = 4;
-+		info->ntotalchunks = 5;
- 		info->chunk_size = 1024;
- 		info->spare_size = 0;
-+		info->last_chunk_size = 0;
-+		info->last_spare_size = 64;
- 		info->ecc_size = 32;
- 		ecc->mode = NAND_ECC_HW;
- 		ecc->size = info->chunk_size;
diff --git a/target/linux/mvebu/patches-4.4/021-mtd-pxa3xx_nand-Increase-the-initial-chunk-size.patch b/target/linux/mvebu/patches-4.4/021-mtd-pxa3xx_nand-Increase-the-initial-chunk-size.patch
deleted file mode 100644
index 0b0e047..0000000
--- a/target/linux/mvebu/patches-4.4/021-mtd-pxa3xx_nand-Increase-the-initial-chunk-size.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= <ezequiel at vanguardiasur.com.ar>
-Date: Wed, 4 Nov 2015 13:13:41 -0300
-Subject: [PATCH] mtd: pxa3xx_nand: Increase the initial chunk size
-
-The chunk size represents the size of the data chunks, which
-is used by the controllers that allow to split transfered data.
-
-However, the initial chunk size is used in a non-splitted way,
-during device identification. Therefore, it must be large enough
-for all the NAND commands issued during device identification.
-This includes NAND_CMD_PARAM which was recently changed to
-transfer up to 2048 bytes (for the redundant parameter pages).
-
-Thus, the initial chunk size should be 2048 as well.
-
-On Armada 370/XP platforms (NFCv2) booted without the keep-config
-devicetree property, this commit fixes a timeout on the NAND_CMD_PARAM
-command:
-
-  [..]
-  pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
-  pxa3xx-nand f10d0000.nand: Wait time out!!!
-  nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x38
-  nand: Micron MT29F8G08ABABAWP
-  nand: 1024 MiB, SLC, erase size: 512 KiB, page size: 4096, OOB size: 224
-
-Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
-Acked-by: Robert Jarzmik <robert.jarzmik at free.fr>
-Signed-off-by: Brian Norris <computersforpeace at gmail.com>
----
-
---- a/drivers/mtd/nand/pxa3xx_nand.c
-+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -1637,7 +1637,7 @@ static int pxa3xx_nand_scan(struct mtd_i
- 		goto KEEP_CONFIG;
- 
- 	/* Set a default chunk size */
--	info->chunk_size = 512;
-+	info->chunk_size = PAGE_CHUNK_SIZE;
- 
- 	ret = pxa3xx_nand_config_flash(info);
- 	if (ret)
diff --git a/target/linux/mvebu/patches-4.4/022-mtd-pxa3xx_nand-Fix-initial-controller-configuration.patch b/target/linux/mvebu/patches-4.4/022-mtd-pxa3xx_nand-Fix-initial-controller-configuration.patch
deleted file mode 100644
index 7d07fb9..0000000
--- a/target/linux/mvebu/patches-4.4/022-mtd-pxa3xx_nand-Fix-initial-controller-configuration.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= <ezequiel at vanguardiasur.com.ar>
-Date: Wed, 4 Nov 2015 13:13:42 -0300
-Subject: [PATCH] mtd: pxa3xx_nand: Fix initial controller configuration
-
-The Data Flash Control Register (NDCR) contains two types
-of parameters: those that are needed for device identification,
-and those that can only be set after device identification.
-
-Therefore, the driver can't set them all at once and instead
-needs to configure the first group before nand_scan_ident()
-and the second group later.
-
-Let's split pxa3xx_nand_config in two halves, and set the
-parameters that depend on the device geometry once this is known.
-
-Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
-Signed-off-by: Brian Norris <computersforpeace at gmail.com>
----
-
---- a/drivers/mtd/nand/pxa3xx_nand.c
-+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -1420,34 +1420,43 @@ static int pxa3xx_nand_waitfunc(struct m
- 	return NAND_STATUS_READY;
- }
- 
--static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info)
-+static int pxa3xx_nand_config_ident(struct pxa3xx_nand_info *info)
- {
- 	struct platform_device *pdev = info->pdev;
- 	struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
--	struct pxa3xx_nand_host *host = info->host[info->cs];
--	struct mtd_info *mtd = host->mtd;
--	struct nand_chip *chip = mtd->priv;
- 
--	/* configure default flash values */
-+	/* Configure default flash values */
-+	info->chunk_size = PAGE_CHUNK_SIZE;
- 	info->reg_ndcr = 0x0; /* enable all interrupts */
- 	info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
- 	info->reg_ndcr |= NDCR_RD_ID_CNT(READ_ID_BYTES);
--	info->reg_ndcr |= NDCR_SPARE_EN; /* enable spare by default */
-+	info->reg_ndcr |= NDCR_SPARE_EN;
-+
-+	return 0;
-+}
-+
-+static void pxa3xx_nand_config_tail(struct pxa3xx_nand_info *info)
-+{
-+	struct pxa3xx_nand_host *host = info->host[info->cs];
-+	struct mtd_info *mtd = host->mtd;
-+	struct nand_chip *chip = mtd->priv;
-+
- 	info->reg_ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0;
- 	info->reg_ndcr |= (chip->page_shift == 6) ? NDCR_PG_PER_BLK : 0;
- 	info->reg_ndcr |= (mtd->writesize == 2048) ? NDCR_PAGE_SZ : 0;
--
--	return 0;
- }
- 
- static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info)
- {
-+	struct platform_device *pdev = info->pdev;
-+	struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
- 	uint32_t ndcr = nand_readl(info, NDCR);
- 
- 	/* Set an initial chunk size */
- 	info->chunk_size = ndcr & NDCR_PAGE_SZ ? 2048 : 512;
- 	info->reg_ndcr = ndcr &
- 		~(NDCR_INT_MASK | NDCR_ND_ARB_EN | NFCV1_NDCR_ARB_CNTL);
-+	info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
- 	info->ndtr0cs0 = nand_readl(info, NDTR0CS0);
- 	info->ndtr1cs0 = nand_readl(info, NDTR1CS0);
- 	return 0;
-@@ -1636,10 +1645,7 @@ static int pxa3xx_nand_scan(struct mtd_i
- 	if (pdata->keep_config && !pxa3xx_nand_detect_config(info))
- 		goto KEEP_CONFIG;
- 
--	/* Set a default chunk size */
--	info->chunk_size = PAGE_CHUNK_SIZE;
--
--	ret = pxa3xx_nand_config_flash(info);
-+	ret = pxa3xx_nand_config_ident(info);
- 	if (ret)
- 		return ret;
- 
-@@ -1652,7 +1658,6 @@ static int pxa3xx_nand_scan(struct mtd_i
- 	}
- 
- KEEP_CONFIG:
--	info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
- 	if (info->reg_ndcr & NDCR_DWIDTH_M)
- 		chip->options |= NAND_BUSWIDTH_16;
- 
-@@ -1737,6 +1742,10 @@ KEEP_CONFIG:
- 		host->row_addr_cycles = 3;
- 	else
- 		host->row_addr_cycles = 2;
-+
-+	if (!pdata->keep_config)
-+		pxa3xx_nand_config_tail(info);
-+
- 	return nand_scan_tail(mtd);
- }
- 
diff --git a/target/linux/mvebu/patches-4.4/023-bus-mvebu-mbus-provide-api-for-obtaining-IO-and-DRAM.patch b/target/linux/mvebu/patches-4.4/023-bus-mvebu-mbus-provide-api-for-obtaining-IO-and-DRAM.patch
deleted file mode 100644
index 58687f3..0000000
--- a/target/linux/mvebu/patches-4.4/023-bus-mvebu-mbus-provide-api-for-obtaining-IO-and-DRAM.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From: Marcin Wojtas <mw at semihalf.com>
-Date: Mon, 14 Mar 2016 09:39:02 +0100
-Subject: [PATCH] bus: mvebu-mbus: provide api for obtaining IO and DRAM window
- information
-
-This commit enables finding appropriate mbus window and obtaining its
-target id and attribute for given physical address in two separate
-routines, both for IO and DRAM windows. This functionality
-is needed for Armada XP/38x Network Controller's Buffer Manager and
-PnC configuration.
-
-[gregory.clement at free-electrons.com: Fix size test for
-mvebu_mbus_get_dram_win_info]
-
-Signed-off-by: Marcin Wojtas <mw at semihalf.com>
-[DRAM window information reference in LKv3.10]
-Signed-off-by: Evan Wang <xswang at marvell.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/bus/mvebu-mbus.c
-+++ b/drivers/bus/mvebu-mbus.c
-@@ -948,6 +948,58 @@ void mvebu_mbus_get_pcie_io_aperture(str
- 	*res = mbus_state.pcie_io_aperture;
- }
- 
-+int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr)
-+{
-+	const struct mbus_dram_target_info *dram;
-+	int i;
-+
-+	/* Get dram info */
-+	dram = mv_mbus_dram_info();
-+	if (!dram) {
-+		pr_err("missing DRAM information\n");
-+		return -ENODEV;
-+	}
-+
-+	/* Try to find matching DRAM window for phyaddr */
-+	for (i = 0; i < dram->num_cs; i++) {
-+		const struct mbus_dram_window *cs = dram->cs + i;
-+
-+		if (cs->base <= phyaddr &&
-+			phyaddr <= (cs->base + cs->size - 1)) {
-+			*target = dram->mbus_dram_target_id;
-+			*attr = cs->mbus_attr;
-+			return 0;
-+		}
-+	}
-+
-+	pr_err("invalid dram address 0x%x\n", phyaddr);
-+	return -EINVAL;
-+}
-+EXPORT_SYMBOL_GPL(mvebu_mbus_get_dram_win_info);
-+
-+int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
-+			       u8 *attr)
-+{
-+	int win;
-+
-+	for (win = 0; win < mbus_state.soc->num_wins; win++) {
-+		u64 wbase;
-+		int enabled;
-+
-+		mvebu_mbus_read_window(&mbus_state, win, &enabled, &wbase,
-+				       size, target, attr, NULL);
-+
-+		if (!enabled)
-+			continue;
-+
-+		if (wbase <= phyaddr && phyaddr <= wbase + *size)
-+			return win;
-+	}
-+
-+	return -EINVAL;
-+}
-+EXPORT_SYMBOL_GPL(mvebu_mbus_get_io_win_info);
-+
- static __init int mvebu_mbus_debugfs_init(void)
- {
- 	struct mvebu_mbus_state *s = &mbus_state;
---- a/include/linux/mbus.h
-+++ b/include/linux/mbus.h
-@@ -69,6 +69,9 @@ static inline const struct mbus_dram_tar
- int mvebu_mbus_save_cpu_target(u32 *store_addr);
- void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
- void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
-+int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr);
-+int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
-+			       u8 *attr);
- int mvebu_mbus_add_window_remap_by_id(unsigned int target,
- 				      unsigned int attribute,
- 				      phys_addr_t base, size_t size,
diff --git a/target/linux/mvebu/patches-4.4/030-mvneta-consolidate-autoneg-enabling.patch b/target/linux/mvebu/patches-4.4/030-mvneta-consolidate-autoneg-enabling.patch
deleted file mode 100644
index 1d98c7d..0000000
--- a/target/linux/mvebu/patches-4.4/030-mvneta-consolidate-autoneg-enabling.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From: Stas Sergeev <stsp at list.ru>
-Date: Wed, 2 Dec 2015 20:33:56 +0300
-Subject: [PATCH] mvneta: consolidate autoneg enabling
-
-This moves autoneg-related bit manipulations to the single place.
-
-CC: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-CC: netdev at vger.kernel.org
-CC: linux-kernel at vger.kernel.org
-
-Signed-off-by: Stas Sergeev <stsp at users.sourceforge.net>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -1067,15 +1067,28 @@ static void mvneta_defaults_set(struct m
- 		       MVNETA_GMAC_AN_SPEED_EN |
- 		       MVNETA_GMAC_AN_DUPLEX_EN;
- 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+
- 		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
- 		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
- 		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
-+		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
- 	} else {
- 		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
- 		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
- 		       MVNETA_GMAC_AN_SPEED_EN |
- 		       MVNETA_GMAC_AN_DUPLEX_EN);
- 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
-+		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
-+		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
- 	}
- 
- 	mvneta_set_ucast_table(pp, -1);
-@@ -3230,9 +3243,6 @@ static int mvneta_port_power_up(struct m
- 		return -EINVAL;
- 	}
- 
--	if (pp->use_inband_status)
--		ctrl |= MVNETA_GMAC2_INBAND_AN_ENABLE;
--
- 	/* Cancel Port Reset */
- 	ctrl &= ~MVNETA_GMAC2_PORT_RESET;
- 	mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);
diff --git a/target/linux/mvebu/patches-4.4/031-mvneta-implement-ethtool-autonegotiation-control.patch b/target/linux/mvebu/patches-4.4/031-mvneta-implement-ethtool-autonegotiation-control.patch
deleted file mode 100644
index 626b511..0000000
--- a/target/linux/mvebu/patches-4.4/031-mvneta-implement-ethtool-autonegotiation-control.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From: Stas Sergeev <stsp at list.ru>
-Date: Wed, 2 Dec 2015 20:35:11 +0300
-Subject: [PATCH] mvneta: implement ethtool autonegotiation control
-
-This patch allows to do
-ethtool -s eth0 autoneg off
-ethtool -s eth0 autoneg on
-to disable or enable autonegotiation at run-time.
-Without that functionality, the only way to control the autonegotiation
-is to modify the device tree.
-
-This is needed if you plan to use the same kernel with
-different ethernet switches, the ones that support the in-band
-status and the ones that not.
-
-CC: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-CC: netdev at vger.kernel.org
-CC: linux-kernel at vger.kernel.org
-
-Signed-off-by: Stas Sergeev <stsp at users.sourceforge.net>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -371,7 +371,7 @@ struct mvneta_port {
- 	unsigned int duplex;
- 	unsigned int speed;
- 	unsigned int tx_csum_limit;
--	int use_inband_status:1;
-+	unsigned int use_inband_status:1;
- 
- 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
- };
-@@ -973,6 +973,44 @@ static void mvneta_set_other_mcast_table
- 		mvreg_write(pp, MVNETA_DA_FILT_OTH_MCAST + offset, val);
- }
- 
-+static void mvneta_set_autoneg(struct mvneta_port *pp, int enable)
-+{
-+	u32 val;
-+
-+	if (enable) {
-+		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
-+			 MVNETA_GMAC_FORCE_LINK_DOWN |
-+			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
-+		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
-+		       MVNETA_GMAC_AN_SPEED_EN |
-+		       MVNETA_GMAC_AN_DUPLEX_EN;
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
-+		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
-+		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
-+	} else {
-+		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
-+		       MVNETA_GMAC_AN_SPEED_EN |
-+		       MVNETA_GMAC_AN_DUPLEX_EN);
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
-+		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
-+
-+		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
-+		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
-+		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
-+	}
-+}
-+
- /* This method sets defaults to the NETA port:
-  *	Clears interrupt Cause and Mask registers.
-  *	Clears all MAC tables.
-@@ -1058,39 +1096,7 @@ static void mvneta_defaults_set(struct m
- 	val &= ~MVNETA_PHY_POLLING_ENABLE;
- 	mvreg_write(pp, MVNETA_UNIT_CONTROL, val);
- 
--	if (pp->use_inband_status) {
--		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
--		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
--			 MVNETA_GMAC_FORCE_LINK_DOWN |
--			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
--		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
--		       MVNETA_GMAC_AN_SPEED_EN |
--		       MVNETA_GMAC_AN_DUPLEX_EN;
--		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
--		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
--		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
--	} else {
--		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
--		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
--		       MVNETA_GMAC_AN_SPEED_EN |
--		       MVNETA_GMAC_AN_DUPLEX_EN);
--		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
--		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
--		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
--	}
--
-+	mvneta_set_autoneg(pp, pp->use_inband_status);
- 	mvneta_set_ucast_table(pp, -1);
- 	mvneta_set_special_mcast_table(pp, -1);
- 	mvneta_set_other_mcast_table(pp, -1);
-@@ -2956,10 +2962,43 @@ int mvneta_ethtool_get_settings(struct n
- int mvneta_ethtool_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
-+	struct phy_device *phydev = pp->phy_dev;
- 
--	if (!pp->phy_dev)
-+	if (!phydev)
- 		return -ENODEV;
- 
-+	if ((cmd->autoneg == AUTONEG_ENABLE) != pp->use_inband_status) {
-+		u32 val;
-+
-+		mvneta_set_autoneg(pp, cmd->autoneg == AUTONEG_ENABLE);
-+
-+		if (cmd->autoneg == AUTONEG_DISABLE) {
-+			val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+			val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
-+				 MVNETA_GMAC_CONFIG_GMII_SPEED |
-+				 MVNETA_GMAC_CONFIG_FULL_DUPLEX);
-+
-+			if (phydev->duplex)
-+				val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
-+
-+			if (phydev->speed == SPEED_1000)
-+				val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
-+			else if (phydev->speed == SPEED_100)
-+				val |= MVNETA_GMAC_CONFIG_MII_SPEED;
-+
-+			mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+		}
-+
-+		pp->use_inband_status = (cmd->autoneg == AUTONEG_ENABLE);
-+		netdev_info(pp->dev, "autoneg status set to %i\n",
-+			    pp->use_inband_status);
-+
-+		if (netif_running(dev)) {
-+			mvneta_port_down(pp);
-+			mvneta_port_up(pp);
-+		}
-+	}
-+
- 	return phy_ethtool_sset(pp->phy_dev, cmd);
- }
- 
diff --git a/target/linux/mvebu/patches-4.4/032-net-mvneta-Make-the-default-queue-related-for-each-p.patch b/target/linux/mvebu/patches-4.4/032-net-mvneta-Make-the-default-queue-related-for-each-p.patch
deleted file mode 100644
index 54c9399..0000000
--- a/target/linux/mvebu/patches-4.4/032-net-mvneta-Make-the-default-queue-related-for-each-p.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Wed, 9 Dec 2015 18:23:48 +0100
-Subject: [PATCH] net: mvneta: Make the default queue related for each port
-
-Instead of using the same default queue for all the port. Move it in the
-port struct. It will allow have a different default queue for each port.
-
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -356,6 +356,7 @@ struct mvneta_port {
- 	struct mvneta_tx_queue *txqs;
- 	struct net_device *dev;
- 	struct notifier_block cpu_notifier;
-+	int rxq_def;
- 
- 	/* Core clock */
- 	struct clk *clk;
-@@ -819,7 +820,7 @@ static void mvneta_port_up(struct mvneta
- 	mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
- 
- 	/* Enable all initialized RXQs. */
--	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(rxq_def));
-+	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(pp->rxq_def));
- }
- 
- /* Stop the Ethernet port activity */
-@@ -1067,7 +1068,7 @@ static void mvneta_defaults_set(struct m
- 	mvreg_write(pp, MVNETA_ACC_MODE, val);
- 
- 	/* Update val of portCfg register accordingly with all RxQueue types */
--	val = MVNETA_PORT_CONFIG_DEFL_VALUE(rxq_def);
-+	val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
- 	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
- 
- 	val = 0;
-@@ -2101,19 +2102,19 @@ static void mvneta_set_rx_mode(struct ne
- 	if (dev->flags & IFF_PROMISC) {
- 		/* Accept all: Multicast + Unicast */
- 		mvneta_rx_unicast_promisc_set(pp, 1);
--		mvneta_set_ucast_table(pp, rxq_def);
--		mvneta_set_special_mcast_table(pp, rxq_def);
--		mvneta_set_other_mcast_table(pp, rxq_def);
-+		mvneta_set_ucast_table(pp, pp->rxq_def);
-+		mvneta_set_special_mcast_table(pp, pp->rxq_def);
-+		mvneta_set_other_mcast_table(pp, pp->rxq_def);
- 	} else {
- 		/* Accept single Unicast */
- 		mvneta_rx_unicast_promisc_set(pp, 0);
- 		mvneta_set_ucast_table(pp, -1);
--		mvneta_mac_addr_set(pp, dev->dev_addr, rxq_def);
-+		mvneta_mac_addr_set(pp, dev->dev_addr, pp->rxq_def);
- 
- 		if (dev->flags & IFF_ALLMULTI) {
- 			/* Accept all multicast */
--			mvneta_set_special_mcast_table(pp, rxq_def);
--			mvneta_set_other_mcast_table(pp, rxq_def);
-+			mvneta_set_special_mcast_table(pp, pp->rxq_def);
-+			mvneta_set_other_mcast_table(pp, pp->rxq_def);
- 		} else {
- 			/* Accept only initialized multicast */
- 			mvneta_set_special_mcast_table(pp, -1);
-@@ -2122,7 +2123,7 @@ static void mvneta_set_rx_mode(struct ne
- 			if (!netdev_mc_empty(dev)) {
- 				netdev_for_each_mc_addr(ha, dev) {
- 					mvneta_mcast_addr_set(pp, ha->addr,
--							      rxq_def);
-+							      pp->rxq_def);
- 				}
- 			}
- 		}
-@@ -2205,7 +2206,7 @@ static int mvneta_poll(struct napi_struc
- 	 * RX packets
- 	 */
- 	cause_rx_tx |= port->cause_rx_tx;
--	rx_done = mvneta_rx(pp, budget, &pp->rxqs[rxq_def]);
-+	rx_done = mvneta_rx(pp, budget, &pp->rxqs[pp->rxq_def]);
- 	budget -= rx_done;
- 
- 	if (budget > 0) {
-@@ -2418,17 +2419,17 @@ static void mvneta_cleanup_txqs(struct m
- /* Cleanup all Rx queues */
- static void mvneta_cleanup_rxqs(struct mvneta_port *pp)
- {
--	mvneta_rxq_deinit(pp, &pp->rxqs[rxq_def]);
-+	mvneta_rxq_deinit(pp, &pp->rxqs[pp->rxq_def]);
- }
- 
- 
- /* Init all Rx queues */
- static int mvneta_setup_rxqs(struct mvneta_port *pp)
- {
--	int err = mvneta_rxq_init(pp, &pp->rxqs[rxq_def]);
-+	int err = mvneta_rxq_init(pp, &pp->rxqs[pp->rxq_def]);
- 	if (err) {
- 		netdev_err(pp->dev, "%s: can't create rxq=%d\n",
--			   __func__, rxq_def);
-+			   __func__, pp->rxq_def);
- 		mvneta_cleanup_rxqs(pp);
- 		return err;
- 	}
-@@ -2634,7 +2635,7 @@ static int mvneta_set_mac_addr(struct ne
- 	mvneta_mac_addr_set(pp, dev->dev_addr, -1);
- 
- 	/* Set new addr in hw */
--	mvneta_mac_addr_set(pp, sockaddr->sa_data, rxq_def);
-+	mvneta_mac_addr_set(pp, sockaddr->sa_data, pp->rxq_def);
- 
- 	eth_commit_mac_addr_change(dev, addr);
- 	return 0;
-@@ -2753,7 +2754,7 @@ static void mvneta_percpu_elect(struct m
- {
- 	int online_cpu_idx, cpu, i = 0;
- 
--	online_cpu_idx = rxq_def % num_online_cpus();
-+	online_cpu_idx = pp->rxq_def % num_online_cpus();
- 
- 	for_each_online_cpu(cpu) {
- 		if (i == online_cpu_idx)
-@@ -3363,6 +3364,8 @@ static int mvneta_probe(struct platform_
- 				 strcmp(managed, "in-band-status") == 0);
- 	pp->cpu_notifier.notifier_call = mvneta_percpu_notifier;
- 
-+	pp->rxq_def = rxq_def;
-+
- 	pp->clk = devm_clk_get(&pdev->dev, NULL);
- 	if (IS_ERR(pp->clk)) {
- 		err = PTR_ERR(pp->clk);
diff --git a/target/linux/mvebu/patches-4.4/033-net-mvneta-Associate-RX-queues-with-each-CPU.patch b/target/linux/mvebu/patches-4.4/033-net-mvneta-Associate-RX-queues-with-each-CPU.patch
deleted file mode 100644
index 636c6cf..0000000
--- a/target/linux/mvebu/patches-4.4/033-net-mvneta-Associate-RX-queues-with-each-CPU.patch
+++ /dev/null
@@ -1,278 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Wed, 9 Dec 2015 18:23:49 +0100
-Subject: [PATCH] net: mvneta: Associate RX queues with each CPU
-
-We enable the percpu interrupt for all the CPU and we just associate a
-CPU to a few queue at the neta level. The mapping between the CPUs and
-the queues is static. The queues are associated to the CPU module the
-number of CPUs. However currently we only use on RX queue for a given
-Ethernet port.
-
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -110,9 +110,16 @@
- #define MVNETA_CPU_MAP(cpu)                      (0x2540 + ((cpu) << 2))
- #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
- #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
-+#define      MVNETA_CPU_RXQ_ACCESS(rxq)		 BIT(rxq)
- #define MVNETA_RXQ_TIME_COAL_REG(q)              (0x2580 + ((q) << 2))
- 
--/* Exception Interrupt Port/Queue Cause register */
-+/* Exception Interrupt Port/Queue Cause register
-+ *
-+ * Their behavior depend of the mapping done using the PCPX2Q
-+ * registers. For a given CPU if the bit associated to a queue is not
-+ * set, then for the register a read from this CPU will always return
-+ * 0 and a write won't do anything
-+ */
- 
- #define MVNETA_INTR_NEW_CAUSE                    0x25a0
- #define MVNETA_INTR_NEW_MASK                     0x25a4
-@@ -820,7 +827,13 @@ static void mvneta_port_up(struct mvneta
- 	mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
- 
- 	/* Enable all initialized RXQs. */
--	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(pp->rxq_def));
-+	for (queue = 0; queue < rxq_number; queue++) {
-+		struct mvneta_rx_queue *rxq = &pp->rxqs[queue];
-+
-+		if (rxq->descs != NULL)
-+			q_map |= (1 << queue);
-+	}
-+	mvreg_write(pp, MVNETA_RXQ_CMD, q_map);
- }
- 
- /* Stop the Ethernet port activity */
-@@ -1026,6 +1039,7 @@ static void mvneta_defaults_set(struct m
- 	int cpu;
- 	int queue;
- 	u32 val;
-+	int max_cpu = num_present_cpus();
- 
- 	/* Clear all Cause registers */
- 	mvreg_write(pp, MVNETA_INTR_NEW_CAUSE, 0);
-@@ -1041,13 +1055,23 @@ static void mvneta_defaults_set(struct m
- 	/* Enable MBUS Retry bit16 */
- 	mvreg_write(pp, MVNETA_MBUS_RETRY, 0x20);
- 
--	/* Set CPU queue access map - all CPUs have access to all RX
--	 * queues and to all TX queues
-+	/* Set CPU queue access map. CPUs are assigned to the RX
-+	 * queues modulo their number and all the TX queues are
-+	 * assigned to the CPU associated to the default RX queue.
- 	 */
--	for_each_present_cpu(cpu)
--		mvreg_write(pp, MVNETA_CPU_MAP(cpu),
--			    (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |
--			     MVNETA_CPU_TXQ_ACCESS_ALL_MASK));
-+	for_each_present_cpu(cpu) {
-+		int rxq_map = 0, txq_map = 0;
-+		int rxq;
-+
-+		for (rxq = 0; rxq < rxq_number; rxq++)
-+			if ((rxq % max_cpu) == cpu)
-+				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
-+
-+		if (cpu == rxq_def)
-+			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
-+
-+		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
-+	}
- 
- 	/* Reset RX and TX DMAs */
- 	mvreg_write(pp, MVNETA_PORT_RX_RESET, MVNETA_PORT_RX_DMA_RESET);
-@@ -2174,6 +2198,7 @@ static int mvneta_poll(struct napi_struc
- {
- 	int rx_done = 0;
- 	u32 cause_rx_tx;
-+	int rx_queue;
- 	struct mvneta_port *pp = netdev_priv(napi->dev);
- 	struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports);
- 
-@@ -2205,8 +2230,15 @@ static int mvneta_poll(struct napi_struc
- 	/* For the case where the last mvneta_poll did not process all
- 	 * RX packets
- 	 */
-+	rx_queue = fls(((cause_rx_tx >> 8) & 0xff));
-+
- 	cause_rx_tx |= port->cause_rx_tx;
--	rx_done = mvneta_rx(pp, budget, &pp->rxqs[pp->rxq_def]);
-+
-+	if (rx_queue) {
-+		rx_queue = rx_queue - 1;
-+		rx_done = mvneta_rx(pp, budget, &pp->rxqs[rx_queue]);
-+	}
-+
- 	budget -= rx_done;
- 
- 	if (budget > 0) {
-@@ -2419,19 +2451,27 @@ static void mvneta_cleanup_txqs(struct m
- /* Cleanup all Rx queues */
- static void mvneta_cleanup_rxqs(struct mvneta_port *pp)
- {
--	mvneta_rxq_deinit(pp, &pp->rxqs[pp->rxq_def]);
-+	int queue;
-+
-+	for (queue = 0; queue < txq_number; queue++)
-+		mvneta_rxq_deinit(pp, &pp->rxqs[queue]);
- }
- 
- 
- /* Init all Rx queues */
- static int mvneta_setup_rxqs(struct mvneta_port *pp)
- {
--	int err = mvneta_rxq_init(pp, &pp->rxqs[pp->rxq_def]);
--	if (err) {
--		netdev_err(pp->dev, "%s: can't create rxq=%d\n",
--			   __func__, pp->rxq_def);
--		mvneta_cleanup_rxqs(pp);
--		return err;
-+	int queue;
-+
-+	for (queue = 0; queue < rxq_number; queue++) {
-+		int err = mvneta_rxq_init(pp, &pp->rxqs[queue]);
-+
-+		if (err) {
-+			netdev_err(pp->dev, "%s: can't create rxq=%d\n",
-+				   __func__, queue);
-+			mvneta_cleanup_rxqs(pp);
-+			return err;
-+		}
- 	}
- 
- 	return 0;
-@@ -2455,6 +2495,19 @@ static int mvneta_setup_txqs(struct mvne
- 	return 0;
- }
- 
-+static void mvneta_percpu_unmask_interrupt(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	/* All the queue are unmasked, but actually only the ones
-+	 * maped to this CPU will be unmasked
-+	 */
-+	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
-+		    MVNETA_RX_INTR_MASK_ALL |
-+		    MVNETA_TX_INTR_MASK_ALL |
-+		    MVNETA_MISCINTR_INTR_MASK);
-+}
-+
- static void mvneta_start_dev(struct mvneta_port *pp)
- {
- 	unsigned int cpu;
-@@ -2472,11 +2525,10 @@ static void mvneta_start_dev(struct mvne
- 		napi_enable(&port->napi);
- 	}
- 
--	/* Unmask interrupts */
--	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
--		    MVNETA_RX_INTR_MASK(rxq_number) |
--		    MVNETA_TX_INTR_MASK(txq_number) |
--		    MVNETA_MISCINTR_INTR_MASK);
-+	/* Unmask interrupts. It has to be done from each CPU */
-+	for_each_online_cpu(cpu)
-+		smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
-+					 pp, true);
- 	mvreg_write(pp, MVNETA_INTR_MISC_MASK,
- 		    MVNETA_CAUSE_PHY_STATUS_CHANGE |
- 		    MVNETA_CAUSE_LINK_CHANGE |
-@@ -2752,22 +2804,35 @@ static void mvneta_percpu_disable(void *
- 
- static void mvneta_percpu_elect(struct mvneta_port *pp)
- {
--	int online_cpu_idx, cpu, i = 0;
-+	int online_cpu_idx, max_cpu, cpu, i = 0;
- 
- 	online_cpu_idx = pp->rxq_def % num_online_cpus();
-+	max_cpu = num_present_cpus();
- 
- 	for_each_online_cpu(cpu) {
--		if (i == online_cpu_idx)
--			/* Enable per-CPU interrupt on the one CPU we
--			 * just elected
-+		int rxq_map = 0, txq_map = 0;
-+		int rxq;
-+
-+		for (rxq = 0; rxq < rxq_number; rxq++)
-+			if ((rxq % max_cpu) == cpu)
-+				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
-+
-+		if (i == online_cpu_idx) {
-+			/* Map the default receive queue and transmit
-+			 * queue to the elected CPU
- 			 */
--			smp_call_function_single(cpu, mvneta_percpu_enable,
--						pp, true);
--		else
--			/* Disable per-CPU interrupt on all the other CPU */
--			smp_call_function_single(cpu, mvneta_percpu_disable,
--						pp, true);
-+			rxq_map |= MVNETA_CPU_RXQ_ACCESS(pp->rxq_def);
-+			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
-+		}
-+		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
-+
-+		/* Update the interrupt mask on each CPU according the
-+		 * new mapping
-+		 */
-+		smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
-+					 pp, true);
- 		i++;
-+
- 	}
- };
- 
-@@ -2802,12 +2867,22 @@ static int mvneta_percpu_notifier(struct
- 		mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
- 		napi_enable(&port->napi);
- 
-+
-+		/* Enable per-CPU interrupts on the CPU that is
-+		 * brought up.
-+		 */
-+		smp_call_function_single(cpu, mvneta_percpu_enable,
-+					 pp, true);
-+
- 		/* Enable per-CPU interrupt on the one CPU we care
- 		 * about.
- 		 */
- 		mvneta_percpu_elect(pp);
- 
--		/* Unmask all ethernet port interrupts */
-+		/* Unmask all ethernet port interrupts, as this
-+		 * notifier is called for each CPU then the CPU to
-+		 * Queue mapping is applied
-+		 */
- 		mvreg_write(pp, MVNETA_INTR_NEW_MASK,
- 			MVNETA_RX_INTR_MASK(rxq_number) |
- 			MVNETA_TX_INTR_MASK(txq_number) |
-@@ -2858,7 +2933,7 @@ static int mvneta_percpu_notifier(struct
- static int mvneta_open(struct net_device *dev)
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
--	int ret;
-+	int ret, cpu;
- 
- 	pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
- 	pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
-@@ -2888,8 +2963,13 @@ static int mvneta_open(struct net_device
- 	 */
- 	mvneta_percpu_disable(pp);
- 
--	/* Elect a CPU to handle our RX queue interrupt */
--	mvneta_percpu_elect(pp);
-+	/* Enable per-CPU interrupt on all the CPU to handle our RX
-+	 * queue interrupts
-+	 */
-+	for_each_online_cpu(cpu)
-+		smp_call_function_single(cpu, mvneta_percpu_enable,
-+					 pp, true);
-+
- 
- 	/* Register a CPU notifier to handle the case where our CPU
- 	 * might be taken offline.
diff --git a/target/linux/mvebu/patches-4.4/034-net-mvneta-Add-naive-RSS-support.patch b/target/linux/mvebu/patches-4.4/034-net-mvneta-Add-naive-RSS-support.patch
deleted file mode 100644
index 629c44c..0000000
--- a/target/linux/mvebu/patches-4.4/034-net-mvneta-Add-naive-RSS-support.patch
+++ /dev/null
@@ -1,191 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Wed, 9 Dec 2015 18:23:50 +0100
-Subject: [PATCH] net: mvneta: Add naive RSS support
-
-This patch adds the support for the RSS related ethtool
-function. Currently it only uses one entry in the indirection table which
-allows associating an mvneta interface to a given CPU.
-
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Tested-by: Marcin Wojtas <mw at semihalf.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -261,6 +261,11 @@
- 
- #define MVNETA_TX_MTU_MAX		0x3ffff
- 
-+/* The RSS lookup table actually has 256 entries but we do not use
-+ * them yet
-+ */
-+#define MVNETA_RSS_LU_TABLE_SIZE	1
-+
- /* TSO header size */
- #define TSO_HEADER_SIZE 128
- 
-@@ -382,6 +387,8 @@ struct mvneta_port {
- 	unsigned int use_inband_status:1;
- 
- 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
-+
-+	u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
- };
- 
- /* The mvneta_tx_desc and mvneta_rx_desc structures describe the
-@@ -1067,7 +1074,7 @@ static void mvneta_defaults_set(struct m
- 			if ((rxq % max_cpu) == cpu)
- 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
- 
--		if (cpu == rxq_def)
-+		if (cpu == pp->rxq_def)
- 			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
- 
- 		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
-@@ -2508,6 +2515,18 @@ static void mvneta_percpu_unmask_interru
- 		    MVNETA_MISCINTR_INTR_MASK);
- }
- 
-+static void mvneta_percpu_mask_interrupt(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	/* All the queue are masked, but actually only the ones
-+	 * maped to this CPU will be masked
-+	 */
-+	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
-+	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
-+	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
-+}
-+
- static void mvneta_start_dev(struct mvneta_port *pp)
- {
- 	unsigned int cpu;
-@@ -3231,6 +3250,106 @@ static int mvneta_ethtool_get_sset_count
- 	return -EOPNOTSUPP;
- }
- 
-+static u32 mvneta_ethtool_get_rxfh_indir_size(struct net_device *dev)
-+{
-+	return MVNETA_RSS_LU_TABLE_SIZE;
-+}
-+
-+static int mvneta_ethtool_get_rxnfc(struct net_device *dev,
-+				    struct ethtool_rxnfc *info,
-+				    u32 *rules __always_unused)
-+{
-+	switch (info->cmd) {
-+	case ETHTOOL_GRXRINGS:
-+		info->data =  rxq_number;
-+		return 0;
-+	case ETHTOOL_GRXFH:
-+		return -EOPNOTSUPP;
-+	default:
-+		return -EOPNOTSUPP;
-+	}
-+}
-+
-+static int  mvneta_config_rss(struct mvneta_port *pp)
-+{
-+	int cpu;
-+	u32 val;
-+
-+	netif_tx_stop_all_queues(pp->dev);
-+
-+	for_each_online_cpu(cpu)
-+		smp_call_function_single(cpu, mvneta_percpu_mask_interrupt,
-+					 pp, true);
-+
-+	/* We have to synchronise on the napi of each CPU */
-+	for_each_online_cpu(cpu) {
-+		struct mvneta_pcpu_port *pcpu_port =
-+			per_cpu_ptr(pp->ports, cpu);
-+
-+		napi_synchronize(&pcpu_port->napi);
-+		napi_disable(&pcpu_port->napi);
-+	}
-+
-+	pp->rxq_def = pp->indir[0];
-+
-+	/* Update unicast mapping */
-+	mvneta_set_rx_mode(pp->dev);
-+
-+	/* Update val of portCfg register accordingly with all RxQueue types */
-+	val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
-+	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
-+
-+	/* Update the elected CPU matching the new rxq_def */
-+	mvneta_percpu_elect(pp);
-+
-+	/* We have to synchronise on the napi of each CPU */
-+	for_each_online_cpu(cpu) {
-+		struct mvneta_pcpu_port *pcpu_port =
-+			per_cpu_ptr(pp->ports, cpu);
-+
-+		napi_enable(&pcpu_port->napi);
-+	}
-+
-+	netif_tx_start_all_queues(pp->dev);
-+
-+	return 0;
-+}
-+
-+static int mvneta_ethtool_set_rxfh(struct net_device *dev, const u32 *indir,
-+				   const u8 *key, const u8 hfunc)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+	/* We require at least one supported parameter to be changed
-+	 * and no change in any of the unsupported parameters
-+	 */
-+	if (key ||
-+	    (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
-+		return -EOPNOTSUPP;
-+
-+	if (!indir)
-+		return 0;
-+
-+	memcpy(pp->indir, indir, MVNETA_RSS_LU_TABLE_SIZE);
-+
-+	return mvneta_config_rss(pp);
-+}
-+
-+static int mvneta_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
-+				   u8 *hfunc)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+
-+	if (hfunc)
-+		*hfunc = ETH_RSS_HASH_TOP;
-+
-+	if (!indir)
-+		return 0;
-+
-+	memcpy(indir, pp->indir, MVNETA_RSS_LU_TABLE_SIZE);
-+
-+	return 0;
-+}
-+
- static const struct net_device_ops mvneta_netdev_ops = {
- 	.ndo_open            = mvneta_open,
- 	.ndo_stop            = mvneta_stop,
-@@ -3255,6 +3374,10 @@ const struct ethtool_ops mvneta_eth_tool
- 	.get_strings	= mvneta_ethtool_get_strings,
- 	.get_ethtool_stats = mvneta_ethtool_get_stats,
- 	.get_sset_count	= mvneta_ethtool_get_sset_count,
-+	.get_rxfh_indir_size = mvneta_ethtool_get_rxfh_indir_size,
-+	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
-+	.get_rxfh	= mvneta_ethtool_get_rxfh,
-+	.set_rxfh	= mvneta_ethtool_set_rxfh,
- };
- 
- /* Initialize hw */
-@@ -3446,6 +3569,8 @@ static int mvneta_probe(struct platform_
- 
- 	pp->rxq_def = rxq_def;
- 
-+	pp->indir[0] = rxq_def;
-+
- 	pp->clk = devm_clk_get(&pdev->dev, NULL);
- 	if (IS_ERR(pp->clk)) {
- 		err = PTR_ERR(pp->clk);
diff --git a/target/linux/mvebu/patches-4.4/035-net-mvneta-Configure-XPS-support.patch b/target/linux/mvebu/patches-4.4/035-net-mvneta-Configure-XPS-support.patch
deleted file mode 100644
index 5b35b64..0000000
--- a/target/linux/mvebu/patches-4.4/035-net-mvneta-Configure-XPS-support.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Wed, 9 Dec 2015 18:23:51 +0100
-Subject: [PATCH] net: mvneta: Configure XPS support
-
-With this patch each CPU is associated with its own set of TX queues.
-
-It also setup the XPS with an initial configuration which set the
-affinity matching the hardware configuration.
-
-Suggested-by: Arnd Bergmann <arnd at arndb.de>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -111,6 +111,7 @@
- #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
- #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
- #define      MVNETA_CPU_RXQ_ACCESS(rxq)		 BIT(rxq)
-+#define      MVNETA_CPU_TXQ_ACCESS(txq)		 BIT(txq + 8)
- #define MVNETA_RXQ_TIME_COAL_REG(q)              (0x2580 + ((q) << 2))
- 
- /* Exception Interrupt Port/Queue Cause register
-@@ -514,6 +515,9 @@ struct mvneta_tx_queue {
- 
- 	/* DMA address of TSO headers */
- 	dma_addr_t tso_hdrs_phys;
-+
-+	/* Affinity mask for CPUs*/
-+	cpumask_t affinity_mask;
- };
- 
- struct mvneta_rx_queue {
-@@ -1062,20 +1066,30 @@ static void mvneta_defaults_set(struct m
- 	/* Enable MBUS Retry bit16 */
- 	mvreg_write(pp, MVNETA_MBUS_RETRY, 0x20);
- 
--	/* Set CPU queue access map. CPUs are assigned to the RX
--	 * queues modulo their number and all the TX queues are
--	 * assigned to the CPU associated to the default RX queue.
-+	/* Set CPU queue access map. CPUs are assigned to the RX and
-+	 * TX queues modulo their number. If there is only one TX
-+	 * queue then it is assigned to the CPU associated to the
-+	 * default RX queue.
- 	 */
- 	for_each_present_cpu(cpu) {
- 		int rxq_map = 0, txq_map = 0;
--		int rxq;
-+		int rxq, txq;
- 
- 		for (rxq = 0; rxq < rxq_number; rxq++)
- 			if ((rxq % max_cpu) == cpu)
- 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
- 
--		if (cpu == pp->rxq_def)
--			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
-+		for (txq = 0; txq < txq_number; txq++)
-+			if ((txq % max_cpu) == cpu)
-+				txq_map |= MVNETA_CPU_TXQ_ACCESS(txq);
-+
-+		/* With only one TX queue we configure a special case
-+		 * which will allow to get all the irq on a single
-+		 * CPU
-+		 */
-+		if (txq_number == 1)
-+			txq_map = (cpu == pp->rxq_def) ?
-+				MVNETA_CPU_TXQ_ACCESS(1) : 0;
- 
- 		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
- 	}
-@@ -2362,6 +2376,8 @@ static void mvneta_rxq_deinit(struct mvn
- static int mvneta_txq_init(struct mvneta_port *pp,
- 			   struct mvneta_tx_queue *txq)
- {
-+	int cpu;
-+
- 	txq->size = pp->tx_ring_size;
- 
- 	/* A queue must always have room for at least one skb.
-@@ -2414,6 +2430,14 @@ static int mvneta_txq_init(struct mvneta
- 	}
- 	mvneta_tx_done_pkts_coal_set(pp, txq, txq->done_pkts_coal);
- 
-+	/* Setup XPS mapping */
-+	if (txq_number > 1)
-+		cpu = txq->id % num_present_cpus();
-+	else
-+		cpu = pp->rxq_def % num_present_cpus();
-+	cpumask_set_cpu(cpu, &txq->affinity_mask);
-+	netif_set_xps_queue(pp->dev, &txq->affinity_mask, txq->id);
-+
- 	return 0;
- }
- 
-@@ -2836,13 +2860,23 @@ static void mvneta_percpu_elect(struct m
- 			if ((rxq % max_cpu) == cpu)
- 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
- 
--		if (i == online_cpu_idx) {
--			/* Map the default receive queue and transmit
--			 * queue to the elected CPU
-+		if (i == online_cpu_idx)
-+			/* Map the default receive queue queue to the
-+			 * elected CPU
- 			 */
- 			rxq_map |= MVNETA_CPU_RXQ_ACCESS(pp->rxq_def);
--			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
--		}
-+
-+		/* We update the TX queue map only if we have one
-+		 * queue. In this case we associate the TX queue to
-+		 * the CPU bound to the default RX queue
-+		 */
-+		if (txq_number == 1)
-+			txq_map = (i == online_cpu_idx) ?
-+				MVNETA_CPU_TXQ_ACCESS(1) : 0;
-+		else
-+			txq_map = mvreg_read(pp, MVNETA_CPU_MAP(cpu)) &
-+				MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
-+
- 		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
- 
- 		/* Update the interrupt mask on each CPU according the
diff --git a/target/linux/mvebu/patches-4.4/036-net-mvneta-fix-trivial-cut-off-issue-in-mvneta_ethto.patch b/target/linux/mvebu/patches-4.4/036-net-mvneta-fix-trivial-cut-off-issue-in-mvneta_ethto.patch
deleted file mode 100644
index 2bd7a88..0000000
--- a/target/linux/mvebu/patches-4.4/036-net-mvneta-fix-trivial-cut-off-issue-in-mvneta_ethto.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From: Jisheng Zhang <jszhang at marvell.com>
-Date: Wed, 20 Jan 2016 16:36:25 +0800
-Subject: [PATCH] net: mvneta: fix trivial cut-off issue in
- mvneta_ethtool_update_stats
-
-When s->type is T_REG_64, the high 32bits are lost in val. This patch
-fixes this trivial issue.
-
-Signed-off-by: Jisheng Zhang <jszhang at marvell.com>
-Fixes: 9b0cdefa4cd5 ("net: mvneta: add ethtool statistics")
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3242,26 +3242,25 @@ static void mvneta_ethtool_update_stats(
- 	const struct mvneta_statistic *s;
- 	void __iomem *base = pp->base;
- 	u32 high, low, val;
-+	u64 val64;
- 	int i;
- 
- 	for (i = 0, s = mvneta_statistics;
- 	     s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics);
- 	     s++, i++) {
--		val = 0;
--
- 		switch (s->type) {
- 		case T_REG_32:
- 			val = readl_relaxed(base + s->offset);
-+			pp->ethtool_stats[i] += val;
- 			break;
- 		case T_REG_64:
- 			/* Docs say to read low 32-bit then high */
- 			low = readl_relaxed(base + s->offset);
- 			high = readl_relaxed(base + s->offset + 4);
--			val = (u64)high << 32 | low;
-+			val64 = (u64)high << 32 | low;
-+			pp->ethtool_stats[i] += val64;
- 			break;
- 		}
--
--		pp->ethtool_stats[i] += val;
- 	}
- }
- 
diff --git a/target/linux/mvebu/patches-4.4/037-net-mvneta-Fix-for_each_present_cpu-usage.patch b/target/linux/mvebu/patches-4.4/037-net-mvneta-Fix-for_each_present_cpu-usage.patch
deleted file mode 100644
index 9ded5b7..0000000
--- a/target/linux/mvebu/patches-4.4/037-net-mvneta-Fix-for_each_present_cpu-usage.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Thu, 4 Feb 2016 22:09:23 +0100
-Subject: [PATCH] net: mvneta: Fix for_each_present_cpu usage
-
-This patch convert the for_each_present in on_each_cpu, instead of
-applying on the present cpus it will be applied only on the online cpus.
-This fix a bug reported on
-http://thread.gmane.org/gmane.linux.ports.arm.kernel/468173.
-
-Using the macro on_each_cpu (instead of a for_each_* loop) also ensures
-that all the calls will be done all at once.
-
-Fixes: f86428854480 ("net: mvneta: Statically assign queues to CPUs")
-Reported-by: Stefan Roese <stefan.roese at gmail.com>
-Suggested-by: Jisheng Zhang <jszhang at marvell.com>
-Suggested-by: Russell King <rmk+kernel at arm.linux.org.uk>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -2562,7 +2562,7 @@ static void mvneta_start_dev(struct mvne
- 	mvneta_port_enable(pp);
- 
- 	/* Enable polling on the port */
--	for_each_present_cpu(cpu) {
-+	for_each_online_cpu(cpu) {
- 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
- 
- 		napi_enable(&port->napi);
-@@ -2587,7 +2587,7 @@ static void mvneta_stop_dev(struct mvnet
- 
- 	phy_stop(pp->phy_dev);
- 
--	for_each_present_cpu(cpu) {
-+	for_each_online_cpu(cpu) {
- 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
- 
- 		napi_disable(&port->napi);
-@@ -3055,13 +3055,11 @@ err_cleanup_rxqs:
- static int mvneta_stop(struct net_device *dev)
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
--	int cpu;
- 
- 	mvneta_stop_dev(pp);
- 	mvneta_mdio_remove(pp);
- 	unregister_cpu_notifier(&pp->cpu_notifier);
--	for_each_present_cpu(cpu)
--		smp_call_function_single(cpu, mvneta_percpu_disable, pp, true);
-+	on_each_cpu(mvneta_percpu_disable, pp, true);
- 	free_percpu_irq(dev->irq, pp->ports);
- 	mvneta_cleanup_rxqs(pp);
- 	mvneta_cleanup_txqs(pp);
diff --git a/target/linux/mvebu/patches-4.4/038-net-mvneta-Fix-the-CPU-choice-in-mvneta_percpu_elect.patch b/target/linux/mvebu/patches-4.4/038-net-mvneta-Fix-the-CPU-choice-in-mvneta_percpu_elect.patch
deleted file mode 100644
index 4fc9ccc..0000000
--- a/target/linux/mvebu/patches-4.4/038-net-mvneta-Fix-the-CPU-choice-in-mvneta_percpu_elect.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Thu, 4 Feb 2016 22:09:24 +0100
-Subject: [PATCH] net: mvneta: Fix the CPU choice in mvneta_percpu_elect
-
-When passing to the management of multiple RX queue, the
-mvneta_percpu_elect function was broken. The use of the modulo can lead
-to elect the wrong cpu. For example with rxq_def=2, if the CPU 2 goes
-offline and then online, we ended with the third RX queue activated in
-the same time on CPU 0 and CPU2, which lead to a kernel crash.
-
-With this fix, we don't try to get "the closer" CPU if the default CPU is
-gone, now we just use CPU 0 which always be there. Thanks to this, the
-code becomes more readable, easier to maintain and more predicable.
-
-Cc: stable at vger.kernel.org
-Fixes: 2dcf75e2793c ("net: mvneta: Associate RX queues with each CPU")
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -2847,9 +2847,14 @@ static void mvneta_percpu_disable(void *
- 
- static void mvneta_percpu_elect(struct mvneta_port *pp)
- {
--	int online_cpu_idx, max_cpu, cpu, i = 0;
-+	int elected_cpu = 0, max_cpu, cpu, i = 0;
-+
-+	/* Use the cpu associated to the rxq when it is online, in all
-+	 * the other cases, use the cpu 0 which can't be offline.
-+	 */
-+	if (cpu_online(pp->rxq_def))
-+		elected_cpu = pp->rxq_def;
- 
--	online_cpu_idx = pp->rxq_def % num_online_cpus();
- 	max_cpu = num_present_cpus();
- 
- 	for_each_online_cpu(cpu) {
-@@ -2860,7 +2865,7 @@ static void mvneta_percpu_elect(struct m
- 			if ((rxq % max_cpu) == cpu)
- 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
- 
--		if (i == online_cpu_idx)
-+		if (cpu == elected_cpu)
- 			/* Map the default receive queue queue to the
- 			 * elected CPU
- 			 */
-@@ -2871,7 +2876,7 @@ static void mvneta_percpu_elect(struct m
- 		 * the CPU bound to the default RX queue
- 		 */
- 		if (txq_number == 1)
--			txq_map = (i == online_cpu_idx) ?
-+			txq_map = (cpu == elected_cpu) ?
- 				MVNETA_CPU_TXQ_ACCESS(1) : 0;
- 		else
- 			txq_map = mvreg_read(pp, MVNETA_CPU_MAP(cpu)) &
diff --git a/target/linux/mvebu/patches-4.4/039-net-mvneta-Use-on_each_cpu-when-possible.patch b/target/linux/mvebu/patches-4.4/039-net-mvneta-Use-on_each_cpu-when-possible.patch
deleted file mode 100644
index 76257a2..0000000
--- a/target/linux/mvebu/patches-4.4/039-net-mvneta-Use-on_each_cpu-when-possible.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Thu, 4 Feb 2016 22:09:25 +0100
-Subject: [PATCH] net: mvneta: Use on_each_cpu when possible
-
-Instead of using a for_each_* loop in which we just call the
-smp_call_function_single macro, it is more simple to directly use the
-on_each_cpu macro. Moreover, this macro ensures that the calls will be
-done all at once.
-
-Suggested-by: Russell King <rmk+kernel at arm.linux.org.uk>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -2553,7 +2553,7 @@ static void mvneta_percpu_mask_interrupt
- 
- static void mvneta_start_dev(struct mvneta_port *pp)
- {
--	unsigned int cpu;
-+	int cpu;
- 
- 	mvneta_max_rx_size_set(pp, pp->pkt_size);
- 	mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
-@@ -2569,9 +2569,8 @@ static void mvneta_start_dev(struct mvne
- 	}
- 
- 	/* Unmask interrupts. It has to be done from each CPU */
--	for_each_online_cpu(cpu)
--		smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
--					 pp, true);
-+	on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
-+
- 	mvreg_write(pp, MVNETA_INTR_MISC_MASK,
- 		    MVNETA_CAUSE_PHY_STATUS_CHANGE |
- 		    MVNETA_CAUSE_LINK_CHANGE |
-@@ -2991,7 +2990,7 @@ static int mvneta_percpu_notifier(struct
- static int mvneta_open(struct net_device *dev)
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
--	int ret, cpu;
-+	int ret;
- 
- 	pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
- 	pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
-@@ -3024,9 +3023,7 @@ static int mvneta_open(struct net_device
- 	/* Enable per-CPU interrupt on all the CPU to handle our RX
- 	 * queue interrupts
- 	 */
--	for_each_online_cpu(cpu)
--		smp_call_function_single(cpu, mvneta_percpu_enable,
--					 pp, true);
-+	on_each_cpu(mvneta_percpu_enable, pp, true);
- 
- 
- 	/* Register a CPU notifier to handle the case where our CPU
-@@ -3313,9 +3310,7 @@ static int  mvneta_config_rss(struct mvn
- 
- 	netif_tx_stop_all_queues(pp->dev);
- 
--	for_each_online_cpu(cpu)
--		smp_call_function_single(cpu, mvneta_percpu_mask_interrupt,
--					 pp, true);
-+	on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
- 
- 	/* We have to synchronise on the napi of each CPU */
- 	for_each_online_cpu(cpu) {
diff --git a/target/linux/mvebu/patches-4.4/040-net-mvneta-Modify-the-queue-related-fields-from-each.patch b/target/linux/mvebu/patches-4.4/040-net-mvneta-Modify-the-queue-related-fields-from-each.patch
deleted file mode 100644
index b025777..0000000
--- a/target/linux/mvebu/patches-4.4/040-net-mvneta-Modify-the-queue-related-fields-from-each.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Thu, 4 Feb 2016 22:09:27 +0100
-Subject: [PATCH] net: mvneta: Modify the queue related fields from each cpu
-
-In the MVNETA_INTR_* registers, the queues related fields are per cpu,
-according to the datasheet (comment in [] are added by me):
-"In a multi-CPU system, bits of RX[or TX] queues for which the access by
-the reading[or writing] CPU is disabled are read as 0, and cannot be
-cleared[or written]."
-
-That means that each time we want to manipulate these bits we had to do
-it on each cpu and not only on the current cpu.
-
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -1036,6 +1036,43 @@ static void mvneta_set_autoneg(struct mv
- 	}
- }
- 
-+static void mvneta_percpu_unmask_interrupt(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	/* All the queue are unmasked, but actually only the ones
-+	 * mapped to this CPU will be unmasked
-+	 */
-+	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
-+		    MVNETA_RX_INTR_MASK_ALL |
-+		    MVNETA_TX_INTR_MASK_ALL |
-+		    MVNETA_MISCINTR_INTR_MASK);
-+}
-+
-+static void mvneta_percpu_mask_interrupt(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	/* All the queue are masked, but actually only the ones
-+	 * mapped to this CPU will be masked
-+	 */
-+	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
-+	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
-+	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
-+}
-+
-+static void mvneta_percpu_clear_intr_cause(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	/* All the queue are cleared, but actually only the ones
-+	 * mapped to this CPU will be cleared
-+	 */
-+	mvreg_write(pp, MVNETA_INTR_NEW_CAUSE, 0);
-+	mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
-+	mvreg_write(pp, MVNETA_INTR_OLD_CAUSE, 0);
-+}
-+
- /* This method sets defaults to the NETA port:
-  *	Clears interrupt Cause and Mask registers.
-  *	Clears all MAC tables.
-@@ -1053,14 +1090,10 @@ static void mvneta_defaults_set(struct m
- 	int max_cpu = num_present_cpus();
- 
- 	/* Clear all Cause registers */
--	mvreg_write(pp, MVNETA_INTR_NEW_CAUSE, 0);
--	mvreg_write(pp, MVNETA_INTR_OLD_CAUSE, 0);
--	mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
-+	on_each_cpu(mvneta_percpu_clear_intr_cause, pp, true);
- 
- 	/* Mask all interrupts */
--	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
--	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
--	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
-+	on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
- 	mvreg_write(pp, MVNETA_INTR_ENABLE, 0);
- 
- 	/* Enable MBUS Retry bit16 */
-@@ -2526,31 +2559,6 @@ static int mvneta_setup_txqs(struct mvne
- 	return 0;
- }
- 
--static void mvneta_percpu_unmask_interrupt(void *arg)
--{
--	struct mvneta_port *pp = arg;
--
--	/* All the queue are unmasked, but actually only the ones
--	 * maped to this CPU will be unmasked
--	 */
--	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
--		    MVNETA_RX_INTR_MASK_ALL |
--		    MVNETA_TX_INTR_MASK_ALL |
--		    MVNETA_MISCINTR_INTR_MASK);
--}
--
--static void mvneta_percpu_mask_interrupt(void *arg)
--{
--	struct mvneta_port *pp = arg;
--
--	/* All the queue are masked, but actually only the ones
--	 * maped to this CPU will be masked
--	 */
--	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
--	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
--	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
--}
--
- static void mvneta_start_dev(struct mvneta_port *pp)
- {
- 	int cpu;
-@@ -2601,13 +2609,10 @@ static void mvneta_stop_dev(struct mvnet
- 	mvneta_port_disable(pp);
- 
- 	/* Clear all ethernet port interrupts */
--	mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
--	mvreg_write(pp, MVNETA_INTR_OLD_CAUSE, 0);
-+	on_each_cpu(mvneta_percpu_clear_intr_cause, pp, true);
- 
- 	/* Mask all ethernet port interrupts */
--	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
--	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
--	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
-+	on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
- 
- 	mvneta_tx_reset(pp);
- 	mvneta_rx_reset(pp);
-@@ -2919,9 +2924,7 @@ static int mvneta_percpu_notifier(struct
- 		}
- 
- 		/* Mask all ethernet port interrupts */
--		mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
--		mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
--		mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
-+		on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
- 		napi_enable(&port->napi);
- 
- 
-@@ -2936,14 +2939,8 @@ static int mvneta_percpu_notifier(struct
- 		 */
- 		mvneta_percpu_elect(pp);
- 
--		/* Unmask all ethernet port interrupts, as this
--		 * notifier is called for each CPU then the CPU to
--		 * Queue mapping is applied
--		 */
--		mvreg_write(pp, MVNETA_INTR_NEW_MASK,
--			MVNETA_RX_INTR_MASK(rxq_number) |
--			MVNETA_TX_INTR_MASK(txq_number) |
--			MVNETA_MISCINTR_INTR_MASK);
-+		/* Unmask all ethernet port interrupts */
-+		on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
- 		mvreg_write(pp, MVNETA_INTR_MISC_MASK,
- 			MVNETA_CAUSE_PHY_STATUS_CHANGE |
- 			MVNETA_CAUSE_LINK_CHANGE |
-@@ -2954,9 +2951,7 @@ static int mvneta_percpu_notifier(struct
- 	case CPU_DOWN_PREPARE_FROZEN:
- 		netif_tx_stop_all_queues(pp->dev);
- 		/* Mask all ethernet port interrupts */
--		mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
--		mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
--		mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
-+		on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
- 
- 		napi_synchronize(&port->napi);
- 		napi_disable(&port->napi);
-@@ -2972,10 +2967,7 @@ static int mvneta_percpu_notifier(struct
- 		/* Check if a new CPU must be elected now this on is down */
- 		mvneta_percpu_elect(pp);
- 		/* Unmask all ethernet port interrupts */
--		mvreg_write(pp, MVNETA_INTR_NEW_MASK,
--			MVNETA_RX_INTR_MASK(rxq_number) |
--			MVNETA_TX_INTR_MASK(txq_number) |
--			MVNETA_MISCINTR_INTR_MASK);
-+		on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
- 		mvreg_write(pp, MVNETA_INTR_MISC_MASK,
- 			MVNETA_CAUSE_PHY_STATUS_CHANGE |
- 			MVNETA_CAUSE_LINK_CHANGE |
diff --git a/target/linux/mvebu/patches-4.4/041-net-mvneta-The-mvneta_percpu_elect-function-should-b.patch b/target/linux/mvebu/patches-4.4/041-net-mvneta-The-mvneta_percpu_elect-function-should-b.patch
deleted file mode 100644
index a77bef4..0000000
--- a/target/linux/mvebu/patches-4.4/041-net-mvneta-The-mvneta_percpu_elect-function-should-b.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Thu, 4 Feb 2016 22:09:28 +0100
-Subject: [PATCH] net: mvneta: The mvneta_percpu_elect function should be
- atomic
-
-Electing a CPU must be done in an atomic way: it should be done after or
-before the removal/insertion of a CPU and this function is not reentrant.
-
-During the loop of mvneta_percpu_elect we associates the queues to the
-CPUs, if there is a topology change during this loop, then the mapping
-between the CPUs and the queues could be wrong. During this loop the
-interrupt mask is also updating for each CPUs, It should not be changed
-in the same time by other part of the driver.
-
-This patch adds spinlock to create the needed critical sections.
-
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -370,6 +370,10 @@ struct mvneta_port {
- 	struct net_device *dev;
- 	struct notifier_block cpu_notifier;
- 	int rxq_def;
-+	/* Protect the access to the percpu interrupt registers,
-+	 * ensuring that the configuration remains coherent.
-+	 */
-+	spinlock_t lock;
- 
- 	/* Core clock */
- 	struct clk *clk;
-@@ -2853,6 +2857,12 @@ static void mvneta_percpu_elect(struct m
- {
- 	int elected_cpu = 0, max_cpu, cpu, i = 0;
- 
-+	/* Electing a CPU must be done in an atomic way: it should be
-+	 * done after or before the removal/insertion of a CPU and
-+	 * this function is not reentrant.
-+	 */
-+	spin_lock(&pp->lock);
-+
- 	/* Use the cpu associated to the rxq when it is online, in all
- 	 * the other cases, use the cpu 0 which can't be offline.
- 	 */
-@@ -2896,6 +2906,7 @@ static void mvneta_percpu_elect(struct m
- 		i++;
- 
- 	}
-+	spin_unlock(&pp->lock);
- };
- 
- static int mvneta_percpu_notifier(struct notifier_block *nfb,
-@@ -2950,8 +2961,13 @@ static int mvneta_percpu_notifier(struct
- 	case CPU_DOWN_PREPARE:
- 	case CPU_DOWN_PREPARE_FROZEN:
- 		netif_tx_stop_all_queues(pp->dev);
-+		/* Thanks to this lock we are sure that any pending
-+		 * cpu election is done
-+		 */
-+		spin_lock(&pp->lock);
- 		/* Mask all ethernet port interrupts */
- 		on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
-+		spin_unlock(&pp->lock);
- 
- 		napi_synchronize(&port->napi);
- 		napi_disable(&port->napi);
diff --git a/target/linux/mvebu/patches-4.4/042-net-mvneta-Fix-race-condition-during-stopping.patch b/target/linux/mvebu/patches-4.4/042-net-mvneta-Fix-race-condition-during-stopping.patch
deleted file mode 100644
index 9936ebf..0000000
--- a/target/linux/mvebu/patches-4.4/042-net-mvneta-Fix-race-condition-during-stopping.patch
+++ /dev/null
@@ -1,128 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Thu, 4 Feb 2016 22:09:29 +0100
-Subject: [PATCH] net: mvneta: Fix race condition during stopping
-
-When stopping the port, the CPU notifier are still there whereas the
-mvneta_stop_dev function calls mvneta_percpu_disable() on each CPUs.
-It was possible to have a new CPU coming at this point which could be
-racy.
-
-This patch adds a flag preventing executing the code notifier for a new
-CPU when the port is stopping. It also uses the spinlock introduces
-previously. To avoid the deadlock, the lock has been moved outside the
-mvneta_percpu_elect function.
-
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -374,6 +374,7 @@ struct mvneta_port {
- 	 * ensuring that the configuration remains coherent.
- 	 */
- 	spinlock_t lock;
-+	bool is_stopped;
- 
- 	/* Core clock */
- 	struct clk *clk;
-@@ -2853,16 +2854,14 @@ static void mvneta_percpu_disable(void *
- 	disable_percpu_irq(pp->dev->irq);
- }
- 
-+/* Electing a CPU must be done in an atomic way: it should be done
-+ * after or before the removal/insertion of a CPU and this function is
-+ * not reentrant.
-+ */
- static void mvneta_percpu_elect(struct mvneta_port *pp)
- {
- 	int elected_cpu = 0, max_cpu, cpu, i = 0;
- 
--	/* Electing a CPU must be done in an atomic way: it should be
--	 * done after or before the removal/insertion of a CPU and
--	 * this function is not reentrant.
--	 */
--	spin_lock(&pp->lock);
--
- 	/* Use the cpu associated to the rxq when it is online, in all
- 	 * the other cases, use the cpu 0 which can't be offline.
- 	 */
-@@ -2906,7 +2905,6 @@ static void mvneta_percpu_elect(struct m
- 		i++;
- 
- 	}
--	spin_unlock(&pp->lock);
- };
- 
- static int mvneta_percpu_notifier(struct notifier_block *nfb,
-@@ -2920,6 +2918,14 @@ static int mvneta_percpu_notifier(struct
- 	switch (action) {
- 	case CPU_ONLINE:
- 	case CPU_ONLINE_FROZEN:
-+		spin_lock(&pp->lock);
-+		/* Configuring the driver for a new CPU while the
-+		 * driver is stopping is racy, so just avoid it.
-+		 */
-+		if (pp->is_stopped) {
-+			spin_unlock(&pp->lock);
-+			break;
-+		}
- 		netif_tx_stop_all_queues(pp->dev);
- 
- 		/* We have to synchronise on tha napi of each CPU
-@@ -2957,6 +2963,7 @@ static int mvneta_percpu_notifier(struct
- 			MVNETA_CAUSE_LINK_CHANGE |
- 			MVNETA_CAUSE_PSC_SYNC_CHANGE);
- 		netif_tx_start_all_queues(pp->dev);
-+		spin_unlock(&pp->lock);
- 		break;
- 	case CPU_DOWN_PREPARE:
- 	case CPU_DOWN_PREPARE_FROZEN:
-@@ -2981,7 +2988,9 @@ static int mvneta_percpu_notifier(struct
- 	case CPU_DEAD:
- 	case CPU_DEAD_FROZEN:
- 		/* Check if a new CPU must be elected now this on is down */
-+		spin_lock(&pp->lock);
- 		mvneta_percpu_elect(pp);
-+		spin_unlock(&pp->lock);
- 		/* Unmask all ethernet port interrupts */
- 		on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
- 		mvreg_write(pp, MVNETA_INTR_MISC_MASK,
-@@ -3033,7 +3042,7 @@ static int mvneta_open(struct net_device
- 	 */
- 	on_each_cpu(mvneta_percpu_enable, pp, true);
- 
--
-+	pp->is_stopped = false;
- 	/* Register a CPU notifier to handle the case where our CPU
- 	 * might be taken offline.
- 	 */
-@@ -3066,9 +3075,18 @@ static int mvneta_stop(struct net_device
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
- 
-+	/* Inform that we are stopping so we don't want to setup the
-+	 * driver for new CPUs in the notifiers
-+	 */
-+	spin_lock(&pp->lock);
-+	pp->is_stopped = true;
- 	mvneta_stop_dev(pp);
- 	mvneta_mdio_remove(pp);
- 	unregister_cpu_notifier(&pp->cpu_notifier);
-+	/* Now that the notifier are unregistered, we can release le
-+	 * lock
-+	 */
-+	spin_unlock(&pp->lock);
- 	on_each_cpu(mvneta_percpu_disable, pp, true);
- 	free_percpu_irq(dev->irq, pp->ports);
- 	mvneta_cleanup_rxqs(pp);
-@@ -3339,7 +3357,9 @@ static int  mvneta_config_rss(struct mvn
- 	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
- 
- 	/* Update the elected CPU matching the new rxq_def */
-+	spin_lock(&pp->lock);
- 	mvneta_percpu_elect(pp);
-+	spin_unlock(&pp->lock);
- 
- 	/* We have to synchronise on the napi of each CPU */
- 	for_each_online_cpu(cpu) {
diff --git a/target/linux/mvebu/patches-4.4/043-net-mvneta-sort-the-headers-in-alphabetic-order.patch b/target/linux/mvebu/patches-4.4/043-net-mvneta-sort-the-headers-in-alphabetic-order.patch
deleted file mode 100644
index 502c258..0000000
--- a/target/linux/mvebu/patches-4.4/043-net-mvneta-sort-the-headers-in-alphabetic-order.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From: Jisheng Zhang <jszhang at marvell.com>
-Date: Wed, 20 Jan 2016 19:27:22 +0800
-Subject: [PATCH] net: mvneta: sort the headers in alphabetic order
-
-Sorting the headers in alphabetic order will help to reduce the conflict
-when adding new headers in the future.
-
-Signed-off-by: Jisheng Zhang <jszhang at marvell.com>
-Acked-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -11,28 +11,28 @@
-  * warranty of any kind, whether express or implied.
-  */
- 
--#include <linux/kernel.h>
--#include <linux/netdevice.h>
-+#include <linux/clk.h>
-+#include <linux/cpu.h>
- #include <linux/etherdevice.h>
--#include <linux/platform_device.h>
--#include <linux/skbuff.h>
-+#include <linux/if_vlan.h>
- #include <linux/inetdevice.h>
--#include <linux/mbus.h>
--#include <linux/module.h>
- #include <linux/interrupt.h>
--#include <linux/if_vlan.h>
--#include <net/ip.h>
--#include <net/ipv6.h>
- #include <linux/io.h>
--#include <net/tso.h>
-+#include <linux/kernel.h>
-+#include <linux/mbus.h>
-+#include <linux/module.h>
-+#include <linux/netdevice.h>
- #include <linux/of.h>
-+#include <linux/of_address.h>
- #include <linux/of_irq.h>
- #include <linux/of_mdio.h>
- #include <linux/of_net.h>
--#include <linux/of_address.h>
- #include <linux/phy.h>
--#include <linux/clk.h>
--#include <linux/cpu.h>
-+#include <linux/platform_device.h>
-+#include <linux/skbuff.h>
-+#include <net/ip.h>
-+#include <net/ipv6.h>
-+#include <net/tso.h>
- 
- /* Registers */
- #define MVNETA_RXQ_CONFIG_REG(q)                (0x1400 + ((q) << 2))
diff --git a/target/linux/mvebu/patches-4.4/044-net-add-a-hardware-buffer-management-helper-API.patch b/target/linux/mvebu/patches-4.4/044-net-add-a-hardware-buffer-management-helper-API.patch
deleted file mode 100644
index d4bc6a0..0000000
--- a/target/linux/mvebu/patches-4.4/044-net-add-a-hardware-buffer-management-helper-API.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Mon, 14 Mar 2016 09:39:04 +0100
-Subject: [PATCH] net: add a hardware buffer management helper API
-
-This basic implementation allows to share code between driver using
-hardware buffer management. As the code is hardware agnostic, there is
-few helpers, most of the optimization brought by the an HW BM has to be
-done at driver level.
-
-Tested-by: Sebastian Careba <nitroshift at yahoo.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
- create mode 100644 include/net/hwbm.h
- create mode 100644 net/core/hwbm.c
-
---- /dev/null
-+++ b/include/net/hwbm.h
-@@ -0,0 +1,28 @@
-+#ifndef _HWBM_H
-+#define _HWBM_H
-+
-+struct hwbm_pool {
-+	/* Capacity of the pool */
-+	int size;
-+	/* Size of the buffers managed */
-+	int frag_size;
-+	/* Number of buffers currently used by this pool */
-+	int buf_num;
-+	/* constructor called during alocation */
-+	int (*construct)(struct hwbm_pool *bm_pool, void *buf);
-+	/* protect acces to the buffer counter*/
-+	spinlock_t lock;
-+	/* private data */
-+	void *priv;
-+};
-+#ifdef CONFIG_HWBM
-+void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
-+int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
-+int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp);
-+#else
-+void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
-+int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
-+int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
-+{ return 0; }
-+#endif /* CONFIG_HWBM */
-+#endif /* _HWBM_H */
---- a/net/Kconfig
-+++ b/net/Kconfig
-@@ -259,6 +259,9 @@ config XPS
- 	depends on SMP
- 	default y
- 
-+config HWBM
-+	bool
-+
- config CGROUP_NET_PRIO
- 	bool "Network priority cgroup"
- 	depends on CGROUPS
---- a/net/core/Makefile
-+++ b/net/core/Makefile
-@@ -14,6 +14,7 @@ obj-y		     += dev.o ethtool.o dev_addr_
- obj-$(CONFIG_SOCK_DIAG) += sock_diag.o
- obj-$(CONFIG_XFRM) += flow.o
- obj-y += net-sysfs.o
-+obj-$(CONFIG_HWBM) += hwbm.o
- obj-$(CONFIG_PROC_FS) += net-procfs.o
- obj-$(CONFIG_NET_PKTGEN) += pktgen.o
- obj-$(CONFIG_NETPOLL) += netpoll.o
---- /dev/null
-+++ b/net/core/hwbm.c
-@@ -0,0 +1,87 @@
-+/* Support for hardware buffer manager.
-+ *
-+ * Copyright (C) 2016 Marvell
-+ *
-+ * Gregory CLEMENT <gregory.clement at free-electrons.com>
-+ *
-+ *  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; either version 2 of the License, or
-+ *  (at your option) any later version.
-+ */
-+#include <linux/kernel.h>
-+#include <linux/printk.h>
-+#include <linux/skbuff.h>
-+#include <net/hwbm.h>
-+
-+void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf)
-+{
-+	if (likely(bm_pool->frag_size <= PAGE_SIZE))
-+		skb_free_frag(buf);
-+	else
-+		kfree(buf);
-+}
-+EXPORT_SYMBOL_GPL(hwbm_buf_free);
-+
-+/* Refill processing for HW buffer management */
-+int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
-+{
-+	int frag_size = bm_pool->frag_size;
-+	void *buf;
-+
-+	if (likely(frag_size <= PAGE_SIZE))
-+		buf = netdev_alloc_frag(frag_size);
-+	else
-+		buf = kmalloc(frag_size, gfp);
-+
-+	if (!buf)
-+		return -ENOMEM;
-+
-+	if (bm_pool->construct)
-+		if (bm_pool->construct(bm_pool, buf)) {
-+			hwbm_buf_free(bm_pool, buf);
-+			return -ENOMEM;
-+		}
-+
-+	return 0;
-+}
-+EXPORT_SYMBOL_GPL(hwbm_pool_refill);
-+
-+int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
-+{
-+	int err, i;
-+	unsigned long flags;
-+
-+	spin_lock_irqsave(&bm_pool->lock, flags);
-+	if (bm_pool->buf_num == bm_pool->size) {
-+		pr_warn("pool already filled\n");
-+		return bm_pool->buf_num;
-+	}
-+
-+	if (buf_num + bm_pool->buf_num > bm_pool->size) {
-+		pr_warn("cannot allocate %d buffers for pool\n",
-+			buf_num);
-+		return 0;
-+	}
-+
-+	if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) {
-+		pr_warn("Adding %d buffers to the %d current buffers will overflow\n",
-+			buf_num,  bm_pool->buf_num);
-+		return 0;
-+	}
-+
-+	for (i = 0; i < buf_num; i++) {
-+		err = hwbm_pool_refill(bm_pool, gfp);
-+		if (err < 0)
-+			break;
-+	}
-+
-+	/* Update BM driver with number of buffers added to pool */
-+	bm_pool->buf_num += i;
-+
-+	pr_debug("hwpm pool: %d of %d buffers added\n", i, buf_num);
-+	spin_unlock_irqrestore(&bm_pool->lock, flags);
-+
-+	return i;
-+}
-+EXPORT_SYMBOL_GPL(hwbm_pool_add);
diff --git a/target/linux/mvebu/patches-4.4/045-net-mvneta-bm-add-support-for-hardware-buffer-manage.patch b/target/linux/mvebu/patches-4.4/045-net-mvneta-bm-add-support-for-hardware-buffer-manage.patch
deleted file mode 100644
index d343b39..0000000
--- a/target/linux/mvebu/patches-4.4/045-net-mvneta-bm-add-support-for-hardware-buffer-manage.patch
+++ /dev/null
@@ -1,1684 +0,0 @@
-From: Marcin Wojtas <mw at semihalf.com>
-Date: Mon, 14 Mar 2016 09:39:03 +0100
-Subject: [PATCH] net: mvneta: bm: add support for hardware buffer management
-
-Buffer manager (BM) is a dedicated hardware unit that can be used by all
-ethernet ports of Armada XP and 38x SoC's. It allows to offload CPU on RX
-path by sparing DRAM access on refilling buffer pool, hardware-based
-filling of descriptor ring data and better memory utilization due to HW
-arbitration for using 'short' pools for small packets.
-
-Tests performed with A388 SoC working as a network bridge between two
-packet generators showed increase of maximum processed 64B packets by
-~20k (~555k packets with BM enabled vs ~535 packets without BM). Also
-when pushing 1500B-packets with a line rate achieved, CPU load decreased
-from around 25% without BM to 20% with BM.
-
-BM comprise up to 4 buffer pointers' (BP) rings kept in DRAM, which
-are called external BP pools - BPPE. Allocating and releasing buffer
-pointers (BP) to/from BPPE is performed indirectly by write/read access
-to a dedicated internal SRAM, where internal BP pools (BPPI) are placed.
-BM hardware controls status of BPPE automatically, as well as assigning
-proper buffers to RX descriptors. For more details please refer to
-Functional Specification of Armada XP or 38x SoC.
-
-In order to enable support for a separate hardware block, common for all
-ports, a new driver has to be implemented ('mvneta_bm'). It provides
-initialization sequence of address space, clocks, registers, SRAM,
-empty pools' structures and also obtaining optional configuration
-from DT (please refer to device tree binding documentation). mvneta_bm
-exposes also a necessary API to mvneta driver, as well as a dedicated
-structure with BM information (bm_priv), whose presence is used as a
-flag notifying of BM usage by port. It has to be ensured that mvneta_bm
-probe is executed prior to the ones in ports' driver. In case BM is not
-used or its probe fails, mvneta falls back to use software buffer
-management.
-
-A sequence executed in mvneta_probe function is modified in order to have
-an access to needed resources before possible port's BM initialization is
-done. According to port-pools mapping provided by DT appropriate registers
-are configured and the buffer pools are filled. RX path is modified
-accordingly. Becaues the hardware allows a wide variety of configuration
-options, following assumptions are made:
-* using BM mechanisms can be selectively disabled/enabled basing
-  on DT configuration among the ports
-* 'long' pool's single buffer size is tied to port's MTU
-* using 'long' pool by port is obligatory and it cannot be shared
-* using 'short' pool for smaller packets is optional
-* one 'short' pool can be shared among all ports
-
-This commit enables hardware buffer management operation cooperating with
-existing mvneta driver. New device tree binding documentation is added and
-the one of mvneta is updated accordingly.
-
-[gregory.clement at free-electrons.com: removed the suspend/resume part]
-
-Signed-off-by: Marcin Wojtas <mw at semihalf.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
- create mode 100644 Documentation/devicetree/bindings/net/marvell-neta-bm.txt
- create mode 100644 drivers/net/ethernet/marvell/mvneta_bm.c
- create mode 100644 drivers/net/ethernet/marvell/mvneta_bm.h
-
---- a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
-+++ b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
-@@ -13,15 +13,30 @@ Optional properties:
-   Value is presented in bytes. If not used, by default 1600B is set for
-   "marvell,armada-370-neta" and 9800B for others.
- 
-+Optional properties (valid only for Armada XP/38x):
-+
-+- buffer-manager: a phandle to a buffer manager node. Please refer to
-+  Documentation/devicetree/bindings/net/marvell-neta-bm.txt
-+- bm,pool-long: ID of a pool, that will accept all packets of a size
-+  higher than 'short' pool's threshold (if set) and up to MTU value.
-+  Obligatory, when the port is supposed to use hardware
-+  buffer management.
-+- bm,pool-short: ID of a pool, that will be used for accepting
-+  packets of a size lower than given threshold. If not set, the port
-+  will use a single 'long' pool for all packets, as defined above.
-+
- Example:
- 
--ethernet at d0070000 {
-+ethernet at 70000 {
- 	compatible = "marvell,armada-370-neta";
--	reg = <0xd0070000 0x2500>;
-+	reg = <0x70000 0x2500>;
- 	interrupts = <8>;
- 	clocks = <&gate_clk 4>;
- 	tx-csum-limit = <9800>
- 	status = "okay";
- 	phy = <&phy0>;
- 	phy-mode = "rgmii-id";
-+	buffer-manager = <&bm>;
-+	bm,pool-long = <0>;
-+	bm,pool-short = <1>;
- };
---- /dev/null
-+++ b/Documentation/devicetree/bindings/net/marvell-neta-bm.txt
-@@ -0,0 +1,49 @@
-+* Marvell Armada 380/XP Buffer Manager driver (BM)
-+
-+Required properties:
-+
-+- compatible: should be "marvell,armada-380-neta-bm".
-+- reg: address and length of the register set for the device.
-+- clocks: a pointer to the reference clock for this device.
-+- internal-mem: a phandle to BM internal SRAM definition.
-+
-+Optional properties (port):
-+
-+- pool<0 : 3>,capacity: size of external buffer pointers' ring maintained
-+  in DRAM. Can be set for each pool (id 0 : 3) separately. The value has
-+  to be chosen between 128 and 16352 and it also has to be aligned to 32.
-+  Otherwise the driver would adjust a given number or choose default if
-+  not set.
-+- pool<0 : 3>,pkt-size: maximum size of a packet accepted by a given buffer
-+  pointers' pool (id 0 : 3). It will be taken into consideration only when pool
-+  type is 'short'. For 'long' ones it would be overridden by port's MTU.
-+  If not set a driver will choose a default value.
-+
-+In order to see how to hook the BM to a given ethernet port, please
-+refer to Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt.
-+
-+Example:
-+
-+- main node:
-+
-+bm: bm at c8000 {
-+	compatible = "marvell,armada-380-neta-bm";
-+	reg = <0xc8000 0xac>;
-+	clocks = <&gateclk 13>;
-+	internal-mem = <&bm_bppi>;
-+	status = "okay";
-+	pool2,capacity = <4096>;
-+	pool1,pkt-size = <512>;
-+};
-+
-+- internal SRAM node:
-+
-+bm_bppi: bm-bppi {
-+	compatible = "mmio-sram";
-+	reg = <MBUS_ID(0x0c, 0x04) 0 0x100000>;
-+	ranges = <0 MBUS_ID(0x0c, 0x04) 0 0x100000>;
-+	#address-cells = <1>;
-+	#size-cells = <1>;
-+	clocks = <&gateclk 13>;
-+	status = "okay";
-+};
---- a/drivers/net/ethernet/marvell/Kconfig
-+++ b/drivers/net/ethernet/marvell/Kconfig
-@@ -40,6 +40,19 @@ config MVMDIO
- 
- 	  This driver is used by the MV643XX_ETH and MVNETA drivers.
- 
-+config MVNETA_BM
-+	tristate "Marvell Armada 38x/XP network interface BM support"
-+	depends on MVNETA
-+	---help---
-+	  This driver supports auxiliary block of the network
-+	  interface units in the Marvell ARMADA XP and ARMADA 38x SoC
-+	  family, which is called buffer manager.
-+
-+	  This driver, when enabled, strictly cooperates with mvneta
-+	  driver and is common for all network ports of the devices,
-+	  even for Armada 370 SoC, which doesn't support hardware
-+	  buffer management.
-+
- config MVNETA
- 	tristate "Marvell Armada 370/38x/XP network interface support"
- 	depends on PLAT_ORION
---- a/drivers/net/ethernet/marvell/Makefile
-+++ b/drivers/net/ethernet/marvell/Makefile
-@@ -4,6 +4,7 @@
- 
- obj-$(CONFIG_MVMDIO) += mvmdio.o
- obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o
-+obj-$(CONFIG_MVNETA_BM) += mvneta_bm.o
- obj-$(CONFIG_MVNETA) += mvneta.o
- obj-$(CONFIG_MVPP2) += mvpp2.o
- obj-$(CONFIG_PXA168_ETH) += pxa168_eth.o
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -30,6 +30,7 @@
- #include <linux/phy.h>
- #include <linux/platform_device.h>
- #include <linux/skbuff.h>
-+#include "mvneta_bm.h"
- #include <net/ip.h>
- #include <net/ipv6.h>
- #include <net/tso.h>
-@@ -37,6 +38,10 @@
- /* Registers */
- #define MVNETA_RXQ_CONFIG_REG(q)                (0x1400 + ((q) << 2))
- #define      MVNETA_RXQ_HW_BUF_ALLOC            BIT(0)
-+#define      MVNETA_RXQ_SHORT_POOL_ID_SHIFT	4
-+#define      MVNETA_RXQ_SHORT_POOL_ID_MASK	0x30
-+#define      MVNETA_RXQ_LONG_POOL_ID_SHIFT	6
-+#define      MVNETA_RXQ_LONG_POOL_ID_MASK	0xc0
- #define      MVNETA_RXQ_PKT_OFFSET_ALL_MASK     (0xf    << 8)
- #define      MVNETA_RXQ_PKT_OFFSET_MASK(offs)   ((offs) << 8)
- #define MVNETA_RXQ_THRESHOLD_REG(q)             (0x14c0 + ((q) << 2))
-@@ -50,6 +55,9 @@
- #define MVNETA_RXQ_STATUS_UPDATE_REG(q)         (0x1500 + ((q) << 2))
- #define      MVNETA_RXQ_ADD_NON_OCCUPIED_SHIFT  16
- #define      MVNETA_RXQ_ADD_NON_OCCUPIED_MAX    255
-+#define MVNETA_PORT_POOL_BUFFER_SZ_REG(pool)	(0x1700 + ((pool) << 2))
-+#define      MVNETA_PORT_POOL_BUFFER_SZ_SHIFT	3
-+#define      MVNETA_PORT_POOL_BUFFER_SZ_MASK	0xfff8
- #define MVNETA_PORT_RX_RESET                    0x1cc0
- #define      MVNETA_PORT_RX_DMA_RESET           BIT(0)
- #define MVNETA_PHY_ADDR                         0x2000
-@@ -107,6 +115,7 @@
- #define MVNETA_GMAC_CLOCK_DIVIDER                0x24f4
- #define      MVNETA_GMAC_1MS_CLOCK_ENABLE        BIT(31)
- #define MVNETA_ACC_MODE                          0x2500
-+#define MVNETA_BM_ADDRESS                        0x2504
- #define MVNETA_CPU_MAP(cpu)                      (0x2540 + ((cpu) << 2))
- #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
- #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
-@@ -253,7 +262,10 @@
- #define MVNETA_CPU_D_CACHE_LINE_SIZE    32
- #define MVNETA_TX_CSUM_DEF_SIZE		1600
- #define MVNETA_TX_CSUM_MAX_SIZE		9800
--#define MVNETA_ACC_MODE_EXT		1
-+#define MVNETA_ACC_MODE_EXT1		1
-+#define MVNETA_ACC_MODE_EXT2		2
-+
-+#define MVNETA_MAX_DECODE_WIN		6
- 
- /* Timeout constants */
- #define MVNETA_TX_DISABLE_TIMEOUT_MSEC	1000
-@@ -293,7 +305,8 @@
- 	((addr >= txq->tso_hdrs_phys) && \
- 	 (addr < txq->tso_hdrs_phys + txq->size * TSO_HEADER_SIZE))
- 
--#define MVNETA_RX_BUF_SIZE(pkt_size)   ((pkt_size) + NET_SKB_PAD)
-+#define MVNETA_RX_GET_BM_POOL_ID(rxd) \
-+	(((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT)
- 
- struct mvneta_statistic {
- 	unsigned short offset;
-@@ -359,6 +372,7 @@ struct mvneta_pcpu_port {
- };
- 
- struct mvneta_port {
-+	u8 id;
- 	struct mvneta_pcpu_port __percpu	*ports;
- 	struct mvneta_pcpu_stats __percpu	*stats;
- 
-@@ -392,6 +406,11 @@ struct mvneta_port {
- 	unsigned int tx_csum_limit;
- 	unsigned int use_inband_status:1;
- 
-+	struct mvneta_bm *bm_priv;
-+	struct mvneta_bm_pool *pool_long;
-+	struct mvneta_bm_pool *pool_short;
-+	int bm_win_id;
-+
- 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
- 
- 	u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
-@@ -417,6 +436,8 @@ struct mvneta_port {
- #define MVNETA_TX_L4_CSUM_NOT	BIT(31)
- 
- #define MVNETA_RXD_ERR_CRC		0x0
-+#define MVNETA_RXD_BM_POOL_SHIFT	13
-+#define MVNETA_RXD_BM_POOL_MASK		(BIT(13) | BIT(14))
- #define MVNETA_RXD_ERR_SUMMARY		BIT(16)
- #define MVNETA_RXD_ERR_OVERRUN		BIT(17)
- #define MVNETA_RXD_ERR_LEN		BIT(18)
-@@ -561,6 +582,9 @@ static int rxq_def;
- 
- static int rx_copybreak __read_mostly = 256;
- 
-+/* HW BM need that each port be identify by a unique ID */
-+static int global_port_id;
-+
- #define MVNETA_DRIVER_NAME "mvneta"
- #define MVNETA_DRIVER_VERSION "1.0"
- 
-@@ -827,6 +851,214 @@ static void mvneta_rxq_bm_disable(struct
- 	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
- }
- 
-+/* Enable buffer management (BM) */
-+static void mvneta_rxq_bm_enable(struct mvneta_port *pp,
-+				 struct mvneta_rx_queue *rxq)
-+{
-+	u32 val;
-+
-+	val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id));
-+	val |= MVNETA_RXQ_HW_BUF_ALLOC;
-+	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
-+}
-+
-+/* Notify HW about port's assignment of pool for bigger packets */
-+static void mvneta_rxq_long_pool_set(struct mvneta_port *pp,
-+				     struct mvneta_rx_queue *rxq)
-+{
-+	u32 val;
-+
-+	val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id));
-+	val &= ~MVNETA_RXQ_LONG_POOL_ID_MASK;
-+	val |= (pp->pool_long->id << MVNETA_RXQ_LONG_POOL_ID_SHIFT);
-+
-+	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
-+}
-+
-+/* Notify HW about port's assignment of pool for smaller packets */
-+static void mvneta_rxq_short_pool_set(struct mvneta_port *pp,
-+				      struct mvneta_rx_queue *rxq)
-+{
-+	u32 val;
-+
-+	val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id));
-+	val &= ~MVNETA_RXQ_SHORT_POOL_ID_MASK;
-+	val |= (pp->pool_short->id << MVNETA_RXQ_SHORT_POOL_ID_SHIFT);
-+
-+	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
-+}
-+
-+/* Set port's receive buffer size for assigned BM pool */
-+static inline void mvneta_bm_pool_bufsize_set(struct mvneta_port *pp,
-+					      int buf_size,
-+					      u8 pool_id)
-+{
-+	u32 val;
-+
-+	if (!IS_ALIGNED(buf_size, 8)) {
-+		dev_warn(pp->dev->dev.parent,
-+			 "illegal buf_size value %d, round to %d\n",
-+			 buf_size, ALIGN(buf_size, 8));
-+		buf_size = ALIGN(buf_size, 8);
-+	}
-+
-+	val = mvreg_read(pp, MVNETA_PORT_POOL_BUFFER_SZ_REG(pool_id));
-+	val |= buf_size & MVNETA_PORT_POOL_BUFFER_SZ_MASK;
-+	mvreg_write(pp, MVNETA_PORT_POOL_BUFFER_SZ_REG(pool_id), val);
-+}
-+
-+/* Configure MBUS window in order to enable access BM internal SRAM */
-+static int mvneta_mbus_io_win_set(struct mvneta_port *pp, u32 base, u32 wsize,
-+				  u8 target, u8 attr)
-+{
-+	u32 win_enable, win_protect;
-+	int i;
-+
-+	win_enable = mvreg_read(pp, MVNETA_BASE_ADDR_ENABLE);
-+
-+	if (pp->bm_win_id < 0) {
-+		/* Find first not occupied window */
-+		for (i = 0; i < MVNETA_MAX_DECODE_WIN; i++) {
-+			if (win_enable & (1 << i)) {
-+				pp->bm_win_id = i;
-+				break;
-+			}
-+		}
-+		if (i == MVNETA_MAX_DECODE_WIN)
-+			return -ENOMEM;
-+	} else {
-+		i = pp->bm_win_id;
-+	}
-+
-+	mvreg_write(pp, MVNETA_WIN_BASE(i), 0);
-+	mvreg_write(pp, MVNETA_WIN_SIZE(i), 0);
-+
-+	if (i < 4)
-+		mvreg_write(pp, MVNETA_WIN_REMAP(i), 0);
-+
-+	mvreg_write(pp, MVNETA_WIN_BASE(i), (base & 0xffff0000) |
-+		    (attr << 8) | target);
-+
-+	mvreg_write(pp, MVNETA_WIN_SIZE(i), (wsize - 1) & 0xffff0000);
-+
-+	win_protect = mvreg_read(pp, MVNETA_ACCESS_PROTECT_ENABLE);
-+	win_protect |= 3 << (2 * i);
-+	mvreg_write(pp, MVNETA_ACCESS_PROTECT_ENABLE, win_protect);
-+
-+	win_enable &= ~(1 << i);
-+	mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
-+
-+	return 0;
-+}
-+
-+/* Assign and initialize pools for port. In case of fail
-+ * buffer manager will remain disabled for current port.
-+ */
-+static int mvneta_bm_port_init(struct platform_device *pdev,
-+			       struct mvneta_port *pp)
-+{
-+	struct device_node *dn = pdev->dev.of_node;
-+	u32 long_pool_id, short_pool_id, wsize;
-+	u8 target, attr;
-+	int err;
-+
-+	/* Get BM window information */
-+	err = mvebu_mbus_get_io_win_info(pp->bm_priv->bppi_phys_addr, &wsize,
-+					 &target, &attr);
-+	if (err < 0)
-+		return err;
-+
-+	pp->bm_win_id = -1;
-+
-+	/* Open NETA -> BM window */
-+	err = mvneta_mbus_io_win_set(pp, pp->bm_priv->bppi_phys_addr, wsize,
-+				     target, attr);
-+	if (err < 0) {
-+		netdev_info(pp->dev, "fail to configure mbus window to BM\n");
-+		return err;
-+	}
-+
-+	if (of_property_read_u32(dn, "bm,pool-long", &long_pool_id)) {
-+		netdev_info(pp->dev, "missing long pool id\n");
-+		return -EINVAL;
-+	}
-+
-+	/* Create port's long pool depending on mtu */
-+	pp->pool_long = mvneta_bm_pool_use(pp->bm_priv, long_pool_id,
-+					   MVNETA_BM_LONG, pp->id,
-+					   MVNETA_RX_PKT_SIZE(pp->dev->mtu));
-+	if (!pp->pool_long) {
-+		netdev_info(pp->dev, "fail to obtain long pool for port\n");
-+		return -ENOMEM;
-+	}
-+
-+	pp->pool_long->port_map |= 1 << pp->id;
-+
-+	mvneta_bm_pool_bufsize_set(pp, pp->pool_long->buf_size,
-+				   pp->pool_long->id);
-+
-+	/* If short pool id is not defined, assume using single pool */
-+	if (of_property_read_u32(dn, "bm,pool-short", &short_pool_id))
-+		short_pool_id = long_pool_id;
-+
-+	/* Create port's short pool */
-+	pp->pool_short = mvneta_bm_pool_use(pp->bm_priv, short_pool_id,
-+					    MVNETA_BM_SHORT, pp->id,
-+					    MVNETA_BM_SHORT_PKT_SIZE);
-+	if (!pp->pool_short) {
-+		netdev_info(pp->dev, "fail to obtain short pool for port\n");
-+		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
-+		return -ENOMEM;
-+	}
-+
-+	if (short_pool_id != long_pool_id) {
-+		pp->pool_short->port_map |= 1 << pp->id;
-+		mvneta_bm_pool_bufsize_set(pp, pp->pool_short->buf_size,
-+					   pp->pool_short->id);
-+	}
-+
-+	return 0;
-+}
-+
-+/* Update settings of a pool for bigger packets */
-+static void mvneta_bm_update_mtu(struct mvneta_port *pp, int mtu)
-+{
-+	struct mvneta_bm_pool *bm_pool = pp->pool_long;
-+	int num;
-+
-+	/* Release all buffers from long pool */
-+	mvneta_bm_bufs_free(pp->bm_priv, bm_pool, 1 << pp->id);
-+	if (bm_pool->buf_num) {
-+		WARN(1, "cannot free all buffers in pool %d\n",
-+		     bm_pool->id);
-+		goto bm_mtu_err;
-+	}
-+
-+	bm_pool->pkt_size = MVNETA_RX_PKT_SIZE(mtu);
-+	bm_pool->buf_size = MVNETA_RX_BUF_SIZE(bm_pool->pkt_size);
-+	bm_pool->frag_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
-+			  SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(bm_pool->pkt_size));
-+
-+	/* Fill entire long pool */
-+	num = mvneta_bm_bufs_add(pp->bm_priv, bm_pool, bm_pool->size);
-+	if (num != bm_pool->size) {
-+		WARN(1, "pool %d: %d of %d allocated\n",
-+		     bm_pool->id, num, bm_pool->size);
-+		goto bm_mtu_err;
-+	}
-+	mvneta_bm_pool_bufsize_set(pp, bm_pool->buf_size, bm_pool->id);
-+
-+	return;
-+
-+bm_mtu_err:
-+	mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
-+	mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, 1 << pp->id);
-+
-+	pp->bm_priv = NULL;
-+	mvreg_write(pp, MVNETA_ACC_MODE, MVNETA_ACC_MODE_EXT1);
-+	netdev_info(pp->dev, "fail to update MTU, fall back to software BM\n");
-+}
-+
- /* Start the Ethernet port RX and TX activity */
- static void mvneta_port_up(struct mvneta_port *pp)
- {
-@@ -1147,9 +1379,17 @@ static void mvneta_defaults_set(struct m
- 	mvreg_write(pp, MVNETA_PORT_RX_RESET, 0);
- 
- 	/* Set Port Acceleration Mode */
--	val = MVNETA_ACC_MODE_EXT;
-+	if (pp->bm_priv)
-+		/* HW buffer management + legacy parser */
-+		val = MVNETA_ACC_MODE_EXT2;
-+	else
-+		/* SW buffer management + legacy parser */
-+		val = MVNETA_ACC_MODE_EXT1;
- 	mvreg_write(pp, MVNETA_ACC_MODE, val);
- 
-+	if (pp->bm_priv)
-+		mvreg_write(pp, MVNETA_BM_ADDRESS, pp->bm_priv->bppi_phys_addr);
-+
- 	/* Update val of portCfg register accordingly with all RxQueue types */
- 	val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
- 	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
-@@ -1516,23 +1756,25 @@ static void mvneta_txq_done(struct mvnet
- 	}
- }
- 
--static void *mvneta_frag_alloc(const struct mvneta_port *pp)
-+void *mvneta_frag_alloc(unsigned int frag_size)
- {
--	if (likely(pp->frag_size <= PAGE_SIZE))
--		return netdev_alloc_frag(pp->frag_size);
-+	if (likely(frag_size <= PAGE_SIZE))
-+		return netdev_alloc_frag(frag_size);
- 	else
--		return kmalloc(pp->frag_size, GFP_ATOMIC);
-+		return kmalloc(frag_size, GFP_ATOMIC);
- }
-+EXPORT_SYMBOL_GPL(mvneta_frag_alloc);
- 
--static void mvneta_frag_free(const struct mvneta_port *pp, void *data)
-+void mvneta_frag_free(unsigned int frag_size, void *data)
- {
--	if (likely(pp->frag_size <= PAGE_SIZE))
-+	if (likely(frag_size <= PAGE_SIZE))
- 		skb_free_frag(data);
- 	else
- 		kfree(data);
- }
-+EXPORT_SYMBOL_GPL(mvneta_frag_free);
- 
--/* Refill processing */
-+/* Refill processing for SW buffer management */
- static int mvneta_rx_refill(struct mvneta_port *pp,
- 			    struct mvneta_rx_desc *rx_desc)
- 
-@@ -1540,7 +1782,7 @@ static int mvneta_rx_refill(struct mvnet
- 	dma_addr_t phys_addr;
- 	void *data;
- 
--	data = mvneta_frag_alloc(pp);
-+	data = mvneta_frag_alloc(pp->frag_size);
- 	if (!data)
- 		return -ENOMEM;
- 
-@@ -1548,7 +1790,7 @@ static int mvneta_rx_refill(struct mvnet
- 				   MVNETA_RX_BUF_SIZE(pp->pkt_size),
- 				   DMA_FROM_DEVICE);
- 	if (unlikely(dma_mapping_error(pp->dev->dev.parent, phys_addr))) {
--		mvneta_frag_free(pp, data);
-+		mvneta_frag_free(pp->frag_size, data);
- 		return -ENOMEM;
- 	}
- 
-@@ -1594,22 +1836,156 @@ static void mvneta_rxq_drop_pkts(struct
- 	int rx_done, i;
- 
- 	rx_done = mvneta_rxq_busy_desc_num_get(pp, rxq);
-+	if (rx_done)
-+		mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
-+
-+	if (pp->bm_priv) {
-+		for (i = 0; i < rx_done; i++) {
-+			struct mvneta_rx_desc *rx_desc =
-+						  mvneta_rxq_next_desc_get(rxq);
-+			u8 pool_id = MVNETA_RX_GET_BM_POOL_ID(rx_desc);
-+			struct mvneta_bm_pool *bm_pool;
-+
-+			bm_pool = &pp->bm_priv->bm_pools[pool_id];
-+			/* Return dropped buffer to the pool */
-+			mvneta_bm_pool_put_bp(pp->bm_priv, bm_pool,
-+					      rx_desc->buf_phys_addr);
-+		}
-+		return;
-+	}
-+
- 	for (i = 0; i < rxq->size; i++) {
- 		struct mvneta_rx_desc *rx_desc = rxq->descs + i;
- 		void *data = (void *)rx_desc->buf_cookie;
- 
- 		dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
- 				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
--		mvneta_frag_free(pp, data);
-+		mvneta_frag_free(pp->frag_size, data);
- 	}
-+}
- 
--	if (rx_done)
--		mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
-+/* Main rx processing when using software buffer management */
-+static int mvneta_rx_swbm(struct mvneta_port *pp, int rx_todo,
-+			  struct mvneta_rx_queue *rxq)
-+{
-+	struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports);
-+	struct net_device *dev = pp->dev;
-+	int rx_done;
-+	u32 rcvd_pkts = 0;
-+	u32 rcvd_bytes = 0;
-+
-+	/* Get number of received packets */
-+	rx_done = mvneta_rxq_busy_desc_num_get(pp, rxq);
-+
-+	if (rx_todo > rx_done)
-+		rx_todo = rx_done;
-+
-+	rx_done = 0;
-+
-+	/* Fairness NAPI loop */
-+	while (rx_done < rx_todo) {
-+		struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq);
-+		struct sk_buff *skb;
-+		unsigned char *data;
-+		dma_addr_t phys_addr;
-+		u32 rx_status, frag_size;
-+		int rx_bytes, err;
-+
-+		rx_done++;
-+		rx_status = rx_desc->status;
-+		rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE);
-+		data = (unsigned char *)rx_desc->buf_cookie;
-+		phys_addr = rx_desc->buf_phys_addr;
-+
-+		if (!mvneta_rxq_desc_is_first_last(rx_status) ||
-+		    (rx_status & MVNETA_RXD_ERR_SUMMARY)) {
-+err_drop_frame:
-+			dev->stats.rx_errors++;
-+			mvneta_rx_error(pp, rx_desc);
-+			/* leave the descriptor untouched */
-+			continue;
-+		}
-+
-+		if (rx_bytes <= rx_copybreak) {
-+		/* better copy a small frame and not unmap the DMA region */
-+			skb = netdev_alloc_skb_ip_align(dev, rx_bytes);
-+			if (unlikely(!skb))
-+				goto err_drop_frame;
-+
-+			dma_sync_single_range_for_cpu(dev->dev.parent,
-+						      rx_desc->buf_phys_addr,
-+						      MVNETA_MH_SIZE + NET_SKB_PAD,
-+						      rx_bytes,
-+						      DMA_FROM_DEVICE);
-+			memcpy(skb_put(skb, rx_bytes),
-+			       data + MVNETA_MH_SIZE + NET_SKB_PAD,
-+			       rx_bytes);
-+
-+			skb->protocol = eth_type_trans(skb, dev);
-+			mvneta_rx_csum(pp, rx_status, skb);
-+			napi_gro_receive(&port->napi, skb);
-+
-+			rcvd_pkts++;
-+			rcvd_bytes += rx_bytes;
-+
-+			/* leave the descriptor and buffer untouched */
-+			continue;
-+		}
-+
-+		/* Refill processing */
-+		err = mvneta_rx_refill(pp, rx_desc);
-+		if (err) {
-+			netdev_err(dev, "Linux processing - Can't refill\n");
-+			rxq->missed++;
-+			goto err_drop_frame;
-+		}
-+
-+		frag_size = pp->frag_size;
-+
-+		skb = build_skb(data, frag_size > PAGE_SIZE ? 0 : frag_size);
-+
-+		/* After refill old buffer has to be unmapped regardless
-+		 * the skb is successfully built or not.
-+		 */
-+		dma_unmap_single(dev->dev.parent, phys_addr,
-+				 MVNETA_RX_BUF_SIZE(pp->pkt_size),
-+				 DMA_FROM_DEVICE);
-+
-+		if (!skb)
-+			goto err_drop_frame;
-+
-+		rcvd_pkts++;
-+		rcvd_bytes += rx_bytes;
-+
-+		/* Linux processing */
-+		skb_reserve(skb, MVNETA_MH_SIZE + NET_SKB_PAD);
-+		skb_put(skb, rx_bytes);
-+
-+		skb->protocol = eth_type_trans(skb, dev);
-+
-+		mvneta_rx_csum(pp, rx_status, skb);
-+
-+		napi_gro_receive(&port->napi, skb);
-+	}
-+
-+	if (rcvd_pkts) {
-+		struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
-+
-+		u64_stats_update_begin(&stats->syncp);
-+		stats->rx_packets += rcvd_pkts;
-+		stats->rx_bytes   += rcvd_bytes;
-+		u64_stats_update_end(&stats->syncp);
-+	}
-+
-+	/* Update rxq management counters */
-+	mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
-+
-+	return rx_done;
- }
- 
--/* Main rx processing */
--static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
--		     struct mvneta_rx_queue *rxq)
-+/* Main rx processing when using hardware buffer management */
-+static int mvneta_rx_hwbm(struct mvneta_port *pp, int rx_todo,
-+			  struct mvneta_rx_queue *rxq)
- {
- 	struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports);
- 	struct net_device *dev = pp->dev;
-@@ -1628,21 +2004,29 @@ static int mvneta_rx(struct mvneta_port
- 	/* Fairness NAPI loop */
- 	while (rx_done < rx_todo) {
- 		struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq);
-+		struct mvneta_bm_pool *bm_pool = NULL;
- 		struct sk_buff *skb;
- 		unsigned char *data;
- 		dma_addr_t phys_addr;
--		u32 rx_status;
-+		u32 rx_status, frag_size;
- 		int rx_bytes, err;
-+		u8 pool_id;
- 
- 		rx_done++;
- 		rx_status = rx_desc->status;
- 		rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE);
- 		data = (unsigned char *)rx_desc->buf_cookie;
- 		phys_addr = rx_desc->buf_phys_addr;
-+		pool_id = MVNETA_RX_GET_BM_POOL_ID(rx_desc);
-+		bm_pool = &pp->bm_priv->bm_pools[pool_id];
- 
- 		if (!mvneta_rxq_desc_is_first_last(rx_status) ||
- 		    (rx_status & MVNETA_RXD_ERR_SUMMARY)) {
--		err_drop_frame:
-+err_drop_frame_ret_pool:
-+			/* Return the buffer to the pool */
-+			mvneta_bm_pool_put_bp(pp->bm_priv, bm_pool,
-+					      rx_desc->buf_phys_addr);
-+err_drop_frame:
- 			dev->stats.rx_errors++;
- 			mvneta_rx_error(pp, rx_desc);
- 			/* leave the descriptor untouched */
-@@ -1653,7 +2037,7 @@ static int mvneta_rx(struct mvneta_port
- 			/* better copy a small frame and not unmap the DMA region */
- 			skb = netdev_alloc_skb_ip_align(dev, rx_bytes);
- 			if (unlikely(!skb))
--				goto err_drop_frame;
-+				goto err_drop_frame_ret_pool;
- 
- 			dma_sync_single_range_for_cpu(dev->dev.parent,
- 			                              rx_desc->buf_phys_addr,
-@@ -1671,26 +2055,31 @@ static int mvneta_rx(struct mvneta_port
- 			rcvd_pkts++;
- 			rcvd_bytes += rx_bytes;
- 
-+			/* Return the buffer to the pool */
-+			mvneta_bm_pool_put_bp(pp->bm_priv, bm_pool,
-+					      rx_desc->buf_phys_addr);
-+
- 			/* leave the descriptor and buffer untouched */
- 			continue;
- 		}
- 
- 		/* Refill processing */
--		err = mvneta_rx_refill(pp, rx_desc);
-+		err = mvneta_bm_pool_refill(pp->bm_priv, bm_pool);
- 		if (err) {
- 			netdev_err(dev, "Linux processing - Can't refill\n");
- 			rxq->missed++;
--			goto err_drop_frame;
-+			goto err_drop_frame_ret_pool;
- 		}
- 
--		skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
-+		frag_size = bm_pool->frag_size;
-+
-+		skb = build_skb(data, frag_size > PAGE_SIZE ? 0 : frag_size);
- 
- 		/* After refill old buffer has to be unmapped regardless
- 		 * the skb is successfully built or not.
- 		 */
--		dma_unmap_single(dev->dev.parent, phys_addr,
--				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
--
-+		dma_unmap_single(&pp->bm_priv->pdev->dev, phys_addr,
-+				 bm_pool->buf_size, DMA_FROM_DEVICE);
- 		if (!skb)
- 			goto err_drop_frame;
- 
-@@ -2295,7 +2684,10 @@ static int mvneta_poll(struct napi_struc
- 
- 	if (rx_queue) {
- 		rx_queue = rx_queue - 1;
--		rx_done = mvneta_rx(pp, budget, &pp->rxqs[rx_queue]);
-+		if (pp->bm_priv)
-+			rx_done = mvneta_rx_hwbm(pp, budget, &pp->rxqs[rx_queue]);
-+		else
-+			rx_done = mvneta_rx_swbm(pp, budget, &pp->rxqs[rx_queue]);
- 	}
- 
- 	budget -= rx_done;
-@@ -2384,9 +2776,17 @@ static int mvneta_rxq_init(struct mvneta
- 	mvneta_rx_pkts_coal_set(pp, rxq, rxq->pkts_coal);
- 	mvneta_rx_time_coal_set(pp, rxq, rxq->time_coal);
- 
--	/* Fill RXQ with buffers from RX pool */
--	mvneta_rxq_buf_size_set(pp, rxq, MVNETA_RX_BUF_SIZE(pp->pkt_size));
--	mvneta_rxq_bm_disable(pp, rxq);
-+	if (!pp->bm_priv) {
-+		/* Fill RXQ with buffers from RX pool */
-+		mvneta_rxq_buf_size_set(pp, rxq,
-+					MVNETA_RX_BUF_SIZE(pp->pkt_size));
-+		mvneta_rxq_bm_disable(pp, rxq);
-+	} else {
-+		mvneta_rxq_bm_enable(pp, rxq);
-+		mvneta_rxq_long_pool_set(pp, rxq);
-+		mvneta_rxq_short_pool_set(pp, rxq);
-+	}
-+
- 	mvneta_rxq_fill(pp, rxq, rxq->size);
- 
- 	return 0;
-@@ -2659,6 +3059,9 @@ static int mvneta_change_mtu(struct net_
- 	dev->mtu = mtu;
- 
- 	if (!netif_running(dev)) {
-+		if (pp->bm_priv)
-+			mvneta_bm_update_mtu(pp, mtu);
-+
- 		netdev_update_features(dev);
- 		return 0;
- 	}
-@@ -2671,6 +3074,9 @@ static int mvneta_change_mtu(struct net_
- 	mvneta_cleanup_txqs(pp);
- 	mvneta_cleanup_rxqs(pp);
- 
-+	if (pp->bm_priv)
-+		mvneta_bm_update_mtu(pp, mtu);
-+
- 	pp->pkt_size = MVNETA_RX_PKT_SIZE(dev->mtu);
- 	pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
- 	                SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
-@@ -3563,6 +3969,7 @@ static int mvneta_probe(struct platform_
- 	struct resource *res;
- 	struct device_node *dn = pdev->dev.of_node;
- 	struct device_node *phy_node;
-+	struct device_node *bm_node;
- 	struct mvneta_port *pp;
- 	struct net_device *dev;
- 	const char *dt_mac_addr;
-@@ -3690,26 +4097,39 @@ static int mvneta_probe(struct platform_
- 
- 	pp->tx_csum_limit = tx_csum_limit;
- 
-+	dram_target_info = mv_mbus_dram_info();
-+	if (dram_target_info)
-+		mvneta_conf_mbus_windows(pp, dram_target_info);
-+
- 	pp->tx_ring_size = MVNETA_MAX_TXD;
- 	pp->rx_ring_size = MVNETA_MAX_RXD;
- 
- 	pp->dev = dev;
- 	SET_NETDEV_DEV(dev, &pdev->dev);
- 
-+	pp->id = global_port_id++;
-+
-+	/* Obtain access to BM resources if enabled and already initialized */
-+	bm_node = of_parse_phandle(dn, "buffer-manager", 0);
-+	if (bm_node && bm_node->data) {
-+		pp->bm_priv = bm_node->data;
-+		err = mvneta_bm_port_init(pdev, pp);
-+		if (err < 0) {
-+			dev_info(&pdev->dev, "use SW buffer management\n");
-+			pp->bm_priv = NULL;
-+		}
-+	}
-+
- 	err = mvneta_init(&pdev->dev, pp);
- 	if (err < 0)
--		goto err_free_stats;
-+		goto err_netdev;
- 
- 	err = mvneta_port_power_up(pp, phy_mode);
- 	if (err < 0) {
- 		dev_err(&pdev->dev, "can't power up port\n");
--		goto err_free_stats;
-+		goto err_netdev;
- 	}
- 
--	dram_target_info = mv_mbus_dram_info();
--	if (dram_target_info)
--		mvneta_conf_mbus_windows(pp, dram_target_info);
--
- 	for_each_present_cpu(cpu) {
- 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
- 
-@@ -3744,6 +4164,13 @@ static int mvneta_probe(struct platform_
- 
- 	return 0;
- 
-+err_netdev:
-+	unregister_netdev(dev);
-+	if (pp->bm_priv) {
-+		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
-+		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
-+				       1 << pp->id);
-+	}
- err_free_stats:
- 	free_percpu(pp->stats);
- err_free_ports:
-@@ -3773,6 +4200,12 @@ static int mvneta_remove(struct platform
- 	of_node_put(pp->phy_node);
- 	free_netdev(dev);
- 
-+	if (pp->bm_priv) {
-+		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
-+		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
-+				       1 << pp->id);
-+	}
-+
- 	return 0;
- }
- 
---- /dev/null
-+++ b/drivers/net/ethernet/marvell/mvneta_bm.c
-@@ -0,0 +1,546 @@
-+/*
-+ * Driver for Marvell NETA network controller Buffer Manager.
-+ *
-+ * Copyright (C) 2015 Marvell
-+ *
-+ * Marcin Wojtas <mw at semihalf.com>
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without any
-+ * warranty of any kind, whether express or implied.
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/genalloc.h>
-+#include <linux/platform_device.h>
-+#include <linux/netdevice.h>
-+#include <linux/skbuff.h>
-+#include <linux/mbus.h>
-+#include <linux/module.h>
-+#include <linux/io.h>
-+#include <linux/of.h>
-+#include <linux/clk.h>
-+#include "mvneta_bm.h"
-+
-+#define MVNETA_BM_DRIVER_NAME "mvneta_bm"
-+#define MVNETA_BM_DRIVER_VERSION "1.0"
-+
-+static void mvneta_bm_write(struct mvneta_bm *priv, u32 offset, u32 data)
-+{
-+	writel(data, priv->reg_base + offset);
-+}
-+
-+static u32 mvneta_bm_read(struct mvneta_bm *priv, u32 offset)
-+{
-+	return readl(priv->reg_base + offset);
-+}
-+
-+static void mvneta_bm_pool_enable(struct mvneta_bm *priv, int pool_id)
-+{
-+	u32 val;
-+
-+	val = mvneta_bm_read(priv, MVNETA_BM_POOL_BASE_REG(pool_id));
-+	val |= MVNETA_BM_POOL_ENABLE_MASK;
-+	mvneta_bm_write(priv, MVNETA_BM_POOL_BASE_REG(pool_id), val);
-+
-+	/* Clear BM cause register */
-+	mvneta_bm_write(priv, MVNETA_BM_INTR_CAUSE_REG, 0);
-+}
-+
-+static void mvneta_bm_pool_disable(struct mvneta_bm *priv, int pool_id)
-+{
-+	u32 val;
-+
-+	val = mvneta_bm_read(priv, MVNETA_BM_POOL_BASE_REG(pool_id));
-+	val &= ~MVNETA_BM_POOL_ENABLE_MASK;
-+	mvneta_bm_write(priv, MVNETA_BM_POOL_BASE_REG(pool_id), val);
-+}
-+
-+static inline void mvneta_bm_config_set(struct mvneta_bm *priv, u32 mask)
-+{
-+	u32 val;
-+
-+	val = mvneta_bm_read(priv, MVNETA_BM_CONFIG_REG);
-+	val |= mask;
-+	mvneta_bm_write(priv, MVNETA_BM_CONFIG_REG, val);
-+}
-+
-+static inline void mvneta_bm_config_clear(struct mvneta_bm *priv, u32 mask)
-+{
-+	u32 val;
-+
-+	val = mvneta_bm_read(priv, MVNETA_BM_CONFIG_REG);
-+	val &= ~mask;
-+	mvneta_bm_write(priv, MVNETA_BM_CONFIG_REG, val);
-+}
-+
-+static void mvneta_bm_pool_target_set(struct mvneta_bm *priv, int pool_id,
-+				      u8 target_id, u8 attr)
-+{
-+	u32 val;
-+
-+	val = mvneta_bm_read(priv, MVNETA_BM_XBAR_POOL_REG(pool_id));
-+	val &= ~MVNETA_BM_TARGET_ID_MASK(pool_id);
-+	val &= ~MVNETA_BM_XBAR_ATTR_MASK(pool_id);
-+	val |= MVNETA_BM_TARGET_ID_VAL(pool_id, target_id);
-+	val |= MVNETA_BM_XBAR_ATTR_VAL(pool_id, attr);
-+
-+	mvneta_bm_write(priv, MVNETA_BM_XBAR_POOL_REG(pool_id), val);
-+}
-+
-+/* Allocate skb for BM pool */
-+void *mvneta_buf_alloc(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+		       dma_addr_t *buf_phys_addr)
-+{
-+	void *buf;
-+	dma_addr_t phys_addr;
-+
-+	buf = mvneta_frag_alloc(bm_pool->frag_size);
-+	if (!buf)
-+		return NULL;
-+
-+	/* In order to update buf_cookie field of RX descriptor properly,
-+	 * BM hardware expects buf virtual address to be placed in the
-+	 * first four bytes of mapped buffer.
-+	 */
-+	*(u32 *)buf = (u32)buf;
-+	phys_addr = dma_map_single(&priv->pdev->dev, buf, bm_pool->buf_size,
-+				   DMA_FROM_DEVICE);
-+	if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr))) {
-+		mvneta_frag_free(bm_pool->frag_size, buf);
-+		return NULL;
-+	}
-+	*buf_phys_addr = phys_addr;
-+
-+	return buf;
-+}
-+
-+/* Refill processing for HW buffer management */
-+int mvneta_bm_pool_refill(struct mvneta_bm *priv,
-+			  struct mvneta_bm_pool *bm_pool)
-+{
-+	dma_addr_t buf_phys_addr;
-+	void *buf;
-+
-+	buf = mvneta_buf_alloc(priv, bm_pool, &buf_phys_addr);
-+	if (!buf)
-+		return -ENOMEM;
-+
-+	mvneta_bm_pool_put_bp(priv, bm_pool, buf_phys_addr);
-+
-+	return 0;
-+}
-+EXPORT_SYMBOL_GPL(mvneta_bm_pool_refill);
-+
-+/* Allocate buffers for the pool */
-+int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+		       int buf_num)
-+{
-+	int err, i;
-+
-+	if (bm_pool->buf_num == bm_pool->size) {
-+		dev_dbg(&priv->pdev->dev, "pool %d already filled\n",
-+			bm_pool->id);
-+		return bm_pool->buf_num;
-+	}
-+
-+	if (buf_num < 0 ||
-+	    (buf_num + bm_pool->buf_num > bm_pool->size)) {
-+		dev_err(&priv->pdev->dev,
-+			"cannot allocate %d buffers for pool %d\n",
-+			buf_num, bm_pool->id);
-+		return 0;
-+	}
-+
-+	for (i = 0; i < buf_num; i++) {
-+		err = mvneta_bm_pool_refill(priv, bm_pool);
-+		if (err < 0)
-+			break;
-+	}
-+
-+	/* Update BM driver with number of buffers added to pool */
-+	bm_pool->buf_num += i;
-+
-+	dev_dbg(&priv->pdev->dev,
-+		"%s pool %d: pkt_size=%4d, buf_size=%4d, frag_size=%4d\n",
-+		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
-+		bm_pool->id, bm_pool->pkt_size, bm_pool->buf_size,
-+		bm_pool->frag_size);
-+
-+	dev_dbg(&priv->pdev->dev,
-+		"%s pool %d: %d of %d buffers added\n",
-+		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
-+		bm_pool->id, i, buf_num);
-+
-+	return i;
-+}
-+EXPORT_SYMBOL_GPL(mvneta_bm_bufs_add);
-+
-+/* Create pool */
-+static int mvneta_bm_pool_create(struct mvneta_bm *priv,
-+				 struct mvneta_bm_pool *bm_pool)
-+{
-+	struct platform_device *pdev = priv->pdev;
-+	u8 target_id, attr;
-+	int size_bytes, err;
-+
-+	size_bytes = sizeof(u32) * bm_pool->size;
-+	bm_pool->virt_addr = dma_alloc_coherent(&pdev->dev, size_bytes,
-+						&bm_pool->phys_addr,
-+						GFP_KERNEL);
-+	if (!bm_pool->virt_addr)
-+		return -ENOMEM;
-+
-+	if (!IS_ALIGNED((u32)bm_pool->virt_addr, MVNETA_BM_POOL_PTR_ALIGN)) {
-+		dma_free_coherent(&pdev->dev, size_bytes, bm_pool->virt_addr,
-+				  bm_pool->phys_addr);
-+		dev_err(&pdev->dev, "BM pool %d is not %d bytes aligned\n",
-+			bm_pool->id, MVNETA_BM_POOL_PTR_ALIGN);
-+		return -ENOMEM;
-+	}
-+
-+	err = mvebu_mbus_get_dram_win_info(bm_pool->phys_addr, &target_id,
-+					   &attr);
-+	if (err < 0) {
-+		dma_free_coherent(&pdev->dev, size_bytes, bm_pool->virt_addr,
-+				  bm_pool->phys_addr);
-+		return err;
-+	}
-+
-+	/* Set pool address */
-+	mvneta_bm_write(priv, MVNETA_BM_POOL_BASE_REG(bm_pool->id),
-+			bm_pool->phys_addr);
-+
-+	mvneta_bm_pool_target_set(priv, bm_pool->id, target_id,  attr);
-+	mvneta_bm_pool_enable(priv, bm_pool->id);
-+
-+	return 0;
-+}
-+
-+/* Notify the driver that BM pool is being used as specific type and return the
-+ * pool pointer on success
-+ */
-+struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
-+					  enum mvneta_bm_type type, u8 port_id,
-+					  int pkt_size)
-+{
-+	struct mvneta_bm_pool *new_pool = &priv->bm_pools[pool_id];
-+	int num, err;
-+
-+	if (new_pool->type == MVNETA_BM_LONG &&
-+	    new_pool->port_map != 1 << port_id) {
-+		dev_err(&priv->pdev->dev,
-+			"long pool cannot be shared by the ports\n");
-+		return NULL;
-+	}
-+
-+	if (new_pool->type == MVNETA_BM_SHORT && new_pool->type != type) {
-+		dev_err(&priv->pdev->dev,
-+			"mixing pools' types between the ports is forbidden\n");
-+		return NULL;
-+	}
-+
-+	if (new_pool->pkt_size == 0 || type != MVNETA_BM_SHORT)
-+		new_pool->pkt_size = pkt_size;
-+
-+	/* Allocate buffers in case BM pool hasn't been used yet */
-+	if (new_pool->type == MVNETA_BM_FREE) {
-+		new_pool->type = type;
-+		new_pool->buf_size = MVNETA_RX_BUF_SIZE(new_pool->pkt_size);
-+		new_pool->frag_size =
-+			SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(new_pool->pkt_size)) +
-+			SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
-+
-+		/* Create new pool */
-+		err = mvneta_bm_pool_create(priv, new_pool);
-+		if (err) {
-+			dev_err(&priv->pdev->dev, "fail to create pool %d\n",
-+				new_pool->id);
-+			return NULL;
-+		}
-+
-+		/* Allocate buffers for this pool */
-+		num = mvneta_bm_bufs_add(priv, new_pool, new_pool->size);
-+		if (num != new_pool->size) {
-+			WARN(1, "pool %d: %d of %d allocated\n",
-+			     new_pool->id, num, new_pool->size);
-+			return NULL;
-+		}
-+	}
-+
-+	return new_pool;
-+}
-+EXPORT_SYMBOL_GPL(mvneta_bm_pool_use);
-+
-+/* Free all buffers from the pool */
-+void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+			 u8 port_map)
-+{
-+	int i;
-+
-+	bm_pool->port_map &= ~port_map;
-+	if (bm_pool->port_map)
-+		return;
-+
-+	mvneta_bm_config_set(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
-+
-+	for (i = 0; i < bm_pool->buf_num; i++) {
-+		dma_addr_t buf_phys_addr;
-+		u32 *vaddr;
-+
-+		/* Get buffer physical address (indirect access) */
-+		buf_phys_addr = mvneta_bm_pool_get_bp(priv, bm_pool);
-+
-+		/* Work-around to the problems when destroying the pool,
-+		 * when it occurs that a read access to BPPI returns 0.
-+		 */
-+		if (buf_phys_addr == 0)
-+			continue;
-+
-+		vaddr = phys_to_virt(buf_phys_addr);
-+		if (!vaddr)
-+			break;
-+
-+		dma_unmap_single(&priv->pdev->dev, buf_phys_addr,
-+				 bm_pool->buf_size, DMA_FROM_DEVICE);
-+		mvneta_frag_free(bm_pool->frag_size, vaddr);
-+	}
-+
-+	mvneta_bm_config_clear(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
-+
-+	/* Update BM driver with number of buffers removed from pool */
-+	bm_pool->buf_num -= i;
-+}
-+EXPORT_SYMBOL_GPL(mvneta_bm_bufs_free);
-+
-+/* Cleanup pool */
-+void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
-+			    struct mvneta_bm_pool *bm_pool, u8 port_map)
-+{
-+	bm_pool->port_map &= ~port_map;
-+	if (bm_pool->port_map)
-+		return;
-+
-+	bm_pool->type = MVNETA_BM_FREE;
-+
-+	mvneta_bm_bufs_free(priv, bm_pool, port_map);
-+	if (bm_pool->buf_num)
-+		WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id);
-+
-+	if (bm_pool->virt_addr) {
-+		dma_free_coherent(&priv->pdev->dev, sizeof(u32) * bm_pool->size,
-+				  bm_pool->virt_addr, bm_pool->phys_addr);
-+		bm_pool->virt_addr = NULL;
-+	}
-+
-+	mvneta_bm_pool_disable(priv, bm_pool->id);
-+}
-+EXPORT_SYMBOL_GPL(mvneta_bm_pool_destroy);
-+
-+static void mvneta_bm_pools_init(struct mvneta_bm *priv)
-+{
-+	struct device_node *dn = priv->pdev->dev.of_node;
-+	struct mvneta_bm_pool *bm_pool;
-+	char prop[15];
-+	u32 size;
-+	int i;
-+
-+	/* Activate BM unit */
-+	mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_START_MASK);
-+
-+	/* Create all pools with maximum size */
-+	for (i = 0; i < MVNETA_BM_POOLS_NUM; i++) {
-+		bm_pool = &priv->bm_pools[i];
-+		bm_pool->id = i;
-+		bm_pool->type = MVNETA_BM_FREE;
-+
-+		/* Reset read pointer */
-+		mvneta_bm_write(priv, MVNETA_BM_POOL_READ_PTR_REG(i), 0);
-+
-+		/* Reset write pointer */
-+		mvneta_bm_write(priv, MVNETA_BM_POOL_WRITE_PTR_REG(i), 0);
-+
-+		/* Configure pool size according to DT or use default value */
-+		sprintf(prop, "pool%d,capacity", i);
-+		if (of_property_read_u32(dn, prop, &size)) {
-+			size = MVNETA_BM_POOL_CAP_DEF;
-+		} else if (size > MVNETA_BM_POOL_CAP_MAX) {
-+			dev_warn(&priv->pdev->dev,
-+				 "Illegal pool %d capacity %d, set to %d\n",
-+				 i, size, MVNETA_BM_POOL_CAP_MAX);
-+			size = MVNETA_BM_POOL_CAP_MAX;
-+		} else if (size < MVNETA_BM_POOL_CAP_MIN) {
-+			dev_warn(&priv->pdev->dev,
-+				 "Illegal pool %d capacity %d, set to %d\n",
-+				 i, size, MVNETA_BM_POOL_CAP_MIN);
-+			size = MVNETA_BM_POOL_CAP_MIN;
-+		} else if (!IS_ALIGNED(size, MVNETA_BM_POOL_CAP_ALIGN)) {
-+			dev_warn(&priv->pdev->dev,
-+				 "Illegal pool %d capacity %d, round to %d\n",
-+				 i, size, ALIGN(size,
-+				 MVNETA_BM_POOL_CAP_ALIGN));
-+			size = ALIGN(size, MVNETA_BM_POOL_CAP_ALIGN);
-+		}
-+		bm_pool->size = size;
-+
-+		mvneta_bm_write(priv, MVNETA_BM_POOL_SIZE_REG(i),
-+				bm_pool->size);
-+
-+		/* Obtain custom pkt_size from DT */
-+		sprintf(prop, "pool%d,pkt-size", i);
-+		if (of_property_read_u32(dn, prop, &bm_pool->pkt_size))
-+			bm_pool->pkt_size = 0;
-+	}
-+}
-+
-+static void mvneta_bm_default_set(struct mvneta_bm *priv)
-+{
-+	u32 val;
-+
-+	/* Mask BM all interrupts */
-+	mvneta_bm_write(priv, MVNETA_BM_INTR_MASK_REG, 0);
-+
-+	/* Clear BM cause register */
-+	mvneta_bm_write(priv, MVNETA_BM_INTR_CAUSE_REG, 0);
-+
-+	/* Set BM configuration register */
-+	val = mvneta_bm_read(priv, MVNETA_BM_CONFIG_REG);
-+
-+	/* Reduce MaxInBurstSize from 32 BPs to 16 BPs */
-+	val &= ~MVNETA_BM_MAX_IN_BURST_SIZE_MASK;
-+	val |= MVNETA_BM_MAX_IN_BURST_SIZE_16BP;
-+	mvneta_bm_write(priv, MVNETA_BM_CONFIG_REG, val);
-+}
-+
-+static int mvneta_bm_init(struct mvneta_bm *priv)
-+{
-+	mvneta_bm_default_set(priv);
-+
-+	/* Allocate and initialize BM pools structures */
-+	priv->bm_pools = devm_kcalloc(&priv->pdev->dev, MVNETA_BM_POOLS_NUM,
-+				      sizeof(struct mvneta_bm_pool),
-+				      GFP_KERNEL);
-+	if (!priv->bm_pools)
-+		return -ENOMEM;
-+
-+	mvneta_bm_pools_init(priv);
-+
-+	return 0;
-+}
-+
-+static int mvneta_bm_get_sram(struct device_node *dn,
-+			      struct mvneta_bm *priv)
-+{
-+	priv->bppi_pool = of_gen_pool_get(dn, "internal-mem", 0);
-+	if (!priv->bppi_pool)
-+		return -ENOMEM;
-+
-+	priv->bppi_virt_addr = gen_pool_dma_alloc(priv->bppi_pool,
-+						  MVNETA_BM_BPPI_SIZE,
-+						  &priv->bppi_phys_addr);
-+	if (!priv->bppi_virt_addr)
-+		return -ENOMEM;
-+
-+	return 0;
-+}
-+
-+static void mvneta_bm_put_sram(struct mvneta_bm *priv)
-+{
-+	gen_pool_free(priv->bppi_pool, priv->bppi_phys_addr,
-+		      MVNETA_BM_BPPI_SIZE);
-+}
-+
-+static int mvneta_bm_probe(struct platform_device *pdev)
-+{
-+	struct device_node *dn = pdev->dev.of_node;
-+	struct mvneta_bm *priv;
-+	struct resource *res;
-+	int err;
-+
-+	priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL);
-+	if (!priv)
-+		return -ENOMEM;
-+
-+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+	priv->reg_base = devm_ioremap_resource(&pdev->dev, res);
-+	if (IS_ERR(priv->reg_base))
-+		return PTR_ERR(priv->reg_base);
-+
-+	priv->clk = devm_clk_get(&pdev->dev, NULL);
-+	if (IS_ERR(priv->clk))
-+		return PTR_ERR(priv->clk);
-+	err = clk_prepare_enable(priv->clk);
-+	if (err < 0)
-+		return err;
-+
-+	err = mvneta_bm_get_sram(dn, priv);
-+	if (err < 0) {
-+		dev_err(&pdev->dev, "failed to allocate internal memory\n");
-+		goto err_clk;
-+	}
-+
-+	priv->pdev = pdev;
-+
-+	/* Initialize buffer manager internals */
-+	err = mvneta_bm_init(priv);
-+	if (err < 0) {
-+		dev_err(&pdev->dev, "failed to initialize controller\n");
-+		goto err_sram;
-+	}
-+
-+	dn->data = priv;
-+	platform_set_drvdata(pdev, priv);
-+
-+	dev_info(&pdev->dev, "Buffer Manager for network controller enabled\n");
-+
-+	return 0;
-+
-+err_sram:
-+	mvneta_bm_put_sram(priv);
-+err_clk:
-+	clk_disable_unprepare(priv->clk);
-+	return err;
-+}
-+
-+static int mvneta_bm_remove(struct platform_device *pdev)
-+{
-+	struct mvneta_bm *priv = platform_get_drvdata(pdev);
-+	u8 all_ports_map = 0xff;
-+	int i = 0;
-+
-+	for (i = 0; i < MVNETA_BM_POOLS_NUM; i++) {
-+		struct mvneta_bm_pool *bm_pool = &priv->bm_pools[i];
-+
-+		mvneta_bm_pool_destroy(priv, bm_pool, all_ports_map);
-+	}
-+
-+	mvneta_bm_put_sram(priv);
-+
-+	/* Dectivate BM unit */
-+	mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_STOP_MASK);
-+
-+	clk_disable_unprepare(priv->clk);
-+
-+	return 0;
-+}
-+
-+static const struct of_device_id mvneta_bm_match[] = {
-+	{ .compatible = "marvell,armada-380-neta-bm" },
-+	{ }
-+};
-+MODULE_DEVICE_TABLE(of, mvneta_bm_match);
-+
-+static struct platform_driver mvneta_bm_driver = {
-+	.probe = mvneta_bm_probe,
-+	.remove = mvneta_bm_remove,
-+	.driver = {
-+		.name = MVNETA_BM_DRIVER_NAME,
-+		.of_match_table = mvneta_bm_match,
-+	},
-+};
-+
-+module_platform_driver(mvneta_bm_driver);
-+
-+MODULE_DESCRIPTION("Marvell NETA Buffer Manager Driver - www.marvell.com");
-+MODULE_AUTHOR("Marcin Wojtas <mw at semihalf.com>");
-+MODULE_LICENSE("GPL v2");
---- /dev/null
-+++ b/drivers/net/ethernet/marvell/mvneta_bm.h
-@@ -0,0 +1,189 @@
-+/*
-+ * Driver for Marvell NETA network controller Buffer Manager.
-+ *
-+ * Copyright (C) 2015 Marvell
-+ *
-+ * Marcin Wojtas <mw at semihalf.com>
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without any
-+ * warranty of any kind, whether express or implied.
-+ */
-+
-+#ifndef _MVNETA_BM_H_
-+#define _MVNETA_BM_H_
-+
-+/* BM Configuration Register */
-+#define MVNETA_BM_CONFIG_REG			0x0
-+#define    MVNETA_BM_STATUS_MASK		0x30
-+#define    MVNETA_BM_ACTIVE_MASK		BIT(4)
-+#define    MVNETA_BM_MAX_IN_BURST_SIZE_MASK	0x60000
-+#define    MVNETA_BM_MAX_IN_BURST_SIZE_16BP	BIT(18)
-+#define    MVNETA_BM_EMPTY_LIMIT_MASK		BIT(19)
-+
-+/* BM Activation Register */
-+#define MVNETA_BM_COMMAND_REG			0x4
-+#define    MVNETA_BM_START_MASK			BIT(0)
-+#define    MVNETA_BM_STOP_MASK			BIT(1)
-+#define    MVNETA_BM_PAUSE_MASK			BIT(2)
-+
-+/* BM Xbar interface Register */
-+#define MVNETA_BM_XBAR_01_REG			0x8
-+#define MVNETA_BM_XBAR_23_REG			0xc
-+#define MVNETA_BM_XBAR_POOL_REG(pool)		\
-+		(((pool) < 2) ? MVNETA_BM_XBAR_01_REG : MVNETA_BM_XBAR_23_REG)
-+#define     MVNETA_BM_TARGET_ID_OFFS(pool)	(((pool) & 1) ? 16 : 0)
-+#define     MVNETA_BM_TARGET_ID_MASK(pool)	\
-+		(0xf << MVNETA_BM_TARGET_ID_OFFS(pool))
-+#define     MVNETA_BM_TARGET_ID_VAL(pool, id)	\
-+		((id) << MVNETA_BM_TARGET_ID_OFFS(pool))
-+#define     MVNETA_BM_XBAR_ATTR_OFFS(pool)	(((pool) & 1) ? 20 : 4)
-+#define     MVNETA_BM_XBAR_ATTR_MASK(pool)	\
-+		(0xff << MVNETA_BM_XBAR_ATTR_OFFS(pool))
-+#define     MVNETA_BM_XBAR_ATTR_VAL(pool, attr)	\
-+		((attr) << MVNETA_BM_XBAR_ATTR_OFFS(pool))
-+
-+/* Address of External Buffer Pointers Pool Register */
-+#define MVNETA_BM_POOL_BASE_REG(pool)		(0x10 + ((pool) << 4))
-+#define     MVNETA_BM_POOL_ENABLE_MASK		BIT(0)
-+
-+/* External Buffer Pointers Pool RD pointer Register */
-+#define MVNETA_BM_POOL_READ_PTR_REG(pool)	(0x14 + ((pool) << 4))
-+#define     MVNETA_BM_POOL_SET_READ_PTR_MASK	0xfffc
-+#define     MVNETA_BM_POOL_GET_READ_PTR_OFFS	16
-+#define     MVNETA_BM_POOL_GET_READ_PTR_MASK	0xfffc0000
-+
-+/* External Buffer Pointers Pool WR pointer */
-+#define MVNETA_BM_POOL_WRITE_PTR_REG(pool)	(0x18 + ((pool) << 4))
-+#define     MVNETA_BM_POOL_SET_WRITE_PTR_OFFS	0
-+#define     MVNETA_BM_POOL_SET_WRITE_PTR_MASK	0xfffc
-+#define     MVNETA_BM_POOL_GET_WRITE_PTR_OFFS	16
-+#define     MVNETA_BM_POOL_GET_WRITE_PTR_MASK	0xfffc0000
-+
-+/* External Buffer Pointers Pool Size Register */
-+#define MVNETA_BM_POOL_SIZE_REG(pool)		(0x1c + ((pool) << 4))
-+#define     MVNETA_BM_POOL_SIZE_MASK		0x3fff
-+
-+/* BM Interrupt Cause Register */
-+#define MVNETA_BM_INTR_CAUSE_REG		(0x50)
-+
-+/* BM interrupt Mask Register */
-+#define MVNETA_BM_INTR_MASK_REG			(0x54)
-+
-+/* Other definitions */
-+#define MVNETA_BM_SHORT_PKT_SIZE		256
-+#define MVNETA_BM_POOLS_NUM			4
-+#define MVNETA_BM_POOL_CAP_MIN			128
-+#define MVNETA_BM_POOL_CAP_DEF			2048
-+#define MVNETA_BM_POOL_CAP_MAX			\
-+		(16 * 1024 - MVNETA_BM_POOL_CAP_ALIGN)
-+#define MVNETA_BM_POOL_CAP_ALIGN		32
-+#define MVNETA_BM_POOL_PTR_ALIGN		32
-+
-+#define MVNETA_BM_POOL_ACCESS_OFFS		8
-+
-+#define MVNETA_BM_BPPI_SIZE			0x100000
-+
-+#define MVNETA_RX_BUF_SIZE(pkt_size)   ((pkt_size) + NET_SKB_PAD)
-+
-+enum mvneta_bm_type {
-+	MVNETA_BM_FREE,
-+	MVNETA_BM_LONG,
-+	MVNETA_BM_SHORT
-+};
-+
-+struct mvneta_bm {
-+	void __iomem *reg_base;
-+	struct clk *clk;
-+	struct platform_device *pdev;
-+
-+	struct gen_pool *bppi_pool;
-+	/* BPPI virtual base address */
-+	void __iomem *bppi_virt_addr;
-+	/* BPPI physical base address */
-+	dma_addr_t bppi_phys_addr;
-+
-+	/* BM pools */
-+	struct mvneta_bm_pool *bm_pools;
-+};
-+
-+struct mvneta_bm_pool {
-+	/* Pool number in the range 0-3 */
-+	u8 id;
-+	enum mvneta_bm_type type;
-+
-+	/* Buffer Pointers Pool External (BPPE) size in number of bytes */
-+	int size;
-+	/* Number of buffers used by this pool */
-+	int buf_num;
-+	/* Pool buffer size */
-+	int buf_size;
-+	/* Packet size */
-+	int pkt_size;
-+	/* Single frag size */
-+	u32 frag_size;
-+
-+	/* BPPE virtual base address */
-+	u32 *virt_addr;
-+	/* BPPE physical base address */
-+	dma_addr_t phys_addr;
-+
-+	/* Ports using BM pool */
-+	u8 port_map;
-+
-+	struct mvneta_bm *priv;
-+};
-+
-+/* Declarations and definitions */
-+void *mvneta_frag_alloc(unsigned int frag_size);
-+void mvneta_frag_free(unsigned int frag_size, void *data);
-+
-+#if defined(CONFIG_MVNETA_BM) || defined(CONFIG_MVNETA_BM_MODULE)
-+void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
-+			    struct mvneta_bm_pool *bm_pool, u8 port_map);
-+void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+			 u8 port_map);
-+int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+		       int buf_num);
-+int mvneta_bm_pool_refill(struct mvneta_bm *priv,
-+			  struct mvneta_bm_pool *bm_pool);
-+struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
-+					  enum mvneta_bm_type type, u8 port_id,
-+					  int pkt_size);
-+
-+static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
-+					 struct mvneta_bm_pool *bm_pool,
-+					 dma_addr_t buf_phys_addr)
-+{
-+	writel_relaxed(buf_phys_addr, priv->bppi_virt_addr +
-+		       (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
-+}
-+
-+static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
-+					struct mvneta_bm_pool *bm_pool)
-+{
-+	return readl_relaxed(priv->bppi_virt_addr +
-+			     (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
-+}
-+#else
-+void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
-+			    struct mvneta_bm_pool *bm_pool, u8 port_map) {}
-+void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+			 u8 port_map) {}
-+int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
-+		       int buf_num) { return 0; }
-+int mvneta_bm_pool_refill(struct mvneta_bm *priv,
-+			  struct mvneta_bm_pool *bm_pool) {return 0; }
-+struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
-+					  enum mvneta_bm_type type, u8 port_id,
-+					  int pkt_size) { return NULL; }
-+
-+static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
-+					 struct mvneta_bm_pool *bm_pool,
-+					 dma_addr_t buf_phys_addr) {}
-+
-+static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
-+					struct mvneta_bm_pool *bm_pool)
-+{ return 0; }
-+#endif /* CONFIG_MVNETA_BM */
-+#endif
diff --git a/target/linux/mvebu/patches-4.4/046-net-mvneta-Use-the-new-hwbm-framework.patch b/target/linux/mvebu/patches-4.4/046-net-mvneta-Use-the-new-hwbm-framework.patch
deleted file mode 100644
index 210504c..0000000
--- a/target/linux/mvebu/patches-4.4/046-net-mvneta-Use-the-new-hwbm-framework.patch
+++ /dev/null
@@ -1,359 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Mon, 14 Mar 2016 09:39:05 +0100
-Subject: [PATCH] net: mvneta: Use the new hwbm framework
-
-Now that the hardware buffer management framework had been introduced,
-let's use it.
-
-Tested-by: Sebastian Careba <nitroshift at yahoo.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/Kconfig
-+++ b/drivers/net/ethernet/marvell/Kconfig
-@@ -43,6 +43,7 @@ config MVMDIO
- config MVNETA_BM
- 	tristate "Marvell Armada 38x/XP network interface BM support"
- 	depends on MVNETA
-+	select HWBM
- 	---help---
- 	  This driver supports auxiliary block of the network
- 	  interface units in the Marvell ARMADA XP and ARMADA 38x SoC
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -30,6 +30,7 @@
- #include <linux/phy.h>
- #include <linux/platform_device.h>
- #include <linux/skbuff.h>
-+#include <net/hwbm.h>
- #include "mvneta_bm.h"
- #include <net/ip.h>
- #include <net/ipv6.h>
-@@ -1024,11 +1025,12 @@ static int mvneta_bm_port_init(struct pl
- static void mvneta_bm_update_mtu(struct mvneta_port *pp, int mtu)
- {
- 	struct mvneta_bm_pool *bm_pool = pp->pool_long;
-+	struct hwbm_pool *hwbm_pool = &bm_pool->hwbm_pool;
- 	int num;
- 
- 	/* Release all buffers from long pool */
- 	mvneta_bm_bufs_free(pp->bm_priv, bm_pool, 1 << pp->id);
--	if (bm_pool->buf_num) {
-+	if (hwbm_pool->buf_num) {
- 		WARN(1, "cannot free all buffers in pool %d\n",
- 		     bm_pool->id);
- 		goto bm_mtu_err;
-@@ -1036,14 +1038,14 @@ static void mvneta_bm_update_mtu(struct
- 
- 	bm_pool->pkt_size = MVNETA_RX_PKT_SIZE(mtu);
- 	bm_pool->buf_size = MVNETA_RX_BUF_SIZE(bm_pool->pkt_size);
--	bm_pool->frag_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
--			  SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(bm_pool->pkt_size));
-+	hwbm_pool->frag_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
-+			SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(bm_pool->pkt_size));
- 
- 	/* Fill entire long pool */
--	num = mvneta_bm_bufs_add(pp->bm_priv, bm_pool, bm_pool->size);
--	if (num != bm_pool->size) {
-+	num = hwbm_pool_add(hwbm_pool, hwbm_pool->size, GFP_ATOMIC);
-+	if (num != hwbm_pool->size) {
- 		WARN(1, "pool %d: %d of %d allocated\n",
--		     bm_pool->id, num, bm_pool->size);
-+		     bm_pool->id, num, hwbm_pool->size);
- 		goto bm_mtu_err;
- 	}
- 	mvneta_bm_pool_bufsize_set(pp, bm_pool->buf_size, bm_pool->id);
-@@ -2064,14 +2066,14 @@ err_drop_frame:
- 		}
- 
- 		/* Refill processing */
--		err = mvneta_bm_pool_refill(pp->bm_priv, bm_pool);
-+		err = hwbm_pool_refill(&bm_pool->hwbm_pool, GFP_ATOMIC);
- 		if (err) {
- 			netdev_err(dev, "Linux processing - Can't refill\n");
- 			rxq->missed++;
- 			goto err_drop_frame_ret_pool;
- 		}
- 
--		frag_size = bm_pool->frag_size;
-+		frag_size = bm_pool->hwbm_pool.frag_size;
- 
- 		skb = build_skb(data, frag_size > PAGE_SIZE ? 0 : frag_size);
- 
---- a/drivers/net/ethernet/marvell/mvneta_bm.c
-+++ b/drivers/net/ethernet/marvell/mvneta_bm.c
-@@ -10,16 +10,17 @@
-  * warranty of any kind, whether express or implied.
-  */
- 
--#include <linux/kernel.h>
-+#include <linux/clk.h>
- #include <linux/genalloc.h>
--#include <linux/platform_device.h>
--#include <linux/netdevice.h>
--#include <linux/skbuff.h>
-+#include <linux/io.h>
-+#include <linux/kernel.h>
- #include <linux/mbus.h>
- #include <linux/module.h>
--#include <linux/io.h>
-+#include <linux/netdevice.h>
- #include <linux/of.h>
--#include <linux/clk.h>
-+#include <linux/platform_device.h>
-+#include <linux/skbuff.h>
-+#include <net/hwbm.h>
- #include "mvneta_bm.h"
- 
- #define MVNETA_BM_DRIVER_NAME "mvneta_bm"
-@@ -88,17 +89,13 @@ static void mvneta_bm_pool_target_set(st
- 	mvneta_bm_write(priv, MVNETA_BM_XBAR_POOL_REG(pool_id), val);
- }
- 
--/* Allocate skb for BM pool */
--void *mvneta_buf_alloc(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
--		       dma_addr_t *buf_phys_addr)
-+int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf)
- {
--	void *buf;
-+	struct mvneta_bm_pool *bm_pool =
-+		(struct mvneta_bm_pool *)hwbm_pool->priv;
-+	struct mvneta_bm *priv = bm_pool->priv;
- 	dma_addr_t phys_addr;
- 
--	buf = mvneta_frag_alloc(bm_pool->frag_size);
--	if (!buf)
--		return NULL;
--
- 	/* In order to update buf_cookie field of RX descriptor properly,
- 	 * BM hardware expects buf virtual address to be placed in the
- 	 * first four bytes of mapped buffer.
-@@ -106,75 +103,13 @@ void *mvneta_buf_alloc(struct mvneta_bm
- 	*(u32 *)buf = (u32)buf;
- 	phys_addr = dma_map_single(&priv->pdev->dev, buf, bm_pool->buf_size,
- 				   DMA_FROM_DEVICE);
--	if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr))) {
--		mvneta_frag_free(bm_pool->frag_size, buf);
--		return NULL;
--	}
--	*buf_phys_addr = phys_addr;
--
--	return buf;
--}
--
--/* Refill processing for HW buffer management */
--int mvneta_bm_pool_refill(struct mvneta_bm *priv,
--			  struct mvneta_bm_pool *bm_pool)
--{
--	dma_addr_t buf_phys_addr;
--	void *buf;
--
--	buf = mvneta_buf_alloc(priv, bm_pool, &buf_phys_addr);
--	if (!buf)
-+	if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr)))
- 		return -ENOMEM;
- 
--	mvneta_bm_pool_put_bp(priv, bm_pool, buf_phys_addr);
--
-+	mvneta_bm_pool_put_bp(priv, bm_pool, phys_addr);
- 	return 0;
- }
--EXPORT_SYMBOL_GPL(mvneta_bm_pool_refill);
--
--/* Allocate buffers for the pool */
--int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
--		       int buf_num)
--{
--	int err, i;
--
--	if (bm_pool->buf_num == bm_pool->size) {
--		dev_dbg(&priv->pdev->dev, "pool %d already filled\n",
--			bm_pool->id);
--		return bm_pool->buf_num;
--	}
--
--	if (buf_num < 0 ||
--	    (buf_num + bm_pool->buf_num > bm_pool->size)) {
--		dev_err(&priv->pdev->dev,
--			"cannot allocate %d buffers for pool %d\n",
--			buf_num, bm_pool->id);
--		return 0;
--	}
--
--	for (i = 0; i < buf_num; i++) {
--		err = mvneta_bm_pool_refill(priv, bm_pool);
--		if (err < 0)
--			break;
--	}
--
--	/* Update BM driver with number of buffers added to pool */
--	bm_pool->buf_num += i;
--
--	dev_dbg(&priv->pdev->dev,
--		"%s pool %d: pkt_size=%4d, buf_size=%4d, frag_size=%4d\n",
--		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
--		bm_pool->id, bm_pool->pkt_size, bm_pool->buf_size,
--		bm_pool->frag_size);
--
--	dev_dbg(&priv->pdev->dev,
--		"%s pool %d: %d of %d buffers added\n",
--		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
--		bm_pool->id, i, buf_num);
--
--	return i;
--}
--EXPORT_SYMBOL_GPL(mvneta_bm_bufs_add);
-+EXPORT_SYMBOL_GPL(mvneta_bm_construct);
- 
- /* Create pool */
- static int mvneta_bm_pool_create(struct mvneta_bm *priv,
-@@ -183,8 +118,7 @@ static int mvneta_bm_pool_create(struct
- 	struct platform_device *pdev = priv->pdev;
- 	u8 target_id, attr;
- 	int size_bytes, err;
--
--	size_bytes = sizeof(u32) * bm_pool->size;
-+	size_bytes = sizeof(u32) * bm_pool->hwbm_pool.size;
- 	bm_pool->virt_addr = dma_alloc_coherent(&pdev->dev, size_bytes,
- 						&bm_pool->phys_addr,
- 						GFP_KERNEL);
-@@ -245,11 +179,16 @@ struct mvneta_bm_pool *mvneta_bm_pool_us
- 
- 	/* Allocate buffers in case BM pool hasn't been used yet */
- 	if (new_pool->type == MVNETA_BM_FREE) {
-+		struct hwbm_pool *hwbm_pool = &new_pool->hwbm_pool;
-+
-+		new_pool->priv = priv;
- 		new_pool->type = type;
- 		new_pool->buf_size = MVNETA_RX_BUF_SIZE(new_pool->pkt_size);
--		new_pool->frag_size =
-+		hwbm_pool->frag_size =
- 			SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(new_pool->pkt_size)) +
- 			SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
-+		hwbm_pool->construct = mvneta_bm_construct;
-+		hwbm_pool->priv = new_pool;
- 
- 		/* Create new pool */
- 		err = mvneta_bm_pool_create(priv, new_pool);
-@@ -260,10 +199,10 @@ struct mvneta_bm_pool *mvneta_bm_pool_us
- 		}
- 
- 		/* Allocate buffers for this pool */
--		num = mvneta_bm_bufs_add(priv, new_pool, new_pool->size);
--		if (num != new_pool->size) {
-+		num = hwbm_pool_add(hwbm_pool, hwbm_pool->size, GFP_ATOMIC);
-+		if (num != hwbm_pool->size) {
- 			WARN(1, "pool %d: %d of %d allocated\n",
--			     new_pool->id, num, new_pool->size);
-+			     new_pool->id, num, hwbm_pool->size);
- 			return NULL;
- 		}
- 	}
-@@ -284,7 +223,7 @@ void mvneta_bm_bufs_free(struct mvneta_b
- 
- 	mvneta_bm_config_set(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
- 
--	for (i = 0; i < bm_pool->buf_num; i++) {
-+	for (i = 0; i < bm_pool->hwbm_pool.buf_num; i++) {
- 		dma_addr_t buf_phys_addr;
- 		u32 *vaddr;
- 
-@@ -303,13 +242,13 @@ void mvneta_bm_bufs_free(struct mvneta_b
- 
- 		dma_unmap_single(&priv->pdev->dev, buf_phys_addr,
- 				 bm_pool->buf_size, DMA_FROM_DEVICE);
--		mvneta_frag_free(bm_pool->frag_size, vaddr);
-+		hwbm_buf_free(&bm_pool->hwbm_pool, vaddr);
- 	}
- 
- 	mvneta_bm_config_clear(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
- 
- 	/* Update BM driver with number of buffers removed from pool */
--	bm_pool->buf_num -= i;
-+	bm_pool->hwbm_pool.buf_num -= i;
- }
- EXPORT_SYMBOL_GPL(mvneta_bm_bufs_free);
- 
-@@ -317,6 +256,7 @@ EXPORT_SYMBOL_GPL(mvneta_bm_bufs_free);
- void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
- 			    struct mvneta_bm_pool *bm_pool, u8 port_map)
- {
-+	struct hwbm_pool *hwbm_pool = &bm_pool->hwbm_pool;
- 	bm_pool->port_map &= ~port_map;
- 	if (bm_pool->port_map)
- 		return;
-@@ -324,11 +264,12 @@ void mvneta_bm_pool_destroy(struct mvnet
- 	bm_pool->type = MVNETA_BM_FREE;
- 
- 	mvneta_bm_bufs_free(priv, bm_pool, port_map);
--	if (bm_pool->buf_num)
-+	if (hwbm_pool->buf_num)
- 		WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id);
- 
- 	if (bm_pool->virt_addr) {
--		dma_free_coherent(&priv->pdev->dev, sizeof(u32) * bm_pool->size,
-+		dma_free_coherent(&priv->pdev->dev,
-+				  sizeof(u32) * hwbm_pool->size,
- 				  bm_pool->virt_addr, bm_pool->phys_addr);
- 		bm_pool->virt_addr = NULL;
- 	}
-@@ -381,10 +322,10 @@ static void mvneta_bm_pools_init(struct
- 				 MVNETA_BM_POOL_CAP_ALIGN));
- 			size = ALIGN(size, MVNETA_BM_POOL_CAP_ALIGN);
- 		}
--		bm_pool->size = size;
-+		bm_pool->hwbm_pool.size = size;
- 
- 		mvneta_bm_write(priv, MVNETA_BM_POOL_SIZE_REG(i),
--				bm_pool->size);
-+				bm_pool->hwbm_pool.size);
- 
- 		/* Obtain custom pkt_size from DT */
- 		sprintf(prop, "pool%d,pkt-size", i);
---- a/drivers/net/ethernet/marvell/mvneta_bm.h
-+++ b/drivers/net/ethernet/marvell/mvneta_bm.h
-@@ -108,20 +108,15 @@ struct mvneta_bm {
- };
- 
- struct mvneta_bm_pool {
-+	struct hwbm_pool hwbm_pool;
- 	/* Pool number in the range 0-3 */
- 	u8 id;
- 	enum mvneta_bm_type type;
- 
--	/* Buffer Pointers Pool External (BPPE) size in number of bytes */
--	int size;
--	/* Number of buffers used by this pool */
--	int buf_num;
--	/* Pool buffer size */
--	int buf_size;
- 	/* Packet size */
- 	int pkt_size;
--	/* Single frag size */
--	u32 frag_size;
-+	/* Size of the buffer acces through DMA*/
-+	u32 buf_size;
- 
- 	/* BPPE virtual base address */
- 	u32 *virt_addr;
-@@ -143,8 +138,7 @@ void mvneta_bm_pool_destroy(struct mvnet
- 			    struct mvneta_bm_pool *bm_pool, u8 port_map);
- void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
- 			 u8 port_map);
--int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
--		       int buf_num);
-+int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf);
- int mvneta_bm_pool_refill(struct mvneta_bm *priv,
- 			  struct mvneta_bm_pool *bm_pool);
- struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
-@@ -170,8 +164,7 @@ void mvneta_bm_pool_destroy(struct mvnet
- 			    struct mvneta_bm_pool *bm_pool, u8 port_map) {}
- void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
- 			 u8 port_map) {}
--int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
--		       int buf_num) { return 0; }
-+int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; }
- int mvneta_bm_pool_refill(struct mvneta_bm *priv,
- 			  struct mvneta_bm_pool *bm_pool) {return 0; }
- struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
diff --git a/target/linux/mvebu/patches-4.4/047-net-mvneta-Fix-spinlock-usage.patch b/target/linux/mvebu/patches-4.4/047-net-mvneta-Fix-spinlock-usage.patch
deleted file mode 100644
index a8e78df..0000000
--- a/target/linux/mvebu/patches-4.4/047-net-mvneta-Fix-spinlock-usage.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Date: Sat, 12 Mar 2016 18:44:17 +0100
-Subject: [PATCH] net: mvneta: Fix spinlock usage
-
-In the previous patch, the spinlock was not initialized. While it didn't
-cause any trouble yet it could be a problem to use it uninitialized.
-
-The most annoying part was the critical section protected by the spinlock
-in mvneta_stop(). Some of the functions could sleep as pointed when
-activated CONFIG_DEBUG_ATOMIC_SLEEP. Actually, in mvneta_stop() we only
-need to protect the is_stopped flagged, indeed the code of the notifier
-for CPU online is protected by the same spinlock, so when we get the
-lock, the notifer work is done.
-
-Reported-by: Patrick Uiterwijk <patrick at puiterwijk.org>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3484,17 +3484,17 @@ static int mvneta_stop(struct net_device
- 	struct mvneta_port *pp = netdev_priv(dev);
- 
- 	/* Inform that we are stopping so we don't want to setup the
--	 * driver for new CPUs in the notifiers
-+	 * driver for new CPUs in the notifiers. The code of the
-+	 * notifier for CPU online is protected by the same spinlock,
-+	 * so when we get the lock, the notifer work is done.
- 	 */
- 	spin_lock(&pp->lock);
- 	pp->is_stopped = true;
-+	spin_unlock(&pp->lock);
-+
- 	mvneta_stop_dev(pp);
- 	mvneta_mdio_remove(pp);
- 	unregister_cpu_notifier(&pp->cpu_notifier);
--	/* Now that the notifier are unregistered, we can release le
--	 * lock
--	 */
--	spin_unlock(&pp->lock);
- 	on_each_cpu(mvneta_percpu_disable, pp, true);
- 	free_percpu_irq(dev->irq, pp->ports);
- 	mvneta_cleanup_rxqs(pp);
-@@ -4027,6 +4027,7 @@ static int mvneta_probe(struct platform_
- 	dev->ethtool_ops = &mvneta_eth_tool_ops;
- 
- 	pp = netdev_priv(dev);
-+	spin_lock_init(&pp->lock);
- 	pp->phy_node = phy_node;
- 	pp->phy_interface = phy_mode;
- 
diff --git a/target/linux/mvebu/patches-4.4/048-net-mvneta-fix-error-messages-in-mvneta_port_down-fu.patch b/target/linux/mvebu/patches-4.4/048-net-mvneta-fix-error-messages-in-mvneta_port_down-fu.patch
deleted file mode 100644
index fd1f1ae..0000000
--- a/target/linux/mvebu/patches-4.4/048-net-mvneta-fix-error-messages-in-mvneta_port_down-fu.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From: Dmitri Epshtein <dima at marvell.com>
-Date: Sat, 12 Mar 2016 18:44:19 +0100
-Subject: [PATCH] net: mvneta: fix error messages in mvneta_port_down function
-
-This commit corrects error printing when shutting down the port.
-
-[gregory.clement at free-electrons.com: split initial commit in two
-individual changes]
-Signed-off-by: Dmitri Epshtein <dima at marvell.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -1105,7 +1105,7 @@ static void mvneta_port_down(struct mvne
- 	do {
- 		if (count++ >= MVNETA_RX_DISABLE_TIMEOUT_MSEC) {
- 			netdev_warn(pp->dev,
--				    "TIMEOUT for RX stopped ! rx_queue_cmd: 0x08%x\n",
-+				    "TIMEOUT for RX stopped ! rx_queue_cmd: 0x%08x\n",
- 				    val);
- 			break;
- 		}
-@@ -1144,7 +1144,7 @@ static void mvneta_port_down(struct mvne
- 	do {
- 		if (count++ >= MVNETA_TX_FIFO_EMPTY_TIMEOUT) {
- 			netdev_warn(pp->dev,
--				    "TX FIFO empty timeout status=0x08%x\n",
-+				    "TX FIFO empty timeout status=0x%08x\n",
- 				    val);
- 			break;
- 		}
diff --git a/target/linux/mvebu/patches-4.4/049-net-mvneta-replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch b/target/linux/mvebu/patches-4.4/049-net-mvneta-replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch
deleted file mode 100644
index c12d98a..0000000
--- a/target/linux/mvebu/patches-4.4/049-net-mvneta-replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From: Jisheng Zhang <jszhang at marvell.com>
-Date: Wed, 30 Mar 2016 19:55:21 +0800
-Subject: [PATCH] net: mvneta: replace MVNETA_CPU_D_CACHE_LINE_SIZE with
- L1_CACHE_BYTES
-
-The mvneta is also used in some Marvell berlin family SoCs which may
-have 64bytes cacheline size. Replace the MVNETA_CPU_D_CACHE_LINE_SIZE
-usage with L1_CACHE_BYTES.
-
-And since dma_alloc_coherent() is always cacheline size aligned, so
-remove the align checks.
-
-Signed-off-by: Jisheng Zhang <jszhang at marvell.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -260,7 +260,6 @@
- 
- #define MVNETA_VLAN_TAG_LEN             4
- 
--#define MVNETA_CPU_D_CACHE_LINE_SIZE    32
- #define MVNETA_TX_CSUM_DEF_SIZE		1600
- #define MVNETA_TX_CSUM_MAX_SIZE		9800
- #define MVNETA_ACC_MODE_EXT1		1
-@@ -300,7 +299,7 @@
- #define MVNETA_RX_PKT_SIZE(mtu) \
- 	ALIGN((mtu) + MVNETA_MH_SIZE + MVNETA_VLAN_TAG_LEN + \
- 	      ETH_HLEN + ETH_FCS_LEN,			     \
--	      MVNETA_CPU_D_CACHE_LINE_SIZE)
-+	      L1_CACHE_BYTES)
- 
- #define IS_TSO_HEADER(txq, addr) \
- 	((addr >= txq->tso_hdrs_phys) && \
-@@ -2762,9 +2761,6 @@ static int mvneta_rxq_init(struct mvneta
- 	if (rxq->descs == NULL)
- 		return -ENOMEM;
- 
--	BUG_ON(rxq->descs !=
--	       PTR_ALIGN(rxq->descs, MVNETA_CPU_D_CACHE_LINE_SIZE));
--
- 	rxq->last_desc = rxq->size - 1;
- 
- 	/* Set Rx descriptors queue starting address */
-@@ -2835,10 +2831,6 @@ static int mvneta_txq_init(struct mvneta
- 	if (txq->descs == NULL)
- 		return -ENOMEM;
- 
--	/* Make sure descriptor address is cache line size aligned  */
--	BUG_ON(txq->descs !=
--	       PTR_ALIGN(txq->descs, MVNETA_CPU_D_CACHE_LINE_SIZE));
--
- 	txq->last_desc = txq->size - 1;
- 
- 	/* Set maximum bandwidth for enabled TXQs */
diff --git a/target/linux/mvebu/patches-4.4/050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch b/target/linux/mvebu/patches-4.4/050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch
deleted file mode 100644
index 0786200..0000000
--- a/target/linux/mvebu/patches-4.4/050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From: Marcin Wojtas <mw at semihalf.com>
-Date: Fri, 1 Apr 2016 15:21:18 +0200
-Subject: [PATCH] net: mvneta: fix changing MTU when using per-cpu processing
-
-After enabling per-cpu processing it appeared that under heavy load
-changing MTU can result in blocking all port's interrupts and
-transmitting data is not possible after the change.
-
-This commit fixes above issue by disabling percpu interrupts for the
-time, when TXQs and RXQs are reconfigured.
-
-Signed-off-by: Marcin Wojtas <mw at semihalf.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3040,6 +3040,20 @@ static int mvneta_check_mtu_valid(struct
- 	return mtu;
- }
- 
-+static void mvneta_percpu_enable(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
-+}
-+
-+static void mvneta_percpu_disable(void *arg)
-+{
-+	struct mvneta_port *pp = arg;
-+
-+	disable_percpu_irq(pp->dev->irq);
-+}
-+
- /* Change the device mtu */
- static int mvneta_change_mtu(struct net_device *dev, int mtu)
- {
-@@ -3064,6 +3078,7 @@ static int mvneta_change_mtu(struct net_
- 	 * reallocation of the queues
- 	 */
- 	mvneta_stop_dev(pp);
-+	on_each_cpu(mvneta_percpu_disable, pp, true);
- 
- 	mvneta_cleanup_txqs(pp);
- 	mvneta_cleanup_rxqs(pp);
-@@ -3087,6 +3102,7 @@ static int mvneta_change_mtu(struct net_
- 		return ret;
- 	}
- 
-+	on_each_cpu(mvneta_percpu_enable, pp, true);
- 	mvneta_start_dev(pp);
- 	mvneta_port_up(pp);
- 
-@@ -3240,20 +3256,6 @@ static void mvneta_mdio_remove(struct mv
- 	pp->phy_dev = NULL;
- }
- 
--static void mvneta_percpu_enable(void *arg)
--{
--	struct mvneta_port *pp = arg;
--
--	enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
--}
--
--static void mvneta_percpu_disable(void *arg)
--{
--	struct mvneta_port *pp = arg;
--
--	disable_percpu_irq(pp->dev->irq);
--}
--
- /* Electing a CPU must be done in an atomic way: it should be done
-  * after or before the removal/insertion of a CPU and this function is
-  * not reentrant.
diff --git a/target/linux/mvebu/patches-4.4/051-ARM-dts-armada-38x-add-buffer-manager-nodes.patch b/target/linux/mvebu/patches-4.4/051-ARM-dts-armada-38x-add-buffer-manager-nodes.patch
deleted file mode 100644
index b56de94..0000000
--- a/target/linux/mvebu/patches-4.4/051-ARM-dts-armada-38x-add-buffer-manager-nodes.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From: Marcin Wojtas <mw at semihalf.com>
-Date: Mon, 14 Mar 2016 09:38:57 +0100
-Subject: [PATCH] ARM: dts: armada-38x: add buffer manager nodes
-
-Armada 38x network controller supports hardware buffer management (BM).
-Since it is now enabled in mvneta driver, appropriate nodes can be added
-to armada-38x.dtsi - for the actual common BM unit (bm at c8000) and its
-internal SRAM (bm-bppi), which is used for indirect access to buffer
-pointer ring residing in DRAM.
-
-Pools - ports mapping, bm-bppi entry in 'soc' node's ranges and optional
-parameters are supposed to be set in board files.
-
-Signed-off-by: Marcin Wojtas <mw at semihalf.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/arch/arm/boot/dts/armada-38x.dtsi
-+++ b/arch/arm/boot/dts/armada-38x.dtsi
-@@ -540,6 +540,14 @@
- 				status = "disabled";
- 			};
- 
-+			bm: bm at c8000 {
-+				compatible = "marvell,armada-380-neta-bm";
-+				reg = <0xc8000 0xac>;
-+				clocks = <&gateclk 13>;
-+				internal-mem = <&bm_bppi>;
-+				status = "disabled";
-+			};
-+
- 			sata at e0000 {
- 				compatible = "marvell,armada-380-ahci";
- 				reg = <0xe0000 0x2000>;
-@@ -618,6 +626,17 @@
- 			#size-cells = <1>;
- 			ranges = <0 MBUS_ID(0x09, 0x15) 0 0x800>;
- 		};
-+
-+		bm_bppi: bm-bppi {
-+			compatible = "mmio-sram";
-+			reg = <MBUS_ID(0x0c, 0x04) 0 0x100000>;
-+			ranges = <0 MBUS_ID(0x0c, 0x04) 0 0x100000>;
-+			#address-cells = <1>;
-+			#size-cells = <1>;
-+			clocks = <&gateclk 13>;
-+			no-memory-wc;
-+			status = "disabled";
-+		};
- 	};
- 
- 	clocks {
diff --git a/target/linux/mvebu/patches-4.4/052-ARM-dts-armada-xp-add-buffer-manager-nodes.patch b/target/linux/mvebu/patches-4.4/052-ARM-dts-armada-xp-add-buffer-manager-nodes.patch
deleted file mode 100644
index 65fafd7..0000000
--- a/target/linux/mvebu/patches-4.4/052-ARM-dts-armada-xp-add-buffer-manager-nodes.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From: Marcin Wojtas <mw at semihalf.com>
-Date: Mon, 14 Mar 2016 09:38:59 +0100
-Subject: [PATCH] ARM: dts: armada-xp: add buffer manager nodes
-
-Armada XP network controller supports hardware buffer management (BM).
-Since it is now enabled in mvneta driver, appropriate nodes can be added
-to armada-xp.dtsi - for the actual common BM unit (bm at c0000) and its
-internal SRAM (bm-bppi), which is used for indirect access to buffer
-pointer ring residing in DRAM.
-
-Pools - ports mapping, bm-bppi entry in 'soc' node's ranges and optional
-parameters are supposed to be set in board files.
-
-Signed-off-by: Marcin Wojtas <mw at semihalf.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
-
---- a/arch/arm/boot/dts/armada-xp.dtsi
-+++ b/arch/arm/boot/dts/armada-xp.dtsi
-@@ -253,6 +253,14 @@
- 				marvell,crypto-sram-size = <0x800>;
- 			};
- 
-+			bm: bm at c0000 {
-+				compatible = "marvell,armada-380-neta-bm";
-+				reg = <0xc0000 0xac>;
-+				clocks = <&gateclk 13>;
-+				internal-mem = <&bm_bppi>;
-+				status = "disabled";
-+			};
-+
- 			xor at f0900 {
- 				compatible = "marvell,orion-xor";
- 				reg = <0xF0900 0x100
-@@ -291,6 +299,17 @@
- 			#size-cells = <1>;
- 			ranges = <0 MBUS_ID(0x09, 0x05) 0 0x800>;
- 		};
-+
-+		bm_bppi: bm-bppi {
-+			compatible = "mmio-sram";
-+			reg = <MBUS_ID(0x0c, 0x04) 0 0x100000>;
-+			ranges = <0 MBUS_ID(0x0c, 0x04) 0 0x100000>;
-+			#address-cells = <1>;
-+			#size-cells = <1>;
-+			clocks = <&gateclk 13>;
-+			no-memory-wc;
-+			status = "disabled";
-+		};
- 	};
- 
- 	clocks {
diff --git a/target/linux/mvebu/patches-4.4/053-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch b/target/linux/mvebu/patches-4.4/053-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch
deleted file mode 100644
index b25d710..0000000
--- a/target/linux/mvebu/patches-4.4/053-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch
+++ /dev/null
@@ -1,611 +0,0 @@
-From 4c945e8556ec7ea5b19d4f8721b212f468656e0d Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 6 Dec 2015 21:52:06 +0000
-Subject: [PATCH] ARM: dts: Add SolidRun Armada 388 Clearfog A1 DT file
-
-Add support for the SolidRun Armada 388 Clearfog A1 board.  This board
-has an Armada 388 microsom, dedicated gigabit ethernet, six switched
-gigabit ethernet ports, SFP cage, two Mini-PCIe/mSATA slots, a m.2 SATA
-slot, and a MikroBUS connector to allow MikroBUS modules to be added.
-
-This DT file adds support for all board facilities with the exception
-of full SFP support.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
-Acked-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
----
- arch/arm/boot/dts/Makefile                         |   1 +
- arch/arm/boot/dts/armada-388-clearfog.dts          | 456 +++++++++++++++++++++
- .../arm/boot/dts/armada-38x-solidrun-microsom.dtsi | 115 ++++++
- 3 files changed, 572 insertions(+)
- create mode 100644 arch/arm/boot/dts/armada-388-clearfog.dts
- create mode 100644 arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
-
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -750,6 +750,7 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \
- 	armada-385-linksys-cobra.dtb \
- 	armada-385-linksys-rango.dtb \
- 	armada-385-linksys-shelby.dtb \
-+	armada-388-clearfog.dtb \
- 	armada-388-db.dtb \
- 	armada-388-gp.dtb \
- 	armada-388-rd.dtb
---- /dev/null
-+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
-@@ -0,0 +1,456 @@
-+/*
-+ * Device Tree file for SolidRun Clearfog revision A1 rev 2.0 (88F6828)
-+ *
-+ *  Copyright (C) 2015 Russell King
-+ *
-+ * This board is in development; the contents of this file work with
-+ * the A1 rev 2.0 of the board, which does not represent final
-+ * production board.  Things will change, don't expect this file to
-+ * remain compatible info the future.
-+ *
-+ * This file is dual-licensed: you can use it either under the terms
-+ * of the GPL or the X11 license, at your option. Note that this dual
-+ * licensing only applies to this file, and not this project as a
-+ * whole.
-+ *
-+ *  a) This file is free software; you can redistribute it and/or
-+ *     modify it under the terms of the GNU General Public License
-+ *     version 2 as published by the Free Software Foundation.
-+ *
-+ *     This file is distributed in the hope that it will be useful
-+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *     GNU General Public License for more details.
-+ *
-+ * Or, alternatively
-+ *
-+ *  b) Permission is hereby granted, free of charge, to any person
-+ *     obtaining a copy of this software and associated documentation
-+ *     files (the "Software"), to deal in the Software without
-+ *     restriction, including without limitation the rights to use
-+ *     copy, modify, merge, publish, distribute, sublicense, and/or
-+ *     sell copies of the Software, and to permit persons to whom the
-+ *     Software is furnished to do so, subject to the following
-+ *     conditions:
-+ *
-+ *     The above copyright notice and this permission notice shall be
-+ *     included in all copies or substantial portions of the Software.
-+ *
-+ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
-+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
-+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-+ *     OTHER DEALINGS IN THE SOFTWARE.
-+ */
-+
-+/dts-v1/;
-+#include "armada-388.dtsi"
-+#include "armada-38x-solidrun-microsom.dtsi"
-+
-+/ {
-+	model = "SolidRun Clearfog A1";
-+	compatible = "solidrun,clearfog-a1", "marvell,armada388",
-+		"marvell,armada385", "marvell,armada380";
-+
-+	aliases {
-+		/* So that mvebu u-boot can update the MAC addresses */
-+		ethernet1 = &eth0;
-+		ethernet2 = &eth1;
-+		ethernet3 = &eth2;
-+	};
-+
-+	chosen {
-+		stdout-path = "serial0:115200n8";
-+	};
-+
-+	reg_3p3v: regulator-3p3v {
-+		compatible = "regulator-fixed";
-+		regulator-name = "3P3V";
-+		regulator-min-microvolt = <3300000>;
-+		regulator-max-microvolt = <3300000>;
-+		regulator-always-on;
-+	};
-+
-+	soc {
-+		internal-regs {
-+			ethernet at 30000 {
-+				phy-mode = "sgmii";
-+				status = "okay";
-+
-+				fixed-link {
-+					speed = <1000>;
-+					full-duplex;
-+				};
-+			};
-+
-+			ethernet at 34000 {
-+				phy-mode = "sgmii";
-+				status = "okay";
-+
-+				fixed-link {
-+					speed = <1000>;
-+					full-duplex;
-+				};
-+			};
-+
-+			i2c at 11000 {
-+				/* Is there anything on this? */
-+				clock-frequency = <100000>;
-+				pinctrl-0 = <&i2c0_pins>;
-+				pinctrl-names = "default";
-+				status = "okay";
-+
-+				/*
-+				 * PCA9655 GPIO expander, up to 1MHz clock.
-+				 *  0-CON3 CLKREQ#
-+				 *  1-CON3 PERST#
-+				 *  2-CON2 PERST#
-+				 *  3-CON3 W_DISABLE
-+				 *  4-CON2 CLKREQ#
-+				 *  5-USB3 overcurrent
-+				 *  6-USB3 power
-+				 *  7-CON2 W_DISABLE
-+				 *  8-JP4 P1
-+				 *  9-JP4 P4
-+				 * 10-JP4 P5
-+				 * 11-m.2 DEVSLP
-+				 * 12-SFP_LOS
-+				 * 13-SFP_TX_FAULT
-+				 * 14-SFP_TX_DISABLE
-+				 * 15-SFP_MOD_DEF0
-+				 */
-+				expander0: gpio-expander at 20 {
-+					/*
-+					 * This is how it should be:
-+					 * compatible = "onnn,pca9655",
-+					 *	 "nxp,pca9555";
-+					 * but you can't do this because of
-+					 * the way I2C works.
-+					 */
-+					compatible = "nxp,pca9555";
-+					gpio-controller;
-+					#gpio-cells = <2>;
-+					reg = <0x20>;
-+
-+					pcie1_0_clkreq {
-+						gpio-hog;
-+						gpios = <0 GPIO_ACTIVE_LOW>;
-+						input;
-+						line-name = "pcie1.0-clkreq";
-+					};
-+					pcie1_0_w_disable {
-+						gpio-hog;
-+						gpios = <3 GPIO_ACTIVE_LOW>;
-+						output-low;
-+						line-name = "pcie1.0-w-disable";
-+					};
-+					pcie2_0_clkreq {
-+						gpio-hog;
-+						gpios = <4 GPIO_ACTIVE_LOW>;
-+						input;
-+						line-name = "pcie2.0-clkreq";
-+					};
-+					pcie2_0_w_disable {
-+						gpio-hog;
-+						gpios = <7 GPIO_ACTIVE_LOW>;
-+						output-low;
-+						line-name = "pcie2.0-w-disable";
-+					};
-+					usb3_ilimit {
-+						gpio-hog;
-+						gpios = <5 GPIO_ACTIVE_LOW>;
-+						input;
-+						line-name = "usb3-current-limit";
-+					};
-+					usb3_power {
-+						gpio-hog;
-+						gpios = <6 GPIO_ACTIVE_HIGH>;
-+						output-high;
-+						line-name = "usb3-power";
-+					};
-+					m2_devslp {
-+						gpio-hog;
-+						gpios = <11 GPIO_ACTIVE_HIGH>;
-+						output-low;
-+						line-name = "m.2 devslp";
-+					};
-+					sfp_los {
-+						/* SFP loss of signal */
-+						gpio-hog;
-+						gpios = <12 GPIO_ACTIVE_HIGH>;
-+						input;
-+						line-name = "sfp-los";
-+					};
-+					sfp_tx_fault {
-+						/* SFP laser fault */
-+						gpio-hog;
-+						gpios = <13 GPIO_ACTIVE_HIGH>;
-+						input;
-+						line-name = "sfp-tx-fault";
-+					};
-+					sfp_tx_disable {
-+						/* SFP transmit disable */
-+						gpio-hog;
-+						gpios = <14 GPIO_ACTIVE_HIGH>;
-+						output-low;
-+						line-name = "sfp-tx-disable";
-+					};
-+					sfp_mod_def0 {
-+						/* SFP module present */
-+						gpio-hog;
-+						gpios = <15 GPIO_ACTIVE_LOW>;
-+						input;
-+						line-name = "sfp-mod-def0";
-+					};
-+				};
-+
-+				/* The MCP3021 is 100kHz clock only */
-+				mikrobus_adc: mcp3021 at 4c {
-+					compatible = "microchip,mcp3021";
-+					reg = <0x4c>;
-+				};
-+
-+				/* Also something at 0x64 */
-+			};
-+
-+			i2c at 11100 {
-+				/*
-+				 * Routed to SFP, mikrobus, and PCIe.
-+				 * SFP limits this to 100kHz, and requires
-+				 *  an AT24C01A/02/04 with address pins tied
-+				 *  low, which takes addresses 0x50 and 0x51.
-+				 * Mikrobus doesn't specify beyond an I2C
-+				 *  bus being present.
-+				 * PCIe uses ARP to assign addresses, or
-+				 *  0x63-0x64.
-+				 */
-+				clock-frequency = <100000>;
-+				pinctrl-0 = <&clearfog_i2c1_pins>;
-+				pinctrl-names = "default";
-+				status = "okay";
-+			};
-+
-+			mdio at 72004 {
-+				pinctrl-0 = <&mdio_pins>;
-+				pinctrl-names = "default";
-+
-+				phy_dedicated: ethernet-phy at 0 {
-+					/*
-+					 * Annoyingly, the marvell phy driver
-+					 * configures the LED register, rather
-+					 * than preserving reset-loaded setting.
-+					 * We undo that rubbish here.
-+					 */
-+					marvell,reg-init = <3 16 0 0x101e>;
-+					reg = <0>;
-+				};
-+			};
-+
-+			pinctrl at 18000 {
-+				clearfog_dsa0_clk_pins: clearfog-dsa0-clk-pins {
-+					marvell,pins = "mpp46";
-+					marvell,function = "ref";
-+				};
-+				clearfog_dsa0_pins: clearfog-dsa0-pins {
-+					marvell,pins = "mpp23", "mpp41";
-+					marvell,function = "gpio";
-+				};
-+				clearfog_i2c1_pins: i2c1-pins {
-+					/* SFP, PCIe, mSATA, mikrobus */
-+					marvell,pins = "mpp26", "mpp27";
-+					marvell,function = "i2c1";
-+				};
-+				clearfog_sdhci_cd_pins: clearfog-sdhci-cd-pins {
-+					marvell,pins = "mpp20";
-+					marvell,function = "gpio";
-+				};
-+				clearfog_sdhci_pins: clearfog-sdhci-pins {
-+					marvell,pins = "mpp21", "mpp28",
-+						       "mpp37", "mpp38",
-+						       "mpp39", "mpp40";
-+					marvell,function = "sd0";
-+				};
-+				clearfog_spi1_cs_pins: spi1-cs-pins {
-+					marvell,pins = "mpp55";
-+					marvell,function = "spi1";
-+				};
-+				mikro_pins: mikro-pins {
-+					/* int: mpp22 rst: mpp29 */
-+					marvell,pins = "mpp22", "mpp29";
-+					marvell,function = "gpio";
-+				};
-+				mikro_spi_pins: mikro-spi-pins {
-+					marvell,pins = "mpp43";
-+					marvell,function = "spi1";
-+				};
-+				mikro_uart_pins: mikro-uart-pins {
-+					marvell,pins = "mpp24", "mpp25";
-+					marvell,function = "ua1";
-+				};
-+				rear_button_pins: rear-button-pins {
-+					marvell,pins = "mpp34";
-+					marvell,function = "gpio";
-+				};
-+			};
-+
-+			sata at a8000 {
-+				/* pinctrl? */
-+				status = "okay";
-+			};
-+
-+			sata at e0000 {
-+				/* pinctrl? */
-+				status = "okay";
-+			};
-+
-+			sdhci at d8000 {
-+				bus-width = <4>;
-+				cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
-+				no-1-8-v;
-+				pinctrl-0 = <&clearfog_sdhci_pins
-+					     &clearfog_sdhci_cd_pins>;
-+				pinctrl-names = "default";
-+				status = "okay";
-+				vmmc = <&reg_3p3v>;
-+				wp-inverted;
-+			};
-+
-+			serial at 12100 {
-+				/* mikrobus uart */
-+				pinctrl-0 = <&mikro_uart_pins>;
-+				pinctrl-names = "default";
-+				status = "okay";
-+			};
-+
-+			spi at 10680 {
-+				/*
-+				 * We don't seem to have the W25Q32 on the
-+				 * A1 Rev 2.0 boards, so disable SPI.
-+				 * CS0: W25Q32 (doesn't appear to be present)
-+				 * CS1:
-+				 * CS2: mikrobus
-+				 */
-+				pinctrl-0 = <&spi1_pins
-+					     &clearfog_spi1_cs_pins
-+					     &mikro_spi_pins>;
-+				pinctrl-names = "default";
-+				status = "okay";
-+
-+				spi-flash at 0 {
-+					#address-cells = <1>;
-+					#size-cells = <0>;
-+					compatible = "w25q32", "jedec,spi-nor";
-+					reg = <0>; /* Chip select 0 */
-+					spi-max-frequency = <3000000>;
-+					status = "disabled";
-+				};
-+			};
-+
-+			usb at 58000 {
-+				/* CON3, nearest  power. */
-+				status = "okay";
-+			};
-+
-+			usb3 at f0000 {
-+				/* CON2, nearest CPU, USB2 only. */
-+				status = "okay";
-+			};
-+
-+			usb3 at f8000 {
-+				/* CON7 */
-+				status = "okay";
-+			};
-+		};
-+
-+		pcie-controller {
-+			status = "okay";
-+			/*
-+			 * The two PCIe units are accessible through
-+			 * the mini-PCIe connectors on the board.
-+			 */
-+			pcie at 2,0 {
-+				/* Port 1, Lane 0. CON3, nearest power. */
-+				reset-gpios = <&expander0 1 GPIO_ACTIVE_LOW>;
-+				status = "okay";
-+			};
-+			pcie at 3,0 {
-+				/* Port 2, Lane 0. CON2, nearest CPU. */
-+				reset-gpios = <&expander0 2 GPIO_ACTIVE_LOW>;
-+				status = "okay";
-+			};
-+		};
-+	};
-+
-+	dsa at 0 {
-+		compatible = "marvell,dsa";
-+		dsa,ethernet = <&eth1>;
-+		dsa,mii-bus = <&mdio>;
-+		pinctrl-0 = <&clearfog_dsa0_clk_pins &clearfog_dsa0_pins>;
-+		pinctrl-names = "default";
-+		#address-cells = <2>;
-+		#size-cells = <0>;
-+
-+		switch at 0 {
-+			#address-cells = <1>;
-+			#size-cells = <0>;
-+			reg = <4 0>;
-+
-+			port at 0 {
-+				reg = <0>;
-+				label = "lan1";
-+			};
-+
-+			port at 1 {
-+				reg = <1>;
-+				label = "lan2";
-+			};
-+
-+			port at 2 {
-+				reg = <2>;
-+				label = "lan3";
-+			};
-+
-+			port at 3 {
-+				reg = <3>;
-+				label = "lan4";
-+			};
-+
-+			port at 4 {
-+				reg = <4>;
-+				label = "lan5";
-+			};
-+
-+			port at 5 {
-+				reg = <5>;
-+				label = "cpu";
-+			};
-+
-+			port at 6 {
-+				/* 88E1512 external phy */
-+				reg = <6>;
-+				label = "lan6";
-+				fixed-link {
-+					speed = <1000>;
-+					full-duplex;
-+				};
-+			};
-+		};
-+	};
-+
-+	gpio-keys {
-+		compatible = "gpio-keys";
-+		pinctrl-0 = <&rear_button_pins>;
-+		pinctrl-names = "default";
-+
-+		button_0 {
-+			/* The rear SW3 button */
-+			label = "Rear Button";
-+			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
-+			linux,can-disable;
-+			linux,code = <BTN_0>;
-+		};
-+	};
-+};
---- /dev/null
-+++ b/arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
-@@ -0,0 +1,115 @@
-+/*
-+ * Device Tree file for SolidRun Armada 38x Microsom
-+ *
-+ *  Copyright (C) 2015 Russell King
-+ *
-+ * This board is in development; the contents of this file work with
-+ * the A1 rev 2.0 of the board, which does not represent final
-+ * production board.  Things will change, don't expect this file to
-+ * remain compatible info the future.
-+ *
-+ * This file is dual-licensed: you can use it either under the terms
-+ * of the GPL or the X11 license, at your option. Note that this dual
-+ * licensing only applies to this file, and not this project as a
-+ * whole.
-+ *
-+ *  a) This file is free software; you can redistribute it and/or
-+ *     modify it under the terms of the GNU General Public License
-+ *     version 2 as published by the Free Software Foundation.
-+ *
-+ *     This file is distributed in the hope that it will be useful
-+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *     GNU General Public License for more details.
-+ *
-+ * Or, alternatively
-+ *
-+ *  b) Permission is hereby granted, free of charge, to any person
-+ *     obtaining a copy of this software and associated documentation
-+ *     files (the "Software"), to deal in the Software without
-+ *     restriction, including without limitation the rights to use
-+ *     copy, modify, merge, publish, distribute, sublicense, and/or
-+ *     sell copies of the Software, and to permit persons to whom the
-+ *     Software is furnished to do so, subject to the following
-+ *     conditions:
-+ *
-+ *     The above copyright notice and this permission notice shall be
-+ *     included in all copies or substantial portions of the Software.
-+ *
-+ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
-+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
-+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-+ *     OTHER DEALINGS IN THE SOFTWARE.
-+ */
-+#include <dt-bindings/input/input.h>
-+#include <dt-bindings/gpio/gpio.h>
-+
-+/ {
-+	memory {
-+		device_type = "memory";
-+		reg = <0x00000000 0x10000000>; /* 256 MB */
-+	};
-+
-+	soc {
-+		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
-+			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
-+			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
-+			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
-+
-+		internal-regs {
-+			ethernet at 70000 {
-+				pinctrl-0 = <&ge0_rgmii_pins>;
-+				pinctrl-names = "default";
-+				phy = <&phy_dedicated>;
-+				phy-mode = "rgmii-id";
-+				status = "okay";
-+			};
-+
-+			mdio at 72004 {
-+				/*
-+				 * Add the phy clock here, so the phy can be
-+				 * accessed to read its IDs prior to binding
-+				 * with the driver.
-+				 */
-+				pinctrl-0 = <&mdio_pins &microsom_phy_clk_pins>;
-+				pinctrl-names = "default";
-+
-+				phy_dedicated: ethernet-phy at 0 {
-+					/*
-+					 * Annoyingly, the marvell phy driver
-+					 * configures the LED register, rather
-+					 * than preserving reset-loaded setting.
-+					 * We undo that rubbish here.
-+					 */
-+					marvell,reg-init = <3 16 0 0x101e>;
-+					reg = <0>;
-+				};
-+			};
-+
-+			pinctrl at 18000 {
-+				microsom_phy_clk_pins: microsom-phy-clk-pins {
-+					marvell,pins = "mpp45";
-+					marvell,function = "ref";
-+				};
-+			};
-+
-+			rtc at a3800 {
-+				/*
-+				 * If the rtc doesn't work, run "date reset"
-+				 * twice in u-boot.
-+				 */
-+				status = "okay";
-+			};
-+
-+			serial at 12000 {
-+				pinctrl-0 = <&uart0_pins>;
-+				pinctrl-names = "default";
-+				status = "okay";
-+			};
-+		};
-+	};
-+};
diff --git a/target/linux/mvebu/patches-4.4/054-ARM-dts-armada-38x-enable-buffer-manager-support-on-.patch b/target/linux/mvebu/patches-4.4/054-ARM-dts-armada-38x-enable-buffer-manager-support-on-.patch
deleted file mode 100644
index 705d503..0000000
--- a/target/linux/mvebu/patches-4.4/054-ARM-dts-armada-38x-enable-buffer-manager-support-on-.patch
+++ /dev/null
@@ -1,256 +0,0 @@
-From c49e99c2b25a412623412a461bb751239208b9b3 Mon Sep 17 00:00:00 2001
-From: Marcin Wojtas <mw at semihalf.com>
-Date: Mon, 14 Mar 2016 09:38:58 +0100
-Subject: [PATCH] ARM: dts: armada-38x: enable buffer manager support on Armada
- 38x boards
-
-Since mvneta driver supports using hardware buffer management (BM), in
-order to use it, board files have to be adjusted accordingly. This commit
-enables BM on:
-* A385-DB-AP - each port has its own pool for long and common pool for
-short packets,
-* A388-ClearFog - same as above,
-* A388-DB - to each port unique 'short' and 'long' pools are mapped,
-* A388-GP - same as above.
-
-Moreover appropriate entry is added to 'soc' node ranges, as well as "okay"
-status for 'bm' and 'bm-bppi' (internal SRAM) nodes.
-
-[gregory.clement at free-electrons.com: add suppport for the ClearFog board]
-
-Signed-off-by: Marcin Wojtas <mw at semihalf.com>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
-Acked-by: Russell King <rmk+kernel at arm.linux.org.uk>
-Signed-off-by: David S. Miller <davem at davemloft.net>
----
- arch/arm/boot/dts/armada-385-db-ap.dts              | 20 +++++++++++++++++++-
- arch/arm/boot/dts/armada-388-clearfog.dts           |  6 ++++++
- arch/arm/boot/dts/armada-388-db.dts                 | 17 ++++++++++++++++-
- arch/arm/boot/dts/armada-388-gp.dts                 | 17 ++++++++++++++++-
- arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi | 15 ++++++++++++++-
- 5 files changed, 71 insertions(+), 4 deletions(-)
-
---- a/arch/arm/boot/dts/armada-385-db-ap.dts
-+++ b/arch/arm/boot/dts/armada-385-db-ap.dts
-@@ -61,7 +61,8 @@
- 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
- 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
- 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
--			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
-+			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
-+			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
- 
- 		internal-regs {
- 			spi1: spi at 10680 {
-@@ -138,12 +139,18 @@
- 				status = "okay";
- 				phy = <&phy2>;
- 				phy-mode = "sgmii";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <1>;
-+				bm,pool-short = <3>;
- 			};
- 
- 			ethernet at 34000 {
- 				status = "okay";
- 				phy = <&phy1>;
- 				phy-mode = "sgmii";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <2>;
-+				bm,pool-short = <3>;
- 			};
- 
- 			ethernet at 70000 {
-@@ -157,6 +164,13 @@
- 				status = "okay";
- 				phy = <&phy0>;
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <0>;
-+				bm,pool-short = <3>;
-+			};
-+
-+			bm at c8000 {
-+				status = "okay";
- 			};
- 
- 			nfc: flash at d0000 {
-@@ -178,6 +192,10 @@
- 			};
- 		};
- 
-+		bm-bppi {
-+			status = "okay";
-+		};
-+
- 		pcie-controller {
- 			status = "okay";
- 
---- a/arch/arm/boot/dts/armada-388-clearfog.dts
-+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
-@@ -78,6 +78,9 @@
- 		internal-regs {
- 			ethernet at 30000 {
- 				phy-mode = "sgmii";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <2>;
-+				bm,pool-short = <1>;
- 				status = "okay";
- 
- 				fixed-link {
-@@ -88,6 +91,9 @@
- 
- 			ethernet at 34000 {
- 				phy-mode = "sgmii";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <3>;
-+				bm,pool-short = <1>;
- 				status = "okay";
- 
- 				fixed-link {
---- a/arch/arm/boot/dts/armada-388-db.dts
-+++ b/arch/arm/boot/dts/armada-388-db.dts
-@@ -66,7 +66,8 @@
- 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
- 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
- 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
--			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
-+			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
-+			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
- 
- 		internal-regs {
- 			spi at 10600 {
-@@ -99,6 +100,9 @@
- 				status = "okay";
- 				phy = <&phy1>;
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <2>;
-+				bm,pool-short = <3>;
- 			};
- 
- 			usb at 58000 {
-@@ -109,6 +113,9 @@
- 				status = "okay";
- 				phy = <&phy0>;
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <0>;
-+				bm,pool-short = <1>;
- 			};
- 
- 			mdio at 72004 {
-@@ -129,6 +136,10 @@
- 				status = "okay";
- 			};
- 
-+			bm at c8000 {
-+				status = "okay";
-+			};
-+
- 			flash at d0000 {
- 				status = "okay";
- 				num-cs = <1>;
-@@ -169,6 +180,10 @@
- 			};
- 		};
- 
-+		bm-bppi {
-+			status = "okay";
-+		};
-+
- 		pcie-controller {
- 			status = "okay";
- 			/*
---- a/arch/arm/boot/dts/armada-388-gp.dts
-+++ b/arch/arm/boot/dts/armada-388-gp.dts
-@@ -60,7 +60,8 @@
- 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
- 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
- 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
--			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
-+			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
-+			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
- 
- 		internal-regs {
- 			spi at 10600 {
-@@ -133,6 +134,9 @@
- 				status = "okay";
- 				phy = <&phy1>;
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <2>;
-+				bm,pool-short = <3>;
- 			};
- 
- 			/* CON4 */
-@@ -152,6 +156,9 @@
- 				status = "okay";
- 				phy = <&phy0>;
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <0>;
-+				bm,pool-short = <1>;
- 			};
- 
- 
-@@ -186,6 +193,10 @@
- 				};
- 			};
- 
-+			bm at c8000 {
-+				status = "okay";
-+			};
-+
- 			sata at e0000 {
- 				pinctrl-names = "default";
- 				pinctrl-0 = <&sata2_pins>, <&sata3_pins>;
-@@ -240,6 +251,10 @@
- 			};
- 		};
- 
-+		bm-bppi {
-+			status = "okay";
-+		};
-+
- 		pcie-controller {
- 			status = "okay";
- 			/*
---- a/arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
-+++ b/arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
-@@ -58,7 +58,8 @@
- 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
- 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
- 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
--			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
-+			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
-+			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
- 
- 		internal-regs {
- 			ethernet at 70000 {
-@@ -66,6 +67,9 @@
- 				pinctrl-names = "default";
- 				phy = <&phy_dedicated>;
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <0>;
-+				bm,pool-short = <1>;
- 				status = "okay";
- 			};
- 
-@@ -110,6 +114,15 @@
- 				pinctrl-names = "default";
- 				status = "okay";
- 			};
-+
-+			bm at c8000 {
-+				status = "okay";
-+			};
- 		};
-+
-+		bm-bppi {
-+			status = "okay";
-+		};
-+
- 	};
- };
diff --git a/target/linux/mvebu/patches-4.4/055-ARM-dts-armada-388-clearfog-remove-duplicate-mdio-en.patch b/target/linux/mvebu/patches-4.4/055-ARM-dts-armada-388-clearfog-remove-duplicate-mdio-en.patch
deleted file mode 100644
index 823d514..0000000
--- a/target/linux/mvebu/patches-4.4/055-ARM-dts-armada-388-clearfog-remove-duplicate-mdio-en.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From d261861ab52623e34a25fe6ae76714456edda033 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at armlinux.org.uk>
-Date: Sun, 10 Jul 2016 16:27:38 +0100
-Subject: [PATCH] ARM: dts: armada-388-clearfog: remove duplicate mdio entry
-
-The clearfog DTS should not be defining the on-board phy, this device
-is located on the microsom.  Remove the duplicated definition.
-
-Reported-by: Jon Nettleton <jon at solid-run.com>
-Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
-Reviewed-by: Andrew Lunn <andrew at lunn.ch>
-Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
----
- arch/arm/boot/dts/armada-388-clearfog.dts | 16 ----------------
- 1 file changed, 16 deletions(-)
-
---- a/arch/arm/boot/dts/armada-388-clearfog.dts
-+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
-@@ -239,22 +239,6 @@
- 				status = "okay";
- 			};
- 
--			mdio at 72004 {
--				pinctrl-0 = <&mdio_pins>;
--				pinctrl-names = "default";
--
--				phy_dedicated: ethernet-phy at 0 {
--					/*
--					 * Annoyingly, the marvell phy driver
--					 * configures the LED register, rather
--					 * than preserving reset-loaded setting.
--					 * We undo that rubbish here.
--					 */
--					marvell,reg-init = <3 16 0 0x101e>;
--					reg = <0>;
--				};
--			};
--
- 			pinctrl at 18000 {
- 				clearfog_dsa0_clk_pins: clearfog-dsa0-clk-pins {
- 					marvell,pins = "mpp46";
diff --git a/target/linux/mvebu/patches-4.4/100-find_active_root.patch b/target/linux/mvebu/patches-4.4/100-find_active_root.patch
deleted file mode 100644
index c997f5b..0000000
--- a/target/linux/mvebu/patches-4.4/100-find_active_root.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-The WRT1900AC among other Linksys routers uses a dual-firmware layout.
-Dynamically rename the active partition to "ubi".
-
-Signed-off-by: Imre Kaloz <kaloz at openwrt.org>
-
---- a/drivers/mtd/ofpart.c
-+++ b/drivers/mtd/ofpart.c
-@@ -25,6 +25,8 @@ static bool node_has_compatible(struct d
- 	return of_get_property(pp, "compatible", NULL);
- }
- 
-+static int mangled_rootblock;
-+
- static int parse_ofpart_partitions(struct mtd_info *master,
- 				   struct mtd_partition **pparts,
- 				   struct mtd_part_parser_data *data)
-@@ -32,6 +34,7 @@ static int parse_ofpart_partitions(struc
- 	struct device_node *mtd_node;
- 	struct device_node *ofpart_node;
- 	const char *partname;
-+	const char *owrtpart = "ubi";
- 	struct device_node *pp;
- 	int nr_parts, i, ret = 0;
- 	bool dedicated = true;
-@@ -110,9 +113,15 @@ static int parse_ofpart_partitions(struc
- 		(*pparts)[i].offset = of_read_number(reg, a_cells);
- 		(*pparts)[i].size = of_read_number(reg + a_cells, s_cells);
- 
--		partname = of_get_property(pp, "label", &len);
--		if (!partname)
--			partname = of_get_property(pp, "name", &len);
-+		if (mangled_rootblock && (i == mangled_rootblock)) {
-+				partname = owrtpart;
-+		} else {
-+			partname = of_get_property(pp, "label", &len);
-+
-+			if (!partname)
-+				partname = of_get_property(pp, "name", &len);
-+		}
-+
- 		(*pparts)[i].name = partname;
- 
- 		if (of_get_property(pp, "read-only", &len))
-@@ -215,6 +224,18 @@ static int __init ofpart_parser_init(voi
- 	return 0;
- }
- 
-+static int __init active_root(char *str)
-+{
-+	get_option(&str, &mangled_rootblock);
-+
-+	if (!mangled_rootblock)
-+		return 1;
-+
-+	return 1;
-+}
-+
-+__setup("mangled_rootblock=", active_root);
-+
- static void __exit ofpart_parser_exit(void)
- {
- 	deregister_mtd_parser(&ofpart_parser);
diff --git a/target/linux/mvebu/patches-4.4/102-revert_i2c_delay.patch b/target/linux/mvebu/patches-4.4/102-revert_i2c_delay.patch
deleted file mode 100644
index f97bba2..0000000
--- a/target/linux/mvebu/patches-4.4/102-revert_i2c_delay.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/arch/arm/boot/dts/armada-xp.dtsi
-+++ b/arch/arm/boot/dts/armada-xp.dtsi
-@@ -98,12 +98,10 @@
- 
- 
- 			i2c0: i2c at 11000 {
--				compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
- 				reg = <0x11000 0x100>;
- 			};
- 
- 			i2c1: i2c at 11100 {
--				compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
- 				reg = <0x11100 0x100>;
- 			};
- 
diff --git a/target/linux/mvebu/patches-4.4/103-remove-nand-driver-bug.patch b/target/linux/mvebu/patches-4.4/103-remove-nand-driver-bug.patch
deleted file mode 100644
index e9cc027..0000000
--- a/target/linux/mvebu/patches-4.4/103-remove-nand-driver-bug.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Remove a BUG() call that would crash on a race condition that should
-otherwise be harmless.
-
---- a/drivers/mtd/nand/pxa3xx_nand.c
-+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -701,7 +701,6 @@ static void handle_data_pio(struct pxa3x
- 	default:
- 		dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__,
- 				info->state);
--		BUG();
- 	}
- 
- 	/* Update buffer pointers for multi-page read/write */
diff --git a/target/linux/mvebu/patches-4.4/104-linksys_mamba_disable_keep_config.patch b/target/linux/mvebu/patches-4.4/104-linksys_mamba_disable_keep_config.patch
deleted file mode 100644
index 4c6b311..0000000
--- a/target/linux/mvebu/patches-4.4/104-linksys_mamba_disable_keep_config.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-@@ -298,7 +298,6 @@
- 			nand at d0000 {
- 				status = "okay";
- 				num-cs = <1>;
--				marvell,nand-keep-config;
- 				marvell,nand-enable-arbiter;
- 				nand-on-flash-bbt;
- 				nand-ecc-strength = <4>;
diff --git a/target/linux/mvebu/patches-4.4/106-enable-bm-on-linksys-devices.patch b/target/linux/mvebu/patches-4.4/106-enable-bm-on-linksys-devices.patch
deleted file mode 100644
index e80bc39..0000000
--- a/target/linux/mvebu/patches-4.4/106-enable-bm-on-linksys-devices.patch
+++ /dev/null
@@ -1,107 +0,0 @@
---- a/arch/arm/boot/dts/armada-385-linksys.dtsi
-+++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
-@@ -59,7 +59,8 @@
- 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
- 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
- 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
--			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
-+			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
-+			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
- 
- 		internal-regs {
- 
-@@ -93,6 +94,9 @@
- 			ethernet at 70000 {
- 				status = "okay";
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <0>;
-+				bm,pool-short = <3>;
- 				fixed-link {
- 					speed = <1000>;
- 					full-duplex;
-@@ -102,6 +106,9 @@
- 			ethernet at 34000 {
- 				status = "okay";
- 				phy-mode = "sgmii";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <2>;
-+				bm,pool-short = <3>;
- 				fixed-link {
- 					speed = <1000>;
- 					full-duplex;
-@@ -112,6 +119,10 @@
- 				status = "okay";
- 			};
- 
-+			bm at c8000 {
-+				status = "okay";
-+			};
-+
- 			sata at a8000 {
- 				status = "okay";
- 			};
-@@ -198,6 +209,10 @@
- 			};
- 		};
- 
-+		bm-bppi {
-+			status = "okay";
-+		};
-+
- 		pcie-controller {
- 			status = "okay";
- 
---- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-@@ -71,7 +71,8 @@
- 		ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
- 			  MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
- 			  MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
--			  MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
-+			  MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000
-+			  MBUS_ID(0x0c, 0x04) 0 0 0xf1200000 0x100000>;
- 
- 		pcie-controller {
- 			status = "okay";
-@@ -205,6 +206,9 @@
- 				pinctrl-names = "default";
- 				status = "okay";
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <0>;
-+				bm,pool-short = <3>;
- 				fixed-link {
- 					speed = <1000>;
- 					full-duplex;
-@@ -216,12 +220,19 @@
- 				pinctrl-names = "default";
- 				status = "okay";
- 				phy-mode = "rgmii-id";
-+				buffer-manager = <&bm>;
-+				bm,pool-long = <1>;
-+				bm,pool-short = <3>;
- 				fixed-link {
- 					speed = <1000>;
- 					full-duplex;
- 				};
- 			};
- 
-+			bm at c0000 {
-+				status = "okay";
-+			};
-+
- 			/* USB part of the eSATA/USB 2.0 port */
- 			usb at 50000 {
- 				status = "okay";
-@@ -379,6 +390,10 @@
- 				};
- 			};
- 		};
-+
-+		bm-bppi {
-+			status = "okay";
-+		};
- 	};
- 
- 	gpio_keys {
diff --git a/target/linux/mvebu/patches-4.4/110-pxa3xxx_revert_irq_thread.patch b/target/linux/mvebu/patches-4.4/110-pxa3xxx_revert_irq_thread.patch
deleted file mode 100644
index 30da17d..0000000
--- a/target/linux/mvebu/patches-4.4/110-pxa3xxx_revert_irq_thread.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-Revert "mtd: pxa3xx-nand: handle PIO in threaded interrupt"
-
-This reverts commit 24542257a3b987025d4b998ec2d15e556c98ad3f
-This upstream change has been causing spurious timeouts on accesses
-to the NAND flash if something else on the system is causing
-significant latency.
-
-Nothing guarantees that the thread will run in time, so the
-usual timeout is unreliable.
-
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
-
---- a/drivers/mtd/nand/pxa3xx_nand.c
-+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -765,24 +765,11 @@ static void start_data_dma(struct pxa3xx
- 		__func__, direction, info->dma_cookie, info->sg.length);
- }
- 
--static irqreturn_t pxa3xx_nand_irq_thread(int irq, void *data)
--{
--	struct pxa3xx_nand_info *info = data;
--
--	handle_data_pio(info);
--
--	info->state = STATE_CMD_DONE;
--	nand_writel(info, NDSR, NDSR_WRDREQ | NDSR_RDDREQ);
--
--	return IRQ_HANDLED;
--}
--
- static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
- {
- 	struct pxa3xx_nand_info *info = devid;
- 	unsigned int status, is_completed = 0, is_ready = 0;
- 	unsigned int ready, cmd_done;
--	irqreturn_t ret = IRQ_HANDLED;
- 
- 	if (info->cs == 0) {
- 		ready           = NDSR_FLASH_RDY;
-@@ -824,8 +811,7 @@ static irqreturn_t pxa3xx_nand_irq(int i
- 		} else {
- 			info->state = (status & NDSR_RDDREQ) ?
- 				      STATE_PIO_READING : STATE_PIO_WRITING;
--			ret = IRQ_WAKE_THREAD;
--			goto NORMAL_IRQ_EXIT;
-+			handle_data_pio(info);
- 		}
- 	}
- 	if (status & cmd_done) {
-@@ -870,7 +856,7 @@ static irqreturn_t pxa3xx_nand_irq(int i
- 	if (is_ready)
- 		complete(&info->dev_ready);
- NORMAL_IRQ_EXIT:
--	return ret;
-+	return IRQ_HANDLED;
- }
- 
- static inline int is_buf_blank(uint8_t *buf, size_t len)
-@@ -1849,9 +1835,7 @@ static int alloc_nand_resource(struct pl
- 	/* initialize all interrupts to be disabled */
- 	disable_int(info, NDSR_MASK);
- 
--	ret = request_threaded_irq(irq, pxa3xx_nand_irq,
--				   pxa3xx_nand_irq_thread, IRQF_ONESHOT,
--				   pdev->name, info);
-+	ret = request_irq(irq, pxa3xx_nand_irq, 0, pdev->name, info);
- 	if (ret < 0) {
- 		dev_err(&pdev->dev, "failed to request IRQ\n");
- 		goto fail_free_buf;
diff --git a/target/linux/mvebu/patches-4.4/120-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch b/target/linux/mvebu/patches-4.4/120-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch
deleted file mode 100644
index 00745f1..0000000
--- a/target/linux/mvebu/patches-4.4/120-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch
+++ /dev/null
@@ -1,306 +0,0 @@
-From 4d5621372f6e7ddbfd5879602f82073987bcc722 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 20 Sep 2015 09:57:10 +0100
-Subject: [PATCH 709/744] phy: move fixed_phy MII register generation to a
- library
-
-Move the fixed_phy MII register generation to a library to allow other
-software phy implementations to use this code.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/Kconfig     |   4 ++
- drivers/net/phy/Makefile    |   3 +-
- drivers/net/phy/fixed_phy.c |  95 ++-------------------------------
- drivers/net/phy/swphy.c     | 126 ++++++++++++++++++++++++++++++++++++++++++++
- drivers/net/phy/swphy.h     |   8 +++
- 5 files changed, 143 insertions(+), 93 deletions(-)
- create mode 100644 drivers/net/phy/swphy.c
- create mode 100644 drivers/net/phy/swphy.h
-
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -26,6 +26,9 @@ config SWCONFIG_LEDS
- 	bool "Switch LED trigger support"
- 	depends on (SWCONFIG && LEDS_TRIGGERS)
- 
-+config SWPHY
-+	bool
-+
- comment "MII PHY device drivers"
- 
- config AQUANTIA_PHY
-@@ -205,6 +208,7 @@ config RTL8306_PHY
- config FIXED_PHY
- 	tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
- 	depends on PHYLIB
-+	select SWPHY
- 	---help---
- 	  Adds the platform "fixed" MDIO Bus to cover the boards that use
- 	  PHYs that are not connected to the real MDIO bus.
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -1,6 +1,7 @@
- # Makefile for Linux PHY drivers
- 
--libphy-objs			:= phy.o phy_device.o mdio_bus.o
-+libphy-y			:= phy.o phy_device.o mdio_bus.o
-+libphy-$(CONFIG_SWPHY)		+= swphy.o
- 
- obj-$(CONFIG_MDIO_BOARDINFO)	+= mdio-boardinfo.o
- 
---- a/drivers/net/phy/fixed_phy.c
-+++ b/drivers/net/phy/fixed_phy.c
-@@ -24,6 +24,8 @@
- #include <linux/of.h>
- #include <linux/gpio.h>
- 
-+#include "swphy.h"
-+
- #define MII_REGS_NUM 29
- 
- struct fixed_mdio_bus {
-@@ -49,101 +51,10 @@ static struct fixed_mdio_bus platform_fm
- 
- static int fixed_phy_update_regs(struct fixed_phy *fp)
- {
--	u16 bmsr = BMSR_ANEGCAPABLE;
--	u16 bmcr = 0;
--	u16 lpagb = 0;
--	u16 lpa = 0;
--
- 	if (gpio_is_valid(fp->link_gpio))
- 		fp->status.link = !!gpio_get_value_cansleep(fp->link_gpio);
- 
--	if (fp->status.duplex) {
--		switch (fp->status.speed) {
--		case 1000:
--			bmsr |= BMSR_ESTATEN;
--			break;
--		case 100:
--			bmsr |= BMSR_100FULL;
--			break;
--		case 10:
--			bmsr |= BMSR_10FULL;
--			break;
--		default:
--			break;
--		}
--	} else {
--		switch (fp->status.speed) {
--		case 1000:
--			bmsr |= BMSR_ESTATEN;
--			break;
--		case 100:
--			bmsr |= BMSR_100HALF;
--			break;
--		case 10:
--			bmsr |= BMSR_10HALF;
--			break;
--		default:
--			break;
--		}
--	}
--
--	if (fp->status.link) {
--		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
--
--		if (fp->status.duplex) {
--			bmcr |= BMCR_FULLDPLX;
--
--			switch (fp->status.speed) {
--			case 1000:
--				bmcr |= BMCR_SPEED1000;
--				lpagb |= LPA_1000FULL;
--				break;
--			case 100:
--				bmcr |= BMCR_SPEED100;
--				lpa |= LPA_100FULL;
--				break;
--			case 10:
--				lpa |= LPA_10FULL;
--				break;
--			default:
--				pr_warn("fixed phy: unknown speed\n");
--				return -EINVAL;
--			}
--		} else {
--			switch (fp->status.speed) {
--			case 1000:
--				bmcr |= BMCR_SPEED1000;
--				lpagb |= LPA_1000HALF;
--				break;
--			case 100:
--				bmcr |= BMCR_SPEED100;
--				lpa |= LPA_100HALF;
--				break;
--			case 10:
--				lpa |= LPA_10HALF;
--				break;
--			default:
--				pr_warn("fixed phy: unknown speed\n");
--			return -EINVAL;
--			}
--		}
--
--		if (fp->status.pause)
--			lpa |= LPA_PAUSE_CAP;
--
--		if (fp->status.asym_pause)
--			lpa |= LPA_PAUSE_ASYM;
--	}
--
--	fp->regs[MII_PHYSID1] = 0;
--	fp->regs[MII_PHYSID2] = 0;
--
--	fp->regs[MII_BMSR] = bmsr;
--	fp->regs[MII_BMCR] = bmcr;
--	fp->regs[MII_LPA] = lpa;
--	fp->regs[MII_STAT1000] = lpagb;
--
--	return 0;
-+	return swphy_update_regs(fp->regs, &fp->status);
- }
- 
- static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
---- /dev/null
-+++ b/drivers/net/phy/swphy.c
-@@ -0,0 +1,126 @@
-+/*
-+ * Software PHY emulation
-+ *
-+ * Code taken from fixed_phy.c by Russell King <rmk+kernel at arm.linux.org.uk>
-+ *
-+ * Author: Vitaly Bordug <vbordug at ru.mvista.com>
-+ *         Anton Vorontsov <avorontsov at ru.mvista.com>
-+ *
-+ * Copyright (c) 2006-2007 MontaVista Software, Inc.
-+ *
-+ * 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;  either version 2 of the  License, or (at your
-+ * option) any later version.
-+ */
-+#include <linux/export.h>
-+#include <linux/mii.h>
-+#include <linux/phy.h>
-+#include <linux/phy_fixed.h>
-+
-+#include "swphy.h"
-+
-+/**
-+ * swphy_update_regs - update MII register array with fixed phy state
-+ * @regs: array of 32 registers to update
-+ * @state: fixed phy status
-+ *
-+ * Update the array of MII registers with the fixed phy link, speed,
-+ * duplex and pause mode settings.
-+ */
-+int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
-+{
-+	u16 bmsr = BMSR_ANEGCAPABLE;
-+	u16 bmcr = 0;
-+	u16 lpagb = 0;
-+	u16 lpa = 0;
-+
-+	if (state->duplex) {
-+		switch (state->speed) {
-+		case 1000:
-+			bmsr |= BMSR_ESTATEN;
-+			break;
-+		case 100:
-+			bmsr |= BMSR_100FULL;
-+			break;
-+		case 10:
-+			bmsr |= BMSR_10FULL;
-+			break;
-+		default:
-+			break;
-+		}
-+	} else {
-+		switch (state->speed) {
-+		case 1000:
-+			bmsr |= BMSR_ESTATEN;
-+			break;
-+		case 100:
-+			bmsr |= BMSR_100HALF;
-+			break;
-+		case 10:
-+			bmsr |= BMSR_10HALF;
-+			break;
-+		default:
-+			break;
-+		}
-+	}
-+
-+	if (state->link) {
-+		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
-+
-+		if (state->duplex) {
-+			bmcr |= BMCR_FULLDPLX;
-+
-+			switch (state->speed) {
-+			case 1000:
-+				bmcr |= BMCR_SPEED1000;
-+				lpagb |= LPA_1000FULL;
-+				break;
-+			case 100:
-+				bmcr |= BMCR_SPEED100;
-+				lpa |= LPA_100FULL;
-+				break;
-+			case 10:
-+				lpa |= LPA_10FULL;
-+				break;
-+			default:
-+				pr_warn("swphy: unknown speed\n");
-+				return -EINVAL;
-+			}
-+		} else {
-+			switch (state->speed) {
-+			case 1000:
-+				bmcr |= BMCR_SPEED1000;
-+				lpagb |= LPA_1000HALF;
-+				break;
-+			case 100:
-+				bmcr |= BMCR_SPEED100;
-+				lpa |= LPA_100HALF;
-+				break;
-+			case 10:
-+				lpa |= LPA_10HALF;
-+				break;
-+			default:
-+				pr_warn("swphy: unknown speed\n");
-+				return -EINVAL;
-+			}
-+		}
-+
-+		if (state->pause)
-+			lpa |= LPA_PAUSE_CAP;
-+
-+		if (state->asym_pause)
-+			lpa |= LPA_PAUSE_ASYM;
-+	}
-+
-+	regs[MII_PHYSID1] = 0;
-+	regs[MII_PHYSID2] = 0;
-+
-+	regs[MII_BMSR] = bmsr;
-+	regs[MII_BMCR] = bmcr;
-+	regs[MII_LPA] = lpa;
-+	regs[MII_STAT1000] = lpagb;
-+
-+	return 0;
-+}
-+EXPORT_SYMBOL_GPL(swphy_update_regs);
---- /dev/null
-+++ b/drivers/net/phy/swphy.h
-@@ -0,0 +1,8 @@
-+#ifndef SWPHY_H
-+#define SWPHY_H
-+
-+struct fixed_phy_status;
-+
-+int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
-+
-+#endif
diff --git a/target/linux/mvebu/patches-4.4/121-phy-convert-swphy-register-generation-to-tabular-for.patch b/target/linux/mvebu/patches-4.4/121-phy-convert-swphy-register-generation-to-tabular-for.patch
deleted file mode 100644
index 0d689f3..0000000
--- a/target/linux/mvebu/patches-4.4/121-phy-convert-swphy-register-generation-to-tabular-for.patch
+++ /dev/null
@@ -1,203 +0,0 @@
-From cd834fe430f030a63bfa9277bba194e8eef4dbd0 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 20 Sep 2015 10:18:59 +0100
-Subject: [PATCH 710/744] phy: convert swphy register generation to tabular
- form
-
-Convert the swphy register generation to tabular form which allows us
-to eliminate multiple switch() statements.  This results in a smaller
-object code size, more efficient, and easier to add support for faster
-speeds.
-
-Before:
-
-Idx Name          Size      VMA       LMA       File off  Algn
-  0 .text         00000164  00000000  00000000  00000034  2**2
-
-   text    data     bss     dec     hex filename
-    388       0       0     388     184 swphy.o
-
-After:
-
-Idx Name          Size      VMA       LMA       File off  Algn
-  0 .text         000000fc  00000000  00000000  00000034  2**2
-  5 .rodata       00000028  00000000  00000000  00000138  2**2
-
-   text    data     bss     dec     hex filename
-    324       0       0     324     144 swphy.o
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/swphy.c | 143 ++++++++++++++++++++++++++----------------------
- 1 file changed, 78 insertions(+), 65 deletions(-)
-
---- a/drivers/net/phy/swphy.c
-+++ b/drivers/net/phy/swphy.c
-@@ -20,6 +20,72 @@
- 
- #include "swphy.h"
- 
-+struct swmii_regs {
-+	u16 bmcr;
-+	u16 bmsr;
-+	u16 lpa;
-+	u16 lpagb;
-+};
-+
-+enum {
-+	SWMII_SPEED_10 = 0,
-+	SWMII_SPEED_100,
-+	SWMII_SPEED_1000,
-+	SWMII_DUPLEX_HALF = 0,
-+	SWMII_DUPLEX_FULL,
-+};
-+
-+/*
-+ * These two tables get bitwise-anded together to produce the final result.
-+ * This means the speed table must contain both duplex settings, and the
-+ * duplex table must contain all speed settings.
-+ */
-+static const struct swmii_regs speed[] = {
-+	[SWMII_SPEED_10] = {
-+		.bmcr  = BMCR_FULLDPLX,
-+		.lpa   = LPA_10FULL | LPA_10HALF,
-+	},
-+	[SWMII_SPEED_100] = {
-+		.bmcr  = BMCR_FULLDPLX | BMCR_SPEED100,
-+		.bmsr  = BMSR_100FULL | BMSR_100HALF,
-+		.lpa   = LPA_100FULL | LPA_100HALF,
-+	},
-+	[SWMII_SPEED_1000] = {
-+		.bmcr  = BMCR_FULLDPLX | BMCR_SPEED1000,
-+		.bmsr  = BMSR_ESTATEN,
-+		.lpagb = LPA_1000FULL | LPA_1000HALF,
-+	},
-+};
-+
-+static const struct swmii_regs duplex[] = {
-+	[SWMII_DUPLEX_HALF] = {
-+		.bmcr  = ~BMCR_FULLDPLX,
-+		.bmsr  = BMSR_ESTATEN | BMSR_100HALF,
-+		.lpa   = LPA_10HALF | LPA_100HALF,
-+		.lpagb = LPA_1000HALF,
-+	},
-+	[SWMII_DUPLEX_FULL] = {
-+		.bmcr  = ~0,
-+		.bmsr  = BMSR_ESTATEN | BMSR_100FULL,
-+		.lpa   = LPA_10FULL | LPA_100FULL,
-+		.lpagb = LPA_1000FULL,
-+	},
-+};
-+
-+static int swphy_decode_speed(int speed)
-+{
-+	switch (speed) {
-+	case 1000:
-+		return SWMII_SPEED_1000;
-+	case 100:
-+		return SWMII_SPEED_100;
-+	case 10:
-+		return SWMII_SPEED_10;
-+	default:
-+		return -EINVAL;
-+	}
-+}
-+
- /**
-  * swphy_update_regs - update MII register array with fixed phy state
-  * @regs: array of 32 registers to update
-@@ -30,81 +96,28 @@
-  */
- int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
- {
-+	int speed_index, duplex_index;
- 	u16 bmsr = BMSR_ANEGCAPABLE;
- 	u16 bmcr = 0;
- 	u16 lpagb = 0;
- 	u16 lpa = 0;
- 
--	if (state->duplex) {
--		switch (state->speed) {
--		case 1000:
--			bmsr |= BMSR_ESTATEN;
--			break;
--		case 100:
--			bmsr |= BMSR_100FULL;
--			break;
--		case 10:
--			bmsr |= BMSR_10FULL;
--			break;
--		default:
--			break;
--		}
--	} else {
--		switch (state->speed) {
--		case 1000:
--			bmsr |= BMSR_ESTATEN;
--			break;
--		case 100:
--			bmsr |= BMSR_100HALF;
--			break;
--		case 10:
--			bmsr |= BMSR_10HALF;
--			break;
--		default:
--			break;
--		}
-+	speed_index = swphy_decode_speed(state->speed);
-+	if (speed_index < 0) {
-+		pr_warn("swphy: unknown speed\n");
-+		return -EINVAL;
- 	}
- 
-+	duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
-+
-+	bmsr |= speed[speed_index].bmsr & duplex[duplex_index].bmsr;
-+
- 	if (state->link) {
- 		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
- 
--		if (state->duplex) {
--			bmcr |= BMCR_FULLDPLX;
--
--			switch (state->speed) {
--			case 1000:
--				bmcr |= BMCR_SPEED1000;
--				lpagb |= LPA_1000FULL;
--				break;
--			case 100:
--				bmcr |= BMCR_SPEED100;
--				lpa |= LPA_100FULL;
--				break;
--			case 10:
--				lpa |= LPA_10FULL;
--				break;
--			default:
--				pr_warn("swphy: unknown speed\n");
--				return -EINVAL;
--			}
--		} else {
--			switch (state->speed) {
--			case 1000:
--				bmcr |= BMCR_SPEED1000;
--				lpagb |= LPA_1000HALF;
--				break;
--			case 100:
--				bmcr |= BMCR_SPEED100;
--				lpa |= LPA_100HALF;
--				break;
--			case 10:
--				lpa |= LPA_10HALF;
--				break;
--			default:
--				pr_warn("swphy: unknown speed\n");
--				return -EINVAL;
--			}
--		}
-+		bmcr  |= speed[speed_index].bmcr  & duplex[duplex_index].bmcr;
-+		lpa   |= speed[speed_index].lpa   & duplex[duplex_index].lpa;
-+		lpagb |= speed[speed_index].lpagb & duplex[duplex_index].lpagb;
- 
- 		if (state->pause)
- 			lpa |= LPA_PAUSE_CAP;
diff --git a/target/linux/mvebu/patches-4.4/122-phy-separate-swphy-state-validation-from-register-ge.patch b/target/linux/mvebu/patches-4.4/122-phy-separate-swphy-state-validation-from-register-ge.patch
deleted file mode 100644
index 4b332cc..0000000
--- a/target/linux/mvebu/patches-4.4/122-phy-separate-swphy-state-validation-from-register-ge.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From e07630ad84c7dc145863f079f108154fb7c975e7 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 20 Sep 2015 11:12:15 +0100
-Subject: [PATCH 711/744] phy: separate swphy state validation from register
- generation
-
-Separate out the generation of MII registers from the state validation.
-This allows us to simplify the error handing in fixed_phy() by allowing
-earlier error detection.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/fixed_phy.c | 15 +++++++--------
- drivers/net/phy/swphy.c     | 33 ++++++++++++++++++++++++++-------
- drivers/net/phy/swphy.h     |  3 ++-
- 3 files changed, 35 insertions(+), 16 deletions(-)
-
---- a/drivers/net/phy/fixed_phy.c
-+++ b/drivers/net/phy/fixed_phy.c
-@@ -49,12 +49,12 @@ static struct fixed_mdio_bus platform_fm
- 	.phys = LIST_HEAD_INIT(platform_fmb.phys),
- };
- 
--static int fixed_phy_update_regs(struct fixed_phy *fp)
-+static void fixed_phy_update_regs(struct fixed_phy *fp)
- {
- 	if (gpio_is_valid(fp->link_gpio))
- 		fp->status.link = !!gpio_get_value_cansleep(fp->link_gpio);
- 
--	return swphy_update_regs(fp->regs, &fp->status);
-+	swphy_update_regs(fp->regs, &fp->status);
- }
- 
- static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
-@@ -161,6 +161,10 @@ int fixed_phy_add(unsigned int irq, int
- 	struct fixed_mdio_bus *fmb = &platform_fmb;
- 	struct fixed_phy *fp;
- 
-+	ret = swphy_validate_state(status);
-+	if (ret < 0)
-+		return ret;
-+
- 	fp = kzalloc(sizeof(*fp), GFP_KERNEL);
- 	if (!fp)
- 		return -ENOMEM;
-@@ -180,17 +184,12 @@ int fixed_phy_add(unsigned int irq, int
- 			goto err_regs;
- 	}
- 
--	ret = fixed_phy_update_regs(fp);
--	if (ret)
--		goto err_gpio;
-+	fixed_phy_update_regs(fp);
- 
- 	list_add_tail(&fp->node, &fmb->phys);
- 
- 	return 0;
- 
--err_gpio:
--	if (gpio_is_valid(fp->link_gpio))
--		gpio_free(fp->link_gpio);
- err_regs:
- 	kfree(fp);
- 	return ret;
---- a/drivers/net/phy/swphy.c
-+++ b/drivers/net/phy/swphy.c
-@@ -87,6 +87,29 @@ static int swphy_decode_speed(int speed)
- }
- 
- /**
-+ * swphy_validate_state - validate the software phy status
-+ * @state: software phy status
-+ *
-+ * This checks that we can represent the state stored in @state can be
-+ * represented in the emulated MII registers.  Returns 0 if it can,
-+ * otherwise returns -EINVAL.
-+ */
-+int swphy_validate_state(const struct fixed_phy_status *state)
-+{
-+	int err;
-+
-+	if (state->link) {
-+		err = swphy_decode_speed(state->speed);
-+		if (err < 0) {
-+			pr_warn("swphy: unknown speed\n");
-+			return -EINVAL;
-+		}
-+	}
-+	return 0;
-+}
-+EXPORT_SYMBOL_GPL(swphy_validate_state);
-+
-+/**
-  * swphy_update_regs - update MII register array with fixed phy state
-  * @regs: array of 32 registers to update
-  * @state: fixed phy status
-@@ -94,7 +117,7 @@ static int swphy_decode_speed(int speed)
-  * Update the array of MII registers with the fixed phy link, speed,
-  * duplex and pause mode settings.
-  */
--int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
-+void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
- {
- 	int speed_index, duplex_index;
- 	u16 bmsr = BMSR_ANEGCAPABLE;
-@@ -103,10 +126,8 @@ int swphy_update_regs(u16 *regs, const s
- 	u16 lpa = 0;
- 
- 	speed_index = swphy_decode_speed(state->speed);
--	if (speed_index < 0) {
--		pr_warn("swphy: unknown speed\n");
--		return -EINVAL;
--	}
-+	if (WARN_ON(speed_index < 0))
-+		return;
- 
- 	duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
- 
-@@ -133,7 +154,5 @@ int swphy_update_regs(u16 *regs, const s
- 	regs[MII_BMCR] = bmcr;
- 	regs[MII_LPA] = lpa;
- 	regs[MII_STAT1000] = lpagb;
--
--	return 0;
- }
- EXPORT_SYMBOL_GPL(swphy_update_regs);
---- a/drivers/net/phy/swphy.h
-+++ b/drivers/net/phy/swphy.h
-@@ -3,6 +3,7 @@
- 
- struct fixed_phy_status;
- 
--int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
-+int swphy_validate_state(const struct fixed_phy_status *state);
-+void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
- 
- #endif
diff --git a/target/linux/mvebu/patches-4.4/123-phy-generate-swphy-registers-on-the-fly.patch b/target/linux/mvebu/patches-4.4/123-phy-generate-swphy-registers-on-the-fly.patch
deleted file mode 100644
index 218b902..0000000
--- a/target/linux/mvebu/patches-4.4/123-phy-generate-swphy-registers-on-the-fly.patch
+++ /dev/null
@@ -1,204 +0,0 @@
-From e0f33a88243329da1aa5a90fe10ab25c9fb0a091 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 20 Sep 2015 11:28:39 +0100
-Subject: [PATCH 712/744] phy: generate swphy registers on the fly
-
-Generate software phy registers as and when requested, rather than
-duplicating the state in fixed_phy.  This allows us to eliminate
-the duplicate storage of of the same data, which is only different
-in format.
-
-As fixed_phy_update_regs() no longer updates register state, rename
-it to fixed_phy_update().
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/fixed_phy.c | 31 +++++-------------------------
- drivers/net/phy/swphy.c     | 47 ++++++++++++++++++++++++++++++++-------------
- drivers/net/phy/swphy.h     |  2 +-
- 3 files changed, 40 insertions(+), 40 deletions(-)
-
---- a/drivers/net/phy/fixed_phy.c
-+++ b/drivers/net/phy/fixed_phy.c
-@@ -26,8 +26,6 @@
- 
- #include "swphy.h"
- 
--#define MII_REGS_NUM 29
--
- struct fixed_mdio_bus {
- 	int irqs[PHY_MAX_ADDR];
- 	struct mii_bus *mii_bus;
-@@ -36,7 +34,6 @@ struct fixed_mdio_bus {
- 
- struct fixed_phy {
- 	int addr;
--	u16 regs[MII_REGS_NUM];
- 	struct phy_device *phydev;
- 	struct fixed_phy_status status;
- 	int (*link_update)(struct net_device *, struct fixed_phy_status *);
-@@ -49,12 +46,10 @@ static struct fixed_mdio_bus platform_fm
- 	.phys = LIST_HEAD_INIT(platform_fmb.phys),
- };
- 
--static void fixed_phy_update_regs(struct fixed_phy *fp)
-+static void fixed_phy_update(struct fixed_phy *fp)
- {
- 	if (gpio_is_valid(fp->link_gpio))
- 		fp->status.link = !!gpio_get_value_cansleep(fp->link_gpio);
--
--	swphy_update_regs(fp->regs, &fp->status);
- }
- 
- static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
-@@ -62,29 +57,15 @@ static int fixed_mdio_read(struct mii_bu
- 	struct fixed_mdio_bus *fmb = bus->priv;
- 	struct fixed_phy *fp;
- 
--	if (reg_num >= MII_REGS_NUM)
--		return -1;
--
--	/* We do not support emulating Clause 45 over Clause 22 register reads
--	 * return an error instead of bogus data.
--	 */
--	switch (reg_num) {
--	case MII_MMD_CTRL:
--	case MII_MMD_DATA:
--		return -1;
--	default:
--		break;
--	}
--
- 	list_for_each_entry(fp, &fmb->phys, node) {
- 		if (fp->addr == phy_addr) {
- 			/* Issue callback if user registered it. */
- 			if (fp->link_update) {
- 				fp->link_update(fp->phydev->attached_dev,
- 						&fp->status);
--				fixed_phy_update_regs(fp);
-+				fixed_phy_update(fp);
- 			}
--			return fp->regs[reg_num];
-+			return swphy_read_reg(reg_num, &fp->status);
- 		}
- 	}
- 
-@@ -144,7 +125,7 @@ int fixed_phy_update_state(struct phy_de
- 			_UPD(pause);
- 			_UPD(asym_pause);
- #undef _UPD
--			fixed_phy_update_regs(fp);
-+			fixed_phy_update(fp);
- 			return 0;
- 		}
- 	}
-@@ -169,8 +150,6 @@ int fixed_phy_add(unsigned int irq, int
- 	if (!fp)
- 		return -ENOMEM;
- 
--	memset(fp->regs, 0xFF,  sizeof(fp->regs[0]) * MII_REGS_NUM);
--
- 	fmb->irqs[phy_addr] = irq;
- 
- 	fp->addr = phy_addr;
-@@ -184,7 +163,7 @@ int fixed_phy_add(unsigned int irq, int
- 			goto err_regs;
- 	}
- 
--	fixed_phy_update_regs(fp);
-+	fixed_phy_update(fp);
- 
- 	list_add_tail(&fp->node, &fmb->phys);
- 
---- a/drivers/net/phy/swphy.c
-+++ b/drivers/net/phy/swphy.c
-@@ -20,6 +20,8 @@
- 
- #include "swphy.h"
- 
-+#define MII_REGS_NUM 29
-+
- struct swmii_regs {
- 	u16 bmcr;
- 	u16 bmsr;
-@@ -110,14 +112,13 @@ int swphy_validate_state(const struct fi
- EXPORT_SYMBOL_GPL(swphy_validate_state);
- 
- /**
-- * swphy_update_regs - update MII register array with fixed phy state
-- * @regs: array of 32 registers to update
-+ * swphy_read_reg - return a MII register from the fixed phy state
-+ * @reg: MII register
-  * @state: fixed phy status
-  *
-- * Update the array of MII registers with the fixed phy link, speed,
-- * duplex and pause mode settings.
-+ * Return the MII @reg register generated from the fixed phy state @state.
-  */
--void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
-+int swphy_read_reg(int reg, const struct fixed_phy_status *state)
- {
- 	int speed_index, duplex_index;
- 	u16 bmsr = BMSR_ANEGCAPABLE;
-@@ -125,9 +126,12 @@ void swphy_update_regs(u16 *regs, const
- 	u16 lpagb = 0;
- 	u16 lpa = 0;
- 
-+	if (reg > MII_REGS_NUM)
-+		return -1;
-+
- 	speed_index = swphy_decode_speed(state->speed);
- 	if (WARN_ON(speed_index < 0))
--		return;
-+		return 0;
- 
- 	duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
- 
-@@ -147,12 +151,29 @@ void swphy_update_regs(u16 *regs, const
- 			lpa |= LPA_PAUSE_ASYM;
- 	}
- 
--	regs[MII_PHYSID1] = 0;
--	regs[MII_PHYSID2] = 0;
-+	switch (reg) {
-+	case MII_BMCR:
-+		return bmcr;
-+	case MII_BMSR:
-+		return bmsr;
-+	case MII_PHYSID1:
-+	case MII_PHYSID2:
-+		return 0;
-+	case MII_LPA:
-+		return lpa;
-+	case MII_STAT1000:
-+		return lpagb;
-+
-+	/*
-+	 * We do not support emulating Clause 45 over Clause 22 register
-+	 * reads.  Return an error instead of bogus data.
-+	 */
-+	case MII_MMD_CTRL:
-+	case MII_MMD_DATA:
-+		return -1;
- 
--	regs[MII_BMSR] = bmsr;
--	regs[MII_BMCR] = bmcr;
--	regs[MII_LPA] = lpa;
--	regs[MII_STAT1000] = lpagb;
-+	default:
-+		return 0xffff;
-+	}
- }
--EXPORT_SYMBOL_GPL(swphy_update_regs);
-+EXPORT_SYMBOL_GPL(swphy_read_reg);
---- a/drivers/net/phy/swphy.h
-+++ b/drivers/net/phy/swphy.h
-@@ -4,6 +4,6 @@
- struct fixed_phy_status;
- 
- int swphy_validate_state(const struct fixed_phy_status *state);
--void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
-+int swphy_read_reg(int reg, const struct fixed_phy_status *state);
- 
- #endif
diff --git a/target/linux/mvebu/patches-4.4/124-phy-improve-safety-of-fixed-phy-MII-register-reading.patch b/target/linux/mvebu/patches-4.4/124-phy-improve-safety-of-fixed-phy-MII-register-reading.patch
deleted file mode 100644
index 5167b07..0000000
--- a/target/linux/mvebu/patches-4.4/124-phy-improve-safety-of-fixed-phy-MII-register-reading.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From c36739c3cfd277a4cc9820a29dd0f4b7fbac795b Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 20 Sep 2015 18:31:36 +0100
-Subject: [PATCH 713/744] phy: improve safety of fixed-phy MII register reading
-
-There is no prevention of a concurrent call to both fixed_mdio_read()
-and fixed_phy_update_state(), which can result in the state being
-modified while it's being inspected.  Fix this by using a seqcount
-to detect modifications, and memcpy()ing the state.
-
-We remain slightly naughty here, calling link_update() and updating
-the link status within the read-side loop - which would need rework
-of the design to change.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/fixed_phy.c | 28 +++++++++++++++++++++-------
- 1 file changed, 21 insertions(+), 7 deletions(-)
-
---- a/drivers/net/phy/fixed_phy.c
-+++ b/drivers/net/phy/fixed_phy.c
-@@ -23,6 +23,7 @@
- #include <linux/slab.h>
- #include <linux/of.h>
- #include <linux/gpio.h>
-+#include <linux/seqlock.h>
- 
- #include "swphy.h"
- 
-@@ -35,6 +36,7 @@ struct fixed_mdio_bus {
- struct fixed_phy {
- 	int addr;
- 	struct phy_device *phydev;
-+	seqcount_t seqcount;
- 	struct fixed_phy_status status;
- 	int (*link_update)(struct net_device *, struct fixed_phy_status *);
- 	struct list_head node;
-@@ -59,13 +61,21 @@ static int fixed_mdio_read(struct mii_bu
- 
- 	list_for_each_entry(fp, &fmb->phys, node) {
- 		if (fp->addr == phy_addr) {
--			/* Issue callback if user registered it. */
--			if (fp->link_update) {
--				fp->link_update(fp->phydev->attached_dev,
--						&fp->status);
--				fixed_phy_update(fp);
--			}
--			return swphy_read_reg(reg_num, &fp->status);
-+			struct fixed_phy_status state;
-+			int s;
-+
-+			do {
-+				s = read_seqcount_begin(&fp->seqcount);
-+				/* Issue callback if user registered it. */
-+				if (fp->link_update) {
-+					fp->link_update(fp->phydev->attached_dev,
-+							&fp->status);
-+					fixed_phy_update(fp);
-+				}
-+				state = fp->status;
-+			} while (read_seqcount_retry(&fp->seqcount, s));
-+
-+			return swphy_read_reg(reg_num, &state);
- 		}
- 	}
- 
-@@ -117,6 +127,7 @@ int fixed_phy_update_state(struct phy_de
- 
- 	list_for_each_entry(fp, &fmb->phys, node) {
- 		if (fp->addr == phydev->addr) {
-+			write_seqcount_begin(&fp->seqcount);
- #define _UPD(x) if (changed->x) \
- 	fp->status.x = status->x
- 			_UPD(link);
-@@ -126,6 +137,7 @@ int fixed_phy_update_state(struct phy_de
- 			_UPD(asym_pause);
- #undef _UPD
- 			fixed_phy_update(fp);
-+			write_seqcount_end(&fp->seqcount);
- 			return 0;
- 		}
- 	}
-@@ -150,6 +162,8 @@ int fixed_phy_add(unsigned int irq, int
- 	if (!fp)
- 		return -ENOMEM;
- 
-+	seqcount_init(&fp->seqcount);
-+
- 	fmb->irqs[phy_addr] = irq;
- 
- 	fp->addr = phy_addr;
diff --git a/target/linux/mvebu/patches-4.4/125-phy-provide-a-hook-for-link-up-link-down-events.patch b/target/linux/mvebu/patches-4.4/125-phy-provide-a-hook-for-link-up-link-down-events.patch
deleted file mode 100644
index b009689..0000000
--- a/target/linux/mvebu/patches-4.4/125-phy-provide-a-hook-for-link-up-link-down-events.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From d8b4e728f598d3c8a9b219d4679d5de350caa082 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Fri, 18 Sep 2015 14:42:16 +0100
-Subject: [PATCH 714/744] phy: provide a hook for link up/link down events
-
-Sometimes, we need to do additional work between the PHY coming up and
-marking the carrier present - for example, we may need to wait for the
-PHY to MAC link to finish negotiation.  This changes phylib to provide
-a notification function pointer which avoids the built-in
-netif_carrier_on() and netif_carrier_off() functions.
-
-Standard ->adjust_link functionality is provided by hooking a helper
-into the new ->phy_link_change method.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phy.c        | 42 ++++++++++++++++++++++--------------------
- drivers/net/phy/phy_device.c | 14 ++++++++++++++
- include/linux/phy.h          |  1 +
- 3 files changed, 37 insertions(+), 20 deletions(-)
-
---- a/drivers/net/phy/phy.c
-+++ b/drivers/net/phy/phy.c
-@@ -849,6 +849,16 @@ void phy_start(struct phy_device *phydev
- }
- EXPORT_SYMBOL(phy_start);
- 
-+static void phy_link_up(struct phy_device *phydev)
-+{
-+	phydev->phy_link_change(phydev, true, true);
-+}
-+
-+static void phy_link_down(struct phy_device *phydev, bool do_carrier)
-+{
-+	phydev->phy_link_change(phydev, false, do_carrier);
-+}
-+
- /**
-  * phy_state_machine - Handle the state machine
-  * @work: work_struct that describes the work to be done
-@@ -890,8 +900,7 @@ void phy_state_machine(struct work_struc
- 		/* If the link is down, give up on negotiation for now */
- 		if (!phydev->link) {
- 			phydev->state = PHY_NOLINK;
--			netif_carrier_off(phydev->attached_dev);
--			phydev->adjust_link(phydev->attached_dev);
-+			phy_link_down(phydev, true);
- 			break;
- 		}
- 
-@@ -903,9 +912,7 @@ void phy_state_machine(struct work_struc
- 		/* If AN is done, we're running */
- 		if (err > 0) {
- 			phydev->state = PHY_RUNNING;
--			netif_carrier_on(phydev->attached_dev);
--			phydev->adjust_link(phydev->attached_dev);
--
-+			phy_link_up(phydev);
- 		} else if (0 == phydev->link_timeout--)
- 			needs_aneg = true;
- 		break;
-@@ -930,8 +937,7 @@ void phy_state_machine(struct work_struc
- 				}
- 			}
- 			phydev->state = PHY_RUNNING;
--			netif_carrier_on(phydev->attached_dev);
--			phydev->adjust_link(phydev->attached_dev);
-+			phy_link_up(phydev);
- 		}
- 		break;
- 	case PHY_FORCING:
-@@ -941,13 +947,12 @@ void phy_state_machine(struct work_struc
- 
- 		if (phydev->link) {
- 			phydev->state = PHY_RUNNING;
--			netif_carrier_on(phydev->attached_dev);
-+			phy_link_up(phydev);
- 		} else {
- 			if (0 == phydev->link_timeout--)
- 				needs_aneg = true;
-+			phy_link_down(phydev, false);
- 		}
--
--		phydev->adjust_link(phydev->attached_dev);
- 		break;
- 	case PHY_RUNNING:
- 		/* Only register a CHANGE if we are polling or ignoring
-@@ -970,14 +975,12 @@ void phy_state_machine(struct work_struc
- 
- 		if (phydev->link) {
- 			phydev->state = PHY_RUNNING;
--			netif_carrier_on(phydev->attached_dev);
-+			phy_link_up(phydev);
- 		} else {
- 			phydev->state = PHY_NOLINK;
--			netif_carrier_off(phydev->attached_dev);
-+			phy_link_down(phydev, true);
- 		}
- 
--		phydev->adjust_link(phydev->attached_dev);
--
- 		if (phy_interrupt_is_valid(phydev))
- 			err = phy_config_interrupt(phydev,
- 						   PHY_INTERRUPT_ENABLED);
-@@ -985,8 +988,7 @@ void phy_state_machine(struct work_struc
- 	case PHY_HALTED:
- 		if (phydev->link) {
- 			phydev->link = 0;
--			netif_carrier_off(phydev->attached_dev);
--			phydev->adjust_link(phydev->attached_dev);
-+			phy_link_down(phydev, true);
- 			do_suspend = true;
- 		}
- 		break;
-@@ -1006,11 +1008,11 @@ void phy_state_machine(struct work_struc
- 
- 				if (phydev->link) {
- 					phydev->state = PHY_RUNNING;
--					netif_carrier_on(phydev->attached_dev);
-+					phy_link_up(phydev);
- 				} else	{
- 					phydev->state = PHY_NOLINK;
-+					phy_link_down(phydev, false);
- 				}
--				phydev->adjust_link(phydev->attached_dev);
- 			} else {
- 				phydev->state = PHY_AN;
- 				phydev->link_timeout = PHY_AN_TIMEOUT;
-@@ -1022,11 +1024,11 @@ void phy_state_machine(struct work_struc
- 
- 			if (phydev->link) {
- 				phydev->state = PHY_RUNNING;
--				netif_carrier_on(phydev->attached_dev);
-+				phy_link_up(phydev);
- 			} else	{
- 				phydev->state = PHY_NOLINK;
-+				phy_link_down(phydev, false);
- 			}
--			phydev->adjust_link(phydev->attached_dev);
- 		}
- 		break;
- 	}
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -441,6 +441,19 @@ struct phy_device *phy_find_first(struct
- }
- EXPORT_SYMBOL(phy_find_first);
- 
-+static void phy_link_change(struct phy_device *phydev, bool up, bool do_carrier)
-+{
-+	struct net_device *netdev = phydev->attached_dev;
-+
-+	if (do_carrier) {
-+		if (up)
-+			netif_carrier_on(netdev);
-+		else
-+			netif_carrier_off(netdev);
-+	}
-+	phydev->adjust_link(netdev);
-+}
-+
- /**
-  * phy_prepare_link - prepares the PHY layer to monitor link status
-  * @phydev: target phy_device struct
-@@ -659,6 +672,7 @@ int phy_attach_direct(struct net_device
- 		goto error;
- 	}
- 
-+	phydev->phy_link_change = phy_link_change;
- 	phydev->attached_dev = dev;
- 	dev->phydev = phydev;
- 
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -433,6 +433,7 @@ struct phy_device {
- 
- 	u8 mdix;
- 
-+	void (*phy_link_change)(struct phy_device *, bool up, bool do_carrier);
- 	void (*adjust_link)(struct net_device *dev);
- };
- #define to_phy_device(d) container_of(d, struct phy_device, dev)
diff --git a/target/linux/mvebu/patches-4.4/126-phy-marvell-88E1512-add-flow-control-support.patch b/target/linux/mvebu/patches-4.4/126-phy-marvell-88E1512-add-flow-control-support.patch
deleted file mode 100644
index e731c4d..0000000
--- a/target/linux/mvebu/patches-4.4/126-phy-marvell-88E1512-add-flow-control-support.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 5eed0bf3bc3e69b20a13d8ffcdf97cb720391637 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 00:34:08 +0100
-Subject: [PATCH 735/744] phy: marvell: 88E1512: add flow control support
-
-The Marvell PHYs support pause frame advertisments, so we should not be
-masking their support off.  Add the necessary flag to the Marvell PHY
-to allow any MAC level pause frame support to be advertised.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/marvell.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/phy/marvell.c
-+++ b/drivers/net/phy/marvell.c
-@@ -1142,7 +1142,7 @@ static struct phy_driver marvell_drivers
- 		.phy_id = MARVELL_PHY_ID_88E1510,
- 		.phy_id_mask = MARVELL_PHY_ID_MASK,
- 		.name = "Marvell 88E1510",
--		.features = PHY_GBIT_FEATURES,
-+		.features = PHY_GBIT_FEATURES | SUPPORTED_Pause,
- 		.flags = PHY_HAS_INTERRUPT,
- 		.config_aneg = &m88e1510_config_aneg,
- 		.read_status = &marvell_read_status,
diff --git a/target/linux/mvebu/patches-4.4/127-phy-export-phy_start_machine-for-phylink.patch b/target/linux/mvebu/patches-4.4/127-phy-export-phy_start_machine-for-phylink.patch
deleted file mode 100644
index eb73933..0000000
--- a/target/linux/mvebu/patches-4.4/127-phy-export-phy_start_machine-for-phylink.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From f2a9687b39cda3fb67ecd5eaa88e3545e78c982c Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Fri, 16 Oct 2015 12:18:41 +0100
-Subject: [PATCH 715/744] phy: export phy_start_machine() for phylink
-
-phylink will need phy_start_machine exported, so lets export it as a
-GPL symbol.  Documentation/networking/phy.txt indicates that this
-should be a PHY API function.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phy.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/drivers/net/phy/phy.c
-+++ b/drivers/net/phy/phy.c
-@@ -568,6 +568,7 @@ void phy_start_machine(struct phy_device
- {
- 	queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, HZ);
- }
-+EXPORT_SYMBOL_GPL(phy_start_machine);
- 
- /**
-  * phy_stop_machine - stop the PHY state machine tracking
diff --git a/target/linux/mvebu/patches-4.4/128-phy-export-phy_speed_to_str-for-phylink.patch b/target/linux/mvebu/patches-4.4/128-phy-export-phy_speed_to_str-for-phylink.patch
deleted file mode 100644
index c436070..0000000
--- a/target/linux/mvebu/patches-4.4/128-phy-export-phy_speed_to_str-for-phylink.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 5c77cc2ffd5deb4762d9551409472f2441297fe7 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 18 Oct 2015 19:51:10 +0100
-Subject: [PATCH 716/744] phy: export phy_speed_to_str() for phylink
-
-phylink would like to reuse phy_speed_to_str() to convert the speed
-to a string.  Add a prototype and export this helper function.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phy.c | 3 ++-
- include/linux/phy.h   | 1 +
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
---- a/drivers/net/phy/phy.c
-+++ b/drivers/net/phy/phy.c
-@@ -38,7 +38,7 @@
- 
- #include <asm/irq.h>
- 
--static const char *phy_speed_to_str(int speed)
-+const char *phy_speed_to_str(int speed)
- {
- 	switch (speed) {
- 	case SPEED_10:
-@@ -57,6 +57,7 @@ static const char *phy_speed_to_str(int
- 		return "Unsupported (update phy.c)";
- 	}
- }
-+EXPORT_SYMBOL_GPL(phy_speed_to_str);
- 
- #define PHY_STATE_STR(_state)			\
- 	case PHY_##_state:			\
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -812,6 +812,7 @@ int phy_ethtool_gset(struct phy_device *
- int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr);
- int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
- int phy_start_interrupts(struct phy_device *phydev);
-+const char *phy_speed_to_str(int speed);
- void phy_print_status(struct phy_device *phydev);
- void phy_device_free(struct phy_device *phydev);
- int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
diff --git a/target/linux/mvebu/patches-4.4/129-phy-add-I2C-mdio-bus.patch b/target/linux/mvebu/patches-4.4/129-phy-add-I2C-mdio-bus.patch
deleted file mode 100644
index 13f8ecf..0000000
--- a/target/linux/mvebu/patches-4.4/129-phy-add-I2C-mdio-bus.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-From 7f36ac946bfbd4090b8b94be3661b41ac73e21f4 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Fri, 25 Sep 2015 17:43:52 +0100
-Subject: [PATCH 717/744] phy: add I2C mdio bus
-
-Add an I2C MDIO bus bridge library, to allow phylib to access PHYs which
-are connected to an I2C bus instead of the more conventional MDIO bus.
-Such PHYs can be found in SFP adapters and SFF modules.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/Kconfig    | 10 ++++++
- drivers/net/phy/Makefile   |  1 +
- drivers/net/phy/mdio-i2c.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++
- drivers/net/phy/mdio-i2c.h | 19 ++++++++++
- 4 files changed, 120 insertions(+)
- create mode 100644 drivers/net/phy/mdio-i2c.c
- create mode 100644 drivers/net/phy/mdio-i2c.h
-
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -233,6 +233,16 @@ config MDIO_GPIO
- 	  To compile this driver as a module, choose M here: the module
- 	  will be called mdio-gpio.
- 
-+config MDIO_I2C
-+	tristate
-+	depends on I2C
-+	help
-+	  Support I2C based PHYs.  This provides a MDIO bus bridged
-+	  to I2C to allow PHYs connected in I2C mode to be accessed
-+	  using the existing infrastructure.
-+
-+	  This is library mode.
-+
- config MDIO_OCTEON
- 	tristate "Support for MDIO buses on Octeon and ThunderX SOCs"
- 	depends on 64BIT
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -41,6 +41,7 @@ obj-$(CONFIG_SWCONFIG_B53)	+= b53/
- obj-$(CONFIG_FIXED_PHY)		+= fixed_phy.o
- obj-$(CONFIG_MDIO_BITBANG)	+= mdio-bitbang.o
- obj-$(CONFIG_MDIO_GPIO)		+= mdio-gpio.o
-+obj-$(CONFIG_MDIO_I2C)		+= mdio-i2c.o
- obj-$(CONFIG_NATIONAL_PHY)	+= national.o
- obj-$(CONFIG_DP83640_PHY)	+= dp83640.o
- obj-$(CONFIG_DP83848_PHY)	+= dp83848.o
---- /dev/null
-+++ b/drivers/net/phy/mdio-i2c.c
-@@ -0,0 +1,90 @@
-+/*
-+ * MDIO I2C bridge
-+ *
-+ * Copyright (C) 2015 Russell King
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+#include <linux/i2c.h>
-+#include <linux/phy.h>
-+
-+#include "mdio-i2c.h"
-+
-+static int i2c_mii_read(struct mii_bus *bus, int phy_id, int reg)
-+{
-+	struct i2c_adapter *i2c = bus->priv;
-+	struct i2c_msg msgs[2];
-+	u8 data[2], dev_addr = reg;
-+	int bus_addr, ret;
-+
-+	bus_addr = 0x40 + phy_id;
-+	if (bus_addr == 0x50 || bus_addr == 0x51)
-+		return 0xffff;
-+
-+	msgs[0].addr = bus_addr;
-+	msgs[0].flags = 0;
-+	msgs[0].len = 1;
-+	msgs[0].buf = &dev_addr;
-+	msgs[1].addr = bus_addr;
-+	msgs[1].flags = I2C_M_RD;
-+	msgs[1].len = sizeof(data);
-+	msgs[1].buf = data;
-+
-+	ret = i2c_transfer(i2c, msgs, ARRAY_SIZE(msgs));
-+	if (ret != ARRAY_SIZE(msgs))
-+		return 0xffff;
-+
-+	return data[0] << 8 | data[1];
-+}
-+
-+static int i2c_mii_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
-+{
-+	struct i2c_adapter *i2c = bus->priv;
-+	struct i2c_msg msg;
-+	int bus_addr, ret;
-+	u8 data[3];
-+
-+	bus_addr = 0x40 + phy_id;
-+	if (bus_addr == 0x50 || bus_addr == 0x51)
-+		return 0;
-+
-+	data[0] = reg;
-+	data[1] = val >> 8;
-+	data[2] = val;
-+
-+	msg.addr = bus_addr;
-+	msg.flags = 0;
-+	msg.len = 3;
-+	msg.buf = data;
-+
-+	ret = i2c_transfer(i2c, &msg, 1);
-+
-+	return ret < 0 ? ret : 0;
-+}
-+
-+struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c)
-+{
-+	struct mii_bus *mii;
-+
-+	if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
-+		return ERR_PTR(-EINVAL);
-+
-+	mii = mdiobus_alloc();
-+	if (!mii)
-+		return ERR_PTR(-ENOMEM);
-+
-+	snprintf(mii->id, MII_BUS_ID_SIZE, "i2c:%s", dev_name(parent));
-+	mii->parent = parent;
-+	mii->read = i2c_mii_read;
-+	mii->write = i2c_mii_write;
-+	mii->priv = i2c;
-+
-+	return mii;
-+}
-+EXPORT_SYMBOL_GPL(mdio_i2c_alloc);
-+
-+MODULE_AUTHOR("Russell King");
-+MODULE_DESCRIPTION("MDIO I2C bridge library");
-+MODULE_LICENSE("GPL v2");
---- /dev/null
-+++ b/drivers/net/phy/mdio-i2c.h
-@@ -0,0 +1,19 @@
-+/*
-+ * MDIO I2C bridge
-+ *
-+ * Copyright (C) 2015 Russell King
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+#ifndef MDIO_I2C_H
-+#define MDIO_I2C_H
-+
-+struct device;
-+struct i2c_adapter;
-+struct mii_bus;
-+
-+struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c);
-+
-+#endif
diff --git a/target/linux/mvebu/patches-4.4/130-phylink-add-phylink-infrastructure.patch b/target/linux/mvebu/patches-4.4/130-phylink-add-phylink-infrastructure.patch
deleted file mode 100644
index 0d340c8..0000000
--- a/target/linux/mvebu/patches-4.4/130-phylink-add-phylink-infrastructure.patch
+++ /dev/null
@@ -1,1005 +0,0 @@
-From c6de6de7d3df13822872ac756eebe868d236297a Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Tue, 22 Sep 2015 20:52:18 +0100
-Subject: [PATCH 718/744] phylink: add phylink infrastructure
-
-The link between the ethernet MAC and its PHY has become more complex
-as the interface evolves.  This is especially true with serdes links,
-where the part of the PHY is effectively integrated into the MAC.
-
-Serdes links can be connected to a variety of devices, including SFF
-modules soldered down onto the board with the MAC, a SFP cage with
-a hotpluggable SFP module which may contain a PHY or directly modulate
-the serdes signals onto optical media with or without a PHY, or even
-a classical PHY connection.
-
-Moreover, the negotiation information on serdes links comes in two
-varieties - SGMII mode, where the PHY provides its speed/duplex/flow
-control information to the MAC, and 1000base-X mode where both ends
-exchange their abilities and each resolve the link capabilities.
-
-This means we need a more flexible means to support these arrangements,
-particularly with the hotpluggable nature of SFP, where the PHY can
-be attached or detached after the network device has been brought up.
-
-Ethtool information can come from multiple sources:
-- we may have a PHY operating in either SGMII or 1000base-X mode, in
-  which case we take ethtool/mii data directly from the PHY.
-- we may have a optical SFP module without a PHY, with the MAC
-  operating in 1000base-X mode - the ethtool/mii data needs to come
-  from the MAC.
-- we may have a copper SFP module with a PHY whic can't be accessed,
-  which means we need to take ethtool/mii data from the MAC.
-
-Phylink aims to solve this by providing an intermediary between the
-MAC and PHY, providing a safe way for PHYs to be hotplugged, and
-allowing a SFP driver to reconfigure the serdes connection.
-
-Phylink also takes over support of fixed link connections, where
-the speed/duplex/flow control are fixed, but link status may be
-controlled by a GPIO signal.  By avoiding the fixed-phy implementation,
-phylink can provide a faster response to link events: fixed-phy has
-to wait for phylib to operate its state machine, which can take
-several seconds.  In comparison, phylink takes milliseconds.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/Kconfig      |  10 +
- drivers/net/phy/Makefile     |   1 +
- drivers/net/phy/phy_device.c |   1 +
- drivers/net/phy/phylink.c    | 816 +++++++++++++++++++++++++++++++++++++++++++
- include/linux/phy.h          |   2 +
- include/linux/phylink.h      |  70 ++++
- 6 files changed, 900 insertions(+)
- create mode 100644 drivers/net/phy/phylink.c
- create mode 100644 include/linux/phylink.h
-
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -10,6 +10,16 @@ menuconfig PHYLIB
- 	  devices.  This option provides infrastructure for
- 	  managing PHY devices.
- 
-+config PHYLINK
-+	tristate
-+	depends on NETDEVICES
-+	select PHYLIB
-+	select SWPHY
-+	help
-+	  PHYlink models the link between the PHY and MAC, allowing fixed
-+	  configuration links, PHYs, and Serdes links with MAC level
-+	  autonegotiation modes.
-+
- if PHYLIB
- 
- config MDIO_BOARDINFO
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -5,6 +5,7 @@ libphy-$(CONFIG_SWPHY)		+= swphy.o
- 
- obj-$(CONFIG_MDIO_BOARDINFO)	+= mdio-boardinfo.o
- 
-+obj-$(CONFIG_PHYLINK)		+= phylink.o
- obj-$(CONFIG_PHYLIB)		+= libphy.o
- obj-$(CONFIG_SWCONFIG)		+= swconfig.o
- obj-$(CONFIG_AQUANTIA_PHY)	+= aquantia.o
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -754,6 +754,7 @@ void phy_detach(struct phy_device *phyde
- 	phydev->attached_dev->phydev = NULL;
- 	phydev->attached_dev = NULL;
- 	phy_suspend(phydev);
-+	phydev->phylink = NULL;
- 
- 	/* If the device had no specific driver before (i.e. - it
- 	 * was using the generic driver), we unbind the device
---- /dev/null
-+++ b/drivers/net/phy/phylink.c
-@@ -0,0 +1,816 @@
-+/*
-+ * phylink models the MAC to optional PHY connection, supporting
-+ * technologies such as SFP cages where the PHY is hot-pluggable.
-+ *
-+ * Copyright (C) 2015 Russell King
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+#include <linux/ethtool.h>
-+#include <linux/export.h>
-+#include <linux/gpio/consumer.h>
-+#include <linux/netdevice.h>
-+#include <linux/of.h>
-+#include <linux/of_mdio.h>
-+#include <linux/phy.h>
-+#include <linux/phy_fixed.h>
-+#include <linux/phylink.h>
-+#include <linux/spinlock.h>
-+#include <linux/workqueue.h>
-+
-+#include "swphy.h"
-+
-+#define SUPPORTED_INTERFACES \
-+	(SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_FIBRE | \
-+	 SUPPORTED_BNC | SUPPORTED_AUI | SUPPORTED_Backplane)
-+#define ADVERTISED_INTERFACES \
-+	(ADVERTISED_TP | ADVERTISED_MII | ADVERTISED_FIBRE | \
-+	 ADVERTISED_BNC | ADVERTISED_AUI | ADVERTISED_Backplane)
-+
-+enum {
-+	PHYLINK_DISABLE_STOPPED,
-+};
-+
-+struct phylink {
-+	struct net_device *netdev;
-+	const struct phylink_mac_ops *ops;
-+	struct mutex config_mutex;
-+
-+	unsigned long phylink_disable_state; /* bitmask of disables */
-+	struct phy_device *phydev;
-+	phy_interface_t link_interface;	/* PHY_INTERFACE_xxx */
-+	u8 link_an_mode;		/* MLO_AN_xxx */
-+	u8 link_port;			/* The current non-phy ethtool port */
-+	u32 link_port_support;		/* SUPPORTED_xxx ethtool for ports */
-+
-+	/* The link configuration settings */
-+	struct phylink_link_state link_config;
-+	struct gpio_desc *link_gpio;
-+
-+	struct mutex state_mutex;	/* may be taken within config_mutex */
-+	struct phylink_link_state phy_state;
-+	struct work_struct resolve;
-+
-+	bool mac_link_up;
-+};
-+
-+static const char *phylink_an_mode_str(unsigned int mode)
-+{
-+	static const char *modestr[] = {
-+		[MLO_AN_PHY] = "phy",
-+		[MLO_AN_FIXED] = "fixed",
-+		[MLO_AN_SGMII] = "SGMII",
-+		[MLO_AN_8023Z] = "802.3z",
-+	};
-+
-+	return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
-+}
-+
-+static int phylink_parse_fixedlink(struct phylink *pl, struct device_node *np)
-+{
-+	struct device_node *fixed_node;
-+	int ret, len;
-+
-+	fixed_node = of_get_child_by_name(np, "fixed-link");
-+	if (fixed_node) {
-+		struct gpio_desc *desc;
-+		u32 speed;
-+
-+		ret = of_property_read_u32(fixed_node, "speed", &speed);
-+
-+		pl->link_an_mode = MLO_AN_FIXED;
-+		pl->link_config.link = 1;
-+		pl->link_config.an_complete = 1;
-+		pl->link_config.speed = speed;
-+		pl->link_config.duplex = DUPLEX_HALF;
-+		pl->link_config.pause = MLO_PAUSE_NONE;
-+
-+		if (of_property_read_bool(fixed_node, "full-duplex"))
-+			pl->link_config.duplex = DUPLEX_FULL;
-+		if (of_property_read_bool(fixed_node, "pause"))
-+			pl->link_config.pause |= MLO_PAUSE_SYM;
-+		if (of_property_read_bool(fixed_node, "asym-pause"))
-+			pl->link_config.pause |= MLO_PAUSE_ASYM;
-+
-+		if (ret == 0) {
-+			desc = fwnode_get_named_gpiod(&fixed_node->fwnode,
-+						      "link-gpios");
-+
-+			if (!IS_ERR(desc))
-+				pl->link_gpio = desc;
-+			else if (desc == ERR_PTR(-EPROBE_DEFER))
-+				ret = -EPROBE_DEFER;
-+		}
-+		of_node_put(fixed_node);
-+	} else {
-+		const __be32 *fixed_prop;
-+
-+		fixed_prop = of_get_property(np, "fixed-link", &len);
-+		if (fixed_prop && len == 5 * sizeof(*fixed_prop)) {
-+			pl->link_config.duplex = be32_to_cpu(fixed_prop[1]) ?
-+						DUPLEX_FULL : DUPLEX_HALF;
-+			pl->link_config.speed = be32_to_cpu(fixed_prop[2]);
-+			pl->link_config.pause = MLO_PAUSE_NONE;
-+			if (be32_to_cpu(fixed_prop[3]))
-+				pl->link_config.pause |= MLO_PAUSE_SYM;
-+			if (be32_to_cpu(fixed_prop[4]))
-+				pl->link_config.pause |= MLO_PAUSE_ASYM;
-+
-+			pl->link_an_mode = MLO_AN_FIXED;
-+		}
-+		ret = 0;
-+	}
-+
-+	if (pl->link_an_mode == MLO_AN_FIXED) {
-+		/* Generate the supported/advertising masks */
-+		if (pl->link_config.pause & MLO_PAUSE_SYM) {
-+			pl->link_config.supported |= SUPPORTED_Pause;
-+			pl->link_config.advertising |= ADVERTISED_Pause;
-+		}
-+		if (pl->link_config.pause & MLO_PAUSE_ASYM) {
-+			pl->link_config.supported |= SUPPORTED_Asym_Pause;
-+			pl->link_config.advertising |= ADVERTISED_Asym_Pause;
-+		}
-+
-+		if (pl->link_config.speed > SPEED_1000 &&
-+		    pl->link_config.duplex != DUPLEX_FULL)
-+			netdev_warn(pl->netdev, "fixed link specifies half duplex for %dMbps link?\n",
-+				    pl->link_config.speed);
-+
-+#define S(spd) \
-+	pl->link_config.supported |= pl->link_config.duplex ? \
-+		SUPPORTED_##spd##_Full : SUPPORTED_##spd##_Half
-+#define A(spd) \
-+	pl->link_config.advertising |= pl->link_config.duplex ? \
-+		ADVERTISED_##spd##_Full : ADVERTISED_##spd##_Half
-+#define C(spd, tech) \
-+		case spd: \
-+			S(spd##tech); \
-+			A(spd##tech); \
-+			break
-+		switch (pl->link_config.speed) {
-+		C(10, baseT);
-+		C(100, baseT);
-+		C(1000, baseT);
-+#undef S
-+#undef A
-+#define S(spd) pl->link_config.supported |= SUPPORTED_##spd##_Full
-+#define A(spd) pl->link_config.advertising |= ADVERTISED_##spd##_Full
-+		C(2500, baseX);
-+		C(10000, baseT);
-+		}
-+#undef S
-+#undef A
-+#undef C
-+	}
-+	return ret;
-+}
-+
-+static int phylink_parse_managed(struct phylink *pl, struct device_node *np)
-+{
-+	const char *managed;
-+
-+	if (of_property_read_string(np, "managed", &managed) == 0 &&
-+	    strcmp(managed, "in-band-status") == 0) {
-+		if (pl->link_an_mode == MLO_AN_FIXED) {
-+			netdev_err(pl->netdev,
-+				   "can't use both fixed-link and in-band-status\n");
-+			return -EINVAL;
-+		}
-+		pl->link_an_mode = MLO_AN_SGMII;
-+		pl->link_config.an_enabled = true;
-+	}
-+
-+	return 0;
-+}
-+
-+
-+static int phylink_get_support(struct phylink *pl, unsigned int mode)
-+{
-+	struct phylink_link_state state = pl->link_config;
-+	int ret;
-+
-+	ret = pl->ops->mac_get_support(pl->netdev, mode, &state);
-+	if (ret == 0) {
-+		pl->link_an_mode = mode;
-+		pl->link_config = state;
-+	}
-+
-+	return ret;
-+}
-+
-+static void phylink_mac_config(struct phylink *pl,
-+			       const struct phylink_link_state *state)
-+{
-+	pl->ops->mac_config(pl->netdev, pl->link_an_mode, state);
-+}
-+
-+static void phylink_mac_an_restart(struct phylink *pl)
-+{
-+	if (pl->link_config.an_enabled)
-+		pl->ops->mac_an_restart(pl->netdev, pl->link_an_mode);
-+}
-+
-+static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state *state)
-+{
-+	struct net_device *ndev = pl->netdev;
-+
-+	state->supported = pl->link_config.supported;
-+	state->advertising = pl->link_config.advertising;
-+	state->an_enabled = pl->link_config.an_enabled;
-+	state->link = 1;
-+	state->sync = 1;
-+
-+	return pl->ops->mac_link_state(ndev, state);
-+}
-+
-+/* The fixed state is... fixed except for the link state,
-+ * which may be determined by a GPIO.
-+ */
-+static void phylink_get_fixed_state(struct phylink *pl, struct phylink_link_state *state)
-+{
-+	*state = pl->link_config;
-+	if (pl->link_gpio)
-+		state->link = !!gpiod_get_value(pl->link_gpio);
-+}
-+
-+extern const char *phy_speed_to_str(int speed);
-+
-+static void phylink_resolve(struct work_struct *w)
-+{
-+	struct phylink *pl = container_of(w, struct phylink, resolve);
-+	struct phylink_link_state link_state;
-+	struct net_device *ndev = pl->netdev;
-+
-+	mutex_lock(&pl->state_mutex);
-+	if (pl->phylink_disable_state) {
-+		link_state.link = false;
-+	} else {
-+		switch (pl->link_an_mode) {
-+		case MLO_AN_PHY:
-+			link_state = pl->phy_state;
-+			break;
-+
-+		case MLO_AN_FIXED:
-+			phylink_get_fixed_state(pl, &link_state);
-+			break;
-+
-+		case MLO_AN_SGMII:
-+			phylink_get_mac_state(pl, &link_state);
-+			if (pl->phydev)
-+				link_state.link = link_state.link &&
-+						  pl->phy_state.link;
-+			break;
-+
-+		case MLO_AN_8023Z:
-+			phylink_get_mac_state(pl, &link_state);
-+			break;
-+		}
-+	}
-+
-+	if (link_state.link != netif_carrier_ok(ndev)) {
-+		if (!link_state.link) {
-+			netif_carrier_off(ndev);
-+			pl->ops->mac_link_down(ndev, pl->link_an_mode);
-+			netdev_info(ndev, "Link is Down\n");
-+		} else {
-+			/* If we have a PHY, we need the MAC updated with
-+			 * the current link parameters (eg, in SGMII mode,
-+			 * with flow control status.)
-+			 */
-+			if (pl->phydev)
-+				phylink_mac_config(pl, &link_state);
-+
-+			pl->ops->mac_link_up(ndev, pl->link_an_mode);
-+
-+			netif_carrier_on(ndev);
-+
-+			netdev_info(ndev,
-+				    "Link is Up - %s/%s - flow control %s\n",
-+				    phy_speed_to_str(link_state.speed),
-+				    link_state.duplex ? "Full" : "Half",
-+				    link_state.pause ? "rx/tx" : "off");
-+		}
-+	}
-+	mutex_unlock(&pl->state_mutex);
-+}
-+
-+static void phylink_run_resolve(struct phylink *pl)
-+{
-+	if (!pl->phylink_disable_state)
-+		queue_work(system_power_efficient_wq, &pl->resolve);
-+}
-+
-+struct phylink *phylink_create(struct net_device *ndev, struct device_node *np,
-+	phy_interface_t iface, const struct phylink_mac_ops *ops)
-+{
-+	struct phylink *pl;
-+	int ret;
-+
-+	pl = kzalloc(sizeof(*pl), GFP_KERNEL);
-+	if (!pl)
-+		return ERR_PTR(-ENOMEM);
-+
-+	mutex_init(&pl->state_mutex);
-+	mutex_init(&pl->config_mutex);
-+	INIT_WORK(&pl->resolve, phylink_resolve);
-+	pl->netdev = ndev;
-+	pl->link_interface = iface;
-+	pl->link_port_support = SUPPORTED_MII;
-+	pl->link_port = PORT_MII;
-+	pl->ops = ops;
-+	__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
-+
-+	ret = phylink_parse_fixedlink(pl, np);
-+	if (ret < 0) {
-+		kfree(pl);
-+		return ERR_PTR(ret);
-+	}
-+
-+	ret = phylink_parse_managed(pl, np);
-+	if (ret < 0) {
-+		kfree(pl);
-+		return ERR_PTR(ret);
-+	}
-+
-+	ret = phylink_get_support(pl, pl->link_an_mode);
-+	if (ret) {
-+		kfree(pl);
-+		return ERR_PTR(ret);
-+	}
-+
-+	return pl;
-+}
-+EXPORT_SYMBOL_GPL(phylink_create);
-+
-+void phylink_destroy(struct phylink *pl)
-+{
-+	cancel_work_sync(&pl->resolve);
-+	kfree(pl);
-+}
-+EXPORT_SYMBOL_GPL(phylink_destroy);
-+
-+void phylink_phy_change(struct phy_device *phy, bool up, bool do_carrier)
-+{
-+	struct phylink *pl = phy->phylink;
-+
-+	mutex_lock(&pl->state_mutex);
-+	pl->phy_state.speed = phy->speed;
-+	pl->phy_state.duplex = phy->duplex;
-+	pl->phy_state.pause = MLO_PAUSE_NONE;
-+	if (phy->pause)
-+		pl->phy_state.pause |= MLO_PAUSE_SYM;
-+	if (phy->asym_pause)
-+		pl->phy_state.pause |= MLO_PAUSE_ASYM;
-+	pl->phy_state.link = up;
-+	mutex_unlock(&pl->state_mutex);
-+
-+	phylink_run_resolve(pl);
-+
-+	netdev_dbg(pl->netdev, "phy link %s\n", up ? "up" : "down");
-+}
-+
-+static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
-+{
-+	mutex_lock(&pl->config_mutex);
-+	phy->phylink = pl;
-+	phy->phy_link_change = phylink_phy_change;
-+
-+	netdev_info(pl->netdev,
-+		    "PHY [%s] driver [%s]\n", dev_name(&phy->dev),
-+		    phy->drv->name);
-+
-+	mutex_lock(&pl->state_mutex);
-+	pl->phydev = phy;
-+
-+	/* Restrict the phy advertisment to the union of the PHY and
-+	 * MAC-level advert.
-+	 */
-+	phy->advertising &= ADVERTISED_INTERFACES |
-+			    pl->link_config.advertising;
-+	mutex_unlock(&pl->state_mutex);
-+
-+	phy_start_machine(phy);
-+	if (phy->irq > 0)
-+		phy_start_interrupts(phy);
-+
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return 0;
-+}
-+
-+int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
-+{
-+	int ret;
-+
-+	ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);
-+	if (ret)
-+		return ret;
-+
-+	ret = phylink_bringup_phy(pl, phy);
-+	if (ret)
-+		phy_detach(phy);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_connect_phy);
-+
-+int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn)
-+{
-+	struct device_node *phy_node;
-+	struct phy_device *phy_dev;
-+	int ret;
-+
-+	/* Fixed links are handled without needing a PHY */
-+	if (pl->link_an_mode == MLO_AN_FIXED)
-+		return 0;
-+
-+	phy_node = of_parse_phandle(dn, "phy-handle", 0);
-+	if (!phy_node)
-+		phy_node = of_parse_phandle(dn, "phy", 0);
-+	if (!phy_node)
-+		phy_node = of_parse_phandle(dn, "phy-device", 0);
-+
-+	if (!phy_node) {
-+		if (pl->link_an_mode == MLO_AN_PHY) {
-+			netdev_err(pl->netdev, "unable to find PHY node\n");
-+			return -ENODEV;
-+		}
-+		return 0;
-+	}
-+
-+	phy_dev = of_phy_attach(pl->netdev, phy_node, 0, pl->link_interface);
-+	/* We're done with the phy_node handle */
-+	of_node_put(phy_node);
-+
-+	if (!phy_dev)
-+		return -ENODEV;
-+
-+	ret = phylink_bringup_phy(pl, phy_dev);
-+	if (ret)
-+		phy_detach(phy_dev);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_of_phy_connect);
-+
-+void phylink_disconnect_phy(struct phylink *pl)
-+{
-+	struct phy_device *phy;
-+
-+	mutex_lock(&pl->config_mutex);
-+	phy = pl->phydev;
-+
-+	mutex_lock(&pl->state_mutex);
-+	pl->phydev = NULL;
-+	mutex_unlock(&pl->state_mutex);
-+	flush_work(&pl->resolve);
-+
-+	if (phy)
-+		phy_disconnect(phy);
-+
-+	mutex_unlock(&pl->config_mutex);
-+}
-+EXPORT_SYMBOL_GPL(phylink_disconnect_phy);
-+
-+void phylink_mac_change(struct phylink *pl, bool up)
-+{
-+	phylink_run_resolve(pl);
-+	netdev_dbg(pl->netdev, "mac link %s\n", up ? "up" : "down");
-+}
-+EXPORT_SYMBOL_GPL(phylink_mac_change);
-+
-+void phylink_start(struct phylink *pl)
-+{
-+	mutex_lock(&pl->config_mutex);
-+
-+	netdev_info(pl->netdev, "configuring for %s link mode\n",
-+		    phylink_an_mode_str(pl->link_an_mode));
-+
-+	/* Apply the link configuration to the MAC when starting. This allows
-+	 * a fixed-link to start with the correct parameters, and also
-+	 * ensures that we set the appropriate advertisment for Serdes links.
-+	 */
-+	phylink_mac_config(pl, &pl->link_config);
-+
-+	clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
-+	phylink_run_resolve(pl);
-+
-+	if (pl->phydev)
-+		phy_start(pl->phydev);
-+
-+	mutex_unlock(&pl->config_mutex);
-+}
-+EXPORT_SYMBOL_GPL(phylink_start);
-+
-+void phylink_stop(struct phylink *pl)
-+{
-+	mutex_lock(&pl->config_mutex);
-+
-+	if (pl->phydev)
-+		phy_stop(pl->phydev);
-+
-+	set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
-+	flush_work(&pl->resolve);
-+
-+	pl->mac_link_up = false;
-+
-+	mutex_unlock(&pl->config_mutex);
-+}
-+EXPORT_SYMBOL_GPL(phylink_stop);
-+
-+static void phylink_get_ethtool(const struct phylink_link_state *state,
-+				struct ethtool_cmd *cmd)
-+{
-+	cmd->supported &= SUPPORTED_INTERFACES;
-+	cmd->supported |= state->supported;
-+	cmd->advertising &= ADVERTISED_INTERFACES;
-+	cmd->advertising |= state->advertising;
-+	ethtool_cmd_speed_set(cmd, state->speed);
-+	cmd->duplex = state->duplex;
-+
-+	cmd->autoneg = state->an_enabled ? AUTONEG_ENABLE : AUTONEG_DISABLE;
-+}
-+
-+static int phylink_ethtool_gset(struct phylink *pl, struct ethtool_cmd *cmd)
-+{
-+	struct phylink_link_state link_state;
-+	int ret;
-+
-+	if (pl->phydev) {
-+		ret = phy_ethtool_gset(pl->phydev, cmd);
-+		if (ret)
-+			return ret;
-+
-+		cmd->supported &= SUPPORTED_INTERFACES |
-+				  pl->link_config.supported;
-+	} else {
-+		cmd->supported = pl->link_port_support;
-+		cmd->transceiver = XCVR_EXTERNAL;
-+		cmd->port = pl->link_port;
-+	}
-+
-+	switch (pl->link_an_mode) {
-+	case MLO_AN_FIXED:
-+		/* We are using fixed settings. Report these as the
-+		 * current link settings - and note that these also
-+		 * represent the supported speeds/duplex/pause modes.
-+		 */
-+		phylink_get_fixed_state(pl, &link_state);
-+		phylink_get_ethtool(&link_state, cmd);
-+		break;
-+
-+	case MLO_AN_SGMII:
-+		/* If there is a phy attached, then use the reported
-+		 * settings from the phy with no modification.
-+		 */
-+		if (pl->phydev)
-+			break;
-+
-+	case MLO_AN_8023Z:
-+		phylink_get_mac_state(pl, &link_state);
-+
-+		/* The MAC is reporting the link results from its own PCS
-+		 * layer via in-band status. Report these as the current
-+		 * link settings.
-+		 */
-+		phylink_get_ethtool(&link_state, cmd);
-+		break;
-+	}
-+
-+	return 0;
-+}
-+
-+int phylink_ethtool_get_settings(struct phylink *pl, struct ethtool_cmd *cmd)
-+{
-+	int ret;
-+
-+	mutex_lock(&pl->config_mutex);
-+	ret = phylink_ethtool_gset(pl, cmd);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_get_settings);
-+
-+static int phylink_ethtool_sset(struct phylink *pl, struct ethtool_cmd *cmd)
-+{
-+	u32 supported;
-+	int ret;
-+
-+	/* Calculate the union of the MAC support and attached phy support */
-+	supported = pl->link_config.supported;
-+	if (pl->phydev)
-+		supported &= pl->phydev->supported;
-+
-+	/* Mask out unsupported advertisments */
-+	cmd->advertising &= supported;
-+
-+	/* FIXME: should we reject autoneg if phy/mac does not support it? */
-+
-+	if (cmd->autoneg == AUTONEG_DISABLE) {
-+		/* Autonegotiation disabled, validate speed and duplex */
-+		if (cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL)
-+			return -EINVAL;
-+
-+		/* FIXME: validate speed/duplex against supported */
-+
-+		cmd->advertising &= ~ADVERTISED_Autoneg;
-+	} else {
-+		/* Autonegotiation enabled, validate advertisment */
-+		/* FIXME: shouldn't we ensure there's some duplex/speeds set */
-+		if (cmd->advertising == 0)
-+			return -EINVAL;
-+
-+		cmd->advertising |= ADVERTISED_Autoneg;
-+	}
-+
-+	/* If we have a fixed link (as specified by firmware), refuse
-+	 * to enable autonegotiation, or change link parameters.
-+	 */
-+	if (pl->link_an_mode == MLO_AN_FIXED) {
-+		if (cmd->autoneg != AUTONEG_DISABLE ||
-+		    ethtool_cmd_speed(cmd) != pl->link_config.speed ||
-+		    cmd->duplex != pl->link_config.duplex)
-+			return -EINVAL;
-+	}
-+
-+	/* If we have a PHY, configure the phy */
-+	if (pl->phydev) {
-+		ret = phy_ethtool_sset(pl->phydev, cmd);
-+		if (ret)
-+			return ret;
-+	}
-+
-+	mutex_lock(&pl->state_mutex);
-+	/* Configure the MAC to match the new settings */
-+	pl->link_config.advertising = cmd->advertising;
-+	pl->link_config.speed = cmd->speed;
-+	pl->link_config.duplex = cmd->duplex;
-+	pl->link_config.an_enabled = cmd->autoneg != AUTONEG_DISABLE;
-+
-+	phylink_mac_config(pl, &pl->link_config);
-+	phylink_mac_an_restart(pl);
-+	mutex_unlock(&pl->state_mutex);
-+
-+	return ret;
-+}
-+
-+int phylink_ethtool_set_settings(struct phylink *pl, struct ethtool_cmd *cmd)
-+{
-+	int ret;
-+
-+	if (cmd->autoneg != AUTONEG_DISABLE && cmd->autoneg != AUTONEG_ENABLE)
-+		return -EINVAL;
-+
-+	mutex_lock(&pl->config_mutex);
-+	ret = phylink_ethtool_sset(pl, cmd);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_set_settings);
-+
-+/* This emulates MII registers for a fixed-mode phy operating as per the
-+ * passed in state. "aneg" defines if we report negotiation is possible.
-+ *
-+ * FIXME: should deal with negotiation state too.
-+ */
-+static int phylink_mii_emul_read(struct net_device *ndev, unsigned int reg,
-+				 struct phylink_link_state *state, bool aneg)
-+{
-+	struct fixed_phy_status fs;
-+	int val;
-+
-+	fs.link = state->link;
-+	fs.speed = state->speed;
-+	fs.duplex = state->duplex;
-+	fs.pause = state->pause & MLO_PAUSE_SYM;
-+	fs.asym_pause = state->pause & MLO_PAUSE_ASYM;
-+
-+	val = swphy_read_reg(reg, &fs);
-+	if (reg == MII_BMSR) {
-+		if (!state->an_complete)
-+			val &= ~BMSR_ANEGCOMPLETE;
-+		if (!aneg)
-+			val &= ~BMSR_ANEGCAPABLE;
-+	}
-+	return val;
-+}
-+
-+static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
-+			    unsigned int reg)
-+{
-+	struct phylink_link_state state;
-+	int val = 0xffff;
-+
-+	if (pl->phydev && pl->phydev->addr != phy_id)
-+		return mdiobus_read(pl->phydev->bus, phy_id, reg);
-+
-+	if (!pl->phydev && phy_id != 0)
-+		return val;
-+
-+	switch (pl->link_an_mode) {
-+	case MLO_AN_FIXED:
-+		phylink_get_fixed_state(pl, &state);
-+		val = phylink_mii_emul_read(pl->netdev, reg, &state, true);
-+		break;
-+
-+	case MLO_AN_PHY:
-+		val = mdiobus_read(pl->phydev->bus, phy_id, reg);
-+		break;
-+
-+	case MLO_AN_SGMII:
-+		if (pl->phydev) {
-+			val = mdiobus_read(pl->phydev->bus,
-+					   pl->phydev->addr, reg);
-+			break;
-+		}
-+		/* No phy, fall through to reading the MAC end */
-+	case MLO_AN_8023Z:
-+		val = phylink_get_mac_state(pl, &state);
-+		if (val < 0)
-+			return val;
-+
-+		val = phylink_mii_emul_read(pl->netdev, reg, &state, true);
-+		break;
-+	}
-+
-+	return val & 0xffff;
-+}
-+
-+static void phylink_mii_write(struct phylink *pl, unsigned int phy_id,
-+			      unsigned int reg, unsigned int val)
-+{
-+	if (pl->phydev && pl->phydev->addr != phy_id) {
-+		mdiobus_write(pl->phydev->bus, phy_id, reg, val);
-+		return;
-+	}
-+
-+	if (!pl->phydev && phy_id != 0)
-+		return;
-+
-+	switch (pl->link_an_mode) {
-+	case MLO_AN_FIXED:
-+		break;
-+
-+	case MLO_AN_PHY:
-+		mdiobus_write(pl->phydev->bus, pl->phydev->addr,
-+			      reg, val);
-+		break;
-+
-+	case MLO_AN_SGMII:
-+		if (pl->phydev) {
-+			mdiobus_write(pl->phydev->bus, phy_id, reg, val);
-+			break;
-+		}
-+		/* No phy, fall through to reading the MAC end */
-+	case MLO_AN_8023Z:
-+		break;
-+	}
-+}
-+
-+int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
-+{
-+	struct mii_ioctl_data *mii_data = if_mii(ifr);
-+	int val, ret;
-+
-+	mutex_lock(&pl->config_mutex);
-+
-+	switch (cmd) {
-+	case SIOCGMIIPHY:
-+		mii_data->phy_id = pl->phydev ? pl->phydev->addr : 0;
-+		/* fallthrough */
-+
-+	case SIOCGMIIREG:
-+		val = phylink_mii_read(pl, mii_data->phy_id, mii_data->reg_num);
-+		if (val < 0) {
-+			ret = val;
-+		} else {
-+			mii_data->val_out = val;
-+			ret = 0;
-+		}
-+		break;
-+
-+	case SIOCSMIIREG:
-+		phylink_mii_write(pl, mii_data->phy_id, mii_data->reg_num,
-+				  mii_data->val_in);
-+		ret = 0;
-+		break;
-+
-+	default:
-+		ret = -EOPNOTSUPP;
-+		if (pl->phydev)
-+			ret = phy_mii_ioctl(pl->phydev, ifr, cmd);
-+		break;
-+	}
-+
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_mii_ioctl);
-+
-+MODULE_LICENSE("GPL");
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -147,6 +147,7 @@ static inline const char *phy_modes(phy_
- #define MII_ADDR_C45 (1<<30)
- 
- struct device;
-+struct phylink;
- struct sk_buff;
- 
- /*
-@@ -429,6 +430,7 @@ struct phy_device {
- 
- 	struct mutex lock;
- 
-+	struct phylink *phylink;
- 	struct net_device *attached_dev;
- 
- 	u8 mdix;
---- /dev/null
-+++ b/include/linux/phylink.h
-@@ -0,0 +1,70 @@
-+#ifndef NETDEV_PCS_H
-+#define NETDEV_PCS_H
-+
-+#include <linux/phy.h>
-+#include <linux/spinlock.h>
-+#include <linux/workqueue.h>
-+
-+struct device_node;
-+struct ethtool_cmd;
-+struct net_device;
-+
-+enum {
-+	MLO_PAUSE_NONE,
-+	MLO_PAUSE_ASYM = BIT(0),
-+	MLO_PAUSE_SYM = BIT(1),
-+
-+	MLO_AN_PHY = 0,
-+	MLO_AN_FIXED,
-+	MLO_AN_SGMII,
-+	MLO_AN_8023Z,
-+};
-+
-+struct phylink_link_state {
-+	u32 supported;
-+	u32 advertising;
-+	u32 lp_advertising;
-+	int speed;
-+	int duplex;
-+	int pause;
-+	unsigned int link:1;
-+	unsigned int sync:1;
-+	unsigned int an_enabled:1;
-+	unsigned int an_complete:1;
-+};
-+
-+struct phylink_mac_ops {
-+	/* Get the ethtool supported mask for the indicated mode */
-+	int (*mac_get_support)(struct net_device *, unsigned int mode,
-+			       struct phylink_link_state *);
-+
-+	/* Read the current link state from the hardware */
-+	int (*mac_link_state)(struct net_device *, struct phylink_link_state *);
-+
-+	/* Configure the MAC */
-+	void (*mac_config)(struct net_device *, unsigned int mode,
-+			   const struct phylink_link_state *);
-+	void (*mac_an_restart)(struct net_device *, unsigned int mode);
-+
-+	void (*mac_link_down)(struct net_device *, unsigned int mode);
-+	void (*mac_link_up)(struct net_device *, unsigned int mode);
-+};
-+
-+struct phylink *phylink_create(struct net_device *, struct device_node *,
-+	phy_interface_t iface, const struct phylink_mac_ops *ops);
-+void phylink_destroy(struct phylink *);
-+
-+int phylink_connect_phy(struct phylink *, struct phy_device *);
-+int phylink_of_phy_connect(struct phylink *, struct device_node *);
-+void phylink_disconnect_phy(struct phylink *);
-+
-+void phylink_mac_change(struct phylink *, bool up);
-+
-+void phylink_start(struct phylink *);
-+void phylink_stop(struct phylink *);
-+
-+int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
-+int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
-+int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
-+
-+#endif
diff --git a/target/linux/mvebu/patches-4.4/131-phylink-add-hooks-for-SFP-support.patch b/target/linux/mvebu/patches-4.4/131-phylink-add-hooks-for-SFP-support.patch
deleted file mode 100644
index 64a1c1f..0000000
--- a/target/linux/mvebu/patches-4.4/131-phylink-add-hooks-for-SFP-support.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-From 0a0c4b3dd4f34df4532f254a5940b520015d766f Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 24 Sep 2015 11:01:13 +0100
-Subject: [PATCH 719/744] phylink: add hooks for SFP support
-
-Add support to phylink for SFP, which needs to control and configure
-the ethernet MAC link state.  Specifically, SFP needs to:
-
-1. set the negotiation mode between SGMII and 1000base-X
-2. attach and detach the module PHY
-3. prevent the link coming up when errors are reported
-
-In the absence of a PHY, we also need to set the ethtool port type
-according to the module plugged in.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phylink.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++
- include/linux/phylink.h   |  6 ++++
- 2 files changed, 88 insertions(+)
-
---- a/drivers/net/phy/phylink.c
-+++ b/drivers/net/phy/phylink.c
-@@ -11,6 +11,7 @@
- #include <linux/ethtool.h>
- #include <linux/export.h>
- #include <linux/gpio/consumer.h>
-+#include <linux/list.h>
- #include <linux/netdevice.h>
- #include <linux/of.h>
- #include <linux/of_mdio.h>
-@@ -29,11 +30,16 @@
- 	(ADVERTISED_TP | ADVERTISED_MII | ADVERTISED_FIBRE | \
- 	 ADVERTISED_BNC | ADVERTISED_AUI | ADVERTISED_Backplane)
- 
-+static LIST_HEAD(phylinks);
-+static DEFINE_MUTEX(phylink_mutex);
-+
- enum {
- 	PHYLINK_DISABLE_STOPPED,
-+	PHYLINK_DISABLE_LINK,
- };
- 
- struct phylink {
-+	struct list_head node;
- 	struct net_device *netdev;
- 	const struct phylink_mac_ops *ops;
- 	struct mutex config_mutex;
-@@ -341,12 +347,20 @@ struct phylink *phylink_create(struct ne
- 		return ERR_PTR(ret);
- 	}
- 
-+	mutex_lock(&phylink_mutex);
-+	list_add_tail(&pl->node, &phylinks);
-+	mutex_unlock(&phylink_mutex);
-+
- 	return pl;
- }
- EXPORT_SYMBOL_GPL(phylink_create);
- 
- void phylink_destroy(struct phylink *pl)
- {
-+	mutex_lock(&phylink_mutex);
-+	list_del(&pl->node);
-+	mutex_unlock(&phylink_mutex);
-+
- 	cancel_work_sync(&pl->resolve);
- 	kfree(pl);
- }
-@@ -813,4 +827,72 @@ int phylink_mii_ioctl(struct phylink *pl
- }
- EXPORT_SYMBOL_GPL(phylink_mii_ioctl);
- 
-+
-+
-+void phylink_disable(struct phylink *pl)
-+{
-+	set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
-+	flush_work(&pl->resolve);
-+
-+	netif_carrier_off(pl->netdev);
-+}
-+EXPORT_SYMBOL_GPL(phylink_disable);
-+
-+void phylink_enable(struct phylink *pl)
-+{
-+	clear_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
-+	phylink_run_resolve(pl);
-+}
-+EXPORT_SYMBOL_GPL(phylink_enable);
-+
-+void phylink_set_link_port(struct phylink *pl, u32 support, u8 port)
-+{
-+	WARN_ON(support & ~SUPPORTED_INTERFACES);
-+
-+	mutex_lock(&pl->config_mutex);
-+	pl->link_port_support = support;
-+	pl->link_port = port;
-+	mutex_unlock(&pl->config_mutex);
-+}
-+EXPORT_SYMBOL_GPL(phylink_set_link_port);
-+
-+int phylink_set_link_an_mode(struct phylink *pl, unsigned int mode)
-+{
-+	int ret = 0;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->link_an_mode != mode) {
-+		ret = phylink_get_support(pl, mode);
-+		if (ret == 0) {
-+			if (!test_bit(PHYLINK_DISABLE_STOPPED,
-+				      &pl->phylink_disable_state))
-+				phylink_mac_config(pl, &pl->link_config);
-+
-+			netdev_info(pl->netdev, "switched to %s link mode\n",
-+				    phylink_an_mode_str(mode));
-+		}
-+	}
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_set_link_an_mode);
-+
-+struct phylink *phylink_lookup_by_netdev(struct net_device *ndev)
-+{
-+	struct phylink *pl, *found = NULL;
-+
-+	mutex_lock(&phylink_mutex);
-+	list_for_each_entry(pl, &phylinks, node)
-+		if (pl->netdev == ndev) {
-+			found = pl;
-+			break;
-+		}
-+
-+	mutex_unlock(&phylink_mutex);
-+
-+	return found;
-+}
-+EXPORT_SYMBOL_GPL(phylink_lookup_by_netdev);
-+
- MODULE_LICENSE("GPL");
---- a/include/linux/phylink.h
-+++ b/include/linux/phylink.h
-@@ -67,4 +67,10 @@ int phylink_ethtool_get_settings(struct
- int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
- int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
- 
-+void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
-+int phylink_set_link_an_mode(struct phylink *pl, unsigned int mode);
-+void phylink_disable(struct phylink *pl);
-+void phylink_enable(struct phylink *pl);
-+struct phylink *phylink_lookup_by_netdev(struct net_device *ndev);
-+
- #endif
diff --git a/target/linux/mvebu/patches-4.4/132-sfp-add-phylink-based-SFP-module-support.patch b/target/linux/mvebu/patches-4.4/132-sfp-add-phylink-based-SFP-module-support.patch
deleted file mode 100644
index 07b1766..0000000
--- a/target/linux/mvebu/patches-4.4/132-sfp-add-phylink-based-SFP-module-support.patch
+++ /dev/null
@@ -1,1382 +0,0 @@
-From bf0a000960234c0e773fadea47240c3cda0cab02 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sat, 12 Sep 2015 18:43:39 +0100
-Subject: [PATCH 720/744] sfp: add phylink based SFP module support
-
-Add support for SFP hotpluggable modules via phylink.  This supports
-both copper and optical SFP modules, which require different Serdes
-modes in order to properly negotiate the link.
-
-Optical SFP modules typically require the Serdes link to be talking
-1000base-X mode - this is the gigabit ethernet mode defined by the
-802.3 standard.
-
-Copper SFP modules typically integrate a PHY in the module to convert
-from Serdes to copper, and the PHY will be configured by the vendor
-to either present a 1000base-X Serdes link (for fixed 1000base-T) or
-a SGMII Serdes link.  However, this is vendor defined, so we instead
-detect the PHY, switch the link to SGMII mode, and use traditional
-PHY based negotiation.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/Kconfig  |   5 +
- drivers/net/phy/Makefile |   1 +
- drivers/net/phy/sfp.c    | 986 +++++++++++++++++++++++++++++++++++++++++++++++
- include/linux/sfp.h      | 339 ++++++++++++++++
- 4 files changed, 1331 insertions(+)
- create mode 100644 drivers/net/phy/sfp.c
- create mode 100644 include/linux/sfp.h
-
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -225,6 +225,11 @@ config FIXED_PHY
- 
- 	  Currently tested with mpc866ads and mpc8349e-mitx.
- 
-+config SFP
-+	tristate "SFP cage support"
-+	depends on I2C && PHYLINK
-+	select MDIO_I2C
-+
- config MDIO_BITBANG
- 	tristate "Support for bitbanged MDIO buses"
- 	help
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -61,3 +61,4 @@ obj-$(CONFIG_MDIO_MOXART)	+= mdio-moxart
- obj-$(CONFIG_MDIO_BCM_UNIMAC)	+= mdio-bcm-unimac.o
- obj-$(CONFIG_MICROCHIP_PHY)	+= microchip.o
- obj-$(CONFIG_MDIO_BCM_IPROC)	+= mdio-bcm-iproc.o
-+obj-$(CONFIG_SFP)		+= sfp.o
---- /dev/null
-+++ b/drivers/net/phy/sfp.c
-@@ -0,0 +1,986 @@
-+#include <linux/delay.h>
-+#include <linux/gpio.h>
-+#include <linux/i2c.h>
-+#include <linux/interrupt.h>
-+#include <linux/jiffies.h>
-+#include <linux/module.h>
-+#include <linux/mutex.h>
-+#include <linux/netdevice.h>
-+#include <linux/of.h>
-+#include <linux/of_net.h>
-+#include <linux/phylink.h>
-+#include <linux/platform_device.h>
-+#include <linux/sfp.h>
-+#include <linux/slab.h>
-+#include <linux/workqueue.h>
-+
-+#include "mdio-i2c.h"
-+#include "swphy.h"
-+
-+enum {
-+	GPIO_MODDEF0,
-+	GPIO_LOS,
-+	GPIO_TX_FAULT,
-+	GPIO_TX_DISABLE,
-+	GPIO_RATE_SELECT,
-+	GPIO_MAX,
-+
-+	SFP_F_PRESENT = BIT(GPIO_MODDEF0),
-+	SFP_F_LOS = BIT(GPIO_LOS),
-+	SFP_F_TX_FAULT = BIT(GPIO_TX_FAULT),
-+	SFP_F_TX_DISABLE = BIT(GPIO_TX_DISABLE),
-+	SFP_F_RATE_SELECT = BIT(GPIO_RATE_SELECT),
-+
-+	SFP_E_INSERT = 0,
-+	SFP_E_REMOVE,
-+	SFP_E_DEV_DOWN,
-+	SFP_E_DEV_UP,
-+	SFP_E_TX_FAULT,
-+	SFP_E_TX_CLEAR,
-+	SFP_E_LOS_HIGH,
-+	SFP_E_LOS_LOW,
-+	SFP_E_TIMEOUT,
-+
-+	SFP_MOD_EMPTY = 0,
-+	SFP_MOD_PROBE,
-+	SFP_MOD_PRESENT,
-+	SFP_MOD_ERROR,
-+
-+	SFP_DEV_DOWN = 0,
-+	SFP_DEV_UP,
-+
-+	SFP_S_DOWN = 0,
-+	SFP_S_INIT,
-+	SFP_S_WAIT_LOS,
-+	SFP_S_LINK_UP,
-+	SFP_S_TX_FAULT,
-+	SFP_S_REINIT,
-+	SFP_S_TX_DISABLE,
-+};
-+
-+static const char *gpio_of_names[] = {
-+	"moddef0",
-+	"los",
-+	"tx-fault",
-+	"tx-disable",
-+	"rate-select",
-+};
-+
-+static const enum gpiod_flags gpio_flags[] = {
-+	GPIOD_IN,
-+	GPIOD_IN,
-+	GPIOD_IN,
-+	GPIOD_ASIS,
-+	GPIOD_ASIS,
-+};
-+
-+#define T_INIT_JIFFIES	msecs_to_jiffies(300)
-+#define T_RESET_US	10
-+#define T_FAULT_RECOVER	msecs_to_jiffies(1000)
-+
-+/* SFP module presence detection is poor: the three MOD DEF signals are
-+ * the same length on the PCB, which means it's possible for MOD DEF 0 to
-+ * connect before the I2C bus on MOD DEF 1/2.  Try to work around this
-+ * design bug by waiting 50ms before probing, and then retry every 250ms.
-+ */
-+#define T_PROBE_INIT	msecs_to_jiffies(50)
-+#define T_PROBE_RETRY	msecs_to_jiffies(250)
-+
-+/*
-+ * SFP modules appear to always have their PHY configured for bus address
-+ * 0x56 (which with mdio-i2c, translates to a PHY address of 22).
-+ */
-+#define SFP_PHY_ADDR	22
-+
-+/*
-+ * Give this long for the PHY to reset.
-+ */
-+#define T_PHY_RESET_MS	50
-+
-+static DEFINE_MUTEX(sfp_mutex);
-+
-+struct sfp {
-+	struct device *dev;
-+	struct i2c_adapter *i2c;
-+	struct mii_bus *i2c_mii;
-+	struct net_device *ndev;
-+	struct phylink *phylink;
-+	struct phy_device *mod_phy;
-+
-+	unsigned int (*get_state)(struct sfp *);
-+	void (*set_state)(struct sfp *, unsigned int);
-+	int (*read)(struct sfp *, bool, u8, void *, size_t);
-+
-+	struct gpio_desc *gpio[GPIO_MAX];
-+
-+	unsigned int state;
-+	struct delayed_work poll;
-+	struct delayed_work timeout;
-+	struct mutex sm_mutex;
-+	unsigned char sm_mod_state;
-+	unsigned char sm_dev_state;
-+	unsigned short sm_state;
-+	unsigned int sm_retries;
-+
-+	struct sfp_eeprom_id id;
-+
-+	struct notifier_block netdev_nb;
-+};
-+
-+static unsigned long poll_jiffies;
-+
-+static unsigned int sfp_gpio_get_state(struct sfp *sfp)
-+{
-+	unsigned int i, state, v;
-+
-+	for (i = state = 0; i < GPIO_MAX; i++) {
-+		if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
-+			continue;
-+
-+		v = gpiod_get_value_cansleep(sfp->gpio[i]);
-+		if (v)
-+			state |= BIT(i);
-+	}
-+
-+	return state;
-+}
-+
-+static void sfp_gpio_set_state(struct sfp *sfp, unsigned int state)
-+{
-+	if (state & SFP_F_PRESENT) {
-+		/* If the module is present, drive the signals */
-+		if (sfp->gpio[GPIO_TX_DISABLE])
-+			gpiod_direction_output(sfp->gpio[GPIO_TX_DISABLE],
-+						state & SFP_F_TX_DISABLE);
-+		if (state & SFP_F_RATE_SELECT)
-+			gpiod_direction_output(sfp->gpio[GPIO_RATE_SELECT],
-+						state & SFP_F_RATE_SELECT);
-+	} else {
-+		/* Otherwise, let them float to the pull-ups */
-+		if (sfp->gpio[GPIO_TX_DISABLE])
-+			gpiod_direction_input(sfp->gpio[GPIO_TX_DISABLE]);
-+		if (state & SFP_F_RATE_SELECT)
-+			gpiod_direction_input(sfp->gpio[GPIO_RATE_SELECT]);
-+	}
-+}
-+
-+static int sfp__i2c_read(struct i2c_adapter *i2c, u8 bus_addr, u8 dev_addr,
-+	void *buf, size_t len)
-+{
-+	struct i2c_msg msgs[2];
-+	int ret;
-+
-+	msgs[0].addr = bus_addr;
-+	msgs[0].flags = 0;
-+	msgs[0].len = 1;
-+	msgs[0].buf = &dev_addr;
-+	msgs[1].addr = bus_addr;
-+	msgs[1].flags = I2C_M_RD;
-+	msgs[1].len = len;
-+	msgs[1].buf = buf;
-+
-+	ret = i2c_transfer(i2c, msgs, ARRAY_SIZE(msgs));
-+	if (ret < 0)
-+		return ret;
-+
-+	return ret == ARRAY_SIZE(msgs) ? len : 0;
-+}
-+
-+static int sfp_i2c_read(struct sfp *sfp, bool a2, u8 addr, void *buf,
-+	size_t len)
-+{
-+	return sfp__i2c_read(sfp->i2c, a2 ? 0x51 : 0x50, addr, buf, len);
-+}
-+
-+static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
-+{
-+	struct mii_bus *i2c_mii;
-+	int ret;
-+
-+	if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
-+		return -EINVAL;
-+
-+	sfp->i2c = i2c;
-+	sfp->read = sfp_i2c_read;
-+
-+	i2c_mii = mdio_i2c_alloc(sfp->dev, i2c);
-+	if (IS_ERR(i2c_mii))
-+		return PTR_ERR(i2c_mii);
-+
-+	i2c_mii->name = "SFP I2C Bus";
-+	i2c_mii->phy_mask = ~0;
-+
-+	ret = mdiobus_register(i2c_mii);
-+	if (ret < 0) {
-+		mdiobus_free(i2c_mii);
-+		return ret;
-+	}
-+
-+	sfp->i2c_mii = i2c_mii;
-+
-+	return 0;
-+}
-+
-+
-+/* Interface */
-+static unsigned int sfp_get_state(struct sfp *sfp)
-+{
-+	return sfp->get_state(sfp);
-+}
-+
-+static void sfp_set_state(struct sfp *sfp, unsigned int state)
-+{
-+	sfp->set_state(sfp, state);
-+}
-+
-+static int sfp_read(struct sfp *sfp, bool a2, u8 addr, void *buf, size_t len)
-+{
-+	return sfp->read(sfp, a2, addr, buf, len);
-+}
-+
-+static unsigned int sfp_check(void *buf, size_t len)
-+{
-+	u8 *p, check;
-+
-+	for (p = buf, check = 0; len; p++, len--)
-+		check += *p;
-+
-+	return check;
-+}
-+
-+/* Helpers */
-+static void sfp_module_tx_disable(struct sfp *sfp)
-+{
-+	dev_dbg(sfp->dev, "tx disable %u -> %u\n",
-+		sfp->state & SFP_F_TX_DISABLE ? 1 : 0, 1);
-+	sfp->state |= SFP_F_TX_DISABLE;
-+	sfp_set_state(sfp, sfp->state);
-+}
-+
-+static void sfp_module_tx_enable(struct sfp *sfp)
-+{
-+	dev_dbg(sfp->dev, "tx disable %u -> %u\n",
-+		sfp->state & SFP_F_TX_DISABLE ? 1 : 0, 0);
-+	sfp->state &= ~SFP_F_TX_DISABLE;
-+	sfp_set_state(sfp, sfp->state);
-+}
-+
-+static void sfp_module_tx_fault_reset(struct sfp *sfp)
-+{
-+	unsigned int state = sfp->state;
-+
-+	if (state & SFP_F_TX_DISABLE)
-+		return;
-+
-+	sfp_set_state(sfp, state | SFP_F_TX_DISABLE);
-+
-+	udelay(T_RESET_US);
-+
-+	sfp_set_state(sfp, state);
-+}
-+
-+/* SFP state machine */
-+static void sfp_sm_set_timer(struct sfp *sfp, unsigned int timeout)
-+{
-+	if (timeout)
-+		mod_delayed_work(system_power_efficient_wq, &sfp->timeout,
-+				 timeout);
-+	else
-+		cancel_delayed_work(&sfp->timeout);
-+}
-+
-+static void sfp_sm_next(struct sfp *sfp, unsigned int state,
-+			unsigned int timeout)
-+{
-+	sfp->sm_state = state;
-+	sfp_sm_set_timer(sfp, timeout);
-+}
-+
-+static void sfp_sm_ins_next(struct sfp *sfp, unsigned int state, unsigned int timeout)
-+{
-+	sfp->sm_mod_state = state;
-+	sfp_sm_set_timer(sfp, timeout);
-+}
-+
-+static void sfp_sm_phy_detach(struct sfp *sfp)
-+{
-+	phy_stop(sfp->mod_phy);
-+	if (sfp->phylink)
-+		phylink_disconnect_phy(sfp->phylink);
-+	phy_device_remove(sfp->mod_phy);
-+	phy_device_free(sfp->mod_phy);
-+	sfp->mod_phy = NULL;
-+}
-+
-+static void sfp_sm_probe_phy(struct sfp *sfp)
-+{
-+	struct phy_device *phy;
-+	int err;
-+
-+	msleep(T_PHY_RESET_MS);
-+
-+	phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
-+	if (IS_ERR(phy)) {
-+		dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
-+		return;
-+	}
-+	if (!phy) {
-+		dev_info(sfp->dev, "no PHY detected\n");
-+		return;
-+	}
-+
-+	err = phylink_connect_phy(sfp->phylink, phy);
-+	if (err) {
-+		phy_device_remove(phy);
-+		phy_device_free(phy);
-+		dev_err(sfp->dev, "phylink_connect_phy failed: %d\n", err);
-+		return;
-+	}
-+
-+	sfp->mod_phy = phy;
-+	phy_start(phy);
-+}
-+
-+static void sfp_sm_link_up(struct sfp *sfp)
-+{
-+	if (sfp->phylink)
-+		phylink_enable(sfp->phylink);
-+
-+	sfp_sm_next(sfp, SFP_S_LINK_UP, 0);
-+}
-+
-+static void sfp_sm_link_down(struct sfp *sfp)
-+{
-+	if (sfp->phylink)
-+		phylink_disable(sfp->phylink);
-+}
-+
-+static void sfp_sm_link_check_los(struct sfp *sfp)
-+{
-+	unsigned int los = sfp->state & SFP_F_LOS;
-+
-+	/* FIXME: what if neither SFP_OPTIONS_LOS_INVERTED nor
-+	 * SFP_OPTIONS_LOS_NORMAL are set?  For now, we assume
-+	 * the same as SFP_OPTIONS_LOS_NORMAL set.
-+	 */
-+	if (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED)
-+		los ^= SFP_F_LOS;
-+
-+	if (los)
-+		sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
-+	else
-+		sfp_sm_link_up(sfp);
-+}
-+
-+static void sfp_sm_fault(struct sfp *sfp, bool warn)
-+{
-+	if (sfp->sm_retries && !--sfp->sm_retries) {
-+		dev_err(sfp->dev, "module persistently indicates fault, disabling\n");
-+		sfp_sm_next(sfp, SFP_S_TX_DISABLE, 0);
-+	} else {
-+		if (warn)
-+			dev_err(sfp->dev, "module transmit fault indicated\n");
-+
-+		sfp_sm_next(sfp, SFP_S_TX_FAULT, T_FAULT_RECOVER);
-+	}
-+}
-+
-+static void sfp_sm_mod_init(struct sfp *sfp)
-+{
-+	sfp_module_tx_enable(sfp);
-+
-+	/* Wait t_init before indicating that the link is up, provided the
-+	 * current state indicates no TX_FAULT.  If TX_FAULT clears before
-+	 * this time, that's fine too.
-+	 */
-+	sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
-+	sfp->sm_retries = 5;
-+
-+	if (sfp->phylink) {
-+		/* Setting the serdes link mode is guesswork: there's no
-+		 * field in the EEPROM which indicates what mode should
-+		 * be used.
-+		 *
-+		 * If it's a gigabit-only fiber module, it probably does
-+		 * not have a PHY, so switch to 802.3z negotiation mode.
-+		 * Otherwise, switch to SGMII mode (which is required to
-+		 * support non-gigabit speeds) and probe for a PHY.
-+		 */
-+		if (!sfp->id.base.e1000_base_t &&
-+		    !sfp->id.base.e100_base_lx &&
-+		    !sfp->id.base.e100_base_fx) {
-+			phylink_set_link_an_mode(sfp->phylink, MLO_AN_8023Z);
-+		} else {
-+			phylink_set_link_an_mode(sfp->phylink, MLO_AN_SGMII);
-+			sfp_sm_probe_phy(sfp);
-+		}
-+	}
-+}
-+
-+static int sfp_sm_mod_probe(struct sfp *sfp)
-+{
-+	/* SFP module inserted - read I2C data */
-+	struct sfp_eeprom_id id;
-+	char vendor[17];
-+	char part[17];
-+	char sn[17];
-+	char date[9];
-+	char rev[5];
-+	u8 check;
-+	int err;
-+
-+	err = sfp_read(sfp, false, 0, &id, sizeof(id));
-+	if (err < 0) {
-+		dev_err(sfp->dev, "failed to read EEPROM: %d\n", err);
-+		return -EAGAIN;
-+	}
-+
-+	/* Validate the checksum over the base structure */
-+	check = sfp_check(&id.base, sizeof(id.base) - 1);
-+	if (check != id.base.cc_base) {
-+		dev_err(sfp->dev,
-+			"EEPROM base structure checksum failure: 0x%02x\n",
-+			check);
-+		return -EINVAL;
-+	}
-+
-+	check = sfp_check(&id.ext, sizeof(id.ext) - 1);
-+	if (check != id.ext.cc_ext) {
-+		dev_err(sfp->dev,
-+			"EEPROM extended structure checksum failure: 0x%02x\n",
-+			check);
-+		memset(&id.ext, 0, sizeof(id.ext));
-+	}
-+
-+	sfp->id = id;
-+
-+	memcpy(vendor, sfp->id.base.vendor_name, 16);
-+	vendor[16] = '\0';
-+	memcpy(part, sfp->id.base.vendor_pn, 16);
-+	part[16] = '\0';
-+	memcpy(rev, sfp->id.base.vendor_rev, 4);
-+	rev[4] = '\0';
-+	memcpy(sn, sfp->id.ext.vendor_sn, 16);
-+	sn[16] = '\0';
-+	memcpy(date, sfp->id.ext.datecode, 8);
-+	date[8] = '\0';
-+
-+	dev_info(sfp->dev, "module %s %s rev %s sn %s dc %s\n", vendor, part, rev, sn, date);
-+
-+	/* We only support SFP modules, not the legacy GBIC modules. */
-+	if (sfp->id.base.phys_id != SFP_PHYS_ID_SFP ||
-+	    sfp->id.base.phys_ext_id != SFP_PHYS_EXT_ID_SFP) {
-+		dev_err(sfp->dev, "module is not SFP - phys id 0x%02x 0x%02x\n",
-+			sfp->id.base.phys_id, sfp->id.base.phys_ext_id);
-+		return -EINVAL;
-+	}
-+
-+	/*
-+	 * What isn't clear from the SFP documentation is whether this
-+	 * specifies the encoding expected on the TD/RD lines, or whether
-+	 * the TD/RD lines are always 8b10b encoded, but the transceiver
-+	 * converts.  Eg, think of a copper SFP supporting 1G/100M/10M
-+	 * ethernet: this requires 8b10b encoding for 1G, 4b5b for 100M,
-+	 * and manchester for 10M.
-+	 */
-+	/* 1Gbit ethernet requires 8b10b encoding */
-+	if (sfp->id.base.encoding != SFP_ENCODING_8B10B) {
-+		dev_err(sfp->dev, "module does not support 8B10B encoding\n");
-+		return -EINVAL;
-+	}
-+
-+	if (sfp->phylink) {
-+		u32 support;
-+		u8 port;
-+
-+		if (sfp->id.base.e1000_base_t) {
-+			support = SUPPORTED_TP;
-+			port = PORT_TP;
-+		} else {
-+			support = SUPPORTED_FIBRE;
-+			port = PORT_FIBRE;
-+		}
-+		phylink_set_link_port(sfp->phylink, support, port);
-+	}
-+
-+	return 0;
-+}
-+
-+static void sfp_sm_mod_remove(struct sfp *sfp)
-+{
-+	if (sfp->mod_phy)
-+		sfp_sm_phy_detach(sfp);
-+
-+	sfp_module_tx_disable(sfp);
-+
-+	memset(&sfp->id, 0, sizeof(sfp->id));
-+
-+	dev_info(sfp->dev, "module removed\n");
-+}
-+
-+static void sfp_sm_event(struct sfp *sfp, unsigned int event)
-+{
-+	mutex_lock(&sfp->sm_mutex);
-+
-+	dev_dbg(sfp->dev, "SM: enter %u:%u:%u event %u\n",
-+		sfp->sm_mod_state, sfp->sm_dev_state, sfp->sm_state, event);
-+
-+	/* This state machine tracks the insert/remove state of
-+	 * the module, and handles probing the on-board EEPROM.
-+	 */
-+	switch (sfp->sm_mod_state) {
-+	default:
-+		if (event == SFP_E_INSERT) {
-+			sfp_module_tx_disable(sfp);
-+			sfp_sm_ins_next(sfp, SFP_MOD_PROBE, T_PROBE_INIT);
-+		}
-+		break;
-+
-+	case SFP_MOD_PROBE:
-+		if (event == SFP_E_REMOVE) {
-+			sfp_sm_ins_next(sfp, SFP_MOD_EMPTY, 0);
-+		} else if (event == SFP_E_TIMEOUT) {
-+			int err = sfp_sm_mod_probe(sfp);
-+
-+			if (err == 0)
-+				sfp_sm_ins_next(sfp, SFP_MOD_PRESENT, 0);
-+			else if (err == -EAGAIN)
-+				sfp_sm_set_timer(sfp, T_PROBE_RETRY);
-+			else
-+				sfp_sm_ins_next(sfp, SFP_MOD_ERROR, 0);
-+		}
-+		break;
-+
-+	case SFP_MOD_PRESENT:
-+	case SFP_MOD_ERROR:
-+		if (event == SFP_E_REMOVE) {
-+			sfp_sm_mod_remove(sfp);
-+			sfp_sm_ins_next(sfp, SFP_MOD_EMPTY, 0);
-+		}
-+		break;
-+	}
-+
-+	/* This state machine tracks the netdev up/down state */
-+	switch (sfp->sm_dev_state) {
-+	default:
-+		if (event == SFP_E_DEV_UP)
-+			sfp->sm_dev_state = SFP_DEV_UP;
-+		break;
-+
-+	case SFP_DEV_UP:
-+		if (event == SFP_E_DEV_DOWN) {
-+			/* If the module has a PHY, avoid raising TX disable
-+			 * as this resets the PHY. Otherwise, raise it to
-+			 * turn the laser off.
-+			 */
-+			if (!sfp->mod_phy)
-+				sfp_module_tx_disable(sfp);
-+			sfp->sm_dev_state = SFP_DEV_DOWN;
-+		}
-+		break;
-+	}
-+
-+	/* Some events are global */
-+	if (sfp->sm_state != SFP_S_DOWN &&
-+	    (sfp->sm_mod_state != SFP_MOD_PRESENT ||
-+	     sfp->sm_dev_state != SFP_DEV_UP)) {
-+		if (sfp->sm_state == SFP_S_LINK_UP &&
-+		    sfp->sm_dev_state == SFP_DEV_UP)
-+			sfp_sm_link_down(sfp);
-+		if (sfp->mod_phy)
-+			sfp_sm_phy_detach(sfp);
-+		sfp_sm_next(sfp, SFP_S_DOWN, 0);
-+		mutex_unlock(&sfp->sm_mutex);
-+		return;
-+	}
-+
-+	/* The main state machine */
-+	switch (sfp->sm_state) {
-+	case SFP_S_DOWN:
-+		if (sfp->sm_mod_state == SFP_MOD_PRESENT &&
-+		    sfp->sm_dev_state == SFP_DEV_UP)
-+			sfp_sm_mod_init(sfp);
-+		break;
-+
-+	case SFP_S_INIT:
-+		if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT)
-+			sfp_sm_fault(sfp, true);
-+		else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR)
-+			sfp_sm_link_check_los(sfp);
-+		break;
-+
-+	case SFP_S_WAIT_LOS:
-+		if (event == SFP_E_TX_FAULT)
-+			sfp_sm_fault(sfp, true);
-+		else if (event ==
-+			 (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
-+			  SFP_E_LOS_HIGH : SFP_E_LOS_LOW))
-+			sfp_sm_link_up(sfp);
-+		break;
-+
-+	case SFP_S_LINK_UP:
-+		if (event == SFP_E_TX_FAULT) {
-+			sfp_sm_link_down(sfp);
-+			sfp_sm_fault(sfp, true);
-+		} else if (event ==
-+			   (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
-+			    SFP_E_LOS_LOW : SFP_E_LOS_HIGH)) {
-+			sfp_sm_link_down(sfp);
-+			sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
-+		}
-+		break;
-+
-+	case SFP_S_TX_FAULT:
-+		if (event == SFP_E_TIMEOUT) {
-+			sfp_module_tx_fault_reset(sfp);
-+			sfp_sm_next(sfp, SFP_S_REINIT, T_INIT_JIFFIES);
-+		}
-+		break;
-+
-+	case SFP_S_REINIT:
-+		if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) {
-+			sfp_sm_fault(sfp, false);
-+		} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
-+			dev_info(sfp->dev, "module transmit fault recovered\n");
-+			sfp_sm_link_check_los(sfp);
-+		}
-+		break;
-+
-+	case SFP_S_TX_DISABLE:
-+		break;
-+	}
-+
-+	dev_dbg(sfp->dev, "SM: exit %u:%u:%u\n",
-+		sfp->sm_mod_state, sfp->sm_dev_state, sfp->sm_state);
-+
-+	mutex_unlock(&sfp->sm_mutex);
-+}
-+
-+#if 0
-+static int sfp_phy_module_info(struct phy_device *phy,
-+			       struct ethtool_modinfo *modinfo)
-+{
-+	struct sfp *sfp = phy->priv;
-+
-+	/* locking... and check module is present */
-+
-+	if (sfp->id.ext.sff8472_compliance) {
-+		modinfo->type = ETH_MODULE_SFF_8472;
-+		modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
-+	} else {
-+		modinfo->type = ETH_MODULE_SFF_8079;
-+		modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
-+	}
-+	return 0;
-+}
-+
-+static int sfp_phy_module_eeprom(struct phy_device *phy,
-+	struct ethtool_eeprom *ee, u8 *data)
-+{
-+	struct sfp *sfp = phy->priv;
-+	unsigned int first, last, len;
-+	int ret;
-+
-+	if (ee->len == 0)
-+		return -EINVAL;
-+
-+	first = ee->offset;
-+	last = ee->offset + ee->len;
-+	if (first < ETH_MODULE_SFF_8079_LEN) {
-+		len = last;
-+		if (len > ETH_MODULE_SFF_8079_LEN)
-+			len = ETH_MODULE_SFF_8079_LEN;
-+		len -= first;
-+
-+		ret = sfp->read(sfp, false, first, data, len);
-+		if (ret < 0)
-+			return ret;
-+
-+		first += len;
-+		data += len;
-+	}
-+	if (first >= ETH_MODULE_SFF_8079_LEN && last > first) {
-+		len = last - first;
-+
-+		ret = sfp->read(sfp, true, first, data, len);
-+		if (ret < 0)
-+			return ret;
-+	}
-+	return 0;
-+}
-+#endif
-+
-+static void sfp_timeout(struct work_struct *work)
-+{
-+	struct sfp *sfp = container_of(work, struct sfp, timeout.work);
-+
-+	sfp_sm_event(sfp, SFP_E_TIMEOUT);
-+}
-+
-+static void sfp_check_state(struct sfp *sfp)
-+{
-+	unsigned int state, i, changed;
-+
-+	state = sfp_get_state(sfp);
-+	changed = state ^ sfp->state;
-+	changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
-+
-+	for (i = 0; i < GPIO_MAX; i++)
-+		if (changed & BIT(i))
-+			dev_dbg(sfp->dev, "%s %u -> %u\n", gpio_of_names[i],
-+				!!(sfp->state & BIT(i)), !!(state & BIT(i)));
-+
-+	state |= sfp->state & (SFP_F_TX_DISABLE | SFP_F_RATE_SELECT);
-+	sfp->state = state;
-+
-+	if (changed & SFP_F_PRESENT)
-+		sfp_sm_event(sfp, state & SFP_F_PRESENT ?
-+				SFP_E_INSERT : SFP_E_REMOVE);
-+
-+	if (changed & SFP_F_TX_FAULT)
-+		sfp_sm_event(sfp, state & SFP_F_TX_FAULT ?
-+				SFP_E_TX_FAULT : SFP_E_TX_CLEAR);
-+
-+	if (changed & SFP_F_LOS)
-+		sfp_sm_event(sfp, state & SFP_F_LOS ?
-+				SFP_E_LOS_HIGH : SFP_E_LOS_LOW);
-+}
-+
-+static irqreturn_t sfp_irq(int irq, void *data)
-+{
-+	struct sfp *sfp = data;
-+
-+	sfp_check_state(sfp);
-+
-+	return IRQ_HANDLED;
-+}
-+
-+static void sfp_poll(struct work_struct *work)
-+{
-+	struct sfp *sfp = container_of(work, struct sfp, poll.work);
-+
-+	sfp_check_state(sfp);
-+	mod_delayed_work(system_wq, &sfp->poll, poll_jiffies);
-+}
-+
-+static int sfp_netdev_notify(struct notifier_block *nb, unsigned long act, void *data)
-+{
-+	struct sfp *sfp = container_of(nb, struct sfp, netdev_nb);
-+	struct netdev_notifier_info *info = data;
-+	struct net_device *ndev = info->dev;
-+
-+	if (!sfp->ndev || ndev != sfp->ndev)
-+		return NOTIFY_DONE;
-+
-+	switch (act) {
-+	case NETDEV_UP:
-+		sfp_sm_event(sfp, SFP_E_DEV_UP);
-+		break;
-+
-+	case NETDEV_GOING_DOWN:
-+		sfp_sm_event(sfp, SFP_E_DEV_DOWN);
-+		break;
-+
-+	case NETDEV_UNREGISTER:
-+		if (sfp->mod_phy && sfp->phylink)
-+			phylink_disconnect_phy(sfp->phylink);
-+		sfp->phylink = NULL;
-+		dev_put(sfp->ndev);
-+		sfp->ndev = NULL;
-+		break;
-+	}
-+	return NOTIFY_OK;
-+}
-+
-+static struct sfp *sfp_alloc(struct device *dev)
-+{
-+	struct sfp *sfp;
-+
-+	sfp = kzalloc(sizeof(*sfp), GFP_KERNEL);
-+	if (!sfp)
-+		return ERR_PTR(-ENOMEM);
-+
-+	sfp->dev = dev;
-+
-+	mutex_init(&sfp->sm_mutex);
-+	INIT_DELAYED_WORK(&sfp->poll, sfp_poll);
-+	INIT_DELAYED_WORK(&sfp->timeout, sfp_timeout);
-+
-+	sfp->netdev_nb.notifier_call = sfp_netdev_notify;
-+
-+	return sfp;
-+}
-+
-+static void sfp_destroy(struct sfp *sfp)
-+{
-+	cancel_delayed_work_sync(&sfp->poll);
-+	cancel_delayed_work_sync(&sfp->timeout);
-+	if (sfp->i2c_mii) {
-+		mdiobus_unregister(sfp->i2c_mii);
-+		mdiobus_free(sfp->i2c_mii);
-+	}
-+	if (sfp->i2c)
-+		i2c_put_adapter(sfp->i2c);
-+	of_node_put(sfp->dev->of_node);
-+	kfree(sfp);
-+}
-+
-+static void sfp_cleanup(void *data)
-+{
-+	struct sfp *sfp = data;
-+
-+	sfp_destroy(sfp);
-+}
-+
-+static int sfp_probe(struct platform_device *pdev)
-+{
-+	struct sfp *sfp;
-+	bool poll = false;
-+	int irq, err, i;
-+
-+	sfp = sfp_alloc(&pdev->dev);
-+	if (IS_ERR(sfp))
-+		return PTR_ERR(sfp);
-+
-+	platform_set_drvdata(pdev, sfp);
-+
-+	err = devm_add_action(sfp->dev, sfp_cleanup, sfp);
-+	if (err < 0)
-+		return err;
-+
-+	if (pdev->dev.of_node) {
-+		struct device_node *node = pdev->dev.of_node;
-+		struct device_node *np;
-+
-+		np = of_parse_phandle(node, "i2c-bus", 0);
-+		if (np) {
-+			struct i2c_adapter *i2c;
-+
-+			i2c = of_find_i2c_adapter_by_node(np);
-+			of_node_put(np);
-+			if (!i2c)
-+				return -EPROBE_DEFER;
-+
-+			err = sfp_i2c_configure(sfp, i2c);
-+			if (err < 0) {
-+				i2c_put_adapter(i2c);
-+				return err;
-+			}
-+		}
-+
-+		for (i = 0; i < GPIO_MAX; i++) {
-+			sfp->gpio[i] = devm_gpiod_get_optional(sfp->dev,
-+					   gpio_of_names[i], gpio_flags[i]);
-+			if (IS_ERR(sfp->gpio[i]))
-+				return PTR_ERR(sfp->gpio[i]);
-+		}
-+
-+		sfp->get_state = sfp_gpio_get_state;
-+		sfp->set_state = sfp_gpio_set_state;
-+
-+		np = of_parse_phandle(node, "sfp,ethernet", 0);
-+		if (!np) {
-+			dev_err(sfp->dev, "missing sfp,ethernet property\n");
-+			return -EINVAL;
-+		}
-+
-+		sfp->ndev = of_find_net_device_by_node(np);
-+		if (!sfp->ndev) {
-+			dev_err(sfp->dev, "ethernet device not found\n");
-+			return -EPROBE_DEFER;
-+		}
-+
-+		dev_hold(sfp->ndev);
-+		put_device(&sfp->ndev->dev);
-+
-+		sfp->phylink = phylink_lookup_by_netdev(sfp->ndev);
-+		if (!sfp->phylink) {
-+			dev_err(sfp->dev, "ethernet device not found\n");
-+			return -EPROBE_DEFER;
-+		}
-+
-+		phylink_disable(sfp->phylink);
-+	}
-+
-+	sfp->state = sfp_get_state(sfp);
-+	if (sfp->gpio[GPIO_TX_DISABLE] &&
-+	    gpiod_get_value_cansleep(sfp->gpio[GPIO_TX_DISABLE]))
-+		sfp->state |= SFP_F_TX_DISABLE;
-+	if (sfp->gpio[GPIO_RATE_SELECT] &&
-+	    gpiod_get_value_cansleep(sfp->gpio[GPIO_RATE_SELECT]))
-+		sfp->state |= SFP_F_RATE_SELECT;
-+	sfp_set_state(sfp, sfp->state);
-+	sfp_module_tx_disable(sfp);
-+	if (sfp->state & SFP_F_PRESENT)
-+		sfp_sm_event(sfp, SFP_E_INSERT);
-+
-+	for (i = 0; i < GPIO_MAX; i++) {
-+		if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
-+			continue;
-+
-+		irq = gpiod_to_irq(sfp->gpio[i]);
-+		if (!irq) {
-+			poll = true;
-+			continue;
-+		}
-+
-+		err = devm_request_threaded_irq(sfp->dev, irq, NULL, sfp_irq,
-+						IRQF_ONESHOT |
-+						IRQF_TRIGGER_RISING |
-+						IRQF_TRIGGER_FALLING,
-+						dev_name(sfp->dev), sfp);
-+		if (err)
-+			poll = true;
-+	}
-+
-+	if (poll)
-+		mod_delayed_work(system_wq, &sfp->poll, poll_jiffies);
-+
-+	register_netdevice_notifier(&sfp->netdev_nb);
-+
-+	return 0;
-+}
-+
-+static int sfp_remove(struct platform_device *pdev)
-+{
-+	struct sfp *sfp = platform_get_drvdata(pdev);
-+
-+	unregister_netdevice_notifier(&sfp->netdev_nb);
-+	if (sfp->ndev)
-+		dev_put(sfp->ndev);
-+
-+	return 0;
-+}
-+
-+static const struct of_device_id sfp_of_match[] = {
-+	{ .compatible = "sff,sfp", },
-+	{ },
-+};
-+MODULE_DEVICE_TABLE(of, sfp_of_match);
-+
-+static struct platform_driver sfp_driver = {
-+	.probe = sfp_probe,
-+	.remove = sfp_remove,
-+	.driver = {
-+		.name = "sfp",
-+		.of_match_table = sfp_of_match,
-+	},
-+};
-+
-+static int sfp_init(void)
-+{
-+	poll_jiffies = msecs_to_jiffies(100);
-+
-+	return platform_driver_register(&sfp_driver);
-+}
-+module_init(sfp_init);
-+
-+static void sfp_exit(void)
-+{
-+	platform_driver_unregister(&sfp_driver);
-+}
-+module_exit(sfp_exit);
-+
-+MODULE_ALIAS("platform:sfp");
-+MODULE_AUTHOR("Russell King");
-+MODULE_LICENSE("GPL v2");
---- /dev/null
-+++ b/include/linux/sfp.h
-@@ -0,0 +1,339 @@
-+#ifndef LINUX_SFP_H
-+#define LINUX_SFP_H
-+
-+struct __packed sfp_eeprom_base {
-+	u8 phys_id;
-+	u8 phys_ext_id;
-+	u8 connector;
-+#if defined __BIG_ENDIAN_BITFIELD
-+	u8 e10g_base_er:1;
-+	u8 e10g_base_lrm:1;
-+	u8 e10g_base_lr:1;
-+	u8 e10g_base_sr:1;
-+	u8 if_1x_sx:1;
-+	u8 if_1x_lx:1;
-+	u8 if_1x_copper_active:1;
-+	u8 if_1x_copper_passive:1;
-+
-+	u8 escon_mmf_1310_led:1;
-+	u8 escon_smf_1310_laser:1;
-+	u8 sonet_oc192_short_reach:1;
-+	u8 sonet_reach_bit1:1;
-+	u8 sonet_reach_bit2:1;
-+	u8 sonet_oc48_long_reach:1;
-+	u8 sonet_oc48_intermediate_reach:1;
-+	u8 sonet_oc48_short_reach:1;
-+
-+	u8 unallocated_5_7:1;
-+	u8 sonet_oc12_smf_long_reach:1;
-+	u8 sonet_oc12_smf_intermediate_reach:1;
-+	u8 sonet_oc12_short_reach:1;
-+	u8 unallocated_5_3:1;
-+	u8 sonet_oc3_smf_long_reach:1;
-+	u8 sonet_oc3_smf_intermediate_reach:1;
-+	u8 sonet_oc3_short_reach:1;
-+
-+	u8 e_base_px:1;
-+	u8 e_base_bx10:1;
-+	u8 e100_base_fx:1;
-+	u8 e100_base_lx:1;
-+	u8 e1000_base_t:1;
-+	u8 e1000_base_cx:1;
-+	u8 e1000_base_lx:1;
-+	u8 e1000_base_sx:1;
-+
-+	u8 fc_ll_v:1;
-+	u8 fc_ll_s:1;
-+	u8 fc_ll_i:1;
-+	u8 fc_ll_l:1;
-+	u8 fc_ll_m:1;
-+	u8 fc_tech_sa:1;
-+	u8 fc_tech_lc:1;
-+	u8 fc_tech_electrical_inter_enclosure:1;
-+
-+	u8 fc_tech_electrical_intra_enclosure:1;
-+	u8 fc_tech_sn:1;
-+	u8 fc_tech_sl:1;
-+	u8 fc_tech_ll:1;
-+	u8 sfp_ct_active:1;
-+	u8 sfp_ct_passive:1;
-+	u8 unallocated_8_1:1;
-+	u8 unallocated_8_0:1;
-+
-+	u8 fc_media_tw:1;
-+	u8 fc_media_tp:1;
-+	u8 fc_media_mi:1;
-+	u8 fc_media_tv:1;
-+	u8 fc_media_m6:1;
-+	u8 fc_media_m5:1;
-+	u8 unallocated_9_1:1;
-+	u8 fc_media_sm:1;
-+
-+	u8 fc_speed_1200:1;
-+	u8 fc_speed_800:1;
-+	u8 fc_speed_1600:1;
-+	u8 fc_speed_400:1;
-+	u8 fc_speed_3200:1;
-+	u8 fc_speed_200:1;
-+	u8 unallocated_10_1:1;
-+	u8 fc_speed_100:1;
-+#elif defined __LITTLE_ENDIAN_BITFIELD
-+	u8 if_1x_copper_passive:1;
-+	u8 if_1x_copper_active:1;
-+	u8 if_1x_lx:1;
-+	u8 if_1x_sx:1;
-+	u8 e10g_base_sr:1;
-+	u8 e10g_base_lr:1;
-+	u8 e10g_base_lrm:1;
-+	u8 e10g_base_er:1;
-+
-+	u8 sonet_oc3_short_reach:1;
-+	u8 sonet_oc3_smf_intermediate_reach:1;
-+	u8 sonet_oc3_smf_long_reach:1;
-+	u8 unallocated_5_3:1;
-+	u8 sonet_oc12_short_reach:1;
-+	u8 sonet_oc12_smf_intermediate_reach:1;
-+	u8 sonet_oc12_smf_long_reach:1;
-+	u8 unallocated_5_7:1;
-+
-+	u8 sonet_oc48_short_reach:1;
-+	u8 sonet_oc48_intermediate_reach:1;
-+	u8 sonet_oc48_long_reach:1;
-+	u8 sonet_reach_bit2:1;
-+	u8 sonet_reach_bit1:1;
-+	u8 sonet_oc192_short_reach:1;
-+	u8 escon_smf_1310_laser:1;
-+	u8 escon_mmf_1310_led:1;
-+
-+	u8 e1000_base_sx:1;
-+	u8 e1000_base_lx:1;
-+	u8 e1000_base_cx:1;
-+	u8 e1000_base_t:1;
-+	u8 e100_base_lx:1;
-+	u8 e100_base_fx:1;
-+	u8 e_base_bx10:1;
-+	u8 e_base_px:1;
-+
-+	u8 fc_tech_electrical_inter_enclosure:1;
-+	u8 fc_tech_lc:1;
-+	u8 fc_tech_sa:1;
-+	u8 fc_ll_m:1;
-+	u8 fc_ll_l:1;
-+	u8 fc_ll_i:1;
-+	u8 fc_ll_s:1;
-+	u8 fc_ll_v:1;
-+
-+	u8 unallocated_8_0:1;
-+	u8 unallocated_8_1:1;
-+	u8 sfp_ct_passive:1;
-+	u8 sfp_ct_active:1;
-+	u8 fc_tech_ll:1;
-+	u8 fc_tech_sl:1;
-+	u8 fc_tech_sn:1;
-+	u8 fc_tech_electrical_intra_enclosure:1;
-+
-+	u8 fc_media_sm:1;
-+	u8 unallocated_9_1:1;
-+	u8 fc_media_m5:1;
-+	u8 fc_media_m6:1;
-+	u8 fc_media_tv:1;
-+	u8 fc_media_mi:1;
-+	u8 fc_media_tp:1;
-+	u8 fc_media_tw:1;
-+
-+	u8 fc_speed_100:1;
-+	u8 unallocated_10_1:1;
-+	u8 fc_speed_200:1;
-+	u8 fc_speed_3200:1;
-+	u8 fc_speed_400:1;
-+	u8 fc_speed_1600:1;
-+	u8 fc_speed_800:1;
-+	u8 fc_speed_1200:1;
-+#else
-+#error Unknown Endian
-+#endif
-+	u8 encoding;
-+	u8 br_nominal;
-+	u8 rate_id;
-+	u8 link_len[6];
-+	char vendor_name[16];
-+	u8 reserved36;
-+	char vendor_oui[3];
-+	char vendor_pn[16];
-+	char vendor_rev[4];
-+	union {
-+		__be16 optical_wavelength;
-+		u8 cable_spec;
-+	};
-+	u8 reserved62;
-+	u8 cc_base;
-+};
-+
-+struct __packed sfp_eeprom_ext {
-+	__be16 options;
-+	u8 br_max;
-+	u8 br_min;
-+	char vendor_sn[16];
-+	char datecode[8];
-+	u8 diagmon;
-+	u8 enhopts;
-+	u8 sff8472_compliance;
-+	u8 cc_ext;
-+};
-+
-+struct __packed sfp_eeprom_id {
-+	struct sfp_eeprom_base base;
-+	struct sfp_eeprom_ext ext;
-+};
-+
-+/* SFP EEPROM registers */
-+enum {
-+	SFP_PHYS_ID			= 0x00,
-+	SFP_PHYS_EXT_ID			= 0x01,
-+	SFP_CONNECTOR			= 0x02,
-+	SFP_COMPLIANCE			= 0x03,
-+	SFP_ENCODING			= 0x0b,
-+	SFP_BR_NOMINAL			= 0x0c,
-+	SFP_RATE_ID			= 0x0d,
-+	SFP_LINK_LEN_SM_KM		= 0x0e,
-+	SFP_LINK_LEN_SM_100M		= 0x0f,
-+	SFP_LINK_LEN_50UM_OM2_10M	= 0x10,
-+	SFP_LINK_LEN_62_5UM_OM1_10M	= 0x11,
-+	SFP_LINK_LEN_COPPER_1M		= 0x12,
-+	SFP_LINK_LEN_50UM_OM4_10M	= 0x12,
-+	SFP_LINK_LEN_50UM_OM3_10M	= 0x13,
-+	SFP_VENDOR_NAME			= 0x14,
-+	SFP_VENDOR_OUI			= 0x25,
-+	SFP_VENDOR_PN			= 0x28,
-+	SFP_VENDOR_REV			= 0x38,
-+	SFP_OPTICAL_WAVELENGTH_MSB	= 0x3c,
-+	SFP_OPTICAL_WAVELENGTH_LSB	= 0x3d,
-+	SFP_CABLE_SPEC			= 0x3c,
-+	SFP_CC_BASE			= 0x3f,
-+	SFP_OPTIONS			= 0x40,	/* 2 bytes, MSB, LSB */
-+	SFP_BR_MAX			= 0x42,
-+	SFP_BR_MIN			= 0x43,
-+	SFP_VENDOR_SN			= 0x44,
-+	SFP_DATECODE			= 0x54,
-+	SFP_DIAGMON			= 0x5c,
-+	SFP_ENHOPTS			= 0x5d,
-+	SFP_SFF8472_COMPLIANCE		= 0x5e,
-+	SFP_CC_EXT			= 0x5f,
-+
-+	SFP_PHYS_ID_SFP			= 0x03,
-+	SFP_PHYS_EXT_ID_SFP		= 0x04,
-+	SFP_CONNECTOR_UNSPEC		= 0x00,
-+	/* codes 01-05 not supportable on SFP, but some modules have single SC */
-+	SFP_CONNECTOR_SC		= 0x01,
-+	SFP_CONNECTOR_FIBERJACK		= 0x06,
-+	SFP_CONNECTOR_LC		= 0x07,
-+	SFP_CONNECTOR_MT_RJ		= 0x08,
-+	SFP_CONNECTOR_MU		= 0x09,
-+	SFP_CONNECTOR_SG		= 0x0a,
-+	SFP_CONNECTOR_OPTICAL_PIGTAIL	= 0x0b,
-+	SFP_CONNECTOR_HSSDC_II		= 0x20,
-+	SFP_CONNECTOR_COPPER_PIGTAIL	= 0x21,
-+	SFP_ENCODING_UNSPEC		= 0x00,
-+	SFP_ENCODING_8B10B		= 0x01,
-+	SFP_ENCODING_4B5B		= 0x02,
-+	SFP_ENCODING_NRZ		= 0x03,
-+	SFP_ENCODING_MANCHESTER		= 0x04,
-+	SFP_OPTIONS_HIGH_POWER_LEVEL	= BIT(13),
-+	SFP_OPTIONS_PAGING_A2		= BIT(12),
-+	SFP_OPTIONS_RETIMER		= BIT(11),
-+	SFP_OPTIONS_COOLED_XCVR		= BIT(10),
-+	SFP_OPTIONS_POWER_DECL		= BIT(9),
-+	SFP_OPTIONS_RX_LINEAR_OUT	= BIT(8),
-+	SFP_OPTIONS_RX_DECISION_THRESH	= BIT(7),
-+	SFP_OPTIONS_TUNABLE_TX		= BIT(6),
-+	SFP_OPTIONS_RATE_SELECT		= BIT(5),
-+	SFP_OPTIONS_TX_DISABLE		= BIT(4),
-+	SFP_OPTIONS_TX_FAULT		= BIT(3),
-+	SFP_OPTIONS_LOS_INVERTED	= BIT(2),
-+	SFP_OPTIONS_LOS_NORMAL		= BIT(1),
-+	SFP_DIAGMON_DDM			= BIT(6),
-+	SFP_DIAGMON_INT_CAL		= BIT(5),
-+	SFP_DIAGMON_EXT_CAL		= BIT(4),
-+	SFP_DIAGMON_RXPWR_AVG		= BIT(3),
-+	SFP_DIAGMON_ADDRMODE		= BIT(2),
-+	SFP_ENHOPTS_ALARMWARN		= BIT(7),
-+	SFP_ENHOPTS_SOFT_TX_DISABLE	= BIT(6),
-+	SFP_ENHOPTS_SOFT_TX_FAULT	= BIT(5),
-+	SFP_ENHOPTS_SOFT_RX_LOS		= BIT(4),
-+	SFP_ENHOPTS_SOFT_RATE_SELECT	= BIT(3),
-+	SFP_ENHOPTS_APP_SELECT_SFF8079	= BIT(2),
-+	SFP_ENHOPTS_SOFT_RATE_SFF8431	= BIT(1),
-+	SFP_SFF8472_COMPLIANCE_NONE	= 0x00,
-+	SFP_SFF8472_COMPLIANCE_REV9_3	= 0x01,
-+	SFP_SFF8472_COMPLIANCE_REV9_5	= 0x02,
-+	SFP_SFF8472_COMPLIANCE_REV10_2	= 0x03,
-+	SFP_SFF8472_COMPLIANCE_REV10_4	= 0x04,
-+	SFP_SFF8472_COMPLIANCE_REV11_0	= 0x05,
-+	SFP_SFF8472_COMPLIANCE_REV11_3	= 0x06,
-+	SFP_SFF8472_COMPLIANCE_REV11_4	= 0x07,
-+	SFP_SFF8472_COMPLIANCE_REV12_0	= 0x08,
-+};
-+
-+/* SFP Diagnostics */
-+enum {
-+	/* Alarm and warnings stored MSB at lower address then LSB */
-+	SFP_TEMP_HIGH_ALARM		= 0x00,
-+	SFP_TEMP_LOW_ALARM		= 0x02,
-+	SFP_TEMP_HIGH_WARN		= 0x04,
-+	SFP_TEMP_LOW_WARN		= 0x06,
-+	SFP_VOLT_HIGH_ALARM		= 0x08,
-+	SFP_VOLT_LOW_ALARM		= 0x0a,
-+	SFP_VOLT_HIGH_WARN		= 0x0c,
-+	SFP_VOLT_LOW_WARN		= 0x0e,
-+	SFP_BIAS_HIGH_ALARM		= 0x10,
-+	SFP_BIAS_LOW_ALARM		= 0x12,
-+	SFP_BIAS_HIGH_WARN		= 0x14,
-+	SFP_BIAS_LOW_WARN		= 0x16,
-+	SFP_TXPWR_HIGH_ALARM		= 0x18,
-+	SFP_TXPWR_LOW_ALARM		= 0x1a,
-+	SFP_TXPWR_HIGH_WARN		= 0x1c,
-+	SFP_TXPWR_LOW_WARN		= 0x1e,
-+	SFP_RXPWR_HIGH_ALARM		= 0x20,
-+	SFP_RXPWR_LOW_ALARM		= 0x22,
-+	SFP_RXPWR_HIGH_WARN		= 0x24,
-+	SFP_RXPWR_LOW_WARN		= 0x26,
-+	SFP_LASER_TEMP_HIGH_ALARM	= 0x28,
-+	SFP_LASER_TEMP_LOW_ALARM	= 0x2a,
-+	SFP_LASER_TEMP_HIGH_WARN	= 0x2c,
-+	SFP_LASER_TEMP_LOW_WARN		= 0x2e,
-+	SFP_TEC_CUR_HIGH_ALARM		= 0x30,
-+	SFP_TEC_CUR_LOW_ALARM		= 0x32,
-+	SFP_TEC_CUR_HIGH_WARN		= 0x34,
-+	SFP_TEC_CUR_LOW_WARN		= 0x36,
-+	SFP_CAL_RXPWR4			= 0x38,
-+	SFP_CAL_RXPWR3			= 0x3c,
-+	SFP_CAL_RXPWR2			= 0x40,
-+	SFP_CAL_RXPWR1			= 0x44,
-+	SFP_CAL_RXPWR0			= 0x48,
-+	SFP_CAL_TXI_SLOPE		= 0x4c,
-+	SFP_CAL_TXI_OFFSET		= 0x4e,
-+	SFP_CAL_TXPWR_SLOPE		= 0x50,
-+	SFP_CAL_TXPWR_OFFSET		= 0x52,
-+	SFP_CAL_T_SLOPE			= 0x54,
-+	SFP_CAL_T_OFFSET		= 0x56,
-+	SFP_CAL_V_SLOPE			= 0x58,
-+	SFP_CAL_V_OFFSET		= 0x5a,
-+	SFP_CHKSUM			= 0x5f,
-+
-+	SFP_TEMP			= 0x60,
-+	SFP_VCC				= 0x62,
-+	SFP_TX_BIAS			= 0x64,
-+	SFP_TX_POWER			= 0x66,
-+	SFP_RX_POWER			= 0x68,
-+	SFP_LASER_TEMP			= 0x6a,
-+	SFP_TEC_CUR			= 0x6c,
-+
-+	SFP_STATUS			= 0x6e,
-+	SFP_ALARM			= 0x70,
-+
-+	SFP_EXT_STATUS			= 0x76,
-+	SFP_VSL				= 0x78,
-+	SFP_PAGE			= 0x7f,
-+};
-+
-+#endif
diff --git a/target/linux/mvebu/patches-4.4/133-sfp-display-SFP-module-information.patch b/target/linux/mvebu/patches-4.4/133-sfp-display-SFP-module-information.patch
deleted file mode 100644
index bc039ee..0000000
--- a/target/linux/mvebu/patches-4.4/133-sfp-display-SFP-module-information.patch
+++ /dev/null
@@ -1,283 +0,0 @@
-From 66c248886538d7ee97ef2fe498061f857d4c906a Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sun, 13 Sep 2015 01:06:31 +0100
-Subject: [PATCH 721/744] sfp: display SFP module information
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/sfp.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 246 insertions(+), 1 deletion(-)
-
---- a/drivers/net/phy/sfp.c
-+++ b/drivers/net/phy/sfp.c
-@@ -248,6 +248,182 @@ static unsigned int sfp_check(void *buf,
- 	return check;
- }
- 
-+static const char *sfp_link_len(char *buf, size_t size, unsigned int length,
-+	unsigned int multiplier)
-+{
-+	if (length == 0)
-+		return "unsupported/unspecified";
-+
-+	if (length == 255) {
-+		*buf++ = '>';
-+		size -= 1;
-+		length -= 1;
-+	}
-+
-+	length *= multiplier;
-+
-+	if (length >= 1000)
-+		snprintf(buf, size, "%u.%0*ukm",
-+			length / 1000,
-+			multiplier > 100 ? 1 :
-+			multiplier > 10 ? 2 : 3,
-+			length % 1000);
-+	else
-+		snprintf(buf, size, "%um", length);
-+
-+	return buf;
-+}
-+
-+struct bitfield {
-+	unsigned int mask;
-+	unsigned int val;
-+	const char *str;
-+};
-+
-+static const struct bitfield sfp_options[] = {
-+	{
-+		.mask = SFP_OPTIONS_HIGH_POWER_LEVEL,
-+		.val = SFP_OPTIONS_HIGH_POWER_LEVEL,
-+		.str = "hpl",
-+	}, {
-+		.mask = SFP_OPTIONS_PAGING_A2,
-+		.val = SFP_OPTIONS_PAGING_A2,
-+		.str = "paginga2",
-+	}, {
-+		.mask = SFP_OPTIONS_RETIMER,
-+		.val = SFP_OPTIONS_RETIMER,
-+		.str = "retimer",
-+	}, {
-+		.mask = SFP_OPTIONS_COOLED_XCVR,
-+		.val = SFP_OPTIONS_COOLED_XCVR,
-+		.str = "cooled",
-+	}, {
-+		.mask = SFP_OPTIONS_POWER_DECL,
-+		.val = SFP_OPTIONS_POWER_DECL,
-+		.str = "powerdecl",
-+	}, {
-+		.mask = SFP_OPTIONS_RX_LINEAR_OUT,
-+		.val = SFP_OPTIONS_RX_LINEAR_OUT,
-+		.str = "rxlinear",
-+	}, {
-+		.mask = SFP_OPTIONS_RX_DECISION_THRESH,
-+		.val = SFP_OPTIONS_RX_DECISION_THRESH,
-+		.str = "rxthresh",
-+	}, {
-+		.mask = SFP_OPTIONS_TUNABLE_TX,
-+		.val = SFP_OPTIONS_TUNABLE_TX,
-+		.str = "tunabletx",
-+	}, {
-+		.mask = SFP_OPTIONS_RATE_SELECT,
-+		.val = SFP_OPTIONS_RATE_SELECT,
-+		.str = "ratesel",
-+	}, {
-+		.mask = SFP_OPTIONS_TX_DISABLE,
-+		.val = SFP_OPTIONS_TX_DISABLE,
-+		.str = "txdisable",
-+	}, {
-+		.mask = SFP_OPTIONS_TX_FAULT,
-+		.val = SFP_OPTIONS_TX_FAULT,
-+		.str = "txfault",
-+	}, {
-+		.mask = SFP_OPTIONS_LOS_INVERTED,
-+		.val = SFP_OPTIONS_LOS_INVERTED,
-+		.str = "los-",
-+	}, {
-+		.mask = SFP_OPTIONS_LOS_NORMAL,
-+		.val = SFP_OPTIONS_LOS_NORMAL,
-+		.str = "los+",
-+	}, { }
-+};
-+
-+static const struct bitfield diagmon[] = {
-+	{
-+		.mask = SFP_DIAGMON_DDM,
-+		.val = SFP_DIAGMON_DDM,
-+		.str = "ddm",
-+	}, {
-+		.mask = SFP_DIAGMON_INT_CAL,
-+		.val = SFP_DIAGMON_INT_CAL,
-+		.str = "intcal",
-+	}, {
-+		.mask = SFP_DIAGMON_EXT_CAL,
-+		.val = SFP_DIAGMON_EXT_CAL,
-+		.str = "extcal",
-+	}, {
-+		.mask = SFP_DIAGMON_RXPWR_AVG,
-+		.val = SFP_DIAGMON_RXPWR_AVG,
-+		.str = "rxpwravg",
-+	}, { }
-+};
-+
-+static const char *sfp_bitfield(char *out, size_t outsz, const struct bitfield *bits, unsigned int val)
-+{
-+	char *p = out;
-+	int n;
-+
-+	*p = '\0';
-+	while (bits->mask) {
-+		if ((val & bits->mask) == bits->val) {
-+			n = snprintf(p, outsz, "%s%s",
-+				     out != p ? ", " : "",
-+				     bits->str);
-+			if (n == outsz)
-+				break;
-+			p += n;
-+			outsz -= n;
-+		}
-+		bits++;
-+	}
-+
-+	return out;
-+}
-+
-+static const char *sfp_connector(unsigned int connector)
-+{
-+	switch (connector) {
-+	case SFP_CONNECTOR_UNSPEC:
-+		return "unknown/unspecified";
-+	case SFP_CONNECTOR_SC:
-+		return "SC";
-+	case SFP_CONNECTOR_FIBERJACK:
-+		return "Fiberjack";
-+	case SFP_CONNECTOR_LC:
-+		return "LC";
-+	case SFP_CONNECTOR_MT_RJ:
-+		return "MT-RJ";
-+	case SFP_CONNECTOR_MU:
-+		return "MU";
-+	case SFP_CONNECTOR_SG:
-+		return "SG";
-+	case SFP_CONNECTOR_OPTICAL_PIGTAIL:
-+		return "Optical pigtail";
-+	case SFP_CONNECTOR_HSSDC_II:
-+		return "HSSDC II";
-+	case SFP_CONNECTOR_COPPER_PIGTAIL:
-+		return "Copper pigtail";
-+	default:
-+		return "unknown";
-+	}
-+}
-+
-+static const char *sfp_encoding(unsigned int encoding)
-+{
-+	switch (encoding) {
-+	case SFP_ENCODING_UNSPEC:
-+		return "unspecified";
-+	case SFP_ENCODING_8B10B:
-+		return "8b10b";
-+	case SFP_ENCODING_4B5B:
-+		return "4b5b";
-+	case SFP_ENCODING_NRZ:
-+		return "NRZ";
-+	case SFP_ENCODING_MANCHESTER:
-+		return "MANCHESTER";
-+	default:
-+		return "unknown";
-+	}
-+}
-+
- /* Helpers */
- static void sfp_module_tx_disable(struct sfp *sfp)
- {
-@@ -426,6 +602,7 @@ static int sfp_sm_mod_probe(struct sfp *
- 	char sn[17];
- 	char date[9];
- 	char rev[5];
-+	char options[80];
- 	u8 check;
- 	int err;
- 
-@@ -462,10 +639,78 @@ static int sfp_sm_mod_probe(struct sfp *
- 	rev[4] = '\0';
- 	memcpy(sn, sfp->id.ext.vendor_sn, 16);
- 	sn[16] = '\0';
--	memcpy(date, sfp->id.ext.datecode, 8);
-+	date[0] = sfp->id.ext.datecode[4];
-+	date[1] = sfp->id.ext.datecode[5];
-+	date[2] = '-';
-+	date[3] = sfp->id.ext.datecode[2];
-+	date[4] = sfp->id.ext.datecode[3];
-+	date[5] = '-';
-+	date[6] = sfp->id.ext.datecode[0];
-+	date[7] = sfp->id.ext.datecode[1];
- 	date[8] = '\0';
- 
- 	dev_info(sfp->dev, "module %s %s rev %s sn %s dc %s\n", vendor, part, rev, sn, date);
-+	dev_info(sfp->dev, "  %s connector, encoding %s, nominal bitrate %u.%uGbps +%u%% -%u%%\n",
-+		 sfp_connector(sfp->id.base.connector),
-+		 sfp_encoding(sfp->id.base.encoding),
-+		 sfp->id.base.br_nominal / 10,
-+		 sfp->id.base.br_nominal % 10,
-+		 sfp->id.ext.br_max, sfp->id.ext.br_min);
-+	dev_info(sfp->dev, "  1000BaseSX%c 1000BaseLX%c 1000BaseCX%c 1000BaseT%c 100BaseTLX%c 1000BaseFX%c BaseBX10%c BasePX%c\n",
-+		 sfp->id.base.e1000_base_sx ? '+' : '-',
-+		 sfp->id.base.e1000_base_lx ? '+' : '-',
-+		 sfp->id.base.e1000_base_cx ? '+' : '-',
-+		 sfp->id.base.e1000_base_t ? '+' : '-',
-+		 sfp->id.base.e100_base_lx ? '+' : '-',
-+		 sfp->id.base.e100_base_fx ? '+' : '-',
-+		 sfp->id.base.e_base_bx10 ? '+' : '-',
-+		 sfp->id.base.e_base_px ? '+' : '-');
-+
-+	if (!sfp->id.base.sfp_ct_passive && !sfp->id.base.sfp_ct_active &&
-+	    !sfp->id.base.e1000_base_t) {
-+		char len_9um[16], len_om[16];
-+
-+		dev_info(sfp->dev, "  Wavelength %unm, fiber lengths:\n",
-+			 be16_to_cpup(&sfp->id.base.optical_wavelength));
-+
-+		if (sfp->id.base.link_len[0] == 255)
-+			strcpy(len_9um, ">254km");
-+		else if (sfp->id.base.link_len[1] && sfp->id.base.link_len[1] != 255)
-+			sprintf(len_9um, "%um",
-+				sfp->id.base.link_len[1] * 100);
-+		else if (sfp->id.base.link_len[0])
-+			sprintf(len_9um, "%ukm", sfp->id.base.link_len[0]);
-+		else if (sfp->id.base.link_len[1] == 255)
-+			strcpy(len_9um, ">25.4km");
-+		else
-+			strcpy(len_9um, "unsupported");
-+
-+		dev_info(sfp->dev, "    9?m SM    : %s\n", len_9um);
-+		dev_info(sfp->dev, " 62.5?m MM OM1: %s\n",
-+			 sfp_link_len(len_om, sizeof(len_om),
-+				      sfp->id.base.link_len[3], 10));
-+		dev_info(sfp->dev, "   50?m MM OM2: %s\n",
-+			 sfp_link_len(len_om, sizeof(len_om),
-+				      sfp->id.base.link_len[2], 10));
-+		dev_info(sfp->dev, "   50?m MM OM3: %s\n",
-+			 sfp_link_len(len_om, sizeof(len_om),
-+				      sfp->id.base.link_len[5], 10));
-+		dev_info(sfp->dev, "   50?m MM OM4: %s\n",
-+			 sfp_link_len(len_om, sizeof(len_om),
-+				      sfp->id.base.link_len[4], 10));
-+	} else {
-+		char len[16];
-+		dev_info(sfp->dev, "  Copper length: %s\n",
-+			 sfp_link_len(len, sizeof(len),
-+				      sfp->id.base.link_len[4], 1));
-+	}
-+
-+	dev_info(sfp->dev, "  Options: %s\n",
-+		 sfp_bitfield(options, sizeof(options), sfp_options,
-+			      be16_to_cpu(sfp->id.ext.options)));
-+	dev_info(sfp->dev, "  Diagnostics: %s\n",
-+		 sfp_bitfield(options, sizeof(options), diagmon,
-+			      sfp->id.ext.diagmon));
- 
- 	/* We only support SFP modules, not the legacy GBIC modules. */
- 	if (sfp->id.base.phys_id != SFP_PHYS_ID_SFP ||
diff --git a/target/linux/mvebu/patches-4.4/134-net-mvneta-convert-to-phylink.patch b/target/linux/mvebu/patches-4.4/134-net-mvneta-convert-to-phylink.patch
deleted file mode 100644
index fac283f..0000000
--- a/target/linux/mvebu/patches-4.4/134-net-mvneta-convert-to-phylink.patch
+++ /dev/null
@@ -1,697 +0,0 @@
-From e268be0ddc666f4a98db462cbed2a97637e82b5c Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Wed, 16 Sep 2015 21:27:10 +0100
-Subject: [PATCH 722/744] net: mvneta: convert to phylink
-
-Convert mvneta to use phylink, which models the MAC to PHY link in
-a generic, reusable form.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/ethernet/marvell/Kconfig  |   2 +-
- drivers/net/ethernet/marvell/mvneta.c | 451 +++++++++++++++++-----------------
- 2 files changed, 227 insertions(+), 226 deletions(-)
-
---- a/drivers/net/ethernet/marvell/Kconfig
-+++ b/drivers/net/ethernet/marvell/Kconfig
-@@ -58,7 +58,7 @@ config MVNETA
- 	tristate "Marvell Armada 370/38x/XP network interface support"
- 	depends on PLAT_ORION
- 	select MVMDIO
--	select FIXED_PHY
-+	select PHYLINK
- 	---help---
- 	  This driver supports the network interface units in the
- 	  Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family.
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -28,6 +28,7 @@
- #include <linux/of_mdio.h>
- #include <linux/of_net.h>
- #include <linux/phy.h>
-+#include <linux/phylink.h>
- #include <linux/platform_device.h>
- #include <linux/skbuff.h>
- #include <net/hwbm.h>
-@@ -188,6 +189,7 @@
- #define MVNETA_GMAC_CTRL_0                       0x2c00
- #define      MVNETA_GMAC_MAX_RX_SIZE_SHIFT       2
- #define      MVNETA_GMAC_MAX_RX_SIZE_MASK        0x7ffc
-+#define      MVNETA_GMAC0_PORT_1000BASE_X        BIT(1)
- #define      MVNETA_GMAC0_PORT_ENABLE            BIT(0)
- #define MVNETA_GMAC_CTRL_2                       0x2c08
- #define      MVNETA_GMAC2_INBAND_AN_ENABLE       BIT(0)
-@@ -203,13 +205,19 @@
- #define      MVNETA_GMAC_TX_FLOW_CTRL_ENABLE     BIT(5)
- #define      MVNETA_GMAC_RX_FLOW_CTRL_ACTIVE     BIT(6)
- #define      MVNETA_GMAC_TX_FLOW_CTRL_ACTIVE     BIT(7)
-+#define      MVNETA_GMAC_AN_COMPLETE             BIT(11)
-+#define      MVNETA_GMAC_SYNC_OK                 BIT(14)
- #define MVNETA_GMAC_AUTONEG_CONFIG               0x2c0c
- #define      MVNETA_GMAC_FORCE_LINK_DOWN         BIT(0)
- #define      MVNETA_GMAC_FORCE_LINK_PASS         BIT(1)
- #define      MVNETA_GMAC_INBAND_AN_ENABLE        BIT(2)
-+#define      MVNETA_GMAC_AN_BYPASS_ENABLE        BIT(3)
-+#define      MVNETA_GMAC_INBAND_RESTART_AN       BIT(4)
- #define      MVNETA_GMAC_CONFIG_MII_SPEED        BIT(5)
- #define      MVNETA_GMAC_CONFIG_GMII_SPEED       BIT(6)
- #define      MVNETA_GMAC_AN_SPEED_EN             BIT(7)
-+#define      MVNETA_GMAC_CONFIG_FLOW_CTRL        BIT(8)
-+#define      MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL    BIT(9)
- #define      MVNETA_GMAC_AN_FLOW_CTRL_EN         BIT(11)
- #define      MVNETA_GMAC_CONFIG_FULL_DUPLEX      BIT(12)
- #define      MVNETA_GMAC_AN_DUPLEX_EN            BIT(13)
-@@ -396,15 +404,9 @@ struct mvneta_port {
- 	u16 tx_ring_size;
- 	u16 rx_ring_size;
- 
--	struct mii_bus *mii_bus;
--	struct phy_device *phy_dev;
--	phy_interface_t phy_interface;
--	struct device_node *phy_node;
--	unsigned int link;
--	unsigned int duplex;
--	unsigned int speed;
-+	struct device_node *dn;
- 	unsigned int tx_csum_limit;
--	unsigned int use_inband_status:1;
-+	struct phylink *phylink;
- 
- 	struct mvneta_bm *bm_priv;
- 	struct mvneta_bm_pool *pool_long;
-@@ -1236,44 +1238,6 @@ static void mvneta_set_other_mcast_table
- 		mvreg_write(pp, MVNETA_DA_FILT_OTH_MCAST + offset, val);
- }
- 
--static void mvneta_set_autoneg(struct mvneta_port *pp, int enable)
--{
--	u32 val;
--
--	if (enable) {
--		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
--		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
--			 MVNETA_GMAC_FORCE_LINK_DOWN |
--			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
--		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
--		       MVNETA_GMAC_AN_SPEED_EN |
--		       MVNETA_GMAC_AN_DUPLEX_EN;
--		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
--		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
--		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
--	} else {
--		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
--		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
--		       MVNETA_GMAC_AN_SPEED_EN |
--		       MVNETA_GMAC_AN_DUPLEX_EN);
--		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
--		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
--
--		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
--		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
--		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
--	}
--}
--
- static void mvneta_percpu_unmask_interrupt(void *arg)
- {
- 	struct mvneta_port *pp = arg;
-@@ -1421,7 +1385,6 @@ static void mvneta_defaults_set(struct m
- 	val &= ~MVNETA_PHY_POLLING_ENABLE;
- 	mvreg_write(pp, MVNETA_UNIT_CONTROL, val);
- 
--	mvneta_set_autoneg(pp, pp->use_inband_status);
- 	mvneta_set_ucast_table(pp, -1);
- 	mvneta_set_special_mcast_table(pp, -1);
- 	mvneta_set_other_mcast_table(pp, -1);
-@@ -2614,26 +2577,11 @@ static irqreturn_t mvneta_isr(int irq, v
- 	return IRQ_HANDLED;
- }
- 
--static int mvneta_fixed_link_update(struct mvneta_port *pp,
--				    struct phy_device *phy)
-+static void mvneta_link_change(struct mvneta_port *pp)
- {
--	struct fixed_phy_status status;
--	struct fixed_phy_status changed = {};
- 	u32 gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS);
- 
--	status.link = !!(gmac_stat & MVNETA_GMAC_LINK_UP);
--	if (gmac_stat & MVNETA_GMAC_SPEED_1000)
--		status.speed = SPEED_1000;
--	else if (gmac_stat & MVNETA_GMAC_SPEED_100)
--		status.speed = SPEED_100;
--	else
--		status.speed = SPEED_10;
--	status.duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX);
--	changed.link = 1;
--	changed.speed = 1;
--	changed.duplex = 1;
--	fixed_phy_update_state(phy, &status, &changed);
--	return 0;
-+	phylink_mac_change(pp->phylink, !!(gmac_stat & MVNETA_GMAC_LINK_UP));
- }
- 
- /* NAPI handler
-@@ -2662,12 +2610,11 @@ static int mvneta_poll(struct napi_struc
- 		u32 cause_misc = mvreg_read(pp, MVNETA_INTR_MISC_CAUSE);
- 
- 		mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
--		if (pp->use_inband_status && (cause_misc &
--				(MVNETA_CAUSE_PHY_STATUS_CHANGE |
--				 MVNETA_CAUSE_LINK_CHANGE |
--				 MVNETA_CAUSE_PSC_SYNC_CHANGE))) {
--			mvneta_fixed_link_update(pp, pp->phy_dev);
--		}
-+
-+		if (cause_misc & (MVNETA_CAUSE_PHY_STATUS_CHANGE |
-+				  MVNETA_CAUSE_LINK_CHANGE |
-+				  MVNETA_CAUSE_PSC_SYNC_CHANGE))
-+			mvneta_link_change(pp);
- 	}
- 
- 	/* Release Tx descriptors */
-@@ -2983,7 +2930,7 @@ static void mvneta_start_dev(struct mvne
- 		    MVNETA_CAUSE_LINK_CHANGE |
- 		    MVNETA_CAUSE_PSC_SYNC_CHANGE);
- 
--	phy_start(pp->phy_dev);
-+	phylink_start(pp->phylink);
- 	netif_tx_start_all_queues(pp->dev);
- }
- 
-@@ -2991,7 +2938,7 @@ static void mvneta_stop_dev(struct mvnet
- {
- 	unsigned int cpu;
- 
--	phy_stop(pp->phy_dev);
-+	phylink_stop(pp->phylink);
- 
- 	for_each_online_cpu(cpu) {
- 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
-@@ -3161,99 +3108,219 @@ static int mvneta_set_mac_addr(struct ne
- 	return 0;
- }
- 
--static void mvneta_adjust_link(struct net_device *ndev)
-+static int mvneta_mac_support(struct net_device *ndev, unsigned int mode,
-+			      struct phylink_link_state *state)
-+{
-+	switch (mode) {
-+	case MLO_AN_8023Z:
-+		state->supported = SUPPORTED_1000baseT_Full |
-+				   SUPPORTED_Autoneg | SUPPORTED_Pause;
-+		state->advertising = ADVERTISED_1000baseT_Full |
-+				     ADVERTISED_Autoneg | ADVERTISED_Pause;
-+		state->an_enabled = 1;
-+		break;
-+
-+	case MLO_AN_FIXED:
-+		break;
-+
-+	default:
-+		state->supported = PHY_10BT_FEATURES |
-+				   PHY_100BT_FEATURES |
-+				   SUPPORTED_1000baseT_Full |
-+				   SUPPORTED_Autoneg;
-+		state->advertising = ADVERTISED_10baseT_Half |
-+				     ADVERTISED_10baseT_Full |
-+				     ADVERTISED_100baseT_Half |
-+				     ADVERTISED_100baseT_Full |
-+				     ADVERTISED_1000baseT_Full |
-+				     ADVERTISED_Autoneg;
-+		state->an_enabled = 1;
-+		break;
-+	}
-+	return 0;
-+}
-+
-+static int mvneta_mac_link_state(struct net_device *ndev,
-+				 struct phylink_link_state *state)
- {
- 	struct mvneta_port *pp = netdev_priv(ndev);
--	struct phy_device *phydev = pp->phy_dev;
--	int status_change = 0;
-+	u32 gmac_stat;
- 
--	if (phydev->link) {
--		if ((pp->speed != phydev->speed) ||
--		    (pp->duplex != phydev->duplex)) {
--			u32 val;
--
--			val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
--			val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
--				 MVNETA_GMAC_CONFIG_GMII_SPEED |
--				 MVNETA_GMAC_CONFIG_FULL_DUPLEX);
--
--			if (phydev->duplex)
--				val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
--
--			if (phydev->speed == SPEED_1000)
--				val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
--			else if (phydev->speed == SPEED_100)
--				val |= MVNETA_GMAC_CONFIG_MII_SPEED;
-+	gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS);
- 
--			mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+	if (gmac_stat & MVNETA_GMAC_SPEED_1000)
-+		state->speed = SPEED_1000;
-+	else if (gmac_stat & MVNETA_GMAC_SPEED_100)
-+		state->speed = SPEED_100;
-+	else
-+		state->speed = SPEED_10;
- 
--			pp->duplex = phydev->duplex;
--			pp->speed  = phydev->speed;
--		}
-+	state->an_complete = !!(gmac_stat & MVNETA_GMAC_AN_COMPLETE);
-+	state->sync = !!(gmac_stat & MVNETA_GMAC_SYNC_OK);
-+	state->link = !!(gmac_stat & MVNETA_GMAC_LINK_UP);
-+	state->duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX);
-+
-+	state->pause = 0;
-+	if (gmac_stat & MVNETA_GMAC_RX_FLOW_CTRL_ENABLE)
-+		state->pause |= MLO_PAUSE_RX;
-+	if (gmac_stat & MVNETA_GMAC_TX_FLOW_CTRL_ENABLE)
-+		state->pause |= MLO_PAUSE_TX;
-+
-+	return 1;
-+}
-+
-+static void mvneta_mac_an_restart(struct net_device *ndev, unsigned int mode)
-+{
-+	struct mvneta_port *pp = netdev_priv(ndev);
-+
-+	if (mode == MLO_AN_8023Z) {
-+		u32 gmac_an = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
-+			    gmac_an | MVNETA_GMAC_INBAND_RESTART_AN);
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
-+			    gmac_an & ~MVNETA_GMAC_INBAND_RESTART_AN);
- 	}
-+}
- 
--	if (phydev->link != pp->link) {
--		if (!phydev->link) {
--			pp->duplex = -1;
--			pp->speed = 0;
--		}
-+static void mvneta_mac_config(struct net_device *ndev, unsigned int mode,
-+	const struct phylink_link_state *state)
-+{
-+	struct mvneta_port *pp = netdev_priv(ndev);
-+	u32 new_ctrl0, gmac_ctrl0 = mvreg_read(pp, MVNETA_GMAC_CTRL_0);
-+	u32 new_ctrl2, gmac_ctrl2 = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
-+	u32 new_clk, gmac_clk = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
-+	u32 new_an, gmac_an = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+
-+	new_ctrl0 = gmac_ctrl0 & ~MVNETA_GMAC0_PORT_1000BASE_X;
-+	new_ctrl2 = gmac_ctrl2 & ~MVNETA_GMAC2_INBAND_AN_ENABLE;
-+	new_clk = gmac_clk & ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
-+	new_an = gmac_an & ~(MVNETA_GMAC_INBAND_AN_ENABLE |
-+			     MVNETA_GMAC_INBAND_RESTART_AN |
-+			     MVNETA_GMAC_CONFIG_MII_SPEED |
-+			     MVNETA_GMAC_CONFIG_GMII_SPEED |
-+			     MVNETA_GMAC_AN_SPEED_EN |
-+			     MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL |
-+			     MVNETA_GMAC_CONFIG_FLOW_CTRL |
-+			     MVNETA_GMAC_AN_FLOW_CTRL_EN |
-+			     MVNETA_GMAC_CONFIG_FULL_DUPLEX |
-+			     MVNETA_GMAC_AN_DUPLEX_EN);
-+
-+	if (state->advertising & ADVERTISED_Pause)
-+		new_an |= MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL;
-+
-+	switch (mode) {
-+	case MLO_AN_SGMII:
-+		/* SGMII mode receives the state from the PHY */
-+		new_ctrl2 |= MVNETA_GMAC2_INBAND_AN_ENABLE;
-+		new_clk |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
-+		new_an = (new_an & ~(MVNETA_GMAC_FORCE_LINK_DOWN |
-+				     MVNETA_GMAC_FORCE_LINK_PASS)) |
-+			 MVNETA_GMAC_INBAND_AN_ENABLE |
-+			 MVNETA_GMAC_AN_SPEED_EN |
-+			 MVNETA_GMAC_AN_DUPLEX_EN;
-+		break;
-+
-+	case MLO_AN_8023Z:
-+		/* 802.3z negotiation - only 1000base-X */
-+		new_ctrl0 |= MVNETA_GMAC0_PORT_1000BASE_X;
-+		new_clk |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
-+		new_an = (new_an & ~(MVNETA_GMAC_FORCE_LINK_DOWN |
-+				     MVNETA_GMAC_FORCE_LINK_PASS)) |
-+			 MVNETA_GMAC_INBAND_AN_ENABLE |
-+			 MVNETA_GMAC_CONFIG_GMII_SPEED |
-+			 /* The MAC only supports FD mode */
-+			 MVNETA_GMAC_CONFIG_FULL_DUPLEX;
-+
-+		if (state->an_enabled)
-+			new_an |= MVNETA_GMAC_AN_FLOW_CTRL_EN;
-+		break;
- 
--		pp->link = phydev->link;
--		status_change = 1;
-+	default:
-+		/* Phy or fixed speed */
-+		if (state->duplex)
-+			new_an |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
-+
-+		if (state->speed == SPEED_1000)
-+			new_an |= MVNETA_GMAC_CONFIG_GMII_SPEED;
-+		else if (state->speed == SPEED_100)
-+			new_an |= MVNETA_GMAC_CONFIG_MII_SPEED;
-+		break;
- 	}
- 
--	if (status_change) {
--		if (phydev->link) {
--			if (!pp->use_inband_status) {
--				u32 val = mvreg_read(pp,
--						  MVNETA_GMAC_AUTONEG_CONFIG);
--				val &= ~MVNETA_GMAC_FORCE_LINK_DOWN;
--				val |= MVNETA_GMAC_FORCE_LINK_PASS;
--				mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
--					    val);
--			}
--			mvneta_port_up(pp);
--		} else {
--			if (!pp->use_inband_status) {
--				u32 val = mvreg_read(pp,
--						  MVNETA_GMAC_AUTONEG_CONFIG);
--				val &= ~MVNETA_GMAC_FORCE_LINK_PASS;
--				val |= MVNETA_GMAC_FORCE_LINK_DOWN;
--				mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
--					    val);
--			}
--			mvneta_port_down(pp);
--		}
--		phy_print_status(phydev);
-+	/* Armada 370 documentation says we can only change the port mode
-+	 * and in-band enable when the link is down, so force it down
-+	 * while making these changes. We also do this for GMAC_CTRL2 */
-+	if ((new_ctrl0 ^ gmac_ctrl0) & MVNETA_GMAC0_PORT_1000BASE_X ||
-+	    (new_ctrl2 ^ gmac_ctrl2) & MVNETA_GMAC2_INBAND_AN_ENABLE ||
-+	    (new_an  ^ gmac_an) & MVNETA_GMAC_INBAND_AN_ENABLE) {
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
-+			    (gmac_an & ~MVNETA_GMAC_FORCE_LINK_PASS) |
-+			    MVNETA_GMAC_FORCE_LINK_DOWN);
-+	}
-+
-+	if (new_ctrl0 != gmac_ctrl0)
-+		mvreg_write(pp, MVNETA_GMAC_CTRL_0, new_ctrl0);
-+	if (new_ctrl2 != gmac_ctrl2)
-+		mvreg_write(pp, MVNETA_GMAC_CTRL_2, new_ctrl2);
-+	if (new_clk != gmac_clk)
-+		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, new_clk);
-+	if (new_an != gmac_an)
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, new_an);
-+}
-+
-+static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode)
-+{
-+	struct mvneta_port *pp = netdev_priv(ndev);
-+	u32 val;
-+
-+	mvneta_port_down(pp);
-+
-+	if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED) {
-+		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+		val &= ~MVNETA_GMAC_FORCE_LINK_PASS;
-+		val |= MVNETA_GMAC_FORCE_LINK_DOWN;
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
- 	}
- }
- 
--static int mvneta_mdio_probe(struct mvneta_port *pp)
-+static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode,
-+			       struct phy_device *phy)
- {
--	struct phy_device *phy_dev;
-+	struct mvneta_port *pp = netdev_priv(ndev);
-+	u32 val;
-+
-+	if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED) {
-+		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
-+		val &= ~MVNETA_GMAC_FORCE_LINK_DOWN;
-+		val |= MVNETA_GMAC_FORCE_LINK_PASS;
-+		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
-+	}
- 
--	phy_dev = of_phy_connect(pp->dev, pp->phy_node, mvneta_adjust_link, 0,
--				 pp->phy_interface);
--	if (!phy_dev) {
--		netdev_err(pp->dev, "could not find the PHY\n");
--		return -ENODEV;
--	}
--
--	phy_dev->supported &= PHY_GBIT_FEATURES;
--	phy_dev->advertising = phy_dev->supported;
--
--	pp->phy_dev = phy_dev;
--	pp->link    = 0;
--	pp->duplex  = 0;
--	pp->speed   = 0;
-+	mvneta_port_up(pp);
-+}
- 
--	return 0;
-+static const struct phylink_mac_ops mvneta_phylink_ops = {
-+	.mac_get_support = mvneta_mac_support,
-+	.mac_link_state = mvneta_mac_link_state,
-+	.mac_an_restart = mvneta_mac_an_restart,
-+	.mac_config = mvneta_mac_config,
-+	.mac_link_down = mvneta_mac_link_down,
-+	.mac_link_up = mvneta_mac_link_up,
-+};
-+
-+static int mvneta_mdio_probe(struct mvneta_port *pp)
-+{
-+	int err = phylink_of_phy_connect(pp->phylink, pp->dn);
-+	if (err)
-+		netdev_err(pp->dev, "could not attach PHY\n");
-+
-+	return err;
- }
- 
- static void mvneta_mdio_remove(struct mvneta_port *pp)
- {
--	phy_disconnect(pp->phy_dev);
--	pp->phy_dev = NULL;
-+	phylink_disconnect_phy(pp->phylink);
- }
- 
- /* Electing a CPU must be done in an atomic way: it should be done
-@@ -3501,10 +3568,7 @@ static int mvneta_ioctl(struct net_devic
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
- 
--	if (!pp->phy_dev)
--		return -ENOTSUPP;
--
--	return phy_mii_ioctl(pp->phy_dev, ifr, cmd);
-+	return phylink_mii_ioctl(pp->phylink, ifr, cmd);
- }
- 
- /* Ethtool methods */
-@@ -3514,54 +3578,15 @@ int mvneta_ethtool_get_settings(struct n
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
- 
--	if (!pp->phy_dev)
--		return -ENODEV;
--
--	return phy_ethtool_gset(pp->phy_dev, cmd);
-+	return phylink_ethtool_get_settings(pp->phylink, cmd);
- }
- 
- /* Set settings (phy address, speed) for ethtools */
- int mvneta_ethtool_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
- {
- 	struct mvneta_port *pp = netdev_priv(dev);
--	struct phy_device *phydev = pp->phy_dev;
--
--	if (!phydev)
--		return -ENODEV;
- 
--	if ((cmd->autoneg == AUTONEG_ENABLE) != pp->use_inband_status) {
--		u32 val;
--
--		mvneta_set_autoneg(pp, cmd->autoneg == AUTONEG_ENABLE);
--
--		if (cmd->autoneg == AUTONEG_DISABLE) {
--			val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
--			val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
--				 MVNETA_GMAC_CONFIG_GMII_SPEED |
--				 MVNETA_GMAC_CONFIG_FULL_DUPLEX);
--
--			if (phydev->duplex)
--				val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
--
--			if (phydev->speed == SPEED_1000)
--				val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
--			else if (phydev->speed == SPEED_100)
--				val |= MVNETA_GMAC_CONFIG_MII_SPEED;
--
--			mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
--		}
--
--		pp->use_inband_status = (cmd->autoneg == AUTONEG_ENABLE);
--		netdev_info(pp->dev, "autoneg status set to %i\n",
--			    pp->use_inband_status);
--
--		if (netif_running(dev)) {
--			mvneta_port_down(pp);
--			mvneta_port_up(pp);
--		}
--	}
--
--	return phy_ethtool_sset(pp->phy_dev, cmd);
-+	return phylink_ethtool_set_settings(pp->phylink, cmd);
- }
- 
- /* Set interrupt coalescing for ethtools */
-@@ -3669,7 +3694,8 @@ static void mvneta_ethtool_update_stats(
- {
- 	const struct mvneta_statistic *s;
- 	void __iomem *base = pp->base;
--	u32 high, low, val;
-+	u32 high, low;
-+	u64 val;
- 	u64 val64;
- 	int i;
- 
-@@ -3964,14 +3990,13 @@ static int mvneta_probe(struct platform_
- 	const struct mbus_dram_target_info *dram_target_info;
- 	struct resource *res;
- 	struct device_node *dn = pdev->dev.of_node;
--	struct device_node *phy_node;
- 	struct device_node *bm_node;
- 	struct mvneta_port *pp;
- 	struct net_device *dev;
-+	struct phylink *phylink;
- 	const char *dt_mac_addr;
- 	char hw_mac_addr[ETH_ALEN];
- 	const char *mac_from;
--	const char *managed;
- 	int tx_csum_limit;
- 	int phy_mode;
- 	int err;
-@@ -3987,31 +4012,11 @@ static int mvneta_probe(struct platform_
- 		goto err_free_netdev;
- 	}
- 
--	phy_node = of_parse_phandle(dn, "phy", 0);
--	if (!phy_node) {
--		if (!of_phy_is_fixed_link(dn)) {
--			dev_err(&pdev->dev, "no PHY specified\n");
--			err = -ENODEV;
--			goto err_free_irq;
--		}
--
--		err = of_phy_register_fixed_link(dn);
--		if (err < 0) {
--			dev_err(&pdev->dev, "cannot register fixed PHY\n");
--			goto err_free_irq;
--		}
--
--		/* In the case of a fixed PHY, the DT node associated
--		 * to the PHY is the Ethernet MAC DT node.
--		 */
--		phy_node = of_node_get(dn);
--	}
--
- 	phy_mode = of_get_phy_mode(dn);
- 	if (phy_mode < 0) {
- 		dev_err(&pdev->dev, "incorrect phy-mode\n");
- 		err = -EINVAL;
--		goto err_put_phy_node;
-+		goto err_free_irq;
- 	}
- 
- 	dev->tx_queue_len = MVNETA_MAX_TXD;
-@@ -4022,12 +4027,7 @@ static int mvneta_probe(struct platform_
- 
- 	pp = netdev_priv(dev);
- 	spin_lock_init(&pp->lock);
--	pp->phy_node = phy_node;
--	pp->phy_interface = phy_mode;
--
--	err = of_property_read_string(dn, "managed", &managed);
--	pp->use_inband_status = (err == 0 &&
--				 strcmp(managed, "in-band-status") == 0);
-+	pp->dn = dn;
- 	pp->cpu_notifier.notifier_call = mvneta_percpu_notifier;
- 
- 	pp->rxq_def = rxq_def;
-@@ -4037,7 +4037,7 @@ static int mvneta_probe(struct platform_
- 	pp->clk = devm_clk_get(&pdev->dev, NULL);
- 	if (IS_ERR(pp->clk)) {
- 		err = PTR_ERR(pp->clk);
--		goto err_put_phy_node;
-+		goto err_free_irq;
- 	}
- 
- 	clk_prepare_enable(pp->clk);
-@@ -4140,6 +4140,14 @@ static int mvneta_probe(struct platform_
- 	dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
- 	dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
- 
-+	phylink = phylink_create(dev, dn, phy_mode, &mvneta_phylink_ops);
-+	if (IS_ERR(phylink)) {
-+		err = PTR_ERR(phylink);
-+		goto err_free_stats;
-+	}
-+
-+	pp->phylink = phylink;
-+
- 	err = register_netdev(dev);
- 	if (err < 0) {
- 		dev_err(&pdev->dev, "failed to register\n");
-@@ -4151,13 +4159,6 @@ static int mvneta_probe(struct platform_
- 
- 	platform_set_drvdata(pdev, pp->dev);
- 
--	if (pp->use_inband_status) {
--		struct phy_device *phy = of_phy_find_device(dn);
--
--		mvneta_fixed_link_update(pp, phy);
--
--		put_device(&phy->dev);
--	}
- 
- 	return 0;
- 
-@@ -4169,13 +4170,13 @@ err_netdev:
- 				       1 << pp->id);
- 	}
- err_free_stats:
-+	if (pp->phylink)
-+		phylink_destroy(pp->phylink);
- 	free_percpu(pp->stats);
- err_free_ports:
- 	free_percpu(pp->ports);
- err_clk:
- 	clk_disable_unprepare(pp->clk);
--err_put_phy_node:
--	of_node_put(phy_node);
- err_free_irq:
- 	irq_dispose_mapping(dev->irq);
- err_free_netdev:
-@@ -4194,7 +4195,7 @@ static int mvneta_remove(struct platform
- 	free_percpu(pp->ports);
- 	free_percpu(pp->stats);
- 	irq_dispose_mapping(dev->irq);
--	of_node_put(pp->phy_node);
-+	phylink_destroy(pp->phylink);
- 	free_netdev(dev);
- 
- 	if (pp->bm_priv) {
diff --git a/target/linux/mvebu/patches-4.4/135-phy-fixed-phy-remove-fixed_phy_update_state.patch b/target/linux/mvebu/patches-4.4/135-phy-fixed-phy-remove-fixed_phy_update_state.patch
deleted file mode 100644
index 58c9aab..0000000
--- a/target/linux/mvebu/patches-4.4/135-phy-fixed-phy-remove-fixed_phy_update_state.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 9be436bdb67c1f4aa9f33f2477f94e1f58a0ff02 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Fri, 2 Oct 2015 22:46:54 +0100
-Subject: [PATCH 723/744] phy: fixed-phy: remove fixed_phy_update_state()
-
-mvneta is the only user of fixed_phy_update_state(), which has been
-converted to use phylink instead.  Remove fixed_phy_update_state().
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/fixed_phy.c | 31 -------------------------------
- include/linux/phy_fixed.h   |  9 ---------
- 2 files changed, 40 deletions(-)
-
---- a/drivers/net/phy/fixed_phy.c
-+++ b/drivers/net/phy/fixed_phy.c
-@@ -115,37 +115,6 @@ int fixed_phy_set_link_update(struct phy
- }
- EXPORT_SYMBOL_GPL(fixed_phy_set_link_update);
- 
--int fixed_phy_update_state(struct phy_device *phydev,
--			   const struct fixed_phy_status *status,
--			   const struct fixed_phy_status *changed)
--{
--	struct fixed_mdio_bus *fmb = &platform_fmb;
--	struct fixed_phy *fp;
--
--	if (!phydev || phydev->bus != fmb->mii_bus)
--		return -EINVAL;
--
--	list_for_each_entry(fp, &fmb->phys, node) {
--		if (fp->addr == phydev->addr) {
--			write_seqcount_begin(&fp->seqcount);
--#define _UPD(x) if (changed->x) \
--	fp->status.x = status->x
--			_UPD(link);
--			_UPD(speed);
--			_UPD(duplex);
--			_UPD(pause);
--			_UPD(asym_pause);
--#undef _UPD
--			fixed_phy_update(fp);
--			write_seqcount_end(&fp->seqcount);
--			return 0;
--		}
--	}
--
--	return -ENOENT;
--}
--EXPORT_SYMBOL(fixed_phy_update_state);
--
- int fixed_phy_add(unsigned int irq, int phy_addr,
- 		  struct fixed_phy_status *status,
- 		  int link_gpio)
---- a/include/linux/phy_fixed.h
-+++ b/include/linux/phy_fixed.h
-@@ -23,9 +23,6 @@ extern void fixed_phy_del(int phy_addr);
- extern int fixed_phy_set_link_update(struct phy_device *phydev,
- 			int (*link_update)(struct net_device *,
- 					   struct fixed_phy_status *));
--extern int fixed_phy_update_state(struct phy_device *phydev,
--			   const struct fixed_phy_status *status,
--			   const struct fixed_phy_status *changed);
- #else
- static inline int fixed_phy_add(unsigned int irq, int phy_id,
- 				struct fixed_phy_status *status,
-@@ -50,12 +47,6 @@ static inline int fixed_phy_set_link_upd
- {
- 	return -ENODEV;
- }
--static inline int fixed_phy_update_state(struct phy_device *phydev,
--			   const struct fixed_phy_status *status,
--			   const struct fixed_phy_status *changed)
--{
--	return -ENODEV;
--}
- #endif /* CONFIG_FIXED_PHY */
- 
- #endif /* __PHY_FIXED_H */
diff --git a/target/linux/mvebu/patches-4.4/136-phylink-add-ethtool-nway_reset-support.patch b/target/linux/mvebu/patches-4.4/136-phylink-add-ethtool-nway_reset-support.patch
deleted file mode 100644
index ade904e..0000000
--- a/target/linux/mvebu/patches-4.4/136-phylink-add-ethtool-nway_reset-support.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From d6bd25b692378ec17bdb1023d398c03c45829947 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 20:27:19 +0100
-Subject: [PATCH 724/744] phylink: add ethtool nway_reset support
-
-Add ethtool nway_reset support to phylink, to allow userspace to
-request a re-negotiation of the link.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phylink.c | 14 ++++++++++++++
- include/linux/phylink.h   |  1 +
- 2 files changed, 15 insertions(+)
-
---- a/drivers/net/phy/phylink.c
-+++ b/drivers/net/phy/phylink.c
-@@ -687,6 +687,20 @@ int phylink_ethtool_set_settings(struct
- }
- EXPORT_SYMBOL_GPL(phylink_ethtool_set_settings);
- 
-+int phylink_ethtool_nway_reset(struct phylink *pl)
-+{
-+	int ret = 0;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->phydev)
-+		ret = genphy_restart_aneg(pl->phydev);
-+	phylink_mac_an_restart(pl);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
-+
- /* This emulates MII registers for a fixed-mode phy operating as per the
-  * passed in state. "aneg" defines if we report negotiation is possible.
-  *
---- a/include/linux/phylink.h
-+++ b/include/linux/phylink.h
-@@ -65,6 +65,7 @@ void phylink_stop(struct phylink *);
- 
- int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
- int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
-+int phylink_ethtool_nway_reset(struct phylink *);
- int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
- 
- void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
diff --git a/target/linux/mvebu/patches-4.4/137-net-mvneta-add-nway_reset-support.patch b/target/linux/mvebu/patches-4.4/137-net-mvneta-add-nway_reset-support.patch
deleted file mode 100644
index 034b596..0000000
--- a/target/linux/mvebu/patches-4.4/137-net-mvneta-add-nway_reset-support.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 244bee2889d08f876c64c335765a8ea6de0f5381 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 19:40:31 +0100
-Subject: [PATCH 725/744] net: mvneta: add nway_reset support
-
-Add ethtool nway_reset support to mvneta via phylink, so that userspace
-can request the link in whatever mode to be renegotiated via
-ethtool -r ethX.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3589,6 +3589,13 @@ int mvneta_ethtool_set_settings(struct n
- 	return phylink_ethtool_set_settings(pp->phylink, cmd);
- }
- 
-+static int mvneta_ethtool_nway_reset(struct net_device *dev)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+
-+	return phylink_ethtool_nway_reset(pp->phylink);
-+}
-+
- /* Set interrupt coalescing for ethtools */
- static int mvneta_ethtool_set_coalesce(struct net_device *dev,
- 				       struct ethtool_coalesce *c)
-@@ -3853,6 +3860,7 @@ const struct ethtool_ops mvneta_eth_tool
- 	.get_link       = ethtool_op_get_link,
- 	.get_settings   = mvneta_ethtool_get_settings,
- 	.set_settings   = mvneta_ethtool_set_settings,
-+	.nway_reset	= mvneta_ethtool_nway_reset,
- 	.set_coalesce   = mvneta_ethtool_set_coalesce,
- 	.get_coalesce   = mvneta_ethtool_get_coalesce,
- 	.get_drvinfo    = mvneta_ethtool_get_drvinfo,
diff --git a/target/linux/mvebu/patches-4.4/138-phylink-add-flow-control-support.patch b/target/linux/mvebu/patches-4.4/138-phylink-add-flow-control-support.patch
deleted file mode 100644
index 95b8a81..0000000
--- a/target/linux/mvebu/patches-4.4/138-phylink-add-flow-control-support.patch
+++ /dev/null
@@ -1,262 +0,0 @@
-From f566177aa6661e646b83526f24391a568ffd1a75 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 20:32:07 +0100
-Subject: [PATCH 726/744] phylink: add flow control support
-
-Add flow control support, including ethtool support, to phylink.  We
-add support to allow ethtool to get and set the current flow control
-settings, and the 802.3 specified resolution for the local and remote
-link partner abilities.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phylink.c | 145 +++++++++++++++++++++++++++++++++++++++++-----
- include/linux/phylink.h   |   8 +++
- 2 files changed, 139 insertions(+), 14 deletions(-)
-
---- a/drivers/net/phy/phylink.c
-+++ b/drivers/net/phy/phylink.c
-@@ -91,10 +91,12 @@ static int phylink_parse_fixedlink(struc
- 		pl->link_config.an_complete = 1;
- 		pl->link_config.speed = speed;
- 		pl->link_config.duplex = DUPLEX_HALF;
--		pl->link_config.pause = MLO_PAUSE_NONE;
- 
- 		if (of_property_read_bool(fixed_node, "full-duplex"))
- 			pl->link_config.duplex = DUPLEX_FULL;
-+
-+		/* We treat the "pause" and "asym-pause" terminology as
-+		 * defining the link partner's ability. */
- 		if (of_property_read_bool(fixed_node, "pause"))
- 			pl->link_config.pause |= MLO_PAUSE_SYM;
- 		if (of_property_read_bool(fixed_node, "asym-pause"))
-@@ -118,7 +120,6 @@ static int phylink_parse_fixedlink(struc
- 			pl->link_config.duplex = be32_to_cpu(fixed_prop[1]) ?
- 						DUPLEX_FULL : DUPLEX_HALF;
- 			pl->link_config.speed = be32_to_cpu(fixed_prop[2]);
--			pl->link_config.pause = MLO_PAUSE_NONE;
- 			if (be32_to_cpu(fixed_prop[3]))
- 				pl->link_config.pause |= MLO_PAUSE_SYM;
- 			if (be32_to_cpu(fixed_prop[4]))
-@@ -130,16 +131,6 @@ static int phylink_parse_fixedlink(struc
- 	}
- 
- 	if (pl->link_an_mode == MLO_AN_FIXED) {
--		/* Generate the supported/advertising masks */
--		if (pl->link_config.pause & MLO_PAUSE_SYM) {
--			pl->link_config.supported |= SUPPORTED_Pause;
--			pl->link_config.advertising |= ADVERTISED_Pause;
--		}
--		if (pl->link_config.pause & MLO_PAUSE_ASYM) {
--			pl->link_config.supported |= SUPPORTED_Asym_Pause;
--			pl->link_config.advertising |= ADVERTISED_Asym_Pause;
--		}
--
- 		if (pl->link_config.speed > SPEED_1000 &&
- 		    pl->link_config.duplex != DUPLEX_FULL)
- 			netdev_warn(pl->netdev, "fixed link specifies half duplex for %dMbps link?\n",
-@@ -242,6 +233,56 @@ static void phylink_get_fixed_state(stru
- 		state->link = !!gpiod_get_value(pl->link_gpio);
- }
- 
-+/* Flow control is resolved according to our and the link partners
-+ * advertisments using the following drawn from the 802.3 specs:
-+ *  Local device  Link partner
-+ *  Pause AsymDir Pause AsymDir Result
-+ *    1     X       1     X     TX+RX
-+ *    0     1       1     1     RX
-+ *    1     1       0     1     TX
-+ */
-+static void phylink_resolve_flow(struct phylink *pl,
-+	struct phylink_link_state *state)
-+{
-+	int new_pause = 0;
-+
-+	if (pl->link_config.pause & MLO_PAUSE_AN) {
-+		int pause = 0;
-+
-+		if (pl->link_config.advertising & ADVERTISED_Pause)
-+			pause |= MLO_PAUSE_SYM;
-+		if (pl->link_config.advertising & ADVERTISED_Asym_Pause)
-+			pause |= MLO_PAUSE_ASYM;
-+
-+		pause &= state->pause;
-+
-+		if (pause & MLO_PAUSE_SYM)
-+			new_pause = MLO_PAUSE_TX | MLO_PAUSE_RX;
-+		else if (pause & MLO_PAUSE_ASYM)
-+			new_pause = state->pause & MLO_PAUSE_SYM ?
-+				 MLO_PAUSE_RX : MLO_PAUSE_TX;
-+	} else {
-+		new_pause = pl->link_config.pause & MLO_PAUSE_TXRX_MASK;
-+	}
-+
-+	state->pause &= ~MLO_PAUSE_TXRX_MASK;
-+	state->pause |= new_pause;
-+}
-+
-+static const char *phylink_pause_to_str(int pause)
-+{
-+	switch (pause & MLO_PAUSE_TXRX_MASK) {
-+	case MLO_PAUSE_TX | MLO_PAUSE_RX:
-+		return "rx/tx";
-+	case MLO_PAUSE_TX:
-+		return "tx";
-+	case MLO_PAUSE_RX:
-+		return "rx";
-+	default:
-+		return "off";
-+	}
-+}
-+
- extern const char *phy_speed_to_str(int speed);
- 
- static void phylink_resolve(struct work_struct *w)
-@@ -257,6 +298,7 @@ static void phylink_resolve(struct work_
- 		switch (pl->link_an_mode) {
- 		case MLO_AN_PHY:
- 			link_state = pl->phy_state;
-+			phylink_resolve_flow(pl, &link_state);
- 			break;
- 
- 		case MLO_AN_FIXED:
-@@ -265,9 +307,12 @@ static void phylink_resolve(struct work_
- 
- 		case MLO_AN_SGMII:
- 			phylink_get_mac_state(pl, &link_state);
--			if (pl->phydev)
-+			if (pl->phydev) {
- 				link_state.link = link_state.link &&
- 						  pl->phy_state.link;
-+				link_state.pause |= pl->phy_state.pause;
-+				phylink_resolve_flow(pl, &link_state);
-+			}
- 			break;
- 
- 		case MLO_AN_8023Z:
-@@ -297,7 +342,7 @@ static void phylink_resolve(struct work_
- 				    "Link is Up - %s/%s - flow control %s\n",
- 				    phy_speed_to_str(link_state.speed),
- 				    link_state.duplex ? "Full" : "Half",
--				    link_state.pause ? "rx/tx" : "off");
-+				    phylink_pause_to_str(link_state.pause));
- 		}
- 	}
- 	mutex_unlock(&pl->state_mutex);
-@@ -326,6 +371,7 @@ struct phylink *phylink_create(struct ne
- 	pl->link_interface = iface;
- 	pl->link_port_support = SUPPORTED_MII;
- 	pl->link_port = PORT_MII;
-+	pl->link_config.pause = MLO_PAUSE_AN;
- 	pl->ops = ops;
- 	__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
- 
-@@ -507,6 +553,7 @@ void phylink_start(struct phylink *pl)
- 	 * a fixed-link to start with the correct parameters, and also
- 	 * ensures that we set the appropriate advertisment for Serdes links.
- 	 */
-+	phylink_resolve_flow(pl, &pl->link_config);
- 	phylink_mac_config(pl, &pl->link_config);
- 
- 	clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
-@@ -701,6 +748,76 @@ int phylink_ethtool_nway_reset(struct ph
- }
- EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
- 
-+void phylink_ethtool_get_pauseparam(struct phylink *pl,
-+				    struct ethtool_pauseparam *pause)
-+{
-+	mutex_lock(&pl->config_mutex);
-+
-+	pause->autoneg = !!(pl->link_config.pause & MLO_PAUSE_AN);
-+	pause->rx_pause = !!(pl->link_config.pause & MLO_PAUSE_RX);
-+	pause->tx_pause = !!(pl->link_config.pause & MLO_PAUSE_TX);
-+
-+	mutex_unlock(&pl->config_mutex);
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_get_pauseparam);
-+
-+static int __phylink_ethtool_set_pauseparam(struct phylink *pl,
-+					    struct ethtool_pauseparam *pause)
-+{
-+	struct phylink_link_state *config = &pl->link_config;
-+
-+	if (!(config->supported & (SUPPORTED_Pause | SUPPORTED_Asym_Pause)))
-+		return -EOPNOTSUPP;
-+
-+	if (!(config->supported & SUPPORTED_Asym_Pause) &&
-+	    !pause->autoneg && pause->rx_pause != pause->tx_pause)
-+		return -EINVAL;
-+
-+	config->pause &= ~(MLO_PAUSE_AN | MLO_PAUSE_TXRX_MASK);
-+
-+	if (pause->autoneg)
-+		config->pause |= MLO_PAUSE_AN;
-+	if (pause->rx_pause)
-+		config->pause |= MLO_PAUSE_RX;
-+	if (pause->tx_pause)
-+		config->pause |= MLO_PAUSE_TX;
-+
-+	switch (pl->link_an_mode) {
-+	case MLO_AN_PHY:
-+		/* Silently mark the carrier down, and then trigger a resolve */
-+		netif_carrier_off(pl->netdev);
-+		phylink_run_resolve(pl);
-+		break;
-+
-+	case MLO_AN_FIXED:
-+		/* Should we allow fixed links to change against the config? */
-+		phylink_resolve_flow(pl, config);
-+		phylink_mac_config(pl, config);
-+		break;
-+
-+	case MLO_AN_SGMII:
-+	case MLO_AN_8023Z:
-+		phylink_mac_config(pl, config);
-+		phylink_mac_an_restart(pl);
-+		break;
-+	}
-+
-+	return 0;
-+}
-+
-+int phylink_ethtool_set_pauseparam(struct phylink *pl,
-+				   struct ethtool_pauseparam *pause)
-+{
-+	int ret;
-+
-+	mutex_lock(&pl->config_mutex);
-+	ret = __phylink_ethtool_set_pauseparam(pl, pause);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam);
-+
- /* This emulates MII registers for a fixed-mode phy operating as per the
-  * passed in state. "aneg" defines if we report negotiation is possible.
-  *
---- a/include/linux/phylink.h
-+++ b/include/linux/phylink.h
-@@ -13,6 +13,10 @@ enum {
- 	MLO_PAUSE_NONE,
- 	MLO_PAUSE_ASYM = BIT(0),
- 	MLO_PAUSE_SYM = BIT(1),
-+	MLO_PAUSE_RX = BIT(2),
-+	MLO_PAUSE_TX = BIT(3),
-+	MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
-+	MLO_PAUSE_AN = BIT(4),
- 
- 	MLO_AN_PHY = 0,
- 	MLO_AN_FIXED,
-@@ -66,6 +70,10 @@ void phylink_stop(struct phylink *);
- int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
- int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
- int phylink_ethtool_nway_reset(struct phylink *);
-+void phylink_ethtool_get_pauseparam(struct phylink *,
-+				    struct ethtool_pauseparam *);
-+int phylink_ethtool_set_pauseparam(struct phylink *,
-+				   struct ethtool_pauseparam *);
- int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
- 
- void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
diff --git a/target/linux/mvebu/patches-4.4/139-net-mvneta-add-flow-control-support-via-phylink.patch b/target/linux/mvebu/patches-4.4/139-net-mvneta-add-flow-control-support-via-phylink.patch
deleted file mode 100644
index 75cd46e..0000000
--- a/target/linux/mvebu/patches-4.4/139-net-mvneta-add-flow-control-support-via-phylink.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 7bd34822b9922beb22a6384d9190646105d259d8 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 17:41:44 +0100
-Subject: [PATCH 727/744] net: mvneta: add flow control support via phylink
-
-Add flow control support to mvneta, including the ethtool hooks.  This
-uses the phylink code to calculate the result of autonegotiation where
-a phy is attached, and to handle the ethtool settings.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++++++++++++-
- 1 file changed, 21 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3208,6 +3208,8 @@ static void mvneta_mac_config(struct net
- 
- 	if (state->advertising & ADVERTISED_Pause)
- 		new_an |= MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL;
-+	if (state->pause & MLO_PAUSE_TXRX_MASK)
-+		new_an |= MVNETA_GMAC_CONFIG_FLOW_CTRL;
- 
- 	switch (mode) {
- 	case MLO_AN_SGMII:
-@@ -3232,7 +3234,7 @@ static void mvneta_mac_config(struct net
- 			 /* The MAC only supports FD mode */
- 			 MVNETA_GMAC_CONFIG_FULL_DUPLEX;
- 
--		if (state->an_enabled)
-+		if (state->pause & MLO_PAUSE_AN && state->an_enabled)
- 			new_an |= MVNETA_GMAC_AN_FLOW_CTRL_EN;
- 		break;
- 
-@@ -3685,6 +3687,22 @@ static int mvneta_ethtool_set_ringparam(
- 	return 0;
- }
- 
-+static void mvneta_ethtool_get_pauseparam(struct net_device *dev,
-+					  struct ethtool_pauseparam *pause)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+
-+	phylink_ethtool_get_pauseparam(pp->phylink, pause);
-+}
-+
-+static int mvneta_ethtool_set_pauseparam(struct net_device *dev,
-+					 struct ethtool_pauseparam *pause)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+
-+	return phylink_ethtool_set_pauseparam(pp->phylink, pause);
-+}
-+
- static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
- 				       u8 *data)
- {
-@@ -3866,6 +3884,8 @@ const struct ethtool_ops mvneta_eth_tool
- 	.get_drvinfo    = mvneta_ethtool_get_drvinfo,
- 	.get_ringparam  = mvneta_ethtool_get_ringparam,
- 	.set_ringparam	= mvneta_ethtool_set_ringparam,
-+	.get_pauseparam	= mvneta_ethtool_get_pauseparam,
-+	.set_pauseparam	= mvneta_ethtool_set_pauseparam,
- 	.get_strings	= mvneta_ethtool_get_strings,
- 	.get_ethtool_stats = mvneta_ethtool_get_stats,
- 	.get_sset_count	= mvneta_ethtool_get_sset_count,
diff --git a/target/linux/mvebu/patches-4.4/140-net-mvneta-enable-flow-control-for-PHY-connections.patch b/target/linux/mvebu/patches-4.4/140-net-mvneta-enable-flow-control-for-PHY-connections.patch
deleted file mode 100644
index e10574c..0000000
--- a/target/linux/mvebu/patches-4.4/140-net-mvneta-enable-flow-control-for-PHY-connections.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 62f8a12044265df11531750a240e516a5f1ff433 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 00:34:08 +0100
-Subject: [PATCH 728/744] net: mvneta: enable flow control for PHY connections
-
-Enable flow control support for PHY connections by indicating our
-support via the ethtool capabilities.  phylink takes care of the
-appropriate handling.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/ethernet/marvell/mvneta.c | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3127,12 +3127,14 @@ static int mvneta_mac_support(struct net
- 		state->supported = PHY_10BT_FEATURES |
- 				   PHY_100BT_FEATURES |
- 				   SUPPORTED_1000baseT_Full |
-+				   SUPPORTED_Pause |
- 				   SUPPORTED_Autoneg;
- 		state->advertising = ADVERTISED_10baseT_Half |
- 				     ADVERTISED_10baseT_Full |
- 				     ADVERTISED_100baseT_Half |
- 				     ADVERTISED_100baseT_Full |
- 				     ADVERTISED_1000baseT_Full |
-+				     ADVERTISED_Pause |
- 				     ADVERTISED_Autoneg;
- 		state->an_enabled = 1;
- 		break;
diff --git a/target/linux/mvebu/patches-4.4/141-net-mvneta-enable-flow-control-for-fixed-connections.patch b/target/linux/mvebu/patches-4.4/141-net-mvneta-enable-flow-control-for-fixed-connections.patch
deleted file mode 100644
index 16ffab3..0000000
--- a/target/linux/mvebu/patches-4.4/141-net-mvneta-enable-flow-control-for-fixed-connections.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 4c3e2dc08a11fb1273ca62467f1d06e59866bad3 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at armlinux.org.uk>
-Date: Tue, 12 Jul 2016 00:04:13 +0100
-Subject: [PATCH 729/744] net: mvneta: enable flow control for fixed
- connections
-
-Allow symetric flow control to be enabled for fixed link connections as
-well as other types of connections by setting the supported and
-advertised capability bits.
-
-Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
----
- drivers/net/ethernet/marvell/mvneta.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3114,9 +3114,9 @@ static int mvneta_mac_support(struct net
- 	switch (mode) {
- 	case MLO_AN_8023Z:
- 		state->supported = SUPPORTED_1000baseT_Full |
--				   SUPPORTED_Autoneg | SUPPORTED_Pause;
-+				   SUPPORTED_Autoneg;
- 		state->advertising = ADVERTISED_1000baseT_Full |
--				     ADVERTISED_Autoneg | ADVERTISED_Pause;
-+				     ADVERTISED_Autoneg;
- 		state->an_enabled = 1;
- 		break;
- 
-@@ -3127,18 +3127,21 @@ static int mvneta_mac_support(struct net
- 		state->supported = PHY_10BT_FEATURES |
- 				   PHY_100BT_FEATURES |
- 				   SUPPORTED_1000baseT_Full |
--				   SUPPORTED_Pause |
- 				   SUPPORTED_Autoneg;
- 		state->advertising = ADVERTISED_10baseT_Half |
- 				     ADVERTISED_10baseT_Full |
- 				     ADVERTISED_100baseT_Half |
- 				     ADVERTISED_100baseT_Full |
- 				     ADVERTISED_1000baseT_Full |
--				     ADVERTISED_Pause |
- 				     ADVERTISED_Autoneg;
- 		state->an_enabled = 1;
- 		break;
- 	}
-+
-+	/* All modes support flow control */
-+	state->supported |= SUPPORTED_Pause;
-+	state->advertising |= ADVERTISED_Pause;
-+
- 	return 0;
- }
- 
diff --git a/target/linux/mvebu/patches-4.4/142-phylink-add-EEE-support.patch b/target/linux/mvebu/patches-4.4/142-phylink-add-EEE-support.patch
deleted file mode 100644
index b06ec76..0000000
--- a/target/linux/mvebu/patches-4.4/142-phylink-add-EEE-support.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From ffba226d73a2be262fff12d30aecf76d107b2ace Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 21:19:53 +0100
-Subject: [PATCH 730/744] phylink: add EEE support
-
-Add EEE hooks to phylink to allow the phylib EEE functions for the
-connected phy to be safely accessed.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phylink.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++-
- include/linux/phylink.h   |  7 +++++-
- 2 files changed, 63 insertions(+), 2 deletions(-)
-
---- a/drivers/net/phy/phylink.c
-+++ b/drivers/net/phy/phylink.c
-@@ -334,7 +334,8 @@ static void phylink_resolve(struct work_
- 			if (pl->phydev)
- 				phylink_mac_config(pl, &link_state);
- 
--			pl->ops->mac_link_up(ndev, pl->link_an_mode);
-+			pl->ops->mac_link_up(ndev, pl->link_an_mode,
-+					     pl->phydev);
- 
- 			netif_carrier_on(ndev);
- 
-@@ -818,6 +819,61 @@ int phylink_ethtool_set_pauseparam(struc
- }
- EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam);
- 
-+int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
-+{
-+	int ret = -EPROTONOSUPPORT;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->phydev)
-+		ret = phy_init_eee(pl->phydev, clk_stop_enable);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_init_eee);
-+
-+int phylink_get_eee_err(struct phylink *pl)
-+{
-+	int ret = 0;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->phydev)
-+		ret = phy_get_eee_err(pl->phydev);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_get_eee_err);
-+
-+int phylink_ethtool_get_eee(struct phylink *pl, struct ethtool_eee *eee)
-+{
-+	int ret = -EOPNOTSUPP;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->phydev)
-+		ret = phy_ethtool_get_eee(pl->phydev, eee);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_get_eee);
-+
-+int phylink_ethtool_set_eee(struct phylink *pl, struct ethtool_eee *eee)
-+{
-+	int ret = -EOPNOTSUPP;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->phydev) {
-+		ret = phy_ethtool_set_eee(pl->phydev, eee);
-+		if (ret == 0 && eee->eee_enabled)
-+			phy_start_aneg(pl->phydev);
-+	}
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_set_eee);
-+
- /* This emulates MII registers for a fixed-mode phy operating as per the
-  * passed in state. "aneg" defines if we report negotiation is possible.
-  *
---- a/include/linux/phylink.h
-+++ b/include/linux/phylink.h
-@@ -51,7 +51,8 @@ struct phylink_mac_ops {
- 	void (*mac_an_restart)(struct net_device *, unsigned int mode);
- 
- 	void (*mac_link_down)(struct net_device *, unsigned int mode);
--	void (*mac_link_up)(struct net_device *, unsigned int mode);
-+	void (*mac_link_up)(struct net_device *, unsigned int mode,
-+			    struct phy_device *);
- };
- 
- struct phylink *phylink_create(struct net_device *, struct device_node *,
-@@ -74,6 +75,10 @@ void phylink_ethtool_get_pauseparam(stru
- 				    struct ethtool_pauseparam *);
- int phylink_ethtool_set_pauseparam(struct phylink *,
- 				   struct ethtool_pauseparam *);
-+int phylink_init_eee(struct phylink *, bool);
-+int phylink_get_eee_err(struct phylink *);
-+int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
-+int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
- int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
- 
- void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
diff --git a/target/linux/mvebu/patches-4.4/143-net-mvneta-add-EEE-support.patch b/target/linux/mvebu/patches-4.4/143-net-mvneta-add-EEE-support.patch
deleted file mode 100644
index b904356..0000000
--- a/target/linux/mvebu/patches-4.4/143-net-mvneta-add-EEE-support.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From b7dacf514e41d6efff0ccc170f660cc6dc2aeae2 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Tue, 29 Sep 2015 15:17:39 +0100
-Subject: [PATCH 731/744] net: mvneta: add EEE support
-
-Add EEE support to mvneta.  This allows us to enable the low power idle
-support at MAC level if there is a PHY attached through phylink which
-supports LPI.  The appropriate ethtool support is provided to allow the
-feature to be controlled, including ethtool statistics for EEE wakeup
-errors.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/ethernet/marvell/mvneta.c | 87 +++++++++++++++++++++++++++++++++++
- 1 file changed, 87 insertions(+)
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -243,6 +243,12 @@
- #define MVNETA_TXQ_TOKEN_SIZE_REG(q)             (0x3e40 + ((q) << 2))
- #define      MVNETA_TXQ_TOKEN_SIZE_MAX           0x7fffffff
- 
-+#define MVNETA_LPI_CTRL_0                        0x2cc0
-+#define MVNETA_LPI_CTRL_1                        0x2cc4
-+#define      MVNETA_LPI_REQUEST_ENABLE           BIT(0)
-+#define MVNETA_LPI_CTRL_2                        0x2cc8
-+#define MVNETA_LPI_STATUS                        0x2ccc
-+
- #define MVNETA_CAUSE_TXQ_SENT_DESC_ALL_MASK	 0xff
- 
- /* Descriptor ring Macros */
-@@ -316,6 +322,11 @@
- #define MVNETA_RX_GET_BM_POOL_ID(rxd) \
- 	(((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT)
- 
-+enum {
-+	ETHTOOL_STAT_EEE_WAKEUP,
-+	ETHTOOL_MAX_STATS,
-+};
-+
- struct mvneta_statistic {
- 	unsigned short offset;
- 	unsigned short type;
-@@ -324,6 +335,7 @@ struct mvneta_statistic {
- 
- #define T_REG_32	32
- #define T_REG_64	64
-+#define T_SW		1
- 
- static const struct mvneta_statistic mvneta_statistics[] = {
- 	{ 0x3000, T_REG_64, "good_octets_received", },
-@@ -358,6 +370,7 @@ static const struct mvneta_statistic mvn
- 	{ 0x304c, T_REG_32, "broadcast_frames_sent", },
- 	{ 0x3054, T_REG_32, "fc_sent", },
- 	{ 0x300c, T_REG_32, "internal_mac_transmit_err", },
-+	{ ETHTOOL_STAT_EEE_WAKEUP, T_SW, "eee_wakeup_errors", },
- };
- 
- struct mvneta_pcpu_stats {
-@@ -413,6 +426,10 @@ struct mvneta_port {
- 	struct mvneta_bm_pool *pool_short;
- 	int bm_win_id;
- 
-+	bool eee_enabled;
-+	bool eee_active;
-+	bool tx_lpi_enabled;
-+
- 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
- 
- 	u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
-@@ -3276,6 +3293,18 @@ static void mvneta_mac_config(struct net
- 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, new_an);
- }
- 
-+static void mvneta_set_eee(struct mvneta_port *pp, bool enable)
-+{
-+	u32 lpi_ctl1;
-+
-+	lpi_ctl1 = mvreg_read(pp, MVNETA_LPI_CTRL_1);
-+	if (enable)
-+		lpi_ctl1 |= MVNETA_LPI_REQUEST_ENABLE;
-+	else
-+		lpi_ctl1 &= ~MVNETA_LPI_REQUEST_ENABLE;
-+	mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi_ctl1);
-+}
-+
- static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode)
- {
- 	struct mvneta_port *pp = netdev_priv(ndev);
-@@ -3289,6 +3318,9 @@ static void mvneta_mac_link_down(struct
- 		val |= MVNETA_GMAC_FORCE_LINK_DOWN;
- 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
- 	}
-+
-+	pp->eee_active = false;
-+	mvneta_set_eee(pp, false);
- }
- 
- static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode,
-@@ -3305,6 +3337,11 @@ static void mvneta_mac_link_up(struct ne
- 	}
- 
- 	mvneta_port_up(pp);
-+
-+	if (phy && pp->eee_enabled) {
-+		pp->eee_active = phy_init_eee(phy, 0) >= 0;
-+		mvneta_set_eee(pp, pp->eee_active && pp->tx_lpi_enabled);
-+	}
- }
- 
- static const struct phylink_mac_ops mvneta_phylink_ops = {
-@@ -3744,6 +3781,13 @@ static void mvneta_ethtool_update_stats(
- 			val64 = (u64)high << 32 | low;
- 			pp->ethtool_stats[i] += val64;
- 			break;
-+		case T_SW:
-+			switch (s->offset) {
-+			case ETHTOOL_STAT_EEE_WAKEUP:
-+				val = phylink_get_eee_err(pp->phylink);
-+				break;
-+			}
-+			break;
- 		}
- 	}
- }
-@@ -3867,6 +3911,47 @@ static int mvneta_ethtool_get_rxfh(struc
- 	return 0;
- }
- 
-+static int mvneta_ethtool_get_eee(struct net_device *dev,
-+				  struct ethtool_eee *eee)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+	u32 lpi_ctl0;
-+
-+	lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
-+
-+	eee->eee_enabled = pp->eee_enabled;
-+	eee->eee_active = pp->eee_active;
-+	eee->tx_lpi_enabled = pp->tx_lpi_enabled;
-+	eee->tx_lpi_timer = (lpi_ctl0) >> 8; // * scale;
-+
-+	return phylink_ethtool_get_eee(pp->phylink, eee);
-+}
-+
-+static int mvneta_ethtool_set_eee(struct net_device *dev,
-+				  struct ethtool_eee *eee)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+	u32 lpi_ctl0;
-+
-+	/* The Armada 37x documents do not give limits for this other than
-+	 * it being an 8-bit register. */
-+	if (eee->tx_lpi_enabled &&
-+	    (eee->tx_lpi_timer < 0 || eee->tx_lpi_timer > 255))
-+		return -EINVAL;
-+
-+	lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
-+	lpi_ctl0 &= ~(0xff << 8);
-+	lpi_ctl0 |= eee->tx_lpi_timer << 8;
-+	mvreg_write(pp, MVNETA_LPI_CTRL_0, lpi_ctl0);
-+
-+	pp->eee_enabled = eee->eee_enabled;
-+	pp->tx_lpi_enabled = eee->tx_lpi_enabled;
-+
-+	mvneta_set_eee(pp, eee->tx_lpi_enabled && eee->eee_enabled);
-+
-+	return phylink_ethtool_set_eee(pp->phylink, eee);
-+}
-+
- static const struct net_device_ops mvneta_netdev_ops = {
- 	.ndo_open            = mvneta_open,
- 	.ndo_stop            = mvneta_stop,
-@@ -3898,6 +3983,8 @@ const struct ethtool_ops mvneta_eth_tool
- 	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
- 	.get_rxfh	= mvneta_ethtool_get_rxfh,
- 	.set_rxfh	= mvneta_ethtool_set_rxfh,
-+	.get_eee	= mvneta_ethtool_get_eee,
-+	.set_eee	= mvneta_ethtool_set_eee,
- };
- 
- /* Initialize hw */
diff --git a/target/linux/mvebu/patches-4.4/144-phylink-add-module-EEPROM-support.patch b/target/linux/mvebu/patches-4.4/144-phylink-add-module-EEPROM-support.patch
deleted file mode 100644
index f57f70d..0000000
--- a/target/linux/mvebu/patches-4.4/144-phylink-add-module-EEPROM-support.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 5419ccb638aa5c353ea88815e98953d9fc02e6ca Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 23:10:05 +0100
-Subject: [PATCH 732/744] phylink: add module EEPROM support
-
-Add support for reading module EEPROMs through phylink.
-
-Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/phylink.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++
- include/linux/phylink.h   | 12 +++++++++
- 2 files changed, 78 insertions(+)
-
---- a/drivers/net/phy/phylink.c
-+++ b/drivers/net/phy/phylink.c
-@@ -60,6 +60,9 @@ struct phylink {
- 	struct work_struct resolve;
- 
- 	bool mac_link_up;
-+
-+	const struct phylink_module_ops *module_ops;
-+	void *module_data;
- };
- 
- static const char *phylink_an_mode_str(unsigned int mode)
-@@ -819,6 +822,36 @@ int phylink_ethtool_set_pauseparam(struc
- }
- EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam);
- 
-+int phylink_ethtool_get_module_info(struct phylink *pl,
-+				    struct ethtool_modinfo *modinfo)
-+{
-+	int ret = -EOPNOTSUPP;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->module_ops)
-+		ret = pl->module_ops->get_module_info(pl->module_data,
-+						      modinfo);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_get_module_info);
-+
-+int phylink_ethtool_get_module_eeprom(struct phylink *pl,
-+				      struct ethtool_eeprom *ee, u8 *buf)
-+{
-+	int ret = -EOPNOTSUPP;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->module_ops)
-+		ret = pl->module_ops->get_module_eeprom(pl->module_data, ee,
-+							buf);
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_ethtool_get_module_eeprom);
-+
- int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
- {
- 	int ret = -EPROTONOSUPPORT;
-@@ -1016,6 +1049,39 @@ EXPORT_SYMBOL_GPL(phylink_mii_ioctl);
- 
- 
- 
-+int phylink_register_module(struct phylink *pl, void *data,
-+			    const struct phylink_module_ops *ops)
-+{
-+	int ret = -EBUSY;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (!pl->module_ops) {
-+		pl->module_ops = ops;
-+		pl->module_data = data;
-+		ret = 0;
-+	}
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_register_module);
-+
-+int phylink_unregister_module(struct phylink *pl, void *data)
-+{
-+	int ret = -EINVAL;
-+
-+	mutex_lock(&pl->config_mutex);
-+	if (pl->module_data == data) {
-+		pl->module_ops = NULL;
-+		pl->module_data = NULL;
-+		ret = 0;
-+	}
-+	mutex_unlock(&pl->config_mutex);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(phylink_unregister_module);
-+
- void phylink_disable(struct phylink *pl)
- {
- 	set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
---- a/include/linux/phylink.h
-+++ b/include/linux/phylink.h
-@@ -55,6 +55,11 @@ struct phylink_mac_ops {
- 			    struct phy_device *);
- };
- 
-+struct phylink_module_ops {
-+	int (*get_module_info)(void *, struct ethtool_modinfo *);
-+	int (*get_module_eeprom)(void *, struct ethtool_eeprom *, u8 *);
-+};
-+
- struct phylink *phylink_create(struct net_device *, struct device_node *,
- 	phy_interface_t iface, const struct phylink_mac_ops *ops);
- void phylink_destroy(struct phylink *);
-@@ -75,12 +80,19 @@ void phylink_ethtool_get_pauseparam(stru
- 				    struct ethtool_pauseparam *);
- int phylink_ethtool_set_pauseparam(struct phylink *,
- 				   struct ethtool_pauseparam *);
-+int phylink_ethtool_get_module_info(struct phylink *, struct ethtool_modinfo *);
-+int phylink_ethtool_get_module_eeprom(struct phylink *,
-+				      struct ethtool_eeprom *, u8 *);
- int phylink_init_eee(struct phylink *, bool);
- int phylink_get_eee_err(struct phylink *);
- int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
- int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
- int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
- 
-+int phylink_register_module(struct phylink *, void *,
-+			    const struct phylink_module_ops *);
-+int phylink_unregister_module(struct phylink *, void *);
-+
- void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
- int phylink_set_link_an_mode(struct phylink *pl, unsigned int mode);
- void phylink_disable(struct phylink *pl);
diff --git a/target/linux/mvebu/patches-4.4/145-net-mvneta-add-module-EEPROM-reading-support.patch b/target/linux/mvebu/patches-4.4/145-net-mvneta-add-module-EEPROM-reading-support.patch
deleted file mode 100644
index b3f9039..0000000
--- a/target/linux/mvebu/patches-4.4/145-net-mvneta-add-module-EEPROM-reading-support.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 665e1fe77dedcfc6b5669214ebfd252c803290d4 Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 1 Oct 2015 23:32:39 +0100
-Subject: [PATCH 733/744] net: mvneta: add module EEPROM reading support
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/ethernet/marvell/mvneta.c | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
-
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3911,6 +3911,22 @@ static int mvneta_ethtool_get_rxfh(struc
- 	return 0;
- }
- 
-+static int mvneta_ethtool_get_module_info(struct net_device *dev,
-+					  struct ethtool_modinfo *modinfo)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+
-+	return phylink_ethtool_get_module_info(pp->phylink, modinfo);
-+}
-+
-+static int mvneta_ethtool_get_module_eeprom(struct net_device *dev,
-+					    struct ethtool_eeprom *ee, u8 *buf)
-+{
-+	struct mvneta_port *pp = netdev_priv(dev);
-+
-+	return phylink_ethtool_get_module_eeprom(pp->phylink, ee, buf);
-+}
-+
- static int mvneta_ethtool_get_eee(struct net_device *dev,
- 				  struct ethtool_eee *eee)
- {
-@@ -3983,6 +3999,8 @@ const struct ethtool_ops mvneta_eth_tool
- 	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
- 	.get_rxfh	= mvneta_ethtool_get_rxfh,
- 	.set_rxfh	= mvneta_ethtool_set_rxfh,
-+	.get_module_info = mvneta_ethtool_get_module_info,
-+	.get_module_eeprom = mvneta_ethtool_get_module_eeprom,
- 	.get_eee	= mvneta_ethtool_get_eee,
- 	.set_eee	= mvneta_ethtool_set_eee,
- };
diff --git a/target/linux/mvebu/patches-4.4/146-sfp-phylink-hook-up-eeprom-functions.patch b/target/linux/mvebu/patches-4.4/146-sfp-phylink-hook-up-eeprom-functions.patch
deleted file mode 100644
index f37e652..0000000
--- a/target/linux/mvebu/patches-4.4/146-sfp-phylink-hook-up-eeprom-functions.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From a7091ef24223ed39b39c6b73b77c55c8a607f34a Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Thu, 8 Oct 2015 23:49:47 +0100
-Subject: [PATCH 734/744] sfp/phylink: hook up eeprom functions
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- drivers/net/phy/sfp.c | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
---- a/drivers/net/phy/sfp.c
-+++ b/drivers/net/phy/sfp.c
-@@ -901,11 +901,9 @@ static void sfp_sm_event(struct sfp *sfp
- 	mutex_unlock(&sfp->sm_mutex);
- }
- 
--#if 0
--static int sfp_phy_module_info(struct phy_device *phy,
--			       struct ethtool_modinfo *modinfo)
-+static int sfp_module_info(void *priv, struct ethtool_modinfo *modinfo)
- {
--	struct sfp *sfp = phy->priv;
-+	struct sfp *sfp = priv;
- 
- 	/* locking... and check module is present */
- 
-@@ -919,10 +917,9 @@ static int sfp_phy_module_info(struct ph
- 	return 0;
- }
- 
--static int sfp_phy_module_eeprom(struct phy_device *phy,
--	struct ethtool_eeprom *ee, u8 *data)
-+static int sfp_module_eeprom(void *priv, struct ethtool_eeprom *ee, u8 *data)
- {
--	struct sfp *sfp = phy->priv;
-+	struct sfp *sfp = priv;
- 	unsigned int first, last, len;
- 	int ret;
- 
-@@ -953,7 +950,11 @@ static int sfp_phy_module_eeprom(struct
- 	}
- 	return 0;
- }
--#endif
-+
-+static const struct phylink_module_ops sfp_module_ops = {
-+	.get_module_info = sfp_module_info,
-+	.get_module_eeprom = sfp_module_eeprom,
-+};
- 
- static void sfp_timeout(struct work_struct *work)
- {
-@@ -1029,6 +1030,7 @@ static int sfp_netdev_notify(struct noti
- 	case NETDEV_UNREGISTER:
- 		if (sfp->mod_phy && sfp->phylink)
- 			phylink_disconnect_phy(sfp->phylink);
-+		phylink_unregister_module(sfp->phylink, sfp);
- 		sfp->phylink = NULL;
- 		dev_put(sfp->ndev);
- 		sfp->ndev = NULL;
-@@ -1145,6 +1147,7 @@ static int sfp_probe(struct platform_dev
- 		}
- 
- 		phylink_disable(sfp->phylink);
-+		phylink_register_module(sfp->phylink, sfp, &sfp_module_ops);
- 	}
- 
- 	sfp->state = sfp_get_state(sfp);
diff --git a/target/linux/mvebu/patches-4.4/147-net-mvneta-add-BQL-support.patch b/target/linux/mvebu/patches-4.4/147-net-mvneta-add-BQL-support.patch
deleted file mode 100644
index 7bd2593..0000000
--- a/target/linux/mvebu/patches-4.4/147-net-mvneta-add-BQL-support.patch
+++ /dev/null
@@ -1,83 +0,0 @@
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -1695,8 +1695,10 @@ static struct mvneta_tx_queue *mvneta_tx
- 
- /* Free tx queue skbuffs */
- static void mvneta_txq_bufs_free(struct mvneta_port *pp,
--				 struct mvneta_tx_queue *txq, int num)
-+				 struct mvneta_tx_queue *txq, int num,
-+				 struct netdev_queue *nq)
- {
-+	unsigned int bytes_compl = 0, pkts_compl = 0;
- 	int i;
- 
- 	for (i = 0; i < num; i++) {
-@@ -1704,6 +1706,11 @@ static void mvneta_txq_bufs_free(struct
- 			txq->txq_get_index;
- 		struct sk_buff *skb = txq->tx_skb[txq->txq_get_index];
- 
-+		if (skb) {
-+			bytes_compl += skb->len;
-+			pkts_compl++;
-+		}
-+
- 		mvneta_txq_inc_get(txq);
- 
- 		if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
-@@ -1714,6 +1721,8 @@ static void mvneta_txq_bufs_free(struct
- 			continue;
- 		dev_kfree_skb_any(skb);
- 	}
-+
-+	netdev_tx_completed_queue(nq, pkts_compl, bytes_compl);
- }
- 
- /* Handle end of transmission */
-@@ -1727,7 +1736,7 @@ static void mvneta_txq_done(struct mvnet
- 	if (!tx_done)
- 		return;
- 
--	mvneta_txq_bufs_free(pp, txq, tx_done);
-+	mvneta_txq_bufs_free(pp, txq, tx_done, nq);
- 
- 	txq->count -= tx_done;
- 
-@@ -2334,6 +2343,8 @@ out:
- 		struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
- 		struct netdev_queue *nq = netdev_get_tx_queue(dev, txq_id);
- 
-+		netdev_tx_sent_queue(nq, len);
-+
- 		txq->count += frags;
- 		mvneta_txq_pend_desc_add(pp, txq, frags);
- 
-@@ -2358,9 +2369,10 @@ static void mvneta_txq_done_force(struct
- 				  struct mvneta_tx_queue *txq)
- 
- {
-+	struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
- 	int tx_done = txq->count;
- 
--	mvneta_txq_bufs_free(pp, txq, tx_done);
-+	mvneta_txq_bufs_free(pp, txq, tx_done, nq);
- 
- 	/* reset txq */
- 	txq->count = 0;
-@@ -2841,6 +2853,8 @@ static int mvneta_txq_init(struct mvneta
- static void mvneta_txq_deinit(struct mvneta_port *pp,
- 			      struct mvneta_tx_queue *txq)
- {
-+	struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
-+
- 	kfree(txq->tx_skb);
- 
- 	if (txq->tso_hdrs)
-@@ -2852,6 +2866,8 @@ static void mvneta_txq_deinit(struct mvn
- 				  txq->size * MVNETA_DESC_ALIGNED_SIZE,
- 				  txq->descs, txq->descs_phys);
- 
-+	netdev_tx_reset_queue(nq);
-+
- 	txq->descs             = NULL;
- 	txq->last_desc         = 0;
- 	txq->next_desc_to_proc = 0;
diff --git a/target/linux/mvebu/patches-4.4/202-gpio_mvebu_add_limited_pwm_support.patch b/target/linux/mvebu/patches-4.4/202-gpio_mvebu_add_limited_pwm_support.patch
deleted file mode 100644
index b09c89f..0000000
--- a/target/linux/mvebu/patches-4.4/202-gpio_mvebu_add_limited_pwm_support.patch
+++ /dev/null
@@ -1,433 +0,0 @@
-Armada 370/XP devices can 'blink' gpio lines with a configurable on
-and off period. This can be modelled as a PWM.
-
-However, there are only two sets of PWM configuration registers for
-all the gpio lines. This driver simply allows a single gpio line per
-gpio chip of 32 lines to be used as a PWM. Attempts to use more return
-EBUSY.
-
-Due to the interleaving of registers it is not simple to separate the
-PWM driver from the gpio driver. Thus the gpio driver has been
-extended with a PWM driver.
-
-Signed-off-by: Andrew Lunn <andrew at lunn.ch>
----
- drivers/gpio/Kconfig          |   5 ++
- drivers/gpio/Makefile         |   1 +
- drivers/gpio/gpio-mvebu-pwm.c | 202 ++++++++++++++++++++++++++++++++++++++++++
- drivers/gpio/gpio-mvebu.c     |  37 +++-----
- drivers/gpio/gpio-mvebu.h     |  79 +++++++++++++++++
- 5 files changed, 299 insertions(+), 25 deletions(-)
- create mode 100644 drivers/gpio/gpio-mvebu-pwm.c
- create mode 100644 drivers/gpio/gpio-mvebu.h
-
---- a/drivers/gpio/Kconfig
-+++ b/drivers/gpio/Kconfig
-@@ -295,6 +295,11 @@ config GPIO_MVEBU
- 	depends on OF
- 	select GENERIC_IRQ_CHIP
- 
-+config GPIO_MVEBU_PWM
-+	def_bool y
-+	depends on GPIO_MVEBU
-+	depends on PWM
-+
- config GPIO_MXC
- 	def_bool y
- 	depends on ARCH_MXC
---- a/drivers/gpio/Makefile
-+++ b/drivers/gpio/Makefile
-@@ -67,6 +67,7 @@ obj-$(CONFIG_GPIO_MPC5200)	+= gpio-mpc52
- obj-$(CONFIG_GPIO_MPC8XXX)	+= gpio-mpc8xxx.o
- obj-$(CONFIG_GPIO_MSIC)		+= gpio-msic.o
- obj-$(CONFIG_GPIO_MVEBU)        += gpio-mvebu.o
-+obj-$(CONFIG_GPIO_MVEBU_PWM)	+= gpio-mvebu-pwm.o
- obj-$(CONFIG_GPIO_MXC)		+= gpio-mxc.o
- obj-$(CONFIG_GPIO_MXS)		+= gpio-mxs.o
- obj-$(CONFIG_GPIO_OCTEON)	+= gpio-octeon.o
---- /dev/null
-+++ b/drivers/gpio/gpio-mvebu-pwm.c
-@@ -0,0 +1,202 @@
-+#include <linux/err.h>
-+#include <linux/module.h>
-+#include <linux/gpio.h>
-+#include <linux/pwm.h>
-+#include <linux/clk.h>
-+#include <linux/platform_device.h>
-+#include "gpio-mvebu.h"
-+#include "gpiolib.h"
-+
-+static void __iomem *mvebu_gpioreg_blink_select(struct mvebu_gpio_chip *mvchip)
-+{
-+	return mvchip->membase + GPIO_BLINK_CNT_SELECT;
-+}
-+
-+static inline struct mvebu_pwm *to_mvebu_pwm(struct pwm_chip *chip)
-+{
-+	return container_of(chip, struct mvebu_pwm, chip);
-+}
-+
-+static inline struct mvebu_gpio_chip *to_mvchip(struct mvebu_pwm *pwm)
-+{
-+	return container_of(pwm, struct mvebu_gpio_chip, pwm);
-+}
-+
-+static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwmd)
-+{
-+	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
-+	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
-+	struct gpio_desc *desc = gpio_to_desc(pwmd->pwm);
-+	unsigned long flags;
-+	int ret = 0;
-+
-+	spin_lock_irqsave(&pwm->lock, flags);
-+	if (pwm->used) {
-+		ret = -EBUSY;
-+	} else {
-+		if (!desc) {
-+			ret = -ENODEV;
-+			goto out;
-+		}
-+		ret = gpiod_request(desc, "mvebu-pwm");
-+		if (ret)
-+			goto out;
-+
-+		ret = gpiod_direction_output(desc, 0);
-+		if (ret) {
-+			gpiod_free(desc);
-+			goto out;
-+		}
-+
-+		pwm->pin = pwmd->pwm - mvchip->chip.base;
-+		pwm->used = true;
-+	}
-+
-+out:
-+	spin_unlock_irqrestore(&pwm->lock, flags);
-+	return ret;
-+}
-+
-+static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwmd)
-+{
-+	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
-+	struct gpio_desc *desc = gpio_to_desc(pwmd->pwm);
-+	unsigned long flags;
-+
-+	spin_lock_irqsave(&pwm->lock, flags);
-+	gpiod_free(desc);
-+	pwm->used = false;
-+	spin_unlock_irqrestore(&pwm->lock, flags);
-+}
-+
-+static int mvebu_pwm_config(struct pwm_chip *chip, struct pwm_device *pwmd,
-+			    int duty_ns, int period_ns)
-+{
-+	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
-+	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
-+	unsigned int on, off;
-+	unsigned long long val;
-+	u32 u;
-+
-+	val = (unsigned long long) pwm->clk_rate * duty_ns;
-+	do_div(val, NSEC_PER_SEC);
-+	if (val > UINT_MAX)
-+		return -EINVAL;
-+	if (val)
-+		on = val;
-+	else
-+		on = 1;
-+
-+	val = (unsigned long long) pwm->clk_rate * (period_ns - duty_ns);
-+	do_div(val, NSEC_PER_SEC);
-+	if (val > UINT_MAX)
-+		return -EINVAL;
-+	if (val)
-+		off = val;
-+	else
-+		off = 1;
-+
-+	u = readl_relaxed(mvebu_gpioreg_blink_select(mvchip));
-+	u &= ~(1 << pwm->pin);
-+	u |= (pwm->id << pwm->pin);
-+	writel_relaxed(u, mvebu_gpioreg_blink_select(mvchip));
-+
-+	writel_relaxed(on, pwm->membase + BLINK_ON_DURATION);
-+	writel_relaxed(off, pwm->membase + BLINK_OFF_DURATION);
-+
-+	return 0;
-+}
-+
-+static int mvebu_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwmd)
-+{
-+	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
-+	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
-+
-+	mvebu_gpio_blink(&mvchip->chip, pwm->pin, 1);
-+
-+	return 0;
-+}
-+
-+static void mvebu_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwmd)
-+{
-+	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
-+	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
-+
-+	mvebu_gpio_blink(&mvchip->chip, pwm->pin, 0);
-+}
-+
-+static const struct pwm_ops mvebu_pwm_ops = {
-+	.request = mvebu_pwm_request,
-+	.free = mvebu_pwm_free,
-+	.config = mvebu_pwm_config,
-+	.enable = mvebu_pwm_enable,
-+	.disable = mvebu_pwm_disable,
-+	.owner = THIS_MODULE,
-+};
-+
-+void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip)
-+{
-+	struct mvebu_pwm *pwm = &mvchip->pwm;
-+
-+	pwm->blink_select = readl_relaxed(mvebu_gpioreg_blink_select(mvchip));
-+	pwm->blink_on_duration =
-+		readl_relaxed(pwm->membase + BLINK_ON_DURATION);
-+	pwm->blink_off_duration =
-+		readl_relaxed(pwm->membase + BLINK_OFF_DURATION);
-+}
-+
-+void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip)
-+{
-+	struct mvebu_pwm *pwm = &mvchip->pwm;
-+
-+	writel_relaxed(pwm->blink_select, mvebu_gpioreg_blink_select(mvchip));
-+	writel_relaxed(pwm->blink_on_duration,
-+		       pwm->membase + BLINK_ON_DURATION);
-+	writel_relaxed(pwm->blink_off_duration,
-+		       pwm->membase + BLINK_OFF_DURATION);
-+}
-+
-+/*
-+ * Armada 370/XP has simple PWM support for gpio lines. Other SoCs
-+ * don't have this hardware. So if we don't have the necessary
-+ * resource, it is not an error.
-+ */
-+int mvebu_pwm_probe(struct platform_device *pdev,
-+		    struct mvebu_gpio_chip *mvchip,
-+		    int id)
-+{
-+	struct device *dev = &pdev->dev;
-+	struct mvebu_pwm *pwm = &mvchip->pwm;
-+	struct resource *res;
-+
-+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm");
-+	if (!res)
-+		return 0;
-+
-+	mvchip->pwm.membase = devm_ioremap_resource(&pdev->dev, res);
-+	if (IS_ERR(mvchip->pwm.membase))
-+		return PTR_ERR(mvchip->percpu_membase);
-+
-+	if (id < 0 || id > 1)
-+		return -EINVAL;
-+	pwm->id = id;
-+
-+	if (IS_ERR(mvchip->clk))
-+		return PTR_ERR(mvchip->clk);
-+
-+	pwm->clk_rate = clk_get_rate(mvchip->clk);
-+	if (!pwm->clk_rate) {
-+		dev_err(dev, "failed to get clock rate\n");
-+		return -EINVAL;
-+	}
-+
-+	pwm->chip.dev = dev;
-+	pwm->chip.ops = &mvebu_pwm_ops;
-+	pwm->chip.base = mvchip->chip.base;
-+	pwm->chip.npwm = mvchip->chip.ngpio;
-+	pwm->chip.can_sleep = false;
-+
-+	spin_lock_init(&pwm->lock);
-+
-+	return pwmchip_add(&pwm->chip);
-+}
---- a/drivers/gpio/gpio-mvebu.c
-+++ b/drivers/gpio/gpio-mvebu.c
-@@ -42,10 +42,11 @@
- #include <linux/io.h>
- #include <linux/of_irq.h>
- #include <linux/of_device.h>
-+#include <linux/pwm.h>
- #include <linux/clk.h>
- #include <linux/pinctrl/consumer.h>
- #include <linux/irqchip/chained_irq.h>
--
-+#include "gpio-mvebu.h"
- /*
-  * GPIO unit register offsets.
-  */
-@@ -75,24 +76,6 @@
- 
- #define MVEBU_MAX_GPIO_PER_BANK		32
- 
--struct mvebu_gpio_chip {
--	struct gpio_chip   chip;
--	spinlock_t	   lock;
--	void __iomem	  *membase;
--	void __iomem	  *percpu_membase;
--	int		   irqbase;
--	struct irq_domain *domain;
--	int		   soc_variant;
--
--	/* Used to preserve GPIO registers across suspend/resume */
--	u32                out_reg;
--	u32                io_conf_reg;
--	u32                blink_en_reg;
--	u32                in_pol_reg;
--	u32                edge_mask_regs[4];
--	u32                level_mask_regs[4];
--};
--
- /*
-  * Functions returning addresses of individual registers for a given
-  * GPIO controller.
-@@ -218,7 +201,7 @@ static int mvebu_gpio_get(struct gpio_ch
- 	return (u >> pin) & 1;
- }
- 
--static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
-+void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
- {
- 	struct mvebu_gpio_chip *mvchip =
- 		container_of(chip, struct mvebu_gpio_chip, chip);
-@@ -607,6 +590,8 @@ static int mvebu_gpio_suspend(struct pla
- 		BUG();
- 	}
- 
-+	mvebu_pwm_suspend(mvchip);
-+
- 	return 0;
- }
- 
-@@ -650,6 +635,8 @@ static int mvebu_gpio_resume(struct plat
- 		BUG();
- 	}
- 
-+	mvebu_pwm_resume(mvchip);
-+
- 	return 0;
- }
- 
-@@ -661,7 +648,6 @@ static int mvebu_gpio_probe(struct platf
- 	struct resource *res;
- 	struct irq_chip_generic *gc;
- 	struct irq_chip_type *ct;
--	struct clk *clk;
- 	unsigned int ngpios;
- 	int soc_variant;
- 	int i, cpu, id;
-@@ -691,10 +677,10 @@ static int mvebu_gpio_probe(struct platf
- 		return id;
- 	}
- 
--	clk = devm_clk_get(&pdev->dev, NULL);
-+	mvchip->clk = devm_clk_get(&pdev->dev, NULL);
- 	/* Not all SoCs require a clock.*/
--	if (!IS_ERR(clk))
--		clk_prepare_enable(clk);
-+	if (!IS_ERR(mvchip->clk))
-+		clk_prepare_enable(mvchip->clk);
- 
- 	mvchip->soc_variant = soc_variant;
- 	mvchip->chip.label = dev_name(&pdev->dev);
-@@ -828,7 +814,8 @@ static int mvebu_gpio_probe(struct platf
- 		goto err_generic_chip;
- 	}
- 
--	return 0;
-+	/* Armada 370/XP has simple PWM support for gpio lines */
-+	return mvebu_pwm_probe(pdev, mvchip, id);
- 
- err_generic_chip:
- 	irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
---- /dev/null
-+++ b/drivers/gpio/gpio-mvebu.h
-@@ -0,0 +1,79 @@
-+/*
-+ * Interface between MVEBU GPIO driver and PWM driver for GPIO pins
-+ *
-+ * Copyright (C) 2015, Andrew Lunn <andrew at lunn.ch>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#ifndef MVEBU_GPIO_PWM_H
-+#define MVEBU_GPIO_PWM_H
-+
-+#define BLINK_ON_DURATION	0x0
-+#define BLINK_OFF_DURATION	0x4
-+#define GPIO_BLINK_CNT_SELECT	0x0020
-+
-+struct mvebu_pwm {
-+	void __iomem	*membase;
-+	unsigned long	 clk_rate;
-+	bool		 used;
-+	unsigned	 pin;
-+	struct pwm_chip	 chip;
-+	int		 id;
-+	spinlock_t	 lock;
-+
-+	/* Used to preserve GPIO/PWM registers across suspend /
-+	 * resume */
-+	u32		 blink_select;
-+	u32		 blink_on_duration;
-+	u32		 blink_off_duration;
-+};
-+
-+struct mvebu_gpio_chip {
-+	struct gpio_chip   chip;
-+	spinlock_t	   lock;
-+	void __iomem	  *membase;
-+	void __iomem	  *percpu_membase;
-+	int		   irqbase;
-+	struct irq_domain *domain;
-+	int		   soc_variant;
-+	struct clk	  *clk;
-+#ifdef CONFIG_PWM
-+	struct mvebu_pwm pwm;
-+#endif
-+	/* Used to preserve GPIO registers across suspend/resume */
-+	u32		   out_reg;
-+	u32		   io_conf_reg;
-+	u32		   blink_en_reg;
-+	u32		   in_pol_reg;
-+	u32		   edge_mask_regs[4];
-+	u32		   level_mask_regs[4];
-+};
-+
-+void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value);
-+
-+#ifdef CONFIG_PWM
-+int mvebu_pwm_probe(struct platform_device *pdev,
-+		    struct mvebu_gpio_chip *mvchip,
-+		    int id);
-+void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip);
-+void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip);
-+#else
-+int mvebu_pwm_probe(struct platform_device *pdev,
-+		    struct mvebu_gpio_chip *mvchip,
-+		    int id)
-+{
-+	return 0;
-+}
-+
-+void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip)
-+{
-+}
-+
-+void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip)
-+{
-+}
-+#endif
-+#endif
diff --git a/target/linux/mvebu/patches-4.4/203-dt_bindings_extend_mvebu_gpio_documentation_with_pwm.patch b/target/linux/mvebu/patches-4.4/203-dt_bindings_extend_mvebu_gpio_documentation_with_pwm.patch
deleted file mode 100644
index 48f9394..0000000
--- a/target/linux/mvebu/patches-4.4/203-dt_bindings_extend_mvebu_gpio_documentation_with_pwm.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-Document the optional parameters needed for PWM operation of gpio
-lines.
-
-Signed-off-by: Andrew Lunn <andrew at lunn.ch>
----
- .../devicetree/bindings/gpio/gpio-mvebu.txt        | 31 ++++++++++++++++++++++
- 1 file changed, 31 insertions(+)
-
---- a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
-+++ b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
-@@ -38,6 +38,23 @@ Required properties:
- - #gpio-cells: Should be two. The first cell is the pin number. The
-   second cell is reserved for flags, unused at the moment.
- 
-+Optional properties:
-+
-+In order to use the gpio lines in PWM mode, some additional optional
-+properties are required. Only Armada 370 and XP supports these
-+properties.
-+
-+- reg: an additional register set is needed, for the GPIO Blink
-+  Counter on/off registers.
-+
-+- reg-names: Must contain an entry "pwm" corresponding to the
-+  additional register range needed for pwm operation.
-+
-+- #pwm-cells: Should be two. The first cell is the pin number. The
-+  second cell is reserved for flags, unused at the moment.
-+
-+- clocks: Must be a phandle to the clock for the gpio controller.
-+
- Example:
- 
- 		gpio0: gpio at d0018100 {
-@@ -51,3 +68,17 @@ Example:
- 			#interrupt-cells = <2>;
- 			interrupts = <16>, <17>, <18>, <19>;
- 		};
-+
-+		gpio1: gpio at 18140 {
-+			compatible = "marvell,orion-gpio";
-+			reg = <0x18140 0x40>, <0x181c8 0x08>;
-+			reg-names = "gpio", "pwm";
-+			ngpios = <17>;
-+			gpio-controller;
-+			#gpio-cells = <2>;
-+			#pwm-cells = <2>;
-+			interrupt-controller;
-+			#interrupt-cells = <2>;
-+			interrupts = <87>, <88>, <89>;
-+			clocks = <&coreclk 0>;
-+		};
diff --git a/target/linux/mvebu/patches-4.4/204-mvebu_xp_add_pwm_properties_to_dtsi_files.patch b/target/linux/mvebu/patches-4.4/204-mvebu_xp_add_pwm_properties_to_dtsi_files.patch
deleted file mode 100644
index 69bec6c..0000000
--- a/target/linux/mvebu/patches-4.4/204-mvebu_xp_add_pwm_properties_to_dtsi_files.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-Add properties to the gpio nodes to allow them to be also used
-as pwm lines.
-
-Signed-off-by: Andrew Lunn <andrew at lunn.ch>
----
- arch/arm/boot/dts/armada-370.dtsi        | 10 ++++++++--
- arch/arm/boot/dts/armada-xp-mv78230.dtsi | 10 ++++++++--
- arch/arm/boot/dts/armada-xp-mv78260.dtsi |  8 ++++++--
- arch/arm/boot/dts/armada-xp-mv78460.dtsi | 10 ++++++++--
- 4 files changed, 30 insertions(+), 8 deletions(-)
-
---- a/arch/arm/boot/dts/armada-370.dtsi
-+++ b/arch/arm/boot/dts/armada-370.dtsi
-@@ -162,24 +162,30 @@
- 
- 			gpio0: gpio at 18100 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18100 0x40>;
-+				reg = <0x18100 0x40>, <0x181c0 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <82>, <83>, <84>, <85>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio1: gpio at 18140 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18140 0x40>;
-+				reg = <0x18140 0x40>, <0x181c8 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <87>, <88>, <89>, <90>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio2: gpio at 18180 {
---- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
-+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
-@@ -203,24 +203,30 @@
- 		internal-regs {
- 			gpio0: gpio at 18100 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18100 0x40>;
-+				reg = <0x18100 0x40>, <0x181c0 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <82>, <83>, <84>, <85>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio1: gpio at 18140 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18140 0x40>;
-+				reg = <0x18140 0x40>, <0x181c8 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <17>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <87>, <88>, <89>;
-+				clocks = <&coreclk 0>;
- 			};
- 		};
- 	};
---- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
-+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
-@@ -286,24 +286,28 @@
- 		internal-regs {
- 			gpio0: gpio at 18100 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18100 0x40>;
-+				reg = <0x18100 0x40>, <0x181c0 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <82>, <83>, <84>, <85>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio1: gpio at 18140 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18140 0x40>;
-+				reg = <0x18140 0x40>, <0x181c8 0x08>;
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <87>, <88>, <89>, <90>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio2: gpio at 18180 {
---- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
-+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
-@@ -324,24 +324,30 @@
- 		internal-regs {
- 			gpio0: gpio at 18100 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18100 0x40>;
-+				reg = <0x18100 0x40>, <0x181c0 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <82>, <83>, <84>, <85>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio1: gpio at 18140 {
- 				compatible = "marvell,orion-gpio";
--				reg = <0x18140 0x40>;
-+				reg = <0x18140 0x40>, <0x181c8 0x08>;
-+				reg-names = "gpio", "pwm";
- 				ngpios = <32>;
- 				gpio-controller;
- 				#gpio-cells = <2>;
-+				#pwm-cells = <2>;
- 				interrupt-controller;
- 				#interrupt-cells = <2>;
- 				interrupts = <87>, <88>, <89>, <90>;
-+				clocks = <&coreclk 0>;
- 			};
- 
- 			gpio2: gpio at 18180 {
diff --git a/target/linux/mvebu/patches-4.4/205-arm_mvebu_enable_pwm_in_defconfig.patch b/target/linux/mvebu/patches-4.4/205-arm_mvebu_enable_pwm_in_defconfig.patch
deleted file mode 100644
index b52c60f..0000000
--- a/target/linux/mvebu/patches-4.4/205-arm_mvebu_enable_pwm_in_defconfig.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Now that the gpio driver also supports PWM operation, enable
-the PWM framework in mvebu_v7_defconfig.
-
-Signed-off-by: Andrew Lunn <andrew at lunn.ch>
----
- arch/arm/configs/mvebu_v7_defconfig | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/arch/arm/configs/mvebu_v7_defconfig
-+++ b/arch/arm/configs/mvebu_v7_defconfig
-@@ -131,6 +131,7 @@ CONFIG_DMADEVICES=y
- CONFIG_MV_XOR=y
- # CONFIG_IOMMU_SUPPORT is not set
- CONFIG_MEMORY=y
-+CONFIG_PWM=y
- CONFIG_EXT4_FS=y
- CONFIG_ISO9660_FS=y
- CONFIG_JOLIET=y
diff --git a/target/linux/mvebu/patches-4.4/206-mvebu_wrt1900ac_use_pwm-fan_rather_than_gpio-fan.patch b/target/linux/mvebu/patches-4.4/206-mvebu_wrt1900ac_use_pwm-fan_rather_than_gpio-fan.patch
deleted file mode 100644
index bff58e9..0000000
--- a/target/linux/mvebu/patches-4.4/206-mvebu_wrt1900ac_use_pwm-fan_rather_than_gpio-fan.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-The mvebu gpio driver can also perform PWM on some pins. Us the
-pwm-fan driver to control the fan of the WRT1900AC, giving us fine
-grain control over its speed and hence noise.
-
-Signed-off-by: Andrew Lunn <andrew at lunn.ch>
----
- arch/arm/boot/dts/armada-xp-wrt1900ac.dts | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
-
---- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
-@@ -428,13 +428,11 @@
- 		};
- 	};
- 
--	gpio_fan {
-+	pwm_fan {
- 		/* SUNON HA4010V4-0000-C99 */
--		compatible = "gpio-fan";
--		gpios = <&gpio0 24 0>;
- 
--		gpio-fan,speed-map = <0    0
--				      4500 1>;
-+		compatible = "pwm-fan";
-+		pwms = <&gpio0 24 4000 0>;
- 	};
- 
- 	dsa at 0 {
diff --git a/target/linux/mvebu/patches-4.4/207-armada-385-rd-mtd-partitions.patch b/target/linux/mvebu/patches-4.4/207-armada-385-rd-mtd-partitions.patch
deleted file mode 100644
index fc94d9a..0000000
--- a/target/linux/mvebu/patches-4.4/207-armada-385-rd-mtd-partitions.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/arch/arm/boot/dts/armada-388-rd.dts
-+++ b/arch/arm/boot/dts/armada-388-rd.dts
-@@ -79,6 +79,16 @@
- 					compatible = "st,m25p128", "jedec,spi-nor";
- 					reg = <0>; /* Chip select 0 */
- 					spi-max-frequency = <108000000>;
-+
-+					partition at 0 {
-+						label = "uboot";
-+						reg = <0 0x400000>;
-+					};
-+
-+					partition at 1 {
-+						label = "firmware";
-+						reg = <0x400000 0xc00000>;
-+					};
- 				};
- 			};
- 
diff --git a/target/linux/mvebu/patches-4.4/208-ARM-mvebu-385-ap-Add-partitions.patch b/target/linux/mvebu/patches-4.4/208-ARM-mvebu-385-ap-Add-partitions.patch
deleted file mode 100644
index d2aaeef..0000000
--- a/target/linux/mvebu/patches-4.4/208-ARM-mvebu-385-ap-Add-partitions.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 9861f93a59142a3131870df2521eb2deb73026d7 Mon Sep 17 00:00:00 2001
-From: Maxime Ripard <maxime.ripard at free-electrons.com>
-Date: Tue, 13 Jan 2015 11:14:09 +0100
-Subject: [PATCH 2/2] ARM: mvebu: 385-ap: Add partitions
-
-Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
----
- arch/arm/boot/dts/armada-385-db-ap.dts | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
---- a/arch/arm/boot/dts/armada-385-db-ap.dts
-+++ b/arch/arm/boot/dts/armada-385-db-ap.dts
-@@ -184,6 +184,21 @@
- 				marvell,nand-keep-config;
- 				marvell,nand-enable-arbiter;
- 				nand-on-flash-bbt;
-+
-+				mtd0 at 00000000 {
-+					label = "u-boot";
-+					reg = <0x00000000 0x00800000>;
-+				};
-+
-+				mtd1 at 00800000 {
-+					label = "kernel";
-+					reg = <0x00800000 0x00800000>;
-+				};
-+
-+				mtd2 at 01000000 {
-+					label = "ubi";
-+					reg = <0x01000000 0x3f000000>;
-+				};
- 			};
- 
- 			usb3 at f0000 {
diff --git a/target/linux/mvebu/patches-4.4/209-clearfog_switch_node.patch b/target/linux/mvebu/patches-4.4/209-clearfog_switch_node.patch
deleted file mode 100644
index 55494d0..0000000
--- a/target/linux/mvebu/patches-4.4/209-clearfog_switch_node.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/arch/arm/boot/dts/armada-388-clearfog.dts
-+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
-@@ -430,6 +430,18 @@
- 		};
- 	};
- 
-+	mvsw61xx {
-+		#address-cells = <1>;
-+		#size-cells = <0>;
-+		compatible = "marvell,88e6176";
-+		status = "okay";
-+		reg = <0x4>;
-+		is-indirect;
-+
-+		mii-bus = <&mdio>;
-+		cpu-port-0 = <5>;
-+	};
-+
- 	gpio-keys {
- 		compatible = "gpio-keys";
- 		pinctrl-0 = <&rear_button_pins>;
diff --git a/target/linux/mvebu/patches-4.4/210-ARM-dts-armada388-clearfog-add-SFP-module-support.patch b/target/linux/mvebu/patches-4.4/210-ARM-dts-armada388-clearfog-add-SFP-module-support.patch
deleted file mode 100644
index 9efcff9..0000000
--- a/target/linux/mvebu/patches-4.4/210-ARM-dts-armada388-clearfog-add-SFP-module-support.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 63ff73593c2f5d3fc1cba479321d192caaca48aa Mon Sep 17 00:00:00 2001
-From: Russell King <rmk+kernel at arm.linux.org.uk>
-Date: Sat, 12 Sep 2015 18:43:39 +0100
-Subject: [PATCH 738/744] ARM: dts: armada388-clearfog: add SFP module support
-
-Add SFP module support for Clearfog using the SFP phylink support.
-
-Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
----
- arch/arm/boot/dts/armada-388-clearfog.dts | 44 ++++++++-----------------------
- 1 file changed, 11 insertions(+), 33 deletions(-)
-
---- a/arch/arm/boot/dts/armada-388-clearfog.dts
-+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
-@@ -90,16 +90,12 @@
- 			};
- 
- 			ethernet at 34000 {
-+				managed = "in-band-status";
- 				phy-mode = "sgmii";
- 				buffer-manager = <&bm>;
- 				bm,pool-long = <3>;
- 				bm,pool-short = <1>;
- 				status = "okay";
--
--				fixed-link {
--					speed = <1000>;
--					full-duplex;
--				};
- 			};
- 
- 			i2c at 11000 {
-@@ -183,34 +179,6 @@
- 						output-low;
- 						line-name = "m.2 devslp";
- 					};
--					sfp_los {
--						/* SFP loss of signal */
--						gpio-hog;
--						gpios = <12 GPIO_ACTIVE_HIGH>;
--						input;
--						line-name = "sfp-los";
--					};
--					sfp_tx_fault {
--						/* SFP laser fault */
--						gpio-hog;
--						gpios = <13 GPIO_ACTIVE_HIGH>;
--						input;
--						line-name = "sfp-tx-fault";
--					};
--					sfp_tx_disable {
--						/* SFP transmit disable */
--						gpio-hog;
--						gpios = <14 GPIO_ACTIVE_HIGH>;
--						output-low;
--						line-name = "sfp-tx-disable";
--					};
--					sfp_mod_def0 {
--						/* SFP module present */
--						gpio-hog;
--						gpios = <15 GPIO_ACTIVE_LOW>;
--						input;
--						line-name = "sfp-mod-def0";
--					};
- 				};
- 
- 				/* The MCP3021 is 100kHz clock only */
-@@ -374,6 +342,16 @@
- 		};
- 	};
- 
-+	sfp: sfp {
-+		compatible = "sff,sfp";
-+		i2c-bus = <&i2c1>;
-+		los-gpio = <&expander0 12 GPIO_ACTIVE_HIGH>;
-+		moddef0-gpio = <&expander0 15 GPIO_ACTIVE_LOW>;
-+		sfp,ethernet = <&eth2>;
-+		tx-disable-gpio = <&expander0 14 GPIO_ACTIVE_HIGH>;
-+		tx-fault-gpio = <&expander0 13 GPIO_ACTIVE_HIGH>;
-+	};
-+
- 	dsa at 0 {
- 		compatible = "marvell,dsa";
- 		dsa,ethernet = <&eth1>;
diff --git a/target/linux/mvebu/patches-4.4/300-reprobe_sfp_phy.patch b/target/linux/mvebu/patches-4.4/300-reprobe_sfp_phy.patch
deleted file mode 100644
index 42614ef..0000000
--- a/target/linux/mvebu/patches-4.4/300-reprobe_sfp_phy.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 28baa5e2635285b178326b301f534ed95c65dd01 Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski at gmail.com>
-Date: Thu, 29 Sep 2016 11:44:39 +0200
-Subject: [PATCH] sfp: retry phy probe if unsuccessful
-
-Some phys seem to take longer than 50 ms to come out of reset, so retry
-until we find a phy.
-
-Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
----
- drivers/net/phy/sfp.c | 38 +++++++++++++++++++++++++-------------
- 1 file changed, 25 insertions(+), 13 deletions(-)
-
---- a/drivers/net/phy/sfp.c
-+++ b/drivers/net/phy/sfp.c
-@@ -488,7 +488,7 @@ static void sfp_sm_phy_detach(struct sfp
- 	sfp->mod_phy = NULL;
- }
- 
--static void sfp_sm_probe_phy(struct sfp *sfp)
-+static int sfp_sm_probe_phy(struct sfp *sfp)
- {
- 	struct phy_device *phy;
- 	int err;
-@@ -498,11 +498,11 @@ static void sfp_sm_probe_phy(struct sfp
- 	phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
- 	if (IS_ERR(phy)) {
- 		dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
--		return;
-+		return PTR_ERR(phy);
- 	}
- 	if (!phy) {
--		dev_info(sfp->dev, "no PHY detected\n");
--		return;
-+		dev_dbg(sfp->dev, "no PHY detected\n");
-+		return -EAGAIN;
- 	}
- 
- 	err = phylink_connect_phy(sfp->phylink, phy);
-@@ -510,11 +510,13 @@ static void sfp_sm_probe_phy(struct sfp
- 		phy_device_remove(phy);
- 		phy_device_free(phy);
- 		dev_err(sfp->dev, "phylink_connect_phy failed: %d\n", err);
--		return;
-+		return err;
- 	}
- 
- 	sfp->mod_phy = phy;
- 	phy_start(phy);
-+
-+	return 0;
- }
- 
- static void sfp_sm_link_up(struct sfp *sfp)
-@@ -565,13 +567,6 @@ static void sfp_sm_mod_init(struct sfp *
- {
- 	sfp_module_tx_enable(sfp);
- 
--	/* Wait t_init before indicating that the link is up, provided the
--	 * current state indicates no TX_FAULT.  If TX_FAULT clears before
--	 * this time, that's fine too.
--	 */
--	sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
--	sfp->sm_retries = 5;
--
- 	if (sfp->phylink) {
- 		/* Setting the serdes link mode is guesswork: there's no
- 		 * field in the EEPROM which indicates what mode should
-@@ -587,9 +582,26 @@ static void sfp_sm_mod_init(struct sfp *
- 		    !sfp->id.base.e100_base_fx) {
- 			phylink_set_link_an_mode(sfp->phylink, MLO_AN_8023Z);
- 		} else {
-+			int ret;
-+
- 			phylink_set_link_an_mode(sfp->phylink, MLO_AN_SGMII);
--			sfp_sm_probe_phy(sfp);
-+
-+			ret = sfp_sm_probe_phy(sfp);
-+			if (ret) {
-+				if (ret == -EAGAIN)
-+					sfp_sm_set_timer(sfp, T_PROBE_RETRY);
-+				else
-+					sfp_sm_next(sfp, SFP_S_TX_DISABLE, 0);
-+				return;
-+			}
- 		}
-+
-+		/* Wait t_init before indicating that the link is up, provided the
-+		 * current state indicates no TX_FAULT.  If TX_FAULT clears before
-+		 * this time, that's fine too.
-+		 */
-+		sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
-+		sfp->sm_retries = 5;
- 	}
- }
- 
diff --git a/target/linux/mvebu/patches-4.4/400-mvneta-tx-queue-workaround.patch b/target/linux/mvebu/patches-4.4/400-mvneta-tx-queue-workaround.patch
deleted file mode 100644
index 5dba311..0000000
--- a/target/linux/mvebu/patches-4.4/400-mvneta-tx-queue-workaround.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-The hardware queue scheduling is apparently configured with fixed
-priorities, which creates a nasty fairness issue where traffic from one
-CPU can starve traffic from all other CPUs.
-
-Work around this issue by forcing all tx packets to go through one CPU,
-until this issue is fixed properly.
-
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
----
---- a/drivers/net/ethernet/marvell/mvneta.c
-+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3984,6 +3984,16 @@ static int mvneta_ethtool_set_eee(struct
- 	return phylink_ethtool_set_eee(pp->phylink, eee);
- }
- 
-+static u16 mvneta_select_queue(struct net_device *dev, struct sk_buff *skb,
-+			       void *accel_priv,
-+			       select_queue_fallback_t fallback)
-+{
-+	/* XXX: hardware queue scheduling is broken,
-+	 * use only one queue until it is fixed */
-+	return 0;
-+}
-+
-+
- static const struct net_device_ops mvneta_netdev_ops = {
- 	.ndo_open            = mvneta_open,
- 	.ndo_stop            = mvneta_stop,
-@@ -3994,6 +4004,7 @@ static const struct net_device_ops mvnet
- 	.ndo_fix_features    = mvneta_fix_features,
- 	.ndo_get_stats64     = mvneta_get_stats64,
- 	.ndo_do_ioctl        = mvneta_ioctl,
-+	.ndo_select_queue    = mvneta_select_queue,
- };
- 
- const struct ethtool_ops mvneta_eth_tool_ops = {


From lede-commits at lists.infradead.org  Sun Apr 16 23:50:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 17 Apr 2017 02:50:07 -0400
Subject: [source]  Revert "mvebu: remove linux 4.4 support"
In-Reply-To: <20170417065007.18501.66992@git-01.infra.lede-project.org>
References: <20170417065007.18501.66992@git-01.infra.lede-project.org>
Message-ID: <mailman.25209.1492703054.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/047695a0294fd7046ba45e5490156c2b8e936a81

commit 047695a0294fd7046ba45e5490156c2b8e936a81
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Apr 17 08:43:54 2017 +0200

    Revert "mvebu: remove linux 4.4 support"
    
    This reverts commit 51397d7d95d9f5e210a5557f65de1fa21e6f5921.
    There are some unresolved random crashes on WRT1900AC v1 that still need
    to be sorted out
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/mvebu/config-4.4                      |  437 +++++
 .../mvebu/patches-4.4/002-add_powertables.patch    |  748 +++++++++
 .../mvebu/patches-4.4/003-add_switch_nodes.patch   |   40 +
 .../mvebu/patches-4.4/010-build_new_dtbs.patch     |   11 +
 ...xa3xx_nand-add-support-for-partial-chunks.patch |  428 +++++
 ...a3xx_nand-Increase-the-initial-chunk-size.patch |   42 +
 ...nand-Fix-initial-controller-configuration.patch |  104 ++
 ...bus-provide-api-for-obtaining-IO-and-DRAM.patch |   94 ++
 .../030-mvneta-consolidate-autoneg-enabling.patch  |   55 +
 ...implement-ethtool-autonegotiation-control.patch |  165 ++
 ...Make-the-default-queue-related-for-each-p.patch |  131 ++
 ...-mvneta-Associate-RX-queues-with-each-CPU.patch |  278 ++++
 .../034-net-mvneta-Add-naive-RSS-support.patch     |  191 +++
 .../035-net-mvneta-Configure-XPS-support.patch     |  124 ++
 ...fix-trivial-cut-off-issue-in-mvneta_ethto.patch |   46 +
 ...net-mvneta-Fix-for_each_present_cpu-usage.patch |   55 +
 ...Fix-the-CPU-choice-in-mvneta_percpu_elect.patch |   57 +
 ...-net-mvneta-Use-on_each_cpu-when-possible.patch |   68 +
 ...Modify-the-queue-related-fields-from-each.patch |  179 +++
 ...The-mvneta_percpu_elect-function-should-b.patch |   68 +
 ...mvneta-Fix-race-condition-during-stopping.patch |  128 ++
 ...neta-sort-the-headers-in-alphabetic-order.patch |   56 +
 ...d-a-hardware-buffer-management-helper-API.patch |  159 ++
 ...bm-add-support-for-hardware-buffer-manage.patch | 1684 ++++++++++++++++++++
 ...046-net-mvneta-Use-the-new-hwbm-framework.patch |  359 +++++
 .../047-net-mvneta-Fix-spinlock-usage.patch        |   52 +
 ...fix-error-messages-in-mvneta_port_down-fu.patch |   33 +
 ...replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch |   56 +
 ...fix-changing-MTU-when-using-per-cpu-proce.patch |   75 +
 ...M-dts-armada-38x-add-buffer-manager-nodes.patch |   53 +
 ...RM-dts-armada-xp-add-buffer-manager-nodes.patch |   53 +
 ...d-SolidRun-Armada-388-Clearfog-A1-DT-file.patch |  611 +++++++
 ...ada-38x-enable-buffer-manager-support-on-.patch |  256 +++
 ...ada-388-clearfog-remove-duplicate-mdio-en.patch |   41 +
 .../mvebu/patches-4.4/100-find_active_root.patch   |   62 +
 .../mvebu/patches-4.4/102-revert_i2c_delay.patch   |   15 +
 .../patches-4.4/103-remove-nand-driver-bug.patch   |   13 +
 .../104-linksys_mamba_disable_keep_config.patch    |   10 +
 .../106-enable-bm-on-linksys-devices.patch         |  107 ++
 .../110-pxa3xxx_revert_irq_thread.patch            |   69 +
 ...xed_phy-MII-register-generation-to-a-libr.patch |  306 ++++
 ...-swphy-register-generation-to-tabular-for.patch |  203 +++
 ...e-swphy-state-validation-from-register-ge.patch |  138 ++
 ...3-phy-generate-swphy-registers-on-the-fly.patch |  204 +++
 ...-safety-of-fixed-phy-MII-register-reading.patch |   92 ++
 ...ovide-a-hook-for-link-up-link-down-events.patch |  183 +++
 ...-marvell-88E1512-add-flow-control-support.patch |   26 +
 ...-phy-export-phy_start_machine-for-phylink.patch |   25 +
 ...8-phy-export-phy_speed_to_str-for-phylink.patch |   44 +
 .../patches-4.4/129-phy-add-I2C-mdio-bus.patch     |  163 ++
 .../130-phylink-add-phylink-infrastructure.patch   | 1005 ++++++++++++
 .../131-phylink-add-hooks-for-SFP-support.patch    |  156 ++
 ...-sfp-add-phylink-based-SFP-module-support.patch | 1382 ++++++++++++++++
 .../133-sfp-display-SFP-module-information.patch   |  283 ++++
 .../134-net-mvneta-convert-to-phylink.patch        |  697 ++++++++
 ...y-fixed-phy-remove-fixed_phy_update_state.patch |   80 +
 ...36-phylink-add-ethtool-nway_reset-support.patch |   48 +
 .../137-net-mvneta-add-nway_reset-support.patch    |   38 +
 .../138-phylink-add-flow-control-support.patch     |  262 +++
 ...neta-add-flow-control-support-via-phylink.patch |   66 +
 ...a-enable-flow-control-for-PHY-connections.patch |   32 +
 ...enable-flow-control-for-fixed-connections.patch |   53 +
 .../patches-4.4/142-phylink-add-EEE-support.patch  |  111 ++
 .../143-net-mvneta-add-EEE-support.patch           |  182 +++
 .../144-phylink-add-module-EEPROM-support.patch    |  137 ++
 ...-mvneta-add-module-EEPROM-reading-support.patch |   44 +
 .../146-sfp-phylink-hook-up-eeprom-functions.patch |   68 +
 .../147-net-mvneta-add-BQL-support.patch           |   83 +
 .../202-gpio_mvebu_add_limited_pwm_support.patch   |  433 +++++
 ..._extend_mvebu_gpio_documentation_with_pwm.patch |   52 +
 ...mvebu_xp_add_pwm_properties_to_dtsi_files.patch |  149 ++
 .../205-arm_mvebu_enable_pwm_in_defconfig.patch    |   18 +
 ...rt1900ac_use_pwm-fan_rather_than_gpio-fan.patch |   28 +
 .../207-armada-385-rd-mtd-partitions.patch         |   19 +
 .../208-ARM-mvebu-385-ap-Add-partitions.patch      |   34 +
 .../patches-4.4/209-clearfog_switch_node.patch     |   21 +
 ...armada388-clearfog-add-SFP-module-support.patch |   84 +
 .../mvebu/patches-4.4/300-reprobe_sfp_phy.patch    |   96 ++
 .../400-mvneta-tx-queue-workaround.patch           |   36 +
 79 files changed, 14294 insertions(+)

diff --git a/target/linux/mvebu/config-4.4 b/target/linux/mvebu/config-4.4
new file mode 100644
index 0000000..d819970
--- /dev/null
+++ b/target/linux/mvebu/config-4.4
@@ -0,0 +1,437 @@
+CONFIG_AHCI_MVEBU=y
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
+CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
+CONFIG_ARCH_HAS_SG_CHAIN=y
+CONFIG_ARCH_HAS_TICK_BROADCAST=y
+CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+# CONFIG_ARCH_MULTI_CPU_AUTO is not set
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
+CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
+CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
+CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_ARM=y
+CONFIG_ARMADA_370_CLK=y
+CONFIG_ARMADA_370_XP_TIMER=y
+CONFIG_ARMADA_38X_CLK=y
+CONFIG_ARMADA_THERMAL=y
+CONFIG_ARMADA_XP_CLK=y
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_ARM_ATAG_DTB_COMPAT=y
+# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
+CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_CRYPTO=y
+CONFIG_ARM_ERRATA_720789=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+# CONFIG_ARM_LPAE is not set
+CONFIG_ARM_MVEBU_V7_CPUIDLE=y
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_ARM_VIRT_EXT=y
+CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
+CONFIG_ATA=y
+CONFIG_ATAGS=y
+CONFIG_AUTO_ZRELADDR=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BOUNCE=y
+# CONFIG_CACHE_FEROCEON_L2 is not set
+CONFIG_CACHE_L2X0=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLKSRC_MMIO=y
+CONFIG_CLKSRC_OF=y
+CONFIG_CLKSRC_PROBE=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_COMMON_CLK=y
+CONFIG_CPUFREQ_DT=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+CONFIG_CPU_FREQ_GOV_COMMON=y
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+CONFIG_CPU_FREQ_STAT=y
+CONFIG_CPU_HAS_ASID=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_PJ4B=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CPU_THERMAL=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_V7=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_ABLK_HELPER=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_AES_ARM=y
+CONFIG_CRYPTO_AES_ARM_BS=y
+# CONFIG_CRYPTO_AES_ARM_CE is not set
+CONFIG_CRYPTO_CRC32C=y
+CONFIG_CRYPTO_CRYPTD=y
+CONFIG_CRYPTO_DEFLATE=y
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_DEV_MARVELL_CESA=y
+# CONFIG_CRYPTO_GHASH_ARM_CE is not set
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_LZO=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+CONFIG_CRYPTO_NULL2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA1_ARM=y
+# CONFIG_CRYPTO_SHA1_ARM_CE is not set
+CONFIG_CRYPTO_SHA1_ARM_NEON=y
+CONFIG_CRYPTO_SHA256_ARM=y
+# CONFIG_CRYPTO_SHA2_ARM_CE is not set
+CONFIG_CRYPTO_SHA512_ARM=y
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_DCACHE_WORD_ACCESS=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_LL=y
+CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
+CONFIG_DEBUG_MVEBU_UART0=y
+# CONFIG_DEBUG_MVEBU_UART0_ALTERNATE is not set
+# CONFIG_DEBUG_MVEBU_UART1_ALTERNATE is not set
+CONFIG_DEBUG_UART_8250=y
+# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set
+CONFIG_DEBUG_UART_8250_SHIFT=2
+# CONFIG_DEBUG_UART_8250_WORD is not set
+CONFIG_DEBUG_UART_PHYS=0xd0012000
+CONFIG_DEBUG_UART_VIRT=0xfec12000
+CONFIG_DEBUG_UNCOMPRESS=y
+CONFIG_DEBUG_USER=y
+CONFIG_DMADEVICES=y
+CONFIG_DMA_ENGINE=y
+CONFIG_DMA_ENGINE_RAID=y
+CONFIG_DMA_OF=y
+CONFIG_DTC=y
+# CONFIG_DW_DMAC_PCI is not set
+CONFIG_EARLY_PRINTK=y
+CONFIG_EDAC_ATOMIC_SCRUB=y
+CONFIG_EDAC_SUPPORT=y
+CONFIG_EXT4_FS=y
+# CONFIG_F2FS_CHECK_FS is not set
+CONFIG_F2FS_FS=y
+# CONFIG_F2FS_FS_SECURITY is not set
+CONFIG_F2FS_FS_XATTR=y
+CONFIG_F2FS_STAT_FS=y
+CONFIG_FIXED_PHY=y
+CONFIG_FIX_EARLYCON_MEM=y
+CONFIG_FS_MBCACHE=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_GENERIC_IDLE_POLL_SETUP=y
+CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_PHY=y
+CONFIG_GENERIC_SCHED_CLOCK=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GLOB=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_DEVRES=y
+CONFIG_GPIO_MVEBU=y
+CONFIG_GPIO_MVEBU_PWM=y
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCA953X_IRQ is not set
+CONFIG_GPIO_SYSFS=y
+CONFIG_HANDLE_DOMAIN_IRQ=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+CONFIG_HAVE_ARCH_AUDITSYSCALL=y
+CONFIG_HAVE_ARCH_BITREVERSE=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_ARM_SCU=y
+CONFIG_HAVE_ARM_TWD=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_BPF_JIT=y
+CONFIG_HAVE_CC_STACKPROTECTOR=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_CLK_PREPARE=y
+CONFIG_HAVE_CONTEXT_TRACKING=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DEBUG_KMEMLEAK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
+CONFIG_HAVE_NET_DSA=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_OPTPROBES=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HAVE_PERF_REGS=y
+CONFIG_HAVE_PERF_USER_STACK_DUMP=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SMP=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_HAVE_UID16=y
+CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
+CONFIG_HIGHMEM=y
+# CONFIG_HIGHPTE is not set
+CONFIG_HOTPLUG_CPU=y
+CONFIG_HWBM=y
+CONFIG_HWMON=y
+CONFIG_HZ_FIXED=0
+CONFIG_HZ_PERIODIC=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_MV64XXX=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IOMMU_HELPER=y
+CONFIG_IRQCHIP=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_DOMAIN_DEBUG=y
+CONFIG_IRQ_DOMAIN_HIERARCHY=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_IRQ_WORK=y
+# CONFIG_IWMMXT is not set
+CONFIG_JBD2=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_PCA963X=y
+CONFIG_LEDS_TLC591XX=y
+CONFIG_LIBFDT=y
+CONFIG_LOCK_SPIN_ON_OWNER=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_MACH_ARMADA_370=y
+# CONFIG_MACH_ARMADA_375 is not set
+CONFIG_MACH_ARMADA_38X=y
+# CONFIG_MACH_ARMADA_39X is not set
+CONFIG_MACH_ARMADA_XP=y
+# CONFIG_MACH_DOVE is not set
+CONFIG_MACH_MVEBU_ANY=y
+CONFIG_MACH_MVEBU_V7=y
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_MANGLE_BOOTARGS=y
+CONFIG_MARVELL_PHY=y
+CONFIG_MDIO_BOARDINFO=y
+CONFIG_MDIO_I2C=y
+CONFIG_MEMORY=y
+CONFIG_MIGHT_HAVE_CACHE_L2X0=y
+CONFIG_MIGHT_HAVE_PCI=y
+CONFIG_MMC=y
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_MVSDIO=y
+CONFIG_MMC_SDHCI=y
+# CONFIG_MMC_SDHCI_PCI is not set
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_SDHCI_PXAV3=y
+# CONFIG_MMC_TIFM_SD is not set
+CONFIG_MODULES_USE_ELF_REL=y
+CONFIG_MTD_CFI_STAA=y
+CONFIG_MTD_M25P80=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC=y
+CONFIG_MTD_NAND_PXA3xx=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_SPLIT_FIRMWARE=y
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_BEB_LIMIT=20
+CONFIG_MTD_UBI_BLOCK=y
+# CONFIG_MTD_UBI_FASTMAP is not set
+# CONFIG_MTD_UBI_GLUEBI is not set
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MULTI_IRQ_HANDLER=y
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_MVEBU_CLK_COMMON=y
+CONFIG_MVEBU_CLK_COREDIV=y
+CONFIG_MVEBU_CLK_CPU=y
+CONFIG_MVEBU_DEVBUS=y
+CONFIG_MVEBU_MBUS=y
+CONFIG_MVMDIO=y
+CONFIG_MVNETA=y
+CONFIG_MVNETA_BM=y
+CONFIG_MVSW61XX_PHY=y
+CONFIG_MV_XOR=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEON=y
+CONFIG_NET_FLOW_LIMIT=y
+CONFIG_NLS=y
+CONFIG_NOP_USB_XCEIV=y
+CONFIG_NO_BOOTMEM=y
+CONFIG_NR_CPUS=4
+CONFIG_OF=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_ADDRESS_PCI=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_MDIO=y
+CONFIG_OF_MTD=y
+CONFIG_OF_NET=y
+CONFIG_OF_PCI=y
+CONFIG_OF_PCI_IRQ=y
+CONFIG_OF_RESERVED_MEM=y
+CONFIG_OLD_SIGACTION=y
+CONFIG_OLD_SIGSUSPEND3=y
+CONFIG_ORION_WATCHDOG=y
+CONFIG_OUTER_CACHE=y
+CONFIG_OUTER_CACHE_SYNC=y
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PCI=y
+# CONFIG_PCI_DOMAINS_GENERIC is not set
+CONFIG_PCI_MVEBU=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PGTABLE_LEVELS=2
+CONFIG_PHYLIB=y
+CONFIG_PHYLINK=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_ARMADA_370=y
+CONFIG_PINCTRL_ARMADA_38X=y
+CONFIG_PINCTRL_ARMADA_XP=y
+CONFIG_PINCTRL_MVEBU=y
+# CONFIG_PINCTRL_SINGLE is not set
+CONFIG_PJ4B_ERRATA_4742=y
+# CONFIG_PL310_ERRATA_588369 is not set
+# CONFIG_PL310_ERRATA_727915 is not set
+# CONFIG_PL310_ERRATA_753970 is not set
+# CONFIG_PL310_ERRATA_769419 is not set
+CONFIG_PLAT_ORION=y
+CONFIG_PM_OPP=y
+CONFIG_PWM=y
+CONFIG_PWM_SYSFS=y
+CONFIG_RATIONAL=y
+CONFIG_RCU_STALL_COMMON=y
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_RFS_ACCEL=y
+CONFIG_RPS=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_ARMADA38X=y
+CONFIG_RTC_DRV_MV=y
+CONFIG_RWSEM_SPIN_ON_OWNER=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_SATA_AHCI_PLATFORM=y
+CONFIG_SATA_MV=y
+CONFIG_SCHED_HRTICK=y
+# CONFIG_SCHED_INFO is not set
+CONFIG_SCSI=y
+CONFIG_SENSORS_PWM_FAN=y
+CONFIG_SENSORS_TMP421=y
+CONFIG_SERIAL_8250_DW=y
+CONFIG_SERIAL_8250_FSL=y
+CONFIG_SFP=y
+CONFIG_SMP=y
+CONFIG_SMP_ON_UP=y
+CONFIG_SOC_BUS=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+CONFIG_SPI_ORION=y
+CONFIG_SRAM=y
+CONFIG_SRCU=y
+CONFIG_SWCONFIG=y
+CONFIG_SWIOTLB=y
+CONFIG_SWPHY=y
+CONFIG_SWP_EMULATE=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_THERMAL=y
+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
+CONFIG_THERMAL_GOV_STEP_WISE=y
+CONFIG_THERMAL_HWMON=y
+CONFIG_THERMAL_OF=y
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_TIMER_STATS=y
+CONFIG_TREE_RCU=y
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
+CONFIG_USB=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_ORION=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_EHCI_PCI=y
+CONFIG_USB_LEDS_TRIGGER_USBPORT=y
+CONFIG_USB_PHY=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_SUPPORT=y
+# CONFIG_USB_UHCI_HCD is not set
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_MVEBU=y
+CONFIG_USB_XHCI_PCI=y
+CONFIG_USB_XHCI_PLATFORM=y
+CONFIG_USE_OF=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_WATCHDOG_CORE=y
+CONFIG_XPS=y
+CONFIG_XZ_DEC_ARM=y
+CONFIG_XZ_DEC_BCJ=y
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/mvebu/patches-4.4/002-add_powertables.patch b/target/linux/mvebu/patches-4.4/002-add_powertables.patch
new file mode 100644
index 0000000..a5a47e4
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/002-add_powertables.patch
@@ -0,0 +1,748 @@
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -86,12 +86,100 @@
+ 			pcie at 2,0 {
+ 				/* Port 0, Lane 1 */
+ 				status = "okay";
++
++				mwlwifi {
++					marvell,5ghz = <0>;
++					marvell,chainmask = <4 4>;
++					marvell,powertable {
++						FCC =
++							<1 0 0x17 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0x17 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0x17 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>;
++
++						ETSI =
++							<1 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0xb 0x0 0x0 0x0 0x0 0 0xf>;
++					};
++				};
+ 			};
+ 
+ 			/* Second mini-PCIe port */
+ 			pcie at 3,0 {
+ 				/* Port 0, Lane 3 */
+ 				status = "okay";
++
++				mwlwifi {
++					marvell,2ghz = <0>;
++					marvell,chainmask = <4 4>;
++					marvell,powertable {
++						FCC =
++							<36 0 0x8 0x8 0x8 0x8 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<40 0 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<44 0 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<48 0 0x8 0x8 0x8 0x8 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<52 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
++							<56 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
++							<60 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
++							<64 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0 0xf>,
++							<100 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<104 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<108 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<112 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<116 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<120 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<124 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<128 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<132 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<136 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<140 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<149 0 0x16 0x16 0x16 0x16 0x14 0x14 0x14 0x14 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
++							<153 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
++							<157 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
++							<161 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>,
++							<165 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0 0xf>;
++
++						ETSI =
++							<36 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<40 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<44 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<48 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<52 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<56 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<60 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<64 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<100 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<104 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<108 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<112 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<116 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<120 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<124 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<128 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<132 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<136 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<140 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>,
++							<149 0 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xc 0xd 0xd 0xd 0xd 0xc 0xc 0xc 0xc 0 0xf>;
++					};
++				};
+ 			};
+ 		};
+ 
+--- a/arch/arm/boot/dts/armada-385-linksys-cobra.dts
++++ b/arch/arm/boot/dts/armada-385-linksys-cobra.dts
+@@ -100,6 +100,212 @@
+ 				};
+ 			};
+ 		};
++
++		pcie-controller {
++			pcie at 1,0 {
++				mwlwifi {
++					marvell,2ghz = <0>;
++					marvell,chainmask = <4 4>;
++					marvell,powertable {
++						AU =
++							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<100 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<104 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<108 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<112 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<116 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<120 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<124 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<128 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<132 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<136 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<140 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<149 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<153 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<157 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<161 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<165 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>;
++						CA =
++							<36 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<40 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<44 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<48 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
++						CN =
++							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<149 0 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<165 0 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>;
++						ETSI =
++							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<149 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>;
++						FCC =
++							<36 0 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0 0xf>,
++							<40 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
++							<44 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
++							<48 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
++					};
++				};
++			};
++
++			pcie at 2,0 {
++				mwlwifi {
++					marvell,5ghz = <0>;
++					marvell,chainmask = <4 4>;
++					marvell,powertable {
++						AU =
++							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
++						CA =
++							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
++						CN =
++							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<14 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
++						ETSI =
++							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
++						FCC =
++							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
++					};
++				};
++			};
++		};
+ 	};
+ 
+ 	gpio-leds {
+--- a/arch/arm/boot/dts/armada-385-linksys-caiman.dts
++++ b/arch/arm/boot/dts/armada-385-linksys-caiman.dts
+@@ -100,6 +100,212 @@
+ 				};
+ 			};
+ 		};
++
++		pcie-controller {
++			pcie at 1,0 {
++				mwlwifi {
++					marvell,2ghz = <0>;
++					marvell,chainmask = <2 2>;
++					marvell,powertable {
++						AU =
++							<36 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<40 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<44 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<48 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<100 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<104 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<108 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<112 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<116 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<120 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<124 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<128 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<132 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<136 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<140 0 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x15 0x17 0x17 0x17 0x14 0x17 0x17 0x17 0x14 0 0xf>,
++							<149 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
++							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
++							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
++							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>,
++							<165 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x1a 0x1a 0x17 0x14 0 0xf>;
++						CA =
++							<36 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
++							<40 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
++							<44 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
++							<48 0 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0xf 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<149 0 0x1a 0x1a 0x18 0x17 0x19 0x19 0x17 0x15 0x18 0x18 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<165 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>;
++						CN =
++							<36 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<40 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<44 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<48 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<100 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<149 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x11 0x11 0x11 0x11 0 0xf>,
++							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>,
++							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>,
++							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>,
++							<165 0 0x15 0x15 0x15 0x15 0x16 0x16 0x16 0x15 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0 0xf>;
++						ETSI =
++							<36 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<40 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<44 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<48 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<100 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>,
++							<149 0 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0 0xf>;
++						FCC =
++							<36 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<40 0 0x19 0x19 0x18 0x17 0x19 0x19 0x17 0x15 0x17 0x17 0x17 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<44 0 0x19 0x19 0x18 0x17 0x19 0x19 0x17 0x15 0x17 0x17 0x17 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<48 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x17 0x17 0x17 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<149 0 0x1a 0x1a 0x18 0x17 0x19 0x19 0x17 0x15 0x18 0x18 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<153 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<157 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<161 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>,
++							<165 0 0x1a 0x1a 0x18 0x17 0x1a 0x1a 0x17 0x15 0x1a 0x1a 0x17 0x14 0x15 0x15 0x15 0x14 0 0xf>;
++					};
++				};
++			};
++
++			pcie at 2,0 {
++				mwlwifi {
++					marvell,5ghz = <0>;
++					marvell,chainmask = <2 2>;
++					marvell,powertable {
++						AU =
++							<1 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>;
++						CA =
++							<1 0 0x19 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x10 0x10 0x10 0x10 0x00 0x00 0x00 0x00 0 0xf>,
++							<2 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<3 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<4 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<5 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<6 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<7 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<8 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<9 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<10 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x00 0x00 0x00 0x00 0 0xf>,
++							<11 0 0x19 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x00 0x00 0x00 0x00 0 0xf>;
++						CN =
++							<1 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<14 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>;
++						ETSI =
++							<1 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0x0 0x0 0x0 0x0 0 0xf>;
++						FCC =
++							<1 0 0x19 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x10 0x10 0x10 0x10 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0x1a 0x19 0x18 0x17 0x19 0x19 0x17 0x16 0x14 0x14 0x14 0x14 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0x19 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x0 0x0 0x0 0x0 0 0xf>;
++					};
++				};
++			};
++		};
+ 	};
+ 
+ 	gpio-leds {
+--- a/arch/arm/boot/dts/armada-385-linksys-shelby.dts
++++ b/arch/arm/boot/dts/armada-385-linksys-shelby.dts
+@@ -100,6 +100,212 @@
+ 				};
+ 			};
+ 		};
++
++		pcie-controller {
++			pcie at 1,0 {
++				mwlwifi {
++					marvell,2ghz = <0>;
++					marvell,chainmask = <4 4>;
++					marvell,powertable {
++						AU =
++							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<100 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<104 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<108 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<112 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<116 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<120 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<124 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<128 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<132 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<136 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<140 0 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0 0xf>,
++							<149 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<153 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<157 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<161 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>,
++							<165 0 0x19 0x19 0x19 0x17 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0x19 0x19 0x16 0x15 0 0xf>;
++						CA =
++							<36 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<40 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<44 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<48 0 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0x9 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
++						CN =
++							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<149 0 0x14 0x14 0x14 0x14 0x13 0x13 0x13 0x13 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>,
++							<165 0 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x14 0x14 0x14 0x14 0x10 0x10 0x10 0x10 0 0xf>;
++						ETSI =
++							<36 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<40 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<44 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<48 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<52 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<56 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<60 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<64 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<100 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<104 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<108 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<112 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<116 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<120 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<124 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<128 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<132 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<136 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<140 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>,
++							<149 0 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xd 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0xe 0 0xf>;
++						FCC =
++							<36 0 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0 0xf>,
++							<40 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
++							<44 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
++							<48 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0xf 0xf 0xf 0xf 0 0xf>,
++							<52 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<56 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<60 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<64 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<100 0 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<104 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x12 0x12 0x12 0x12 0x10 0x10 0x10 0x10 0 0xf>,
++							<108 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<112 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<116 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<120 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<124 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<128 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<132 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<136 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<140 0 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0x11 0x11 0x11 0x11 0x10 0x10 0x10 0x10 0 0xf>,
++							<149 0 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<153 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<157 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<161 0 0x16 0x16 0x16 0x16 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>,
++							<165 0 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0 0xf>;
++					};
++				};
++			};
++
++			pcie at 2,0 {
++				mwlwifi {
++					marvell,5ghz = <0>;
++					marvell,chainmask = <4 4>;
++					marvell,powertable {
++						AU =
++							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
++						CA =
++							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
++						CN =
++							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<14 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
++						ETSI =
++							<1 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<12 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>,
++							<13 0 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0xa 0x0 0x0 0x0 0x0 0 0xf>;
++						FCC =
++							<1 0 0x17 0x10 0x10 0x10 0xf 0xf 0xf 0xf 0xe 0xe 0xe 0xe 0x0 0x0 0x0 0x0 0 0xf>,
++							<2 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<3 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<4 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<5 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<6 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<7 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<8 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<9 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<10 0 0x18 0x16 0x16 0x16 0x16 0x16 0x16 0x14 0x11 0x11 0x11 0x11 0x0 0x0 0x0 0x0 0 0xf>,
++							<11 0 0x17 0x12 0x12 0x12 0x13 0x13 0x13 0x13 0xf 0xf 0xf 0xf 0x0 0x0 0x0 0x0 0 0xf>;
++					};
++				};
++			};
++		};
+ 	};
+ 
+ 	gpio-leds {
diff --git a/target/linux/mvebu/patches-4.4/003-add_switch_nodes.patch b/target/linux/mvebu/patches-4.4/003-add_switch_nodes.patch
new file mode 100644
index 0000000..1502b6b
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/003-add_switch_nodes.patch
@@ -0,0 +1,40 @@
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -467,6 +467,16 @@
+ 			};
+ 		};
+ 	};
++
++	mvsw61xx {
++		compatible = "marvell,88e6172";
++		status = "okay";
++		reg = <0x10>;
++
++		mii-bus = <&mdio>;
++		cpu-port-0 = <5>;
++		cpu-port-1 = <6>;
++	};
+ };
+ 
+ &pinctrl {
+--- a/arch/arm/boot/dts/armada-385-linksys.dtsi
++++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
+@@ -309,6 +309,18 @@
+ 			};
+ 		};
+ 	};
++
++	mvsw61xx {
++		#address-cells = <1>;
++		#size-cells = <0>;
++		compatible = "marvell,88e6176";
++		status = "okay";
++		reg = <0x10>;
++
++		mii-bus = <&mdio>;
++		cpu-port-0 = <5>;
++		cpu-port-1 = <6>;
++	};
+ };
+ 
+ &pinctrl {
diff --git a/target/linux/mvebu/patches-4.4/010-build_new_dtbs.patch b/target/linux/mvebu/patches-4.4/010-build_new_dtbs.patch
new file mode 100644
index 0000000..6ba9ee6
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/010-build_new_dtbs.patch
@@ -0,0 +1,11 @@
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -748,6 +748,8 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \
+ 	armada-385-db-ap.dtb \
+ 	armada-385-linksys-caiman.dtb \
+ 	armada-385-linksys-cobra.dtb \
++	armada-385-linksys-rango.dtb \
++	armada-385-linksys-shelby.dtb \
+ 	armada-388-db.dtb \
+ 	armada-388-gp.dtb \
+ 	armada-388-rd.dtb
diff --git a/target/linux/mvebu/patches-4.4/020-mtd-nand-pxa3xx_nand-add-support-for-partial-chunks.patch b/target/linux/mvebu/patches-4.4/020-mtd-nand-pxa3xx_nand-add-support-for-partial-chunks.patch
new file mode 100644
index 0000000..2e67097
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/020-mtd-nand-pxa3xx_nand-add-support-for-partial-chunks.patch
@@ -0,0 +1,428 @@
+From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+Date: Wed, 10 Feb 2016 14:54:21 +0100
+Subject: [PATCH] mtd: nand: pxa3xx_nand: add support for partial chunks
+
+This commit is needed to properly support the 8-bits ECC configuration
+with 4KB pages.
+
+When pages larger than 2 KB are used on platforms using the PXA3xx
+NAND controller, the reading/programming operations need to be split
+in chunks of 2 KBs or less because the controller FIFO is limited to
+about 2 KB (i.e a bit more than 2 KB to accommodate OOB data). Due to
+this requirement, the data layout on NAND is a bit strange, with ECC
+interleaved with data, at the end of each chunk.
+
+When a 4-bits ECC configuration is used with 4 KB pages, the physical
+data layout on the NAND looks like this:
+
+| 2048 data | 32 spare | 30 ECC | 2048 data | 32 spare | 30 ECC |
+
+So the data chunks have an equal size, 2080 bytes for each chunk,
+which the driver supports properly.
+
+When a 8-bits ECC configuration is used with 4KB pages, the physical
+data layout on the NAND looks like this:
+
+| 1024 data | 30 ECC | 1024 data | 30 ECC | 1024 data | 30 ECC | 1024 data | 30 ECC | 64 spare | 30 ECC |
+
+So, the spare area is stored in its own chunk, which has a different
+size than the other chunks. Since OOB is not used by UBIFS, the initial
+implementation of the driver has chosen to not support reading this
+additional "spare" chunk of data.
+
+Unfortunately, Marvell has chosen to store the BBT signature in the
+OOB area. Therefore, if the driver doesn't read this spare area, Linux
+has no way of finding the BBT. It thinks there is no BBT, and rewrites
+one, which U-Boot does not recognize, causing compatibility problems
+between the bootloader and the kernel in terms of NAND usage.
+
+To fix this, this commit implements the support for reading a partial
+last chunk. This support is currently only useful for the case of 8
+bits ECC with 4 KB pages, but it will be useful in the future to
+enable other configurations such as 12 bits and 16 bits ECC with 4 KB
+pages, or 8 bits ECC with 8 KB pages, etc. All those configurations
+have a "last" chunk that doesn't have the same size as the other
+chunks.
+
+In order to implement reading of the last chunk, this commit:
+
+ - Adds a number of new fields to the pxa3xx_nand_info to describe how
+   many full chunks and how many chunks we have, the size of full
+   chunks and partial chunks, both in terms of data area and spare
+   area.
+
+ - Fills in the step_chunk_size and step_spare_size variables to
+   describe how much data and spare should be read/written for the
+   current read/program step.
+
+ - Reworks the state machine to accommodate doing the additional read
+   or program step when a last partial chunk is used.
+
+This commit has been tested on a Marvell Armada 398 DB board, with a
+4KB page NAND, tested in both 4 bits ECC and 8 bits ECC
+configurations. Robert Jarzmik has tested on some PXA platforms.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+Tested-by: Robert Jarzmik <robert.jarzmik at free.fr>
+Acked-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
+Signed-off-by: Brian Norris <computersforpeace at gmail.com>
+---
+
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -228,15 +228,44 @@ struct pxa3xx_nand_info {
+ 	int			use_spare;	/* use spare ? */
+ 	int			need_wait;
+ 
+-	unsigned int		data_size;	/* data to be read from FIFO */
+-	unsigned int		chunk_size;	/* split commands chunk size */
+-	unsigned int		oob_size;
++	/* Amount of real data per full chunk */
++	unsigned int		chunk_size;
++
++	/* Amount of spare data per full chunk */
+ 	unsigned int		spare_size;
++
++	/* Number of full chunks (i.e chunk_size + spare_size) */
++	unsigned int            nfullchunks;
++
++	/*
++	 * Total number of chunks. If equal to nfullchunks, then there
++	 * are only full chunks. Otherwise, there is one last chunk of
++	 * size (last_chunk_size + last_spare_size)
++	 */
++	unsigned int            ntotalchunks;
++
++	/* Amount of real data in the last chunk */
++	unsigned int		last_chunk_size;
++
++	/* Amount of spare data in the last chunk */
++	unsigned int		last_spare_size;
++
+ 	unsigned int		ecc_size;
+ 	unsigned int		ecc_err_cnt;
+ 	unsigned int		max_bitflips;
+ 	int 			retcode;
+ 
++	/*
++	 * Variables only valid during command
++	 * execution. step_chunk_size and step_spare_size is the
++	 * amount of real data and spare data in the current
++	 * chunk. cur_chunk is the current chunk being
++	 * read/programmed.
++	 */
++	unsigned int		step_chunk_size;
++	unsigned int		step_spare_size;
++	unsigned int            cur_chunk;
++
+ 	/* cached register value */
+ 	uint32_t		reg_ndcr;
+ 	uint32_t		ndtr0cs0;
+@@ -531,25 +560,6 @@ static int pxa3xx_nand_init(struct pxa3x
+ 	return 0;
+ }
+ 
+-/*
+- * Set the data and OOB size, depending on the selected
+- * spare and ECC configuration.
+- * Only applicable to READ0, READOOB and PAGEPROG commands.
+- */
+-static void pxa3xx_set_datasize(struct pxa3xx_nand_info *info,
+-				struct mtd_info *mtd)
+-{
+-	int oob_enable = info->reg_ndcr & NDCR_SPARE_EN;
+-
+-	info->data_size = mtd->writesize;
+-	if (!oob_enable)
+-		return;
+-
+-	info->oob_size = info->spare_size;
+-	if (!info->use_ecc)
+-		info->oob_size += info->ecc_size;
+-}
+-
+ /**
+  * NOTE: it is a must to set ND_RUN firstly, then write
+  * command buffer, otherwise, it does not work.
+@@ -665,28 +675,28 @@ static void drain_fifo(struct pxa3xx_nan
+ 
+ static void handle_data_pio(struct pxa3xx_nand_info *info)
+ {
+-	unsigned int do_bytes = min(info->data_size, info->chunk_size);
+-
+ 	switch (info->state) {
+ 	case STATE_PIO_WRITING:
+-		writesl(info->mmio_base + NDDB,
+-			info->data_buff + info->data_buff_pos,
+-			DIV_ROUND_UP(do_bytes, 4));
++		if (info->step_chunk_size)
++			writesl(info->mmio_base + NDDB,
++				info->data_buff + info->data_buff_pos,
++				DIV_ROUND_UP(info->step_chunk_size, 4));
+ 
+-		if (info->oob_size > 0)
++		if (info->step_spare_size)
+ 			writesl(info->mmio_base + NDDB,
+ 				info->oob_buff + info->oob_buff_pos,
+-				DIV_ROUND_UP(info->oob_size, 4));
++				DIV_ROUND_UP(info->step_spare_size, 4));
+ 		break;
+ 	case STATE_PIO_READING:
+-		drain_fifo(info,
+-			   info->data_buff + info->data_buff_pos,
+-			   DIV_ROUND_UP(do_bytes, 4));
++		if (info->step_chunk_size)
++			drain_fifo(info,
++				   info->data_buff + info->data_buff_pos,
++				   DIV_ROUND_UP(info->step_chunk_size, 4));
+ 
+-		if (info->oob_size > 0)
++		if (info->step_spare_size)
+ 			drain_fifo(info,
+ 				   info->oob_buff + info->oob_buff_pos,
+-				   DIV_ROUND_UP(info->oob_size, 4));
++				   DIV_ROUND_UP(info->step_spare_size, 4));
+ 		break;
+ 	default:
+ 		dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__,
+@@ -695,9 +705,8 @@ static void handle_data_pio(struct pxa3x
+ 	}
+ 
+ 	/* Update buffer pointers for multi-page read/write */
+-	info->data_buff_pos += do_bytes;
+-	info->oob_buff_pos += info->oob_size;
+-	info->data_size -= do_bytes;
++	info->data_buff_pos += info->step_chunk_size;
++	info->oob_buff_pos += info->step_spare_size;
+ }
+ 
+ static void pxa3xx_nand_data_dma_irq(void *data)
+@@ -738,8 +747,9 @@ static void start_data_dma(struct pxa3xx
+ 				info->state);
+ 		BUG();
+ 	}
+-	info->sg.length = info->data_size +
+-		(info->oob_size ? info->spare_size + info->ecc_size : 0);
++	info->sg.length = info->chunk_size;
++	if (info->use_spare)
++		info->sg.length += info->spare_size + info->ecc_size;
+ 	dma_map_sg(info->dma_chan->device->dev, &info->sg, 1, info->dma_dir);
+ 
+ 	tx = dmaengine_prep_slave_sg(info->dma_chan, &info->sg, 1, direction,
+@@ -900,9 +910,11 @@ static void prepare_start_command(struct
+ 	/* reset data and oob column point to handle data */
+ 	info->buf_start		= 0;
+ 	info->buf_count		= 0;
+-	info->oob_size		= 0;
+ 	info->data_buff_pos	= 0;
+ 	info->oob_buff_pos	= 0;
++	info->step_chunk_size   = 0;
++	info->step_spare_size   = 0;
++	info->cur_chunk         = 0;
+ 	info->use_ecc		= 0;
+ 	info->use_spare		= 1;
+ 	info->retcode		= ERR_NONE;
+@@ -914,8 +926,6 @@ static void prepare_start_command(struct
+ 	case NAND_CMD_READ0:
+ 	case NAND_CMD_PAGEPROG:
+ 		info->use_ecc = 1;
+-	case NAND_CMD_READOOB:
+-		pxa3xx_set_datasize(info, mtd);
+ 		break;
+ 	case NAND_CMD_PARAM:
+ 		info->use_spare = 0;
+@@ -974,6 +984,14 @@ static int prepare_set_command(struct px
+ 		if (command == NAND_CMD_READOOB)
+ 			info->buf_start += mtd->writesize;
+ 
++		if (info->cur_chunk < info->nfullchunks) {
++			info->step_chunk_size = info->chunk_size;
++			info->step_spare_size = info->spare_size;
++		} else {
++			info->step_chunk_size = info->last_chunk_size;
++			info->step_spare_size = info->last_spare_size;
++		}
++
+ 		/*
+ 		 * Multiple page read needs an 'extended command type' field,
+ 		 * which is either naked-read or last-read according to the
+@@ -985,8 +1003,8 @@ static int prepare_set_command(struct px
+ 			info->ndcb0 |= NDCB0_DBC | (NAND_CMD_READSTART << 8)
+ 					| NDCB0_LEN_OVRD
+ 					| NDCB0_EXT_CMD_TYPE(ext_cmd_type);
+-			info->ndcb3 = info->chunk_size +
+-				      info->oob_size;
++			info->ndcb3 = info->step_chunk_size +
++				info->step_spare_size;
+ 		}
+ 
+ 		set_command_address(info, mtd->writesize, column, page_addr);
+@@ -1006,8 +1024,6 @@ static int prepare_set_command(struct px
+ 				| NDCB0_EXT_CMD_TYPE(ext_cmd_type)
+ 				| addr_cycle
+ 				| command;
+-			/* No data transfer in this case */
+-			info->data_size = 0;
+ 			exec_cmd = 1;
+ 		}
+ 		break;
+@@ -1019,6 +1035,14 @@ static int prepare_set_command(struct px
+ 			break;
+ 		}
+ 
++		if (info->cur_chunk < info->nfullchunks) {
++			info->step_chunk_size = info->chunk_size;
++			info->step_spare_size = info->spare_size;
++		} else {
++			info->step_chunk_size = info->last_chunk_size;
++			info->step_spare_size = info->last_spare_size;
++		}
++
+ 		/* Second command setting for large pages */
+ 		if (mtd->writesize > PAGE_CHUNK_SIZE) {
+ 			/*
+@@ -1029,14 +1053,14 @@ static int prepare_set_command(struct px
+ 			info->ndcb0 |= NDCB0_CMD_TYPE(0x1)
+ 					| NDCB0_LEN_OVRD
+ 					| NDCB0_EXT_CMD_TYPE(ext_cmd_type);
+-			info->ndcb3 = info->chunk_size +
+-				      info->oob_size;
++			info->ndcb3 = info->step_chunk_size +
++				      info->step_spare_size;
+ 
+ 			/*
+ 			 * This is the command dispatch that completes a chunked
+ 			 * page program operation.
+ 			 */
+-			if (info->data_size == 0) {
++			if (info->cur_chunk == info->ntotalchunks) {
+ 				info->ndcb0 = NDCB0_CMD_TYPE(0x1)
+ 					| NDCB0_EXT_CMD_TYPE(ext_cmd_type)
+ 					| command;
+@@ -1063,7 +1087,7 @@ static int prepare_set_command(struct px
+ 				| command;
+ 		info->ndcb1 = (column & 0xFF);
+ 		info->ndcb3 = INIT_BUFFER_SIZE;
+-		info->data_size = INIT_BUFFER_SIZE;
++		info->step_chunk_size = INIT_BUFFER_SIZE;
+ 		break;
+ 
+ 	case NAND_CMD_READID:
+@@ -1073,7 +1097,7 @@ static int prepare_set_command(struct px
+ 				| command;
+ 		info->ndcb1 = (column & 0xFF);
+ 
+-		info->data_size = 8;
++		info->step_chunk_size = 8;
+ 		break;
+ 	case NAND_CMD_STATUS:
+ 		info->buf_count = 1;
+@@ -1081,7 +1105,7 @@ static int prepare_set_command(struct px
+ 				| NDCB0_ADDR_CYC(1)
+ 				| command;
+ 
+-		info->data_size = 8;
++		info->step_chunk_size = 8;
+ 		break;
+ 
+ 	case NAND_CMD_ERASE1:
+@@ -1220,6 +1244,7 @@ static void nand_cmdfunc_extended(struct
+ 	init_completion(&info->dev_ready);
+ 	do {
+ 		info->state = STATE_PREPARED;
++
+ 		exec_cmd = prepare_set_command(info, command, ext_cmd_type,
+ 					       column, page_addr);
+ 		if (!exec_cmd) {
+@@ -1239,22 +1264,30 @@ static void nand_cmdfunc_extended(struct
+ 			break;
+ 		}
+ 
++		/* Only a few commands need several steps */
++		if (command != NAND_CMD_PAGEPROG &&
++		    command != NAND_CMD_READ0    &&
++		    command != NAND_CMD_READOOB)
++			break;
++
++		info->cur_chunk++;
++
+ 		/* Check if the sequence is complete */
+-		if (info->data_size == 0 && command != NAND_CMD_PAGEPROG)
++		if (info->cur_chunk == info->ntotalchunks && command != NAND_CMD_PAGEPROG)
+ 			break;
+ 
+ 		/*
+ 		 * After a splitted program command sequence has issued
+ 		 * the command dispatch, the command sequence is complete.
+ 		 */
+-		if (info->data_size == 0 &&
++		if (info->cur_chunk == (info->ntotalchunks + 1) &&
+ 		    command == NAND_CMD_PAGEPROG &&
+ 		    ext_cmd_type == EXT_CMD_TYPE_DISPATCH)
+ 			break;
+ 
+ 		if (command == NAND_CMD_READ0 || command == NAND_CMD_READOOB) {
+ 			/* Last read: issue a 'last naked read' */
+-			if (info->data_size == info->chunk_size)
++			if (info->cur_chunk == info->ntotalchunks - 1)
+ 				ext_cmd_type = EXT_CMD_TYPE_LAST_RW;
+ 			else
+ 				ext_cmd_type = EXT_CMD_TYPE_NAKED_RW;
+@@ -1264,7 +1297,7 @@ static void nand_cmdfunc_extended(struct
+ 		 * the command dispatch must be issued to complete.
+ 		 */
+ 		} else if (command == NAND_CMD_PAGEPROG &&
+-			   info->data_size == 0) {
++			   info->cur_chunk == info->ntotalchunks) {
+ 				ext_cmd_type = EXT_CMD_TYPE_DISPATCH;
+ 		}
+ 	} while (1);
+@@ -1514,6 +1547,8 @@ static int pxa_ecc_init(struct pxa3xx_na
+ 			int strength, int ecc_stepsize, int page_size)
+ {
+ 	if (strength == 1 && ecc_stepsize == 512 && page_size == 2048) {
++		info->nfullchunks = 1;
++		info->ntotalchunks = 1;
+ 		info->chunk_size = 2048;
+ 		info->spare_size = 40;
+ 		info->ecc_size = 24;
+@@ -1522,6 +1557,8 @@ static int pxa_ecc_init(struct pxa3xx_na
+ 		ecc->strength = 1;
+ 
+ 	} else if (strength == 1 && ecc_stepsize == 512 && page_size == 512) {
++		info->nfullchunks = 1;
++		info->ntotalchunks = 1;
+ 		info->chunk_size = 512;
+ 		info->spare_size = 8;
+ 		info->ecc_size = 8;
+@@ -1535,6 +1572,8 @@ static int pxa_ecc_init(struct pxa3xx_na
+ 	 */
+ 	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 2048) {
+ 		info->ecc_bch = 1;
++		info->nfullchunks = 1;
++		info->ntotalchunks = 1;
+ 		info->chunk_size = 2048;
+ 		info->spare_size = 32;
+ 		info->ecc_size = 32;
+@@ -1545,6 +1584,8 @@ static int pxa_ecc_init(struct pxa3xx_na
+ 
+ 	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) {
+ 		info->ecc_bch = 1;
++		info->nfullchunks = 2;
++		info->ntotalchunks = 2;
+ 		info->chunk_size = 2048;
+ 		info->spare_size = 32;
+ 		info->ecc_size = 32;
+@@ -1559,8 +1600,12 @@ static int pxa_ecc_init(struct pxa3xx_na
+ 	 */
+ 	} else if (strength == 8 && ecc_stepsize == 512 && page_size == 4096) {
+ 		info->ecc_bch = 1;
++		info->nfullchunks = 4;
++		info->ntotalchunks = 5;
+ 		info->chunk_size = 1024;
+ 		info->spare_size = 0;
++		info->last_chunk_size = 0;
++		info->last_spare_size = 64;
+ 		info->ecc_size = 32;
+ 		ecc->mode = NAND_ECC_HW;
+ 		ecc->size = info->chunk_size;
diff --git a/target/linux/mvebu/patches-4.4/021-mtd-pxa3xx_nand-Increase-the-initial-chunk-size.patch b/target/linux/mvebu/patches-4.4/021-mtd-pxa3xx_nand-Increase-the-initial-chunk-size.patch
new file mode 100644
index 0000000..0b0e047
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/021-mtd-pxa3xx_nand-Increase-the-initial-chunk-size.patch
@@ -0,0 +1,42 @@
+From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= <ezequiel at vanguardiasur.com.ar>
+Date: Wed, 4 Nov 2015 13:13:41 -0300
+Subject: [PATCH] mtd: pxa3xx_nand: Increase the initial chunk size
+
+The chunk size represents the size of the data chunks, which
+is used by the controllers that allow to split transfered data.
+
+However, the initial chunk size is used in a non-splitted way,
+during device identification. Therefore, it must be large enough
+for all the NAND commands issued during device identification.
+This includes NAND_CMD_PARAM which was recently changed to
+transfer up to 2048 bytes (for the redundant parameter pages).
+
+Thus, the initial chunk size should be 2048 as well.
+
+On Armada 370/XP platforms (NFCv2) booted without the keep-config
+devicetree property, this commit fixes a timeout on the NAND_CMD_PARAM
+command:
+
+  [..]
+  pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
+  pxa3xx-nand f10d0000.nand: Wait time out!!!
+  nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x38
+  nand: Micron MT29F8G08ABABAWP
+  nand: 1024 MiB, SLC, erase size: 512 KiB, page size: 4096, OOB size: 224
+
+Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
+Acked-by: Robert Jarzmik <robert.jarzmik at free.fr>
+Signed-off-by: Brian Norris <computersforpeace at gmail.com>
+---
+
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -1637,7 +1637,7 @@ static int pxa3xx_nand_scan(struct mtd_i
+ 		goto KEEP_CONFIG;
+ 
+ 	/* Set a default chunk size */
+-	info->chunk_size = 512;
++	info->chunk_size = PAGE_CHUNK_SIZE;
+ 
+ 	ret = pxa3xx_nand_config_flash(info);
+ 	if (ret)
diff --git a/target/linux/mvebu/patches-4.4/022-mtd-pxa3xx_nand-Fix-initial-controller-configuration.patch b/target/linux/mvebu/patches-4.4/022-mtd-pxa3xx_nand-Fix-initial-controller-configuration.patch
new file mode 100644
index 0000000..7d07fb9
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/022-mtd-pxa3xx_nand-Fix-initial-controller-configuration.patch
@@ -0,0 +1,104 @@
+From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= <ezequiel at vanguardiasur.com.ar>
+Date: Wed, 4 Nov 2015 13:13:42 -0300
+Subject: [PATCH] mtd: pxa3xx_nand: Fix initial controller configuration
+
+The Data Flash Control Register (NDCR) contains two types
+of parameters: those that are needed for device identification,
+and those that can only be set after device identification.
+
+Therefore, the driver can't set them all at once and instead
+needs to configure the first group before nand_scan_ident()
+and the second group later.
+
+Let's split pxa3xx_nand_config in two halves, and set the
+parameters that depend on the device geometry once this is known.
+
+Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
+Signed-off-by: Brian Norris <computersforpeace at gmail.com>
+---
+
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -1420,34 +1420,43 @@ static int pxa3xx_nand_waitfunc(struct m
+ 	return NAND_STATUS_READY;
+ }
+ 
+-static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info)
++static int pxa3xx_nand_config_ident(struct pxa3xx_nand_info *info)
+ {
+ 	struct platform_device *pdev = info->pdev;
+ 	struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
+-	struct pxa3xx_nand_host *host = info->host[info->cs];
+-	struct mtd_info *mtd = host->mtd;
+-	struct nand_chip *chip = mtd->priv;
+ 
+-	/* configure default flash values */
++	/* Configure default flash values */
++	info->chunk_size = PAGE_CHUNK_SIZE;
+ 	info->reg_ndcr = 0x0; /* enable all interrupts */
+ 	info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
+ 	info->reg_ndcr |= NDCR_RD_ID_CNT(READ_ID_BYTES);
+-	info->reg_ndcr |= NDCR_SPARE_EN; /* enable spare by default */
++	info->reg_ndcr |= NDCR_SPARE_EN;
++
++	return 0;
++}
++
++static void pxa3xx_nand_config_tail(struct pxa3xx_nand_info *info)
++{
++	struct pxa3xx_nand_host *host = info->host[info->cs];
++	struct mtd_info *mtd = host->mtd;
++	struct nand_chip *chip = mtd->priv;
++
+ 	info->reg_ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0;
+ 	info->reg_ndcr |= (chip->page_shift == 6) ? NDCR_PG_PER_BLK : 0;
+ 	info->reg_ndcr |= (mtd->writesize == 2048) ? NDCR_PAGE_SZ : 0;
+-
+-	return 0;
+ }
+ 
+ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info)
+ {
++	struct platform_device *pdev = info->pdev;
++	struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
+ 	uint32_t ndcr = nand_readl(info, NDCR);
+ 
+ 	/* Set an initial chunk size */
+ 	info->chunk_size = ndcr & NDCR_PAGE_SZ ? 2048 : 512;
+ 	info->reg_ndcr = ndcr &
+ 		~(NDCR_INT_MASK | NDCR_ND_ARB_EN | NFCV1_NDCR_ARB_CNTL);
++	info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
+ 	info->ndtr0cs0 = nand_readl(info, NDTR0CS0);
+ 	info->ndtr1cs0 = nand_readl(info, NDTR1CS0);
+ 	return 0;
+@@ -1636,10 +1645,7 @@ static int pxa3xx_nand_scan(struct mtd_i
+ 	if (pdata->keep_config && !pxa3xx_nand_detect_config(info))
+ 		goto KEEP_CONFIG;
+ 
+-	/* Set a default chunk size */
+-	info->chunk_size = PAGE_CHUNK_SIZE;
+-
+-	ret = pxa3xx_nand_config_flash(info);
++	ret = pxa3xx_nand_config_ident(info);
+ 	if (ret)
+ 		return ret;
+ 
+@@ -1652,7 +1658,6 @@ static int pxa3xx_nand_scan(struct mtd_i
+ 	}
+ 
+ KEEP_CONFIG:
+-	info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
+ 	if (info->reg_ndcr & NDCR_DWIDTH_M)
+ 		chip->options |= NAND_BUSWIDTH_16;
+ 
+@@ -1737,6 +1742,10 @@ KEEP_CONFIG:
+ 		host->row_addr_cycles = 3;
+ 	else
+ 		host->row_addr_cycles = 2;
++
++	if (!pdata->keep_config)
++		pxa3xx_nand_config_tail(info);
++
+ 	return nand_scan_tail(mtd);
+ }
+ 
diff --git a/target/linux/mvebu/patches-4.4/023-bus-mvebu-mbus-provide-api-for-obtaining-IO-and-DRAM.patch b/target/linux/mvebu/patches-4.4/023-bus-mvebu-mbus-provide-api-for-obtaining-IO-and-DRAM.patch
new file mode 100644
index 0000000..58687f3
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/023-bus-mvebu-mbus-provide-api-for-obtaining-IO-and-DRAM.patch
@@ -0,0 +1,94 @@
+From: Marcin Wojtas <mw at semihalf.com>
+Date: Mon, 14 Mar 2016 09:39:02 +0100
+Subject: [PATCH] bus: mvebu-mbus: provide api for obtaining IO and DRAM window
+ information
+
+This commit enables finding appropriate mbus window and obtaining its
+target id and attribute for given physical address in two separate
+routines, both for IO and DRAM windows. This functionality
+is needed for Armada XP/38x Network Controller's Buffer Manager and
+PnC configuration.
+
+[gregory.clement at free-electrons.com: Fix size test for
+mvebu_mbus_get_dram_win_info]
+
+Signed-off-by: Marcin Wojtas <mw at semihalf.com>
+[DRAM window information reference in LKv3.10]
+Signed-off-by: Evan Wang <xswang at marvell.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/bus/mvebu-mbus.c
++++ b/drivers/bus/mvebu-mbus.c
+@@ -948,6 +948,58 @@ void mvebu_mbus_get_pcie_io_aperture(str
+ 	*res = mbus_state.pcie_io_aperture;
+ }
+ 
++int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr)
++{
++	const struct mbus_dram_target_info *dram;
++	int i;
++
++	/* Get dram info */
++	dram = mv_mbus_dram_info();
++	if (!dram) {
++		pr_err("missing DRAM information\n");
++		return -ENODEV;
++	}
++
++	/* Try to find matching DRAM window for phyaddr */
++	for (i = 0; i < dram->num_cs; i++) {
++		const struct mbus_dram_window *cs = dram->cs + i;
++
++		if (cs->base <= phyaddr &&
++			phyaddr <= (cs->base + cs->size - 1)) {
++			*target = dram->mbus_dram_target_id;
++			*attr = cs->mbus_attr;
++			return 0;
++		}
++	}
++
++	pr_err("invalid dram address 0x%x\n", phyaddr);
++	return -EINVAL;
++}
++EXPORT_SYMBOL_GPL(mvebu_mbus_get_dram_win_info);
++
++int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
++			       u8 *attr)
++{
++	int win;
++
++	for (win = 0; win < mbus_state.soc->num_wins; win++) {
++		u64 wbase;
++		int enabled;
++
++		mvebu_mbus_read_window(&mbus_state, win, &enabled, &wbase,
++				       size, target, attr, NULL);
++
++		if (!enabled)
++			continue;
++
++		if (wbase <= phyaddr && phyaddr <= wbase + *size)
++			return win;
++	}
++
++	return -EINVAL;
++}
++EXPORT_SYMBOL_GPL(mvebu_mbus_get_io_win_info);
++
+ static __init int mvebu_mbus_debugfs_init(void)
+ {
+ 	struct mvebu_mbus_state *s = &mbus_state;
+--- a/include/linux/mbus.h
++++ b/include/linux/mbus.h
+@@ -69,6 +69,9 @@ static inline const struct mbus_dram_tar
+ int mvebu_mbus_save_cpu_target(u32 *store_addr);
+ void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
+ void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
++int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr);
++int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
++			       u8 *attr);
+ int mvebu_mbus_add_window_remap_by_id(unsigned int target,
+ 				      unsigned int attribute,
+ 				      phys_addr_t base, size_t size,
diff --git a/target/linux/mvebu/patches-4.4/030-mvneta-consolidate-autoneg-enabling.patch b/target/linux/mvebu/patches-4.4/030-mvneta-consolidate-autoneg-enabling.patch
new file mode 100644
index 0000000..1d98c7d
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/030-mvneta-consolidate-autoneg-enabling.patch
@@ -0,0 +1,55 @@
+From: Stas Sergeev <stsp at list.ru>
+Date: Wed, 2 Dec 2015 20:33:56 +0300
+Subject: [PATCH] mvneta: consolidate autoneg enabling
+
+This moves autoneg-related bit manipulations to the single place.
+
+CC: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+CC: netdev at vger.kernel.org
+CC: linux-kernel at vger.kernel.org
+
+Signed-off-by: Stas Sergeev <stsp at users.sourceforge.net>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -1067,15 +1067,28 @@ static void mvneta_defaults_set(struct m
+ 		       MVNETA_GMAC_AN_SPEED_EN |
+ 		       MVNETA_GMAC_AN_DUPLEX_EN;
+ 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++
+ 		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+ 		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
+ 		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
++		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
+ 	} else {
+ 		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+ 		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
+ 		       MVNETA_GMAC_AN_SPEED_EN |
+ 		       MVNETA_GMAC_AN_DUPLEX_EN);
+ 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
++		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
++		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
+ 	}
+ 
+ 	mvneta_set_ucast_table(pp, -1);
+@@ -3230,9 +3243,6 @@ static int mvneta_port_power_up(struct m
+ 		return -EINVAL;
+ 	}
+ 
+-	if (pp->use_inband_status)
+-		ctrl |= MVNETA_GMAC2_INBAND_AN_ENABLE;
+-
+ 	/* Cancel Port Reset */
+ 	ctrl &= ~MVNETA_GMAC2_PORT_RESET;
+ 	mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);
diff --git a/target/linux/mvebu/patches-4.4/031-mvneta-implement-ethtool-autonegotiation-control.patch b/target/linux/mvebu/patches-4.4/031-mvneta-implement-ethtool-autonegotiation-control.patch
new file mode 100644
index 0000000..626b511
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/031-mvneta-implement-ethtool-autonegotiation-control.patch
@@ -0,0 +1,165 @@
+From: Stas Sergeev <stsp at list.ru>
+Date: Wed, 2 Dec 2015 20:35:11 +0300
+Subject: [PATCH] mvneta: implement ethtool autonegotiation control
+
+This patch allows to do
+ethtool -s eth0 autoneg off
+ethtool -s eth0 autoneg on
+to disable or enable autonegotiation at run-time.
+Without that functionality, the only way to control the autonegotiation
+is to modify the device tree.
+
+This is needed if you plan to use the same kernel with
+different ethernet switches, the ones that support the in-band
+status and the ones that not.
+
+CC: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+CC: netdev at vger.kernel.org
+CC: linux-kernel at vger.kernel.org
+
+Signed-off-by: Stas Sergeev <stsp at users.sourceforge.net>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -371,7 +371,7 @@ struct mvneta_port {
+ 	unsigned int duplex;
+ 	unsigned int speed;
+ 	unsigned int tx_csum_limit;
+-	int use_inband_status:1;
++	unsigned int use_inband_status:1;
+ 
+ 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
+ };
+@@ -973,6 +973,44 @@ static void mvneta_set_other_mcast_table
+ 		mvreg_write(pp, MVNETA_DA_FILT_OTH_MCAST + offset, val);
+ }
+ 
++static void mvneta_set_autoneg(struct mvneta_port *pp, int enable)
++{
++	u32 val;
++
++	if (enable) {
++		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
++			 MVNETA_GMAC_FORCE_LINK_DOWN |
++			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
++		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
++		       MVNETA_GMAC_AN_SPEED_EN |
++		       MVNETA_GMAC_AN_DUPLEX_EN;
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
++		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
++		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
++	} else {
++		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
++		       MVNETA_GMAC_AN_SPEED_EN |
++		       MVNETA_GMAC_AN_DUPLEX_EN);
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
++		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
++
++		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
++		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
++		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
++	}
++}
++
+ /* This method sets defaults to the NETA port:
+  *	Clears interrupt Cause and Mask registers.
+  *	Clears all MAC tables.
+@@ -1058,39 +1096,7 @@ static void mvneta_defaults_set(struct m
+ 	val &= ~MVNETA_PHY_POLLING_ENABLE;
+ 	mvreg_write(pp, MVNETA_UNIT_CONTROL, val);
+ 
+-	if (pp->use_inband_status) {
+-		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+-		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
+-			 MVNETA_GMAC_FORCE_LINK_DOWN |
+-			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
+-		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
+-		       MVNETA_GMAC_AN_SPEED_EN |
+-		       MVNETA_GMAC_AN_DUPLEX_EN;
+-		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+-		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
+-		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
+-	} else {
+-		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+-		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
+-		       MVNETA_GMAC_AN_SPEED_EN |
+-		       MVNETA_GMAC_AN_DUPLEX_EN);
+-		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+-		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
+-		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
+-	}
+-
++	mvneta_set_autoneg(pp, pp->use_inband_status);
+ 	mvneta_set_ucast_table(pp, -1);
+ 	mvneta_set_special_mcast_table(pp, -1);
+ 	mvneta_set_other_mcast_table(pp, -1);
+@@ -2956,10 +2962,43 @@ int mvneta_ethtool_get_settings(struct n
+ int mvneta_ethtool_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
++	struct phy_device *phydev = pp->phy_dev;
+ 
+-	if (!pp->phy_dev)
++	if (!phydev)
+ 		return -ENODEV;
+ 
++	if ((cmd->autoneg == AUTONEG_ENABLE) != pp->use_inband_status) {
++		u32 val;
++
++		mvneta_set_autoneg(pp, cmd->autoneg == AUTONEG_ENABLE);
++
++		if (cmd->autoneg == AUTONEG_DISABLE) {
++			val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++			val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
++				 MVNETA_GMAC_CONFIG_GMII_SPEED |
++				 MVNETA_GMAC_CONFIG_FULL_DUPLEX);
++
++			if (phydev->duplex)
++				val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
++
++			if (phydev->speed == SPEED_1000)
++				val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
++			else if (phydev->speed == SPEED_100)
++				val |= MVNETA_GMAC_CONFIG_MII_SPEED;
++
++			mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++		}
++
++		pp->use_inband_status = (cmd->autoneg == AUTONEG_ENABLE);
++		netdev_info(pp->dev, "autoneg status set to %i\n",
++			    pp->use_inband_status);
++
++		if (netif_running(dev)) {
++			mvneta_port_down(pp);
++			mvneta_port_up(pp);
++		}
++	}
++
+ 	return phy_ethtool_sset(pp->phy_dev, cmd);
+ }
+ 
diff --git a/target/linux/mvebu/patches-4.4/032-net-mvneta-Make-the-default-queue-related-for-each-p.patch b/target/linux/mvebu/patches-4.4/032-net-mvneta-Make-the-default-queue-related-for-each-p.patch
new file mode 100644
index 0000000..54c9399
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/032-net-mvneta-Make-the-default-queue-related-for-each-p.patch
@@ -0,0 +1,131 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Wed, 9 Dec 2015 18:23:48 +0100
+Subject: [PATCH] net: mvneta: Make the default queue related for each port
+
+Instead of using the same default queue for all the port. Move it in the
+port struct. It will allow have a different default queue for each port.
+
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -356,6 +356,7 @@ struct mvneta_port {
+ 	struct mvneta_tx_queue *txqs;
+ 	struct net_device *dev;
+ 	struct notifier_block cpu_notifier;
++	int rxq_def;
+ 
+ 	/* Core clock */
+ 	struct clk *clk;
+@@ -819,7 +820,7 @@ static void mvneta_port_up(struct mvneta
+ 	mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
+ 
+ 	/* Enable all initialized RXQs. */
+-	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(rxq_def));
++	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(pp->rxq_def));
+ }
+ 
+ /* Stop the Ethernet port activity */
+@@ -1067,7 +1068,7 @@ static void mvneta_defaults_set(struct m
+ 	mvreg_write(pp, MVNETA_ACC_MODE, val);
+ 
+ 	/* Update val of portCfg register accordingly with all RxQueue types */
+-	val = MVNETA_PORT_CONFIG_DEFL_VALUE(rxq_def);
++	val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
+ 	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
+ 
+ 	val = 0;
+@@ -2101,19 +2102,19 @@ static void mvneta_set_rx_mode(struct ne
+ 	if (dev->flags & IFF_PROMISC) {
+ 		/* Accept all: Multicast + Unicast */
+ 		mvneta_rx_unicast_promisc_set(pp, 1);
+-		mvneta_set_ucast_table(pp, rxq_def);
+-		mvneta_set_special_mcast_table(pp, rxq_def);
+-		mvneta_set_other_mcast_table(pp, rxq_def);
++		mvneta_set_ucast_table(pp, pp->rxq_def);
++		mvneta_set_special_mcast_table(pp, pp->rxq_def);
++		mvneta_set_other_mcast_table(pp, pp->rxq_def);
+ 	} else {
+ 		/* Accept single Unicast */
+ 		mvneta_rx_unicast_promisc_set(pp, 0);
+ 		mvneta_set_ucast_table(pp, -1);
+-		mvneta_mac_addr_set(pp, dev->dev_addr, rxq_def);
++		mvneta_mac_addr_set(pp, dev->dev_addr, pp->rxq_def);
+ 
+ 		if (dev->flags & IFF_ALLMULTI) {
+ 			/* Accept all multicast */
+-			mvneta_set_special_mcast_table(pp, rxq_def);
+-			mvneta_set_other_mcast_table(pp, rxq_def);
++			mvneta_set_special_mcast_table(pp, pp->rxq_def);
++			mvneta_set_other_mcast_table(pp, pp->rxq_def);
+ 		} else {
+ 			/* Accept only initialized multicast */
+ 			mvneta_set_special_mcast_table(pp, -1);
+@@ -2122,7 +2123,7 @@ static void mvneta_set_rx_mode(struct ne
+ 			if (!netdev_mc_empty(dev)) {
+ 				netdev_for_each_mc_addr(ha, dev) {
+ 					mvneta_mcast_addr_set(pp, ha->addr,
+-							      rxq_def);
++							      pp->rxq_def);
+ 				}
+ 			}
+ 		}
+@@ -2205,7 +2206,7 @@ static int mvneta_poll(struct napi_struc
+ 	 * RX packets
+ 	 */
+ 	cause_rx_tx |= port->cause_rx_tx;
+-	rx_done = mvneta_rx(pp, budget, &pp->rxqs[rxq_def]);
++	rx_done = mvneta_rx(pp, budget, &pp->rxqs[pp->rxq_def]);
+ 	budget -= rx_done;
+ 
+ 	if (budget > 0) {
+@@ -2418,17 +2419,17 @@ static void mvneta_cleanup_txqs(struct m
+ /* Cleanup all Rx queues */
+ static void mvneta_cleanup_rxqs(struct mvneta_port *pp)
+ {
+-	mvneta_rxq_deinit(pp, &pp->rxqs[rxq_def]);
++	mvneta_rxq_deinit(pp, &pp->rxqs[pp->rxq_def]);
+ }
+ 
+ 
+ /* Init all Rx queues */
+ static int mvneta_setup_rxqs(struct mvneta_port *pp)
+ {
+-	int err = mvneta_rxq_init(pp, &pp->rxqs[rxq_def]);
++	int err = mvneta_rxq_init(pp, &pp->rxqs[pp->rxq_def]);
+ 	if (err) {
+ 		netdev_err(pp->dev, "%s: can't create rxq=%d\n",
+-			   __func__, rxq_def);
++			   __func__, pp->rxq_def);
+ 		mvneta_cleanup_rxqs(pp);
+ 		return err;
+ 	}
+@@ -2634,7 +2635,7 @@ static int mvneta_set_mac_addr(struct ne
+ 	mvneta_mac_addr_set(pp, dev->dev_addr, -1);
+ 
+ 	/* Set new addr in hw */
+-	mvneta_mac_addr_set(pp, sockaddr->sa_data, rxq_def);
++	mvneta_mac_addr_set(pp, sockaddr->sa_data, pp->rxq_def);
+ 
+ 	eth_commit_mac_addr_change(dev, addr);
+ 	return 0;
+@@ -2753,7 +2754,7 @@ static void mvneta_percpu_elect(struct m
+ {
+ 	int online_cpu_idx, cpu, i = 0;
+ 
+-	online_cpu_idx = rxq_def % num_online_cpus();
++	online_cpu_idx = pp->rxq_def % num_online_cpus();
+ 
+ 	for_each_online_cpu(cpu) {
+ 		if (i == online_cpu_idx)
+@@ -3363,6 +3364,8 @@ static int mvneta_probe(struct platform_
+ 				 strcmp(managed, "in-band-status") == 0);
+ 	pp->cpu_notifier.notifier_call = mvneta_percpu_notifier;
+ 
++	pp->rxq_def = rxq_def;
++
+ 	pp->clk = devm_clk_get(&pdev->dev, NULL);
+ 	if (IS_ERR(pp->clk)) {
+ 		err = PTR_ERR(pp->clk);
diff --git a/target/linux/mvebu/patches-4.4/033-net-mvneta-Associate-RX-queues-with-each-CPU.patch b/target/linux/mvebu/patches-4.4/033-net-mvneta-Associate-RX-queues-with-each-CPU.patch
new file mode 100644
index 0000000..636c6cf
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/033-net-mvneta-Associate-RX-queues-with-each-CPU.patch
@@ -0,0 +1,278 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Wed, 9 Dec 2015 18:23:49 +0100
+Subject: [PATCH] net: mvneta: Associate RX queues with each CPU
+
+We enable the percpu interrupt for all the CPU and we just associate a
+CPU to a few queue at the neta level. The mapping between the CPUs and
+the queues is static. The queues are associated to the CPU module the
+number of CPUs. However currently we only use on RX queue for a given
+Ethernet port.
+
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -110,9 +110,16 @@
+ #define MVNETA_CPU_MAP(cpu)                      (0x2540 + ((cpu) << 2))
+ #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
+ #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
++#define      MVNETA_CPU_RXQ_ACCESS(rxq)		 BIT(rxq)
+ #define MVNETA_RXQ_TIME_COAL_REG(q)              (0x2580 + ((q) << 2))
+ 
+-/* Exception Interrupt Port/Queue Cause register */
++/* Exception Interrupt Port/Queue Cause register
++ *
++ * Their behavior depend of the mapping done using the PCPX2Q
++ * registers. For a given CPU if the bit associated to a queue is not
++ * set, then for the register a read from this CPU will always return
++ * 0 and a write won't do anything
++ */
+ 
+ #define MVNETA_INTR_NEW_CAUSE                    0x25a0
+ #define MVNETA_INTR_NEW_MASK                     0x25a4
+@@ -820,7 +827,13 @@ static void mvneta_port_up(struct mvneta
+ 	mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
+ 
+ 	/* Enable all initialized RXQs. */
+-	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(pp->rxq_def));
++	for (queue = 0; queue < rxq_number; queue++) {
++		struct mvneta_rx_queue *rxq = &pp->rxqs[queue];
++
++		if (rxq->descs != NULL)
++			q_map |= (1 << queue);
++	}
++	mvreg_write(pp, MVNETA_RXQ_CMD, q_map);
+ }
+ 
+ /* Stop the Ethernet port activity */
+@@ -1026,6 +1039,7 @@ static void mvneta_defaults_set(struct m
+ 	int cpu;
+ 	int queue;
+ 	u32 val;
++	int max_cpu = num_present_cpus();
+ 
+ 	/* Clear all Cause registers */
+ 	mvreg_write(pp, MVNETA_INTR_NEW_CAUSE, 0);
+@@ -1041,13 +1055,23 @@ static void mvneta_defaults_set(struct m
+ 	/* Enable MBUS Retry bit16 */
+ 	mvreg_write(pp, MVNETA_MBUS_RETRY, 0x20);
+ 
+-	/* Set CPU queue access map - all CPUs have access to all RX
+-	 * queues and to all TX queues
++	/* Set CPU queue access map. CPUs are assigned to the RX
++	 * queues modulo their number and all the TX queues are
++	 * assigned to the CPU associated to the default RX queue.
+ 	 */
+-	for_each_present_cpu(cpu)
+-		mvreg_write(pp, MVNETA_CPU_MAP(cpu),
+-			    (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |
+-			     MVNETA_CPU_TXQ_ACCESS_ALL_MASK));
++	for_each_present_cpu(cpu) {
++		int rxq_map = 0, txq_map = 0;
++		int rxq;
++
++		for (rxq = 0; rxq < rxq_number; rxq++)
++			if ((rxq % max_cpu) == cpu)
++				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
++
++		if (cpu == rxq_def)
++			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
++
++		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
++	}
+ 
+ 	/* Reset RX and TX DMAs */
+ 	mvreg_write(pp, MVNETA_PORT_RX_RESET, MVNETA_PORT_RX_DMA_RESET);
+@@ -2174,6 +2198,7 @@ static int mvneta_poll(struct napi_struc
+ {
+ 	int rx_done = 0;
+ 	u32 cause_rx_tx;
++	int rx_queue;
+ 	struct mvneta_port *pp = netdev_priv(napi->dev);
+ 	struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports);
+ 
+@@ -2205,8 +2230,15 @@ static int mvneta_poll(struct napi_struc
+ 	/* For the case where the last mvneta_poll did not process all
+ 	 * RX packets
+ 	 */
++	rx_queue = fls(((cause_rx_tx >> 8) & 0xff));
++
+ 	cause_rx_tx |= port->cause_rx_tx;
+-	rx_done = mvneta_rx(pp, budget, &pp->rxqs[pp->rxq_def]);
++
++	if (rx_queue) {
++		rx_queue = rx_queue - 1;
++		rx_done = mvneta_rx(pp, budget, &pp->rxqs[rx_queue]);
++	}
++
+ 	budget -= rx_done;
+ 
+ 	if (budget > 0) {
+@@ -2419,19 +2451,27 @@ static void mvneta_cleanup_txqs(struct m
+ /* Cleanup all Rx queues */
+ static void mvneta_cleanup_rxqs(struct mvneta_port *pp)
+ {
+-	mvneta_rxq_deinit(pp, &pp->rxqs[pp->rxq_def]);
++	int queue;
++
++	for (queue = 0; queue < txq_number; queue++)
++		mvneta_rxq_deinit(pp, &pp->rxqs[queue]);
+ }
+ 
+ 
+ /* Init all Rx queues */
+ static int mvneta_setup_rxqs(struct mvneta_port *pp)
+ {
+-	int err = mvneta_rxq_init(pp, &pp->rxqs[pp->rxq_def]);
+-	if (err) {
+-		netdev_err(pp->dev, "%s: can't create rxq=%d\n",
+-			   __func__, pp->rxq_def);
+-		mvneta_cleanup_rxqs(pp);
+-		return err;
++	int queue;
++
++	for (queue = 0; queue < rxq_number; queue++) {
++		int err = mvneta_rxq_init(pp, &pp->rxqs[queue]);
++
++		if (err) {
++			netdev_err(pp->dev, "%s: can't create rxq=%d\n",
++				   __func__, queue);
++			mvneta_cleanup_rxqs(pp);
++			return err;
++		}
+ 	}
+ 
+ 	return 0;
+@@ -2455,6 +2495,19 @@ static int mvneta_setup_txqs(struct mvne
+ 	return 0;
+ }
+ 
++static void mvneta_percpu_unmask_interrupt(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	/* All the queue are unmasked, but actually only the ones
++	 * maped to this CPU will be unmasked
++	 */
++	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
++		    MVNETA_RX_INTR_MASK_ALL |
++		    MVNETA_TX_INTR_MASK_ALL |
++		    MVNETA_MISCINTR_INTR_MASK);
++}
++
+ static void mvneta_start_dev(struct mvneta_port *pp)
+ {
+ 	unsigned int cpu;
+@@ -2472,11 +2525,10 @@ static void mvneta_start_dev(struct mvne
+ 		napi_enable(&port->napi);
+ 	}
+ 
+-	/* Unmask interrupts */
+-	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
+-		    MVNETA_RX_INTR_MASK(rxq_number) |
+-		    MVNETA_TX_INTR_MASK(txq_number) |
+-		    MVNETA_MISCINTR_INTR_MASK);
++	/* Unmask interrupts. It has to be done from each CPU */
++	for_each_online_cpu(cpu)
++		smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
++					 pp, true);
+ 	mvreg_write(pp, MVNETA_INTR_MISC_MASK,
+ 		    MVNETA_CAUSE_PHY_STATUS_CHANGE |
+ 		    MVNETA_CAUSE_LINK_CHANGE |
+@@ -2752,22 +2804,35 @@ static void mvneta_percpu_disable(void *
+ 
+ static void mvneta_percpu_elect(struct mvneta_port *pp)
+ {
+-	int online_cpu_idx, cpu, i = 0;
++	int online_cpu_idx, max_cpu, cpu, i = 0;
+ 
+ 	online_cpu_idx = pp->rxq_def % num_online_cpus();
++	max_cpu = num_present_cpus();
+ 
+ 	for_each_online_cpu(cpu) {
+-		if (i == online_cpu_idx)
+-			/* Enable per-CPU interrupt on the one CPU we
+-			 * just elected
++		int rxq_map = 0, txq_map = 0;
++		int rxq;
++
++		for (rxq = 0; rxq < rxq_number; rxq++)
++			if ((rxq % max_cpu) == cpu)
++				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
++
++		if (i == online_cpu_idx) {
++			/* Map the default receive queue and transmit
++			 * queue to the elected CPU
+ 			 */
+-			smp_call_function_single(cpu, mvneta_percpu_enable,
+-						pp, true);
+-		else
+-			/* Disable per-CPU interrupt on all the other CPU */
+-			smp_call_function_single(cpu, mvneta_percpu_disable,
+-						pp, true);
++			rxq_map |= MVNETA_CPU_RXQ_ACCESS(pp->rxq_def);
++			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
++		}
++		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
++
++		/* Update the interrupt mask on each CPU according the
++		 * new mapping
++		 */
++		smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
++					 pp, true);
+ 		i++;
++
+ 	}
+ };
+ 
+@@ -2802,12 +2867,22 @@ static int mvneta_percpu_notifier(struct
+ 		mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
+ 		napi_enable(&port->napi);
+ 
++
++		/* Enable per-CPU interrupts on the CPU that is
++		 * brought up.
++		 */
++		smp_call_function_single(cpu, mvneta_percpu_enable,
++					 pp, true);
++
+ 		/* Enable per-CPU interrupt on the one CPU we care
+ 		 * about.
+ 		 */
+ 		mvneta_percpu_elect(pp);
+ 
+-		/* Unmask all ethernet port interrupts */
++		/* Unmask all ethernet port interrupts, as this
++		 * notifier is called for each CPU then the CPU to
++		 * Queue mapping is applied
++		 */
+ 		mvreg_write(pp, MVNETA_INTR_NEW_MASK,
+ 			MVNETA_RX_INTR_MASK(rxq_number) |
+ 			MVNETA_TX_INTR_MASK(txq_number) |
+@@ -2858,7 +2933,7 @@ static int mvneta_percpu_notifier(struct
+ static int mvneta_open(struct net_device *dev)
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+-	int ret;
++	int ret, cpu;
+ 
+ 	pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
+ 	pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
+@@ -2888,8 +2963,13 @@ static int mvneta_open(struct net_device
+ 	 */
+ 	mvneta_percpu_disable(pp);
+ 
+-	/* Elect a CPU to handle our RX queue interrupt */
+-	mvneta_percpu_elect(pp);
++	/* Enable per-CPU interrupt on all the CPU to handle our RX
++	 * queue interrupts
++	 */
++	for_each_online_cpu(cpu)
++		smp_call_function_single(cpu, mvneta_percpu_enable,
++					 pp, true);
++
+ 
+ 	/* Register a CPU notifier to handle the case where our CPU
+ 	 * might be taken offline.
diff --git a/target/linux/mvebu/patches-4.4/034-net-mvneta-Add-naive-RSS-support.patch b/target/linux/mvebu/patches-4.4/034-net-mvneta-Add-naive-RSS-support.patch
new file mode 100644
index 0000000..629c44c
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/034-net-mvneta-Add-naive-RSS-support.patch
@@ -0,0 +1,191 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Wed, 9 Dec 2015 18:23:50 +0100
+Subject: [PATCH] net: mvneta: Add naive RSS support
+
+This patch adds the support for the RSS related ethtool
+function. Currently it only uses one entry in the indirection table which
+allows associating an mvneta interface to a given CPU.
+
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Tested-by: Marcin Wojtas <mw at semihalf.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -261,6 +261,11 @@
+ 
+ #define MVNETA_TX_MTU_MAX		0x3ffff
+ 
++/* The RSS lookup table actually has 256 entries but we do not use
++ * them yet
++ */
++#define MVNETA_RSS_LU_TABLE_SIZE	1
++
+ /* TSO header size */
+ #define TSO_HEADER_SIZE 128
+ 
+@@ -382,6 +387,8 @@ struct mvneta_port {
+ 	unsigned int use_inband_status:1;
+ 
+ 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
++
++	u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
+ };
+ 
+ /* The mvneta_tx_desc and mvneta_rx_desc structures describe the
+@@ -1067,7 +1074,7 @@ static void mvneta_defaults_set(struct m
+ 			if ((rxq % max_cpu) == cpu)
+ 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
+ 
+-		if (cpu == rxq_def)
++		if (cpu == pp->rxq_def)
+ 			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
+ 
+ 		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
+@@ -2508,6 +2515,18 @@ static void mvneta_percpu_unmask_interru
+ 		    MVNETA_MISCINTR_INTR_MASK);
+ }
+ 
++static void mvneta_percpu_mask_interrupt(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	/* All the queue are masked, but actually only the ones
++	 * maped to this CPU will be masked
++	 */
++	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
++	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
++	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
++}
++
+ static void mvneta_start_dev(struct mvneta_port *pp)
+ {
+ 	unsigned int cpu;
+@@ -3231,6 +3250,106 @@ static int mvneta_ethtool_get_sset_count
+ 	return -EOPNOTSUPP;
+ }
+ 
++static u32 mvneta_ethtool_get_rxfh_indir_size(struct net_device *dev)
++{
++	return MVNETA_RSS_LU_TABLE_SIZE;
++}
++
++static int mvneta_ethtool_get_rxnfc(struct net_device *dev,
++				    struct ethtool_rxnfc *info,
++				    u32 *rules __always_unused)
++{
++	switch (info->cmd) {
++	case ETHTOOL_GRXRINGS:
++		info->data =  rxq_number;
++		return 0;
++	case ETHTOOL_GRXFH:
++		return -EOPNOTSUPP;
++	default:
++		return -EOPNOTSUPP;
++	}
++}
++
++static int  mvneta_config_rss(struct mvneta_port *pp)
++{
++	int cpu;
++	u32 val;
++
++	netif_tx_stop_all_queues(pp->dev);
++
++	for_each_online_cpu(cpu)
++		smp_call_function_single(cpu, mvneta_percpu_mask_interrupt,
++					 pp, true);
++
++	/* We have to synchronise on the napi of each CPU */
++	for_each_online_cpu(cpu) {
++		struct mvneta_pcpu_port *pcpu_port =
++			per_cpu_ptr(pp->ports, cpu);
++
++		napi_synchronize(&pcpu_port->napi);
++		napi_disable(&pcpu_port->napi);
++	}
++
++	pp->rxq_def = pp->indir[0];
++
++	/* Update unicast mapping */
++	mvneta_set_rx_mode(pp->dev);
++
++	/* Update val of portCfg register accordingly with all RxQueue types */
++	val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
++	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
++
++	/* Update the elected CPU matching the new rxq_def */
++	mvneta_percpu_elect(pp);
++
++	/* We have to synchronise on the napi of each CPU */
++	for_each_online_cpu(cpu) {
++		struct mvneta_pcpu_port *pcpu_port =
++			per_cpu_ptr(pp->ports, cpu);
++
++		napi_enable(&pcpu_port->napi);
++	}
++
++	netif_tx_start_all_queues(pp->dev);
++
++	return 0;
++}
++
++static int mvneta_ethtool_set_rxfh(struct net_device *dev, const u32 *indir,
++				   const u8 *key, const u8 hfunc)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++	/* We require at least one supported parameter to be changed
++	 * and no change in any of the unsupported parameters
++	 */
++	if (key ||
++	    (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
++		return -EOPNOTSUPP;
++
++	if (!indir)
++		return 0;
++
++	memcpy(pp->indir, indir, MVNETA_RSS_LU_TABLE_SIZE);
++
++	return mvneta_config_rss(pp);
++}
++
++static int mvneta_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
++				   u8 *hfunc)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++
++	if (hfunc)
++		*hfunc = ETH_RSS_HASH_TOP;
++
++	if (!indir)
++		return 0;
++
++	memcpy(indir, pp->indir, MVNETA_RSS_LU_TABLE_SIZE);
++
++	return 0;
++}
++
+ static const struct net_device_ops mvneta_netdev_ops = {
+ 	.ndo_open            = mvneta_open,
+ 	.ndo_stop            = mvneta_stop,
+@@ -3255,6 +3374,10 @@ const struct ethtool_ops mvneta_eth_tool
+ 	.get_strings	= mvneta_ethtool_get_strings,
+ 	.get_ethtool_stats = mvneta_ethtool_get_stats,
+ 	.get_sset_count	= mvneta_ethtool_get_sset_count,
++	.get_rxfh_indir_size = mvneta_ethtool_get_rxfh_indir_size,
++	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
++	.get_rxfh	= mvneta_ethtool_get_rxfh,
++	.set_rxfh	= mvneta_ethtool_set_rxfh,
+ };
+ 
+ /* Initialize hw */
+@@ -3446,6 +3569,8 @@ static int mvneta_probe(struct platform_
+ 
+ 	pp->rxq_def = rxq_def;
+ 
++	pp->indir[0] = rxq_def;
++
+ 	pp->clk = devm_clk_get(&pdev->dev, NULL);
+ 	if (IS_ERR(pp->clk)) {
+ 		err = PTR_ERR(pp->clk);
diff --git a/target/linux/mvebu/patches-4.4/035-net-mvneta-Configure-XPS-support.patch b/target/linux/mvebu/patches-4.4/035-net-mvneta-Configure-XPS-support.patch
new file mode 100644
index 0000000..5b35b64
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/035-net-mvneta-Configure-XPS-support.patch
@@ -0,0 +1,124 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Wed, 9 Dec 2015 18:23:51 +0100
+Subject: [PATCH] net: mvneta: Configure XPS support
+
+With this patch each CPU is associated with its own set of TX queues.
+
+It also setup the XPS with an initial configuration which set the
+affinity matching the hardware configuration.
+
+Suggested-by: Arnd Bergmann <arnd at arndb.de>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -111,6 +111,7 @@
+ #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
+ #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
+ #define      MVNETA_CPU_RXQ_ACCESS(rxq)		 BIT(rxq)
++#define      MVNETA_CPU_TXQ_ACCESS(txq)		 BIT(txq + 8)
+ #define MVNETA_RXQ_TIME_COAL_REG(q)              (0x2580 + ((q) << 2))
+ 
+ /* Exception Interrupt Port/Queue Cause register
+@@ -514,6 +515,9 @@ struct mvneta_tx_queue {
+ 
+ 	/* DMA address of TSO headers */
+ 	dma_addr_t tso_hdrs_phys;
++
++	/* Affinity mask for CPUs*/
++	cpumask_t affinity_mask;
+ };
+ 
+ struct mvneta_rx_queue {
+@@ -1062,20 +1066,30 @@ static void mvneta_defaults_set(struct m
+ 	/* Enable MBUS Retry bit16 */
+ 	mvreg_write(pp, MVNETA_MBUS_RETRY, 0x20);
+ 
+-	/* Set CPU queue access map. CPUs are assigned to the RX
+-	 * queues modulo their number and all the TX queues are
+-	 * assigned to the CPU associated to the default RX queue.
++	/* Set CPU queue access map. CPUs are assigned to the RX and
++	 * TX queues modulo their number. If there is only one TX
++	 * queue then it is assigned to the CPU associated to the
++	 * default RX queue.
+ 	 */
+ 	for_each_present_cpu(cpu) {
+ 		int rxq_map = 0, txq_map = 0;
+-		int rxq;
++		int rxq, txq;
+ 
+ 		for (rxq = 0; rxq < rxq_number; rxq++)
+ 			if ((rxq % max_cpu) == cpu)
+ 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
+ 
+-		if (cpu == pp->rxq_def)
+-			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
++		for (txq = 0; txq < txq_number; txq++)
++			if ((txq % max_cpu) == cpu)
++				txq_map |= MVNETA_CPU_TXQ_ACCESS(txq);
++
++		/* With only one TX queue we configure a special case
++		 * which will allow to get all the irq on a single
++		 * CPU
++		 */
++		if (txq_number == 1)
++			txq_map = (cpu == pp->rxq_def) ?
++				MVNETA_CPU_TXQ_ACCESS(1) : 0;
+ 
+ 		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
+ 	}
+@@ -2362,6 +2376,8 @@ static void mvneta_rxq_deinit(struct mvn
+ static int mvneta_txq_init(struct mvneta_port *pp,
+ 			   struct mvneta_tx_queue *txq)
+ {
++	int cpu;
++
+ 	txq->size = pp->tx_ring_size;
+ 
+ 	/* A queue must always have room for at least one skb.
+@@ -2414,6 +2430,14 @@ static int mvneta_txq_init(struct mvneta
+ 	}
+ 	mvneta_tx_done_pkts_coal_set(pp, txq, txq->done_pkts_coal);
+ 
++	/* Setup XPS mapping */
++	if (txq_number > 1)
++		cpu = txq->id % num_present_cpus();
++	else
++		cpu = pp->rxq_def % num_present_cpus();
++	cpumask_set_cpu(cpu, &txq->affinity_mask);
++	netif_set_xps_queue(pp->dev, &txq->affinity_mask, txq->id);
++
+ 	return 0;
+ }
+ 
+@@ -2836,13 +2860,23 @@ static void mvneta_percpu_elect(struct m
+ 			if ((rxq % max_cpu) == cpu)
+ 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
+ 
+-		if (i == online_cpu_idx) {
+-			/* Map the default receive queue and transmit
+-			 * queue to the elected CPU
++		if (i == online_cpu_idx)
++			/* Map the default receive queue queue to the
++			 * elected CPU
+ 			 */
+ 			rxq_map |= MVNETA_CPU_RXQ_ACCESS(pp->rxq_def);
+-			txq_map = MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
+-		}
++
++		/* We update the TX queue map only if we have one
++		 * queue. In this case we associate the TX queue to
++		 * the CPU bound to the default RX queue
++		 */
++		if (txq_number == 1)
++			txq_map = (i == online_cpu_idx) ?
++				MVNETA_CPU_TXQ_ACCESS(1) : 0;
++		else
++			txq_map = mvreg_read(pp, MVNETA_CPU_MAP(cpu)) &
++				MVNETA_CPU_TXQ_ACCESS_ALL_MASK;
++
+ 		mvreg_write(pp, MVNETA_CPU_MAP(cpu), rxq_map | txq_map);
+ 
+ 		/* Update the interrupt mask on each CPU according the
diff --git a/target/linux/mvebu/patches-4.4/036-net-mvneta-fix-trivial-cut-off-issue-in-mvneta_ethto.patch b/target/linux/mvebu/patches-4.4/036-net-mvneta-fix-trivial-cut-off-issue-in-mvneta_ethto.patch
new file mode 100644
index 0000000..2bd7a88
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/036-net-mvneta-fix-trivial-cut-off-issue-in-mvneta_ethto.patch
@@ -0,0 +1,46 @@
+From: Jisheng Zhang <jszhang at marvell.com>
+Date: Wed, 20 Jan 2016 16:36:25 +0800
+Subject: [PATCH] net: mvneta: fix trivial cut-off issue in
+ mvneta_ethtool_update_stats
+
+When s->type is T_REG_64, the high 32bits are lost in val. This patch
+fixes this trivial issue.
+
+Signed-off-by: Jisheng Zhang <jszhang at marvell.com>
+Fixes: 9b0cdefa4cd5 ("net: mvneta: add ethtool statistics")
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3242,26 +3242,25 @@ static void mvneta_ethtool_update_stats(
+ 	const struct mvneta_statistic *s;
+ 	void __iomem *base = pp->base;
+ 	u32 high, low, val;
++	u64 val64;
+ 	int i;
+ 
+ 	for (i = 0, s = mvneta_statistics;
+ 	     s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics);
+ 	     s++, i++) {
+-		val = 0;
+-
+ 		switch (s->type) {
+ 		case T_REG_32:
+ 			val = readl_relaxed(base + s->offset);
++			pp->ethtool_stats[i] += val;
+ 			break;
+ 		case T_REG_64:
+ 			/* Docs say to read low 32-bit then high */
+ 			low = readl_relaxed(base + s->offset);
+ 			high = readl_relaxed(base + s->offset + 4);
+-			val = (u64)high << 32 | low;
++			val64 = (u64)high << 32 | low;
++			pp->ethtool_stats[i] += val64;
+ 			break;
+ 		}
+-
+-		pp->ethtool_stats[i] += val;
+ 	}
+ }
+ 
diff --git a/target/linux/mvebu/patches-4.4/037-net-mvneta-Fix-for_each_present_cpu-usage.patch b/target/linux/mvebu/patches-4.4/037-net-mvneta-Fix-for_each_present_cpu-usage.patch
new file mode 100644
index 0000000..9ded5b7
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/037-net-mvneta-Fix-for_each_present_cpu-usage.patch
@@ -0,0 +1,55 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Thu, 4 Feb 2016 22:09:23 +0100
+Subject: [PATCH] net: mvneta: Fix for_each_present_cpu usage
+
+This patch convert the for_each_present in on_each_cpu, instead of
+applying on the present cpus it will be applied only on the online cpus.
+This fix a bug reported on
+http://thread.gmane.org/gmane.linux.ports.arm.kernel/468173.
+
+Using the macro on_each_cpu (instead of a for_each_* loop) also ensures
+that all the calls will be done all at once.
+
+Fixes: f86428854480 ("net: mvneta: Statically assign queues to CPUs")
+Reported-by: Stefan Roese <stefan.roese at gmail.com>
+Suggested-by: Jisheng Zhang <jszhang at marvell.com>
+Suggested-by: Russell King <rmk+kernel at arm.linux.org.uk>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -2562,7 +2562,7 @@ static void mvneta_start_dev(struct mvne
+ 	mvneta_port_enable(pp);
+ 
+ 	/* Enable polling on the port */
+-	for_each_present_cpu(cpu) {
++	for_each_online_cpu(cpu) {
+ 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
+ 
+ 		napi_enable(&port->napi);
+@@ -2587,7 +2587,7 @@ static void mvneta_stop_dev(struct mvnet
+ 
+ 	phy_stop(pp->phy_dev);
+ 
+-	for_each_present_cpu(cpu) {
++	for_each_online_cpu(cpu) {
+ 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
+ 
+ 		napi_disable(&port->napi);
+@@ -3055,13 +3055,11 @@ err_cleanup_rxqs:
+ static int mvneta_stop(struct net_device *dev)
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+-	int cpu;
+ 
+ 	mvneta_stop_dev(pp);
+ 	mvneta_mdio_remove(pp);
+ 	unregister_cpu_notifier(&pp->cpu_notifier);
+-	for_each_present_cpu(cpu)
+-		smp_call_function_single(cpu, mvneta_percpu_disable, pp, true);
++	on_each_cpu(mvneta_percpu_disable, pp, true);
+ 	free_percpu_irq(dev->irq, pp->ports);
+ 	mvneta_cleanup_rxqs(pp);
+ 	mvneta_cleanup_txqs(pp);
diff --git a/target/linux/mvebu/patches-4.4/038-net-mvneta-Fix-the-CPU-choice-in-mvneta_percpu_elect.patch b/target/linux/mvebu/patches-4.4/038-net-mvneta-Fix-the-CPU-choice-in-mvneta_percpu_elect.patch
new file mode 100644
index 0000000..4fc9ccc
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/038-net-mvneta-Fix-the-CPU-choice-in-mvneta_percpu_elect.patch
@@ -0,0 +1,57 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Thu, 4 Feb 2016 22:09:24 +0100
+Subject: [PATCH] net: mvneta: Fix the CPU choice in mvneta_percpu_elect
+
+When passing to the management of multiple RX queue, the
+mvneta_percpu_elect function was broken. The use of the modulo can lead
+to elect the wrong cpu. For example with rxq_def=2, if the CPU 2 goes
+offline and then online, we ended with the third RX queue activated in
+the same time on CPU 0 and CPU2, which lead to a kernel crash.
+
+With this fix, we don't try to get "the closer" CPU if the default CPU is
+gone, now we just use CPU 0 which always be there. Thanks to this, the
+code becomes more readable, easier to maintain and more predicable.
+
+Cc: stable at vger.kernel.org
+Fixes: 2dcf75e2793c ("net: mvneta: Associate RX queues with each CPU")
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -2847,9 +2847,14 @@ static void mvneta_percpu_disable(void *
+ 
+ static void mvneta_percpu_elect(struct mvneta_port *pp)
+ {
+-	int online_cpu_idx, max_cpu, cpu, i = 0;
++	int elected_cpu = 0, max_cpu, cpu, i = 0;
++
++	/* Use the cpu associated to the rxq when it is online, in all
++	 * the other cases, use the cpu 0 which can't be offline.
++	 */
++	if (cpu_online(pp->rxq_def))
++		elected_cpu = pp->rxq_def;
+ 
+-	online_cpu_idx = pp->rxq_def % num_online_cpus();
+ 	max_cpu = num_present_cpus();
+ 
+ 	for_each_online_cpu(cpu) {
+@@ -2860,7 +2865,7 @@ static void mvneta_percpu_elect(struct m
+ 			if ((rxq % max_cpu) == cpu)
+ 				rxq_map |= MVNETA_CPU_RXQ_ACCESS(rxq);
+ 
+-		if (i == online_cpu_idx)
++		if (cpu == elected_cpu)
+ 			/* Map the default receive queue queue to the
+ 			 * elected CPU
+ 			 */
+@@ -2871,7 +2876,7 @@ static void mvneta_percpu_elect(struct m
+ 		 * the CPU bound to the default RX queue
+ 		 */
+ 		if (txq_number == 1)
+-			txq_map = (i == online_cpu_idx) ?
++			txq_map = (cpu == elected_cpu) ?
+ 				MVNETA_CPU_TXQ_ACCESS(1) : 0;
+ 		else
+ 			txq_map = mvreg_read(pp, MVNETA_CPU_MAP(cpu)) &
diff --git a/target/linux/mvebu/patches-4.4/039-net-mvneta-Use-on_each_cpu-when-possible.patch b/target/linux/mvebu/patches-4.4/039-net-mvneta-Use-on_each_cpu-when-possible.patch
new file mode 100644
index 0000000..76257a2
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/039-net-mvneta-Use-on_each_cpu-when-possible.patch
@@ -0,0 +1,68 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Thu, 4 Feb 2016 22:09:25 +0100
+Subject: [PATCH] net: mvneta: Use on_each_cpu when possible
+
+Instead of using a for_each_* loop in which we just call the
+smp_call_function_single macro, it is more simple to directly use the
+on_each_cpu macro. Moreover, this macro ensures that the calls will be
+done all at once.
+
+Suggested-by: Russell King <rmk+kernel at arm.linux.org.uk>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -2553,7 +2553,7 @@ static void mvneta_percpu_mask_interrupt
+ 
+ static void mvneta_start_dev(struct mvneta_port *pp)
+ {
+-	unsigned int cpu;
++	int cpu;
+ 
+ 	mvneta_max_rx_size_set(pp, pp->pkt_size);
+ 	mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
+@@ -2569,9 +2569,8 @@ static void mvneta_start_dev(struct mvne
+ 	}
+ 
+ 	/* Unmask interrupts. It has to be done from each CPU */
+-	for_each_online_cpu(cpu)
+-		smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
+-					 pp, true);
++	on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
++
+ 	mvreg_write(pp, MVNETA_INTR_MISC_MASK,
+ 		    MVNETA_CAUSE_PHY_STATUS_CHANGE |
+ 		    MVNETA_CAUSE_LINK_CHANGE |
+@@ -2991,7 +2990,7 @@ static int mvneta_percpu_notifier(struct
+ static int mvneta_open(struct net_device *dev)
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+-	int ret, cpu;
++	int ret;
+ 
+ 	pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
+ 	pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
+@@ -3024,9 +3023,7 @@ static int mvneta_open(struct net_device
+ 	/* Enable per-CPU interrupt on all the CPU to handle our RX
+ 	 * queue interrupts
+ 	 */
+-	for_each_online_cpu(cpu)
+-		smp_call_function_single(cpu, mvneta_percpu_enable,
+-					 pp, true);
++	on_each_cpu(mvneta_percpu_enable, pp, true);
+ 
+ 
+ 	/* Register a CPU notifier to handle the case where our CPU
+@@ -3313,9 +3310,7 @@ static int  mvneta_config_rss(struct mvn
+ 
+ 	netif_tx_stop_all_queues(pp->dev);
+ 
+-	for_each_online_cpu(cpu)
+-		smp_call_function_single(cpu, mvneta_percpu_mask_interrupt,
+-					 pp, true);
++	on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
+ 
+ 	/* We have to synchronise on the napi of each CPU */
+ 	for_each_online_cpu(cpu) {
diff --git a/target/linux/mvebu/patches-4.4/040-net-mvneta-Modify-the-queue-related-fields-from-each.patch b/target/linux/mvebu/patches-4.4/040-net-mvneta-Modify-the-queue-related-fields-from-each.patch
new file mode 100644
index 0000000..b025777
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/040-net-mvneta-Modify-the-queue-related-fields-from-each.patch
@@ -0,0 +1,179 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Thu, 4 Feb 2016 22:09:27 +0100
+Subject: [PATCH] net: mvneta: Modify the queue related fields from each cpu
+
+In the MVNETA_INTR_* registers, the queues related fields are per cpu,
+according to the datasheet (comment in [] are added by me):
+"In a multi-CPU system, bits of RX[or TX] queues for which the access by
+the reading[or writing] CPU is disabled are read as 0, and cannot be
+cleared[or written]."
+
+That means that each time we want to manipulate these bits we had to do
+it on each cpu and not only on the current cpu.
+
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -1036,6 +1036,43 @@ static void mvneta_set_autoneg(struct mv
+ 	}
+ }
+ 
++static void mvneta_percpu_unmask_interrupt(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	/* All the queue are unmasked, but actually only the ones
++	 * mapped to this CPU will be unmasked
++	 */
++	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
++		    MVNETA_RX_INTR_MASK_ALL |
++		    MVNETA_TX_INTR_MASK_ALL |
++		    MVNETA_MISCINTR_INTR_MASK);
++}
++
++static void mvneta_percpu_mask_interrupt(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	/* All the queue are masked, but actually only the ones
++	 * mapped to this CPU will be masked
++	 */
++	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
++	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
++	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
++}
++
++static void mvneta_percpu_clear_intr_cause(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	/* All the queue are cleared, but actually only the ones
++	 * mapped to this CPU will be cleared
++	 */
++	mvreg_write(pp, MVNETA_INTR_NEW_CAUSE, 0);
++	mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
++	mvreg_write(pp, MVNETA_INTR_OLD_CAUSE, 0);
++}
++
+ /* This method sets defaults to the NETA port:
+  *	Clears interrupt Cause and Mask registers.
+  *	Clears all MAC tables.
+@@ -1053,14 +1090,10 @@ static void mvneta_defaults_set(struct m
+ 	int max_cpu = num_present_cpus();
+ 
+ 	/* Clear all Cause registers */
+-	mvreg_write(pp, MVNETA_INTR_NEW_CAUSE, 0);
+-	mvreg_write(pp, MVNETA_INTR_OLD_CAUSE, 0);
+-	mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
++	on_each_cpu(mvneta_percpu_clear_intr_cause, pp, true);
+ 
+ 	/* Mask all interrupts */
+-	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
+-	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
+-	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
++	on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
+ 	mvreg_write(pp, MVNETA_INTR_ENABLE, 0);
+ 
+ 	/* Enable MBUS Retry bit16 */
+@@ -2526,31 +2559,6 @@ static int mvneta_setup_txqs(struct mvne
+ 	return 0;
+ }
+ 
+-static void mvneta_percpu_unmask_interrupt(void *arg)
+-{
+-	struct mvneta_port *pp = arg;
+-
+-	/* All the queue are unmasked, but actually only the ones
+-	 * maped to this CPU will be unmasked
+-	 */
+-	mvreg_write(pp, MVNETA_INTR_NEW_MASK,
+-		    MVNETA_RX_INTR_MASK_ALL |
+-		    MVNETA_TX_INTR_MASK_ALL |
+-		    MVNETA_MISCINTR_INTR_MASK);
+-}
+-
+-static void mvneta_percpu_mask_interrupt(void *arg)
+-{
+-	struct mvneta_port *pp = arg;
+-
+-	/* All the queue are masked, but actually only the ones
+-	 * maped to this CPU will be masked
+-	 */
+-	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
+-	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
+-	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
+-}
+-
+ static void mvneta_start_dev(struct mvneta_port *pp)
+ {
+ 	int cpu;
+@@ -2601,13 +2609,10 @@ static void mvneta_stop_dev(struct mvnet
+ 	mvneta_port_disable(pp);
+ 
+ 	/* Clear all ethernet port interrupts */
+-	mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
+-	mvreg_write(pp, MVNETA_INTR_OLD_CAUSE, 0);
++	on_each_cpu(mvneta_percpu_clear_intr_cause, pp, true);
+ 
+ 	/* Mask all ethernet port interrupts */
+-	mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
+-	mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
+-	mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
++	on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
+ 
+ 	mvneta_tx_reset(pp);
+ 	mvneta_rx_reset(pp);
+@@ -2919,9 +2924,7 @@ static int mvneta_percpu_notifier(struct
+ 		}
+ 
+ 		/* Mask all ethernet port interrupts */
+-		mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
+-		mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
+-		mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
++		on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
+ 		napi_enable(&port->napi);
+ 
+ 
+@@ -2936,14 +2939,8 @@ static int mvneta_percpu_notifier(struct
+ 		 */
+ 		mvneta_percpu_elect(pp);
+ 
+-		/* Unmask all ethernet port interrupts, as this
+-		 * notifier is called for each CPU then the CPU to
+-		 * Queue mapping is applied
+-		 */
+-		mvreg_write(pp, MVNETA_INTR_NEW_MASK,
+-			MVNETA_RX_INTR_MASK(rxq_number) |
+-			MVNETA_TX_INTR_MASK(txq_number) |
+-			MVNETA_MISCINTR_INTR_MASK);
++		/* Unmask all ethernet port interrupts */
++		on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
+ 		mvreg_write(pp, MVNETA_INTR_MISC_MASK,
+ 			MVNETA_CAUSE_PHY_STATUS_CHANGE |
+ 			MVNETA_CAUSE_LINK_CHANGE |
+@@ -2954,9 +2951,7 @@ static int mvneta_percpu_notifier(struct
+ 	case CPU_DOWN_PREPARE_FROZEN:
+ 		netif_tx_stop_all_queues(pp->dev);
+ 		/* Mask all ethernet port interrupts */
+-		mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
+-		mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
+-		mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
++		on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
+ 
+ 		napi_synchronize(&port->napi);
+ 		napi_disable(&port->napi);
+@@ -2972,10 +2967,7 @@ static int mvneta_percpu_notifier(struct
+ 		/* Check if a new CPU must be elected now this on is down */
+ 		mvneta_percpu_elect(pp);
+ 		/* Unmask all ethernet port interrupts */
+-		mvreg_write(pp, MVNETA_INTR_NEW_MASK,
+-			MVNETA_RX_INTR_MASK(rxq_number) |
+-			MVNETA_TX_INTR_MASK(txq_number) |
+-			MVNETA_MISCINTR_INTR_MASK);
++		on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
+ 		mvreg_write(pp, MVNETA_INTR_MISC_MASK,
+ 			MVNETA_CAUSE_PHY_STATUS_CHANGE |
+ 			MVNETA_CAUSE_LINK_CHANGE |
diff --git a/target/linux/mvebu/patches-4.4/041-net-mvneta-The-mvneta_percpu_elect-function-should-b.patch b/target/linux/mvebu/patches-4.4/041-net-mvneta-The-mvneta_percpu_elect-function-should-b.patch
new file mode 100644
index 0000000..a77bef4
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/041-net-mvneta-The-mvneta_percpu_elect-function-should-b.patch
@@ -0,0 +1,68 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Thu, 4 Feb 2016 22:09:28 +0100
+Subject: [PATCH] net: mvneta: The mvneta_percpu_elect function should be
+ atomic
+
+Electing a CPU must be done in an atomic way: it should be done after or
+before the removal/insertion of a CPU and this function is not reentrant.
+
+During the loop of mvneta_percpu_elect we associates the queues to the
+CPUs, if there is a topology change during this loop, then the mapping
+between the CPUs and the queues could be wrong. During this loop the
+interrupt mask is also updating for each CPUs, It should not be changed
+in the same time by other part of the driver.
+
+This patch adds spinlock to create the needed critical sections.
+
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -370,6 +370,10 @@ struct mvneta_port {
+ 	struct net_device *dev;
+ 	struct notifier_block cpu_notifier;
+ 	int rxq_def;
++	/* Protect the access to the percpu interrupt registers,
++	 * ensuring that the configuration remains coherent.
++	 */
++	spinlock_t lock;
+ 
+ 	/* Core clock */
+ 	struct clk *clk;
+@@ -2853,6 +2857,12 @@ static void mvneta_percpu_elect(struct m
+ {
+ 	int elected_cpu = 0, max_cpu, cpu, i = 0;
+ 
++	/* Electing a CPU must be done in an atomic way: it should be
++	 * done after or before the removal/insertion of a CPU and
++	 * this function is not reentrant.
++	 */
++	spin_lock(&pp->lock);
++
+ 	/* Use the cpu associated to the rxq when it is online, in all
+ 	 * the other cases, use the cpu 0 which can't be offline.
+ 	 */
+@@ -2896,6 +2906,7 @@ static void mvneta_percpu_elect(struct m
+ 		i++;
+ 
+ 	}
++	spin_unlock(&pp->lock);
+ };
+ 
+ static int mvneta_percpu_notifier(struct notifier_block *nfb,
+@@ -2950,8 +2961,13 @@ static int mvneta_percpu_notifier(struct
+ 	case CPU_DOWN_PREPARE:
+ 	case CPU_DOWN_PREPARE_FROZEN:
+ 		netif_tx_stop_all_queues(pp->dev);
++		/* Thanks to this lock we are sure that any pending
++		 * cpu election is done
++		 */
++		spin_lock(&pp->lock);
+ 		/* Mask all ethernet port interrupts */
+ 		on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
++		spin_unlock(&pp->lock);
+ 
+ 		napi_synchronize(&port->napi);
+ 		napi_disable(&port->napi);
diff --git a/target/linux/mvebu/patches-4.4/042-net-mvneta-Fix-race-condition-during-stopping.patch b/target/linux/mvebu/patches-4.4/042-net-mvneta-Fix-race-condition-during-stopping.patch
new file mode 100644
index 0000000..9936ebf
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/042-net-mvneta-Fix-race-condition-during-stopping.patch
@@ -0,0 +1,128 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Thu, 4 Feb 2016 22:09:29 +0100
+Subject: [PATCH] net: mvneta: Fix race condition during stopping
+
+When stopping the port, the CPU notifier are still there whereas the
+mvneta_stop_dev function calls mvneta_percpu_disable() on each CPUs.
+It was possible to have a new CPU coming at this point which could be
+racy.
+
+This patch adds a flag preventing executing the code notifier for a new
+CPU when the port is stopping. It also uses the spinlock introduces
+previously. To avoid the deadlock, the lock has been moved outside the
+mvneta_percpu_elect function.
+
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -374,6 +374,7 @@ struct mvneta_port {
+ 	 * ensuring that the configuration remains coherent.
+ 	 */
+ 	spinlock_t lock;
++	bool is_stopped;
+ 
+ 	/* Core clock */
+ 	struct clk *clk;
+@@ -2853,16 +2854,14 @@ static void mvneta_percpu_disable(void *
+ 	disable_percpu_irq(pp->dev->irq);
+ }
+ 
++/* Electing a CPU must be done in an atomic way: it should be done
++ * after or before the removal/insertion of a CPU and this function is
++ * not reentrant.
++ */
+ static void mvneta_percpu_elect(struct mvneta_port *pp)
+ {
+ 	int elected_cpu = 0, max_cpu, cpu, i = 0;
+ 
+-	/* Electing a CPU must be done in an atomic way: it should be
+-	 * done after or before the removal/insertion of a CPU and
+-	 * this function is not reentrant.
+-	 */
+-	spin_lock(&pp->lock);
+-
+ 	/* Use the cpu associated to the rxq when it is online, in all
+ 	 * the other cases, use the cpu 0 which can't be offline.
+ 	 */
+@@ -2906,7 +2905,6 @@ static void mvneta_percpu_elect(struct m
+ 		i++;
+ 
+ 	}
+-	spin_unlock(&pp->lock);
+ };
+ 
+ static int mvneta_percpu_notifier(struct notifier_block *nfb,
+@@ -2920,6 +2918,14 @@ static int mvneta_percpu_notifier(struct
+ 	switch (action) {
+ 	case CPU_ONLINE:
+ 	case CPU_ONLINE_FROZEN:
++		spin_lock(&pp->lock);
++		/* Configuring the driver for a new CPU while the
++		 * driver is stopping is racy, so just avoid it.
++		 */
++		if (pp->is_stopped) {
++			spin_unlock(&pp->lock);
++			break;
++		}
+ 		netif_tx_stop_all_queues(pp->dev);
+ 
+ 		/* We have to synchronise on tha napi of each CPU
+@@ -2957,6 +2963,7 @@ static int mvneta_percpu_notifier(struct
+ 			MVNETA_CAUSE_LINK_CHANGE |
+ 			MVNETA_CAUSE_PSC_SYNC_CHANGE);
+ 		netif_tx_start_all_queues(pp->dev);
++		spin_unlock(&pp->lock);
+ 		break;
+ 	case CPU_DOWN_PREPARE:
+ 	case CPU_DOWN_PREPARE_FROZEN:
+@@ -2981,7 +2988,9 @@ static int mvneta_percpu_notifier(struct
+ 	case CPU_DEAD:
+ 	case CPU_DEAD_FROZEN:
+ 		/* Check if a new CPU must be elected now this on is down */
++		spin_lock(&pp->lock);
+ 		mvneta_percpu_elect(pp);
++		spin_unlock(&pp->lock);
+ 		/* Unmask all ethernet port interrupts */
+ 		on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
+ 		mvreg_write(pp, MVNETA_INTR_MISC_MASK,
+@@ -3033,7 +3042,7 @@ static int mvneta_open(struct net_device
+ 	 */
+ 	on_each_cpu(mvneta_percpu_enable, pp, true);
+ 
+-
++	pp->is_stopped = false;
+ 	/* Register a CPU notifier to handle the case where our CPU
+ 	 * might be taken offline.
+ 	 */
+@@ -3066,9 +3075,18 @@ static int mvneta_stop(struct net_device
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+ 
++	/* Inform that we are stopping so we don't want to setup the
++	 * driver for new CPUs in the notifiers
++	 */
++	spin_lock(&pp->lock);
++	pp->is_stopped = true;
+ 	mvneta_stop_dev(pp);
+ 	mvneta_mdio_remove(pp);
+ 	unregister_cpu_notifier(&pp->cpu_notifier);
++	/* Now that the notifier are unregistered, we can release le
++	 * lock
++	 */
++	spin_unlock(&pp->lock);
+ 	on_each_cpu(mvneta_percpu_disable, pp, true);
+ 	free_percpu_irq(dev->irq, pp->ports);
+ 	mvneta_cleanup_rxqs(pp);
+@@ -3339,7 +3357,9 @@ static int  mvneta_config_rss(struct mvn
+ 	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
+ 
+ 	/* Update the elected CPU matching the new rxq_def */
++	spin_lock(&pp->lock);
+ 	mvneta_percpu_elect(pp);
++	spin_unlock(&pp->lock);
+ 
+ 	/* We have to synchronise on the napi of each CPU */
+ 	for_each_online_cpu(cpu) {
diff --git a/target/linux/mvebu/patches-4.4/043-net-mvneta-sort-the-headers-in-alphabetic-order.patch b/target/linux/mvebu/patches-4.4/043-net-mvneta-sort-the-headers-in-alphabetic-order.patch
new file mode 100644
index 0000000..502c258
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/043-net-mvneta-sort-the-headers-in-alphabetic-order.patch
@@ -0,0 +1,56 @@
+From: Jisheng Zhang <jszhang at marvell.com>
+Date: Wed, 20 Jan 2016 19:27:22 +0800
+Subject: [PATCH] net: mvneta: sort the headers in alphabetic order
+
+Sorting the headers in alphabetic order will help to reduce the conflict
+when adding new headers in the future.
+
+Signed-off-by: Jisheng Zhang <jszhang at marvell.com>
+Acked-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -11,28 +11,28 @@
+  * warranty of any kind, whether express or implied.
+  */
+ 
+-#include <linux/kernel.h>
+-#include <linux/netdevice.h>
++#include <linux/clk.h>
++#include <linux/cpu.h>
+ #include <linux/etherdevice.h>
+-#include <linux/platform_device.h>
+-#include <linux/skbuff.h>
++#include <linux/if_vlan.h>
+ #include <linux/inetdevice.h>
+-#include <linux/mbus.h>
+-#include <linux/module.h>
+ #include <linux/interrupt.h>
+-#include <linux/if_vlan.h>
+-#include <net/ip.h>
+-#include <net/ipv6.h>
+ #include <linux/io.h>
+-#include <net/tso.h>
++#include <linux/kernel.h>
++#include <linux/mbus.h>
++#include <linux/module.h>
++#include <linux/netdevice.h>
+ #include <linux/of.h>
++#include <linux/of_address.h>
+ #include <linux/of_irq.h>
+ #include <linux/of_mdio.h>
+ #include <linux/of_net.h>
+-#include <linux/of_address.h>
+ #include <linux/phy.h>
+-#include <linux/clk.h>
+-#include <linux/cpu.h>
++#include <linux/platform_device.h>
++#include <linux/skbuff.h>
++#include <net/ip.h>
++#include <net/ipv6.h>
++#include <net/tso.h>
+ 
+ /* Registers */
+ #define MVNETA_RXQ_CONFIG_REG(q)                (0x1400 + ((q) << 2))
diff --git a/target/linux/mvebu/patches-4.4/044-net-add-a-hardware-buffer-management-helper-API.patch b/target/linux/mvebu/patches-4.4/044-net-add-a-hardware-buffer-management-helper-API.patch
new file mode 100644
index 0000000..d4bc6a0
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/044-net-add-a-hardware-buffer-management-helper-API.patch
@@ -0,0 +1,159 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Mon, 14 Mar 2016 09:39:04 +0100
+Subject: [PATCH] net: add a hardware buffer management helper API
+
+This basic implementation allows to share code between driver using
+hardware buffer management. As the code is hardware agnostic, there is
+few helpers, most of the optimization brought by the an HW BM has to be
+done at driver level.
+
+Tested-by: Sebastian Careba <nitroshift at yahoo.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ create mode 100644 include/net/hwbm.h
+ create mode 100644 net/core/hwbm.c
+
+--- /dev/null
++++ b/include/net/hwbm.h
+@@ -0,0 +1,28 @@
++#ifndef _HWBM_H
++#define _HWBM_H
++
++struct hwbm_pool {
++	/* Capacity of the pool */
++	int size;
++	/* Size of the buffers managed */
++	int frag_size;
++	/* Number of buffers currently used by this pool */
++	int buf_num;
++	/* constructor called during alocation */
++	int (*construct)(struct hwbm_pool *bm_pool, void *buf);
++	/* protect acces to the buffer counter*/
++	spinlock_t lock;
++	/* private data */
++	void *priv;
++};
++#ifdef CONFIG_HWBM
++void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
++int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
++int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp);
++#else
++void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
++int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
++int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
++{ return 0; }
++#endif /* CONFIG_HWBM */
++#endif /* _HWBM_H */
+--- a/net/Kconfig
++++ b/net/Kconfig
+@@ -259,6 +259,9 @@ config XPS
+ 	depends on SMP
+ 	default y
+ 
++config HWBM
++	bool
++
+ config CGROUP_NET_PRIO
+ 	bool "Network priority cgroup"
+ 	depends on CGROUPS
+--- a/net/core/Makefile
++++ b/net/core/Makefile
+@@ -14,6 +14,7 @@ obj-y		     += dev.o ethtool.o dev_addr_
+ obj-$(CONFIG_SOCK_DIAG) += sock_diag.o
+ obj-$(CONFIG_XFRM) += flow.o
+ obj-y += net-sysfs.o
++obj-$(CONFIG_HWBM) += hwbm.o
+ obj-$(CONFIG_PROC_FS) += net-procfs.o
+ obj-$(CONFIG_NET_PKTGEN) += pktgen.o
+ obj-$(CONFIG_NETPOLL) += netpoll.o
+--- /dev/null
++++ b/net/core/hwbm.c
+@@ -0,0 +1,87 @@
++/* Support for hardware buffer manager.
++ *
++ * Copyright (C) 2016 Marvell
++ *
++ * Gregory CLEMENT <gregory.clement at free-electrons.com>
++ *
++ *  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; either version 2 of the License, or
++ *  (at your option) any later version.
++ */
++#include <linux/kernel.h>
++#include <linux/printk.h>
++#include <linux/skbuff.h>
++#include <net/hwbm.h>
++
++void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf)
++{
++	if (likely(bm_pool->frag_size <= PAGE_SIZE))
++		skb_free_frag(buf);
++	else
++		kfree(buf);
++}
++EXPORT_SYMBOL_GPL(hwbm_buf_free);
++
++/* Refill processing for HW buffer management */
++int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
++{
++	int frag_size = bm_pool->frag_size;
++	void *buf;
++
++	if (likely(frag_size <= PAGE_SIZE))
++		buf = netdev_alloc_frag(frag_size);
++	else
++		buf = kmalloc(frag_size, gfp);
++
++	if (!buf)
++		return -ENOMEM;
++
++	if (bm_pool->construct)
++		if (bm_pool->construct(bm_pool, buf)) {
++			hwbm_buf_free(bm_pool, buf);
++			return -ENOMEM;
++		}
++
++	return 0;
++}
++EXPORT_SYMBOL_GPL(hwbm_pool_refill);
++
++int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
++{
++	int err, i;
++	unsigned long flags;
++
++	spin_lock_irqsave(&bm_pool->lock, flags);
++	if (bm_pool->buf_num == bm_pool->size) {
++		pr_warn("pool already filled\n");
++		return bm_pool->buf_num;
++	}
++
++	if (buf_num + bm_pool->buf_num > bm_pool->size) {
++		pr_warn("cannot allocate %d buffers for pool\n",
++			buf_num);
++		return 0;
++	}
++
++	if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) {
++		pr_warn("Adding %d buffers to the %d current buffers will overflow\n",
++			buf_num,  bm_pool->buf_num);
++		return 0;
++	}
++
++	for (i = 0; i < buf_num; i++) {
++		err = hwbm_pool_refill(bm_pool, gfp);
++		if (err < 0)
++			break;
++	}
++
++	/* Update BM driver with number of buffers added to pool */
++	bm_pool->buf_num += i;
++
++	pr_debug("hwpm pool: %d of %d buffers added\n", i, buf_num);
++	spin_unlock_irqrestore(&bm_pool->lock, flags);
++
++	return i;
++}
++EXPORT_SYMBOL_GPL(hwbm_pool_add);
diff --git a/target/linux/mvebu/patches-4.4/045-net-mvneta-bm-add-support-for-hardware-buffer-manage.patch b/target/linux/mvebu/patches-4.4/045-net-mvneta-bm-add-support-for-hardware-buffer-manage.patch
new file mode 100644
index 0000000..d343b39
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/045-net-mvneta-bm-add-support-for-hardware-buffer-manage.patch
@@ -0,0 +1,1684 @@
+From: Marcin Wojtas <mw at semihalf.com>
+Date: Mon, 14 Mar 2016 09:39:03 +0100
+Subject: [PATCH] net: mvneta: bm: add support for hardware buffer management
+
+Buffer manager (BM) is a dedicated hardware unit that can be used by all
+ethernet ports of Armada XP and 38x SoC's. It allows to offload CPU on RX
+path by sparing DRAM access on refilling buffer pool, hardware-based
+filling of descriptor ring data and better memory utilization due to HW
+arbitration for using 'short' pools for small packets.
+
+Tests performed with A388 SoC working as a network bridge between two
+packet generators showed increase of maximum processed 64B packets by
+~20k (~555k packets with BM enabled vs ~535 packets without BM). Also
+when pushing 1500B-packets with a line rate achieved, CPU load decreased
+from around 25% without BM to 20% with BM.
+
+BM comprise up to 4 buffer pointers' (BP) rings kept in DRAM, which
+are called external BP pools - BPPE. Allocating and releasing buffer
+pointers (BP) to/from BPPE is performed indirectly by write/read access
+to a dedicated internal SRAM, where internal BP pools (BPPI) are placed.
+BM hardware controls status of BPPE automatically, as well as assigning
+proper buffers to RX descriptors. For more details please refer to
+Functional Specification of Armada XP or 38x SoC.
+
+In order to enable support for a separate hardware block, common for all
+ports, a new driver has to be implemented ('mvneta_bm'). It provides
+initialization sequence of address space, clocks, registers, SRAM,
+empty pools' structures and also obtaining optional configuration
+from DT (please refer to device tree binding documentation). mvneta_bm
+exposes also a necessary API to mvneta driver, as well as a dedicated
+structure with BM information (bm_priv), whose presence is used as a
+flag notifying of BM usage by port. It has to be ensured that mvneta_bm
+probe is executed prior to the ones in ports' driver. In case BM is not
+used or its probe fails, mvneta falls back to use software buffer
+management.
+
+A sequence executed in mvneta_probe function is modified in order to have
+an access to needed resources before possible port's BM initialization is
+done. According to port-pools mapping provided by DT appropriate registers
+are configured and the buffer pools are filled. RX path is modified
+accordingly. Becaues the hardware allows a wide variety of configuration
+options, following assumptions are made:
+* using BM mechanisms can be selectively disabled/enabled basing
+  on DT configuration among the ports
+* 'long' pool's single buffer size is tied to port's MTU
+* using 'long' pool by port is obligatory and it cannot be shared
+* using 'short' pool for smaller packets is optional
+* one 'short' pool can be shared among all ports
+
+This commit enables hardware buffer management operation cooperating with
+existing mvneta driver. New device tree binding documentation is added and
+the one of mvneta is updated accordingly.
+
+[gregory.clement at free-electrons.com: removed the suspend/resume part]
+
+Signed-off-by: Marcin Wojtas <mw at semihalf.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ create mode 100644 Documentation/devicetree/bindings/net/marvell-neta-bm.txt
+ create mode 100644 drivers/net/ethernet/marvell/mvneta_bm.c
+ create mode 100644 drivers/net/ethernet/marvell/mvneta_bm.h
+
+--- a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
++++ b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
+@@ -13,15 +13,30 @@ Optional properties:
+   Value is presented in bytes. If not used, by default 1600B is set for
+   "marvell,armada-370-neta" and 9800B for others.
+ 
++Optional properties (valid only for Armada XP/38x):
++
++- buffer-manager: a phandle to a buffer manager node. Please refer to
++  Documentation/devicetree/bindings/net/marvell-neta-bm.txt
++- bm,pool-long: ID of a pool, that will accept all packets of a size
++  higher than 'short' pool's threshold (if set) and up to MTU value.
++  Obligatory, when the port is supposed to use hardware
++  buffer management.
++- bm,pool-short: ID of a pool, that will be used for accepting
++  packets of a size lower than given threshold. If not set, the port
++  will use a single 'long' pool for all packets, as defined above.
++
+ Example:
+ 
+-ethernet at d0070000 {
++ethernet at 70000 {
+ 	compatible = "marvell,armada-370-neta";
+-	reg = <0xd0070000 0x2500>;
++	reg = <0x70000 0x2500>;
+ 	interrupts = <8>;
+ 	clocks = <&gate_clk 4>;
+ 	tx-csum-limit = <9800>
+ 	status = "okay";
+ 	phy = <&phy0>;
+ 	phy-mode = "rgmii-id";
++	buffer-manager = <&bm>;
++	bm,pool-long = <0>;
++	bm,pool-short = <1>;
+ };
+--- /dev/null
++++ b/Documentation/devicetree/bindings/net/marvell-neta-bm.txt
+@@ -0,0 +1,49 @@
++* Marvell Armada 380/XP Buffer Manager driver (BM)
++
++Required properties:
++
++- compatible: should be "marvell,armada-380-neta-bm".
++- reg: address and length of the register set for the device.
++- clocks: a pointer to the reference clock for this device.
++- internal-mem: a phandle to BM internal SRAM definition.
++
++Optional properties (port):
++
++- pool<0 : 3>,capacity: size of external buffer pointers' ring maintained
++  in DRAM. Can be set for each pool (id 0 : 3) separately. The value has
++  to be chosen between 128 and 16352 and it also has to be aligned to 32.
++  Otherwise the driver would adjust a given number or choose default if
++  not set.
++- pool<0 : 3>,pkt-size: maximum size of a packet accepted by a given buffer
++  pointers' pool (id 0 : 3). It will be taken into consideration only when pool
++  type is 'short'. For 'long' ones it would be overridden by port's MTU.
++  If not set a driver will choose a default value.
++
++In order to see how to hook the BM to a given ethernet port, please
++refer to Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt.
++
++Example:
++
++- main node:
++
++bm: bm at c8000 {
++	compatible = "marvell,armada-380-neta-bm";
++	reg = <0xc8000 0xac>;
++	clocks = <&gateclk 13>;
++	internal-mem = <&bm_bppi>;
++	status = "okay";
++	pool2,capacity = <4096>;
++	pool1,pkt-size = <512>;
++};
++
++- internal SRAM node:
++
++bm_bppi: bm-bppi {
++	compatible = "mmio-sram";
++	reg = <MBUS_ID(0x0c, 0x04) 0 0x100000>;
++	ranges = <0 MBUS_ID(0x0c, 0x04) 0 0x100000>;
++	#address-cells = <1>;
++	#size-cells = <1>;
++	clocks = <&gateclk 13>;
++	status = "okay";
++};
+--- a/drivers/net/ethernet/marvell/Kconfig
++++ b/drivers/net/ethernet/marvell/Kconfig
+@@ -40,6 +40,19 @@ config MVMDIO
+ 
+ 	  This driver is used by the MV643XX_ETH and MVNETA drivers.
+ 
++config MVNETA_BM
++	tristate "Marvell Armada 38x/XP network interface BM support"
++	depends on MVNETA
++	---help---
++	  This driver supports auxiliary block of the network
++	  interface units in the Marvell ARMADA XP and ARMADA 38x SoC
++	  family, which is called buffer manager.
++
++	  This driver, when enabled, strictly cooperates with mvneta
++	  driver and is common for all network ports of the devices,
++	  even for Armada 370 SoC, which doesn't support hardware
++	  buffer management.
++
+ config MVNETA
+ 	tristate "Marvell Armada 370/38x/XP network interface support"
+ 	depends on PLAT_ORION
+--- a/drivers/net/ethernet/marvell/Makefile
++++ b/drivers/net/ethernet/marvell/Makefile
+@@ -4,6 +4,7 @@
+ 
+ obj-$(CONFIG_MVMDIO) += mvmdio.o
+ obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o
++obj-$(CONFIG_MVNETA_BM) += mvneta_bm.o
+ obj-$(CONFIG_MVNETA) += mvneta.o
+ obj-$(CONFIG_MVPP2) += mvpp2.o
+ obj-$(CONFIG_PXA168_ETH) += pxa168_eth.o
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -30,6 +30,7 @@
+ #include <linux/phy.h>
+ #include <linux/platform_device.h>
+ #include <linux/skbuff.h>
++#include "mvneta_bm.h"
+ #include <net/ip.h>
+ #include <net/ipv6.h>
+ #include <net/tso.h>
+@@ -37,6 +38,10 @@
+ /* Registers */
+ #define MVNETA_RXQ_CONFIG_REG(q)                (0x1400 + ((q) << 2))
+ #define      MVNETA_RXQ_HW_BUF_ALLOC            BIT(0)
++#define      MVNETA_RXQ_SHORT_POOL_ID_SHIFT	4
++#define      MVNETA_RXQ_SHORT_POOL_ID_MASK	0x30
++#define      MVNETA_RXQ_LONG_POOL_ID_SHIFT	6
++#define      MVNETA_RXQ_LONG_POOL_ID_MASK	0xc0
+ #define      MVNETA_RXQ_PKT_OFFSET_ALL_MASK     (0xf    << 8)
+ #define      MVNETA_RXQ_PKT_OFFSET_MASK(offs)   ((offs) << 8)
+ #define MVNETA_RXQ_THRESHOLD_REG(q)             (0x14c0 + ((q) << 2))
+@@ -50,6 +55,9 @@
+ #define MVNETA_RXQ_STATUS_UPDATE_REG(q)         (0x1500 + ((q) << 2))
+ #define      MVNETA_RXQ_ADD_NON_OCCUPIED_SHIFT  16
+ #define      MVNETA_RXQ_ADD_NON_OCCUPIED_MAX    255
++#define MVNETA_PORT_POOL_BUFFER_SZ_REG(pool)	(0x1700 + ((pool) << 2))
++#define      MVNETA_PORT_POOL_BUFFER_SZ_SHIFT	3
++#define      MVNETA_PORT_POOL_BUFFER_SZ_MASK	0xfff8
+ #define MVNETA_PORT_RX_RESET                    0x1cc0
+ #define      MVNETA_PORT_RX_DMA_RESET           BIT(0)
+ #define MVNETA_PHY_ADDR                         0x2000
+@@ -107,6 +115,7 @@
+ #define MVNETA_GMAC_CLOCK_DIVIDER                0x24f4
+ #define      MVNETA_GMAC_1MS_CLOCK_ENABLE        BIT(31)
+ #define MVNETA_ACC_MODE                          0x2500
++#define MVNETA_BM_ADDRESS                        0x2504
+ #define MVNETA_CPU_MAP(cpu)                      (0x2540 + ((cpu) << 2))
+ #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
+ #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
+@@ -253,7 +262,10 @@
+ #define MVNETA_CPU_D_CACHE_LINE_SIZE    32
+ #define MVNETA_TX_CSUM_DEF_SIZE		1600
+ #define MVNETA_TX_CSUM_MAX_SIZE		9800
+-#define MVNETA_ACC_MODE_EXT		1
++#define MVNETA_ACC_MODE_EXT1		1
++#define MVNETA_ACC_MODE_EXT2		2
++
++#define MVNETA_MAX_DECODE_WIN		6
+ 
+ /* Timeout constants */
+ #define MVNETA_TX_DISABLE_TIMEOUT_MSEC	1000
+@@ -293,7 +305,8 @@
+ 	((addr >= txq->tso_hdrs_phys) && \
+ 	 (addr < txq->tso_hdrs_phys + txq->size * TSO_HEADER_SIZE))
+ 
+-#define MVNETA_RX_BUF_SIZE(pkt_size)   ((pkt_size) + NET_SKB_PAD)
++#define MVNETA_RX_GET_BM_POOL_ID(rxd) \
++	(((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT)
+ 
+ struct mvneta_statistic {
+ 	unsigned short offset;
+@@ -359,6 +372,7 @@ struct mvneta_pcpu_port {
+ };
+ 
+ struct mvneta_port {
++	u8 id;
+ 	struct mvneta_pcpu_port __percpu	*ports;
+ 	struct mvneta_pcpu_stats __percpu	*stats;
+ 
+@@ -392,6 +406,11 @@ struct mvneta_port {
+ 	unsigned int tx_csum_limit;
+ 	unsigned int use_inband_status:1;
+ 
++	struct mvneta_bm *bm_priv;
++	struct mvneta_bm_pool *pool_long;
++	struct mvneta_bm_pool *pool_short;
++	int bm_win_id;
++
+ 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
+ 
+ 	u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
+@@ -417,6 +436,8 @@ struct mvneta_port {
+ #define MVNETA_TX_L4_CSUM_NOT	BIT(31)
+ 
+ #define MVNETA_RXD_ERR_CRC		0x0
++#define MVNETA_RXD_BM_POOL_SHIFT	13
++#define MVNETA_RXD_BM_POOL_MASK		(BIT(13) | BIT(14))
+ #define MVNETA_RXD_ERR_SUMMARY		BIT(16)
+ #define MVNETA_RXD_ERR_OVERRUN		BIT(17)
+ #define MVNETA_RXD_ERR_LEN		BIT(18)
+@@ -561,6 +582,9 @@ static int rxq_def;
+ 
+ static int rx_copybreak __read_mostly = 256;
+ 
++/* HW BM need that each port be identify by a unique ID */
++static int global_port_id;
++
+ #define MVNETA_DRIVER_NAME "mvneta"
+ #define MVNETA_DRIVER_VERSION "1.0"
+ 
+@@ -827,6 +851,214 @@ static void mvneta_rxq_bm_disable(struct
+ 	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
+ }
+ 
++/* Enable buffer management (BM) */
++static void mvneta_rxq_bm_enable(struct mvneta_port *pp,
++				 struct mvneta_rx_queue *rxq)
++{
++	u32 val;
++
++	val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id));
++	val |= MVNETA_RXQ_HW_BUF_ALLOC;
++	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
++}
++
++/* Notify HW about port's assignment of pool for bigger packets */
++static void mvneta_rxq_long_pool_set(struct mvneta_port *pp,
++				     struct mvneta_rx_queue *rxq)
++{
++	u32 val;
++
++	val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id));
++	val &= ~MVNETA_RXQ_LONG_POOL_ID_MASK;
++	val |= (pp->pool_long->id << MVNETA_RXQ_LONG_POOL_ID_SHIFT);
++
++	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
++}
++
++/* Notify HW about port's assignment of pool for smaller packets */
++static void mvneta_rxq_short_pool_set(struct mvneta_port *pp,
++				      struct mvneta_rx_queue *rxq)
++{
++	u32 val;
++
++	val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id));
++	val &= ~MVNETA_RXQ_SHORT_POOL_ID_MASK;
++	val |= (pp->pool_short->id << MVNETA_RXQ_SHORT_POOL_ID_SHIFT);
++
++	mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
++}
++
++/* Set port's receive buffer size for assigned BM pool */
++static inline void mvneta_bm_pool_bufsize_set(struct mvneta_port *pp,
++					      int buf_size,
++					      u8 pool_id)
++{
++	u32 val;
++
++	if (!IS_ALIGNED(buf_size, 8)) {
++		dev_warn(pp->dev->dev.parent,
++			 "illegal buf_size value %d, round to %d\n",
++			 buf_size, ALIGN(buf_size, 8));
++		buf_size = ALIGN(buf_size, 8);
++	}
++
++	val = mvreg_read(pp, MVNETA_PORT_POOL_BUFFER_SZ_REG(pool_id));
++	val |= buf_size & MVNETA_PORT_POOL_BUFFER_SZ_MASK;
++	mvreg_write(pp, MVNETA_PORT_POOL_BUFFER_SZ_REG(pool_id), val);
++}
++
++/* Configure MBUS window in order to enable access BM internal SRAM */
++static int mvneta_mbus_io_win_set(struct mvneta_port *pp, u32 base, u32 wsize,
++				  u8 target, u8 attr)
++{
++	u32 win_enable, win_protect;
++	int i;
++
++	win_enable = mvreg_read(pp, MVNETA_BASE_ADDR_ENABLE);
++
++	if (pp->bm_win_id < 0) {
++		/* Find first not occupied window */
++		for (i = 0; i < MVNETA_MAX_DECODE_WIN; i++) {
++			if (win_enable & (1 << i)) {
++				pp->bm_win_id = i;
++				break;
++			}
++		}
++		if (i == MVNETA_MAX_DECODE_WIN)
++			return -ENOMEM;
++	} else {
++		i = pp->bm_win_id;
++	}
++
++	mvreg_write(pp, MVNETA_WIN_BASE(i), 0);
++	mvreg_write(pp, MVNETA_WIN_SIZE(i), 0);
++
++	if (i < 4)
++		mvreg_write(pp, MVNETA_WIN_REMAP(i), 0);
++
++	mvreg_write(pp, MVNETA_WIN_BASE(i), (base & 0xffff0000) |
++		    (attr << 8) | target);
++
++	mvreg_write(pp, MVNETA_WIN_SIZE(i), (wsize - 1) & 0xffff0000);
++
++	win_protect = mvreg_read(pp, MVNETA_ACCESS_PROTECT_ENABLE);
++	win_protect |= 3 << (2 * i);
++	mvreg_write(pp, MVNETA_ACCESS_PROTECT_ENABLE, win_protect);
++
++	win_enable &= ~(1 << i);
++	mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
++
++	return 0;
++}
++
++/* Assign and initialize pools for port. In case of fail
++ * buffer manager will remain disabled for current port.
++ */
++static int mvneta_bm_port_init(struct platform_device *pdev,
++			       struct mvneta_port *pp)
++{
++	struct device_node *dn = pdev->dev.of_node;
++	u32 long_pool_id, short_pool_id, wsize;
++	u8 target, attr;
++	int err;
++
++	/* Get BM window information */
++	err = mvebu_mbus_get_io_win_info(pp->bm_priv->bppi_phys_addr, &wsize,
++					 &target, &attr);
++	if (err < 0)
++		return err;
++
++	pp->bm_win_id = -1;
++
++	/* Open NETA -> BM window */
++	err = mvneta_mbus_io_win_set(pp, pp->bm_priv->bppi_phys_addr, wsize,
++				     target, attr);
++	if (err < 0) {
++		netdev_info(pp->dev, "fail to configure mbus window to BM\n");
++		return err;
++	}
++
++	if (of_property_read_u32(dn, "bm,pool-long", &long_pool_id)) {
++		netdev_info(pp->dev, "missing long pool id\n");
++		return -EINVAL;
++	}
++
++	/* Create port's long pool depending on mtu */
++	pp->pool_long = mvneta_bm_pool_use(pp->bm_priv, long_pool_id,
++					   MVNETA_BM_LONG, pp->id,
++					   MVNETA_RX_PKT_SIZE(pp->dev->mtu));
++	if (!pp->pool_long) {
++		netdev_info(pp->dev, "fail to obtain long pool for port\n");
++		return -ENOMEM;
++	}
++
++	pp->pool_long->port_map |= 1 << pp->id;
++
++	mvneta_bm_pool_bufsize_set(pp, pp->pool_long->buf_size,
++				   pp->pool_long->id);
++
++	/* If short pool id is not defined, assume using single pool */
++	if (of_property_read_u32(dn, "bm,pool-short", &short_pool_id))
++		short_pool_id = long_pool_id;
++
++	/* Create port's short pool */
++	pp->pool_short = mvneta_bm_pool_use(pp->bm_priv, short_pool_id,
++					    MVNETA_BM_SHORT, pp->id,
++					    MVNETA_BM_SHORT_PKT_SIZE);
++	if (!pp->pool_short) {
++		netdev_info(pp->dev, "fail to obtain short pool for port\n");
++		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
++		return -ENOMEM;
++	}
++
++	if (short_pool_id != long_pool_id) {
++		pp->pool_short->port_map |= 1 << pp->id;
++		mvneta_bm_pool_bufsize_set(pp, pp->pool_short->buf_size,
++					   pp->pool_short->id);
++	}
++
++	return 0;
++}
++
++/* Update settings of a pool for bigger packets */
++static void mvneta_bm_update_mtu(struct mvneta_port *pp, int mtu)
++{
++	struct mvneta_bm_pool *bm_pool = pp->pool_long;
++	int num;
++
++	/* Release all buffers from long pool */
++	mvneta_bm_bufs_free(pp->bm_priv, bm_pool, 1 << pp->id);
++	if (bm_pool->buf_num) {
++		WARN(1, "cannot free all buffers in pool %d\n",
++		     bm_pool->id);
++		goto bm_mtu_err;
++	}
++
++	bm_pool->pkt_size = MVNETA_RX_PKT_SIZE(mtu);
++	bm_pool->buf_size = MVNETA_RX_BUF_SIZE(bm_pool->pkt_size);
++	bm_pool->frag_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
++			  SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(bm_pool->pkt_size));
++
++	/* Fill entire long pool */
++	num = mvneta_bm_bufs_add(pp->bm_priv, bm_pool, bm_pool->size);
++	if (num != bm_pool->size) {
++		WARN(1, "pool %d: %d of %d allocated\n",
++		     bm_pool->id, num, bm_pool->size);
++		goto bm_mtu_err;
++	}
++	mvneta_bm_pool_bufsize_set(pp, bm_pool->buf_size, bm_pool->id);
++
++	return;
++
++bm_mtu_err:
++	mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
++	mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, 1 << pp->id);
++
++	pp->bm_priv = NULL;
++	mvreg_write(pp, MVNETA_ACC_MODE, MVNETA_ACC_MODE_EXT1);
++	netdev_info(pp->dev, "fail to update MTU, fall back to software BM\n");
++}
++
+ /* Start the Ethernet port RX and TX activity */
+ static void mvneta_port_up(struct mvneta_port *pp)
+ {
+@@ -1147,9 +1379,17 @@ static void mvneta_defaults_set(struct m
+ 	mvreg_write(pp, MVNETA_PORT_RX_RESET, 0);
+ 
+ 	/* Set Port Acceleration Mode */
+-	val = MVNETA_ACC_MODE_EXT;
++	if (pp->bm_priv)
++		/* HW buffer management + legacy parser */
++		val = MVNETA_ACC_MODE_EXT2;
++	else
++		/* SW buffer management + legacy parser */
++		val = MVNETA_ACC_MODE_EXT1;
+ 	mvreg_write(pp, MVNETA_ACC_MODE, val);
+ 
++	if (pp->bm_priv)
++		mvreg_write(pp, MVNETA_BM_ADDRESS, pp->bm_priv->bppi_phys_addr);
++
+ 	/* Update val of portCfg register accordingly with all RxQueue types */
+ 	val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
+ 	mvreg_write(pp, MVNETA_PORT_CONFIG, val);
+@@ -1516,23 +1756,25 @@ static void mvneta_txq_done(struct mvnet
+ 	}
+ }
+ 
+-static void *mvneta_frag_alloc(const struct mvneta_port *pp)
++void *mvneta_frag_alloc(unsigned int frag_size)
+ {
+-	if (likely(pp->frag_size <= PAGE_SIZE))
+-		return netdev_alloc_frag(pp->frag_size);
++	if (likely(frag_size <= PAGE_SIZE))
++		return netdev_alloc_frag(frag_size);
+ 	else
+-		return kmalloc(pp->frag_size, GFP_ATOMIC);
++		return kmalloc(frag_size, GFP_ATOMIC);
+ }
++EXPORT_SYMBOL_GPL(mvneta_frag_alloc);
+ 
+-static void mvneta_frag_free(const struct mvneta_port *pp, void *data)
++void mvneta_frag_free(unsigned int frag_size, void *data)
+ {
+-	if (likely(pp->frag_size <= PAGE_SIZE))
++	if (likely(frag_size <= PAGE_SIZE))
+ 		skb_free_frag(data);
+ 	else
+ 		kfree(data);
+ }
++EXPORT_SYMBOL_GPL(mvneta_frag_free);
+ 
+-/* Refill processing */
++/* Refill processing for SW buffer management */
+ static int mvneta_rx_refill(struct mvneta_port *pp,
+ 			    struct mvneta_rx_desc *rx_desc)
+ 
+@@ -1540,7 +1782,7 @@ static int mvneta_rx_refill(struct mvnet
+ 	dma_addr_t phys_addr;
+ 	void *data;
+ 
+-	data = mvneta_frag_alloc(pp);
++	data = mvneta_frag_alloc(pp->frag_size);
+ 	if (!data)
+ 		return -ENOMEM;
+ 
+@@ -1548,7 +1790,7 @@ static int mvneta_rx_refill(struct mvnet
+ 				   MVNETA_RX_BUF_SIZE(pp->pkt_size),
+ 				   DMA_FROM_DEVICE);
+ 	if (unlikely(dma_mapping_error(pp->dev->dev.parent, phys_addr))) {
+-		mvneta_frag_free(pp, data);
++		mvneta_frag_free(pp->frag_size, data);
+ 		return -ENOMEM;
+ 	}
+ 
+@@ -1594,22 +1836,156 @@ static void mvneta_rxq_drop_pkts(struct
+ 	int rx_done, i;
+ 
+ 	rx_done = mvneta_rxq_busy_desc_num_get(pp, rxq);
++	if (rx_done)
++		mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
++
++	if (pp->bm_priv) {
++		for (i = 0; i < rx_done; i++) {
++			struct mvneta_rx_desc *rx_desc =
++						  mvneta_rxq_next_desc_get(rxq);
++			u8 pool_id = MVNETA_RX_GET_BM_POOL_ID(rx_desc);
++			struct mvneta_bm_pool *bm_pool;
++
++			bm_pool = &pp->bm_priv->bm_pools[pool_id];
++			/* Return dropped buffer to the pool */
++			mvneta_bm_pool_put_bp(pp->bm_priv, bm_pool,
++					      rx_desc->buf_phys_addr);
++		}
++		return;
++	}
++
+ 	for (i = 0; i < rxq->size; i++) {
+ 		struct mvneta_rx_desc *rx_desc = rxq->descs + i;
+ 		void *data = (void *)rx_desc->buf_cookie;
+ 
+ 		dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
+ 				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
+-		mvneta_frag_free(pp, data);
++		mvneta_frag_free(pp->frag_size, data);
+ 	}
++}
+ 
+-	if (rx_done)
+-		mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
++/* Main rx processing when using software buffer management */
++static int mvneta_rx_swbm(struct mvneta_port *pp, int rx_todo,
++			  struct mvneta_rx_queue *rxq)
++{
++	struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports);
++	struct net_device *dev = pp->dev;
++	int rx_done;
++	u32 rcvd_pkts = 0;
++	u32 rcvd_bytes = 0;
++
++	/* Get number of received packets */
++	rx_done = mvneta_rxq_busy_desc_num_get(pp, rxq);
++
++	if (rx_todo > rx_done)
++		rx_todo = rx_done;
++
++	rx_done = 0;
++
++	/* Fairness NAPI loop */
++	while (rx_done < rx_todo) {
++		struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq);
++		struct sk_buff *skb;
++		unsigned char *data;
++		dma_addr_t phys_addr;
++		u32 rx_status, frag_size;
++		int rx_bytes, err;
++
++		rx_done++;
++		rx_status = rx_desc->status;
++		rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE);
++		data = (unsigned char *)rx_desc->buf_cookie;
++		phys_addr = rx_desc->buf_phys_addr;
++
++		if (!mvneta_rxq_desc_is_first_last(rx_status) ||
++		    (rx_status & MVNETA_RXD_ERR_SUMMARY)) {
++err_drop_frame:
++			dev->stats.rx_errors++;
++			mvneta_rx_error(pp, rx_desc);
++			/* leave the descriptor untouched */
++			continue;
++		}
++
++		if (rx_bytes <= rx_copybreak) {
++		/* better copy a small frame and not unmap the DMA region */
++			skb = netdev_alloc_skb_ip_align(dev, rx_bytes);
++			if (unlikely(!skb))
++				goto err_drop_frame;
++
++			dma_sync_single_range_for_cpu(dev->dev.parent,
++						      rx_desc->buf_phys_addr,
++						      MVNETA_MH_SIZE + NET_SKB_PAD,
++						      rx_bytes,
++						      DMA_FROM_DEVICE);
++			memcpy(skb_put(skb, rx_bytes),
++			       data + MVNETA_MH_SIZE + NET_SKB_PAD,
++			       rx_bytes);
++
++			skb->protocol = eth_type_trans(skb, dev);
++			mvneta_rx_csum(pp, rx_status, skb);
++			napi_gro_receive(&port->napi, skb);
++
++			rcvd_pkts++;
++			rcvd_bytes += rx_bytes;
++
++			/* leave the descriptor and buffer untouched */
++			continue;
++		}
++
++		/* Refill processing */
++		err = mvneta_rx_refill(pp, rx_desc);
++		if (err) {
++			netdev_err(dev, "Linux processing - Can't refill\n");
++			rxq->missed++;
++			goto err_drop_frame;
++		}
++
++		frag_size = pp->frag_size;
++
++		skb = build_skb(data, frag_size > PAGE_SIZE ? 0 : frag_size);
++
++		/* After refill old buffer has to be unmapped regardless
++		 * the skb is successfully built or not.
++		 */
++		dma_unmap_single(dev->dev.parent, phys_addr,
++				 MVNETA_RX_BUF_SIZE(pp->pkt_size),
++				 DMA_FROM_DEVICE);
++
++		if (!skb)
++			goto err_drop_frame;
++
++		rcvd_pkts++;
++		rcvd_bytes += rx_bytes;
++
++		/* Linux processing */
++		skb_reserve(skb, MVNETA_MH_SIZE + NET_SKB_PAD);
++		skb_put(skb, rx_bytes);
++
++		skb->protocol = eth_type_trans(skb, dev);
++
++		mvneta_rx_csum(pp, rx_status, skb);
++
++		napi_gro_receive(&port->napi, skb);
++	}
++
++	if (rcvd_pkts) {
++		struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
++
++		u64_stats_update_begin(&stats->syncp);
++		stats->rx_packets += rcvd_pkts;
++		stats->rx_bytes   += rcvd_bytes;
++		u64_stats_update_end(&stats->syncp);
++	}
++
++	/* Update rxq management counters */
++	mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
++
++	return rx_done;
+ }
+ 
+-/* Main rx processing */
+-static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
+-		     struct mvneta_rx_queue *rxq)
++/* Main rx processing when using hardware buffer management */
++static int mvneta_rx_hwbm(struct mvneta_port *pp, int rx_todo,
++			  struct mvneta_rx_queue *rxq)
+ {
+ 	struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports);
+ 	struct net_device *dev = pp->dev;
+@@ -1628,21 +2004,29 @@ static int mvneta_rx(struct mvneta_port
+ 	/* Fairness NAPI loop */
+ 	while (rx_done < rx_todo) {
+ 		struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq);
++		struct mvneta_bm_pool *bm_pool = NULL;
+ 		struct sk_buff *skb;
+ 		unsigned char *data;
+ 		dma_addr_t phys_addr;
+-		u32 rx_status;
++		u32 rx_status, frag_size;
+ 		int rx_bytes, err;
++		u8 pool_id;
+ 
+ 		rx_done++;
+ 		rx_status = rx_desc->status;
+ 		rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE);
+ 		data = (unsigned char *)rx_desc->buf_cookie;
+ 		phys_addr = rx_desc->buf_phys_addr;
++		pool_id = MVNETA_RX_GET_BM_POOL_ID(rx_desc);
++		bm_pool = &pp->bm_priv->bm_pools[pool_id];
+ 
+ 		if (!mvneta_rxq_desc_is_first_last(rx_status) ||
+ 		    (rx_status & MVNETA_RXD_ERR_SUMMARY)) {
+-		err_drop_frame:
++err_drop_frame_ret_pool:
++			/* Return the buffer to the pool */
++			mvneta_bm_pool_put_bp(pp->bm_priv, bm_pool,
++					      rx_desc->buf_phys_addr);
++err_drop_frame:
+ 			dev->stats.rx_errors++;
+ 			mvneta_rx_error(pp, rx_desc);
+ 			/* leave the descriptor untouched */
+@@ -1653,7 +2037,7 @@ static int mvneta_rx(struct mvneta_port
+ 			/* better copy a small frame and not unmap the DMA region */
+ 			skb = netdev_alloc_skb_ip_align(dev, rx_bytes);
+ 			if (unlikely(!skb))
+-				goto err_drop_frame;
++				goto err_drop_frame_ret_pool;
+ 
+ 			dma_sync_single_range_for_cpu(dev->dev.parent,
+ 			                              rx_desc->buf_phys_addr,
+@@ -1671,26 +2055,31 @@ static int mvneta_rx(struct mvneta_port
+ 			rcvd_pkts++;
+ 			rcvd_bytes += rx_bytes;
+ 
++			/* Return the buffer to the pool */
++			mvneta_bm_pool_put_bp(pp->bm_priv, bm_pool,
++					      rx_desc->buf_phys_addr);
++
+ 			/* leave the descriptor and buffer untouched */
+ 			continue;
+ 		}
+ 
+ 		/* Refill processing */
+-		err = mvneta_rx_refill(pp, rx_desc);
++		err = mvneta_bm_pool_refill(pp->bm_priv, bm_pool);
+ 		if (err) {
+ 			netdev_err(dev, "Linux processing - Can't refill\n");
+ 			rxq->missed++;
+-			goto err_drop_frame;
++			goto err_drop_frame_ret_pool;
+ 		}
+ 
+-		skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
++		frag_size = bm_pool->frag_size;
++
++		skb = build_skb(data, frag_size > PAGE_SIZE ? 0 : frag_size);
+ 
+ 		/* After refill old buffer has to be unmapped regardless
+ 		 * the skb is successfully built or not.
+ 		 */
+-		dma_unmap_single(dev->dev.parent, phys_addr,
+-				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
+-
++		dma_unmap_single(&pp->bm_priv->pdev->dev, phys_addr,
++				 bm_pool->buf_size, DMA_FROM_DEVICE);
+ 		if (!skb)
+ 			goto err_drop_frame;
+ 
+@@ -2295,7 +2684,10 @@ static int mvneta_poll(struct napi_struc
+ 
+ 	if (rx_queue) {
+ 		rx_queue = rx_queue - 1;
+-		rx_done = mvneta_rx(pp, budget, &pp->rxqs[rx_queue]);
++		if (pp->bm_priv)
++			rx_done = mvneta_rx_hwbm(pp, budget, &pp->rxqs[rx_queue]);
++		else
++			rx_done = mvneta_rx_swbm(pp, budget, &pp->rxqs[rx_queue]);
+ 	}
+ 
+ 	budget -= rx_done;
+@@ -2384,9 +2776,17 @@ static int mvneta_rxq_init(struct mvneta
+ 	mvneta_rx_pkts_coal_set(pp, rxq, rxq->pkts_coal);
+ 	mvneta_rx_time_coal_set(pp, rxq, rxq->time_coal);
+ 
+-	/* Fill RXQ with buffers from RX pool */
+-	mvneta_rxq_buf_size_set(pp, rxq, MVNETA_RX_BUF_SIZE(pp->pkt_size));
+-	mvneta_rxq_bm_disable(pp, rxq);
++	if (!pp->bm_priv) {
++		/* Fill RXQ with buffers from RX pool */
++		mvneta_rxq_buf_size_set(pp, rxq,
++					MVNETA_RX_BUF_SIZE(pp->pkt_size));
++		mvneta_rxq_bm_disable(pp, rxq);
++	} else {
++		mvneta_rxq_bm_enable(pp, rxq);
++		mvneta_rxq_long_pool_set(pp, rxq);
++		mvneta_rxq_short_pool_set(pp, rxq);
++	}
++
+ 	mvneta_rxq_fill(pp, rxq, rxq->size);
+ 
+ 	return 0;
+@@ -2659,6 +3059,9 @@ static int mvneta_change_mtu(struct net_
+ 	dev->mtu = mtu;
+ 
+ 	if (!netif_running(dev)) {
++		if (pp->bm_priv)
++			mvneta_bm_update_mtu(pp, mtu);
++
+ 		netdev_update_features(dev);
+ 		return 0;
+ 	}
+@@ -2671,6 +3074,9 @@ static int mvneta_change_mtu(struct net_
+ 	mvneta_cleanup_txqs(pp);
+ 	mvneta_cleanup_rxqs(pp);
+ 
++	if (pp->bm_priv)
++		mvneta_bm_update_mtu(pp, mtu);
++
+ 	pp->pkt_size = MVNETA_RX_PKT_SIZE(dev->mtu);
+ 	pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
+ 	                SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
+@@ -3563,6 +3969,7 @@ static int mvneta_probe(struct platform_
+ 	struct resource *res;
+ 	struct device_node *dn = pdev->dev.of_node;
+ 	struct device_node *phy_node;
++	struct device_node *bm_node;
+ 	struct mvneta_port *pp;
+ 	struct net_device *dev;
+ 	const char *dt_mac_addr;
+@@ -3690,26 +4097,39 @@ static int mvneta_probe(struct platform_
+ 
+ 	pp->tx_csum_limit = tx_csum_limit;
+ 
++	dram_target_info = mv_mbus_dram_info();
++	if (dram_target_info)
++		mvneta_conf_mbus_windows(pp, dram_target_info);
++
+ 	pp->tx_ring_size = MVNETA_MAX_TXD;
+ 	pp->rx_ring_size = MVNETA_MAX_RXD;
+ 
+ 	pp->dev = dev;
+ 	SET_NETDEV_DEV(dev, &pdev->dev);
+ 
++	pp->id = global_port_id++;
++
++	/* Obtain access to BM resources if enabled and already initialized */
++	bm_node = of_parse_phandle(dn, "buffer-manager", 0);
++	if (bm_node && bm_node->data) {
++		pp->bm_priv = bm_node->data;
++		err = mvneta_bm_port_init(pdev, pp);
++		if (err < 0) {
++			dev_info(&pdev->dev, "use SW buffer management\n");
++			pp->bm_priv = NULL;
++		}
++	}
++
+ 	err = mvneta_init(&pdev->dev, pp);
+ 	if (err < 0)
+-		goto err_free_stats;
++		goto err_netdev;
+ 
+ 	err = mvneta_port_power_up(pp, phy_mode);
+ 	if (err < 0) {
+ 		dev_err(&pdev->dev, "can't power up port\n");
+-		goto err_free_stats;
++		goto err_netdev;
+ 	}
+ 
+-	dram_target_info = mv_mbus_dram_info();
+-	if (dram_target_info)
+-		mvneta_conf_mbus_windows(pp, dram_target_info);
+-
+ 	for_each_present_cpu(cpu) {
+ 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
+ 
+@@ -3744,6 +4164,13 @@ static int mvneta_probe(struct platform_
+ 
+ 	return 0;
+ 
++err_netdev:
++	unregister_netdev(dev);
++	if (pp->bm_priv) {
++		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
++		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
++				       1 << pp->id);
++	}
+ err_free_stats:
+ 	free_percpu(pp->stats);
+ err_free_ports:
+@@ -3773,6 +4200,12 @@ static int mvneta_remove(struct platform
+ 	of_node_put(pp->phy_node);
+ 	free_netdev(dev);
+ 
++	if (pp->bm_priv) {
++		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
++		mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
++				       1 << pp->id);
++	}
++
+ 	return 0;
+ }
+ 
+--- /dev/null
++++ b/drivers/net/ethernet/marvell/mvneta_bm.c
+@@ -0,0 +1,546 @@
++/*
++ * Driver for Marvell NETA network controller Buffer Manager.
++ *
++ * Copyright (C) 2015 Marvell
++ *
++ * Marcin Wojtas <mw at semihalf.com>
++ *
++ * This file is licensed under the terms of the GNU General Public
++ * License version 2. This program is licensed "as is" without any
++ * warranty of any kind, whether express or implied.
++ */
++
++#include <linux/kernel.h>
++#include <linux/genalloc.h>
++#include <linux/platform_device.h>
++#include <linux/netdevice.h>
++#include <linux/skbuff.h>
++#include <linux/mbus.h>
++#include <linux/module.h>
++#include <linux/io.h>
++#include <linux/of.h>
++#include <linux/clk.h>
++#include "mvneta_bm.h"
++
++#define MVNETA_BM_DRIVER_NAME "mvneta_bm"
++#define MVNETA_BM_DRIVER_VERSION "1.0"
++
++static void mvneta_bm_write(struct mvneta_bm *priv, u32 offset, u32 data)
++{
++	writel(data, priv->reg_base + offset);
++}
++
++static u32 mvneta_bm_read(struct mvneta_bm *priv, u32 offset)
++{
++	return readl(priv->reg_base + offset);
++}
++
++static void mvneta_bm_pool_enable(struct mvneta_bm *priv, int pool_id)
++{
++	u32 val;
++
++	val = mvneta_bm_read(priv, MVNETA_BM_POOL_BASE_REG(pool_id));
++	val |= MVNETA_BM_POOL_ENABLE_MASK;
++	mvneta_bm_write(priv, MVNETA_BM_POOL_BASE_REG(pool_id), val);
++
++	/* Clear BM cause register */
++	mvneta_bm_write(priv, MVNETA_BM_INTR_CAUSE_REG, 0);
++}
++
++static void mvneta_bm_pool_disable(struct mvneta_bm *priv, int pool_id)
++{
++	u32 val;
++
++	val = mvneta_bm_read(priv, MVNETA_BM_POOL_BASE_REG(pool_id));
++	val &= ~MVNETA_BM_POOL_ENABLE_MASK;
++	mvneta_bm_write(priv, MVNETA_BM_POOL_BASE_REG(pool_id), val);
++}
++
++static inline void mvneta_bm_config_set(struct mvneta_bm *priv, u32 mask)
++{
++	u32 val;
++
++	val = mvneta_bm_read(priv, MVNETA_BM_CONFIG_REG);
++	val |= mask;
++	mvneta_bm_write(priv, MVNETA_BM_CONFIG_REG, val);
++}
++
++static inline void mvneta_bm_config_clear(struct mvneta_bm *priv, u32 mask)
++{
++	u32 val;
++
++	val = mvneta_bm_read(priv, MVNETA_BM_CONFIG_REG);
++	val &= ~mask;
++	mvneta_bm_write(priv, MVNETA_BM_CONFIG_REG, val);
++}
++
++static void mvneta_bm_pool_target_set(struct mvneta_bm *priv, int pool_id,
++				      u8 target_id, u8 attr)
++{
++	u32 val;
++
++	val = mvneta_bm_read(priv, MVNETA_BM_XBAR_POOL_REG(pool_id));
++	val &= ~MVNETA_BM_TARGET_ID_MASK(pool_id);
++	val &= ~MVNETA_BM_XBAR_ATTR_MASK(pool_id);
++	val |= MVNETA_BM_TARGET_ID_VAL(pool_id, target_id);
++	val |= MVNETA_BM_XBAR_ATTR_VAL(pool_id, attr);
++
++	mvneta_bm_write(priv, MVNETA_BM_XBAR_POOL_REG(pool_id), val);
++}
++
++/* Allocate skb for BM pool */
++void *mvneta_buf_alloc(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++		       dma_addr_t *buf_phys_addr)
++{
++	void *buf;
++	dma_addr_t phys_addr;
++
++	buf = mvneta_frag_alloc(bm_pool->frag_size);
++	if (!buf)
++		return NULL;
++
++	/* In order to update buf_cookie field of RX descriptor properly,
++	 * BM hardware expects buf virtual address to be placed in the
++	 * first four bytes of mapped buffer.
++	 */
++	*(u32 *)buf = (u32)buf;
++	phys_addr = dma_map_single(&priv->pdev->dev, buf, bm_pool->buf_size,
++				   DMA_FROM_DEVICE);
++	if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr))) {
++		mvneta_frag_free(bm_pool->frag_size, buf);
++		return NULL;
++	}
++	*buf_phys_addr = phys_addr;
++
++	return buf;
++}
++
++/* Refill processing for HW buffer management */
++int mvneta_bm_pool_refill(struct mvneta_bm *priv,
++			  struct mvneta_bm_pool *bm_pool)
++{
++	dma_addr_t buf_phys_addr;
++	void *buf;
++
++	buf = mvneta_buf_alloc(priv, bm_pool, &buf_phys_addr);
++	if (!buf)
++		return -ENOMEM;
++
++	mvneta_bm_pool_put_bp(priv, bm_pool, buf_phys_addr);
++
++	return 0;
++}
++EXPORT_SYMBOL_GPL(mvneta_bm_pool_refill);
++
++/* Allocate buffers for the pool */
++int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++		       int buf_num)
++{
++	int err, i;
++
++	if (bm_pool->buf_num == bm_pool->size) {
++		dev_dbg(&priv->pdev->dev, "pool %d already filled\n",
++			bm_pool->id);
++		return bm_pool->buf_num;
++	}
++
++	if (buf_num < 0 ||
++	    (buf_num + bm_pool->buf_num > bm_pool->size)) {
++		dev_err(&priv->pdev->dev,
++			"cannot allocate %d buffers for pool %d\n",
++			buf_num, bm_pool->id);
++		return 0;
++	}
++
++	for (i = 0; i < buf_num; i++) {
++		err = mvneta_bm_pool_refill(priv, bm_pool);
++		if (err < 0)
++			break;
++	}
++
++	/* Update BM driver with number of buffers added to pool */
++	bm_pool->buf_num += i;
++
++	dev_dbg(&priv->pdev->dev,
++		"%s pool %d: pkt_size=%4d, buf_size=%4d, frag_size=%4d\n",
++		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
++		bm_pool->id, bm_pool->pkt_size, bm_pool->buf_size,
++		bm_pool->frag_size);
++
++	dev_dbg(&priv->pdev->dev,
++		"%s pool %d: %d of %d buffers added\n",
++		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
++		bm_pool->id, i, buf_num);
++
++	return i;
++}
++EXPORT_SYMBOL_GPL(mvneta_bm_bufs_add);
++
++/* Create pool */
++static int mvneta_bm_pool_create(struct mvneta_bm *priv,
++				 struct mvneta_bm_pool *bm_pool)
++{
++	struct platform_device *pdev = priv->pdev;
++	u8 target_id, attr;
++	int size_bytes, err;
++
++	size_bytes = sizeof(u32) * bm_pool->size;
++	bm_pool->virt_addr = dma_alloc_coherent(&pdev->dev, size_bytes,
++						&bm_pool->phys_addr,
++						GFP_KERNEL);
++	if (!bm_pool->virt_addr)
++		return -ENOMEM;
++
++	if (!IS_ALIGNED((u32)bm_pool->virt_addr, MVNETA_BM_POOL_PTR_ALIGN)) {
++		dma_free_coherent(&pdev->dev, size_bytes, bm_pool->virt_addr,
++				  bm_pool->phys_addr);
++		dev_err(&pdev->dev, "BM pool %d is not %d bytes aligned\n",
++			bm_pool->id, MVNETA_BM_POOL_PTR_ALIGN);
++		return -ENOMEM;
++	}
++
++	err = mvebu_mbus_get_dram_win_info(bm_pool->phys_addr, &target_id,
++					   &attr);
++	if (err < 0) {
++		dma_free_coherent(&pdev->dev, size_bytes, bm_pool->virt_addr,
++				  bm_pool->phys_addr);
++		return err;
++	}
++
++	/* Set pool address */
++	mvneta_bm_write(priv, MVNETA_BM_POOL_BASE_REG(bm_pool->id),
++			bm_pool->phys_addr);
++
++	mvneta_bm_pool_target_set(priv, bm_pool->id, target_id,  attr);
++	mvneta_bm_pool_enable(priv, bm_pool->id);
++
++	return 0;
++}
++
++/* Notify the driver that BM pool is being used as specific type and return the
++ * pool pointer on success
++ */
++struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
++					  enum mvneta_bm_type type, u8 port_id,
++					  int pkt_size)
++{
++	struct mvneta_bm_pool *new_pool = &priv->bm_pools[pool_id];
++	int num, err;
++
++	if (new_pool->type == MVNETA_BM_LONG &&
++	    new_pool->port_map != 1 << port_id) {
++		dev_err(&priv->pdev->dev,
++			"long pool cannot be shared by the ports\n");
++		return NULL;
++	}
++
++	if (new_pool->type == MVNETA_BM_SHORT && new_pool->type != type) {
++		dev_err(&priv->pdev->dev,
++			"mixing pools' types between the ports is forbidden\n");
++		return NULL;
++	}
++
++	if (new_pool->pkt_size == 0 || type != MVNETA_BM_SHORT)
++		new_pool->pkt_size = pkt_size;
++
++	/* Allocate buffers in case BM pool hasn't been used yet */
++	if (new_pool->type == MVNETA_BM_FREE) {
++		new_pool->type = type;
++		new_pool->buf_size = MVNETA_RX_BUF_SIZE(new_pool->pkt_size);
++		new_pool->frag_size =
++			SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(new_pool->pkt_size)) +
++			SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
++
++		/* Create new pool */
++		err = mvneta_bm_pool_create(priv, new_pool);
++		if (err) {
++			dev_err(&priv->pdev->dev, "fail to create pool %d\n",
++				new_pool->id);
++			return NULL;
++		}
++
++		/* Allocate buffers for this pool */
++		num = mvneta_bm_bufs_add(priv, new_pool, new_pool->size);
++		if (num != new_pool->size) {
++			WARN(1, "pool %d: %d of %d allocated\n",
++			     new_pool->id, num, new_pool->size);
++			return NULL;
++		}
++	}
++
++	return new_pool;
++}
++EXPORT_SYMBOL_GPL(mvneta_bm_pool_use);
++
++/* Free all buffers from the pool */
++void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++			 u8 port_map)
++{
++	int i;
++
++	bm_pool->port_map &= ~port_map;
++	if (bm_pool->port_map)
++		return;
++
++	mvneta_bm_config_set(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
++
++	for (i = 0; i < bm_pool->buf_num; i++) {
++		dma_addr_t buf_phys_addr;
++		u32 *vaddr;
++
++		/* Get buffer physical address (indirect access) */
++		buf_phys_addr = mvneta_bm_pool_get_bp(priv, bm_pool);
++
++		/* Work-around to the problems when destroying the pool,
++		 * when it occurs that a read access to BPPI returns 0.
++		 */
++		if (buf_phys_addr == 0)
++			continue;
++
++		vaddr = phys_to_virt(buf_phys_addr);
++		if (!vaddr)
++			break;
++
++		dma_unmap_single(&priv->pdev->dev, buf_phys_addr,
++				 bm_pool->buf_size, DMA_FROM_DEVICE);
++		mvneta_frag_free(bm_pool->frag_size, vaddr);
++	}
++
++	mvneta_bm_config_clear(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
++
++	/* Update BM driver with number of buffers removed from pool */
++	bm_pool->buf_num -= i;
++}
++EXPORT_SYMBOL_GPL(mvneta_bm_bufs_free);
++
++/* Cleanup pool */
++void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
++			    struct mvneta_bm_pool *bm_pool, u8 port_map)
++{
++	bm_pool->port_map &= ~port_map;
++	if (bm_pool->port_map)
++		return;
++
++	bm_pool->type = MVNETA_BM_FREE;
++
++	mvneta_bm_bufs_free(priv, bm_pool, port_map);
++	if (bm_pool->buf_num)
++		WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id);
++
++	if (bm_pool->virt_addr) {
++		dma_free_coherent(&priv->pdev->dev, sizeof(u32) * bm_pool->size,
++				  bm_pool->virt_addr, bm_pool->phys_addr);
++		bm_pool->virt_addr = NULL;
++	}
++
++	mvneta_bm_pool_disable(priv, bm_pool->id);
++}
++EXPORT_SYMBOL_GPL(mvneta_bm_pool_destroy);
++
++static void mvneta_bm_pools_init(struct mvneta_bm *priv)
++{
++	struct device_node *dn = priv->pdev->dev.of_node;
++	struct mvneta_bm_pool *bm_pool;
++	char prop[15];
++	u32 size;
++	int i;
++
++	/* Activate BM unit */
++	mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_START_MASK);
++
++	/* Create all pools with maximum size */
++	for (i = 0; i < MVNETA_BM_POOLS_NUM; i++) {
++		bm_pool = &priv->bm_pools[i];
++		bm_pool->id = i;
++		bm_pool->type = MVNETA_BM_FREE;
++
++		/* Reset read pointer */
++		mvneta_bm_write(priv, MVNETA_BM_POOL_READ_PTR_REG(i), 0);
++
++		/* Reset write pointer */
++		mvneta_bm_write(priv, MVNETA_BM_POOL_WRITE_PTR_REG(i), 0);
++
++		/* Configure pool size according to DT or use default value */
++		sprintf(prop, "pool%d,capacity", i);
++		if (of_property_read_u32(dn, prop, &size)) {
++			size = MVNETA_BM_POOL_CAP_DEF;
++		} else if (size > MVNETA_BM_POOL_CAP_MAX) {
++			dev_warn(&priv->pdev->dev,
++				 "Illegal pool %d capacity %d, set to %d\n",
++				 i, size, MVNETA_BM_POOL_CAP_MAX);
++			size = MVNETA_BM_POOL_CAP_MAX;
++		} else if (size < MVNETA_BM_POOL_CAP_MIN) {
++			dev_warn(&priv->pdev->dev,
++				 "Illegal pool %d capacity %d, set to %d\n",
++				 i, size, MVNETA_BM_POOL_CAP_MIN);
++			size = MVNETA_BM_POOL_CAP_MIN;
++		} else if (!IS_ALIGNED(size, MVNETA_BM_POOL_CAP_ALIGN)) {
++			dev_warn(&priv->pdev->dev,
++				 "Illegal pool %d capacity %d, round to %d\n",
++				 i, size, ALIGN(size,
++				 MVNETA_BM_POOL_CAP_ALIGN));
++			size = ALIGN(size, MVNETA_BM_POOL_CAP_ALIGN);
++		}
++		bm_pool->size = size;
++
++		mvneta_bm_write(priv, MVNETA_BM_POOL_SIZE_REG(i),
++				bm_pool->size);
++
++		/* Obtain custom pkt_size from DT */
++		sprintf(prop, "pool%d,pkt-size", i);
++		if (of_property_read_u32(dn, prop, &bm_pool->pkt_size))
++			bm_pool->pkt_size = 0;
++	}
++}
++
++static void mvneta_bm_default_set(struct mvneta_bm *priv)
++{
++	u32 val;
++
++	/* Mask BM all interrupts */
++	mvneta_bm_write(priv, MVNETA_BM_INTR_MASK_REG, 0);
++
++	/* Clear BM cause register */
++	mvneta_bm_write(priv, MVNETA_BM_INTR_CAUSE_REG, 0);
++
++	/* Set BM configuration register */
++	val = mvneta_bm_read(priv, MVNETA_BM_CONFIG_REG);
++
++	/* Reduce MaxInBurstSize from 32 BPs to 16 BPs */
++	val &= ~MVNETA_BM_MAX_IN_BURST_SIZE_MASK;
++	val |= MVNETA_BM_MAX_IN_BURST_SIZE_16BP;
++	mvneta_bm_write(priv, MVNETA_BM_CONFIG_REG, val);
++}
++
++static int mvneta_bm_init(struct mvneta_bm *priv)
++{
++	mvneta_bm_default_set(priv);
++
++	/* Allocate and initialize BM pools structures */
++	priv->bm_pools = devm_kcalloc(&priv->pdev->dev, MVNETA_BM_POOLS_NUM,
++				      sizeof(struct mvneta_bm_pool),
++				      GFP_KERNEL);
++	if (!priv->bm_pools)
++		return -ENOMEM;
++
++	mvneta_bm_pools_init(priv);
++
++	return 0;
++}
++
++static int mvneta_bm_get_sram(struct device_node *dn,
++			      struct mvneta_bm *priv)
++{
++	priv->bppi_pool = of_gen_pool_get(dn, "internal-mem", 0);
++	if (!priv->bppi_pool)
++		return -ENOMEM;
++
++	priv->bppi_virt_addr = gen_pool_dma_alloc(priv->bppi_pool,
++						  MVNETA_BM_BPPI_SIZE,
++						  &priv->bppi_phys_addr);
++	if (!priv->bppi_virt_addr)
++		return -ENOMEM;
++
++	return 0;
++}
++
++static void mvneta_bm_put_sram(struct mvneta_bm *priv)
++{
++	gen_pool_free(priv->bppi_pool, priv->bppi_phys_addr,
++		      MVNETA_BM_BPPI_SIZE);
++}
++
++static int mvneta_bm_probe(struct platform_device *pdev)
++{
++	struct device_node *dn = pdev->dev.of_node;
++	struct mvneta_bm *priv;
++	struct resource *res;
++	int err;
++
++	priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL);
++	if (!priv)
++		return -ENOMEM;
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++	priv->reg_base = devm_ioremap_resource(&pdev->dev, res);
++	if (IS_ERR(priv->reg_base))
++		return PTR_ERR(priv->reg_base);
++
++	priv->clk = devm_clk_get(&pdev->dev, NULL);
++	if (IS_ERR(priv->clk))
++		return PTR_ERR(priv->clk);
++	err = clk_prepare_enable(priv->clk);
++	if (err < 0)
++		return err;
++
++	err = mvneta_bm_get_sram(dn, priv);
++	if (err < 0) {
++		dev_err(&pdev->dev, "failed to allocate internal memory\n");
++		goto err_clk;
++	}
++
++	priv->pdev = pdev;
++
++	/* Initialize buffer manager internals */
++	err = mvneta_bm_init(priv);
++	if (err < 0) {
++		dev_err(&pdev->dev, "failed to initialize controller\n");
++		goto err_sram;
++	}
++
++	dn->data = priv;
++	platform_set_drvdata(pdev, priv);
++
++	dev_info(&pdev->dev, "Buffer Manager for network controller enabled\n");
++
++	return 0;
++
++err_sram:
++	mvneta_bm_put_sram(priv);
++err_clk:
++	clk_disable_unprepare(priv->clk);
++	return err;
++}
++
++static int mvneta_bm_remove(struct platform_device *pdev)
++{
++	struct mvneta_bm *priv = platform_get_drvdata(pdev);
++	u8 all_ports_map = 0xff;
++	int i = 0;
++
++	for (i = 0; i < MVNETA_BM_POOLS_NUM; i++) {
++		struct mvneta_bm_pool *bm_pool = &priv->bm_pools[i];
++
++		mvneta_bm_pool_destroy(priv, bm_pool, all_ports_map);
++	}
++
++	mvneta_bm_put_sram(priv);
++
++	/* Dectivate BM unit */
++	mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_STOP_MASK);
++
++	clk_disable_unprepare(priv->clk);
++
++	return 0;
++}
++
++static const struct of_device_id mvneta_bm_match[] = {
++	{ .compatible = "marvell,armada-380-neta-bm" },
++	{ }
++};
++MODULE_DEVICE_TABLE(of, mvneta_bm_match);
++
++static struct platform_driver mvneta_bm_driver = {
++	.probe = mvneta_bm_probe,
++	.remove = mvneta_bm_remove,
++	.driver = {
++		.name = MVNETA_BM_DRIVER_NAME,
++		.of_match_table = mvneta_bm_match,
++	},
++};
++
++module_platform_driver(mvneta_bm_driver);
++
++MODULE_DESCRIPTION("Marvell NETA Buffer Manager Driver - www.marvell.com");
++MODULE_AUTHOR("Marcin Wojtas <mw at semihalf.com>");
++MODULE_LICENSE("GPL v2");
+--- /dev/null
++++ b/drivers/net/ethernet/marvell/mvneta_bm.h
+@@ -0,0 +1,189 @@
++/*
++ * Driver for Marvell NETA network controller Buffer Manager.
++ *
++ * Copyright (C) 2015 Marvell
++ *
++ * Marcin Wojtas <mw at semihalf.com>
++ *
++ * This file is licensed under the terms of the GNU General Public
++ * License version 2. This program is licensed "as is" without any
++ * warranty of any kind, whether express or implied.
++ */
++
++#ifndef _MVNETA_BM_H_
++#define _MVNETA_BM_H_
++
++/* BM Configuration Register */
++#define MVNETA_BM_CONFIG_REG			0x0
++#define    MVNETA_BM_STATUS_MASK		0x30
++#define    MVNETA_BM_ACTIVE_MASK		BIT(4)
++#define    MVNETA_BM_MAX_IN_BURST_SIZE_MASK	0x60000
++#define    MVNETA_BM_MAX_IN_BURST_SIZE_16BP	BIT(18)
++#define    MVNETA_BM_EMPTY_LIMIT_MASK		BIT(19)
++
++/* BM Activation Register */
++#define MVNETA_BM_COMMAND_REG			0x4
++#define    MVNETA_BM_START_MASK			BIT(0)
++#define    MVNETA_BM_STOP_MASK			BIT(1)
++#define    MVNETA_BM_PAUSE_MASK			BIT(2)
++
++/* BM Xbar interface Register */
++#define MVNETA_BM_XBAR_01_REG			0x8
++#define MVNETA_BM_XBAR_23_REG			0xc
++#define MVNETA_BM_XBAR_POOL_REG(pool)		\
++		(((pool) < 2) ? MVNETA_BM_XBAR_01_REG : MVNETA_BM_XBAR_23_REG)
++#define     MVNETA_BM_TARGET_ID_OFFS(pool)	(((pool) & 1) ? 16 : 0)
++#define     MVNETA_BM_TARGET_ID_MASK(pool)	\
++		(0xf << MVNETA_BM_TARGET_ID_OFFS(pool))
++#define     MVNETA_BM_TARGET_ID_VAL(pool, id)	\
++		((id) << MVNETA_BM_TARGET_ID_OFFS(pool))
++#define     MVNETA_BM_XBAR_ATTR_OFFS(pool)	(((pool) & 1) ? 20 : 4)
++#define     MVNETA_BM_XBAR_ATTR_MASK(pool)	\
++		(0xff << MVNETA_BM_XBAR_ATTR_OFFS(pool))
++#define     MVNETA_BM_XBAR_ATTR_VAL(pool, attr)	\
++		((attr) << MVNETA_BM_XBAR_ATTR_OFFS(pool))
++
++/* Address of External Buffer Pointers Pool Register */
++#define MVNETA_BM_POOL_BASE_REG(pool)		(0x10 + ((pool) << 4))
++#define     MVNETA_BM_POOL_ENABLE_MASK		BIT(0)
++
++/* External Buffer Pointers Pool RD pointer Register */
++#define MVNETA_BM_POOL_READ_PTR_REG(pool)	(0x14 + ((pool) << 4))
++#define     MVNETA_BM_POOL_SET_READ_PTR_MASK	0xfffc
++#define     MVNETA_BM_POOL_GET_READ_PTR_OFFS	16
++#define     MVNETA_BM_POOL_GET_READ_PTR_MASK	0xfffc0000
++
++/* External Buffer Pointers Pool WR pointer */
++#define MVNETA_BM_POOL_WRITE_PTR_REG(pool)	(0x18 + ((pool) << 4))
++#define     MVNETA_BM_POOL_SET_WRITE_PTR_OFFS	0
++#define     MVNETA_BM_POOL_SET_WRITE_PTR_MASK	0xfffc
++#define     MVNETA_BM_POOL_GET_WRITE_PTR_OFFS	16
++#define     MVNETA_BM_POOL_GET_WRITE_PTR_MASK	0xfffc0000
++
++/* External Buffer Pointers Pool Size Register */
++#define MVNETA_BM_POOL_SIZE_REG(pool)		(0x1c + ((pool) << 4))
++#define     MVNETA_BM_POOL_SIZE_MASK		0x3fff
++
++/* BM Interrupt Cause Register */
++#define MVNETA_BM_INTR_CAUSE_REG		(0x50)
++
++/* BM interrupt Mask Register */
++#define MVNETA_BM_INTR_MASK_REG			(0x54)
++
++/* Other definitions */
++#define MVNETA_BM_SHORT_PKT_SIZE		256
++#define MVNETA_BM_POOLS_NUM			4
++#define MVNETA_BM_POOL_CAP_MIN			128
++#define MVNETA_BM_POOL_CAP_DEF			2048
++#define MVNETA_BM_POOL_CAP_MAX			\
++		(16 * 1024 - MVNETA_BM_POOL_CAP_ALIGN)
++#define MVNETA_BM_POOL_CAP_ALIGN		32
++#define MVNETA_BM_POOL_PTR_ALIGN		32
++
++#define MVNETA_BM_POOL_ACCESS_OFFS		8
++
++#define MVNETA_BM_BPPI_SIZE			0x100000
++
++#define MVNETA_RX_BUF_SIZE(pkt_size)   ((pkt_size) + NET_SKB_PAD)
++
++enum mvneta_bm_type {
++	MVNETA_BM_FREE,
++	MVNETA_BM_LONG,
++	MVNETA_BM_SHORT
++};
++
++struct mvneta_bm {
++	void __iomem *reg_base;
++	struct clk *clk;
++	struct platform_device *pdev;
++
++	struct gen_pool *bppi_pool;
++	/* BPPI virtual base address */
++	void __iomem *bppi_virt_addr;
++	/* BPPI physical base address */
++	dma_addr_t bppi_phys_addr;
++
++	/* BM pools */
++	struct mvneta_bm_pool *bm_pools;
++};
++
++struct mvneta_bm_pool {
++	/* Pool number in the range 0-3 */
++	u8 id;
++	enum mvneta_bm_type type;
++
++	/* Buffer Pointers Pool External (BPPE) size in number of bytes */
++	int size;
++	/* Number of buffers used by this pool */
++	int buf_num;
++	/* Pool buffer size */
++	int buf_size;
++	/* Packet size */
++	int pkt_size;
++	/* Single frag size */
++	u32 frag_size;
++
++	/* BPPE virtual base address */
++	u32 *virt_addr;
++	/* BPPE physical base address */
++	dma_addr_t phys_addr;
++
++	/* Ports using BM pool */
++	u8 port_map;
++
++	struct mvneta_bm *priv;
++};
++
++/* Declarations and definitions */
++void *mvneta_frag_alloc(unsigned int frag_size);
++void mvneta_frag_free(unsigned int frag_size, void *data);
++
++#if defined(CONFIG_MVNETA_BM) || defined(CONFIG_MVNETA_BM_MODULE)
++void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
++			    struct mvneta_bm_pool *bm_pool, u8 port_map);
++void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++			 u8 port_map);
++int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++		       int buf_num);
++int mvneta_bm_pool_refill(struct mvneta_bm *priv,
++			  struct mvneta_bm_pool *bm_pool);
++struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
++					  enum mvneta_bm_type type, u8 port_id,
++					  int pkt_size);
++
++static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
++					 struct mvneta_bm_pool *bm_pool,
++					 dma_addr_t buf_phys_addr)
++{
++	writel_relaxed(buf_phys_addr, priv->bppi_virt_addr +
++		       (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
++}
++
++static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
++					struct mvneta_bm_pool *bm_pool)
++{
++	return readl_relaxed(priv->bppi_virt_addr +
++			     (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
++}
++#else
++void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
++			    struct mvneta_bm_pool *bm_pool, u8 port_map) {}
++void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++			 u8 port_map) {}
++int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
++		       int buf_num) { return 0; }
++int mvneta_bm_pool_refill(struct mvneta_bm *priv,
++			  struct mvneta_bm_pool *bm_pool) {return 0; }
++struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
++					  enum mvneta_bm_type type, u8 port_id,
++					  int pkt_size) { return NULL; }
++
++static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
++					 struct mvneta_bm_pool *bm_pool,
++					 dma_addr_t buf_phys_addr) {}
++
++static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
++					struct mvneta_bm_pool *bm_pool)
++{ return 0; }
++#endif /* CONFIG_MVNETA_BM */
++#endif
diff --git a/target/linux/mvebu/patches-4.4/046-net-mvneta-Use-the-new-hwbm-framework.patch b/target/linux/mvebu/patches-4.4/046-net-mvneta-Use-the-new-hwbm-framework.patch
new file mode 100644
index 0000000..210504c
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/046-net-mvneta-Use-the-new-hwbm-framework.patch
@@ -0,0 +1,359 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Mon, 14 Mar 2016 09:39:05 +0100
+Subject: [PATCH] net: mvneta: Use the new hwbm framework
+
+Now that the hardware buffer management framework had been introduced,
+let's use it.
+
+Tested-by: Sebastian Careba <nitroshift at yahoo.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/Kconfig
++++ b/drivers/net/ethernet/marvell/Kconfig
+@@ -43,6 +43,7 @@ config MVMDIO
+ config MVNETA_BM
+ 	tristate "Marvell Armada 38x/XP network interface BM support"
+ 	depends on MVNETA
++	select HWBM
+ 	---help---
+ 	  This driver supports auxiliary block of the network
+ 	  interface units in the Marvell ARMADA XP and ARMADA 38x SoC
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -30,6 +30,7 @@
+ #include <linux/phy.h>
+ #include <linux/platform_device.h>
+ #include <linux/skbuff.h>
++#include <net/hwbm.h>
+ #include "mvneta_bm.h"
+ #include <net/ip.h>
+ #include <net/ipv6.h>
+@@ -1024,11 +1025,12 @@ static int mvneta_bm_port_init(struct pl
+ static void mvneta_bm_update_mtu(struct mvneta_port *pp, int mtu)
+ {
+ 	struct mvneta_bm_pool *bm_pool = pp->pool_long;
++	struct hwbm_pool *hwbm_pool = &bm_pool->hwbm_pool;
+ 	int num;
+ 
+ 	/* Release all buffers from long pool */
+ 	mvneta_bm_bufs_free(pp->bm_priv, bm_pool, 1 << pp->id);
+-	if (bm_pool->buf_num) {
++	if (hwbm_pool->buf_num) {
+ 		WARN(1, "cannot free all buffers in pool %d\n",
+ 		     bm_pool->id);
+ 		goto bm_mtu_err;
+@@ -1036,14 +1038,14 @@ static void mvneta_bm_update_mtu(struct
+ 
+ 	bm_pool->pkt_size = MVNETA_RX_PKT_SIZE(mtu);
+ 	bm_pool->buf_size = MVNETA_RX_BUF_SIZE(bm_pool->pkt_size);
+-	bm_pool->frag_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
+-			  SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(bm_pool->pkt_size));
++	hwbm_pool->frag_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
++			SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(bm_pool->pkt_size));
+ 
+ 	/* Fill entire long pool */
+-	num = mvneta_bm_bufs_add(pp->bm_priv, bm_pool, bm_pool->size);
+-	if (num != bm_pool->size) {
++	num = hwbm_pool_add(hwbm_pool, hwbm_pool->size, GFP_ATOMIC);
++	if (num != hwbm_pool->size) {
+ 		WARN(1, "pool %d: %d of %d allocated\n",
+-		     bm_pool->id, num, bm_pool->size);
++		     bm_pool->id, num, hwbm_pool->size);
+ 		goto bm_mtu_err;
+ 	}
+ 	mvneta_bm_pool_bufsize_set(pp, bm_pool->buf_size, bm_pool->id);
+@@ -2064,14 +2066,14 @@ err_drop_frame:
+ 		}
+ 
+ 		/* Refill processing */
+-		err = mvneta_bm_pool_refill(pp->bm_priv, bm_pool);
++		err = hwbm_pool_refill(&bm_pool->hwbm_pool, GFP_ATOMIC);
+ 		if (err) {
+ 			netdev_err(dev, "Linux processing - Can't refill\n");
+ 			rxq->missed++;
+ 			goto err_drop_frame_ret_pool;
+ 		}
+ 
+-		frag_size = bm_pool->frag_size;
++		frag_size = bm_pool->hwbm_pool.frag_size;
+ 
+ 		skb = build_skb(data, frag_size > PAGE_SIZE ? 0 : frag_size);
+ 
+--- a/drivers/net/ethernet/marvell/mvneta_bm.c
++++ b/drivers/net/ethernet/marvell/mvneta_bm.c
+@@ -10,16 +10,17 @@
+  * warranty of any kind, whether express or implied.
+  */
+ 
+-#include <linux/kernel.h>
++#include <linux/clk.h>
+ #include <linux/genalloc.h>
+-#include <linux/platform_device.h>
+-#include <linux/netdevice.h>
+-#include <linux/skbuff.h>
++#include <linux/io.h>
++#include <linux/kernel.h>
+ #include <linux/mbus.h>
+ #include <linux/module.h>
+-#include <linux/io.h>
++#include <linux/netdevice.h>
+ #include <linux/of.h>
+-#include <linux/clk.h>
++#include <linux/platform_device.h>
++#include <linux/skbuff.h>
++#include <net/hwbm.h>
+ #include "mvneta_bm.h"
+ 
+ #define MVNETA_BM_DRIVER_NAME "mvneta_bm"
+@@ -88,17 +89,13 @@ static void mvneta_bm_pool_target_set(st
+ 	mvneta_bm_write(priv, MVNETA_BM_XBAR_POOL_REG(pool_id), val);
+ }
+ 
+-/* Allocate skb for BM pool */
+-void *mvneta_buf_alloc(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
+-		       dma_addr_t *buf_phys_addr)
++int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf)
+ {
+-	void *buf;
++	struct mvneta_bm_pool *bm_pool =
++		(struct mvneta_bm_pool *)hwbm_pool->priv;
++	struct mvneta_bm *priv = bm_pool->priv;
+ 	dma_addr_t phys_addr;
+ 
+-	buf = mvneta_frag_alloc(bm_pool->frag_size);
+-	if (!buf)
+-		return NULL;
+-
+ 	/* In order to update buf_cookie field of RX descriptor properly,
+ 	 * BM hardware expects buf virtual address to be placed in the
+ 	 * first four bytes of mapped buffer.
+@@ -106,75 +103,13 @@ void *mvneta_buf_alloc(struct mvneta_bm
+ 	*(u32 *)buf = (u32)buf;
+ 	phys_addr = dma_map_single(&priv->pdev->dev, buf, bm_pool->buf_size,
+ 				   DMA_FROM_DEVICE);
+-	if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr))) {
+-		mvneta_frag_free(bm_pool->frag_size, buf);
+-		return NULL;
+-	}
+-	*buf_phys_addr = phys_addr;
+-
+-	return buf;
+-}
+-
+-/* Refill processing for HW buffer management */
+-int mvneta_bm_pool_refill(struct mvneta_bm *priv,
+-			  struct mvneta_bm_pool *bm_pool)
+-{
+-	dma_addr_t buf_phys_addr;
+-	void *buf;
+-
+-	buf = mvneta_buf_alloc(priv, bm_pool, &buf_phys_addr);
+-	if (!buf)
++	if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr)))
+ 		return -ENOMEM;
+ 
+-	mvneta_bm_pool_put_bp(priv, bm_pool, buf_phys_addr);
+-
++	mvneta_bm_pool_put_bp(priv, bm_pool, phys_addr);
+ 	return 0;
+ }
+-EXPORT_SYMBOL_GPL(mvneta_bm_pool_refill);
+-
+-/* Allocate buffers for the pool */
+-int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
+-		       int buf_num)
+-{
+-	int err, i;
+-
+-	if (bm_pool->buf_num == bm_pool->size) {
+-		dev_dbg(&priv->pdev->dev, "pool %d already filled\n",
+-			bm_pool->id);
+-		return bm_pool->buf_num;
+-	}
+-
+-	if (buf_num < 0 ||
+-	    (buf_num + bm_pool->buf_num > bm_pool->size)) {
+-		dev_err(&priv->pdev->dev,
+-			"cannot allocate %d buffers for pool %d\n",
+-			buf_num, bm_pool->id);
+-		return 0;
+-	}
+-
+-	for (i = 0; i < buf_num; i++) {
+-		err = mvneta_bm_pool_refill(priv, bm_pool);
+-		if (err < 0)
+-			break;
+-	}
+-
+-	/* Update BM driver with number of buffers added to pool */
+-	bm_pool->buf_num += i;
+-
+-	dev_dbg(&priv->pdev->dev,
+-		"%s pool %d: pkt_size=%4d, buf_size=%4d, frag_size=%4d\n",
+-		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
+-		bm_pool->id, bm_pool->pkt_size, bm_pool->buf_size,
+-		bm_pool->frag_size);
+-
+-	dev_dbg(&priv->pdev->dev,
+-		"%s pool %d: %d of %d buffers added\n",
+-		bm_pool->type == MVNETA_BM_SHORT ? "short" : "long",
+-		bm_pool->id, i, buf_num);
+-
+-	return i;
+-}
+-EXPORT_SYMBOL_GPL(mvneta_bm_bufs_add);
++EXPORT_SYMBOL_GPL(mvneta_bm_construct);
+ 
+ /* Create pool */
+ static int mvneta_bm_pool_create(struct mvneta_bm *priv,
+@@ -183,8 +118,7 @@ static int mvneta_bm_pool_create(struct
+ 	struct platform_device *pdev = priv->pdev;
+ 	u8 target_id, attr;
+ 	int size_bytes, err;
+-
+-	size_bytes = sizeof(u32) * bm_pool->size;
++	size_bytes = sizeof(u32) * bm_pool->hwbm_pool.size;
+ 	bm_pool->virt_addr = dma_alloc_coherent(&pdev->dev, size_bytes,
+ 						&bm_pool->phys_addr,
+ 						GFP_KERNEL);
+@@ -245,11 +179,16 @@ struct mvneta_bm_pool *mvneta_bm_pool_us
+ 
+ 	/* Allocate buffers in case BM pool hasn't been used yet */
+ 	if (new_pool->type == MVNETA_BM_FREE) {
++		struct hwbm_pool *hwbm_pool = &new_pool->hwbm_pool;
++
++		new_pool->priv = priv;
+ 		new_pool->type = type;
+ 		new_pool->buf_size = MVNETA_RX_BUF_SIZE(new_pool->pkt_size);
+-		new_pool->frag_size =
++		hwbm_pool->frag_size =
+ 			SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(new_pool->pkt_size)) +
+ 			SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
++		hwbm_pool->construct = mvneta_bm_construct;
++		hwbm_pool->priv = new_pool;
+ 
+ 		/* Create new pool */
+ 		err = mvneta_bm_pool_create(priv, new_pool);
+@@ -260,10 +199,10 @@ struct mvneta_bm_pool *mvneta_bm_pool_us
+ 		}
+ 
+ 		/* Allocate buffers for this pool */
+-		num = mvneta_bm_bufs_add(priv, new_pool, new_pool->size);
+-		if (num != new_pool->size) {
++		num = hwbm_pool_add(hwbm_pool, hwbm_pool->size, GFP_ATOMIC);
++		if (num != hwbm_pool->size) {
+ 			WARN(1, "pool %d: %d of %d allocated\n",
+-			     new_pool->id, num, new_pool->size);
++			     new_pool->id, num, hwbm_pool->size);
+ 			return NULL;
+ 		}
+ 	}
+@@ -284,7 +223,7 @@ void mvneta_bm_bufs_free(struct mvneta_b
+ 
+ 	mvneta_bm_config_set(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
+ 
+-	for (i = 0; i < bm_pool->buf_num; i++) {
++	for (i = 0; i < bm_pool->hwbm_pool.buf_num; i++) {
+ 		dma_addr_t buf_phys_addr;
+ 		u32 *vaddr;
+ 
+@@ -303,13 +242,13 @@ void mvneta_bm_bufs_free(struct mvneta_b
+ 
+ 		dma_unmap_single(&priv->pdev->dev, buf_phys_addr,
+ 				 bm_pool->buf_size, DMA_FROM_DEVICE);
+-		mvneta_frag_free(bm_pool->frag_size, vaddr);
++		hwbm_buf_free(&bm_pool->hwbm_pool, vaddr);
+ 	}
+ 
+ 	mvneta_bm_config_clear(priv, MVNETA_BM_EMPTY_LIMIT_MASK);
+ 
+ 	/* Update BM driver with number of buffers removed from pool */
+-	bm_pool->buf_num -= i;
++	bm_pool->hwbm_pool.buf_num -= i;
+ }
+ EXPORT_SYMBOL_GPL(mvneta_bm_bufs_free);
+ 
+@@ -317,6 +256,7 @@ EXPORT_SYMBOL_GPL(mvneta_bm_bufs_free);
+ void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
+ 			    struct mvneta_bm_pool *bm_pool, u8 port_map)
+ {
++	struct hwbm_pool *hwbm_pool = &bm_pool->hwbm_pool;
+ 	bm_pool->port_map &= ~port_map;
+ 	if (bm_pool->port_map)
+ 		return;
+@@ -324,11 +264,12 @@ void mvneta_bm_pool_destroy(struct mvnet
+ 	bm_pool->type = MVNETA_BM_FREE;
+ 
+ 	mvneta_bm_bufs_free(priv, bm_pool, port_map);
+-	if (bm_pool->buf_num)
++	if (hwbm_pool->buf_num)
+ 		WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id);
+ 
+ 	if (bm_pool->virt_addr) {
+-		dma_free_coherent(&priv->pdev->dev, sizeof(u32) * bm_pool->size,
++		dma_free_coherent(&priv->pdev->dev,
++				  sizeof(u32) * hwbm_pool->size,
+ 				  bm_pool->virt_addr, bm_pool->phys_addr);
+ 		bm_pool->virt_addr = NULL;
+ 	}
+@@ -381,10 +322,10 @@ static void mvneta_bm_pools_init(struct
+ 				 MVNETA_BM_POOL_CAP_ALIGN));
+ 			size = ALIGN(size, MVNETA_BM_POOL_CAP_ALIGN);
+ 		}
+-		bm_pool->size = size;
++		bm_pool->hwbm_pool.size = size;
+ 
+ 		mvneta_bm_write(priv, MVNETA_BM_POOL_SIZE_REG(i),
+-				bm_pool->size);
++				bm_pool->hwbm_pool.size);
+ 
+ 		/* Obtain custom pkt_size from DT */
+ 		sprintf(prop, "pool%d,pkt-size", i);
+--- a/drivers/net/ethernet/marvell/mvneta_bm.h
++++ b/drivers/net/ethernet/marvell/mvneta_bm.h
+@@ -108,20 +108,15 @@ struct mvneta_bm {
+ };
+ 
+ struct mvneta_bm_pool {
++	struct hwbm_pool hwbm_pool;
+ 	/* Pool number in the range 0-3 */
+ 	u8 id;
+ 	enum mvneta_bm_type type;
+ 
+-	/* Buffer Pointers Pool External (BPPE) size in number of bytes */
+-	int size;
+-	/* Number of buffers used by this pool */
+-	int buf_num;
+-	/* Pool buffer size */
+-	int buf_size;
+ 	/* Packet size */
+ 	int pkt_size;
+-	/* Single frag size */
+-	u32 frag_size;
++	/* Size of the buffer acces through DMA*/
++	u32 buf_size;
+ 
+ 	/* BPPE virtual base address */
+ 	u32 *virt_addr;
+@@ -143,8 +138,7 @@ void mvneta_bm_pool_destroy(struct mvnet
+ 			    struct mvneta_bm_pool *bm_pool, u8 port_map);
+ void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
+ 			 u8 port_map);
+-int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
+-		       int buf_num);
++int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf);
+ int mvneta_bm_pool_refill(struct mvneta_bm *priv,
+ 			  struct mvneta_bm_pool *bm_pool);
+ struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
+@@ -170,8 +164,7 @@ void mvneta_bm_pool_destroy(struct mvnet
+ 			    struct mvneta_bm_pool *bm_pool, u8 port_map) {}
+ void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
+ 			 u8 port_map) {}
+-int mvneta_bm_bufs_add(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
+-		       int buf_num) { return 0; }
++int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; }
+ int mvneta_bm_pool_refill(struct mvneta_bm *priv,
+ 			  struct mvneta_bm_pool *bm_pool) {return 0; }
+ struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
diff --git a/target/linux/mvebu/patches-4.4/047-net-mvneta-Fix-spinlock-usage.patch b/target/linux/mvebu/patches-4.4/047-net-mvneta-Fix-spinlock-usage.patch
new file mode 100644
index 0000000..a8e78df
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/047-net-mvneta-Fix-spinlock-usage.patch
@@ -0,0 +1,52 @@
+From: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Date: Sat, 12 Mar 2016 18:44:17 +0100
+Subject: [PATCH] net: mvneta: Fix spinlock usage
+
+In the previous patch, the spinlock was not initialized. While it didn't
+cause any trouble yet it could be a problem to use it uninitialized.
+
+The most annoying part was the critical section protected by the spinlock
+in mvneta_stop(). Some of the functions could sleep as pointed when
+activated CONFIG_DEBUG_ATOMIC_SLEEP. Actually, in mvneta_stop() we only
+need to protect the is_stopped flagged, indeed the code of the notifier
+for CPU online is protected by the same spinlock, so when we get the
+lock, the notifer work is done.
+
+Reported-by: Patrick Uiterwijk <patrick at puiterwijk.org>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3484,17 +3484,17 @@ static int mvneta_stop(struct net_device
+ 	struct mvneta_port *pp = netdev_priv(dev);
+ 
+ 	/* Inform that we are stopping so we don't want to setup the
+-	 * driver for new CPUs in the notifiers
++	 * driver for new CPUs in the notifiers. The code of the
++	 * notifier for CPU online is protected by the same spinlock,
++	 * so when we get the lock, the notifer work is done.
+ 	 */
+ 	spin_lock(&pp->lock);
+ 	pp->is_stopped = true;
++	spin_unlock(&pp->lock);
++
+ 	mvneta_stop_dev(pp);
+ 	mvneta_mdio_remove(pp);
+ 	unregister_cpu_notifier(&pp->cpu_notifier);
+-	/* Now that the notifier are unregistered, we can release le
+-	 * lock
+-	 */
+-	spin_unlock(&pp->lock);
+ 	on_each_cpu(mvneta_percpu_disable, pp, true);
+ 	free_percpu_irq(dev->irq, pp->ports);
+ 	mvneta_cleanup_rxqs(pp);
+@@ -4027,6 +4027,7 @@ static int mvneta_probe(struct platform_
+ 	dev->ethtool_ops = &mvneta_eth_tool_ops;
+ 
+ 	pp = netdev_priv(dev);
++	spin_lock_init(&pp->lock);
+ 	pp->phy_node = phy_node;
+ 	pp->phy_interface = phy_mode;
+ 
diff --git a/target/linux/mvebu/patches-4.4/048-net-mvneta-fix-error-messages-in-mvneta_port_down-fu.patch b/target/linux/mvebu/patches-4.4/048-net-mvneta-fix-error-messages-in-mvneta_port_down-fu.patch
new file mode 100644
index 0000000..fd1f1ae
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/048-net-mvneta-fix-error-messages-in-mvneta_port_down-fu.patch
@@ -0,0 +1,33 @@
+From: Dmitri Epshtein <dima at marvell.com>
+Date: Sat, 12 Mar 2016 18:44:19 +0100
+Subject: [PATCH] net: mvneta: fix error messages in mvneta_port_down function
+
+This commit corrects error printing when shutting down the port.
+
+[gregory.clement at free-electrons.com: split initial commit in two
+individual changes]
+Signed-off-by: Dmitri Epshtein <dima at marvell.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -1105,7 +1105,7 @@ static void mvneta_port_down(struct mvne
+ 	do {
+ 		if (count++ >= MVNETA_RX_DISABLE_TIMEOUT_MSEC) {
+ 			netdev_warn(pp->dev,
+-				    "TIMEOUT for RX stopped ! rx_queue_cmd: 0x08%x\n",
++				    "TIMEOUT for RX stopped ! rx_queue_cmd: 0x%08x\n",
+ 				    val);
+ 			break;
+ 		}
+@@ -1144,7 +1144,7 @@ static void mvneta_port_down(struct mvne
+ 	do {
+ 		if (count++ >= MVNETA_TX_FIFO_EMPTY_TIMEOUT) {
+ 			netdev_warn(pp->dev,
+-				    "TX FIFO empty timeout status=0x08%x\n",
++				    "TX FIFO empty timeout status=0x%08x\n",
+ 				    val);
+ 			break;
+ 		}
diff --git a/target/linux/mvebu/patches-4.4/049-net-mvneta-replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch b/target/linux/mvebu/patches-4.4/049-net-mvneta-replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch
new file mode 100644
index 0000000..c12d98a
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/049-net-mvneta-replace-MVNETA_CPU_D_CACHE_LINE_SIZE-with.patch
@@ -0,0 +1,56 @@
+From: Jisheng Zhang <jszhang at marvell.com>
+Date: Wed, 30 Mar 2016 19:55:21 +0800
+Subject: [PATCH] net: mvneta: replace MVNETA_CPU_D_CACHE_LINE_SIZE with
+ L1_CACHE_BYTES
+
+The mvneta is also used in some Marvell berlin family SoCs which may
+have 64bytes cacheline size. Replace the MVNETA_CPU_D_CACHE_LINE_SIZE
+usage with L1_CACHE_BYTES.
+
+And since dma_alloc_coherent() is always cacheline size aligned, so
+remove the align checks.
+
+Signed-off-by: Jisheng Zhang <jszhang at marvell.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -260,7 +260,6 @@
+ 
+ #define MVNETA_VLAN_TAG_LEN             4
+ 
+-#define MVNETA_CPU_D_CACHE_LINE_SIZE    32
+ #define MVNETA_TX_CSUM_DEF_SIZE		1600
+ #define MVNETA_TX_CSUM_MAX_SIZE		9800
+ #define MVNETA_ACC_MODE_EXT1		1
+@@ -300,7 +299,7 @@
+ #define MVNETA_RX_PKT_SIZE(mtu) \
+ 	ALIGN((mtu) + MVNETA_MH_SIZE + MVNETA_VLAN_TAG_LEN + \
+ 	      ETH_HLEN + ETH_FCS_LEN,			     \
+-	      MVNETA_CPU_D_CACHE_LINE_SIZE)
++	      L1_CACHE_BYTES)
+ 
+ #define IS_TSO_HEADER(txq, addr) \
+ 	((addr >= txq->tso_hdrs_phys) && \
+@@ -2762,9 +2761,6 @@ static int mvneta_rxq_init(struct mvneta
+ 	if (rxq->descs == NULL)
+ 		return -ENOMEM;
+ 
+-	BUG_ON(rxq->descs !=
+-	       PTR_ALIGN(rxq->descs, MVNETA_CPU_D_CACHE_LINE_SIZE));
+-
+ 	rxq->last_desc = rxq->size - 1;
+ 
+ 	/* Set Rx descriptors queue starting address */
+@@ -2835,10 +2831,6 @@ static int mvneta_txq_init(struct mvneta
+ 	if (txq->descs == NULL)
+ 		return -ENOMEM;
+ 
+-	/* Make sure descriptor address is cache line size aligned  */
+-	BUG_ON(txq->descs !=
+-	       PTR_ALIGN(txq->descs, MVNETA_CPU_D_CACHE_LINE_SIZE));
+-
+ 	txq->last_desc = txq->size - 1;
+ 
+ 	/* Set maximum bandwidth for enabled TXQs */
diff --git a/target/linux/mvebu/patches-4.4/050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch b/target/linux/mvebu/patches-4.4/050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch
new file mode 100644
index 0000000..0786200
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch
@@ -0,0 +1,75 @@
+From: Marcin Wojtas <mw at semihalf.com>
+Date: Fri, 1 Apr 2016 15:21:18 +0200
+Subject: [PATCH] net: mvneta: fix changing MTU when using per-cpu processing
+
+After enabling per-cpu processing it appeared that under heavy load
+changing MTU can result in blocking all port's interrupts and
+transmitting data is not possible after the change.
+
+This commit fixes above issue by disabling percpu interrupts for the
+time, when TXQs and RXQs are reconfigured.
+
+Signed-off-by: Marcin Wojtas <mw at semihalf.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3040,6 +3040,20 @@ static int mvneta_check_mtu_valid(struct
+ 	return mtu;
+ }
+ 
++static void mvneta_percpu_enable(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
++}
++
++static void mvneta_percpu_disable(void *arg)
++{
++	struct mvneta_port *pp = arg;
++
++	disable_percpu_irq(pp->dev->irq);
++}
++
+ /* Change the device mtu */
+ static int mvneta_change_mtu(struct net_device *dev, int mtu)
+ {
+@@ -3064,6 +3078,7 @@ static int mvneta_change_mtu(struct net_
+ 	 * reallocation of the queues
+ 	 */
+ 	mvneta_stop_dev(pp);
++	on_each_cpu(mvneta_percpu_disable, pp, true);
+ 
+ 	mvneta_cleanup_txqs(pp);
+ 	mvneta_cleanup_rxqs(pp);
+@@ -3087,6 +3102,7 @@ static int mvneta_change_mtu(struct net_
+ 		return ret;
+ 	}
+ 
++	on_each_cpu(mvneta_percpu_enable, pp, true);
+ 	mvneta_start_dev(pp);
+ 	mvneta_port_up(pp);
+ 
+@@ -3240,20 +3256,6 @@ static void mvneta_mdio_remove(struct mv
+ 	pp->phy_dev = NULL;
+ }
+ 
+-static void mvneta_percpu_enable(void *arg)
+-{
+-	struct mvneta_port *pp = arg;
+-
+-	enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
+-}
+-
+-static void mvneta_percpu_disable(void *arg)
+-{
+-	struct mvneta_port *pp = arg;
+-
+-	disable_percpu_irq(pp->dev->irq);
+-}
+-
+ /* Electing a CPU must be done in an atomic way: it should be done
+  * after or before the removal/insertion of a CPU and this function is
+  * not reentrant.
diff --git a/target/linux/mvebu/patches-4.4/051-ARM-dts-armada-38x-add-buffer-manager-nodes.patch b/target/linux/mvebu/patches-4.4/051-ARM-dts-armada-38x-add-buffer-manager-nodes.patch
new file mode 100644
index 0000000..b56de94
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/051-ARM-dts-armada-38x-add-buffer-manager-nodes.patch
@@ -0,0 +1,53 @@
+From: Marcin Wojtas <mw at semihalf.com>
+Date: Mon, 14 Mar 2016 09:38:57 +0100
+Subject: [PATCH] ARM: dts: armada-38x: add buffer manager nodes
+
+Armada 38x network controller supports hardware buffer management (BM).
+Since it is now enabled in mvneta driver, appropriate nodes can be added
+to armada-38x.dtsi - for the actual common BM unit (bm at c8000) and its
+internal SRAM (bm-bppi), which is used for indirect access to buffer
+pointer ring residing in DRAM.
+
+Pools - ports mapping, bm-bppi entry in 'soc' node's ranges and optional
+parameters are supposed to be set in board files.
+
+Signed-off-by: Marcin Wojtas <mw at semihalf.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/arch/arm/boot/dts/armada-38x.dtsi
++++ b/arch/arm/boot/dts/armada-38x.dtsi
+@@ -540,6 +540,14 @@
+ 				status = "disabled";
+ 			};
+ 
++			bm: bm at c8000 {
++				compatible = "marvell,armada-380-neta-bm";
++				reg = <0xc8000 0xac>;
++				clocks = <&gateclk 13>;
++				internal-mem = <&bm_bppi>;
++				status = "disabled";
++			};
++
+ 			sata at e0000 {
+ 				compatible = "marvell,armada-380-ahci";
+ 				reg = <0xe0000 0x2000>;
+@@ -618,6 +626,17 @@
+ 			#size-cells = <1>;
+ 			ranges = <0 MBUS_ID(0x09, 0x15) 0 0x800>;
+ 		};
++
++		bm_bppi: bm-bppi {
++			compatible = "mmio-sram";
++			reg = <MBUS_ID(0x0c, 0x04) 0 0x100000>;
++			ranges = <0 MBUS_ID(0x0c, 0x04) 0 0x100000>;
++			#address-cells = <1>;
++			#size-cells = <1>;
++			clocks = <&gateclk 13>;
++			no-memory-wc;
++			status = "disabled";
++		};
+ 	};
+ 
+ 	clocks {
diff --git a/target/linux/mvebu/patches-4.4/052-ARM-dts-armada-xp-add-buffer-manager-nodes.patch b/target/linux/mvebu/patches-4.4/052-ARM-dts-armada-xp-add-buffer-manager-nodes.patch
new file mode 100644
index 0000000..65fafd7
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/052-ARM-dts-armada-xp-add-buffer-manager-nodes.patch
@@ -0,0 +1,53 @@
+From: Marcin Wojtas <mw at semihalf.com>
+Date: Mon, 14 Mar 2016 09:38:59 +0100
+Subject: [PATCH] ARM: dts: armada-xp: add buffer manager nodes
+
+Armada XP network controller supports hardware buffer management (BM).
+Since it is now enabled in mvneta driver, appropriate nodes can be added
+to armada-xp.dtsi - for the actual common BM unit (bm at c0000) and its
+internal SRAM (bm-bppi), which is used for indirect access to buffer
+pointer ring residing in DRAM.
+
+Pools - ports mapping, bm-bppi entry in 'soc' node's ranges and optional
+parameters are supposed to be set in board files.
+
+Signed-off-by: Marcin Wojtas <mw at semihalf.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+
+--- a/arch/arm/boot/dts/armada-xp.dtsi
++++ b/arch/arm/boot/dts/armada-xp.dtsi
+@@ -253,6 +253,14 @@
+ 				marvell,crypto-sram-size = <0x800>;
+ 			};
+ 
++			bm: bm at c0000 {
++				compatible = "marvell,armada-380-neta-bm";
++				reg = <0xc0000 0xac>;
++				clocks = <&gateclk 13>;
++				internal-mem = <&bm_bppi>;
++				status = "disabled";
++			};
++
+ 			xor at f0900 {
+ 				compatible = "marvell,orion-xor";
+ 				reg = <0xF0900 0x100
+@@ -291,6 +299,17 @@
+ 			#size-cells = <1>;
+ 			ranges = <0 MBUS_ID(0x09, 0x05) 0 0x800>;
+ 		};
++
++		bm_bppi: bm-bppi {
++			compatible = "mmio-sram";
++			reg = <MBUS_ID(0x0c, 0x04) 0 0x100000>;
++			ranges = <0 MBUS_ID(0x0c, 0x04) 0 0x100000>;
++			#address-cells = <1>;
++			#size-cells = <1>;
++			clocks = <&gateclk 13>;
++			no-memory-wc;
++			status = "disabled";
++		};
+ 	};
+ 
+ 	clocks {
diff --git a/target/linux/mvebu/patches-4.4/053-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch b/target/linux/mvebu/patches-4.4/053-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch
new file mode 100644
index 0000000..b25d710
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/053-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch
@@ -0,0 +1,611 @@
+From 4c945e8556ec7ea5b19d4f8721b212f468656e0d Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 6 Dec 2015 21:52:06 +0000
+Subject: [PATCH] ARM: dts: Add SolidRun Armada 388 Clearfog A1 DT file
+
+Add support for the SolidRun Armada 388 Clearfog A1 board.  This board
+has an Armada 388 microsom, dedicated gigabit ethernet, six switched
+gigabit ethernet ports, SFP cage, two Mini-PCIe/mSATA slots, a m.2 SATA
+slot, and a MikroBUS connector to allow MikroBUS modules to be added.
+
+This DT file adds support for all board facilities with the exception
+of full SFP support.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+Acked-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+---
+ arch/arm/boot/dts/Makefile                         |   1 +
+ arch/arm/boot/dts/armada-388-clearfog.dts          | 456 +++++++++++++++++++++
+ .../arm/boot/dts/armada-38x-solidrun-microsom.dtsi | 115 ++++++
+ 3 files changed, 572 insertions(+)
+ create mode 100644 arch/arm/boot/dts/armada-388-clearfog.dts
+ create mode 100644 arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
+
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -750,6 +750,7 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \
+ 	armada-385-linksys-cobra.dtb \
+ 	armada-385-linksys-rango.dtb \
+ 	armada-385-linksys-shelby.dtb \
++	armada-388-clearfog.dtb \
+ 	armada-388-db.dtb \
+ 	armada-388-gp.dtb \
+ 	armada-388-rd.dtb
+--- /dev/null
++++ b/arch/arm/boot/dts/armada-388-clearfog.dts
+@@ -0,0 +1,456 @@
++/*
++ * Device Tree file for SolidRun Clearfog revision A1 rev 2.0 (88F6828)
++ *
++ *  Copyright (C) 2015 Russell King
++ *
++ * This board is in development; the contents of this file work with
++ * the A1 rev 2.0 of the board, which does not represent final
++ * production board.  Things will change, don't expect this file to
++ * remain compatible info the future.
++ *
++ * This file is dual-licensed: you can use it either under the terms
++ * of the GPL or the X11 license, at your option. Note that this dual
++ * licensing only applies to this file, and not this project as a
++ * whole.
++ *
++ *  a) This file is free software; you can redistribute it and/or
++ *     modify it under the terms of the GNU General Public License
++ *     version 2 as published by the Free Software Foundation.
++ *
++ *     This file is distributed in the hope that it will be useful
++ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *     GNU General Public License for more details.
++ *
++ * Or, alternatively
++ *
++ *  b) Permission is hereby granted, free of charge, to any person
++ *     obtaining a copy of this software and associated documentation
++ *     files (the "Software"), to deal in the Software without
++ *     restriction, including without limitation the rights to use
++ *     copy, modify, merge, publish, distribute, sublicense, and/or
++ *     sell copies of the Software, and to permit persons to whom the
++ *     Software is furnished to do so, subject to the following
++ *     conditions:
++ *
++ *     The above copyright notice and this permission notice shall be
++ *     included in all copies or substantial portions of the Software.
++ *
++ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
++ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
++ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
++ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
++ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
++ *     OTHER DEALINGS IN THE SOFTWARE.
++ */
++
++/dts-v1/;
++#include "armada-388.dtsi"
++#include "armada-38x-solidrun-microsom.dtsi"
++
++/ {
++	model = "SolidRun Clearfog A1";
++	compatible = "solidrun,clearfog-a1", "marvell,armada388",
++		"marvell,armada385", "marvell,armada380";
++
++	aliases {
++		/* So that mvebu u-boot can update the MAC addresses */
++		ethernet1 = &eth0;
++		ethernet2 = &eth1;
++		ethernet3 = &eth2;
++	};
++
++	chosen {
++		stdout-path = "serial0:115200n8";
++	};
++
++	reg_3p3v: regulator-3p3v {
++		compatible = "regulator-fixed";
++		regulator-name = "3P3V";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++		regulator-always-on;
++	};
++
++	soc {
++		internal-regs {
++			ethernet at 30000 {
++				phy-mode = "sgmii";
++				status = "okay";
++
++				fixed-link {
++					speed = <1000>;
++					full-duplex;
++				};
++			};
++
++			ethernet at 34000 {
++				phy-mode = "sgmii";
++				status = "okay";
++
++				fixed-link {
++					speed = <1000>;
++					full-duplex;
++				};
++			};
++
++			i2c at 11000 {
++				/* Is there anything on this? */
++				clock-frequency = <100000>;
++				pinctrl-0 = <&i2c0_pins>;
++				pinctrl-names = "default";
++				status = "okay";
++
++				/*
++				 * PCA9655 GPIO expander, up to 1MHz clock.
++				 *  0-CON3 CLKREQ#
++				 *  1-CON3 PERST#
++				 *  2-CON2 PERST#
++				 *  3-CON3 W_DISABLE
++				 *  4-CON2 CLKREQ#
++				 *  5-USB3 overcurrent
++				 *  6-USB3 power
++				 *  7-CON2 W_DISABLE
++				 *  8-JP4 P1
++				 *  9-JP4 P4
++				 * 10-JP4 P5
++				 * 11-m.2 DEVSLP
++				 * 12-SFP_LOS
++				 * 13-SFP_TX_FAULT
++				 * 14-SFP_TX_DISABLE
++				 * 15-SFP_MOD_DEF0
++				 */
++				expander0: gpio-expander at 20 {
++					/*
++					 * This is how it should be:
++					 * compatible = "onnn,pca9655",
++					 *	 "nxp,pca9555";
++					 * but you can't do this because of
++					 * the way I2C works.
++					 */
++					compatible = "nxp,pca9555";
++					gpio-controller;
++					#gpio-cells = <2>;
++					reg = <0x20>;
++
++					pcie1_0_clkreq {
++						gpio-hog;
++						gpios = <0 GPIO_ACTIVE_LOW>;
++						input;
++						line-name = "pcie1.0-clkreq";
++					};
++					pcie1_0_w_disable {
++						gpio-hog;
++						gpios = <3 GPIO_ACTIVE_LOW>;
++						output-low;
++						line-name = "pcie1.0-w-disable";
++					};
++					pcie2_0_clkreq {
++						gpio-hog;
++						gpios = <4 GPIO_ACTIVE_LOW>;
++						input;
++						line-name = "pcie2.0-clkreq";
++					};
++					pcie2_0_w_disable {
++						gpio-hog;
++						gpios = <7 GPIO_ACTIVE_LOW>;
++						output-low;
++						line-name = "pcie2.0-w-disable";
++					};
++					usb3_ilimit {
++						gpio-hog;
++						gpios = <5 GPIO_ACTIVE_LOW>;
++						input;
++						line-name = "usb3-current-limit";
++					};
++					usb3_power {
++						gpio-hog;
++						gpios = <6 GPIO_ACTIVE_HIGH>;
++						output-high;
++						line-name = "usb3-power";
++					};
++					m2_devslp {
++						gpio-hog;
++						gpios = <11 GPIO_ACTIVE_HIGH>;
++						output-low;
++						line-name = "m.2 devslp";
++					};
++					sfp_los {
++						/* SFP loss of signal */
++						gpio-hog;
++						gpios = <12 GPIO_ACTIVE_HIGH>;
++						input;
++						line-name = "sfp-los";
++					};
++					sfp_tx_fault {
++						/* SFP laser fault */
++						gpio-hog;
++						gpios = <13 GPIO_ACTIVE_HIGH>;
++						input;
++						line-name = "sfp-tx-fault";
++					};
++					sfp_tx_disable {
++						/* SFP transmit disable */
++						gpio-hog;
++						gpios = <14 GPIO_ACTIVE_HIGH>;
++						output-low;
++						line-name = "sfp-tx-disable";
++					};
++					sfp_mod_def0 {
++						/* SFP module present */
++						gpio-hog;
++						gpios = <15 GPIO_ACTIVE_LOW>;
++						input;
++						line-name = "sfp-mod-def0";
++					};
++				};
++
++				/* The MCP3021 is 100kHz clock only */
++				mikrobus_adc: mcp3021 at 4c {
++					compatible = "microchip,mcp3021";
++					reg = <0x4c>;
++				};
++
++				/* Also something at 0x64 */
++			};
++
++			i2c at 11100 {
++				/*
++				 * Routed to SFP, mikrobus, and PCIe.
++				 * SFP limits this to 100kHz, and requires
++				 *  an AT24C01A/02/04 with address pins tied
++				 *  low, which takes addresses 0x50 and 0x51.
++				 * Mikrobus doesn't specify beyond an I2C
++				 *  bus being present.
++				 * PCIe uses ARP to assign addresses, or
++				 *  0x63-0x64.
++				 */
++				clock-frequency = <100000>;
++				pinctrl-0 = <&clearfog_i2c1_pins>;
++				pinctrl-names = "default";
++				status = "okay";
++			};
++
++			mdio at 72004 {
++				pinctrl-0 = <&mdio_pins>;
++				pinctrl-names = "default";
++
++				phy_dedicated: ethernet-phy at 0 {
++					/*
++					 * Annoyingly, the marvell phy driver
++					 * configures the LED register, rather
++					 * than preserving reset-loaded setting.
++					 * We undo that rubbish here.
++					 */
++					marvell,reg-init = <3 16 0 0x101e>;
++					reg = <0>;
++				};
++			};
++
++			pinctrl at 18000 {
++				clearfog_dsa0_clk_pins: clearfog-dsa0-clk-pins {
++					marvell,pins = "mpp46";
++					marvell,function = "ref";
++				};
++				clearfog_dsa0_pins: clearfog-dsa0-pins {
++					marvell,pins = "mpp23", "mpp41";
++					marvell,function = "gpio";
++				};
++				clearfog_i2c1_pins: i2c1-pins {
++					/* SFP, PCIe, mSATA, mikrobus */
++					marvell,pins = "mpp26", "mpp27";
++					marvell,function = "i2c1";
++				};
++				clearfog_sdhci_cd_pins: clearfog-sdhci-cd-pins {
++					marvell,pins = "mpp20";
++					marvell,function = "gpio";
++				};
++				clearfog_sdhci_pins: clearfog-sdhci-pins {
++					marvell,pins = "mpp21", "mpp28",
++						       "mpp37", "mpp38",
++						       "mpp39", "mpp40";
++					marvell,function = "sd0";
++				};
++				clearfog_spi1_cs_pins: spi1-cs-pins {
++					marvell,pins = "mpp55";
++					marvell,function = "spi1";
++				};
++				mikro_pins: mikro-pins {
++					/* int: mpp22 rst: mpp29 */
++					marvell,pins = "mpp22", "mpp29";
++					marvell,function = "gpio";
++				};
++				mikro_spi_pins: mikro-spi-pins {
++					marvell,pins = "mpp43";
++					marvell,function = "spi1";
++				};
++				mikro_uart_pins: mikro-uart-pins {
++					marvell,pins = "mpp24", "mpp25";
++					marvell,function = "ua1";
++				};
++				rear_button_pins: rear-button-pins {
++					marvell,pins = "mpp34";
++					marvell,function = "gpio";
++				};
++			};
++
++			sata at a8000 {
++				/* pinctrl? */
++				status = "okay";
++			};
++
++			sata at e0000 {
++				/* pinctrl? */
++				status = "okay";
++			};
++
++			sdhci at d8000 {
++				bus-width = <4>;
++				cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
++				no-1-8-v;
++				pinctrl-0 = <&clearfog_sdhci_pins
++					     &clearfog_sdhci_cd_pins>;
++				pinctrl-names = "default";
++				status = "okay";
++				vmmc = <&reg_3p3v>;
++				wp-inverted;
++			};
++
++			serial at 12100 {
++				/* mikrobus uart */
++				pinctrl-0 = <&mikro_uart_pins>;
++				pinctrl-names = "default";
++				status = "okay";
++			};
++
++			spi at 10680 {
++				/*
++				 * We don't seem to have the W25Q32 on the
++				 * A1 Rev 2.0 boards, so disable SPI.
++				 * CS0: W25Q32 (doesn't appear to be present)
++				 * CS1:
++				 * CS2: mikrobus
++				 */
++				pinctrl-0 = <&spi1_pins
++					     &clearfog_spi1_cs_pins
++					     &mikro_spi_pins>;
++				pinctrl-names = "default";
++				status = "okay";
++
++				spi-flash at 0 {
++					#address-cells = <1>;
++					#size-cells = <0>;
++					compatible = "w25q32", "jedec,spi-nor";
++					reg = <0>; /* Chip select 0 */
++					spi-max-frequency = <3000000>;
++					status = "disabled";
++				};
++			};
++
++			usb at 58000 {
++				/* CON3, nearest  power. */
++				status = "okay";
++			};
++
++			usb3 at f0000 {
++				/* CON2, nearest CPU, USB2 only. */
++				status = "okay";
++			};
++
++			usb3 at f8000 {
++				/* CON7 */
++				status = "okay";
++			};
++		};
++
++		pcie-controller {
++			status = "okay";
++			/*
++			 * The two PCIe units are accessible through
++			 * the mini-PCIe connectors on the board.
++			 */
++			pcie at 2,0 {
++				/* Port 1, Lane 0. CON3, nearest power. */
++				reset-gpios = <&expander0 1 GPIO_ACTIVE_LOW>;
++				status = "okay";
++			};
++			pcie at 3,0 {
++				/* Port 2, Lane 0. CON2, nearest CPU. */
++				reset-gpios = <&expander0 2 GPIO_ACTIVE_LOW>;
++				status = "okay";
++			};
++		};
++	};
++
++	dsa at 0 {
++		compatible = "marvell,dsa";
++		dsa,ethernet = <&eth1>;
++		dsa,mii-bus = <&mdio>;
++		pinctrl-0 = <&clearfog_dsa0_clk_pins &clearfog_dsa0_pins>;
++		pinctrl-names = "default";
++		#address-cells = <2>;
++		#size-cells = <0>;
++
++		switch at 0 {
++			#address-cells = <1>;
++			#size-cells = <0>;
++			reg = <4 0>;
++
++			port at 0 {
++				reg = <0>;
++				label = "lan1";
++			};
++
++			port at 1 {
++				reg = <1>;
++				label = "lan2";
++			};
++
++			port at 2 {
++				reg = <2>;
++				label = "lan3";
++			};
++
++			port at 3 {
++				reg = <3>;
++				label = "lan4";
++			};
++
++			port at 4 {
++				reg = <4>;
++				label = "lan5";
++			};
++
++			port at 5 {
++				reg = <5>;
++				label = "cpu";
++			};
++
++			port at 6 {
++				/* 88E1512 external phy */
++				reg = <6>;
++				label = "lan6";
++				fixed-link {
++					speed = <1000>;
++					full-duplex;
++				};
++			};
++		};
++	};
++
++	gpio-keys {
++		compatible = "gpio-keys";
++		pinctrl-0 = <&rear_button_pins>;
++		pinctrl-names = "default";
++
++		button_0 {
++			/* The rear SW3 button */
++			label = "Rear Button";
++			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
++			linux,can-disable;
++			linux,code = <BTN_0>;
++		};
++	};
++};
+--- /dev/null
++++ b/arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
+@@ -0,0 +1,115 @@
++/*
++ * Device Tree file for SolidRun Armada 38x Microsom
++ *
++ *  Copyright (C) 2015 Russell King
++ *
++ * This board is in development; the contents of this file work with
++ * the A1 rev 2.0 of the board, which does not represent final
++ * production board.  Things will change, don't expect this file to
++ * remain compatible info the future.
++ *
++ * This file is dual-licensed: you can use it either under the terms
++ * of the GPL or the X11 license, at your option. Note that this dual
++ * licensing only applies to this file, and not this project as a
++ * whole.
++ *
++ *  a) This file is free software; you can redistribute it and/or
++ *     modify it under the terms of the GNU General Public License
++ *     version 2 as published by the Free Software Foundation.
++ *
++ *     This file is distributed in the hope that it will be useful
++ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *     GNU General Public License for more details.
++ *
++ * Or, alternatively
++ *
++ *  b) Permission is hereby granted, free of charge, to any person
++ *     obtaining a copy of this software and associated documentation
++ *     files (the "Software"), to deal in the Software without
++ *     restriction, including without limitation the rights to use
++ *     copy, modify, merge, publish, distribute, sublicense, and/or
++ *     sell copies of the Software, and to permit persons to whom the
++ *     Software is furnished to do so, subject to the following
++ *     conditions:
++ *
++ *     The above copyright notice and this permission notice shall be
++ *     included in all copies or substantial portions of the Software.
++ *
++ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
++ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
++ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
++ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
++ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
++ *     OTHER DEALINGS IN THE SOFTWARE.
++ */
++#include <dt-bindings/input/input.h>
++#include <dt-bindings/gpio/gpio.h>
++
++/ {
++	memory {
++		device_type = "memory";
++		reg = <0x00000000 0x10000000>; /* 256 MB */
++	};
++
++	soc {
++		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
++			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
++			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
++			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
++
++		internal-regs {
++			ethernet at 70000 {
++				pinctrl-0 = <&ge0_rgmii_pins>;
++				pinctrl-names = "default";
++				phy = <&phy_dedicated>;
++				phy-mode = "rgmii-id";
++				status = "okay";
++			};
++
++			mdio at 72004 {
++				/*
++				 * Add the phy clock here, so the phy can be
++				 * accessed to read its IDs prior to binding
++				 * with the driver.
++				 */
++				pinctrl-0 = <&mdio_pins &microsom_phy_clk_pins>;
++				pinctrl-names = "default";
++
++				phy_dedicated: ethernet-phy at 0 {
++					/*
++					 * Annoyingly, the marvell phy driver
++					 * configures the LED register, rather
++					 * than preserving reset-loaded setting.
++					 * We undo that rubbish here.
++					 */
++					marvell,reg-init = <3 16 0 0x101e>;
++					reg = <0>;
++				};
++			};
++
++			pinctrl at 18000 {
++				microsom_phy_clk_pins: microsom-phy-clk-pins {
++					marvell,pins = "mpp45";
++					marvell,function = "ref";
++				};
++			};
++
++			rtc at a3800 {
++				/*
++				 * If the rtc doesn't work, run "date reset"
++				 * twice in u-boot.
++				 */
++				status = "okay";
++			};
++
++			serial at 12000 {
++				pinctrl-0 = <&uart0_pins>;
++				pinctrl-names = "default";
++				status = "okay";
++			};
++		};
++	};
++};
diff --git a/target/linux/mvebu/patches-4.4/054-ARM-dts-armada-38x-enable-buffer-manager-support-on-.patch b/target/linux/mvebu/patches-4.4/054-ARM-dts-armada-38x-enable-buffer-manager-support-on-.patch
new file mode 100644
index 0000000..705d503
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/054-ARM-dts-armada-38x-enable-buffer-manager-support-on-.patch
@@ -0,0 +1,256 @@
+From c49e99c2b25a412623412a461bb751239208b9b3 Mon Sep 17 00:00:00 2001
+From: Marcin Wojtas <mw at semihalf.com>
+Date: Mon, 14 Mar 2016 09:38:58 +0100
+Subject: [PATCH] ARM: dts: armada-38x: enable buffer manager support on Armada
+ 38x boards
+
+Since mvneta driver supports using hardware buffer management (BM), in
+order to use it, board files have to be adjusted accordingly. This commit
+enables BM on:
+* A385-DB-AP - each port has its own pool for long and common pool for
+short packets,
+* A388-ClearFog - same as above,
+* A388-DB - to each port unique 'short' and 'long' pools are mapped,
+* A388-GP - same as above.
+
+Moreover appropriate entry is added to 'soc' node ranges, as well as "okay"
+status for 'bm' and 'bm-bppi' (internal SRAM) nodes.
+
+[gregory.clement at free-electrons.com: add suppport for the ClearFog board]
+
+Signed-off-by: Marcin Wojtas <mw at semihalf.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+Acked-by: Russell King <rmk+kernel at arm.linux.org.uk>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ arch/arm/boot/dts/armada-385-db-ap.dts              | 20 +++++++++++++++++++-
+ arch/arm/boot/dts/armada-388-clearfog.dts           |  6 ++++++
+ arch/arm/boot/dts/armada-388-db.dts                 | 17 ++++++++++++++++-
+ arch/arm/boot/dts/armada-388-gp.dts                 | 17 ++++++++++++++++-
+ arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi | 15 ++++++++++++++-
+ 5 files changed, 71 insertions(+), 4 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-385-db-ap.dts
++++ b/arch/arm/boot/dts/armada-385-db-ap.dts
+@@ -61,7 +61,8 @@
+ 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+ 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+ 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
+-			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
++			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
++			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
+ 
+ 		internal-regs {
+ 			spi1: spi at 10680 {
+@@ -138,12 +139,18 @@
+ 				status = "okay";
+ 				phy = <&phy2>;
+ 				phy-mode = "sgmii";
++				buffer-manager = <&bm>;
++				bm,pool-long = <1>;
++				bm,pool-short = <3>;
+ 			};
+ 
+ 			ethernet at 34000 {
+ 				status = "okay";
+ 				phy = <&phy1>;
+ 				phy-mode = "sgmii";
++				buffer-manager = <&bm>;
++				bm,pool-long = <2>;
++				bm,pool-short = <3>;
+ 			};
+ 
+ 			ethernet at 70000 {
+@@ -157,6 +164,13 @@
+ 				status = "okay";
+ 				phy = <&phy0>;
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <0>;
++				bm,pool-short = <3>;
++			};
++
++			bm at c8000 {
++				status = "okay";
+ 			};
+ 
+ 			nfc: flash at d0000 {
+@@ -178,6 +192,10 @@
+ 			};
+ 		};
+ 
++		bm-bppi {
++			status = "okay";
++		};
++
+ 		pcie-controller {
+ 			status = "okay";
+ 
+--- a/arch/arm/boot/dts/armada-388-clearfog.dts
++++ b/arch/arm/boot/dts/armada-388-clearfog.dts
+@@ -78,6 +78,9 @@
+ 		internal-regs {
+ 			ethernet at 30000 {
+ 				phy-mode = "sgmii";
++				buffer-manager = <&bm>;
++				bm,pool-long = <2>;
++				bm,pool-short = <1>;
+ 				status = "okay";
+ 
+ 				fixed-link {
+@@ -88,6 +91,9 @@
+ 
+ 			ethernet at 34000 {
+ 				phy-mode = "sgmii";
++				buffer-manager = <&bm>;
++				bm,pool-long = <3>;
++				bm,pool-short = <1>;
+ 				status = "okay";
+ 
+ 				fixed-link {
+--- a/arch/arm/boot/dts/armada-388-db.dts
++++ b/arch/arm/boot/dts/armada-388-db.dts
+@@ -66,7 +66,8 @@
+ 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+ 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+ 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
+-			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
++			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
++			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
+ 
+ 		internal-regs {
+ 			spi at 10600 {
+@@ -99,6 +100,9 @@
+ 				status = "okay";
+ 				phy = <&phy1>;
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <2>;
++				bm,pool-short = <3>;
+ 			};
+ 
+ 			usb at 58000 {
+@@ -109,6 +113,9 @@
+ 				status = "okay";
+ 				phy = <&phy0>;
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <0>;
++				bm,pool-short = <1>;
+ 			};
+ 
+ 			mdio at 72004 {
+@@ -129,6 +136,10 @@
+ 				status = "okay";
+ 			};
+ 
++			bm at c8000 {
++				status = "okay";
++			};
++
+ 			flash at d0000 {
+ 				status = "okay";
+ 				num-cs = <1>;
+@@ -169,6 +180,10 @@
+ 			};
+ 		};
+ 
++		bm-bppi {
++			status = "okay";
++		};
++
+ 		pcie-controller {
+ 			status = "okay";
+ 			/*
+--- a/arch/arm/boot/dts/armada-388-gp.dts
++++ b/arch/arm/boot/dts/armada-388-gp.dts
+@@ -60,7 +60,8 @@
+ 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+ 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+ 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
+-			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
++			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
++			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
+ 
+ 		internal-regs {
+ 			spi at 10600 {
+@@ -133,6 +134,9 @@
+ 				status = "okay";
+ 				phy = <&phy1>;
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <2>;
++				bm,pool-short = <3>;
+ 			};
+ 
+ 			/* CON4 */
+@@ -152,6 +156,9 @@
+ 				status = "okay";
+ 				phy = <&phy0>;
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <0>;
++				bm,pool-short = <1>;
+ 			};
+ 
+ 
+@@ -186,6 +193,10 @@
+ 				};
+ 			};
+ 
++			bm at c8000 {
++				status = "okay";
++			};
++
+ 			sata at e0000 {
+ 				pinctrl-names = "default";
+ 				pinctrl-0 = <&sata2_pins>, <&sata3_pins>;
+@@ -240,6 +251,10 @@
+ 			};
+ 		};
+ 
++		bm-bppi {
++			status = "okay";
++		};
++
+ 		pcie-controller {
+ 			status = "okay";
+ 			/*
+--- a/arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
++++ b/arch/arm/boot/dts/armada-38x-solidrun-microsom.dtsi
+@@ -58,7 +58,8 @@
+ 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+ 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+ 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
+-			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
++			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
++			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
+ 
+ 		internal-regs {
+ 			ethernet at 70000 {
+@@ -66,6 +67,9 @@
+ 				pinctrl-names = "default";
+ 				phy = <&phy_dedicated>;
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <0>;
++				bm,pool-short = <1>;
+ 				status = "okay";
+ 			};
+ 
+@@ -110,6 +114,15 @@
+ 				pinctrl-names = "default";
+ 				status = "okay";
+ 			};
++
++			bm at c8000 {
++				status = "okay";
++			};
+ 		};
++
++		bm-bppi {
++			status = "okay";
++		};
++
+ 	};
+ };
diff --git a/target/linux/mvebu/patches-4.4/055-ARM-dts-armada-388-clearfog-remove-duplicate-mdio-en.patch b/target/linux/mvebu/patches-4.4/055-ARM-dts-armada-388-clearfog-remove-duplicate-mdio-en.patch
new file mode 100644
index 0000000..823d514
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/055-ARM-dts-armada-388-clearfog-remove-duplicate-mdio-en.patch
@@ -0,0 +1,41 @@
+From d261861ab52623e34a25fe6ae76714456edda033 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at armlinux.org.uk>
+Date: Sun, 10 Jul 2016 16:27:38 +0100
+Subject: [PATCH] ARM: dts: armada-388-clearfog: remove duplicate mdio entry
+
+The clearfog DTS should not be defining the on-board phy, this device
+is located on the microsom.  Remove the duplicated definition.
+
+Reported-by: Jon Nettleton <jon at solid-run.com>
+Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
+Reviewed-by: Andrew Lunn <andrew at lunn.ch>
+Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
+---
+ arch/arm/boot/dts/armada-388-clearfog.dts | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-388-clearfog.dts
++++ b/arch/arm/boot/dts/armada-388-clearfog.dts
+@@ -239,22 +239,6 @@
+ 				status = "okay";
+ 			};
+ 
+-			mdio at 72004 {
+-				pinctrl-0 = <&mdio_pins>;
+-				pinctrl-names = "default";
+-
+-				phy_dedicated: ethernet-phy at 0 {
+-					/*
+-					 * Annoyingly, the marvell phy driver
+-					 * configures the LED register, rather
+-					 * than preserving reset-loaded setting.
+-					 * We undo that rubbish here.
+-					 */
+-					marvell,reg-init = <3 16 0 0x101e>;
+-					reg = <0>;
+-				};
+-			};
+-
+ 			pinctrl at 18000 {
+ 				clearfog_dsa0_clk_pins: clearfog-dsa0-clk-pins {
+ 					marvell,pins = "mpp46";
diff --git a/target/linux/mvebu/patches-4.4/100-find_active_root.patch b/target/linux/mvebu/patches-4.4/100-find_active_root.patch
new file mode 100644
index 0000000..c997f5b
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/100-find_active_root.patch
@@ -0,0 +1,62 @@
+The WRT1900AC among other Linksys routers uses a dual-firmware layout.
+Dynamically rename the active partition to "ubi".
+
+Signed-off-by: Imre Kaloz <kaloz at openwrt.org>
+
+--- a/drivers/mtd/ofpart.c
++++ b/drivers/mtd/ofpart.c
+@@ -25,6 +25,8 @@ static bool node_has_compatible(struct d
+ 	return of_get_property(pp, "compatible", NULL);
+ }
+ 
++static int mangled_rootblock;
++
+ static int parse_ofpart_partitions(struct mtd_info *master,
+ 				   struct mtd_partition **pparts,
+ 				   struct mtd_part_parser_data *data)
+@@ -32,6 +34,7 @@ static int parse_ofpart_partitions(struc
+ 	struct device_node *mtd_node;
+ 	struct device_node *ofpart_node;
+ 	const char *partname;
++	const char *owrtpart = "ubi";
+ 	struct device_node *pp;
+ 	int nr_parts, i, ret = 0;
+ 	bool dedicated = true;
+@@ -110,9 +113,15 @@ static int parse_ofpart_partitions(struc
+ 		(*pparts)[i].offset = of_read_number(reg, a_cells);
+ 		(*pparts)[i].size = of_read_number(reg + a_cells, s_cells);
+ 
+-		partname = of_get_property(pp, "label", &len);
+-		if (!partname)
+-			partname = of_get_property(pp, "name", &len);
++		if (mangled_rootblock && (i == mangled_rootblock)) {
++				partname = owrtpart;
++		} else {
++			partname = of_get_property(pp, "label", &len);
++
++			if (!partname)
++				partname = of_get_property(pp, "name", &len);
++		}
++
+ 		(*pparts)[i].name = partname;
+ 
+ 		if (of_get_property(pp, "read-only", &len))
+@@ -215,6 +224,18 @@ static int __init ofpart_parser_init(voi
+ 	return 0;
+ }
+ 
++static int __init active_root(char *str)
++{
++	get_option(&str, &mangled_rootblock);
++
++	if (!mangled_rootblock)
++		return 1;
++
++	return 1;
++}
++
++__setup("mangled_rootblock=", active_root);
++
+ static void __exit ofpart_parser_exit(void)
+ {
+ 	deregister_mtd_parser(&ofpart_parser);
diff --git a/target/linux/mvebu/patches-4.4/102-revert_i2c_delay.patch b/target/linux/mvebu/patches-4.4/102-revert_i2c_delay.patch
new file mode 100644
index 0000000..f97bba2
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/102-revert_i2c_delay.patch
@@ -0,0 +1,15 @@
+--- a/arch/arm/boot/dts/armada-xp.dtsi
++++ b/arch/arm/boot/dts/armada-xp.dtsi
+@@ -98,12 +98,10 @@
+ 
+ 
+ 			i2c0: i2c at 11000 {
+-				compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
+ 				reg = <0x11000 0x100>;
+ 			};
+ 
+ 			i2c1: i2c at 11100 {
+-				compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
+ 				reg = <0x11100 0x100>;
+ 			};
+ 
diff --git a/target/linux/mvebu/patches-4.4/103-remove-nand-driver-bug.patch b/target/linux/mvebu/patches-4.4/103-remove-nand-driver-bug.patch
new file mode 100644
index 0000000..e9cc027
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/103-remove-nand-driver-bug.patch
@@ -0,0 +1,13 @@
+Remove a BUG() call that would crash on a race condition that should
+otherwise be harmless.
+
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -701,7 +701,6 @@ static void handle_data_pio(struct pxa3x
+ 	default:
+ 		dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__,
+ 				info->state);
+-		BUG();
+ 	}
+ 
+ 	/* Update buffer pointers for multi-page read/write */
diff --git a/target/linux/mvebu/patches-4.4/104-linksys_mamba_disable_keep_config.patch b/target/linux/mvebu/patches-4.4/104-linksys_mamba_disable_keep_config.patch
new file mode 100644
index 0000000..4c6b311
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/104-linksys_mamba_disable_keep_config.patch
@@ -0,0 +1,10 @@
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -298,7 +298,6 @@
+ 			nand at d0000 {
+ 				status = "okay";
+ 				num-cs = <1>;
+-				marvell,nand-keep-config;
+ 				marvell,nand-enable-arbiter;
+ 				nand-on-flash-bbt;
+ 				nand-ecc-strength = <4>;
diff --git a/target/linux/mvebu/patches-4.4/106-enable-bm-on-linksys-devices.patch b/target/linux/mvebu/patches-4.4/106-enable-bm-on-linksys-devices.patch
new file mode 100644
index 0000000..e80bc39
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/106-enable-bm-on-linksys-devices.patch
@@ -0,0 +1,107 @@
+--- a/arch/arm/boot/dts/armada-385-linksys.dtsi
++++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
+@@ -59,7 +59,8 @@
+ 		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+ 			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+ 			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
+-			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000>;
++			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
++			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
+ 
+ 		internal-regs {
+ 
+@@ -93,6 +94,9 @@
+ 			ethernet at 70000 {
+ 				status = "okay";
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <0>;
++				bm,pool-short = <3>;
+ 				fixed-link {
+ 					speed = <1000>;
+ 					full-duplex;
+@@ -102,6 +106,9 @@
+ 			ethernet at 34000 {
+ 				status = "okay";
+ 				phy-mode = "sgmii";
++				buffer-manager = <&bm>;
++				bm,pool-long = <2>;
++				bm,pool-short = <3>;
+ 				fixed-link {
+ 					speed = <1000>;
+ 					full-duplex;
+@@ -112,6 +119,10 @@
+ 				status = "okay";
+ 			};
+ 
++			bm at c8000 {
++				status = "okay";
++			};
++
+ 			sata at a8000 {
+ 				status = "okay";
+ 			};
+@@ -198,6 +209,10 @@
+ 			};
+ 		};
+ 
++		bm-bppi {
++			status = "okay";
++		};
++
+ 		pcie-controller {
+ 			status = "okay";
+ 
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -71,7 +71,8 @@
+ 		ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
+ 			  MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
+ 			  MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
+-			  MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
++			  MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000
++			  MBUS_ID(0x0c, 0x04) 0 0 0xf1200000 0x100000>;
+ 
+ 		pcie-controller {
+ 			status = "okay";
+@@ -205,6 +206,9 @@
+ 				pinctrl-names = "default";
+ 				status = "okay";
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <0>;
++				bm,pool-short = <3>;
+ 				fixed-link {
+ 					speed = <1000>;
+ 					full-duplex;
+@@ -216,12 +220,19 @@
+ 				pinctrl-names = "default";
+ 				status = "okay";
+ 				phy-mode = "rgmii-id";
++				buffer-manager = <&bm>;
++				bm,pool-long = <1>;
++				bm,pool-short = <3>;
+ 				fixed-link {
+ 					speed = <1000>;
+ 					full-duplex;
+ 				};
+ 			};
+ 
++			bm at c0000 {
++				status = "okay";
++			};
++
+ 			/* USB part of the eSATA/USB 2.0 port */
+ 			usb at 50000 {
+ 				status = "okay";
+@@ -379,6 +390,10 @@
+ 				};
+ 			};
+ 		};
++
++		bm-bppi {
++			status = "okay";
++		};
+ 	};
+ 
+ 	gpio_keys {
diff --git a/target/linux/mvebu/patches-4.4/110-pxa3xxx_revert_irq_thread.patch b/target/linux/mvebu/patches-4.4/110-pxa3xxx_revert_irq_thread.patch
new file mode 100644
index 0000000..30da17d
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/110-pxa3xxx_revert_irq_thread.patch
@@ -0,0 +1,69 @@
+Revert "mtd: pxa3xx-nand: handle PIO in threaded interrupt"
+
+This reverts commit 24542257a3b987025d4b998ec2d15e556c98ad3f
+This upstream change has been causing spurious timeouts on accesses
+to the NAND flash if something else on the system is causing
+significant latency.
+
+Nothing guarantees that the thread will run in time, so the
+usual timeout is unreliable.
+
+Signed-off-by: Felix Fietkau <nbd at nbd.name>
+
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -765,24 +765,11 @@ static void start_data_dma(struct pxa3xx
+ 		__func__, direction, info->dma_cookie, info->sg.length);
+ }
+ 
+-static irqreturn_t pxa3xx_nand_irq_thread(int irq, void *data)
+-{
+-	struct pxa3xx_nand_info *info = data;
+-
+-	handle_data_pio(info);
+-
+-	info->state = STATE_CMD_DONE;
+-	nand_writel(info, NDSR, NDSR_WRDREQ | NDSR_RDDREQ);
+-
+-	return IRQ_HANDLED;
+-}
+-
+ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
+ {
+ 	struct pxa3xx_nand_info *info = devid;
+ 	unsigned int status, is_completed = 0, is_ready = 0;
+ 	unsigned int ready, cmd_done;
+-	irqreturn_t ret = IRQ_HANDLED;
+ 
+ 	if (info->cs == 0) {
+ 		ready           = NDSR_FLASH_RDY;
+@@ -824,8 +811,7 @@ static irqreturn_t pxa3xx_nand_irq(int i
+ 		} else {
+ 			info->state = (status & NDSR_RDDREQ) ?
+ 				      STATE_PIO_READING : STATE_PIO_WRITING;
+-			ret = IRQ_WAKE_THREAD;
+-			goto NORMAL_IRQ_EXIT;
++			handle_data_pio(info);
+ 		}
+ 	}
+ 	if (status & cmd_done) {
+@@ -870,7 +856,7 @@ static irqreturn_t pxa3xx_nand_irq(int i
+ 	if (is_ready)
+ 		complete(&info->dev_ready);
+ NORMAL_IRQ_EXIT:
+-	return ret;
++	return IRQ_HANDLED;
+ }
+ 
+ static inline int is_buf_blank(uint8_t *buf, size_t len)
+@@ -1849,9 +1835,7 @@ static int alloc_nand_resource(struct pl
+ 	/* initialize all interrupts to be disabled */
+ 	disable_int(info, NDSR_MASK);
+ 
+-	ret = request_threaded_irq(irq, pxa3xx_nand_irq,
+-				   pxa3xx_nand_irq_thread, IRQF_ONESHOT,
+-				   pdev->name, info);
++	ret = request_irq(irq, pxa3xx_nand_irq, 0, pdev->name, info);
+ 	if (ret < 0) {
+ 		dev_err(&pdev->dev, "failed to request IRQ\n");
+ 		goto fail_free_buf;
diff --git a/target/linux/mvebu/patches-4.4/120-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch b/target/linux/mvebu/patches-4.4/120-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch
new file mode 100644
index 0000000..00745f1
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/120-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch
@@ -0,0 +1,306 @@
+From 4d5621372f6e7ddbfd5879602f82073987bcc722 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 20 Sep 2015 09:57:10 +0100
+Subject: [PATCH 709/744] phy: move fixed_phy MII register generation to a
+ library
+
+Move the fixed_phy MII register generation to a library to allow other
+software phy implementations to use this code.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/Kconfig     |   4 ++
+ drivers/net/phy/Makefile    |   3 +-
+ drivers/net/phy/fixed_phy.c |  95 ++-------------------------------
+ drivers/net/phy/swphy.c     | 126 ++++++++++++++++++++++++++++++++++++++++++++
+ drivers/net/phy/swphy.h     |   8 +++
+ 5 files changed, 143 insertions(+), 93 deletions(-)
+ create mode 100644 drivers/net/phy/swphy.c
+ create mode 100644 drivers/net/phy/swphy.h
+
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -26,6 +26,9 @@ config SWCONFIG_LEDS
+ 	bool "Switch LED trigger support"
+ 	depends on (SWCONFIG && LEDS_TRIGGERS)
+ 
++config SWPHY
++	bool
++
+ comment "MII PHY device drivers"
+ 
+ config AQUANTIA_PHY
+@@ -205,6 +208,7 @@ config RTL8306_PHY
+ config FIXED_PHY
+ 	tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
+ 	depends on PHYLIB
++	select SWPHY
+ 	---help---
+ 	  Adds the platform "fixed" MDIO Bus to cover the boards that use
+ 	  PHYs that are not connected to the real MDIO bus.
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -1,6 +1,7 @@
+ # Makefile for Linux PHY drivers
+ 
+-libphy-objs			:= phy.o phy_device.o mdio_bus.o
++libphy-y			:= phy.o phy_device.o mdio_bus.o
++libphy-$(CONFIG_SWPHY)		+= swphy.o
+ 
+ obj-$(CONFIG_MDIO_BOARDINFO)	+= mdio-boardinfo.o
+ 
+--- a/drivers/net/phy/fixed_phy.c
++++ b/drivers/net/phy/fixed_phy.c
+@@ -24,6 +24,8 @@
+ #include <linux/of.h>
+ #include <linux/gpio.h>
+ 
++#include "swphy.h"
++
+ #define MII_REGS_NUM 29
+ 
+ struct fixed_mdio_bus {
+@@ -49,101 +51,10 @@ static struct fixed_mdio_bus platform_fm
+ 
+ static int fixed_phy_update_regs(struct fixed_phy *fp)
+ {
+-	u16 bmsr = BMSR_ANEGCAPABLE;
+-	u16 bmcr = 0;
+-	u16 lpagb = 0;
+-	u16 lpa = 0;
+-
+ 	if (gpio_is_valid(fp->link_gpio))
+ 		fp->status.link = !!gpio_get_value_cansleep(fp->link_gpio);
+ 
+-	if (fp->status.duplex) {
+-		switch (fp->status.speed) {
+-		case 1000:
+-			bmsr |= BMSR_ESTATEN;
+-			break;
+-		case 100:
+-			bmsr |= BMSR_100FULL;
+-			break;
+-		case 10:
+-			bmsr |= BMSR_10FULL;
+-			break;
+-		default:
+-			break;
+-		}
+-	} else {
+-		switch (fp->status.speed) {
+-		case 1000:
+-			bmsr |= BMSR_ESTATEN;
+-			break;
+-		case 100:
+-			bmsr |= BMSR_100HALF;
+-			break;
+-		case 10:
+-			bmsr |= BMSR_10HALF;
+-			break;
+-		default:
+-			break;
+-		}
+-	}
+-
+-	if (fp->status.link) {
+-		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
+-
+-		if (fp->status.duplex) {
+-			bmcr |= BMCR_FULLDPLX;
+-
+-			switch (fp->status.speed) {
+-			case 1000:
+-				bmcr |= BMCR_SPEED1000;
+-				lpagb |= LPA_1000FULL;
+-				break;
+-			case 100:
+-				bmcr |= BMCR_SPEED100;
+-				lpa |= LPA_100FULL;
+-				break;
+-			case 10:
+-				lpa |= LPA_10FULL;
+-				break;
+-			default:
+-				pr_warn("fixed phy: unknown speed\n");
+-				return -EINVAL;
+-			}
+-		} else {
+-			switch (fp->status.speed) {
+-			case 1000:
+-				bmcr |= BMCR_SPEED1000;
+-				lpagb |= LPA_1000HALF;
+-				break;
+-			case 100:
+-				bmcr |= BMCR_SPEED100;
+-				lpa |= LPA_100HALF;
+-				break;
+-			case 10:
+-				lpa |= LPA_10HALF;
+-				break;
+-			default:
+-				pr_warn("fixed phy: unknown speed\n");
+-			return -EINVAL;
+-			}
+-		}
+-
+-		if (fp->status.pause)
+-			lpa |= LPA_PAUSE_CAP;
+-
+-		if (fp->status.asym_pause)
+-			lpa |= LPA_PAUSE_ASYM;
+-	}
+-
+-	fp->regs[MII_PHYSID1] = 0;
+-	fp->regs[MII_PHYSID2] = 0;
+-
+-	fp->regs[MII_BMSR] = bmsr;
+-	fp->regs[MII_BMCR] = bmcr;
+-	fp->regs[MII_LPA] = lpa;
+-	fp->regs[MII_STAT1000] = lpagb;
+-
+-	return 0;
++	return swphy_update_regs(fp->regs, &fp->status);
+ }
+ 
+ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
+--- /dev/null
++++ b/drivers/net/phy/swphy.c
+@@ -0,0 +1,126 @@
++/*
++ * Software PHY emulation
++ *
++ * Code taken from fixed_phy.c by Russell King <rmk+kernel at arm.linux.org.uk>
++ *
++ * Author: Vitaly Bordug <vbordug at ru.mvista.com>
++ *         Anton Vorontsov <avorontsov at ru.mvista.com>
++ *
++ * Copyright (c) 2006-2007 MontaVista Software, Inc.
++ *
++ * 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;  either version 2 of the  License, or (at your
++ * option) any later version.
++ */
++#include <linux/export.h>
++#include <linux/mii.h>
++#include <linux/phy.h>
++#include <linux/phy_fixed.h>
++
++#include "swphy.h"
++
++/**
++ * swphy_update_regs - update MII register array with fixed phy state
++ * @regs: array of 32 registers to update
++ * @state: fixed phy status
++ *
++ * Update the array of MII registers with the fixed phy link, speed,
++ * duplex and pause mode settings.
++ */
++int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
++{
++	u16 bmsr = BMSR_ANEGCAPABLE;
++	u16 bmcr = 0;
++	u16 lpagb = 0;
++	u16 lpa = 0;
++
++	if (state->duplex) {
++		switch (state->speed) {
++		case 1000:
++			bmsr |= BMSR_ESTATEN;
++			break;
++		case 100:
++			bmsr |= BMSR_100FULL;
++			break;
++		case 10:
++			bmsr |= BMSR_10FULL;
++			break;
++		default:
++			break;
++		}
++	} else {
++		switch (state->speed) {
++		case 1000:
++			bmsr |= BMSR_ESTATEN;
++			break;
++		case 100:
++			bmsr |= BMSR_100HALF;
++			break;
++		case 10:
++			bmsr |= BMSR_10HALF;
++			break;
++		default:
++			break;
++		}
++	}
++
++	if (state->link) {
++		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
++
++		if (state->duplex) {
++			bmcr |= BMCR_FULLDPLX;
++
++			switch (state->speed) {
++			case 1000:
++				bmcr |= BMCR_SPEED1000;
++				lpagb |= LPA_1000FULL;
++				break;
++			case 100:
++				bmcr |= BMCR_SPEED100;
++				lpa |= LPA_100FULL;
++				break;
++			case 10:
++				lpa |= LPA_10FULL;
++				break;
++			default:
++				pr_warn("swphy: unknown speed\n");
++				return -EINVAL;
++			}
++		} else {
++			switch (state->speed) {
++			case 1000:
++				bmcr |= BMCR_SPEED1000;
++				lpagb |= LPA_1000HALF;
++				break;
++			case 100:
++				bmcr |= BMCR_SPEED100;
++				lpa |= LPA_100HALF;
++				break;
++			case 10:
++				lpa |= LPA_10HALF;
++				break;
++			default:
++				pr_warn("swphy: unknown speed\n");
++				return -EINVAL;
++			}
++		}
++
++		if (state->pause)
++			lpa |= LPA_PAUSE_CAP;
++
++		if (state->asym_pause)
++			lpa |= LPA_PAUSE_ASYM;
++	}
++
++	regs[MII_PHYSID1] = 0;
++	regs[MII_PHYSID2] = 0;
++
++	regs[MII_BMSR] = bmsr;
++	regs[MII_BMCR] = bmcr;
++	regs[MII_LPA] = lpa;
++	regs[MII_STAT1000] = lpagb;
++
++	return 0;
++}
++EXPORT_SYMBOL_GPL(swphy_update_regs);
+--- /dev/null
++++ b/drivers/net/phy/swphy.h
+@@ -0,0 +1,8 @@
++#ifndef SWPHY_H
++#define SWPHY_H
++
++struct fixed_phy_status;
++
++int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
++
++#endif
diff --git a/target/linux/mvebu/patches-4.4/121-phy-convert-swphy-register-generation-to-tabular-for.patch b/target/linux/mvebu/patches-4.4/121-phy-convert-swphy-register-generation-to-tabular-for.patch
new file mode 100644
index 0000000..0d689f3
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/121-phy-convert-swphy-register-generation-to-tabular-for.patch
@@ -0,0 +1,203 @@
+From cd834fe430f030a63bfa9277bba194e8eef4dbd0 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 20 Sep 2015 10:18:59 +0100
+Subject: [PATCH 710/744] phy: convert swphy register generation to tabular
+ form
+
+Convert the swphy register generation to tabular form which allows us
+to eliminate multiple switch() statements.  This results in a smaller
+object code size, more efficient, and easier to add support for faster
+speeds.
+
+Before:
+
+Idx Name          Size      VMA       LMA       File off  Algn
+  0 .text         00000164  00000000  00000000  00000034  2**2
+
+   text    data     bss     dec     hex filename
+    388       0       0     388     184 swphy.o
+
+After:
+
+Idx Name          Size      VMA       LMA       File off  Algn
+  0 .text         000000fc  00000000  00000000  00000034  2**2
+  5 .rodata       00000028  00000000  00000000  00000138  2**2
+
+   text    data     bss     dec     hex filename
+    324       0       0     324     144 swphy.o
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/swphy.c | 143 ++++++++++++++++++++++++++----------------------
+ 1 file changed, 78 insertions(+), 65 deletions(-)
+
+--- a/drivers/net/phy/swphy.c
++++ b/drivers/net/phy/swphy.c
+@@ -20,6 +20,72 @@
+ 
+ #include "swphy.h"
+ 
++struct swmii_regs {
++	u16 bmcr;
++	u16 bmsr;
++	u16 lpa;
++	u16 lpagb;
++};
++
++enum {
++	SWMII_SPEED_10 = 0,
++	SWMII_SPEED_100,
++	SWMII_SPEED_1000,
++	SWMII_DUPLEX_HALF = 0,
++	SWMII_DUPLEX_FULL,
++};
++
++/*
++ * These two tables get bitwise-anded together to produce the final result.
++ * This means the speed table must contain both duplex settings, and the
++ * duplex table must contain all speed settings.
++ */
++static const struct swmii_regs speed[] = {
++	[SWMII_SPEED_10] = {
++		.bmcr  = BMCR_FULLDPLX,
++		.lpa   = LPA_10FULL | LPA_10HALF,
++	},
++	[SWMII_SPEED_100] = {
++		.bmcr  = BMCR_FULLDPLX | BMCR_SPEED100,
++		.bmsr  = BMSR_100FULL | BMSR_100HALF,
++		.lpa   = LPA_100FULL | LPA_100HALF,
++	},
++	[SWMII_SPEED_1000] = {
++		.bmcr  = BMCR_FULLDPLX | BMCR_SPEED1000,
++		.bmsr  = BMSR_ESTATEN,
++		.lpagb = LPA_1000FULL | LPA_1000HALF,
++	},
++};
++
++static const struct swmii_regs duplex[] = {
++	[SWMII_DUPLEX_HALF] = {
++		.bmcr  = ~BMCR_FULLDPLX,
++		.bmsr  = BMSR_ESTATEN | BMSR_100HALF,
++		.lpa   = LPA_10HALF | LPA_100HALF,
++		.lpagb = LPA_1000HALF,
++	},
++	[SWMII_DUPLEX_FULL] = {
++		.bmcr  = ~0,
++		.bmsr  = BMSR_ESTATEN | BMSR_100FULL,
++		.lpa   = LPA_10FULL | LPA_100FULL,
++		.lpagb = LPA_1000FULL,
++	},
++};
++
++static int swphy_decode_speed(int speed)
++{
++	switch (speed) {
++	case 1000:
++		return SWMII_SPEED_1000;
++	case 100:
++		return SWMII_SPEED_100;
++	case 10:
++		return SWMII_SPEED_10;
++	default:
++		return -EINVAL;
++	}
++}
++
+ /**
+  * swphy_update_regs - update MII register array with fixed phy state
+  * @regs: array of 32 registers to update
+@@ -30,81 +96,28 @@
+  */
+ int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
+ {
++	int speed_index, duplex_index;
+ 	u16 bmsr = BMSR_ANEGCAPABLE;
+ 	u16 bmcr = 0;
+ 	u16 lpagb = 0;
+ 	u16 lpa = 0;
+ 
+-	if (state->duplex) {
+-		switch (state->speed) {
+-		case 1000:
+-			bmsr |= BMSR_ESTATEN;
+-			break;
+-		case 100:
+-			bmsr |= BMSR_100FULL;
+-			break;
+-		case 10:
+-			bmsr |= BMSR_10FULL;
+-			break;
+-		default:
+-			break;
+-		}
+-	} else {
+-		switch (state->speed) {
+-		case 1000:
+-			bmsr |= BMSR_ESTATEN;
+-			break;
+-		case 100:
+-			bmsr |= BMSR_100HALF;
+-			break;
+-		case 10:
+-			bmsr |= BMSR_10HALF;
+-			break;
+-		default:
+-			break;
+-		}
++	speed_index = swphy_decode_speed(state->speed);
++	if (speed_index < 0) {
++		pr_warn("swphy: unknown speed\n");
++		return -EINVAL;
+ 	}
+ 
++	duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
++
++	bmsr |= speed[speed_index].bmsr & duplex[duplex_index].bmsr;
++
+ 	if (state->link) {
+ 		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
+ 
+-		if (state->duplex) {
+-			bmcr |= BMCR_FULLDPLX;
+-
+-			switch (state->speed) {
+-			case 1000:
+-				bmcr |= BMCR_SPEED1000;
+-				lpagb |= LPA_1000FULL;
+-				break;
+-			case 100:
+-				bmcr |= BMCR_SPEED100;
+-				lpa |= LPA_100FULL;
+-				break;
+-			case 10:
+-				lpa |= LPA_10FULL;
+-				break;
+-			default:
+-				pr_warn("swphy: unknown speed\n");
+-				return -EINVAL;
+-			}
+-		} else {
+-			switch (state->speed) {
+-			case 1000:
+-				bmcr |= BMCR_SPEED1000;
+-				lpagb |= LPA_1000HALF;
+-				break;
+-			case 100:
+-				bmcr |= BMCR_SPEED100;
+-				lpa |= LPA_100HALF;
+-				break;
+-			case 10:
+-				lpa |= LPA_10HALF;
+-				break;
+-			default:
+-				pr_warn("swphy: unknown speed\n");
+-				return -EINVAL;
+-			}
+-		}
++		bmcr  |= speed[speed_index].bmcr  & duplex[duplex_index].bmcr;
++		lpa   |= speed[speed_index].lpa   & duplex[duplex_index].lpa;
++		lpagb |= speed[speed_index].lpagb & duplex[duplex_index].lpagb;
+ 
+ 		if (state->pause)
+ 			lpa |= LPA_PAUSE_CAP;
diff --git a/target/linux/mvebu/patches-4.4/122-phy-separate-swphy-state-validation-from-register-ge.patch b/target/linux/mvebu/patches-4.4/122-phy-separate-swphy-state-validation-from-register-ge.patch
new file mode 100644
index 0000000..4b332cc
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/122-phy-separate-swphy-state-validation-from-register-ge.patch
@@ -0,0 +1,138 @@
+From e07630ad84c7dc145863f079f108154fb7c975e7 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 20 Sep 2015 11:12:15 +0100
+Subject: [PATCH 711/744] phy: separate swphy state validation from register
+ generation
+
+Separate out the generation of MII registers from the state validation.
+This allows us to simplify the error handing in fixed_phy() by allowing
+earlier error detection.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/fixed_phy.c | 15 +++++++--------
+ drivers/net/phy/swphy.c     | 33 ++++++++++++++++++++++++++-------
+ drivers/net/phy/swphy.h     |  3 ++-
+ 3 files changed, 35 insertions(+), 16 deletions(-)
+
+--- a/drivers/net/phy/fixed_phy.c
++++ b/drivers/net/phy/fixed_phy.c
+@@ -49,12 +49,12 @@ static struct fixed_mdio_bus platform_fm
+ 	.phys = LIST_HEAD_INIT(platform_fmb.phys),
+ };
+ 
+-static int fixed_phy_update_regs(struct fixed_phy *fp)
++static void fixed_phy_update_regs(struct fixed_phy *fp)
+ {
+ 	if (gpio_is_valid(fp->link_gpio))
+ 		fp->status.link = !!gpio_get_value_cansleep(fp->link_gpio);
+ 
+-	return swphy_update_regs(fp->regs, &fp->status);
++	swphy_update_regs(fp->regs, &fp->status);
+ }
+ 
+ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
+@@ -161,6 +161,10 @@ int fixed_phy_add(unsigned int irq, int
+ 	struct fixed_mdio_bus *fmb = &platform_fmb;
+ 	struct fixed_phy *fp;
+ 
++	ret = swphy_validate_state(status);
++	if (ret < 0)
++		return ret;
++
+ 	fp = kzalloc(sizeof(*fp), GFP_KERNEL);
+ 	if (!fp)
+ 		return -ENOMEM;
+@@ -180,17 +184,12 @@ int fixed_phy_add(unsigned int irq, int
+ 			goto err_regs;
+ 	}
+ 
+-	ret = fixed_phy_update_regs(fp);
+-	if (ret)
+-		goto err_gpio;
++	fixed_phy_update_regs(fp);
+ 
+ 	list_add_tail(&fp->node, &fmb->phys);
+ 
+ 	return 0;
+ 
+-err_gpio:
+-	if (gpio_is_valid(fp->link_gpio))
+-		gpio_free(fp->link_gpio);
+ err_regs:
+ 	kfree(fp);
+ 	return ret;
+--- a/drivers/net/phy/swphy.c
++++ b/drivers/net/phy/swphy.c
+@@ -87,6 +87,29 @@ static int swphy_decode_speed(int speed)
+ }
+ 
+ /**
++ * swphy_validate_state - validate the software phy status
++ * @state: software phy status
++ *
++ * This checks that we can represent the state stored in @state can be
++ * represented in the emulated MII registers.  Returns 0 if it can,
++ * otherwise returns -EINVAL.
++ */
++int swphy_validate_state(const struct fixed_phy_status *state)
++{
++	int err;
++
++	if (state->link) {
++		err = swphy_decode_speed(state->speed);
++		if (err < 0) {
++			pr_warn("swphy: unknown speed\n");
++			return -EINVAL;
++		}
++	}
++	return 0;
++}
++EXPORT_SYMBOL_GPL(swphy_validate_state);
++
++/**
+  * swphy_update_regs - update MII register array with fixed phy state
+  * @regs: array of 32 registers to update
+  * @state: fixed phy status
+@@ -94,7 +117,7 @@ static int swphy_decode_speed(int speed)
+  * Update the array of MII registers with the fixed phy link, speed,
+  * duplex and pause mode settings.
+  */
+-int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
++void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
+ {
+ 	int speed_index, duplex_index;
+ 	u16 bmsr = BMSR_ANEGCAPABLE;
+@@ -103,10 +126,8 @@ int swphy_update_regs(u16 *regs, const s
+ 	u16 lpa = 0;
+ 
+ 	speed_index = swphy_decode_speed(state->speed);
+-	if (speed_index < 0) {
+-		pr_warn("swphy: unknown speed\n");
+-		return -EINVAL;
+-	}
++	if (WARN_ON(speed_index < 0))
++		return;
+ 
+ 	duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
+ 
+@@ -133,7 +154,5 @@ int swphy_update_regs(u16 *regs, const s
+ 	regs[MII_BMCR] = bmcr;
+ 	regs[MII_LPA] = lpa;
+ 	regs[MII_STAT1000] = lpagb;
+-
+-	return 0;
+ }
+ EXPORT_SYMBOL_GPL(swphy_update_regs);
+--- a/drivers/net/phy/swphy.h
++++ b/drivers/net/phy/swphy.h
+@@ -3,6 +3,7 @@
+ 
+ struct fixed_phy_status;
+ 
+-int swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
++int swphy_validate_state(const struct fixed_phy_status *state);
++void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
+ 
+ #endif
diff --git a/target/linux/mvebu/patches-4.4/123-phy-generate-swphy-registers-on-the-fly.patch b/target/linux/mvebu/patches-4.4/123-phy-generate-swphy-registers-on-the-fly.patch
new file mode 100644
index 0000000..218b902
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/123-phy-generate-swphy-registers-on-the-fly.patch
@@ -0,0 +1,204 @@
+From e0f33a88243329da1aa5a90fe10ab25c9fb0a091 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 20 Sep 2015 11:28:39 +0100
+Subject: [PATCH 712/744] phy: generate swphy registers on the fly
+
+Generate software phy registers as and when requested, rather than
+duplicating the state in fixed_phy.  This allows us to eliminate
+the duplicate storage of of the same data, which is only different
+in format.
+
+As fixed_phy_update_regs() no longer updates register state, rename
+it to fixed_phy_update().
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/fixed_phy.c | 31 +++++-------------------------
+ drivers/net/phy/swphy.c     | 47 ++++++++++++++++++++++++++++++++-------------
+ drivers/net/phy/swphy.h     |  2 +-
+ 3 files changed, 40 insertions(+), 40 deletions(-)
+
+--- a/drivers/net/phy/fixed_phy.c
++++ b/drivers/net/phy/fixed_phy.c
+@@ -26,8 +26,6 @@
+ 
+ #include "swphy.h"
+ 
+-#define MII_REGS_NUM 29
+-
+ struct fixed_mdio_bus {
+ 	int irqs[PHY_MAX_ADDR];
+ 	struct mii_bus *mii_bus;
+@@ -36,7 +34,6 @@ struct fixed_mdio_bus {
+ 
+ struct fixed_phy {
+ 	int addr;
+-	u16 regs[MII_REGS_NUM];
+ 	struct phy_device *phydev;
+ 	struct fixed_phy_status status;
+ 	int (*link_update)(struct net_device *, struct fixed_phy_status *);
+@@ -49,12 +46,10 @@ static struct fixed_mdio_bus platform_fm
+ 	.phys = LIST_HEAD_INIT(platform_fmb.phys),
+ };
+ 
+-static void fixed_phy_update_regs(struct fixed_phy *fp)
++static void fixed_phy_update(struct fixed_phy *fp)
+ {
+ 	if (gpio_is_valid(fp->link_gpio))
+ 		fp->status.link = !!gpio_get_value_cansleep(fp->link_gpio);
+-
+-	swphy_update_regs(fp->regs, &fp->status);
+ }
+ 
+ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
+@@ -62,29 +57,15 @@ static int fixed_mdio_read(struct mii_bu
+ 	struct fixed_mdio_bus *fmb = bus->priv;
+ 	struct fixed_phy *fp;
+ 
+-	if (reg_num >= MII_REGS_NUM)
+-		return -1;
+-
+-	/* We do not support emulating Clause 45 over Clause 22 register reads
+-	 * return an error instead of bogus data.
+-	 */
+-	switch (reg_num) {
+-	case MII_MMD_CTRL:
+-	case MII_MMD_DATA:
+-		return -1;
+-	default:
+-		break;
+-	}
+-
+ 	list_for_each_entry(fp, &fmb->phys, node) {
+ 		if (fp->addr == phy_addr) {
+ 			/* Issue callback if user registered it. */
+ 			if (fp->link_update) {
+ 				fp->link_update(fp->phydev->attached_dev,
+ 						&fp->status);
+-				fixed_phy_update_regs(fp);
++				fixed_phy_update(fp);
+ 			}
+-			return fp->regs[reg_num];
++			return swphy_read_reg(reg_num, &fp->status);
+ 		}
+ 	}
+ 
+@@ -144,7 +125,7 @@ int fixed_phy_update_state(struct phy_de
+ 			_UPD(pause);
+ 			_UPD(asym_pause);
+ #undef _UPD
+-			fixed_phy_update_regs(fp);
++			fixed_phy_update(fp);
+ 			return 0;
+ 		}
+ 	}
+@@ -169,8 +150,6 @@ int fixed_phy_add(unsigned int irq, int
+ 	if (!fp)
+ 		return -ENOMEM;
+ 
+-	memset(fp->regs, 0xFF,  sizeof(fp->regs[0]) * MII_REGS_NUM);
+-
+ 	fmb->irqs[phy_addr] = irq;
+ 
+ 	fp->addr = phy_addr;
+@@ -184,7 +163,7 @@ int fixed_phy_add(unsigned int irq, int
+ 			goto err_regs;
+ 	}
+ 
+-	fixed_phy_update_regs(fp);
++	fixed_phy_update(fp);
+ 
+ 	list_add_tail(&fp->node, &fmb->phys);
+ 
+--- a/drivers/net/phy/swphy.c
++++ b/drivers/net/phy/swphy.c
+@@ -20,6 +20,8 @@
+ 
+ #include "swphy.h"
+ 
++#define MII_REGS_NUM 29
++
+ struct swmii_regs {
+ 	u16 bmcr;
+ 	u16 bmsr;
+@@ -110,14 +112,13 @@ int swphy_validate_state(const struct fi
+ EXPORT_SYMBOL_GPL(swphy_validate_state);
+ 
+ /**
+- * swphy_update_regs - update MII register array with fixed phy state
+- * @regs: array of 32 registers to update
++ * swphy_read_reg - return a MII register from the fixed phy state
++ * @reg: MII register
+  * @state: fixed phy status
+  *
+- * Update the array of MII registers with the fixed phy link, speed,
+- * duplex and pause mode settings.
++ * Return the MII @reg register generated from the fixed phy state @state.
+  */
+-void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state)
++int swphy_read_reg(int reg, const struct fixed_phy_status *state)
+ {
+ 	int speed_index, duplex_index;
+ 	u16 bmsr = BMSR_ANEGCAPABLE;
+@@ -125,9 +126,12 @@ void swphy_update_regs(u16 *regs, const
+ 	u16 lpagb = 0;
+ 	u16 lpa = 0;
+ 
++	if (reg > MII_REGS_NUM)
++		return -1;
++
+ 	speed_index = swphy_decode_speed(state->speed);
+ 	if (WARN_ON(speed_index < 0))
+-		return;
++		return 0;
+ 
+ 	duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
+ 
+@@ -147,12 +151,29 @@ void swphy_update_regs(u16 *regs, const
+ 			lpa |= LPA_PAUSE_ASYM;
+ 	}
+ 
+-	regs[MII_PHYSID1] = 0;
+-	regs[MII_PHYSID2] = 0;
++	switch (reg) {
++	case MII_BMCR:
++		return bmcr;
++	case MII_BMSR:
++		return bmsr;
++	case MII_PHYSID1:
++	case MII_PHYSID2:
++		return 0;
++	case MII_LPA:
++		return lpa;
++	case MII_STAT1000:
++		return lpagb;
++
++	/*
++	 * We do not support emulating Clause 45 over Clause 22 register
++	 * reads.  Return an error instead of bogus data.
++	 */
++	case MII_MMD_CTRL:
++	case MII_MMD_DATA:
++		return -1;
+ 
+-	regs[MII_BMSR] = bmsr;
+-	regs[MII_BMCR] = bmcr;
+-	regs[MII_LPA] = lpa;
+-	regs[MII_STAT1000] = lpagb;
++	default:
++		return 0xffff;
++	}
+ }
+-EXPORT_SYMBOL_GPL(swphy_update_regs);
++EXPORT_SYMBOL_GPL(swphy_read_reg);
+--- a/drivers/net/phy/swphy.h
++++ b/drivers/net/phy/swphy.h
+@@ -4,6 +4,6 @@
+ struct fixed_phy_status;
+ 
+ int swphy_validate_state(const struct fixed_phy_status *state);
+-void swphy_update_regs(u16 *regs, const struct fixed_phy_status *state);
++int swphy_read_reg(int reg, const struct fixed_phy_status *state);
+ 
+ #endif
diff --git a/target/linux/mvebu/patches-4.4/124-phy-improve-safety-of-fixed-phy-MII-register-reading.patch b/target/linux/mvebu/patches-4.4/124-phy-improve-safety-of-fixed-phy-MII-register-reading.patch
new file mode 100644
index 0000000..5167b07
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/124-phy-improve-safety-of-fixed-phy-MII-register-reading.patch
@@ -0,0 +1,92 @@
+From c36739c3cfd277a4cc9820a29dd0f4b7fbac795b Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 20 Sep 2015 18:31:36 +0100
+Subject: [PATCH 713/744] phy: improve safety of fixed-phy MII register reading
+
+There is no prevention of a concurrent call to both fixed_mdio_read()
+and fixed_phy_update_state(), which can result in the state being
+modified while it's being inspected.  Fix this by using a seqcount
+to detect modifications, and memcpy()ing the state.
+
+We remain slightly naughty here, calling link_update() and updating
+the link status within the read-side loop - which would need rework
+of the design to change.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/fixed_phy.c | 28 +++++++++++++++++++++-------
+ 1 file changed, 21 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/phy/fixed_phy.c
++++ b/drivers/net/phy/fixed_phy.c
+@@ -23,6 +23,7 @@
+ #include <linux/slab.h>
+ #include <linux/of.h>
+ #include <linux/gpio.h>
++#include <linux/seqlock.h>
+ 
+ #include "swphy.h"
+ 
+@@ -35,6 +36,7 @@ struct fixed_mdio_bus {
+ struct fixed_phy {
+ 	int addr;
+ 	struct phy_device *phydev;
++	seqcount_t seqcount;
+ 	struct fixed_phy_status status;
+ 	int (*link_update)(struct net_device *, struct fixed_phy_status *);
+ 	struct list_head node;
+@@ -59,13 +61,21 @@ static int fixed_mdio_read(struct mii_bu
+ 
+ 	list_for_each_entry(fp, &fmb->phys, node) {
+ 		if (fp->addr == phy_addr) {
+-			/* Issue callback if user registered it. */
+-			if (fp->link_update) {
+-				fp->link_update(fp->phydev->attached_dev,
+-						&fp->status);
+-				fixed_phy_update(fp);
+-			}
+-			return swphy_read_reg(reg_num, &fp->status);
++			struct fixed_phy_status state;
++			int s;
++
++			do {
++				s = read_seqcount_begin(&fp->seqcount);
++				/* Issue callback if user registered it. */
++				if (fp->link_update) {
++					fp->link_update(fp->phydev->attached_dev,
++							&fp->status);
++					fixed_phy_update(fp);
++				}
++				state = fp->status;
++			} while (read_seqcount_retry(&fp->seqcount, s));
++
++			return swphy_read_reg(reg_num, &state);
+ 		}
+ 	}
+ 
+@@ -117,6 +127,7 @@ int fixed_phy_update_state(struct phy_de
+ 
+ 	list_for_each_entry(fp, &fmb->phys, node) {
+ 		if (fp->addr == phydev->addr) {
++			write_seqcount_begin(&fp->seqcount);
+ #define _UPD(x) if (changed->x) \
+ 	fp->status.x = status->x
+ 			_UPD(link);
+@@ -126,6 +137,7 @@ int fixed_phy_update_state(struct phy_de
+ 			_UPD(asym_pause);
+ #undef _UPD
+ 			fixed_phy_update(fp);
++			write_seqcount_end(&fp->seqcount);
+ 			return 0;
+ 		}
+ 	}
+@@ -150,6 +162,8 @@ int fixed_phy_add(unsigned int irq, int
+ 	if (!fp)
+ 		return -ENOMEM;
+ 
++	seqcount_init(&fp->seqcount);
++
+ 	fmb->irqs[phy_addr] = irq;
+ 
+ 	fp->addr = phy_addr;
diff --git a/target/linux/mvebu/patches-4.4/125-phy-provide-a-hook-for-link-up-link-down-events.patch b/target/linux/mvebu/patches-4.4/125-phy-provide-a-hook-for-link-up-link-down-events.patch
new file mode 100644
index 0000000..b009689
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/125-phy-provide-a-hook-for-link-up-link-down-events.patch
@@ -0,0 +1,183 @@
+From d8b4e728f598d3c8a9b219d4679d5de350caa082 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Fri, 18 Sep 2015 14:42:16 +0100
+Subject: [PATCH 714/744] phy: provide a hook for link up/link down events
+
+Sometimes, we need to do additional work between the PHY coming up and
+marking the carrier present - for example, we may need to wait for the
+PHY to MAC link to finish negotiation.  This changes phylib to provide
+a notification function pointer which avoids the built-in
+netif_carrier_on() and netif_carrier_off() functions.
+
+Standard ->adjust_link functionality is provided by hooking a helper
+into the new ->phy_link_change method.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phy.c        | 42 ++++++++++++++++++++++--------------------
+ drivers/net/phy/phy_device.c | 14 ++++++++++++++
+ include/linux/phy.h          |  1 +
+ 3 files changed, 37 insertions(+), 20 deletions(-)
+
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -849,6 +849,16 @@ void phy_start(struct phy_device *phydev
+ }
+ EXPORT_SYMBOL(phy_start);
+ 
++static void phy_link_up(struct phy_device *phydev)
++{
++	phydev->phy_link_change(phydev, true, true);
++}
++
++static void phy_link_down(struct phy_device *phydev, bool do_carrier)
++{
++	phydev->phy_link_change(phydev, false, do_carrier);
++}
++
+ /**
+  * phy_state_machine - Handle the state machine
+  * @work: work_struct that describes the work to be done
+@@ -890,8 +900,7 @@ void phy_state_machine(struct work_struc
+ 		/* If the link is down, give up on negotiation for now */
+ 		if (!phydev->link) {
+ 			phydev->state = PHY_NOLINK;
+-			netif_carrier_off(phydev->attached_dev);
+-			phydev->adjust_link(phydev->attached_dev);
++			phy_link_down(phydev, true);
+ 			break;
+ 		}
+ 
+@@ -903,9 +912,7 @@ void phy_state_machine(struct work_struc
+ 		/* If AN is done, we're running */
+ 		if (err > 0) {
+ 			phydev->state = PHY_RUNNING;
+-			netif_carrier_on(phydev->attached_dev);
+-			phydev->adjust_link(phydev->attached_dev);
+-
++			phy_link_up(phydev);
+ 		} else if (0 == phydev->link_timeout--)
+ 			needs_aneg = true;
+ 		break;
+@@ -930,8 +937,7 @@ void phy_state_machine(struct work_struc
+ 				}
+ 			}
+ 			phydev->state = PHY_RUNNING;
+-			netif_carrier_on(phydev->attached_dev);
+-			phydev->adjust_link(phydev->attached_dev);
++			phy_link_up(phydev);
+ 		}
+ 		break;
+ 	case PHY_FORCING:
+@@ -941,13 +947,12 @@ void phy_state_machine(struct work_struc
+ 
+ 		if (phydev->link) {
+ 			phydev->state = PHY_RUNNING;
+-			netif_carrier_on(phydev->attached_dev);
++			phy_link_up(phydev);
+ 		} else {
+ 			if (0 == phydev->link_timeout--)
+ 				needs_aneg = true;
++			phy_link_down(phydev, false);
+ 		}
+-
+-		phydev->adjust_link(phydev->attached_dev);
+ 		break;
+ 	case PHY_RUNNING:
+ 		/* Only register a CHANGE if we are polling or ignoring
+@@ -970,14 +975,12 @@ void phy_state_machine(struct work_struc
+ 
+ 		if (phydev->link) {
+ 			phydev->state = PHY_RUNNING;
+-			netif_carrier_on(phydev->attached_dev);
++			phy_link_up(phydev);
+ 		} else {
+ 			phydev->state = PHY_NOLINK;
+-			netif_carrier_off(phydev->attached_dev);
++			phy_link_down(phydev, true);
+ 		}
+ 
+-		phydev->adjust_link(phydev->attached_dev);
+-
+ 		if (phy_interrupt_is_valid(phydev))
+ 			err = phy_config_interrupt(phydev,
+ 						   PHY_INTERRUPT_ENABLED);
+@@ -985,8 +988,7 @@ void phy_state_machine(struct work_struc
+ 	case PHY_HALTED:
+ 		if (phydev->link) {
+ 			phydev->link = 0;
+-			netif_carrier_off(phydev->attached_dev);
+-			phydev->adjust_link(phydev->attached_dev);
++			phy_link_down(phydev, true);
+ 			do_suspend = true;
+ 		}
+ 		break;
+@@ -1006,11 +1008,11 @@ void phy_state_machine(struct work_struc
+ 
+ 				if (phydev->link) {
+ 					phydev->state = PHY_RUNNING;
+-					netif_carrier_on(phydev->attached_dev);
++					phy_link_up(phydev);
+ 				} else	{
+ 					phydev->state = PHY_NOLINK;
++					phy_link_down(phydev, false);
+ 				}
+-				phydev->adjust_link(phydev->attached_dev);
+ 			} else {
+ 				phydev->state = PHY_AN;
+ 				phydev->link_timeout = PHY_AN_TIMEOUT;
+@@ -1022,11 +1024,11 @@ void phy_state_machine(struct work_struc
+ 
+ 			if (phydev->link) {
+ 				phydev->state = PHY_RUNNING;
+-				netif_carrier_on(phydev->attached_dev);
++				phy_link_up(phydev);
+ 			} else	{
+ 				phydev->state = PHY_NOLINK;
++				phy_link_down(phydev, false);
+ 			}
+-			phydev->adjust_link(phydev->attached_dev);
+ 		}
+ 		break;
+ 	}
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -441,6 +441,19 @@ struct phy_device *phy_find_first(struct
+ }
+ EXPORT_SYMBOL(phy_find_first);
+ 
++static void phy_link_change(struct phy_device *phydev, bool up, bool do_carrier)
++{
++	struct net_device *netdev = phydev->attached_dev;
++
++	if (do_carrier) {
++		if (up)
++			netif_carrier_on(netdev);
++		else
++			netif_carrier_off(netdev);
++	}
++	phydev->adjust_link(netdev);
++}
++
+ /**
+  * phy_prepare_link - prepares the PHY layer to monitor link status
+  * @phydev: target phy_device struct
+@@ -659,6 +672,7 @@ int phy_attach_direct(struct net_device
+ 		goto error;
+ 	}
+ 
++	phydev->phy_link_change = phy_link_change;
+ 	phydev->attached_dev = dev;
+ 	dev->phydev = phydev;
+ 
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -433,6 +433,7 @@ struct phy_device {
+ 
+ 	u8 mdix;
+ 
++	void (*phy_link_change)(struct phy_device *, bool up, bool do_carrier);
+ 	void (*adjust_link)(struct net_device *dev);
+ };
+ #define to_phy_device(d) container_of(d, struct phy_device, dev)
diff --git a/target/linux/mvebu/patches-4.4/126-phy-marvell-88E1512-add-flow-control-support.patch b/target/linux/mvebu/patches-4.4/126-phy-marvell-88E1512-add-flow-control-support.patch
new file mode 100644
index 0000000..e731c4d
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/126-phy-marvell-88E1512-add-flow-control-support.patch
@@ -0,0 +1,26 @@
+From 5eed0bf3bc3e69b20a13d8ffcdf97cb720391637 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 00:34:08 +0100
+Subject: [PATCH 735/744] phy: marvell: 88E1512: add flow control support
+
+The Marvell PHYs support pause frame advertisments, so we should not be
+masking their support off.  Add the necessary flag to the Marvell PHY
+to allow any MAC level pause frame support to be advertised.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/marvell.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/phy/marvell.c
++++ b/drivers/net/phy/marvell.c
+@@ -1142,7 +1142,7 @@ static struct phy_driver marvell_drivers
+ 		.phy_id = MARVELL_PHY_ID_88E1510,
+ 		.phy_id_mask = MARVELL_PHY_ID_MASK,
+ 		.name = "Marvell 88E1510",
+-		.features = PHY_GBIT_FEATURES,
++		.features = PHY_GBIT_FEATURES | SUPPORTED_Pause,
+ 		.flags = PHY_HAS_INTERRUPT,
+ 		.config_aneg = &m88e1510_config_aneg,
+ 		.read_status = &marvell_read_status,
diff --git a/target/linux/mvebu/patches-4.4/127-phy-export-phy_start_machine-for-phylink.patch b/target/linux/mvebu/patches-4.4/127-phy-export-phy_start_machine-for-phylink.patch
new file mode 100644
index 0000000..eb73933
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/127-phy-export-phy_start_machine-for-phylink.patch
@@ -0,0 +1,25 @@
+From f2a9687b39cda3fb67ecd5eaa88e3545e78c982c Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Fri, 16 Oct 2015 12:18:41 +0100
+Subject: [PATCH 715/744] phy: export phy_start_machine() for phylink
+
+phylink will need phy_start_machine exported, so lets export it as a
+GPL symbol.  Documentation/networking/phy.txt indicates that this
+should be a PHY API function.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phy.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -568,6 +568,7 @@ void phy_start_machine(struct phy_device
+ {
+ 	queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, HZ);
+ }
++EXPORT_SYMBOL_GPL(phy_start_machine);
+ 
+ /**
+  * phy_stop_machine - stop the PHY state machine tracking
diff --git a/target/linux/mvebu/patches-4.4/128-phy-export-phy_speed_to_str-for-phylink.patch b/target/linux/mvebu/patches-4.4/128-phy-export-phy_speed_to_str-for-phylink.patch
new file mode 100644
index 0000000..c436070
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/128-phy-export-phy_speed_to_str-for-phylink.patch
@@ -0,0 +1,44 @@
+From 5c77cc2ffd5deb4762d9551409472f2441297fe7 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 18 Oct 2015 19:51:10 +0100
+Subject: [PATCH 716/744] phy: export phy_speed_to_str() for phylink
+
+phylink would like to reuse phy_speed_to_str() to convert the speed
+to a string.  Add a prototype and export this helper function.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phy.c | 3 ++-
+ include/linux/phy.h   | 1 +
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -38,7 +38,7 @@
+ 
+ #include <asm/irq.h>
+ 
+-static const char *phy_speed_to_str(int speed)
++const char *phy_speed_to_str(int speed)
+ {
+ 	switch (speed) {
+ 	case SPEED_10:
+@@ -57,6 +57,7 @@ static const char *phy_speed_to_str(int
+ 		return "Unsupported (update phy.c)";
+ 	}
+ }
++EXPORT_SYMBOL_GPL(phy_speed_to_str);
+ 
+ #define PHY_STATE_STR(_state)			\
+ 	case PHY_##_state:			\
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -812,6 +812,7 @@ int phy_ethtool_gset(struct phy_device *
+ int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr);
+ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
+ int phy_start_interrupts(struct phy_device *phydev);
++const char *phy_speed_to_str(int speed);
+ void phy_print_status(struct phy_device *phydev);
+ void phy_device_free(struct phy_device *phydev);
+ int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
diff --git a/target/linux/mvebu/patches-4.4/129-phy-add-I2C-mdio-bus.patch b/target/linux/mvebu/patches-4.4/129-phy-add-I2C-mdio-bus.patch
new file mode 100644
index 0000000..13f8ecf
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/129-phy-add-I2C-mdio-bus.patch
@@ -0,0 +1,163 @@
+From 7f36ac946bfbd4090b8b94be3661b41ac73e21f4 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Fri, 25 Sep 2015 17:43:52 +0100
+Subject: [PATCH 717/744] phy: add I2C mdio bus
+
+Add an I2C MDIO bus bridge library, to allow phylib to access PHYs which
+are connected to an I2C bus instead of the more conventional MDIO bus.
+Such PHYs can be found in SFP adapters and SFF modules.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/Kconfig    | 10 ++++++
+ drivers/net/phy/Makefile   |  1 +
+ drivers/net/phy/mdio-i2c.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/net/phy/mdio-i2c.h | 19 ++++++++++
+ 4 files changed, 120 insertions(+)
+ create mode 100644 drivers/net/phy/mdio-i2c.c
+ create mode 100644 drivers/net/phy/mdio-i2c.h
+
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -233,6 +233,16 @@ config MDIO_GPIO
+ 	  To compile this driver as a module, choose M here: the module
+ 	  will be called mdio-gpio.
+ 
++config MDIO_I2C
++	tristate
++	depends on I2C
++	help
++	  Support I2C based PHYs.  This provides a MDIO bus bridged
++	  to I2C to allow PHYs connected in I2C mode to be accessed
++	  using the existing infrastructure.
++
++	  This is library mode.
++
+ config MDIO_OCTEON
+ 	tristate "Support for MDIO buses on Octeon and ThunderX SOCs"
+ 	depends on 64BIT
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -41,6 +41,7 @@ obj-$(CONFIG_SWCONFIG_B53)	+= b53/
+ obj-$(CONFIG_FIXED_PHY)		+= fixed_phy.o
+ obj-$(CONFIG_MDIO_BITBANG)	+= mdio-bitbang.o
+ obj-$(CONFIG_MDIO_GPIO)		+= mdio-gpio.o
++obj-$(CONFIG_MDIO_I2C)		+= mdio-i2c.o
+ obj-$(CONFIG_NATIONAL_PHY)	+= national.o
+ obj-$(CONFIG_DP83640_PHY)	+= dp83640.o
+ obj-$(CONFIG_DP83848_PHY)	+= dp83848.o
+--- /dev/null
++++ b/drivers/net/phy/mdio-i2c.c
+@@ -0,0 +1,90 @@
++/*
++ * MDIO I2C bridge
++ *
++ * Copyright (C) 2015 Russell King
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <linux/i2c.h>
++#include <linux/phy.h>
++
++#include "mdio-i2c.h"
++
++static int i2c_mii_read(struct mii_bus *bus, int phy_id, int reg)
++{
++	struct i2c_adapter *i2c = bus->priv;
++	struct i2c_msg msgs[2];
++	u8 data[2], dev_addr = reg;
++	int bus_addr, ret;
++
++	bus_addr = 0x40 + phy_id;
++	if (bus_addr == 0x50 || bus_addr == 0x51)
++		return 0xffff;
++
++	msgs[0].addr = bus_addr;
++	msgs[0].flags = 0;
++	msgs[0].len = 1;
++	msgs[0].buf = &dev_addr;
++	msgs[1].addr = bus_addr;
++	msgs[1].flags = I2C_M_RD;
++	msgs[1].len = sizeof(data);
++	msgs[1].buf = data;
++
++	ret = i2c_transfer(i2c, msgs, ARRAY_SIZE(msgs));
++	if (ret != ARRAY_SIZE(msgs))
++		return 0xffff;
++
++	return data[0] << 8 | data[1];
++}
++
++static int i2c_mii_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
++{
++	struct i2c_adapter *i2c = bus->priv;
++	struct i2c_msg msg;
++	int bus_addr, ret;
++	u8 data[3];
++
++	bus_addr = 0x40 + phy_id;
++	if (bus_addr == 0x50 || bus_addr == 0x51)
++		return 0;
++
++	data[0] = reg;
++	data[1] = val >> 8;
++	data[2] = val;
++
++	msg.addr = bus_addr;
++	msg.flags = 0;
++	msg.len = 3;
++	msg.buf = data;
++
++	ret = i2c_transfer(i2c, &msg, 1);
++
++	return ret < 0 ? ret : 0;
++}
++
++struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c)
++{
++	struct mii_bus *mii;
++
++	if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
++		return ERR_PTR(-EINVAL);
++
++	mii = mdiobus_alloc();
++	if (!mii)
++		return ERR_PTR(-ENOMEM);
++
++	snprintf(mii->id, MII_BUS_ID_SIZE, "i2c:%s", dev_name(parent));
++	mii->parent = parent;
++	mii->read = i2c_mii_read;
++	mii->write = i2c_mii_write;
++	mii->priv = i2c;
++
++	return mii;
++}
++EXPORT_SYMBOL_GPL(mdio_i2c_alloc);
++
++MODULE_AUTHOR("Russell King");
++MODULE_DESCRIPTION("MDIO I2C bridge library");
++MODULE_LICENSE("GPL v2");
+--- /dev/null
++++ b/drivers/net/phy/mdio-i2c.h
+@@ -0,0 +1,19 @@
++/*
++ * MDIO I2C bridge
++ *
++ * Copyright (C) 2015 Russell King
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#ifndef MDIO_I2C_H
++#define MDIO_I2C_H
++
++struct device;
++struct i2c_adapter;
++struct mii_bus;
++
++struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c);
++
++#endif
diff --git a/target/linux/mvebu/patches-4.4/130-phylink-add-phylink-infrastructure.patch b/target/linux/mvebu/patches-4.4/130-phylink-add-phylink-infrastructure.patch
new file mode 100644
index 0000000..0d340c8
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/130-phylink-add-phylink-infrastructure.patch
@@ -0,0 +1,1005 @@
+From c6de6de7d3df13822872ac756eebe868d236297a Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Tue, 22 Sep 2015 20:52:18 +0100
+Subject: [PATCH 718/744] phylink: add phylink infrastructure
+
+The link between the ethernet MAC and its PHY has become more complex
+as the interface evolves.  This is especially true with serdes links,
+where the part of the PHY is effectively integrated into the MAC.
+
+Serdes links can be connected to a variety of devices, including SFF
+modules soldered down onto the board with the MAC, a SFP cage with
+a hotpluggable SFP module which may contain a PHY or directly modulate
+the serdes signals onto optical media with or without a PHY, or even
+a classical PHY connection.
+
+Moreover, the negotiation information on serdes links comes in two
+varieties - SGMII mode, where the PHY provides its speed/duplex/flow
+control information to the MAC, and 1000base-X mode where both ends
+exchange their abilities and each resolve the link capabilities.
+
+This means we need a more flexible means to support these arrangements,
+particularly with the hotpluggable nature of SFP, where the PHY can
+be attached or detached after the network device has been brought up.
+
+Ethtool information can come from multiple sources:
+- we may have a PHY operating in either SGMII or 1000base-X mode, in
+  which case we take ethtool/mii data directly from the PHY.
+- we may have a optical SFP module without a PHY, with the MAC
+  operating in 1000base-X mode - the ethtool/mii data needs to come
+  from the MAC.
+- we may have a copper SFP module with a PHY whic can't be accessed,
+  which means we need to take ethtool/mii data from the MAC.
+
+Phylink aims to solve this by providing an intermediary between the
+MAC and PHY, providing a safe way for PHYs to be hotplugged, and
+allowing a SFP driver to reconfigure the serdes connection.
+
+Phylink also takes over support of fixed link connections, where
+the speed/duplex/flow control are fixed, but link status may be
+controlled by a GPIO signal.  By avoiding the fixed-phy implementation,
+phylink can provide a faster response to link events: fixed-phy has
+to wait for phylib to operate its state machine, which can take
+several seconds.  In comparison, phylink takes milliseconds.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/Kconfig      |  10 +
+ drivers/net/phy/Makefile     |   1 +
+ drivers/net/phy/phy_device.c |   1 +
+ drivers/net/phy/phylink.c    | 816 +++++++++++++++++++++++++++++++++++++++++++
+ include/linux/phy.h          |   2 +
+ include/linux/phylink.h      |  70 ++++
+ 6 files changed, 900 insertions(+)
+ create mode 100644 drivers/net/phy/phylink.c
+ create mode 100644 include/linux/phylink.h
+
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -10,6 +10,16 @@ menuconfig PHYLIB
+ 	  devices.  This option provides infrastructure for
+ 	  managing PHY devices.
+ 
++config PHYLINK
++	tristate
++	depends on NETDEVICES
++	select PHYLIB
++	select SWPHY
++	help
++	  PHYlink models the link between the PHY and MAC, allowing fixed
++	  configuration links, PHYs, and Serdes links with MAC level
++	  autonegotiation modes.
++
+ if PHYLIB
+ 
+ config MDIO_BOARDINFO
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -5,6 +5,7 @@ libphy-$(CONFIG_SWPHY)		+= swphy.o
+ 
+ obj-$(CONFIG_MDIO_BOARDINFO)	+= mdio-boardinfo.o
+ 
++obj-$(CONFIG_PHYLINK)		+= phylink.o
+ obj-$(CONFIG_PHYLIB)		+= libphy.o
+ obj-$(CONFIG_SWCONFIG)		+= swconfig.o
+ obj-$(CONFIG_AQUANTIA_PHY)	+= aquantia.o
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -754,6 +754,7 @@ void phy_detach(struct phy_device *phyde
+ 	phydev->attached_dev->phydev = NULL;
+ 	phydev->attached_dev = NULL;
+ 	phy_suspend(phydev);
++	phydev->phylink = NULL;
+ 
+ 	/* If the device had no specific driver before (i.e. - it
+ 	 * was using the generic driver), we unbind the device
+--- /dev/null
++++ b/drivers/net/phy/phylink.c
+@@ -0,0 +1,816 @@
++/*
++ * phylink models the MAC to optional PHY connection, supporting
++ * technologies such as SFP cages where the PHY is hot-pluggable.
++ *
++ * Copyright (C) 2015 Russell King
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <linux/ethtool.h>
++#include <linux/export.h>
++#include <linux/gpio/consumer.h>
++#include <linux/netdevice.h>
++#include <linux/of.h>
++#include <linux/of_mdio.h>
++#include <linux/phy.h>
++#include <linux/phy_fixed.h>
++#include <linux/phylink.h>
++#include <linux/spinlock.h>
++#include <linux/workqueue.h>
++
++#include "swphy.h"
++
++#define SUPPORTED_INTERFACES \
++	(SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_FIBRE | \
++	 SUPPORTED_BNC | SUPPORTED_AUI | SUPPORTED_Backplane)
++#define ADVERTISED_INTERFACES \
++	(ADVERTISED_TP | ADVERTISED_MII | ADVERTISED_FIBRE | \
++	 ADVERTISED_BNC | ADVERTISED_AUI | ADVERTISED_Backplane)
++
++enum {
++	PHYLINK_DISABLE_STOPPED,
++};
++
++struct phylink {
++	struct net_device *netdev;
++	const struct phylink_mac_ops *ops;
++	struct mutex config_mutex;
++
++	unsigned long phylink_disable_state; /* bitmask of disables */
++	struct phy_device *phydev;
++	phy_interface_t link_interface;	/* PHY_INTERFACE_xxx */
++	u8 link_an_mode;		/* MLO_AN_xxx */
++	u8 link_port;			/* The current non-phy ethtool port */
++	u32 link_port_support;		/* SUPPORTED_xxx ethtool for ports */
++
++	/* The link configuration settings */
++	struct phylink_link_state link_config;
++	struct gpio_desc *link_gpio;
++
++	struct mutex state_mutex;	/* may be taken within config_mutex */
++	struct phylink_link_state phy_state;
++	struct work_struct resolve;
++
++	bool mac_link_up;
++};
++
++static const char *phylink_an_mode_str(unsigned int mode)
++{
++	static const char *modestr[] = {
++		[MLO_AN_PHY] = "phy",
++		[MLO_AN_FIXED] = "fixed",
++		[MLO_AN_SGMII] = "SGMII",
++		[MLO_AN_8023Z] = "802.3z",
++	};
++
++	return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
++}
++
++static int phylink_parse_fixedlink(struct phylink *pl, struct device_node *np)
++{
++	struct device_node *fixed_node;
++	int ret, len;
++
++	fixed_node = of_get_child_by_name(np, "fixed-link");
++	if (fixed_node) {
++		struct gpio_desc *desc;
++		u32 speed;
++
++		ret = of_property_read_u32(fixed_node, "speed", &speed);
++
++		pl->link_an_mode = MLO_AN_FIXED;
++		pl->link_config.link = 1;
++		pl->link_config.an_complete = 1;
++		pl->link_config.speed = speed;
++		pl->link_config.duplex = DUPLEX_HALF;
++		pl->link_config.pause = MLO_PAUSE_NONE;
++
++		if (of_property_read_bool(fixed_node, "full-duplex"))
++			pl->link_config.duplex = DUPLEX_FULL;
++		if (of_property_read_bool(fixed_node, "pause"))
++			pl->link_config.pause |= MLO_PAUSE_SYM;
++		if (of_property_read_bool(fixed_node, "asym-pause"))
++			pl->link_config.pause |= MLO_PAUSE_ASYM;
++
++		if (ret == 0) {
++			desc = fwnode_get_named_gpiod(&fixed_node->fwnode,
++						      "link-gpios");
++
++			if (!IS_ERR(desc))
++				pl->link_gpio = desc;
++			else if (desc == ERR_PTR(-EPROBE_DEFER))
++				ret = -EPROBE_DEFER;
++		}
++		of_node_put(fixed_node);
++	} else {
++		const __be32 *fixed_prop;
++
++		fixed_prop = of_get_property(np, "fixed-link", &len);
++		if (fixed_prop && len == 5 * sizeof(*fixed_prop)) {
++			pl->link_config.duplex = be32_to_cpu(fixed_prop[1]) ?
++						DUPLEX_FULL : DUPLEX_HALF;
++			pl->link_config.speed = be32_to_cpu(fixed_prop[2]);
++			pl->link_config.pause = MLO_PAUSE_NONE;
++			if (be32_to_cpu(fixed_prop[3]))
++				pl->link_config.pause |= MLO_PAUSE_SYM;
++			if (be32_to_cpu(fixed_prop[4]))
++				pl->link_config.pause |= MLO_PAUSE_ASYM;
++
++			pl->link_an_mode = MLO_AN_FIXED;
++		}
++		ret = 0;
++	}
++
++	if (pl->link_an_mode == MLO_AN_FIXED) {
++		/* Generate the supported/advertising masks */
++		if (pl->link_config.pause & MLO_PAUSE_SYM) {
++			pl->link_config.supported |= SUPPORTED_Pause;
++			pl->link_config.advertising |= ADVERTISED_Pause;
++		}
++		if (pl->link_config.pause & MLO_PAUSE_ASYM) {
++			pl->link_config.supported |= SUPPORTED_Asym_Pause;
++			pl->link_config.advertising |= ADVERTISED_Asym_Pause;
++		}
++
++		if (pl->link_config.speed > SPEED_1000 &&
++		    pl->link_config.duplex != DUPLEX_FULL)
++			netdev_warn(pl->netdev, "fixed link specifies half duplex for %dMbps link?\n",
++				    pl->link_config.speed);
++
++#define S(spd) \
++	pl->link_config.supported |= pl->link_config.duplex ? \
++		SUPPORTED_##spd##_Full : SUPPORTED_##spd##_Half
++#define A(spd) \
++	pl->link_config.advertising |= pl->link_config.duplex ? \
++		ADVERTISED_##spd##_Full : ADVERTISED_##spd##_Half
++#define C(spd, tech) \
++		case spd: \
++			S(spd##tech); \
++			A(spd##tech); \
++			break
++		switch (pl->link_config.speed) {
++		C(10, baseT);
++		C(100, baseT);
++		C(1000, baseT);
++#undef S
++#undef A
++#define S(spd) pl->link_config.supported |= SUPPORTED_##spd##_Full
++#define A(spd) pl->link_config.advertising |= ADVERTISED_##spd##_Full
++		C(2500, baseX);
++		C(10000, baseT);
++		}
++#undef S
++#undef A
++#undef C
++	}
++	return ret;
++}
++
++static int phylink_parse_managed(struct phylink *pl, struct device_node *np)
++{
++	const char *managed;
++
++	if (of_property_read_string(np, "managed", &managed) == 0 &&
++	    strcmp(managed, "in-band-status") == 0) {
++		if (pl->link_an_mode == MLO_AN_FIXED) {
++			netdev_err(pl->netdev,
++				   "can't use both fixed-link and in-band-status\n");
++			return -EINVAL;
++		}
++		pl->link_an_mode = MLO_AN_SGMII;
++		pl->link_config.an_enabled = true;
++	}
++
++	return 0;
++}
++
++
++static int phylink_get_support(struct phylink *pl, unsigned int mode)
++{
++	struct phylink_link_state state = pl->link_config;
++	int ret;
++
++	ret = pl->ops->mac_get_support(pl->netdev, mode, &state);
++	if (ret == 0) {
++		pl->link_an_mode = mode;
++		pl->link_config = state;
++	}
++
++	return ret;
++}
++
++static void phylink_mac_config(struct phylink *pl,
++			       const struct phylink_link_state *state)
++{
++	pl->ops->mac_config(pl->netdev, pl->link_an_mode, state);
++}
++
++static void phylink_mac_an_restart(struct phylink *pl)
++{
++	if (pl->link_config.an_enabled)
++		pl->ops->mac_an_restart(pl->netdev, pl->link_an_mode);
++}
++
++static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state *state)
++{
++	struct net_device *ndev = pl->netdev;
++
++	state->supported = pl->link_config.supported;
++	state->advertising = pl->link_config.advertising;
++	state->an_enabled = pl->link_config.an_enabled;
++	state->link = 1;
++	state->sync = 1;
++
++	return pl->ops->mac_link_state(ndev, state);
++}
++
++/* The fixed state is... fixed except for the link state,
++ * which may be determined by a GPIO.
++ */
++static void phylink_get_fixed_state(struct phylink *pl, struct phylink_link_state *state)
++{
++	*state = pl->link_config;
++	if (pl->link_gpio)
++		state->link = !!gpiod_get_value(pl->link_gpio);
++}
++
++extern const char *phy_speed_to_str(int speed);
++
++static void phylink_resolve(struct work_struct *w)
++{
++	struct phylink *pl = container_of(w, struct phylink, resolve);
++	struct phylink_link_state link_state;
++	struct net_device *ndev = pl->netdev;
++
++	mutex_lock(&pl->state_mutex);
++	if (pl->phylink_disable_state) {
++		link_state.link = false;
++	} else {
++		switch (pl->link_an_mode) {
++		case MLO_AN_PHY:
++			link_state = pl->phy_state;
++			break;
++
++		case MLO_AN_FIXED:
++			phylink_get_fixed_state(pl, &link_state);
++			break;
++
++		case MLO_AN_SGMII:
++			phylink_get_mac_state(pl, &link_state);
++			if (pl->phydev)
++				link_state.link = link_state.link &&
++						  pl->phy_state.link;
++			break;
++
++		case MLO_AN_8023Z:
++			phylink_get_mac_state(pl, &link_state);
++			break;
++		}
++	}
++
++	if (link_state.link != netif_carrier_ok(ndev)) {
++		if (!link_state.link) {
++			netif_carrier_off(ndev);
++			pl->ops->mac_link_down(ndev, pl->link_an_mode);
++			netdev_info(ndev, "Link is Down\n");
++		} else {
++			/* If we have a PHY, we need the MAC updated with
++			 * the current link parameters (eg, in SGMII mode,
++			 * with flow control status.)
++			 */
++			if (pl->phydev)
++				phylink_mac_config(pl, &link_state);
++
++			pl->ops->mac_link_up(ndev, pl->link_an_mode);
++
++			netif_carrier_on(ndev);
++
++			netdev_info(ndev,
++				    "Link is Up - %s/%s - flow control %s\n",
++				    phy_speed_to_str(link_state.speed),
++				    link_state.duplex ? "Full" : "Half",
++				    link_state.pause ? "rx/tx" : "off");
++		}
++	}
++	mutex_unlock(&pl->state_mutex);
++}
++
++static void phylink_run_resolve(struct phylink *pl)
++{
++	if (!pl->phylink_disable_state)
++		queue_work(system_power_efficient_wq, &pl->resolve);
++}
++
++struct phylink *phylink_create(struct net_device *ndev, struct device_node *np,
++	phy_interface_t iface, const struct phylink_mac_ops *ops)
++{
++	struct phylink *pl;
++	int ret;
++
++	pl = kzalloc(sizeof(*pl), GFP_KERNEL);
++	if (!pl)
++		return ERR_PTR(-ENOMEM);
++
++	mutex_init(&pl->state_mutex);
++	mutex_init(&pl->config_mutex);
++	INIT_WORK(&pl->resolve, phylink_resolve);
++	pl->netdev = ndev;
++	pl->link_interface = iface;
++	pl->link_port_support = SUPPORTED_MII;
++	pl->link_port = PORT_MII;
++	pl->ops = ops;
++	__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
++
++	ret = phylink_parse_fixedlink(pl, np);
++	if (ret < 0) {
++		kfree(pl);
++		return ERR_PTR(ret);
++	}
++
++	ret = phylink_parse_managed(pl, np);
++	if (ret < 0) {
++		kfree(pl);
++		return ERR_PTR(ret);
++	}
++
++	ret = phylink_get_support(pl, pl->link_an_mode);
++	if (ret) {
++		kfree(pl);
++		return ERR_PTR(ret);
++	}
++
++	return pl;
++}
++EXPORT_SYMBOL_GPL(phylink_create);
++
++void phylink_destroy(struct phylink *pl)
++{
++	cancel_work_sync(&pl->resolve);
++	kfree(pl);
++}
++EXPORT_SYMBOL_GPL(phylink_destroy);
++
++void phylink_phy_change(struct phy_device *phy, bool up, bool do_carrier)
++{
++	struct phylink *pl = phy->phylink;
++
++	mutex_lock(&pl->state_mutex);
++	pl->phy_state.speed = phy->speed;
++	pl->phy_state.duplex = phy->duplex;
++	pl->phy_state.pause = MLO_PAUSE_NONE;
++	if (phy->pause)
++		pl->phy_state.pause |= MLO_PAUSE_SYM;
++	if (phy->asym_pause)
++		pl->phy_state.pause |= MLO_PAUSE_ASYM;
++	pl->phy_state.link = up;
++	mutex_unlock(&pl->state_mutex);
++
++	phylink_run_resolve(pl);
++
++	netdev_dbg(pl->netdev, "phy link %s\n", up ? "up" : "down");
++}
++
++static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
++{
++	mutex_lock(&pl->config_mutex);
++	phy->phylink = pl;
++	phy->phy_link_change = phylink_phy_change;
++
++	netdev_info(pl->netdev,
++		    "PHY [%s] driver [%s]\n", dev_name(&phy->dev),
++		    phy->drv->name);
++
++	mutex_lock(&pl->state_mutex);
++	pl->phydev = phy;
++
++	/* Restrict the phy advertisment to the union of the PHY and
++	 * MAC-level advert.
++	 */
++	phy->advertising &= ADVERTISED_INTERFACES |
++			    pl->link_config.advertising;
++	mutex_unlock(&pl->state_mutex);
++
++	phy_start_machine(phy);
++	if (phy->irq > 0)
++		phy_start_interrupts(phy);
++
++	mutex_unlock(&pl->config_mutex);
++
++	return 0;
++}
++
++int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
++{
++	int ret;
++
++	ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);
++	if (ret)
++		return ret;
++
++	ret = phylink_bringup_phy(pl, phy);
++	if (ret)
++		phy_detach(phy);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_connect_phy);
++
++int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn)
++{
++	struct device_node *phy_node;
++	struct phy_device *phy_dev;
++	int ret;
++
++	/* Fixed links are handled without needing a PHY */
++	if (pl->link_an_mode == MLO_AN_FIXED)
++		return 0;
++
++	phy_node = of_parse_phandle(dn, "phy-handle", 0);
++	if (!phy_node)
++		phy_node = of_parse_phandle(dn, "phy", 0);
++	if (!phy_node)
++		phy_node = of_parse_phandle(dn, "phy-device", 0);
++
++	if (!phy_node) {
++		if (pl->link_an_mode == MLO_AN_PHY) {
++			netdev_err(pl->netdev, "unable to find PHY node\n");
++			return -ENODEV;
++		}
++		return 0;
++	}
++
++	phy_dev = of_phy_attach(pl->netdev, phy_node, 0, pl->link_interface);
++	/* We're done with the phy_node handle */
++	of_node_put(phy_node);
++
++	if (!phy_dev)
++		return -ENODEV;
++
++	ret = phylink_bringup_phy(pl, phy_dev);
++	if (ret)
++		phy_detach(phy_dev);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_of_phy_connect);
++
++void phylink_disconnect_phy(struct phylink *pl)
++{
++	struct phy_device *phy;
++
++	mutex_lock(&pl->config_mutex);
++	phy = pl->phydev;
++
++	mutex_lock(&pl->state_mutex);
++	pl->phydev = NULL;
++	mutex_unlock(&pl->state_mutex);
++	flush_work(&pl->resolve);
++
++	if (phy)
++		phy_disconnect(phy);
++
++	mutex_unlock(&pl->config_mutex);
++}
++EXPORT_SYMBOL_GPL(phylink_disconnect_phy);
++
++void phylink_mac_change(struct phylink *pl, bool up)
++{
++	phylink_run_resolve(pl);
++	netdev_dbg(pl->netdev, "mac link %s\n", up ? "up" : "down");
++}
++EXPORT_SYMBOL_GPL(phylink_mac_change);
++
++void phylink_start(struct phylink *pl)
++{
++	mutex_lock(&pl->config_mutex);
++
++	netdev_info(pl->netdev, "configuring for %s link mode\n",
++		    phylink_an_mode_str(pl->link_an_mode));
++
++	/* Apply the link configuration to the MAC when starting. This allows
++	 * a fixed-link to start with the correct parameters, and also
++	 * ensures that we set the appropriate advertisment for Serdes links.
++	 */
++	phylink_mac_config(pl, &pl->link_config);
++
++	clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
++	phylink_run_resolve(pl);
++
++	if (pl->phydev)
++		phy_start(pl->phydev);
++
++	mutex_unlock(&pl->config_mutex);
++}
++EXPORT_SYMBOL_GPL(phylink_start);
++
++void phylink_stop(struct phylink *pl)
++{
++	mutex_lock(&pl->config_mutex);
++
++	if (pl->phydev)
++		phy_stop(pl->phydev);
++
++	set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
++	flush_work(&pl->resolve);
++
++	pl->mac_link_up = false;
++
++	mutex_unlock(&pl->config_mutex);
++}
++EXPORT_SYMBOL_GPL(phylink_stop);
++
++static void phylink_get_ethtool(const struct phylink_link_state *state,
++				struct ethtool_cmd *cmd)
++{
++	cmd->supported &= SUPPORTED_INTERFACES;
++	cmd->supported |= state->supported;
++	cmd->advertising &= ADVERTISED_INTERFACES;
++	cmd->advertising |= state->advertising;
++	ethtool_cmd_speed_set(cmd, state->speed);
++	cmd->duplex = state->duplex;
++
++	cmd->autoneg = state->an_enabled ? AUTONEG_ENABLE : AUTONEG_DISABLE;
++}
++
++static int phylink_ethtool_gset(struct phylink *pl, struct ethtool_cmd *cmd)
++{
++	struct phylink_link_state link_state;
++	int ret;
++
++	if (pl->phydev) {
++		ret = phy_ethtool_gset(pl->phydev, cmd);
++		if (ret)
++			return ret;
++
++		cmd->supported &= SUPPORTED_INTERFACES |
++				  pl->link_config.supported;
++	} else {
++		cmd->supported = pl->link_port_support;
++		cmd->transceiver = XCVR_EXTERNAL;
++		cmd->port = pl->link_port;
++	}
++
++	switch (pl->link_an_mode) {
++	case MLO_AN_FIXED:
++		/* We are using fixed settings. Report these as the
++		 * current link settings - and note that these also
++		 * represent the supported speeds/duplex/pause modes.
++		 */
++		phylink_get_fixed_state(pl, &link_state);
++		phylink_get_ethtool(&link_state, cmd);
++		break;
++
++	case MLO_AN_SGMII:
++		/* If there is a phy attached, then use the reported
++		 * settings from the phy with no modification.
++		 */
++		if (pl->phydev)
++			break;
++
++	case MLO_AN_8023Z:
++		phylink_get_mac_state(pl, &link_state);
++
++		/* The MAC is reporting the link results from its own PCS
++		 * layer via in-band status. Report these as the current
++		 * link settings.
++		 */
++		phylink_get_ethtool(&link_state, cmd);
++		break;
++	}
++
++	return 0;
++}
++
++int phylink_ethtool_get_settings(struct phylink *pl, struct ethtool_cmd *cmd)
++{
++	int ret;
++
++	mutex_lock(&pl->config_mutex);
++	ret = phylink_ethtool_gset(pl, cmd);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_get_settings);
++
++static int phylink_ethtool_sset(struct phylink *pl, struct ethtool_cmd *cmd)
++{
++	u32 supported;
++	int ret;
++
++	/* Calculate the union of the MAC support and attached phy support */
++	supported = pl->link_config.supported;
++	if (pl->phydev)
++		supported &= pl->phydev->supported;
++
++	/* Mask out unsupported advertisments */
++	cmd->advertising &= supported;
++
++	/* FIXME: should we reject autoneg if phy/mac does not support it? */
++
++	if (cmd->autoneg == AUTONEG_DISABLE) {
++		/* Autonegotiation disabled, validate speed and duplex */
++		if (cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL)
++			return -EINVAL;
++
++		/* FIXME: validate speed/duplex against supported */
++
++		cmd->advertising &= ~ADVERTISED_Autoneg;
++	} else {
++		/* Autonegotiation enabled, validate advertisment */
++		/* FIXME: shouldn't we ensure there's some duplex/speeds set */
++		if (cmd->advertising == 0)
++			return -EINVAL;
++
++		cmd->advertising |= ADVERTISED_Autoneg;
++	}
++
++	/* If we have a fixed link (as specified by firmware), refuse
++	 * to enable autonegotiation, or change link parameters.
++	 */
++	if (pl->link_an_mode == MLO_AN_FIXED) {
++		if (cmd->autoneg != AUTONEG_DISABLE ||
++		    ethtool_cmd_speed(cmd) != pl->link_config.speed ||
++		    cmd->duplex != pl->link_config.duplex)
++			return -EINVAL;
++	}
++
++	/* If we have a PHY, configure the phy */
++	if (pl->phydev) {
++		ret = phy_ethtool_sset(pl->phydev, cmd);
++		if (ret)
++			return ret;
++	}
++
++	mutex_lock(&pl->state_mutex);
++	/* Configure the MAC to match the new settings */
++	pl->link_config.advertising = cmd->advertising;
++	pl->link_config.speed = cmd->speed;
++	pl->link_config.duplex = cmd->duplex;
++	pl->link_config.an_enabled = cmd->autoneg != AUTONEG_DISABLE;
++
++	phylink_mac_config(pl, &pl->link_config);
++	phylink_mac_an_restart(pl);
++	mutex_unlock(&pl->state_mutex);
++
++	return ret;
++}
++
++int phylink_ethtool_set_settings(struct phylink *pl, struct ethtool_cmd *cmd)
++{
++	int ret;
++
++	if (cmd->autoneg != AUTONEG_DISABLE && cmd->autoneg != AUTONEG_ENABLE)
++		return -EINVAL;
++
++	mutex_lock(&pl->config_mutex);
++	ret = phylink_ethtool_sset(pl, cmd);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_set_settings);
++
++/* This emulates MII registers for a fixed-mode phy operating as per the
++ * passed in state. "aneg" defines if we report negotiation is possible.
++ *
++ * FIXME: should deal with negotiation state too.
++ */
++static int phylink_mii_emul_read(struct net_device *ndev, unsigned int reg,
++				 struct phylink_link_state *state, bool aneg)
++{
++	struct fixed_phy_status fs;
++	int val;
++
++	fs.link = state->link;
++	fs.speed = state->speed;
++	fs.duplex = state->duplex;
++	fs.pause = state->pause & MLO_PAUSE_SYM;
++	fs.asym_pause = state->pause & MLO_PAUSE_ASYM;
++
++	val = swphy_read_reg(reg, &fs);
++	if (reg == MII_BMSR) {
++		if (!state->an_complete)
++			val &= ~BMSR_ANEGCOMPLETE;
++		if (!aneg)
++			val &= ~BMSR_ANEGCAPABLE;
++	}
++	return val;
++}
++
++static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
++			    unsigned int reg)
++{
++	struct phylink_link_state state;
++	int val = 0xffff;
++
++	if (pl->phydev && pl->phydev->addr != phy_id)
++		return mdiobus_read(pl->phydev->bus, phy_id, reg);
++
++	if (!pl->phydev && phy_id != 0)
++		return val;
++
++	switch (pl->link_an_mode) {
++	case MLO_AN_FIXED:
++		phylink_get_fixed_state(pl, &state);
++		val = phylink_mii_emul_read(pl->netdev, reg, &state, true);
++		break;
++
++	case MLO_AN_PHY:
++		val = mdiobus_read(pl->phydev->bus, phy_id, reg);
++		break;
++
++	case MLO_AN_SGMII:
++		if (pl->phydev) {
++			val = mdiobus_read(pl->phydev->bus,
++					   pl->phydev->addr, reg);
++			break;
++		}
++		/* No phy, fall through to reading the MAC end */
++	case MLO_AN_8023Z:
++		val = phylink_get_mac_state(pl, &state);
++		if (val < 0)
++			return val;
++
++		val = phylink_mii_emul_read(pl->netdev, reg, &state, true);
++		break;
++	}
++
++	return val & 0xffff;
++}
++
++static void phylink_mii_write(struct phylink *pl, unsigned int phy_id,
++			      unsigned int reg, unsigned int val)
++{
++	if (pl->phydev && pl->phydev->addr != phy_id) {
++		mdiobus_write(pl->phydev->bus, phy_id, reg, val);
++		return;
++	}
++
++	if (!pl->phydev && phy_id != 0)
++		return;
++
++	switch (pl->link_an_mode) {
++	case MLO_AN_FIXED:
++		break;
++
++	case MLO_AN_PHY:
++		mdiobus_write(pl->phydev->bus, pl->phydev->addr,
++			      reg, val);
++		break;
++
++	case MLO_AN_SGMII:
++		if (pl->phydev) {
++			mdiobus_write(pl->phydev->bus, phy_id, reg, val);
++			break;
++		}
++		/* No phy, fall through to reading the MAC end */
++	case MLO_AN_8023Z:
++		break;
++	}
++}
++
++int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
++{
++	struct mii_ioctl_data *mii_data = if_mii(ifr);
++	int val, ret;
++
++	mutex_lock(&pl->config_mutex);
++
++	switch (cmd) {
++	case SIOCGMIIPHY:
++		mii_data->phy_id = pl->phydev ? pl->phydev->addr : 0;
++		/* fallthrough */
++
++	case SIOCGMIIREG:
++		val = phylink_mii_read(pl, mii_data->phy_id, mii_data->reg_num);
++		if (val < 0) {
++			ret = val;
++		} else {
++			mii_data->val_out = val;
++			ret = 0;
++		}
++		break;
++
++	case SIOCSMIIREG:
++		phylink_mii_write(pl, mii_data->phy_id, mii_data->reg_num,
++				  mii_data->val_in);
++		ret = 0;
++		break;
++
++	default:
++		ret = -EOPNOTSUPP;
++		if (pl->phydev)
++			ret = phy_mii_ioctl(pl->phydev, ifr, cmd);
++		break;
++	}
++
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_mii_ioctl);
++
++MODULE_LICENSE("GPL");
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -147,6 +147,7 @@ static inline const char *phy_modes(phy_
+ #define MII_ADDR_C45 (1<<30)
+ 
+ struct device;
++struct phylink;
+ struct sk_buff;
+ 
+ /*
+@@ -429,6 +430,7 @@ struct phy_device {
+ 
+ 	struct mutex lock;
+ 
++	struct phylink *phylink;
+ 	struct net_device *attached_dev;
+ 
+ 	u8 mdix;
+--- /dev/null
++++ b/include/linux/phylink.h
+@@ -0,0 +1,70 @@
++#ifndef NETDEV_PCS_H
++#define NETDEV_PCS_H
++
++#include <linux/phy.h>
++#include <linux/spinlock.h>
++#include <linux/workqueue.h>
++
++struct device_node;
++struct ethtool_cmd;
++struct net_device;
++
++enum {
++	MLO_PAUSE_NONE,
++	MLO_PAUSE_ASYM = BIT(0),
++	MLO_PAUSE_SYM = BIT(1),
++
++	MLO_AN_PHY = 0,
++	MLO_AN_FIXED,
++	MLO_AN_SGMII,
++	MLO_AN_8023Z,
++};
++
++struct phylink_link_state {
++	u32 supported;
++	u32 advertising;
++	u32 lp_advertising;
++	int speed;
++	int duplex;
++	int pause;
++	unsigned int link:1;
++	unsigned int sync:1;
++	unsigned int an_enabled:1;
++	unsigned int an_complete:1;
++};
++
++struct phylink_mac_ops {
++	/* Get the ethtool supported mask for the indicated mode */
++	int (*mac_get_support)(struct net_device *, unsigned int mode,
++			       struct phylink_link_state *);
++
++	/* Read the current link state from the hardware */
++	int (*mac_link_state)(struct net_device *, struct phylink_link_state *);
++
++	/* Configure the MAC */
++	void (*mac_config)(struct net_device *, unsigned int mode,
++			   const struct phylink_link_state *);
++	void (*mac_an_restart)(struct net_device *, unsigned int mode);
++
++	void (*mac_link_down)(struct net_device *, unsigned int mode);
++	void (*mac_link_up)(struct net_device *, unsigned int mode);
++};
++
++struct phylink *phylink_create(struct net_device *, struct device_node *,
++	phy_interface_t iface, const struct phylink_mac_ops *ops);
++void phylink_destroy(struct phylink *);
++
++int phylink_connect_phy(struct phylink *, struct phy_device *);
++int phylink_of_phy_connect(struct phylink *, struct device_node *);
++void phylink_disconnect_phy(struct phylink *);
++
++void phylink_mac_change(struct phylink *, bool up);
++
++void phylink_start(struct phylink *);
++void phylink_stop(struct phylink *);
++
++int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
++int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
++int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
++
++#endif
diff --git a/target/linux/mvebu/patches-4.4/131-phylink-add-hooks-for-SFP-support.patch b/target/linux/mvebu/patches-4.4/131-phylink-add-hooks-for-SFP-support.patch
new file mode 100644
index 0000000..64a1c1f
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/131-phylink-add-hooks-for-SFP-support.patch
@@ -0,0 +1,156 @@
+From 0a0c4b3dd4f34df4532f254a5940b520015d766f Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 24 Sep 2015 11:01:13 +0100
+Subject: [PATCH 719/744] phylink: add hooks for SFP support
+
+Add support to phylink for SFP, which needs to control and configure
+the ethernet MAC link state.  Specifically, SFP needs to:
+
+1. set the negotiation mode between SGMII and 1000base-X
+2. attach and detach the module PHY
+3. prevent the link coming up when errors are reported
+
+In the absence of a PHY, we also need to set the ethtool port type
+according to the module plugged in.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phylink.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/phylink.h   |  6 ++++
+ 2 files changed, 88 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -11,6 +11,7 @@
+ #include <linux/ethtool.h>
+ #include <linux/export.h>
+ #include <linux/gpio/consumer.h>
++#include <linux/list.h>
+ #include <linux/netdevice.h>
+ #include <linux/of.h>
+ #include <linux/of_mdio.h>
+@@ -29,11 +30,16 @@
+ 	(ADVERTISED_TP | ADVERTISED_MII | ADVERTISED_FIBRE | \
+ 	 ADVERTISED_BNC | ADVERTISED_AUI | ADVERTISED_Backplane)
+ 
++static LIST_HEAD(phylinks);
++static DEFINE_MUTEX(phylink_mutex);
++
+ enum {
+ 	PHYLINK_DISABLE_STOPPED,
++	PHYLINK_DISABLE_LINK,
+ };
+ 
+ struct phylink {
++	struct list_head node;
+ 	struct net_device *netdev;
+ 	const struct phylink_mac_ops *ops;
+ 	struct mutex config_mutex;
+@@ -341,12 +347,20 @@ struct phylink *phylink_create(struct ne
+ 		return ERR_PTR(ret);
+ 	}
+ 
++	mutex_lock(&phylink_mutex);
++	list_add_tail(&pl->node, &phylinks);
++	mutex_unlock(&phylink_mutex);
++
+ 	return pl;
+ }
+ EXPORT_SYMBOL_GPL(phylink_create);
+ 
+ void phylink_destroy(struct phylink *pl)
+ {
++	mutex_lock(&phylink_mutex);
++	list_del(&pl->node);
++	mutex_unlock(&phylink_mutex);
++
+ 	cancel_work_sync(&pl->resolve);
+ 	kfree(pl);
+ }
+@@ -813,4 +827,72 @@ int phylink_mii_ioctl(struct phylink *pl
+ }
+ EXPORT_SYMBOL_GPL(phylink_mii_ioctl);
+ 
++
++
++void phylink_disable(struct phylink *pl)
++{
++	set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
++	flush_work(&pl->resolve);
++
++	netif_carrier_off(pl->netdev);
++}
++EXPORT_SYMBOL_GPL(phylink_disable);
++
++void phylink_enable(struct phylink *pl)
++{
++	clear_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
++	phylink_run_resolve(pl);
++}
++EXPORT_SYMBOL_GPL(phylink_enable);
++
++void phylink_set_link_port(struct phylink *pl, u32 support, u8 port)
++{
++	WARN_ON(support & ~SUPPORTED_INTERFACES);
++
++	mutex_lock(&pl->config_mutex);
++	pl->link_port_support = support;
++	pl->link_port = port;
++	mutex_unlock(&pl->config_mutex);
++}
++EXPORT_SYMBOL_GPL(phylink_set_link_port);
++
++int phylink_set_link_an_mode(struct phylink *pl, unsigned int mode)
++{
++	int ret = 0;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->link_an_mode != mode) {
++		ret = phylink_get_support(pl, mode);
++		if (ret == 0) {
++			if (!test_bit(PHYLINK_DISABLE_STOPPED,
++				      &pl->phylink_disable_state))
++				phylink_mac_config(pl, &pl->link_config);
++
++			netdev_info(pl->netdev, "switched to %s link mode\n",
++				    phylink_an_mode_str(mode));
++		}
++	}
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_set_link_an_mode);
++
++struct phylink *phylink_lookup_by_netdev(struct net_device *ndev)
++{
++	struct phylink *pl, *found = NULL;
++
++	mutex_lock(&phylink_mutex);
++	list_for_each_entry(pl, &phylinks, node)
++		if (pl->netdev == ndev) {
++			found = pl;
++			break;
++		}
++
++	mutex_unlock(&phylink_mutex);
++
++	return found;
++}
++EXPORT_SYMBOL_GPL(phylink_lookup_by_netdev);
++
+ MODULE_LICENSE("GPL");
+--- a/include/linux/phylink.h
++++ b/include/linux/phylink.h
+@@ -67,4 +67,10 @@ int phylink_ethtool_get_settings(struct
+ int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
+ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
+ 
++void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
++int phylink_set_link_an_mode(struct phylink *pl, unsigned int mode);
++void phylink_disable(struct phylink *pl);
++void phylink_enable(struct phylink *pl);
++struct phylink *phylink_lookup_by_netdev(struct net_device *ndev);
++
+ #endif
diff --git a/target/linux/mvebu/patches-4.4/132-sfp-add-phylink-based-SFP-module-support.patch b/target/linux/mvebu/patches-4.4/132-sfp-add-phylink-based-SFP-module-support.patch
new file mode 100644
index 0000000..07b1766
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/132-sfp-add-phylink-based-SFP-module-support.patch
@@ -0,0 +1,1382 @@
+From bf0a000960234c0e773fadea47240c3cda0cab02 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sat, 12 Sep 2015 18:43:39 +0100
+Subject: [PATCH 720/744] sfp: add phylink based SFP module support
+
+Add support for SFP hotpluggable modules via phylink.  This supports
+both copper and optical SFP modules, which require different Serdes
+modes in order to properly negotiate the link.
+
+Optical SFP modules typically require the Serdes link to be talking
+1000base-X mode - this is the gigabit ethernet mode defined by the
+802.3 standard.
+
+Copper SFP modules typically integrate a PHY in the module to convert
+from Serdes to copper, and the PHY will be configured by the vendor
+to either present a 1000base-X Serdes link (for fixed 1000base-T) or
+a SGMII Serdes link.  However, this is vendor defined, so we instead
+detect the PHY, switch the link to SGMII mode, and use traditional
+PHY based negotiation.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/Kconfig  |   5 +
+ drivers/net/phy/Makefile |   1 +
+ drivers/net/phy/sfp.c    | 986 +++++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/sfp.h      | 339 ++++++++++++++++
+ 4 files changed, 1331 insertions(+)
+ create mode 100644 drivers/net/phy/sfp.c
+ create mode 100644 include/linux/sfp.h
+
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -225,6 +225,11 @@ config FIXED_PHY
+ 
+ 	  Currently tested with mpc866ads and mpc8349e-mitx.
+ 
++config SFP
++	tristate "SFP cage support"
++	depends on I2C && PHYLINK
++	select MDIO_I2C
++
+ config MDIO_BITBANG
+ 	tristate "Support for bitbanged MDIO buses"
+ 	help
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -61,3 +61,4 @@ obj-$(CONFIG_MDIO_MOXART)	+= mdio-moxart
+ obj-$(CONFIG_MDIO_BCM_UNIMAC)	+= mdio-bcm-unimac.o
+ obj-$(CONFIG_MICROCHIP_PHY)	+= microchip.o
+ obj-$(CONFIG_MDIO_BCM_IPROC)	+= mdio-bcm-iproc.o
++obj-$(CONFIG_SFP)		+= sfp.o
+--- /dev/null
++++ b/drivers/net/phy/sfp.c
+@@ -0,0 +1,986 @@
++#include <linux/delay.h>
++#include <linux/gpio.h>
++#include <linux/i2c.h>
++#include <linux/interrupt.h>
++#include <linux/jiffies.h>
++#include <linux/module.h>
++#include <linux/mutex.h>
++#include <linux/netdevice.h>
++#include <linux/of.h>
++#include <linux/of_net.h>
++#include <linux/phylink.h>
++#include <linux/platform_device.h>
++#include <linux/sfp.h>
++#include <linux/slab.h>
++#include <linux/workqueue.h>
++
++#include "mdio-i2c.h"
++#include "swphy.h"
++
++enum {
++	GPIO_MODDEF0,
++	GPIO_LOS,
++	GPIO_TX_FAULT,
++	GPIO_TX_DISABLE,
++	GPIO_RATE_SELECT,
++	GPIO_MAX,
++
++	SFP_F_PRESENT = BIT(GPIO_MODDEF0),
++	SFP_F_LOS = BIT(GPIO_LOS),
++	SFP_F_TX_FAULT = BIT(GPIO_TX_FAULT),
++	SFP_F_TX_DISABLE = BIT(GPIO_TX_DISABLE),
++	SFP_F_RATE_SELECT = BIT(GPIO_RATE_SELECT),
++
++	SFP_E_INSERT = 0,
++	SFP_E_REMOVE,
++	SFP_E_DEV_DOWN,
++	SFP_E_DEV_UP,
++	SFP_E_TX_FAULT,
++	SFP_E_TX_CLEAR,
++	SFP_E_LOS_HIGH,
++	SFP_E_LOS_LOW,
++	SFP_E_TIMEOUT,
++
++	SFP_MOD_EMPTY = 0,
++	SFP_MOD_PROBE,
++	SFP_MOD_PRESENT,
++	SFP_MOD_ERROR,
++
++	SFP_DEV_DOWN = 0,
++	SFP_DEV_UP,
++
++	SFP_S_DOWN = 0,
++	SFP_S_INIT,
++	SFP_S_WAIT_LOS,
++	SFP_S_LINK_UP,
++	SFP_S_TX_FAULT,
++	SFP_S_REINIT,
++	SFP_S_TX_DISABLE,
++};
++
++static const char *gpio_of_names[] = {
++	"moddef0",
++	"los",
++	"tx-fault",
++	"tx-disable",
++	"rate-select",
++};
++
++static const enum gpiod_flags gpio_flags[] = {
++	GPIOD_IN,
++	GPIOD_IN,
++	GPIOD_IN,
++	GPIOD_ASIS,
++	GPIOD_ASIS,
++};
++
++#define T_INIT_JIFFIES	msecs_to_jiffies(300)
++#define T_RESET_US	10
++#define T_FAULT_RECOVER	msecs_to_jiffies(1000)
++
++/* SFP module presence detection is poor: the three MOD DEF signals are
++ * the same length on the PCB, which means it's possible for MOD DEF 0 to
++ * connect before the I2C bus on MOD DEF 1/2.  Try to work around this
++ * design bug by waiting 50ms before probing, and then retry every 250ms.
++ */
++#define T_PROBE_INIT	msecs_to_jiffies(50)
++#define T_PROBE_RETRY	msecs_to_jiffies(250)
++
++/*
++ * SFP modules appear to always have their PHY configured for bus address
++ * 0x56 (which with mdio-i2c, translates to a PHY address of 22).
++ */
++#define SFP_PHY_ADDR	22
++
++/*
++ * Give this long for the PHY to reset.
++ */
++#define T_PHY_RESET_MS	50
++
++static DEFINE_MUTEX(sfp_mutex);
++
++struct sfp {
++	struct device *dev;
++	struct i2c_adapter *i2c;
++	struct mii_bus *i2c_mii;
++	struct net_device *ndev;
++	struct phylink *phylink;
++	struct phy_device *mod_phy;
++
++	unsigned int (*get_state)(struct sfp *);
++	void (*set_state)(struct sfp *, unsigned int);
++	int (*read)(struct sfp *, bool, u8, void *, size_t);
++
++	struct gpio_desc *gpio[GPIO_MAX];
++
++	unsigned int state;
++	struct delayed_work poll;
++	struct delayed_work timeout;
++	struct mutex sm_mutex;
++	unsigned char sm_mod_state;
++	unsigned char sm_dev_state;
++	unsigned short sm_state;
++	unsigned int sm_retries;
++
++	struct sfp_eeprom_id id;
++
++	struct notifier_block netdev_nb;
++};
++
++static unsigned long poll_jiffies;
++
++static unsigned int sfp_gpio_get_state(struct sfp *sfp)
++{
++	unsigned int i, state, v;
++
++	for (i = state = 0; i < GPIO_MAX; i++) {
++		if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
++			continue;
++
++		v = gpiod_get_value_cansleep(sfp->gpio[i]);
++		if (v)
++			state |= BIT(i);
++	}
++
++	return state;
++}
++
++static void sfp_gpio_set_state(struct sfp *sfp, unsigned int state)
++{
++	if (state & SFP_F_PRESENT) {
++		/* If the module is present, drive the signals */
++		if (sfp->gpio[GPIO_TX_DISABLE])
++			gpiod_direction_output(sfp->gpio[GPIO_TX_DISABLE],
++						state & SFP_F_TX_DISABLE);
++		if (state & SFP_F_RATE_SELECT)
++			gpiod_direction_output(sfp->gpio[GPIO_RATE_SELECT],
++						state & SFP_F_RATE_SELECT);
++	} else {
++		/* Otherwise, let them float to the pull-ups */
++		if (sfp->gpio[GPIO_TX_DISABLE])
++			gpiod_direction_input(sfp->gpio[GPIO_TX_DISABLE]);
++		if (state & SFP_F_RATE_SELECT)
++			gpiod_direction_input(sfp->gpio[GPIO_RATE_SELECT]);
++	}
++}
++
++static int sfp__i2c_read(struct i2c_adapter *i2c, u8 bus_addr, u8 dev_addr,
++	void *buf, size_t len)
++{
++	struct i2c_msg msgs[2];
++	int ret;
++
++	msgs[0].addr = bus_addr;
++	msgs[0].flags = 0;
++	msgs[0].len = 1;
++	msgs[0].buf = &dev_addr;
++	msgs[1].addr = bus_addr;
++	msgs[1].flags = I2C_M_RD;
++	msgs[1].len = len;
++	msgs[1].buf = buf;
++
++	ret = i2c_transfer(i2c, msgs, ARRAY_SIZE(msgs));
++	if (ret < 0)
++		return ret;
++
++	return ret == ARRAY_SIZE(msgs) ? len : 0;
++}
++
++static int sfp_i2c_read(struct sfp *sfp, bool a2, u8 addr, void *buf,
++	size_t len)
++{
++	return sfp__i2c_read(sfp->i2c, a2 ? 0x51 : 0x50, addr, buf, len);
++}
++
++static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
++{
++	struct mii_bus *i2c_mii;
++	int ret;
++
++	if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
++		return -EINVAL;
++
++	sfp->i2c = i2c;
++	sfp->read = sfp_i2c_read;
++
++	i2c_mii = mdio_i2c_alloc(sfp->dev, i2c);
++	if (IS_ERR(i2c_mii))
++		return PTR_ERR(i2c_mii);
++
++	i2c_mii->name = "SFP I2C Bus";
++	i2c_mii->phy_mask = ~0;
++
++	ret = mdiobus_register(i2c_mii);
++	if (ret < 0) {
++		mdiobus_free(i2c_mii);
++		return ret;
++	}
++
++	sfp->i2c_mii = i2c_mii;
++
++	return 0;
++}
++
++
++/* Interface */
++static unsigned int sfp_get_state(struct sfp *sfp)
++{
++	return sfp->get_state(sfp);
++}
++
++static void sfp_set_state(struct sfp *sfp, unsigned int state)
++{
++	sfp->set_state(sfp, state);
++}
++
++static int sfp_read(struct sfp *sfp, bool a2, u8 addr, void *buf, size_t len)
++{
++	return sfp->read(sfp, a2, addr, buf, len);
++}
++
++static unsigned int sfp_check(void *buf, size_t len)
++{
++	u8 *p, check;
++
++	for (p = buf, check = 0; len; p++, len--)
++		check += *p;
++
++	return check;
++}
++
++/* Helpers */
++static void sfp_module_tx_disable(struct sfp *sfp)
++{
++	dev_dbg(sfp->dev, "tx disable %u -> %u\n",
++		sfp->state & SFP_F_TX_DISABLE ? 1 : 0, 1);
++	sfp->state |= SFP_F_TX_DISABLE;
++	sfp_set_state(sfp, sfp->state);
++}
++
++static void sfp_module_tx_enable(struct sfp *sfp)
++{
++	dev_dbg(sfp->dev, "tx disable %u -> %u\n",
++		sfp->state & SFP_F_TX_DISABLE ? 1 : 0, 0);
++	sfp->state &= ~SFP_F_TX_DISABLE;
++	sfp_set_state(sfp, sfp->state);
++}
++
++static void sfp_module_tx_fault_reset(struct sfp *sfp)
++{
++	unsigned int state = sfp->state;
++
++	if (state & SFP_F_TX_DISABLE)
++		return;
++
++	sfp_set_state(sfp, state | SFP_F_TX_DISABLE);
++
++	udelay(T_RESET_US);
++
++	sfp_set_state(sfp, state);
++}
++
++/* SFP state machine */
++static void sfp_sm_set_timer(struct sfp *sfp, unsigned int timeout)
++{
++	if (timeout)
++		mod_delayed_work(system_power_efficient_wq, &sfp->timeout,
++				 timeout);
++	else
++		cancel_delayed_work(&sfp->timeout);
++}
++
++static void sfp_sm_next(struct sfp *sfp, unsigned int state,
++			unsigned int timeout)
++{
++	sfp->sm_state = state;
++	sfp_sm_set_timer(sfp, timeout);
++}
++
++static void sfp_sm_ins_next(struct sfp *sfp, unsigned int state, unsigned int timeout)
++{
++	sfp->sm_mod_state = state;
++	sfp_sm_set_timer(sfp, timeout);
++}
++
++static void sfp_sm_phy_detach(struct sfp *sfp)
++{
++	phy_stop(sfp->mod_phy);
++	if (sfp->phylink)
++		phylink_disconnect_phy(sfp->phylink);
++	phy_device_remove(sfp->mod_phy);
++	phy_device_free(sfp->mod_phy);
++	sfp->mod_phy = NULL;
++}
++
++static void sfp_sm_probe_phy(struct sfp *sfp)
++{
++	struct phy_device *phy;
++	int err;
++
++	msleep(T_PHY_RESET_MS);
++
++	phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
++	if (IS_ERR(phy)) {
++		dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
++		return;
++	}
++	if (!phy) {
++		dev_info(sfp->dev, "no PHY detected\n");
++		return;
++	}
++
++	err = phylink_connect_phy(sfp->phylink, phy);
++	if (err) {
++		phy_device_remove(phy);
++		phy_device_free(phy);
++		dev_err(sfp->dev, "phylink_connect_phy failed: %d\n", err);
++		return;
++	}
++
++	sfp->mod_phy = phy;
++	phy_start(phy);
++}
++
++static void sfp_sm_link_up(struct sfp *sfp)
++{
++	if (sfp->phylink)
++		phylink_enable(sfp->phylink);
++
++	sfp_sm_next(sfp, SFP_S_LINK_UP, 0);
++}
++
++static void sfp_sm_link_down(struct sfp *sfp)
++{
++	if (sfp->phylink)
++		phylink_disable(sfp->phylink);
++}
++
++static void sfp_sm_link_check_los(struct sfp *sfp)
++{
++	unsigned int los = sfp->state & SFP_F_LOS;
++
++	/* FIXME: what if neither SFP_OPTIONS_LOS_INVERTED nor
++	 * SFP_OPTIONS_LOS_NORMAL are set?  For now, we assume
++	 * the same as SFP_OPTIONS_LOS_NORMAL set.
++	 */
++	if (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED)
++		los ^= SFP_F_LOS;
++
++	if (los)
++		sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
++	else
++		sfp_sm_link_up(sfp);
++}
++
++static void sfp_sm_fault(struct sfp *sfp, bool warn)
++{
++	if (sfp->sm_retries && !--sfp->sm_retries) {
++		dev_err(sfp->dev, "module persistently indicates fault, disabling\n");
++		sfp_sm_next(sfp, SFP_S_TX_DISABLE, 0);
++	} else {
++		if (warn)
++			dev_err(sfp->dev, "module transmit fault indicated\n");
++
++		sfp_sm_next(sfp, SFP_S_TX_FAULT, T_FAULT_RECOVER);
++	}
++}
++
++static void sfp_sm_mod_init(struct sfp *sfp)
++{
++	sfp_module_tx_enable(sfp);
++
++	/* Wait t_init before indicating that the link is up, provided the
++	 * current state indicates no TX_FAULT.  If TX_FAULT clears before
++	 * this time, that's fine too.
++	 */
++	sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
++	sfp->sm_retries = 5;
++
++	if (sfp->phylink) {
++		/* Setting the serdes link mode is guesswork: there's no
++		 * field in the EEPROM which indicates what mode should
++		 * be used.
++		 *
++		 * If it's a gigabit-only fiber module, it probably does
++		 * not have a PHY, so switch to 802.3z negotiation mode.
++		 * Otherwise, switch to SGMII mode (which is required to
++		 * support non-gigabit speeds) and probe for a PHY.
++		 */
++		if (!sfp->id.base.e1000_base_t &&
++		    !sfp->id.base.e100_base_lx &&
++		    !sfp->id.base.e100_base_fx) {
++			phylink_set_link_an_mode(sfp->phylink, MLO_AN_8023Z);
++		} else {
++			phylink_set_link_an_mode(sfp->phylink, MLO_AN_SGMII);
++			sfp_sm_probe_phy(sfp);
++		}
++	}
++}
++
++static int sfp_sm_mod_probe(struct sfp *sfp)
++{
++	/* SFP module inserted - read I2C data */
++	struct sfp_eeprom_id id;
++	char vendor[17];
++	char part[17];
++	char sn[17];
++	char date[9];
++	char rev[5];
++	u8 check;
++	int err;
++
++	err = sfp_read(sfp, false, 0, &id, sizeof(id));
++	if (err < 0) {
++		dev_err(sfp->dev, "failed to read EEPROM: %d\n", err);
++		return -EAGAIN;
++	}
++
++	/* Validate the checksum over the base structure */
++	check = sfp_check(&id.base, sizeof(id.base) - 1);
++	if (check != id.base.cc_base) {
++		dev_err(sfp->dev,
++			"EEPROM base structure checksum failure: 0x%02x\n",
++			check);
++		return -EINVAL;
++	}
++
++	check = sfp_check(&id.ext, sizeof(id.ext) - 1);
++	if (check != id.ext.cc_ext) {
++		dev_err(sfp->dev,
++			"EEPROM extended structure checksum failure: 0x%02x\n",
++			check);
++		memset(&id.ext, 0, sizeof(id.ext));
++	}
++
++	sfp->id = id;
++
++	memcpy(vendor, sfp->id.base.vendor_name, 16);
++	vendor[16] = '\0';
++	memcpy(part, sfp->id.base.vendor_pn, 16);
++	part[16] = '\0';
++	memcpy(rev, sfp->id.base.vendor_rev, 4);
++	rev[4] = '\0';
++	memcpy(sn, sfp->id.ext.vendor_sn, 16);
++	sn[16] = '\0';
++	memcpy(date, sfp->id.ext.datecode, 8);
++	date[8] = '\0';
++
++	dev_info(sfp->dev, "module %s %s rev %s sn %s dc %s\n", vendor, part, rev, sn, date);
++
++	/* We only support SFP modules, not the legacy GBIC modules. */
++	if (sfp->id.base.phys_id != SFP_PHYS_ID_SFP ||
++	    sfp->id.base.phys_ext_id != SFP_PHYS_EXT_ID_SFP) {
++		dev_err(sfp->dev, "module is not SFP - phys id 0x%02x 0x%02x\n",
++			sfp->id.base.phys_id, sfp->id.base.phys_ext_id);
++		return -EINVAL;
++	}
++
++	/*
++	 * What isn't clear from the SFP documentation is whether this
++	 * specifies the encoding expected on the TD/RD lines, or whether
++	 * the TD/RD lines are always 8b10b encoded, but the transceiver
++	 * converts.  Eg, think of a copper SFP supporting 1G/100M/10M
++	 * ethernet: this requires 8b10b encoding for 1G, 4b5b for 100M,
++	 * and manchester for 10M.
++	 */
++	/* 1Gbit ethernet requires 8b10b encoding */
++	if (sfp->id.base.encoding != SFP_ENCODING_8B10B) {
++		dev_err(sfp->dev, "module does not support 8B10B encoding\n");
++		return -EINVAL;
++	}
++
++	if (sfp->phylink) {
++		u32 support;
++		u8 port;
++
++		if (sfp->id.base.e1000_base_t) {
++			support = SUPPORTED_TP;
++			port = PORT_TP;
++		} else {
++			support = SUPPORTED_FIBRE;
++			port = PORT_FIBRE;
++		}
++		phylink_set_link_port(sfp->phylink, support, port);
++	}
++
++	return 0;
++}
++
++static void sfp_sm_mod_remove(struct sfp *sfp)
++{
++	if (sfp->mod_phy)
++		sfp_sm_phy_detach(sfp);
++
++	sfp_module_tx_disable(sfp);
++
++	memset(&sfp->id, 0, sizeof(sfp->id));
++
++	dev_info(sfp->dev, "module removed\n");
++}
++
++static void sfp_sm_event(struct sfp *sfp, unsigned int event)
++{
++	mutex_lock(&sfp->sm_mutex);
++
++	dev_dbg(sfp->dev, "SM: enter %u:%u:%u event %u\n",
++		sfp->sm_mod_state, sfp->sm_dev_state, sfp->sm_state, event);
++
++	/* This state machine tracks the insert/remove state of
++	 * the module, and handles probing the on-board EEPROM.
++	 */
++	switch (sfp->sm_mod_state) {
++	default:
++		if (event == SFP_E_INSERT) {
++			sfp_module_tx_disable(sfp);
++			sfp_sm_ins_next(sfp, SFP_MOD_PROBE, T_PROBE_INIT);
++		}
++		break;
++
++	case SFP_MOD_PROBE:
++		if (event == SFP_E_REMOVE) {
++			sfp_sm_ins_next(sfp, SFP_MOD_EMPTY, 0);
++		} else if (event == SFP_E_TIMEOUT) {
++			int err = sfp_sm_mod_probe(sfp);
++
++			if (err == 0)
++				sfp_sm_ins_next(sfp, SFP_MOD_PRESENT, 0);
++			else if (err == -EAGAIN)
++				sfp_sm_set_timer(sfp, T_PROBE_RETRY);
++			else
++				sfp_sm_ins_next(sfp, SFP_MOD_ERROR, 0);
++		}
++		break;
++
++	case SFP_MOD_PRESENT:
++	case SFP_MOD_ERROR:
++		if (event == SFP_E_REMOVE) {
++			sfp_sm_mod_remove(sfp);
++			sfp_sm_ins_next(sfp, SFP_MOD_EMPTY, 0);
++		}
++		break;
++	}
++
++	/* This state machine tracks the netdev up/down state */
++	switch (sfp->sm_dev_state) {
++	default:
++		if (event == SFP_E_DEV_UP)
++			sfp->sm_dev_state = SFP_DEV_UP;
++		break;
++
++	case SFP_DEV_UP:
++		if (event == SFP_E_DEV_DOWN) {
++			/* If the module has a PHY, avoid raising TX disable
++			 * as this resets the PHY. Otherwise, raise it to
++			 * turn the laser off.
++			 */
++			if (!sfp->mod_phy)
++				sfp_module_tx_disable(sfp);
++			sfp->sm_dev_state = SFP_DEV_DOWN;
++		}
++		break;
++	}
++
++	/* Some events are global */
++	if (sfp->sm_state != SFP_S_DOWN &&
++	    (sfp->sm_mod_state != SFP_MOD_PRESENT ||
++	     sfp->sm_dev_state != SFP_DEV_UP)) {
++		if (sfp->sm_state == SFP_S_LINK_UP &&
++		    sfp->sm_dev_state == SFP_DEV_UP)
++			sfp_sm_link_down(sfp);
++		if (sfp->mod_phy)
++			sfp_sm_phy_detach(sfp);
++		sfp_sm_next(sfp, SFP_S_DOWN, 0);
++		mutex_unlock(&sfp->sm_mutex);
++		return;
++	}
++
++	/* The main state machine */
++	switch (sfp->sm_state) {
++	case SFP_S_DOWN:
++		if (sfp->sm_mod_state == SFP_MOD_PRESENT &&
++		    sfp->sm_dev_state == SFP_DEV_UP)
++			sfp_sm_mod_init(sfp);
++		break;
++
++	case SFP_S_INIT:
++		if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT)
++			sfp_sm_fault(sfp, true);
++		else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR)
++			sfp_sm_link_check_los(sfp);
++		break;
++
++	case SFP_S_WAIT_LOS:
++		if (event == SFP_E_TX_FAULT)
++			sfp_sm_fault(sfp, true);
++		else if (event ==
++			 (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
++			  SFP_E_LOS_HIGH : SFP_E_LOS_LOW))
++			sfp_sm_link_up(sfp);
++		break;
++
++	case SFP_S_LINK_UP:
++		if (event == SFP_E_TX_FAULT) {
++			sfp_sm_link_down(sfp);
++			sfp_sm_fault(sfp, true);
++		} else if (event ==
++			   (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
++			    SFP_E_LOS_LOW : SFP_E_LOS_HIGH)) {
++			sfp_sm_link_down(sfp);
++			sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
++		}
++		break;
++
++	case SFP_S_TX_FAULT:
++		if (event == SFP_E_TIMEOUT) {
++			sfp_module_tx_fault_reset(sfp);
++			sfp_sm_next(sfp, SFP_S_REINIT, T_INIT_JIFFIES);
++		}
++		break;
++
++	case SFP_S_REINIT:
++		if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) {
++			sfp_sm_fault(sfp, false);
++		} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
++			dev_info(sfp->dev, "module transmit fault recovered\n");
++			sfp_sm_link_check_los(sfp);
++		}
++		break;
++
++	case SFP_S_TX_DISABLE:
++		break;
++	}
++
++	dev_dbg(sfp->dev, "SM: exit %u:%u:%u\n",
++		sfp->sm_mod_state, sfp->sm_dev_state, sfp->sm_state);
++
++	mutex_unlock(&sfp->sm_mutex);
++}
++
++#if 0
++static int sfp_phy_module_info(struct phy_device *phy,
++			       struct ethtool_modinfo *modinfo)
++{
++	struct sfp *sfp = phy->priv;
++
++	/* locking... and check module is present */
++
++	if (sfp->id.ext.sff8472_compliance) {
++		modinfo->type = ETH_MODULE_SFF_8472;
++		modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
++	} else {
++		modinfo->type = ETH_MODULE_SFF_8079;
++		modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
++	}
++	return 0;
++}
++
++static int sfp_phy_module_eeprom(struct phy_device *phy,
++	struct ethtool_eeprom *ee, u8 *data)
++{
++	struct sfp *sfp = phy->priv;
++	unsigned int first, last, len;
++	int ret;
++
++	if (ee->len == 0)
++		return -EINVAL;
++
++	first = ee->offset;
++	last = ee->offset + ee->len;
++	if (first < ETH_MODULE_SFF_8079_LEN) {
++		len = last;
++		if (len > ETH_MODULE_SFF_8079_LEN)
++			len = ETH_MODULE_SFF_8079_LEN;
++		len -= first;
++
++		ret = sfp->read(sfp, false, first, data, len);
++		if (ret < 0)
++			return ret;
++
++		first += len;
++		data += len;
++	}
++	if (first >= ETH_MODULE_SFF_8079_LEN && last > first) {
++		len = last - first;
++
++		ret = sfp->read(sfp, true, first, data, len);
++		if (ret < 0)
++			return ret;
++	}
++	return 0;
++}
++#endif
++
++static void sfp_timeout(struct work_struct *work)
++{
++	struct sfp *sfp = container_of(work, struct sfp, timeout.work);
++
++	sfp_sm_event(sfp, SFP_E_TIMEOUT);
++}
++
++static void sfp_check_state(struct sfp *sfp)
++{
++	unsigned int state, i, changed;
++
++	state = sfp_get_state(sfp);
++	changed = state ^ sfp->state;
++	changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
++
++	for (i = 0; i < GPIO_MAX; i++)
++		if (changed & BIT(i))
++			dev_dbg(sfp->dev, "%s %u -> %u\n", gpio_of_names[i],
++				!!(sfp->state & BIT(i)), !!(state & BIT(i)));
++
++	state |= sfp->state & (SFP_F_TX_DISABLE | SFP_F_RATE_SELECT);
++	sfp->state = state;
++
++	if (changed & SFP_F_PRESENT)
++		sfp_sm_event(sfp, state & SFP_F_PRESENT ?
++				SFP_E_INSERT : SFP_E_REMOVE);
++
++	if (changed & SFP_F_TX_FAULT)
++		sfp_sm_event(sfp, state & SFP_F_TX_FAULT ?
++				SFP_E_TX_FAULT : SFP_E_TX_CLEAR);
++
++	if (changed & SFP_F_LOS)
++		sfp_sm_event(sfp, state & SFP_F_LOS ?
++				SFP_E_LOS_HIGH : SFP_E_LOS_LOW);
++}
++
++static irqreturn_t sfp_irq(int irq, void *data)
++{
++	struct sfp *sfp = data;
++
++	sfp_check_state(sfp);
++
++	return IRQ_HANDLED;
++}
++
++static void sfp_poll(struct work_struct *work)
++{
++	struct sfp *sfp = container_of(work, struct sfp, poll.work);
++
++	sfp_check_state(sfp);
++	mod_delayed_work(system_wq, &sfp->poll, poll_jiffies);
++}
++
++static int sfp_netdev_notify(struct notifier_block *nb, unsigned long act, void *data)
++{
++	struct sfp *sfp = container_of(nb, struct sfp, netdev_nb);
++	struct netdev_notifier_info *info = data;
++	struct net_device *ndev = info->dev;
++
++	if (!sfp->ndev || ndev != sfp->ndev)
++		return NOTIFY_DONE;
++
++	switch (act) {
++	case NETDEV_UP:
++		sfp_sm_event(sfp, SFP_E_DEV_UP);
++		break;
++
++	case NETDEV_GOING_DOWN:
++		sfp_sm_event(sfp, SFP_E_DEV_DOWN);
++		break;
++
++	case NETDEV_UNREGISTER:
++		if (sfp->mod_phy && sfp->phylink)
++			phylink_disconnect_phy(sfp->phylink);
++		sfp->phylink = NULL;
++		dev_put(sfp->ndev);
++		sfp->ndev = NULL;
++		break;
++	}
++	return NOTIFY_OK;
++}
++
++static struct sfp *sfp_alloc(struct device *dev)
++{
++	struct sfp *sfp;
++
++	sfp = kzalloc(sizeof(*sfp), GFP_KERNEL);
++	if (!sfp)
++		return ERR_PTR(-ENOMEM);
++
++	sfp->dev = dev;
++
++	mutex_init(&sfp->sm_mutex);
++	INIT_DELAYED_WORK(&sfp->poll, sfp_poll);
++	INIT_DELAYED_WORK(&sfp->timeout, sfp_timeout);
++
++	sfp->netdev_nb.notifier_call = sfp_netdev_notify;
++
++	return sfp;
++}
++
++static void sfp_destroy(struct sfp *sfp)
++{
++	cancel_delayed_work_sync(&sfp->poll);
++	cancel_delayed_work_sync(&sfp->timeout);
++	if (sfp->i2c_mii) {
++		mdiobus_unregister(sfp->i2c_mii);
++		mdiobus_free(sfp->i2c_mii);
++	}
++	if (sfp->i2c)
++		i2c_put_adapter(sfp->i2c);
++	of_node_put(sfp->dev->of_node);
++	kfree(sfp);
++}
++
++static void sfp_cleanup(void *data)
++{
++	struct sfp *sfp = data;
++
++	sfp_destroy(sfp);
++}
++
++static int sfp_probe(struct platform_device *pdev)
++{
++	struct sfp *sfp;
++	bool poll = false;
++	int irq, err, i;
++
++	sfp = sfp_alloc(&pdev->dev);
++	if (IS_ERR(sfp))
++		return PTR_ERR(sfp);
++
++	platform_set_drvdata(pdev, sfp);
++
++	err = devm_add_action(sfp->dev, sfp_cleanup, sfp);
++	if (err < 0)
++		return err;
++
++	if (pdev->dev.of_node) {
++		struct device_node *node = pdev->dev.of_node;
++		struct device_node *np;
++
++		np = of_parse_phandle(node, "i2c-bus", 0);
++		if (np) {
++			struct i2c_adapter *i2c;
++
++			i2c = of_find_i2c_adapter_by_node(np);
++			of_node_put(np);
++			if (!i2c)
++				return -EPROBE_DEFER;
++
++			err = sfp_i2c_configure(sfp, i2c);
++			if (err < 0) {
++				i2c_put_adapter(i2c);
++				return err;
++			}
++		}
++
++		for (i = 0; i < GPIO_MAX; i++) {
++			sfp->gpio[i] = devm_gpiod_get_optional(sfp->dev,
++					   gpio_of_names[i], gpio_flags[i]);
++			if (IS_ERR(sfp->gpio[i]))
++				return PTR_ERR(sfp->gpio[i]);
++		}
++
++		sfp->get_state = sfp_gpio_get_state;
++		sfp->set_state = sfp_gpio_set_state;
++
++		np = of_parse_phandle(node, "sfp,ethernet", 0);
++		if (!np) {
++			dev_err(sfp->dev, "missing sfp,ethernet property\n");
++			return -EINVAL;
++		}
++
++		sfp->ndev = of_find_net_device_by_node(np);
++		if (!sfp->ndev) {
++			dev_err(sfp->dev, "ethernet device not found\n");
++			return -EPROBE_DEFER;
++		}
++
++		dev_hold(sfp->ndev);
++		put_device(&sfp->ndev->dev);
++
++		sfp->phylink = phylink_lookup_by_netdev(sfp->ndev);
++		if (!sfp->phylink) {
++			dev_err(sfp->dev, "ethernet device not found\n");
++			return -EPROBE_DEFER;
++		}
++
++		phylink_disable(sfp->phylink);
++	}
++
++	sfp->state = sfp_get_state(sfp);
++	if (sfp->gpio[GPIO_TX_DISABLE] &&
++	    gpiod_get_value_cansleep(sfp->gpio[GPIO_TX_DISABLE]))
++		sfp->state |= SFP_F_TX_DISABLE;
++	if (sfp->gpio[GPIO_RATE_SELECT] &&
++	    gpiod_get_value_cansleep(sfp->gpio[GPIO_RATE_SELECT]))
++		sfp->state |= SFP_F_RATE_SELECT;
++	sfp_set_state(sfp, sfp->state);
++	sfp_module_tx_disable(sfp);
++	if (sfp->state & SFP_F_PRESENT)
++		sfp_sm_event(sfp, SFP_E_INSERT);
++
++	for (i = 0; i < GPIO_MAX; i++) {
++		if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
++			continue;
++
++		irq = gpiod_to_irq(sfp->gpio[i]);
++		if (!irq) {
++			poll = true;
++			continue;
++		}
++
++		err = devm_request_threaded_irq(sfp->dev, irq, NULL, sfp_irq,
++						IRQF_ONESHOT |
++						IRQF_TRIGGER_RISING |
++						IRQF_TRIGGER_FALLING,
++						dev_name(sfp->dev), sfp);
++		if (err)
++			poll = true;
++	}
++
++	if (poll)
++		mod_delayed_work(system_wq, &sfp->poll, poll_jiffies);
++
++	register_netdevice_notifier(&sfp->netdev_nb);
++
++	return 0;
++}
++
++static int sfp_remove(struct platform_device *pdev)
++{
++	struct sfp *sfp = platform_get_drvdata(pdev);
++
++	unregister_netdevice_notifier(&sfp->netdev_nb);
++	if (sfp->ndev)
++		dev_put(sfp->ndev);
++
++	return 0;
++}
++
++static const struct of_device_id sfp_of_match[] = {
++	{ .compatible = "sff,sfp", },
++	{ },
++};
++MODULE_DEVICE_TABLE(of, sfp_of_match);
++
++static struct platform_driver sfp_driver = {
++	.probe = sfp_probe,
++	.remove = sfp_remove,
++	.driver = {
++		.name = "sfp",
++		.of_match_table = sfp_of_match,
++	},
++};
++
++static int sfp_init(void)
++{
++	poll_jiffies = msecs_to_jiffies(100);
++
++	return platform_driver_register(&sfp_driver);
++}
++module_init(sfp_init);
++
++static void sfp_exit(void)
++{
++	platform_driver_unregister(&sfp_driver);
++}
++module_exit(sfp_exit);
++
++MODULE_ALIAS("platform:sfp");
++MODULE_AUTHOR("Russell King");
++MODULE_LICENSE("GPL v2");
+--- /dev/null
++++ b/include/linux/sfp.h
+@@ -0,0 +1,339 @@
++#ifndef LINUX_SFP_H
++#define LINUX_SFP_H
++
++struct __packed sfp_eeprom_base {
++	u8 phys_id;
++	u8 phys_ext_id;
++	u8 connector;
++#if defined __BIG_ENDIAN_BITFIELD
++	u8 e10g_base_er:1;
++	u8 e10g_base_lrm:1;
++	u8 e10g_base_lr:1;
++	u8 e10g_base_sr:1;
++	u8 if_1x_sx:1;
++	u8 if_1x_lx:1;
++	u8 if_1x_copper_active:1;
++	u8 if_1x_copper_passive:1;
++
++	u8 escon_mmf_1310_led:1;
++	u8 escon_smf_1310_laser:1;
++	u8 sonet_oc192_short_reach:1;
++	u8 sonet_reach_bit1:1;
++	u8 sonet_reach_bit2:1;
++	u8 sonet_oc48_long_reach:1;
++	u8 sonet_oc48_intermediate_reach:1;
++	u8 sonet_oc48_short_reach:1;
++
++	u8 unallocated_5_7:1;
++	u8 sonet_oc12_smf_long_reach:1;
++	u8 sonet_oc12_smf_intermediate_reach:1;
++	u8 sonet_oc12_short_reach:1;
++	u8 unallocated_5_3:1;
++	u8 sonet_oc3_smf_long_reach:1;
++	u8 sonet_oc3_smf_intermediate_reach:1;
++	u8 sonet_oc3_short_reach:1;
++
++	u8 e_base_px:1;
++	u8 e_base_bx10:1;
++	u8 e100_base_fx:1;
++	u8 e100_base_lx:1;
++	u8 e1000_base_t:1;
++	u8 e1000_base_cx:1;
++	u8 e1000_base_lx:1;
++	u8 e1000_base_sx:1;
++
++	u8 fc_ll_v:1;
++	u8 fc_ll_s:1;
++	u8 fc_ll_i:1;
++	u8 fc_ll_l:1;
++	u8 fc_ll_m:1;
++	u8 fc_tech_sa:1;
++	u8 fc_tech_lc:1;
++	u8 fc_tech_electrical_inter_enclosure:1;
++
++	u8 fc_tech_electrical_intra_enclosure:1;
++	u8 fc_tech_sn:1;
++	u8 fc_tech_sl:1;
++	u8 fc_tech_ll:1;
++	u8 sfp_ct_active:1;
++	u8 sfp_ct_passive:1;
++	u8 unallocated_8_1:1;
++	u8 unallocated_8_0:1;
++
++	u8 fc_media_tw:1;
++	u8 fc_media_tp:1;
++	u8 fc_media_mi:1;
++	u8 fc_media_tv:1;
++	u8 fc_media_m6:1;
++	u8 fc_media_m5:1;
++	u8 unallocated_9_1:1;
++	u8 fc_media_sm:1;
++
++	u8 fc_speed_1200:1;
++	u8 fc_speed_800:1;
++	u8 fc_speed_1600:1;
++	u8 fc_speed_400:1;
++	u8 fc_speed_3200:1;
++	u8 fc_speed_200:1;
++	u8 unallocated_10_1:1;
++	u8 fc_speed_100:1;
++#elif defined __LITTLE_ENDIAN_BITFIELD
++	u8 if_1x_copper_passive:1;
++	u8 if_1x_copper_active:1;
++	u8 if_1x_lx:1;
++	u8 if_1x_sx:1;
++	u8 e10g_base_sr:1;
++	u8 e10g_base_lr:1;
++	u8 e10g_base_lrm:1;
++	u8 e10g_base_er:1;
++
++	u8 sonet_oc3_short_reach:1;
++	u8 sonet_oc3_smf_intermediate_reach:1;
++	u8 sonet_oc3_smf_long_reach:1;
++	u8 unallocated_5_3:1;
++	u8 sonet_oc12_short_reach:1;
++	u8 sonet_oc12_smf_intermediate_reach:1;
++	u8 sonet_oc12_smf_long_reach:1;
++	u8 unallocated_5_7:1;
++
++	u8 sonet_oc48_short_reach:1;
++	u8 sonet_oc48_intermediate_reach:1;
++	u8 sonet_oc48_long_reach:1;
++	u8 sonet_reach_bit2:1;
++	u8 sonet_reach_bit1:1;
++	u8 sonet_oc192_short_reach:1;
++	u8 escon_smf_1310_laser:1;
++	u8 escon_mmf_1310_led:1;
++
++	u8 e1000_base_sx:1;
++	u8 e1000_base_lx:1;
++	u8 e1000_base_cx:1;
++	u8 e1000_base_t:1;
++	u8 e100_base_lx:1;
++	u8 e100_base_fx:1;
++	u8 e_base_bx10:1;
++	u8 e_base_px:1;
++
++	u8 fc_tech_electrical_inter_enclosure:1;
++	u8 fc_tech_lc:1;
++	u8 fc_tech_sa:1;
++	u8 fc_ll_m:1;
++	u8 fc_ll_l:1;
++	u8 fc_ll_i:1;
++	u8 fc_ll_s:1;
++	u8 fc_ll_v:1;
++
++	u8 unallocated_8_0:1;
++	u8 unallocated_8_1:1;
++	u8 sfp_ct_passive:1;
++	u8 sfp_ct_active:1;
++	u8 fc_tech_ll:1;
++	u8 fc_tech_sl:1;
++	u8 fc_tech_sn:1;
++	u8 fc_tech_electrical_intra_enclosure:1;
++
++	u8 fc_media_sm:1;
++	u8 unallocated_9_1:1;
++	u8 fc_media_m5:1;
++	u8 fc_media_m6:1;
++	u8 fc_media_tv:1;
++	u8 fc_media_mi:1;
++	u8 fc_media_tp:1;
++	u8 fc_media_tw:1;
++
++	u8 fc_speed_100:1;
++	u8 unallocated_10_1:1;
++	u8 fc_speed_200:1;
++	u8 fc_speed_3200:1;
++	u8 fc_speed_400:1;
++	u8 fc_speed_1600:1;
++	u8 fc_speed_800:1;
++	u8 fc_speed_1200:1;
++#else
++#error Unknown Endian
++#endif
++	u8 encoding;
++	u8 br_nominal;
++	u8 rate_id;
++	u8 link_len[6];
++	char vendor_name[16];
++	u8 reserved36;
++	char vendor_oui[3];
++	char vendor_pn[16];
++	char vendor_rev[4];
++	union {
++		__be16 optical_wavelength;
++		u8 cable_spec;
++	};
++	u8 reserved62;
++	u8 cc_base;
++};
++
++struct __packed sfp_eeprom_ext {
++	__be16 options;
++	u8 br_max;
++	u8 br_min;
++	char vendor_sn[16];
++	char datecode[8];
++	u8 diagmon;
++	u8 enhopts;
++	u8 sff8472_compliance;
++	u8 cc_ext;
++};
++
++struct __packed sfp_eeprom_id {
++	struct sfp_eeprom_base base;
++	struct sfp_eeprom_ext ext;
++};
++
++/* SFP EEPROM registers */
++enum {
++	SFP_PHYS_ID			= 0x00,
++	SFP_PHYS_EXT_ID			= 0x01,
++	SFP_CONNECTOR			= 0x02,
++	SFP_COMPLIANCE			= 0x03,
++	SFP_ENCODING			= 0x0b,
++	SFP_BR_NOMINAL			= 0x0c,
++	SFP_RATE_ID			= 0x0d,
++	SFP_LINK_LEN_SM_KM		= 0x0e,
++	SFP_LINK_LEN_SM_100M		= 0x0f,
++	SFP_LINK_LEN_50UM_OM2_10M	= 0x10,
++	SFP_LINK_LEN_62_5UM_OM1_10M	= 0x11,
++	SFP_LINK_LEN_COPPER_1M		= 0x12,
++	SFP_LINK_LEN_50UM_OM4_10M	= 0x12,
++	SFP_LINK_LEN_50UM_OM3_10M	= 0x13,
++	SFP_VENDOR_NAME			= 0x14,
++	SFP_VENDOR_OUI			= 0x25,
++	SFP_VENDOR_PN			= 0x28,
++	SFP_VENDOR_REV			= 0x38,
++	SFP_OPTICAL_WAVELENGTH_MSB	= 0x3c,
++	SFP_OPTICAL_WAVELENGTH_LSB	= 0x3d,
++	SFP_CABLE_SPEC			= 0x3c,
++	SFP_CC_BASE			= 0x3f,
++	SFP_OPTIONS			= 0x40,	/* 2 bytes, MSB, LSB */
++	SFP_BR_MAX			= 0x42,
++	SFP_BR_MIN			= 0x43,
++	SFP_VENDOR_SN			= 0x44,
++	SFP_DATECODE			= 0x54,
++	SFP_DIAGMON			= 0x5c,
++	SFP_ENHOPTS			= 0x5d,
++	SFP_SFF8472_COMPLIANCE		= 0x5e,
++	SFP_CC_EXT			= 0x5f,
++
++	SFP_PHYS_ID_SFP			= 0x03,
++	SFP_PHYS_EXT_ID_SFP		= 0x04,
++	SFP_CONNECTOR_UNSPEC		= 0x00,
++	/* codes 01-05 not supportable on SFP, but some modules have single SC */
++	SFP_CONNECTOR_SC		= 0x01,
++	SFP_CONNECTOR_FIBERJACK		= 0x06,
++	SFP_CONNECTOR_LC		= 0x07,
++	SFP_CONNECTOR_MT_RJ		= 0x08,
++	SFP_CONNECTOR_MU		= 0x09,
++	SFP_CONNECTOR_SG		= 0x0a,
++	SFP_CONNECTOR_OPTICAL_PIGTAIL	= 0x0b,
++	SFP_CONNECTOR_HSSDC_II		= 0x20,
++	SFP_CONNECTOR_COPPER_PIGTAIL	= 0x21,
++	SFP_ENCODING_UNSPEC		= 0x00,
++	SFP_ENCODING_8B10B		= 0x01,
++	SFP_ENCODING_4B5B		= 0x02,
++	SFP_ENCODING_NRZ		= 0x03,
++	SFP_ENCODING_MANCHESTER		= 0x04,
++	SFP_OPTIONS_HIGH_POWER_LEVEL	= BIT(13),
++	SFP_OPTIONS_PAGING_A2		= BIT(12),
++	SFP_OPTIONS_RETIMER		= BIT(11),
++	SFP_OPTIONS_COOLED_XCVR		= BIT(10),
++	SFP_OPTIONS_POWER_DECL		= BIT(9),
++	SFP_OPTIONS_RX_LINEAR_OUT	= BIT(8),
++	SFP_OPTIONS_RX_DECISION_THRESH	= BIT(7),
++	SFP_OPTIONS_TUNABLE_TX		= BIT(6),
++	SFP_OPTIONS_RATE_SELECT		= BIT(5),
++	SFP_OPTIONS_TX_DISABLE		= BIT(4),
++	SFP_OPTIONS_TX_FAULT		= BIT(3),
++	SFP_OPTIONS_LOS_INVERTED	= BIT(2),
++	SFP_OPTIONS_LOS_NORMAL		= BIT(1),
++	SFP_DIAGMON_DDM			= BIT(6),
++	SFP_DIAGMON_INT_CAL		= BIT(5),
++	SFP_DIAGMON_EXT_CAL		= BIT(4),
++	SFP_DIAGMON_RXPWR_AVG		= BIT(3),
++	SFP_DIAGMON_ADDRMODE		= BIT(2),
++	SFP_ENHOPTS_ALARMWARN		= BIT(7),
++	SFP_ENHOPTS_SOFT_TX_DISABLE	= BIT(6),
++	SFP_ENHOPTS_SOFT_TX_FAULT	= BIT(5),
++	SFP_ENHOPTS_SOFT_RX_LOS		= BIT(4),
++	SFP_ENHOPTS_SOFT_RATE_SELECT	= BIT(3),
++	SFP_ENHOPTS_APP_SELECT_SFF8079	= BIT(2),
++	SFP_ENHOPTS_SOFT_RATE_SFF8431	= BIT(1),
++	SFP_SFF8472_COMPLIANCE_NONE	= 0x00,
++	SFP_SFF8472_COMPLIANCE_REV9_3	= 0x01,
++	SFP_SFF8472_COMPLIANCE_REV9_5	= 0x02,
++	SFP_SFF8472_COMPLIANCE_REV10_2	= 0x03,
++	SFP_SFF8472_COMPLIANCE_REV10_4	= 0x04,
++	SFP_SFF8472_COMPLIANCE_REV11_0	= 0x05,
++	SFP_SFF8472_COMPLIANCE_REV11_3	= 0x06,
++	SFP_SFF8472_COMPLIANCE_REV11_4	= 0x07,
++	SFP_SFF8472_COMPLIANCE_REV12_0	= 0x08,
++};
++
++/* SFP Diagnostics */
++enum {
++	/* Alarm and warnings stored MSB at lower address then LSB */
++	SFP_TEMP_HIGH_ALARM		= 0x00,
++	SFP_TEMP_LOW_ALARM		= 0x02,
++	SFP_TEMP_HIGH_WARN		= 0x04,
++	SFP_TEMP_LOW_WARN		= 0x06,
++	SFP_VOLT_HIGH_ALARM		= 0x08,
++	SFP_VOLT_LOW_ALARM		= 0x0a,
++	SFP_VOLT_HIGH_WARN		= 0x0c,
++	SFP_VOLT_LOW_WARN		= 0x0e,
++	SFP_BIAS_HIGH_ALARM		= 0x10,
++	SFP_BIAS_LOW_ALARM		= 0x12,
++	SFP_BIAS_HIGH_WARN		= 0x14,
++	SFP_BIAS_LOW_WARN		= 0x16,
++	SFP_TXPWR_HIGH_ALARM		= 0x18,
++	SFP_TXPWR_LOW_ALARM		= 0x1a,
++	SFP_TXPWR_HIGH_WARN		= 0x1c,
++	SFP_TXPWR_LOW_WARN		= 0x1e,
++	SFP_RXPWR_HIGH_ALARM		= 0x20,
++	SFP_RXPWR_LOW_ALARM		= 0x22,
++	SFP_RXPWR_HIGH_WARN		= 0x24,
++	SFP_RXPWR_LOW_WARN		= 0x26,
++	SFP_LASER_TEMP_HIGH_ALARM	= 0x28,
++	SFP_LASER_TEMP_LOW_ALARM	= 0x2a,
++	SFP_LASER_TEMP_HIGH_WARN	= 0x2c,
++	SFP_LASER_TEMP_LOW_WARN		= 0x2e,
++	SFP_TEC_CUR_HIGH_ALARM		= 0x30,
++	SFP_TEC_CUR_LOW_ALARM		= 0x32,
++	SFP_TEC_CUR_HIGH_WARN		= 0x34,
++	SFP_TEC_CUR_LOW_WARN		= 0x36,
++	SFP_CAL_RXPWR4			= 0x38,
++	SFP_CAL_RXPWR3			= 0x3c,
++	SFP_CAL_RXPWR2			= 0x40,
++	SFP_CAL_RXPWR1			= 0x44,
++	SFP_CAL_RXPWR0			= 0x48,
++	SFP_CAL_TXI_SLOPE		= 0x4c,
++	SFP_CAL_TXI_OFFSET		= 0x4e,
++	SFP_CAL_TXPWR_SLOPE		= 0x50,
++	SFP_CAL_TXPWR_OFFSET		= 0x52,
++	SFP_CAL_T_SLOPE			= 0x54,
++	SFP_CAL_T_OFFSET		= 0x56,
++	SFP_CAL_V_SLOPE			= 0x58,
++	SFP_CAL_V_OFFSET		= 0x5a,
++	SFP_CHKSUM			= 0x5f,
++
++	SFP_TEMP			= 0x60,
++	SFP_VCC				= 0x62,
++	SFP_TX_BIAS			= 0x64,
++	SFP_TX_POWER			= 0x66,
++	SFP_RX_POWER			= 0x68,
++	SFP_LASER_TEMP			= 0x6a,
++	SFP_TEC_CUR			= 0x6c,
++
++	SFP_STATUS			= 0x6e,
++	SFP_ALARM			= 0x70,
++
++	SFP_EXT_STATUS			= 0x76,
++	SFP_VSL				= 0x78,
++	SFP_PAGE			= 0x7f,
++};
++
++#endif
diff --git a/target/linux/mvebu/patches-4.4/133-sfp-display-SFP-module-information.patch b/target/linux/mvebu/patches-4.4/133-sfp-display-SFP-module-information.patch
new file mode 100644
index 0000000..bc039ee
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/133-sfp-display-SFP-module-information.patch
@@ -0,0 +1,283 @@
+From 66c248886538d7ee97ef2fe498061f857d4c906a Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sun, 13 Sep 2015 01:06:31 +0100
+Subject: [PATCH 721/744] sfp: display SFP module information
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/sfp.c | 247 +++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 246 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -248,6 +248,182 @@ static unsigned int sfp_check(void *buf,
+ 	return check;
+ }
+ 
++static const char *sfp_link_len(char *buf, size_t size, unsigned int length,
++	unsigned int multiplier)
++{
++	if (length == 0)
++		return "unsupported/unspecified";
++
++	if (length == 255) {
++		*buf++ = '>';
++		size -= 1;
++		length -= 1;
++	}
++
++	length *= multiplier;
++
++	if (length >= 1000)
++		snprintf(buf, size, "%u.%0*ukm",
++			length / 1000,
++			multiplier > 100 ? 1 :
++			multiplier > 10 ? 2 : 3,
++			length % 1000);
++	else
++		snprintf(buf, size, "%um", length);
++
++	return buf;
++}
++
++struct bitfield {
++	unsigned int mask;
++	unsigned int val;
++	const char *str;
++};
++
++static const struct bitfield sfp_options[] = {
++	{
++		.mask = SFP_OPTIONS_HIGH_POWER_LEVEL,
++		.val = SFP_OPTIONS_HIGH_POWER_LEVEL,
++		.str = "hpl",
++	}, {
++		.mask = SFP_OPTIONS_PAGING_A2,
++		.val = SFP_OPTIONS_PAGING_A2,
++		.str = "paginga2",
++	}, {
++		.mask = SFP_OPTIONS_RETIMER,
++		.val = SFP_OPTIONS_RETIMER,
++		.str = "retimer",
++	}, {
++		.mask = SFP_OPTIONS_COOLED_XCVR,
++		.val = SFP_OPTIONS_COOLED_XCVR,
++		.str = "cooled",
++	}, {
++		.mask = SFP_OPTIONS_POWER_DECL,
++		.val = SFP_OPTIONS_POWER_DECL,
++		.str = "powerdecl",
++	}, {
++		.mask = SFP_OPTIONS_RX_LINEAR_OUT,
++		.val = SFP_OPTIONS_RX_LINEAR_OUT,
++		.str = "rxlinear",
++	}, {
++		.mask = SFP_OPTIONS_RX_DECISION_THRESH,
++		.val = SFP_OPTIONS_RX_DECISION_THRESH,
++		.str = "rxthresh",
++	}, {
++		.mask = SFP_OPTIONS_TUNABLE_TX,
++		.val = SFP_OPTIONS_TUNABLE_TX,
++		.str = "tunabletx",
++	}, {
++		.mask = SFP_OPTIONS_RATE_SELECT,
++		.val = SFP_OPTIONS_RATE_SELECT,
++		.str = "ratesel",
++	}, {
++		.mask = SFP_OPTIONS_TX_DISABLE,
++		.val = SFP_OPTIONS_TX_DISABLE,
++		.str = "txdisable",
++	}, {
++		.mask = SFP_OPTIONS_TX_FAULT,
++		.val = SFP_OPTIONS_TX_FAULT,
++		.str = "txfault",
++	}, {
++		.mask = SFP_OPTIONS_LOS_INVERTED,
++		.val = SFP_OPTIONS_LOS_INVERTED,
++		.str = "los-",
++	}, {
++		.mask = SFP_OPTIONS_LOS_NORMAL,
++		.val = SFP_OPTIONS_LOS_NORMAL,
++		.str = "los+",
++	}, { }
++};
++
++static const struct bitfield diagmon[] = {
++	{
++		.mask = SFP_DIAGMON_DDM,
++		.val = SFP_DIAGMON_DDM,
++		.str = "ddm",
++	}, {
++		.mask = SFP_DIAGMON_INT_CAL,
++		.val = SFP_DIAGMON_INT_CAL,
++		.str = "intcal",
++	}, {
++		.mask = SFP_DIAGMON_EXT_CAL,
++		.val = SFP_DIAGMON_EXT_CAL,
++		.str = "extcal",
++	}, {
++		.mask = SFP_DIAGMON_RXPWR_AVG,
++		.val = SFP_DIAGMON_RXPWR_AVG,
++		.str = "rxpwravg",
++	}, { }
++};
++
++static const char *sfp_bitfield(char *out, size_t outsz, const struct bitfield *bits, unsigned int val)
++{
++	char *p = out;
++	int n;
++
++	*p = '\0';
++	while (bits->mask) {
++		if ((val & bits->mask) == bits->val) {
++			n = snprintf(p, outsz, "%s%s",
++				     out != p ? ", " : "",
++				     bits->str);
++			if (n == outsz)
++				break;
++			p += n;
++			outsz -= n;
++		}
++		bits++;
++	}
++
++	return out;
++}
++
++static const char *sfp_connector(unsigned int connector)
++{
++	switch (connector) {
++	case SFP_CONNECTOR_UNSPEC:
++		return "unknown/unspecified";
++	case SFP_CONNECTOR_SC:
++		return "SC";
++	case SFP_CONNECTOR_FIBERJACK:
++		return "Fiberjack";
++	case SFP_CONNECTOR_LC:
++		return "LC";
++	case SFP_CONNECTOR_MT_RJ:
++		return "MT-RJ";
++	case SFP_CONNECTOR_MU:
++		return "MU";
++	case SFP_CONNECTOR_SG:
++		return "SG";
++	case SFP_CONNECTOR_OPTICAL_PIGTAIL:
++		return "Optical pigtail";
++	case SFP_CONNECTOR_HSSDC_II:
++		return "HSSDC II";
++	case SFP_CONNECTOR_COPPER_PIGTAIL:
++		return "Copper pigtail";
++	default:
++		return "unknown";
++	}
++}
++
++static const char *sfp_encoding(unsigned int encoding)
++{
++	switch (encoding) {
++	case SFP_ENCODING_UNSPEC:
++		return "unspecified";
++	case SFP_ENCODING_8B10B:
++		return "8b10b";
++	case SFP_ENCODING_4B5B:
++		return "4b5b";
++	case SFP_ENCODING_NRZ:
++		return "NRZ";
++	case SFP_ENCODING_MANCHESTER:
++		return "MANCHESTER";
++	default:
++		return "unknown";
++	}
++}
++
+ /* Helpers */
+ static void sfp_module_tx_disable(struct sfp *sfp)
+ {
+@@ -426,6 +602,7 @@ static int sfp_sm_mod_probe(struct sfp *
+ 	char sn[17];
+ 	char date[9];
+ 	char rev[5];
++	char options[80];
+ 	u8 check;
+ 	int err;
+ 
+@@ -462,10 +639,78 @@ static int sfp_sm_mod_probe(struct sfp *
+ 	rev[4] = '\0';
+ 	memcpy(sn, sfp->id.ext.vendor_sn, 16);
+ 	sn[16] = '\0';
+-	memcpy(date, sfp->id.ext.datecode, 8);
++	date[0] = sfp->id.ext.datecode[4];
++	date[1] = sfp->id.ext.datecode[5];
++	date[2] = '-';
++	date[3] = sfp->id.ext.datecode[2];
++	date[4] = sfp->id.ext.datecode[3];
++	date[5] = '-';
++	date[6] = sfp->id.ext.datecode[0];
++	date[7] = sfp->id.ext.datecode[1];
+ 	date[8] = '\0';
+ 
+ 	dev_info(sfp->dev, "module %s %s rev %s sn %s dc %s\n", vendor, part, rev, sn, date);
++	dev_info(sfp->dev, "  %s connector, encoding %s, nominal bitrate %u.%uGbps +%u%% -%u%%\n",
++		 sfp_connector(sfp->id.base.connector),
++		 sfp_encoding(sfp->id.base.encoding),
++		 sfp->id.base.br_nominal / 10,
++		 sfp->id.base.br_nominal % 10,
++		 sfp->id.ext.br_max, sfp->id.ext.br_min);
++	dev_info(sfp->dev, "  1000BaseSX%c 1000BaseLX%c 1000BaseCX%c 1000BaseT%c 100BaseTLX%c 1000BaseFX%c BaseBX10%c BasePX%c\n",
++		 sfp->id.base.e1000_base_sx ? '+' : '-',
++		 sfp->id.base.e1000_base_lx ? '+' : '-',
++		 sfp->id.base.e1000_base_cx ? '+' : '-',
++		 sfp->id.base.e1000_base_t ? '+' : '-',
++		 sfp->id.base.e100_base_lx ? '+' : '-',
++		 sfp->id.base.e100_base_fx ? '+' : '-',
++		 sfp->id.base.e_base_bx10 ? '+' : '-',
++		 sfp->id.base.e_base_px ? '+' : '-');
++
++	if (!sfp->id.base.sfp_ct_passive && !sfp->id.base.sfp_ct_active &&
++	    !sfp->id.base.e1000_base_t) {
++		char len_9um[16], len_om[16];
++
++		dev_info(sfp->dev, "  Wavelength %unm, fiber lengths:\n",
++			 be16_to_cpup(&sfp->id.base.optical_wavelength));
++
++		if (sfp->id.base.link_len[0] == 255)
++			strcpy(len_9um, ">254km");
++		else if (sfp->id.base.link_len[1] && sfp->id.base.link_len[1] != 255)
++			sprintf(len_9um, "%um",
++				sfp->id.base.link_len[1] * 100);
++		else if (sfp->id.base.link_len[0])
++			sprintf(len_9um, "%ukm", sfp->id.base.link_len[0]);
++		else if (sfp->id.base.link_len[1] == 255)
++			strcpy(len_9um, ">25.4km");
++		else
++			strcpy(len_9um, "unsupported");
++
++		dev_info(sfp->dev, "    9?m SM    : %s\n", len_9um);
++		dev_info(sfp->dev, " 62.5?m MM OM1: %s\n",
++			 sfp_link_len(len_om, sizeof(len_om),
++				      sfp->id.base.link_len[3], 10));
++		dev_info(sfp->dev, "   50?m MM OM2: %s\n",
++			 sfp_link_len(len_om, sizeof(len_om),
++				      sfp->id.base.link_len[2], 10));
++		dev_info(sfp->dev, "   50?m MM OM3: %s\n",
++			 sfp_link_len(len_om, sizeof(len_om),
++				      sfp->id.base.link_len[5], 10));
++		dev_info(sfp->dev, "   50?m MM OM4: %s\n",
++			 sfp_link_len(len_om, sizeof(len_om),
++				      sfp->id.base.link_len[4], 10));
++	} else {
++		char len[16];
++		dev_info(sfp->dev, "  Copper length: %s\n",
++			 sfp_link_len(len, sizeof(len),
++				      sfp->id.base.link_len[4], 1));
++	}
++
++	dev_info(sfp->dev, "  Options: %s\n",
++		 sfp_bitfield(options, sizeof(options), sfp_options,
++			      be16_to_cpu(sfp->id.ext.options)));
++	dev_info(sfp->dev, "  Diagnostics: %s\n",
++		 sfp_bitfield(options, sizeof(options), diagmon,
++			      sfp->id.ext.diagmon));
+ 
+ 	/* We only support SFP modules, not the legacy GBIC modules. */
+ 	if (sfp->id.base.phys_id != SFP_PHYS_ID_SFP ||
diff --git a/target/linux/mvebu/patches-4.4/134-net-mvneta-convert-to-phylink.patch b/target/linux/mvebu/patches-4.4/134-net-mvneta-convert-to-phylink.patch
new file mode 100644
index 0000000..fac283f
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/134-net-mvneta-convert-to-phylink.patch
@@ -0,0 +1,697 @@
+From e268be0ddc666f4a98db462cbed2a97637e82b5c Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Wed, 16 Sep 2015 21:27:10 +0100
+Subject: [PATCH 722/744] net: mvneta: convert to phylink
+
+Convert mvneta to use phylink, which models the MAC to PHY link in
+a generic, reusable form.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/ethernet/marvell/Kconfig  |   2 +-
+ drivers/net/ethernet/marvell/mvneta.c | 451 +++++++++++++++++-----------------
+ 2 files changed, 227 insertions(+), 226 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/Kconfig
++++ b/drivers/net/ethernet/marvell/Kconfig
+@@ -58,7 +58,7 @@ config MVNETA
+ 	tristate "Marvell Armada 370/38x/XP network interface support"
+ 	depends on PLAT_ORION
+ 	select MVMDIO
+-	select FIXED_PHY
++	select PHYLINK
+ 	---help---
+ 	  This driver supports the network interface units in the
+ 	  Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family.
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -28,6 +28,7 @@
+ #include <linux/of_mdio.h>
+ #include <linux/of_net.h>
+ #include <linux/phy.h>
++#include <linux/phylink.h>
+ #include <linux/platform_device.h>
+ #include <linux/skbuff.h>
+ #include <net/hwbm.h>
+@@ -188,6 +189,7 @@
+ #define MVNETA_GMAC_CTRL_0                       0x2c00
+ #define      MVNETA_GMAC_MAX_RX_SIZE_SHIFT       2
+ #define      MVNETA_GMAC_MAX_RX_SIZE_MASK        0x7ffc
++#define      MVNETA_GMAC0_PORT_1000BASE_X        BIT(1)
+ #define      MVNETA_GMAC0_PORT_ENABLE            BIT(0)
+ #define MVNETA_GMAC_CTRL_2                       0x2c08
+ #define      MVNETA_GMAC2_INBAND_AN_ENABLE       BIT(0)
+@@ -203,13 +205,19 @@
+ #define      MVNETA_GMAC_TX_FLOW_CTRL_ENABLE     BIT(5)
+ #define      MVNETA_GMAC_RX_FLOW_CTRL_ACTIVE     BIT(6)
+ #define      MVNETA_GMAC_TX_FLOW_CTRL_ACTIVE     BIT(7)
++#define      MVNETA_GMAC_AN_COMPLETE             BIT(11)
++#define      MVNETA_GMAC_SYNC_OK                 BIT(14)
+ #define MVNETA_GMAC_AUTONEG_CONFIG               0x2c0c
+ #define      MVNETA_GMAC_FORCE_LINK_DOWN         BIT(0)
+ #define      MVNETA_GMAC_FORCE_LINK_PASS         BIT(1)
+ #define      MVNETA_GMAC_INBAND_AN_ENABLE        BIT(2)
++#define      MVNETA_GMAC_AN_BYPASS_ENABLE        BIT(3)
++#define      MVNETA_GMAC_INBAND_RESTART_AN       BIT(4)
+ #define      MVNETA_GMAC_CONFIG_MII_SPEED        BIT(5)
+ #define      MVNETA_GMAC_CONFIG_GMII_SPEED       BIT(6)
+ #define      MVNETA_GMAC_AN_SPEED_EN             BIT(7)
++#define      MVNETA_GMAC_CONFIG_FLOW_CTRL        BIT(8)
++#define      MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL    BIT(9)
+ #define      MVNETA_GMAC_AN_FLOW_CTRL_EN         BIT(11)
+ #define      MVNETA_GMAC_CONFIG_FULL_DUPLEX      BIT(12)
+ #define      MVNETA_GMAC_AN_DUPLEX_EN            BIT(13)
+@@ -396,15 +404,9 @@ struct mvneta_port {
+ 	u16 tx_ring_size;
+ 	u16 rx_ring_size;
+ 
+-	struct mii_bus *mii_bus;
+-	struct phy_device *phy_dev;
+-	phy_interface_t phy_interface;
+-	struct device_node *phy_node;
+-	unsigned int link;
+-	unsigned int duplex;
+-	unsigned int speed;
++	struct device_node *dn;
+ 	unsigned int tx_csum_limit;
+-	unsigned int use_inband_status:1;
++	struct phylink *phylink;
+ 
+ 	struct mvneta_bm *bm_priv;
+ 	struct mvneta_bm_pool *pool_long;
+@@ -1236,44 +1238,6 @@ static void mvneta_set_other_mcast_table
+ 		mvreg_write(pp, MVNETA_DA_FILT_OTH_MCAST + offset, val);
+ }
+ 
+-static void mvneta_set_autoneg(struct mvneta_port *pp, int enable)
+-{
+-	u32 val;
+-
+-	if (enable) {
+-		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+-		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
+-			 MVNETA_GMAC_FORCE_LINK_DOWN |
+-			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
+-		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
+-		       MVNETA_GMAC_AN_SPEED_EN |
+-		       MVNETA_GMAC_AN_DUPLEX_EN;
+-		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+-		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
+-		val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
+-	} else {
+-		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+-		val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
+-		       MVNETA_GMAC_AN_SPEED_EN |
+-		       MVNETA_GMAC_AN_DUPLEX_EN);
+-		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+-		val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
+-
+-		val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
+-		val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
+-		mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
+-	}
+-}
+-
+ static void mvneta_percpu_unmask_interrupt(void *arg)
+ {
+ 	struct mvneta_port *pp = arg;
+@@ -1421,7 +1385,6 @@ static void mvneta_defaults_set(struct m
+ 	val &= ~MVNETA_PHY_POLLING_ENABLE;
+ 	mvreg_write(pp, MVNETA_UNIT_CONTROL, val);
+ 
+-	mvneta_set_autoneg(pp, pp->use_inband_status);
+ 	mvneta_set_ucast_table(pp, -1);
+ 	mvneta_set_special_mcast_table(pp, -1);
+ 	mvneta_set_other_mcast_table(pp, -1);
+@@ -2614,26 +2577,11 @@ static irqreturn_t mvneta_isr(int irq, v
+ 	return IRQ_HANDLED;
+ }
+ 
+-static int mvneta_fixed_link_update(struct mvneta_port *pp,
+-				    struct phy_device *phy)
++static void mvneta_link_change(struct mvneta_port *pp)
+ {
+-	struct fixed_phy_status status;
+-	struct fixed_phy_status changed = {};
+ 	u32 gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS);
+ 
+-	status.link = !!(gmac_stat & MVNETA_GMAC_LINK_UP);
+-	if (gmac_stat & MVNETA_GMAC_SPEED_1000)
+-		status.speed = SPEED_1000;
+-	else if (gmac_stat & MVNETA_GMAC_SPEED_100)
+-		status.speed = SPEED_100;
+-	else
+-		status.speed = SPEED_10;
+-	status.duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX);
+-	changed.link = 1;
+-	changed.speed = 1;
+-	changed.duplex = 1;
+-	fixed_phy_update_state(phy, &status, &changed);
+-	return 0;
++	phylink_mac_change(pp->phylink, !!(gmac_stat & MVNETA_GMAC_LINK_UP));
+ }
+ 
+ /* NAPI handler
+@@ -2662,12 +2610,11 @@ static int mvneta_poll(struct napi_struc
+ 		u32 cause_misc = mvreg_read(pp, MVNETA_INTR_MISC_CAUSE);
+ 
+ 		mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
+-		if (pp->use_inband_status && (cause_misc &
+-				(MVNETA_CAUSE_PHY_STATUS_CHANGE |
+-				 MVNETA_CAUSE_LINK_CHANGE |
+-				 MVNETA_CAUSE_PSC_SYNC_CHANGE))) {
+-			mvneta_fixed_link_update(pp, pp->phy_dev);
+-		}
++
++		if (cause_misc & (MVNETA_CAUSE_PHY_STATUS_CHANGE |
++				  MVNETA_CAUSE_LINK_CHANGE |
++				  MVNETA_CAUSE_PSC_SYNC_CHANGE))
++			mvneta_link_change(pp);
+ 	}
+ 
+ 	/* Release Tx descriptors */
+@@ -2983,7 +2930,7 @@ static void mvneta_start_dev(struct mvne
+ 		    MVNETA_CAUSE_LINK_CHANGE |
+ 		    MVNETA_CAUSE_PSC_SYNC_CHANGE);
+ 
+-	phy_start(pp->phy_dev);
++	phylink_start(pp->phylink);
+ 	netif_tx_start_all_queues(pp->dev);
+ }
+ 
+@@ -2991,7 +2938,7 @@ static void mvneta_stop_dev(struct mvnet
+ {
+ 	unsigned int cpu;
+ 
+-	phy_stop(pp->phy_dev);
++	phylink_stop(pp->phylink);
+ 
+ 	for_each_online_cpu(cpu) {
+ 		struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
+@@ -3161,99 +3108,219 @@ static int mvneta_set_mac_addr(struct ne
+ 	return 0;
+ }
+ 
+-static void mvneta_adjust_link(struct net_device *ndev)
++static int mvneta_mac_support(struct net_device *ndev, unsigned int mode,
++			      struct phylink_link_state *state)
++{
++	switch (mode) {
++	case MLO_AN_8023Z:
++		state->supported = SUPPORTED_1000baseT_Full |
++				   SUPPORTED_Autoneg | SUPPORTED_Pause;
++		state->advertising = ADVERTISED_1000baseT_Full |
++				     ADVERTISED_Autoneg | ADVERTISED_Pause;
++		state->an_enabled = 1;
++		break;
++
++	case MLO_AN_FIXED:
++		break;
++
++	default:
++		state->supported = PHY_10BT_FEATURES |
++				   PHY_100BT_FEATURES |
++				   SUPPORTED_1000baseT_Full |
++				   SUPPORTED_Autoneg;
++		state->advertising = ADVERTISED_10baseT_Half |
++				     ADVERTISED_10baseT_Full |
++				     ADVERTISED_100baseT_Half |
++				     ADVERTISED_100baseT_Full |
++				     ADVERTISED_1000baseT_Full |
++				     ADVERTISED_Autoneg;
++		state->an_enabled = 1;
++		break;
++	}
++	return 0;
++}
++
++static int mvneta_mac_link_state(struct net_device *ndev,
++				 struct phylink_link_state *state)
+ {
+ 	struct mvneta_port *pp = netdev_priv(ndev);
+-	struct phy_device *phydev = pp->phy_dev;
+-	int status_change = 0;
++	u32 gmac_stat;
+ 
+-	if (phydev->link) {
+-		if ((pp->speed != phydev->speed) ||
+-		    (pp->duplex != phydev->duplex)) {
+-			u32 val;
+-
+-			val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+-			val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
+-				 MVNETA_GMAC_CONFIG_GMII_SPEED |
+-				 MVNETA_GMAC_CONFIG_FULL_DUPLEX);
+-
+-			if (phydev->duplex)
+-				val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
+-
+-			if (phydev->speed == SPEED_1000)
+-				val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
+-			else if (phydev->speed == SPEED_100)
+-				val |= MVNETA_GMAC_CONFIG_MII_SPEED;
++	gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS);
+ 
+-			mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++	if (gmac_stat & MVNETA_GMAC_SPEED_1000)
++		state->speed = SPEED_1000;
++	else if (gmac_stat & MVNETA_GMAC_SPEED_100)
++		state->speed = SPEED_100;
++	else
++		state->speed = SPEED_10;
+ 
+-			pp->duplex = phydev->duplex;
+-			pp->speed  = phydev->speed;
+-		}
++	state->an_complete = !!(gmac_stat & MVNETA_GMAC_AN_COMPLETE);
++	state->sync = !!(gmac_stat & MVNETA_GMAC_SYNC_OK);
++	state->link = !!(gmac_stat & MVNETA_GMAC_LINK_UP);
++	state->duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX);
++
++	state->pause = 0;
++	if (gmac_stat & MVNETA_GMAC_RX_FLOW_CTRL_ENABLE)
++		state->pause |= MLO_PAUSE_RX;
++	if (gmac_stat & MVNETA_GMAC_TX_FLOW_CTRL_ENABLE)
++		state->pause |= MLO_PAUSE_TX;
++
++	return 1;
++}
++
++static void mvneta_mac_an_restart(struct net_device *ndev, unsigned int mode)
++{
++	struct mvneta_port *pp = netdev_priv(ndev);
++
++	if (mode == MLO_AN_8023Z) {
++		u32 gmac_an = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
++			    gmac_an | MVNETA_GMAC_INBAND_RESTART_AN);
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
++			    gmac_an & ~MVNETA_GMAC_INBAND_RESTART_AN);
+ 	}
++}
+ 
+-	if (phydev->link != pp->link) {
+-		if (!phydev->link) {
+-			pp->duplex = -1;
+-			pp->speed = 0;
+-		}
++static void mvneta_mac_config(struct net_device *ndev, unsigned int mode,
++	const struct phylink_link_state *state)
++{
++	struct mvneta_port *pp = netdev_priv(ndev);
++	u32 new_ctrl0, gmac_ctrl0 = mvreg_read(pp, MVNETA_GMAC_CTRL_0);
++	u32 new_ctrl2, gmac_ctrl2 = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
++	u32 new_clk, gmac_clk = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
++	u32 new_an, gmac_an = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++
++	new_ctrl0 = gmac_ctrl0 & ~MVNETA_GMAC0_PORT_1000BASE_X;
++	new_ctrl2 = gmac_ctrl2 & ~MVNETA_GMAC2_INBAND_AN_ENABLE;
++	new_clk = gmac_clk & ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
++	new_an = gmac_an & ~(MVNETA_GMAC_INBAND_AN_ENABLE |
++			     MVNETA_GMAC_INBAND_RESTART_AN |
++			     MVNETA_GMAC_CONFIG_MII_SPEED |
++			     MVNETA_GMAC_CONFIG_GMII_SPEED |
++			     MVNETA_GMAC_AN_SPEED_EN |
++			     MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL |
++			     MVNETA_GMAC_CONFIG_FLOW_CTRL |
++			     MVNETA_GMAC_AN_FLOW_CTRL_EN |
++			     MVNETA_GMAC_CONFIG_FULL_DUPLEX |
++			     MVNETA_GMAC_AN_DUPLEX_EN);
++
++	if (state->advertising & ADVERTISED_Pause)
++		new_an |= MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL;
++
++	switch (mode) {
++	case MLO_AN_SGMII:
++		/* SGMII mode receives the state from the PHY */
++		new_ctrl2 |= MVNETA_GMAC2_INBAND_AN_ENABLE;
++		new_clk |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
++		new_an = (new_an & ~(MVNETA_GMAC_FORCE_LINK_DOWN |
++				     MVNETA_GMAC_FORCE_LINK_PASS)) |
++			 MVNETA_GMAC_INBAND_AN_ENABLE |
++			 MVNETA_GMAC_AN_SPEED_EN |
++			 MVNETA_GMAC_AN_DUPLEX_EN;
++		break;
++
++	case MLO_AN_8023Z:
++		/* 802.3z negotiation - only 1000base-X */
++		new_ctrl0 |= MVNETA_GMAC0_PORT_1000BASE_X;
++		new_clk |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
++		new_an = (new_an & ~(MVNETA_GMAC_FORCE_LINK_DOWN |
++				     MVNETA_GMAC_FORCE_LINK_PASS)) |
++			 MVNETA_GMAC_INBAND_AN_ENABLE |
++			 MVNETA_GMAC_CONFIG_GMII_SPEED |
++			 /* The MAC only supports FD mode */
++			 MVNETA_GMAC_CONFIG_FULL_DUPLEX;
++
++		if (state->an_enabled)
++			new_an |= MVNETA_GMAC_AN_FLOW_CTRL_EN;
++		break;
+ 
+-		pp->link = phydev->link;
+-		status_change = 1;
++	default:
++		/* Phy or fixed speed */
++		if (state->duplex)
++			new_an |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
++
++		if (state->speed == SPEED_1000)
++			new_an |= MVNETA_GMAC_CONFIG_GMII_SPEED;
++		else if (state->speed == SPEED_100)
++			new_an |= MVNETA_GMAC_CONFIG_MII_SPEED;
++		break;
+ 	}
+ 
+-	if (status_change) {
+-		if (phydev->link) {
+-			if (!pp->use_inband_status) {
+-				u32 val = mvreg_read(pp,
+-						  MVNETA_GMAC_AUTONEG_CONFIG);
+-				val &= ~MVNETA_GMAC_FORCE_LINK_DOWN;
+-				val |= MVNETA_GMAC_FORCE_LINK_PASS;
+-				mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
+-					    val);
+-			}
+-			mvneta_port_up(pp);
+-		} else {
+-			if (!pp->use_inband_status) {
+-				u32 val = mvreg_read(pp,
+-						  MVNETA_GMAC_AUTONEG_CONFIG);
+-				val &= ~MVNETA_GMAC_FORCE_LINK_PASS;
+-				val |= MVNETA_GMAC_FORCE_LINK_DOWN;
+-				mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
+-					    val);
+-			}
+-			mvneta_port_down(pp);
+-		}
+-		phy_print_status(phydev);
++	/* Armada 370 documentation says we can only change the port mode
++	 * and in-band enable when the link is down, so force it down
++	 * while making these changes. We also do this for GMAC_CTRL2 */
++	if ((new_ctrl0 ^ gmac_ctrl0) & MVNETA_GMAC0_PORT_1000BASE_X ||
++	    (new_ctrl2 ^ gmac_ctrl2) & MVNETA_GMAC2_INBAND_AN_ENABLE ||
++	    (new_an  ^ gmac_an) & MVNETA_GMAC_INBAND_AN_ENABLE) {
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
++			    (gmac_an & ~MVNETA_GMAC_FORCE_LINK_PASS) |
++			    MVNETA_GMAC_FORCE_LINK_DOWN);
++	}
++
++	if (new_ctrl0 != gmac_ctrl0)
++		mvreg_write(pp, MVNETA_GMAC_CTRL_0, new_ctrl0);
++	if (new_ctrl2 != gmac_ctrl2)
++		mvreg_write(pp, MVNETA_GMAC_CTRL_2, new_ctrl2);
++	if (new_clk != gmac_clk)
++		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, new_clk);
++	if (new_an != gmac_an)
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, new_an);
++}
++
++static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode)
++{
++	struct mvneta_port *pp = netdev_priv(ndev);
++	u32 val;
++
++	mvneta_port_down(pp);
++
++	if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED) {
++		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++		val &= ~MVNETA_GMAC_FORCE_LINK_PASS;
++		val |= MVNETA_GMAC_FORCE_LINK_DOWN;
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+ 	}
+ }
+ 
+-static int mvneta_mdio_probe(struct mvneta_port *pp)
++static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode,
++			       struct phy_device *phy)
+ {
+-	struct phy_device *phy_dev;
++	struct mvneta_port *pp = netdev_priv(ndev);
++	u32 val;
++
++	if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED) {
++		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
++		val &= ~MVNETA_GMAC_FORCE_LINK_DOWN;
++		val |= MVNETA_GMAC_FORCE_LINK_PASS;
++		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
++	}
+ 
+-	phy_dev = of_phy_connect(pp->dev, pp->phy_node, mvneta_adjust_link, 0,
+-				 pp->phy_interface);
+-	if (!phy_dev) {
+-		netdev_err(pp->dev, "could not find the PHY\n");
+-		return -ENODEV;
+-	}
+-
+-	phy_dev->supported &= PHY_GBIT_FEATURES;
+-	phy_dev->advertising = phy_dev->supported;
+-
+-	pp->phy_dev = phy_dev;
+-	pp->link    = 0;
+-	pp->duplex  = 0;
+-	pp->speed   = 0;
++	mvneta_port_up(pp);
++}
+ 
+-	return 0;
++static const struct phylink_mac_ops mvneta_phylink_ops = {
++	.mac_get_support = mvneta_mac_support,
++	.mac_link_state = mvneta_mac_link_state,
++	.mac_an_restart = mvneta_mac_an_restart,
++	.mac_config = mvneta_mac_config,
++	.mac_link_down = mvneta_mac_link_down,
++	.mac_link_up = mvneta_mac_link_up,
++};
++
++static int mvneta_mdio_probe(struct mvneta_port *pp)
++{
++	int err = phylink_of_phy_connect(pp->phylink, pp->dn);
++	if (err)
++		netdev_err(pp->dev, "could not attach PHY\n");
++
++	return err;
+ }
+ 
+ static void mvneta_mdio_remove(struct mvneta_port *pp)
+ {
+-	phy_disconnect(pp->phy_dev);
+-	pp->phy_dev = NULL;
++	phylink_disconnect_phy(pp->phylink);
+ }
+ 
+ /* Electing a CPU must be done in an atomic way: it should be done
+@@ -3501,10 +3568,7 @@ static int mvneta_ioctl(struct net_devic
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+ 
+-	if (!pp->phy_dev)
+-		return -ENOTSUPP;
+-
+-	return phy_mii_ioctl(pp->phy_dev, ifr, cmd);
++	return phylink_mii_ioctl(pp->phylink, ifr, cmd);
+ }
+ 
+ /* Ethtool methods */
+@@ -3514,54 +3578,15 @@ int mvneta_ethtool_get_settings(struct n
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+ 
+-	if (!pp->phy_dev)
+-		return -ENODEV;
+-
+-	return phy_ethtool_gset(pp->phy_dev, cmd);
++	return phylink_ethtool_get_settings(pp->phylink, cmd);
+ }
+ 
+ /* Set settings (phy address, speed) for ethtools */
+ int mvneta_ethtool_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+ {
+ 	struct mvneta_port *pp = netdev_priv(dev);
+-	struct phy_device *phydev = pp->phy_dev;
+-
+-	if (!phydev)
+-		return -ENODEV;
+ 
+-	if ((cmd->autoneg == AUTONEG_ENABLE) != pp->use_inband_status) {
+-		u32 val;
+-
+-		mvneta_set_autoneg(pp, cmd->autoneg == AUTONEG_ENABLE);
+-
+-		if (cmd->autoneg == AUTONEG_DISABLE) {
+-			val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+-			val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
+-				 MVNETA_GMAC_CONFIG_GMII_SPEED |
+-				 MVNETA_GMAC_CONFIG_FULL_DUPLEX);
+-
+-			if (phydev->duplex)
+-				val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
+-
+-			if (phydev->speed == SPEED_1000)
+-				val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
+-			else if (phydev->speed == SPEED_100)
+-				val |= MVNETA_GMAC_CONFIG_MII_SPEED;
+-
+-			mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+-		}
+-
+-		pp->use_inband_status = (cmd->autoneg == AUTONEG_ENABLE);
+-		netdev_info(pp->dev, "autoneg status set to %i\n",
+-			    pp->use_inband_status);
+-
+-		if (netif_running(dev)) {
+-			mvneta_port_down(pp);
+-			mvneta_port_up(pp);
+-		}
+-	}
+-
+-	return phy_ethtool_sset(pp->phy_dev, cmd);
++	return phylink_ethtool_set_settings(pp->phylink, cmd);
+ }
+ 
+ /* Set interrupt coalescing for ethtools */
+@@ -3669,7 +3694,8 @@ static void mvneta_ethtool_update_stats(
+ {
+ 	const struct mvneta_statistic *s;
+ 	void __iomem *base = pp->base;
+-	u32 high, low, val;
++	u32 high, low;
++	u64 val;
+ 	u64 val64;
+ 	int i;
+ 
+@@ -3964,14 +3990,13 @@ static int mvneta_probe(struct platform_
+ 	const struct mbus_dram_target_info *dram_target_info;
+ 	struct resource *res;
+ 	struct device_node *dn = pdev->dev.of_node;
+-	struct device_node *phy_node;
+ 	struct device_node *bm_node;
+ 	struct mvneta_port *pp;
+ 	struct net_device *dev;
++	struct phylink *phylink;
+ 	const char *dt_mac_addr;
+ 	char hw_mac_addr[ETH_ALEN];
+ 	const char *mac_from;
+-	const char *managed;
+ 	int tx_csum_limit;
+ 	int phy_mode;
+ 	int err;
+@@ -3987,31 +4012,11 @@ static int mvneta_probe(struct platform_
+ 		goto err_free_netdev;
+ 	}
+ 
+-	phy_node = of_parse_phandle(dn, "phy", 0);
+-	if (!phy_node) {
+-		if (!of_phy_is_fixed_link(dn)) {
+-			dev_err(&pdev->dev, "no PHY specified\n");
+-			err = -ENODEV;
+-			goto err_free_irq;
+-		}
+-
+-		err = of_phy_register_fixed_link(dn);
+-		if (err < 0) {
+-			dev_err(&pdev->dev, "cannot register fixed PHY\n");
+-			goto err_free_irq;
+-		}
+-
+-		/* In the case of a fixed PHY, the DT node associated
+-		 * to the PHY is the Ethernet MAC DT node.
+-		 */
+-		phy_node = of_node_get(dn);
+-	}
+-
+ 	phy_mode = of_get_phy_mode(dn);
+ 	if (phy_mode < 0) {
+ 		dev_err(&pdev->dev, "incorrect phy-mode\n");
+ 		err = -EINVAL;
+-		goto err_put_phy_node;
++		goto err_free_irq;
+ 	}
+ 
+ 	dev->tx_queue_len = MVNETA_MAX_TXD;
+@@ -4022,12 +4027,7 @@ static int mvneta_probe(struct platform_
+ 
+ 	pp = netdev_priv(dev);
+ 	spin_lock_init(&pp->lock);
+-	pp->phy_node = phy_node;
+-	pp->phy_interface = phy_mode;
+-
+-	err = of_property_read_string(dn, "managed", &managed);
+-	pp->use_inband_status = (err == 0 &&
+-				 strcmp(managed, "in-band-status") == 0);
++	pp->dn = dn;
+ 	pp->cpu_notifier.notifier_call = mvneta_percpu_notifier;
+ 
+ 	pp->rxq_def = rxq_def;
+@@ -4037,7 +4037,7 @@ static int mvneta_probe(struct platform_
+ 	pp->clk = devm_clk_get(&pdev->dev, NULL);
+ 	if (IS_ERR(pp->clk)) {
+ 		err = PTR_ERR(pp->clk);
+-		goto err_put_phy_node;
++		goto err_free_irq;
+ 	}
+ 
+ 	clk_prepare_enable(pp->clk);
+@@ -4140,6 +4140,14 @@ static int mvneta_probe(struct platform_
+ 	dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
+ 	dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
+ 
++	phylink = phylink_create(dev, dn, phy_mode, &mvneta_phylink_ops);
++	if (IS_ERR(phylink)) {
++		err = PTR_ERR(phylink);
++		goto err_free_stats;
++	}
++
++	pp->phylink = phylink;
++
+ 	err = register_netdev(dev);
+ 	if (err < 0) {
+ 		dev_err(&pdev->dev, "failed to register\n");
+@@ -4151,13 +4159,6 @@ static int mvneta_probe(struct platform_
+ 
+ 	platform_set_drvdata(pdev, pp->dev);
+ 
+-	if (pp->use_inband_status) {
+-		struct phy_device *phy = of_phy_find_device(dn);
+-
+-		mvneta_fixed_link_update(pp, phy);
+-
+-		put_device(&phy->dev);
+-	}
+ 
+ 	return 0;
+ 
+@@ -4169,13 +4170,13 @@ err_netdev:
+ 				       1 << pp->id);
+ 	}
+ err_free_stats:
++	if (pp->phylink)
++		phylink_destroy(pp->phylink);
+ 	free_percpu(pp->stats);
+ err_free_ports:
+ 	free_percpu(pp->ports);
+ err_clk:
+ 	clk_disable_unprepare(pp->clk);
+-err_put_phy_node:
+-	of_node_put(phy_node);
+ err_free_irq:
+ 	irq_dispose_mapping(dev->irq);
+ err_free_netdev:
+@@ -4194,7 +4195,7 @@ static int mvneta_remove(struct platform
+ 	free_percpu(pp->ports);
+ 	free_percpu(pp->stats);
+ 	irq_dispose_mapping(dev->irq);
+-	of_node_put(pp->phy_node);
++	phylink_destroy(pp->phylink);
+ 	free_netdev(dev);
+ 
+ 	if (pp->bm_priv) {
diff --git a/target/linux/mvebu/patches-4.4/135-phy-fixed-phy-remove-fixed_phy_update_state.patch b/target/linux/mvebu/patches-4.4/135-phy-fixed-phy-remove-fixed_phy_update_state.patch
new file mode 100644
index 0000000..58c9aab
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/135-phy-fixed-phy-remove-fixed_phy_update_state.patch
@@ -0,0 +1,80 @@
+From 9be436bdb67c1f4aa9f33f2477f94e1f58a0ff02 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Fri, 2 Oct 2015 22:46:54 +0100
+Subject: [PATCH 723/744] phy: fixed-phy: remove fixed_phy_update_state()
+
+mvneta is the only user of fixed_phy_update_state(), which has been
+converted to use phylink instead.  Remove fixed_phy_update_state().
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/fixed_phy.c | 31 -------------------------------
+ include/linux/phy_fixed.h   |  9 ---------
+ 2 files changed, 40 deletions(-)
+
+--- a/drivers/net/phy/fixed_phy.c
++++ b/drivers/net/phy/fixed_phy.c
+@@ -115,37 +115,6 @@ int fixed_phy_set_link_update(struct phy
+ }
+ EXPORT_SYMBOL_GPL(fixed_phy_set_link_update);
+ 
+-int fixed_phy_update_state(struct phy_device *phydev,
+-			   const struct fixed_phy_status *status,
+-			   const struct fixed_phy_status *changed)
+-{
+-	struct fixed_mdio_bus *fmb = &platform_fmb;
+-	struct fixed_phy *fp;
+-
+-	if (!phydev || phydev->bus != fmb->mii_bus)
+-		return -EINVAL;
+-
+-	list_for_each_entry(fp, &fmb->phys, node) {
+-		if (fp->addr == phydev->addr) {
+-			write_seqcount_begin(&fp->seqcount);
+-#define _UPD(x) if (changed->x) \
+-	fp->status.x = status->x
+-			_UPD(link);
+-			_UPD(speed);
+-			_UPD(duplex);
+-			_UPD(pause);
+-			_UPD(asym_pause);
+-#undef _UPD
+-			fixed_phy_update(fp);
+-			write_seqcount_end(&fp->seqcount);
+-			return 0;
+-		}
+-	}
+-
+-	return -ENOENT;
+-}
+-EXPORT_SYMBOL(fixed_phy_update_state);
+-
+ int fixed_phy_add(unsigned int irq, int phy_addr,
+ 		  struct fixed_phy_status *status,
+ 		  int link_gpio)
+--- a/include/linux/phy_fixed.h
++++ b/include/linux/phy_fixed.h
+@@ -23,9 +23,6 @@ extern void fixed_phy_del(int phy_addr);
+ extern int fixed_phy_set_link_update(struct phy_device *phydev,
+ 			int (*link_update)(struct net_device *,
+ 					   struct fixed_phy_status *));
+-extern int fixed_phy_update_state(struct phy_device *phydev,
+-			   const struct fixed_phy_status *status,
+-			   const struct fixed_phy_status *changed);
+ #else
+ static inline int fixed_phy_add(unsigned int irq, int phy_id,
+ 				struct fixed_phy_status *status,
+@@ -50,12 +47,6 @@ static inline int fixed_phy_set_link_upd
+ {
+ 	return -ENODEV;
+ }
+-static inline int fixed_phy_update_state(struct phy_device *phydev,
+-			   const struct fixed_phy_status *status,
+-			   const struct fixed_phy_status *changed)
+-{
+-	return -ENODEV;
+-}
+ #endif /* CONFIG_FIXED_PHY */
+ 
+ #endif /* __PHY_FIXED_H */
diff --git a/target/linux/mvebu/patches-4.4/136-phylink-add-ethtool-nway_reset-support.patch b/target/linux/mvebu/patches-4.4/136-phylink-add-ethtool-nway_reset-support.patch
new file mode 100644
index 0000000..ade904e
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/136-phylink-add-ethtool-nway_reset-support.patch
@@ -0,0 +1,48 @@
+From d6bd25b692378ec17bdb1023d398c03c45829947 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 20:27:19 +0100
+Subject: [PATCH 724/744] phylink: add ethtool nway_reset support
+
+Add ethtool nway_reset support to phylink, to allow userspace to
+request a re-negotiation of the link.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phylink.c | 14 ++++++++++++++
+ include/linux/phylink.h   |  1 +
+ 2 files changed, 15 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -687,6 +687,20 @@ int phylink_ethtool_set_settings(struct
+ }
+ EXPORT_SYMBOL_GPL(phylink_ethtool_set_settings);
+ 
++int phylink_ethtool_nway_reset(struct phylink *pl)
++{
++	int ret = 0;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->phydev)
++		ret = genphy_restart_aneg(pl->phydev);
++	phylink_mac_an_restart(pl);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
++
+ /* This emulates MII registers for a fixed-mode phy operating as per the
+  * passed in state. "aneg" defines if we report negotiation is possible.
+  *
+--- a/include/linux/phylink.h
++++ b/include/linux/phylink.h
+@@ -65,6 +65,7 @@ void phylink_stop(struct phylink *);
+ 
+ int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
+ int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
++int phylink_ethtool_nway_reset(struct phylink *);
+ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
+ 
+ void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
diff --git a/target/linux/mvebu/patches-4.4/137-net-mvneta-add-nway_reset-support.patch b/target/linux/mvebu/patches-4.4/137-net-mvneta-add-nway_reset-support.patch
new file mode 100644
index 0000000..034b596
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/137-net-mvneta-add-nway_reset-support.patch
@@ -0,0 +1,38 @@
+From 244bee2889d08f876c64c335765a8ea6de0f5381 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 19:40:31 +0100
+Subject: [PATCH 725/744] net: mvneta: add nway_reset support
+
+Add ethtool nway_reset support to mvneta via phylink, so that userspace
+can request the link in whatever mode to be renegotiated via
+ethtool -r ethX.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3589,6 +3589,13 @@ int mvneta_ethtool_set_settings(struct n
+ 	return phylink_ethtool_set_settings(pp->phylink, cmd);
+ }
+ 
++static int mvneta_ethtool_nway_reset(struct net_device *dev)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++
++	return phylink_ethtool_nway_reset(pp->phylink);
++}
++
+ /* Set interrupt coalescing for ethtools */
+ static int mvneta_ethtool_set_coalesce(struct net_device *dev,
+ 				       struct ethtool_coalesce *c)
+@@ -3853,6 +3860,7 @@ const struct ethtool_ops mvneta_eth_tool
+ 	.get_link       = ethtool_op_get_link,
+ 	.get_settings   = mvneta_ethtool_get_settings,
+ 	.set_settings   = mvneta_ethtool_set_settings,
++	.nway_reset	= mvneta_ethtool_nway_reset,
+ 	.set_coalesce   = mvneta_ethtool_set_coalesce,
+ 	.get_coalesce   = mvneta_ethtool_get_coalesce,
+ 	.get_drvinfo    = mvneta_ethtool_get_drvinfo,
diff --git a/target/linux/mvebu/patches-4.4/138-phylink-add-flow-control-support.patch b/target/linux/mvebu/patches-4.4/138-phylink-add-flow-control-support.patch
new file mode 100644
index 0000000..95b8a81
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/138-phylink-add-flow-control-support.patch
@@ -0,0 +1,262 @@
+From f566177aa6661e646b83526f24391a568ffd1a75 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 20:32:07 +0100
+Subject: [PATCH 726/744] phylink: add flow control support
+
+Add flow control support, including ethtool support, to phylink.  We
+add support to allow ethtool to get and set the current flow control
+settings, and the 802.3 specified resolution for the local and remote
+link partner abilities.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phylink.c | 145 +++++++++++++++++++++++++++++++++++++++++-----
+ include/linux/phylink.h   |   8 +++
+ 2 files changed, 139 insertions(+), 14 deletions(-)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -91,10 +91,12 @@ static int phylink_parse_fixedlink(struc
+ 		pl->link_config.an_complete = 1;
+ 		pl->link_config.speed = speed;
+ 		pl->link_config.duplex = DUPLEX_HALF;
+-		pl->link_config.pause = MLO_PAUSE_NONE;
+ 
+ 		if (of_property_read_bool(fixed_node, "full-duplex"))
+ 			pl->link_config.duplex = DUPLEX_FULL;
++
++		/* We treat the "pause" and "asym-pause" terminology as
++		 * defining the link partner's ability. */
+ 		if (of_property_read_bool(fixed_node, "pause"))
+ 			pl->link_config.pause |= MLO_PAUSE_SYM;
+ 		if (of_property_read_bool(fixed_node, "asym-pause"))
+@@ -118,7 +120,6 @@ static int phylink_parse_fixedlink(struc
+ 			pl->link_config.duplex = be32_to_cpu(fixed_prop[1]) ?
+ 						DUPLEX_FULL : DUPLEX_HALF;
+ 			pl->link_config.speed = be32_to_cpu(fixed_prop[2]);
+-			pl->link_config.pause = MLO_PAUSE_NONE;
+ 			if (be32_to_cpu(fixed_prop[3]))
+ 				pl->link_config.pause |= MLO_PAUSE_SYM;
+ 			if (be32_to_cpu(fixed_prop[4]))
+@@ -130,16 +131,6 @@ static int phylink_parse_fixedlink(struc
+ 	}
+ 
+ 	if (pl->link_an_mode == MLO_AN_FIXED) {
+-		/* Generate the supported/advertising masks */
+-		if (pl->link_config.pause & MLO_PAUSE_SYM) {
+-			pl->link_config.supported |= SUPPORTED_Pause;
+-			pl->link_config.advertising |= ADVERTISED_Pause;
+-		}
+-		if (pl->link_config.pause & MLO_PAUSE_ASYM) {
+-			pl->link_config.supported |= SUPPORTED_Asym_Pause;
+-			pl->link_config.advertising |= ADVERTISED_Asym_Pause;
+-		}
+-
+ 		if (pl->link_config.speed > SPEED_1000 &&
+ 		    pl->link_config.duplex != DUPLEX_FULL)
+ 			netdev_warn(pl->netdev, "fixed link specifies half duplex for %dMbps link?\n",
+@@ -242,6 +233,56 @@ static void phylink_get_fixed_state(stru
+ 		state->link = !!gpiod_get_value(pl->link_gpio);
+ }
+ 
++/* Flow control is resolved according to our and the link partners
++ * advertisments using the following drawn from the 802.3 specs:
++ *  Local device  Link partner
++ *  Pause AsymDir Pause AsymDir Result
++ *    1     X       1     X     TX+RX
++ *    0     1       1     1     RX
++ *    1     1       0     1     TX
++ */
++static void phylink_resolve_flow(struct phylink *pl,
++	struct phylink_link_state *state)
++{
++	int new_pause = 0;
++
++	if (pl->link_config.pause & MLO_PAUSE_AN) {
++		int pause = 0;
++
++		if (pl->link_config.advertising & ADVERTISED_Pause)
++			pause |= MLO_PAUSE_SYM;
++		if (pl->link_config.advertising & ADVERTISED_Asym_Pause)
++			pause |= MLO_PAUSE_ASYM;
++
++		pause &= state->pause;
++
++		if (pause & MLO_PAUSE_SYM)
++			new_pause = MLO_PAUSE_TX | MLO_PAUSE_RX;
++		else if (pause & MLO_PAUSE_ASYM)
++			new_pause = state->pause & MLO_PAUSE_SYM ?
++				 MLO_PAUSE_RX : MLO_PAUSE_TX;
++	} else {
++		new_pause = pl->link_config.pause & MLO_PAUSE_TXRX_MASK;
++	}
++
++	state->pause &= ~MLO_PAUSE_TXRX_MASK;
++	state->pause |= new_pause;
++}
++
++static const char *phylink_pause_to_str(int pause)
++{
++	switch (pause & MLO_PAUSE_TXRX_MASK) {
++	case MLO_PAUSE_TX | MLO_PAUSE_RX:
++		return "rx/tx";
++	case MLO_PAUSE_TX:
++		return "tx";
++	case MLO_PAUSE_RX:
++		return "rx";
++	default:
++		return "off";
++	}
++}
++
+ extern const char *phy_speed_to_str(int speed);
+ 
+ static void phylink_resolve(struct work_struct *w)
+@@ -257,6 +298,7 @@ static void phylink_resolve(struct work_
+ 		switch (pl->link_an_mode) {
+ 		case MLO_AN_PHY:
+ 			link_state = pl->phy_state;
++			phylink_resolve_flow(pl, &link_state);
+ 			break;
+ 
+ 		case MLO_AN_FIXED:
+@@ -265,9 +307,12 @@ static void phylink_resolve(struct work_
+ 
+ 		case MLO_AN_SGMII:
+ 			phylink_get_mac_state(pl, &link_state);
+-			if (pl->phydev)
++			if (pl->phydev) {
+ 				link_state.link = link_state.link &&
+ 						  pl->phy_state.link;
++				link_state.pause |= pl->phy_state.pause;
++				phylink_resolve_flow(pl, &link_state);
++			}
+ 			break;
+ 
+ 		case MLO_AN_8023Z:
+@@ -297,7 +342,7 @@ static void phylink_resolve(struct work_
+ 				    "Link is Up - %s/%s - flow control %s\n",
+ 				    phy_speed_to_str(link_state.speed),
+ 				    link_state.duplex ? "Full" : "Half",
+-				    link_state.pause ? "rx/tx" : "off");
++				    phylink_pause_to_str(link_state.pause));
+ 		}
+ 	}
+ 	mutex_unlock(&pl->state_mutex);
+@@ -326,6 +371,7 @@ struct phylink *phylink_create(struct ne
+ 	pl->link_interface = iface;
+ 	pl->link_port_support = SUPPORTED_MII;
+ 	pl->link_port = PORT_MII;
++	pl->link_config.pause = MLO_PAUSE_AN;
+ 	pl->ops = ops;
+ 	__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
+ 
+@@ -507,6 +553,7 @@ void phylink_start(struct phylink *pl)
+ 	 * a fixed-link to start with the correct parameters, and also
+ 	 * ensures that we set the appropriate advertisment for Serdes links.
+ 	 */
++	phylink_resolve_flow(pl, &pl->link_config);
+ 	phylink_mac_config(pl, &pl->link_config);
+ 
+ 	clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
+@@ -701,6 +748,76 @@ int phylink_ethtool_nway_reset(struct ph
+ }
+ EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
+ 
++void phylink_ethtool_get_pauseparam(struct phylink *pl,
++				    struct ethtool_pauseparam *pause)
++{
++	mutex_lock(&pl->config_mutex);
++
++	pause->autoneg = !!(pl->link_config.pause & MLO_PAUSE_AN);
++	pause->rx_pause = !!(pl->link_config.pause & MLO_PAUSE_RX);
++	pause->tx_pause = !!(pl->link_config.pause & MLO_PAUSE_TX);
++
++	mutex_unlock(&pl->config_mutex);
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_get_pauseparam);
++
++static int __phylink_ethtool_set_pauseparam(struct phylink *pl,
++					    struct ethtool_pauseparam *pause)
++{
++	struct phylink_link_state *config = &pl->link_config;
++
++	if (!(config->supported & (SUPPORTED_Pause | SUPPORTED_Asym_Pause)))
++		return -EOPNOTSUPP;
++
++	if (!(config->supported & SUPPORTED_Asym_Pause) &&
++	    !pause->autoneg && pause->rx_pause != pause->tx_pause)
++		return -EINVAL;
++
++	config->pause &= ~(MLO_PAUSE_AN | MLO_PAUSE_TXRX_MASK);
++
++	if (pause->autoneg)
++		config->pause |= MLO_PAUSE_AN;
++	if (pause->rx_pause)
++		config->pause |= MLO_PAUSE_RX;
++	if (pause->tx_pause)
++		config->pause |= MLO_PAUSE_TX;
++
++	switch (pl->link_an_mode) {
++	case MLO_AN_PHY:
++		/* Silently mark the carrier down, and then trigger a resolve */
++		netif_carrier_off(pl->netdev);
++		phylink_run_resolve(pl);
++		break;
++
++	case MLO_AN_FIXED:
++		/* Should we allow fixed links to change against the config? */
++		phylink_resolve_flow(pl, config);
++		phylink_mac_config(pl, config);
++		break;
++
++	case MLO_AN_SGMII:
++	case MLO_AN_8023Z:
++		phylink_mac_config(pl, config);
++		phylink_mac_an_restart(pl);
++		break;
++	}
++
++	return 0;
++}
++
++int phylink_ethtool_set_pauseparam(struct phylink *pl,
++				   struct ethtool_pauseparam *pause)
++{
++	int ret;
++
++	mutex_lock(&pl->config_mutex);
++	ret = __phylink_ethtool_set_pauseparam(pl, pause);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam);
++
+ /* This emulates MII registers for a fixed-mode phy operating as per the
+  * passed in state. "aneg" defines if we report negotiation is possible.
+  *
+--- a/include/linux/phylink.h
++++ b/include/linux/phylink.h
+@@ -13,6 +13,10 @@ enum {
+ 	MLO_PAUSE_NONE,
+ 	MLO_PAUSE_ASYM = BIT(0),
+ 	MLO_PAUSE_SYM = BIT(1),
++	MLO_PAUSE_RX = BIT(2),
++	MLO_PAUSE_TX = BIT(3),
++	MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
++	MLO_PAUSE_AN = BIT(4),
+ 
+ 	MLO_AN_PHY = 0,
+ 	MLO_AN_FIXED,
+@@ -66,6 +70,10 @@ void phylink_stop(struct phylink *);
+ int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
+ int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
+ int phylink_ethtool_nway_reset(struct phylink *);
++void phylink_ethtool_get_pauseparam(struct phylink *,
++				    struct ethtool_pauseparam *);
++int phylink_ethtool_set_pauseparam(struct phylink *,
++				   struct ethtool_pauseparam *);
+ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
+ 
+ void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
diff --git a/target/linux/mvebu/patches-4.4/139-net-mvneta-add-flow-control-support-via-phylink.patch b/target/linux/mvebu/patches-4.4/139-net-mvneta-add-flow-control-support-via-phylink.patch
new file mode 100644
index 0000000..75cd46e
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/139-net-mvneta-add-flow-control-support-via-phylink.patch
@@ -0,0 +1,66 @@
+From 7bd34822b9922beb22a6384d9190646105d259d8 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 17:41:44 +0100
+Subject: [PATCH 727/744] net: mvneta: add flow control support via phylink
+
+Add flow control support to mvneta, including the ethtool hooks.  This
+uses the phylink code to calculate the result of autonegotiation where
+a phy is attached, and to handle the ethtool settings.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++++++++++++-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3208,6 +3208,8 @@ static void mvneta_mac_config(struct net
+ 
+ 	if (state->advertising & ADVERTISED_Pause)
+ 		new_an |= MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL;
++	if (state->pause & MLO_PAUSE_TXRX_MASK)
++		new_an |= MVNETA_GMAC_CONFIG_FLOW_CTRL;
+ 
+ 	switch (mode) {
+ 	case MLO_AN_SGMII:
+@@ -3232,7 +3234,7 @@ static void mvneta_mac_config(struct net
+ 			 /* The MAC only supports FD mode */
+ 			 MVNETA_GMAC_CONFIG_FULL_DUPLEX;
+ 
+-		if (state->an_enabled)
++		if (state->pause & MLO_PAUSE_AN && state->an_enabled)
+ 			new_an |= MVNETA_GMAC_AN_FLOW_CTRL_EN;
+ 		break;
+ 
+@@ -3685,6 +3687,22 @@ static int mvneta_ethtool_set_ringparam(
+ 	return 0;
+ }
+ 
++static void mvneta_ethtool_get_pauseparam(struct net_device *dev,
++					  struct ethtool_pauseparam *pause)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++
++	phylink_ethtool_get_pauseparam(pp->phylink, pause);
++}
++
++static int mvneta_ethtool_set_pauseparam(struct net_device *dev,
++					 struct ethtool_pauseparam *pause)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++
++	return phylink_ethtool_set_pauseparam(pp->phylink, pause);
++}
++
+ static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
+ 				       u8 *data)
+ {
+@@ -3866,6 +3884,8 @@ const struct ethtool_ops mvneta_eth_tool
+ 	.get_drvinfo    = mvneta_ethtool_get_drvinfo,
+ 	.get_ringparam  = mvneta_ethtool_get_ringparam,
+ 	.set_ringparam	= mvneta_ethtool_set_ringparam,
++	.get_pauseparam	= mvneta_ethtool_get_pauseparam,
++	.set_pauseparam	= mvneta_ethtool_set_pauseparam,
+ 	.get_strings	= mvneta_ethtool_get_strings,
+ 	.get_ethtool_stats = mvneta_ethtool_get_stats,
+ 	.get_sset_count	= mvneta_ethtool_get_sset_count,
diff --git a/target/linux/mvebu/patches-4.4/140-net-mvneta-enable-flow-control-for-PHY-connections.patch b/target/linux/mvebu/patches-4.4/140-net-mvneta-enable-flow-control-for-PHY-connections.patch
new file mode 100644
index 0000000..e10574c
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/140-net-mvneta-enable-flow-control-for-PHY-connections.patch
@@ -0,0 +1,32 @@
+From 62f8a12044265df11531750a240e516a5f1ff433 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 00:34:08 +0100
+Subject: [PATCH 728/744] net: mvneta: enable flow control for PHY connections
+
+Enable flow control support for PHY connections by indicating our
+support via the ethtool capabilities.  phylink takes care of the
+appropriate handling.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3127,12 +3127,14 @@ static int mvneta_mac_support(struct net
+ 		state->supported = PHY_10BT_FEATURES |
+ 				   PHY_100BT_FEATURES |
+ 				   SUPPORTED_1000baseT_Full |
++				   SUPPORTED_Pause |
+ 				   SUPPORTED_Autoneg;
+ 		state->advertising = ADVERTISED_10baseT_Half |
+ 				     ADVERTISED_10baseT_Full |
+ 				     ADVERTISED_100baseT_Half |
+ 				     ADVERTISED_100baseT_Full |
+ 				     ADVERTISED_1000baseT_Full |
++				     ADVERTISED_Pause |
+ 				     ADVERTISED_Autoneg;
+ 		state->an_enabled = 1;
+ 		break;
diff --git a/target/linux/mvebu/patches-4.4/141-net-mvneta-enable-flow-control-for-fixed-connections.patch b/target/linux/mvebu/patches-4.4/141-net-mvneta-enable-flow-control-for-fixed-connections.patch
new file mode 100644
index 0000000..16ffab3
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/141-net-mvneta-enable-flow-control-for-fixed-connections.patch
@@ -0,0 +1,53 @@
+From 4c3e2dc08a11fb1273ca62467f1d06e59866bad3 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at armlinux.org.uk>
+Date: Tue, 12 Jul 2016 00:04:13 +0100
+Subject: [PATCH 729/744] net: mvneta: enable flow control for fixed
+ connections
+
+Allow symetric flow control to be enabled for fixed link connections as
+well as other types of connections by setting the supported and
+advertised capability bits.
+
+Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3114,9 +3114,9 @@ static int mvneta_mac_support(struct net
+ 	switch (mode) {
+ 	case MLO_AN_8023Z:
+ 		state->supported = SUPPORTED_1000baseT_Full |
+-				   SUPPORTED_Autoneg | SUPPORTED_Pause;
++				   SUPPORTED_Autoneg;
+ 		state->advertising = ADVERTISED_1000baseT_Full |
+-				     ADVERTISED_Autoneg | ADVERTISED_Pause;
++				     ADVERTISED_Autoneg;
+ 		state->an_enabled = 1;
+ 		break;
+ 
+@@ -3127,18 +3127,21 @@ static int mvneta_mac_support(struct net
+ 		state->supported = PHY_10BT_FEATURES |
+ 				   PHY_100BT_FEATURES |
+ 				   SUPPORTED_1000baseT_Full |
+-				   SUPPORTED_Pause |
+ 				   SUPPORTED_Autoneg;
+ 		state->advertising = ADVERTISED_10baseT_Half |
+ 				     ADVERTISED_10baseT_Full |
+ 				     ADVERTISED_100baseT_Half |
+ 				     ADVERTISED_100baseT_Full |
+ 				     ADVERTISED_1000baseT_Full |
+-				     ADVERTISED_Pause |
+ 				     ADVERTISED_Autoneg;
+ 		state->an_enabled = 1;
+ 		break;
+ 	}
++
++	/* All modes support flow control */
++	state->supported |= SUPPORTED_Pause;
++	state->advertising |= ADVERTISED_Pause;
++
+ 	return 0;
+ }
+ 
diff --git a/target/linux/mvebu/patches-4.4/142-phylink-add-EEE-support.patch b/target/linux/mvebu/patches-4.4/142-phylink-add-EEE-support.patch
new file mode 100644
index 0000000..b06ec76
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/142-phylink-add-EEE-support.patch
@@ -0,0 +1,111 @@
+From ffba226d73a2be262fff12d30aecf76d107b2ace Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 21:19:53 +0100
+Subject: [PATCH 730/744] phylink: add EEE support
+
+Add EEE hooks to phylink to allow the phylib EEE functions for the
+connected phy to be safely accessed.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phylink.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++-
+ include/linux/phylink.h   |  7 +++++-
+ 2 files changed, 63 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -334,7 +334,8 @@ static void phylink_resolve(struct work_
+ 			if (pl->phydev)
+ 				phylink_mac_config(pl, &link_state);
+ 
+-			pl->ops->mac_link_up(ndev, pl->link_an_mode);
++			pl->ops->mac_link_up(ndev, pl->link_an_mode,
++					     pl->phydev);
+ 
+ 			netif_carrier_on(ndev);
+ 
+@@ -818,6 +819,61 @@ int phylink_ethtool_set_pauseparam(struc
+ }
+ EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam);
+ 
++int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
++{
++	int ret = -EPROTONOSUPPORT;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->phydev)
++		ret = phy_init_eee(pl->phydev, clk_stop_enable);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_init_eee);
++
++int phylink_get_eee_err(struct phylink *pl)
++{
++	int ret = 0;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->phydev)
++		ret = phy_get_eee_err(pl->phydev);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_get_eee_err);
++
++int phylink_ethtool_get_eee(struct phylink *pl, struct ethtool_eee *eee)
++{
++	int ret = -EOPNOTSUPP;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->phydev)
++		ret = phy_ethtool_get_eee(pl->phydev, eee);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_get_eee);
++
++int phylink_ethtool_set_eee(struct phylink *pl, struct ethtool_eee *eee)
++{
++	int ret = -EOPNOTSUPP;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->phydev) {
++		ret = phy_ethtool_set_eee(pl->phydev, eee);
++		if (ret == 0 && eee->eee_enabled)
++			phy_start_aneg(pl->phydev);
++	}
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_set_eee);
++
+ /* This emulates MII registers for a fixed-mode phy operating as per the
+  * passed in state. "aneg" defines if we report negotiation is possible.
+  *
+--- a/include/linux/phylink.h
++++ b/include/linux/phylink.h
+@@ -51,7 +51,8 @@ struct phylink_mac_ops {
+ 	void (*mac_an_restart)(struct net_device *, unsigned int mode);
+ 
+ 	void (*mac_link_down)(struct net_device *, unsigned int mode);
+-	void (*mac_link_up)(struct net_device *, unsigned int mode);
++	void (*mac_link_up)(struct net_device *, unsigned int mode,
++			    struct phy_device *);
+ };
+ 
+ struct phylink *phylink_create(struct net_device *, struct device_node *,
+@@ -74,6 +75,10 @@ void phylink_ethtool_get_pauseparam(stru
+ 				    struct ethtool_pauseparam *);
+ int phylink_ethtool_set_pauseparam(struct phylink *,
+ 				   struct ethtool_pauseparam *);
++int phylink_init_eee(struct phylink *, bool);
++int phylink_get_eee_err(struct phylink *);
++int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
++int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
+ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
+ 
+ void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
diff --git a/target/linux/mvebu/patches-4.4/143-net-mvneta-add-EEE-support.patch b/target/linux/mvebu/patches-4.4/143-net-mvneta-add-EEE-support.patch
new file mode 100644
index 0000000..b904356
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/143-net-mvneta-add-EEE-support.patch
@@ -0,0 +1,182 @@
+From b7dacf514e41d6efff0ccc170f660cc6dc2aeae2 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Tue, 29 Sep 2015 15:17:39 +0100
+Subject: [PATCH 731/744] net: mvneta: add EEE support
+
+Add EEE support to mvneta.  This allows us to enable the low power idle
+support at MAC level if there is a PHY attached through phylink which
+supports LPI.  The appropriate ethtool support is provided to allow the
+feature to be controlled, including ethtool statistics for EEE wakeup
+errors.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 87 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 87 insertions(+)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -243,6 +243,12 @@
+ #define MVNETA_TXQ_TOKEN_SIZE_REG(q)             (0x3e40 + ((q) << 2))
+ #define      MVNETA_TXQ_TOKEN_SIZE_MAX           0x7fffffff
+ 
++#define MVNETA_LPI_CTRL_0                        0x2cc0
++#define MVNETA_LPI_CTRL_1                        0x2cc4
++#define      MVNETA_LPI_REQUEST_ENABLE           BIT(0)
++#define MVNETA_LPI_CTRL_2                        0x2cc8
++#define MVNETA_LPI_STATUS                        0x2ccc
++
+ #define MVNETA_CAUSE_TXQ_SENT_DESC_ALL_MASK	 0xff
+ 
+ /* Descriptor ring Macros */
+@@ -316,6 +322,11 @@
+ #define MVNETA_RX_GET_BM_POOL_ID(rxd) \
+ 	(((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT)
+ 
++enum {
++	ETHTOOL_STAT_EEE_WAKEUP,
++	ETHTOOL_MAX_STATS,
++};
++
+ struct mvneta_statistic {
+ 	unsigned short offset;
+ 	unsigned short type;
+@@ -324,6 +335,7 @@ struct mvneta_statistic {
+ 
+ #define T_REG_32	32
+ #define T_REG_64	64
++#define T_SW		1
+ 
+ static const struct mvneta_statistic mvneta_statistics[] = {
+ 	{ 0x3000, T_REG_64, "good_octets_received", },
+@@ -358,6 +370,7 @@ static const struct mvneta_statistic mvn
+ 	{ 0x304c, T_REG_32, "broadcast_frames_sent", },
+ 	{ 0x3054, T_REG_32, "fc_sent", },
+ 	{ 0x300c, T_REG_32, "internal_mac_transmit_err", },
++	{ ETHTOOL_STAT_EEE_WAKEUP, T_SW, "eee_wakeup_errors", },
+ };
+ 
+ struct mvneta_pcpu_stats {
+@@ -413,6 +426,10 @@ struct mvneta_port {
+ 	struct mvneta_bm_pool *pool_short;
+ 	int bm_win_id;
+ 
++	bool eee_enabled;
++	bool eee_active;
++	bool tx_lpi_enabled;
++
+ 	u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
+ 
+ 	u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
+@@ -3276,6 +3293,18 @@ static void mvneta_mac_config(struct net
+ 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, new_an);
+ }
+ 
++static void mvneta_set_eee(struct mvneta_port *pp, bool enable)
++{
++	u32 lpi_ctl1;
++
++	lpi_ctl1 = mvreg_read(pp, MVNETA_LPI_CTRL_1);
++	if (enable)
++		lpi_ctl1 |= MVNETA_LPI_REQUEST_ENABLE;
++	else
++		lpi_ctl1 &= ~MVNETA_LPI_REQUEST_ENABLE;
++	mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi_ctl1);
++}
++
+ static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode)
+ {
+ 	struct mvneta_port *pp = netdev_priv(ndev);
+@@ -3289,6 +3318,9 @@ static void mvneta_mac_link_down(struct
+ 		val |= MVNETA_GMAC_FORCE_LINK_DOWN;
+ 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+ 	}
++
++	pp->eee_active = false;
++	mvneta_set_eee(pp, false);
+ }
+ 
+ static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode,
+@@ -3305,6 +3337,11 @@ static void mvneta_mac_link_up(struct ne
+ 	}
+ 
+ 	mvneta_port_up(pp);
++
++	if (phy && pp->eee_enabled) {
++		pp->eee_active = phy_init_eee(phy, 0) >= 0;
++		mvneta_set_eee(pp, pp->eee_active && pp->tx_lpi_enabled);
++	}
+ }
+ 
+ static const struct phylink_mac_ops mvneta_phylink_ops = {
+@@ -3744,6 +3781,13 @@ static void mvneta_ethtool_update_stats(
+ 			val64 = (u64)high << 32 | low;
+ 			pp->ethtool_stats[i] += val64;
+ 			break;
++		case T_SW:
++			switch (s->offset) {
++			case ETHTOOL_STAT_EEE_WAKEUP:
++				val = phylink_get_eee_err(pp->phylink);
++				break;
++			}
++			break;
+ 		}
+ 	}
+ }
+@@ -3867,6 +3911,47 @@ static int mvneta_ethtool_get_rxfh(struc
+ 	return 0;
+ }
+ 
++static int mvneta_ethtool_get_eee(struct net_device *dev,
++				  struct ethtool_eee *eee)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++	u32 lpi_ctl0;
++
++	lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
++
++	eee->eee_enabled = pp->eee_enabled;
++	eee->eee_active = pp->eee_active;
++	eee->tx_lpi_enabled = pp->tx_lpi_enabled;
++	eee->tx_lpi_timer = (lpi_ctl0) >> 8; // * scale;
++
++	return phylink_ethtool_get_eee(pp->phylink, eee);
++}
++
++static int mvneta_ethtool_set_eee(struct net_device *dev,
++				  struct ethtool_eee *eee)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++	u32 lpi_ctl0;
++
++	/* The Armada 37x documents do not give limits for this other than
++	 * it being an 8-bit register. */
++	if (eee->tx_lpi_enabled &&
++	    (eee->tx_lpi_timer < 0 || eee->tx_lpi_timer > 255))
++		return -EINVAL;
++
++	lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
++	lpi_ctl0 &= ~(0xff << 8);
++	lpi_ctl0 |= eee->tx_lpi_timer << 8;
++	mvreg_write(pp, MVNETA_LPI_CTRL_0, lpi_ctl0);
++
++	pp->eee_enabled = eee->eee_enabled;
++	pp->tx_lpi_enabled = eee->tx_lpi_enabled;
++
++	mvneta_set_eee(pp, eee->tx_lpi_enabled && eee->eee_enabled);
++
++	return phylink_ethtool_set_eee(pp->phylink, eee);
++}
++
+ static const struct net_device_ops mvneta_netdev_ops = {
+ 	.ndo_open            = mvneta_open,
+ 	.ndo_stop            = mvneta_stop,
+@@ -3898,6 +3983,8 @@ const struct ethtool_ops mvneta_eth_tool
+ 	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
+ 	.get_rxfh	= mvneta_ethtool_get_rxfh,
+ 	.set_rxfh	= mvneta_ethtool_set_rxfh,
++	.get_eee	= mvneta_ethtool_get_eee,
++	.set_eee	= mvneta_ethtool_set_eee,
+ };
+ 
+ /* Initialize hw */
diff --git a/target/linux/mvebu/patches-4.4/144-phylink-add-module-EEPROM-support.patch b/target/linux/mvebu/patches-4.4/144-phylink-add-module-EEPROM-support.patch
new file mode 100644
index 0000000..f57f70d
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/144-phylink-add-module-EEPROM-support.patch
@@ -0,0 +1,137 @@
+From 5419ccb638aa5c353ea88815e98953d9fc02e6ca Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 23:10:05 +0100
+Subject: [PATCH 732/744] phylink: add module EEPROM support
+
+Add support for reading module EEPROMs through phylink.
+
+Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/phylink.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/phylink.h   | 12 +++++++++
+ 2 files changed, 78 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -60,6 +60,9 @@ struct phylink {
+ 	struct work_struct resolve;
+ 
+ 	bool mac_link_up;
++
++	const struct phylink_module_ops *module_ops;
++	void *module_data;
+ };
+ 
+ static const char *phylink_an_mode_str(unsigned int mode)
+@@ -819,6 +822,36 @@ int phylink_ethtool_set_pauseparam(struc
+ }
+ EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam);
+ 
++int phylink_ethtool_get_module_info(struct phylink *pl,
++				    struct ethtool_modinfo *modinfo)
++{
++	int ret = -EOPNOTSUPP;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->module_ops)
++		ret = pl->module_ops->get_module_info(pl->module_data,
++						      modinfo);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_get_module_info);
++
++int phylink_ethtool_get_module_eeprom(struct phylink *pl,
++				      struct ethtool_eeprom *ee, u8 *buf)
++{
++	int ret = -EOPNOTSUPP;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->module_ops)
++		ret = pl->module_ops->get_module_eeprom(pl->module_data, ee,
++							buf);
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_ethtool_get_module_eeprom);
++
+ int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
+ {
+ 	int ret = -EPROTONOSUPPORT;
+@@ -1016,6 +1049,39 @@ EXPORT_SYMBOL_GPL(phylink_mii_ioctl);
+ 
+ 
+ 
++int phylink_register_module(struct phylink *pl, void *data,
++			    const struct phylink_module_ops *ops)
++{
++	int ret = -EBUSY;
++
++	mutex_lock(&pl->config_mutex);
++	if (!pl->module_ops) {
++		pl->module_ops = ops;
++		pl->module_data = data;
++		ret = 0;
++	}
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_register_module);
++
++int phylink_unregister_module(struct phylink *pl, void *data)
++{
++	int ret = -EINVAL;
++
++	mutex_lock(&pl->config_mutex);
++	if (pl->module_data == data) {
++		pl->module_ops = NULL;
++		pl->module_data = NULL;
++		ret = 0;
++	}
++	mutex_unlock(&pl->config_mutex);
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(phylink_unregister_module);
++
+ void phylink_disable(struct phylink *pl)
+ {
+ 	set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
+--- a/include/linux/phylink.h
++++ b/include/linux/phylink.h
+@@ -55,6 +55,11 @@ struct phylink_mac_ops {
+ 			    struct phy_device *);
+ };
+ 
++struct phylink_module_ops {
++	int (*get_module_info)(void *, struct ethtool_modinfo *);
++	int (*get_module_eeprom)(void *, struct ethtool_eeprom *, u8 *);
++};
++
+ struct phylink *phylink_create(struct net_device *, struct device_node *,
+ 	phy_interface_t iface, const struct phylink_mac_ops *ops);
+ void phylink_destroy(struct phylink *);
+@@ -75,12 +80,19 @@ void phylink_ethtool_get_pauseparam(stru
+ 				    struct ethtool_pauseparam *);
+ int phylink_ethtool_set_pauseparam(struct phylink *,
+ 				   struct ethtool_pauseparam *);
++int phylink_ethtool_get_module_info(struct phylink *, struct ethtool_modinfo *);
++int phylink_ethtool_get_module_eeprom(struct phylink *,
++				      struct ethtool_eeprom *, u8 *);
+ int phylink_init_eee(struct phylink *, bool);
+ int phylink_get_eee_err(struct phylink *);
+ int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
+ int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
+ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
+ 
++int phylink_register_module(struct phylink *, void *,
++			    const struct phylink_module_ops *);
++int phylink_unregister_module(struct phylink *, void *);
++
+ void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);
+ int phylink_set_link_an_mode(struct phylink *pl, unsigned int mode);
+ void phylink_disable(struct phylink *pl);
diff --git a/target/linux/mvebu/patches-4.4/145-net-mvneta-add-module-EEPROM-reading-support.patch b/target/linux/mvebu/patches-4.4/145-net-mvneta-add-module-EEPROM-reading-support.patch
new file mode 100644
index 0000000..b3f9039
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/145-net-mvneta-add-module-EEPROM-reading-support.patch
@@ -0,0 +1,44 @@
+From 665e1fe77dedcfc6b5669214ebfd252c803290d4 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 1 Oct 2015 23:32:39 +0100
+Subject: [PATCH 733/744] net: mvneta: add module EEPROM reading support
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3911,6 +3911,22 @@ static int mvneta_ethtool_get_rxfh(struc
+ 	return 0;
+ }
+ 
++static int mvneta_ethtool_get_module_info(struct net_device *dev,
++					  struct ethtool_modinfo *modinfo)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++
++	return phylink_ethtool_get_module_info(pp->phylink, modinfo);
++}
++
++static int mvneta_ethtool_get_module_eeprom(struct net_device *dev,
++					    struct ethtool_eeprom *ee, u8 *buf)
++{
++	struct mvneta_port *pp = netdev_priv(dev);
++
++	return phylink_ethtool_get_module_eeprom(pp->phylink, ee, buf);
++}
++
+ static int mvneta_ethtool_get_eee(struct net_device *dev,
+ 				  struct ethtool_eee *eee)
+ {
+@@ -3983,6 +3999,8 @@ const struct ethtool_ops mvneta_eth_tool
+ 	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
+ 	.get_rxfh	= mvneta_ethtool_get_rxfh,
+ 	.set_rxfh	= mvneta_ethtool_set_rxfh,
++	.get_module_info = mvneta_ethtool_get_module_info,
++	.get_module_eeprom = mvneta_ethtool_get_module_eeprom,
+ 	.get_eee	= mvneta_ethtool_get_eee,
+ 	.set_eee	= mvneta_ethtool_set_eee,
+ };
diff --git a/target/linux/mvebu/patches-4.4/146-sfp-phylink-hook-up-eeprom-functions.patch b/target/linux/mvebu/patches-4.4/146-sfp-phylink-hook-up-eeprom-functions.patch
new file mode 100644
index 0000000..f37e652
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/146-sfp-phylink-hook-up-eeprom-functions.patch
@@ -0,0 +1,68 @@
+From a7091ef24223ed39b39c6b73b77c55c8a607f34a Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Thu, 8 Oct 2015 23:49:47 +0100
+Subject: [PATCH 734/744] sfp/phylink: hook up eeprom functions
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ drivers/net/phy/sfp.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -901,11 +901,9 @@ static void sfp_sm_event(struct sfp *sfp
+ 	mutex_unlock(&sfp->sm_mutex);
+ }
+ 
+-#if 0
+-static int sfp_phy_module_info(struct phy_device *phy,
+-			       struct ethtool_modinfo *modinfo)
++static int sfp_module_info(void *priv, struct ethtool_modinfo *modinfo)
+ {
+-	struct sfp *sfp = phy->priv;
++	struct sfp *sfp = priv;
+ 
+ 	/* locking... and check module is present */
+ 
+@@ -919,10 +917,9 @@ static int sfp_phy_module_info(struct ph
+ 	return 0;
+ }
+ 
+-static int sfp_phy_module_eeprom(struct phy_device *phy,
+-	struct ethtool_eeprom *ee, u8 *data)
++static int sfp_module_eeprom(void *priv, struct ethtool_eeprom *ee, u8 *data)
+ {
+-	struct sfp *sfp = phy->priv;
++	struct sfp *sfp = priv;
+ 	unsigned int first, last, len;
+ 	int ret;
+ 
+@@ -953,7 +950,11 @@ static int sfp_phy_module_eeprom(struct
+ 	}
+ 	return 0;
+ }
+-#endif
++
++static const struct phylink_module_ops sfp_module_ops = {
++	.get_module_info = sfp_module_info,
++	.get_module_eeprom = sfp_module_eeprom,
++};
+ 
+ static void sfp_timeout(struct work_struct *work)
+ {
+@@ -1029,6 +1030,7 @@ static int sfp_netdev_notify(struct noti
+ 	case NETDEV_UNREGISTER:
+ 		if (sfp->mod_phy && sfp->phylink)
+ 			phylink_disconnect_phy(sfp->phylink);
++		phylink_unregister_module(sfp->phylink, sfp);
+ 		sfp->phylink = NULL;
+ 		dev_put(sfp->ndev);
+ 		sfp->ndev = NULL;
+@@ -1145,6 +1147,7 @@ static int sfp_probe(struct platform_dev
+ 		}
+ 
+ 		phylink_disable(sfp->phylink);
++		phylink_register_module(sfp->phylink, sfp, &sfp_module_ops);
+ 	}
+ 
+ 	sfp->state = sfp_get_state(sfp);
diff --git a/target/linux/mvebu/patches-4.4/147-net-mvneta-add-BQL-support.patch b/target/linux/mvebu/patches-4.4/147-net-mvneta-add-BQL-support.patch
new file mode 100644
index 0000000..7bd2593
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/147-net-mvneta-add-BQL-support.patch
@@ -0,0 +1,83 @@
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -1695,8 +1695,10 @@ static struct mvneta_tx_queue *mvneta_tx
+ 
+ /* Free tx queue skbuffs */
+ static void mvneta_txq_bufs_free(struct mvneta_port *pp,
+-				 struct mvneta_tx_queue *txq, int num)
++				 struct mvneta_tx_queue *txq, int num,
++				 struct netdev_queue *nq)
+ {
++	unsigned int bytes_compl = 0, pkts_compl = 0;
+ 	int i;
+ 
+ 	for (i = 0; i < num; i++) {
+@@ -1704,6 +1706,11 @@ static void mvneta_txq_bufs_free(struct
+ 			txq->txq_get_index;
+ 		struct sk_buff *skb = txq->tx_skb[txq->txq_get_index];
+ 
++		if (skb) {
++			bytes_compl += skb->len;
++			pkts_compl++;
++		}
++
+ 		mvneta_txq_inc_get(txq);
+ 
+ 		if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
+@@ -1714,6 +1721,8 @@ static void mvneta_txq_bufs_free(struct
+ 			continue;
+ 		dev_kfree_skb_any(skb);
+ 	}
++
++	netdev_tx_completed_queue(nq, pkts_compl, bytes_compl);
+ }
+ 
+ /* Handle end of transmission */
+@@ -1727,7 +1736,7 @@ static void mvneta_txq_done(struct mvnet
+ 	if (!tx_done)
+ 		return;
+ 
+-	mvneta_txq_bufs_free(pp, txq, tx_done);
++	mvneta_txq_bufs_free(pp, txq, tx_done, nq);
+ 
+ 	txq->count -= tx_done;
+ 
+@@ -2334,6 +2343,8 @@ out:
+ 		struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
+ 		struct netdev_queue *nq = netdev_get_tx_queue(dev, txq_id);
+ 
++		netdev_tx_sent_queue(nq, len);
++
+ 		txq->count += frags;
+ 		mvneta_txq_pend_desc_add(pp, txq, frags);
+ 
+@@ -2358,9 +2369,10 @@ static void mvneta_txq_done_force(struct
+ 				  struct mvneta_tx_queue *txq)
+ 
+ {
++	struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
+ 	int tx_done = txq->count;
+ 
+-	mvneta_txq_bufs_free(pp, txq, tx_done);
++	mvneta_txq_bufs_free(pp, txq, tx_done, nq);
+ 
+ 	/* reset txq */
+ 	txq->count = 0;
+@@ -2841,6 +2853,8 @@ static int mvneta_txq_init(struct mvneta
+ static void mvneta_txq_deinit(struct mvneta_port *pp,
+ 			      struct mvneta_tx_queue *txq)
+ {
++	struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
++
+ 	kfree(txq->tx_skb);
+ 
+ 	if (txq->tso_hdrs)
+@@ -2852,6 +2866,8 @@ static void mvneta_txq_deinit(struct mvn
+ 				  txq->size * MVNETA_DESC_ALIGNED_SIZE,
+ 				  txq->descs, txq->descs_phys);
+ 
++	netdev_tx_reset_queue(nq);
++
+ 	txq->descs             = NULL;
+ 	txq->last_desc         = 0;
+ 	txq->next_desc_to_proc = 0;
diff --git a/target/linux/mvebu/patches-4.4/202-gpio_mvebu_add_limited_pwm_support.patch b/target/linux/mvebu/patches-4.4/202-gpio_mvebu_add_limited_pwm_support.patch
new file mode 100644
index 0000000..b09c89f
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/202-gpio_mvebu_add_limited_pwm_support.patch
@@ -0,0 +1,433 @@
+Armada 370/XP devices can 'blink' gpio lines with a configurable on
+and off period. This can be modelled as a PWM.
+
+However, there are only two sets of PWM configuration registers for
+all the gpio lines. This driver simply allows a single gpio line per
+gpio chip of 32 lines to be used as a PWM. Attempts to use more return
+EBUSY.
+
+Due to the interleaving of registers it is not simple to separate the
+PWM driver from the gpio driver. Thus the gpio driver has been
+extended with a PWM driver.
+
+Signed-off-by: Andrew Lunn <andrew at lunn.ch>
+---
+ drivers/gpio/Kconfig          |   5 ++
+ drivers/gpio/Makefile         |   1 +
+ drivers/gpio/gpio-mvebu-pwm.c | 202 ++++++++++++++++++++++++++++++++++++++++++
+ drivers/gpio/gpio-mvebu.c     |  37 +++-----
+ drivers/gpio/gpio-mvebu.h     |  79 +++++++++++++++++
+ 5 files changed, 299 insertions(+), 25 deletions(-)
+ create mode 100644 drivers/gpio/gpio-mvebu-pwm.c
+ create mode 100644 drivers/gpio/gpio-mvebu.h
+
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -295,6 +295,11 @@ config GPIO_MVEBU
+ 	depends on OF
+ 	select GENERIC_IRQ_CHIP
+ 
++config GPIO_MVEBU_PWM
++	def_bool y
++	depends on GPIO_MVEBU
++	depends on PWM
++
+ config GPIO_MXC
+ 	def_bool y
+ 	depends on ARCH_MXC
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -67,6 +67,7 @@ obj-$(CONFIG_GPIO_MPC5200)	+= gpio-mpc52
+ obj-$(CONFIG_GPIO_MPC8XXX)	+= gpio-mpc8xxx.o
+ obj-$(CONFIG_GPIO_MSIC)		+= gpio-msic.o
+ obj-$(CONFIG_GPIO_MVEBU)        += gpio-mvebu.o
++obj-$(CONFIG_GPIO_MVEBU_PWM)	+= gpio-mvebu-pwm.o
+ obj-$(CONFIG_GPIO_MXC)		+= gpio-mxc.o
+ obj-$(CONFIG_GPIO_MXS)		+= gpio-mxs.o
+ obj-$(CONFIG_GPIO_OCTEON)	+= gpio-octeon.o
+--- /dev/null
++++ b/drivers/gpio/gpio-mvebu-pwm.c
+@@ -0,0 +1,202 @@
++#include <linux/err.h>
++#include <linux/module.h>
++#include <linux/gpio.h>
++#include <linux/pwm.h>
++#include <linux/clk.h>
++#include <linux/platform_device.h>
++#include "gpio-mvebu.h"
++#include "gpiolib.h"
++
++static void __iomem *mvebu_gpioreg_blink_select(struct mvebu_gpio_chip *mvchip)
++{
++	return mvchip->membase + GPIO_BLINK_CNT_SELECT;
++}
++
++static inline struct mvebu_pwm *to_mvebu_pwm(struct pwm_chip *chip)
++{
++	return container_of(chip, struct mvebu_pwm, chip);
++}
++
++static inline struct mvebu_gpio_chip *to_mvchip(struct mvebu_pwm *pwm)
++{
++	return container_of(pwm, struct mvebu_gpio_chip, pwm);
++}
++
++static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwmd)
++{
++	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
++	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
++	struct gpio_desc *desc = gpio_to_desc(pwmd->pwm);
++	unsigned long flags;
++	int ret = 0;
++
++	spin_lock_irqsave(&pwm->lock, flags);
++	if (pwm->used) {
++		ret = -EBUSY;
++	} else {
++		if (!desc) {
++			ret = -ENODEV;
++			goto out;
++		}
++		ret = gpiod_request(desc, "mvebu-pwm");
++		if (ret)
++			goto out;
++
++		ret = gpiod_direction_output(desc, 0);
++		if (ret) {
++			gpiod_free(desc);
++			goto out;
++		}
++
++		pwm->pin = pwmd->pwm - mvchip->chip.base;
++		pwm->used = true;
++	}
++
++out:
++	spin_unlock_irqrestore(&pwm->lock, flags);
++	return ret;
++}
++
++static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwmd)
++{
++	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
++	struct gpio_desc *desc = gpio_to_desc(pwmd->pwm);
++	unsigned long flags;
++
++	spin_lock_irqsave(&pwm->lock, flags);
++	gpiod_free(desc);
++	pwm->used = false;
++	spin_unlock_irqrestore(&pwm->lock, flags);
++}
++
++static int mvebu_pwm_config(struct pwm_chip *chip, struct pwm_device *pwmd,
++			    int duty_ns, int period_ns)
++{
++	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
++	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
++	unsigned int on, off;
++	unsigned long long val;
++	u32 u;
++
++	val = (unsigned long long) pwm->clk_rate * duty_ns;
++	do_div(val, NSEC_PER_SEC);
++	if (val > UINT_MAX)
++		return -EINVAL;
++	if (val)
++		on = val;
++	else
++		on = 1;
++
++	val = (unsigned long long) pwm->clk_rate * (period_ns - duty_ns);
++	do_div(val, NSEC_PER_SEC);
++	if (val > UINT_MAX)
++		return -EINVAL;
++	if (val)
++		off = val;
++	else
++		off = 1;
++
++	u = readl_relaxed(mvebu_gpioreg_blink_select(mvchip));
++	u &= ~(1 << pwm->pin);
++	u |= (pwm->id << pwm->pin);
++	writel_relaxed(u, mvebu_gpioreg_blink_select(mvchip));
++
++	writel_relaxed(on, pwm->membase + BLINK_ON_DURATION);
++	writel_relaxed(off, pwm->membase + BLINK_OFF_DURATION);
++
++	return 0;
++}
++
++static int mvebu_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwmd)
++{
++	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
++	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
++
++	mvebu_gpio_blink(&mvchip->chip, pwm->pin, 1);
++
++	return 0;
++}
++
++static void mvebu_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwmd)
++{
++	struct mvebu_pwm *pwm = to_mvebu_pwm(chip);
++	struct mvebu_gpio_chip *mvchip = to_mvchip(pwm);
++
++	mvebu_gpio_blink(&mvchip->chip, pwm->pin, 0);
++}
++
++static const struct pwm_ops mvebu_pwm_ops = {
++	.request = mvebu_pwm_request,
++	.free = mvebu_pwm_free,
++	.config = mvebu_pwm_config,
++	.enable = mvebu_pwm_enable,
++	.disable = mvebu_pwm_disable,
++	.owner = THIS_MODULE,
++};
++
++void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip)
++{
++	struct mvebu_pwm *pwm = &mvchip->pwm;
++
++	pwm->blink_select = readl_relaxed(mvebu_gpioreg_blink_select(mvchip));
++	pwm->blink_on_duration =
++		readl_relaxed(pwm->membase + BLINK_ON_DURATION);
++	pwm->blink_off_duration =
++		readl_relaxed(pwm->membase + BLINK_OFF_DURATION);
++}
++
++void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip)
++{
++	struct mvebu_pwm *pwm = &mvchip->pwm;
++
++	writel_relaxed(pwm->blink_select, mvebu_gpioreg_blink_select(mvchip));
++	writel_relaxed(pwm->blink_on_duration,
++		       pwm->membase + BLINK_ON_DURATION);
++	writel_relaxed(pwm->blink_off_duration,
++		       pwm->membase + BLINK_OFF_DURATION);
++}
++
++/*
++ * Armada 370/XP has simple PWM support for gpio lines. Other SoCs
++ * don't have this hardware. So if we don't have the necessary
++ * resource, it is not an error.
++ */
++int mvebu_pwm_probe(struct platform_device *pdev,
++		    struct mvebu_gpio_chip *mvchip,
++		    int id)
++{
++	struct device *dev = &pdev->dev;
++	struct mvebu_pwm *pwm = &mvchip->pwm;
++	struct resource *res;
++
++	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm");
++	if (!res)
++		return 0;
++
++	mvchip->pwm.membase = devm_ioremap_resource(&pdev->dev, res);
++	if (IS_ERR(mvchip->pwm.membase))
++		return PTR_ERR(mvchip->percpu_membase);
++
++	if (id < 0 || id > 1)
++		return -EINVAL;
++	pwm->id = id;
++
++	if (IS_ERR(mvchip->clk))
++		return PTR_ERR(mvchip->clk);
++
++	pwm->clk_rate = clk_get_rate(mvchip->clk);
++	if (!pwm->clk_rate) {
++		dev_err(dev, "failed to get clock rate\n");
++		return -EINVAL;
++	}
++
++	pwm->chip.dev = dev;
++	pwm->chip.ops = &mvebu_pwm_ops;
++	pwm->chip.base = mvchip->chip.base;
++	pwm->chip.npwm = mvchip->chip.ngpio;
++	pwm->chip.can_sleep = false;
++
++	spin_lock_init(&pwm->lock);
++
++	return pwmchip_add(&pwm->chip);
++}
+--- a/drivers/gpio/gpio-mvebu.c
++++ b/drivers/gpio/gpio-mvebu.c
+@@ -42,10 +42,11 @@
+ #include <linux/io.h>
+ #include <linux/of_irq.h>
+ #include <linux/of_device.h>
++#include <linux/pwm.h>
+ #include <linux/clk.h>
+ #include <linux/pinctrl/consumer.h>
+ #include <linux/irqchip/chained_irq.h>
+-
++#include "gpio-mvebu.h"
+ /*
+  * GPIO unit register offsets.
+  */
+@@ -75,24 +76,6 @@
+ 
+ #define MVEBU_MAX_GPIO_PER_BANK		32
+ 
+-struct mvebu_gpio_chip {
+-	struct gpio_chip   chip;
+-	spinlock_t	   lock;
+-	void __iomem	  *membase;
+-	void __iomem	  *percpu_membase;
+-	int		   irqbase;
+-	struct irq_domain *domain;
+-	int		   soc_variant;
+-
+-	/* Used to preserve GPIO registers across suspend/resume */
+-	u32                out_reg;
+-	u32                io_conf_reg;
+-	u32                blink_en_reg;
+-	u32                in_pol_reg;
+-	u32                edge_mask_regs[4];
+-	u32                level_mask_regs[4];
+-};
+-
+ /*
+  * Functions returning addresses of individual registers for a given
+  * GPIO controller.
+@@ -218,7 +201,7 @@ static int mvebu_gpio_get(struct gpio_ch
+ 	return (u >> pin) & 1;
+ }
+ 
+-static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
++void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
+ {
+ 	struct mvebu_gpio_chip *mvchip =
+ 		container_of(chip, struct mvebu_gpio_chip, chip);
+@@ -607,6 +590,8 @@ static int mvebu_gpio_suspend(struct pla
+ 		BUG();
+ 	}
+ 
++	mvebu_pwm_suspend(mvchip);
++
+ 	return 0;
+ }
+ 
+@@ -650,6 +635,8 @@ static int mvebu_gpio_resume(struct plat
+ 		BUG();
+ 	}
+ 
++	mvebu_pwm_resume(mvchip);
++
+ 	return 0;
+ }
+ 
+@@ -661,7 +648,6 @@ static int mvebu_gpio_probe(struct platf
+ 	struct resource *res;
+ 	struct irq_chip_generic *gc;
+ 	struct irq_chip_type *ct;
+-	struct clk *clk;
+ 	unsigned int ngpios;
+ 	int soc_variant;
+ 	int i, cpu, id;
+@@ -691,10 +677,10 @@ static int mvebu_gpio_probe(struct platf
+ 		return id;
+ 	}
+ 
+-	clk = devm_clk_get(&pdev->dev, NULL);
++	mvchip->clk = devm_clk_get(&pdev->dev, NULL);
+ 	/* Not all SoCs require a clock.*/
+-	if (!IS_ERR(clk))
+-		clk_prepare_enable(clk);
++	if (!IS_ERR(mvchip->clk))
++		clk_prepare_enable(mvchip->clk);
+ 
+ 	mvchip->soc_variant = soc_variant;
+ 	mvchip->chip.label = dev_name(&pdev->dev);
+@@ -828,7 +814,8 @@ static int mvebu_gpio_probe(struct platf
+ 		goto err_generic_chip;
+ 	}
+ 
+-	return 0;
++	/* Armada 370/XP has simple PWM support for gpio lines */
++	return mvebu_pwm_probe(pdev, mvchip, id);
+ 
+ err_generic_chip:
+ 	irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
+--- /dev/null
++++ b/drivers/gpio/gpio-mvebu.h
+@@ -0,0 +1,79 @@
++/*
++ * Interface between MVEBU GPIO driver and PWM driver for GPIO pins
++ *
++ * Copyright (C) 2015, Andrew Lunn <andrew at lunn.ch>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++
++#ifndef MVEBU_GPIO_PWM_H
++#define MVEBU_GPIO_PWM_H
++
++#define BLINK_ON_DURATION	0x0
++#define BLINK_OFF_DURATION	0x4
++#define GPIO_BLINK_CNT_SELECT	0x0020
++
++struct mvebu_pwm {
++	void __iomem	*membase;
++	unsigned long	 clk_rate;
++	bool		 used;
++	unsigned	 pin;
++	struct pwm_chip	 chip;
++	int		 id;
++	spinlock_t	 lock;
++
++	/* Used to preserve GPIO/PWM registers across suspend /
++	 * resume */
++	u32		 blink_select;
++	u32		 blink_on_duration;
++	u32		 blink_off_duration;
++};
++
++struct mvebu_gpio_chip {
++	struct gpio_chip   chip;
++	spinlock_t	   lock;
++	void __iomem	  *membase;
++	void __iomem	  *percpu_membase;
++	int		   irqbase;
++	struct irq_domain *domain;
++	int		   soc_variant;
++	struct clk	  *clk;
++#ifdef CONFIG_PWM
++	struct mvebu_pwm pwm;
++#endif
++	/* Used to preserve GPIO registers across suspend/resume */
++	u32		   out_reg;
++	u32		   io_conf_reg;
++	u32		   blink_en_reg;
++	u32		   in_pol_reg;
++	u32		   edge_mask_regs[4];
++	u32		   level_mask_regs[4];
++};
++
++void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value);
++
++#ifdef CONFIG_PWM
++int mvebu_pwm_probe(struct platform_device *pdev,
++		    struct mvebu_gpio_chip *mvchip,
++		    int id);
++void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip);
++void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip);
++#else
++int mvebu_pwm_probe(struct platform_device *pdev,
++		    struct mvebu_gpio_chip *mvchip,
++		    int id)
++{
++	return 0;
++}
++
++void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip)
++{
++}
++
++void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip)
++{
++}
++#endif
++#endif
diff --git a/target/linux/mvebu/patches-4.4/203-dt_bindings_extend_mvebu_gpio_documentation_with_pwm.patch b/target/linux/mvebu/patches-4.4/203-dt_bindings_extend_mvebu_gpio_documentation_with_pwm.patch
new file mode 100644
index 0000000..48f9394
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/203-dt_bindings_extend_mvebu_gpio_documentation_with_pwm.patch
@@ -0,0 +1,52 @@
+Document the optional parameters needed for PWM operation of gpio
+lines.
+
+Signed-off-by: Andrew Lunn <andrew at lunn.ch>
+---
+ .../devicetree/bindings/gpio/gpio-mvebu.txt        | 31 ++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+
+--- a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
++++ b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
+@@ -38,6 +38,23 @@ Required properties:
+ - #gpio-cells: Should be two. The first cell is the pin number. The
+   second cell is reserved for flags, unused at the moment.
+ 
++Optional properties:
++
++In order to use the gpio lines in PWM mode, some additional optional
++properties are required. Only Armada 370 and XP supports these
++properties.
++
++- reg: an additional register set is needed, for the GPIO Blink
++  Counter on/off registers.
++
++- reg-names: Must contain an entry "pwm" corresponding to the
++  additional register range needed for pwm operation.
++
++- #pwm-cells: Should be two. The first cell is the pin number. The
++  second cell is reserved for flags, unused at the moment.
++
++- clocks: Must be a phandle to the clock for the gpio controller.
++
+ Example:
+ 
+ 		gpio0: gpio at d0018100 {
+@@ -51,3 +68,17 @@ Example:
+ 			#interrupt-cells = <2>;
+ 			interrupts = <16>, <17>, <18>, <19>;
+ 		};
++
++		gpio1: gpio at 18140 {
++			compatible = "marvell,orion-gpio";
++			reg = <0x18140 0x40>, <0x181c8 0x08>;
++			reg-names = "gpio", "pwm";
++			ngpios = <17>;
++			gpio-controller;
++			#gpio-cells = <2>;
++			#pwm-cells = <2>;
++			interrupt-controller;
++			#interrupt-cells = <2>;
++			interrupts = <87>, <88>, <89>;
++			clocks = <&coreclk 0>;
++		};
diff --git a/target/linux/mvebu/patches-4.4/204-mvebu_xp_add_pwm_properties_to_dtsi_files.patch b/target/linux/mvebu/patches-4.4/204-mvebu_xp_add_pwm_properties_to_dtsi_files.patch
new file mode 100644
index 0000000..69bec6c
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/204-mvebu_xp_add_pwm_properties_to_dtsi_files.patch
@@ -0,0 +1,149 @@
+Add properties to the gpio nodes to allow them to be also used
+as pwm lines.
+
+Signed-off-by: Andrew Lunn <andrew at lunn.ch>
+---
+ arch/arm/boot/dts/armada-370.dtsi        | 10 ++++++++--
+ arch/arm/boot/dts/armada-xp-mv78230.dtsi | 10 ++++++++--
+ arch/arm/boot/dts/armada-xp-mv78260.dtsi |  8 ++++++--
+ arch/arm/boot/dts/armada-xp-mv78460.dtsi | 10 ++++++++--
+ 4 files changed, 30 insertions(+), 8 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-370.dtsi
++++ b/arch/arm/boot/dts/armada-370.dtsi
+@@ -162,24 +162,30 @@
+ 
+ 			gpio0: gpio at 18100 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18100 0x40>;
++				reg = <0x18100 0x40>, <0x181c0 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <82>, <83>, <84>, <85>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio1: gpio at 18140 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18140 0x40>;
++				reg = <0x18140 0x40>, <0x181c8 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <87>, <88>, <89>, <90>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio2: gpio at 18180 {
+--- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
++++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
+@@ -203,24 +203,30 @@
+ 		internal-regs {
+ 			gpio0: gpio at 18100 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18100 0x40>;
++				reg = <0x18100 0x40>, <0x181c0 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <82>, <83>, <84>, <85>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio1: gpio at 18140 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18140 0x40>;
++				reg = <0x18140 0x40>, <0x181c8 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <17>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <87>, <88>, <89>;
++				clocks = <&coreclk 0>;
+ 			};
+ 		};
+ 	};
+--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
++++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+@@ -286,24 +286,28 @@
+ 		internal-regs {
+ 			gpio0: gpio at 18100 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18100 0x40>;
++				reg = <0x18100 0x40>, <0x181c0 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <82>, <83>, <84>, <85>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio1: gpio at 18140 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18140 0x40>;
++				reg = <0x18140 0x40>, <0x181c8 0x08>;
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <87>, <88>, <89>, <90>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio2: gpio at 18180 {
+--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
++++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+@@ -324,24 +324,30 @@
+ 		internal-regs {
+ 			gpio0: gpio at 18100 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18100 0x40>;
++				reg = <0x18100 0x40>, <0x181c0 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <82>, <83>, <84>, <85>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio1: gpio at 18140 {
+ 				compatible = "marvell,orion-gpio";
+-				reg = <0x18140 0x40>;
++				reg = <0x18140 0x40>, <0x181c8 0x08>;
++				reg-names = "gpio", "pwm";
+ 				ngpios = <32>;
+ 				gpio-controller;
+ 				#gpio-cells = <2>;
++				#pwm-cells = <2>;
+ 				interrupt-controller;
+ 				#interrupt-cells = <2>;
+ 				interrupts = <87>, <88>, <89>, <90>;
++				clocks = <&coreclk 0>;
+ 			};
+ 
+ 			gpio2: gpio at 18180 {
diff --git a/target/linux/mvebu/patches-4.4/205-arm_mvebu_enable_pwm_in_defconfig.patch b/target/linux/mvebu/patches-4.4/205-arm_mvebu_enable_pwm_in_defconfig.patch
new file mode 100644
index 0000000..b52c60f
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/205-arm_mvebu_enable_pwm_in_defconfig.patch
@@ -0,0 +1,18 @@
+Now that the gpio driver also supports PWM operation, enable
+the PWM framework in mvebu_v7_defconfig.
+
+Signed-off-by: Andrew Lunn <andrew at lunn.ch>
+---
+ arch/arm/configs/mvebu_v7_defconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/arm/configs/mvebu_v7_defconfig
++++ b/arch/arm/configs/mvebu_v7_defconfig
+@@ -131,6 +131,7 @@ CONFIG_DMADEVICES=y
+ CONFIG_MV_XOR=y
+ # CONFIG_IOMMU_SUPPORT is not set
+ CONFIG_MEMORY=y
++CONFIG_PWM=y
+ CONFIG_EXT4_FS=y
+ CONFIG_ISO9660_FS=y
+ CONFIG_JOLIET=y
diff --git a/target/linux/mvebu/patches-4.4/206-mvebu_wrt1900ac_use_pwm-fan_rather_than_gpio-fan.patch b/target/linux/mvebu/patches-4.4/206-mvebu_wrt1900ac_use_pwm-fan_rather_than_gpio-fan.patch
new file mode 100644
index 0000000..bff58e9
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/206-mvebu_wrt1900ac_use_pwm-fan_rather_than_gpio-fan.patch
@@ -0,0 +1,28 @@
+The mvebu gpio driver can also perform PWM on some pins. Us the
+pwm-fan driver to control the fan of the WRT1900AC, giving us fine
+grain control over its speed and hence noise.
+
+Signed-off-by: Andrew Lunn <andrew at lunn.ch>
+---
+ arch/arm/boot/dts/armada-xp-wrt1900ac.dts | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -428,13 +428,11 @@
+ 		};
+ 	};
+ 
+-	gpio_fan {
++	pwm_fan {
+ 		/* SUNON HA4010V4-0000-C99 */
+-		compatible = "gpio-fan";
+-		gpios = <&gpio0 24 0>;
+ 
+-		gpio-fan,speed-map = <0    0
+-				      4500 1>;
++		compatible = "pwm-fan";
++		pwms = <&gpio0 24 4000 0>;
+ 	};
+ 
+ 	dsa at 0 {
diff --git a/target/linux/mvebu/patches-4.4/207-armada-385-rd-mtd-partitions.patch b/target/linux/mvebu/patches-4.4/207-armada-385-rd-mtd-partitions.patch
new file mode 100644
index 0000000..fc94d9a
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/207-armada-385-rd-mtd-partitions.patch
@@ -0,0 +1,19 @@
+--- a/arch/arm/boot/dts/armada-388-rd.dts
++++ b/arch/arm/boot/dts/armada-388-rd.dts
+@@ -79,6 +79,16 @@
+ 					compatible = "st,m25p128", "jedec,spi-nor";
+ 					reg = <0>; /* Chip select 0 */
+ 					spi-max-frequency = <108000000>;
++
++					partition at 0 {
++						label = "uboot";
++						reg = <0 0x400000>;
++					};
++
++					partition at 1 {
++						label = "firmware";
++						reg = <0x400000 0xc00000>;
++					};
+ 				};
+ 			};
+ 
diff --git a/target/linux/mvebu/patches-4.4/208-ARM-mvebu-385-ap-Add-partitions.patch b/target/linux/mvebu/patches-4.4/208-ARM-mvebu-385-ap-Add-partitions.patch
new file mode 100644
index 0000000..d2aaeef
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/208-ARM-mvebu-385-ap-Add-partitions.patch
@@ -0,0 +1,34 @@
+From 9861f93a59142a3131870df2521eb2deb73026d7 Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime.ripard at free-electrons.com>
+Date: Tue, 13 Jan 2015 11:14:09 +0100
+Subject: [PATCH 2/2] ARM: mvebu: 385-ap: Add partitions
+
+Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
+---
+ arch/arm/boot/dts/armada-385-db-ap.dts | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+--- a/arch/arm/boot/dts/armada-385-db-ap.dts
++++ b/arch/arm/boot/dts/armada-385-db-ap.dts
+@@ -184,6 +184,21 @@
+ 				marvell,nand-keep-config;
+ 				marvell,nand-enable-arbiter;
+ 				nand-on-flash-bbt;
++
++				mtd0 at 00000000 {
++					label = "u-boot";
++					reg = <0x00000000 0x00800000>;
++				};
++
++				mtd1 at 00800000 {
++					label = "kernel";
++					reg = <0x00800000 0x00800000>;
++				};
++
++				mtd2 at 01000000 {
++					label = "ubi";
++					reg = <0x01000000 0x3f000000>;
++				};
+ 			};
+ 
+ 			usb3 at f0000 {
diff --git a/target/linux/mvebu/patches-4.4/209-clearfog_switch_node.patch b/target/linux/mvebu/patches-4.4/209-clearfog_switch_node.patch
new file mode 100644
index 0000000..55494d0
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/209-clearfog_switch_node.patch
@@ -0,0 +1,21 @@
+--- a/arch/arm/boot/dts/armada-388-clearfog.dts
++++ b/arch/arm/boot/dts/armada-388-clearfog.dts
+@@ -430,6 +430,18 @@
+ 		};
+ 	};
+ 
++	mvsw61xx {
++		#address-cells = <1>;
++		#size-cells = <0>;
++		compatible = "marvell,88e6176";
++		status = "okay";
++		reg = <0x4>;
++		is-indirect;
++
++		mii-bus = <&mdio>;
++		cpu-port-0 = <5>;
++	};
++
+ 	gpio-keys {
+ 		compatible = "gpio-keys";
+ 		pinctrl-0 = <&rear_button_pins>;
diff --git a/target/linux/mvebu/patches-4.4/210-ARM-dts-armada388-clearfog-add-SFP-module-support.patch b/target/linux/mvebu/patches-4.4/210-ARM-dts-armada388-clearfog-add-SFP-module-support.patch
new file mode 100644
index 0000000..9efcff9
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/210-ARM-dts-armada388-clearfog-add-SFP-module-support.patch
@@ -0,0 +1,84 @@
+From 63ff73593c2f5d3fc1cba479321d192caaca48aa Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel at arm.linux.org.uk>
+Date: Sat, 12 Sep 2015 18:43:39 +0100
+Subject: [PATCH 738/744] ARM: dts: armada388-clearfog: add SFP module support
+
+Add SFP module support for Clearfog using the SFP phylink support.
+
+Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
+---
+ arch/arm/boot/dts/armada-388-clearfog.dts | 44 ++++++++-----------------------
+ 1 file changed, 11 insertions(+), 33 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-388-clearfog.dts
++++ b/arch/arm/boot/dts/armada-388-clearfog.dts
+@@ -90,16 +90,12 @@
+ 			};
+ 
+ 			ethernet at 34000 {
++				managed = "in-band-status";
+ 				phy-mode = "sgmii";
+ 				buffer-manager = <&bm>;
+ 				bm,pool-long = <3>;
+ 				bm,pool-short = <1>;
+ 				status = "okay";
+-
+-				fixed-link {
+-					speed = <1000>;
+-					full-duplex;
+-				};
+ 			};
+ 
+ 			i2c at 11000 {
+@@ -183,34 +179,6 @@
+ 						output-low;
+ 						line-name = "m.2 devslp";
+ 					};
+-					sfp_los {
+-						/* SFP loss of signal */
+-						gpio-hog;
+-						gpios = <12 GPIO_ACTIVE_HIGH>;
+-						input;
+-						line-name = "sfp-los";
+-					};
+-					sfp_tx_fault {
+-						/* SFP laser fault */
+-						gpio-hog;
+-						gpios = <13 GPIO_ACTIVE_HIGH>;
+-						input;
+-						line-name = "sfp-tx-fault";
+-					};
+-					sfp_tx_disable {
+-						/* SFP transmit disable */
+-						gpio-hog;
+-						gpios = <14 GPIO_ACTIVE_HIGH>;
+-						output-low;
+-						line-name = "sfp-tx-disable";
+-					};
+-					sfp_mod_def0 {
+-						/* SFP module present */
+-						gpio-hog;
+-						gpios = <15 GPIO_ACTIVE_LOW>;
+-						input;
+-						line-name = "sfp-mod-def0";
+-					};
+ 				};
+ 
+ 				/* The MCP3021 is 100kHz clock only */
+@@ -374,6 +342,16 @@
+ 		};
+ 	};
+ 
++	sfp: sfp {
++		compatible = "sff,sfp";
++		i2c-bus = <&i2c1>;
++		los-gpio = <&expander0 12 GPIO_ACTIVE_HIGH>;
++		moddef0-gpio = <&expander0 15 GPIO_ACTIVE_LOW>;
++		sfp,ethernet = <&eth2>;
++		tx-disable-gpio = <&expander0 14 GPIO_ACTIVE_HIGH>;
++		tx-fault-gpio = <&expander0 13 GPIO_ACTIVE_HIGH>;
++	};
++
+ 	dsa at 0 {
+ 		compatible = "marvell,dsa";
+ 		dsa,ethernet = <&eth1>;
diff --git a/target/linux/mvebu/patches-4.4/300-reprobe_sfp_phy.patch b/target/linux/mvebu/patches-4.4/300-reprobe_sfp_phy.patch
new file mode 100644
index 0000000..42614ef
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/300-reprobe_sfp_phy.patch
@@ -0,0 +1,96 @@
+From 28baa5e2635285b178326b301f534ed95c65dd01 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski at gmail.com>
+Date: Thu, 29 Sep 2016 11:44:39 +0200
+Subject: [PATCH] sfp: retry phy probe if unsuccessful
+
+Some phys seem to take longer than 50 ms to come out of reset, so retry
+until we find a phy.
+
+Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
+---
+ drivers/net/phy/sfp.c | 38 +++++++++++++++++++++++++-------------
+ 1 file changed, 25 insertions(+), 13 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -488,7 +488,7 @@ static void sfp_sm_phy_detach(struct sfp
+ 	sfp->mod_phy = NULL;
+ }
+ 
+-static void sfp_sm_probe_phy(struct sfp *sfp)
++static int sfp_sm_probe_phy(struct sfp *sfp)
+ {
+ 	struct phy_device *phy;
+ 	int err;
+@@ -498,11 +498,11 @@ static void sfp_sm_probe_phy(struct sfp
+ 	phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
+ 	if (IS_ERR(phy)) {
+ 		dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
+-		return;
++		return PTR_ERR(phy);
+ 	}
+ 	if (!phy) {
+-		dev_info(sfp->dev, "no PHY detected\n");
+-		return;
++		dev_dbg(sfp->dev, "no PHY detected\n");
++		return -EAGAIN;
+ 	}
+ 
+ 	err = phylink_connect_phy(sfp->phylink, phy);
+@@ -510,11 +510,13 @@ static void sfp_sm_probe_phy(struct sfp
+ 		phy_device_remove(phy);
+ 		phy_device_free(phy);
+ 		dev_err(sfp->dev, "phylink_connect_phy failed: %d\n", err);
+-		return;
++		return err;
+ 	}
+ 
+ 	sfp->mod_phy = phy;
+ 	phy_start(phy);
++
++	return 0;
+ }
+ 
+ static void sfp_sm_link_up(struct sfp *sfp)
+@@ -565,13 +567,6 @@ static void sfp_sm_mod_init(struct sfp *
+ {
+ 	sfp_module_tx_enable(sfp);
+ 
+-	/* Wait t_init before indicating that the link is up, provided the
+-	 * current state indicates no TX_FAULT.  If TX_FAULT clears before
+-	 * this time, that's fine too.
+-	 */
+-	sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
+-	sfp->sm_retries = 5;
+-
+ 	if (sfp->phylink) {
+ 		/* Setting the serdes link mode is guesswork: there's no
+ 		 * field in the EEPROM which indicates what mode should
+@@ -587,9 +582,26 @@ static void sfp_sm_mod_init(struct sfp *
+ 		    !sfp->id.base.e100_base_fx) {
+ 			phylink_set_link_an_mode(sfp->phylink, MLO_AN_8023Z);
+ 		} else {
++			int ret;
++
+ 			phylink_set_link_an_mode(sfp->phylink, MLO_AN_SGMII);
+-			sfp_sm_probe_phy(sfp);
++
++			ret = sfp_sm_probe_phy(sfp);
++			if (ret) {
++				if (ret == -EAGAIN)
++					sfp_sm_set_timer(sfp, T_PROBE_RETRY);
++				else
++					sfp_sm_next(sfp, SFP_S_TX_DISABLE, 0);
++				return;
++			}
+ 		}
++
++		/* Wait t_init before indicating that the link is up, provided the
++		 * current state indicates no TX_FAULT.  If TX_FAULT clears before
++		 * this time, that's fine too.
++		 */
++		sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
++		sfp->sm_retries = 5;
+ 	}
+ }
+ 
diff --git a/target/linux/mvebu/patches-4.4/400-mvneta-tx-queue-workaround.patch b/target/linux/mvebu/patches-4.4/400-mvneta-tx-queue-workaround.patch
new file mode 100644
index 0000000..5dba311
--- /dev/null
+++ b/target/linux/mvebu/patches-4.4/400-mvneta-tx-queue-workaround.patch
@@ -0,0 +1,36 @@
+The hardware queue scheduling is apparently configured with fixed
+priorities, which creates a nasty fairness issue where traffic from one
+CPU can starve traffic from all other CPUs.
+
+Work around this issue by forcing all tx packets to go through one CPU,
+until this issue is fixed properly.
+
+Signed-off-by: Felix Fietkau <nbd at nbd.name>
+---
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -3984,6 +3984,16 @@ static int mvneta_ethtool_set_eee(struct
+ 	return phylink_ethtool_set_eee(pp->phylink, eee);
+ }
+ 
++static u16 mvneta_select_queue(struct net_device *dev, struct sk_buff *skb,
++			       void *accel_priv,
++			       select_queue_fallback_t fallback)
++{
++	/* XXX: hardware queue scheduling is broken,
++	 * use only one queue until it is fixed */
++	return 0;
++}
++
++
+ static const struct net_device_ops mvneta_netdev_ops = {
+ 	.ndo_open            = mvneta_open,
+ 	.ndo_stop            = mvneta_stop,
+@@ -3994,6 +4004,7 @@ static const struct net_device_ops mvnet
+ 	.ndo_fix_features    = mvneta_fix_features,
+ 	.ndo_get_stats64     = mvneta_get_stats64,
+ 	.ndo_do_ioctl        = mvneta_ioctl,
++	.ndo_select_queue    = mvneta_select_queue,
+ };
+ 
+ const struct ethtool_ops mvneta_eth_tool_ops = {


From lede-commits at lists.infradead.org  Thu Apr 20 13:46:31 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 16:46:31 -0400
Subject: [source]  bcm53xx: enable Northstar thermal driver
In-Reply-To: <20170420204630.24062.3869@git-01.infra.lede-project.org>
References: <20170420204630.24062.3869@git-01.infra.lede-project.org>
Message-ID: <mailman.25295.1492721216.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch master:
https://git.lede-project.org/23d7c4d6324e553cd2e05e9b9751af380fd1ae56

commit 23d7c4d6324e553cd2e05e9b9751af380fd1ae56
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Thu Apr 20 22:27:19 2017 +0200

    bcm53xx: enable Northstar thermal driver
    
    It allows monitoring CPU temp and will shutdown system on critical
    value.
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 target/linux/bcm53xx/config-4.4 | 5 +++++
 target/linux/bcm53xx/config-4.9 | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/target/linux/bcm53xx/config-4.4 b/target/linux/bcm53xx/config-4.4
index a7675e4..21d6e1c 100644
--- a/target/linux/bcm53xx/config-4.4
+++ b/target/linux/bcm53xx/config-4.4
@@ -71,6 +71,7 @@ CONFIG_BCMA_HOST_PCI_POSSIBLE=y
 CONFIG_BCMA_HOST_SOC=y
 CONFIG_BCMA_SFLASH=y
 CONFIG_BCM_NET_PHYLIB=y
+CONFIG_BCM_NS_THERMAL=y
 CONFIG_BGMAC=y
 CONFIG_BGMAC_BCMA=y
 # CONFIG_BGMAC_PLATFORM is not set
@@ -312,6 +313,10 @@ CONFIG_SWCONFIG_B53_SRAB_DRIVER=y
 CONFIG_SWIOTLB=y
 CONFIG_SWP_EMULATE=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_THERMAL=y
+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
+CONFIG_THERMAL_GOV_STEP_WISE=y
+CONFIG_THERMAL_OF=y
 # CONFIG_THUMB2_KERNEL is not set
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TREE_RCU=y
diff --git a/target/linux/bcm53xx/config-4.9 b/target/linux/bcm53xx/config-4.9
index 77492c8..3f6b7c3 100644
--- a/target/linux/bcm53xx/config-4.9
+++ b/target/linux/bcm53xx/config-4.9
@@ -64,6 +64,7 @@ CONFIG_BCMA_HOST_PCI_POSSIBLE=y
 CONFIG_BCMA_HOST_SOC=y
 CONFIG_BCMA_SFLASH=y
 CONFIG_BCM_NET_PHYLIB=y
+CONFIG_BCM_NS_THERMAL=y
 CONFIG_BGMAC=y
 CONFIG_BGMAC_BCMA=y
 # CONFIG_BGMAC_PLATFORM is not set
@@ -313,6 +314,10 @@ CONFIG_SWIOTLB=y
 CONFIG_SWPHY=y
 CONFIG_SWP_EMULATE=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_THERMAL=y
+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
+CONFIG_THERMAL_GOV_STEP_WISE=y
+CONFIG_THERMAL_OF=y
 # CONFIG_THUMB2_KERNEL is not set
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TREE_RCU=y


From lede-commits at lists.infradead.org  Thu Apr 20 13:46:30 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 16:46:30 -0400
Subject: [source]  bcm53xx: backport DT patches for serial, thermal and MDIO
In-Reply-To: <20170420204630.24062.3869@git-01.infra.lede-project.org>
References: <20170420204630.24062.3869@git-01.infra.lede-project.org>
Message-ID: <mailman.25296.1492721219.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch master:
https://git.lede-project.org/b0fcb9b85c7f16c13f1d45c80c00de8f4d2ff56c

commit b0fcb9b85c7f16c13f1d45c80c00de8f4d2ff56c
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Thu Apr 20 22:15:09 2017 +0200

    bcm53xx: backport DT patches for serial, thermal and MDIO
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ...5301X-Specify-serial-console-params-in-dt.patch | 161 +++++++++++++++++++++
 ...CM53573-Specify-serial-console-parameters.patch |  33 +++++
 ...-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch |  59 ++++++++
 ...M-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch |  34 +++++
 .../patches-4.4/905-BCM53573-minor-hacks.patch     |   2 +-
 ...5301X-Specify-serial-console-params-in-dt.patch | 161 +++++++++++++++++++++
 ...CM53573-Specify-serial-console-parameters.patch |  33 +++++
 ...-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch |  59 ++++++++
 ...M-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch |  34 +++++
 .../patches-4.9/905-BCM53573-minor-hacks.patch     |   2 +-
 10 files changed, 576 insertions(+), 2 deletions(-)

diff --git a/target/linux/bcm53xx/patches-4.4/047-0018-ARM-dts-BCM5301X-Specify-serial-console-params-in-dt.patch b/target/linux/bcm53xx/patches-4.4/047-0018-ARM-dts-BCM5301X-Specify-serial-console-params-in-dt.patch
new file mode 100644
index 0000000..d174adc
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0018-ARM-dts-BCM5301X-Specify-serial-console-params-in-dt.patch
@@ -0,0 +1,161 @@
+From 5be82d0475941dc96eeeee3c754baf48365f7bf5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 15 Mar 2017 18:03:27 +0100
+Subject: [PATCH] ARM: dts: BCM5301X: Specify serial console params in dtsi
+ files
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+So far every Northstar device we have seen was using the same serial
+console params (115200n8). It probably make the most sense to put it in
+some proper dtsi files instead of repeating over and over for every
+single device. As different boards may use different bootloaders it
+seems the safest idea is to use board specific dtsi files.
+
+Just in case some vendor decides to use different UART (parameters) this
+can be always easily overwritten.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm4708.dtsi    | 8 ++++++++
+ arch/arm/boot/dts/bcm47081.dtsi   | 8 ++++++++
+ arch/arm/boot/dts/bcm5301x.dtsi   | 4 ----
+ arch/arm/boot/dts/bcm94708.dts    | 8 --------
+ arch/arm/boot/dts/bcm94709.dts    | 8 --------
+ arch/arm/boot/dts/bcm953012er.dts | 8 --------
+ arch/arm/boot/dts/bcm953012hr.dts | 5 -----
+ arch/arm/boot/dts/bcm953012k.dts  | 4 ----
+ 8 files changed, 16 insertions(+), 37 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm4708.dtsi
++++ b/arch/arm/boot/dts/bcm4708.dtsi
+@@ -12,6 +12,14 @@
+ / {
+ 	compatible = "brcm,bcm4708";
+ 
++	aliases {
++		serial0 = &uart0;
++	};
++
++	chosen {
++		stdout-path = "serial0:115200n8";
++	};
++
+ 	cpus {
+ 		#address-cells = <1>;
+ 		#size-cells = <0>;
+--- a/arch/arm/boot/dts/bcm47081.dtsi
++++ b/arch/arm/boot/dts/bcm47081.dtsi
+@@ -22,6 +22,14 @@
+ / {
+ 	compatible = "brcm,bcm47081";
+ 
++	aliases {
++		serial0 = &uart0;
++	};
++
++	chosen {
++		stdout-path = "serial0:115200n8";
++	};
++
+ 	cpus {
+ 		#address-cells = <1>;
+ 		#size-cells = <0>;
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -18,10 +18,6 @@
+ / {
+ 	interrupt-parent = <&gic>;
+ 
+-	chosen {
+-		stdout-path = &uart0;
+-	};
+-
+ 	chipcommonA {
+ 		compatible = "simple-bus";
+ 		ranges = <0x00000000 0x18000000 0x00001000>;
+--- a/arch/arm/boot/dts/bcm94708.dts
++++ b/arch/arm/boot/dts/bcm94708.dts
+@@ -38,14 +38,6 @@
+ 	model = "NorthStar SVK (BCM94708)";
+ 	compatible = "brcm,bcm94708", "brcm,bcm4708";
+ 
+-	aliases {
+-		serial0 = &uart0;
+-	};
+-
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x08000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm94709.dts
++++ b/arch/arm/boot/dts/bcm94709.dts
+@@ -38,14 +38,6 @@
+ 	model = "NorthStar SVK (BCM94709)";
+ 	compatible = "brcm,bcm94709", "brcm,bcm4709", "brcm,bcm4708";
+ 
+-	aliases {
+-		serial0 = &uart0;
+-	};
+-
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x08000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm953012er.dts
++++ b/arch/arm/boot/dts/bcm953012er.dts
+@@ -39,14 +39,6 @@
+ 	model = "NorthStar Enterprise Router (BCM953012ER)";
+ 	compatible = "brcm,bcm953012er", "brcm,brcm53012", "brcm,bcm4708";
+ 
+-	aliases {
+-		serial0 = &uart0;
+-	};
+-
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x8000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm953012hr.dts
++++ b/arch/arm/boot/dts/bcm953012hr.dts
+@@ -40,16 +40,11 @@
+ 	compatible = "brcm,bcm953012hr", "brcm,brcm53012", "brcm,bcm4708";
+ 
+ 	aliases {
+-		serial0 = &uart0;
+ 		ethernet0 = &gmac0;
+ 		ethernet1 = &gmac1;
+ 		ethernet2 = &gmac2;
+ 	};
+ 
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory at 80000000 {
+ 		reg = <0x80000000 0x10000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm953012k.dts
++++ b/arch/arm/boot/dts/bcm953012k.dts
+@@ -43,10 +43,6 @@
+ 		serial1 = &uart1;
+ 	};
+ 
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x10000000>;
+ 	};
diff --git a/target/linux/bcm53xx/patches-4.4/047-0019-ARM-dts-BCM53573-Specify-serial-console-parameters.patch b/target/linux/bcm53xx/patches-4.4/047-0019-ARM-dts-BCM53573-Specify-serial-console-parameters.patch
new file mode 100644
index 0000000..b2a9a1f
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0019-ARM-dts-BCM53573-Specify-serial-console-parameters.patch
@@ -0,0 +1,33 @@
+From 3a599e0dbc03ffc51568cf3376633d127451632d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 15 Mar 2017 18:03:28 +0100
+Subject: [PATCH] ARM: dts: BCM53573: Specify serial console parameters
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This adds baud rate, parity & number of data bits. It's required to get
+serial working correctly.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm53573.dtsi | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/bcm53573.dtsi
++++ b/arch/arm/boot/dts/bcm53573.dtsi
+@@ -13,8 +13,12 @@
+ / {
+ 	interrupt-parent = <&gic>;
+ 
++	aliases {
++		serial0 = &uart0;
++	};
++
+ 	chosen {
+-		stdout-path = &uart0;
++		stdout-path = "serial0:115200n8";
+ 	};
+ 
+ 	cpus {
diff --git a/target/linux/bcm53xx/patches-4.4/047-0020-ARM-dts-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch b/target/linux/bcm53xx/patches-4.4/047-0020-ARM-dts-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch
new file mode 100644
index 0000000..461696e
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0020-ARM-dts-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch
@@ -0,0 +1,59 @@
+From e55d2c7272ff647efac4aecd895b20ee66e43519 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Fri, 14 Apr 2017 23:42:28 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Add CPU thermal sensor and zone
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This uses CPU thermal sensor available on every Northstar chipset to
+monitor temperature. We don't have any cooling or throttling so only a
+critical trip was added.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Acked-by: Jon Mason <jon.mason at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -363,6 +363,12 @@
+ 				     "sata2";
+ 	};
+ 
++	thermal: thermal at 1800c2c0 {
++		compatible = "brcm,ns-thermal";
++		reg = <0x1800c2c0 0x10>;
++		#thermal-sensor-cells = <0>;
++	};
++
+ 	srab: srab at 18007000 {
+ 		compatible = "brcm,bcm5301x-srab";
+ 		reg = <0x18007000 0x1000>;
+@@ -390,4 +396,24 @@
+ 
+ 		brcm,nand-has-wp;
+ 	};
++
++	thermal-zones {
++		cpu_thermal: cpu-thermal {
++			polling-delay-passive = <0>;
++			polling-delay = <1000>;
++			coefficients = <(-556) 418000>;
++			thermal-sensors = <&thermal>;
++
++			trips {
++				cpu-crit {
++					temperature	= <125000>;
++					hysteresis	= <0>;
++					type		= "critical";
++				};
++			};
++
++			cooling-maps {
++			};
++		};
++	};
+ };
diff --git a/target/linux/bcm53xx/patches-4.4/047-0021-ARM-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch b/target/linux/bcm53xx/patches-4.4/047-0021-ARM-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch
new file mode 100644
index 0000000..8449a34
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0021-ARM-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch
@@ -0,0 +1,34 @@
+From c4b88e77c28fad5151a1a4eac516b947e2d51be5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 19 Apr 2017 23:54:25 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify MDIO bus in the DT
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Northstar devices have MDIO bus that may contain various PHYs attached.
+A common example is USB 3.0 PHY (that doesn't have an MDIO driver yet).
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -334,6 +334,14 @@
+ 		};
+ 	};
+ 
++	mdio: mdio at 18003000 {
++		compatible = "brcm,iproc-mdio";
++		reg = <0x18003000 0x8>;
++		#size-cells = <1>;
++		#address-cells = <0>;
++		status = "disabled";
++	};
++
+ 	i2c0: i2c at 18009000 {
+ 		compatible = "brcm,iproc-i2c";
+ 		reg = <0x18009000 0x50>;
diff --git a/target/linux/bcm53xx/patches-4.4/905-BCM53573-minor-hacks.patch b/target/linux/bcm53xx/patches-4.4/905-BCM53573-minor-hacks.patch
index 52a32a0..c59048d 100644
--- a/target/linux/bcm53xx/patches-4.4/905-BCM53573-minor-hacks.patch
+++ b/target/linux/bcm53xx/patches-4.4/905-BCM53573-minor-hacks.patch
@@ -11,7 +11,7 @@ Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
 
 --- a/arch/arm/boot/dts/bcm53573.dtsi
 +++ b/arch/arm/boot/dts/bcm53573.dtsi
-@@ -44,6 +44,15 @@
+@@ -48,6 +48,15 @@
  		};
  	};
  
diff --git a/target/linux/bcm53xx/patches-4.9/033-0018-ARM-dts-BCM5301X-Specify-serial-console-params-in-dt.patch b/target/linux/bcm53xx/patches-4.9/033-0018-ARM-dts-BCM5301X-Specify-serial-console-params-in-dt.patch
new file mode 100644
index 0000000..d174adc
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.9/033-0018-ARM-dts-BCM5301X-Specify-serial-console-params-in-dt.patch
@@ -0,0 +1,161 @@
+From 5be82d0475941dc96eeeee3c754baf48365f7bf5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 15 Mar 2017 18:03:27 +0100
+Subject: [PATCH] ARM: dts: BCM5301X: Specify serial console params in dtsi
+ files
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+So far every Northstar device we have seen was using the same serial
+console params (115200n8). It probably make the most sense to put it in
+some proper dtsi files instead of repeating over and over for every
+single device. As different boards may use different bootloaders it
+seems the safest idea is to use board specific dtsi files.
+
+Just in case some vendor decides to use different UART (parameters) this
+can be always easily overwritten.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm4708.dtsi    | 8 ++++++++
+ arch/arm/boot/dts/bcm47081.dtsi   | 8 ++++++++
+ arch/arm/boot/dts/bcm5301x.dtsi   | 4 ----
+ arch/arm/boot/dts/bcm94708.dts    | 8 --------
+ arch/arm/boot/dts/bcm94709.dts    | 8 --------
+ arch/arm/boot/dts/bcm953012er.dts | 8 --------
+ arch/arm/boot/dts/bcm953012hr.dts | 5 -----
+ arch/arm/boot/dts/bcm953012k.dts  | 4 ----
+ 8 files changed, 16 insertions(+), 37 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm4708.dtsi
++++ b/arch/arm/boot/dts/bcm4708.dtsi
+@@ -12,6 +12,14 @@
+ / {
+ 	compatible = "brcm,bcm4708";
+ 
++	aliases {
++		serial0 = &uart0;
++	};
++
++	chosen {
++		stdout-path = "serial0:115200n8";
++	};
++
+ 	cpus {
+ 		#address-cells = <1>;
+ 		#size-cells = <0>;
+--- a/arch/arm/boot/dts/bcm47081.dtsi
++++ b/arch/arm/boot/dts/bcm47081.dtsi
+@@ -22,6 +22,14 @@
+ / {
+ 	compatible = "brcm,bcm47081";
+ 
++	aliases {
++		serial0 = &uart0;
++	};
++
++	chosen {
++		stdout-path = "serial0:115200n8";
++	};
++
+ 	cpus {
+ 		#address-cells = <1>;
+ 		#size-cells = <0>;
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -18,10 +18,6 @@
+ / {
+ 	interrupt-parent = <&gic>;
+ 
+-	chosen {
+-		stdout-path = &uart0;
+-	};
+-
+ 	chipcommonA {
+ 		compatible = "simple-bus";
+ 		ranges = <0x00000000 0x18000000 0x00001000>;
+--- a/arch/arm/boot/dts/bcm94708.dts
++++ b/arch/arm/boot/dts/bcm94708.dts
+@@ -38,14 +38,6 @@
+ 	model = "NorthStar SVK (BCM94708)";
+ 	compatible = "brcm,bcm94708", "brcm,bcm4708";
+ 
+-	aliases {
+-		serial0 = &uart0;
+-	};
+-
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x08000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm94709.dts
++++ b/arch/arm/boot/dts/bcm94709.dts
+@@ -38,14 +38,6 @@
+ 	model = "NorthStar SVK (BCM94709)";
+ 	compatible = "brcm,bcm94709", "brcm,bcm4709", "brcm,bcm4708";
+ 
+-	aliases {
+-		serial0 = &uart0;
+-	};
+-
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x08000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm953012er.dts
++++ b/arch/arm/boot/dts/bcm953012er.dts
+@@ -39,14 +39,6 @@
+ 	model = "NorthStar Enterprise Router (BCM953012ER)";
+ 	compatible = "brcm,bcm953012er", "brcm,brcm53012", "brcm,bcm4708";
+ 
+-	aliases {
+-		serial0 = &uart0;
+-	};
+-
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x8000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm953012hr.dts
++++ b/arch/arm/boot/dts/bcm953012hr.dts
+@@ -40,16 +40,11 @@
+ 	compatible = "brcm,bcm953012hr", "brcm,brcm53012", "brcm,bcm4708";
+ 
+ 	aliases {
+-		serial0 = &uart0;
+ 		ethernet0 = &gmac0;
+ 		ethernet1 = &gmac1;
+ 		ethernet2 = &gmac2;
+ 	};
+ 
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory at 80000000 {
+ 		reg = <0x80000000 0x10000000>;
+ 	};
+--- a/arch/arm/boot/dts/bcm953012k.dts
++++ b/arch/arm/boot/dts/bcm953012k.dts
+@@ -43,10 +43,6 @@
+ 		serial1 = &uart1;
+ 	};
+ 
+-	chosen {
+-		stdout-path = "serial0:115200n8";
+-	};
+-
+ 	memory {
+ 		reg = <0x00000000 0x10000000>;
+ 	};
diff --git a/target/linux/bcm53xx/patches-4.9/033-0019-ARM-dts-BCM53573-Specify-serial-console-parameters.patch b/target/linux/bcm53xx/patches-4.9/033-0019-ARM-dts-BCM53573-Specify-serial-console-parameters.patch
new file mode 100644
index 0000000..b2a9a1f
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.9/033-0019-ARM-dts-BCM53573-Specify-serial-console-parameters.patch
@@ -0,0 +1,33 @@
+From 3a599e0dbc03ffc51568cf3376633d127451632d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 15 Mar 2017 18:03:28 +0100
+Subject: [PATCH] ARM: dts: BCM53573: Specify serial console parameters
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This adds baud rate, parity & number of data bits. It's required to get
+serial working correctly.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm53573.dtsi | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/bcm53573.dtsi
++++ b/arch/arm/boot/dts/bcm53573.dtsi
+@@ -13,8 +13,12 @@
+ / {
+ 	interrupt-parent = <&gic>;
+ 
++	aliases {
++		serial0 = &uart0;
++	};
++
+ 	chosen {
+-		stdout-path = &uart0;
++		stdout-path = "serial0:115200n8";
+ 	};
+ 
+ 	cpus {
diff --git a/target/linux/bcm53xx/patches-4.9/033-0020-ARM-dts-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch b/target/linux/bcm53xx/patches-4.9/033-0020-ARM-dts-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch
new file mode 100644
index 0000000..461696e
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.9/033-0020-ARM-dts-BCM5301X-Add-CPU-thermal-sensor-and-zone.patch
@@ -0,0 +1,59 @@
+From e55d2c7272ff647efac4aecd895b20ee66e43519 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Fri, 14 Apr 2017 23:42:28 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Add CPU thermal sensor and zone
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This uses CPU thermal sensor available on every Northstar chipset to
+monitor temperature. We don't have any cooling or throttling so only a
+critical trip was added.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Acked-by: Jon Mason <jon.mason at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -363,6 +363,12 @@
+ 				     "sata2";
+ 	};
+ 
++	thermal: thermal at 1800c2c0 {
++		compatible = "brcm,ns-thermal";
++		reg = <0x1800c2c0 0x10>;
++		#thermal-sensor-cells = <0>;
++	};
++
+ 	srab: srab at 18007000 {
+ 		compatible = "brcm,bcm5301x-srab";
+ 		reg = <0x18007000 0x1000>;
+@@ -390,4 +396,24 @@
+ 
+ 		brcm,nand-has-wp;
+ 	};
++
++	thermal-zones {
++		cpu_thermal: cpu-thermal {
++			polling-delay-passive = <0>;
++			polling-delay = <1000>;
++			coefficients = <(-556) 418000>;
++			thermal-sensors = <&thermal>;
++
++			trips {
++				cpu-crit {
++					temperature	= <125000>;
++					hysteresis	= <0>;
++					type		= "critical";
++				};
++			};
++
++			cooling-maps {
++			};
++		};
++	};
+ };
diff --git a/target/linux/bcm53xx/patches-4.9/033-0021-ARM-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch b/target/linux/bcm53xx/patches-4.9/033-0021-ARM-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch
new file mode 100644
index 0000000..8449a34
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.9/033-0021-ARM-dts-BCM5301X-Specify-MDIO-bus-in-the-DT.patch
@@ -0,0 +1,34 @@
+From c4b88e77c28fad5151a1a4eac516b947e2d51be5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 19 Apr 2017 23:54:25 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify MDIO bus in the DT
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Northstar devices have MDIO bus that may contain various PHYs attached.
+A common example is USB 3.0 PHY (that doesn't have an MDIO driver yet).
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -334,6 +334,14 @@
+ 		};
+ 	};
+ 
++	mdio: mdio at 18003000 {
++		compatible = "brcm,iproc-mdio";
++		reg = <0x18003000 0x8>;
++		#size-cells = <1>;
++		#address-cells = <0>;
++		status = "disabled";
++	};
++
+ 	i2c0: i2c at 18009000 {
+ 		compatible = "brcm,iproc-i2c";
+ 		reg = <0x18009000 0x50>;
diff --git a/target/linux/bcm53xx/patches-4.9/905-BCM53573-minor-hacks.patch b/target/linux/bcm53xx/patches-4.9/905-BCM53573-minor-hacks.patch
index a2f15e5..c702390 100644
--- a/target/linux/bcm53xx/patches-4.9/905-BCM53573-minor-hacks.patch
+++ b/target/linux/bcm53xx/patches-4.9/905-BCM53573-minor-hacks.patch
@@ -11,7 +11,7 @@ Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
 
 --- a/arch/arm/boot/dts/bcm53573.dtsi
 +++ b/arch/arm/boot/dts/bcm53573.dtsi
-@@ -44,6 +44,15 @@
+@@ -48,6 +48,15 @@
  		};
  	};
  


From lede-commits at lists.infradead.org  Thu Apr 20 14:18:47 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 17:18:47 -0400
Subject: [source]  bcm53xx: prepare for building Archer C5 V2 image
In-Reply-To: <20170420211846.31094.70865@git-01.infra.lede-project.org>
References: <20170420211846.31094.70865@git-01.infra.lede-project.org>
Message-ID: <mailman.25301.1492723280.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/ad145e03cc59470c41807470e7366e541bcce869

commit ad145e03cc59470c41807470e7366e541bcce869
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Sat Mar 11 12:33:53 2017 +0100

    bcm53xx: prepare for building Archer C5 V2 image
    
    Don't enable it yet as kernel needs to be updated first.
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 target/linux/bcm53xx/image/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 5bb3f0c..a87e1c2 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -250,6 +250,15 @@ define Device/tenda-ac9
 endef
 TARGET_DEVICES += tenda-ac9
 
+define Device/tplink-archer-c5-v2
+  DEVICE_TITLE := TP-LINK Archer C5 V2
+  DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
+  IMAGES := bin
+  IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
+  TPLINK_BOARD := ARCHER-C5-V2
+endef
+# TARGET_DEVICES += tplink-archer-c5-v2
+
 define Device/tplink-archer-c9-v1
   DEVICE_TITLE := TP-LINK Archer C9 V1
   DEVICE_PACKAGES := $(USB3_PACKAGES)


From lede-commits at lists.infradead.org  Thu Apr 20 14:18:48 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 17:18:48 -0400
Subject: [source]  bcm53xx: parepare for building more Linksys images
In-Reply-To: <20170420211846.31094.70865@git-01.infra.lede-project.org>
References: <20170420211846.31094.70865@git-01.infra.lede-project.org>
Message-ID: <mailman.25302.1492723281.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/3ff31f8a7822aad352d2714cafce7db9ea15541d

commit 3ff31f8a7822aad352d2714cafce7db9ea15541d
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Sun Mar 12 16:24:13 2017 +0100

    bcm53xx: parepare for building more Linksys images
    
    We still can't enable them by default without proper TRX support.
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 target/linux/bcm53xx/image/Makefile | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index a87e1c2..86156dc 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -88,6 +88,7 @@ DEVICE_VARS += PRODUCTID SIGNATURE NETGEAR_BOARD_ID NETGEAR_REGION TPLINK_BOARD
 
 BRCMFMAC_43602A1 := kmod-brcmfmac brcmfmac-firmware-43602a1-pcie
 BRCMFMAC_4366B1 := kmod-brcmfmac brcmfmac-firmware-4366b1-pcie
+BRCMFMAC_4366C0 := kmod-brcmfmac
 USB2_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-phy-bcm-ns-usb2
 USB2_PACKAGES += kmod-usb-ledtrig-usbport
 USB3_PACKAGES := $(USB2_PACKAGES) kmod-usb3 kmod-phy-bcm-ns-usb3
@@ -173,13 +174,27 @@ define Device/dlink-dir-885l
 endef
 TARGET_DEVICES += dlink-dir-885l
 
+# Linksys devices are disabled due to problem with 2 TRX partitions
+
 define Device/linksys-ea6300-v1
   DEVICE_TITLE := Linksys EA6300 V1
   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
 endef
-# Disabled due to problems with 2 TRX partitions
 # TARGET_DEVICES += linksys-ea6300-v1
 
+define Device/linksys-ea9200
+  DEVICE_TITLE := Linksys EA9200 V1
+  DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
+endef
+# TARGET_DEVICES += linksys-ea9200
+
+define Device/linksys-ea9500
+  DEVICE_TITLE := Linksys EA9500
+  DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
+  DEVICE_DTS := bcm47094-linksys-panamera
+endef
+# TARGET_DEVICES += linksys-ea9500
+
 define Device/netgear
   IMAGES := chk
   IMAGE/chk := append-ubi | trx-nand | netgear-chk


From lede-commits at lists.infradead.org  Thu Apr 20 14:18:49 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 17:18:49 -0400
Subject: [source]  bcm53xx: backport BCM5301X patches
In-Reply-To: <20170420211846.31094.70865@git-01.infra.lede-project.org>
References: <20170420211846.31094.70865@git-01.infra.lede-project.org>
Message-ID: <mailman.25305.1492723289.26984.lede-commits@lists.infradead.org>

rmilecki pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/9437fbb7ab2c979b5b464c031d50a243706799ab

commit 9437fbb7ab2c979b5b464c031d50a243706799ab
Author: Rafa? Mi?ecki <rafal at milecki.pl>
AuthorDate: Sat Mar 18 18:31:36 2017 +0100

    bcm53xx: backport BCM5301X patches
    
    This fixes GIC interrupts (required before switching to 4.9), adds few
    new entires & introduces DTS for Archer C5.
    
    Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ...53573-Don-t-use-nonexistent-default-off-L.patch |  50 ++
 ...5301X-Don-t-use-nonexistent-default-off-L.patch | 651 +++++++++++++++++++++
 ...-BCM5301X-Correct-GIC_PPI-interrupt-flags.patch |  41 ++
 ...ARM-dts-BCM5301X-Add-TWD-WD-Support-to-DT.patch |  40 ++
 ...RM-dts-BCM5301X-Add-I2C-support-to-the-DT.patch |  34 ++
 ...5301X-Add-support-for-TP-LINK-Archer-C5-V.patch | 130 ++++
 ...-ARM-dts-BCM953012HR-Add-ethernet-aliases.patch |  27 +
 ...301-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch |   2 +-
 ...-Add-power-button-for-Buffalo-WZR-1750DHP.patch |   2 +-
 9 files changed, 975 insertions(+), 2 deletions(-)

diff --git a/target/linux/bcm53xx/patches-4.4/047-0011-ARM-dts-BCM53573-Don-t-use-nonexistent-default-off-L.patch b/target/linux/bcm53xx/patches-4.4/047-0011-ARM-dts-BCM53573-Don-t-use-nonexistent-default-off-L.patch
new file mode 100644
index 0000000..ce74ff3
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0011-ARM-dts-BCM53573-Don-t-use-nonexistent-default-off-L.patch
@@ -0,0 +1,50 @@
+From 820a3e952b266d4355e89ed91c9b11945030321e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 8 Mar 2017 07:41:04 +0100
+Subject: [PATCH] ARM: dts: BCM53573: Don't use nonexistent "default-off" LED
+ trigger
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Such a trigger doesn't exist in Linux and is not needed as LED is being
+turned off by default. This could cause errors in LEDs core code when
+trying to set default trigger.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Acked-by: Pavel Machek <pavel at ucw.cz>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm47189-tenda-ac9.dts | 4 ----
+ 1 file changed, 4 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts
++++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts
+@@ -26,19 +26,16 @@
+ 		usb {
+ 			label = "bcm53xx:blue:usb";
+ 			gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wps {
+ 			label = "bcm53xx:blue:wps";
+ 			gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz {
+ 			label = "bcm53xx:blue:5ghz";
+ 			gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		system {
+@@ -54,7 +51,6 @@
+ 		2ghz {
+ 			label = "bcm53xx:blue:2ghz";
+ 			gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
diff --git a/target/linux/bcm53xx/patches-4.4/047-0012-ARM-dts-BCM5301X-Don-t-use-nonexistent-default-off-L.patch b/target/linux/bcm53xx/patches-4.4/047-0012-ARM-dts-BCM5301X-Don-t-use-nonexistent-default-off-L.patch
new file mode 100644
index 0000000..cecae0b
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0012-ARM-dts-BCM5301X-Don-t-use-nonexistent-default-off-L.patch
@@ -0,0 +1,651 @@
+From 0b660259e927177dc0c6eb3b1c39f23c6a011c5f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Wed, 8 Mar 2017 07:41:05 +0100
+Subject: [PATCH] ARM: dts: BCM5301X: Don't use nonexistent "default-off" LED
+ trigger
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Such a trigger doesn't exist in Linux and is not needed as LED is being
+turned off by default. This could cause errors in LEDs core code when
+trying to set default trigger.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts        |  5 -----
+ arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts        |  2 --
+ arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts  |  5 -----
+ arch/arm/boot/dts/bcm4708-netgear-r6250.dts        |  3 ---
+ arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts     |  3 ---
+ arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts      | 10 ----------
+ arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts        |  2 --
+ arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts |  4 ----
+ arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts        |  2 --
+ arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts  |  8 --------
+ arch/arm/boot/dts/bcm4709-netgear-r7000.dts        |  7 -------
+ arch/arm/boot/dts/bcm4709-netgear-r8000.dts        |  9 ---------
+ arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts  |  8 --------
+ arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts      |  6 ------
+ arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts      |  8 --------
+ arch/arm/boot/dts/bcm47094-netgear-r8500.dts       |  6 ------
+ 16 files changed, 88 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts
++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts
+@@ -41,19 +41,16 @@
+ 		usb3 {
+ 			label = "bcm53xx:blue:usb3";
+ 			gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan {
+ 			label = "bcm53xx:blue:wan";
+ 			gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		lan {
+ 			label = "bcm53xx:blue:lan";
+ 			gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power {
+@@ -71,14 +68,12 @@
+ 		2ghz {
+ 			label = "bcm53xx:blue:2ghz";
+ 			gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 
+ 		usb2 {
+ 			label = "bcm53xx:blue:usb2";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts
++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts
+@@ -41,7 +41,6 @@
+ 		usb2 {
+ 			label = "bcm53xx:blue:usb2";
+ 			gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power {
+@@ -59,7 +58,6 @@
+ 		usb3 {
+ 			label = "bcm53xx:blue:usb3";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
+@@ -52,13 +52,11 @@
+ 		usb {
+ 			label = "bcm53xx:blue:usb";
+ 			gpios = <&hc595 0 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power0 {
+ 			label = "bcm53xx:red:power";
+ 			gpios = <&hc595 1 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power1 {
+@@ -76,7 +74,6 @@
+ 		router1 {
+ 			label = "bcm53xx:amber:router";
+ 			gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan {
+@@ -88,13 +85,11 @@
+ 		wireless0 {
+ 			label = "bcm53xx:blue:wireless";
+ 			gpios = <&hc595 6 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless1 {
+ 			label = "bcm53xx:amber:wireless";
+ 			gpios = <&hc595 7 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
+@@ -43,19 +43,16 @@
+ 		power1 {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb {
+ 			label = "bcm53xx:blue:usb";
+ 			gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless {
+ 			label = "bcm53xx:blue:wireless";
+ 			gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts
++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts
+@@ -47,7 +47,6 @@
+ 		power0 {
+ 			label = "bcm53xx:green:power";
+ 			gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power1 {
+@@ -59,13 +58,11 @@
+ 		usb {
+ 			label = "bcm53xx:blue:usb";
+ 			gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless {
+ 			label = "bcm53xx:blue:wireless";
+ 			gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
+@@ -37,61 +37,51 @@
+ 		power-amber {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 2 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb2 {
+ 			label = "bcm53xx:white:usb2";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3-white {
+ 			label = "bcm53xx:white:usb3";
+ 			gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3-green {
+ 			label = "bcm53xx:green:usb3";
+ 			gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wps {
+ 			label = "bcm53xx:white:wps";
+ 			gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		status-red {
+ 			label = "bcm53xx:red:status";
+ 			gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		status-green {
+ 			label = "bcm53xx:green:status";
+ 			gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		status-blue {
+ 			label = "bcm53xx:blue:status";
+ 			gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-white {
+ 			label = "bcm53xx:white:wan";
+ 			gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-red {
+ 			label = "bcm53xx:red:wan";
+ 			gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts
++++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts
+@@ -47,7 +47,6 @@
+ 		usb2 {
+ 			label = "bcm53xx:blue:usb2";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan {
+@@ -65,7 +64,6 @@
+ 		usb3 {
+ 			label = "bcm53xx:blue:usb3";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts
++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts
+@@ -68,7 +68,6 @@
+ 		power1 {
+ 			label = "bcm53xx:red:power";
+ 			gpios = <&hc595 2 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		router0 {
+@@ -80,7 +79,6 @@
+ 		router1 {
+ 			label = "bcm53xx:amber:router";
+ 			gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan {
+@@ -92,13 +90,11 @@
+ 		wireless0 {
+ 			label = "bcm53xx:green:wireless";
+ 			gpios = <&hc595 6 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless1 {
+ 			label = "bcm53xx:amber:wireless";
+ 			gpios = <&hc595 7 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts
++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts
+@@ -41,7 +41,6 @@
+ 		wps {
+ 			label = "bcm53xx:blue:wps";
+ 			gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power {
+@@ -53,7 +52,6 @@
+ 		wan {
+ 			label = "bcm53xx:red:wan";
+ 			gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts
++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts
+@@ -31,13 +31,11 @@
+ 		usb {
+ 			label = "bcm53xx:green:usb";
+ 			gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power-amber {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power-white {
+@@ -49,37 +47,31 @@
+ 		router-amber {
+ 			label = "bcm53xx:amber:router";
+ 			gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		router-white {
+ 			label = "bcm53xx:white:router";
+ 			gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-amber {
+ 			label = "bcm53xx:amber:wan";
+ 			gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-white {
+ 			label = "bcm53xx:white:wan";
+ 			gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless-amber {
+ 			label = "bcm53xx:amber:wireless";
+ 			gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless-white {
+ 			label = "bcm53xx:white:wireless";
+ 			gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts
++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts
+@@ -47,43 +47,36 @@
+ 		power-amber {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz {
+ 			label = "bcm53xx:white:5ghz";
+ 			gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		2ghz {
+ 			label = "bcm53xx:white:2ghz";
+ 			gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wps {
+ 			label = "bcm53xx:white:wps";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless {
+ 			label = "bcm53xx:white:wireless";
+ 			gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3 {
+ 			label = "bcm53xx:white:usb3";
+ 			gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb2 {
+ 			label = "bcm53xx:white:usb2";
+ 			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts
++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts
+@@ -47,7 +47,6 @@
+ 		power-amber {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-white {
+@@ -59,49 +58,41 @@
+ 		wan-amber {
+ 			label = "bcm53xx:amber:wan";
+ 			gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz-1 {
+ 			label = "bcm53xx:white:5ghz-1";
+ 			gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		2ghz {
+ 			label = "bcm53xx:white:2ghz";
+ 			gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wireless {
+ 			label = "bcm53xx:white:wireless";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wps {
+ 			label = "bcm53xx:white:wps";
+ 			gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz-2 {
+ 			label = "bcm53xx:white:5ghz-2";
+ 			gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3 {
+ 			label = "bcm53xx:white:usb3";
+ 			gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb2 {
+ 			label = "bcm53xx:white:usb2";
+ 			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts
++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts
+@@ -26,49 +26,41 @@
+ 		lan {
+ 			label = "bcm53xx:blue:lan";
+ 			gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wps {
+ 			label = "bcm53xx:blue:wps";
+ 			gpios = <&chipcommon 2 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		2ghz {
+ 			label = "bcm53xx:blue:2ghz";
+ 			gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz {
+ 			label = "bcm53xx:blue:5ghz";
+ 			gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3 {
+ 			label = "bcm53xx:blue:usb3";
+ 			gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb2 {
+ 			label = "bcm53xx:blue:usb2";
+ 			gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-blue {
+ 			label = "bcm53xx:blue:wan";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-amber {
+ 			label = "bcm53xx:amber:wan";
+ 			gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power {
+--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts
++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts
+@@ -56,37 +56,31 @@
+ 		wan-white {
+ 			label = "bcm53xx:white:wan";
+ 			gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		power-amber {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan-amber {
+ 			label = "bcm53xx:amber:wan";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3-white {
+ 			label = "bcm53xx:white:usb3";
+ 			gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		2ghz {
+ 			label = "bcm53xx:white:2ghz";
+ 			gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz {
+ 			label = "bcm53xx:white:5ghz";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts
++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts
+@@ -34,37 +34,31 @@
+ 		lan3	{
+ 			label = "bcm53xx:green:lan3";
+ 			gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		lan4	{
+ 			label = "bcm53xx:green:lan4";
+ 			gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		wan	{
+ 			label = "bcm53xx:green:wan";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		lan1	{
+ 			label = "bcm53xx:green:lan1";
+ 			gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		lan2	{
+ 			label = "bcm53xx:green:lan2";
+ 			gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3	{
+ 			label = "bcm53xx:green:usb3";
+ 			gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		status	{
+@@ -76,13 +70,11 @@
+ 		2ghz {
+ 			label = "bcm53xx:green:2ghz";
+ 			gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz {
+ 			label = "bcm53xx:green:5ghz";
+ 			gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
+--- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts
++++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts
+@@ -34,37 +34,31 @@
+ 		power1 {
+ 			label = "bcm53xx:amber:power";
+ 			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz-1 {
+ 			label = "bcm53xx:white:5ghz-1";
+ 			gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		5ghz-2 {
+ 			label = "bcm53xx:white:5ghz-2";
+ 			gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		2ghz {
+ 			label = "bcm53xx:white:2ghz";
+ 			gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb2 {
+ 			label = "bcm53xx:white:usb2";
+ 			gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 
+ 		usb3 {
+ 			label = "bcm53xx:white:usb3";
+ 			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
+-			linux,default-trigger = "default-off";
+ 		};
+ 	};
+ 
diff --git a/target/linux/bcm53xx/patches-4.4/047-0013-ARM-dts-BCM5301X-Correct-GIC_PPI-interrupt-flags.patch b/target/linux/bcm53xx/patches-4.4/047-0013-ARM-dts-BCM5301X-Correct-GIC_PPI-interrupt-flags.patch
new file mode 100644
index 0000000..70df201
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0013-ARM-dts-BCM5301X-Correct-GIC_PPI-interrupt-flags.patch
@@ -0,0 +1,41 @@
+From 0e34079cd1f674449749aafe4be07336177de90d Mon Sep 17 00:00:00 2001
+From: Jon Mason <jon.mason at broadcom.com>
+Date: Thu, 2 Mar 2017 19:21:32 -0500
+Subject: [PATCH] ARM: dts: BCM5301X: Correct GIC_PPI interrupt flags
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GIC_PPI flags were misconfigured for the timers, resulting in errors
+like:
+[    0.000000] GIC: PPI11 is secure or misconfigured
+
+Changing them to being edge triggered corrects the issue
+
+Suggested-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Jon Mason <jon.mason at broadcom.com>
+Fixes: d27509f1 ("ARM: BCM5301X: add dts files for BCM4708 SoC")
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -66,14 +66,14 @@
+ 		timer at 20200 {
+ 			compatible = "arm,cortex-a9-global-timer";
+ 			reg = <0x20200 0x100>;
+-			interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
++			interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
+ 			clocks = <&periph_clk>;
+ 		};
+ 
+ 		local-timer at 20600 {
+ 			compatible = "arm,cortex-a9-twd-timer";
+ 			reg = <0x20600 0x100>;
+-			interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
++			interrupts = <GIC_PPI 13 IRQ_TYPE_EDGE_RISING>;
+ 			clocks = <&periph_clk>;
+ 		};
+ 
diff --git a/target/linux/bcm53xx/patches-4.4/047-0014-ARM-dts-BCM5301X-Add-TWD-WD-Support-to-DT.patch b/target/linux/bcm53xx/patches-4.4/047-0014-ARM-dts-BCM5301X-Add-TWD-WD-Support-to-DT.patch
new file mode 100644
index 0000000..b112cba
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0014-ARM-dts-BCM5301X-Add-TWD-WD-Support-to-DT.patch
@@ -0,0 +1,40 @@
+From f22c635e585471d01a38b829c0753c1467b5058e Mon Sep 17 00:00:00 2001
+From: Jon Mason <jonmason at broadcom.com>
+Date: Mon, 6 Mar 2017 11:24:44 -0500
+Subject: [PATCH] ARM: dts: BCM5301X: Add TWD WD Support to DT
+
+Add support for the ARM TWD Watchdog to the bcm5301x device tree.  The
+ARM TWD timer allocated the register space for the WDT, so this patch
+necessitated shrinking that.  Also, the GIC masks were added for these.
+
+Signed-off-by: Jon Mason <jonmason at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -70,10 +70,19 @@
+ 			clocks = <&periph_clk>;
+ 		};
+ 
+-		local-timer at 20600 {
++		timer at 20600 {
+ 			compatible = "arm,cortex-a9-twd-timer";
+-			reg = <0x20600 0x100>;
+-			interrupts = <GIC_PPI 13 IRQ_TYPE_EDGE_RISING>;
++			reg = <0x20600 0x20>;
++			interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) |
++						  IRQ_TYPE_EDGE_RISING)>;
++			clocks = <&periph_clk>;
++		};
++
++		watchdog at 20620 {
++			compatible = "arm,cortex-a9-twd-wdt";
++			reg = <0x20620 0x20>;
++			interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) |
++						  IRQ_TYPE_EDGE_RISING)>;
+ 			clocks = <&periph_clk>;
+ 		};
+ 
diff --git a/target/linux/bcm53xx/patches-4.4/047-0015-ARM-dts-BCM5301X-Add-I2C-support-to-the-DT.patch b/target/linux/bcm53xx/patches-4.4/047-0015-ARM-dts-BCM5301X-Add-I2C-support-to-the-DT.patch
new file mode 100644
index 0000000..d233e06
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0015-ARM-dts-BCM5301X-Add-I2C-support-to-the-DT.patch
@@ -0,0 +1,34 @@
+From bb097e3e00457bd69ad3a767f6b99424e2e06411 Mon Sep 17 00:00:00 2001
+From: Jon Mason <jonmason at broadcom.com>
+Date: Mon, 6 Mar 2017 11:24:45 -0500
+Subject: [PATCH] ARM: dts: BCM5301X: Add I2C support to the DT
+
+Add I2C support to the bcm5301x Device Tree.  Since no driver changes
+are needed to enable this hardware, only the device tree changes are
+required to make this functional.
+
+Signed-off-by: Jon Mason <jonmason at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -338,6 +338,16 @@
+ 		};
+ 	};
+ 
++	i2c0: i2c at 18009000 {
++		compatible = "brcm,iproc-i2c";
++		reg = <0x18009000 0x50>;
++		interrupts = <GIC_SPI 121 IRQ_TYPE_NONE>;
++		#address-cells = <1>;
++		#size-cells = <0>;
++		clock-frequency = <100000>;
++		status = "disabled";
++	};
++
+ 	lcpll0: lcpll0 at 1800c100 {
+ 		#clock-cells = <1>;
+ 		compatible = "brcm,nsp-lcpll0";
diff --git a/target/linux/bcm53xx/patches-4.4/047-0016-ARM-dts-BCM5301X-Add-support-for-TP-LINK-Archer-C5-V.patch b/target/linux/bcm53xx/patches-4.4/047-0016-ARM-dts-BCM5301X-Add-support-for-TP-LINK-Archer-C5-V.patch
new file mode 100644
index 0000000..db8fdb5
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0016-ARM-dts-BCM5301X-Add-support-for-TP-LINK-Archer-C5-V.patch
@@ -0,0 +1,130 @@
+From d6661da842bbeec2082b7263c9e682792e7951a9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Tue, 14 Mar 2017 11:39:41 +0100
+Subject: [PATCH] ARM: dts: BCM5301X: Add support for TP-LINK Archer C5 V2
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is BCM47081A0 based home router with BCM43217 and BCM4352 wireless
+chipsets.
+
+Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/Makefile                         |  1 +
+ arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts | 98 ++++++++++++++++++++++
+ 2 files changed, 99 insertions(+)
+ create mode 100644 arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts
+
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -76,6 +76,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
+ 	bcm47081-buffalo-wzr-900dhp.dtb \
+ 	bcm47081-luxul-xap-1410.dtb \
+ 	bcm47081-luxul-xwr-1200.dtb \
++	bcm47081-tplink-archer-c5-v2.dtb \
+ 	bcm4709-asus-rt-ac87u.dtb \
+ 	bcm4709-buffalo-wxr-1900dhp.dtb \
+ 	bcm4709-linksys-ea9200.dtb \
+--- /dev/null
++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts
+@@ -0,0 +1,98 @@
++/*
++ * Copyright (C) 2017 Rafa? Mi?ecki <rafal at milecki.pl>
++ *
++ * Licensed under the ISC license.
++ */
++
++/dts-v1/;
++
++#include "bcm47081.dtsi"
++
++/ {
++	compatible = "tplink,archer-c5-v2", "brcm,bcm47081", "brcm,bcm4708";
++	model = "TP-LINK Archer C5 V2";
++
++	chosen {
++		bootargs = "earlycon";
++	};
++
++	memory {
++		reg = <0x00000000 0x08000000>;
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		2ghz {
++			label = "bcm53xx:green:2ghz";
++			gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>;
++		};
++
++		lan {
++			label = "bcm53xx:green:lan";
++			gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>;
++		};
++
++		usb2-port1 {
++			label = "bcm53xx:green:usb2-port1";
++			gpios = <&chipcommon 2 GPIO_ACTIVE_HIGH>;
++		};
++
++		power {
++			label = "bcm53xx:green:power";
++			gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
++			linux,default-trigger = "default-on";
++		};
++
++		wan-green {
++			label = "bcm53xx:green:wan";
++			gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
++		};
++
++		wps {
++			label = "bcm53xx:green:wps";
++			gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>;
++		};
++
++		wan-amber {
++			label = "bcm53xx:amber:wan";
++			gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>;
++		};
++
++		5ghz {
++			label = "bcm53xx:green:5ghz";
++			gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>;
++		};
++
++		usb2-port2 {
++			label = "bcm53xx:green:usb2-port2";
++			gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>;
++		};
++	};
++
++	gpio-keys {
++		compatible = "gpio-keys";
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		rfkill {
++			label = "WiFi";
++			linux,code = <KEY_RFKILL>;
++			gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
++		};
++
++		restart {
++			label = "Reset";
++			linux,code = <KEY_RESTART>;
++			gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>;
++		};
++	};
++};
++
++&spi_nor {
++	status = "okay";
++};
++
++&usb2 {
++	vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>;
++};
diff --git a/target/linux/bcm53xx/patches-4.4/047-0017-ARM-dts-BCM953012HR-Add-ethernet-aliases.patch b/target/linux/bcm53xx/patches-4.4/047-0017-ARM-dts-BCM953012HR-Add-ethernet-aliases.patch
new file mode 100644
index 0000000..781af7a
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/047-0017-ARM-dts-BCM953012HR-Add-ethernet-aliases.patch
@@ -0,0 +1,27 @@
+From a7996761d1dacbac10c892c16faa90dfe46affcd Mon Sep 17 00:00:00 2001
+From: Steve Lin <steven.lin1 at broadcom.com>
+Date: Wed, 15 Mar 2017 16:59:35 -0400
+Subject: [PATCH] ARM: dts: BCM953012HR: Add ethernet aliases
+
+Adding ethernet aliases.  These are used, for example, by bootloaders,
+to modify the MAC addresses in the device tree.
+
+Signed-off-by: Steve Lin <steven.lin1 at broadcom.com>
+Acked-by: Jon Mason <jon.mason at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+---
+ arch/arm/boot/dts/bcm953012hr.dts | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm953012hr.dts
++++ b/arch/arm/boot/dts/bcm953012hr.dts
+@@ -41,6 +41,9 @@
+ 
+ 	aliases {
+ 		serial0 = &uart0;
++		ethernet0 = &gmac0;
++		ethernet1 = &gmac1;
++		ethernet2 = &gmac2;
+ 	};
+ 
+ 	chosen {
diff --git a/target/linux/bcm53xx/patches-4.4/301-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch b/target/linux/bcm53xx/patches-4.4/301-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch
index 859985c..c780e22 100644
--- a/target/linux/bcm53xx/patches-4.4/301-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch
+++ b/target/linux/bcm53xx/patches-4.4/301-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch
@@ -9,7 +9,7 @@ Signed-off-by: Rafa? Mi?ecki <zajec5 at gmail.com>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -80,6 +80,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
+@@ -81,6 +81,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
  	bcm4709-buffalo-wxr-1900dhp.dtb \
  	bcm4709-linksys-ea9200.dtb \
  	bcm4709-netgear-r7000.dtb \
diff --git a/target/linux/bcm53xx/patches-4.4/332-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch b/target/linux/bcm53xx/patches-4.4/332-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch
index e7262cb..425c420 100644
--- a/target/linux/bcm53xx/patches-4.4/332-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch
+++ b/target/linux/bcm53xx/patches-4.4/332-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch
@@ -5,7 +5,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 ---
 --- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
 +++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
-@@ -103,6 +103,12 @@
+@@ -98,6 +98,12 @@
  		#address-cells = <1>;
  		#size-cells = <0>;
  


From lede-commits at lists.infradead.org  Thu Apr 20 17:32:00 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 20:32:00 -0400
Subject: [source]  ramips: split Phicomm PSG1218 and PSG1218K2C
In-Reply-To: <20170421003200.32053.4373@git-01.infra.lede-project.org>
References: <20170421003200.32053.4373@git-01.infra.lede-project.org>
Message-ID: <mailman.25328.1492734742.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/c5a7dc49d11810838af9eafdddadf92a3b8218aa

commit c5a7dc49d11810838af9eafdddadf92a3b8218aa
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Fri Apr 21 00:53:03 2017 +0200

    ramips: split Phicomm PSG1218 and PSG1218K2C
    
    PSG1218 got only 4 Ethernet ports and WAN on port 3 while
    PSG1218K2C got 5 Ethernet ports and WAN on port 4
    Switch to use kmod-kt76x2 instead of kmod-mt76 for both devices while
    at it.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 target/linux/ramips/base-files/etc/board.d/01_leds |  3 +-
 .../linux/ramips/base-files/etc/board.d/02_network |  6 +-
 target/linux/ramips/base-files/etc/diag.sh         |  3 +-
 target/linux/ramips/base-files/lib/ramips.sh       |  3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |  1 +
 target/linux/ramips/dts/PSG1218.dts                | 83 +---------------------
 .../linux/ramips/dts/{PSG1218.dts => PSG1218.dtsi} | 45 ------------
 target/linux/ramips/dts/PSG1218K2C.dts             | 47 ++++++++++++
 target/linux/ramips/image/mt7620.mk                |  9 ++-
 9 files changed, 71 insertions(+), 129 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 4073d80..2c44a83 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -287,7 +287,8 @@ pbr-m1)
 psg1208)
 	set_wifi_led "$board:white:wlan2g"
 	;;
-psg1218)
+psg1218\|
+psg1218k2c)
 	ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0"
 	ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0"
 	;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 7bdebbe..b2966c2 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -95,7 +95,7 @@ ramips_setup_interfaces()
 	oy-0001|\
 	pbr-m1|\
 	psg1208|\
-	psg1218|\
+	psg1218k2c|\
 	r6220|\
 	sap-g3200u3|\
 	sk-wb8|\
@@ -115,6 +115,10 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6 at eth0"
 		;;
+	psg1218)
+		ucidef_add_switch "switch0" \
+			"0:lan:3" "1:lan:2" "2:lan:1" "3:wan" "6 at eth0"
+		;;
 	whr-300hp2|\
 	whr-600d|\
 	wsr-1166|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 3dbf87a..af18264 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -104,7 +104,8 @@ get_status_led() {
 	psg1208)
 		status_led="$board:white:wps"
 		;;
-	psg1218)
+	psg1218|\
+	psg1218k2c)
 		status_led="$board:yellow:status"
 		;;
 	cy-swr1100|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 786aecb..a75f520 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -400,6 +400,9 @@ ramips_board_detect() {
 	*"PSG1218")
 		name="psg1218"
 		;;
+	*"PSG1218K2C")
+		name="psg1218k2c"
+		;;
 	*"PSR-680W"*)
 		name="psr-680w"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 08fa45a..827109b 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -113,6 +113,7 @@ platform_check_image() {
 	pbr-m1|\
 	psg1208|\
 	psg1218|\
+	psg1218k2c|\
 	psr-680w|\
 	px-4885|\
 	rb750gr3|\
diff --git a/target/linux/ramips/dts/PSG1218.dts b/target/linux/ramips/dts/PSG1218.dts
index 1e53dce..0492d65 100644
--- a/target/linux/ramips/dts/PSG1218.dts
+++ b/target/linux/ramips/dts/PSG1218.dts
@@ -1,8 +1,6 @@
 /dts-v1/;
 
-#include "mt7620a.dtsi"
-
-#include <dt-bindings/input/input.h>
+#include "PSG1218.dtsi"
 
 / {
 	compatible = "PSG1218", "ralink,mt7620a-soc";
@@ -10,7 +8,6 @@
 
 	gpio-leds {
 		compatible = "gpio-leds";
-
 		blue {
 			label = "psg1218:blue:status";
 			gpios = <&gpio0 10 1>;
@@ -23,59 +20,7 @@
 
 		red {
 			label = "psg1218:red:status";
-			gpios = <&gpio0 8 0>;
-		};
-	};
-
-	gpio-keys-polled {
-		compatible = "gpio-keys-polled";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		poll-interval = <20>;
-
-		reset {
-			label = "reset";
-			gpios = <&gpio0 1 1>;
-			linux,code = <KEY_RESTART>;
-		};
-	};
-};
-
-&gpio0 {
-	status = "okay";
-};
-
-&spi0 {
-	status = "okay";
-
-	m25p80 at 0 {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "jedec,spi-nor";
-		reg = <0>;
-		spi-max-frequency = <10000000>;
-
-		partition at 0 {
-			label = "u-boot";
-			reg = <0x0 0x30000>;
-			read-only;
-		};
-
-		partition at 20000 {
-			label = "u-boot-env";
-			reg = <0x30000 0x10000>;
-			read-only;
-		};
-
-		factory: partition at 30000 {
-			label = "factory";
-			reg = <0x40000 0x10000>;
-			read-only;
-		};
-
-		partition at 40000 {
-			label = "firmware";
-			reg = <0x50000 0x7b0000>;
+				gpios = <&gpio0 8 0>;
 		};
 	};
 };
@@ -83,14 +28,9 @@
 &pinctrl {
 	state_default: pinctrl0 {
 		gpio {
-			ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd";
+			ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd", "pa";
 			ralink,function = "gpio";
 		};
-
-		pa {
-			ralink,group = "pa";
-			ralink,function = "pa";
-		};
 	};
 };
 
@@ -100,20 +40,3 @@
 	mtd-mac-address = <&factory 0x28>;
 	mediatek,portmap = "llllw";
 };
-
-&pcie {
-	status = "okay";
-
-	pcie-bridge {
-		mt76 at 0,0 {
-			reg = <0x0000 0 0 0 0>;
-			device_type = "pci";
-			mediatek,mtd-eeprom = <&factory 0x8000>;
-			ieee80211-freq-limit = <5000000 6000000>;
-		};
-	};
-};
-
-&wmac {
-	ralink,mtd-eeprom = <&factory 0>;
-};
diff --git a/target/linux/ramips/dts/PSG1218.dts b/target/linux/ramips/dts/PSG1218.dtsi
similarity index 60%
copy from target/linux/ramips/dts/PSG1218.dts
copy to target/linux/ramips/dts/PSG1218.dtsi
index 1e53dce..b3b5894 100644
--- a/target/linux/ramips/dts/PSG1218.dts
+++ b/target/linux/ramips/dts/PSG1218.dtsi
@@ -1,32 +1,8 @@
-/dts-v1/;
-
 #include "mt7620a.dtsi"
 
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "PSG1218", "ralink,mt7620a-soc";
-	model = "Phicomm PSG1218";
-
-	gpio-leds {
-		compatible = "gpio-leds";
-
-		blue {
-			label = "psg1218:blue:status";
-			gpios = <&gpio0 10 1>;
-		};
-
-		yellow {
-			label = "psg1218:yellow:status";
-			gpios = <&gpio0 11 1>;
-		};
-
-		red {
-			label = "psg1218:red:status";
-			gpios = <&gpio0 8 0>;
-		};
-	};
-
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
@@ -80,27 +56,6 @@
 	};
 };
 
-&pinctrl {
-	state_default: pinctrl0 {
-		gpio {
-			ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd";
-			ralink,function = "gpio";
-		};
-
-		pa {
-			ralink,group = "pa";
-			ralink,function = "pa";
-		};
-	};
-};
-
-&ethernet {
-	pinctrl-names = "default";
-	pinctrl-0 = <&ephy_pins>;
-	mtd-mac-address = <&factory 0x28>;
-	mediatek,portmap = "llllw";
-};
-
 &pcie {
 	status = "okay";
 
diff --git a/target/linux/ramips/dts/PSG1218K2C.dts b/target/linux/ramips/dts/PSG1218K2C.dts
new file mode 100644
index 0000000..d8105b9
--- /dev/null
+++ b/target/linux/ramips/dts/PSG1218K2C.dts
@@ -0,0 +1,47 @@
+/dts-v1/;
+
+#include "PSG1218.dtsi"
+
+/ {
+	compatible = "PSG1218K2C", "ralink,mt7620a-soc";
+	model = "Phicomm PSG1218K2C";
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		blue {
+			label = "psg1218k2c:blue:status";
+			gpios = <&gpio0 10 1>;
+		};
+
+		yellow {
+			label = "psg1218k2c:yellow:status";
+			gpios = <&gpio0 11 1>;
+		};
+
+		red {
+			label = "psg1218k2c:red:status";
+				gpios = <&gpio0 8 0>;
+		};
+	};
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd";
+			ralink,function = "gpio";
+		};
+
+		pa {
+			ralink,group = "pa";
+			ralink,function = "pa";
+		};
+	};
+};
+
+&ethernet {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ephy_pins>;
+	mtd-mac-address = <&factory 0x28>;
+	mediatek,portmap = "llllw";
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 016e5ac..63d5a7c 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -325,10 +325,17 @@ TARGET_DEVICES += psg1208
 define Device/psg1218
   DTS := PSG1218
   DEVICE_TITLE := Phicomm PSG1218
-  DEVICE_PACKAGES := kmod-mt76
+  DEVICE_PACKAGES := kmod-mt76x2
 endef
 TARGET_DEVICES += psg1218
 
+define Device/psg1218k2c
+  DTS := PSG1218K2C
+  DEVICE_TITLE := Phicomm PSG1218K2C
+  DEVICE_PACKAGES := kmod-mt76x2
+endef
+TARGET_DEVICES += psg1218k2c
+
 define Device/rp-n53
   DTS := RP-N53
   DEVICE_TITLE := Asus RP-N53


From lede-commits at lists.infradead.org  Thu Apr 20 17:56:21 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 20 Apr 2017 20:56:21 -0400
Subject: [source]  ramips: rename PSG1218 to match label
In-Reply-To: <20170421005621.4164.35858@git-01.infra.lede-project.org>
References: <20170421005621.4164.35858@git-01.infra.lede-project.org>
Message-ID: <mailman.25329.1492736203.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/c6fe325587b1955f84c339a2ae17da28dc4e6bec

commit c6fe325587b1955f84c339a2ae17da28dc4e6bec
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Fri Apr 21 02:47:44 2017 +0200

    ramips: rename PSG1218 to match label
    
    Fix previous commit to be less ambigous:
    PSG1218 rev.A = 5 ports, external PA, heatsinks
    PSG1218 rev.B = 4 ports, internal PA, no heatsinks
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 target/linux/ramips/base-files/etc/board.d/01_leds       |  4 ++--
 target/linux/ramips/base-files/etc/board.d/02_network    |  4 ++--
 target/linux/ramips/base-files/etc/diag.sh               |  4 ++--
 target/linux/ramips/base-files/lib/ramips.sh             |  8 ++++----
 target/linux/ramips/base-files/lib/upgrade/platform.sh   |  4 ++--
 target/linux/ramips/dts/{PSG1218K2C.dts => PSG1218A.dts} | 10 +++++-----
 target/linux/ramips/dts/{PSG1218.dts => PSG1218B.dts}    | 10 +++++-----
 target/linux/ramips/image/mt7620.mk                      | 16 ++++++++--------
 8 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 2c44a83..3ca390f 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -287,8 +287,8 @@ pbr-m1)
 psg1208)
 	set_wifi_led "$board:white:wlan2g"
 	;;
-psg1218\|
-psg1218k2c)
+psg1218a\|
+psg1218b)
 	ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0"
 	ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0"
 	;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index b2966c2..a4da5ee 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -95,7 +95,7 @@ ramips_setup_interfaces()
 	oy-0001|\
 	pbr-m1|\
 	psg1208|\
-	psg1218k2c|\
+	psg1218a|\
 	r6220|\
 	sap-g3200u3|\
 	sk-wb8|\
@@ -115,7 +115,7 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6 at eth0"
 		;;
-	psg1218)
+	psg1218b)
 		ucidef_add_switch "switch0" \
 			"0:lan:3" "1:lan:2" "2:lan:1" "3:wan" "6 at eth0"
 		;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index af18264..3624efd 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -104,8 +104,8 @@ get_status_led() {
 	psg1208)
 		status_led="$board:white:wps"
 		;;
-	psg1218|\
-	psg1218k2c)
+	psg1218a|\
+	psg1218b)
 		status_led="$board:yellow:status"
 		;;
 	cy-swr1100|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index a75f520..7630166 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -397,11 +397,11 @@ ramips_board_detect() {
 	*"PSG1208")
 		name="psg1208"
 		;;
-	*"PSG1218")
-		name="psg1218"
+	*"PSG1218 rev.A")
+		name="psg1218a"
 		;;
-	*"PSG1218K2C")
-		name="psg1218k2c"
+	*"PSG1218 rev.B")
+		name="psg1218b"
 		;;
 	*"PSR-680W"*)
 		name="psr-680w"
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 827109b..d0dd28e 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -112,8 +112,8 @@ platform_check_image() {
 	pbr-d1|\
 	pbr-m1|\
 	psg1208|\
-	psg1218|\
-	psg1218k2c|\
+	psg1218a|\
+	psg1218b|\
 	psr-680w|\
 	px-4885|\
 	rb750gr3|\
diff --git a/target/linux/ramips/dts/PSG1218K2C.dts b/target/linux/ramips/dts/PSG1218A.dts
similarity index 74%
rename from target/linux/ramips/dts/PSG1218K2C.dts
rename to target/linux/ramips/dts/PSG1218A.dts
index d8105b9..e85ef70 100644
--- a/target/linux/ramips/dts/PSG1218K2C.dts
+++ b/target/linux/ramips/dts/PSG1218A.dts
@@ -3,23 +3,23 @@
 #include "PSG1218.dtsi"
 
 / {
-	compatible = "PSG1218K2C", "ralink,mt7620a-soc";
-	model = "Phicomm PSG1218K2C";
+	compatible = "PSG1218A", "ralink,mt7620a-soc";
+	model = "Phicomm PSG1218 rev.A";
 
 	gpio-leds {
 		compatible = "gpio-leds";
 		blue {
-			label = "psg1218k2c:blue:status";
+			label = "psg1218a:blue:status";
 			gpios = <&gpio0 10 1>;
 		};
 
 		yellow {
-			label = "psg1218k2c:yellow:status";
+			label = "psg1218a:yellow:status";
 			gpios = <&gpio0 11 1>;
 		};
 
 		red {
-			label = "psg1218k2c:red:status";
+			label = "psg1218a:red:status";
 				gpios = <&gpio0 8 0>;
 		};
 	};
diff --git a/target/linux/ramips/dts/PSG1218.dts b/target/linux/ramips/dts/PSG1218B.dts
similarity index 73%
rename from target/linux/ramips/dts/PSG1218.dts
rename to target/linux/ramips/dts/PSG1218B.dts
index 0492d65..38ceb95 100644
--- a/target/linux/ramips/dts/PSG1218.dts
+++ b/target/linux/ramips/dts/PSG1218B.dts
@@ -3,23 +3,23 @@
 #include "PSG1218.dtsi"
 
 / {
-	compatible = "PSG1218", "ralink,mt7620a-soc";
-	model = "Phicomm PSG1218";
+	compatible = "PSG1218B", "ralink,mt7620a-soc";
+	model = "Phicomm PSG1218 rev.B";
 
 	gpio-leds {
 		compatible = "gpio-leds";
 		blue {
-			label = "psg1218:blue:status";
+			label = "psg1218b:blue:status";
 			gpios = <&gpio0 10 1>;
 		};
 
 		yellow {
-			label = "psg1218:yellow:status";
+			label = "psg1218b:yellow:status";
 			gpios = <&gpio0 11 1>;
 		};
 
 		red {
-			label = "psg1218:red:status";
+			label = "psg1218b:red:status";
 				gpios = <&gpio0 8 0>;
 		};
 	};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 63d5a7c..fcecb7a 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -322,19 +322,19 @@ define Device/psg1208
 endef
 TARGET_DEVICES += psg1208
 
-define Device/psg1218
-  DTS := PSG1218
-  DEVICE_TITLE := Phicomm PSG1218
+define Device/psg1218a
+  DTS := PSG1218A
+  DEVICE_TITLE := Phicomm PSG1218 rev.Ax
   DEVICE_PACKAGES := kmod-mt76x2
 endef
-TARGET_DEVICES += psg1218
+TARGET_DEVICES += psg1218a
 
-define Device/psg1218k2c
-  DTS := PSG1218K2C
-  DEVICE_TITLE := Phicomm PSG1218K2C
+define Device/psg1218b
+  DTS := PSG1218B
+  DEVICE_TITLE := Phicomm PSG1218 rev.Bx
   DEVICE_PACKAGES := kmod-mt76x2
 endef
-TARGET_DEVICES += psg1218k2c
+TARGET_DEVICES += psg1218b
 
 define Device/rp-n53
   DTS := RP-N53


From lede-commits at lists.infradead.org  Thu Apr 20 22:53:03 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 01:53:03 -0400
Subject: [source]  lantiq: improve DGN3500 LED definitions
In-Reply-To: <20170421055301.26714.9942@git-01.infra.lede-project.org>
References: <20170421055301.26714.9942@git-01.infra.lede-project.org>
Message-ID: <mailman.25350.1492754004.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/e1d433b293ae12037947d8e168f8080534fa3d37

commit e1d433b293ae12037947d8e168f8080534fa3d37
Author: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
AuthorDate: Mon Apr 17 16:06:40 2017 +0100

    lantiq: improve DGN3500 LED definitions
    
    Add red:internet led on gpio 30 previously claimed as missing.
    Wifi led was claimed as blue however there are no blue leds on the
    board at all.  Actually there are two wifi leds, green & amber so add
    definitions for those.  Make the newly discovered green wifi led gpio
    14 the default.
    
    There is no amber power led on this board. The mention of the amber
    power led in the manual means power red and power green at the same
    time.
    
    Signed-off-by: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
    [removed unnecessary aliases, add migration script]
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../base-files/etc/uci-defaults/01_led_migration   | 54 ++++++++++++++++++++++
 target/linux/lantiq/dts/DGN3500.dtsi               | 20 ++++----
 2 files changed, 65 insertions(+), 9 deletions(-)

diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration b/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration
new file mode 100644
index 0000000..130694a
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+LED_OPTIONS_CHANGED=0
+
+. /lib/functions.sh
+
+do_led_update_sysfs()
+{
+	local cfg=$1; shift
+	local tuples="$@"
+	local sysfs
+	local name
+
+	config_get sysfs $cfg sysfs
+	config_get name $cfg name
+
+	[ -z "$sysfs" ] && return
+
+	for tuple in $tuples; do
+		local old=${tuple%=*}
+		local new=${tuple#*=}
+		local new_sysfs
+
+		new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/")
+
+		[ "$new_sysfs" = "$sysfs" ] && continue
+
+		uci set system.${cfg}.sysfs="${new_sysfs}"
+		LED_OPTIONS_CHANGED=1
+
+		logger -t led-migration "sysfs option of LED \"${name}\" updated to ${new_sysfs}"
+	done;
+}
+
+migrate_leds()
+{
+	config_load system
+	config_foreach do_led_update_sysfs led "$@"
+}
+
+case "$(board_name)" in
+DGN3500*)
+	migrate_leds "dgn3500:blue:wireless=dgn3500:green:wireless"
+	;;
+*)
+	;;
+esac
+
+[ "$LED_OPTIONS_CHANGED" = "1" ] && uci commit system
+
+exit 0
diff --git a/target/linux/lantiq/dts/DGN3500.dtsi b/target/linux/lantiq/dts/DGN3500.dtsi
index e155577..890b49f 100644
--- a/target/linux/lantiq/dts/DGN3500.dtsi
+++ b/target/linux/lantiq/dts/DGN3500.dtsi
@@ -15,7 +15,7 @@
 		led-dsl = &dsl;
 		led-internet = &internet;
 		led-usb = &usb;
-		led-wifi = &wifi;
+		led-wifi = &wifi_green;
 	};
 
 	memory at 0 {
@@ -106,9 +106,10 @@
 			label = "dgn3500:green:internet";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
-		/*
-			internet red is missing
-		*/
+		internet2 {
+			label = "dgn3500:red:internet";
+			gpios = <&gpio 30 GPIO_ACTIVE_LOW>;
+		};
 		dsl: dsl {
 			label = "dgn3500:green:dsl";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
@@ -126,11 +127,12 @@
 			label = "dgn3500:red:power";
 			gpios = <&gpio 39 GPIO_ACTIVE_LOW>;
 		};
-		/*
-			power amber is missing
-		*/
-		wifi: wifi {
-			label = "dgn3500:blue:wireless";
+		wifi_green: wifi {
+			label = "dgn3500:green:wireless";
+			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+		};
+		wifi2 {
+			label = "dgn3500:amber:wireless";
 			gpios = <&gpio 51 GPIO_ACTIVE_LOW>;
 		};
 		wps {


From lede-commits at lists.infradead.org  Thu Apr 20 22:53:01 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 01:53:01 -0400
Subject: [source]  ramips: add former used board names to metadata
In-Reply-To: <20170421055301.26714.9942@git-01.infra.lede-project.org>
References: <20170421055301.26714.9942@git-01.infra.lede-project.org>
Message-ID: <mailman.25351.1492754004.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/9e468f7829eb6bfeff2a3671b04e53003a709313

commit 9e468f7829eb6bfeff2a3671b04e53003a709313
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Apr 1 12:27:46 2017 +0200

    ramips: add former used board names to metadata
    
    We need to keep the former used (unmodified) boardname in the metadata.
    Otherwise an upgrade from an board using the old boardname will be
    refused.
    
    Fixes: a75ce960ac1b ("ramips: use different board names for variants")
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/image/mt7620.mk | 2 ++
 target/linux/ramips/image/rt305x.mk | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index fcecb7a..dd88d50 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -418,6 +418,7 @@ define Device/wt3020-4M
   BLOCKSIZE := 4k
   IMAGE_SIZE := $(ralink_default_fw_size_4M)
   IMAGES += factory.bin
+  SUPPORTED_DEVICES += wt3020
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
 	poray-header -B WT3020 -F 4M
   DEVICE_TITLE := Nexx WT3020 (4MB)
@@ -427,6 +428,7 @@ TARGET_DEVICES += wt3020-4M
 define Device/wt3020-8M
   DTS := WT3020-8M
   IMAGES += factory.bin
+  SUPPORTED_DEVICES += wt3020
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
 	poray-header -B WT3020 -F 8M
   DEVICE_TITLE := Nexx WT3020 (8MB)
diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk
index 55c47e3..69533ce 100644
--- a/target/linux/ramips/image/rt305x.mk
+++ b/target/linux/ramips/image/rt305x.mk
@@ -111,6 +111,7 @@ TARGET_DEVICES += all5003
 define Device/asl26555-8M
   DTS := ASL26555-8M
   IMAGE_SIZE := 7744k
+  SUPPORTED_DEVICES += asl26555
   DEVICE_TITLE := Alpha ASL26555 
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport
 endef
@@ -119,6 +120,7 @@ TARGET_DEVICES += asl26555-8M
 define Device/asl26555-16M
   DTS := ASL26555-16M
   IMAGE_SIZE := 15872k
+  SUPPORTED_DEVICES += asl26555
   DEVICE_TITLE := Alpha ASL26555 16M
   DEVICE_PACKAGES :=
 endef
@@ -538,6 +540,7 @@ TARGET_DEVICES += ncs601w
 define Device/nixcore-x1-8M
   DTS := NIXCORE-8M
   IMAGE_SIZE := 7872k
+  SUPPORTED_DEVICES += nixcore-x1
   DEVICE_TITLE := NixcoreX1 (8M)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-i2c-core kmod-i2c-ralink kmod-spi-dev
 endef
@@ -546,6 +549,7 @@ TARGET_DEVICES += nixcore-x1-8M
 define Device/nixcore-x1-16M
   DTS := NIXCORE-16M
   IMAGE_SIZE := 16064k
+  SUPPORTED_DEVICES += nixcore-x1
   DEVICE_TITLE := NixcoreX1 (16M)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-i2c-core kmod-i2c-ralink kmod-spi-dev
 endef
@@ -679,6 +683,7 @@ TARGET_DEVICES += v22rw-2x2
 define Device/vocore-8M
   DTS := VOCORE-8M
   IMAGE_SIZE := 7872k
+  SUPPORTED_DEVICES += vocore
   DEVICE_TITLE := VoCore (8M)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 \
 		kmod-i2c-core kmod-i2c-ralink \
@@ -689,6 +694,7 @@ TARGET_DEVICES += vocore-8M
 define Device/vocore-16M
   DTS := VOCORE-16M
   IMAGE_SIZE := 16064k
+  SUPPORTED_DEVICES += vocore
   DEVICE_TITLE := VoCore (16M)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 \
 		kmod-i2c-core kmod-i2c-ralink \


From lede-commits at lists.infradead.org  Thu Apr 20 22:53:02 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 01:53:02 -0400
Subject: [source]  ramips: dont replace the board name
In-Reply-To: <20170421055301.26714.9942@git-01.infra.lede-project.org>
References: <20170421055301.26714.9942@git-01.infra.lede-project.org>
Message-ID: <mailman.25352.1492754006.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/18618695aedf8cf593ca5bb5a5a0b4c97e53dd2f

commit 18618695aedf8cf593ca5bb5a5a0b4c97e53dd2f
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Apr 8 00:34:48 2017 +0200

    ramips: dont replace the board name
    
    Use fixed led names and add each board variant instead of manipulating
    the board name.
    
    It makes the ramips board name function less different to the one used
    in other targets and allows to merge them with a common function.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 package/boot/uboot-envtools/files/ramips           |  3 +-
 target/linux/ramips/base-files/etc/board.d/01_leds | 42 ++++++++++++----------
 .../linux/ramips/base-files/etc/board.d/02_network | 24 ++++++++-----
 target/linux/ramips/base-files/etc/diag.sh         | 32 +++++++++++++----
 target/linux/ramips/base-files/lib/ramips.sh       |  2 +-
 .../ramips/base-files/lib/upgrade/platform.sh      | 30 ++++++++++------
 6 files changed, 88 insertions(+), 45 deletions(-)

diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 3216b30..9ce8c30 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -15,7 +15,8 @@ board=$(ramips_board_name)
 
 case "$board" in
 all0239-3g|\
-all0256n|\
+all0256n-4M|\
+all0256n-8M|\
 all5002)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
 	;;
diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 3ca390f..213f2ed 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -56,11 +56,12 @@ air3gii)
 	set_wifi_led "$board:green:wlan"
 	set_usb_led "$board:green:mobile"
 	;;
-all0256n)
+all0256n-4M|\
+all0256n-8M)
 	ucidef_set_rssimon "wlan0" "200000" "1"
-	ucidef_set_led_rssi "rssilow" "RSSILOW" "$board:green:rssilow" "wlan0" "1" "40" "0" "6"
-	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$board:green:rssimed" "wlan0" "30" "80" "-29" "5"
-	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$board:green:rssihigh" "wlan0" "70" "100" "-69" "8"
+	ucidef_set_led_rssi "rssilow" "RSSILOW" "all0256n:green:rssilow" "wlan0" "1" "40" "0" "6"
+	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "all0256n:green:rssimed" "wlan0" "30" "80" "-29" "5"
+	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "all0256n:green:rssihigh" "wlan0" "70" "100" "-69" "8"
 	set_wifi_led "rt2800pci-phy0::radio"
 	;;
 ar670w|\
@@ -68,11 +69,12 @@ ar725w|\
 awapn2403)
 	set_wifi_led "rt2800soc-phy0::radio"
 	;;
-asl26555)
-	ucidef_set_led_default "power" "POWER" "$board:green:power" "1"
-	ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0"
-	set_wifi_led "$board:green:wlan"
-	set_usb_led "$board:green:3g"
+asl26555-8M|\
+asl26555-16M)
+	ucidef_set_led_default "power" "POWER" "asl26555:green:power" "1"
+	ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0"
+	set_wifi_led "asl26555:green:wlan"
+	set_usb_led "asl26555:green:3g"
 	;;
 bc2)
 	set_usb_led "$board:blue:usb"
@@ -139,7 +141,8 @@ hlk-rm04|\
 sl-r7205|\
 v11st-fe|\
 w306r-v20|\
-wt1520)
+wt1520-4M|\
+wt1520-8M)
 	set_wifi_led "rt2800pci-phy0::radio"
 	;;
 dir-615-d|\
@@ -292,9 +295,10 @@ psg1218b)
 	ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0"
 	ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0"
 	;;
-px-4885)
-	set_wifi_led "$board:orange:wifi"
-	set_usb_led "$board:blue:storage"
+px-4885-4M|\
+px-4885-8M)
+	set_wifi_led "px-4885:orange:wifi"
+	set_usb_led "px-4885:blue:storage"
 	;;
 r6220)
 	ucidef_set_led_netdev "wan" "wan" "$board:green:wan" eth0.2
@@ -324,9 +328,10 @@ tiny-ac)
 	set_wifi_led "$board:orange:wifi"
 	set_usb_led "$board:green:usb"
 	;;
-vocore)
-	ucidef_set_led_netdev "eth" "ETH" "$board:orange:eth" "eth0"
-	set_wifi_led "$board:green:status"
+vocore-8M|\
+vocore-16M)
+	ucidef_set_led_netdev "eth" "ETH" "vocore:orange:eth" "eth0"
+	set_wifi_led "vocore:green:status"
 	;;
 vocore2)
 	set_wifi_led "$board:fuchsia:status"
@@ -357,8 +362,9 @@ wrh-300cr)
 wndr3700v5)
 	ucidef_set_led_default "power" "POWER" "$board:green:power" "0"
 	;;
-wt3020)
-	ucidef_set_led_default "power" "power" "$board:blue:power" "0"
+wt3020-4M|\
+wt3020-8M)
+	ucidef_set_led_default "power" "power" "wt3020:blue:power" "0"
 	;;
 y1)
 	set_usb_led "$board:blue:usb"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index a4da5ee..99c3ad6 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -41,7 +41,8 @@ ramips_setup_interfaces()
 	3g150b|\
 	3g300m|\
 	a5-v11|\
-	all0256n|\
+	all0256n-4M|\
+	all0256n-8M|\
 	all5002|\
 	all5003|\
 	broadway|\
@@ -91,7 +92,8 @@ ramips_setup_interfaces()
 	mt7628|\
 	mzk-750dhp|\
 	mzk-w300nh2|\
-	nixcore|\
+	nixcore-x1-8M|\
+	nixcore-x1-16M|\
 	oy-0001|\
 	pbr-m1|\
 	psg1208|\
@@ -104,7 +106,8 @@ ramips_setup_interfaces()
 	witi|\
 	wl-wn575a3|\
 	wndr3700v5|\
-	wt1520|\
+	wt1520-4M|\
+	wt1520-8M|\
 	y1|\
 	youku-yk1|\
 	zbt-ape522ii|\
@@ -133,13 +136,15 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5 at eth0"
 		;;
-	asl26555|\
+	asl26555-8M|\
+	asl26555-16M|\
 	rp-n53)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"
 		;;
 	atp-52b|\
-	awm002-evb|\
+	awm002-evb-4M|\
+	awm002-evb-8M|\
 	awm003-evb|\
 	c20i|\
 	c50|\
@@ -161,7 +166,8 @@ ramips_setup_interfaces()
 	wrtnode|\
 	wrtnode2p | \
 	wrtnode2r | \
-	wt3020|\
+	wt3020-4M|\
+	wt3020-8M|\
 	zbt-wa05)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6 at eth0"
@@ -241,7 +247,8 @@ ramips_setup_interfaces()
 		ucidef_set_interface_wan "usb0"
 		;;
 	mzk-dp150n|\
-	vocore)
+	vocore-8M|\
+	vocore-16M)
 		ucidef_add_switch "switch0" \
 			"0:lan" "4:lan" "6t at eth0"
 		;;
@@ -382,7 +389,8 @@ ramips_setup_macs()
 		lan_mac=$(macaddr_setbit_la "$wan_mac")
 		;;
 	m3|\
-	m4|\
+	m4-4M|\
+	m4-8M|\
 	x5|\
 	x8)
 		lan_mac=$(cat /sys/class/net/eth0/address)
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 3624efd..e5b4b59 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -16,7 +16,6 @@ get_status_led() {
 	3g-6200n|\
 	ar670w|\
 	ar725w|\
-	asl26555|\
 	br-6425|\
 	br-6475nd|\
 	c50|\
@@ -79,7 +78,6 @@ get_status_led() {
 	mofi3500-3gn|\
 	rut5xx|\
 	v11st-fe|\
-	vocore|\
 	wmr-300|\
 	zbt-wg2626|\
 	zbt-wg3526)
@@ -89,6 +87,10 @@ get_status_led() {
 	ht-tm02)
 		status_led="$board:blue:wlan"
 		;;
+	asl26555-8M|\
+	asl26555-16M)
+		status_led="asl26555:green:power"
+		;;
 	atp-52b|\
 	ew1200|\
 	ip2202)
@@ -123,7 +125,6 @@ get_status_led() {
 	wl-330n|\
 	wl-330n3g|\
 	wli-tx4-ag300n|\
-	wt3020|\
 	y1|\
 	y1s)
 		status_led="$board:blue:power"
@@ -162,10 +163,13 @@ get_status_led() {
 		status_led="$board:blue:wifi"
 		;;
 	m3|\
-	m4|\
 	miwifi-nano)
 		status_led="$board:blue:status"
 		;;
+	m4-4M|\
+	m4-8M)
+		status_led="m4:blue:status"
+		;;
 	miwifi-mini|\
 	zte-q7)
 		status_led="$board:red:status"
@@ -194,7 +198,10 @@ get_status_led() {
 	psr-680w)
 		status_led="$board:red:wan"
 		;;
-	px-4885|\
+	px-4885-4M|\
+	px-4885-8M)
+		status_led="px-4885:orange:wifi"
+		;;
 	re6500|\
 	whr-1166d|\
 	whr-600d|\
@@ -207,8 +214,7 @@ get_status_led() {
 	tew-692gr|\
 	ur-326n4g|\
 	ur-336un|\
-	wf-2881|\
-	wr512-3gn)
+	wf-2881)
 		status_led="$board:green:wps"
 		;;
 	rb750gr3)
@@ -220,6 +226,10 @@ get_status_led() {
 	v22rw-2x2)
 		status_led="$board:green:security"
 		;;
+	vocore-8M|\
+	vocore-16M)
+		status_led="vocore:green:status"
+		;;
 	vocore2)
 		status_led="$board:fuchsia:status"
 		;;
@@ -249,11 +259,19 @@ get_status_led() {
 	wizfi630a)
 		status_led="$board::run"
 		;;
+	wr512-3gn-4M|\
+	wr512-3gn-8M)
+		status_led="wr512-3gn:green:wps"
+		;;
 	wrtnode2r | \
 	wrtnode2p | \
 	wrtnode)
 		status_led="wrtnode:blue:indicator"
 		;;
+	wt3020-4M|\
+	wt3020-8M)
+		status_led="wt3020:blue:power"
+		;;
 	zbt-cpe102)
 		status_led="$board:green:4g-0"
 		;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 7630166..eec9612 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -696,5 +696,5 @@ ramips_board_name() {
 	[ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
 	[ -z "$name" ] && name="unknown"
 
-	echo "${name%-[0-9]*M}"
+	echo "${name}"
 }
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index d0dd28e..036e19a 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -21,13 +21,16 @@ platform_check_image() {
 	ai-br100|\
 	air3gii|\
 	all0239-3g|\
-	all0256n|\
+	all0256n-4M|\
+	all0256n-8M|\
 	all5002|\
 	all5003|\
 	ar725w|\
-	asl26555|\
+	asl26555-8M|\
+	asl26555-16M|\
 	awapn2403|\
-	awm002-evb|\
+	awm002-evb-4M|\
+	awm002-evb-8M|\
 	awm003-evb|\
 	bc2|\
 	broadway|\
@@ -81,7 +84,8 @@ platform_check_image() {
 	linkits7688d|\
 	m2m|\
 	m3|\
-	m4|\
+	m4-4M|\
+	m4-8M|\
 	mac1200rv2|\
 	microwrt|\
 	miniembplug|\
@@ -104,7 +108,8 @@ platform_check_image() {
 	nbg-419n|\
 	nbg-419n2|\
 	newifi-d1|\
-	nixcore|\
+	nixcore-x1-8M|\
+	nixcore-x1-16M|\
 	nw718|\
 	omega2|\
 	omega2p|\
@@ -115,7 +120,8 @@ platform_check_image() {
 	psg1218a|\
 	psg1218b|\
 	psr-680w|\
-	px-4885|\
+	px-4885-4M|\
+	px-4885-8M|\
 	rb750gr3|\
 	re6500|\
 	rp-n53|\
@@ -139,7 +145,8 @@ platform_check_image() {
 	ur-326n4g|\
 	ur-336un|\
 	v22rw-2x2|\
-	vocore|\
+	vocore-8M|\
+	vocore-16M|\
 	vocore2|\
 	vr500|\
 	w150m|\
@@ -165,15 +172,18 @@ platform_check_image() {
 	wn3000rpv3|\
 	wnce2001|\
 	wndr3700v5|\
-	wr512-3gn|\
+	wr512-3gn-4M|\
+	wr512-3gn-8M|\
 	wr6202|\
 	wrh-300cr|\
 	wrtnode|\
 	wrtnode2r |\
 	wrtnode2p |\
 	wsr-600|\
-	wt1520|\
-	wt3020|\
+	wt1520-4M|\
+	wt1520-8M|\
+	wt3020-4M|\
+	wt3020-8M|\
 	wzr-agl300nh|\
 	x5|\
 	x8|\


From lede-commits at lists.infradead.org  Fri Apr 21 03:24:35 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 06:24:35 -0400
Subject: [source]  busybox: Move libresolv detection to LEDE Makefile
In-Reply-To: <20170421102435.16550.91811@git-01.infra.lede-project.org>
References: <20170421102435.16550.91811@git-01.infra.lede-project.org>
Message-ID: <mailman.25386.1492770297.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/449880e0ffe528999c17f6ad6e4f87f1f4c46cdd

commit 449880e0ffe528999c17f6ad6e4f87f1f4c46cdd
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Wed Apr 12 09:02:30 2017 -0700

    busybox: Move libresolv detection to LEDE Makefile
    
    Since the LEDE nslookup applet is already specific to LEDE, move the
    libresolv detection into the busybox Makefile that LEDE uses.
    
    This fixes builds with external toolchains that don't automatically
    search for headers and/or libraries without being told so.
    
    Fixes: de5b8e5d2fe1 ("busybox: add musl compatible nslookup replacement")
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 package/utils/busybox/Makefile                         |  6 ++++++
 .../utils/busybox/patches/230-add_nslookup_lede.patch  | 18 ------------------
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index c1e60ea..fdac78f 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -85,6 +85,12 @@ ifdef CONFIG_BUSYBOX_CONFIG_PAM
   LDLIBS += pam pam_misc pthread
 endif
 
+ifdef CONFIG_BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+  ifeq ($(CONFIG_USE_GLIBC),y)
+	LDLIBS += resolv
+  endif
+endif
+
 define Build/Compile
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
 		CC="$(TARGET_CC)" \
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index bff88a6..9e89837 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -12,28 +12,10 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- Makefile.flags             |   6 +
  networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 875 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
-diff --git a/Makefile.flags b/Makefile.flags
-index 65021de..096ab77 100644
---- a/Makefile.flags
-+++ b/Makefile.flags
-@@ -134,6 +134,12 @@ else
- LDLIBS += m
- endif
- 
-+# nslookup_lede might need the resolv library
-+RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
-+ifeq ($(RESOLV_AVAILABLE),y)
-+LDLIBS += resolv
-+endif
-+
- # libpam may use libpthread, libdl and/or libaudit.
- # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
- # However, on *other platforms* it fails when some of those flags
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
 index 0000000..fe927ad


From lede-commits at lists.infradead.org  Fri Apr 21 04:20:34 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 07:20:34 -0400
Subject: [source] busybox: fix build of nslookup_lede applet without IPv6
 (#728)
In-Reply-To: <20170421112034.29862.10161@git-01.infra.lede-project.org>
References: <20170421112034.29862.10161@git-01.infra.lede-project.org>
Message-ID: <mailman.25390.1492773658.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/8ed5c6d3b1ee9f938b60e4f4e7bcbcdec52a8fba

commit 8ed5c6d3b1ee9f938b60e4f4e7bcbcdec52a8fba
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Fri Apr 21 13:18:16 2017 +0200

    busybox: fix build of nslookup_lede applet without IPv6 (#728)
    
    Protect any IPv6 related with appropriate guards to fix compilation with
    disabled IPv6 support in Busybox.
    
    Fixes #728.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 .../busybox/patches/230-add_nslookup_lede.patch    | 42 +++++++++++++++++-----
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index 9e89837..51034e6 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -1,4 +1,4 @@
-From 8c1440a0934dd8b3ad6aae48d6653b5ba6fce8a1 Mon Sep 17 00:00:00 2001
+From 2285cd400a10b1bde5472fe1cec3311300ee943c Mon Sep 17 00:00:00 2001
 From: Jo-Philipp Wich <jo at mein.io>
 Date: Tue, 14 Mar 2017 22:21:34 +0100
 Subject: [PATCH] networking: add LEDE nslookup applet
@@ -12,16 +12,16 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 875 insertions(+)
+ networking/nslookup_lede.c | 893 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 893 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
-index 0000000..fe927ad
+index 000000000..6f1f86502
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,869 @@
+@@ -0,0 +1,893 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -109,7 +109,9 @@ index 0000000..fe927ad
 +	{ ns_t_soa,   "SOA"   },
 +	{ ns_t_ns,    "NS"    },
 +	{ ns_t_a,     "A"     },
++#if ENABLE_FEATURE_IPV6
 +	{ ns_t_aaaa,  "AAAA"  },
++#endif
 +	{ ns_t_cname, "CNAME" },
 +	{ ns_t_mx,    "MX"    },
 +	{ ns_t_txt,   "TXT"   },
@@ -176,6 +178,7 @@ index 0000000..fe927ad
 +			printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
 +			break;
 +
++#if ENABLE_FEATURE_IPV6
 +		case ns_t_aaaa:
 +			if (rdlen != 16) {
 +				//fprintf(stderr, "Unexpected AAAA record length\n");
@@ -184,6 +187,7 @@ index 0000000..fe927ad
 +			inet_ntop(AF_INET6, ns_rr_rdata(rr), astr, sizeof(astr));
 +			printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
 +			break;
++#endif
 +
 +		case ns_t_ns:
 +			if (!format)
@@ -326,6 +330,7 @@ index 0000000..fe927ad
 +		}
 +	}
 +
++#if ENABLE_FEATURE_IPV6
 +	if (inet_pton(AF_INET6, addrstr, &lsa->u.sin6.sin6_addr)) {
 +		lsa->u.sin6.sin6_family = AF_INET6;
 +		lsa->u.sin6.sin6_port = htons(port);
@@ -333,6 +338,7 @@ index 0000000..fe927ad
 +		lsa->len = sizeof(lsa->u.sin6);
 +		return 0;
 +	}
++#endif
 +
 +	if (!scope && inet_pton(AF_INET, addrstr, &lsa->u.sin.sin_addr)) {
 +		lsa->u.sin.sin_family = AF_INET;
@@ -387,6 +393,7 @@ index 0000000..fe927ad
 +	return (unsigned long)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
 +}
 +
++#if ENABLE_FEATURE_IPV6
 +static void to_v4_mapped(len_and_sockaddr *a)
 +{
 +	if (a->u.sa.sa_family != AF_INET)
@@ -403,6 +410,7 @@ index 0000000..fe927ad
 +	a->u.sin6.sin6_scope_id = 0;
 +	a->len = sizeof(a->u.sin6);
 +}
++#endif
 +
 +
 +/*
@@ -414,7 +422,9 @@ index 0000000..fe927ad
 +	int fd;
 +	int timeout = default_timeout * 1000, retry_interval, servfail_retry = 0;
 +	len_and_sockaddr from = { };
++#if ENABLE_FEATURE_IPV6
 +	int one = 1;
++#endif
 +	int recvlen = 0;
 +	int n_replies = 0;
 +	struct pollfd pfd;
@@ -424,6 +434,7 @@ index 0000000..fe927ad
 +	from.u.sa.sa_family = AF_INET;
 +	from.len = sizeof(from.u.sin);
 +
++#if ENABLE_FEATURE_IPV6
 +	for (nn = 0; nn < n_ns; nn++) {
 +		if (ns[nn].addr.u.sa.sa_family == AF_INET6) {
 +			from.u.sa.sa_family = AF_INET6;
@@ -431,15 +442,18 @@ index 0000000..fe927ad
 +			break;
 +		}
 +	}
++#endif
 +
 +	/* Get local address and open/bind a socket */
 +	fd = socket(from.u.sa.sa_family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
 +
++#if ENABLE_FEATURE_IPV6
 +	/* Handle case where system lacks IPv6 support */
 +	if (fd < 0 && from.u.sa.sa_family == AF_INET6 && errno == EAFNOSUPPORT) {
 +		fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
 +		from.u.sa.sa_family = AF_INET;
 +	}
++#endif
 +
 +	if (fd < 0)
 +		return -1;
@@ -449,6 +463,7 @@ index 0000000..fe927ad
 +		return -1;
 +	}
 +
++#if ENABLE_FEATURE_IPV6
 +	/* Convert any IPv4 addresses in a mixed environment to v4-mapped */
 +	if (from.u.sa.sa_family == AF_INET6) {
 +		setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
@@ -456,6 +471,7 @@ index 0000000..fe927ad
 +		for (nn = 0; nn < n_ns; nn++)
 +			to_v4_mapped(&ns[nn].addr);
 +	}
++#endif
 +
 +	pfd.fd = fd;
 +	pfd.events = POLLIN;
@@ -585,7 +601,12 @@ index 0000000..fe927ad
 +			for (aip = ai; aip; aip = aip->ai_next) {
 +				if (aip->ai_addr->sa_family != AF_INET &&
 +				    aip->ai_addr->sa_family != AF_INET6)
-+				    continue;
++					continue;
++
++#if ! ENABLE_FEATURE_IPV6
++				if (aip->ai_addr->sa_family != AF_INET)
++					continue;
++#endif
 +
 +				tmp = realloc(*ns, sizeof(**ns) * (*n_ns + 1));
 +
@@ -685,6 +706,7 @@ index 0000000..fe927ad
 +	static char buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ + 1 + 5 + 1];
 +	char *p = buf;
 +
++#if ENABLE_FEATURE_IPV6
 +	if (a->u.sa.sa_family == AF_INET6) {
 +		inet_ntop(AF_INET6, &a->u.sin6.sin6_addr, buf, sizeof(buf));
 +		p += strlen(p);
@@ -696,12 +718,14 @@ index 0000000..fe927ad
 +			}
 +		}
 +	}
-+	else {
++	else
++#endif
++	{
 +		inet_ntop(AF_INET, &a->u.sin.sin_addr, buf, sizeof(buf));
 +		p += strlen(p);
 +	}
 +
-+	sprintf(p, "#%hu", ntohs(a->u.sin6.sin6_port));
++	sprintf(p, "#%hu", ntohs(a->u.sin.sin_port));
 +
 +	return buf;
 +}
@@ -892,5 +916,5 @@ index 0000000..fe927ad
 +	return rc;
 +}
 -- 
-2.1.4
+2.11.0
 


From lede-commits at lists.infradead.org  Fri Apr 21 04:20:47 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 07:20:47 -0400
Subject: [source] busybox: fix build of nslookup_lede applet without IPv6
 (#728)
In-Reply-To: <20170421112047.29985.92016@git-01.infra.lede-project.org>
References: <20170421112047.29985.92016@git-01.infra.lede-project.org>
Message-ID: <mailman.25391.1492773667.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/5feb4f0e6d9e686c9b2d3d406a7f348137baf0dc

commit 5feb4f0e6d9e686c9b2d3d406a7f348137baf0dc
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Fri Apr 21 13:18:16 2017 +0200

    busybox: fix build of nslookup_lede applet without IPv6 (#728)
    
    Protect any IPv6 related with appropriate guards to fix compilation with
    disabled IPv6 support in Busybox.
    
    Fixes #728.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 .../busybox/patches/230-add_nslookup_lede.patch    | 42 +++++++++++++++++-----
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index 9e89837..51034e6 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -1,4 +1,4 @@
-From 8c1440a0934dd8b3ad6aae48d6653b5ba6fce8a1 Mon Sep 17 00:00:00 2001
+From 2285cd400a10b1bde5472fe1cec3311300ee943c Mon Sep 17 00:00:00 2001
 From: Jo-Philipp Wich <jo at mein.io>
 Date: Tue, 14 Mar 2017 22:21:34 +0100
 Subject: [PATCH] networking: add LEDE nslookup applet
@@ -12,16 +12,16 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 875 insertions(+)
+ networking/nslookup_lede.c | 893 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 893 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
-index 0000000..fe927ad
+index 000000000..6f1f86502
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,869 @@
+@@ -0,0 +1,893 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -109,7 +109,9 @@ index 0000000..fe927ad
 +	{ ns_t_soa,   "SOA"   },
 +	{ ns_t_ns,    "NS"    },
 +	{ ns_t_a,     "A"     },
++#if ENABLE_FEATURE_IPV6
 +	{ ns_t_aaaa,  "AAAA"  },
++#endif
 +	{ ns_t_cname, "CNAME" },
 +	{ ns_t_mx,    "MX"    },
 +	{ ns_t_txt,   "TXT"   },
@@ -176,6 +178,7 @@ index 0000000..fe927ad
 +			printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
 +			break;
 +
++#if ENABLE_FEATURE_IPV6
 +		case ns_t_aaaa:
 +			if (rdlen != 16) {
 +				//fprintf(stderr, "Unexpected AAAA record length\n");
@@ -184,6 +187,7 @@ index 0000000..fe927ad
 +			inet_ntop(AF_INET6, ns_rr_rdata(rr), astr, sizeof(astr));
 +			printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
 +			break;
++#endif
 +
 +		case ns_t_ns:
 +			if (!format)
@@ -326,6 +330,7 @@ index 0000000..fe927ad
 +		}
 +	}
 +
++#if ENABLE_FEATURE_IPV6
 +	if (inet_pton(AF_INET6, addrstr, &lsa->u.sin6.sin6_addr)) {
 +		lsa->u.sin6.sin6_family = AF_INET6;
 +		lsa->u.sin6.sin6_port = htons(port);
@@ -333,6 +338,7 @@ index 0000000..fe927ad
 +		lsa->len = sizeof(lsa->u.sin6);
 +		return 0;
 +	}
++#endif
 +
 +	if (!scope && inet_pton(AF_INET, addrstr, &lsa->u.sin.sin_addr)) {
 +		lsa->u.sin.sin_family = AF_INET;
@@ -387,6 +393,7 @@ index 0000000..fe927ad
 +	return (unsigned long)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
 +}
 +
++#if ENABLE_FEATURE_IPV6
 +static void to_v4_mapped(len_and_sockaddr *a)
 +{
 +	if (a->u.sa.sa_family != AF_INET)
@@ -403,6 +410,7 @@ index 0000000..fe927ad
 +	a->u.sin6.sin6_scope_id = 0;
 +	a->len = sizeof(a->u.sin6);
 +}
++#endif
 +
 +
 +/*
@@ -414,7 +422,9 @@ index 0000000..fe927ad
 +	int fd;
 +	int timeout = default_timeout * 1000, retry_interval, servfail_retry = 0;
 +	len_and_sockaddr from = { };
++#if ENABLE_FEATURE_IPV6
 +	int one = 1;
++#endif
 +	int recvlen = 0;
 +	int n_replies = 0;
 +	struct pollfd pfd;
@@ -424,6 +434,7 @@ index 0000000..fe927ad
 +	from.u.sa.sa_family = AF_INET;
 +	from.len = sizeof(from.u.sin);
 +
++#if ENABLE_FEATURE_IPV6
 +	for (nn = 0; nn < n_ns; nn++) {
 +		if (ns[nn].addr.u.sa.sa_family == AF_INET6) {
 +			from.u.sa.sa_family = AF_INET6;
@@ -431,15 +442,18 @@ index 0000000..fe927ad
 +			break;
 +		}
 +	}
++#endif
 +
 +	/* Get local address and open/bind a socket */
 +	fd = socket(from.u.sa.sa_family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
 +
++#if ENABLE_FEATURE_IPV6
 +	/* Handle case where system lacks IPv6 support */
 +	if (fd < 0 && from.u.sa.sa_family == AF_INET6 && errno == EAFNOSUPPORT) {
 +		fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
 +		from.u.sa.sa_family = AF_INET;
 +	}
++#endif
 +
 +	if (fd < 0)
 +		return -1;
@@ -449,6 +463,7 @@ index 0000000..fe927ad
 +		return -1;
 +	}
 +
++#if ENABLE_FEATURE_IPV6
 +	/* Convert any IPv4 addresses in a mixed environment to v4-mapped */
 +	if (from.u.sa.sa_family == AF_INET6) {
 +		setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
@@ -456,6 +471,7 @@ index 0000000..fe927ad
 +		for (nn = 0; nn < n_ns; nn++)
 +			to_v4_mapped(&ns[nn].addr);
 +	}
++#endif
 +
 +	pfd.fd = fd;
 +	pfd.events = POLLIN;
@@ -585,7 +601,12 @@ index 0000000..fe927ad
 +			for (aip = ai; aip; aip = aip->ai_next) {
 +				if (aip->ai_addr->sa_family != AF_INET &&
 +				    aip->ai_addr->sa_family != AF_INET6)
-+				    continue;
++					continue;
++
++#if ! ENABLE_FEATURE_IPV6
++				if (aip->ai_addr->sa_family != AF_INET)
++					continue;
++#endif
 +
 +				tmp = realloc(*ns, sizeof(**ns) * (*n_ns + 1));
 +
@@ -685,6 +706,7 @@ index 0000000..fe927ad
 +	static char buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ + 1 + 5 + 1];
 +	char *p = buf;
 +
++#if ENABLE_FEATURE_IPV6
 +	if (a->u.sa.sa_family == AF_INET6) {
 +		inet_ntop(AF_INET6, &a->u.sin6.sin6_addr, buf, sizeof(buf));
 +		p += strlen(p);
@@ -696,12 +718,14 @@ index 0000000..fe927ad
 +			}
 +		}
 +	}
-+	else {
++	else
++#endif
++	{
 +		inet_ntop(AF_INET, &a->u.sin.sin_addr, buf, sizeof(buf));
 +		p += strlen(p);
 +	}
 +
-+	sprintf(p, "#%hu", ntohs(a->u.sin6.sin6_port));
++	sprintf(p, "#%hu", ntohs(a->u.sin.sin_port));
 +
 +	return buf;
 +}
@@ -892,5 +916,5 @@ index 0000000..fe927ad
 +	return rc;
 +}
 -- 
-2.1.4
+2.11.0
 


From lede-commits at lists.infradead.org  Fri Apr 21 05:53:00 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 21 Apr 2017 08:53:00 -0400
Subject: [source]  ramips: add former board names to PSG1218 variants
In-Reply-To: <20170421125300.16193.80197@git-01.infra.lede-project.org>
References: <20170421125300.16193.80197@git-01.infra.lede-project.org>
Message-ID: <mailman.25404.1492779203.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/f66e7cb30bcb7bc428a4613fce806fde83962c01

commit f66e7cb30bcb7bc428a4613fce806fde83962c01
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Fri Apr 21 14:51:58 2017 +0200

    ramips: add former board names to PSG1218 variants
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 target/linux/ramips/image/mt7620.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index dd88d50..83c9a7f 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -326,6 +326,7 @@ define Device/psg1218a
   DTS := PSG1218A
   DEVICE_TITLE := Phicomm PSG1218 rev.Ax
   DEVICE_PACKAGES := kmod-mt76x2
+  SUPPORTED_DEVICES += psg1218
 endef
 TARGET_DEVICES += psg1218a
 
@@ -333,6 +334,7 @@ define Device/psg1218b
   DTS := PSG1218B
   DEVICE_TITLE := Phicomm PSG1218 rev.Bx
   DEVICE_PACKAGES := kmod-mt76x2
+  SUPPORTED_DEVICES += psg1218
 endef
 TARGET_DEVICES += psg1218b
 


From lede-commits at lists.infradead.org  Sat Apr 22 03:43:59 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 06:43:59 -0400
Subject: [source]  openssl: Use mkhash for STAMP_CONFIGURED
In-Reply-To: <20170422104359.7768.18765@git-01.infra.lede-project.org>
References: <20170422104359.7768.18765@git-01.infra.lede-project.org>
Message-ID: <mailman.25524.1492857864.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/72fcdb6286ad7be24296acbd36043ee3e96e5ec4

commit 72fcdb6286ad7be24296acbd36043ee3e96e5ec4
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Wed Mar 1 10:48:32 2017 -0800

    openssl: Use mkhash for STAMP_CONFIGURED
    
    The current way of creating a STAMP_CONFIGURED filename for OpenSSL can
    lead to an extremely long filename that makes touch unable to create it,
    and fail the build.
    
    Use mkhash to produce a hash against OPENSSL_OPTIONS which creates a
    shortert stamp file,
    
    Fixes #572
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 package/libs/openssl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 9b64302..b39e3c6 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -168,7 +168,7 @@ else
   endif
 endif
 
-STAMP_CONFIGURED := $(STAMP_CONFIGURED)_$(subst $(space),_,$(OPENSSL_OPTIONS))
+STAMP_CONFIGURED := $(STAMP_CONFIGURED)_$(shell echo $(OPENSSL_OPTIONS) | mkhash md5)
 
 define Build/Configure
 	[ -f $(STAMP_CONFIGURED) ] || { \


From lede-commits at lists.infradead.org  Sat Apr 22 09:59:46 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 12:59:46 -0400
Subject: [source] ar71xx: fix minor syntax error in /lib/upgrade/platform.sh
In-Reply-To: <20170422165945.10603.58616@git-01.infra.lede-project.org>
References: <20170422165945.10603.58616@git-01.infra.lede-project.org>
Message-ID: <mailman.25538.1492880409.26984.lede-commits@lists.infradead.org>

neoraider pushed a commit to source.git, branch master:
https://git.lede-project.org/96414cb4072050ffc45c9907a2bfa1e40f088293

commit 96414cb4072050ffc45c9907a2bfa1e40f088293
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Sat Apr 22 18:56:25 2017 +0200

    ar71xx: fix minor syntax error in /lib/upgrade/platform.sh
    
    Fix a '==' that should be a '=' in a test condition. Busybox fortunately
    doesn't care.
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 27b0f8a..5be678e 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -111,7 +111,7 @@ tplink_pharos_check_image() {
 	# is accepted (loading the first 1.5M of a remote image for this check seems
 	# a bit extreme)
 	dd if="$1" bs=1 skip=1511432 count=1024 2>/dev/null | while read line; do
-		[ "$line" == "$model_string" ] && break
+		[ "$line" = "$model_string" ] && break
 	done || {
 		echo "Unsupported image (model not in support-list)"
 		return 1


From lede-commits at lists.infradead.org  Sat Apr 22 09:59:45 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 12:59:45 -0400
Subject: [source]  ramips: update DEVICE_PACKAGES for Ubiquiti EdgeRouter X
In-Reply-To: <20170422165945.10603.58616@git-01.infra.lede-project.org>
References: <20170422165945.10603.58616@git-01.infra.lede-project.org>
Message-ID: <mailman.25539.1492880409.26984.lede-commits@lists.infradead.org>

neoraider pushed a commit to source.git, branch master:
https://git.lede-project.org/411c1b64f0b8929ba80b026b9b5c2995c5478249

commit 411c1b64f0b8929ba80b026b9b5c2995c5478249
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Sat Apr 22 18:54:07 2017 +0200

    ramips: update DEVICE_PACKAGES for Ubiquiti EdgeRouter X
    
    Fixes removal of unneeded kernel modules with per-device rootfs.
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 target/linux/ramips/image/mt7621.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 8e4ac40..feda0f1 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -180,7 +180,7 @@ define Device/ubnt-erx
   KERNEL_INITRAMFS := $$(KERNEL) | ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
   IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
   DEVICE_TITLE := Ubiquiti EdgeRouter X
-  DEVICE_PACKAGES := -kmod-mt76 -kmod-rt2x00-lib -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo
+  DEVICE_PACKAGES := -kmod-mt76 -kmod-mt7603 -kmod-mt76x2 -kmod-mt76-core -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo
 endef
 TARGET_DEVICES += ubnt-erx
 


From lede-commits at lists.infradead.org  Sat Apr 22 10:02:05 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 13:02:05 -0400
Subject: [source] ar71xx: fix minor syntax error in /lib/upgrade/platform.sh
In-Reply-To: <20170422170204.11399.71249@git-01.infra.lede-project.org>
References: <20170422170204.11399.71249@git-01.infra.lede-project.org>
Message-ID: <mailman.25540.1492880547.26984.lede-commits@lists.infradead.org>

neoraider pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/1d1935b242e2a2e5d34b2342b90eb772857e90bb

commit 1d1935b242e2a2e5d34b2342b90eb772857e90bb
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Sat Apr 22 18:56:25 2017 +0200

    ar71xx: fix minor syntax error in /lib/upgrade/platform.sh
    
    Fix a '==' that should be a '=' in a test condition. Busybox fortunately
    doesn't care.
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 4f479ce..580e09a 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -111,7 +111,7 @@ tplink_pharos_check_image() {
 	# is accepted (loading the first 1.5M of a remote image for this check seems
 	# a bit extreme)
 	dd if="$1" bs=1 skip=1511432 count=1024 2>/dev/null | while read line; do
-		[ "$line" == "$model_string" ] && break
+		[ "$line" = "$model_string" ] && break
 	done || {
 		echo "Unsupported image (model not in support-list)"
 		return 1


From lede-commits at lists.infradead.org  Sat Apr 22 10:02:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 13:02:04 -0400
Subject: [source]  ramips: update DEVICE_PACKAGES for Ubiquiti EdgeRouter X
In-Reply-To: <20170422170204.11399.71249@git-01.infra.lede-project.org>
References: <20170422170204.11399.71249@git-01.infra.lede-project.org>
Message-ID: <mailman.25541.1492880551.26984.lede-commits@lists.infradead.org>

neoraider pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/9117ef8d6ae3bf4ae27a858bf9e2c2abc4434a04

commit 9117ef8d6ae3bf4ae27a858bf9e2c2abc4434a04
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Sat Apr 22 18:54:07 2017 +0200

    ramips: update DEVICE_PACKAGES for Ubiquiti EdgeRouter X
    
    Fixes removal of unneeded kernel modules with per-device rootfs.
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 target/linux/ramips/image/mt7621.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index fd28e19..15ea9a1 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -140,7 +140,7 @@ define Device/ubnt-erx
   KERNEL_INITRAMFS := $$(KERNEL) | ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
   IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
   DEVICE_TITLE := Ubiquiti EdgeRouter X
-  DEVICE_PACKAGES := -kmod-mt76 -kmod-rt2x00-lib -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo
+  DEVICE_PACKAGES := -kmod-mt76 -kmod-mt7603 -kmod-mt76x2 -kmod-mt76-core -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo
 endef
 TARGET_DEVICES += ubnt-erx
 


From lede-commits at lists.infradead.org  Sat Apr 22 12:34:15 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 15:34:15 -0400
Subject: [source] iptables: fix wrong depends for nftables support (FS#707)
In-Reply-To: <20170422193415.3881.5061@git-01.infra.lede-project.org>
References: <20170422193415.3881.5061@git-01.infra.lede-project.org>
Message-ID: <mailman.25543.1492889679.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/e80a0413487d957d939eb670393e73d955a77d87

commit e80a0413487d957d939eb670393e73d955a77d87
Author: Ansuel Smith <ansuelsmth at gmail.com>
AuthorDate: Sat Apr 22 19:57:09 2017 +0200

    iptables: fix wrong depends for nftables support (FS#707)
    
    The dep for the nftables support was wrong, if someone actually enable
    that option gain a compilation error. This fix this problem.
    
    Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
---
 package/network/utils/iptables/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index ae2377e..ca8b197 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -432,7 +432,7 @@ define Package/libxtables
  ABI_VERSION:=$(PKG_VERSION)
  DEPENDS:= \
 	+IPTABLES_CONNLABEL:libnetfilter-conntrack \
-	+IPTABLES_NFTABLES:libnfnetlink
+	+IPTABLES_NFTABLES:libnftnl
 endef
 
 TARGET_CPPFLAGS := \


From lede-commits at lists.infradead.org  Sat Apr 22 18:19:37 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 21:19:37 -0400
Subject: [source]  build: fix aarch64 default cpu selection
In-Reply-To: <20170423011937.26221.27365@git-01.infra.lede-project.org>
References: <20170423011937.26221.27365@git-01.infra.lede-project.org>
Message-ID: <mailman.25555.1492910539.26984.lede-commits@lists.infradead.org>

yousong pushed a commit to source.git, branch master:
https://git.lede-project.org/b889d1e3cf0233e6efbf4b55197ab64aa8c0cd6a

commit b889d1e3cf0233e6efbf4b55197ab64aa8c0cd6a
Author: Yousong Zhou <yszhou4tech at gmail.com>
AuthorDate: Wed Apr 19 17:34:18 2017 +0800

    build: fix aarch64 default cpu selection
    
    Not sure since when the issue emerged, but according to the current doc of gcc
    and as, armv8-a is intended as argument of -march
    
    The change will affect at the moment arm64 and layerscape/64b
    
    Below is the relevant error messages when building toolchain
    
        Assembler messages:
        Error: unknown cpu `armv8-a'
        Error: unrecognized option -mcpu=armv8-a
        /home/yousong/git-repo/lede-project/lede/build_dir/toolchain-aarch64_armv8-a_gcc-5.4.0_musl/gcc-5.4.0/libgcc/libgcc2.c:1:0: error: unknown value 'armv8-a' for -mcpu
    
    Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 include/target.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/target.mk b/include/target.mk
index 3523d04..646057c 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -208,8 +208,8 @@ ifeq ($(DUMP),1)
     CPU_CFLAGS_ultrasparc = -mcpu=ultrasparc
   endif
   ifeq ($(ARCH),aarch64)
-    CPU_TYPE ?= armv8-a
-    CPU_CFLAGS_armv8-a = -mcpu=armv8-a
+    CPU_TYPE ?= generic
+    CPU_CFLAGS_generic = -mcpu=generic
     CPU_CFLAGS_cortex-a53 = -mcpu=cortex-a53
   endif
   ifeq ($(ARCH),arc)


From lede-commits at lists.infradead.org  Sat Apr 22 18:19:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 21:19:39 -0400
Subject: [source]  scripts/qemustart: initial version
In-Reply-To: <20170423011937.26221.27365@git-01.infra.lede-project.org>
References: <20170423011937.26221.27365@git-01.infra.lede-project.org>
Message-ID: <mailman.25556.1492910540.26984.lede-commits@lists.infradead.org>

yousong pushed a commit to source.git, branch master:
https://git.lede-project.org/50fcfd4b654999a1cca71d593000e3775cf2d740

commit 50fcfd4b654999a1cca71d593000e3775cf2d740
Author: Yousong Zhou <yszhou4tech at gmail.com>
AuthorDate: Mon Apr 17 17:09:19 2017 +0800

    scripts/qemustart: initial version
    
    The script can be used to quickly spin up QEMU virtual machines with lan
    and wan network.  Please read the initial part of the script for
    instructions about how to configure host machine
    
    Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 scripts/qemustart | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 281 insertions(+)

diff --git a/scripts/qemustart b/scripts/qemustart
new file mode 100755
index 0000000..5cadd7d
--- /dev/null
+++ b/scripts/qemustart
@@ -0,0 +1,281 @@
+#!/usr/bin/env bash
+
+SELF="$0"
+
+# Linux bridge for connecting lan and wan network of guest machines
+BR_LAN="${BR_LAN:-br-lan}"
+BR_WAN="${BR_WAN:-br-wan}"
+
+# Host network interface providing internet access for guest machines
+IF_INET="${IF_INET:-eth0}"
+
+# qemu-bridge-helper does two things here
+#
+# - create tap interface
+# - add the tap interface to bridge
+#
+# as such it requires CAP_NET_ADMIN to do its job.  It will be convenient to
+# have it as a root setuid program.  Be aware of the security risks implied
+#
+# the helper has an acl list which defaults to deny all bridge.  we need to add
+# $BR_LAN and $BR_WAN to its allow list
+#
+#	# sudo vim /etc/qemu/bridge.conf
+#	allow br-lan
+#	allow br-wan
+#
+# Other allowed directives can be 'allow all', 'deny all', 'include xxx',  See
+# qemu-bridge-helper.c of qemu source code for details.
+#
+# The helper can be provided by package qemu-system-common on debian, or
+# qemu-kvm-common on rhel
+#
+HELPER="${HELPER:-/usr/libexec/qemu-bridge-helper}"
+
+### end of global settings
+
+__errmsg() {
+	echo "$*" >&2
+}
+
+do_setup() {
+	# setup bridge for LAN network
+	sudo ip link add dev "$BR_LAN" type bridge
+	sudo ip link set dev "$BR_LAN" up
+	sudo ip addr add 192.168.1.3/24 dev "$BR_LAN"
+
+	# setup bridge for WAN network
+	#
+	# minimal dnsmasq config for configuring guest wan network with dhcp
+	#
+	#	# sudo apt-get install dnsmasq
+	#	# sudo vi /etc/dnsmasq.conf
+	#	interface=br-wan
+	#	dhcp-range=192.168.7.50,192.168.7.150,255.255.255.0,30m
+	#
+	sudo ip link add dev "$BR_WAN" type bridge
+	sudo ip link set dev "$BR_WAN" up
+	sudo ip addr add 192.168.7.1/24 dev "$BR_WAN"
+
+	# guest internet access
+	sudo sysctl -w "net.ipv4.ip_forward=1"
+	sudo sysctl -w "net.ipv4.conf.$BR_WAN.proxy_arp=1"
+	while sudo iptables -t nat -D POSTROUTING -o "$IF_INET" -j MASQUERADE 2>/dev/null; do true; done
+	      sudo iptables -t nat -A POSTROUTING -o "$IF_INET" -j MASQUERADE
+}
+
+check_setup_() {
+	ip link show "$BR_LAN" >/dev/null || return 1
+	ip link show "$BR_WAN" >/dev/null || return 1
+	[ -x "$HELPER" ] || {
+		__errmsg "helper $HELPER is not an executable"
+		return 1
+	}
+}
+
+check_setup() {
+	check_setup_ || {
+		__errmsg "please check the script content to see the environment requirement"
+		return 1
+	}
+}
+#do_setup; check_setup; exit $?
+
+usage() {
+	cat >&2 <<EOF
+Usage: $SELF [-h|--help]
+       $SELF <target>
+         [<subtarget> [<extra-qemu-options>]]
+         [--kernel <kernel>]
+         [--rootfs <rootfs>]
+
+<subtarget> will default to "generic" and must be specified if
+<extra-qemu-options> are present
+
+e.g. <subtarget> for malta can be le, be, le64, be64, le-glibc, le64-glibc, etc
+
+<kernel>, <rootfs> can be required or optional arguments to qemu depending on
+the actual <target> in use.  They will default to files under bin/targets/
+
+Examples
+
+  $SELF x86 64
+  $SELF x86 64 -enable-kvm -device virtio-balloon-pci
+  $SELF x86 64 -incoming tcp:0:4444
+  $SELF x86 64-glibc
+  $SELF malta be -m 64
+  $SELF malta le64
+  $SELF malta be-glibc
+  $SELF armvirt 32 \\
+                --kernel bin/targets/armvirt/32/lede-armvirt-32-zImage \\
+                --rootfs bin/targets/armvirt/32/lede-armvirt-32-root.ext4
+EOF
+}
+
+rand_mac() {
+	hexdump -n 3 -e '"52:54:00:" 2/1 "%02x:" 1/1 "%02x"' /dev/urandom
+}
+
+parse_args() {
+	while [ "$#" -gt 0 ]; do
+		case "$1" in
+			--kernel) o_kernel="$2"; shift 2 ;;
+			--rootfs) o_rootfs="$2"; shift 2 ;;
+			--help|-h)
+				usage
+				exit 0
+				;;
+			*)
+				if [ -z "$o_target" ]; then
+					o_target="$1"
+				elif [ -z "$o_subtarget" ]; then
+					o_subtarget="$1"
+				else
+					o_qemu_extra=("${o_qemu_extra[@]}" "$1")
+				fi
+				shift
+				;;
+		esac
+	done
+
+	MAC_LAN="$(rand_mac)"
+	MAC_WAN="$(rand_mac)"
+	[ -n "$o_target" ] || {
+		usage
+		return 1
+	}
+	[ -n "$o_subtarget" ] || o_subtarget="generic"
+	o_bindir="bin/targets/$o_target/$o_subtarget"
+}
+
+start_qemu_armvirt() {
+	local kernel="$o_kernel"
+	local rootfs="$o_rootfs"
+	local cpu
+	local qemu_exe
+
+	case "${o_subtarget%-*}" in
+		32)
+			qemu_exe="qemu-system-arm"
+			cpu="cortex-a15"
+			[ -n "$kernel" ] || kernel="$o_bindir/lede-$o_target-${o_subtarget%-*}-zImage-initramfs"
+			;;
+		64)
+			qemu_exe="qemu-system-aarch64"
+			cpu="cortex-a57"
+			[ -n "$kernel" ] || kernel="$o_bindir/lede-$o_target-${o_subtarget%-*}-Image-initramfs"
+			;;
+		*)
+			__errmsg "target $o_target: unknown subtarget $o_subtarget"
+			return 1
+			;;
+	esac
+	[ -z "$rootfs" ] || {
+		if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
+			gunzip "$rootfs.gz"
+		fi
+		o_qemu_extra=( \
+			"-drive" "file=$rootfs,format=raw,if=virtio" \
+			"-append" "root=/dev/vda rootwait" \
+			"${o_qemu_extra[@]}" \
+		 )
+	}
+
+	"$qemu_exe" -machine virt -cpu "$cpu" -nographic \
+		-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \
+		-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \
+		-kernel "$kernel" \
+		"${o_qemu_extra[@]}"
+}
+
+start_qemu_malta() {
+	local is64
+	local isel
+	local qemu_exe
+	local kernel="$o_kernel"
+
+	# o_subtarget can be le, be, le64, be64, le-glibc, le64-glibc, etc..
+	is64="$(echo $o_subtarget | grep -o 64)"
+	[ "$(echo "$o_subtarget" | grep -o '^..')" = "le" ] && isel="el"
+	qemu_exe="qemu-system-mips$is64$isel"
+
+	[ -n "$kernel" ] || kernel="$o_bindir/lede-malta-${o_subtarget%-*}-vmlinux-initramfs.elf"
+
+	# NOTE: order of wan, lan -device arguments matters as it will affect which
+	# one will be actually used as the wan, lan network interface inside the
+	# guest machine
+	"$qemu_exe" -machine malta -nographic \
+		-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \
+		-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" \
+		-kernel "$kernel" \
+		"${o_qemu_extra[@]}"
+}
+
+start_qemu_x86() {
+	local rootfs="$o_rootfs"
+	local qemu_exe
+
+	[ -n "$rootfs" ] || {
+		rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-ext4.img"
+		if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
+			gunzip "$rootfs.gz"
+		fi
+	}
+	#
+	# generic: 32-bit, pentium4 (CONFIG_MPENTIUM4), kvm guest, virtio
+	# legacy: 32-bit, i486 (CONFIG_M486)
+	# 64: 64-bit, kvm guest, virtio
+	#
+	case "${o_subtarget%-*}" in
+		legacy)			qemu_exe="qemu-system-i386"		;;
+		generic|64)		qemu_exe="qemu-system-x86_64"	;;
+		*)
+			__errmsg "target $o_target: unknown subtarget $o_subtarget"
+			return 1
+			;;
+	esac
+
+	case "${o_subtarget%-*}" in
+		legacy)
+			# use IDE (PATA) disk instead of AHCI (SATA).  Refer to link
+			# [1] for related discussions
+			#
+			# To use AHCI interface
+			#
+			#	-device ich9-ahci,id=ahci \
+			#	-device ide-drive,drive=drv0,bus=ahci.0 \
+			#	-drive "file=$rootfs,format=raw,id=drv0,if=none" \
+			#
+			# [1] https://dev.openwrt.org/ticket/17947
+			"$qemu_exe" -nographic \
+				-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device e1000,id=devlan,netdev=lan,mac="$MAC_LAN" \
+				-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device e1000,id=devwan,netdev=wan,mac="$MAC_WAN" \
+				-device ide-drive,drive=drv0 \
+				-drive "file=$rootfs,format=raw,id=drv0,if=none" \
+				"${o_qemu_extra[@]}"
+			;;
+		generic|64)
+			"$qemu_exe" -nographic \
+				-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \
+				-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \
+				-drive "file=$rootfs,format=raw,if=virtio" \
+				"${o_qemu_extra[@]}"
+			;;
+	esac
+}
+
+start_qemu() {
+	case "$o_target" in
+		armvirt)	start_qemu_armvirt	;;
+		malta)		start_qemu_malta	;;
+		x86)		start_qemu_x86		;;
+		*)
+			__errmsg "target $o_target is not supported yet"
+			return 1
+			;;
+	esac
+}
+
+check_setup \
+	&& parse_args "$@" \
+	&& start_qemu


From lede-commits at lists.infradead.org  Sat Apr 22 18:19:38 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 22 Apr 2017 21:19:38 -0400
Subject: [source]  armvirt: merge arm64 as subtarget 64
In-Reply-To: <20170423011937.26221.27365@git-01.infra.lede-project.org>
References: <20170423011937.26221.27365@git-01.infra.lede-project.org>
Message-ID: <mailman.25557.1492910542.26984.lede-commits@lists.infradead.org>

yousong pushed a commit to source.git, branch master:
https://git.lede-project.org/88468f7e5307a132a612d619a73936d030339892

commit 88468f7e5307a132a612d619a73936d030339892
Author: Yousong Zhou <yszhou4tech at gmail.com>
AuthorDate: Tue Apr 18 20:59:52 2017 +0800

    armvirt: merge arm64 as subtarget 64
    
    Original armvirt target is now subtarget 32.  Other than that the built
    result should remain the same as before
    
    Besides old features already available with arm64, the new armvirt/64
    subtarget will also have those features originally enabled for
    armvirt/32 with commit 44ecfc2 ("armvirt: new target")
     - pl011, uart
     - pl031, rtc
     - pl061, gpio
     - pci-host-generic
     - virtio_{mmio,pci,net,blk,scsi,9p,console,balloon}
     - smp with NR_CPUS=4
     - cpu-hotplug
     - ext4
     - DEBUG_BUGVERBOSE for debug purposes
    
    Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 target/linux/arm64/Makefile                        |  28 ----
 target/linux/arm64/README                          |   8 -
 target/linux/arm64/base-files/etc/inittab          |   5 -
 target/linux/arm64/image/Makefile                  |  34 -----
 target/linux/armvirt/32/config-default             |  91 +++++++++++
 target/linux/armvirt/32/target.mk                  |  10 ++
 .../config-4.9 => armvirt/64/config-default}       | 167 ++-------------------
 target/linux/armvirt/64/target.mk                  |   8 +
 target/linux/armvirt/Makefile                      |  16 +-
 target/linux/armvirt/README                        |  22 ++-
 target/linux/armvirt/config-default                | 111 ++------------
 target/linux/armvirt/image/Makefile                |  10 +-
 12 files changed, 165 insertions(+), 345 deletions(-)

diff --git a/target/linux/arm64/Makefile b/target/linux/arm64/Makefile
deleted file mode 100644
index 5257b89..0000000
--- a/target/linux/arm64/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=aarch64
-BOARD:=arm64
-BOARDNAME:=ARMv8 multiplatform
-FEATURES:=fpu ramdisk
-CFLAGS:=-Os -pipe -fno-caller-saves
-MAINTAINER:=Florian Fainelli <florian at openwrt.org>
-
-KERNEL_PATCHVER:=4.9
-
-DEVICE_TYPE:=developerboard
-
-define Target/Description
-	Build multi-platform images for the ARMv8 instruction set architecture
-endef
-
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=Image dtbs
-
-$(eval $(call BuildTarget))
diff --git a/target/linux/arm64/README b/target/linux/arm64/README
deleted file mode 100644
index ab26934..0000000
--- a/target/linux/arm64/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This multi-platform ARMv8 target can be used with QEMU:
-
-qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic \
-	-smp 1 -m 2048 \
-	-kernel bin/targets/arm64/generic/lede-arm64-qemu-virt-initramfs.Image \
-	--append "console=ttyAMA0"
-
-and enjoy the system booting.
diff --git a/target/linux/arm64/base-files/etc/inittab b/target/linux/arm64/base-files/etc/inittab
deleted file mode 100644
index be235d8..0000000
--- a/target/linux/arm64/base-files/etc/inittab
+++ /dev/null
@@ -1,5 +0,0 @@
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
-tts/0::askfirst:/usr/libexec/login.sh
-ttyAMA0::askfirst:/usr/libexec/login.sh
-tty1::askfirst:/usr/libexec/login.sh
diff --git a/target/linux/arm64/image/Makefile b/target/linux/arm64/image/Makefile
deleted file mode 100644
index d529368..0000000
--- a/target/linux/arm64/image/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Image/Prepare
-	cp $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/Image $(KDIR)/Image
-endef
-
-define Image/Build/QemuVirt
-	$(CP) $(KDIR)/Image $(BIN_DIR)/$(IMG_PREFIX)-qemu-virt.Image
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-	$(CP) $(KDIR)/Image-initramfs $(BIN_DIR)/$(IMG_PREFIX)-qemu-virt-initramfs.Image
-endif
-endef
-
-define Image/BuildKernel
-	$(call Image/Build/QemuVirt)
-endef
-
-define Image/Build/squashfs
-	$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
-endef
-
-define Image/Build
-	$(call Image/Build/$(1))
-	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/armvirt/32/config-default b/target/linux/armvirt/32/config-default
new file mode 100644
index 0000000..eee2a72
--- /dev/null
+++ b/target/linux/armvirt/32/config-default
@@ -0,0 +1,91 @@
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+# CONFIG_ARCH_MULTI_CPU_AUTO is not set
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_VIRT=y
+CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
+CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
+CONFIG_ARM=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+# CONFIG_ARM_LPAE is not set
+CONFIG_ARM_PATCH_IDIV=y
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_ARM_PSCI=y
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_ARM_VIRT_EXT=y
+CONFIG_AUTO_ZRELADDR=y
+# CONFIG_BINFMT_FLAT is not set
+CONFIG_CACHE_L2X0=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_HAS_ASID=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_V7=y
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
+# CONFIG_DEBUG_UART_8250 is not set
+# CONFIG_DEBUG_USER is not set
+CONFIG_EDAC_ATOMIC_SCRUB=y
+CONFIG_HAVE_ARM_ARCH_TIMER=y
+CONFIG_HAVE_CBPF_JIT=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_OPTPROBES=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_HAVE_SMP=y
+CONFIG_HZ_FIXED=0
+CONFIG_HZ_PERIODIC=y
+CONFIG_MIGHT_HAVE_CACHE_L2X0=y
+CONFIG_MIGHT_HAVE_PCI=y
+CONFIG_MODULES_USE_ELF_REL=y
+CONFIG_MULTI_IRQ_HANDLER=y
+CONFIG_NEON=y
+CONFIG_OLD_SIGACTION=y
+CONFIG_OUTER_CACHE=y
+CONFIG_OUTER_CACHE_SYNC=y
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PGTABLE_LEVELS=2
+# CONFIG_PL310_ERRATA_588369 is not set
+# CONFIG_PL310_ERRATA_727915 is not set
+# CONFIG_PL310_ERRATA_753970 is not set
+# CONFIG_PL310_ERRATA_769419 is not set
+CONFIG_RTC_MC146818_LIB=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SMP_ON_UP=y
+CONFIG_SWP_EMULATE=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
+CONFIG_USB_SUPPORT=y
+CONFIG_USE_OF=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_XZ_DEC_ARM=y
+CONFIG_XZ_DEC_BCJ=y
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_ZBOOT_ROM_TEXT=0
diff --git a/target/linux/armvirt/32/target.mk b/target/linux/armvirt/32/target.mk
new file mode 100644
index 0000000..8d42a14
--- /dev/null
+++ b/target/linux/armvirt/32/target.mk
@@ -0,0 +1,10 @@
+ARCH:=arm
+SUBTARGET:=32
+BOARDNAME:=QEMU ARM Virtual Machine (cortex-a15)
+CPU_TYPE:=cortex-a15
+CPU_SUBTYPE:=neon-vfpv4
+KERNELNAME:=zImage
+
+define Target/Description
+  Build images for $(BOARDNAME)
+endef
diff --git a/target/linux/arm64/config-4.9 b/target/linux/armvirt/64/config-default
similarity index 53%
rename from target/linux/arm64/config-4.9
rename to target/linux/armvirt/64/config-default
index 91a8f97..8a8c50b 100644
--- a/target/linux/arm64/config-4.9
+++ b/target/linux/armvirt/64/config-default
@@ -1,17 +1,10 @@
 CONFIG_64BIT=y
 # CONFIG_ACPI is not set
-CONFIG_ARCH_CLOCKSOURCE_DATA=y
 CONFIG_ARCH_DMA_ADDR_T_64BIT=y
-CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y
 CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
 CONFIG_ARCH_HAS_GIGANTIC_PAGE=y
 CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
 CONFIG_ARCH_HAS_KCOV=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_TICK_BROADCAST=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_MMAP_RND_BITS=18
 CONFIG_ARCH_MMAP_RND_BITS_MAX=24
 CONFIG_ARCH_MMAP_RND_BITS_MIN=18
@@ -21,11 +14,8 @@ CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_SPARSEMEM_DEFAULT=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
 CONFIG_ARCH_VEXPRESS=y
 CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
 CONFIG_ARCH_WANT_FRAME_POINTERS=y
@@ -34,7 +24,6 @@ CONFIG_ARM64=y
 # CONFIG_ARM64_16K_PAGES is not set
 CONFIG_ARM64_4K_PAGES=y
 # CONFIG_ARM64_64K_PAGES is not set
-# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set
 CONFIG_ARM64_CONT_SHIFT=4
 CONFIG_ARM64_CRYPTO=y
 CONFIG_ARM64_ERRATUM_819472=y
@@ -57,32 +46,18 @@ CONFIG_ARM64_VA_BITS_39=y
 # CONFIG_ARM64_VA_BITS_48 is not set
 CONFIG_ARM64_VHE=y
 # CONFIG_ARMV8_DEPRECATED is not set
-CONFIG_ARM_AMBA=y
-CONFIG_ARM_ARCH_TIMER=y
-CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
-CONFIG_ARM_GIC=y
-CONFIG_ARM_GIC_V2M=y
-CONFIG_ARM_GIC_V3=y
 CONFIG_ARM_GIC_V3_ITS=y
-CONFIG_ARM_PSCI_FW=y
 # CONFIG_ARM_SBSA_WATCHDOG is not set
-# CONFIG_ARM_SP805_WATCHDOG is not set
 CONFIG_ATOMIC64_SELFTEST=y
 CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
 CONFIG_BLOCK_COMPAT=y
 CONFIG_BOUNCE=y
-CONFIG_BUILD_BIN2C=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_ACPI=y
 CONFIG_CLKSRC_MMIO=y
-CONFIG_CLKSRC_OF=y
-CONFIG_CLKSRC_PROBE=y
 CONFIG_CLKSRC_VERSATILE=y
 CONFIG_CLK_SP810=y
 CONFIG_CLK_VEXPRESS_OSC=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyAMA0"
-CONFIG_COMMON_CLK=y
 CONFIG_COMMON_CLK_VERSATILE=y
 # CONFIG_COMMON_CLK_XGENE is not set
 CONFIG_COMPAT=y
@@ -94,18 +69,19 @@ CONFIG_CPU_IDLE=y
 # CONFIG_CPU_IDLE_GOV_LADDER is not set
 CONFIG_CPU_IDLE_GOV_MENU=y
 CONFIG_CPU_PM=y
-CONFIG_CPU_RMAP=y
-CONFIG_CRYPTO_SHA1_ARM64_CE=y
-CONFIG_CRYPTO_SHA2_ARM64_CE=y
-CONFIG_CRYPTO_GHASH_ARM64_CE=y
+CONFIG_CRYPTO_ABLK_HELPER=y
 CONFIG_CRYPTO_AES_ARM64_CE=y
-CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
 CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
 CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y
 CONFIG_CRYPTO_CRC32_ARM64=y
-CONFIG_DCACHE_WORD_ACCESS=y
+CONFIG_CRYPTO_CRYPTD=y
+CONFIG_CRYPTO_GHASH_ARM64_CE=y
+CONFIG_CRYPTO_SHA1_ARM64_CE=y
+CONFIG_CRYPTO_SHA2_ARM64_CE=y
 # CONFIG_DEBUG_ALIGN_RODATA is not set
-CONFIG_DTC=y
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_RODATA=y
 CONFIG_FB=y
 CONFIG_FB_ARMCLCD=y
 CONFIG_FB_CFB_COPYAREA=y
@@ -113,102 +89,38 @@ CONFIG_FB_CFB_FILLRECT=y
 CONFIG_FB_CFB_IMAGEBLIT=y
 CONFIG_FB_CMDLINE=y
 CONFIG_FB_MODE_HELPERS=y
-CONFIG_FIX_EARLYCON_MEM=y
-CONFIG_FRAME_POINTER=y
 CONFIG_FSL_ERRATUM_A008585=y
 # CONFIG_FSL_MC_BUS is not set
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
 CONFIG_GENERIC_CSUM=y
-CONFIG_GENERIC_EARLY_IOREMAP=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_MSI_IRQ=y
-CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
-CONFIG_GPIOLIB=y
-# CONFIG_GPIO_AMDPT is not set
 CONFIG_GPIO_GENERIC=y
 CONFIG_GPIO_GENERIC_PLATFORM=y
-CONFIG_GRACE_PERIOD=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
 CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_BITREVERSE=y
 CONFIG_HAVE_ARCH_HUGE_VMAP=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
 CONFIG_HAVE_ARCH_KASAN=y
-CONFIG_HAVE_ARCH_KGDB=y
 CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
 CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
-CONFIG_HAVE_ARM_SMCCC=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
 CONFIG_HAVE_CMPXCHG_DOUBLE=y
 CONFIG_HAVE_CMPXCHG_LOCAL=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
 CONFIG_HAVE_DEBUG_BUGVERBOSE=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_EBPF_JIT=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
 CONFIG_HAVE_GENERIC_RCU_GUP=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_MEMBLOCK=y
 CONFIG_HAVE_MEMORY_PRESENT=y
-CONFIG_HAVE_NET_DSA=y
 CONFIG_HAVE_PATA_PLATFORM=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
 CONFIG_HAVE_RCU_TABLE_FREE=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-# CONFIG_HPET is not set
 # CONFIG_HUGETLBFS is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_HW_RANDOM_CAVIUM is not set
 CONFIG_HW_RANDOM_VIRTIO=y
 CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
-CONFIG_IOMMU_HELPER=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_DOMAIN_HIERARCHY=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
 # CONFIG_KASAN is not set
-CONFIG_LIBFDT=y
+CONFIG_LCD_CLASS_DEVICE=m
+# CONFIG_LCD_PLATFORM is not set
 # CONFIG_LIQUIDIO is not set
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_MFD_CORE=y
 CONFIG_MFD_SYSCON=y
 CONFIG_MFD_VEXPRESS_SYSREG=y
@@ -217,77 +129,35 @@ CONFIG_MMC_ARMMMCI=y
 # CONFIG_MMC_TIFM_SD is not set
 CONFIG_MODULES_USE_ELF_RELA=y
 # CONFIG_MTD_PHYSMAP_OF is not set
-CONFIG_MUTEX_SPIN_ON_OWNER=y
-CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_SG_DMA_LENGTH=y
-CONFIG_NET_FLOW_LIMIT=y
-CONFIG_NO_BOOTMEM=y
 CONFIG_NO_HZ=y
 CONFIG_NO_HZ_COMMON=y
 CONFIG_NO_HZ_IDLE=y
-CONFIG_NR_CPUS=4
 # CONFIG_NUMA is not set
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGSUSPEND3=y
-# CONFIG_PADATA is not set
-CONFIG_PARTITION_PERCPU=y
-CONFIG_PCI=y
 CONFIG_PCI_BUS_ADDR_T_64BIT=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_DOMAINS_GENERIC=y
-CONFIG_PCI_ECAM=y
 # CONFIG_PCI_HISI is not set
 # CONFIG_PCI_HOST_THUNDER_ECAM is not set
 # CONFIG_PCI_HOST_THUNDER_PEM is not set
-CONFIG_PCI_LABEL=y
-CONFIG_PCI_MSI=y
-CONFIG_PCI_MSI_IRQ_DOMAIN=y
 CONFIG_PGTABLE_LEVELS=3
 CONFIG_PHYS_ADDR_T_64BIT=y
 # CONFIG_PHY_XGENE is not set
 CONFIG_PM=y
-# CONFIG_PMIC_OPREGION is not set
 CONFIG_PM_CLK=y
 # CONFIG_PM_DEBUG is not set
 CONFIG_PM_GENERIC_DOMAINS=y
 CONFIG_PM_GENERIC_DOMAINS_OF=y
-CONFIG_PNP=y
-CONFIG_PNP_DEBUG_MESSAGES=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_VEXPRESS=y
 CONFIG_POWER_SUPPLY=y
 # CONFIG_RANDOMIZE_BASE is not set
-CONFIG_RATIONAL=y
 CONFIG_REGMAP=y
 CONFIG_REGMAP_MMIO=y
-CONFIG_RWSEM_SPIN_ON_OWNER=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-# CONFIG_SCHED_INFO is not set
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_PNP=y
-# CONFIG_SERIAL_AMBA_PL010 is not set
-CONFIG_SERIAL_AMBA_PL011=y
-CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
 CONFIG_SMC91X=y
-CONFIG_SMP=y
 CONFIG_SPARSEMEM=y
 CONFIG_SPARSEMEM_EXTREME=y
 CONFIG_SPARSEMEM_MANUAL=y
 CONFIG_SPARSEMEM_VMEMMAP=y
 CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
-CONFIG_SPARSE_IRQ=y
-CONFIG_SRCU=y
-CONFIG_SWIOTLB=y
 CONFIG_SYSCTL_EXCEPTION_TRACE=y
 CONFIG_SYSVIPC_COMPAT=y
 CONFIG_SYS_SUPPORTS_HUGETLBFS=y
@@ -295,13 +165,6 @@ CONFIG_SYS_SUPPORTS_HUGETLBFS=y
 # CONFIG_THUNDER_NIC_PF is not set
 # CONFIG_THUNDER_NIC_RGX is not set
 # CONFIG_THUNDER_NIC_VF is not set
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TREE_RCU=y
 CONFIG_VEXPRESS_CONFIG=y
 CONFIG_VEXPRESS_SYSCFG=y
-CONFIG_VIRTIO=y
-CONFIG_VIRTIO_BLK=y
-# CONFIG_VIRTIO_CONSOLE is not set
-CONFIG_VIRTIO_MMIO=y
-# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set
-CONFIG_VIRTIO_NET=y
+CONFIG_VIDEOMODE_HELPERS=y
diff --git a/target/linux/armvirt/64/target.mk b/target/linux/armvirt/64/target.mk
new file mode 100644
index 0000000..38d8fa1
--- /dev/null
+++ b/target/linux/armvirt/64/target.mk
@@ -0,0 +1,8 @@
+ARCH:=aarch64
+SUBTARGET:=64
+BOARDNAME:=ARMv8 multiplatform
+KERNELNAME:=Image
+
+define Target/Description
+	Build multi-platform images for the ARMv8 instruction set architecture
+endef
diff --git a/target/linux/armvirt/Makefile b/target/linux/armvirt/Makefile
index 3fedcad..2cf3820 100644
--- a/target/linux/armvirt/Makefile
+++ b/target/linux/armvirt/Makefile
@@ -1,28 +1,20 @@
 #
-# Copyright (C) 2016 Yousong Zhou <yszhou4tech at gmail.com>
+# Copyright (C) 2017 Yousong Zhou <yszhou4tech at gmail.com>
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
 include $(TOPDIR)/rules.mk
 
-ARCH:=arm
 BOARD:=armvirt
 BOARDNAME:=QEMU ARM Virtual Machine
 FEATURES:=fpu pci rtc usb
 FEATURES+=cpiogz ext4 ramdisk squashfs targz
-CPU_TYPE:=cortex-a15
-CPU_SUBTYPE:=neon-vfpv4
-MAINTAINER:=Yousong Zhou <yszhou4tech at gmail.com>
+MAINTAINER:=Florian Fainelli <f.fainelli at gmail.com>, \
+	Yousong Zhou <yszhou4tech at gmail.com>
 
-KERNEL_PATCHVER:=4.4
-
-define Target/Description
-  Build images for QEMU ARM Virtual Machine
-endef
+KERNEL_PATCHVER:=4.9
 
 include $(INCLUDE_DIR)/target.mk
 
-KERNELNAME:=zImage
-
 $(eval $(call BuildTarget))
diff --git a/target/linux/armvirt/README b/target/linux/armvirt/README
index e990381..fba71a6 100644
--- a/target/linux/armvirt/README
+++ b/target/linux/armvirt/README
@@ -1,20 +1,21 @@
 This is intended to be used with LEDE project to provide image for use with
-QEMU arm-softmmu virt machine.
+QEMU ARM virt machine.
 
 Run with qemu-system-arm
 
 	# boot with initramfs embedded in
-	qemu-system-arm -nographic -M virt -m 64 -kernel lede-armvirt-zImage-initramfs
+	qemu-system-arm -nographic -M virt -m 64 -kernel lede-armvirt-32-zImage-initramfs
 
 	# boot with accel=kvm
-	qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel lede-armvirt-zImage-initramfs
+	qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel
+	lede-armvirt-32-zImage-initramfs
 
 	# boot with a separate rootfs
-	qemu-system-arm -nographic -M virt -m 64 -kernel lede-armvirt-zImage \
-	  -drive file=lede-armvirt-root.ext4,format=raw,if=virtio -append 'root=/dev/vda rootwait'
+	qemu-system-arm -nographic -M virt -m 64 -kernel lede-armvirt-32-zImage \
+	  -drive file=lede-armvirt-32-root.ext4,format=raw,if=virtio -append 'root=/dev/vda rootwait'
 
 	# boot with local dir as rootfs
-	qemu-system-arm -nographic -M virt -m 64 -kernel lede-armvirt-zImage \
+	qemu-system-arm -nographic -M virt -m 64 -kernel lede-armvirt-32-zImage \
 	  -fsdev local,id=rootdev,path=root-armvirt/,security_model=none \
 	  -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \
 	  -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p'
@@ -22,13 +23,18 @@ Run with qemu-system-arm
 Run with kvmtool
 
 	# start a named machine
-	lkvm run -k lede-armvirt-zImage -i lede-armvirt-rootfs.cpio --name armvirt0
+	lkvm run -k lede-armvirt-32-zImage -i lede-armvirt-32-rootfs.cpio --name armvirt0
 
 	# start with virtio-9p rootfs
-	lkvm run -k lede-armvirt-zImage -d root-armvirt/
+	lkvm run -k lede-armvirt-32-zImage -d root-armvirt/
 
 	# stop "armvirt0"
 	lkvm stop --name armvirt0
 
 	# stop all
 	lkvm stop --all
+
+The multi-platform ARMv8 target can be used with QEMU:
+
+	qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \
+		-kernel lede-armvirt-64-Image-initramfs \
diff --git a/target/linux/armvirt/config-default b/target/linux/armvirt/config-default
index 0cee053..ed6a82e 100644
--- a/target/linux/armvirt/config-default
+++ b/target/linux/armvirt/config-default
@@ -1,72 +1,31 @@
 CONFIG_9P_FS=y
 # CONFIG_9P_FS_POSIX_ACL is not set
 # CONFIG_9P_FS_SECURITY is not set
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+CONFIG_ARCH_CLOCKSOURCE_DATA=y
 CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
 CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
 CONFIG_ARCH_HAS_SG_CHAIN=y
 CONFIG_ARCH_HAS_TICK_BROADCAST=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MULTIPLATFORM=y
-# CONFIG_ARCH_MULTI_CPU_AUTO is not set
-CONFIG_ARCH_MULTI_V6_V7=y
-CONFIG_ARCH_MULTI_V7=y
-CONFIG_ARCH_NR_GPIO=0
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
 CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
 CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_VIRT=y
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_ARM=y
 CONFIG_ARM_AMBA=y
 CONFIG_ARM_ARCH_TIMER=y
 CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
-# CONFIG_ARM_CPU_SUSPEND is not set
 CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V2M=y
 CONFIG_ARM_GIC_V3=y
-CONFIG_ARM_HAS_SG_CHAIN=y
-CONFIG_ARM_HEAVY_MB=y
-CONFIG_ARM_L1_CACHE_SHIFT=6
-CONFIG_ARM_L1_CACHE_SHIFT_6=y
-# CONFIG_ARM_LPAE is not set
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-CONFIG_ARM_PSCI=y
 CONFIG_ARM_PSCI_FW=y
 # CONFIG_ARM_SP805_WATCHDOG is not set
-CONFIG_ARM_THUMB=y
-# CONFIG_ARM_THUMBEE is not set
-CONFIG_ARM_VIRT_EXT=y
-CONFIG_AUTO_ZRELADDR=y
-CONFIG_CACHE_L2X0=y
+CONFIG_BLK_MQ_PCI=y
 CONFIG_CLKDEV_LOOKUP=y
 CONFIG_CLKSRC_OF=y
 CONFIG_CLKSRC_PROBE=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_COMMON_CLK=y
-CONFIG_CPU_32v6K=y
-CONFIG_CPU_32v7=y
-CONFIG_CPU_ABRT_EV7=y
-# CONFIG_CPU_BPREDICT_DISABLE is not set
-CONFIG_CPU_CACHE_V7=y
-CONFIG_CPU_CACHE_VIPT=y
-CONFIG_CPU_COPY_V6=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_HAS_ASID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_PABRT_V7=y
+# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
 CONFIG_CPU_RMAP=y
-CONFIG_CPU_TLB_V7=y
-CONFIG_CPU_V7=y
 CONFIG_CRC16=y
 CONFIG_CRYPTO_AEAD=y
 CONFIG_CRYPTO_AEAD2=y
@@ -79,12 +38,7 @@ CONFIG_CRYPTO_NULL2=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
 CONFIG_DCACHE_WORD_ACCESS=y
-CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_UART_8250 is not set
-# CONFIG_DEBUG_USER is not set
 CONFIG_DTC=y
-CONFIG_EDAC_ATOMIC_SCRUB=y
 CONFIG_EDAC_SUPPORT=y
 CONFIG_EXT4_FS=y
 CONFIG_FIX_EARLYCON_MEM=y
@@ -94,10 +48,14 @@ CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_GENERIC_EARLY_IOREMAP=y
 CONFIG_GENERIC_IDLE_POLL_SETUP=y
 CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IRQ_MIGRATION=y
 CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_MSI_IRQ=y
+CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SCHED_CLOCK=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
@@ -105,7 +63,6 @@ CONFIG_GENERIC_STRNCPY_FROM_USER=y
 CONFIG_GENERIC_STRNLEN_USER=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIOLIB_IRQCHIP=y
-CONFIG_GPIO_DEVRES=y
 CONFIG_GPIO_PL061=y
 CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDIRQS_SW_RESEND=y
@@ -120,9 +77,8 @@ CONFIG_HAVE_ARCH_KGDB=y
 CONFIG_HAVE_ARCH_PFN_VALID=y
 CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
-CONFIG_HAVE_ARM_ARCH_TIMER=y
+CONFIG_HAVE_ARM_SMCCC=y
 # CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
 CONFIG_HAVE_CC_STACKPROTECTOR=y
 CONFIG_HAVE_CLK=y
 CONFIG_HAVE_CLK_PREPARE=y
@@ -130,7 +86,6 @@ CONFIG_HAVE_CONTEXT_TRACKING=y
 CONFIG_HAVE_C_RECORDMCOUNT=y
 CONFIG_HAVE_DEBUG_KMEMLEAK=y
 CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
 CONFIG_HAVE_DMA_CONTIGUOUS=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -138,26 +93,18 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
 CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
 CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
 CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_OPTPROBES=y
 CONFIG_HAVE_PERF_EVENTS=y
 CONFIG_HAVE_PERF_REGS=y
 CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_PROC_CPU=y
 CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SMP=y
 CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_HAVE_UID16=y
 CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HVC_DRIVER=y
-CONFIG_HZ_FIXED=0
-CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IOMMU_HELPER=y
 CONFIG_IRQCHIP=y
@@ -169,13 +116,8 @@ CONFIG_JBD2=y
 CONFIG_LIBFDT=y
 CONFIG_LOCK_SPIN_ON_OWNER=y
 CONFIG_MEMORY_BALLOON=y
-CONFIG_MIGHT_HAVE_CACHE_L2X0=y
-CONFIG_MIGHT_HAVE_PCI=y
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MULTI_IRQ_HANDLER=y
 CONFIG_MUTEX_SPIN_ON_OWNER=y
 CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEON=y
 CONFIG_NET_9P=y
 # CONFIG_NET_9P_DEBUG is not set
 CONFIG_NET_9P_VIRTIO=y
@@ -189,26 +131,21 @@ CONFIG_OF_EARLY_FLATTREE=y
 CONFIG_OF_FLATTREE=y
 CONFIG_OF_GPIO=y
 CONFIG_OF_IRQ=y
-CONFIG_OF_MTD=y
 CONFIG_OF_NET=y
 CONFIG_OF_PCI=y
 CONFIG_OF_PCI_IRQ=y
 CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
 CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_OUTER_CACHE=y
-CONFIG_OUTER_CACHE_SYNC=y
 CONFIG_PADATA=y
-CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PARTITION_PERCPU=y
 CONFIG_PCI=y
-# CONFIG_PCI_DOMAINS_GENERIC is not set
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_DOMAINS_GENERIC=y
+CONFIG_PCI_ECAM=y
+CONFIG_PCI_HOST_COMMON=y
 CONFIG_PCI_HOST_GENERIC=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=2
-# CONFIG_PL310_ERRATA_588369 is not set
-# CONFIG_PL310_ERRATA_727915 is not set
-# CONFIG_PL310_ERRATA_753970 is not set
-# CONFIG_PL310_ERRATA_769419 is not set
+CONFIG_PCI_MSI=y
+CONFIG_PCI_MSI_IRQ_DOMAIN=y
 CONFIG_RATIONAL=y
 CONFIG_RCU_STALL_COMMON=y
 CONFIG_RFS_ACCEL=y
@@ -225,23 +162,12 @@ CONFIG_SERIAL_8250_FSL=y
 # CONFIG_SERIAL_AMBA_PL010 is not set
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
-CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_SMP=y
-CONFIG_SMP_ON_UP=y
 CONFIG_SPARSE_IRQ=y
 CONFIG_SRCU=y
 CONFIG_SWIOTLB=y
-CONFIG_SWP_EMULATE=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-# CONFIG_THUMB2_KERNEL is not set
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TREE_RCU=y
-CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
-CONFIG_USB_SUPPORT=y
-CONFIG_USE_OF=y
-CONFIG_VECTORS_BASE=0xffff0000
-CONFIG_VFP=y
-CONFIG_VFPv3=y
 CONFIG_VIRTIO=y
 CONFIG_VIRTIO_BALLOON=y
 CONFIG_VIRTIO_BLK=y
@@ -252,8 +178,3 @@ CONFIG_VIRTIO_NET=y
 CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_PCI_LEGACY=y
 CONFIG_XPS=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0
-CONFIG_ZBOOT_ROM_TEXT=0
-CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile
index df4383f..73d9145 100644
--- a/target/linux/armvirt/image/Makefile
+++ b/target/linux/armvirt/image/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2016 Yousong Zhou <yszhou4tech at gmail.com>
+# Copyright (C) 2016-2017 Yousong Zhou <yszhou4tech at gmail.com>
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,11 +8,15 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
 define Image/BuildKernel
-	cp $(KDIR)/$(KERNELNAME) $(BIN_DIR)/$(IMG_PREFIX)-$(KERNELNAME)
+	$(foreach k,$(filter zImage Image,$(KERNELNAME)), \
+		cp $(KDIR)/$(KERNELNAME) $(BIN_DIR)/$(IMG_PREFIX)-$(k) \
+	)
 endef
 
 define Image/Build/Initramfs
-	cp $(KDIR)/$(KERNELNAME)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(KERNELNAME)-initramfs
+	$(foreach k,$(filter zImage Image,$(KERNELNAME)), \
+		cp $(KDIR)/$(k)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(k)-initramfs \
+	)
 endef
 
 define Image/Build


From lede-commits at lists.infradead.org  Sun Apr 23 04:51:13 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 23 Apr 2017 07:51:13 -0400
Subject: [source]  kernel: use skb_cow_head() to deal with cloned skbs
In-Reply-To: <20170423115113.655.719@git-01.infra.lede-project.org>
References: <20170423115113.655.719@git-01.infra.lede-project.org>
Message-ID: <mailman.25588.1492948306.26984.lede-commits@lists.infradead.org>

noltari pushed a commit to source.git, branch master:
https://git.lede-project.org/2db05cd199999d9a3670e5287d067bdab0431f1a

commit 2db05cd199999d9a3670e5287d067bdab0431f1a
Author: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
AuthorDate: Sun Apr 23 13:48:05 2017 +0200

    kernel: use skb_cow_head() to deal with cloned skbs
    
    We need to ensure there is enough headroom to push extra header,
    but we also need to check if we are allowed to change headers.
    
    skb_cow_head() is the proper helper to deal with this.
    
    Fixes Ethernet<->WiFi bridge for Raspberry Pi and probably other devices.
    
    Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
---
 ...Use-skb_cow_head-to-deal-with-cloned-skbs.patch | 40 ++++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 36 ++++++++++++++++++
 ...-use-skb_cow_head-to-deal-with-cloned-skb.patch | 35 ++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 37 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 38 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 38 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 43 ++++++++++++++++++++++
 ...Use-skb_cow_head-to-deal-with-cloned-skbs.patch | 40 ++++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 36 ++++++++++++++++++
 ...-use-skb_cow_head-to-deal-with-cloned-skb.patch | 35 ++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 37 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 38 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 38 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 43 ++++++++++++++++++++++
 14 files changed, 534 insertions(+)

diff --git a/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..36fb936
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,40 @@
+From e9156cd26a495a18706e796f02a81fee41ec14f4 Mon Sep 17 00:00:00 2001
+From: James Hughes <james.hughes at raspberrypi.org>
+Date: Wed, 19 Apr 2017 11:13:40 +0100
+Subject: [PATCH] smsc95xx: Use skb_cow_head to deal with cloned skbs
+
+The driver was failing to check that the SKB wasn't cloned
+before adding checksum data.
+Replace existing handling to extend/copy the header buffer
+with skb_cow_head.
+
+Signed-off-by: James Hughes <james.hughes at raspberrypi.org>
+Acked-by: Eric Dumazet <edumazet at google.com>
+Acked-by: Woojung Huh <Woojung.Huh at microchip.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/smsc95xx.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc95xx.c
++++ b/drivers/net/usb/smsc95xx.c
+@@ -1835,13 +1835,13 @@ static struct sk_buff *smsc95xx_tx_fixup
+ 	/* We do not advertise SG, so skbs should be already linearized */
+ 	BUG_ON(skb_shinfo(skb)->nr_frags);
+ 
+-	if (skb_headroom(skb) < overhead) {
+-		struct sk_buff *skb2 = skb_copy_expand(skb,
+-			overhead, 0, flags);
++	/* Make writable and expand header space by overhead if required */
++	if (skb_cow_head(skb, overhead)) {
++		/* Must deallocate here as returning NULL to indicate error
++		 * means the skb won't be deallocated in the caller.
++		 */
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	if (csum) {
diff --git a/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..6312f0f
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,36 @@
+From b7c6d2675899cfff0180412c63fc9cbd5bacdb4d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:21 -0700
+Subject: [PATCH] smsc75xx: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: d0cad871703b ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/smsc75xx.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc75xx.c
++++ b/drivers/net/usb/smsc75xx.c
+@@ -2193,13 +2193,9 @@ static struct sk_buff *smsc75xx_tx_fixup
+ {
+ 	u32 tx_cmd_a, tx_cmd_b;
+ 
+-	if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) {
+-		struct sk_buff *skb2 =
+-			skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, SMSC75XX_TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS;
diff --git a/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch b/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
new file mode 100644
index 0000000..aee8aa9
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
@@ -0,0 +1,35 @@
+From a9e840a2081ed28c2b7caa6a9a0041c950b3c37d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:22 -0700
+Subject: [PATCH] cx82310_eth: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: cc28a20e77b2 ("introduce cx82310_eth: Conexant CX82310-based ADSL router USB ethernet driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/cx82310_eth.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/usb/cx82310_eth.c
++++ b/drivers/net/usb/cx82310_eth.c
+@@ -293,12 +293,9 @@ static struct sk_buff *cx82310_tx_fixup(
+ {
+ 	int len = skb->len;
+ 
+-	if (skb_headroom(skb) < 2) {
+-		struct sk_buff *skb2 = skb_copy_expand(skb, 2, 0, flags);
++	if (skb_cow_head(skb, 2)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 	skb_push(skb, 2);
+ 
diff --git a/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..4d0fcf6
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,37 @@
+From d532c1082f68176363ed766d09bf187616e282fe Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:23 -0700
+Subject: [PATCH] sr9700: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: c9b37458e956 ("USB2NET : SR9700 : One chip USB 1.1 USB2NET SR9700Device Driver Support")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/sr9700.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/sr9700.c
++++ b/drivers/net/usb/sr9700.c
+@@ -456,14 +456,9 @@ static struct sk_buff *sr9700_tx_fixup(s
+ 
+ 	len = skb->len;
+ 
+-	if (skb_headroom(skb) < SR_TX_OVERHEAD) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, SR_TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, SR_TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	__skb_push(skb, SR_TX_OVERHEAD);
diff --git a/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..4f96041
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,38 @@
+From d4ca73591916b760478d2b04334d5dcadc028e9c Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:24 -0700
+Subject: [PATCH] lan78xx: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Cc: Woojung Huh <woojung.huh at microchip.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/lan78xx.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/lan78xx.c
++++ b/drivers/net/usb/lan78xx.c
+@@ -2050,14 +2050,9 @@ static struct sk_buff *lan78xx_tx_prep(s
+ {
+ 	u32 tx_cmd_a, tx_cmd_b;
+ 
+-	if (skb_headroom(skb) < TX_OVERHEAD) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	if (lan78xx_linearize(skb) < 0)
diff --git a/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..2e8bba5
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,38 @@
+From 6bc6895bdd6744e0136eaa4a11fbdb20a7db4e40 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:25 -0700
+Subject: [PATCH] ch9200: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Cc: Matthew Garrett <mjg59 at srcf.ucam.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/ch9200.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/ch9200.c
++++ b/drivers/net/usb/ch9200.c
+@@ -255,14 +255,9 @@ static struct sk_buff *ch9200_tx_fixup(s
+ 	tx_overhead = 0x40;
+ 
+ 	len = skb->len;
+-	if (skb_headroom(skb) < tx_overhead) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, tx_overhead, 0, flags);
++	if (skb_cow_head(skb, tx_overhead)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	__skb_push(skb, tx_overhead);
diff --git a/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..541c694
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,43 @@
+From 39fba7835aacda65284a86e611774cbba71dac20 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:26 -0700
+Subject: [PATCH] kaweth: use skb_cow_head() to deal with cloned skbs
+
+We can use skb_cow_head() to properly deal with clones,
+especially the ones coming from TCP stack that allow their head being
+modified. This avoids a copy.
+
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/kaweth.c | 18 ++++++------------
+ 1 file changed, 6 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/usb/kaweth.c
++++ b/drivers/net/usb/kaweth.c
+@@ -812,18 +812,12 @@ static netdev_tx_t kaweth_start_xmit(str
+ 	}
+ 
+ 	/* We now decide whether we can put our special header into the sk_buff */
+-	if (skb_cloned(skb) || skb_headroom(skb) < 2) {
+-		/* no such luck - we make our own */
+-		struct sk_buff *copied_skb;
+-		copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC);
+-		dev_kfree_skb_irq(skb);
+-		skb = copied_skb;
+-		if (!copied_skb) {
+-			kaweth->stats.tx_errors++;
+-			netif_start_queue(net);
+-			spin_unlock_irq(&kaweth->device_lock);
+-			return NETDEV_TX_OK;
+-		}
++	if (skb_cow_head(skb, 2)) {
++		kaweth->stats.tx_errors++;
++		netif_start_queue(net);
++		spin_unlock_irq(&kaweth->device_lock);
++		dev_kfree_skb_any(skb);
++		return NETDEV_TX_OK;
+ 	}
+ 
+ 	private_header = (__le16 *)__skb_push(skb, 2);
diff --git a/target/linux/generic/patches-4.9/023-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.9/023-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..cfc9abb
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,40 @@
+From e9156cd26a495a18706e796f02a81fee41ec14f4 Mon Sep 17 00:00:00 2001
+From: James Hughes <james.hughes at raspberrypi.org>
+Date: Wed, 19 Apr 2017 11:13:40 +0100
+Subject: [PATCH] smsc95xx: Use skb_cow_head to deal with cloned skbs
+
+The driver was failing to check that the SKB wasn't cloned
+before adding checksum data.
+Replace existing handling to extend/copy the header buffer
+with skb_cow_head.
+
+Signed-off-by: James Hughes <james.hughes at raspberrypi.org>
+Acked-by: Eric Dumazet <edumazet at google.com>
+Acked-by: Woojung Huh <Woojung.Huh at microchip.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/smsc95xx.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc95xx.c
++++ b/drivers/net/usb/smsc95xx.c
+@@ -2001,13 +2001,13 @@ static struct sk_buff *smsc95xx_tx_fixup
+ 	/* We do not advertise SG, so skbs should be already linearized */
+ 	BUG_ON(skb_shinfo(skb)->nr_frags);
+ 
+-	if (skb_headroom(skb) < overhead) {
+-		struct sk_buff *skb2 = skb_copy_expand(skb,
+-			overhead, 0, flags);
++	/* Make writable and expand header space by overhead if required */
++	if (skb_cow_head(skb, overhead)) {
++		/* Must deallocate here as returning NULL to indicate error
++		 * means the skb won't be deallocated in the caller.
++		 */
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	if (csum) {
diff --git a/target/linux/generic/patches-4.9/023-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.9/023-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..99d98e1
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,36 @@
+From b7c6d2675899cfff0180412c63fc9cbd5bacdb4d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:21 -0700
+Subject: [PATCH] smsc75xx: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: d0cad871703b ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/smsc75xx.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc75xx.c
++++ b/drivers/net/usb/smsc75xx.c
+@@ -2205,13 +2205,9 @@ static struct sk_buff *smsc75xx_tx_fixup
+ {
+ 	u32 tx_cmd_a, tx_cmd_b;
+ 
+-	if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) {
+-		struct sk_buff *skb2 =
+-			skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, SMSC75XX_TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS;
diff --git a/target/linux/generic/patches-4.9/023-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch b/target/linux/generic/patches-4.9/023-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
new file mode 100644
index 0000000..aee8aa9
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
@@ -0,0 +1,35 @@
+From a9e840a2081ed28c2b7caa6a9a0041c950b3c37d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:22 -0700
+Subject: [PATCH] cx82310_eth: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: cc28a20e77b2 ("introduce cx82310_eth: Conexant CX82310-based ADSL router USB ethernet driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/cx82310_eth.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/usb/cx82310_eth.c
++++ b/drivers/net/usb/cx82310_eth.c
+@@ -293,12 +293,9 @@ static struct sk_buff *cx82310_tx_fixup(
+ {
+ 	int len = skb->len;
+ 
+-	if (skb_headroom(skb) < 2) {
+-		struct sk_buff *skb2 = skb_copy_expand(skb, 2, 0, flags);
++	if (skb_cow_head(skb, 2)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 	skb_push(skb, 2);
+ 
diff --git a/target/linux/generic/patches-4.9/023-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.9/023-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..4d0fcf6
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,37 @@
+From d532c1082f68176363ed766d09bf187616e282fe Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:23 -0700
+Subject: [PATCH] sr9700: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: c9b37458e956 ("USB2NET : SR9700 : One chip USB 1.1 USB2NET SR9700Device Driver Support")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/sr9700.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/sr9700.c
++++ b/drivers/net/usb/sr9700.c
+@@ -456,14 +456,9 @@ static struct sk_buff *sr9700_tx_fixup(s
+ 
+ 	len = skb->len;
+ 
+-	if (skb_headroom(skb) < SR_TX_OVERHEAD) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, SR_TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, SR_TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	__skb_push(skb, SR_TX_OVERHEAD);
diff --git a/target/linux/generic/patches-4.9/023-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.9/023-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..ea82799
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,38 @@
+From d4ca73591916b760478d2b04334d5dcadc028e9c Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:24 -0700
+Subject: [PATCH] lan78xx: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Cc: Woojung Huh <woojung.huh at microchip.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/lan78xx.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/lan78xx.c
++++ b/drivers/net/usb/lan78xx.c
+@@ -2419,14 +2419,9 @@ static struct sk_buff *lan78xx_tx_prep(s
+ {
+ 	u32 tx_cmd_a, tx_cmd_b;
+ 
+-	if (skb_headroom(skb) < TX_OVERHEAD) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	if (lan78xx_linearize(skb) < 0)
diff --git a/target/linux/generic/patches-4.9/023-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.9/023-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..83de38b
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,38 @@
+From 6bc6895bdd6744e0136eaa4a11fbdb20a7db4e40 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:25 -0700
+Subject: [PATCH] ch9200: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Cc: Matthew Garrett <mjg59 at srcf.ucam.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/ch9200.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/ch9200.c
++++ b/drivers/net/usb/ch9200.c
+@@ -254,14 +254,9 @@ static struct sk_buff *ch9200_tx_fixup(s
+ 	tx_overhead = 0x40;
+ 
+ 	len = skb->len;
+-	if (skb_headroom(skb) < tx_overhead) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, tx_overhead, 0, flags);
++	if (skb_cow_head(skb, tx_overhead)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	__skb_push(skb, tx_overhead);
diff --git a/target/linux/generic/patches-4.9/023-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.9/023-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..597f25b
--- /dev/null
+++ b/target/linux/generic/patches-4.9/023-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,43 @@
+From 39fba7835aacda65284a86e611774cbba71dac20 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:26 -0700
+Subject: [PATCH] kaweth: use skb_cow_head() to deal with cloned skbs
+
+We can use skb_cow_head() to properly deal with clones,
+especially the ones coming from TCP stack that allow their head being
+modified. This avoids a copy.
+
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/kaweth.c | 18 ++++++------------
+ 1 file changed, 6 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/usb/kaweth.c
++++ b/drivers/net/usb/kaweth.c
+@@ -803,18 +803,12 @@ static netdev_tx_t kaweth_start_xmit(str
+ 	}
+ 
+ 	/* We now decide whether we can put our special header into the sk_buff */
+-	if (skb_cloned(skb) || skb_headroom(skb) < 2) {
+-		/* no such luck - we make our own */
+-		struct sk_buff *copied_skb;
+-		copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC);
+-		dev_kfree_skb_irq(skb);
+-		skb = copied_skb;
+-		if (!copied_skb) {
+-			kaweth->stats.tx_errors++;
+-			netif_start_queue(net);
+-			spin_unlock_irq(&kaweth->device_lock);
+-			return NETDEV_TX_OK;
+-		}
++	if (skb_cow_head(skb, 2)) {
++		kaweth->stats.tx_errors++;
++		netif_start_queue(net);
++		spin_unlock_irq(&kaweth->device_lock);
++		dev_kfree_skb_any(skb);
++		return NETDEV_TX_OK;
+ 	}
+ 
+ 	private_header = (__le16 *)__skb_push(skb, 2);


From lede-commits at lists.infradead.org  Sun Apr 23 04:53:16 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 23 Apr 2017 07:53:16 -0400
Subject: [source]  kernel: use skb_cow_head() to deal with cloned skbs
In-Reply-To: <20170423115316.1329.33875@git-01.infra.lede-project.org>
References: <20170423115316.1329.33875@git-01.infra.lede-project.org>
Message-ID: <mailman.25589.1492948420.26984.lede-commits@lists.infradead.org>

noltari pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/1ab41265c39354332630bcba0ec704abd2e790f0

commit 1ab41265c39354332630bcba0ec704abd2e790f0
Author: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
AuthorDate: Sun Apr 23 13:55:03 2017 +0200

    kernel: use skb_cow_head() to deal with cloned skbs
    
    We need to ensure there is enough headroom to push extra header,
    but we also need to check if we are allowed to change headers.
    
    skb_cow_head() is the proper helper to deal with this.
    
    Fixes Ethernet<->WiFi bridge for Raspberry Pi and probably other devices.
    
    Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
---
 ...Use-skb_cow_head-to-deal-with-cloned-skbs.patch | 40 ++++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 36 ++++++++++++++++++
 ...-use-skb_cow_head-to-deal-with-cloned-skb.patch | 35 ++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 37 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 38 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 38 +++++++++++++++++++
 ...use-skb_cow_head-to-deal-with-cloned-skbs.patch | 43 ++++++++++++++++++++++
 7 files changed, 267 insertions(+)

diff --git a/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..36fb936
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,40 @@
+From e9156cd26a495a18706e796f02a81fee41ec14f4 Mon Sep 17 00:00:00 2001
+From: James Hughes <james.hughes at raspberrypi.org>
+Date: Wed, 19 Apr 2017 11:13:40 +0100
+Subject: [PATCH] smsc95xx: Use skb_cow_head to deal with cloned skbs
+
+The driver was failing to check that the SKB wasn't cloned
+before adding checksum data.
+Replace existing handling to extend/copy the header buffer
+with skb_cow_head.
+
+Signed-off-by: James Hughes <james.hughes at raspberrypi.org>
+Acked-by: Eric Dumazet <edumazet at google.com>
+Acked-by: Woojung Huh <Woojung.Huh at microchip.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/smsc95xx.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc95xx.c
++++ b/drivers/net/usb/smsc95xx.c
+@@ -1835,13 +1835,13 @@ static struct sk_buff *smsc95xx_tx_fixup
+ 	/* We do not advertise SG, so skbs should be already linearized */
+ 	BUG_ON(skb_shinfo(skb)->nr_frags);
+ 
+-	if (skb_headroom(skb) < overhead) {
+-		struct sk_buff *skb2 = skb_copy_expand(skb,
+-			overhead, 0, flags);
++	/* Make writable and expand header space by overhead if required */
++	if (skb_cow_head(skb, overhead)) {
++		/* Must deallocate here as returning NULL to indicate error
++		 * means the skb won't be deallocated in the caller.
++		 */
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	if (csum) {
diff --git a/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..6312f0f
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,36 @@
+From b7c6d2675899cfff0180412c63fc9cbd5bacdb4d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:21 -0700
+Subject: [PATCH] smsc75xx: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: d0cad871703b ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/smsc75xx.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc75xx.c
++++ b/drivers/net/usb/smsc75xx.c
+@@ -2193,13 +2193,9 @@ static struct sk_buff *smsc75xx_tx_fixup
+ {
+ 	u32 tx_cmd_a, tx_cmd_b;
+ 
+-	if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) {
+-		struct sk_buff *skb2 =
+-			skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, SMSC75XX_TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS;
diff --git a/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch b/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
new file mode 100644
index 0000000..aee8aa9
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
@@ -0,0 +1,35 @@
+From a9e840a2081ed28c2b7caa6a9a0041c950b3c37d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:22 -0700
+Subject: [PATCH] cx82310_eth: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: cc28a20e77b2 ("introduce cx82310_eth: Conexant CX82310-based ADSL router USB ethernet driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/cx82310_eth.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/usb/cx82310_eth.c
++++ b/drivers/net/usb/cx82310_eth.c
+@@ -293,12 +293,9 @@ static struct sk_buff *cx82310_tx_fixup(
+ {
+ 	int len = skb->len;
+ 
+-	if (skb_headroom(skb) < 2) {
+-		struct sk_buff *skb2 = skb_copy_expand(skb, 2, 0, flags);
++	if (skb_cow_head(skb, 2)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 	skb_push(skb, 2);
+ 
diff --git a/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..4d0fcf6
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,37 @@
+From d532c1082f68176363ed766d09bf187616e282fe Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:23 -0700
+Subject: [PATCH] sr9700: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: c9b37458e956 ("USB2NET : SR9700 : One chip USB 1.1 USB2NET SR9700Device Driver Support")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/sr9700.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/sr9700.c
++++ b/drivers/net/usb/sr9700.c
+@@ -456,14 +456,9 @@ static struct sk_buff *sr9700_tx_fixup(s
+ 
+ 	len = skb->len;
+ 
+-	if (skb_headroom(skb) < SR_TX_OVERHEAD) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, SR_TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, SR_TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	__skb_push(skb, SR_TX_OVERHEAD);
diff --git a/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..4f96041
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,38 @@
+From d4ca73591916b760478d2b04334d5dcadc028e9c Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:24 -0700
+Subject: [PATCH] lan78xx: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Cc: Woojung Huh <woojung.huh at microchip.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/lan78xx.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/lan78xx.c
++++ b/drivers/net/usb/lan78xx.c
+@@ -2050,14 +2050,9 @@ static struct sk_buff *lan78xx_tx_prep(s
+ {
+ 	u32 tx_cmd_a, tx_cmd_b;
+ 
+-	if (skb_headroom(skb) < TX_OVERHEAD) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, TX_OVERHEAD, 0, flags);
++	if (skb_cow_head(skb, TX_OVERHEAD)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	if (lan78xx_linearize(skb) < 0)
diff --git a/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..2e8bba5
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,38 @@
+From 6bc6895bdd6744e0136eaa4a11fbdb20a7db4e40 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:25 -0700
+Subject: [PATCH] ch9200: use skb_cow_head() to deal with cloned skbs
+
+We need to ensure there is enough headroom to push extra header,
+but we also need to check if we are allowed to change headers.
+
+skb_cow_head() is the proper helper to deal with this.
+
+Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices")
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Cc: Matthew Garrett <mjg59 at srcf.ucam.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/ch9200.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/ch9200.c
++++ b/drivers/net/usb/ch9200.c
+@@ -255,14 +255,9 @@ static struct sk_buff *ch9200_tx_fixup(s
+ 	tx_overhead = 0x40;
+ 
+ 	len = skb->len;
+-	if (skb_headroom(skb) < tx_overhead) {
+-		struct sk_buff *skb2;
+-
+-		skb2 = skb_copy_expand(skb, tx_overhead, 0, flags);
++	if (skb_cow_head(skb, tx_overhead)) {
+ 		dev_kfree_skb_any(skb);
+-		skb = skb2;
+-		if (!skb)
+-			return NULL;
++		return NULL;
+ 	}
+ 
+ 	__skb_push(skb, tx_overhead);
diff --git a/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
new file mode 100644
index 0000000..541c694
--- /dev/null
+++ b/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
@@ -0,0 +1,43 @@
+From 39fba7835aacda65284a86e611774cbba71dac20 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet at google.com>
+Date: Wed, 19 Apr 2017 09:59:26 -0700
+Subject: [PATCH] kaweth: use skb_cow_head() to deal with cloned skbs
+
+We can use skb_cow_head() to properly deal with clones,
+especially the ones coming from TCP stack that allow their head being
+modified. This avoids a copy.
+
+Signed-off-by: Eric Dumazet <edumazet at google.com>
+Cc: James Hughes <james.hughes at raspberrypi.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/usb/kaweth.c | 18 ++++++------------
+ 1 file changed, 6 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/usb/kaweth.c
++++ b/drivers/net/usb/kaweth.c
+@@ -812,18 +812,12 @@ static netdev_tx_t kaweth_start_xmit(str
+ 	}
+ 
+ 	/* We now decide whether we can put our special header into the sk_buff */
+-	if (skb_cloned(skb) || skb_headroom(skb) < 2) {
+-		/* no such luck - we make our own */
+-		struct sk_buff *copied_skb;
+-		copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC);
+-		dev_kfree_skb_irq(skb);
+-		skb = copied_skb;
+-		if (!copied_skb) {
+-			kaweth->stats.tx_errors++;
+-			netif_start_queue(net);
+-			spin_unlock_irq(&kaweth->device_lock);
+-			return NETDEV_TX_OK;
+-		}
++	if (skb_cow_head(skb, 2)) {
++		kaweth->stats.tx_errors++;
++		netif_start_queue(net);
++		spin_unlock_irq(&kaweth->device_lock);
++		dev_kfree_skb_any(skb);
++		return NETDEV_TX_OK;
+ 	}
+ 
+ 	private_header = (__le16 *)__skb_push(skb, 2);


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:13 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:13 -0400
Subject: [source]  ipq8064: Fix dwc3 module unloading
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25722.1493029245.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/8db079a9ff1756059250b801617a20baba214684

commit 8db079a9ff1756059250b801617a20baba214684
Author: Thomas Reifferscheid <thomas at reifferscheid.org>
AuthorDate: Fri Apr 7 12:25:10 2017 +0200

    ipq8064: Fix dwc3 module unloading
    
    The patch follows the qualcomm code comments setting
    SSUSB_CTRL_TEST_POWERDOWN to 0x1 and is testing and clearing the
    bit during USB superspeed PHY init. According to Andy Gross it
    needs to be BIT(26).
    
    Signed-off-by: Thomas Reifferscheid <thomas at reifferscheid.org>
    Acked-by: Andy Gross <andy.gross at linaro.org>
---
 .../ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch b/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch
index 39e918f..261836e 100644
--- a/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch
+++ b/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch
@@ -39,7 +39,7 @@ Signed-off-by: Andy Gross <agross at codeaurora.org>
 +obj-$(CONFIG_PHY_QCOM_DWC3)		+= phy-qcom-dwc3.o
 --- /dev/null
 +++ b/drivers/phy/phy-qcom-dwc3.c
-@@ -0,0 +1,484 @@
+@@ -0,0 +1,492 @@
 +/* Copyright (c) 2014-2015, Code Aurora Forum. All rights reserved.
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -99,7 +99,7 @@ Signed-off-by: Andy Gross <agross at codeaurora.org>
 +
 +/* PHY_CTRL_REG */
 +#define SSUSB_CTRL_REF_USE_PAD		BIT(28)
-+#define SSUSB_CTRL_TEST_POWERDOWN	BIT(27)
++#define SSUSB_CTRL_TEST_POWERDOWN	BIT(26)
 +#define SSUSB_CTRL_LANE0_PWR_PRESENT	BIT(24)
 +#define SSUSB_CTRL_SS_PHY_EN		BIT(8)
 +#define SSUSB_CTRL_SS_PHY_RESET		BIT(7)
@@ -331,6 +331,14 @@ Signed-off-by: Andy Gross <agross at codeaurora.org>
 +
 +	/* reset phy */
 +	data = readl(phy_dwc3->base + SSUSB_PHY_CTRL_REG);
++
++       /* Test and clear SSUSB_CTRL_TEST_POWERDOWN */
++       if (data & SSUSB_CTRL_TEST_POWERDOWN) {
++               qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_CTRL_REG,
++                               SSUSB_CTRL_TEST_POWERDOWN, 0x0);
++               data = readl(phy_dwc3->base + SSUSB_PHY_CTRL_REG);
++       }
++
 +	writel(data | SSUSB_CTRL_SS_PHY_RESET,
 +		phy_dwc3->base + SSUSB_PHY_CTRL_REG);
 +	usleep_range(2000, 2200);
@@ -420,7 +428,7 @@ Signed-off-by: Andy Gross <agross at codeaurora.org>
 +	qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_CTRL_REG,
 +		SSUSB_CTRL_REF_USE_PAD, 0x0);
 +	qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_CTRL_REG,
-+		SSUSB_CTRL_TEST_POWERDOWN, 0x0);
++		SSUSB_CTRL_TEST_POWERDOWN, SSUSB_CTRL_TEST_POWERDOWN);
 +
 +	return 0;
 +}


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:18 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:18 -0400
Subject: [source] include/image.mk: allow passing a compat string to the
 NAND image template
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25723.1493029245.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/003e15221a353a1162c7253c01864893469b66f4

commit 003e15221a353a1162c7253c01864893469b66f4
Author: John Crispin <john at phrozen.org>
AuthorDate: Mon Apr 24 11:10:39 2017 +0200

    include/image.mk: allow passing a compat string to the NAND image template
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 include/image.mk | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index cc90a14..ad9535d 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -210,14 +210,15 @@ endef
 # $(1): board name
 # $(2): rootfs type
 # $(3): kernel image
+# $(4): compat string
 ifneq ($(CONFIG_NAND_SUPPORT),)
    define Image/Build/SysupgradeNAND
-	mkdir -p "$(KDIR_TMP)/sysupgrade-$(1)/"
-	echo "BOARD=$(1)" > "$(KDIR_TMP)/sysupgrade-$(1)/CONTROL"
-	[ -z "$(2)" ] || $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(1)/root"
-	[ -z "$(3)" ] || $(CP) "$(3)" "$(KDIR_TMP)/sysupgrade-$(1)/kernel"
+	mkdir -p "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/"
+	echo "BOARD=$(if $(4),$(4),$(1))" > "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/CONTROL"
+	[ -z "$(2)" ] || $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/root"
+	[ -z "$(3)" ] || $(CP) "$(3)" "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/kernel"
 	(cd "$(KDIR_TMP)"; $(TAR) cvf \
-		"$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(1) \
+		"$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(if $(4),$(4),$(1)) \
 			$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
 	)
    endef


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:14 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:14 -0400
Subject: [source] ipq8064: fix dwc3-of-simple module unloading for Netgear
 R7500
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25724.1493029247.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/956e31b1e447a3a3d5cc4c17cda089ccb49b0f29

commit 956e31b1e447a3a3d5cc4c17cda089ccb49b0f29
Author: Thomas Reifferscheid <thomas at reifferscheid.org>
AuthorDate: Mon Apr 3 00:34:34 2017 +0200

    ipq8064: fix dwc3-of-simple module unloading for Netgear R7500
    
    Without patch unloading the dwc3-of-simple module went stuck after
    successfully removing hcd.1 during the hcd.0 removal:
    
    root at LEDE:/# rmmod dwc3-of-simple
    [   21.391846] xhci-hcd xhci-hcd.1.auto: remove, state 1
    [   21.391931] usb usb4: USB disconnect, device number 1
    [   21.397038] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
    [   21.401111] xhci-hcd xhci-hcd.1.auto: remove, state 1
    [   21.406685] usb usb3: USB disconnect, device number 1
    [   21.412848] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered
    [   21.417248] xhci-hcd xhci-hcd.0.auto: remove, state 1
    [   21.422521] usb usb2: USB disconnect, device number 1
    followed by nothing.
    
    Sometimes a stall CPU was detected, or a kernel panic,
    or a reboot occurred after a couple of minutes.
    
    At the same time unloading the dwc3 module followed by dwc3-of-simple
    module was working repeatedly.
    
    root at LEDE:/# rmmod dwc3
    [   53.827328] xhci-hcd xhci-hcd.1.auto: remove, state 1
    [   53.827412] usb usb4: USB disconnect, device number 1
    [   53.832630] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
    [   53.836452] xhci-hcd xhci-hcd.1.auto: remove, state 1
    [   53.842314] usb usb3: USB disconnect, device number 1
    [   53.848412] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered
    [   53.852542] xhci-hcd xhci-hcd.0.auto: remove, state 1
    [   53.857882] usb usb2: USB disconnect, device number 1
    [   53.863956] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
    [   53.867875] xhci-hcd xhci-hcd.0.auto: remove, state 1
    [   53.873696] usb usb1: USB disconnect, device number 1
    [   53.879742] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
    root at LEDE:/# rmmod dwc3-of-simple
    root at LEDE:/#
    
    For the non-working case, the code was stuck in a readl() in
    http://lxr.free-electrons.com/source/drivers/usb/host/xhci.c#L91
    because
    http://lxr.free-electrons.com/source/drivers/usb/dwc3/dwc3-of-simple.c#L126
    was disabling the wrong clocks when removing hcd.1 (it was disabling
    the clock of hcd.0). That's why the readl() went stuck when removing
    hcd.0
    
    The patch however addresses the clock assignment from the Netgear R7500
    dts file and backs off the previous attempt.
    
    Now unloading and repeated module loading is working just fine.
    
    root at LEDE:/# rmmod dwc3-of-simple
    [   24.089679] xhci-hcd xhci-hcd.1.auto: remove, state 1
    [   24.089765] usb usb4: USB disconnect, device number 1
    [   24.094856] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
    [   24.098963] xhci-hcd xhci-hcd.1.auto: remove, state 1
    [   24.104522] usb usb3: USB disconnect, device number 1
    [   24.111194] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered
    [   24.115086] xhci-hcd xhci-hcd.0.auto: remove, state 1
    [   24.120396] usb usb2: USB disconnect, device number 1
    [   24.126503] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
    [   24.130347] xhci-hcd xhci-hcd.0.auto: remove, state 1
    [   24.135948] usb usb1: USB disconnect, device number 1
    [   24.142085] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
    root at LEDE:/#
    
    Fixes: dwc3-of-simple module unloading for Netgear R7500
    
    Signed-off-by: Thomas Reifferscheid <thomas at reifferscheid.org>
---
 .../arch/arm/boot/dts/qcom-ipq8064-r7500.dts       |  6 +++++
 .../files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi  | 28 +++++++++++-----------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
index b31f34c..2ea856d 100644
--- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
+++ b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
@@ -133,26 +133,32 @@
 		};
 
 		phy at 100f8800 {		/* USB3 port 1 HS phy */
+			clocks = <&gcc USB30_0_UTMI_CLK>;
 			status = "ok";
 		};
 
 		phy at 100f8830 {		/* USB3 port 1 SS phy */
+			clocks = <&gcc USB30_0_MASTER_CLK>;
 			status = "ok";
 		};
 
 		phy at 110f8800 {		/* USB3 port 0 HS phy */
+			clocks = <&gcc USB30_1_UTMI_CLK>;
 			status = "ok";
 		};
 
 		phy at 110f8830 {		/* USB3 port 0 SS phy */
+			clocks = <&gcc USB30_1_MASTER_CLK>;
 			status = "ok";
 		};
 
 		usb30 at 0 {
+			clocks = <&gcc USB30_1_MASTER_CLK>;
 			status = "ok";
 		};
 
 		usb30 at 1 {
+			clocks = <&gcc USB30_0_MASTER_CLK>;
 			status = "ok";
 		};
 
diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi
index 296e7ba..9996bd7 100644
--- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -918,9 +918,9 @@
 			reg = <0x01200600 0x100>;
 		};
 
-		hs_phy_1: phy at 110f8800 {
+		hs_phy_1: phy at 100f8800 {
 			compatible = "qcom,dwc3-hs-usb-phy";
-			reg = <0x110f8800 0x30>;
+			reg = <0x100f8800 0x30>;
 			clocks = <&gcc USB30_1_UTMI_CLK>;
 			clock-names = "ref";
 			#phy-cells = <0>;
@@ -928,9 +928,9 @@
 			status = "disabled";
 		};
 
-		ss_phy_1: phy at 110f8830 {
+		ss_phy_1: phy at 100f8830 {
 			compatible = "qcom,dwc3-ss-usb-phy";
-			reg = <0x110f8830 0x30>;
+			reg = <0x100f8830 0x30>;
 			clocks = <&gcc USB30_1_MASTER_CLK>;
 			clock-names = "ref";
 			#phy-cells = <0>;
@@ -938,9 +938,9 @@
 			status = "disabled";
 		};
 
-		hs_phy_0: phy at 100f8800 {
+		hs_phy_0: phy at 110f8800 {
 			compatible = "qcom,dwc3-hs-usb-phy";
-			reg = <0x100f8800 0x30>;
+			reg = <0x110f8800 0x30>;
 			clocks = <&gcc USB30_0_UTMI_CLK>;
 			clock-names = "ref";
 			#phy-cells = <0>;
@@ -948,9 +948,9 @@
 			status = "disabled";
 		};
 
-		ss_phy_0: phy at 100f8830 {
+		ss_phy_0: phy at 110f8830 {
 			compatible = "qcom,dwc3-ss-usb-phy";
-			reg = <0x100f8830 0x30>;
+			reg = <0x110f8830 0x30>;
 			clocks = <&gcc USB30_0_MASTER_CLK>;
 			clock-names = "ref";
 			#phy-cells = <0>;
@@ -969,10 +969,10 @@
 
 			status = "disabled";
 
-			dwc3 at 10000000 {
+			dwc3 at 11000000 {
 				compatible = "snps,dwc3";
-				reg = <0x10000000 0xcd00>;
-				interrupts = <0 205 0x4>;
+				reg = <0x11000000 0xcd00>;
+				interrupts = <0 110 0x4>;
 				phys = <&hs_phy_0>, <&ss_phy_0>;
 				phy-names = "usb2-phy", "usb3-phy";
 				dr_mode = "host";
@@ -991,10 +991,10 @@
 
 			status = "disabled";
 
-			dwc3 at 11000000 {
+			dwc3 at 10000000 {
 				compatible = "snps,dwc3";
-				reg = <0x11000000 0xcd00>;
-				interrupts = <0 110 0x4>;
+				reg = <0x10000000 0xcd00>;
+				interrupts = <0 205 0x4>;
 				phys = <&hs_phy_1>, <&ss_phy_1>;
 				phy-names = "usb2-phy", "usb3-phy";
 				dr_mode = "host";


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:15 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:15 -0400
Subject: [source]  mediatek: fix support for gmac1 using external PHY
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25725.1493029249.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/f3bae0fa4b2e2e3eea64102eb40cd0dffb59f9d3

commit f3bae0fa4b2e2e3eea64102eb40cd0dffb59f9d3
Author: John Crispin <john at phrozen.org>
AuthorDate: Fri Apr 21 09:40:01 2017 +0200

    mediatek: fix support for gmac1 using external PHY
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 target/linux/mediatek/config-4.9                   |  1 +
 .../files/arch/arm/boot/dts/mt7623-NAND.dts        | 27 +++++++++-
 .../files/arch/arm/boot/dts/mt7623-eMMC.dts        | 59 ++++++++++++++++++++++
 target/linux/mediatek/patches-4.9/0095-ephy.patch  | 30 +++++++++++
 4 files changed, 115 insertions(+), 2 deletions(-)

diff --git a/target/linux/mediatek/config-4.9 b/target/linux/mediatek/config-4.9
index 1d77275..88332e4 100644
--- a/target/linux/mediatek/config-4.9
+++ b/target/linux/mediatek/config-4.9
@@ -218,6 +218,7 @@ CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_MT65XX=y
+CONFIG_ICPLUS_PHY=y
 CONFIG_IIO=y
 # CONFIG_IIO_BUFFER is not set
 # CONFIG_IIO_TRIGGER is not set
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
index d90e0fb..072ebe7 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
@@ -454,6 +454,14 @@
 &gmac1 {
 	mac-address = [00 11 22 33 44 56];
 	status = "okay";
+
+	phy-mode = "trgmii";
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+		pause;
+	};
 };
 
 &gmac2 {
@@ -490,29 +498,45 @@
 			port at 0 {
 				reg = <0>;
 				label = "lan0";
+				cpu = <&cpu_port0>;
 			};
 
 			port at 1 {
 				reg = <1>;
 				label = "lan1";
+				cpu = <&cpu_port0>;
 			};
 
 			port at 2 {
 				reg = <2>;
 				label = "lan2";
+				cpu = <&cpu_port0>;
 			};
 
 			port at 3 {
 				reg = <3>;
 				label = "lan3";
+				cpu = <&cpu_port0>;
 			};
 
 			port at 4 {
 				reg = <4>;
 				label = "wan";
+				cpu = <&cpu_port1>;
 			};
 
-			port at 6 {
+			cpu_port1: port at 5 {
+				reg = <5>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "trgmii";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			cpu_port0: port at 6 {
 				reg = <6>;
 				label = "cpu";
 				ethernet = <&gmac1>;
@@ -526,7 +550,6 @@
 	};
 };
 
-
 &pwm {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pwm_pins>;
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
index 86c4dd5..36b0065 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
@@ -474,6 +474,65 @@
 &gmac2 {
 	mac-address = [00 11 22 33 44 55];
 	status = "okay";
+
+	phy-handle = <&phy5>;
+};
+
+&mdio0 {
+	switch at 0 {
+		compatible = "mediatek,mt7530";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&eth_default>;
+
+		core-supply = <&mt6323_vpa_reg>;
+		io-supply = <&mt6323_vemc3v3_reg>;
+		reset-gpios = <&pio 33 0>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0>;
+			port at 0 {
+				reg = <0>;
+				label = "lan0";
+			};
+
+			port at 1 {
+				reg = <1>;
+				label = "lan1";
+			};
+
+			port at 2 {
+				reg = <2>;
+				label = "lan2";
+			};
+
+			port at 3 {
+				reg = <3>;
+				label = "lan3";
+			};
+
+			port at 6 {
+				reg = <6>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "trgmii";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+		};
+	};
+
+	phy5: ethernet-phy at 5 {
+		reg = <5>;
+		phy-mode = "rgmii-rxid";
+	};
 };
 
 &pwm {
diff --git a/target/linux/mediatek/patches-4.9/0095-ephy.patch b/target/linux/mediatek/patches-4.9/0095-ephy.patch
new file mode 100644
index 0000000..52d8299
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0095-ephy.patch
@@ -0,0 +1,30 @@
+Index: linux-4.9.20/drivers/net/dsa/mt7530.c
+===================================================================
+--- linux-4.9.20.orig/drivers/net/dsa/mt7530.c
++++ linux-4.9.20/drivers/net/dsa/mt7530.c
+@@ -629,6 +629,11 @@ mt7530_setup(struct dsa_switch *ds)
+ 	val = mt7530_read(priv, MT7530_MHWTRAP);
+ 	val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
+ 	val |= MHWTRAP_MANUAL;
++	if (!dsa_is_cpu_port(ds, 5)) {
++		val |= MHWTRAP_P5_DIS;
++		val |= MHWTRAP_P5_MAC_SEL;
++		val |= MHWTRAP_P5_RGMII_MODE;
++	}
+ 	mt7530_write(priv, MT7530_MHWTRAP, val);
+ 
+ 	/* Enable and reset MIB counters */
+Index: linux-4.9.20/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+===================================================================
+--- linux-4.9.20.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ linux-4.9.20/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -221,6 +221,9 @@ static void mtk_phy_link_adjust(struct n
+ 		netif_carrier_on(dev);
+ 	else
+ 		netif_carrier_off(dev);
++
++	if (!of_phy_is_fixed_link(mac->of_node))
++		phy_print_status(dev->phydev);
+ }
+ 
+ static int mtk_phy_connect_node(struct mtk_eth *eth, struct mtk_mac *mac,


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:19 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:19 -0400
Subject: [source]  mediatek: fix sysupgrade board detection
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25726.1493029249.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/da352c46235a69d333277b52c1d98fe334b94d9f

commit da352c46235a69d333277b52c1d98fe334b94d9f
Author: John Crispin <john at phrozen.org>
AuthorDate: Mon Apr 10 06:45:59 2017 +0200

    mediatek: fix sysupgrade board detection
    
    boardnames were changed with the recent target update. the sysupgrade board
    detection was not updated properly.
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 target/linux/mediatek/base-files/lib/upgrade/platform.sh | 8 +++++---
 target/linux/mediatek/image/Makefile                     | 7 +++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/target/linux/mediatek/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/base-files/lib/upgrade/platform.sh
index f2dd453..9a844bc 100755
--- a/target/linux/mediatek/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/base-files/lib/upgrade/platform.sh
@@ -20,11 +20,12 @@ platform_check_image() {
 	local board=$(cat /tmp/sysinfo/board_name)
 
 	case "$board" in
-	NAND)
+	mediatek,mt7623-rfb-nand-ephy |\
+	mediatek,mt7623-rfb-nand)
 		nand_do_platform_check $board $1
 		return $?
 		;;
-	eMMC)
+	mediatek,mt7623-rfb-emmc)
 		local kernel_length=`(tar xf $tar_file sysupgrade-$board/kernel -O | wc -c) 2> /dev/null`
 		local rootfs_length=`(tar xf $tar_file sysupgrade-$board/root -O | wc -c) 2> /dev/null`
 		;;
@@ -46,7 +47,8 @@ platform_check_image() {
 platform_pre_upgrade() {
 	local board=$(cat /tmp/sysinfo/board_name)
 	case "$board" in
-	NAND)
+	mediatek,mt7623-rfb-nand-ephy |\
+	mediatek,mt7623-rfb-nand)
 		nand_do_upgrade $1
 		;;
 	esac
diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile
index ac42691..177e4f7 100644
--- a/target/linux/mediatek/image/Makefile
+++ b/target/linux/mediatek/image/Makefile
@@ -25,6 +25,9 @@ endif
 	)
 endef
 
+COMPAT_NAND:=mediatek,mt7623-rfb-nand
+COMPAT_NAND_EPHY:=mediatek,mt7623-rfb-nand-ephy
+
 define Image/Build/squashfs
 	$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
 	$(CP) $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
@@ -39,8 +42,8 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 	$(CP) $(KDIR)/uImage-NAND-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-initramfs
 	$(CP) $(KDIR)/uImage-NAND-ePHY-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-ePHY-initramfs
 endif
-	$(call Image/Build/SysupgradeNAND,NAND,$(1),$(KDIR)/uImage-NAND)
-	$(call Image/Build/SysupgradeNAND,NAND-ePHY,$(1),$(KDIR)/uImage-NAND-ePHY)
+	$(call Image/Build/SysupgradeNAND,NAND,$(1),$(KDIR)/uImage-NAND,$$(COMPAT_NAND))
+	$(call Image/Build/SysupgradeNAND,NAND-ePHY,$(1),$(KDIR)/uImage-NAND-ePHY,$$(COMPAT_NAND_EPHY))
 endef
 
 define Image/Build


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:16 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:16 -0400
Subject: [source]  mediatek: add DSA multi cpu port support
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25727.1493029249.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/4c6ae885c5796c94976bc5aaca071fe8f8b47f39

commit 4c6ae885c5796c94976bc5aaca071fe8f8b47f39
Author: John Crispin <john at phrozen.org>
AuthorDate: Mon Apr 24 09:21:11 2017 +0200

    mediatek: add DSA multi cpu port support
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 .../mediatek/patches-4.9/0096-dsa-multi-cpu.patch  | 268 +++++++++++++++++++++
 .../mediatek/patches-4.9/0097-dsa-mt7530.patch     |  83 +++++++
 2 files changed, 351 insertions(+)

diff --git a/target/linux/mediatek/patches-4.9/0096-dsa-multi-cpu.patch b/target/linux/mediatek/patches-4.9/0096-dsa-multi-cpu.patch
new file mode 100644
index 0000000..2a562e1
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0096-dsa-multi-cpu.patch
@@ -0,0 +1,268 @@
+Index: linux-4.9.20/drivers/net/dsa/mt7530.c
+===================================================================
+--- linux-4.9.20.orig/drivers/net/dsa/mt7530.c
++++ linux-4.9.20/drivers/net/dsa/mt7530.c
+@@ -996,15 +996,7 @@ err:
+ static enum dsa_tag_protocol
+ mtk_get_tag_protocol(struct dsa_switch *ds)
+ {
+-	struct mt7530_priv *priv = ds->priv;
+-
+-	if (!dsa_is_cpu_port(ds, MT7530_CPU_PORT)) {
+-		dev_warn(priv->dev,
+-			 "port not matched with tagging CPU port\n");
+-		return DSA_TAG_PROTO_NONE;
+-	} else {
+-		return DSA_TAG_PROTO_MTK;
+-	}
++	return DSA_TAG_PROTO_MTK;
+ }
+ 
+ static struct dsa_switch_ops mt7530_switch_ops = {
+Index: linux-4.9.20/include/net/dsa.h
+===================================================================
+--- linux-4.9.20.orig/include/net/dsa.h
++++ linux-4.9.20/include/net/dsa.h
+@@ -145,6 +145,8 @@ struct dsa_port {
+ 	struct device_node	*dn;
+ 	unsigned int		ageing_time;
+ 	u8			stp_state;
++	struct net_device	*ethernet;
++	int			upstream;
+ };
+ 
+ struct dsa_switch {
+@@ -205,7 +207,7 @@ struct dsa_switch {
+ 
+ static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
+ {
+-	return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
++	return !!(ds->cpu_port_mask & (1 << p));
+ }
+ 
+ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
+@@ -218,6 +220,11 @@ static inline bool dsa_is_port_initializ
+ 	return ds->enabled_port_mask & (1 << p) && ds->ports[p].netdev;
+ }
+ 
++static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int p)
++{
++	return dsa_is_cpu_port(ds, p) || dsa_is_dsa_port(ds, p);
++}
++
+ static inline u8 dsa_upstream_port(struct dsa_switch *ds)
+ {
+ 	struct dsa_switch_tree *dst = ds->dst;
+@@ -234,6 +241,18 @@ static inline u8 dsa_upstream_port(struc
+ 		return ds->rtable[dst->cpu_switch];
+ }
+ 
++static inline u8 dsa_port_upstream_port(struct dsa_switch *ds, int port)
++{
++	/*
++	 * If this port has a specific upstream cpu port, use it,
++	 * otherwise use the switch default.
++	 */
++	if (ds->ports[port].upstream)
++		return ds->ports[port].upstream;
++	else
++		return dsa_upstream_port(ds);
++}
++
+ struct switchdev_trans;
+ struct switchdev_obj;
+ struct switchdev_obj_port_fdb;
+Index: linux-4.9.20/net/dsa/dsa2.c
+===================================================================
+--- linux-4.9.20.orig/net/dsa/dsa2.c
++++ linux-4.9.20/net/dsa/dsa2.c
+@@ -248,8 +248,6 @@ static int dsa_cpu_port_apply(struct dev
+ 		return err;
+ 	}
+ 
+-	ds->cpu_port_mask |= BIT(index);
+-
+ 	return 0;
+ }
+ 
+@@ -259,6 +257,10 @@ static void dsa_cpu_port_unapply(struct
+ 	dsa_cpu_dsa_destroy(port);
+ 	ds->cpu_port_mask &= ~BIT(index);
+ 
++	if (ds->ports[index].ethernet) {
++		dev_put(ds->ports[index].ethernet);
++		ds->ports[index].ethernet = NULL;
++	}
+ }
+ 
+ static int dsa_user_port_apply(struct device_node *port, u32 index,
+@@ -479,6 +481,29 @@ static int dsa_cpu_parse(struct device_n
+ 
+ 	dst->rcv = dst->tag_ops->rcv;
+ 
++	dev_hold(ethernet_dev);
++	ds->ports[index].ethernet = ethernet_dev;
++	ds->cpu_port_mask |= BIT(index);
++
++	return 0;
++}
++
++static int dsa_user_parse(struct device_node *port, u32 index,
++			  struct dsa_switch *ds)
++{
++	struct device_node *cpu_port;
++	const unsigned int *cpu_port_reg;
++	int cpu_port_index;
++
++	cpu_port = of_parse_phandle(port, "cpu", 0);
++	if (cpu_port) {
++		cpu_port_reg = of_get_property(cpu_port, "reg", NULL);
++		if (!cpu_port_reg)
++			return -EINVAL;
++		cpu_port_index = be32_to_cpup(cpu_port_reg);
++		ds->ports[index].upstream = cpu_port_index;
++	}
++
+ 	return 0;
+ }
+ 
+@@ -486,18 +511,19 @@ static int dsa_ds_parse(struct dsa_switc
+ {
+ 	struct device_node *port;
+ 	u32 index;
+-	int err;
++	int err = 0;
+ 
+ 	for (index = 0; index < DSA_MAX_PORTS; index++) {
+ 		port = ds->ports[index].dn;
+ 		if (!port)
+ 			continue;
+ 
+-		if (dsa_port_is_cpu(port)) {
++		if (dsa_port_is_cpu(port))
+ 			err = dsa_cpu_parse(port, index, dst, ds);
+-			if (err)
+-				return err;
+-		}
++		else if (!dsa_port_is_dsa(port))
++			err = dsa_user_parse(port, index,  ds);
++		if (err)
++			return err;
+ 	}
+ 
+ 	pr_info("DSA: switch %d %d parsed\n", dst->tree, ds->index);
+Index: linux-4.9.20/net/dsa/dsa_priv.h
+===================================================================
+--- linux-4.9.20.orig/net/dsa/dsa_priv.h
++++ linux-4.9.20/net/dsa/dsa_priv.h
+@@ -43,6 +43,7 @@ struct dsa_slave_priv {
+ 	int			old_duplex;
+ 
+ 	struct net_device	*bridge_dev;
++	struct net_device	*master;
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ 	struct netpoll		*netpoll;
+ #endif
+Index: linux-4.9.20/net/dsa/slave.c
+===================================================================
+--- linux-4.9.20.orig/net/dsa/slave.c
++++ linux-4.9.20/net/dsa/slave.c
+@@ -61,7 +61,7 @@ static int dsa_slave_get_iflink(const st
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+ 
+-	return p->parent->dst->master_netdev->ifindex;
++	return p->master->ifindex;
+ }
+ 
+ static inline bool dsa_port_is_bridged(struct dsa_slave_priv *p)
+@@ -96,7 +96,7 @@ static void dsa_port_set_stp_state(struc
+ static int dsa_slave_open(struct net_device *dev)
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+-	struct net_device *master = p->parent->dst->master_netdev;
++	struct net_device *master = p->master;
+ 	struct dsa_switch *ds = p->parent;
+ 	u8 stp_state = dsa_port_is_bridged(p) ?
+ 			BR_STATE_BLOCKING : BR_STATE_FORWARDING;
+@@ -151,7 +151,7 @@ out:
+ static int dsa_slave_close(struct net_device *dev)
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+-	struct net_device *master = p->parent->dst->master_netdev;
++	struct net_device *master = p->master;
+ 	struct dsa_switch *ds = p->parent;
+ 
+ 	if (p->phy)
+@@ -178,7 +178,7 @@ static int dsa_slave_close(struct net_de
+ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+-	struct net_device *master = p->parent->dst->master_netdev;
++	struct net_device *master = p->master;
+ 
+ 	if (change & IFF_ALLMULTI)
+ 		dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
+@@ -189,7 +189,7 @@ static void dsa_slave_change_rx_flags(st
+ static void dsa_slave_set_rx_mode(struct net_device *dev)
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+-	struct net_device *master = p->parent->dst->master_netdev;
++	struct net_device *master = p->master;
+ 
+ 	dev_mc_sync(master, dev);
+ 	dev_uc_sync(master, dev);
+@@ -198,7 +198,7 @@ static void dsa_slave_set_rx_mode(struct
+ static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+-	struct net_device *master = p->parent->dst->master_netdev;
++	struct net_device *master = p->master;
+ 	struct sockaddr *addr = a;
+ 	int err;
+ 
+@@ -633,7 +633,7 @@ static netdev_tx_t dsa_slave_xmit(struct
+ 	/* Queue the SKB for transmission on the parent interface, but
+ 	 * do not modify its EtherType
+ 	 */
+-	nskb->dev = p->parent->dst->master_netdev;
++	nskb->dev = p->master;
+ 	dev_queue_xmit(nskb);
+ 
+ 	return NETDEV_TX_OK;
+@@ -945,7 +945,7 @@ static int dsa_slave_netpoll_setup(struc
+ {
+ 	struct dsa_slave_priv *p = netdev_priv(dev);
+ 	struct dsa_switch *ds = p->parent;
+-	struct net_device *master = ds->dst->master_netdev;
++	struct net_device *master = p->master;
+ 	struct netpoll *netpoll;
+ 	int err = 0;
+ 
+@@ -1235,11 +1235,16 @@ int dsa_slave_create(struct dsa_switch *
+ 	struct net_device *master;
+ 	struct net_device *slave_dev;
+ 	struct dsa_slave_priv *p;
++	int port_cpu = ds->ports[port].upstream;
+ 	int ret;
+ 
+-	master = ds->dst->master_netdev;
+-	if (ds->master_netdev)
++	if (port_cpu && ds->ports[port_cpu].ethernet)
++		master = ds->ports[port_cpu].ethernet;
++	else if (ds->master_netdev)
+ 		master = ds->master_netdev;
++	else
++		master = ds->dst->master_netdev;
++	master->dsa_ptr = (void *)ds->dst;
+ 
+ 	slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
+ 				 NET_NAME_UNKNOWN, ether_setup);
+@@ -1265,6 +1270,7 @@ int dsa_slave_create(struct dsa_switch *
+ 	p->parent = ds;
+ 	p->port = port;
+ 	p->xmit = dst->tag_ops->xmit;
++	p->master = master;
+ 
+ 	p->old_pause = -1;
+ 	p->old_link = -1;
diff --git a/target/linux/mediatek/patches-4.9/0097-dsa-mt7530.patch b/target/linux/mediatek/patches-4.9/0097-dsa-mt7530.patch
new file mode 100644
index 0000000..9f785dd
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0097-dsa-mt7530.patch
@@ -0,0 +1,83 @@
+Index: linux-4.9.20/drivers/net/dsa/mt7530.c
+===================================================================
+--- linux-4.9.20.orig/drivers/net/dsa/mt7530.c
++++ linux-4.9.20/drivers/net/dsa/mt7530.c
+@@ -627,7 +627,7 @@ mt7530_setup(struct dsa_switch *ds)
+ 
+ 	/* Enable Port 6 only; P5 as GMAC5 which currently is not supported */
+ 	val = mt7530_read(priv, MT7530_MHWTRAP);
+-	val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
++	val &= ~MHWTRAP_P5_DIS & ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
+ 	val |= MHWTRAP_MANUAL;
+ 	if (!dsa_is_cpu_port(ds, 5)) {
+ 		val |= MHWTRAP_P5_DIS;
+@@ -735,6 +735,9 @@ static int
+ mt7530_cpu_port_enable(struct mt7530_priv *priv,
+ 		       int port)
+ {
++	u8 port_mask = 0;
++	int i;
++
+ 	/* Enable Mediatek header mode on the cpu port */
+ 	mt7530_write(priv, MT7530_PVC_P(port),
+ 		     PORT_SPEC_TAG);
+@@ -751,8 +754,12 @@ mt7530_cpu_port_enable(struct mt7530_pri
+ 	/* CPU port gets connected to all user ports of
+ 	 * the switch
+ 	 */
++	for (i = 0; i < MT7530_NUM_PORTS; i++)
++		if ((priv->ds->enabled_port_mask & BIT(i)) &&
++		    (dsa_port_upstream_port(priv->ds, i) == port))
++			port_mask |= BIT(i);
+ 	mt7530_write(priv, MT7530_PCR_P(port),
+-		     PCR_MATRIX(priv->ds->enabled_port_mask));
++		     PCR_MATRIX(port_mask));
+ 
+ 	return 0;
+ }
+@@ -762,6 +769,7 @@ mt7530_port_enable(struct dsa_switch *ds
+ 		   struct phy_device *phy)
+ {
+ 	struct mt7530_priv *priv = ds->priv;
++	u8 upstream = dsa_port_upstream_port(ds, port);
+ 
+ 	mutex_lock(&priv->reg_mutex);
+ 
+@@ -772,7 +780,7 @@ mt7530_port_enable(struct dsa_switch *ds
+ 	 * restore the port matrix if the port is the member of a certain
+ 	 * bridge.
+ 	 */
+-	priv->ports[port].pm |= PCR_MATRIX(BIT(MT7530_CPU_PORT));
++	priv->ports[port].pm |= PCR_MATRIX(BIT(upstream));
+ 	priv->ports[port].enable = true;
+ 	mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
+ 		   priv->ports[port].pm);
+@@ -835,7 +843,8 @@ mt7530_port_bridge_join(struct dsa_switc
+ 			struct net_device *bridge)
+ {
+ 	struct mt7530_priv *priv = ds->priv;
+-	u32 port_bitmap = BIT(MT7530_CPU_PORT);
++	u8 upstream = dsa_port_upstream_port(ds, port);
++	u32 port_bitmap = BIT(upstream);
+ 	int i;
+ 
+ 	mutex_lock(&priv->reg_mutex);
+@@ -873,6 +882,7 @@ static void
+ mt7530_port_bridge_leave(struct dsa_switch *ds, int port)
+ {
+ 	struct mt7530_priv *priv = ds->priv;
++	u8 upstream = dsa_port_upstream_port(ds, port);
+ 	int i;
+ 
+ 	mutex_lock(&priv->reg_mutex);
+@@ -898,8 +908,8 @@ mt7530_port_bridge_leave(struct dsa_swit
+ 	priv->bridge_dev[port] = NULL;
+ 	if (priv->ports[port].enable)
+ 		mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
+-			   PCR_MATRIX(BIT(MT7530_CPU_PORT)));
+-	priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT));
++			   PCR_MATRIX(BIT(upstream)));
++	priv->ports[port].pm = PCR_MATRIX(BIT(upstream));
+ 
+ 	mutex_unlock(&priv->reg_mutex);
+ }


From lede-commits at lists.infradead.org  Mon Apr 24 03:18:17 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 06:18:17 -0400
Subject: [source]  mediatek: add support for the NAND-ePHY board
In-Reply-To: <20170424101813.7148.42801@git-01.infra.lede-project.org>
References: <20170424101813.7148.42801@git-01.infra.lede-project.org>
Message-ID: <mailman.25730.1493029252.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/a02cb1f311218ef12cc5502e0841495ec7682100

commit a02cb1f311218ef12cc5502e0841495ec7682100
Author: John Crispin <john at phrozen.org>
AuthorDate: Fri Apr 21 09:38:52 2017 +0200

    mediatek: add support for the NAND-ePHY board
    
    This is the same as the NAND board but gmac1 is wired to an external phy.
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 .../mediatek/base-files/etc/board.d/02_network     |   6 +-
 .../files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts   | 527 +++++++++++++++++++++
 target/linux/mediatek/image/Makefile               |   4 +
 .../mediatek/patches-4.9/0200-devicetree.patch     |   3 +-
 4 files changed, 538 insertions(+), 2 deletions(-)

diff --git a/target/linux/mediatek/base-files/etc/board.d/02_network b/target/linux/mediatek/base-files/etc/board.d/02_network
index d772ab0..3617711 100755
--- a/target/linux/mediatek/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/base-files/etc/board.d/02_network
@@ -10,8 +10,12 @@ mediatek_setup_interfaces()
 
 	case $board in
 	'mediatek,mt7623-rfb-emmc' | \
+	'mediatek,mt7623-rfb-nand-ephy')
+		ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
+		ucidef_set_interface_wan eth1
+		;;
 	'mediatek,mt7623-rfb-nand')
-		ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
+		ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
 		ucidef_set_interface_wan wan
 		;;
 	esac
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts
new file mode 100644
index 0000000..035bdf5
--- /dev/null
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts
@@ -0,0 +1,527 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: John Crispin <blogic at openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+#include "_mt7623.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	model = "MediaTek MT7623 NAND reference board";
+	compatible = "mediatek,mt7623-rfb-nand-ephy", "mediatek,mt7623";
+
+	chosen {
+		stdout-path = &uart2;
+	};
+
+	memory {
+		reg = <0 0x80000000 0 0x20000000>;
+	};
+
+	usb_p1_vbus: regulator at 0 {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&pio 135 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+};
+
+&cpu0 {
+	proc-supply = <&mt6323_vproc_reg>;
+};
+
+&cpu1 {
+	proc-supply = <&mt6323_vproc_reg>;
+};
+
+&cpu2 {
+	proc-supply = <&mt6323_vproc_reg>;
+};
+
+&cpu3 {
+	proc-supply = <&mt6323_vproc_reg>;
+};
+
+&pwrap {
+	pmic: mt6323 {
+		compatible = "mediatek,mt6323";
+		interrupt-parent = <&pio>;
+		interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+
+		mt6323regulator: mt6323regulator{
+			compatible = "mediatek,mt6323-regulator";
+
+			mt6323_vproc_reg: buck_vproc{
+				regulator-name = "vproc";
+				regulator-min-microvolt = < 700000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <12500>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vsys_reg: buck_vsys{
+				regulator-name = "vsys";
+				regulator-min-microvolt = <1400000>;
+				regulator-max-microvolt = <2987500>;
+				regulator-ramp-delay = <25000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vpa_reg: buck_vpa{
+				regulator-name = "vpa";
+				regulator-min-microvolt = < 500000>;
+				regulator-max-microvolt = <3650000>;
+			};
+
+			mt6323_vtcxo_reg: ldo_vtcxo{
+				regulator-name = "vtcxo";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <90>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vcn28_reg: ldo_vcn28{
+				regulator-name = "vcn28";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <185>;
+			};
+
+			mt6323_vcn33_bt_reg: ldo_vcn33_bt{
+				regulator-name = "vcn33_bt";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3600000>;
+				regulator-enable-ramp-delay = <185>;
+			};
+
+			mt6323_vcn33_wifi_reg: ldo_vcn33_wifi{
+				regulator-name = "vcn33_wifi";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3600000>;
+				regulator-enable-ramp-delay = <185>;
+			};
+
+			mt6323_va_reg: ldo_va{
+				regulator-name = "va";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <216>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vcama_reg: ldo_vcama{
+				regulator-name = "vcama";
+				regulator-min-microvolt = <1500000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vio28_reg: ldo_vio28{
+				regulator-name = "vio28";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <216>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vusb_reg: ldo_vusb{
+				regulator-name = "vusb";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <216>;
+				regulator-boot-on;
+			};
+
+			mt6323_vmc_reg: ldo_vmc{
+				regulator-name = "vmc";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <36>;
+				regulator-boot-on;
+			};
+
+			mt6323_vmch_reg: ldo_vmch{
+				regulator-name = "vmch";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <36>;
+				regulator-boot-on;
+			};
+
+			mt6323_vemc3v3_reg: ldo_vemc3v3{
+				regulator-name = "vemc3v3";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <36>;
+				regulator-boot-on;
+			};
+
+			mt6323_vgp1_reg: ldo_vgp1{
+				regulator-name = "vgp1";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vgp2_reg: ldo_vgp2{
+				regulator-name = "vgp2";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vgp3_reg: ldo_vgp3{
+				regulator-name = "vgp3";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vcn18_reg: ldo_vcn18{
+				regulator-name = "vcn18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vsim1_reg: ldo_vsim1{
+				regulator-name = "vsim1";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vsim2_reg: ldo_vsim2{
+				regulator-name = "vsim2";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vrtc_reg: ldo_vrtc{
+				regulator-name = "vrtc";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vcamaf_reg: ldo_vcamaf{
+				regulator-name = "vcamaf";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vibr_reg: ldo_vibr{
+				regulator-name = "vibr";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <36>;
+			};
+
+			mt6323_vrf18_reg: ldo_vrf18{
+				regulator-name = "vrf18";
+				regulator-min-microvolt = <1825000>;
+				regulator-max-microvolt = <1825000>;
+				regulator-enable-ramp-delay = <187>;
+			};
+
+			mt6323_vm_reg: ldo_vm{
+				regulator-name = "vm";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <216>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vio18_reg: ldo_vio18{
+				regulator-name = "vio18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <216>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6323_vcamd_reg: ldo_vcamd{
+				regulator-name = "vcamd";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+
+			mt6323_vcamio_reg: ldo_vcamio{
+				regulator-name = "vcamio";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <216>;
+			};
+		};
+
+		mt6323led: leds {
+			compatible = "mediatek,mt6323-led";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led at 0 {
+				reg = <0>;
+				label = "LED0";
+				linux,default-trigger = "timer";
+				default-state = "on";
+			};
+			led at 1 {
+				reg = <1>;
+				label = "LED1";
+				default-state = "off";
+			};
+			led at 2 {
+				reg = <2>;
+				label = "LED2";
+				default-state = "on";
+			};
+			led at 3 {
+				reg = <3>;
+				label = "LED3";
+				default-state = "on";
+			};
+		};
+	};
+};
+
+&uart2 {
+	status = "okay";
+};
+
+&pio {
+	nand_pins_default: nanddefault {
+		pins_dat {
+			pinmux = <MT7623_PIN_111_MSDC0_DAT7_FUNC_NLD7>,
+				 <MT7623_PIN_112_MSDC0_DAT6_FUNC_NLD6>,
+				 <MT7623_PIN_114_MSDC0_DAT4_FUNC_NLD4>,
+				 <MT7623_PIN_118_MSDC0_DAT3_FUNC_NLD3>,
+				 <MT7623_PIN_121_MSDC0_DAT0_FUNC_NLD0>,
+				 <MT7623_PIN_120_MSDC0_DAT1_FUNC_NLD1>,
+				 <MT7623_PIN_113_MSDC0_DAT5_FUNC_NLD5>,
+				 <MT7623_PIN_115_MSDC0_RSTB_FUNC_NLD8>,
+				 <MT7623_PIN_119_MSDC0_DAT2_FUNC_NLD2>;
+				input-enable;
+				drive-strength = <MTK_DRIVE_8mA>;
+				bias-pull-up;
+		};
+
+		pins_we {
+			pinmux = <MT7623_PIN_117_MSDC0_CLK_FUNC_NWEB>;
+			drive-strength = <MTK_DRIVE_8mA>;
+			bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
+		};
+
+		pins_ale {
+			pinmux = <MT7623_PIN_116_MSDC0_CMD_FUNC_NALE>;
+			drive-strength = <MTK_DRIVE_8mA>;
+			bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
+		};
+	};
+
+	eth_default: eth {
+		pins_eth {
+			pinmux = <MT7623_PIN_275_G2_MDC_FUNC_MDC>,
+				 <MT7623_PIN_276_G2_MDIO_FUNC_MDIO>,
+				 <MT7623_PIN_262_G2_TXEN_FUNC_G2_TXEN>,
+				 <MT7623_PIN_263_G2_TXD3_FUNC_G2_TXD3>,
+				 <MT7623_PIN_264_G2_TXD2_FUNC_G2_TXD2>,
+				 <MT7623_PIN_265_G2_TXD1_FUNC_G2_TXD1>,
+				 <MT7623_PIN_266_G2_TXD0_FUNC_G2_TXD0>,
+				 <MT7623_PIN_267_G2_TXCLK_FUNC_G2_TXC>,
+				 <MT7623_PIN_268_G2_RXCLK_FUNC_G2_RXC>,
+				 <MT7623_PIN_269_G2_RXD0_FUNC_G2_RXD0>,
+				 <MT7623_PIN_270_G2_RXD1_FUNC_G2_RXD1>,
+				 <MT7623_PIN_271_G2_RXD2_FUNC_G2_RXD2>,
+				 <MT7623_PIN_272_G2_RXD3_FUNC_G2_RXD3>,
+				 <MT7623_PIN_274_G2_RXDV_FUNC_G2_RXDV>;
+		};
+
+		pins_eth_esw {
+			pinmux = <MT7623_PIN_273_ESW_INT_FUNC_ESW_INT>;
+			input-enable;
+			drive-strength = <MTK_DRIVE_8mA>;
+			bias-pull-up;
+		};
+
+		pins_eth_rst {
+			pinmux = <MT7623_PIN_15_GPIO15_FUNC_GPIO15>;
+			output-low;
+		};
+	};
+
+	pwm_pins: pwm {
+		pins_pwm1 {
+			pinmux = <MT7623_PIN_204_PWM1_FUNC_PWM1>;
+		};
+
+		pins_pwm2 {
+			pinmux = <MT7623_PIN_205_PWM2_FUNC_PWM2>;
+		};
+	};
+};
+
+&nandc {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_default>;
+	nand at 0 {
+		reg = <0>;
+		spare_per_sector = <64>;
+		nand-ecc-mode = "hw";
+		nand-ecc-strength = <12>;
+		nand-ecc-step-size = <1024>;
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at C0000 {
+				label = "uboot-env";
+				reg = <0xC0000 0x40000>;
+			};
+
+			partition at 100000 {
+				label = "factory";
+				reg = <0x100000 0x40000>;
+			};
+
+			partition at 140000 {
+				label = "kernel";
+				reg = <0x140000 0x2000000>;
+			};
+
+			partition at 2140000 {
+				label = "recovery";
+				reg = <0x2140000 0x2000000>;
+			};
+
+			partition at 4140000 {
+				label = "ubi";
+				reg = <0x4140000 0x1000000>;
+			};
+		};
+	};
+};
+&bch {
+	status = "okay";
+};
+
+&usb1 {
+	vusb33-supply = <&mt6323_vusb_reg>;
+	vbus-supply = <&usb_p1_vbus>;
+	status = "okay";
+};
+
+&u3phy1 {
+	status = "okay";
+};
+
+&pcie {
+	status = "okay";
+};
+
+&eth {
+	status = "okay";
+};
+
+&gmac1 {
+	mac-address = [00 11 22 33 44 56];
+	status = "okay";
+};
+
+&gmac2 {
+	mac-address = [00 11 22 33 44 55];
+	status = "okay";
+
+	phy-handle = <&phy5>;
+};
+
+&mdio0 {
+	switch at 0 {
+		compatible = "mediatek,mt7530";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&eth_default>;
+
+		core-supply = <&mt6323_vpa_reg>;
+		io-supply = <&mt6323_vemc3v3_reg>;
+		reset-gpios = <&pio 33 0>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0>;
+			port at 0 {
+				reg = <0>;
+				label = "lan0";
+			};
+
+			port at 1 {
+				reg = <1>;
+				label = "lan1";
+			};
+
+			port at 2 {
+				reg = <2>;
+				label = "lan2";
+			};
+
+			port at 3 {
+				reg = <3>;
+				label = "lan3";
+			};
+
+			port at 6 {
+				reg = <6>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "trgmii";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+		};
+	};
+
+	phy5: ethernet-phy at 5 {
+		reg = <5>;
+		phy-mode = "rgmii-rxid";
+	};
+};
+
+&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm_pins>;
+	status = "okay";
+};
diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile
index 3139197..ac42691 100644
--- a/target/linux/mediatek/image/Makefile
+++ b/target/linux/mediatek/image/Makefile
@@ -32,11 +32,15 @@ define Image/Build/squashfs
 	$(call Image/Build/SysupgradeCombined,eMMC,squashfs)
 
 	$(call Image/BuilduImage,NAND)
+	$(call Image/BuilduImage,NAND-ePHY)
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 	$(call Image/BuilduImage,NAND,-initramfs)
+	$(call Image/BuilduImage,NAND-ePHY,-initramfs)
 	$(CP) $(KDIR)/uImage-NAND-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-initramfs
+	$(CP) $(KDIR)/uImage-NAND-ePHY-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-ePHY-initramfs
 endif
 	$(call Image/Build/SysupgradeNAND,NAND,$(1),$(KDIR)/uImage-NAND)
+	$(call Image/Build/SysupgradeNAND,NAND-ePHY,$(1),$(KDIR)/uImage-NAND-ePHY)
 endef
 
 define Image/Build
diff --git a/target/linux/mediatek/patches-4.9/0200-devicetree.patch b/target/linux/mediatek/patches-4.9/0200-devicetree.patch
index 50b54f4..4eca20a 100644
--- a/target/linux/mediatek/patches-4.9/0200-devicetree.patch
+++ b/target/linux/mediatek/patches-4.9/0200-devicetree.patch
@@ -1,11 +1,12 @@
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -950,6 +950,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
+@@ -950,6 +950,9 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
  	mt6589-aquaris5.dtb \
  	mt6592-evb.dtb \
  	mt7623-evb.dtb \
 +	mt7623-eMMC.dtb \
 +	mt7623-NAND.dtb \
++	mt7623-NAND-ePHY.dtb \
  	mt8127-moose.dtb \
  	mt8135-evbp1.dtb
  dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb


From lede-commits at lists.infradead.org  Mon Apr 24 07:35:40 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 10:35:40 -0400
Subject: [source] mac80211: rt2x00: reorder patches and prepare for MT7620
 external PA
In-Reply-To: <20170424143539.1530.83545@git-01.infra.lede-project.org>
References: <20170424143539.1530.83545@git-01.infra.lede-project.org>
Message-ID: <mailman.25779.1493044566.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/3d71d1d9a98f55659acbfb8434406636310cb54b

commit 3d71d1d9a98f55659acbfb8434406636310cb54b
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Apr 24 01:38:07 2017 +0200

    mac80211: rt2x00: reorder patches and prepare for MT7620 external PA
    
    Import change to make external PA capability consistent with the
    vendor driver instead of having the logic inverted.
    While at it, apply patches in the same order as they got merged
    upstream.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...reverse-external-PA-capability-flag-logic.patch | 128 +++++++++++++++++++++
 ...t2800-fix-LNA-gain-assignment-for-MT7620.patch} |   0
 ...do-VCO-calibration-after-programming-ALC.patch} |   0
 ...800-fix-mt7620-vco-calibration-registers.patch} |   0
 ...4-rt2800-fix-mt7620-E2-channel-registers.patch} |   0
 5 files changed, 128 insertions(+)

diff --git a/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch b/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch
new file mode 100644
index 0000000..35b1918
--- /dev/null
+++ b/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch
@@ -0,0 +1,128 @@
+From 1f242a3de702d5a19c479685d35b050837122724 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Mon, 10 Apr 2017 15:29:45 +0200
+Subject: [PATCH] rt2x00: reverse external PA capability flag logic
+
+Consequently refer to external PA instead of inverting the logic and
+use an internal PA capability flag which is a bit confusing.
+Currently this is used for Rt3352 only, but MT7620A also allows for an
+external PA which will be supported by a follow up patch.
+
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+Acked-by: Stanislaw Gruszka <sgruszka at redhat.com>
+Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 40 +++++++++++++-------------
+ drivers/net/wireless/ralink/rt2x00/rt2x00.h    |  4 +--
+ 2 files changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index 201b12ed90c6..ba06ac2d876d 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -7014,9 +7014,9 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
+ 
+ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
+ {
+-	int tx0_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX0,
++	int tx0_ext_pa = test_bit(CAPABILITY_EXTERNAL_PA_TX0,
+ 				  &rt2x00dev->cap_flags);
+-	int tx1_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX1,
++	int tx1_ext_pa = test_bit(CAPABILITY_EXTERNAL_PA_TX1,
+ 				  &rt2x00dev->cap_flags);
+ 	u8 rfcsr;
+ 
+@@ -7056,9 +7056,9 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
+ 	rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
+ 	rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
+ 	rfcsr = 0x01;
+-	if (!tx0_int_pa)
++	if (tx0_ext_pa)
+ 		rt2x00_set_field8(&rfcsr, RFCSR34_TX0_EXT_PA, 1);
+-	if (!tx1_int_pa)
++	if (tx1_ext_pa)
+ 		rt2x00_set_field8(&rfcsr, RFCSR34_TX1_EXT_PA, 1);
+ 	rt2800_rfcsr_write(rt2x00dev, 34, rfcsr);
+ 	rt2800_rfcsr_write(rt2x00dev, 35, 0x03);
+@@ -7068,13 +7068,13 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
+ 	rt2800_rfcsr_write(rt2x00dev, 39, 0xc5);
+ 	rt2800_rfcsr_write(rt2x00dev, 40, 0x33);
+ 	rfcsr = 0x52;
+-	if (tx0_int_pa) {
++	if (!tx0_ext_pa) {
+ 		rt2x00_set_field8(&rfcsr, RFCSR41_BIT1, 1);
+ 		rt2x00_set_field8(&rfcsr, RFCSR41_BIT4, 1);
+ 	}
+ 	rt2800_rfcsr_write(rt2x00dev, 41, rfcsr);
+ 	rfcsr = 0x52;
+-	if (tx1_int_pa) {
++	if (!tx1_ext_pa) {
+ 		rt2x00_set_field8(&rfcsr, RFCSR42_BIT1, 1);
+ 		rt2x00_set_field8(&rfcsr, RFCSR42_BIT4, 1);
+ 	}
+@@ -7087,19 +7087,19 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
+ 	rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
+ 	rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
+ 	rfcsr = 0x2d;
+-	if (!tx0_int_pa)
++	if (tx0_ext_pa)
+ 		rt2x00_set_field8(&rfcsr, RFCSR50_TX0_EXT_PA, 1);
+-	if (!tx1_int_pa)
++	if (tx1_ext_pa)
+ 		rt2x00_set_field8(&rfcsr, RFCSR50_TX1_EXT_PA, 1);
+ 	rt2800_rfcsr_write(rt2x00dev, 50, rfcsr);
+-	rt2800_rfcsr_write(rt2x00dev, 51, (tx0_int_pa ? 0x7f : 0x52));
+-	rt2800_rfcsr_write(rt2x00dev, 52, (tx0_int_pa ? 0x00 : 0xc0));
+-	rt2800_rfcsr_write(rt2x00dev, 53, (tx0_int_pa ? 0x52 : 0xd2));
+-	rt2800_rfcsr_write(rt2x00dev, 54, (tx0_int_pa ? 0x1b : 0xc0));
+-	rt2800_rfcsr_write(rt2x00dev, 55, (tx1_int_pa ? 0x7f : 0x52));
+-	rt2800_rfcsr_write(rt2x00dev, 56, (tx1_int_pa ? 0x00 : 0xc0));
+-	rt2800_rfcsr_write(rt2x00dev, 57, (tx0_int_pa ? 0x52 : 0x49));
+-	rt2800_rfcsr_write(rt2x00dev, 58, (tx1_int_pa ? 0x1b : 0xc0));
++	rt2800_rfcsr_write(rt2x00dev, 51, (tx0_ext_pa ? 0x52 : 0x7f));
++	rt2800_rfcsr_write(rt2x00dev, 52, (tx0_ext_pa ? 0xc0 : 0x00));
++	rt2800_rfcsr_write(rt2x00dev, 53, (tx0_ext_pa ? 0xd2 : 0x52));
++	rt2800_rfcsr_write(rt2x00dev, 54, (tx0_ext_pa ? 0xc0 : 0x1b));
++	rt2800_rfcsr_write(rt2x00dev, 55, (tx1_ext_pa ? 0x52 : 0x7f));
++	rt2800_rfcsr_write(rt2x00dev, 56, (tx1_ext_pa ? 0xc0 : 0x00));
++	rt2800_rfcsr_write(rt2x00dev, 57, (tx0_ext_pa ? 0x49 : 0x52));
++	rt2800_rfcsr_write(rt2x00dev, 58, (tx1_ext_pa ? 0xc0 : 0x1b));
+ 	rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
+ 	rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
+ 	rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
+@@ -8782,13 +8782,13 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
+ 	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+ 
+ 	if (rt2x00_rt(rt2x00dev, RT3352)) {
+-		if (!rt2x00_get_field16(eeprom,
++		if (rt2x00_get_field16(eeprom,
+ 		    EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
+-		    __set_bit(CAPABILITY_INTERNAL_PA_TX0,
++		    __set_bit(CAPABILITY_EXTERNAL_PA_TX0,
+ 			      &rt2x00dev->cap_flags);
+-		if (!rt2x00_get_field16(eeprom,
++		if (rt2x00_get_field16(eeprom,
+ 		    EEPROM_NIC_CONF1_EXTERNAL_TX1_PA_3352))
+-		    __set_bit(CAPABILITY_INTERNAL_PA_TX1,
++		    __set_bit(CAPABILITY_EXTERNAL_PA_TX1,
+ 			      &rt2x00dev->cap_flags);
+ 	}
+ 
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+index 8fdd2f9726ee..1bc353eafe37 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+@@ -719,8 +719,8 @@ enum rt2x00_capability_flags {
+ 	CAPABILITY_DOUBLE_ANTENNA,
+ 	CAPABILITY_BT_COEXIST,
+ 	CAPABILITY_VCO_RECALIBRATION,
+-	CAPABILITY_INTERNAL_PA_TX0,
+-	CAPABILITY_INTERNAL_PA_TX1,
++	CAPABILITY_EXTERNAL_PA_TX0,
++	CAPABILITY_EXTERNAL_PA_TX1,
+ };
+ 
+ /*
+-- 
+2.12.2
+
diff --git a/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch b/package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
similarity index 100%
rename from package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
rename to package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
diff --git a/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch b/package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch
similarity index 100%
rename from package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch
rename to package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch
diff --git a/package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch b/package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch
similarity index 100%
rename from package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch
rename to package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch
diff --git a/package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch b/package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch
similarity index 100%
rename from package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch
rename to package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch


From lede-commits at lists.infradead.org  Mon Apr 24 07:35:41 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 10:35:41 -0400
Subject: [source] mac80211: rt2x00: add incomplete support for external PA
 on MT7620
In-Reply-To: <20170424143539.1530.83545@git-01.infra.lede-project.org>
References: <20170424143539.1530.83545@git-01.infra.lede-project.org>
Message-ID: <mailman.25780.1493044570.26984.lede-commits@lists.infradead.org>

dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/61cfc8075b615c231cf6349b3708d0a7e073613e

commit 61cfc8075b615c231cf6349b3708d0a7e073613e
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Apr 24 01:44:29 2017 +0200

    mac80211: rt2x00: add incomplete support for external PA on MT7620
    
    Do as the vendor driver does -- however, some devices apparently
    patched support for external PA into the driver similar to how it was
    done on Rt3352, using EEPROM_NIC_CONF1 rather than EEPROM_NIC_CONF2,
    hence we check for both fields. Somehow the vendor driver also no
    longer offers the option of only one of the TX paths having an external
    PA (which was probably to weird to ever be implemented in practise,
    though it doesn't seem like a particularly bad idea to me). Do the same
    in rt2x00 and enable support for external PA on both TX paths whenever
    it is set for TX0 in EEPROM.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...x00-add-support-for-external-PA-on-MT7620.patch | 125 +++++++++++++++++++++
 1 file changed, 125 insertions(+)

diff --git a/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch
new file mode 100644
index 0000000..b224861
--- /dev/null
+++ b/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch
@@ -0,0 +1,125 @@
+From 9782a7f7488443568fa4d6088b73c9aff7eb8510 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Wed, 19 Apr 2017 16:14:53 +0200
+Subject: [PATCH] rt2x00: add support for external PA on MT7620
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+    linux-wireless at vger.kernel.org,
+    Kalle Valo <kvalo at codeaurora.org>
+
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800.h    |  1 +
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 70 +++++++++++++++++++++++++-
+ 2 files changed, 70 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800.h b/drivers/net/wireless/ralink/rt2x00/rt2800.h
+index 6a8c93fb6a43..df0cefe44171 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
+@@ -2732,6 +2732,7 @@ enum rt2800_eeprom_word {
+ #define EEPROM_NIC_CONF2_RX_STREAM	FIELD16(0x000f)
+ #define EEPROM_NIC_CONF2_TX_STREAM	FIELD16(0x00f0)
+ #define EEPROM_NIC_CONF2_CRYSTAL	FIELD16(0x0600)
++#define EEPROM_NIC_CONF2_EXTERNAL_PA	FIELD16(0xc000)
+ 
+ /*
+  * EEPROM LNA
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index c06db547b0a4..db431c9544e2 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3834,6 +3834,61 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
+ 		rt2800_iq_calibrate(rt2x00dev, rf->channel);
+ 	}
+ 
++	if (rt2x00_rt(rt2x00dev, RT6352)) {
++		if (test_bit(CAPABILITY_EXTERNAL_PA_TX0,
++			     &rt2x00dev->cap_flags)) {
++			rt2x00_warn(rt2x00dev, "Using incomplete support for " \
++					       "external PA\n");
++			rt2800_register_read(rt2x00dev, RF_CONTROL3, &reg);
++			reg |= 0x00000101;
++			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
++
++			rt2800_register_read(rt2x00dev, RF_BYPASS3, &reg);
++			reg |= 0x00000101;
++			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
++
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 43, 0x73);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 43, 0x73);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 44, 0x73);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 44, 0x73);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 45, 0x73);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0x73);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 46, 0x27);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 46, 0x27);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 47, 0xC8);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 47, 0xC8);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 48, 0xA4);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 48, 0xA4);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 49, 0x05);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 49, 0x05);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 54, 0x27);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 54, 0x27);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 55, 0xC8);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 55, 0xC8);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 56, 0xA4);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 56, 0xA4);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 57, 0x05);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 57, 0x05);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 58, 0x27);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 58, 0x27);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 59, 0xC8);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 59, 0xC8);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 60, 0xA4);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 60, 0xA4);
++			rt2800_rfcsr_write_bank(rt2x00dev, 4, 61, 0x05);
++			rt2800_rfcsr_write_bank(rt2x00dev, 6, 61, 0x05);
++			rt2800_rfcsr_write_bank(rt2x00dev, 5, 05, 0x00);
++			rt2800_rfcsr_write_bank(rt2x00dev, 7, 05, 0x00);
++
++			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT,
++					      0x36303636);
++			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN,
++					      0x6C6C6B6C);
++			rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN,
++					      0x6C6C6B6C);
++		}
++	}
++
+ 	rt2800_bbp_read(rt2x00dev, 4, &bbp);
+ 	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
+ 	rt2800_bbp_write(rt2x00dev, 4, bbp);
+@@ -8796,7 +8851,8 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
+ 	 */
+ 	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+ 
+-	if (rt2x00_rt(rt2x00dev, RT3352)) {
++	if (rt2x00_rt(rt2x00dev, RT3352) ||
++	    rt2x00_rt(rt2x00dev, RT6352)) {
+ 		if (rt2x00_get_field16(eeprom,
+ 		    EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
+ 		    __set_bit(CAPABILITY_EXTERNAL_PA_TX0,
+@@ -8807,6 +8863,18 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
+ 			      &rt2x00dev->cap_flags);
+ 	}
+ 
++	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2, &eeprom);
++
++	if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) {
++		if (rt2x00_get_field16(eeprom,
++		    EEPROM_NIC_CONF2_EXTERNAL_PA)) {
++		    __set_bit(CAPABILITY_EXTERNAL_PA_TX0,
++			      &rt2x00dev->cap_flags);
++		    __set_bit(CAPABILITY_EXTERNAL_PA_TX1,
++			      &rt2x00dev->cap_flags);
++		}
++	}
++
+ 	return 0;
+ }
+ 
+-- 
+2.12.2
+


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:32 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:32 -0400
Subject: [source] package/uboot-omap: add default uEnv to boot via mmc card
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25796.1493050128.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/a5eb9c6370f5e1f38c9429b0c46f757706eac0c7

commit a5eb9c6370f5e1f38c9429b0c46f757706eac0c7
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Wed Apr 19 04:48:03 2017 +0200

    package/uboot-omap: add default uEnv to boot via mmc card
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 package/boot/uboot-omap/Makefile               | 2 ++
 package/boot/uboot-omap/files/uEnv-default.txt | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
index 17a4af4..d11ced4 100644
--- a/package/boot/uboot-omap/Makefile
+++ b/package/boot/uboot-omap/Makefile
@@ -19,6 +19,7 @@ include $(INCLUDE_DIR)/package.mk
 define U-Boot/Default
   BUILD_TARGET:=omap
   UBOOT_IMAGE:=u-boot.img MLO
+  UENV:=default
 endef
 
 define U-Boot/omap4_panda
@@ -45,6 +46,7 @@ UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle
 define Build/InstallDev
 	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)
 	$(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/
+	$(CP) ./files/uEnv-$(UENV).txt $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/uEnv.txt
 endef
 
 $(eval $(call BuildPackage/U-Boot))
diff --git a/package/boot/uboot-omap/files/uEnv-default.txt b/package/boot/uboot-omap/files/uEnv-default.txt
new file mode 100644
index 0000000..3584e43
--- /dev/null
+++ b/package/boot/uboot-omap/files/uEnv-default.txt
@@ -0,0 +1,8 @@
+bootpart=0:1
+bootdir=/
+bootfile=zImage
+fdtdir=/dtbs
+uenvcmd=run loadfdt; run loadimage; run uenvbootargs ; bootz ${loadaddr} - ${fdtaddr}
+loadfdt=load mmc ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}
+devtype=mmc
+uenvbootargs=setenv bootargs console=${console} root=/dev/mmcblk0p2


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:27 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:27 -0400
Subject: [source]  omap/Kconfig: refresh by oldconfig
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25797.1493050131.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/d2bad25b7cd120f7813e3b0f25f934bb4cfe32ce

commit d2bad25b7cd120f7813e3b0f25f934bb4cfe32ce
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 22 15:14:00 2017 +0200

    omap/Kconfig: refresh by oldconfig
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/omap/config-4.4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/linux/omap/config-4.4 b/target/linux/omap/config-4.4
index 231ef63..19f3178 100644
--- a/target/linux/omap/config-4.4
+++ b/target/linux/omap/config-4.4
@@ -137,6 +137,8 @@ CONFIG_CRC7=y
 CONFIG_CRC_CCITT=y
 CONFIG_CRC_ITU_T=y
 CONFIG_CRC_T10DIF=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_CRC32C=y
 CONFIG_CRYPTO_CRCT10DIF=y
 CONFIG_CRYPTO_DEFLATE=y
@@ -152,6 +154,7 @@ CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_NULL2=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_SHA1=y
 CONFIG_CRYPTO_SHA256=y
@@ -317,8 +320,6 @@ CONFIG_JFFS2_LZO=y
 CONFIG_JFFS2_RUBIN=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KEXEC=y
-CONFIG_KEXEC_CORE=y
 CONFIG_KEYS=y
 CONFIG_KPROBES=y
 CONFIG_KRETPROBES=y


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:24 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:24 -0400
Subject: [source]  omap/Kconfig: add omap2plus_cpufreq
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25798.1493050131.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/59649164a3cd9cd024a988cf7a7d516322e74203

commit 59649164a3cd9cd024a988cf7a7d516322e74203
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 22 14:58:36 2017 +0200

    omap/Kconfig: add omap2plus_cpufreq
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/omap/config-4.4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/omap/config-4.4 b/target/linux/omap/config-4.4
index 76cf84e..e7d6247 100644
--- a/target/linux/omap/config-4.4
+++ b/target/linux/omap/config-4.4
@@ -48,7 +48,7 @@ CONFIG_ARM_HEAVY_MB=y
 CONFIG_ARM_L1_CACHE_SHIFT=6
 CONFIG_ARM_L1_CACHE_SHIFT_6=y
 # CONFIG_ARM_LPAE is not set
-# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set
+CONFIG_ARM_OMAP2PLUS_CPUFREQ=y
 CONFIG_ARM_PATCH_PHYS_VIRT=y
 CONFIG_ARM_THUMB=y
 CONFIG_ARM_THUMBEE=y


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:33 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:33 -0400
Subject: [source]  package/uboot-omap: add am335x_boneblack
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25799.1493050131.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/23fc55e7235c719856ea4ba23a3dabb804d2fed9

commit 23fc55e7235c719856ea4ba23a3dabb804d2fed9
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sun Apr 16 19:26:45 2017 +0200

    package/uboot-omap: add am335x_boneblack
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 package/boot/uboot-omap/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
index d11ced4..9084f37 100644
--- a/package/boot/uboot-omap/Makefile
+++ b/package/boot/uboot-omap/Makefile
@@ -27,6 +27,11 @@ define U-Boot/omap4_panda
   BUILD_DEVICES:=omap4-panda
 endef
 
+define U-Boot/am335x_boneblack
+  NAME:=TI AM335x BeagleBone Black
+  BUILD_DEVICES:=am335x-boneblack
+endef
+
 define U-Boot/am335x_evm
   NAME:=AM335x EVM
   BUILD_DEVICES:=am335x-evm
@@ -41,7 +46,7 @@ define U-Boot/omap3_beagle
   BUILD_DEVICES:=omap3-beagle
 endef
 
-UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle
+UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle am335x_boneblack
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:28 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:28 -0400
Subject: [source]  omap: correct CPU_TYPE: omaps are cortext-a8
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25800.1493050131.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/72fdea244f1accf5198569e081f5b97dc49ce9e7

commit 72fdea244f1accf5198569e081f5b97dc49ce9e7
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Tue Apr 18 19:58:20 2017 +0200

    omap: correct CPU_TYPE: omaps are cortext-a8
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/omap/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/omap/Makefile b/target/linux/omap/Makefile
index 91b9d9b..f58197f 100644
--- a/target/linux/omap/Makefile
+++ b/target/linux/omap/Makefile
@@ -10,7 +10,7 @@ ARCH:=arm
 BOARD:=omap
 BOARDNAME:=TI OMAP3/4/AM33xx
 FEATURES:=usb usbgadget ext4 targz fpu audio display nand ubifs
-CPU_TYPE:=cortex-a9
+CPU_TYPE:=cortex-a8
 CPU_SUBTYPE:=vfpv3
 
 KERNEL_PATCHVER:=4.4


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:31 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:31 -0400
Subject: [source] package/uboot-omap: re-introduce patches dropped by update
 to v2017.01
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25801.1493050131.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/147e18bdbdb5ac093d06c3a7e400b20969b7a5f5

commit 147e18bdbdb5ac093d06c3a7e400b20969b7a5f5
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Tue Apr 18 20:15:59 2017 +0200

    package/uboot-omap: re-introduce patches dropped by update to v2017.01
    
    The beagleboard doesn't boot with Thumb enabled, but without Thumb the
    SPL (first stage bootloader) is too big to fit into SRAM.
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 .../patches/101-disable-thumb-beagleboard.patch    | 14 +++++++
 .../boot/uboot-omap/patches/102-minify-spl.patch   | 44 ++++++++++++++++++++++
 .../patches/103-disable-fat-write-spl.patch        | 27 +++++++++++++
 3 files changed, 85 insertions(+)

diff --git a/package/boot/uboot-omap/patches/101-disable-thumb-beagleboard.patch b/package/boot/uboot-omap/patches/101-disable-thumb-beagleboard.patch
new file mode 100644
index 0000000..8a3b024
--- /dev/null
+++ b/package/boot/uboot-omap/patches/101-disable-thumb-beagleboard.patch
@@ -0,0 +1,14 @@
+Index: u-boot-2017.01/include/configs/ti_omap3_common.h
+===================================================================
+--- u-boot-2017.01.orig/include/configs/ti_omap3_common.h
++++ u-boot-2017.01/include/configs/ti_omap3_common.h
+@@ -80,4 +80,9 @@
+ /* Now bring in the rest of the common code. */
+ #include <configs/ti_armv7_omap.h>
+ 
++/* beagleboard doesnt boot with thumb */
++#ifdef CONFIG_SYS_THUMB_BUILD
++#undef CONFIG_SYS_THUMB_BUILD
++#endif
++
+ #endif	/* __CONFIG_TI_OMAP3_COMMON_H__ */
diff --git a/package/boot/uboot-omap/patches/102-minify-spl.patch b/package/boot/uboot-omap/patches/102-minify-spl.patch
new file mode 100644
index 0000000..66f6b6b
--- /dev/null
+++ b/package/boot/uboot-omap/patches/102-minify-spl.patch
@@ -0,0 +1,44 @@
+Index: u-boot-2017.01/configs/omap3_beagle_defconfig
+===================================================================
+--- u-boot-2017.01.orig/configs/omap3_beagle_defconfig
++++ u-boot-2017.01/configs/omap3_beagle_defconfig
+@@ -7,7 +7,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
+ CONFIG_VERSION_VARIABLE=y
+ CONFIG_SPL=y
+ CONFIG_SPL_MTD_SUPPORT=y
+-CONFIG_SPL_OS_BOOT=y
++# CONFIG_SPL_EXT_SUPPORT is not set
+ # CONFIG_CMD_IMLS is not set
+ CONFIG_CMD_ASKENV=y
+ # CONFIG_CMD_FLASH is not set
+Index: u-boot-2017.01/common/Makefile
+===================================================================
+--- u-boot-2017.01.orig/common/Makefile
++++ u-boot-2017.01/common/Makefile
+@@ -174,8 +174,11 @@ obj-$(CONFIG_CMDLINE) += cli_simple.o
+ obj-y += cli.o
+ obj-$(CONFIG_CMDLINE) += cli_readline.o
+ obj-$(CONFIG_CMD_DFU) += dfu.o
++
++ifndef CONFIG_SPL_BUILD
+ obj-y += command.o
+ obj-y += s_record.o
+ obj-y += xyzModem.o
++endif
+ 
+ CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
+Index: u-boot-2017.01/cmd/Makefile
+===================================================================
+--- u-boot-2017.01.orig/cmd/Makefile
++++ u-boot-2017.01/cmd/Makefile
+@@ -161,7 +161,10 @@ endif # !CONFIG_SPL_BUILD
+ 
+ obj-$(CONFIG_CMD_BLOB) += blob.o
+ 
++
++# ifndef CONFIG_SPL_BUILD
+ # core command
+ obj-y += nvedit.o
++# endif # !CONFIG_SPL_BUILD
+ 
+ obj-$(CONFIG_ARCH_MVEBU) += mvebu/
diff --git a/package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch b/package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch
new file mode 100644
index 0000000..89b0204
--- /dev/null
+++ b/package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch
@@ -0,0 +1,27 @@
+Index: u-boot-2017.01/fs/fat/Makefile
+===================================================================
+--- u-boot-2017.01.orig/fs/fat/Makefile
++++ u-boot-2017.01/fs/fat/Makefile
+@@ -4,8 +4,8 @@
+ #
+ 
+ obj-$(CONFIG_FS_FAT)	:= fat.o
+-obj-$(CONFIG_FAT_WRITE):= fat_write.o
+ 
+ ifndef CONFIG_SPL_BUILD
++obj-$(CONFIG_FAT_WRITE):= fat_write.o
+ obj-$(CONFIG_FS_FAT)	+= file.o
+ endif
+Index: u-boot-2017.01/fs/fat/fat.c
+===================================================================
+--- u-boot-2017.01.orig/fs/fat/fat.c
++++ u-boot-2017.01/fs/fat/fat.c
+@@ -163,7 +163,7 @@ static void get_name(dir_entry *dirent,
+ }
+ 
+ static int flush_dirty_fat_buffer(fsdata *mydata);
+-#if !defined(CONFIG_FAT_WRITE)
++#if !defined(CONFIG_FAT_WRITE) || defined(CONFIG_SPL_BUILD)
+ /* Stub for read only operation */
+ int flush_dirty_fat_buffer(fsdata *mydata)
+ {


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:30 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:30 -0400
Subject: [source]  package/uboot-omap: install image to STAGING_DIR_IMAGE
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25802.1493050131.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/e2caa74a2ffece85c302960f4994776427db4e38

commit e2caa74a2ffece85c302960f4994776427db4e38
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 15 18:49:57 2017 +0200

    package/uboot-omap: install image to STAGING_DIR_IMAGE
    
    to use them later by image/Makefile to create full working sdcard images
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 package/boot/uboot-omap/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
index 876d9f0..17a4af4 100644
--- a/package/boot/uboot-omap/Makefile
+++ b/package/boot/uboot-omap/Makefile
@@ -42,4 +42,9 @@ endef
 
 UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle
 
+define Build/InstallDev
+	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)
+	$(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/
+endef
+
 $(eval $(call BuildPackage/U-Boot))


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:26 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:26 -0400
Subject: [source]  omap/Kconfig: add usb options
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25803.1493050134.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/c864661d148cf3f9d955fc9a26a6d2c5808c0e29

commit c864661d148cf3f9d955fc9a26a6d2c5808c0e29
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 22 15:13:35 2017 +0200

    omap/Kconfig: add usb options
    
    including phy and required dma options
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/omap/config-4.4 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/linux/omap/config-4.4 b/target/linux/omap/config-4.4
index 1624945..231ef63 100644
--- a/target/linux/omap/config-4.4
+++ b/target/linux/omap/config-4.4
@@ -644,7 +644,7 @@ CONFIG_THERMAL_OF=y
 # CONFIG_THUMB2_KERNEL is not set
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TIMER_STATS=y
-# CONFIG_TI_CPPI41 is not set
+CONFIG_TI_CPPI41=y
 CONFIG_TI_CPSW=y
 CONFIG_TI_CPSW_ALE=y
 CONFIG_TI_CPSW_PHY_SEL=y
@@ -687,9 +687,9 @@ CONFIG_USB_EHCI_HCD_OMAP=y
 # CONFIG_USB_EHCI_HCD_PLATFORM is not set
 # CONFIG_USB_ETH is not set
 CONFIG_USB_GADGET=y
-# CONFIG_USB_INVENTRA_DMA is not set
+CONFIG_USB_INVENTRA_DMA=y
 CONFIG_USB_MUSB_AM335X_CHILD=y
-# CONFIG_USB_MUSB_AM35X is not set
+CONFIG_USB_MUSB_AM35X=y
 CONFIG_USB_MUSB_DSPS=y
 CONFIG_USB_MUSB_DUAL_ROLE=y
 # CONFIG_USB_MUSB_GADGET is not set
@@ -699,8 +699,8 @@ CONFIG_USB_MUSB_OMAP2PLUS=y
 CONFIG_USB_MUSB_TUSB6010=y
 CONFIG_USB_PHY=y
 CONFIG_USB_SUPPORT=y
-# CONFIG_USB_TI_CPPI41_DMA is not set
-# CONFIG_USB_TUSB_OMAP_DMA is not set
+CONFIG_USB_TI_CPPI41_DMA=y
+CONFIG_USB_TUSB_OMAP_DMA=y
 # CONFIG_USERIO is not set
 CONFIG_USE_OF=y
 CONFIG_VECTORS_BASE=0xffff0000


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:25 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:25 -0400
Subject: [source]  omap/Kconfig: enable SMP
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25804.1493050134.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/a1160fa9c5d08daeeaf062ce29909ac85f5dacce

commit a1160fa9c5d08daeeaf062ce29909ac85f5dacce
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 22 15:12:13 2017 +0200

    omap/Kconfig: enable SMP
    
    the pandaboard is a multicore omap
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/omap/config-4.4 | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/target/linux/omap/config-4.4 b/target/linux/omap/config-4.4
index e7d6247..1624945 100644
--- a/target/linux/omap/config-4.4
+++ b/target/linux/omap/config-4.4
@@ -16,6 +16,7 @@ CONFIG_ARCH_MULTIPLATFORM=y
 # CONFIG_ARCH_MULTI_CPU_AUTO is not set
 CONFIG_ARCH_MULTI_V6_V7=y
 CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED=y
 CONFIG_ARCH_NR_GPIO=0
 CONFIG_ARCH_OMAP=y
 CONFIG_ARCH_OMAP2PLUS=y
@@ -126,6 +127,7 @@ CONFIG_CPU_IDLE_GOV_LADDER=y
 CONFIG_CPU_IDLE_GOV_MENU=y
 CONFIG_CPU_PABRT_V7=y
 CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
 CONFIG_CPU_THERMAL=y
 CONFIG_CPU_TLB_V7=y
 CONFIG_CPU_V7=y
@@ -271,7 +273,6 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_GENERIC_DMA_COHERENT=y
 CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_HAVE_MEMBLOCK=y
 CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
 CONFIG_HAVE_NET_DSA=y
@@ -336,6 +337,7 @@ CONFIG_LIBCRC32C=y
 CONFIG_LIBFDT=y
 CONFIG_LOCKD=y
 CONFIG_LOCKDEP=y
+CONFIG_LOCK_SPIN_ON_OWNER=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y
 # CONFIG_MACH_NOKIA_RX51 is not set
@@ -391,9 +393,9 @@ CONFIG_MTD_UBI_WL_THRESHOLD=4096
 CONFIG_MULTI_IRQ_HANDLER=y
 # CONFIG_MUSB_PIO_ONLY is not set
 CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NEON=y
 # CONFIG_NET_CADENCE is not set
+CONFIG_NET_FLOW_LIMIT=y
 CONFIG_NET_KEY=y
 CONFIG_NET_KEY_MIGRATE=y
 CONFIG_NET_PTP_CLASSIFY=y
@@ -426,6 +428,7 @@ CONFIG_NO_BOOTMEM=y
 CONFIG_NO_HZ=y
 CONFIG_NO_HZ_COMMON=y
 CONFIG_NO_HZ_IDLE=y
+CONFIG_NR_CPUS=4
 CONFIG_OF=y
 CONFIG_OF_ADDRESS=y
 CONFIG_OF_EARLY_FLATTREE=y
@@ -475,6 +478,7 @@ CONFIG_OPROFILE=y
 CONFIG_OPTPROBES=y
 CONFIG_OUTER_CACHE=y
 CONFIG_OUTER_CACHE_SYNC=y
+CONFIG_PADATA=y
 CONFIG_PAGE_OFFSET=0xC0000000
 # CONFIG_PCI is not set
 # CONFIG_PCI_DOMAINS_GENERIC is not set
@@ -522,7 +526,7 @@ CONFIG_QUOTACTL=y
 # CONFIG_QUOTA_NETLINK_INTERFACE is not set
 CONFIG_QUOTA_TREE=y
 CONFIG_RATIONAL=y
-# CONFIG_RCU_STALL_COMMON is not set
+CONFIG_RCU_STALL_COMMON=y
 CONFIG_REGMAP=y
 CONFIG_REGMAP_I2C=y
 CONFIG_REGMAP_IRQ=y
@@ -540,20 +544,24 @@ CONFIG_REGULATOR_TPS65217=y
 CONFIG_REGULATOR_TPS65218=y
 CONFIG_REGULATOR_TPS65910=y
 CONFIG_REGULATOR_TWL4030=y
+CONFIG_RFS_ACCEL=y
 CONFIG_RING_BUFFER=y
 CONFIG_RING_BUFFER_ALLOW_SWAP=y
 CONFIG_ROOT_NFS=y
+CONFIG_RPS=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
 CONFIG_RTC_DRV_OMAP=y
 CONFIG_RTC_DRV_PALMAS=y
 # CONFIG_RTC_DRV_TPS65910 is not set
 CONFIG_RTC_DRV_TWL4030=y
+CONFIG_RWSEM_SPIN_ON_OWNER=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_SATA_AHCI_PLATFORM=y
 CONFIG_SCHEDSTATS=y
 CONFIG_SCHED_HRTICK=y
 CONFIG_SCHED_INFO=y
+CONFIG_SCHED_MC=y
 CONFIG_SCSI=y
 CONFIG_SCSI_SCAN_ASYNC=y
 CONFIG_SDIO_UART=y
@@ -576,6 +584,8 @@ CONFIG_SERIAL_OMAP=y
 CONFIG_SERIAL_OMAP_CONSOLE=y
 CONFIG_SERIO=y
 CONFIG_SMC91X=y
+CONFIG_SMP=y
+CONFIG_SMP_ON_UP=y
 CONFIG_SMSC911X=y
 # CONFIG_SMSC911X_ARCH_HOOKS is not set
 CONFIG_SMSC_PHY=y
@@ -651,6 +661,7 @@ CONFIG_TI_THERMAL=y
 CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_TRACE_CLOCK=y
 CONFIG_TRACE_IRQFLAGS=y
+CONFIG_TREE_RCU=y
 CONFIG_TWL4030_CORE=y
 CONFIG_TWL4030_POWER=y
 CONFIG_TWL4030_USB=y
@@ -701,6 +712,7 @@ CONFIG_WATCHDOG_CORE=y
 # CONFIG_WKUP_M3_RPROC is not set
 CONFIG_XFRM_ALGO=y
 CONFIG_XFRM_MIGRATE=y
+CONFIG_XPS=y
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZLIB_DEFLATE=y


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:29 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:29 -0400
Subject: [source]  package/uboot-omap: assign BUILD_DEVICES most boards
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25807.1493050134.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/4ac4148cc4c7ffe8520da031fa9dec7704a224a0

commit 4ac4148cc4c7ffe8520da031fa9dec7704a224a0
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 15 18:52:34 2017 +0200

    package/uboot-omap: assign BUILD_DEVICES most boards
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 package/boot/uboot-omap/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
index 286d480..876d9f0 100644
--- a/package/boot/uboot-omap/Makefile
+++ b/package/boot/uboot-omap/Makefile
@@ -18,16 +18,17 @@ include $(INCLUDE_DIR)/package.mk
 
 define U-Boot/Default
   BUILD_TARGET:=omap
-  BUILD_DEVICES:=Default
   UBOOT_IMAGE:=u-boot.img MLO
 endef
 
 define U-Boot/omap4_panda
   NAME:=Pandaboard
+  BUILD_DEVICES:=omap4-panda
 endef
 
 define U-Boot/am335x_evm
   NAME:=AM335x EVM
+  BUILD_DEVICES:=am335x-evm
 endef
 
 define U-Boot/omap3_overo
@@ -36,6 +37,7 @@ endef
 
 define U-Boot/omap3_beagle
   NAME:=BeagleBoard
+  BUILD_DEVICES:=omap3-beagle
 endef
 
 UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle


From lede-commits at lists.infradead.org  Mon Apr 24 09:08:34 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:08:34 -0400
Subject: [source]  omap: rework image generation and profiles
In-Reply-To: <20170424160824.17447.19595@git-01.infra.lede-project.org>
References: <20170424160824.17447.19595@git-01.infra.lede-project.org>
Message-ID: <mailman.25810.1493050304.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/9b8e274e1b10a0d7a3066b5b1a62e24f7b313d9b

commit 9b8e274e1b10a0d7a3066b5b1a62e24f7b313d9b
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Sat Apr 15 19:00:10 2017 +0200

    omap: rework image generation and profiles
    
    Migrate to new image generation and
    introduce sdcard generation (based on sunxi).
    Profile now generated via image/Makefile instead
    of profiles/ directory.
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/omap/Makefile                     |  3 +-
 target/linux/omap/image/Config.in              |  5 ++
 target/linux/omap/image/Makefile               | 75 +++++++++++++++++++-------
 target/linux/omap/image/gen_omap_sdcard_img.sh | 33 ++++++++++++
 target/linux/omap/profiles/00-default.mk       |  9 +++-
 target/linux/omap/profiles/beagleboard.mk      | 23 --------
 6 files changed, 104 insertions(+), 44 deletions(-)

diff --git a/target/linux/omap/Makefile b/target/linux/omap/Makefile
index f58197f..34dc9a4 100644
--- a/target/linux/omap/Makefile
+++ b/target/linux/omap/Makefile
@@ -4,6 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+
 include $(TOPDIR)/rules.mk
 
 ARCH:=arm
@@ -25,6 +26,4 @@ endef
 
 include $(INCLUDE_DIR)/target.mk
 
-DEFAULT_PACKAGES += uboot-omap-am335x_evm uboot-omap-omap3_beagle uboot-omap-omap3_overo uboot-omap-omap4_panda
-
 $(eval $(call BuildTarget))
diff --git a/target/linux/omap/image/Config.in b/target/linux/omap/image/Config.in
new file mode 100644
index 0000000..08b88eb
--- /dev/null
+++ b/target/linux/omap/image/Config.in
@@ -0,0 +1,5 @@
+config OMAP_SD_BOOT_PARTSIZE
+	int "Boot (SD Card) filesystem partition size (in MB)"
+	depends on TARGET_omap
+	default 20
+
diff --git a/target/linux/omap/image/Makefile b/target/linux/omap/image/Makefile
index 4c24cca..2f1e5b5 100644
--- a/target/linux/omap/image/Makefile
+++ b/target/linux/omap/image/Makefile
@@ -7,35 +7,74 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
+FAT32_BLOCK_SIZE=1024
+FAT32_BLOCKS=$(shell echo $$(($(CONFIG_OMAP_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
+
 UBIFS_OPTS = -F -m 2048 -e 124KiB -c 4096 -U
 UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
 
-define Image/BuildKernel
-	$(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
- ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-	$(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
- endif
-	-mkdir $(BIN_DIR)/dtbs
-	-$(CP) $(DTS_DIR)/am335x*.dtb $(BIN_DIR)/dtbs/
-	-$(CP) $(DTS_DIR)/omap3*.dtb $(BIN_DIR)/dtbs/
-	-$(CP) $(DTS_DIR)/omap4*.dtb $(BIN_DIR)/dtbs/
+define Build/omap-sdcard
+	rm -f $@.boot
+	mkfs.fat $@.boot -C $(FAT32_BLOCKS)
+
+	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/MLO ::MLO
+	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/u-boot.img ::u-boot.img
+	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/uEnv.txt ::uEnv.txt
+	mmd -i $@.boot ::/dtbs
+	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::/dtbs/$(DEVICE_DTS).dtb
+	mcopy -i $@.boot $(IMAGE_KERNEL) ::/zImage
+	./gen_omap_sdcard_img.sh $@ \
+		$@.boot \
+		$(IMAGE_ROOTFS) \
+		$(CONFIG_OMAP_SD_BOOT_PARTSIZE) \
+		$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+	rm -f $@.boot
 endef
 
-define Image/Build
-	$(call Image/Build/$(1),$(1))
+define Device/Default
+  PROFILES := Default
+  DEVICE_VARS :=
+  KERNEL_NAME := zImage
+  KERNEL := kernel-bin
+  IMAGES := sdcard.img.gz
+  IMAGE/sdcard.img.gz := omap-sdcard | append-metadata | gzip
+  SUPPORTED_DEVICES = $$(DEVICE_DTS)
 endef
 
-define Image/Build/jffs2-64k
-	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=65536 conv=sync
+#uboot-omap-am335x_evm uboot-omap-omap3_beagle uboot-omap-omap3_overo uboot-omap-omap4_panda
+
+define Device/am335x-evm
+  DEVICE_TITLE := TI AM335x EVM
+  DEVICE_DTS := am335x-evm
 endef
 
-define Image/Build/jffs2-128k
-	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=131072 conv=sync
+TARGET_DEVICES += am335x-evm
+
+define Device/am335x-boneblack
+  DEVICE_TITLE := TI AM335x BeagleBone Black
+  DEVICE_DTS := am335x-boneblack
 endef
 
-define Image/Build/squashfs
-	$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
-	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=131072 conv=sync
+TARGET_DEVICES += am335x-boneblack
+
+define Device/omap4-panda
+  DEVICE_TITLE := OMAP4 TI pandaboard
+  DEVICE_DTS := omap4-panda
+  DEVICE_PACKAGES := kmod-usb-net-smsc95xx
 endef
 
+TARGET_DEVICES += omap4-panda
+
+define Device/omap3-beagle
+  DEVICE_TITLE := OMAP3 TI beagleboard
+  DEVICE_DTS := omap3-beagle
+  # beagleboard doesn't have a network interface, support most common usb net
+  DEVICE_PACKAGES := kmod-usb-net \
+	kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
+	kmod-usb-net-kaweth kmod-usb-net-pegasus kmod-usb-net-mcs7830 \
+	kmod-usb-net-smsc95xx kmod-usb-net-dm9601-ether
+endef
+
+TARGET_DEVICES += omap3-beagle
+
 $(eval $(call BuildImage))
diff --git a/target/linux/omap/image/gen_omap_sdcard_img.sh b/target/linux/omap/image/gen_omap_sdcard_img.sh
new file mode 100755
index 0000000..c2f2aad
--- /dev/null
+++ b/target/linux/omap/image/gen_omap_sdcard_img.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+set -x
+[ $# -eq 5 ] || {
+    echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
+    exit 1
+}
+
+OUTPUT="$1"
+BOOTFS="$2"
+ROOTFS="$3"
+BOOTFSSIZE="$4"
+ROOTFSSIZE="$5"
+
+head=4
+sect=63
+
+set `ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M`
+
+BOOTOFFSET="$(($1 / 512))"
+BOOTSIZE="$(($2 / 512))"
+ROOTFSOFFSET="$(($3 / 512))"
+ROOTFSSIZE="$(($4 / 512))"
+
+dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
+dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
diff --git a/target/linux/omap/profiles/00-default.mk b/target/linux/omap/profiles/00-default.mk
index 3ff040d..c0af557 100644
--- a/target/linux/omap/profiles/00-default.mk
+++ b/target/linux/omap/profiles/00-default.mk
@@ -6,7 +6,14 @@
 #
 
 define Profile/Default
-	NAME:=Default Profile
+  NAME:=Default Profile
+  PACKAGES:= \
+	kmod-usb-net \
+	kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
+	kmod-usb-net-kaweth kmod-usb-net-pegasus kmod-usb-net-mcs7830 \
+	kmod-usb-net-smsc95xx kmod-usb-net-dm9601-ether \
+	wpad-mini
+  PRIORITY := 1
 endef
 
 define Profile/Default/Description
diff --git a/target/linux/omap/profiles/beagleboard.mk b/target/linux/omap/profiles/beagleboard.mk
deleted file mode 100644
index aa8b68a..0000000
--- a/target/linux/omap/profiles/beagleboard.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (C) 2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/BEAGLEBOARD
-	NAME:=EBV BeagleBoard
-	DEFAULT_PACKAGES += \
-			kmod-usb-net kmod-usb-net-asix \
-			kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
-			kmod-usb-net-kaweth kmod-usb-net-pegasus \
-			kmod-usb-net-mcs7830 kmod-usb-net-smsc95xx \
-			kmod-usb-net-dm9601-ether
-endef
-
-define Profile/BEAGLEBOARD/Description
-	Package set for the BEAGLEBOARD and similar devices.
-	Contains various USB-NET drivers for boards without Ethernet.
-endef
-
-$(eval $(call Profile,BEAGLEBOARD))


From lede-commits at lists.infradead.org  Mon Apr 24 09:58:11 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:58:11 -0400
Subject: [source]  netifd: return error status in reload_service
In-Reply-To: <20170424165809.27286.4007@git-01.infra.lede-project.org>
References: <20170424165809.27286.4007@git-01.infra.lede-project.org>
Message-ID: <mailman.25820.1493053258.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/4b195a611fe146969e813ce77ecf74ce5f9c176b

commit 4b195a611fe146969e813ce77ecf74ce5f9c176b
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Fri Apr 21 11:44:57 2017 +0200

    netifd: return error status in reload_service
    
    Based on a patch by Alexandru Ardelean.
    netifd ubus reload call returns the actual reload error status;
    return error status as well in reload_service
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/config/netifd/files/etc/init.d/network | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network
index a825dfd..6cd167d 100755
--- a/package/network/config/netifd/files/etc/init.d/network
+++ b/package/network/config/netifd/files/etc/init.d/network
@@ -26,9 +26,12 @@ start_service() {
 }
 
 reload_service() {
+	local rv=0
+
 	init_switch
-	ubus call network reload
+	ubus call network reload || rv=1
 	/sbin/wifi reload_legacy
+	return $rv
 }
 
 stop_service() {


From lede-commits at lists.infradead.org  Mon Apr 24 09:58:10 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:58:10 -0400
Subject: [source]  netifd: update to git HEAD version
In-Reply-To: <20170424165809.27286.4007@git-01.infra.lede-project.org>
References: <20170424165809.27286.4007@git-01.infra.lede-project.org>
Message-ID: <mailman.25821.1493053258.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/8e37d5b584f944aeea375d348ded21b28fa07c3c

commit 8e37d5b584f944aeea375d348ded21b28fa07c3c
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Mon Apr 24 13:28:02 2017 +0200

    netifd: update to git HEAD version
    
    11cb9cf ubus: add interface method to trigger renew event
    4375d1b system-linux: allow "throw" route type
    5fbd904 netifd: propagate error code on netifd_reload()
    6e0acec interface-ip: fix device name for IPv6 link-local DNS server
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/config/netifd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index f1cdfa1..2a32888 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/netifd.git
-PKG_SOURCE_DATE:=2017-03-21
-PKG_SOURCE_VERSION:=a03216660797173fbe67866f75564e3fec9c1e8d
-PKG_MIRROR_HASH:=a488b17929ab9f05241bc92ea177594986f1775a1355e457c1a20ce0280a5404
+PKG_SOURCE_DATE:=2017-04-12
+PKG_SOURCE_VERSION:=11cb9cfbb088740ee7ee5e6c6b661958c0f962cb
+PKG_MIRROR_HASH:=48abf3a238c3046f37b2dd9b77d246befc80dc7decc849e67ba0542a9052ed02
 PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
 
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Mon Apr 24 09:58:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Mon, 24 Apr 2017 12:58:09 -0400
Subject: [source]  odhcpd: update to git HEAD version
In-Reply-To: <20170424165809.27286.4007@git-01.infra.lede-project.org>
References: <20170424165809.27286.4007@git-01.infra.lede-project.org>
Message-ID: <mailman.25822.1493053259.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/6fd65820144689a2aaf2fad9c09f6f9925e240ae

commit 6fd65820144689a2aaf2fad9c09f6f9925e240ae
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Mon Apr 24 18:39:59 2017 +0200

    odhcpd: update to git HEAD version
    
    570069d ubus: rework dumping IPv6 and IPv4 leases
    4e579c4 dhcpv6-ia: simplify logic to write statefile and dhcpv6 logging
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/odhcpd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index 322460c..9c26583 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-03-29
-PKG_SOURCE_VERSION:=3d9f4067d56660a2c75ab2ce9b801ae1a4ff4cde
-PKG_MIRROR_HASH:=d4ffa35979dbba55a2ce1cc92085ed6a5fb4fa59c2da7412126db1b3a00599e8
+PKG_SOURCE_DATE:=2017-04-21
+PKG_SOURCE_VERSION:=570069d3e16e7679676ceeb1e973c1342a2f2684
+PKG_MIRROR_HASH:=f61732ae768f1b2801222dd44c272ace0318c10b77dba7947c6a857d10e3f5a7
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh at gmail.com>
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:33 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:33 -0400
Subject: [source]  generic: rtl8366rb: add support for initvals from DTS
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26025.1493141459.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/f4ae444f3ed94d89ea6d239c944ae2956ba92d3b

commit f4ae444f3ed94d89ea6d239c944ae2956ba92d3b
Author: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
AuthorDate: Thu Apr 20 19:14:35 2017 +0100

    generic: rtl8366rb: add support for initvals from DTS
    
    Allow per-device initvals in the DTS file for rlt8366rb
    switches.
    
    Shamelessly copies 30494598f891fc4436a49eca55fc31d03c087841
    
    Signed-off-by: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
---
 .../generic/files/drivers/net/phy/rtl8366rb.c      | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
index a0aaabf..264343a 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
@@ -282,6 +282,31 @@ static int rtl8366rb_reset_chip(struct rtl8366_smi *smi)
 static int rtl8366rb_setup(struct rtl8366_smi *smi)
 {
 	int err;
+#ifdef CONFIG_OF
+	unsigned i;
+	struct device_node *np;
+	unsigned num_initvals;
+	const __be32 *paddr;
+
+	np = smi->parent->of_node;
+
+	paddr = of_get_property(np, "realtek,initvals", &num_initvals);
+	if (paddr) {
+		dev_info(smi->parent, "applying initvals from DTS\n");
+
+		if (num_initvals < (2 * sizeof(*paddr)))
+			return -EINVAL;
+
+		num_initvals /= sizeof(*paddr);
+
+		for (i = 0; i < num_initvals - 1; i += 2) {
+			u32 reg = be32_to_cpup(paddr + i);
+			u32 val = be32_to_cpup(paddr + i + 1);
+
+			REG_WR(smi, reg, val);
+		}
+	}
+#endif
 
 	/* set maximum packet length to 1536 bytes */
 	REG_RMW(smi, RTL8366RB_SGCR, RTL8366RB_SGCR_MAX_LENGTH_MASK,


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:37 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:37 -0400
Subject: [source]  ramips: add support for ZBT-WE1326
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26026.1493141459.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/ff258effd508fc75edfb08ba709b333619d3f1e8

commit ff258effd508fc75edfb08ba709b333619d3f1e8
Author: Jiawei Wang <buaawjw at gmail.com>
AuthorDate: Thu Apr 20 11:07:26 2017 +0800

    ramips: add support for ZBT-WE1326
    
    Specification:
    - SoC: MT7621AT, MT7603EN and MT7612EN
    - Flash: 16 MiB (W25Q128FVSG)
    - RAM: 512 MiB (EM6GE16EWXD-12H)
    - Ethernet: 1 x WAN (10/100/1000Mbps) and 4 x LAN (10/100/1000 Mbps)
    - Others: USB 2.0, micro SD slot, reset button and 8 x LEDs
    
    Issues:
    - Two LEDs for 2.4 GHz and 5 GHz Wi-Fi do not work, can't find GPIOs.
    - The pwr LED is not GPIO controllable
    
    How to install:
    - The original firmware is OpenWrt, so both LuCI or sysupgrade can be used.
    - Do not keep settings, for sysupgrade please use the -n option.
    
    Signed-off-by: Jiawei Wang <buaawjw at gmail.com>
---
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ramips/dts/ZBT-WE1326.dts             | 107 +++++++++++++++++++++
 target/linux/ramips/image/mt7621.mk                |   8 ++
 5 files changed, 120 insertions(+)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index ecfa8a6..1abe139 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -112,6 +112,7 @@ ramips_setup_interfaces()
 	y1|\
 	youku-yk1|\
 	zbt-ape522ii|\
+	zbt-we1326|\
 	zbt-we826|\
 	zbt-wg2626|\
 	zbt-wg3526|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index eec9612..61f8a70 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -649,6 +649,9 @@ ramips_board_detect() {
 	*"ZBT-WA05")
 		name="zbt-wa05"
 		;;
+	*"ZBT-WE1326")
+		name="zbt-we1326"
+		;;
 	*"ZBT-WE2026")
 		name="zbt-we2026"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 036e19a..ae5a07b 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -192,6 +192,7 @@ platform_check_image() {
 	zbt-ape522ii|\
 	zbt-cpe102|\
 	zbt-wa05|\
+	zbt-we1326|\
 	zbt-we2026|\
 	zbt-we826|\
 	zbt-wg2626|\
diff --git a/target/linux/ramips/dts/ZBT-WE1326.dts b/target/linux/ramips/dts/ZBT-WE1326.dts
new file mode 100644
index 0000000..0dc2c77
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WE1326.dts
@@ -0,0 +1,107 @@
+/dts-v1/;
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "ZBT-WE1326";
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x1c000000>, <0x20000000 0x4000000>;
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "wdt";
+			ralink,function = "gpio";
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	m25p80 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+		m25p,chunked-io = <32>;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		factory: partition at 40000 {
+			label = "factory";
+			reg = <0x40000 0x10000>;
+			read-only;
+		};
+
+		partition at 50000 {
+			label = "firmware";
+			reg = <0x50000 0xfb0000>;
+		};
+	};
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0xe000>;
+};
+
+&pcie {
+	status = "okay";
+
+	pcie0 {
+		mt76 at 0,0 {
+			reg = <0x0000 0 0 0 0>;
+			device_type = "pci";
+			mediatek,mtd-eeprom = <&factory 0x8000>;
+			ieee80211-freq-limit = <5000000 6000000>;
+		};
+	};
+
+	pcie1 {
+		mt76 at 1,0 {
+			reg = <0x0000 0 0 0 0>;
+			device_type = "pci";
+			mediatek,mtd-eeprom = <&factory 0x0000>;
+			ieee80211-freq-limit = <2400000 2500000>;
+		};
+	};
+};
+
+&sdhci {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index feda0f1..0e418fe 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -245,6 +245,14 @@ define Device/wsr-600
 endef
 TARGET_DEVICES += wsr-600
 
+define Device/zbt-we1326
+  DTS := ZBT-WE1326
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := ZBT WE1326
+  DEVICE_PACKAGES := kmod-usb3 kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += zbt-we1326
+
 define Device/zbt-wg2626
   DTS := ZBT-WG2626
   IMAGE_SIZE := $(ralink_default_fw_size_16M)


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:41 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:41 -0400
Subject: [source] ramips: use the ZBT-WE826 power LED for status indication
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26027.1493141461.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/725238f698c94656dc216bdd6ae6e3275f266ea4

commit 725238f698c94656dc216bdd6ae6e3275f266ea4
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Apr 12 07:56:40 2017 +0200

    ramips: use the ZBT-WE826 power LED for status indication
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/base-files/etc/board.d/01_leds | 1 -
 target/linux/ramips/base-files/etc/diag.sh         | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index d11d9c3..5aab21c 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -397,7 +397,6 @@ zbt-we2026)
 	;;
 zbt-we826-16M|\
 zbt-we826-32M)
-	ucidef_set_led_default "power" "power" "zbt-we826:green:power" "1"
 	set_wifi_led "zbt-we826:green:wifi"
 	set_usb_led "zbt-we826:green:usb"
 	;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index f2aca34..461f46c 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -274,7 +274,7 @@ get_status_led() {
 		;;
 	zbt-we826-16M|\
 	zbt-we826-32M)
-		status_led="zbt-we826:green:wifi"
+		status_led="zbt-we826:green:power"
 		;;
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M)


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:35 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:35 -0400
Subject: [source]  ramips: fix ZyXEL Keenetic Omni switch config
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26028.1493141461.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/3549bad8147f7795dc6334cd8f73ea389b1a62e0

commit 3549bad8147f7795dc6334cd8f73ea389b1a62e0
Author: Alexey Belyaev <spider at spider.vc>
AuthorDate: Sun Apr 23 02:46:23 2017 +0600

    ramips: fix ZyXEL Keenetic Omni switch config
    
    The wan port is connected to switch port 0. Fix the mediatek,portmap as
    well as the default switch config.
    
    Signed-off-by: Alexey Belyaev <spider at spider.vc>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 2 +-
 target/linux/ramips/dts/kn_rc.dts                     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 99c3ad6..ecfa8a6 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -85,6 +85,7 @@ ramips_setup_interfaces()
 	hc5661a|\
 	hc5962|\
 	hlk-rm04|\
+	kn_rc|\
 	mac1200rv2|\
 	miwifi-mini|\
 	miwifi-nano|\
@@ -227,7 +228,6 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6 at eth0"
 		;;
-	kn_rc|\
 	kn_rf)
 		ucidef_add_switch "switch0" \
 			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6 at eth0"
diff --git a/target/linux/ramips/dts/kn_rc.dts b/target/linux/ramips/dts/kn_rc.dts
index e25783f..3c9dfb4 100644
--- a/target/linux/ramips/dts/kn_rc.dts
+++ b/target/linux/ramips/dts/kn_rc.dts
@@ -115,7 +115,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = "wllll";
+	mediatek,portmap = "llllw";
 };
 
 &wmac {


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:34 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:34 -0400
Subject: [source]  lantiq: DGN3500: make switch LEDs blink on activity
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26029.1493141461.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/42120bd7f323ff7170b32a5fd4674babd8b184bc

commit 42120bd7f323ff7170b32a5fd4674babd8b184bc
Author: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
AuthorDate: Thu Apr 20 19:14:57 2017 +0100

    lantiq: DGN3500: make switch LEDs blink on activity
    
    Make switch port LEDs blink on activity as they do with stock firmware.
    
    The u-boot loader sets suitable values in the LED control register that
    unfortunately get blown away by the linux switch driver init.  Restore
    that value by using driver 'initvals'.  0x0431 is the led control
    register, the value 0x0960. Each nybble represents each LED's mode
    (LED3,2,1,0) in this case OFF, 1000LINK+Activity, 100/10LINK+Activity,
    OFF.  Only LED1&2 are physically present.
    
    Enabling the blinkenlights exposed the fact that an RRCP packet was
    being emitted by the switch on all ports every second.  Further initvals
    copied from stock firmware's u-boot driver disabled this 'feature'.
    
    Signed-off-by: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
---
 target/linux/lantiq/dts/DGN3500.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/target/linux/lantiq/dts/DGN3500.dtsi b/target/linux/lantiq/dts/DGN3500.dtsi
index 890b49f..d58d717 100644
--- a/target/linux/lantiq/dts/DGN3500.dtsi
+++ b/target/linux/lantiq/dts/DGN3500.dtsi
@@ -75,8 +75,23 @@
 		compatible = "realtek,rtl8366rb";
 		gpio-sda = <&gpio 35 GPIO_ACTIVE_HIGH>;
 		gpio-sck = <&gpio 37 GPIO_ACTIVE_HIGH>;
+
+		realtek,initvals = <
+			0x0000 0x0830
+			0x0400 0x8130
+			0x000A 0x83ED
+			0x0F51 0x0017
+			0x02F5 0x0048
+			0x02FA 0xFFDF
+			0x02FB 0xFFE0
+			0x0450 0x0000
+			0x0401 0x0000
+			0x0431 0x0960
+		>;
 	};
 
+
+
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:36 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:36 -0400
Subject: [source]  ramips: fix ZyXEL Keenetic Omni/Omni II GPIOs
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26030.1493141461.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/187624f759f6ee3ede1697d9cfbc648a92a18ef1

commit 187624f759f6ee3ede1697d9cfbc648a92a18ef1
Author: Alexey Belyaev <spider at spider.vc>
AuthorDate: Sun Apr 23 02:46:23 2017 +0600

    ramips: fix ZyXEL Keenetic Omni/Omni II GPIOs
    
    Each GPIO bank has only 24 gpios. Use and enable the correct banks for
    GPIOs > 24.
    
    Signed-off-by: Alexey Belyaev <spider at spider.vc>
---
 target/linux/ramips/dts/kn_rc.dts | 14 +++++++++++---
 target/linux/ramips/dts/kn_rf.dts | 14 +++++++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/target/linux/ramips/dts/kn_rc.dts b/target/linux/ramips/dts/kn_rc.dts
index 3c9dfb4..d275902 100644
--- a/target/linux/ramips/dts/kn_rc.dts
+++ b/target/linux/ramips/dts/kn_rc.dts
@@ -13,17 +13,17 @@
 
 		wan {
 			label = "kn_rc:green:wan";
-			gpios = <&gpio0 38 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
 			label = "kn_rc:green:usb";
-			gpios = <&gpio0 39 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi {
 			label = "kn_rc:green:wifi";
-			gpios = <&gpio0 72 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
 		};
 
 		power {
@@ -69,6 +69,14 @@
 	};
 };
 
+&gpio1 {
+	status = "okay";
+};
+
+&gpio3 {
+	status = "okay";
+};
+
 &spi0 {
 	status = "okay";
 
diff --git a/target/linux/ramips/dts/kn_rf.dts b/target/linux/ramips/dts/kn_rf.dts
index 4f2b710..a65fda1 100644
--- a/target/linux/ramips/dts/kn_rf.dts
+++ b/target/linux/ramips/dts/kn_rf.dts
@@ -13,7 +13,7 @@
 
 		wan {
 			label = "kn_rc:green:wan";
-			gpios = <&gpio0 38 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
@@ -23,12 +23,12 @@
 
 		wifi {
 			label = "kn_rc:green:wifi";
-			gpios = <&gpio0 72 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
 		};
 
 		power {
 			label = "kn_rc:green:power";
-			gpios = <&gpio0 39 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
 		};
 	};
 
@@ -69,6 +69,14 @@
 	};
 };
 
+&gpio1 {
+	status = "okay";
+};
+
+&gpio3 {
+	status = "okay";
+};
+
 &spi0 {
 	status = "okay";
 


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:40 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:40 -0400
Subject: [source]  ramips: add ZBT-WE826 32MB variant
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26031.1493141461.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/2ddaf96a77a92186447ca18935b8a36d46d3db95

commit 2ddaf96a77a92186447ca18935b8a36d46d3db95
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Apr 12 07:53:56 2017 +0200

    ramips: add ZBT-WE826 32MB variant
    
    The ZBT-WG826 is available with 16 or 32 MByte of flash. Split the
    device tree source file, rename the currently supported 16 MByte
    version and add the 32 MByte variant.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/base-files/etc/board.d/01_leds      |  9 +++++----
 target/linux/ramips/base-files/etc/board.d/02_network   |  3 ++-
 target/linux/ramips/base-files/etc/diag.sh              |  7 +++++--
 target/linux/ramips/base-files/lib/ramips.sh            |  7 +++++--
 target/linux/ramips/base-files/lib/upgrade/platform.sh  |  3 ++-
 target/linux/ramips/dts/ZBT-WE826-16M.dts               | 12 ++++++++++++
 target/linux/ramips/dts/ZBT-WE826-32M.dts               | 12 ++++++++++++
 .../linux/ramips/dts/{ZBT-WE826.dts => ZBT-WE826.dtsi}  |  6 +-----
 target/linux/ramips/image/mt7620.mk                     | 17 +++++++++++++----
 9 files changed, 57 insertions(+), 19 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 213f2ed..d11d9c3 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -395,10 +395,11 @@ zbt-wa05)
 zbt-we2026)
 	set_wifi_led "$board:green:wlan"
 	;;
-zbt-we826)
-	ucidef_set_led_default "power" "power" "$board:green:power" "1"
-	set_wifi_led "$board:green:wifi"
-	set_usb_led "$board:green:usb"
+zbt-we826-16M|\
+zbt-we826-32M)
+	ucidef_set_led_default "power" "power" "zbt-we826:green:power" "1"
+	set_wifi_led "zbt-we826:green:wifi"
+	set_usb_led "zbt-we826:green:usb"
 	;;
 zbt-wr8305rt)
 	ucidef_set_led_default "power" "power" "$board:green:sys" "1"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 016d293..80a3bc2 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -112,7 +112,8 @@ ramips_setup_interfaces()
 	youku-yk1|\
 	zbt-ape522ii|\
 	zbt-we1326|\
-	zbt-we826|\
+	zbt-we826-16M|\
+	zbt-we826-32M|\
 	zbt-wg2626|\
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 8b5e260..f2aca34 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -189,8 +189,7 @@ get_status_led() {
 		status_led="$board:amber:system"
 		;;
 	oy-0001|\
-	sl-r7205|\
-	zbt-we826)
+	sl-r7205)
 		status_led="$board:green:wifi"
 		;;
 	psr-680w)
@@ -273,6 +272,10 @@ get_status_led() {
 	zbt-cpe102)
 		status_led="$board:green:4g-0"
 		;;
+	zbt-we826-16M|\
+	zbt-we826-32M)
+		status_led="zbt-we826:green:wifi"
+		;;
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M)
 		status_led="zbt-wg3526:green:status"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 3342a8f..87cb7ff 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -652,8 +652,11 @@ ramips_board_detect() {
 	*"ZBT-WE2026")
 		name="zbt-we2026"
 		;;
-	*"ZBT-WE826")
-		name="zbt-we826"
+	*"ZBT-WE826 (16M)")
+		name="zbt-we826-16M"
+		;;
+	*"ZBT-WE826 (32M)")
+		name="zbt-we826-32M"
 		;;
 	*"ZBT-WG2626")
 		name="zbt-wg2626"
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 8c7f959..adad8da 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -193,7 +193,8 @@ platform_check_image() {
 	zbt-wa05|\
 	zbt-we1326|\
 	zbt-we2026|\
-	zbt-we826|\
+	zbt-we826-16M|\
+	zbt-we826-32M|\
 	zbt-wg2626|\
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M|\
diff --git a/target/linux/ramips/dts/ZBT-WE826-16M.dts b/target/linux/ramips/dts/ZBT-WE826-16M.dts
new file mode 100644
index 0000000..de3c4c1
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WE826-16M.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "ZBT-WG3526.dtsi"
+
+/ {
+	compatible = "zbtlink,zbt-we826-16m", "zbtlink,zbt-we826", "ralink,mt7620a-soc";
+	model = "ZBT-WE826 (16M)";
+};
+
+&firmware {
+	reg = <0x50000 0xfb0000>;
+};
\ No newline at end of file
diff --git a/target/linux/ramips/dts/ZBT-WE826-32M.dts b/target/linux/ramips/dts/ZBT-WE826-32M.dts
new file mode 100644
index 0000000..c8383cb
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WE826-32M.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "ZBT-WG3526.dtsi"
+
+/ {
+	compatible = "zbtlink,zbt-we826-32m", "zbtlink,zbt-we826", "ralink,mt7620a-soc";
+	model = "ZBT-WE826 (32M)";
+};
+
+&firmware {
+	reg = <0x50000 0x1fb0000>;
+};
\ No newline at end of file
diff --git a/target/linux/ramips/dts/ZBT-WE826.dts b/target/linux/ramips/dts/ZBT-WE826.dtsi
similarity index 92%
rename from target/linux/ramips/dts/ZBT-WE826.dts
rename to target/linux/ramips/dts/ZBT-WE826.dtsi
index 8a453bc..62ea419 100644
--- a/target/linux/ramips/dts/ZBT-WE826.dts
+++ b/target/linux/ramips/dts/ZBT-WE826.dtsi
@@ -5,9 +5,6 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "zbtlink,zbt-we826", "ralink,mt7620a-soc";
-	model = "ZBT-WE826";
-
 	chosen {
 		bootargs = "console=ttyS0,115200";
 	};
@@ -81,9 +78,8 @@
 			read-only;
 		};
 
-		partition at 50000 {
+		firmware: partition at 50000 {
 			label = "firmware";
-			reg = <0x50000 0xfb0000>;
 		};
 	};
 };
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 83c9a7f..71b651c 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -484,13 +484,22 @@ define Device/zbt-we2026
 endef
 TARGET_DEVICES += zbt-we2026
 
-define Device/zbt-we826
-  DTS := ZBT-WE826
+define Device/zbt-we826-16M
+  DTS := ZBT-WE826-16M
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
-  DEVICE_TITLE := Zbtlink ZBT-WE826
+  SUPPORTED_DEVICES += zbt-we826
+  DEVICE_TITLE := Zbtlink ZBT-WE826 (16M)
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620 
 endef
-TARGET_DEVICES += zbt-we826
+TARGET_DEVICES += zbt-we826-16M
+
+define Device/zbt-we826-32M
+  DTS := ZBT-WE826-32M
+  IMAGE_SIZE := $(ralink_default_fw_size_32M)
+  DEVICE_TITLE := Zbtlink ZBT-WE826 (32M)
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += zbt-we826-32M
 
 define Device/zbt-wr8305rt
   DTS := ZBT-WR8305RT


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:38 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:38 -0400
Subject: [source]  ramips: prepare ZBT-WG3526 for hardware variants
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26034.1493141465.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/619d68bfc90e548e3398b26a2a0ca3fccd7d3f38

commit 619d68bfc90e548e3398b26a2a0ca3fccd7d3f38
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Fri Apr 7 23:52:27 2017 +0200

    ramips: prepare ZBT-WG3526 for hardware variants
    
    The ZBT-WG3526 is available with 16 or 32 MByte of flash. Rename the
    current supported 16MByte version to indicate which flash size variant
    is supported.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/base-files/etc/board.d/02_network          | 2 +-
 target/linux/ramips/base-files/etc/diag.sh                     | 6 ++++--
 target/linux/ramips/base-files/lib/ramips.sh                   | 4 ++--
 target/linux/ramips/base-files/lib/upgrade/platform.sh         | 2 +-
 target/linux/ramips/dts/{ZBT-WG3526.dts => ZBT-WG3526-16M.dts} | 2 +-
 target/linux/ramips/image/mt7621.mk                            | 9 +++++----
 6 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 1abe139..391a8b6 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -115,7 +115,7 @@ ramips_setup_interfaces()
 	zbt-we1326|\
 	zbt-we826|\
 	zbt-wg2626|\
-	zbt-wg3526|\
+	zbt-wg3526-16M|\
 	zbt-wr8305rt)
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6 at eth0"
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index e5b4b59..999ad9f 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -79,8 +79,7 @@ get_status_led() {
 	rut5xx|\
 	v11st-fe|\
 	wmr-300|\
-	zbt-wg2626|\
-	zbt-wg3526)
+	zbt-wg2626)
 		status_led="$board:green:status"
 		;;
 	ai-br100|\
@@ -275,6 +274,9 @@ get_status_led() {
 	zbt-cpe102)
 		status_led="$board:green:4g-0"
 		;;
+	zbt-wg3526-16M)
+		status_led="zbt-wg3526:green:status"
+		;;
 	esac
 }
 
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 61f8a70..d0abd2d 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -661,8 +661,8 @@ ramips_board_detect() {
 	*"ZBT-WG2626")
 		name="zbt-wg2626"
 		;;
-	*"ZBT-WG3526")
-		name="zbt-wg3526"
+	*"ZBT-WG3526 (16M)")
+		name="zbt-wg3526-16M"
 		;;
 	*"ZBT-WR8305RT")
 		name="zbt-wr8305rt"
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index ae5a07b..f329b43 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -196,7 +196,7 @@ platform_check_image() {
 	zbt-we2026|\
 	zbt-we826|\
 	zbt-wg2626|\
-	zbt-wg3526|\
+	zbt-wg3526-16M|\
 	zbt-wr8305rt|\
 	zte-q7|\
 	youku-yk1)
diff --git a/target/linux/ramips/dts/ZBT-WG3526.dts b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
similarity index 83%
rename from target/linux/ramips/dts/ZBT-WG3526.dts
rename to target/linux/ramips/dts/ZBT-WG3526-16M.dts
index c361bdd..fb64450 100644
--- a/target/linux/ramips/dts/ZBT-WG3526.dts
+++ b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
@@ -3,7 +3,7 @@
 #include "ZBT-WG3526.dtsi"
 
 / {
-	model = "ZBT-WG3526";
+	model = "ZBT-WG3526 (16M)";
 };
 
 &firmware {
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 0e418fe..ae5bf5e 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -261,13 +261,14 @@ define Device/zbt-wg2626
 endef
 TARGET_DEVICES += zbt-wg2626
 
-define Device/zbt-wg3526
-  DTS := ZBT-WG3526
+define Device/zbt-wg3526-16M
+  DTS := ZBT-WG3526-16M
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
-  DEVICE_TITLE := ZBT WG3526
+  SUPPORTED_DEVICES += zbt-wg3526
+  DEVICE_TITLE := ZBT WG3526 (16MB flash)
   DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620
 endef
-TARGET_DEVICES += zbt-wg3526
+TARGET_DEVICES += zbt-wg3526-16M
 
 # FIXME: is this still needed?
 define Image/Prepare


From lede-commits at lists.infradead.org  Tue Apr 25 10:30:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Tue, 25 Apr 2017 13:30:39 -0400
Subject: [source]  ramips: rename Digineo AC1200 Pro to ZBT-WG3526 32MB
In-Reply-To: <20170425173033.2680.50731@git-01.infra.lede-project.org>
References: <20170425173033.2680.50731@git-01.infra.lede-project.org>
Message-ID: <mailman.26035.1493141465.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/3cfc909c54c07d5a24d9a1a7496142b82d580878

commit 3cfc909c54c07d5a24d9a1a7496142b82d580878
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Apr 1 10:46:44 2017 +0200

    ramips: rename Digineo AC1200 Pro to ZBT-WG3526 32MB
    
    The Digineo AC1200 Pro is the 32MB flash variant of the ZBT-WG3526 with
    unpopulated/exposed sdhci slot. Rename to board to the OEM/ODM name and
    add the sdhci kernel module to use it for multiple clones.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/base-files/etc/board.d/02_network   |  2 +-
 target/linux/ramips/base-files/etc/diag.sh              | 12 ++++++------
 target/linux/ramips/base-files/lib/ramips.sh            |  6 +++---
 target/linux/ramips/base-files/lib/upgrade/platform.sh  |  2 +-
 target/linux/ramips/dts/ZBT-WG3526-16M.dts              |  4 ----
 .../ramips/dts/{AC1200pro.dts => ZBT-WG3526-32M.dts}    |  6 +-----
 target/linux/ramips/dts/ZBT-WG3526.dtsi                 |  3 ++-
 target/linux/ramips/image/mt7621.mk                     | 17 +++++++++--------
 8 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 391a8b6..016d293 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -72,7 +72,6 @@ ramips_setup_interfaces()
 		ucidef_set_interface_lan "eth0.2"
 		;;
 	3g-6200n|\
-	ac1200pro|\
 	ai-br100|\
 	d240|\
 	db-wrt01|\
@@ -116,6 +115,7 @@ ramips_setup_interfaces()
 	zbt-we826|\
 	zbt-wg2626|\
 	zbt-wg3526-16M|\
+	zbt-wg3526-32M|\
 	zbt-wr8305rt)
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6 at eth0"
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 999ad9f..8b5e260 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -58,7 +58,10 @@ get_status_led() {
 	wn3000rpv3)
 		status_led="$board:red:power"
 		;;
-	ac1200pro|\
+	ai-br100|\
+	ht-tm02)
+		status_led="$board:blue:wlan"
+		;;
 	all0239-3g|\
 	dcs-930|\
 	dir-300-b1|\
@@ -82,10 +85,6 @@ get_status_led() {
 	zbt-wg2626)
 		status_led="$board:green:status"
 		;;
-	ai-br100|\
-	ht-tm02)
-		status_led="$board:blue:wlan"
-		;;
 	asl26555-8M|\
 	asl26555-16M)
 		status_led="asl26555:green:power"
@@ -274,7 +273,8 @@ get_status_led() {
 	zbt-cpe102)
 		status_led="$board:green:4g-0"
 		;;
-	zbt-wg3526-16M)
+	zbt-wg3526-16M|\
+	zbt-wg3526-32M)
 		status_led="zbt-wg3526:green:status"
 		;;
 	esac
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index d0abd2d..3342a8f 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -130,9 +130,6 @@ ramips_board_detect() {
 	*"DCS-930L B1")
 		name="dcs-930l-b1"
 		;;
-	*"Digineo AC1200 Pro")
-		name="ac1200pro"
-		;;
 	*"DIR-300 B1")
 		name="dir-300-b1"
 		;;
@@ -664,6 +661,9 @@ ramips_board_detect() {
 	*"ZBT-WG3526 (16M)")
 		name="zbt-wg3526-16M"
 		;;
+	*"ZBT-WG3526 (32M)")
+		name="zbt-wg3526-32M"
+		;;
 	*"ZBT-WR8305RT")
 		name="zbt-wr8305rt"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index f329b43..8c7f959 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -17,7 +17,6 @@ platform_check_image() {
 	3g150b|\
 	3g300m|\
 	a5-v11|\
-	ac1200pro|\
 	ai-br100|\
 	air3gii|\
 	all0239-3g|\
@@ -197,6 +196,7 @@ platform_check_image() {
 	zbt-we826|\
 	zbt-wg2626|\
 	zbt-wg3526-16M|\
+	zbt-wg3526-32M|\
 	zbt-wr8305rt|\
 	zte-q7|\
 	youku-yk1)
diff --git a/target/linux/ramips/dts/ZBT-WG3526-16M.dts b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
index fb64450..1e2f152 100644
--- a/target/linux/ramips/dts/ZBT-WG3526-16M.dts
+++ b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
@@ -9,7 +9,3 @@
 &firmware {
 	reg = <0x50000 0xfb0000>;
 };
-
-&status_led {
-	label = "zbt-wg3526:green:status";
-};
diff --git a/target/linux/ramips/dts/AC1200pro.dts b/target/linux/ramips/dts/ZBT-WG3526-32M.dts
similarity index 51%
rename from target/linux/ramips/dts/AC1200pro.dts
rename to target/linux/ramips/dts/ZBT-WG3526-32M.dts
index fbec818..99a4b45 100644
--- a/target/linux/ramips/dts/AC1200pro.dts
+++ b/target/linux/ramips/dts/ZBT-WG3526-32M.dts
@@ -3,13 +3,9 @@
 #include "ZBT-WG3526.dtsi"
 
 / {
-	model = "Digineo AC1200 Pro";
+	model = "ZBT-WG3526 (32M)";
 };
 
 &firmware {
 	reg = <0x50000 0x1fb0000>;
 };
-
-&status_led {
-	label = "ac1200pro:green:status";
-};
diff --git a/target/linux/ramips/dts/ZBT-WG3526.dtsi b/target/linux/ramips/dts/ZBT-WG3526.dtsi
index 582e420..5e195fb 100644
--- a/target/linux/ramips/dts/ZBT-WG3526.dtsi
+++ b/target/linux/ramips/dts/ZBT-WG3526.dtsi
@@ -35,7 +35,8 @@
 	gpio-leds {
 		compatible = "gpio-leds";
 
-		status_led: status {
+		status {
+			label = "zbt-wg3526:green:status";
 			gpios = <&gpio0 24 1>;
 		};
 	};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index ae5bf5e..b57552a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -34,14 +34,6 @@ define Device/11acnas
 endef
 TARGET_DEVICES += 11acnas
 
-define Device/ac1200pro
-  DTS := AC1200pro
-  IMAGE_SIZE := $(ralink_default_fw_size_32M)
-  DEVICE_TITLE := Digineo AC1200 Pro
-  DEVICE_PACKAGES := kmod-usb3 kmod-ata-core kmod-ata-ahci
-endef
-TARGET_DEVICES += ac1200pro
-
 define Device/dir-860l-b1
   DTS := DIR-860L-B1
   BLOCKSIZE := 64k
@@ -270,6 +262,15 @@ define Device/zbt-wg3526-16M
 endef
 TARGET_DEVICES += zbt-wg3526-16M
 
+define Device/zbt-wg3526-32M
+  DTS := ZBT-WG3526-32M
+  IMAGE_SIZE := $(ralink_default_fw_size_32M)
+  SUPPORTED_DEVICES += ac1200pro
+  DEVICE_TITLE := ZBT WG3526 (32MB flash)
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += zbt-wg3526-32M
+
 # FIXME: is this still needed?
 define Image/Prepare
 #define Build/Compile


From lede-commits at lists.infradead.org  Wed Apr 26 01:29:55 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 04:29:55 -0400
Subject: [source]  tools: host/include/getline.h: Remove
In-Reply-To: <20170426082953.30150.46803@git-01.infra.lede-project.org>
References: <20170426082953.30150.46803@git-01.infra.lede-project.org>
Message-ID: <mailman.26106.1493195422.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/74f9c9c1594f205f975723f60448077090a8f014

commit 74f9c9c1594f205f975723f60448077090a8f014
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Wed Apr 12 13:18:49 2017 -0700

    tools: host/include/getline.h: Remove
    
    Seems to be useful only for old and unsupported operating systems. Removed and adjusted the mtd-utils Makefile.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 tools/include/getline.h  | 72 ------------------------------------------------
 tools/mtd-utils/Makefile |  2 +-
 2 files changed, 1 insertion(+), 73 deletions(-)

diff --git a/tools/include/getline.h b/tools/include/getline.h
deleted file mode 100644
index 7b320f7..0000000
--- a/tools/include/getline.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * Copyright (c) 2006 SPARTA, Inc.
- * All rights reserved.
- *
- * This software was developed by SPARTA ISSO under SPAWAR contract
- * N66001-04-C-6019 ("SEFOS").
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __FreeBSD__
-#include <osreldate.h>
-#endif
-
-#if !defined(__linux__) && !defined(__OpenBSD__) && !(defined(__APPLE__) && __DARWIN_C_LEVEL >= 200809L) && !(defined(__FreeBSD__) && __FreeBSD_version >= 800000)
-/*
- * Emulate glibc getline() via BSD fgetln().
- * Note that outsize is not changed unless memory is allocated.
- */
-static inline ssize_t
-getline(char **outbuf, size_t *outsize, FILE *fp)
-{
-	size_t len;
-
-#ifndef __CYGWIN__
-	char *buf;
-	buf = fgetln(fp, &len);
-#else
-	char buf[512];
-	fgets(buf, sizeof(buf), fp);	
-	len = strlen(buf);
-#endif
-	if (buf == NULL)
-		return (-1);
-
-	/* Assumes realloc() accepts NULL for ptr (C99) */
-	if (*outbuf == NULL || *outsize < len + 1) {
-		void *tmp = realloc(*outbuf, len + 1);
-		if (tmp == NULL)
-			return (-1);
-		*outbuf = tmp;
-		*outsize = len + 1;
-	}
-	memcpy(*outbuf, buf, len);
-	(*outbuf)[len] = '\0';
-	return (len);
-}
-#endif
diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile
index 9e920bc..7b4a91a 100644
--- a/tools/mtd-utils/Makefile
+++ b/tools/mtd-utils/Makefile
@@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/host-build.mk
 HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
 CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
 ifneq ($(HOST_OS),Linux)
-CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h -I$(CURDIR)/include -include fls.h
+CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include endian.h -I$(CURDIR)/include -include fls.h
 MTD_STATIC := 0
 else
 MTD_STATIC := 1


From lede-commits at lists.infradead.org  Wed Apr 26 01:29:57 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 04:29:57 -0400
Subject: [source]  mac80211: Backport AR934x OTP Patch
In-Reply-To: <20170426082953.30150.46803@git-01.infra.lede-project.org>
References: <20170426082953.30150.46803@git-01.infra.lede-project.org>
Message-ID: <mailman.26107.1493195424.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/ad0c1d3a310554af94659d82f75ecb5e9013baeb

commit ad0c1d3a310554af94659d82f75ecb5e9013baeb
Author: Chris Blake <chrisrblake93 at gmail.com>
AuthorDate: Mon Mar 27 11:39:07 2017 -0500

    mac80211: Backport AR934x OTP Patch
    
    Merged upstream in https://patchwork.kernel.org/patch/9572541/, this
    patch fixes the OTP offset used by the AR934x and AR955X to properly
    enable reading from the OTP.
    
    Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
    Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
 .../patches/326-ath9k-fix-ar934x-OTP-offsets.patch | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/package/kernel/mac80211/patches/326-ath9k-fix-ar934x-OTP-offsets.patch b/package/kernel/mac80211/patches/326-ath9k-fix-ar934x-OTP-offsets.patch
new file mode 100644
index 0000000..ae6a90f
--- /dev/null
+++ b/package/kernel/mac80211/patches/326-ath9k-fix-ar934x-OTP-offsets.patch
@@ -0,0 +1,42 @@
+From: Christian Lamparter <chunkeey at googlemail.com>
+Date: Tue, 14 Feb 2017 20:10:30 +0100
+Subject: ath9k: use correct OTP register offsets for the AR9340 and AR9550
+
+This patch fixes the OTP register definitions for the AR934x and AR9550
+WMAC SoC.
+
+Previously, the ath9k driver was unable to initialize the integrated
+WMAC on an Aerohive AP121:
+
+| ath: phy0: timeout (1000 us) on reg 0x30018: 0xbadc0ffe & 0x00000007 != 0x00000004
+| ath: phy0: timeout (1000 us) on reg 0x30018: 0xbadc0ffe & 0x00000007 != 0x00000004
+| ath: phy0: Unable to initialize hardware; initialization status: -5
+| ath9k ar934x_wmac: failed to initialize device
+| ath9k: probe of ar934x_wmac failed with error -5
+
+It turns out that the AR9300_OTP_STATUS and AR9300_OTP_DATA
+definitions contain a typo.
+
+Fixes: add295a4afbdf5852d0 "ath9k: use correct OTP register offsets for AR9550"
+Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
+Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+@@ -75,13 +75,13 @@
+ #define AR9300_OTP_BASE \
+ 		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30000 : 0x14000)
+ #define AR9300_OTP_STATUS \
+-		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30018 : 0x15f18)
++		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x31018 : 0x15f18)
+ #define AR9300_OTP_STATUS_TYPE		0x7
+ #define AR9300_OTP_STATUS_VALID		0x4
+ #define AR9300_OTP_STATUS_ACCESS_BUSY	0x2
+ #define AR9300_OTP_STATUS_SM_BUSY	0x1
+ #define AR9300_OTP_READ_DATA \
+-		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3001c : 0x15f1c)
++		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3101c : 0x15f1c)
+
+ enum targetPowerHTRates {
+ 	HT_TARGET_RATE_0_8_16,


From lede-commits at lists.infradead.org  Wed Apr 26 01:29:56 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 04:29:56 -0400
Subject: [source]  ar71xx: Add OTP support for AR934x
In-Reply-To: <20170426082953.30150.46803@git-01.infra.lede-project.org>
References: <20170426082953.30150.46803@git-01.infra.lede-project.org>
Message-ID: <mailman.26108.1493195424.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/064eca14bef97cd3b514cecad79cb26721832076

commit 064eca14bef97cd3b514cecad79cb26721832076
Author: Chris Blake <chrisrblake93 at gmail.com>
AuthorDate: Mon Mar 27 11:38:49 2017 -0500

    ar71xx: Add OTP support for AR934x
    
    The patch 523-MIPS-ath79-OTP-support only supports the OTP offsets for
    AR933x chips, which has changed on newer platforms such as the AR934x.
    The follwoing change is to add support for reading the OTP on the
    AR934x. Tested on an Aerohive AP-121.
    
    Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
    Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
 .../641-MIPS-ath79-fix-AR934x-OTP-offsets.patch    | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/target/linux/ar71xx/patches-4.4/641-MIPS-ath79-fix-AR934x-OTP-offsets.patch b/target/linux/ar71xx/patches-4.4/641-MIPS-ath79-fix-AR934x-OTP-offsets.patch
new file mode 100644
index 0000000..78ecf89
--- /dev/null
+++ b/target/linux/ar71xx/patches-4.4/641-MIPS-ath79-fix-AR934x-OTP-offsets.patch
@@ -0,0 +1,66 @@
+--- a/arch/mips/ath79/dev-wmac.c	2017-02-12 19:49:21.158142253 +0100
++++ b/arch/mips/ath79/dev-wmac.c	2017-02-12 21:01:51.206198122 +0100
+@@ -232,15 +274,27 @@ static void qca956x_wmac_setup(void)
+ 	ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision;
+ }
+
++#define AR93XX_WMAC_SIZE \
++	(soc_is_ar934x() ? AR934X_WMAC_SIZE : AR933X_WMAC_SIZE)
++#define AR93XX_WMAC_BASE \
++	(soc_is_ar934x() ? AR934X_WMAC_BASE : AR933X_WMAC_BASE)
++
++#define AR93XX_OTP_BASE \
++	(soc_is_ar934x() ? AR934X_OTP_BASE : AR9300_OTP_BASE)
++#define AR93XX_OTP_STATUS \
++	(soc_is_ar934x() ? AR934X_OTP_STATUS : AR9300_OTP_STATUS)
++#define AR93XX_OTP_READ_DATA \
++	(soc_is_ar934x() ? AR934X_OTP_READ_DATA : AR9300_OTP_READ_DATA)
++
+ static bool __init
+ ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
+ {
+ 	int timeout = 1000;
+ 	u32 val;
+
+-	__raw_readl(base + AR9300_OTP_BASE + (4 * addr));
++	__raw_readl(base + AR93XX_OTP_BASE + (4 * addr));
+ 	while (timeout--) {
+-		val = __raw_readl(base + AR9300_OTP_STATUS);
++		val = __raw_readl(base + AR93XX_OTP_STATUS);
+ 		if ((val & AR9300_OTP_STATUS_TYPE) == AR9300_OTP_STATUS_VALID)
+ 			break;
+
+@@ -250,7 +304,7 @@ ar93xx_wmac_otp_read_word(void __iomem *
+ 	if (!timeout)
+ 		return false;
+
+-	*data = __raw_readl(base + AR9300_OTP_READ_DATA);
++	*data = __raw_readl(base + AR93XX_OTP_READ_DATA);
+ 	return true;
+ }
+
+@@ -326,7 +380,7 @@ bool __init ar93xx_wmac_read_mac_address
+ 	int mac_start = 2, mac_end = 8;
+
+ 	BUG_ON(!soc_is_ar933x() && !soc_is_ar934x());
+-	base = ioremap_nocache(AR933X_WMAC_BASE, AR933X_WMAC_SIZE);
++	base = ioremap_nocache(AR93XX_WMAC_BASE, AR93XX_WMAC_SIZE);
+ 	while (addr > sizeof(hdr)) {
+ 		if (!ar93xx_wmac_otp_read(base, addr, hdr, sizeof(hdr)))
+ 			break;
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h	2017-02-12 20:22:32.185209249 +0100
++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h	2017-02-12 20:42:21.037382287 +0100
+@@ -172,6 +172,13 @@
+ #define AR9300_OTP_STATUS_SM_BUSY	0x1
+ #define AR9300_OTP_READ_DATA	0x15f1c
+
++#define AR934X_OTP_BASE					0x30000
++#define AR934X_OTP_STATUS				0x31018
++#define AR934X_OTP_READ_DATA				0x3101c
++#define AR934X_OTP_INTF2_ADDRESS			0x31008
++#define AR934X_OTP_INTF3_ADDRESS			0x3100c
++#define AR934X_OTP_PGENB_SETUP_HOLD_TIME_ADDRESS	0x31034
++
+ /*
+  * Hidden Registers
+  */


From lede-commits at lists.infradead.org  Wed Apr 26 01:29:58 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 04:29:58 -0400
Subject: [source] ar71xx: fold 641-MIPS-ath79-fix-AR934x-OTP-offsets.patch
 into the patch that it fixes
In-Reply-To: <20170426082953.30150.46803@git-01.infra.lede-project.org>
References: <20170426082953.30150.46803@git-01.infra.lede-project.org>
Message-ID: <mailman.26109.1493195426.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/837285b83221963739cda81911d8004f30f9afb0

commit 837285b83221963739cda81911d8004f30f9afb0
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Apr 18 09:59:54 2017 +0200

    ar71xx: fold 641-MIPS-ath79-fix-AR934x-OTP-offsets.patch into the patch that it fixes
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../patches-4.4/523-MIPS-ath79-OTP-support.patch   | 36 ++++++++++--
 ...th79-add-ath79_wmac_disable_25ghz-helpers.patch |  2 +-
 .../525-MIPS-ath79-enable-qca-usb-quirks.patch     |  8 +--
 .../601-MIPS-ath79-add-more-register-defines.patch | 20 +++----
 .../patches-4.4/609-MIPS-ath79-ap136-fixes.patch   | 14 ++---
 .../612-MIPS-ath79-set-buffalo-txgain.patch        |  2 +-
 ...-add-ath79_wmac_setup_ext_lna_gpio-helper.patch |  2 +-
 ...20-MIPS-ath79-add-support-for-QCA953x-SoC.patch | 30 +++++-----
 ...21-MIPS-ath79-add-support-for-QCA956x-SoC.patch | 24 ++++----
 ...add-more-register-defines-for-QCA956x-SoC.patch |  4 +-
 .../631-MIPS-ath79-wmac-enable-set-led-pin.patch   |  2 +-
 .../640-MIPS-ath79-add-QCA955x-wmac-reset.patch    |  4 +-
 .../641-MIPS-ath79-fix-AR934x-OTP-offsets.patch    | 66 ----------------------
 .../820-MIPS-ath79-add_gpio_function2_setup.patch  |  4 +-
 .../920-usb-chipidea-AR933x-platform-support.patch |  4 +-
 15 files changed, 91 insertions(+), 131 deletions(-)

diff --git a/target/linux/ar71xx/patches-4.4/523-MIPS-ath79-OTP-support.patch b/target/linux/ar71xx/patches-4.4/523-MIPS-ath79-OTP-support.patch
index e030d7c..6778183 100644
--- a/target/linux/ar71xx/patches-4.4/523-MIPS-ath79-OTP-support.patch
+++ b/target/linux/ar71xx/patches-4.4/523-MIPS-ath79-OTP-support.patch
@@ -1,18 +1,30 @@
 --- a/arch/mips/ath79/dev-wmac.c
 +++ b/arch/mips/ath79/dev-wmac.c
-@@ -167,6 +167,137 @@ static void qca955x_wmac_setup(void)
+@@ -167,6 +167,149 @@ static void qca955x_wmac_setup(void)
  		ath79_wmac_data.is_clk_25mhz = true;
  }
  
++#define AR93XX_WMAC_SIZE \
++	(soc_is_ar934x() ? AR934X_WMAC_SIZE : AR933X_WMAC_SIZE)
++#define AR93XX_WMAC_BASE \
++	(soc_is_ar934x() ? AR934X_WMAC_BASE : AR933X_WMAC_BASE)
++
++#define AR93XX_OTP_BASE \
++	(soc_is_ar934x() ? AR934X_OTP_BASE : AR9300_OTP_BASE)
++#define AR93XX_OTP_STATUS \
++	(soc_is_ar934x() ? AR934X_OTP_STATUS : AR9300_OTP_STATUS)
++#define AR93XX_OTP_READ_DATA \
++	(soc_is_ar934x() ? AR934X_OTP_READ_DATA : AR9300_OTP_READ_DATA)
++
 +static bool __init
 +ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
 +{
 +	int timeout = 1000;
 +	u32 val;
 +
-+	__raw_readl(base + AR9300_OTP_BASE + (4 * addr));
++	__raw_readl(base + AR93XX_OTP_BASE + (4 * addr));
 +	while (timeout--) {
-+		val = __raw_readl(base + AR9300_OTP_STATUS);
++		val = __raw_readl(base + AR93XX_OTP_STATUS);
 +		if ((val & AR9300_OTP_STATUS_TYPE) == AR9300_OTP_STATUS_VALID)
 +			break;
 +
@@ -22,7 +34,7 @@
 +	if (!timeout)
 +		return false;
 +
-+	*data = __raw_readl(base + AR9300_OTP_READ_DATA);
++	*data = __raw_readl(base + AR93XX_OTP_READ_DATA);
 +	return true;
 +}
 +
@@ -98,7 +110,7 @@
 +	int mac_start = 2, mac_end = 8;
 +
 +	BUG_ON(!soc_is_ar933x() && !soc_is_ar934x());
-+	base = ioremap_nocache(AR933X_WMAC_BASE, AR933X_WMAC_SIZE);
++	base = ioremap_nocache(AR93XX_WMAC_BASE, AR93XX_WMAC_SIZE);
 +	while (addr > sizeof(hdr)) {
 +		if (!ar93xx_wmac_otp_read(base, addr, hdr, sizeof(hdr)))
 +			break;
@@ -164,3 +176,17 @@
  /*
   * DDR_CTRL block
   */
+@@ -149,6 +157,13 @@
+ #define AR934X_DDR_REG_FLUSH_PCIE	0xa8
+ #define AR934X_DDR_REG_FLUSH_WMAC	0xac
+ 
++#define AR934X_OTP_BASE					0x30000
++#define AR934X_OTP_STATUS				0x31018
++#define AR934X_OTP_READ_DATA				0x3101c
++#define AR934X_OTP_INTF2_ADDRESS			0x31008
++#define AR934X_OTP_INTF3_ADDRESS			0x3100c
++#define AR934X_OTP_PGENB_SETUP_HOLD_TIME_ADDRESS	0x31034
++
+ /*
+  * PLL block
+  */
diff --git a/target/linux/ar71xx/patches-4.4/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch b/target/linux/ar71xx/patches-4.4/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch
index 31f885f..6f36462 100644
--- a/target/linux/ar71xx/patches-4.4/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch
+++ b/target/linux/ar71xx/patches-4.4/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/dev-wmac.c
 +++ b/arch/mips/ath79/dev-wmac.c
-@@ -298,6 +298,16 @@ bool __init ar93xx_wmac_read_mac_address
+@@ -310,6 +310,16 @@ bool __init ar93xx_wmac_read_mac_address
  	return ret;
  }
  
diff --git a/target/linux/ar71xx/patches-4.4/525-MIPS-ath79-enable-qca-usb-quirks.patch b/target/linux/ar71xx/patches-4.4/525-MIPS-ath79-enable-qca-usb-quirks.patch
index 0e33674..61b6b4e 100644
--- a/target/linux/ar71xx/patches-4.4/525-MIPS-ath79-enable-qca-usb-quirks.patch
+++ b/target/linux/ar71xx/patches-4.4/525-MIPS-ath79-enable-qca-usb-quirks.patch
@@ -29,7 +29,9 @@
 -	u32 bootstrap;
 +	void __iomem *phy_reg;
 +	u32 t;
-+
+ 
+-	bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
+-	if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
 +	phy_reg = ioremap(base, 4);
 +	if (!phy_reg)
 +		return;
@@ -41,9 +43,7 @@
 +
 +	iounmap(phy_reg);
 +}
- 
--	bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
--	if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
++
 +static void ar934x_usb_reset_notifier(struct platform_device *pdev)
 +{
 +	if (pdev->id != -1)
diff --git a/target/linux/ar71xx/patches-4.4/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-4.4/601-MIPS-ath79-add-more-register-defines.patch
index 0126f6a..03ca106 100644
--- a/target/linux/ar71xx/patches-4.4/601-MIPS-ath79-add-more-register-defines.patch
+++ b/target/linux/ar71xx/patches-4.4/601-MIPS-ath79-add-more-register-defines.patch
@@ -58,7 +58,7 @@
  
  #define AR9300_OTP_BASE		0x14000
  #define AR9300_OTP_STATUS	0x15f18
-@@ -174,6 +190,9 @@
+@@ -181,6 +197,9 @@
  #define AR71XX_AHB_DIV_SHIFT		20
  #define AR71XX_AHB_DIV_MASK		0x7
  
@@ -68,7 +68,7 @@
  #define AR724X_PLL_REG_CPU_CONFIG	0x00
  #define AR724X_PLL_REG_PCIE_CONFIG	0x18
  
-@@ -186,6 +205,8 @@
+@@ -193,6 +212,8 @@
  #define AR724X_DDR_DIV_SHIFT		22
  #define AR724X_DDR_DIV_MASK		0x3
  
@@ -77,7 +77,7 @@
  #define AR913X_PLL_REG_CPU_CONFIG	0x00
  #define AR913X_PLL_REG_ETH_CONFIG	0x04
  #define AR913X_PLL_REG_ETH0_INT_CLOCK	0x14
-@@ -198,6 +219,9 @@
+@@ -205,6 +226,9 @@
  #define AR913X_AHB_DIV_SHIFT		19
  #define AR913X_AHB_DIV_MASK		0x1
  
@@ -87,7 +87,7 @@
  #define AR933X_PLL_CPU_CONFIG_REG	0x00
  #define AR933X_PLL_CLOCK_CTRL_REG	0x08
  
-@@ -219,6 +243,8 @@
+@@ -226,6 +250,8 @@
  #define AR934X_PLL_CPU_CONFIG_REG		0x00
  #define AR934X_PLL_DDR_CONFIG_REG		0x04
  #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG		0x08
@@ -96,7 +96,7 @@
  
  #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT	0
  #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK	0x3f
-@@ -251,9 +277,13 @@
+@@ -258,9 +284,13 @@
  #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL	BIT(21)
  #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL	BIT(24)
  
@@ -110,7 +110,7 @@
  
  #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT	0
  #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK	0x3f
-@@ -378,16 +408,83 @@
+@@ -385,16 +415,83 @@
  #define AR913X_RESET_USB_HOST		BIT(5)
  #define AR913X_RESET_USB_PHY		BIT(4)
  
@@ -155,7 +155,7 @@
 +#define AR934X_RESET_LUT		BIT(2)
 +#define AR934X_RESET_MBOX		BIT(1)
 +#define AR934X_RESET_I2S		BIT(0)
-+
+ 
 +#define QCA955X_RESET_HOST		BIT(31)
 +#define QCA955X_RESET_SLIC		BIT(30)
 +#define QCA955X_RESET_HDMA		BIT(29)
@@ -188,13 +188,13 @@
 +#define QCA955X_RESET_LUT		BIT(2)
 +#define QCA955X_RESET_MBOX		BIT(1)
 +#define QCA955X_RESET_I2S		BIT(0)
- 
++
 +#define AR933X_BOOTSTRAP_MDIO_GPIO_EN	BIT(18)
 +#define AR933X_BOOTSTRAP_EEPBUSY	BIT(4)
  #define AR933X_BOOTSTRAP_REF_CLK_40	BIT(0)
  
  #define AR934X_BOOTSTRAP_SW_OPTION8	BIT(23)
-@@ -529,8 +626,22 @@
+@@ -536,8 +633,22 @@
  #define AR71XX_GPIO_REG_INT_ENABLE	0x24
  #define AR71XX_GPIO_REG_FUNC		0x28
  
@@ -217,7 +217,7 @@
  #define AR71XX_GPIO_COUNT		16
  #define AR7240_GPIO_COUNT		18
  #define AR7241_GPIO_COUNT		20
-@@ -560,4 +671,235 @@
+@@ -567,4 +678,235 @@
  #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT	13
  #define AR934X_SRIF_DPLL2_OUTDIV_MASK	0x7
  
diff --git a/target/linux/ar71xx/patches-4.4/609-MIPS-ath79-ap136-fixes.patch b/target/linux/ar71xx/patches-4.4/609-MIPS-ath79-ap136-fixes.patch
index 4d7902e..5d9d802 100644
--- a/target/linux/ar71xx/patches-4.4/609-MIPS-ath79-ap136-fixes.patch
+++ b/target/linux/ar71xx/patches-4.4/609-MIPS-ath79-ap136-fixes.patch
@@ -135,7 +135,8 @@
 +static void __init ap136_common_setup(void)
 +{
 +	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
-+
+ 
+-static int ap136_pci_plat_dev_init(struct pci_dev *dev)
 +	ath79_register_m25p80(NULL);
 +
 +	ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio),
@@ -150,8 +151,7 @@
 +	ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET, NULL);
 +
 +	ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
- 
--static int ap136_pci_plat_dev_init(struct pci_dev *dev)
++
 +	ath79_register_mdio(0, 0x0);
 +	ath79_init_mac(ath79_eth0_data.mac_addr, art + AP136_MAC0_OFFSET, 0);
 +
@@ -211,16 +211,16 @@
 +	/* GMAC0 of the AR8327 switch is connected to GMAC1 via SGMII */
 +	ap136_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_SGMII;
 +	ap136_ar8327_pad0_cfg.sgmii_delay_en = true;
-+
+ 
+-	ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init);
+-	ath79_register_pci();
 +	/* GMAC6 of the AR8327 switch is connected to GMAC0 via RGMII */
 +	ap136_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_RGMII;
 +	ap136_ar8327_pad6_cfg.txclk_delay_en = true;
 +	ap136_ar8327_pad6_cfg.rxclk_delay_en = true;
 +	ap136_ar8327_pad6_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1;
 +	ap136_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2;
- 
--	ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init);
--	ath79_register_pci();
++
 +	ath79_eth0_pll_data.pll_1000 = 0x56000000;
 +	ath79_eth1_pll_data.pll_1000 = 0x03000101;
 +
diff --git a/target/linux/ar71xx/patches-4.4/612-MIPS-ath79-set-buffalo-txgain.patch b/target/linux/ar71xx/patches-4.4/612-MIPS-ath79-set-buffalo-txgain.patch
index 4e3ac70..41775f0 100644
--- a/target/linux/ar71xx/patches-4.4/612-MIPS-ath79-set-buffalo-txgain.patch
+++ b/target/linux/ar71xx/patches-4.4/612-MIPS-ath79-set-buffalo-txgain.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/dev-wmac.c
 +++ b/arch/mips/ath79/dev-wmac.c
-@@ -308,6 +308,11 @@ void __init ath79_wmac_disable_5ghz(void
+@@ -320,6 +320,11 @@ void __init ath79_wmac_disable_5ghz(void
  	ath79_wmac_data.disable_5ghz = true;
  }
  
diff --git a/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch b/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
index e8bbe44..3d422bb 100644
--- a/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
+++ b/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
@@ -12,7 +12,7 @@
  #include "dev-wmac.h"
  
  static u8 ath79_wmac_mac[ETH_ALEN];
-@@ -313,6 +315,51 @@ void __init ath79_wmac_set_tx_gain_buffa
+@@ -325,6 +327,51 @@ void __init ath79_wmac_set_tx_gain_buffa
  	ath79_wmac_data.tx_gain_buffalo = true;
  }
  
diff --git a/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch b/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch
index 777f7b2..64ebf59 100644
--- a/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch
+++ b/target/linux/ar71xx/patches-4.4/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch
@@ -274,7 +274,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  static void qca955x_wmac_setup(void)
  {
  	u32 t;
-@@ -368,6 +388,8 @@ void __init ath79_register_wmac(u8 *cal_
+@@ -380,6 +400,8 @@ void __init ath79_register_wmac(u8 *cal_
  		ar933x_wmac_setup();
  	else if (soc_is_ar934x())
  		ar934x_wmac_setup();
@@ -446,9 +446,9 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_PCI_MEM_BASE0	0x10000000
  #define QCA955X_PCI_MEM_BASE1	0x12000000
  #define QCA955X_PCI_MEM_SIZE	0x02000000
-@@ -173,6 +188,12 @@
- #define AR934X_DDR_REG_FLUSH_PCIE	0xa8
- #define AR934X_DDR_REG_FLUSH_WMAC	0xac
+@@ -180,6 +195,12 @@
+ #define AR934X_OTP_INTF3_ADDRESS			0x3100c
+ #define AR934X_OTP_PGENB_SETUP_HOLD_TIME_ADDRESS	0x31034
  
 +#define QCA953X_DDR_REG_FLUSH_GE0	0x9c
 +#define QCA953X_DDR_REG_FLUSH_GE1	0xa0
@@ -459,7 +459,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  /*
   * PLL block
   */
-@@ -279,6 +300,44 @@
+@@ -286,6 +307,44 @@
  
  #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL	BIT(6)
  
@@ -504,7 +504,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_PLL_CPU_CONFIG_REG		0x00
  #define QCA955X_PLL_DDR_CONFIG_REG		0x04
  #define QCA955X_PLL_CLK_CTRL_REG		0x08
-@@ -355,6 +414,10 @@
+@@ -362,6 +421,10 @@
  #define AR934X_RESET_REG_BOOTSTRAP		0xb0
  #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS	0xac
  
@@ -515,7 +515,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_RESET_REG_RESET_MODULE		0x1c
  #define QCA955X_RESET_REG_BOOTSTRAP		0xb0
  #define QCA955X_RESET_REG_EXT_INT_STATUS	0xac
-@@ -450,6 +513,27 @@
+@@ -457,6 +520,27 @@
  #define AR934X_RESET_MBOX		BIT(1)
  #define AR934X_RESET_I2S		BIT(0)
  
@@ -543,7 +543,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_RESET_HOST		BIT(31)
  #define QCA955X_RESET_SLIC		BIT(30)
  #define QCA955X_RESET_HDMA		BIT(29)
-@@ -503,6 +587,13 @@
+@@ -510,6 +594,13 @@
  #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
  #define AR934X_BOOTSTRAP_DDR1		BIT(0)
  
@@ -557,7 +557,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_BOOTSTRAP_REF_CLK_40	BIT(4)
  
  #define AR934X_PCIE_WMAC_INT_WMAC_MISC		BIT(0)
-@@ -523,6 +614,24 @@
+@@ -530,6 +621,24 @@
  	 AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
  	 AR934X_PCIE_WMAC_INT_PCIE_RC3)
  
@@ -582,7 +582,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_EXT_INT_WMAC_MISC		BIT(0)
  #define QCA955X_EXT_INT_WMAC_TX			BIT(1)
  #define QCA955X_EXT_INT_WMAC_RXLP		BIT(2)
-@@ -565,6 +674,8 @@
+@@ -572,6 +681,8 @@
  #define REV_ID_MAJOR_AR9341		0x0120
  #define REV_ID_MAJOR_AR9342		0x1120
  #define REV_ID_MAJOR_AR9344		0x2120
@@ -591,7 +591,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define REV_ID_MAJOR_QCA9556		0x0130
  #define REV_ID_MAJOR_QCA9558		0x1130
  
-@@ -587,6 +698,8 @@
+@@ -594,6 +705,8 @@
  
  #define AR934X_REV_ID_REVISION_MASK	0xf
  
@@ -600,7 +600,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_REV_ID_REVISION_MASK	0xf
  
  /*
-@@ -634,6 +747,25 @@
+@@ -641,6 +754,25 @@
  #define AR934X_GPIO_REG_OUT_FUNC5	0x40
  #define AR934X_GPIO_REG_FUNC		0x6c
  
@@ -626,7 +626,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_GPIO_REG_OUT_FUNC0	0x2c
  #define QCA955X_GPIO_REG_OUT_FUNC1	0x30
  #define QCA955X_GPIO_REG_OUT_FUNC2	0x34
-@@ -648,6 +780,7 @@
+@@ -655,6 +787,7 @@
  #define AR913X_GPIO_COUNT		22
  #define AR933X_GPIO_COUNT		30
  #define AR934X_GPIO_COUNT		23
@@ -634,7 +634,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define QCA955X_GPIO_COUNT		24
  
  /*
-@@ -671,6 +804,24 @@
+@@ -678,6 +811,24 @@
  #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT	13
  #define AR934X_SRIF_DPLL2_OUTDIV_MASK	0x7
  
@@ -659,7 +659,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  #define AR71XX_GPIO_FUNC_STEREO_EN		BIT(17)
  #define AR71XX_GPIO_FUNC_SLIC_EN		BIT(16)
  #define AR71XX_GPIO_FUNC_SPI_CS2_EN		BIT(13)
-@@ -877,6 +1028,16 @@
+@@ -884,6 +1035,16 @@
  #define AR934X_ETH_CFG_RDV_DELAY_SHIFT  16
  
  /*
diff --git a/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
index ed90c40..d8bb248 100644
--- a/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+++ b/target/linux/ar71xx/patches-4.4/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
@@ -219,9 +219,9 @@
  }
 --- a/arch/mips/ath79/dev-wmac.c
 +++ b/arch/mips/ath79/dev-wmac.c
-@@ -189,6 +189,26 @@ static void qca955x_wmac_setup(void)
- 		ath79_wmac_data.is_clk_25mhz = true;
- }
+@@ -201,6 +201,26 @@ static void qca955x_wmac_setup(void)
+ #define AR93XX_OTP_READ_DATA \
+ 	(soc_is_ar934x() ? AR934X_OTP_READ_DATA : AR9300_OTP_READ_DATA)
  
 +static void qca956x_wmac_setup(void)
 +{
@@ -246,7 +246,7 @@
  static bool __init
  ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
  {
-@@ -392,6 +412,8 @@ void __init ath79_register_wmac(u8 *cal_
+@@ -404,6 +424,8 @@ void __init ath79_register_wmac(u8 *cal_
  		qca953x_wmac_setup();
  	else if (soc_is_qca955x())
  		qca955x_wmac_setup();
@@ -522,7 +522,7 @@
   * DDR_CTRL block
   */
  #define AR71XX_DDR_REG_PCI_WIN0		0x7c
-@@ -375,6 +399,49 @@
+@@ -382,6 +406,49 @@
  #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL		BIT(21)
  #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL		BIT(24)
  
@@ -572,7 +572,7 @@
  /*
   * USB_CONFIG block
   */
-@@ -422,6 +489,11 @@
+@@ -429,6 +496,11 @@
  #define QCA955X_RESET_REG_BOOTSTRAP		0xb0
  #define QCA955X_RESET_REG_EXT_INT_STATUS	0xac
  
@@ -584,7 +584,7 @@
  #define MISC_INT_ETHSW			BIT(12)
  #define MISC_INT_TIMER4			BIT(10)
  #define MISC_INT_TIMER3			BIT(9)
-@@ -596,6 +668,8 @@
+@@ -603,6 +675,8 @@
  
  #define QCA955X_BOOTSTRAP_REF_CLK_40	BIT(4)
  
@@ -593,7 +593,7 @@
  #define AR934X_PCIE_WMAC_INT_WMAC_MISC		BIT(0)
  #define AR934X_PCIE_WMAC_INT_WMAC_TX		BIT(1)
  #define AR934X_PCIE_WMAC_INT_WMAC_RXLP		BIT(2)
-@@ -663,6 +737,37 @@
+@@ -670,6 +744,37 @@
  	 QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
  	 QCA955X_EXT_INT_PCIE_RC2_INT3)
  
@@ -631,7 +631,7 @@
  #define REV_ID_MAJOR_MASK		0xfff0
  #define REV_ID_MAJOR_AR71XX		0x00a0
  #define REV_ID_MAJOR_AR913X		0x00b0
-@@ -678,6 +783,8 @@
+@@ -685,6 +790,8 @@
  #define REV_ID_MAJOR_QCA9533_V2		0x0160
  #define REV_ID_MAJOR_QCA9556		0x0130
  #define REV_ID_MAJOR_QCA9558		0x1130
@@ -640,7 +640,7 @@
  
  #define AR71XX_REV_ID_MINOR_MASK	0x3
  #define AR71XX_REV_ID_MINOR_AR7130	0x0
-@@ -702,6 +809,8 @@
+@@ -709,6 +816,8 @@
  
  #define QCA955X_REV_ID_REVISION_MASK	0xf
  
@@ -649,7 +649,7 @@
  /*
   * SPI block
   */
-@@ -774,6 +883,19 @@
+@@ -781,6 +890,19 @@
  #define QCA955X_GPIO_REG_OUT_FUNC5	0x40
  #define QCA955X_GPIO_REG_FUNC		0x6c
  
@@ -669,7 +669,7 @@
  #define AR71XX_GPIO_COUNT		16
  #define AR7240_GPIO_COUNT		18
  #define AR7241_GPIO_COUNT		20
-@@ -782,6 +904,7 @@
+@@ -789,6 +911,7 @@
  #define AR934X_GPIO_COUNT		23
  #define QCA953X_GPIO_COUNT		18
  #define QCA955X_GPIO_COUNT		24
diff --git a/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
index dff3543..6573b29 100644
--- a/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
+++ b/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
@@ -11,7 +11,7 @@
  #define QCA956X_GMAC_BASE	(AR71XX_APB_BASE + 0x00070000)
  #define QCA956X_GMAC_SIZE	0x64
  
-@@ -404,6 +408,7 @@
+@@ -411,6 +415,7 @@
  #define QCA956X_PLL_DDR_CONFIG_REG			0x08
  #define QCA956X_PLL_DDR_CONFIG1_REG			0x0c
  #define QCA956X_PLL_CLK_CTRL_REG			0x10
@@ -19,7 +19,7 @@
  
  #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT		12
  #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
-@@ -1186,4 +1191,16 @@
+@@ -1193,4 +1198,16 @@
  #define QCA955X_ETH_CFG_TXE_DELAY_MASK	0x3
  #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT	20
  
diff --git a/target/linux/ar71xx/patches-4.4/631-MIPS-ath79-wmac-enable-set-led-pin.patch b/target/linux/ar71xx/patches-4.4/631-MIPS-ath79-wmac-enable-set-led-pin.patch
index 16a0b90..0af1488 100644
--- a/target/linux/ar71xx/patches-4.4/631-MIPS-ath79-wmac-enable-set-led-pin.patch
+++ b/target/linux/ar71xx/patches-4.4/631-MIPS-ath79-wmac-enable-set-led-pin.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/dev-wmac.c
 +++ b/arch/mips/ath79/dev-wmac.c
-@@ -400,6 +400,11 @@ void __init ath79_wmac_set_ext_lna_gpio(
+@@ -412,6 +412,11 @@ void __init ath79_wmac_set_ext_lna_gpio(
  		ar934x_set_ext_lna_gpio(chain, gpio);
  }
  
diff --git a/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch b/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
index 8aa5957..8ddb81c 100644
--- a/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
+++ b/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_SIZE	0x100
  #define AR71XX_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
-@@ -222,6 +222,9 @@
+@@ -229,6 +229,9 @@
  #define QCA953X_DDR_REG_FLUSH_PCIE	0xa8
  #define QCA953X_DDR_REG_FLUSH_WMAC	0xac
  
@@ -68,7 +68,7 @@
 +	ath79_wmac_data.external_reset = ar955x_wmac_reset;
  }
  
- static void qca956x_wmac_setup(void)
+ #define AR93XX_WMAC_SIZE \
 --- a/arch/mips/ath79/common.h
 +++ b/arch/mips/ath79/common.h
 @@ -19,6 +19,8 @@
diff --git a/target/linux/ar71xx/patches-4.4/641-MIPS-ath79-fix-AR934x-OTP-offsets.patch b/target/linux/ar71xx/patches-4.4/641-MIPS-ath79-fix-AR934x-OTP-offsets.patch
deleted file mode 100644
index 78ecf89..0000000
--- a/target/linux/ar71xx/patches-4.4/641-MIPS-ath79-fix-AR934x-OTP-offsets.patch
+++ /dev/null
@@ -1,66 +0,0 @@
---- a/arch/mips/ath79/dev-wmac.c	2017-02-12 19:49:21.158142253 +0100
-+++ b/arch/mips/ath79/dev-wmac.c	2017-02-12 21:01:51.206198122 +0100
-@@ -232,15 +274,27 @@ static void qca956x_wmac_setup(void)
- 	ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision;
- }
-
-+#define AR93XX_WMAC_SIZE \
-+	(soc_is_ar934x() ? AR934X_WMAC_SIZE : AR933X_WMAC_SIZE)
-+#define AR93XX_WMAC_BASE \
-+	(soc_is_ar934x() ? AR934X_WMAC_BASE : AR933X_WMAC_BASE)
-+
-+#define AR93XX_OTP_BASE \
-+	(soc_is_ar934x() ? AR934X_OTP_BASE : AR9300_OTP_BASE)
-+#define AR93XX_OTP_STATUS \
-+	(soc_is_ar934x() ? AR934X_OTP_STATUS : AR9300_OTP_STATUS)
-+#define AR93XX_OTP_READ_DATA \
-+	(soc_is_ar934x() ? AR934X_OTP_READ_DATA : AR9300_OTP_READ_DATA)
-+
- static bool __init
- ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
- {
- 	int timeout = 1000;
- 	u32 val;
-
--	__raw_readl(base + AR9300_OTP_BASE + (4 * addr));
-+	__raw_readl(base + AR93XX_OTP_BASE + (4 * addr));
- 	while (timeout--) {
--		val = __raw_readl(base + AR9300_OTP_STATUS);
-+		val = __raw_readl(base + AR93XX_OTP_STATUS);
- 		if ((val & AR9300_OTP_STATUS_TYPE) == AR9300_OTP_STATUS_VALID)
- 			break;
-
-@@ -250,7 +304,7 @@ ar93xx_wmac_otp_read_word(void __iomem *
- 	if (!timeout)
- 		return false;
-
--	*data = __raw_readl(base + AR9300_OTP_READ_DATA);
-+	*data = __raw_readl(base + AR93XX_OTP_READ_DATA);
- 	return true;
- }
-
-@@ -326,7 +380,7 @@ bool __init ar93xx_wmac_read_mac_address
- 	int mac_start = 2, mac_end = 8;
-
- 	BUG_ON(!soc_is_ar933x() && !soc_is_ar934x());
--	base = ioremap_nocache(AR933X_WMAC_BASE, AR933X_WMAC_SIZE);
-+	base = ioremap_nocache(AR93XX_WMAC_BASE, AR93XX_WMAC_SIZE);
- 	while (addr > sizeof(hdr)) {
- 		if (!ar93xx_wmac_otp_read(base, addr, hdr, sizeof(hdr)))
- 			break;
---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h	2017-02-12 20:22:32.185209249 +0100
-+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h	2017-02-12 20:42:21.037382287 +0100
-@@ -172,6 +172,13 @@
- #define AR9300_OTP_STATUS_SM_BUSY	0x1
- #define AR9300_OTP_READ_DATA	0x15f1c
-
-+#define AR934X_OTP_BASE					0x30000
-+#define AR934X_OTP_STATUS				0x31018
-+#define AR934X_OTP_READ_DATA				0x3101c
-+#define AR934X_OTP_INTF2_ADDRESS			0x31008
-+#define AR934X_OTP_INTF3_ADDRESS			0x3100c
-+#define AR934X_OTP_PGENB_SETUP_HOLD_TIME_ADDRESS	0x31034
-+
- /*
-  * Hidden Registers
-  */
diff --git a/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch b/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
index 6b33158..4d72a6c 100644
--- a/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
+++ b/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();
 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
-@@ -855,6 +855,7 @@
+@@ -862,6 +862,7 @@
  #define AR71XX_GPIO_REG_INT_PENDING	0x20
  #define AR71XX_GPIO_REG_INT_ENABLE	0x24
  #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_FUNC1	0x30
-@@ -979,6 +980,8 @@
+@@ -986,6 +987,8 @@
  #define AR724X_GPIO_FUNC_UART_EN		BIT(1)
  #define AR724X_GPIO_FUNC_JTAG_DISABLE		BIT(0)
  
diff --git a/target/linux/ar71xx/patches-4.4/920-usb-chipidea-AR933x-platform-support.patch b/target/linux/ar71xx/patches-4.4/920-usb-chipidea-AR933x-platform-support.patch
index 26aab8e..1aa4120 100644
--- a/target/linux/ar71xx/patches-4.4/920-usb-chipidea-AR933x-platform-support.patch
+++ b/target/linux/ar71xx/patches-4.4/920-usb-chipidea-AR933x-platform-support.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
-@@ -649,6 +649,7 @@
+@@ -656,6 +656,7 @@
  
  #define AR933X_BOOTSTRAP_MDIO_GPIO_EN	BIT(18)
  #define AR933X_BOOTSTRAP_EEPBUSY	BIT(4)
@@ -8,7 +8,7 @@
  #define AR933X_BOOTSTRAP_REF_CLK_40	BIT(0)
  
  #define AR934X_BOOTSTRAP_SW_OPTION8	BIT(23)
-@@ -678,6 +679,8 @@
+@@ -685,6 +686,8 @@
  
  #define QCA956X_BOOTSTRAP_REF_CLK_40	BIT(2)
  


From lede-commits at lists.infradead.org  Wed Apr 26 01:29:54 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 04:29:54 -0400
Subject: [source]  kernel: remove out of tree direct-io disable hack
In-Reply-To: <20170426082953.30150.46803@git-01.infra.lede-project.org>
References: <20170426082953.30150.46803@git-01.infra.lede-project.org>
Message-ID: <mailman.26112.1493195426.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/0b7ed65cec8084bb98ae0e2758b7aca6c447cd4b

commit 0b7ed65cec8084bb98ae0e2758b7aca6c447cd4b
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Apr 12 09:35:14 2017 +0200

    kernel: remove out of tree direct-io disable hack
    
    Direct-IO support has to be enabled for the release build anyway, so
    this hack is not worth keeping
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 config/Config-kernel.in                            |  4 --
 package/utils/mdadm/Makefile                       |  2 +-
 target/linux/generic/config-3.18                   |  1 -
 target/linux/generic/config-4.4                    |  1 -
 target/linux/generic/config-4.9                    |  1 -
 .../patches-3.18/903-debloat_direct_io.patch       | 83 ----------------------
 .../patches-4.4/903-debloat_direct_io.patch        | 80 ---------------------
 .../patches-4.9/903-debloat_direct_io.patch        | 82 ---------------------
 target/linux/oxnas/config-4.4                      |  1 -
 target/linux/sunxi/config-4.4                      |  1 -
 target/linux/zynq/config-4.4                       |  1 -
 11 files changed, 1 insertion(+), 256 deletions(-)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index a4c46f5..f65e3da 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -170,10 +170,6 @@ config KERNEL_AIO
 	bool "Compile the kernel with asynchronous IO support"
 	default n
 
-config KERNEL_DIRECT_IO
-	bool "Compile the kernel with direct IO support"
-	default n
-
 config KERNEL_FHANDLE
 	bool "Compile the kernel with support for fhandle syscalls"
 	default n
diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
index 8ebc02c..c25f34e 100644
--- a/package/utils/mdadm/Makefile
+++ b/package/utils/mdadm/Makefile
@@ -27,7 +27,7 @@ define Package/mdadm
   SUBMENU:=Disc
   TITLE:=A tool for managing Soft RAID under Linux
   URL:=http://www.kernel.org/pub/linux/utils/raid/mdadm/
-  DEPENDS:=+ at KERNEL_DIRECT_IO +libpthread +kmod-md-mod +kmod-md-raid0 +kmod-md-raid10 +kmod-md-raid1
+  DEPENDS:=+libpthread +kmod-md-mod +kmod-md-raid0 +kmod-md-raid10 +kmod-md-raid1
 endef
 
 define Package/mdadm/description
diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18
index ca97734..f434d56 100644
--- a/target/linux/generic/config-3.18
+++ b/target/linux/generic/config-3.18
@@ -881,7 +881,6 @@ CONFIG_DEVPORT=y
 # CONFIG_DGNC is not set
 # CONFIG_DGRP is not set
 # CONFIG_DHT11 is not set
-# CONFIG_DIRECT_IO is not set
 CONFIG_DISABLE_DEV_COREDUMP=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
 # CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set
diff --git a/target/linux/generic/config-4.4 b/target/linux/generic/config-4.4
index f57e265..7587fec 100644
--- a/target/linux/generic/config-4.4
+++ b/target/linux/generic/config-4.4
@@ -926,7 +926,6 @@ CONFIG_DEVPORT=y
 # CONFIG_DGAP is not set
 # CONFIG_DGNC is not set
 # CONFIG_DHT11 is not set
-# CONFIG_DIRECT_IO is not set
 # CONFIG_DISCONTIGMEM_MANUAL is not set
 # CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set
 # CONFIG_DISPLAY_CONNECTOR_DVI is not set
diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9
index 1b0bae6..731c3cd 100644
--- a/target/linux/generic/config-4.9
+++ b/target/linux/generic/config-4.9
@@ -1021,7 +1021,6 @@ CONFIG_DEVPORT=y
 # CONFIG_DGAP is not set
 # CONFIG_DGNC is not set
 # CONFIG_DHT11 is not set
-# CONFIG_DIRECT_IO is not set
 # CONFIG_DISCONTIGMEM_MANUAL is not set
 # CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set
 # CONFIG_DISPLAY_CONNECTOR_DVI is not set
diff --git a/target/linux/generic/patches-3.18/903-debloat_direct_io.patch b/target/linux/generic/patches-3.18/903-debloat_direct_io.patch
deleted file mode 100644
index 166bb5a..0000000
--- a/target/linux/generic/patches-3.18/903-debloat_direct_io.patch
+++ /dev/null
@@ -1,83 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -61,6 +61,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
- 
- 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
-@@ -2529,12 +2529,25 @@ enum {
- 	DIO_ASYNC_EXTEND = 0x04,
- };
- 
-+#ifdef CONFIG_DIRECT_IO
- void dio_end_io(struct bio *bio, int error);
- 
- ssize_t __blockdev_direct_IO(int rw, 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);
-+#else
-+static inline void dio_end_io(struct bio *bio, int error)
-+{
-+}
-+static inline ssize_t __blockdev_direct_IO(int rw, 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(int rw, struct kiocb *iocb,
- 		struct inode *inode, struct iov_iter *iter, loff_t offset,
---- 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
-@@ -655,9 +655,12 @@ 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) &&
--		    (!f->f_mapping->a_ops->get_xip_mem))) {
-+		    (!f->f_mapping->a_ops->get_xip_mem)))
-+#endif
-+		{
- 			return -EINVAL;
- 		}
- 	}
diff --git a/target/linux/generic/patches-4.4/903-debloat_direct_io.patch b/target/linux/generic/patches-4.4/903-debloat_direct_io.patch
deleted file mode 100644
index 3ced09a..0000000
--- a/target/linux/generic/patches-4.4/903-debloat_direct_io.patch
+++ /dev/null
@@ -1,80 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -73,6 +73,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
-@@ -2717,6 +2717,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,
-@@ -2724,6 +2725,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;
diff --git a/target/linux/generic/patches-4.9/903-debloat_direct_io.patch b/target/linux/generic/patches-4.9/903-debloat_direct_io.patch
deleted file mode 100644
index fb8709e..0000000
--- a/target/linux/generic/patches-4.9/903-debloat_direct_io.patch
+++ /dev/null
@@ -1,82 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -97,6 +97,11 @@ config MANDATORY_FILE_LOCKING
- 
- source "fs/crypto/Kconfig"
- 
-+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
-@@ -2852,6 +2852,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,
-@@ -2859,6 +2860,20 @@ ssize_t __blockdev_direct_IO(struct kioc
- 			     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,
-+			     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
-@@ -53,8 +53,10 @@ static int setfl(int fd, struct file * f
- 
- 	/* Pipe packetized mode is controlled by O_DIRECT flag */
- 	if (!S_ISFIFO(filp->f_inode->i_mode) && (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
-@@ -690,7 +690,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;
diff --git a/target/linux/oxnas/config-4.4 b/target/linux/oxnas/config-4.4
index f1d08a4..77a7755 100644
--- a/target/linux/oxnas/config-4.4
+++ b/target/linux/oxnas/config-4.4
@@ -98,7 +98,6 @@ CONFIG_DEBUG_LL_INCLUDE="debug/icedcc.S"
 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=16
 CONFIG_DEPRECATED_PARAM_STRUCT=y
 CONFIG_DETECT_HUNG_TASK=y
-CONFIG_DIRECT_IO=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_CACHE_FIQ_BROADCAST=y
 # CONFIG_DMA_CACHE_RWFO is not set
diff --git a/target/linux/sunxi/config-4.4 b/target/linux/sunxi/config-4.4
index 2253afa..f64e966 100644
--- a/target/linux/sunxi/config-4.4
+++ b/target/linux/sunxi/config-4.4
@@ -136,7 +136,6 @@ CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
-CONFIG_DIRECT_IO=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_ENGINE=y
 CONFIG_DMA_OF=y
diff --git a/target/linux/zynq/config-4.4 b/target/linux/zynq/config-4.4
index 70d09a1..52080e2 100644
--- a/target/linux/zynq/config-4.4
+++ b/target/linux/zynq/config-4.4
@@ -179,7 +179,6 @@ CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
-CONFIG_DIRECT_IO=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_CMA=y
 CONFIG_DMA_ENGINE=y


From lede-commits at lists.infradead.org  Wed Apr 26 01:29:53 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 04:29:53 -0400
Subject: [source]  utils/mdadm: Update to 4.0
In-Reply-To: <20170426082953.30150.46803@git-01.infra.lede-project.org>
References: <20170426082953.30150.46803@git-01.infra.lede-project.org>
Message-ID: <mailman.26113.1493195427.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/980c41f8e04f5586731e84492001971eb8371590

commit 980c41f8e04f5586731e84492001971eb8371590
Author: Daniel Engberg <daniel.engberg.lists at pyret.net>
AuthorDate: Fri Mar 24 12:17:24 2017 +0100

    utils/mdadm: Update to 4.0
    
    Update mdadm to 4.0
    Remove 000-compile.patch as it's fixed upstream
    Refresh patches
    Add mdadm.h-Undefine-dprintf-before-redefining.patch
    Source: http://git.openembedded.org/openembedded-core/tree/meta/recipes-extended/mdadm/files
    Add RAID 0,1 and 10 as depends to make mdadm usable.
    
    Signed-off-by: Daniel Engberg <daniel.engberg.lists at pyret.net>
---
 package/utils/mdadm/Makefile                       | 13 +++++---
 package/utils/mdadm/patches/000-compile.patch      | 11 -------
 .../utils/mdadm/patches/100-cross_compile.patch    | 18 +++-------
 ...dadm.h-Undefine-dprintf-before-redefining.patch | 38 ++++++++++++++++++++++
 package/utils/mdadm/patches/200-reduce_size.patch  |  4 +--
 5 files changed, 53 insertions(+), 31 deletions(-)

diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
index 32544cc..8ebc02c 100644
--- a/package/utils/mdadm/Makefile
+++ b/package/utils/mdadm/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mdadm
-PKG_VERSION:=3.2.5
-PKG_RELEASE:=2
+PKG_VERSION:=4.0
+PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=ec1d264e4126309aafe76d76067e8f3fd6649941cff6cb0242d467a1e66a01e0
+PKG_HASH:=1d6ae7f24ced3a0fa7b5613b32f4a589bb4881e3946a5a2c3724056254ada3a9
 
 PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
 
@@ -27,11 +27,14 @@ define Package/mdadm
   SUBMENU:=Disc
   TITLE:=A tool for managing Soft RAID under Linux
   URL:=http://www.kernel.org/pub/linux/utils/raid/mdadm/
-  DEPENDS:=+ at KERNEL_DIRECT_IO
+  DEPENDS:=+ at KERNEL_DIRECT_IO +libpthread +kmod-md-mod +kmod-md-raid0 +kmod-md-raid10 +kmod-md-raid1
 endef
 
 define Package/mdadm/description
  A tool for managing Linux Software RAID arrays.
+ RAID 0, 1 and 10 support included. 
+ If you need RAID 4,5 or 6 functionality please 
+ install kmod-md-raid456 .
 endef
 
 define Package/mdadm/conffiles
@@ -39,7 +42,7 @@ define Package/mdadm/conffiles
 /etc/config/mdadm
 endef
 
-TARGET_CFLAGS += -ffunction-sections -fdata-sections
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -DNO_COROSYNC -DNO_DLM -DUSE_PTHREADS
 TARGET_LDFLAGS += -Wl,--gc-sections
 
 define Build/Compile
diff --git a/package/utils/mdadm/patches/000-compile.patch b/package/utils/mdadm/patches/000-compile.patch
deleted file mode 100644
index 6d47489..0000000
--- a/package/utils/mdadm/patches/000-compile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/sha1.h
-+++ b/sha1.h
-@@ -26,8 +26,6 @@
- # include <limits.h>
- #endif
- 
--#include "ansidecl.h"
--
- /* The following contortions are an attempt to use the C preprocessor
-    to determine an unsigned integral type that is 32 bits wide.  An
-    alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
diff --git a/package/utils/mdadm/patches/100-cross_compile.patch b/package/utils/mdadm/patches/100-cross_compile.patch
index 8709e57..62bf693 100644
--- a/package/utils/mdadm/patches/100-cross_compile.patch
+++ b/package/utils/mdadm/patches/100-cross_compile.patch
@@ -1,19 +1,11 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -76,7 +76,6 @@ FAILED_SLOTS_DIR = /run/mdadm/failed-slo
+@@ -86,7 +86,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h
  DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
  DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
  DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
--CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS)
+-CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
++# CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
  
- # The glibc TLS ABI requires applications that call clone(2) to set up
- # TLS data structures, use pthreads until mdmon implements this support
-@@ -183,7 +182,7 @@ raid6check : raid6check.o mdadm.h $(CHEC
- 
- mdassemble : $(ASSEMBLE_SRCS) $(INCL)
- 	rm -f $(OBJS)
--	$(DIET_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)  $(STATICSRC)
-+	$(CC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)  $(STATICSRC)
- 
- mdassemble.static : $(ASSEMBLE_SRCS) $(INCL)
- 	rm -f $(OBJS)
+ VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
+ VERS_DATE = $(shell [ -d .git ] && date --date="`git log -n1 --format=format:%cd --date=short`" '+%0dth %B %Y' | sed -e 's/1th/1st/' -e 's/2th/2nd/' -e 's/11st/11th/' -e 's/12nd/12th/')
diff --git a/package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch b/package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch
new file mode 100644
index 0000000..bcff20d
--- /dev/null
+++ b/package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch
@@ -0,0 +1,38 @@
+From 6d369e8f226594632ce4260129509daf7030de0a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Mon, 9 May 2016 22:03:57 +0000
+Subject: [PATCH] mdadm.h: Undefine dprintf before redefining
+
+dprintf is also defined in libc see
+usr/include/bits/stdio2.h, this comes into
+play especially when fortify sources is enabled
+and compilers like clang reports the override
+
+In file included from policy.c:25:
+./mdadm.h:1562:9: error: 'dprintf' macro redefined [-Werror,-Wmacro-redefined]
+        ^
+/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/qemux86/usr/include/bits/stdio2.h:145:12: note: previous definition is here
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ mdadm.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/mdadm.h
++++ b/mdadm.h
+@@ -1595,11 +1595,13 @@ static inline char *to_subarray(struct m
+ }
+ 
+ #ifdef DEBUG
++#undef dprintf
+ #define dprintf(fmt, arg...) \
+ 	fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg)
+ #define dprintf_cont(fmt, arg...) \
+ 	fprintf(stderr, fmt, ##arg)
+ #else
++#undef dprintf
+ #define dprintf(fmt, arg...) \
+         ({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; })
+ #define dprintf_cont(fmt, arg...) \
diff --git a/package/utils/mdadm/patches/200-reduce_size.patch b/package/utils/mdadm/patches/200-reduce_size.patch
index 3d8c2f4..ae8204c 100644
--- a/package/utils/mdadm/patches/200-reduce_size.patch
+++ b/package/utils/mdadm/patches/200-reduce_size.patch
@@ -1,6 +1,6 @@
 --- a/Incremental.c
 +++ b/Incremental.c
-@@ -1508,6 +1508,10 @@ static int Incremental_container(struct 
+@@ -1642,6 +1642,10 @@ static int Incremental_container(struct
  	if (ra_all == ra_blocked)
  		return 0;
  
@@ -13,7 +13,7 @@
  	memcpy(suuid, uuid_zero, sizeof(int[4]));
 --- a/util.c
 +++ b/util.c
-@@ -928,7 +928,9 @@ void wait_for(char *dev, int fd)
+@@ -1151,7 +1151,9 @@ void wait_for(char *dev, int fd)
  struct superswitch *superlist[] =
  {
  	&super0, &super1,


From lede-commits at lists.infradead.org  Wed Apr 26 02:34:48 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 05:34:48 -0400
Subject: [source]  apm821xx: Add default packages to NAND target
In-Reply-To: <20170426093448.12894.90689@git-01.infra.lede-project.org>
References: <20170426093448.12894.90689@git-01.infra.lede-project.org>
Message-ID: <mailman.26148.1493199371.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/d1c3a9485a90fff9bf7083faba4138e14dcdae7d

commit d1c3a9485a90fff9bf7083faba4138e14dcdae7d
Author: Chris Blake <chrisrblake93 at gmail.com>
AuthorDate: Fri Mar 31 04:31:21 2017 -0500

    apm821xx: Add default packages to NAND target
    
    This moves core router packages to the NAND target, to ensure they are
    applied to all images. This change is being done due to an issue found
    when flashing the MX60W image, which came without these when built as a
    multi image.
    
    Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
 target/linux/apm821xx/image/Makefile              | 11 +++++------
 target/linux/apm821xx/nand/profiles/00-default.mk |  4 ++--
 target/linux/apm821xx/nand/target.mk              |  2 ++
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile
index 3553336..1dae2b6 100644
--- a/target/linux/apm821xx/image/Makefile
+++ b/target/linux/apm821xx/image/Makefile
@@ -69,7 +69,7 @@ endef
 
 define Device/mr24
   DEVICE_TITLE := Cisco Meraki MR24
-  DEVICE_PACKAGES := kmod-spi-gpio kmod-ath9k wpad-mini
+  DEVICE_PACKAGES := kmod-spi-gpio
   DEVICE_PROFILE := MR24
   DEVICE_DTS := MR24
   BLOCKSIZE := 63k
@@ -89,8 +89,8 @@ TARGET_DEVICES += mr24
 
 define Device/mx60
   DEVICE_TITLE := Cisco Meraki MX60
-  DEVICE_PACKAGES := kmod-spi-gpio swconfig kmod-usb-ledtrig-usbport \
-	kmod-usb-dwc2 kmod-usb-storage block-mount
+  DEVICE_PACKAGES := kmod-spi-gpio kmod-usb-ledtrig-usbport kmod-usb-dwc2 \
+  kmod-usb-storage block-mount
   DEVICE_PROFILE := MX60
   DEVICE_DTS := MX60
   BLOCKSIZE := 63k
@@ -115,7 +115,6 @@ TARGET_DEVICES += mx60
 define Device/mx60w
 $(Device/mx60)
   DEVICE_TITLE := Cisco Meraki MX60W
-  DEVICE_PACKAGES += kmod-ath9k wpad-mini
 endef
 TARGET_DEVICES += mx60w
 
@@ -160,10 +159,10 @@ endef
 define Device/WNDR4700
   DEVICE_TITLE := Netgear Centria N900 WNDR4700/WNDR4720
   DEVICE_PACKAGES := badblocks block-mount e2fsprogs \
-	kmod-ath9k kmod-dm kmod-fs-ext4 kmod-fs-vfat kmod-usb-ledtrig-usbport \
+	kmod-dm kmod-fs-ext4 kmod-fs-vfat kmod-usb-ledtrig-usbport \
 	kmod-md-mod kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \
 	kmod-nls-utf8 kmod-usb3 kmod-usb-dwc2 kmod-usb-storage \
-	partx-utils swconfig wpad-mini
+	partx-utils
   DEVICE_NAME := wndr4700
   DEVICE_PROFILE := wndr4700
   DEVICE_DTS := wndr4700
diff --git a/target/linux/apm821xx/nand/profiles/00-default.mk b/target/linux/apm821xx/nand/profiles/00-default.mk
index 12c38ec..8c2203f 100644
--- a/target/linux/apm821xx/nand/profiles/00-default.mk
+++ b/target/linux/apm821xx/nand/profiles/00-default.mk
@@ -9,10 +9,10 @@ define Profile/Default
   NAME:=Default Profile
   PRIORITY:=1
   PACKAGES := badblocks block-mount e2fsprogs \
-	kmod-ath9k kmod-dm kmod-fs-ext4 kmod-fs-vfat kmod-usb-ledtrig-usbport \
+	kmod-dm kmod-fs-ext4 kmod-fs-vfat kmod-usb-ledtrig-usbport \
 	kmod-md-mod kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \
 	kmod-nls-utf8 kmod-usb3 kmod-usb-dwc2 kmod-usb-storage \
-	kmod-spi-gpio partx-utils swconfig wpad-mini
+	kmod-spi-gpio partx-utils
 endef
 
 define Profile/Default/Description
diff --git a/target/linux/apm821xx/nand/target.mk b/target/linux/apm821xx/nand/target.mk
index a7d88b8..2dce530 100644
--- a/target/linux/apm821xx/nand/target.mk
+++ b/target/linux/apm821xx/nand/target.mk
@@ -1,6 +1,8 @@
 BOARDNAME:=Devices with NAND flash (Routers)
 FEATURES += nand pcie ramdisk squashfs usb
 
+DEFAULT_PACKAGES += kmod-ath9k swconfig wpad-mini
+
 define Target/Description
 	Build firmware images for APM821XX boards with NAND flash.
 	For routers like the MR24 or the WNDR4700.


From lede-commits at lists.infradead.org  Wed Apr 26 02:34:49 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 05:34:49 -0400
Subject: [source]  apm821xx: Merge the Cisco Meraki MX60 & MX60W
In-Reply-To: <20170426093448.12894.90689@git-01.infra.lede-project.org>
References: <20170426093448.12894.90689@git-01.infra.lede-project.org>
Message-ID: <mailman.26149.1493199377.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/8f43ba8c489caa978b368decf0d66f70374389fd

commit 8f43ba8c489caa978b368decf0d66f70374389fd
Author: Chris Blake <chrisrblake93 at gmail.com>
AuthorDate: Fri Mar 31 04:32:55 2017 -0500

    apm821xx: Merge the Cisco Meraki MX60 & MX60W
    
    Both of these boards share the same DTS, and hardware. The only
    difference would be the PCI-E slot, and ath9k card found on the MX60W.
    Due to the similarities, it would be more efficient to merge these
    profiles.
    
    Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
 target/linux/apm821xx/image/Makefile | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile
index 1dae2b6..6ed183c 100644
--- a/target/linux/apm821xx/image/Makefile
+++ b/target/linux/apm821xx/image/Makefile
@@ -88,7 +88,7 @@ endef
 TARGET_DEVICES += mr24
 
 define Device/mx60
-  DEVICE_TITLE := Cisco Meraki MX60
+  DEVICE_TITLE := Cisco Meraki MX60/MX60W
   DEVICE_PACKAGES := kmod-spi-gpio kmod-usb-ledtrig-usbport kmod-usb-dwc2 \
   kmod-usb-storage block-mount
   DEVICE_PROFILE := MX60
@@ -112,12 +112,6 @@ define Device/mx60
 endef
 TARGET_DEVICES += mx60
 
-define Device/mx60w
-$(Device/mx60)
-  DEVICE_TITLE := Cisco Meraki MX60W
-endef
-TARGET_DEVICES += mx60w
-
 define Build/create-uImage-dtb
 	# flat_dt target expect FIT image - which WNDR4700's uboot doesn't support
 	-$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) \


From lede-commits at lists.infradead.org  Wed Apr 26 02:53:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 05:53:06 -0400
Subject: [source]  imx6: ventana: add GW553x board identification
In-Reply-To: <20170426095304.16790.27062@git-01.infra.lede-project.org>
References: <20170426095304.16790.27062@git-01.infra.lede-project.org>
Message-ID: <mailman.26154.1493200405.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/9d91ef52c38804857025742bad48a73bc8be0866

commit 9d91ef52c38804857025742bad48a73bc8be0866
Author: Tim Harvey <tharvey at gateworks.com>
AuthorDate: Thu Apr 20 14:51:37 2017 -0700

    imx6: ventana: add GW553x board identification
    
    Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 target/linux/imx6/base-files/lib/imx6.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/linux/imx6/base-files/lib/imx6.sh b/target/linux/imx6/base-files/lib/imx6.sh
index 3a9dea3..8254cac 100755
--- a/target/linux/imx6/base-files/lib/imx6.sh
+++ b/target/linux/imx6/base-files/lib/imx6.sh
@@ -44,6 +44,11 @@ imx6_board_detect() {
 		name="gw552x"
 		;;
 
+	"Gateworks Ventana i.MX6 DualLite/Solo GW553X" |\
+	"Gateworks Ventana i.MX6 Dual/Quad GW553X")
+		name="gw553x"
+		;;
+
 	"Gateworks Ventana i.MX6 DualLite/Solo GW5904" |\
 	"Gateworks Ventana i.MX6 Dual/Quad GW5904")
 		name="gw5904"


From lede-commits at lists.infradead.org  Wed Apr 26 02:34:50 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 05:34:50 -0400
Subject: [source]  build: fix symlinked .config handling
In-Reply-To: <20170426093448.12894.90689@git-01.infra.lede-project.org>
References: <20170426093448.12894.90689@git-01.infra.lede-project.org>
Message-ID: <mailman.26155.1493200406.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/5bf98b1acc3b6b178f8954c5075a58e1e6a99d6a

commit 5bf98b1acc3b6b178f8954c5075a58e1e6a99d6a
Author: Sergey Ryazanov <ryazanov.s.a at gmail.com>
AuthorDate: Thu Apr 20 05:10:45 2017 +0300

    build: fix symlinked .config handling
    
    When running "make menuconfig" with symlinked .config (e.g. to
    env/.config) it renames symlink to .config.old, creates new .config file
    and writes updated configuration here.
    
    This breaks the desired workflow when changes in the configuration could
    be checked using "scripts/env diff" and commited with
    "scripts/env save". Since the env/.config file is not updated.
    
    Fix this issue by exporting KCONFIG_OVERWRITECONFIG=1, which forces
    mconf to overwrite the .config content, instead of renaming it and
    creating a new file. This variable is set only if .config is a symlink,
    otherwise the variable is not exported and the old behaviour is
    preserved.
    
    Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 include/toplevel.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/toplevel.mk b/include/toplevel.mk
index ceafffb..4b63e8a 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -129,7 +129,7 @@ menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
 	if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
 		cp $(HOME)/.openwrt/defconfig .config; \
 	fi
-	$< Config.in
+	[ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; $< Config.in
 
 prepare_kernel_conf: .config FORCE
 


From lede-commits at lists.infradead.org  Wed Apr 26 02:53:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 05:53:04 -0400
Subject: [source] imx6: apply upstream mmc fix for DDR50 cards on UHS-I
 capable boards
In-Reply-To: <20170426095304.16790.27062@git-01.infra.lede-project.org>
References: <20170426095304.16790.27062@git-01.infra.lede-project.org>
Message-ID: <mailman.26156.1493200535.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/bc1e7469aac44ce1e9a21be4cea1e6e7672f3cdb

commit bc1e7469aac44ce1e9a21be4cea1e6e7672f3cdb
Author: Tim Harvey <tharvey at gateworks.com>
AuthorDate: Thu Apr 20 11:46:01 2017 -0700

    imx6: apply upstream mmc fix for DDR50 cards on UHS-I capable boards
    
    https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/commit/?h=fixes&id=9f327845358d3dd0d8a5a7a5436b0aa5c432e757
    
    Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 ...sdhc-imx-increase-the-pad-I-O-drive-stren.patch | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/target/linux/imx6/patches-4.9/0003-mmc-sdhci-esdhc-imx-increase-the-pad-I-O-drive-stren.patch b/target/linux/imx6/patches-4.9/0003-mmc-sdhci-esdhc-imx-increase-the-pad-I-O-drive-stren.patch
new file mode 100644
index 0000000..f97e829
--- /dev/null
+++ b/target/linux/imx6/patches-4.9/0003-mmc-sdhci-esdhc-imx-increase-the-pad-I-O-drive-stren.patch
@@ -0,0 +1,42 @@
+From 9f327845358d3dd0d8a5a7a5436b0aa5c432e757 Mon Sep 17 00:00:00 2001
+From: Haibo Chen <haibo.chen at nxp.com>
+Date: Wed, 19 Apr 2017 10:53:51 +0800
+Subject: [PATCH] mmc: sdhci-esdhc-imx: increase the pad I/O drive strength for
+ DDR50 card
+
+Currently for DDR50 card, it need tuning in default. We meet tuning fail
+issue for DDR50 card and some data CRC error when DDR50 sd card works.
+
+This is because the default pad I/O drive strength can't make sure DDR50
+card work stable. So increase the pad I/O drive strength for DDR50 card,
+and use pins_100mhz.
+
+This fixes DDR50 card support for IMX since DDR50 tuning was enabled from
+commit 9faac7b95ea4 ("mmc: sdhci: enable tuning for DDR50")
+
+Tested-and-reported-by: Tim Harvey <tharvey at gateworks.com>
+Signed-off-by: Haibo Chen <haibo.chen at nxp.com>
+Cc: stable at vger.kernel.org # v4.4+
+Acked-by: Dong Aisheng <aisheng.dong at nxp.com>
+Acked-by: Adrian Hunter <adrian.hunter at intel.com>
+Signed-off-by: Ulf Hansson <ulf.hansson at linaro.org>
+Signed-off-by: Tim Harvey <tharvey at gateworks.com>
+---
+ drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
+index 7123ef9..445fc47 100644
+--- a/drivers/mmc/host/sdhci-esdhc-imx.c
++++ b/drivers/mmc/host/sdhci-esdhc-imx.c
+@@ -830,6 +830,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
+ 
+ 	switch (uhs) {
+ 	case MMC_TIMING_UHS_SDR50:
++	case MMC_TIMING_UHS_DDR50:
+ 		pinctrl = imx_data->pins_100mhz;
+ 		break;
+ 	case MMC_TIMING_UHS_SDR104:
+-- 
+2.7.4
+


From lede-commits at lists.infradead.org  Wed Apr 26 02:53:05 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 05:53:05 -0400
Subject: [source]  imx6: disable MSI interrupts
In-Reply-To: <20170426095304.16790.27062@git-01.infra.lede-project.org>
References: <20170426095304.16790.27062@git-01.infra.lede-project.org>
Message-ID: <mailman.26157.1493200536.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/456bd950236e5a8a59c19ae8614bec65ed513a2f

commit 456bd950236e5a8a59c19ae8614bec65ed513a2f
Author: Tim Harvey <tharvey at gateworks.com>
AuthorDate: Thu Apr 20 13:28:20 2017 -0700

    imx6: disable MSI interrupts
    
    The IMX6 PCIe host controller does not fire legacy interrupts if MSI is
    enabled. A patch is being worked on to enable MSI at runtime only when
    it is needed but meanwhile this patch will disable MSI for the imx6 kernel.
    
    This fixes the no interrupt issue on cards/drivers that use legacy interrupts
    such as ath9k.
    
    Signed-off-by: Tim Harvey <tharvey at gateworks.com>
    Tested-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
---
 target/linux/imx6/config-4.9                       | 42 ++--------------------
 .../linux/imx6/patches-4.9/200-disable-msi.patch   | 22 ++++++++++++
 2 files changed, 24 insertions(+), 40 deletions(-)

diff --git a/target/linux/imx6/config-4.9 b/target/linux/imx6/config-4.9
index b4d23de..701bb53 100644
--- a/target/linux/imx6/config-4.9
+++ b/target/linux/imx6/config-4.9
@@ -1,7 +1,5 @@
 CONFIG_AHCI_IMX=y
 CONFIG_ALIGNMENT_TRAP=y
-# CONFIG_APM_EMULATION is not set
-# CONFIG_ARCH_ARTPEC is not set
 CONFIG_ARCH_CLOCKSOURCE_DATA=y
 CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
 CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
@@ -18,29 +16,22 @@ CONFIG_ARCH_MULTI_V6_V7=y
 CONFIG_ARCH_MULTI_V7=y
 CONFIG_ARCH_MXC=y
 CONFIG_ARCH_NR_GPIO=0
-# CONFIG_ARCH_RENESAS is not set
 # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
 # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
 CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
 CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
 CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
-# CONFIG_ARCH_TANGO is not set
 CONFIG_ARCH_USE_BUILTIN_BSWAP=y
 CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
 CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
 CONFIG_ARM=y
-# CONFIG_ARM_CPU_SUSPEND is not set
+CONFIG_ARM_CPU_SUSPEND=y
 CONFIG_ARM_CRYPTO=y
 CONFIG_ARM_ERRATA_754322=y
 CONFIG_ARM_ERRATA_764369=y
 CONFIG_ARM_ERRATA_775420=y
-# CONFIG_ARM_ERRATA_818325_852422 is not set
-# CONFIG_ARM_ERRATA_821420 is not set
-# CONFIG_ARM_ERRATA_825619 is not set
-# CONFIG_ARM_ERRATA_852421 is not set
-# CONFIG_ARM_ERRATA_852423 is not set
 CONFIG_ARM_GIC=y
 CONFIG_ARM_HAS_SG_CHAIN=y
 CONFIG_ARM_HEAVY_MB=y
@@ -69,9 +60,6 @@ CONFIG_CLKSRC_PROBE=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_CLZ_TAB=y
 CONFIG_COMMON_CLK=y
-# CONFIG_COMMON_CLK_CS2000_CP is not set
-# CONFIG_COMMON_CLK_NXP is not set
-# CONFIG_COMMON_CLK_PIC32 is not set
 CONFIG_CPUFREQ_DT=y
 CONFIG_CPUFREQ_DT_PLATDEV=y
 CONFIG_CPU_32v6K=y
@@ -175,7 +163,6 @@ CONFIG_DMA_OF=y
 CONFIG_DTC=y
 CONFIG_EDAC_ATOMIC_SCRUB=y
 CONFIG_EDAC_SUPPORT=y
-# CONFIG_EFI is not set
 # CONFIG_ENABLE_DEFAULT_TRACERS is not set
 CONFIG_ENCRYPTED_KEYS=y
 CONFIG_EXT2_FS=y
@@ -211,8 +198,6 @@ CONFIG_GENERIC_IO=y
 CONFIG_GENERIC_IRQ_CHIP=y
 CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_MSI_IRQ=y
-CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_PINCONF=y
 CONFIG_GENERIC_SCHED_CLOCK=y
@@ -224,7 +209,6 @@ CONFIG_GLOB=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIOLIB_IRQCHIP=y
 CONFIG_GPIO_GENERIC=y
-# CONFIG_GPIO_MPC8XXX is not set
 CONFIG_GPIO_MXC=y
 CONFIG_GPIO_PCA953X=y
 CONFIG_GPIO_PCA953X_IRQ=y
@@ -281,8 +265,6 @@ CONFIG_HAVE_SMP=y
 CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_HAVE_UID16=y
 CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-# CONFIG_HISI_FEMAC is not set
-# CONFIG_HWLAT_TRACER is not set
 CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
@@ -305,19 +287,12 @@ CONFIG_IRQ_WORK=y
 CONFIG_JBD2=y
 # CONFIG_JFFS2_FS is not set
 CONFIG_KEYS=y
-# CONFIG_KEY_DH_OPERATIONS is not set
-CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y
-# CONFIG_LEDS_IS31FL319X is not set
-# CONFIG_LEDS_IS31FL32XX is not set
-# CONFIG_LEDS_TRIGGER_MTD is not set
 CONFIG_LIBFDT=y
 CONFIG_LOCK_SPIN_ON_OWNER=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y
 CONFIG_MARVELL_PHY=y
 CONFIG_MDIO_BOARDINFO=y
-# CONFIG_MDIO_HISI_FEMAC is not set
-# CONFIG_MFD_ACT8945A is not set
 # CONFIG_MFD_MAX77620 is not set
 CONFIG_MFD_SYSCON=y
 CONFIG_MICREL_PHY=y
@@ -338,7 +313,6 @@ CONFIG_MPILIB=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_NAND_GPMI_NAND=y
-# CONFIG_MTD_NAND_MTK is not set
 # CONFIG_MTD_PHYSMAP_OF_VERSATILE is not set
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
@@ -353,10 +327,8 @@ CONFIG_MXS_DMA=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEON=y
 CONFIG_NET_DSA=y
-# CONFIG_B53 is not set
 CONFIG_NET_DSA_MV88E6XXX=y
 CONFIG_NET_DSA_MV88E6XXX_GLOBAL2=y
-# CONFIG_NET_DSA_QCA8K is not set
 CONFIG_NET_DSA_TAG_DSA=y
 CONFIG_NET_DSA_TAG_EDSA=y
 CONFIG_NET_FLOW_LIMIT=y
@@ -386,18 +358,14 @@ CONFIG_OUTER_CACHE=y
 CONFIG_OUTER_CACHE_SYNC=y
 CONFIG_PADATA=y
 CONFIG_PAGE_OFFSET=0x80000000
-# CONFIG_PARAVIRT is not set
-# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
 CONFIG_PCI=y
 CONFIG_PCIEAER=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_PCIE_DW=y
-CONFIG_PCIE_DW_PLAT=y
+CONFIG_PCIE_PME=y
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_DOMAINS_GENERIC=y
 CONFIG_PCI_IMX6=y
-CONFIG_PCI_MSI=y
-CONFIG_PCI_MSI_IRQ_DOMAIN=y
 CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PGTABLE_LEVELS=2
 CONFIG_PHYLIB=y
@@ -423,9 +391,6 @@ CONFIG_PTP_1588_CLOCK=y
 CONFIG_PWM=y
 CONFIG_PWM_IMX=y
 CONFIG_PWM_SYSFS=y
-CONFIG_PWRSEQ_EMMC=y
-CONFIG_PWRSEQ_SIMPLE=y
-# CONFIG_QORIQ_THERMAL is not set
 CONFIG_RAS=y
 CONFIG_RATIONAL=y
 CONFIG_RCU_STALL_COMMON=y
@@ -442,9 +407,6 @@ CONFIG_REGULATOR_ANATOP=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_LTC3676=y
 CONFIG_REGULATOR_PFUZE100=y
-# CONFIG_REGULATOR_PV88060 is not set
-# CONFIG_REGULATOR_PV88080 is not set
-# CONFIG_REGULATOR_PV88090 is not set
 CONFIG_RFS_ACCEL=y
 CONFIG_RPS=y
 CONFIG_RTC_CLASS=y
diff --git a/target/linux/imx6/patches-4.9/200-disable-msi.patch b/target/linux/imx6/patches-4.9/200-disable-msi.patch
new file mode 100644
index 0000000..290147c
--- /dev/null
+++ b/target/linux/imx6/patches-4.9/200-disable-msi.patch
@@ -0,0 +1,22 @@
+The IMX6 PCIe host controller does not fire legacy interrupts when MSI is
+enabled. A patch is being worked on upstream to only enable MSI at runtime
+when needed, but until that is ready we will allow MSI to be disabled.
+
+--- a/drivers/pci/host/Kconfig
++++ b/drivers/pci/host/Kconfig
+@@ -51,7 +51,6 @@ config PCIE_DW_PLAT
+ 
+ config PCIE_DW
+ 	bool
+-	depends on PCI_MSI_IRQ_DOMAIN
+ 
+ config PCI_EXYNOS
+ 	bool "Samsung Exynos PCIe controller"
+@@ -63,7 +62,6 @@ config PCI_EXYNOS
+ config PCI_IMX6
+ 	bool "Freescale i.MX6 PCIe controller"
+ 	depends on SOC_IMX6Q
+-	depends on PCI_MSI_IRQ_DOMAIN
+ 	select PCIEPORTBUS
+ 	select PCIE_DW
+ 


From lede-commits at lists.infradead.org  Wed Apr 26 04:39:23 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 07:39:23 -0400
Subject: [source]  include/packages-defaults.mk: Remove LARGEFILE option
In-Reply-To: <20170426113923.6036.6893@git-01.infra.lede-project.org>
References: <20170426113923.6036.6893@git-01.infra.lede-project.org>
Message-ID: <mailman.26206.1493206913.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/edda8ecd79b181e338e82331ecb45eaeff0f57af

commit edda8ecd79b181e338e82331ecb45eaeff0f57af
Author: Daniel Engberg <daniel.engberg.lists at pyret.net>
AuthorDate: Fri Apr 21 10:23:20 2017 +0200

    include/packages-defaults.mk: Remove LARGEFILE option
    
    Remove LARGEFILE option, support was removed back in 2011 (OpenWrt rev 25208).
    
    Signed-off-by: Daniel Engberg <daniel.engberg.lists at pyret.net>
---
 include/package-defaults.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 487811c..6672b67 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -92,7 +92,6 @@ CONFIGURE_ARGS = \
 		--mandir=$(CONFIGURE_PREFIX)/man \
 		--infodir=$(CONFIGURE_PREFIX)/info \
 		$(DISABLE_NLS) \
-		$(DISABLE_LARGEFILE) \
 		$(DISABLE_IPV6)
 
 CONFIGURE_VARS = \


From lede-commits at lists.infradead.org  Wed Apr 26 04:40:46 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 07:40:46 -0400
Subject: [source]  busybox: Enable sendfile by default
In-Reply-To: <20170426114046.6423.1377@git-01.infra.lede-project.org>
References: <20170426114046.6423.1377@git-01.infra.lede-project.org>
Message-ID: <mailman.26207.1493207558.26984.lede-commits@lists.infradead.org>

nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/dca2966b77b6caa6da4cbd9314a05961a71ffaed

commit dca2966b77b6caa6da4cbd9314a05961a71ffaed
Author: Daniel Engberg <daniel.engberg.lists at pyret.net>
AuthorDate: Fri Apr 21 10:36:39 2017 +0200

    busybox: Enable sendfile by default
    
    Enable sendfile system call by default.
    http://lists.busybox.net/pipermail/busybox-cvs/2014-November/034831.html
    
    Signed-off-by: Daniel Engberg <daniel.engberg.lists at pyret.net>
---
 package/utils/busybox/Config-defaults.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in
index 29cc475..9438cb2 100644
--- a/package/utils/busybox/Config-defaults.in
+++ b/package/utils/busybox/Config-defaults.in
@@ -273,7 +273,7 @@ config BUSYBOX_DEFAULT_FEATURE_VERBOSE_CP_MESSAGE
 	default n
 config BUSYBOX_DEFAULT_FEATURE_USE_SENDFILE
 	bool
-	default n
+	default y
 config BUSYBOX_DEFAULT_FEATURE_COPYBUF_KB
 	int
 	default 4


From lede-commits at lists.infradead.org  Wed Apr 26 12:29:29 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Wed, 26 Apr 2017 15:29:29 -0400
Subject: [source]  dropbear: fix procd interface trigger install
In-Reply-To: <20170426192929.9268.65908@git-01.infra.lede-project.org>
References: <20170426192929.9268.65908@git-01.infra.lede-project.org>
Message-ID: <mailman.26251.1493234996.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/e5bbead1a83944293fccc27679ba9846d133374e

commit e5bbead1a83944293fccc27679ba9846d133374e
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Wed Apr 26 16:44:02 2017 +0200

    dropbear: fix procd interface trigger install
    
    Install procd interface triggers only for interfaces which are enabled
    so dropbear instances running on (an) enabled interface(s) are not
    restarted due to an interface trigger of an interface which is disabled.
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/dropbear/files/dropbear.init | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
index c5210cd..3fd2c57 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -109,7 +109,9 @@ keygen()
 load_interfaces()
 {
 	config_get interface "$1" Interface
-	interfaces=" ${interface} ${interfaces}"
+	config_get enable "$1" enable 1
+
+	[ "${enable}" = "1" ] && interfaces=" ${interface} ${interfaces}"
 }
 
 start_service()


From lede-commits at lists.infradead.org  Wed Apr 26 23:38:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 02:38:07 -0400
Subject: [source]  ubox: bump to version 2017-03-10
In-Reply-To: <20170427063807.8291.45325@git-01.infra.lede-project.org>
References: <20170427063807.8291.45325@git-01.infra.lede-project.org>
Message-ID: <mailman.26294.1493275115.26984.lede-commits@lists.infradead.org>

yousong pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/2bc8d5eaf17823ddd319f5fd3e9fb880535ed696

commit 2bc8d5eaf17823ddd319f5fd3e9fb880535ed696
Author: Yousong Zhou <yszhou4tech at gmail.com>
AuthorDate: Tue Apr 25 20:26:38 2017 +0800

    ubox: bump to version 2017-03-10
    
    Fixes FS#684 with commit 21a4bd0
    
    Changes since current version.  All changes except the ones prefixed
    with asterisks are for bugfixes.  Module aliases awareness is expected
    by the kernel to be a basic facility and is required for properly
    initializing wireguard.
    
        16f7e16 syslog: remove unnecessary sizeof struct between messages
        21a4bd0 kmodloader: modprobe: return 0 for loaded modules
        3dc78a4 kmodloader: don't store aliases info in struct module
        c553354 cmake: fix typo
        8973576 kmodloader: fix not being able to find some modules
        fce9382 cmake: Check for getrandom system call
        ac2d43e kmodloader: support '-q' quiet option
       *f8d3d16 ubox: Add an option for more accurate timestamps in log
        14839f0 kmodloader: make insert_module() idempotent
       *6e3c6dc kmodloader: add module alias awareness
        9371411 kmodloader: fix out-of-bound access when parsing .modinfo
        a62c946 kmodloader: modprobe: skip possible command line arguments
       *46a4b5f kmodloader: log to kmsg when loading directories of modules
        eacc426 kmodloader: remove redundant glob wildcard char
        8488bb5 ubox: Initialize conditionally uninitialized variabled
        db070f1 ubox: Fix some memory leaks
        acc48b5 kmodloader: Fix typo in error message
    
    Size comparison on x86_64 host
    
        function                                             old     new   delta
        main                                                2190    2344    +154
        scan_module_folder                                   665     793    +128
        alloc_module_node                                      -     113    +113
        .rodata                                              946    1036     +90
        alloc_module                                         202     245     +43
        free_modules                                          77     119     +42
        load_modprobe                                        209     237     +28
        scan_loaded_modules                                  241     265     +24
        avl_modcmp                                            45      67     +22
        insert_module                                        204     224     +20
        find_module                                           13      30     +17
        static.optind@@GLIBC_2                                 -       4      +4
        static.load_moddeps                                  118     117      -1
        scan_module_folders                                   55      54      -1
        ------------------------------------------------------------------------------
        (add/remove: 2/0 grow/shrink: 10/2 up/down: 685/-2)           Total: 683 bytes
    
    Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 package/system/ubox/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile
index cdf9265..3c9b4aa 100644
--- a/package/system/ubox/Makefile
+++ b/package/system/ubox/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/ubox.git
-PKG_SOURCE_DATE:=2017-01-15
-PKG_SOURCE_VERSION:=5649c028c426060616e2bd4e7ea83271cd333d21
-PKG_MIRROR_HASH:=28e5580d481a415697fbca46c160177bab6dc47a04ba7ddb73537827632b2dd6
+PKG_SOURCE_DATE:=2017-03-10
+PKG_SOURCE_VERSION:=16f7e16181e2f3e9cf3e2ce56a7e291844900d09
+PKG_MIRROR_HASH:=5f10f3df134eb8a69d281a73d39f5d2e2fc96af531a2f3960b0c6116ff11a707
 CMAKE_INSTALL:=1
 
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Wed Apr 26 23:47:46 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 02:47:46 -0400
Subject: [source]  generic: keep module aliases inside .modinfo
In-Reply-To: <20170427064746.10842.17756@git-01.infra.lede-project.org>
References: <20170427064746.10842.17756@git-01.infra.lede-project.org>
Message-ID: <mailman.26297.1493275688.26984.lede-commits@lists.infradead.org>

yousong pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/3bfe7ee6326d5131e50678638251540c8acf2177

commit 3bfe7ee6326d5131e50678638251540c8acf2177
Author: Yousong Zhou <yszhou4tech at gmail.com>
AuthorDate: Wed Jan 11 19:57:24 2017 +0800

    generic: keep module aliases inside .modinfo
    
    It seems module aliases are actually essential info.  E.g. other modules
    may call xt_request_find_match(NFPROTO_IPV{4,6}, "hashlimit", 1) and the
    kernel will request user mode modprobe helper for ipt_hashlimit and
    ip6t_hashlimit respectively which are aliases of xt_hashlimit.ko
    
    Compile-tested for armvirt, there is nearly no size impact.
    
    Before
    
        -rw-r--r-- 1 yousong yousong     304 Jan 10 17:37 config.seed
        -rw-r--r-- 1 yousong yousong    1634 Jan 11 11:07 lede-armvirt-default.manifest
        -rw-r--r-- 1 yousong yousong 1533647 Jan 11 11:07 lede-armvirt-default-rootfs.tar.gz
        -rw-r--r-- 1 yousong yousong 1802711 Jan 11 11:07 lede-armvirt-root.ext4.gz
        -rw-r--r-- 1 yousong yousong 1544597 Jan 11 11:07 lede-armvirt-rootfs.cpio.gz
        -rw-r--r-- 1 yousong yousong 1174984 Jan 11 11:07 lede-armvirt-root.squashfs.gz
        -rwxr-xr-x 1 yousong yousong 1654712 Jan 11 11:07 lede-armvirt-zImage
        -rwxr-xr-x 1 yousong yousong 2738296 Jan 11 11:07 lede-armvirt-zImage-initramfs
        drwxr-xr-x 2 yousong yousong    4096 Jan 10 17:35 packages
        -rw-r--r-- 1 yousong yousong     739 Jan 10 17:37 sha256sums
    
    After
    
        -rw-r--r-- 1 yousong yousong     304 Jan 10 17:37 config.seed
        -rw-r--r-- 1 yousong yousong    1634 Jan 11 11:10 lede-armvirt-default.manifest
        -rw-r--r-- 1 yousong yousong 1533646 Jan 11 11:10 lede-armvirt-default-rootfs.tar.gz
        -rw-r--r-- 1 yousong yousong 1802711 Jan 11 11:10 lede-armvirt-root.ext4.gz
        -rw-r--r-- 1 yousong yousong 1544593 Jan 11 11:10 lede-armvirt-rootfs.cpio.gz
        -rw-r--r-- 1 yousong yousong 1174984 Jan 11 11:10 lede-armvirt-root.squashfs.gz
        -rwxr-xr-x 1 yousong yousong 1654736 Jan 11 11:10 lede-armvirt-zImage
        -rwxr-xr-x 1 yousong yousong 2738144 Jan 11 11:10 lede-armvirt-zImage-initramfs
        drwxr-xr-x 2 yousong yousong    4096 Jan 10 17:35 packages
        -rw-r--r-- 1 yousong yousong     739 Jan 10 17:37 sha256sums
    
    Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 target/linux/generic/patches-3.18/204-module_strip.patch | 8 ++------
 target/linux/generic/patches-4.4/204-module_strip.patch  | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/target/linux/generic/patches-3.18/204-module_strip.patch b/target/linux/generic/patches-3.18/204-module_strip.patch
index dab7799..844c3b5 100644
--- a/target/linux/generic/patches-3.18/204-module_strip.patch
+++ b/target/linux/generic/patches-3.18/204-module_strip.patch
@@ -5,18 +5,14 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 ---
 --- a/include/linux/module.h
 +++ b/include/linux/module.h
-@@ -84,9 +84,10 @@ void trim_init_extable(struct module *m)
+@@ -84,6 +84,7 @@ void trim_init_extable(struct module *m)
  
  /* Generic info of form tag = "info" */
  #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
 +#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info)
  
  /* For userspace: you can also call me... */
--#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
-+#define MODULE_ALIAS(_alias) MODULE_INFO_STRIP(alias, _alias)
- 
- /* Soft module dependencies. See man modprobe.d for details.
-  * Example: MODULE_SOFTDEP("pre: module-foo module-bar post: module-baz")
+ #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
 @@ -127,12 +128,12 @@ void trim_init_extable(struct module *m)
   * Author(s), use "Name <email>" or just "Name", for multiple
   * authors use multiple MODULE_AUTHOR() statements/lines.
diff --git a/target/linux/generic/patches-4.4/204-module_strip.patch b/target/linux/generic/patches-4.4/204-module_strip.patch
index 8b807da..85805b3 100644
--- a/target/linux/generic/patches-4.4/204-module_strip.patch
+++ b/target/linux/generic/patches-4.4/204-module_strip.patch
@@ -5,18 +5,14 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 ---
 --- a/include/linux/module.h
 +++ b/include/linux/module.h
-@@ -169,9 +169,10 @@ void trim_init_extable(struct module *m)
+@@ -169,6 +169,7 @@ void trim_init_extable(struct module *m)
  
  /* Generic info of form tag = "info" */
  #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
 +#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info)
  
  /* For userspace: you can also call me... */
--#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
-+#define MODULE_ALIAS(_alias) MODULE_INFO_STRIP(alias, _alias)
- 
- /* Soft module dependencies. See man modprobe.d for details.
-  * Example: MODULE_SOFTDEP("pre: module-foo module-bar post: module-baz")
+ #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
 @@ -212,12 +213,12 @@ void trim_init_extable(struct module *m)
   * Author(s), use "Name <email>" or just "Name", for multiple
   * authors use multiple MODULE_AUTHOR() statements/lines.


From lede-commits at lists.infradead.org  Thu Apr 27 00:42:39 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 03:42:39 -0400
Subject: [source]  ramips: ZBT-WE826: include the correct dtsi
In-Reply-To: <20170427074239.20911.68146@git-01.infra.lede-project.org>
References: <20170427074239.20911.68146@git-01.infra.lede-project.org>
Message-ID: <mailman.26303.1493279109.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/bd2727fb257dbe2fee2b8eb575f7eabe8758e553

commit bd2727fb257dbe2fee2b8eb575f7eabe8758e553
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Apr 26 19:45:38 2017 +0200

    ramips: ZBT-WE826: include the correct dtsi
    
    Fix a copy/paste error and include the ZBT-WE826 dtsi instead of the
    ZBT-WG3526 one.
    
    Fix the syntax error in the ZBT-WE826 dtsi to prevent an compile error.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/ZBT-WE826-16M.dts | 4 ++--
 target/linux/ramips/dts/ZBT-WE826-32M.dts | 4 ++--
 target/linux/ramips/dts/ZBT-WE826.dtsi    | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/target/linux/ramips/dts/ZBT-WE826-16M.dts b/target/linux/ramips/dts/ZBT-WE826-16M.dts
index de3c4c1..a27cefd 100644
--- a/target/linux/ramips/dts/ZBT-WE826-16M.dts
+++ b/target/linux/ramips/dts/ZBT-WE826-16M.dts
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-#include "ZBT-WG3526.dtsi"
+#include "ZBT-WE826.dtsi"
 
 / {
 	compatible = "zbtlink,zbt-we826-16m", "zbtlink,zbt-we826", "ralink,mt7620a-soc";
@@ -9,4 +9,4 @@
 
 &firmware {
 	reg = <0x50000 0xfb0000>;
-};
\ No newline at end of file
+};
diff --git a/target/linux/ramips/dts/ZBT-WE826-32M.dts b/target/linux/ramips/dts/ZBT-WE826-32M.dts
index c8383cb..6fde218 100644
--- a/target/linux/ramips/dts/ZBT-WE826-32M.dts
+++ b/target/linux/ramips/dts/ZBT-WE826-32M.dts
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-#include "ZBT-WG3526.dtsi"
+#include "ZBT-WE826.dtsi"
 
 / {
 	compatible = "zbtlink,zbt-we826-32m", "zbtlink,zbt-we826", "ralink,mt7620a-soc";
@@ -9,4 +9,4 @@
 
 &firmware {
 	reg = <0x50000 0x1fb0000>;
-};
\ No newline at end of file
+};
diff --git a/target/linux/ramips/dts/ZBT-WE826.dtsi b/target/linux/ramips/dts/ZBT-WE826.dtsi
index 62ea419..02d546c 100644
--- a/target/linux/ramips/dts/ZBT-WE826.dtsi
+++ b/target/linux/ramips/dts/ZBT-WE826.dtsi
@@ -1,5 +1,3 @@
-/dts-v1/;
-
 #include "mt7620a.dtsi"
 
 #include <dt-bindings/input/input.h>


From lede-commits at lists.infradead.org  Thu Apr 27 00:42:40 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 03:42:40 -0400
Subject: [source]  ramips: fix syntax error in board.d/01_leds
In-Reply-To: <20170427074239.20911.68146@git-01.infra.lede-project.org>
References: <20170427074239.20911.68146@git-01.infra.lede-project.org>
Message-ID: <mailman.26304.1493279109.26984.lede-commits@lists.infradead.org>

mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/3a2cc2c8ad0abe72070688348d70c8d3aadc46ef

commit 3a2cc2c8ad0abe72070688348d70c8d3aadc46ef
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Apr 27 09:38:25 2017 +0200

    ramips: fix syntax error in board.d/01_leds
    
    Fixes the following error:
    
      syntax error: unexpected newline (expecting ")")
    
    Fixes: FS#739
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/base-files/etc/board.d/01_leds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 5aab21c..52542ec 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -290,7 +290,7 @@ pbr-m1)
 psg1208)
 	set_wifi_led "$board:white:wlan2g"
 	;;
-psg1218a\|
+psg1218a|\
 psg1218b)
 	ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0"
 	ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0"


From lede-commits at lists.infradead.org  Thu Apr 27 01:44:41 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 04:44:41 -0400
Subject: [source]  busybox: nslookup_lede: fix compatibility with v1.25
In-Reply-To: <20170427084441.2824.5505@git-01.infra.lede-project.org>
References: <20170427084441.2824.5505@git-01.infra.lede-project.org>
Message-ID: <mailman.26312.1493282704.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/f1e32854619c09a49d85f5066517e300130cbcd2

commit f1e32854619c09a49d85f5066517e300130cbcd2
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Apr 25 14:03:11 2017 +0200

    busybox: nslookup_lede: fix compatibility with v1.25
    
    The ":*" optstring syntax was only recently introduced with BusyBox v1.26,
    older versions need a corresponding hint in the "opt_complementary" variable
    to denote flag values that should be stored as llist entries.
    
    Add the required opt_complementary entry to fix random SIGBUS, SIGILL or
    SIGSEGV related crashes on BusyBox 1.25.x when attempting to use the "-q"
    flag of the "nslookup_lede" applet.
    
    Ref: https://forum.lede-project.org/t/nslookup-ipv6-in-lede-17-01-1
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Makefile                            |  2 +-
 package/utils/busybox/patches/230-add_nslookup_lede.patch | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index c87243b..dd81045 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.26.2
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index 51034e6..f37f4bd 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -1,4 +1,4 @@
-From 2285cd400a10b1bde5472fe1cec3311300ee943c Mon Sep 17 00:00:00 2001
+From 1188f159e0b0a9c07bed835c7313bedf5322a9e3 Mon Sep 17 00:00:00 2001
 From: Jo-Philipp Wich <jo at mein.io>
 Date: Tue, 14 Mar 2017 22:21:34 +0100
 Subject: [PATCH] networking: add LEDE nslookup applet
@@ -12,16 +12,16 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- networking/nslookup_lede.c | 893 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 893 insertions(+)
+ networking/nslookup_lede.c | 894 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 894 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
-index 000000000..6f1f86502
+index 000000000..f3e42d3bb
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,893 @@
+@@ -0,0 +1,894 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -760,6 +760,7 @@ index 000000000..6f1f86502
 +	applet_long_options = nslookup_longopts;
 +#endif
 +
++	opt_complementary = "q::";
 +	opts = getopt32(argv, "+q:*p:+r:+t:+s",
 +	                &type_strings, &default_port,
 +	                &default_retry, &default_timeout);


From lede-commits at lists.infradead.org  Thu Apr 27 01:44:43 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 04:44:43 -0400
Subject: [source] ramips: ZTE-Q7: fix switch driver initialization in DTS
 (FS#716)
In-Reply-To: <20170427084441.2824.5505@git-01.infra.lede-project.org>
References: <20170427084441.2824.5505@git-01.infra.lede-project.org>
Message-ID: <mailman.26313.1493282704.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/a45cde91183753d5e909c31f07370c5755113439

commit a45cde91183753d5e909c31f07370c5755113439
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Apr 25 14:56:57 2017 +0200

    ramips: ZTE-Q7: fix switch driver initialization in DTS (FS#716)
    
    Add the changes suggested by FS#716 to fix the switch driver initialization
    on the ZTE Q7.
    
    Also remove the `pinctrl-names` field obsoleted by the changes.
    
    Reported-by: Harry Lau <harrylwc at gmail.com>
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 target/linux/ramips/dts/ZTE-Q7.dts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/dts/ZTE-Q7.dts b/target/linux/ramips/dts/ZTE-Q7.dts
index 9ec1d89..c2db43e 100644
--- a/target/linux/ramips/dts/ZTE-Q7.dts
+++ b/target/linux/ramips/dts/ZTE-Q7.dts
@@ -89,8 +89,6 @@
 };
 
 &ethernet {
-	pinctrl-names = "default";
-	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
 	mediatek,portmap = "wllll";
 };
@@ -110,3 +108,7 @@
 &ohci {
 	status = "okay";
 };
+
+&gsw {
+	mediatek,port4 = "ephy";
+};


From lede-commits at lists.infradead.org  Thu Apr 27 01:44:42 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 04:44:42 -0400
Subject: [source] busybox: nslookup_lede: mimic output format of old Busybox
 applet
In-Reply-To: <20170427084441.2824.5505@git-01.infra.lede-project.org>
References: <20170427084441.2824.5505@git-01.infra.lede-project.org>
Message-ID: <mailman.26314.1493282706.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/76871a8dbbf26ea68b1f95b2e46774def87930d3

commit 76871a8dbbf26ea68b1f95b2e46774def87930d3
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Apr 25 14:21:08 2017 +0200

    busybox: nslookup_lede: mimic output format of old Busybox applet
    
    When invoking "nslookup_lede" with a domain argument and without explicit
    query type, issue both A and AAAA queries and display the resulting IP
    addresses in a numbered list style, similar to how the old BusyBox nslookup
    used to output the records.
    
    This is required for compatibility with certain scripts.
    
    Ref: https://forum.lede-project.org/t/nslookup-ipv6-in-lede-17-01-1
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Makefile                     |  2 +-
 .../busybox/patches/230-add_nslookup_lede.patch    | 81 ++++++++++++++++------
 2 files changed, 61 insertions(+), 22 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index dd81045..f0110ee 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.26.2
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index f37f4bd..976960c 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -1,4 +1,4 @@
-From 1188f159e0b0a9c07bed835c7313bedf5322a9e3 Mon Sep 17 00:00:00 2001
+From ab0f8bb80527928f513297ab93e3ec8c8b48dd50 Mon Sep 17 00:00:00 2001
 From: Jo-Philipp Wich <jo at mein.io>
 Date: Tue, 14 Mar 2017 22:21:34 +0100
 Subject: [PATCH] networking: add LEDE nslookup applet
@@ -12,16 +12,34 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- networking/nslookup_lede.c | 894 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 894 insertions(+)
+ Makefile.flags             |   6 +
+ networking/nslookup_lede.c | 915 +++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 921 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
+diff --git a/Makefile.flags b/Makefile.flags
+index 65021de25..096ab7756 100644
+--- a/Makefile.flags
++++ b/Makefile.flags
+@@ -134,6 +134,12 @@ else
+ LDLIBS += m
+ endif
+ 
++# nslookup_lede might need the resolv library
++RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
++ifeq ($(RESOLV_AVAILABLE),y)
++LDLIBS += resolv
++endif
++
+ # libpam may use libpthread, libdl and/or libaudit.
+ # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
+ # However, on *other platforms* it fails when some of those flags
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
-index 000000000..f3e42d3bb
+index 000000000..c6c90ddf3
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,894 @@
+@@ -0,0 +1,915 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -145,7 +163,7 @@ index 000000000..f3e42d3bb
 +static unsigned int default_timeout = 5;
 +
 +
-+static int parse_reply(const unsigned char *msg, size_t len)
++static int parse_reply(const unsigned char *msg, size_t len, int *bb_style_counter)
 +{
 +	ns_msg handle;
 +	ns_rr rr;
@@ -165,6 +183,9 @@ index 000000000..f3e42d3bb
 +			return -1;
 +		}
 +
++		if (bb_style_counter && *bb_style_counter == 1)
++			printf("Name:      %s\n", ns_rr_name(rr));
++
 +		rdlen = ns_rr_rdlen(rr);
 +
 +		switch (ns_rr_type(rr))
@@ -175,7 +196,10 @@ index 000000000..f3e42d3bb
 +				return -1;
 +			}
 +			inet_ntop(AF_INET, ns_rr_rdata(rr), astr, sizeof(astr));
-+			printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
++			if (bb_style_counter)
++				printf("Address %d: %s\n", (*bb_style_counter)++, astr);
++			else
++				printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
 +			break;
 +
 +#if ENABLE_FEATURE_IPV6
@@ -185,7 +209,10 @@ index 000000000..f3e42d3bb
 +				return -1;
 +			}
 +			inet_ntop(AF_INET6, ns_rr_rdata(rr), astr, sizeof(astr));
-+			printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
++			if (bb_style_counter)
++				printf("Address %d: %s\n", (*bb_style_counter)++, astr);
++			else
++				printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
 +			break;
 +#endif
 +
@@ -752,7 +779,7 @@ index 000000000..f3e42d3bb
 +	llist_t *type_strings = NULL;
 +	int n_ns = 0, n_queries = 0;
 +	int c, opts, option_index = 0;
-+	int stats = 0;
++	int stats = 0, bb_style_counter = 0;
 +	unsigned int types = 0;
 +	HEADER *header;
 +
@@ -769,10 +796,8 @@ index 000000000..f3e42d3bb
 +		ptr = llist_pop(&type_strings);
 +
 +		/* skip leading text, e.g. when invoked with -querytype=AAAA */
-+		if ((chr = strchr(ptr, '=')) != NULL) {
-+			ptr = chr;
-+			*ptr++ = 0;
-+		}
++		if ((chr = strchr(ptr, '=')) != NULL)
++			ptr = chr + 1;
 +
 +		for (c = 0; qtypes[c].name; c++)
 +			if (!strcmp(qtypes[c].name, ptr))
@@ -813,14 +838,21 @@ index 000000000..f3e42d3bb
 +		/* No explicit type given, guess query type.
 +		 * If we can convert the domain argument into a ptr (means that
 +		 * inet_pton() could read it) we assume a PTR request, else
-+		 * we issue A queries. */
++		 * we issue A+AAAA queries and switch to an output format
++		 * mimicking the one of the traditional nslookup applet. */
 +		if (types == 0) {
 +			ptr = make_ptr(argv[option_index]);
 +
-+			if (ptr)
++			if (ptr) {
 +				add_query(&queries, &n_queries, T_PTR, ptr);
-+			else
++			}
++			else {
++				bb_style_counter = 1;
 +				add_query(&queries, &n_queries, T_A, argv[option_index]);
++#if ENABLE_FEATURE_IPV6
++				add_query(&queries, &n_queries, T_AAAA, argv[option_index]);
++#endif
++			}
 +		}
 +		else {
 +			for (c = 0; qtypes[c].name; c++)
@@ -889,12 +921,18 @@ index 000000000..f3e42d3bb
 +		c = 0;
 +
 +		if (queries[rc].rlen) {
-+			header = (HEADER *)queries[rc].reply;
++			if (!bb_style_counter) {
++				header = (HEADER *)queries[rc].reply;
 +
-+			if (!header->aa)
-+				printf("Non-authoritative answer:\n");
++				if (!header->aa)
++					printf("Non-authoritative answer:\n");
 +
-+			c = parse_reply(queries[rc].reply, queries[rc].rlen);
++				c = parse_reply(queries[rc].reply, queries[rc].rlen, NULL);
++			}
++			else {
++				c = parse_reply(queries[rc].reply, queries[rc].rlen,
++				                &bb_style_counter);
++			}
 +		}
 +
 +		if (c == 0)
@@ -902,7 +940,8 @@ index 000000000..f3e42d3bb
 +		else if (c < 0)
 +			printf("*** Can't find %s: Parse error\n", queries[rc].name);
 +
-+		printf("\n");
++		if (!bb_style_counter)
++			printf("\n");
 +	}
 +
 +	rc = 0;


From lede-commits at lists.infradead.org  Thu Apr 27 06:19:29 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 09:19:29 -0400
Subject: [source] x86: enable 4G high memory support for generic (32bit)
 subtarget
In-Reply-To: <20170427131929.25417.83647@git-01.infra.lede-project.org>
References: <20170427131929.25417.83647@git-01.infra.lede-project.org>
Message-ID: <mailman.26345.1493299195.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch master:
https://git.lede-project.org/4b4f73937371cc628692c812fdb12eca8a635e5c

commit 4b4f73937371cc628692c812fdb12eca8a635e5c
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Apr 27 15:15:29 2017 +0200

    x86: enable 4G high memory support for generic (32bit) subtarget
    
    This is required to fully support a number of 32bit x86 systems equipped
    with more than one GB ram, e.g. certain Atom CPU machines.
    
    Ref: https://forum.lede-project.org/t/17-01-1-x86-doesnt-detect-all-of-the-ram/3295
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 target/linux/x86/config-4.9            | 9 +++++----
 target/linux/x86/legacy/config-default | 3 +++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/target/linux/x86/config-4.9 b/target/linux/x86/config-4.9
index 4c5812b..849ab3d 100644
--- a/target/linux/x86/config-4.9
+++ b/target/linux/x86/config-4.9
@@ -9,6 +9,7 @@ CONFIG_AMD_NB=y
 CONFIG_ARCH_CLOCKSOURCE_DATA=y
 CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
 CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
 CONFIG_ARCH_HAS_CPU_RELAX=y
 CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
@@ -210,7 +211,9 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_HAVE_UID16=y
 CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
 CONFIG_HAVE_USER_RETURN_NOTIFIER=y
-# CONFIG_HIGHMEM4G is not set
+CONFIG_HIGHMEM=y
+CONFIG_HIGHMEM4G=y
+# CONFIG_HIGHPTE is not set
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 # CONFIG_HP_WATCHDOG is not set
@@ -302,7 +305,7 @@ CONFIG_NEED_SG_DMA_LENGTH=y
 # CONFIG_NET5501 is not set
 # CONFIG_NET_NS is not set
 CONFIG_NLS=y
-CONFIG_NOHIGHMEM=y
+# CONFIG_NOHIGHMEM is not set
 CONFIG_NO_BOOTMEM=y
 CONFIG_NR_CPUS=1
 # CONFIG_NSC_GPIO is not set
@@ -345,7 +348,6 @@ CONFIG_PROC_PAGE_MONITOR=y
 # CONFIG_RCU_STALL_COMMON is not set
 CONFIG_RD_BZIP2=y
 CONFIG_RD_GZIP=y
-# CONFIG_RELOCATABLE is not set
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_MC146818_LIB=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -432,7 +434,6 @@ CONFIG_X86_MINIMUM_CPU_FAMILY=4
 CONFIG_X86_MPPARSE=y
 CONFIG_X86_MSR=y
 # CONFIG_X86_P4_CLOCKMOD is not set
-# CONFIG_X86_PAE is not set
 CONFIG_X86_PAT=y
 CONFIG_X86_PLATFORM_DEVICES=y
 # CONFIG_X86_POWERNOW_K6 is not set
diff --git a/target/linux/x86/legacy/config-default b/target/linux/x86/legacy/config-default
index e7718a8..2bcdef7 100644
--- a/target/linux/x86/legacy/config-default
+++ b/target/linux/x86/legacy/config-default
@@ -120,6 +120,7 @@ CONFIG_HAVE_CLK_PREPARE=y
 CONFIG_HDMI=y
 CONFIG_HID=y
 CONFIG_HID_BATTERY_STRENGTH=y
+# CONFIG_HIGHMEM4G is not set
 CONFIG_HPET=y
 CONFIG_HPET_MMAP=y
 # CONFIG_HP_ACCEL is not set
@@ -169,6 +170,7 @@ CONFIG_MOUSE_PS2_SYNAPTICS=y
 CONFIG_MOUSE_PS2_TRACKPOINT=y
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_VSXXXAA is not set
+CONFIG_NOHIGHMEM=y
 CONFIG_NO_HZ=y
 CONFIG_PATA_AMD=y
 CONFIG_PATA_ATIIXP=y
@@ -217,6 +219,7 @@ CONFIG_X86_ACPI_CPUFREQ=y
 # CONFIG_X86_E_POWERSAVER is not set
 # CONFIG_X86_INTEL_LPSS is not set
 # CONFIG_X86_LONGHAUL is not set
+# CONFIG_X86_PAE is not set
 # CONFIG_X86_PCC_CPUFREQ is not set
 CONFIG_X86_PM_TIMER=y
 # CONFIG_X86_POWERNOW_K8 is not set


From lede-commits at lists.infradead.org  Thu Apr 27 06:28:51 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 09:28:51 -0400
Subject: [source] x86: enable 4G high memory support for generic (32bit)
 subtarget
In-Reply-To: <20170427132851.27275.73199@git-01.infra.lede-project.org>
References: <20170427132851.27275.73199@git-01.infra.lede-project.org>
Message-ID: <mailman.26350.1493299753.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/af1d1ebdda59602cbb61c84a103a1149a054a1b4

commit af1d1ebdda59602cbb61c84a103a1149a054a1b4
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Apr 27 15:26:48 2017 +0200

    x86: enable 4G high memory support for generic (32bit) subtarget
    
    This is required to fully support a number of 32bit x86 systems equipped
    with more than one GB ram, e.g. certain Atom CPU machines.
    
    Ref: https://forum.lede-project.org/t/17-01-1-x86-doesnt-detect-all-of-the-ram/3295
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 target/linux/x86/config-4.4            | 8 +++++---
 target/linux/x86/legacy/config-default | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/target/linux/x86/config-4.4 b/target/linux/x86/config-4.4
index 29d19da..26bb124 100644
--- a/target/linux/x86/config-4.4
+++ b/target/linux/x86/config-4.4
@@ -9,6 +9,7 @@ CONFIG_AMD_NB=y
 CONFIG_ARCH_CLOCKSOURCE_DATA=y
 CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
 CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
 CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
 CONFIG_ARCH_HAS_CPU_RELAX=y
@@ -213,7 +214,9 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_HAVE_UID16=y
 CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
 CONFIG_HAVE_USER_RETURN_NOTIFIER=y
-# CONFIG_HIGHMEM4G is not set
+CONFIG_HIGHMEM=y
+CONFIG_HIGHMEM4G=y
+# CONFIG_HIGHPTE is not set
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 # CONFIG_HP_WATCHDOG is not set
@@ -305,7 +308,7 @@ CONFIG_NEED_SG_DMA_LENGTH=y
 # CONFIG_NET5501 is not set
 # CONFIG_NET_NS is not set
 CONFIG_NLS=y
-CONFIG_NOHIGHMEM=y
+# CONFIG_NOHIGHMEM is not set
 CONFIG_NO_BOOTMEM=y
 CONFIG_NR_CPUS=1
 # CONFIG_NSC_GPIO is not set
@@ -431,7 +434,6 @@ CONFIG_X86_MINIMUM_CPU_FAMILY=4
 CONFIG_X86_MPPARSE=y
 CONFIG_X86_MSR=y
 # CONFIG_X86_P4_CLOCKMOD is not set
-# CONFIG_X86_PAE is not set
 CONFIG_X86_PAT=y
 CONFIG_X86_PLATFORM_DEVICES=y
 # CONFIG_X86_POWERNOW_K6 is not set
diff --git a/target/linux/x86/legacy/config-default b/target/linux/x86/legacy/config-default
index 60b55c7..968c14b 100644
--- a/target/linux/x86/legacy/config-default
+++ b/target/linux/x86/legacy/config-default
@@ -119,6 +119,7 @@ CONFIG_HAVE_CLK_PREPARE=y
 CONFIG_HDMI=y
 CONFIG_HID=y
 CONFIG_HID_BATTERY_STRENGTH=y
+# CONFIG_HIGHMEM4G is not set
 CONFIG_HPET=y
 CONFIG_HPET_MMAP=y
 # CONFIG_HP_ACCEL is not set
@@ -164,6 +165,7 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_VSXXXAA is not set
 CONFIG_NLS=y
+CONFIG_NOHIGHMEM=y
 CONFIG_NO_HZ=y
 # CONFIG_PANASONIC_LAPTOP is not set
 CONFIG_PATA_AMD=y
@@ -211,5 +213,6 @@ CONFIG_X86_ACPI_CPUFREQ=y
 # CONFIG_X86_E_POWERSAVER is not set
 # CONFIG_X86_INTEL_LPSS is not set
 # CONFIG_X86_LONGHAUL is not set
+# CONFIG_X86_PAE is not set
 # CONFIG_X86_PCC_CPUFREQ is not set
 CONFIG_X86_PM_TIMER=y


From lede-commits at lists.infradead.org  Thu Apr 27 06:35:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 09:35:06 -0400
Subject: [source]  busybox: nslookup_lede: fix compatibility with v1.25
In-Reply-To: <20170427133506.28983.6106@git-01.infra.lede-project.org>
References: <20170427133506.28983.6106@git-01.infra.lede-project.org>
Message-ID: <mailman.26353.1493300129.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/a2ee9b7068f77e0285b9cb68399bbafc674777af

commit a2ee9b7068f77e0285b9cb68399bbafc674777af
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Apr 25 14:03:11 2017 +0200

    busybox: nslookup_lede: fix compatibility with v1.25
    
    The ":*" optstring syntax was only recently introduced with BusyBox v1.26,
    older versions need a corresponding hint in the "opt_complementary" variable
    to denote flag values that should be stored as llist entries.
    
    Add the required opt_complementary entry to fix random SIGBUS, SIGILL or
    SIGSEGV related crashes on BusyBox 1.25.x when attempting to use the "-q"
    flag of the "nslookup_lede" applet.
    
    Ref: https://forum.lede-project.org/t/nslookup-ipv6-in-lede-17-01-1
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Makefile                            |  2 +-
 package/utils/busybox/patches/230-add_nslookup_lede.patch | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index fdac78f..a593bc9 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
-PKG_VERSION:=1.25.1
+PKG_VERSION:=1.25.2
 PKG_RELEASE:=3
 PKG_FLAGS:=essential
 
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index 51034e6..f37f4bd 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -1,4 +1,4 @@
-From 2285cd400a10b1bde5472fe1cec3311300ee943c Mon Sep 17 00:00:00 2001
+From 1188f159e0b0a9c07bed835c7313bedf5322a9e3 Mon Sep 17 00:00:00 2001
 From: Jo-Philipp Wich <jo at mein.io>
 Date: Tue, 14 Mar 2017 22:21:34 +0100
 Subject: [PATCH] networking: add LEDE nslookup applet
@@ -12,16 +12,16 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- networking/nslookup_lede.c | 893 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 893 insertions(+)
+ networking/nslookup_lede.c | 894 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 894 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
-index 000000000..6f1f86502
+index 000000000..f3e42d3bb
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,893 @@
+@@ -0,0 +1,894 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -760,6 +760,7 @@ index 000000000..6f1f86502
 +	applet_long_options = nslookup_longopts;
 +#endif
 +
++	opt_complementary = "q::";
 +	opts = getopt32(argv, "+q:*p:+r:+t:+s",
 +	                &type_strings, &default_port,
 +	                &default_retry, &default_timeout);


From lede-commits at lists.infradead.org  Thu Apr 27 06:35:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 09:35:07 -0400
Subject: [source] busybox: nslookup_lede: mimic output format of old Busybox
 applet
In-Reply-To: <20170427133506.28983.6106@git-01.infra.lede-project.org>
References: <20170427133506.28983.6106@git-01.infra.lede-project.org>
Message-ID: <mailman.26354.1493300129.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/fe0b1713725913511b5042322f7305a418a04e54

commit fe0b1713725913511b5042322f7305a418a04e54
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Apr 25 14:21:08 2017 +0200

    busybox: nslookup_lede: mimic output format of old Busybox applet
    
    When invoking "nslookup_lede" with a domain argument and without explicit
    query type, issue both A and AAAA queries and display the resulting IP
    addresses in a numbered list style, similar to how the old BusyBox nslookup
    used to output the records.
    
    This is required for compatibility with certain scripts.
    
    Ref: https://forum.lede-project.org/t/nslookup-ipv6-in-lede-17-01-1
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Makefile                     |  2 +-
 .../busybox/patches/230-add_nslookup_lede.patch    | 81 ++++++++++++++++------
 2 files changed, 61 insertions(+), 22 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index a593bc9..95814ea 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.25.2
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git a/package/utils/busybox/patches/230-add_nslookup_lede.patch b/package/utils/busybox/patches/230-add_nslookup_lede.patch
index f37f4bd..976960c 100644
--- a/package/utils/busybox/patches/230-add_nslookup_lede.patch
+++ b/package/utils/busybox/patches/230-add_nslookup_lede.patch
@@ -1,4 +1,4 @@
-From 1188f159e0b0a9c07bed835c7313bedf5322a9e3 Mon Sep 17 00:00:00 2001
+From ab0f8bb80527928f513297ab93e3ec8c8b48dd50 Mon Sep 17 00:00:00 2001
 From: Jo-Philipp Wich <jo at mein.io>
 Date: Tue, 14 Mar 2017 22:21:34 +0100
 Subject: [PATCH] networking: add LEDE nslookup applet
@@ -12,16 +12,34 @@ and the libresolv primitives to parse received DNS responses.
 
 Signed-off-by: Jo-Philipp Wich <jo at mein.io>
 ---
- networking/nslookup_lede.c | 894 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 894 insertions(+)
+ Makefile.flags             |   6 +
+ networking/nslookup_lede.c | 915 +++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 921 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
+diff --git a/Makefile.flags b/Makefile.flags
+index 65021de25..096ab7756 100644
+--- a/Makefile.flags
++++ b/Makefile.flags
+@@ -134,6 +134,12 @@ else
+ LDLIBS += m
+ endif
+ 
++# nslookup_lede might need the resolv library
++RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
++ifeq ($(RESOLV_AVAILABLE),y)
++LDLIBS += resolv
++endif
++
+ # libpam may use libpthread, libdl and/or libaudit.
+ # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
+ # However, on *other platforms* it fails when some of those flags
 diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
 new file mode 100644
-index 000000000..f3e42d3bb
+index 000000000..c6c90ddf3
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,894 @@
+@@ -0,0 +1,915 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -145,7 +163,7 @@ index 000000000..f3e42d3bb
 +static unsigned int default_timeout = 5;
 +
 +
-+static int parse_reply(const unsigned char *msg, size_t len)
++static int parse_reply(const unsigned char *msg, size_t len, int *bb_style_counter)
 +{
 +	ns_msg handle;
 +	ns_rr rr;
@@ -165,6 +183,9 @@ index 000000000..f3e42d3bb
 +			return -1;
 +		}
 +
++		if (bb_style_counter && *bb_style_counter == 1)
++			printf("Name:      %s\n", ns_rr_name(rr));
++
 +		rdlen = ns_rr_rdlen(rr);
 +
 +		switch (ns_rr_type(rr))
@@ -175,7 +196,10 @@ index 000000000..f3e42d3bb
 +				return -1;
 +			}
 +			inet_ntop(AF_INET, ns_rr_rdata(rr), astr, sizeof(astr));
-+			printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
++			if (bb_style_counter)
++				printf("Address %d: %s\n", (*bb_style_counter)++, astr);
++			else
++				printf("Name:\t%s\nAddress: %s\n", ns_rr_name(rr), astr);
 +			break;
 +
 +#if ENABLE_FEATURE_IPV6
@@ -185,7 +209,10 @@ index 000000000..f3e42d3bb
 +				return -1;
 +			}
 +			inet_ntop(AF_INET6, ns_rr_rdata(rr), astr, sizeof(astr));
-+			printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
++			if (bb_style_counter)
++				printf("Address %d: %s\n", (*bb_style_counter)++, astr);
++			else
++				printf("%s\thas AAAA address %s\n", ns_rr_name(rr), astr);
 +			break;
 +#endif
 +
@@ -752,7 +779,7 @@ index 000000000..f3e42d3bb
 +	llist_t *type_strings = NULL;
 +	int n_ns = 0, n_queries = 0;
 +	int c, opts, option_index = 0;
-+	int stats = 0;
++	int stats = 0, bb_style_counter = 0;
 +	unsigned int types = 0;
 +	HEADER *header;
 +
@@ -769,10 +796,8 @@ index 000000000..f3e42d3bb
 +		ptr = llist_pop(&type_strings);
 +
 +		/* skip leading text, e.g. when invoked with -querytype=AAAA */
-+		if ((chr = strchr(ptr, '=')) != NULL) {
-+			ptr = chr;
-+			*ptr++ = 0;
-+		}
++		if ((chr = strchr(ptr, '=')) != NULL)
++			ptr = chr + 1;
 +
 +		for (c = 0; qtypes[c].name; c++)
 +			if (!strcmp(qtypes[c].name, ptr))
@@ -813,14 +838,21 @@ index 000000000..f3e42d3bb
 +		/* No explicit type given, guess query type.
 +		 * If we can convert the domain argument into a ptr (means that
 +		 * inet_pton() could read it) we assume a PTR request, else
-+		 * we issue A queries. */
++		 * we issue A+AAAA queries and switch to an output format
++		 * mimicking the one of the traditional nslookup applet. */
 +		if (types == 0) {
 +			ptr = make_ptr(argv[option_index]);
 +
-+			if (ptr)
++			if (ptr) {
 +				add_query(&queries, &n_queries, T_PTR, ptr);
-+			else
++			}
++			else {
++				bb_style_counter = 1;
 +				add_query(&queries, &n_queries, T_A, argv[option_index]);
++#if ENABLE_FEATURE_IPV6
++				add_query(&queries, &n_queries, T_AAAA, argv[option_index]);
++#endif
++			}
 +		}
 +		else {
 +			for (c = 0; qtypes[c].name; c++)
@@ -889,12 +921,18 @@ index 000000000..f3e42d3bb
 +		c = 0;
 +
 +		if (queries[rc].rlen) {
-+			header = (HEADER *)queries[rc].reply;
++			if (!bb_style_counter) {
++				header = (HEADER *)queries[rc].reply;
 +
-+			if (!header->aa)
-+				printf("Non-authoritative answer:\n");
++				if (!header->aa)
++					printf("Non-authoritative answer:\n");
 +
-+			c = parse_reply(queries[rc].reply, queries[rc].rlen);
++				c = parse_reply(queries[rc].reply, queries[rc].rlen, NULL);
++			}
++			else {
++				c = parse_reply(queries[rc].reply, queries[rc].rlen,
++				                &bb_style_counter);
++			}
 +		}
 +
 +		if (c == 0)
@@ -902,7 +940,8 @@ index 000000000..f3e42d3bb
 +		else if (c < 0)
 +			printf("*** Can't find %s: Parse error\n", queries[rc].name);
 +
-+		printf("\n");
++		if (!bb_style_counter)
++			printf("\n");
 +	}
 +
 +	rc = 0;


From lede-commits at lists.infradead.org  Thu Apr 27 06:41:29 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 09:41:29 -0400
Subject: [source]  busybox: revert accidential version bump
In-Reply-To: <20170427134129.30537.69428@git-01.infra.lede-project.org>
References: <20170427134129.30537.69428@git-01.infra.lede-project.org>
Message-ID: <mailman.26355.1493300512.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/ae0e167f2b2e424d3d0d708a2bb6b1075f454234

commit ae0e167f2b2e424d3d0d708a2bb6b1075f454234
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Apr 27 15:38:48 2017 +0200

    busybox: revert accidential version bump
    
    Due to an oversight during patch conflict resolution, the PKG_VERSION got
    accidentially bumped instead of the PKG_RELEASE field.
    
    Revert the bad version change as there exists no upstream 1.25.2 version.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/busybox/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 95814ea..40bddd6 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
-PKG_VERSION:=1.25.2
+PKG_VERSION:=1.25.1
 PKG_RELEASE:=4
 PKG_FLAGS:=essential
 


From lede-commits at lists.infradead.org  Thu Apr 27 13:04:49 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Thu, 27 Apr 2017 16:04:49 -0400
Subject: [source]  dnsmasq: support dhcp_option config as a list
In-Reply-To: <20170427200449.5442.74302@git-01.infra.lede-project.org>
References: <20170427200449.5442.74302@git-01.infra.lede-project.org>
Message-ID: <mailman.26421.1493323770.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/9412fc294995ae2543fabf84d2ce39a80bfb3bd6

commit 9412fc294995ae2543fabf84d2ce39a80bfb3bd6
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Wed Apr 26 22:37:27 2017 +0200

    dnsmasq: support dhcp_option config as a list
    
    Configuring dhcp_option as an option does not allow the usage of white
    spaces in the option value; fix this by supporting dhcp_option as a list
    config while still supporting the option config to maintain backwards
    compatibility
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 .../network/services/dnsmasq/files/dnsmasq.init    | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 448d3ee..4291df2 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -538,6 +538,14 @@ dhcp_add() {
 	dhcp_option_add "$cfg" "$networkid"
 }
 
+dhcp_option_append() {
+	local option="$1"
+	local networkid="$2"
+	local force="$3"
+
+	xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$option"
+}
+
 dhcp_option_add() {
 	# NOTE: dnsmasq has explicit "option6:" prefix for DHCPv6 so no collisions
 	local cfg="$1"
@@ -546,11 +554,20 @@ dhcp_option_add() {
 
 	[ "$force" = "0" ] && force=
 
-	config_get dhcp_option "$cfg" dhcp_option
-	for o in $dhcp_option; do
-		xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$o"
-	done
+	local list_len
+	config_get list_len "$cfg" dhcp_option_LENGTH
+
+	if [ -n "$list_len" ]; then
+		config_list_foreach "$cfg" dhcp_option dhcp_option_append "$networkid" "$force"
+	else
+		echo "Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'" >&2
+		config_get dhcp_option "$cfg" dhcp_option
 
+		local option
+		for option in $dhcp_option; do
+			dhcp_option_append "$option" "$networkid" "$force"
+		done
+	fi
 }
 
 dhcp_domain_add() {


From lede-commits at lists.infradead.org  Fri Apr 28 08:04:10 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:04:10 -0400
Subject: [source]  ramips: fixed sms led polarity into dwr-512 DT
In-Reply-To: <20170428150409.13128.27341@git-01.infra.lede-project.org>
References: <20170428150409.13128.27341@git-01.infra.lede-project.org>
Message-ID: <mailman.26605.1493391875.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/26f07f668aec6363f69cfdaadbe88f5a394d8a41

commit 26f07f668aec6363f69cfdaadbe88f5a394d8a41
Author: Giuseppe Lippolis <giu.lippolis at gmail.com>
AuthorDate: Mon Feb 13 11:36:41 2017 +0100

    ramips: fixed sms led polarity into dwr-512 DT
    
    Signed-off-by: Giuseppe Lippolis <giu.lippolis at gmail.com>
---
 target/linux/ramips/dts/DWR-512-B.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/dts/DWR-512-B.dts b/target/linux/ramips/dts/DWR-512-B.dts
index 29e8eaf..9e15485 100644
--- a/target/linux/ramips/dts/DWR-512-B.dts
+++ b/target/linux/ramips/dts/DWR-512-B.dts
@@ -33,7 +33,7 @@
 
 		sms {
 			label = "dwr-512-b:green:sms";
-			gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
 		};
 		status {
 			label = "dwr-512-b:green:status";


From lede-commits at lists.infradead.org  Fri Apr 28 08:04:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:04:09 -0400
Subject: [source]  ramips: WN3000RPv3: do not setup switch
In-Reply-To: <20170428150409.13128.27341@git-01.infra.lede-project.org>
References: <20170428150409.13128.27341@git-01.infra.lede-project.org>
Message-ID: <mailman.26606.1493391875.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/dbd2212205908eac3afce45f3c05e805143728cf

commit dbd2212205908eac3afce45f3c05e805143728cf
Author: Thibaut VARENE <hacks at slashdirt.org>
AuthorDate: Sun Feb 12 17:11:08 2017 +0100

    ramips: WN3000RPv3: do not setup switch
    
    The WN3000RPv3 is a repeater with a single ethernet port. Setting up the
    switch, even to disable it, is unnecessary and possibly confusing.
    
    Configure LAN as eth0 instead.
    
    Signed-off-by: Thibaut VARENE <hacks at slashdirt.org>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 2dd6793..1c40d55 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -192,6 +192,7 @@ ramips_setup_interfaces()
 	pbr-d1|\
 	wli-tx4-ag300n|\
 	wmr-300|\
+	wn3000rpv3|\
 	wrh-300cr)
 		ucidef_set_interface_lan "eth0"
 		;;


From lede-commits at lists.infradead.org  Fri Apr 28 08:04:12 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:04:12 -0400
Subject: [source] feeds: add option to force feed update despite modified files
In-Reply-To: <20170428150409.13128.27341@git-01.infra.lede-project.org>
References: <20170428150409.13128.27341@git-01.infra.lede-project.org>
Message-ID: <mailman.26607.1493392136.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/7ee09377e7e3c64ee56514bf455cf04064208a27

commit 7ee09377e7e3c64ee56514bf455cf04064208a27
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Feb 14 18:35:57 2017 +0100

    feeds: add option to force feed update despite modified files
    
    Implement a new flag "-f" for the feeds update command which causes the
    script to fall back to a more agressive git update strategy in case there
    are locally modified files in the feeds directory.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 scripts/feeds | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/scripts/feeds b/scripts/feeds
index dfecaa9..55c294a 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -130,6 +130,7 @@ my %update_method = (
 		'init_branch'   => "git clone --depth 1 --branch '%s' '%s' '%s'",
 		'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
 		'update'	=> "git pull --ff",
+		'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
 		'controldir'	=> ".git",
 		'revision'	=> "git rev-parse --short HEAD | tr -d '\n'"},
 	'src-git-full' => {
@@ -137,6 +138,7 @@ my %update_method = (
 		'init_branch'   => "git clone --branch '%s' '%s' '%s'",
 		'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
 		'update'	=> "git pull --ff",
+		'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
 		'controldir'	=> ".git",
 		'revision'	=> "git rev-parse --short HEAD | tr -d '\n'"},
 	'src-gitsvn' => {
@@ -161,11 +163,12 @@ my %update_method = (
 # src-git: pull broken
 # src-cpy: broken if `basename $src` != $name
 
-sub update_feed_via($$$$) {
+sub update_feed_via($$$$$) {
 	my $type = shift;
 	my $name = shift;
 	my $src = shift;
 	my $relocate = shift;
+	my $force = shift;
 
 	my $m = $update_method{$type};
 	my $localpath = "./feeds/$name";
@@ -186,7 +189,11 @@ sub update_feed_via($$$$) {
 	} elsif ($m->{'init_commit'} and $commit) {
 		# in case git hash has been provided don't update the feed
 	} else {
-		system("cd '$safepath'; $m->{'update'}") == 0 or return 1;
+		my $update_cmd = $m->{'update'};
+		if ($force && exists $m->{'update_force'}) {
+			$update_cmd = $m->{'update_force'};
+		}
+		system("cd '$safepath'; $update_cmd") == 0 or return 1;
 	}
 
 	return 0;
@@ -664,13 +671,15 @@ sub uninstall {
 	return 0;
 }
 
-sub update_feed($$$$)
+sub update_feed($$$$$)
 {
 	my $type=shift;
 	my $name=shift;
 	my $src=shift;
 	my $perform_update=shift;
+	my $force_update=shift;
 	my $force_relocate=update_location( $name, "@$src" );
+	my $rv=0;
 
 	if( $force_relocate ) {
 		warn "Source of feed $name has changed, replacing copy\n";
@@ -683,9 +692,16 @@ sub update_feed($$$$)
 		my $failed = 1;
 		foreach my $feedsrc (@$src) {
 			warn "Updating feed '$name' from '$feedsrc' ...\n";
-			next unless update_feed_via($type, $name, $feedsrc, $force_relocate) == 0;
+			if (update_feed_via($type, $name, $feedsrc, $force_relocate, $force_update) != 0) {
+				if ($force_update) {
+					$rv=1;
+					$failed=0;
+					warn "failed, ignore.\n";
+					next;
+				}
+				last;
+			}
 			$failed = 0;
-			last;
 		}
 		$failed and do {
 			warn "failed.\n";
@@ -697,7 +713,7 @@ sub update_feed($$$$)
 		warn "failed.\n";
 		return 1;
 	};
-	return 0;
+	return $rv;
 }
 
 sub update {
@@ -709,7 +725,7 @@ sub update {
 	$ENV{SCAN_COOKIE} = $$;
 	$ENV{OPENWRT_VERBOSE} = 's';
 
-	getopts('ahi', \%opts);
+	getopts('ahif', \%opts);
 
 	if ($opts{h}) {
 		usage();
@@ -729,7 +745,7 @@ sub update {
 	if ( ($#ARGV == -1) or $opts{a}) {
 		foreach my $feed (@feeds) {
 			my ($type, $name, $src) = @$feed;
-			update_feed($type, $name, $src, $perform_update) == 0 or $failed=1;
+			update_feed($type, $name, $src, $perform_update, $opts{f}) == 0 or $failed=1;
 		}
 	} else {
 		while ($feed_name = shift @ARGV) {
@@ -738,7 +754,7 @@ sub update {
 				if($feed_name ne $name) {
 					next;
 				}
-				update_feed($type, $name, $src, $perform_update) == 0 or $failed=1;
+				update_feed($type, $name, $src, $perform_update, $opts{f}) == 0 or $failed=1;
 			}
 		}
 	}
@@ -796,6 +812,7 @@ Commands:
 	Options:
 	    -a :           Update all feeds listed within feeds.conf. Otherwise the specified feeds will be updated.
 	    -i :           Recreate the index only. No feed update from repository is performed.
+	    -f :           Force updating feeds even if there are changed, uncommitted files.
 
 	clean:             Remove downloaded/generated files.
 


From lede-commits at lists.infradead.org  Fri Apr 28 08:04:11 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:04:11 -0400
Subject: [source] ramips: Clean duplicated status property for Omega2 WMAC
 in dtsi
In-Reply-To: <20170428150409.13128.27341@git-01.infra.lede-project.org>
References: <20170428150409.13128.27341@git-01.infra.lede-project.org>
Message-ID: <mailman.26610.1493392252.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/0f3c2d031a0a2d040cedfc6e51b97f223e17da87

commit 0f3c2d031a0a2d040cedfc6e51b97f223e17da87
Author: Furong Xu <xfr at outlook.com>
AuthorDate: Tue Feb 14 17:25:08 2017 +0800

    ramips: Clean duplicated status property for Omega2 WMAC in dtsi
    
    At the tail of dtsi, wmac is enabled twice, clean the first one
    
    Signed-off-by: Furong Xu <xfr at outlook.com>
---
 target/linux/ramips/dts/OMEGA2.dtsi | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/target/linux/ramips/dts/OMEGA2.dtsi b/target/linux/ramips/dts/OMEGA2.dtsi
index 5d9b619..132df58 100644
--- a/target/linux/ramips/dts/OMEGA2.dtsi
+++ b/target/linux/ramips/dts/OMEGA2.dtsi
@@ -94,10 +94,6 @@
 	status = "okay";
 };
 
-&wmac {
-	status = "okay";
-};
-
 &spi0 {
 	status = "okay";
 


From lede-commits at lists.infradead.org  Fri Apr 28 08:10:57 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:10:57 -0400
Subject: [source]  ramips: correct keenetic-series switch index
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26611.1493392277.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/85bca2d0fb6886ebff40c63b73a95d522ae8aba3

commit 85bca2d0fb6886ebff40c63b73a95d522ae8aba3
Author: Vitaly Chekryzhev <13hakta at gmail.com>
AuthorDate: Mon Jan 2 02:46:33 2017 +0500

    ramips: correct keenetic-series switch index
    
    Fix switch name typo
    
    Signed-off-by: Vitaly Chekryzhev <13hakta at gmail.com>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 8b75fe1..bcb9509 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -213,7 +213,7 @@ ramips_setup_interfaces()
 		;;
 	kn_rc|\
 	kn_rf)
-		ucidef_add_switch "switch" \
+		ucidef_add_switch "switch0" \
 			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6 at eth0"
 		;;
 	kng_rc)


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:01 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:01 -0400
Subject: [source]  ramips: add ip17xx support to WLI-TX4-AG300N
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26612.1493392277.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/a66623639af5ea120a522565f4b9ad7f9a3f6c18

commit a66623639af5ea120a522565f4b9ad7f9a3f6c18
Author: Yo Abe <abe.geel at gmail.com>
AuthorDate: Thu Jan 26 22:28:09 2017 +0900

    ramips: add ip17xx support to WLI-TX4-AG300N
    
    ramips/rt288x WLI-TX4-AG300N was missing support for its 100Mbit switch which
    should be included by default.
    
    Signed-off-by: Yo Abe <abe.geel at gmail.com>
    [Jo-Philipp Wich: picked from OpenWrt PR#359, rewrap commit msg, fix Sob]
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 target/linux/ramips/image/rt288x.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/ramips/image/rt288x.mk b/target/linux/ramips/image/rt288x.mk
index 3a69c81..7fa5f67 100644
--- a/target/linux/ramips/image/rt288x.mk
+++ b/target/linux/ramips/image/rt288x.mk
@@ -61,6 +61,7 @@ define Device/wli-tx4-ag300n
   BLOCKSIZE := 64k
   IMAGE_SIZE := $(ralink_default_fw_size_4M)
   DEVICE_TITLE := Buffalo WLI-TX4-AG300N
+  DEVICE_PACKAGES := kmod-switch-ip17xx
 endef
 TARGET_DEVICES += wli-tx4-ag300n
 


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:04 -0400
Subject: [source]  ramips: ZyXEL Keenetic Omni/Omni2: export gpio usb power
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26613.1493392279.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/28d626556d846ce69246d72e2a0e3a008e5fc7dd

commit 28d626556d846ce69246d72e2a0e3a008e5fc7dd
Author: Vitaly Chekryzhev <13hakta at gmail.com>
AuthorDate: Fri Jan 20 18:03:15 2017 +0500

    ramips: ZyXEL Keenetic Omni/Omni2: export gpio usb power
    
    Export gpio usb to allow power management of USB port.
    
    Signed-off-by: Vitaly Chekryzhev <13hakta at gmail.com>
---
 target/linux/ramips/dts/kn_rc.dts | 11 +++++++++++
 target/linux/ramips/dts/kn_rf.dts | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/target/linux/ramips/dts/kn_rc.dts b/target/linux/ramips/dts/kn_rc.dts
index c63c1a3..2709b51 100644
--- a/target/linux/ramips/dts/kn_rc.dts
+++ b/target/linux/ramips/dts/kn_rc.dts
@@ -56,6 +56,17 @@
 			linux,code = <BTN_0>;
 		};
 	};
+
+	gpio_export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		usb_power {
+			gpio-export,name = "usb";
+			gpio-export,output = <1>;
+			gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+		};
+	};
 };
 
 &spi0 {
diff --git a/target/linux/ramips/dts/kn_rf.dts b/target/linux/ramips/dts/kn_rf.dts
index 22b16b0..1190eab 100644
--- a/target/linux/ramips/dts/kn_rf.dts
+++ b/target/linux/ramips/dts/kn_rf.dts
@@ -56,6 +56,17 @@
 			linux,code = <BTN_0>;
 		};
 	};
+
+	gpio_export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		usb_power {
+			gpio-export,name = "usb";
+			gpio-export,output = <1>;
+			gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+		};
+	};
 };
 
 &spi0 {


From lede-commits at lists.infradead.org  Fri Apr 28 08:10:59 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:10:59 -0400
Subject: [source]  ramips: ZyXEL Keenetic series update wan mac
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26614.1493392279.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/a12655a840b7ba86bf23b389671f386ae58f51a8

commit a12655a840b7ba86bf23b389671f386ae58f51a8
Author: Vitaly Chekryzhev <13hakta at gmail.com>
AuthorDate: Thu Jan 5 16:25:59 2017 +0500

    ramips: ZyXEL Keenetic series update wan mac
    
    Signed-off-by: Vitaly Chekryzhev <13hakta at gmail.com>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index bcb9509..cc092b1 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -347,8 +347,10 @@ ramips_setup_macs()
 		[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
 		wan_mac=$(macaddr_add "$lan_mac" 1)
 		;;
+	kn_rc|\
+	kn_rf|\
 	kng_rc)
-		wan_mac=$(mtd_get_mac_binary factory 28)
+		wan_mac=$(mtd_get_mac_binary factory 40)
 		;;
 	linkits7688 | \
 	linkits7688d)


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:02 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:02 -0400
Subject: [source]  ramips: ZyXEL Keenetic Viva: export gpio usb power
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26615.1493392279.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/5b2624d61821432b6a939333577ec1de124cdf10

commit 5b2624d61821432b6a939333577ec1de124cdf10
Author: Vitaly Chekryzhev <13hakta at gmail.com>
AuthorDate: Tue Jan 3 23:18:55 2017 +0500

    ramips: ZyXEL Keenetic Viva: export gpio usb power
    
    Export gpio usb to allow power management of USB port.
    
    Signed-off-by: Vitaly Chekryzhev <13hakta at gmail.com>
---
 target/linux/ramips/dts/kng_rc.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/target/linux/ramips/dts/kng_rc.dts b/target/linux/ramips/dts/kng_rc.dts
index fefa1b7..7cd4de3 100644
--- a/target/linux/ramips/dts/kng_rc.dts
+++ b/target/linux/ramips/dts/kng_rc.dts
@@ -62,6 +62,17 @@
 		};
 	};
 
+	gpio_export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		usb_power {
+			gpio-export,name = "usb";
+			gpio-export,output = <1>;
+			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
 	rtl8367rb {
 		compatible = "realtek,rtl8367b";
 		cpu_port = <7>;


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:00 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:00 -0400
Subject: [source]  ramips: fix EX2700 wireless mac
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26618.1493392280.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/0405851eb226ef51e7184cc545e64906b9a7e379

commit 0405851eb226ef51e7184cc545e64906b9a7e379
Author: Joseph C. Lehner <joseph.c.lehner at gmail.com>
AuthorDate: Wed Jan 25 17:57:56 2017 +0100

    ramips: fix EX2700 wireless mac
    
    On some EX2700 devices, the MAC address from the eeprom data differs
    from the actual MAC address. Fix that, and cleanup the DTS file
    while we're at it.
    
    Signed-off-by: Joseph C. Lehner <joseph.c.lehner at gmail.com>
---
 target/linux/ramips/dts/EX2700.dts | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/target/linux/ramips/dts/EX2700.dts b/target/linux/ramips/dts/EX2700.dts
index 348ca78..6c66c20 100644
--- a/target/linux/ramips/dts/EX2700.dts
+++ b/target/linux/ramips/dts/EX2700.dts
@@ -13,6 +13,7 @@
 #include "mt7620a.dtsi"
 
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	compatible = "ralink,mt7620a-soc";
@@ -27,38 +28,38 @@
 
 		power_g {
 			label = "ex2700:green:power";
-			gpios = <&gpio0 9 1>;
+			gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		power_r {
 			label = "ex2700:red:power";
-			gpios = <&gpio0 11 1>;
+			gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
 		};
 
 		device_g {
 			label = "ex2700:green:device";
-			gpios = <&gpio0 13 1>;
+			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
 		};
 
 		device_r {
 			label = "ex2700:red:device";
-			gpios = <&gpio0 10 1>;
+			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
 		};
 
 		router_g {
 			label = "ex2700:green:router";
-			gpios = <&gpio0 12 1>;
+			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
 		};
 
 		router_r {
 			label = "ex2700:red:router";
-			gpios = <&gpio0 14 1>;
+			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
 			label = "ex2700:green:wps";
-			gpios = <&gpio1 15 1>;
+			gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
 		};
 	};
 
@@ -70,13 +71,13 @@
 
 		reset {
 			label = "reset";
-			gpios = <&gpio0 1 1>;
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_RESTART>;
 		};
 
 		wps {
 			label = "wps";
-			gpios = <&gpio0 2 1>;
+			gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_WPS_BUTTON>;
 		};
 	};
@@ -98,7 +99,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
@@ -131,15 +131,13 @@
 };
 
 &wmac {
+	mtd-mac-address = <&art 0x6>;
 	ralink,mtd-eeprom = <&art 0x1000>;
 };
 
 &pinctrl {
 	state_default: pinctrl0 {
 		default {
-			//  spi refclk: pins 37, 38, 39
-			//       uartf: pins 8, 9, 10, 11, 12, 13, 14
-			//         i2c: pins 1, 2
 			ralink,group = "i2c", "uartf", "spi refclk";
 			ralink,function = "gpio";
 		};


From lede-commits at lists.infradead.org  Fri Apr 28 08:10:58 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:10:58 -0400
Subject: [source]  ramips: ZyXEL Keenetic Omni align factory images
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26619.1493392280.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/94948252e25f96e180e5c4bb7fe928595e3243d2

commit 94948252e25f96e180e5c4bb7fe928595e3243d2
Author: Vitaly Chekryzhev <13hakta at gmail.com>
AuthorDate: Thu Jan 5 16:23:07 2017 +0500

    ramips: ZyXEL Keenetic Omni align factory images
    
    ZyXEL web-flasher requires squashfs to be aligned to 64kb.
    
    Signed-off-by: Vitaly Chekryzhev <13hakta at gmail.com>
---
 target/linux/ramips/image/mt7620.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 42e0ab6..d2a4ad7 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -448,7 +448,7 @@ define Device/kn_rc
   DEVICE_TITLE := ZyXEL Keenetic Omni
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
   IMAGES += factory.bin
-  IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | check-size $$$$(IMAGE_SIZE) | \
+  IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | pad-to 64k | check-size $$$$(IMAGE_SIZE) | \
 	zyimage -d 4882 -v "ZyXEL Keenetic Omni"
 endef
 TARGET_DEVICES += kn_rc
@@ -458,7 +458,7 @@ define Device/kn_rf
   DEVICE_TITLE := ZyXEL Keenetic Omni II
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
   IMAGES += factory.bin
-  IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | check-size $$$$(IMAGE_SIZE) | \
+  IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | pad-to 64k | check-size $$$$(IMAGE_SIZE) | \
 	zyimage -d 2102034 -v "ZyXEL Keenetic Omni II"
 endef
 TARGET_DEVICES += kn_rf


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:03 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:03 -0400
Subject: [source]  ramips: ZyXEL Keenetic Viva: align factory images
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26620.1493392280.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/fd693bc0e80bafe89a85db7f905d717310ab513b

commit fd693bc0e80bafe89a85db7f905d717310ab513b
Author: Vitaly Chekryzhev <13hakta at gmail.com>
AuthorDate: Fri Jan 20 17:57:11 2017 +0500

    ramips: ZyXEL Keenetic Viva: align factory images
    
    ZyXEL web-flasher requires squashfs to be aligned to 64kb.
    
    Signed-off-by: Vitaly Chekryzhev <13hakta at gmail.com>
---
 target/linux/ramips/image/mt7620.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index d2a4ad7..f4f072f 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -469,7 +469,7 @@ define Device/kng_rc
   DEVICE_TITLE := ZyXEL Keenetic Viva
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-switch-rtl8366-smi kmod-switch-rtl8367b
   IMAGES += factory.bin
-  IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
+  IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | check-size $$$$(IMAGE_SIZE) | \
 	zyimage -d 8997 -v "ZyXEL Keenetic Viva"
 endef
 TARGET_DEVICES += kng_rc


From lede-commits at lists.infradead.org  Fri Apr 28 08:10:55 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:10:55 -0400
Subject: [source]  ramips: fix mac address of miwifi-mini
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26621.1493392280.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/846457fdbffaffdf44d668715e88cb21765ec6c9

commit 846457fdbffaffdf44d668715e88cb21765ec6c9
Author: BangLang Huang <banglang.huang at foxmail.com>
AuthorDate: Wed Jan 18 17:45:48 2017 +0800

    ramips: fix mac address of miwifi-mini
    
    For the miwifi-mini, the offset of ethernet mac should be 0x28
    which you can easyily dump from 'Factory' partition.
    
    Signed-off-by: BangLang Huang <banglang.huang at foxmail.com>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 4 ++++
 target/linux/ramips/dts/MIWIFI-MINI.dts               | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 1c40d55..ebca378 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -358,6 +358,10 @@ ramips_setup_macs()
 		lan_mac=$(mtd_get_mac_binary factory_info 13)
 		wan_mac=$(macaddr_add "$lan_mac" 1)
 		;;
+	miwifi-mini)
+		wan_mac=$(cat /sys/class/net/eth0/address)
+		lan_mac=$(macaddr_setbit_la "$wan_mac")
+		;;
 	m3|\
 	m4|\
 	x5|\
diff --git a/target/linux/ramips/dts/MIWIFI-MINI.dts b/target/linux/ramips/dts/MIWIFI-MINI.dts
index 0cd511c..6d8b28c 100644
--- a/target/linux/ramips/dts/MIWIFI-MINI.dts
+++ b/target/linux/ramips/dts/MIWIFI-MINI.dts
@@ -119,7 +119,7 @@
 &ethernet {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
-	mtd-mac-address = <&factory 0x4>;
+	mtd-mac-address = <&factory 0x28>;
 	mediatek,portmap = "llllw";
 };
 


From lede-commits at lists.infradead.org  Fri Apr 28 08:10:56 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:10:56 -0400
Subject: [source]  ramips: add support for Netgear WN3000RPv3
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26622.1493392280.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/1aee42c6a9d297e5a8bd241318338217b86c3070

commit 1aee42c6a9d297e5a8bd241318338217b86c3070
Author: Thibaut VARENE <hacks at slashdirt.org>
AuthorDate: Wed Jan 18 11:34:56 2017 +0100

    ramips: add support for Netgear WN3000RPv3
    
    This patch adds support for the Netgear WN3000RPv3
    http://www.netgear.com/support/product/wn3000rpv3.aspx
    
    Specifications:
    - SoC: MediaTek MT7620A (580MHz, ramips)
    - RAM: 32MB DDR
    - Storage: 8MB NOR SPI flash
    - Wireless: builtin MT7620A, 2x2:2 with u.FL connectors
    - Ethernet: 1x100M
    - Serial: JP1 header, 57600-8N1
    - Stock firmware based on OpenWRT Kamikaze
    
    Like the EX2700, the bootloader expects a secondary image signature,
    see https://forum.openwrt.org/viewtopic.php?pid=312577#p312577
    This is why the same fakeroot image is used for the WN3000
    
    Signed-off-by: Thibaut VARENE <hacks at slashdirt.org>
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   3 +-
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh         |   3 +-
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ramips/dts/WN3000RPV3.dts             | 143 +++++++++++++++++++++
 target/linux/ramips/image/mt7620.mk                |  11 ++
 7 files changed, 163 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 3d3aa0a..545d6a4 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -155,7 +155,8 @@ vr500)
 dir-860l-b1)
 	ucidef_set_led_netdev "wan" "wan" "$board:green:net" "eth0.2"
 	;;
-ex2700)
+ex2700|\
+wn3000rpv3)
 	ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
 	set_wifi_led "$board:green:router"
 	;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index ebca378..8b75fe1 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -58,6 +58,7 @@ ramips_setup_interfaces()
 	timecloud|\
 	w150m|\
 	widora-neo|\
+	wn3000rpv3|\
 	wnce2001|\
 	zbt-cpe102|\
 	zte-q7)
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 5367e65..9499833 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -53,7 +53,8 @@ get_status_led() {
 	jhr-n825r|\
 	mpr-a1|\
 	mpr-a2|\
-	mzk-ex750np)
+	mzk-ex750np|\
+	wn3000rpv3)
 		status_led="$board:red:power"
 		;;
 	ac1200pro|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 6afe709..8292da1 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -553,6 +553,9 @@ ramips_board_detect() {
 	*"WMR-300")
 		name="wmr-300"
 		;;
+	*"WN3000RPv3")
+		name="wn3000rpv3"
+		;;
 	*"WNCE2001")
 		name="wnce2001"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0f2510c..c6ad8ca 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -157,6 +157,7 @@ platform_check_image() {
 	wli-tx4-ag300n|\
 	wlr-6000|\
 	wmr-300|\
+	wn3000rpv3|\
 	wnce2001|\
 	wndr3700v5|\
 	wr512-3gn|\
diff --git a/target/linux/ramips/dts/WN3000RPV3.dts b/target/linux/ramips/dts/WN3000RPV3.dts
new file mode 100644
index 0000000..933cf1a
--- /dev/null
+++ b/target/linux/ramips/dts/WN3000RPV3.dts
@@ -0,0 +1,143 @@
+/* This file is released into the public domain */
+
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	compatible = "ralink,mt7620a-soc";
+	model = "Netgear WN3000RPv3";
+
+	chosen {
+		bootargs = "console=ttyS0,57600";
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power_g {
+			label = "wn3000rpv3:green:power";
+			gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
+			default-state = "on";
+		};
+
+		power_r {
+			label = "wn3000rpv3:red:power";
+			gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+		};
+
+		client_g {
+			label = "wn3000rpv3:green:client";
+			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+		};
+
+		client_r {
+			label = "wn3000rpv3:red:client";
+			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
+		};
+
+		router_g {
+			label = "wn3000rpv3:green:router";
+			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+		};
+
+		router_r {
+			label = "wn3000rpv3:red:router";
+			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
+		};
+
+		wps {
+			label = "wn3000rpv3:green:wps";
+			gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+		};
+
+		l_arrow {
+			label = "wn3000rpv3:blue:leftarrow";
+			gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+		};
+
+		r_arrow {
+			label = "wn3000rpv3:blue:rightarrow";
+			gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+	};
+};
+
+&gpio1 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	m25p80 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		partition at 40000 {
+			label = "firmware";
+			reg = <0x40000 0x7b0000>;
+		};
+
+		art: partition at 7f0000 {
+			label = "art";
+			reg = <0x7f0000 0x10000>;
+			read-only;
+		};
+	};
+};
+
+&ethernet {
+	mtd-mac-address = <&art 0x0>;
+};
+
+&wmac {
+	mtd-mac-address = <&art 0x6>;
+	ralink,mtd-eeprom = <&art 0x1000>;
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		default {
+			ralink,group = "i2c", "uartf", "spi refclk";
+			ralink,function = "gpio";
+		};
+	};
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 1889bcf..42e0ab6 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -75,6 +75,17 @@ define Device/ex2700
 endef
 TARGET_DEVICES += ex2700
 
+define Device/wn3000rpv3
+  DTS := WN3000RPV3
+  BLOCKSIZE := 4k
+  IMAGES += factory.bin
+  KERNEL := $(KERNEL_DTB) | uImage lzma | pad-kernel-ex2700
+  IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
+	netgear-header -B WN3000RPv3 -H 29764836+8+0+32+2x2+0
+  DEVICE_TITLE := Netgear WN3000RPv3
+endef
+TARGET_DEVICES += wn3000rpv3
+
 define Device/wt3020-4M
   DTS := WT3020-4M
   BLOCKSIZE := 4k


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:05 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:05 -0400
Subject: [source]  rpcd: Explicitly link with lcrypt
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26623.1493392303.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/e200c66a1ad1ac62007084629da5dcc28ed822a0

commit e200c66a1ad1ac62007084629da5dcc28ed822a0
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Sat Dec 31 16:13:34 2016 -0800

    rpcd: Explicitly link with lcrypt
    
    Fixes build issues with some toolchains that don't add lcrypt in the default
    search paths:
    
    CMakeFiles/rpcd.dir/session.c.o: In function `rpc_login_test_password':
    build_dir/target-mipsel-linux-gnu/rpcd-2016-12-03-0577cfc1/session.c:823: undefined reference to `crypt'
    collect2: error: ld returned 1 exit status
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 package/system/rpcd/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 9da7df8..d13f20e 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -51,6 +51,8 @@ define Package/rpcd/conffiles
 /etc/config/rpcd
 endef
 
+TARGET_LDFLAGS += -lcrypt
+
 define Package/rpcd/install
 	$(INSTALL_DIR) $(1)/etc/init.d
 	$(INSTALL_BIN) ./files/rpcd.init $(1)/etc/init.d/rpcd


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:08 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:08 -0400
Subject: [source]  ramips: remove Planex CS-QR10 sound device tree node
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26624.1493392325.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/88cc06abb7b40ae91f889b5038292f4ffe2e55d5

commit 88cc06abb7b40ae91f889b5038292f4ffe2e55d5
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Feb 2 22:34:53 2017 +0100

    ramips: remove Planex CS-QR10 sound device tree node
    
    The comptible string is neither added by any LEDE patch nor exists in
    in the kernel. Drop the sound node which was obviously added
    accidentally with 9195d8da ("ramips: DTS rework").
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/CS-QR10.dts | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/target/linux/ramips/dts/CS-QR10.dts b/target/linux/ramips/dts/CS-QR10.dts
index e3611c2..81d897a 100644
--- a/target/linux/ramips/dts/CS-QR10.dts
+++ b/target/linux/ramips/dts/CS-QR10.dts
@@ -8,17 +8,6 @@
 	compatible = "ralink,mt7620a-soc";
 	model = "Planex CS-QR10";
 
-	sound {
-		compatible = "mediatek,mt7620-audio-wm8960";
-		model = "mt7620-wm8960";
-		i2s-controller = <&i2s>;
-		audio-routing =
-			"Ext Spk", "SPK_LP",
-			"Ext Spk", "SPK_LN",
-			"Ext Spk", "SPK_RP",
-			"Ext Spk", "SPK_RN";
-	};
-
 	gpio-leds {
 		compatible = "gpio-leds";
 


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:06 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:06 -0400
Subject: [source]  ramips: remove DT pcie nodes for GL-MT300A/N
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26625.1493392350.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/6aa0a85fc613970940777b36e1f633f6677e310a

commit 6aa0a85fc613970940777b36e1f633f6677e310a
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Feb 1 13:53:57 2017 +0100

    ramips: remove DT pcie nodes for GL-MT300A/N
    
    These devices don't have a secondary wifi chip
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/ramips/dts/GL-MT300A.dts | 13 -------------
 target/linux/ramips/dts/GL-MT300N.dts | 13 -------------
 2 files changed, 26 deletions(-)

diff --git a/target/linux/ramips/dts/GL-MT300A.dts b/target/linux/ramips/dts/GL-MT300A.dts
index 6922b95..32e1fe0 100644
--- a/target/linux/ramips/dts/GL-MT300A.dts
+++ b/target/linux/ramips/dts/GL-MT300A.dts
@@ -141,19 +141,6 @@
 	ralink,mtd-eeprom = <&factory 0>;
 };
 
-&pcie {
-	status = "okay";
-
-	pcie-bridge {
-		mt76 at 0,0 {
-			reg = <0x0000 0 0 0 0>;
-			device_type = "pci";
-			mediatek,mtd-eeprom = <&factory 0x8000>;
-			mediatek,2ghz = <0>;
-		};
-	};
-};
-
 &pinctrl {
 	state_default: pinctrl0 {
 		gpio {
diff --git a/target/linux/ramips/dts/GL-MT300N.dts b/target/linux/ramips/dts/GL-MT300N.dts
index c6feb96..7334bc7 100644
--- a/target/linux/ramips/dts/GL-MT300N.dts
+++ b/target/linux/ramips/dts/GL-MT300N.dts
@@ -130,19 +130,6 @@
 	ralink,mtd-eeprom = <&factory 0>;
 };
 
-&pcie {
-	status = "okay";
-
-	pcie-bridge {
-		mt76 at 0,0 {
-			reg = <0x0000 0 0 0 0>;
-			device_type = "pci";
-			mediatek,mtd-eeprom = <&factory 0x8000>;
-			mediatek,2ghz = <0>;
-		};
-	};
-};
-
 &pinctrl {
 	state_default: pinctrl0 {
 		gpio {


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:09 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:09 -0400
Subject: [source]  ramips: fix Sercomm NA930 compatible string
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26628.1493392371.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/7e2ad9cbb855abd660d72d2127b7440bd282db85

commit 7e2ad9cbb855abd660d72d2127b7440bd282db85
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Feb 2 22:35:59 2017 +0100

    ramips: fix Sercomm NA930 compatible string
    
    The Sercomm NA930 is not a mt7620a evaluation board and shouldn't use
    the eval board compatible string.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/NA930.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/dts/NA930.dts b/target/linux/ramips/dts/NA930.dts
index 522bc75..a5393e2 100644
--- a/target/linux/ramips/dts/NA930.dts
+++ b/target/linux/ramips/dts/NA930.dts
@@ -5,7 +5,7 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
+	compatible = "ralink,mt7620a-soc";
 	model = "Sercomm NA930";
 
 	chosen {


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:12 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:12 -0400
Subject: [source]  cns3xxx: use proper macro's for ID handling
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26629.1493392393.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/105d5b6f03647e225ce3361a818ff4303f64df24

commit 105d5b6f03647e225ce3361a818ff4303f64df24
Author: Koen Vandeputte <koen.vandeputte at ncentric.com>
AuthorDate: Mon Feb 6 12:11:39 2017 +0100

    cns3xxx: use proper macro's for ID handling
    
    Compiled & tested on cns3xxx
    
    Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
---
 target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c
index 4a59612..4584d54 100644
--- a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c
+++ b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c
@@ -297,7 +297,7 @@ static struct gpio_led_platform_data laguna_gpio_leds_data = {
 
 static struct platform_device laguna_gpio_leds_device = {
 	.name = "leds-gpio",
-	.id = -1,
+	.id = PLATFORM_DEVID_NONE,
 	.dev.platform_data = &laguna_gpio_leds_data,
 };
 
@@ -641,7 +641,7 @@ static struct resource laguna_watchdog_resources[] = {
 
 static struct platform_device laguna_watchdog = {
 	.name		= "mpcore_wdt",
-	.id		= -1,
+	.id		= PLATFORM_DEVID_NONE,
 	.num_resources	= ARRAY_SIZE(laguna_watchdog_resources),
 	.resource	= laguna_watchdog_resources,
 };
@@ -658,7 +658,7 @@ static struct pps_gpio_platform_data laguna_pps_data = {
 
 static struct platform_device laguna_pps_device = {
 	.name = "pps-gpio",
-	.id = -1,
+	.id = PLATFORM_DEVID_NONE,
 	.dev.platform_data = &laguna_pps_data,
 };
 


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:07 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:07 -0400
Subject: [source]  ramips: cleanup SPI flash device tree properties usage
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26630.1493392416.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/f1f0b92a795e3f238912d5f03172627141af2375

commit f1f0b92a795e3f238912d5f03172627141af2375
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Feb 2 22:11:23 2017 +0100

    ramips: cleanup SPI flash device tree properties usage
    
    Use only the jedec,spi-nor compatible string. Everything else either
    never worked or is only support to keep compatibility.
    
    Remove the linux,modalias property. It is obsolete since kernel 4.4.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/ramips/dts/3G150B.dts                | 1 -
 target/linux/ramips/dts/3G300M.dts                | 1 -
 target/linux/ramips/dts/A5-V11.dts                | 1 -
 target/linux/ramips/dts/AI-BR100.dts              | 1 -
 target/linux/ramips/dts/AIR3GII.dts               | 1 -
 target/linux/ramips/dts/ALL0256N-4M.dts           | 1 -
 target/linux/ramips/dts/ALL0256N-8M.dts           | 1 -
 target/linux/ramips/dts/ALL5002.dts               | 1 -
 target/linux/ramips/dts/ALL5003.dts               | 1 -
 target/linux/ramips/dts/ASL26555-16M.dts          | 1 -
 target/linux/ramips/dts/ASL26555-8M.dts           | 1 -
 target/linux/ramips/dts/AWAPN2403.dts             | 1 -
 target/linux/ramips/dts/AWM002-4M.dtsi            | 1 -
 target/linux/ramips/dts/AWM002-8M.dtsi            | 1 -
 target/linux/ramips/dts/AWM003-EVB.dts            | 1 -
 target/linux/ramips/dts/ArcherC20i.dts            | 1 -
 target/linux/ramips/dts/ArcherC50.dts             | 1 -
 target/linux/ramips/dts/ArcherMR200.dts           | 1 -
 target/linux/ramips/dts/CF-WR800N.dts             | 1 -
 target/linux/ramips/dts/CS-QR10.dts               | 1 -
 target/linux/ramips/dts/DB-WRT01.dts              | 1 -
 target/linux/ramips/dts/DCH-M225.dts              | 1 -
 target/linux/ramips/dts/DCS-930L-B1.dts           | 1 -
 target/linux/ramips/dts/DIR-300-B7.dts            | 1 -
 target/linux/ramips/dts/DIR-320-B1.dts            | 1 -
 target/linux/ramips/dts/DIR-610-A1.dts            | 1 -
 target/linux/ramips/dts/DIR-615-H1.dts            | 1 -
 target/linux/ramips/dts/DIR-620-D1.dts            | 1 -
 target/linux/ramips/dts/DIR-645.dts               | 1 -
 target/linux/ramips/dts/DIR-810L.dts              | 1 -
 target/linux/ramips/dts/DUZUN-DM06.dts            | 1 -
 target/linux/ramips/dts/E1700.dts                 | 1 -
 target/linux/ramips/dts/F7C027.dts                | 1 -
 target/linux/ramips/dts/GL-MT300A.dts             | 3 +--
 target/linux/ramips/dts/GL-MT300N.dts             | 3 +--
 target/linux/ramips/dts/GL-MT750.dts              | 3 +--
 target/linux/ramips/dts/HC5XXX.dtsi               | 1 -
 target/linux/ramips/dts/HLKRM04.dts               | 1 -
 target/linux/ramips/dts/HT-TM02.dts               | 1 -
 target/linux/ramips/dts/JHR-N805R.dts             | 1 -
 target/linux/ramips/dts/LINKIT7688.dts            | 1 -
 target/linux/ramips/dts/M2M.dts                   | 1 -
 target/linux/ramips/dts/M3.dts                    | 1 -
 target/linux/ramips/dts/M4-4M.dts                 | 1 -
 target/linux/ramips/dts/M4-8M.dts                 | 1 -
 target/linux/ramips/dts/MAC1200RV2.dts            | 3 +--
 target/linux/ramips/dts/MINIEMBPLUG.dts           | 1 -
 target/linux/ramips/dts/MIWIFI-MINI.dts           | 1 -
 target/linux/ramips/dts/MIWIFI-NANO.dts           | 1 -
 target/linux/ramips/dts/MLW221.dts                | 1 -
 target/linux/ramips/dts/MLWG2.dts                 | 1 -
 target/linux/ramips/dts/MPRA1.dts                 | 1 -
 target/linux/ramips/dts/MPRA2.dts                 | 1 -
 target/linux/ramips/dts/MT7620a.dts               | 1 -
 target/linux/ramips/dts/MT7620a_MT7530.dts        | 1 -
 target/linux/ramips/dts/MT7620a_MT7610e.dts       | 1 -
 target/linux/ramips/dts/MT7628.dts                | 1 -
 target/linux/ramips/dts/MZK-750DHP.dts            | 1 -
 target/linux/ramips/dts/MZK-DP150N.dts            | 1 -
 target/linux/ramips/dts/MZK-EX300NP.dts           | 1 -
 target/linux/ramips/dts/MZK-EX750NP.dts           | 1 -
 target/linux/ramips/dts/MicroWRT.dts              | 1 -
 target/linux/ramips/dts/NBG-419N2.dts             | 3 +--
 target/linux/ramips/dts/NCS601W.dts               | 1 -
 target/linux/ramips/dts/NIXCORE-16M.dts           | 1 -
 target/linux/ramips/dts/NIXCORE-8M.dts            | 1 -
 target/linux/ramips/dts/NW718.dts                 | 1 -
 target/linux/ramips/dts/OY-0001.dts               | 1 -
 target/linux/ramips/dts/PBR-D1.dts                | 1 -
 target/linux/ramips/dts/PSG1208.dts               | 1 -
 target/linux/ramips/dts/PSG1218.dts               | 1 -
 target/linux/ramips/dts/PX-4885-4M.dts            | 1 -
 target/linux/ramips/dts/PX-4885-8M.dts            | 1 -
 target/linux/ramips/dts/RP-N53.dts                | 1 -
 target/linux/ramips/dts/RT-G32-B1.dts             | 1 -
 target/linux/ramips/dts/RT-N14U.dts               | 1 -
 target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts | 1 -
 target/linux/ramips/dts/RT5350F-OLINUXINO.dts     | 1 -
 target/linux/ramips/dts/RUT5XX.dts                | 1 -
 target/linux/ramips/dts/TEW-714TRU.dts            | 1 -
 target/linux/ramips/dts/TINY-AC.dts               | 1 -
 target/linux/ramips/dts/VOCORE-16M.dts            | 1 -
 target/linux/ramips/dts/VOCORE-8M.dts             | 1 -
 target/linux/ramips/dts/WHR-1166D.dts             | 1 -
 target/linux/ramips/dts/WHR-300HP2.dts            | 1 -
 target/linux/ramips/dts/WHR-600D.dts              | 1 -
 target/linux/ramips/dts/WIDORA-NEO.dts            | 1 -
 target/linux/ramips/dts/WIZARD8800.dts            | 1 -
 target/linux/ramips/dts/WIZFI630A.dts             | 1 -
 target/linux/ramips/dts/WL-330N.dts               | 1 -
 target/linux/ramips/dts/WL-330N3G.dts             | 1 -
 target/linux/ramips/dts/WL-WN575A3.dts            | 1 -
 target/linux/ramips/dts/WMR-300.dts               | 1 -
 target/linux/ramips/dts/WNCE2001.dts              | 1 -
 target/linux/ramips/dts/WRH-300CR.dts             | 1 -
 target/linux/ramips/dts/WRTNODE.dts               | 1 -
 target/linux/ramips/dts/WT1520-4M.dts             | 1 -
 target/linux/ramips/dts/WT1520-8M.dts             | 1 -
 target/linux/ramips/dts/WT3020-4M.dts             | 1 -
 target/linux/ramips/dts/WT3020-8M.dts             | 1 -
 target/linux/ramips/dts/X5.dts                    | 1 -
 target/linux/ramips/dts/X8.dts                    | 1 -
 target/linux/ramips/dts/Y1.dtsi                   | 1 -
 target/linux/ramips/dts/YOUKU-YK1.dts             | 1 -
 target/linux/ramips/dts/ZBT-APE522II.dts          | 1 -
 target/linux/ramips/dts/ZBT-CPE102.dts            | 1 -
 target/linux/ramips/dts/ZBT-WA05.dts              | 1 -
 target/linux/ramips/dts/ZBT-WE826.dts             | 3 +--
 target/linux/ramips/dts/ZBT-WR8305RT.dts          | 1 -
 target/linux/ramips/dts/ZTE-Q7.dts                | 1 -
 110 files changed, 6 insertions(+), 116 deletions(-)

diff --git a/target/linux/ramips/dts/3G150B.dts b/target/linux/ramips/dts/3G150B.dts
index b64f940..e242e33 100644
--- a/target/linux/ramips/dts/3G150B.dts
+++ b/target/linux/ramips/dts/3G150B.dts
@@ -55,7 +55,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/3G300M.dts b/target/linux/ramips/dts/3G300M.dts
index 4d19bca..8ca8d15 100644
--- a/target/linux/ramips/dts/3G300M.dts
+++ b/target/linux/ramips/dts/3G300M.dts
@@ -70,7 +70,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/A5-V11.dts b/target/linux/ramips/dts/A5-V11.dts
index 748e1ed..d755695 100644
--- a/target/linux/ramips/dts/A5-V11.dts
+++ b/target/linux/ramips/dts/A5-V11.dts
@@ -61,7 +61,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "pm25lq032";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/AI-BR100.dts b/target/linux/ramips/dts/AI-BR100.dts
index 2405ae7..b21e4c2 100644
--- a/target/linux/ramips/dts/AI-BR100.dts
+++ b/target/linux/ramips/dts/AI-BR100.dts
@@ -52,7 +52,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0 0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/AIR3GII.dts b/target/linux/ramips/dts/AIR3GII.dts
index 4d9a3b5..e9c1434 100644
--- a/target/linux/ramips/dts/AIR3GII.dts
+++ b/target/linux/ramips/dts/AIR3GII.dts
@@ -48,7 +48,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q32b";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ALL0256N-4M.dts b/target/linux/ramips/dts/ALL0256N-4M.dts
index abe43d1..b4d421f 100644
--- a/target/linux/ramips/dts/ALL0256N-4M.dts
+++ b/target/linux/ramips/dts/ALL0256N-4M.dts
@@ -53,7 +53,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ALL0256N-8M.dts b/target/linux/ramips/dts/ALL0256N-8M.dts
index 45c5d33..704e606 100644
--- a/target/linux/ramips/dts/ALL0256N-8M.dts
+++ b/target/linux/ramips/dts/ALL0256N-8M.dts
@@ -53,7 +53,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ALL5002.dts b/target/linux/ramips/dts/ALL5002.dts
index 66ed017..ddfe811 100644
--- a/target/linux/ramips/dts/ALL5002.dts
+++ b/target/linux/ramips/dts/ALL5002.dts
@@ -54,7 +54,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l25635e";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ALL5003.dts b/target/linux/ramips/dts/ALL5003.dts
index dfb97e6..f507aa9 100644
--- a/target/linux/ramips/dts/ALL5003.dts
+++ b/target/linux/ramips/dts/ALL5003.dts
@@ -54,7 +54,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l25635e";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ASL26555-16M.dts b/target/linux/ramips/dts/ASL26555-16M.dts
index 460fe05..8379851 100644
--- a/target/linux/ramips/dts/ASL26555-16M.dts
+++ b/target/linux/ramips/dts/ASL26555-16M.dts
@@ -84,7 +84,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25sl12801";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ASL26555-8M.dts b/target/linux/ramips/dts/ASL26555-8M.dts
index 288f555..2c6a462 100644
--- a/target/linux/ramips/dts/ASL26555-8M.dts
+++ b/target/linux/ramips/dts/ASL26555-8M.dts
@@ -84,7 +84,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25sl064p";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/AWAPN2403.dts b/target/linux/ramips/dts/AWAPN2403.dts
index a1b5b21..06bfac0 100644
--- a/target/linux/ramips/dts/AWAPN2403.dts
+++ b/target/linux/ramips/dts/AWAPN2403.dts
@@ -39,7 +39,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/AWM002-4M.dtsi b/target/linux/ramips/dts/AWM002-4M.dtsi
index 69d25bb..3ea20e6 100644
--- a/target/linux/ramips/dts/AWM002-4M.dtsi
+++ b/target/linux/ramips/dts/AWM002-4M.dtsi
@@ -7,5 +7,4 @@
 
 &m25p80 {
 	compatible = "jedec,spi-nor";
-	linux,modalias = "m25p80", "mx25l3205d";
 };
diff --git a/target/linux/ramips/dts/AWM002-8M.dtsi b/target/linux/ramips/dts/AWM002-8M.dtsi
index 1e6970d..3ea20e6 100644
--- a/target/linux/ramips/dts/AWM002-8M.dtsi
+++ b/target/linux/ramips/dts/AWM002-8M.dtsi
@@ -7,5 +7,4 @@
 
 &m25p80 {
 	compatible = "jedec,spi-nor";
-	linux,modalias = "m25p80", "mx25l6405d";
 };
diff --git a/target/linux/ramips/dts/AWM003-EVB.dts b/target/linux/ramips/dts/AWM003-EVB.dts
index b42d77e..7c23f34 100644
--- a/target/linux/ramips/dts/AWM003-EVB.dts
+++ b/target/linux/ramips/dts/AWM003-EVB.dts
@@ -54,7 +54,6 @@
 
 &m25p80 {
 	compatible = "jedec,spi-nor";
-	linux,modalias = "m25p80", "mx25l6405d";
 };
 
 &ethernet {
diff --git a/target/linux/ramips/dts/ArcherC20i.dts b/target/linux/ramips/dts/ArcherC20i.dts
index 711274e..b1001bf 100644
--- a/target/linux/ramips/dts/ArcherC20i.dts
+++ b/target/linux/ramips/dts/ArcherC20i.dts
@@ -73,7 +73,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ArcherC50.dts b/target/linux/ramips/dts/ArcherC50.dts
index 3924cc4..abc4dac 100644
--- a/target/linux/ramips/dts/ArcherC50.dts
+++ b/target/linux/ramips/dts/ArcherC50.dts
@@ -95,7 +95,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ArcherMR200.dts b/target/linux/ramips/dts/ArcherMR200.dts
index 93fb048..bbbf0af 100644
--- a/target/linux/ramips/dts/ArcherMR200.dts
+++ b/target/linux/ramips/dts/ArcherMR200.dts
@@ -117,7 +117,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/CF-WR800N.dts b/target/linux/ramips/dts/CF-WR800N.dts
index 6ce4b27..9fcab02 100644
--- a/target/linux/ramips/dts/CF-WR800N.dts
+++ b/target/linux/ramips/dts/CF-WR800N.dts
@@ -69,7 +69,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/CS-QR10.dts b/target/linux/ramips/dts/CS-QR10.dts
index bdd828f..e3611c2 100644
--- a/target/linux/ramips/dts/CS-QR10.dts
+++ b/target/linux/ramips/dts/CS-QR10.dts
@@ -82,7 +82,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DB-WRT01.dts b/target/linux/ramips/dts/DB-WRT01.dts
index 400c5ef..c4a32ea 100644
--- a/target/linux/ramips/dts/DB-WRT01.dts
+++ b/target/linux/ramips/dts/DB-WRT01.dts
@@ -43,7 +43,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DCH-M225.dts b/target/linux/ramips/dts/DCH-M225.dts
index 21133a9..3465c70 100644
--- a/target/linux/ramips/dts/DCH-M225.dts
+++ b/target/linux/ramips/dts/DCH-M225.dts
@@ -100,7 +100,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <80000000>;
 		m25p,fast-read;
 
diff --git a/target/linux/ramips/dts/DCS-930L-B1.dts b/target/linux/ramips/dts/DCS-930L-B1.dts
index 17996d2..8ebc1bb 100644
--- a/target/linux/ramips/dts/DCS-930L-B1.dts
+++ b/target/linux/ramips/dts/DCS-930L-B1.dts
@@ -50,7 +50,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-300-B7.dts b/target/linux/ramips/dts/DIR-300-B7.dts
index fb93f5d..9bb4345 100644
--- a/target/linux/ramips/dts/DIR-300-B7.dts
+++ b/target/linux/ramips/dts/DIR-300-B7.dts
@@ -50,7 +50,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-320-B1.dts b/target/linux/ramips/dts/DIR-320-B1.dts
index 2335c9a..0716229 100644
--- a/target/linux/ramips/dts/DIR-320-B1.dts
+++ b/target/linux/ramips/dts/DIR-320-B1.dts
@@ -72,7 +72,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-610-A1.dts b/target/linux/ramips/dts/DIR-610-A1.dts
index e69997f..a70b460 100644
--- a/target/linux/ramips/dts/DIR-610-A1.dts
+++ b/target/linux/ramips/dts/DIR-610-A1.dts
@@ -50,7 +50,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-615-H1.dts b/target/linux/ramips/dts/DIR-615-H1.dts
index 9fbd735..a2873be 100644
--- a/target/linux/ramips/dts/DIR-615-H1.dts
+++ b/target/linux/ramips/dts/DIR-615-H1.dts
@@ -65,7 +65,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-620-D1.dts b/target/linux/ramips/dts/DIR-620-D1.dts
index 1bdcaff..f3079d3 100644
--- a/target/linux/ramips/dts/DIR-620-D1.dts
+++ b/target/linux/ramips/dts/DIR-620-D1.dts
@@ -44,7 +44,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-645.dts b/target/linux/ramips/dts/DIR-645.dts
index 30eccaf..9c8082c 100644
--- a/target/linux/ramips/dts/DIR-645.dts
+++ b/target/linux/ramips/dts/DIR-645.dts
@@ -72,7 +72,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <25000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DIR-810L.dts b/target/linux/ramips/dts/DIR-810L.dts
index 4ccea0d..9621183 100644
--- a/target/linux/ramips/dts/DIR-810L.dts
+++ b/target/linux/ramips/dts/DIR-810L.dts
@@ -55,7 +55,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/DUZUN-DM06.dts b/target/linux/ramips/dts/DUZUN-DM06.dts
index 5715791..d40df4f 100644
--- a/target/linux/ramips/dts/DUZUN-DM06.dts
+++ b/target/linux/ramips/dts/DUZUN-DM06.dts
@@ -126,7 +126,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <60000000>;
 		m25p,chunked-io = <32>;
 		m25p,fast-read;
diff --git a/target/linux/ramips/dts/E1700.dts b/target/linux/ramips/dts/E1700.dts
index 050303a..cb3d2ec 100644
--- a/target/linux/ramips/dts/E1700.dts
+++ b/target/linux/ramips/dts/E1700.dts
@@ -60,7 +60,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/F7C027.dts b/target/linux/ramips/dts/F7C027.dts
index d6a150a..10d26a4 100644
--- a/target/linux/ramips/dts/F7C027.dts
+++ b/target/linux/ramips/dts/F7C027.dts
@@ -66,7 +66,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l12805d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/GL-MT300A.dts b/target/linux/ramips/dts/GL-MT300A.dts
index 32e1fe0..a700558 100644
--- a/target/linux/ramips/dts/GL-MT300A.dts
+++ b/target/linux/ramips/dts/GL-MT300A.dts
@@ -84,9 +84,8 @@
 	m25p80 at 0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		compatible = "w25q128";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/GL-MT300N.dts b/target/linux/ramips/dts/GL-MT300N.dts
index 7334bc7..be78a72 100644
--- a/target/linux/ramips/dts/GL-MT300N.dts
+++ b/target/linux/ramips/dts/GL-MT300N.dts
@@ -79,9 +79,8 @@
 	m25p80 at 0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		compatible = "w25q128";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/GL-MT750.dts b/target/linux/ramips/dts/GL-MT750.dts
index 4667984..8bf96c7 100644
--- a/target/linux/ramips/dts/GL-MT750.dts
+++ b/target/linux/ramips/dts/GL-MT750.dts
@@ -79,9 +79,8 @@
 	m25p80 at 0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		compatible = "w25q128";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/HC5XXX.dtsi b/target/linux/ramips/dts/HC5XXX.dtsi
index 54bf409..3bea77e 100644
--- a/target/linux/ramips/dts/HC5XXX.dtsi
+++ b/target/linux/ramips/dts/HC5XXX.dtsi
@@ -58,7 +58,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/HLKRM04.dts b/target/linux/ramips/dts/HLKRM04.dts
index cbd8609..79a599d 100644
--- a/target/linux/ramips/dts/HLKRM04.dts
+++ b/target/linux/ramips/dts/HLKRM04.dts
@@ -66,7 +66,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/HT-TM02.dts b/target/linux/ramips/dts/HT-TM02.dts
index 8dc2dbc..0bfe48f 100644
--- a/target/linux/ramips/dts/HT-TM02.dts
+++ b/target/linux/ramips/dts/HT-TM02.dts
@@ -55,7 +55,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/JHR-N805R.dts b/target/linux/ramips/dts/JHR-N805R.dts
index 20cdb84..4493b3c 100644
--- a/target/linux/ramips/dts/JHR-N805R.dts
+++ b/target/linux/ramips/dts/JHR-N805R.dts
@@ -48,7 +48,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/LINKIT7688.dts b/target/linux/ramips/dts/LINKIT7688.dts
index 210d4d0..f1809d1 100644
--- a/target/linux/ramips/dts/LINKIT7688.dts
+++ b/target/linux/ramips/dts/LINKIT7688.dts
@@ -118,7 +118,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l25635e";
 		spi-max-frequency = <40000000>;
 		m25p,chunked-io = <31>;
 
diff --git a/target/linux/ramips/dts/M2M.dts b/target/linux/ramips/dts/M2M.dts
index 99e7b6a..74d66d5 100644
--- a/target/linux/ramips/dts/M2M.dts
+++ b/target/linux/ramips/dts/M2M.dts
@@ -54,7 +54,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/M3.dts b/target/linux/ramips/dts/M3.dts
index f4169c7..19ccf3d 100644
--- a/target/linux/ramips/dts/M3.dts
+++ b/target/linux/ramips/dts/M3.dts
@@ -46,7 +46,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q32";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/M4-4M.dts b/target/linux/ramips/dts/M4-4M.dts
index c6ed683..3e147e5 100644
--- a/target/linux/ramips/dts/M4-4M.dts
+++ b/target/linux/ramips/dts/M4-4M.dts
@@ -39,7 +39,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "pm25lq032";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/M4-8M.dts b/target/linux/ramips/dts/M4-8M.dts
index 75c7e53..65a3972 100644
--- a/target/linux/ramips/dts/M4-8M.dts
+++ b/target/linux/ramips/dts/M4-8M.dts
@@ -39,7 +39,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "gd25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MAC1200RV2.dts b/target/linux/ramips/dts/MAC1200RV2.dts
index f52be3c..45c26e1 100644
--- a/target/linux/ramips/dts/MAC1200RV2.dts
+++ b/target/linux/ramips/dts/MAC1200RV2.dts
@@ -30,9 +30,8 @@
 	m25p80 at 0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		compatible = "w25q128";
+		compatible = "jedec,spi-nor";
 		reg = <0 0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 		m25p,chunked-io = <32>;
 
diff --git a/target/linux/ramips/dts/MINIEMBPLUG.dts b/target/linux/ramips/dts/MINIEMBPLUG.dts
index 5f1cfe9..45616ef 100644
--- a/target/linux/ramips/dts/MINIEMBPLUG.dts
+++ b/target/linux/ramips/dts/MINIEMBPLUG.dts
@@ -75,7 +75,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MIWIFI-MINI.dts b/target/linux/ramips/dts/MIWIFI-MINI.dts
index 6d8b28c..101ae8d 100644
--- a/target/linux/ramips/dts/MIWIFI-MINI.dts
+++ b/target/linux/ramips/dts/MIWIFI-MINI.dts
@@ -65,7 +65,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MIWIFI-NANO.dts b/target/linux/ramips/dts/MIWIFI-NANO.dts
index dfe9ef5..d262d8c 100644
--- a/target/linux/ramips/dts/MIWIFI-NANO.dts
+++ b/target/linux/ramips/dts/MIWIFI-NANO.dts
@@ -75,7 +75,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 		m25p,chunked-io = <32>;
 
diff --git a/target/linux/ramips/dts/MLW221.dts b/target/linux/ramips/dts/MLW221.dts
index 05d7dff..f02602f 100644
--- a/target/linux/ramips/dts/MLW221.dts
+++ b/target/linux/ramips/dts/MLW221.dts
@@ -62,7 +62,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl129p1";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MLWG2.dts b/target/linux/ramips/dts/MLWG2.dts
index 9c71c91..fc28193 100644
--- a/target/linux/ramips/dts/MLWG2.dts
+++ b/target/linux/ramips/dts/MLWG2.dts
@@ -62,7 +62,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MPRA1.dts b/target/linux/ramips/dts/MPRA1.dts
index e97e60c..9762658 100644
--- a/target/linux/ramips/dts/MPRA1.dts
+++ b/target/linux/ramips/dts/MPRA1.dts
@@ -61,7 +61,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MPRA2.dts b/target/linux/ramips/dts/MPRA2.dts
index 72ee876..30ab50f 100644
--- a/target/linux/ramips/dts/MPRA2.dts
+++ b/target/linux/ramips/dts/MPRA2.dts
@@ -61,7 +61,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MT7620a.dts b/target/linux/ramips/dts/MT7620a.dts
index 8f1b6d9..3ed22d5 100644
--- a/target/linux/ramips/dts/MT7620a.dts
+++ b/target/linux/ramips/dts/MT7620a.dts
@@ -36,7 +36,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MT7620a_MT7530.dts b/target/linux/ramips/dts/MT7620a_MT7530.dts
index 5885ed0..70f9253 100644
--- a/target/linux/ramips/dts/MT7620a_MT7530.dts
+++ b/target/linux/ramips/dts/MT7620a_MT7530.dts
@@ -15,7 +15,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MT7620a_MT7610e.dts b/target/linux/ramips/dts/MT7620a_MT7610e.dts
index da241a4..1670b9c 100644
--- a/target/linux/ramips/dts/MT7620a_MT7610e.dts
+++ b/target/linux/ramips/dts/MT7620a_MT7610e.dts
@@ -40,7 +40,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <1000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MT7628.dts b/target/linux/ramips/dts/MT7628.dts
index a4b066c..dc86c70 100644
--- a/target/linux/ramips/dts/MT7628.dts
+++ b/target/linux/ramips/dts/MT7628.dts
@@ -33,7 +33,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 		m25p,chunked-io = <32>;
 
diff --git a/target/linux/ramips/dts/MZK-750DHP.dts b/target/linux/ramips/dts/MZK-750DHP.dts
index 589b19e..4107c6f 100644
--- a/target/linux/ramips/dts/MZK-750DHP.dts
+++ b/target/linux/ramips/dts/MZK-750DHP.dts
@@ -63,7 +63,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MZK-DP150N.dts b/target/linux/ramips/dts/MZK-DP150N.dts
index 7fa8ef4..2e559d6 100644
--- a/target/linux/ramips/dts/MZK-DP150N.dts
+++ b/target/linux/ramips/dts/MZK-DP150N.dts
@@ -43,7 +43,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MZK-EX300NP.dts b/target/linux/ramips/dts/MZK-EX300NP.dts
index 569d0a9..854d8a1 100644
--- a/target/linux/ramips/dts/MZK-EX300NP.dts
+++ b/target/linux/ramips/dts/MZK-EX300NP.dts
@@ -78,7 +78,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MZK-EX750NP.dts b/target/linux/ramips/dts/MZK-EX750NP.dts
index ec2ca5f..3aa2a57 100644
--- a/target/linux/ramips/dts/MZK-EX750NP.dts
+++ b/target/linux/ramips/dts/MZK-EX750NP.dts
@@ -83,7 +83,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/MicroWRT.dts b/target/linux/ramips/dts/MicroWRT.dts
index c8558c6..6f8179c 100644
--- a/target/linux/ramips/dts/MicroWRT.dts
+++ b/target/linux/ramips/dts/MicroWRT.dts
@@ -48,7 +48,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/NBG-419N2.dts b/target/linux/ramips/dts/NBG-419N2.dts
index 8bb0cc5..18e7902 100644
--- a/target/linux/ramips/dts/NBG-419N2.dts
+++ b/target/linux/ramips/dts/NBG-419N2.dts
@@ -14,9 +14,8 @@
 			m25p80 at 0 {
 				#address-cells = <1>;
 				#size-cells = <1>;
-				compatible = "mx25l6405d";
+				compatible = "jedec,spi-nor";
 				reg = <0 0>;
-				linux,modalias = "m25p80", "mx25l6405d";
 				spi-max-frequency = <10000000>;
 
 				partition at 0 {
diff --git a/target/linux/ramips/dts/NCS601W.dts b/target/linux/ramips/dts/NCS601W.dts
index 1942b0f..3c5097f 100644
--- a/target/linux/ramips/dts/NCS601W.dts
+++ b/target/linux/ramips/dts/NCS601W.dts
@@ -15,7 +15,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/NIXCORE-16M.dts b/target/linux/ramips/dts/NIXCORE-16M.dts
index b97c425..5d4cdae 100644
--- a/target/linux/ramips/dts/NIXCORE-16M.dts
+++ b/target/linux/ramips/dts/NIXCORE-16M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/NIXCORE-8M.dts b/target/linux/ramips/dts/NIXCORE-8M.dts
index 55457d9..af78808 100644
--- a/target/linux/ramips/dts/NIXCORE-8M.dts
+++ b/target/linux/ramips/dts/NIXCORE-8M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/NW718.dts b/target/linux/ramips/dts/NW718.dts
index 372bff6..6092255 100644
--- a/target/linux/ramips/dts/NW718.dts
+++ b/target/linux/ramips/dts/NW718.dts
@@ -55,7 +55,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <25000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/OY-0001.dts b/target/linux/ramips/dts/OY-0001.dts
index 932d379..ff6fe1e 100644
--- a/target/linux/ramips/dts/OY-0001.dts
+++ b/target/linux/ramips/dts/OY-0001.dts
@@ -56,7 +56,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/PBR-D1.dts b/target/linux/ramips/dts/PBR-D1.dts
index 3d4e987..739940e 100644
--- a/target/linux/ramips/dts/PBR-D1.dts
+++ b/target/linux/ramips/dts/PBR-D1.dts
@@ -99,7 +99,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <40000000>;
 		m25p,chunked-io = <31>;
 
diff --git a/target/linux/ramips/dts/PSG1208.dts b/target/linux/ramips/dts/PSG1208.dts
index e9b6639..ea96209 100644
--- a/target/linux/ramips/dts/PSG1208.dts
+++ b/target/linux/ramips/dts/PSG1208.dts
@@ -52,7 +52,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/PSG1218.dts b/target/linux/ramips/dts/PSG1218.dts
index b777c9b..5e90d1b 100644
--- a/target/linux/ramips/dts/PSG1218.dts
+++ b/target/linux/ramips/dts/PSG1218.dts
@@ -53,7 +53,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/PX-4885-4M.dts b/target/linux/ramips/dts/PX-4885-4M.dts
index 398a4a9..bd3b271 100644
--- a/target/linux/ramips/dts/PX-4885-4M.dts
+++ b/target/linux/ramips/dts/PX-4885-4M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/PX-4885-8M.dts b/target/linux/ramips/dts/PX-4885-8M.dts
index d6e694e..6055409 100644
--- a/target/linux/ramips/dts/PX-4885-8M.dts
+++ b/target/linux/ramips/dts/PX-4885-8M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/RP-N53.dts b/target/linux/ramips/dts/RP-N53.dts
index fe18b6f..466a072 100644
--- a/target/linux/ramips/dts/RP-N53.dts
+++ b/target/linux/ramips/dts/RP-N53.dts
@@ -106,7 +106,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/RT-G32-B1.dts b/target/linux/ramips/dts/RT-G32-B1.dts
index d392bb3..38d6992 100644
--- a/target/linux/ramips/dts/RT-G32-B1.dts
+++ b/target/linux/ramips/dts/RT-G32-B1.dts
@@ -36,7 +36,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/RT-N14U.dts b/target/linux/ramips/dts/RT-N14U.dts
index 22dd7b8..8bb2701 100644
--- a/target/linux/ramips/dts/RT-N14U.dts
+++ b/target/linux/ramips/dts/RT-N14U.dts
@@ -73,7 +73,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts b/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts
index bda918b..dbd2cf6 100644
--- a/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts
+++ b/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts
@@ -37,7 +37,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO.dts b/target/linux/ramips/dts/RT5350F-OLINUXINO.dts
index 0d28e10..a4f1aa7 100644
--- a/target/linux/ramips/dts/RT5350F-OLINUXINO.dts
+++ b/target/linux/ramips/dts/RT5350F-OLINUXINO.dts
@@ -15,7 +15,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/RUT5XX.dts b/target/linux/ramips/dts/RUT5XX.dts
index 76cf49b..7a09d43 100644
--- a/target/linux/ramips/dts/RUT5XX.dts
+++ b/target/linux/ramips/dts/RUT5XX.dts
@@ -39,7 +39,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "n25q128a13";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/TEW-714TRU.dts b/target/linux/ramips/dts/TEW-714TRU.dts
index 79b30d1..27727cb 100644
--- a/target/linux/ramips/dts/TEW-714TRU.dts
+++ b/target/linux/ramips/dts/TEW-714TRU.dts
@@ -65,7 +65,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/TINY-AC.dts b/target/linux/ramips/dts/TINY-AC.dts
index 356c44d..460227d 100644
--- a/target/linux/ramips/dts/TINY-AC.dts
+++ b/target/linux/ramips/dts/TINY-AC.dts
@@ -73,7 +73,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/VOCORE-16M.dts b/target/linux/ramips/dts/VOCORE-16M.dts
index dd10784..d2792c4 100644
--- a/target/linux/ramips/dts/VOCORE-16M.dts
+++ b/target/linux/ramips/dts/VOCORE-16M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/VOCORE-8M.dts b/target/linux/ramips/dts/VOCORE-8M.dts
index e364724..ea14a42 100644
--- a/target/linux/ramips/dts/VOCORE-8M.dts
+++ b/target/linux/ramips/dts/VOCORE-8M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WHR-1166D.dts b/target/linux/ramips/dts/WHR-1166D.dts
index c3b85da..643729c 100644
--- a/target/linux/ramips/dts/WHR-1166D.dts
+++ b/target/linux/ramips/dts/WHR-1166D.dts
@@ -93,7 +93,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WHR-300HP2.dts b/target/linux/ramips/dts/WHR-300HP2.dts
index 3958217..4438754 100644
--- a/target/linux/ramips/dts/WHR-300HP2.dts
+++ b/target/linux/ramips/dts/WHR-300HP2.dts
@@ -93,7 +93,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WHR-600D.dts b/target/linux/ramips/dts/WHR-600D.dts
index ec91989..1100261 100644
--- a/target/linux/ramips/dts/WHR-600D.dts
+++ b/target/linux/ramips/dts/WHR-600D.dts
@@ -93,7 +93,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l6405d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WIDORA-NEO.dts b/target/linux/ramips/dts/WIDORA-NEO.dts
index f6b8f1d..0be11e9 100644
--- a/target/linux/ramips/dts/WIDORA-NEO.dts
+++ b/target/linux/ramips/dts/WIDORA-NEO.dts
@@ -105,7 +105,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <40000000>;
 		m25p,chunked-io = <31>;
 
diff --git a/target/linux/ramips/dts/WIZARD8800.dts b/target/linux/ramips/dts/WIZARD8800.dts
index bbfa610..623e351 100644
--- a/target/linux/ramips/dts/WIZARD8800.dts
+++ b/target/linux/ramips/dts/WIZARD8800.dts
@@ -23,7 +23,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q32";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WIZFI630A.dts b/target/linux/ramips/dts/WIZFI630A.dts
index 78891c2..9f19564 100644
--- a/target/linux/ramips/dts/WIZFI630A.dts
+++ b/target/linux/ramips/dts/WIZFI630A.dts
@@ -85,7 +85,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WL-330N.dts b/target/linux/ramips/dts/WL-330N.dts
index 1cf1712..3095e24 100644
--- a/target/linux/ramips/dts/WL-330N.dts
+++ b/target/linux/ramips/dts/WL-330N.dts
@@ -50,7 +50,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WL-330N3G.dts b/target/linux/ramips/dts/WL-330N3G.dts
index fe703ba..948d37d 100644
--- a/target/linux/ramips/dts/WL-330N3G.dts
+++ b/target/linux/ramips/dts/WL-330N3G.dts
@@ -55,7 +55,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WL-WN575A3.dts b/target/linux/ramips/dts/WL-WN575A3.dts
index 2674824..63eff77 100644
--- a/target/linux/ramips/dts/WL-WN575A3.dts
+++ b/target/linux/ramips/dts/WL-WN575A3.dts
@@ -90,7 +90,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 		m25p,chunked-io = <32>;
 
diff --git a/target/linux/ramips/dts/WMR-300.dts b/target/linux/ramips/dts/WMR-300.dts
index faa867b..a56f716 100644
--- a/target/linux/ramips/dts/WMR-300.dts
+++ b/target/linux/ramips/dts/WMR-300.dts
@@ -59,7 +59,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WNCE2001.dts b/target/linux/ramips/dts/WNCE2001.dts
index 92d03de..fd52966 100644
--- a/target/linux/ramips/dts/WNCE2001.dts
+++ b/target/linux/ramips/dts/WNCE2001.dts
@@ -76,7 +76,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WRH-300CR.dts b/target/linux/ramips/dts/WRH-300CR.dts
index f7ef933..c336ba3 100644
--- a/target/linux/ramips/dts/WRH-300CR.dts
+++ b/target/linux/ramips/dts/WRH-300CR.dts
@@ -67,7 +67,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l12805d";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WRTNODE.dts b/target/linux/ramips/dts/WRTNODE.dts
index 04f5836..df10eef 100644
--- a/target/linux/ramips/dts/WRTNODE.dts
+++ b/target/linux/ramips/dts/WRTNODE.dts
@@ -36,7 +36,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WT1520-4M.dts b/target/linux/ramips/dts/WT1520-4M.dts
index 26e01f1..7db8242 100644
--- a/target/linux/ramips/dts/WT1520-4M.dts
+++ b/target/linux/ramips/dts/WT1520-4M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WT1520-8M.dts b/target/linux/ramips/dts/WT1520-8M.dts
index 86c9297..101f3d7 100644
--- a/target/linux/ramips/dts/WT1520-8M.dts
+++ b/target/linux/ramips/dts/WT1520-8M.dts
@@ -14,7 +14,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WT3020-4M.dts b/target/linux/ramips/dts/WT3020-4M.dts
index 6e40d5a..c2d83f9 100644
--- a/target/linux/ramips/dts/WT3020-4M.dts
+++ b/target/linux/ramips/dts/WT3020-4M.dts
@@ -47,7 +47,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q32";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/WT3020-8M.dts b/target/linux/ramips/dts/WT3020-8M.dts
index 4ef48cb..987eed4 100644
--- a/target/linux/ramips/dts/WT3020-8M.dts
+++ b/target/linux/ramips/dts/WT3020-8M.dts
@@ -47,7 +47,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/X5.dts b/target/linux/ramips/dts/X5.dts
index efb9d77..9cae72c 100644
--- a/target/linux/ramips/dts/X5.dts
+++ b/target/linux/ramips/dts/X5.dts
@@ -78,7 +78,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "gd25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/X8.dts b/target/linux/ramips/dts/X8.dts
index db8eec5..de5170e 100644
--- a/target/linux/ramips/dts/X8.dts
+++ b/target/linux/ramips/dts/X8.dts
@@ -39,7 +39,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "gd25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/Y1.dtsi b/target/linux/ramips/dts/Y1.dtsi
index 1d5f1ef..8e6133a 100644
--- a/target/linux/ramips/dts/Y1.dtsi
+++ b/target/linux/ramips/dts/Y1.dtsi
@@ -41,7 +41,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q128";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts b/target/linux/ramips/dts/YOUKU-YK1.dts
index 1746f6c..260f86a 100644
--- a/target/linux/ramips/dts/YOUKU-YK1.dts
+++ b/target/linux/ramips/dts/YOUKU-YK1.dts
@@ -65,7 +65,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q256";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ZBT-APE522II.dts b/target/linux/ramips/dts/ZBT-APE522II.dts
index f570129..5eca65f 100644
--- a/target/linux/ramips/dts/ZBT-APE522II.dts
+++ b/target/linux/ramips/dts/ZBT-APE522II.dts
@@ -79,7 +79,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "w25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ZBT-CPE102.dts b/target/linux/ramips/dts/ZBT-CPE102.dts
index abfe0c0..0890840 100644
--- a/target/linux/ramips/dts/ZBT-CPE102.dts
+++ b/target/linux/ramips/dts/ZBT-CPE102.dts
@@ -65,7 +65,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ZBT-WA05.dts b/target/linux/ramips/dts/ZBT-WA05.dts
index 43f08f5..3353889 100644
--- a/target/linux/ramips/dts/ZBT-WA05.dts
+++ b/target/linux/ramips/dts/ZBT-WA05.dts
@@ -65,7 +65,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ZBT-WE826.dts b/target/linux/ramips/dts/ZBT-WE826.dts
index 1eb0318..de7fa42 100644
--- a/target/linux/ramips/dts/ZBT-WE826.dts
+++ b/target/linux/ramips/dts/ZBT-WE826.dts
@@ -59,9 +59,8 @@
 	en25q128 at 0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		compatible = "w25q128";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ZBT-WR8305RT.dts b/target/linux/ramips/dts/ZBT-WR8305RT.dts
index edc820f..81598bd 100644
--- a/target/linux/ramips/dts/ZBT-WR8305RT.dts
+++ b/target/linux/ramips/dts/ZBT-WR8305RT.dts
@@ -57,7 +57,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {
diff --git a/target/linux/ramips/dts/ZTE-Q7.dts b/target/linux/ramips/dts/ZTE-Q7.dts
index 44bed87..9ec1d89 100644
--- a/target/linux/ramips/dts/ZTE-Q7.dts
+++ b/target/linux/ramips/dts/ZTE-Q7.dts
@@ -52,7 +52,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition at 0 {


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:11 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:11 -0400
Subject: [source]  ramips: add support for Sanlinking D240
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26633.1493392438.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/49ce6d04b0fa56facd37924003df02b4ebf14aab

commit 49ce6d04b0fa56facd37924003df02b4ebf14aab
Author: Kristian Evensen <kristian.evensen at gmail.com>
AuthorDate: Sat Feb 4 21:28:52 2017 +0100

    ramips: add support for Sanlinking D240
    
    The Sanlinking Technologies D240
    (http://www.sanlinking.com/en/29-dual-4g-wifi-router.html) is basically the same
    device as the ZBT WE826, so adding support for it in LEDE is straight forward.
    The differences is that the D240 has two mini-PCIe slots (instead of one), blue
    LEDs and supports PoE.
    
    Specification:
    * CPU: MT7620A
    * 1x 10/100Mbps POE (802.3af/802.3at) Ethernet, 4x 10/100Mbps.
    * 16 MB Flash.
    * 128 MB RAM.
    * 1x USB 2.0 port.
    * 2x mini-PCIe slots.
    * 2x SIM slots.
    * 1x 2.4Ghz WIFI.
    * 1x button.
    
    Wifi, USB, switch and both mini-PCIe slots are working. I have not been able to
    test the SD card reader.
    
    The device comes pre-installed with an older version of OpenWRT, including Luci.
    In order to install LEDE, you need to follow the existing procedure for updating
    OpenWRT/LEDE using Luci. I.e., you need to access the UI and update the firmware
    using the sysupgrade-image. Remember to select that you do not want to keep
    existing settings. The default router address is 192.168.10.1 and
    username/password admin/root (at least on my devices).
    
    If you brick the device, the procedure for recovery is the same as for the
    WE826. Please see the wiki page for that device for instructions.
    
    Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   4 +
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh         |   1 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ramips/dts/D240.dts                   | 157 +++++++++++++++++++++
 target/linux/ramips/image/mt7620.mk                |   8 ++
 7 files changed, 175 insertions(+)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 545d6a4..4e6eeb2 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -109,6 +109,10 @@ d105)
 	ucidef_set_led_default "power" "POWER" "$board:red:power" "1"
 	set_usb_led "$board:green:usb"
 	;;
+d240)
+	set_wifi_led "$board:blue:wifi"
+	set_usb_led "$board:blue:usb"
+	;;
 db-wrt01)
 	ucidef_set_led_default "power" "power" "$board:orange:power" "1"
 	;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index cc092b1..af5a951 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -73,6 +73,7 @@ ramips_setup_interfaces()
 	3g-6200n|\
 	ac1200pro|\
 	ai-br100|\
+	d240|\
 	db-wrt01|\
 	dir-300-b7|\
 	dir-320-b1|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 9499833..4ed18d7 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -108,6 +108,7 @@ get_status_led() {
 	w502u)
 		status_led="$board:blue:wps"
 		;;
+	d240|\
 	dap-1350|\
 	na930|\
 	pbr-m1|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 8292da1..e642d56 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -112,6 +112,9 @@ ramips_board_detect() {
 	*"D105")
 		name="d105"
 		;;
+	*"D240")
+		name="d240"
+		;;
 	*"DAP-1350")
 		name="dap-1350"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index c6ad8ca..7f5b1dd 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -35,6 +35,7 @@ platform_check_image() {
 	cf-wr800n|\
 	cs-qr10|\
 	d105|\
+	d240|\
 	dap-1350|\
 	db-wrt01|\
 	dcs-930|\
diff --git a/target/linux/ramips/dts/D240.dts b/target/linux/ramips/dts/D240.dts
new file mode 100644
index 0000000..3da96f2
--- /dev/null
+++ b/target/linux/ramips/dts/D240.dts
@@ -0,0 +1,157 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Kristian Evensen <kristian.evensen at gmail.com>.
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom Corporation nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "d240", "ralink,mt7620a-soc";
+	model = "Sanlinking Technologies D240";
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power {
+			label = "d240:blue:power";
+			gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+		};
+
+		usb {
+			label = "d240:blue:usb";
+			gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+		};
+
+		air {
+			label = "d240:blue:wifi";
+			gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&gpio1 {
+	status = "okay";
+};
+
+&gpio3 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	en25q128 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		factory: partition at 40000 {
+			label = "factory";
+			reg = <0x40000 0x10000>;
+			read-only;
+		};
+
+		partition at 50000 {
+			label = "firmware";
+			reg = <0x50000 0xfb0000>;
+		};
+	};
+};
+
+&sdhci {
+	status = "okay";
+};
+
+&ehci {
+	status = "okay";
+};
+
+&ohci {
+	status = "okay";
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0x4>;
+	ralink,port-map = "wllll";
+};
+
+&wmac {
+	ralink,mtd-eeprom = <&factory 0>;
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		default {
+			ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa";
+			ralink,function = "gpio";
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index f4f072f..42745c4 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -473,3 +473,11 @@ define Device/kng_rc
 	zyimage -d 8997 -v "ZyXEL Keenetic Viva"
 endef
 TARGET_DEVICES += kng_rc
+
+define Device/d240
+  DTS := D240
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := Sanlinking Technologies D240
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += d240


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:13 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:13 -0400
Subject: [source]  brcm63xx: Add Observa VH4032N support
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26634.1493392459.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/bf534e45ea696cc2d4afe12502a8ad78b54cfc29

commit bf534e45ea696cc2d4afe12502a8ad78b54cfc29
Author: Daniel Gonzalez Cabanelas <dgcbueu at gmail.com>
AuthorDate: Sat Dec 3 15:51:05 2016 +0100

    brcm63xx: Add Observa VH4032N support
    
    Add support for the Observa Telecom VH4032N router.
    
    This is another BCM6368 router, 128 MB RAM, 32MB flash and 3 USB
    host ports.
    
    The wifi chip is an onboard Broadcom BCM43222.
    
    Signed-off-by: Daniel Gonzalez Cabanelas <dgcbueu at gmail.com>
    [jonas.gorski: use gpio-hog instead of abusing ephy-reset]
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 .../brcm63xx/base-files/etc/board.d/02_network     |   5 +
 target/linux/brcm63xx/base-files/etc/diag.sh       |   3 +
 .../base-files/etc/uci-defaults/09_fix_crc         |   1 +
 target/linux/brcm63xx/base-files/lib/brcm63xx.sh   |   3 +
 target/linux/brcm63xx/dts/vh4032n.dts              | 102 +++++++++++++++++++++
 target/linux/brcm63xx/image/bcm63xx.mk             |  15 +++
 .../brcm63xx/patches-4.4/577-board_VH4032N.patch   |  64 +++++++++++++
 7 files changed, 193 insertions(+)

diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network b/target/linux/brcm63xx/base-files/etc/board.d/02_network
index c20caf9..c83aa62 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network
@@ -98,6 +98,11 @@ vr-3026e)
 		"0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "8t at eth0"
 	;;
 
+vh4032n)
+	ucidef_add_switch "switch0" \
+		"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "8t at eth0"
+	;;
+
 bcm96368mvwg)
 	ucidef_add_switch "switch0" \
 		"1:lan" "2:lan" "4:lan" "5:lan" "8t at eth0"
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index 852a701..3a858e4 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -33,6 +33,9 @@ set_state() {
 	spw303v)
 		status_led="spw303v:green:power+adsl"
 		;;
+	vh4032n)
+		status_led="VH4032N:red:power"
+		;;
 	vr-3025un)
 		status_led="VR-3025un:green:power"
 		;;
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index 1201168..650db9d 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -31,6 +31,7 @@ case "$(brcm63xx_board_name)" in
 	spw303v |\
 	v2110 |\
 	v2500v_bb |\
+	vh4032n |\
 	vr-3025u |\
 	vr-3025un |\
 	vr-3026e |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 9cc0b2b..3dce282 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -189,6 +189,9 @@ brcm63xx_dt_detect() {
 	"NuCom R5010UN v2")
 		board_name="r5010un_v2"
 		;;
+	"Observa VH4032N")
+		board_name="vh4032n"
+		;;
 	"Pirelli A226G")
 		board_name="a226g"
 		;;
diff --git a/target/linux/brcm63xx/dts/vh4032n.dts b/target/linux/brcm63xx/dts/vh4032n.dts
new file mode 100644
index 0000000..8b8abd9
--- /dev/null
+++ b/target/linux/brcm63xx/dts/vh4032n.dts
@@ -0,0 +1,102 @@
+/dts-v1/;
+
+#include "bcm6368.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Observa VH4032N";
+	compatible = "observa,vh4032n", "brcm,bcm6368";
+
+	chosen {
+		bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+		debounce-interval = <60>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio1 2 1>;
+			linux,code = <KEY_RESTART>;
+		};
+		wps {
+			label = "wps";
+			gpios = <&gpio1 3 1>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		dsl_blue {
+			label = "VH4032N:blue:dsl";
+			gpios = <&gpio0 2 1>;
+		};
+		dsl_red {
+			label = "VH4032N:red:dsl";
+			gpios = <&gpio0 5 1>;
+		};
+		hspa_blue {
+			label = "VH4032N:blue:hspa";
+			gpios = <&gpio0 11 1>;
+		};
+		hspa_red {
+			label = "VH4032N:red:hspa";
+			gpios = <&gpio0 12 1>;
+		};
+		power_blue {
+			label = "VH4032N:blue:power";
+			gpios = <&gpio0 22 0>;
+		};
+		power_red {
+			label = "VH4032N:red:power";
+			gpios = <&gpio0 24 0>;
+			default-state = "on";
+		};
+		voice_blue {
+			label = "VH4032N:blue:voice";
+			gpios = <&gpio0 25 1>;
+		};
+		voice_red {
+			label = "VH4032N:red:voice";
+			gpios = <&gpio0 26 1>;
+		};
+	};
+};
+
+&gpio0 {
+	usb_hub_reset {
+		gpio-hog;
+		gpios = <27 0>;
+		output-high;
+		line-name = "usb-hub-reset-gpio";
+	};
+};
+
+&pflash {
+	status = "ok";
+
+	linux,part-probe = "bcm63xxpart";
+
+	cfe at 0 {
+		label = "CFE";
+		reg = <0x0000000 0x0020000>;
+		read-only;
+	};
+
+	linux at 20000 {
+		label = "linux";
+		reg = <0x0020000 0x1fc0000>;
+	};
+
+	nvram at 1fe0000 {
+		label = "nvram";
+		reg = <0x1fe0000 0x020000>;
+	};
+};
diff --git a/target/linux/brcm63xx/image/bcm63xx.mk b/target/linux/brcm63xx/image/bcm63xx.mk
index ce03f7b..da3dbba 100644
--- a/target/linux/brcm63xx/image/bcm63xx.mk
+++ b/target/linux/brcm63xx/image/bcm63xx.mk
@@ -806,6 +806,21 @@ define Device/R5010UNv2
 endef
 TARGET_DEVICES += R5010UNv2
 
+### Observa ###
+define Device/VH4032N
+  $(Device/bcm63xx)
+  IMAGES += sysupgrade.bin
+  DEVICE_TITLE := Observa VH4032N
+  DEVICE_DTS := vh4032n
+  CFE_BOARD_ID := 96368VVW
+  CFE_CHIP_ID := 6368
+  BLOCK_SIZE := 0x20000
+  FLASH_MB := 32
+  DEVICE_PACKAGES := \
+    $(B43_PACKAGES) $(USB2_PACKAGES)
+endef
+TARGET_DEVICES += VH4032N
+
 ### Pirelli ###
 define Device/A226G
   $(Device/bcm63xx)
diff --git a/target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch b/target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch
new file mode 100644
index 0000000..2e5c13e
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch
@@ -0,0 +1,64 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -2356,6 +2356,45 @@ static struct board_info __initdata boar
+ 	},
+ };
+ 
++static struct board_info __initdata board_VH4032N = {
++	.name				= "VH4032N",
++	.expected_cpu_id		= 0x6368,
++
++	.has_uart0			= 1,
++	.has_pci			= 1,
++	.has_ohci0			= 1,
++	.has_ehci0			= 1,
++	.num_usbh_ports			= 2,
++
++	.has_enetsw			= 1,
++	.enetsw = {
++		.used_ports = {
++			[0] = {
++				.used   = 1,
++				.phy_id = 1,
++				.name   = "LAN4",
++			},
++			[1] = {
++				.used   = 1,
++				.phy_id = 2,
++				.name   = "LAN3",
++			},
++			[2] = {
++				.used   = 1,
++				.phy_id = 3,
++				.name   = "LAN2",
++			},
++			[3] = {
++				.used   = 1,
++				.phy_id = 4,
++				.name   = "LAN1",
++			},
++		},
++	},
++
++	.use_fallback_sprom		= 1,
++};
++
+ static struct b53_platform_data WAP5813n_b53_pdata = {
+ 	.alias = "eth0",
+ };
+@@ -2662,6 +2701,7 @@ static const struct board_info __initcon
+ 	&board_HG622,
+ 	&board_HG655b,
+ 	&board_P870HW51A_V2,
++	&board_VH4032N,
+ 	&board_VR3025u,
+ 	&board_VR3025un,
+ 	&board_VR3026e,
+@@ -2773,6 +2813,7 @@ static struct of_device_id const bcm963x
+ 	{ .compatible = "huawei,hg655b", .data = &board_HG655b, },
+ 	{ .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, },
+ 	{ .compatible = "netgear,evg2000", .data = &board_EVG2000, },
++	{ .compatible = "observa,vh4032n", .data = &board_VH4032N, },
+ 	{ .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, },
+ #endif
+ #ifdef CONFIG_BCM63XX_CPU_63268


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:10 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:10 -0400
Subject: [source] ar71xx: select ATH79_NVRAM only by boards actually use it
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26635.1493392483.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/58ec566331d05dc80e42347bd846a65077c2f735

commit 58ec566331d05dc80e42347bd846a65077c2f735
Author: Piotr Dymacz <pepe2k at gmail.com>
AuthorDate: Fri Jan 27 15:50:35 2017 +0100

    ar71xx: select ATH79_NVRAM only by boards actually use it
    
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
---
 target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 894367f..76ba6fa 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -252,6 +252,7 @@ config ATH79_MACH_ESR1750
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_SOM9331
 	bool "SOM9331 support"
@@ -458,7 +459,6 @@ config ATH79_MACH_DIR_505_A1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
-	select ATH79_NVRAM
 
 config ATH79_MACH_DIR_600_A1
 	bool "D-Link DIR-600 A1/DIR-615 E1/DIR-615 E4 support"
@@ -489,7 +489,6 @@ config ATH79_MACH_DIR_615_I1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
-	select ATH79_NVRAM
 
 config ATH79_MACH_DIR_825_B1
 	bool "D-Link DIR-825 rev. B1 board support"
@@ -521,6 +520,7 @@ config ATH79_MACH_DIR_869_A1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_DLAN_HOTSPOT
 	bool "devolo dLAN Hotspot support"
@@ -617,6 +617,7 @@ config ATH79_MACH_ESR900
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_EW_DORIN
 	bool "embedded wireless Dorin Platform support"
@@ -1603,7 +1604,6 @@ config ATH79_MACH_TEW_673GRU
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_USB
-	select ATH79_NVRAM
 
 config ATH79_MACH_TEW_712BR
 	bool "TRENDnet TEW-712BR support"
@@ -1613,7 +1613,6 @@ config ATH79_MACH_TEW_712BR
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
-	select ATH79_NVRAM
 
 config ATH79_MACH_TEW_732BR
 	bool "TRENDnet TEW-732BR support"
@@ -1744,6 +1743,7 @@ config ATH79_MACH_NBG6716
 	select ATH79_DEV_NFC
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_CARAMBOLA2
 	bool "8devices Carambola2 board"
@@ -1846,6 +1846,7 @@ config ATH79_MACH_DAP_2695_A1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_TL_WPA8630
 	bool "TP-Link TL-WPA8630 support"


From lede-commits at lists.infradead.org  Fri Apr 28 08:11:14 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 11:11:14 -0400
Subject: [source]  ramips: WN3000RPv3: do not setup switch
In-Reply-To: <20170428151055.14625.91697@git-01.infra.lede-project.org>
References: <20170428151055.14625.91697@git-01.infra.lede-project.org>
Message-ID: <mailman.26636.1493392504.26984.lede-commits@lists.infradead.org>

jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/8b9f7bd7bd911a8677b6fa8256ab521417f326bf

commit 8b9f7bd7bd911a8677b6fa8256ab521417f326bf
Author: Thibaut VARENE <hacks at slashdirt.org>
AuthorDate: Sun Feb 12 17:11:08 2017 +0100

    ramips: WN3000RPv3: do not setup switch
    
    The WN3000RPv3 is a repeater with a single ethernet port. Setting up the
    switch, even to disable it, is unnecessary and possibly confusing.
    
    Configure LAN as eth0 instead.
    
    Signed-off-by: Thibaut VARENE <hacks at slashdirt.org>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index af5a951..36cdc10 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -58,7 +58,6 @@ ramips_setup_interfaces()
 	timecloud|\
 	w150m|\
 	widora-neo|\
-	wn3000rpv3|\
 	wnce2001|\
 	zbt-cpe102|\
 	zte-q7)


From lede-commits at lists.infradead.org  Fri Apr 28 13:00:04 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Fri, 28 Apr 2017 16:00:04 -0400
Subject: [source]  odhcpd: update to git HEAD version (FS#656,FS#595)
In-Reply-To: <20170428200004.11114.70603@git-01.infra.lede-project.org>
References: <20170428200004.11114.70603@git-01.infra.lede-project.org>
Message-ID: <mailman.26662.1493409638.26984.lede-commits@lists.infradead.org>

dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/c45ef702ff3d4fd79b788823719cda356b9088c5

commit c45ef702ff3d4fd79b788823719cda356b9088c5
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Fri Apr 28 21:45:10 2017 +0200

    odhcpd: update to git HEAD version (FS#656,FS#595)
    
    9268ca6 ndp: don't trigger IPv6 ping when neighbor entry is invalid
    2b3355f ndp: fix adding proxy neighbor entries
    7dff5b4 ndp: fix wrong interface name in syslog message
    a54afb5 dhcpv6-ia: Fix segfault when writing DHCPv4 leases in state file
    c0e9dbf ubus: don't segfault when there're no leases
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/odhcpd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index 9c26583..21b50d9 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-04-21
-PKG_SOURCE_VERSION:=570069d3e16e7679676ceeb1e973c1342a2f2684
-PKG_MIRROR_HASH:=f61732ae768f1b2801222dd44c272ace0318c10b77dba7947c6a857d10e3f5a7
+PKG_SOURCE_DATE:=2017-04-28
+PKG_SOURCE_VERSION:=9268ca65d6e000b6cd4ed72d4a8fa427dada6f06
+PKG_MIRROR_HASH:=3c375291de38034f0965c92e509ca17788d3b31fe13abbc8f541b2e2452bc7fe
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh at gmail.com>
 PKG_LICENSE:=GPL-2.0


From lede-commits at lists.infradead.org  Sat Apr 29 00:49:44 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sat, 29 Apr 2017 03:49:44 -0400
Subject: [source]  mediatek: fix mt7530 mcm reset
In-Reply-To: <20170429074944.20206.65350@git-01.infra.lede-project.org>
References: <20170429074944.20206.65350@git-01.infra.lede-project.org>
Message-ID: <mailman.26683.1493452346.26984.lede-commits@lists.infradead.org>

blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/3ddc1914ba2aa6b9d93528e05c051ce44ef7f8a3

commit 3ddc1914ba2aa6b9d93528e05c051ce44ef7f8a3
Author: John Crispin <john at phrozen.org>
AuthorDate: Sat Apr 29 09:48:35 2017 +0200

    mediatek: fix mt7530 mcm reset
    
    Early SoC versions with an ECO of 1 required the gpio reset.
    Mass production SoCs no longer need this work around.
    
    Signed-off-by: John Crispin <john at phrozen.org>
---
 target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts | 5 ++++-
 target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts      | 5 ++++-
 target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts      | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts
index 035bdf5..1278b8b 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts
@@ -475,7 +475,10 @@
 
 		core-supply = <&mt6323_vpa_reg>;
 		io-supply = <&mt6323_vemc3v3_reg>;
-		reset-gpios = <&pio 33 0>;
+
+		mediatek,mcm;
+		resets = <&ethsys 2>;
+		reset-names = "mcm";
 
 		ports {
 			#address-cells = <1>;
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
index 072ebe7..6606176 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND.dts
@@ -489,7 +489,10 @@
 
 		core-supply = <&mt6323_vpa_reg>;
 		io-supply = <&mt6323_vemc3v3_reg>;
-		reset-gpios = <&pio 33 0>;
+
+		mediatek,mcm;
+		resets = <&ethsys 2>;
+		reset-names = "mcm";
 
 		ports {
 			#address-cells = <1>;
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
index 36b0065..fe1a42d 100644
--- a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
+++ b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-eMMC.dts
@@ -490,7 +490,10 @@
 
 		core-supply = <&mt6323_vpa_reg>;
 		io-supply = <&mt6323_vemc3v3_reg>;
-		reset-gpios = <&pio 33 0>;
+
+		mediatek,mcm;
+		resets = <&ethsys 2>;
+		reset-names = "mcm";
 
 		ports {
 			#address-cells = <1>;


From lede-commits at lists.infradead.org  Sun Apr 30 03:19:33 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 30 Apr 2017 06:19:33 -0400
Subject: [source]  uboot-omap: enable thumb for overo
In-Reply-To: <20170430101933.16176.20608@git-01.infra.lede-project.org>
References: <20170430101933.16176.20608@git-01.infra.lede-project.org>
Message-ID: <mailman.26727.1493547603.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/ca8988614c9b42889357e54f37391a0d9676a22b

commit ca8988614c9b42889357e54f37391a0d9676a22b
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Fri Apr 28 14:27:45 2017 +0200

    uboot-omap: enable thumb for overo
    
    Even it's unknown if it's booting with thumb, because the lack of hardware.
    Enable it for now, so the build succeed, because without thumb it can not fit
    into spl.
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 .../patches/104-omap3-overo-enable-thumb.patch         | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch b/package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch
new file mode 100644
index 0000000..ca928c9
--- /dev/null
+++ b/package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch
@@ -0,0 +1,18 @@
+Index: u-boot-2017.01/include/configs/omap3_overo.h
+===================================================================
+--- u-boot-2017.01.orig/include/configs/omap3_overo.h
++++ u-boot-2017.01/include/configs/omap3_overo.h
+@@ -11,6 +11,13 @@
+ #define CONFIG_NAND
+ 
+ #include <configs/ti_omap3_common.h>
++
++/* try to enable thumb - unknown if it's working
++ * but otherwise it's too big for spl */
++#ifndef CONFIG_SYS_THUMB_BUILD
++#define CONFIG_SYS_THUMB_BUILD
++#endif
++
+ /*
+  * We are only ever GP parts and will utilize all of the "downloaded image"
+  * area in SRAM which starts at 0x40200000 and ends at 0x4020FFFF (64KB).


From lede-commits at lists.infradead.org  Sun Apr 30 03:19:34 2017
From: lede-commits at lists.infradead.org (LEDE Commits)
Date: Sun, 30 Apr 2017 06:19:34 -0400
Subject: [source] uboot-omap: rename patch to 101-disable-thumb-omap3.patch
In-Reply-To: <20170430101933.16176.20608@git-01.infra.lede-project.org>
References: <20170430101933.16176.20608@git-01.infra.lede-project.org>
Message-ID: <mailman.26728.1493547609.26984.lede-commits@lists.infradead.org>

lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/21c2e93e67bc44c1b72dbbe2dc9f9451d44f81a0

commit 21c2e93e67bc44c1b72dbbe2dc9f9451d44f81a0
Author: Alexander Couzens <lynxis at fe80.eu>
AuthorDate: Fri Apr 28 14:34:46 2017 +0200

    uboot-omap: rename patch to 101-disable-thumb-omap3.patch
    
    It's disabling thumb for the whole omap3 family.
    
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 ...{101-disable-thumb-beagleboard.patch => 101-disable-thumb-omap3.patch} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/package/boot/uboot-omap/patches/101-disable-thumb-beagleboard.patch b/package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch
similarity index 100%
rename from package/boot/uboot-omap/patches/101-disable-thumb-beagleboard.patch
rename to package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch


