[Feature][ZXW-259]Without phy, gmac's gpio output power is removed
Only Configure :No
Affected branch: master
Affected module: Ethernet,PowerMan
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: Iba9e14db0e12c1e38a02aad8e85371ec4cf1e4dc
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
index fd87356..cc32d3a 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -491,18 +491,33 @@
struct mdio_device *mdio_dev = NULL;
int ret = 0;
- if (priv->nports == 1) {
- p = phy_find_first(priv->mii.bus);
- } else if (priv->rmii_port < PHY_MAX_ADDR) {
- mdio_dev = priv->mii.bus->mdio_map[priv->rmii_port];
- p = container_of(mdio_dev, struct phy_device, mdio);
- }
-
-
- if (!p) {
- printk("%s: no PHY found\n", dev->name);
- return -ENODEV;
- }
+ //zw.wang Without phy, gmac's gpio output power is removed on 20240328 start
+ int i = 0;
+ for(i = 0;i <= 5;i++)
+ {
+ if (priv->nports == 1) {
+ p = phy_find_first(priv->mii.bus);
+ } else if (priv->rmii_port < PHY_MAX_ADDR) {
+ mdio_dev = priv->mii.bus->mdio_map[priv->rmii_port];
+ p = container_of(mdio_dev, struct phy_device, mdio);
+ }
+
+ if (!p) {
+ if(i == 5){
+ gpio_direction_output(priv->gpio_power[0], 0);
+#ifdef CONFIG_MDIO_C45
+ gpio_direction_output(priv->gpio_power[1], 0);
+#endif
+ }
+ else
+ continue;
+ printk("%s: no PHY found\n", dev->name);
+ return -ENODEV;
+ }
+ else
+ break;
+ }
+ //zw.wang Without phy, gmac's gpio output power is removed on 20240328 end
ret = phy_connect_direct(dev, p, zx29_gmac_adjust_link, PHY_INTERFACE_MODE_RMII); /* phy_start_machine */
/* supported and advertising */