From 39ed2265dde1bc8817f9dc6ba053268bb6939ae6 Mon Sep 17 00:00:00 2001
From: Vivek Unune <npcomplete13@gmail.com>
Date: Fri, 13 Nov 2020 08:39:43 -0500
Subject: bcm53xx: backport Linksys Panamera (EA9500) patches
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These patches have been already accepted.

302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch had to
be updated.

[rmilecki: use actual upstream accepted patches
           replace v5.10 with v5.11 to match actual upstream kernel
           recover dropped part of the pinctrl compatible patch
           update filenames
           refresh patches]

Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 ...5301X-Linksys-EA9500-add-port-5-and-port-.patch | 47 ++++++++++++++
 ...5301X-Linksys-EA9500-add-fixed-partitions.patch | 71 ++++++++++++++++++++++
 ...5301X-Use-corretc-pinctrl-compatible-for-.patch | 49 +++++++++++++++
 ...M5301X-Linksys-EA9500-make-use-of-pinctrl.patch | 61 +++++++++++++++++++
 ...BCM5301X-Update-Northstar-pinctrl-binding.patch |  4 +-
 5 files changed, 230 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0001-ARM-dts-BCM5301X-Linksys-EA9500-add-port-5-and-port-.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0004-ARM-dts-BCM5301X-Linksys-EA9500-add-fixed-partitions.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0005-ARM-dts-BCM5301X-Use-corretc-pinctrl-compatible-for-.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0006-ARM-dts-BCM5301X-Linksys-EA9500-make-use-of-pinctrl.patch

(limited to 'target/linux/bcm53xx/patches-5.4')

diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0001-ARM-dts-BCM5301X-Linksys-EA9500-add-port-5-and-port-.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0001-ARM-dts-BCM5301X-Linksys-EA9500-add-port-5-and-port-.patch
new file mode 100644
index 0000000000..f0cfbf8e63
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0001-ARM-dts-BCM5301X-Linksys-EA9500-add-port-5-and-port-.patch
@@ -0,0 +1,47 @@
+From 1ca5f2430c4f9d85b98b8d6e5d93f8d4802faf8e Mon Sep 17 00:00:00 2001
+From: Vivek Unune <npcomplete13@gmail.com>
+Date: Wed, 14 Oct 2020 15:27:27 -0400
+Subject: [PATCH] ARM: dts: BCM5301X: Linksys EA9500 add port 5 and port 7
+
+Add ports 5 and 7 which are connected to gmac cores 1 & 2.
+These will be disabled for now.
+
+Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ .../boot/dts/bcm47094-linksys-panamera.dts    | 24 +++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
+@@ -242,6 +242,30 @@
+ 			label = "wan";
+ 		};
+ 
++		port@5 {
++			reg = <5>;
++			ethernet = <&gmac0>;
++			label = "cpu";
++			status = "disabled";
++
++			fixed-link {
++				speed = <1000>;
++				full-duplex;
++			};
++		};
++
++		port@7 {
++			reg = <7>;
++			ethernet = <&gmac1>;
++			label = "cpu";
++			status = "disabled";
++
++			fixed-link {
++				speed = <1000>;
++				full-duplex;
++			};
++		};
++
+ 		port@8 {
+ 			reg = <8>;
+ 			ethernet = <&gmac2>;
diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0004-ARM-dts-BCM5301X-Linksys-EA9500-add-fixed-partitions.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0004-ARM-dts-BCM5301X-Linksys-EA9500-add-fixed-partitions.patch
new file mode 100644
index 0000000000..c3fdd163d9
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0004-ARM-dts-BCM5301X-Linksys-EA9500-add-fixed-partitions.patch
@@ -0,0 +1,71 @@
+From bd9a01e28e5d1632528e531480b42d6e2c861d88 Mon Sep 17 00:00:00 2001
+From: Vivek Unune <npcomplete13@gmail.com>
+Date: Sun, 1 Nov 2020 15:08:03 -0500
+Subject: [PATCH] ARM: dts: BCM5301X: Linksys EA9500 add fixed partitions
+
+This router has dual paritions to store trx firmware image and
+dual partitions for nvram. The second one in each of these cases acts
+as a backup store.
+
+When tested with OpenWrt, the default partition parser causes two issues:
+
+1. It labels both nvram partitions as nvram. In factory, second one is
+labeled devinfo.
+2. It parses second trx image and tries to create second 'linux' partition
+and fails with - cannot create duplicate 'linux' partition
+
+The following patch works around both of these issues.
+
+Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ .../boot/dts/bcm47094-linksys-panamera.dts    | 41 +++++++++++++++++++
+ 1 file changed, 41 insertions(+)
+
+--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
+@@ -292,3 +292,44 @@
+ &usb3_phy {
+ 	status = "okay";
+ };
++
++&nandcs {
++	partitions {
++		compatible = "fixed-partitions";
++		#address-cells = <1>;
++		#size-cells = <1>;
++
++		partition@0 {
++			label = "boot";
++			reg = <0x0000000 0x0080000>;
++			read-only;
++		};
++
++		partition@80000 {
++			label = "nvram";
++			reg = <0x080000 0x0100000>;
++		};
++
++		partition@180000{
++			label = "devinfo";
++			reg = <0x0180000 0x080000>;
++		};
++
++		partition@200000 {
++			label = "firmware";
++			reg = <0x0200000 0x01D00000>;
++			compatible = "brcm,trx";
++		};
++
++		partition@1F00000 {
++			label = "failsafe";
++			reg = <0x01F00000 0x01D00000>;
++			read-only;
++		};
++
++		partition@5200000 {
++			label = "system";
++			reg = <0x05200000 0x02E00000>;
++		};
++	};
++};
diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0005-ARM-dts-BCM5301X-Use-corretc-pinctrl-compatible-for-.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0005-ARM-dts-BCM5301X-Use-corretc-pinctrl-compatible-for-.patch
new file mode 100644
index 0000000000..3796967936
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0005-ARM-dts-BCM5301X-Use-corretc-pinctrl-compatible-for-.patch
@@ -0,0 +1,49 @@
+From 2f34ae32f5e74096540cd7ce95bfd467cb74b21a Mon Sep 17 00:00:00 2001
+From: Vivek Unune <npcomplete13@gmail.com>
+Date: Wed, 4 Nov 2020 15:29:51 -0500
+Subject: [PATCH] ARM: dts: BCM5301X: Use corretc pinctrl compatible for 4709x
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+BCM47094 version of pinmux uses different compatible and supports MDIO
+pinmux pins. Hence, use the correct compatible string and defines the
+MDIO pins group.
+
+Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
+Acked-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ arch/arm/boot/dts/bcm47094.dtsi | 9 +++++++++
+ arch/arm/boot/dts/bcm5301x.dtsi | 2 +-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/bcm47094.dtsi
++++ b/arch/arm/boot/dts/bcm47094.dtsi
+@@ -8,6 +8,15 @@
+ / {
+ };
+ 
++&pinctrl {
++	compatible = "brcm,bcm4709-pinmux";
++
++	pinmux_mdio: mdio {
++		groups = "mdio_grp";
++		function = "mdio";
++	};
++};
++
+ &usb3_phy {
+ 	compatible = "brcm,ns-bx-usb3-phy";
+ };
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -428,7 +428,7 @@
+ 			#address-cells = <1>;
+ 			#size-cells = <1>;
+ 
+-			pin-controller@1c0 {
++			pinctrl: pin-controller@1c0 {
+ 				compatible = "brcm,bcm4708-pinmux";
+ 				reg = <0x1c0 0x24>;
+ 				reg-names = "cru_gpio_control";
diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0006-ARM-dts-BCM5301X-Linksys-EA9500-make-use-of-pinctrl.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0006-ARM-dts-BCM5301X-Linksys-EA9500-make-use-of-pinctrl.patch
new file mode 100644
index 0000000000..785271546b
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0006-ARM-dts-BCM5301X-Linksys-EA9500-make-use-of-pinctrl.patch
@@ -0,0 +1,61 @@
+From c862059875cffc013ee27bf9759ac288224e7a14 Mon Sep 17 00:00:00 2001
+From: Vivek Unune <npcomplete13@gmail.com>
+Date: Wed, 4 Nov 2020 15:29:52 -0500
+Subject: [PATCH] ARM: dts: BCM5301X: Linksys EA9500 make use of pinctrl
+
+Now that we have a pin controller, use that instead of manuplating the
+mdio/mdc pins directly. i.e. we no longer require the mdio-mii-mux
+
+Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ .../boot/dts/bcm47094-linksys-panamera.dts    | 26 +++----------------
+ 1 file changed, 4 insertions(+), 22 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
+@@ -123,33 +123,13 @@
+ 		};
+ 	};
+ 
+-	mdio-bus-mux {
+-		#address-cells = <1>;
+-		#size-cells = <0>;
++	mdio-bus-mux@18003000 {
+ 
+ 		/* BIT(9) = 1 => external mdio */
+-		mdio_ext: mdio@200 {
++		mdio@200 {
+ 			reg = <0x200>;
+ 			#address-cells = <1>;
+ 			#size-cells = <0>;
+-		};
+-	};
+-
+-	mdio-mii-mux {
+-		compatible = "mdio-mux-mmioreg";
+-		mdio-parent-bus = <&mdio_ext>;
+-		#address-cells = <1>;
+-		#size-cells = <0>;
+-		reg = <0x1800c1c0 0x4>;
+-
+-		/* BIT(6) = mdc, BIT(7) = mdio */
+-		mux-mask = <0xc0>;
+-
+-		mdio-mii@0 {
+-			/* Enable MII function */
+-			reg = <0x0>;
+-			#address-cells = <1>;
+-			#size-cells = <0>;
+ 
+ 			switch@0  {
+ 				compatible = "brcm,bcm53125";
+@@ -159,6 +139,8 @@
+ 				reset-names = "robo_reset";
+ 				reg = <0>;
+ 				dsa,member = <1 0>;
++				pinctrl-names = "default";
++				pinctrl-0 = <&pinmux_mdio>;
+ 
+ 				ports {
+ 					#address-cells = <1>;
diff --git a/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch b/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
index 1d71647d60..e1a2d4ab9b 100644
--- a/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
+++ b/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
@@ -20,8 +20,8 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
 -			#address-cells = <1>;
 -			#size-cells = <1>;
  
--			pin-controller@1c0 {
-+			pinctrl {
+-			pinctrl: pin-controller@1c0 {
++			pinctrl: pinctrl {
  				compatible = "brcm,bcm4708-pinmux";
 -				reg = <0x1c0 0x24>;
 -				reg-names = "cru_gpio_control";
-- 
cgit v1.2.3