net: phy: marvell: add Marvell specific PHY loopback
Subsystems (4)
cover net: phy: marvell: add Marvell specific PHY loopback
This patch to implement Marvell PHY specific loopback callback function. Verified working on Marvell 88E1510 at 1Gbps speed only. For 100Mbps and 10Mbps, found that the PHY loopback not able to function properly. Possible due to limitation in Marvell 88E1510 PHY.
Tested on Intel Elkhart Lake platform (Synopsys Designware QoS MAC and Marvell 88E1510 PHY).
Mohammad Athari Bin Ismail (1):
net: phy: marvell: add Marvell specific PHY loopback
drivers/net/phy/marvell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH 1/1 net: phy: marvell: add Marvell specific PHY loopback
Existing genphy_loopback() is not applicable for Marvell PHY. So, adding Marvell specific PHY loopback operation by only setting(enable) or clearing(disable) BMCR_LOOPBACK bit.
Tested working on Marvell 88E1510.
--- drivers/net/phy/marvell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/phy/marvell.c +7 -1
@@ -1932,6 +1932,12 @@ static void marvell_get_stats(struct phy_device *phydev, data[i] =marvell_get_stat (phydev, i); } +static int marvell_loopback (struct phy_device *phydev,bool enable) +{ +return phy_modify (phydev,MII_BMCR ,BMCR_LOOPBACK , + enable ?BMCR_LOOPBACK :0 ); +} +static int marvell_vct5_wait_complete (struct phy_device *phydev) {int i;
@@ -3078,7 +3084,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, - .set_loopback = genphy_loopback, + .set_loopback = marvell_loopback, .get_tunable = m88e1011_get_tunable, .set_tunable = m88e1011_set_tunable, .cable_test_start = marvell_vct7_cable_test_start,
Signature · 1 line
2.17.1
Heiner Kallweit
maintainerQuoted 6 lines · Mohammad Athari Bin Ismail
Existing
genphy_loopback()is not applicable for Marvell PHY. So, adding Marvell specific PHY loopback operation by only setting(enable) or clearing(disable)BMCR_LOOPBACKbit.Tested working on Marvell 88E1510.
With this change you'd basically revert the original change and loose its functionality. Did you check the Marvell datasheets? At least for few versions I found that you may have to configure bits 0..2 in MAC Specific Control Register 2 (page 2, register 21) instead of BMCR.
Quoted 33 lines
Fixes 014068dcb5b1 ("net: phy: genphy_loopback: add link speed configuration")Cc <[email protected]> # 5.15.xSigned-off-by Mohammad Athari Bin Ismail <[email protected]>--- drivers/net/phy/marvell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/phy/marvell.c +7
-1@@ -1932,6 +1932,12 @@ static void marvell_get_stats(struct phy_device *phydev, data[i] =marvell_get_stat (phydev, i); } +static int marvell_loopback (struct phy_device *phydev,bool enable) +{ +return phy_modify (phydev,MII_BMCR ,BMCR_LOOPBACK , + enable ?BMCR_LOOPBACK :0 ); +} +static int marvell_vct5_wait_complete (struct phy_device *phydev) {int i;@@ -3078,7 +3084,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, - .set_loopback = genphy_loopback, + .set_loopback = marvell_loopback, .get_tunable = m88e1011_get_tunable, .set_tunable = m88e1011_set_tunable, .cable_test_start = marvell_vct7_cable_test_start,
Quoted 20 lines
-----Original Message-----
From: Heiner Kallweit <[email protected]>
Sent: Monday, January 10, 2022 4:34 PM
To: Ismail, Mohammad Athari <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Jakub Kicinski <[email protected]>; Oleksij Rempel <linux@rempel- privat.de>; Russell King <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net 1/1] net: phy: marvell: add Marvell specific PHY loopbackQuoted 5 lines · Mohammad Athari Bin Ismail
Existing
genphy_loopback()is not applicable for Marvell PHY. So, adding Marvell specific PHY loopback operation by only setting(enable) or
clearing(disable)BMCR_LOOPBACKbit.
Quoted 6 lines
Quoted 2 lines
Tested working on Marvell 88E1510.
With this change you'd basically revert the original change and loose its functionality. Did you check the Marvell datasheets?
At least for few versions I found that you may have to configure bits 0..2 in MAC Specific Control Register 2 (page 2, register 21) instead of BMCR.
May I know what datasheet version that has the bits 2:0's detail explanation? The version that I have, bits 2:0 in MAC Specific Control Register 2 shows as Reserved. The datasheet I have is "Marvell Alaska 88E1510/88E1518/88E1512/88E1514 Integrated 10/100/1000 Mbps Energy Efficient Ethernet Transceiver Rev. G December 17, 2021"
Really appreciate if you could advice on PHY loopback enabling for Marvell 88E1510 because the existing genphy_loopback() function doesn't work for the PHY.
Thank you.
-Athari-
Quoted 35 lines
drivers/net/phy/marvell.c static void marvell_get_stats(struct phy_device
Quoted 16 lines
Fixes 014068dcb5b1 ("net: phy: genphy_loopback: add link speedconfiguration")
Cc: <[email protected]> # 5.15.x
Signed-off-by: Mohammad Athari Bin Ismail
<[email protected]>--- drivers/net/phy/marvell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/phy/marvell.c +0
-0@@ -1932,6 +1932,12 @@ static void marvell_get_stats(struct phy_device*phydev,
Quoted 18 lines
drivers/net/phy/marvell.c +6
-1data[i] =marvell_get_stat (phydev, i); } +static int marvell_loopback (struct phy_device *phydev,bool enable) { +return phy_modify (phydev,MII_BMCR ,BMCR_LOOPBACK , + enable ?BMCR_LOOPBACK :0 ); +} +static int marvell_vct5_wait_complete (struct phy_device *phydev) {int i;@@ -3078,7 +3084,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, - .set_loopback = genphy_loopback, + .set_loopback = marvell_loopback, .get_tunable = m88e1011_get_tunable, .set_tunable = m88e1011_set_tunable, .cable_test_start = marvell_vct7_cable_test_start,
Heiner Kallweit
maintainerQuoted 22 lines · Mohammad Athari
Quoted 22 lines
-----Original Message-----
From: Heiner Kallweit <[email protected]>
Sent: Monday, January 10, 2022 4:34 PM
To: Ismail, Mohammad Athari <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Jakub Kicinski <[email protected]>; Oleksij Rempel <linux@rempel- privat.de>; Russell King <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net 1/1] net: phy: marvell: add Marvell specific PHY loopbackQuoted 7 lines · Mohammad Athari Bin Ismail
Existing
genphy_loopback()is not applicable for Marvell PHY. So, adding Marvell specific PHY loopback operation by only setting(enable) or
clearing(disable)BMCR_LOOPBACKbit.Tested working on Marvell 88E1510.
Quoted 8 lines
Quoted 4 lines
With this change you'd basically revert the original change and loose its functionality. Did you check the Marvell datasheets?
At least for few versions I found that you may have to configure bits 0..2 in MAC Specific Control Register 2 (page 2, register 21) instead of BMCR.May I know what datasheet version that has the bits 2:0's detail explanation? The version that I have, bits 2:0 in MAC Specific Control Register 2 shows as Reserved. The datasheet I have is "Marvell Alaska 88E1510/88E1518/88E1512/88E1514 Integrated 10/100/1000 Mbps Energy Efficient Ethernet Transceiver Rev. G December 17, 2021"
I checked the 88E6352 switch chip datasheet. The part covering the integrated PHY's lists the mentioned bits in MAC Specific Control Register 2.
Table 75 in the 88E1510 datasheet says: Loopback speed is determined by Registers 21_2.6,13. So Marvell PHY's seem to use different bits (although same register) for loopback speed configuration.
Quoted 42 lines
Really appreciate if you could advice on PHY loopback enabling for Marvell 88E1510 because the existing
genphy_loopback()function doesn't work for the PHY.Thank you.
-Athari-
Quoted 35 lines
drivers/net/phy/marvell.c static void marvell_get_stats(struct phy_device
Quoted 16 lines
Fixes 014068dcb5b1 ("net: phy: genphy_loopback: add link speedconfiguration")
Cc: <[email protected]> # 5.15.x
Signed-off-by: Mohammad Athari Bin Ismail
<[email protected]>--- drivers/net/phy/marvell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/phy/marvell.c +0
-0@@ -1932,6 +1932,12 @@ static void marvell_get_stats(struct phy_device*phydev,
Quoted 18 lines
drivers/net/phy/marvell.c +6
-1data[i] =marvell_get_stat (phydev, i); } +static int marvell_loopback (struct phy_device *phydev,bool enable) { +return phy_modify (phydev,MII_BMCR ,BMCR_LOOPBACK , + enable ?BMCR_LOOPBACK :0 ); +} +static int marvell_vct5_wait_complete (struct phy_device *phydev) {int i;@@ -3078,7 +3084,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, - .set_loopback = genphy_loopback, + .set_loopback = marvell_loopback, .get_tunable = m88e1011_get_tunable, .set_tunable = m88e1011_set_tunable, .cable_test_start = marvell_vct7_cable_test_start,
Quoted 51 lines
-----Original Message-----
From: Heiner Kallweit <[email protected]>
Sent: Monday, January 10, 2022 6:17 PM
To: Ismail, Mohammad Athari <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Jakub Kicinski <[email protected]>; Oleksij Rempel <linux@rempel- privat.de>; Russell King <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net 1/1] net: phy: marvell: add Marvell specific PHY loopbackQuoted 7 lines · Mohammad Athari
Quoted 7 lines
-----Original Message-----
From: Heiner Kallweit <[email protected]>
Sent: Monday, January 10, 2022 4:34 PM
To: Ismail, Mohammad Athari <[email protected]>; Andrew Lunn <[email protected]>; David S . MillerQuoted 13 lines
Quoted 13 lines
Jakub Kicinski <[email protected]>; Oleksij Rempel <linux@rempel- privat.de>; Russell King <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net 1/1] net: phy: marvell: add Marvell specific PHY loopbackQuoted 5 lines · Mohammad Athari Bin Ismail
Existing
genphy_loopback()is not applicable for Marvell PHY. So, adding Marvell specific PHY loopback operation by only setting(enable) or
clearing(disable)BMCR_LOOPBACKbit.Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Tested working on Marvell 88E1510.
With this change you'd basically revert the original change and loose its functionality. Did you check the Marvell datasheets?
At least for few versions I found that you may have to configure bits 0..2 in MAC Specific Control Register 2 (page 2, register 21) instead ofBMCR.
Quoted 2 lines
May I know what datasheet version that has the bits 2:0's detail
explanation? The version that I have, bits 2:0 in MAC Specific Control Register 2 shows as Reserved.
Quoted 1 line
The datasheet I have is "Marvell Alaska 88E1510/88E1518/88E1512/88E1514
Integrated 10/100/1000 Mbps Energy Efficient Ethernet Transceiver Rev. G December 17, 2021"
Quoted 1 line
Quoted 7 lines
I checked the 88E6352 switch chip datasheet. The part covering the integrated PHY's lists the mentioned bits in MAC Specific Control Register 2.
Table 75 in the 88E1510 datasheet says: Loopback speed is determined by Registers 21_2.6,13.
So Marvell PHY's seem to use different bits (although same register) for loopback speed configuration.
I get your point. Registers 21_2.6,13 also need to be configured for loopback to work for all speeds. I'll send the v2 patch later.
-Athari-
Quoted 46 lines
Quoted 2 lines
Really appreciate if you could advice on PHY loopback enabling for Marvell
88E1510 because the existing
genphy_loopback()function doesn't work for the PHY.Quoted 42 lines
Thank you.
-Athari-
Quoted 36 lines
Quoted 16 lines
Fixes 014068dcb5b1 ("net: phy: genphy_loopback: add link speedconfiguration")
Cc: <[email protected]> # 5.15.x
Signed-off-by: Mohammad Athari Bin Ismail
<[email protected]>--- drivers/net/phy/marvell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/phy/marvell.c +0
-0@@ -1932,6 +1932,12 @@ static void marvell_get_stats(structQuoted 1 line
phy_device*phydev,
Quoted 18 lines
drivers/net/phy/marvell.c +6
-1data[i] =marvell_get_stat (phydev, i); } +static int marvell_loopback (struct phy_device *phydev,bool enable) { +return phy_modify (phydev,MII_BMCR ,BMCR_LOOPBACK , + enable ?BMCR_LOOPBACK :0 ); +} +static int marvell_vct5_wait_complete (struct phy_device *phydev) {int i;@@ -3078,7 +3084,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, - .set_loopback = genphy_loopback, + .set_loopback = marvell_loopback, .get_tunable = m88e1011_get_tunable, .set_tunable = m88e1011_set_tunable, .cable_test_start = marvell_vct7_cable_test_start,
Russell King (Oracle)
reviewerQuoted 4 lines · Mohammad Athari Bin Ismail
This patch to implement Marvell PHY specific loopback callback function. Verified working on Marvell 88E1510 at 1Gbps speed only. For 100Mbps and 10Mbps, found that the PHY loopback not able to function properly. Possible due to limitation in Marvell 88E1510 PHY.
This is valuable information that should be in the commit message for the patch.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Quoted 16 lines
-----Original Message-----
From: Russell King <[email protected]>
Sent: Monday, January 10, 2022 5:36 PM
To: Ismail, Mohammad Athari <[email protected]>
Cc: Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Jakub Kicinski <[email protected]>; Oleksij Rempel <[email protected]>; Heiner Kallweit <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH net 0/1] net: phy: marvell: add Marvell specific PHY loopbackOn Mon, Jan 10, 2022 at 02:21:16PM +0800, Mohammad Athari Bin Ismail wrote:
Quoted 7 lines
Quoted 4 lines
This patch to implement Marvell PHY specific loopback callback function. Verified working on Marvell 88E1510 at 1Gbps speed only. For 100Mbps and 10Mbps, found that the PHY loopback not able to function properly. Possible due to limitation in Marvell 88E1510 PHY.
This is valuable information that should be in the commit message for the patch.
Sure. I will add this information in commit message for next version patch.
-Athari-
Quoted 4 lines
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!