diff mbox series

[meta-rockchip,v2] rock-pi-e: enable networking in u-boot

Message ID 20240116165550.25181-1-twoerner@gmail.com
State New
Headers show
Series [meta-rockchip,v2] rock-pi-e: enable networking in u-boot | expand

Commit Message

Trevor Woerner Jan. 16, 2024, 4:55 p.m. UTC
The rock-pi-e currently comes in 4 board revisions, the latest of which
(v1.21) replaces the realtek 8211e PHY with the 8211f.

This patch enables networking on the rock-pi-e, which had not been working up
to this point. Interestingly enough, this patch also has the side-effect of
enabling both the 8211e and 8211f PHYs under Linux. Previously only the 8211e
boards were working.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v2:
- add eth_phy_reset_pin to pinctrl-0 in gmac2io node
- u-boot patch commit message tweaks
---
 ...s-rk3328-rock-pi-e-enable-networking.patch | 68 +++++++++++++++++++
 recipes-bsp/u-boot/u-boot%.bbappend           |  5 ++
 2 files changed, 73 insertions(+)
 create mode 100644 recipes-bsp/u-boot/files/0001-arm-dts-rk3328-rock-pi-e-enable-networking.patch
diff mbox series

Patch

diff --git a/recipes-bsp/u-boot/files/0001-arm-dts-rk3328-rock-pi-e-enable-networking.patch b/recipes-bsp/u-boot/files/0001-arm-dts-rk3328-rock-pi-e-enable-networking.patch
new file mode 100644
index 000000000000..e1c71a40261b
--- /dev/null
+++ b/recipes-bsp/u-boot/files/0001-arm-dts-rk3328-rock-pi-e-enable-networking.patch
@@ -0,0 +1,68 @@ 
+From 9204939a75805769c654b1dab399c30f2b9bd9b4 Mon Sep 17 00:00:00 2001
+From: Trevor Woerner <twoerner@gmail.com>
+Date: Tue, 16 Jan 2024 11:33:50 -0500
+Subject: [PATCH] arm: dts: rk3328-rock-pi-e: enable networking
+
+Currently the rock-pi-e comes in 4 board spins, the latest of which
+replaces the realtek phy from the rtl8211e to the rtl8211f, therefore
+rename the phy handle to be more generic.
+
+The device tree includes information for the MDIO, therefore enable DM_MDIO
+to use it. The gmac2io node needs addition information in order for the
+driver to initialize correctly, specifically the 3 "snps" lines; add the
+reset pin to the pinctrl-0 entry to match.
+
+Upstream-Status: Submitted
+Signed-off-by: Trevor Woerner <twoerner@gmail.com>
+---
+ arch/arm/dts/rk3328-rock-pi-e.dts  | 9 ++++++---
+ configs/rock-pi-e-rk3328_defconfig | 2 ++
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/dts/rk3328-rock-pi-e.dts b/arch/arm/dts/rk3328-rock-pi-e.dts
+index 018a3a5075c7..f5e28cbf4ffe 100644
+--- a/arch/arm/dts/rk3328-rock-pi-e.dts
++++ b/arch/arm/dts/rk3328-rock-pi-e.dts
+@@ -146,12 +146,15 @@
+ 	assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
+ 	assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
+ 	clock_in_out = "input";
+-	phy-handle = <&rtl8211e>;
++	phy-handle = <&rtl8211>;
+ 	phy-mode = "rgmii";
+ 	phy-supply = <&vcc_io>;
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&rgmiim1_pins>;
++	pinctrl-0 = <&rgmiim1_pins>, <&eth_phy_reset_pin>;
+ 	snps,aal;
++	snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
++	snps,reset-active-low;
++	snps,reset-delays-us = <0 10000 50000>;
+ 	snps,rxpbl = <0x4>;
+ 	snps,txpbl = <0x4>;
+ 	tx_delay = <0x26>;
+@@ -163,7 +166,7 @@
+ 		#address-cells = <1>;
+ 		#size-cells = <0>;
+ 
+-		rtl8211e: ethernet-phy@1 {
++		rtl8211: ethernet-phy@1 {
+ 			reg = <1>;
+ 			pinctrl-0 = <&eth_phy_int_pin>, <&eth_phy_reset_pin>;
+ 			pinctrl-names = "default";
+diff --git a/configs/rock-pi-e-rk3328_defconfig b/configs/rock-pi-e-rk3328_defconfig
+index c0375beffec3..65ca028c0787 100644
+--- a/configs/rock-pi-e-rk3328_defconfig
++++ b/configs/rock-pi-e-rk3328_defconfig
+@@ -76,6 +76,8 @@ CONFIG_SYS_I2C_ROCKCHIP=y
+ CONFIG_MISC=y
+ CONFIG_MMC_DW=y
+ CONFIG_MMC_DW_ROCKCHIP=y
++CONFIG_PHY_REALTEK=y
++CONFIG_DM_MDIO=y
+ CONFIG_ETH_DESIGNWARE=y
+ CONFIG_GMAC_ROCKCHIP=y
+ CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+-- 
+2.43.0.76.g1a87c842ece3
+
diff --git a/recipes-bsp/u-boot/u-boot%.bbappend b/recipes-bsp/u-boot/u-boot%.bbappend
index d902c9a05a83..62133f24c64a 100644
--- a/recipes-bsp/u-boot/u-boot%.bbappend
+++ b/recipes-bsp/u-boot/u-boot%.bbappend
@@ -1,3 +1,8 @@ 
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+SRC_URI:append:rock-pi-e = " \
+	file://0001-arm-dts-rk3328-rock-pi-e-enable-networking.patch \
+	"
+
 # various machines require the pyelftools library for parsing dtb files
 DEPENDS:append = " python3-pyelftools-native"
 DEPENDS:append:rock-pi-s = " u-boot-tools-native"