From d7b70542abae13a77d3ed6f4a10ea921fbf7c558 Mon Sep 17 00:00:00 2001
From: Bartlomiej Grzeskowiak <bartlomiej.grzeskowiak@iopsys.eu>
Date: Fri, 19 Nov 2021 13:43:05 +0100
Subject: [PATCH] iopsys-econet: Add 2,5 Gb phy support

Enable 2,5Gb phy support handled by RTL8221B chip.

Signed-off-by: Bartlomiej Grzeskowiak <bartlomiej.grzeskowiak@iopsys.eu>
---
 iopsys-econet/base-files/etc/preinit                         | 4 ++--
 iopsys-econet/config/config                                  | 2 +-
 .../UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak      | 2 +-
 iopsys-econet/image/upgrade-bundle/upgrade                   | 5 +++++
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/iopsys-econet/base-files/etc/preinit b/iopsys-econet/base-files/etc/preinit
index ae3cf78d9..d5a6dc4cb 100755
--- a/iopsys-econet/base-files/etc/preinit
+++ b/iopsys-econet/base-files/etc/preinit
@@ -64,8 +64,8 @@ insmod /lib/modules/5.4.55/sw_rps_for_wifi.ko
 echo "insmod hw_nat.ko"
 insmod /lib/modules/5.4.55/hw_nat.ko
 
-echo "insmod ae_wan.ko"
-insmod /lib/modules/5.4.55/ae_wan.ko
+echo "insmod ae_wan.ko wan_sel=1"
+insmod /lib/modules/5.4.55/ae_wan.ko wan_sel=1
 
 echo "insmod hsgmii_lan.ko"
 insmod /lib/modules/5.4.55/hsgmii_lan.ko
diff --git a/iopsys-econet/config/config b/iopsys-econet/config/config
index 96130c037..88859600d 100644
--- a/iopsys-econet/config/config
+++ b/iopsys-econet/config/config
@@ -17,7 +17,7 @@ CONFIG_PACKAGE_kmod-qdma_wan=y
 CONFIG_PACKAGE_kmod-tcledctrl=y
 CONFIG_PACKAGE_kmod-tccicmd=y
 CONFIG_PACKAGE_kmod-sif=y
-# CONFIG_PACKAGE_kmod-tcphy is not set
+CONFIG_PACKAGE_kmod-tcphy=y
 
 #Econet apps
 CONFIG_PACKAGE_ecnt_sys=y
diff --git a/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak b/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak
index c974a4518..9e38a2f6d 100755
--- a/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak
+++ b/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak
@@ -336,7 +336,7 @@ TCSUPPORT_TSO_ENABLE=y
 TCSUPPORT_TSO_V2_ENABLE=y
 TCSUPPORT_LRO_ENABLE=y
 TCSUPPORT_ACTIVE_ETHERNET_WAN=y
-TCSUPPORT_HSGMII_LAN=y
+# TCSUPPORT_HSGMII_LAN is not set
 TCSUPPORT_VOIP=y
 
 #
diff --git a/iopsys-econet/image/upgrade-bundle/upgrade b/iopsys-econet/image/upgrade-bundle/upgrade
index 18bc7d301..dc9618d5b 100755
--- a/iopsys-econet/image/upgrade-bundle/upgrade
+++ b/iopsys-econet/image/upgrade-bundle/upgrade
@@ -28,6 +28,11 @@ do_post_upgrade() {
 		fw_setenv iop_eco_bootargs "qdma_init=33 serdes_sel=2"
 		fw_setenv bootcmd "run iop_set_mtdblock_\${rootfstype}; setenv bootargs \${iop_gen_bootargs} \${iop_sys_bootargs} \${iop_eco_bootargs}; run iop_read_kernel; bootm"
 	fi
+	if [[ "2" != "$(fw_printenv -n serdes_sel)" ]]; then
+		log "- Fixing uboot serdes_sel variable -"
+		fw_setenv serdes_sel 2
+	fi
+
 	#For future use
 	#reboot && sleep 60 ; reboot -f ; sleep 60 ; exit 1
 }
-- 
GitLab