From 30bd619480b6a2b92d404a61a1e90ddb76ae4be8 Mon Sep 17 00:00:00 2001
From: Stefan Wahren <wahrenst@gmx.net>
Date: Wed, 25 Dec 2019 16:40:47 +0100
Subject: [PATCH] ARM: dts: bcm2838: Backport genet from upstream

This backport all genet differences (different compatible, right PHY mode,
board specific stuff) from upstream.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 14 ++++++++++++++
 arch/arm/boot/dts/bcm2838-rpi-4-b.dts | 14 ++++++++++++++
 arch/arm/boot/dts/bcm2838.dtsi        | 17 ++++-------------
 3 files changed, 32 insertions(+), 13 deletions(-)

--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -134,6 +134,20 @@
 	vqmmc-supply = <&sd_io_1v8_reg>;
 };
 
+&genet {
+	phy-handle = <&phy1>;
+	phy-mode = "rgmii-rxid";
+	status = "okay";
+};
+
+&genet_mdio {
+	phy1: ethernet-phy@1 {
+		/* No PHY interrupt */
+		reg = <0x1>;
+		led-modes = <0x00 0x08>; /* link/activity link */
+	};
+};
+
 &leds {
 	act_led: act {
 		label = "led0";
--- a/arch/arm/boot/dts/bcm2838-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2838-rpi-4-b.dts
@@ -98,6 +98,20 @@
 	vqmmc-supply = <&sd_io_1v8_reg>;
 };
 
+&genet {
+	phy-handle = <&phy1>;
+	phy-mode = "rgmii-rxid";
+	status = "okay";
+};
+
+&genet_mdio {
+	phy1: ethernet-phy@1 {
+		/* No PHY interrupt */
+		reg = <0x1>;
+		led-modes = <0x00 0x08>; /* link/activity link */
+	};
+};
+
 /* uart0 communicates with the BT module */
 &uart0 {
 	pinctrl-names = "default";
--- a/arch/arm/boot/dts/bcm2838.dtsi
+++ b/arch/arm/boot/dts/bcm2838.dtsi
@@ -346,29 +346,20 @@
 		};
 
 		genet: ethernet@7d580000 {
-			compatible = "brcm,genet-v5";
+			compatible = "brcm,bcm2711-genet-v5", "brcm,genet-v5";
 			reg = <0x0 0x7d580000 0x10000>;
-			status = "okay";
 			#address-cells = <0x1>;
 			#size-cells = <0x1>;
 			interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>;
-			phy-handle = <&phy1>;
-			phy-mode = "rgmii";
-			mdio@e14 {
+			status = "disabled";
+
+			genet_mdio: mdio@e14 {
 				#address-cells = <0x0>;
 				#size-cells = <0x1>;
 				compatible = "brcm,genet-mdio-v5";
 				reg = <0xe14 0x8>;
 				reg-names = "mdio";
-				phy1: ethernet-phy@0 {
-					compatible =
-						"ethernet-phy-ieee802.3-c22";
-					/* No interrupts - use PHY_POLL */
-					max-speed = <1000>;
-					reg = <0x1>;
-					led-modes = <0x00 0x08>; /* link/activity link */
-				};
 			};
 		};
 
