The RTL8366S/RB support connecting a second mac to it and using the 5th
port as an independent phy. Therefore we need to handle autonegotiation
changes for phy 4 like on a single phy device.

This fixes #7980, verified on a WNDR3700.

Signed-off-by: Jonas Gorski <jonas.gorski+open...@gmail.com>
---
 .../generic/files/drivers/net/phy/rtl8366rb.c      |    5 +++++
 .../linux/generic/files/drivers/net/phy/rtl8366s.c |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

v2:
 * added a define for it
 * added a small comment
 * added an empty line before the return

diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c 
b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
index ec196f9..9615eeb 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
@@ -25,6 +25,7 @@
 #define RTL8366RB_PHY_NO_MAX   4
 #define RTL8366RB_PHY_PAGE_MAX 7
 #define RTL8366RB_PHY_ADDR_MAX 31
+#define RTL8366RB_PHY_WAN      4
 
 /* Switch Global Configuration register */
 #define RTL8366RB_SGCR                         0x0000
@@ -1063,6 +1064,10 @@ static int rtl8366rb_phy_config_init(struct phy_device 
*phydev)
 
 static int rtl8366rb_phy_config_aneg(struct phy_device *phydev)
 {
+       /* phy 4 might be connected to a second mac, allow aneg config */
+       if (phydev->addr == RTL8366RB_PHY_WAN)
+               return genphy_config_aneg(phydev);
+
        return 0;
 }
 
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c 
b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 66dc2db..d45e4d7 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -25,6 +25,7 @@
 #define RTL8366S_PHY_NO_MAX    4
 #define RTL8366S_PHY_PAGE_MAX  7
 #define RTL8366S_PHY_ADDR_MAX  31
+#define RTL8366S_PHY_WAN       4
 
 /* Switch Global Configuration register */
 #define RTL8366S_SGCR                          0x0000
@@ -1090,6 +1091,10 @@ static int rtl8366s_phy_config_init(struct phy_device 
*phydev)
 
 static int rtl8366s_phy_config_aneg(struct phy_device *phydev)
 {
+       /* phy 4 might be connected to a second mac, allow aneg config */
+       if (phydev->addr == RTL8366S_PHY_WAN)
+               return genphy_config_aneg(phydev);
+
        return 0;
 }
 
-- 
1.5.6.5

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to