[][kernel][mt7981/mt7988][eth][phy: mediatek-ge: Add enhancement to slave mode and do calibration only once]

[Description]
Add enhancement to slave mode and do phy calibration only once at
system startup.

[Release-log]
N/A

Change-Id: Ic49d90fbb4c6524bd22984f5166496efd0247ca1
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6818459
diff --git a/target/linux/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c b/target/linux/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
index fd3022f..9026535 100644
--- a/target/linux/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
@@ -160,6 +160,9 @@
 #define MTK_PHY_RG_DEV1E_REG184		(0x180)
 #define   MTK_PHY_DASN_DAC_IN1_D_MASK	GENMASK(9, 0)
 
+#define MTK_PHY_RG_DEV1E_REG234		(0x234)
+#define   MTK_PHY_TR_OPEN_LOOP_EN	GENMASK(0, 0)
+
 #define MTK_PHY_RG_DEV1E_REG53D		(0x53d)
 #define   MTK_PHY_DA_TX_R50_A_NORMAL_MASK	GENMASK(13, 8)
 #define   MTK_PHY_DA_TX_R50_A_TBT_MASK		GENMASK(5, 0)
@@ -907,6 +910,9 @@
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, 0x2426);
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, 0x2624);
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, 0x2426);
+
+	phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
+			MTK_PHY_TR_OPEN_LOOP_EN, 0x1);
 }
 
 static inline void mt7988_phy_finetune(struct phy_device *phydev)
@@ -981,14 +987,14 @@
 	return ret;
 }
 
-static int mt7981_phy_config_init(struct phy_device *phydev)
+static int mt7981_phy_probe(struct phy_device *phydev)
 {
 	mt7981_phy_finetune(phydev);
 
 	return mt798x_phy_calibration(phydev);
 }
 
-static int mt7988_phy_config_init(struct phy_device *phydev)
+static int mt7988_phy_probe(struct phy_device *phydev)
 {
 	struct device_node *np;
 	void __iomem *boottrap;
@@ -1027,11 +1033,6 @@
 	return mt798x_phy_calibration(phydev);
 }
 
-static int mt7988_phy_probe(struct phy_device *phydev)
-{
-	return mt7988_phy_config_init(phydev);
-}
-
 static struct phy_driver mtk_gephy_driver[] = {
 #if 0
 	{
@@ -1066,7 +1067,8 @@
 	{
 		PHY_ID_MATCH_EXACT(0x03a29461),
 		.name		= "MediaTek MT7981 PHY",
-		.config_init	= mt7981_phy_config_init,
+		.probe		= mt7981_phy_probe,
+		.read_status	= mt798x_phy_read_status,
 		/* Interrupts are handled by the switch, not the PHY
 		 * itself.
 		 */
@@ -1081,7 +1083,6 @@
 		PHY_ID_MATCH_EXACT(0x03a29481),
 		.name		= "MediaTek MT7988 PHY",
 		.probe		= mt7988_phy_probe,
-		.config_init	= mt7988_phy_config_init,
 		/* Interrupts are handled by the switch, not the PHY
 		 * itself.
 		 */