diff mbox series

[net-next,1/2] net: phy: micrel: disable EEE on KSZ9477-type PHY

Message ID 77df52d5-a7b9-4a5c-b004-a785750a1291@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series microchip/micrel switch: replace MICREL_NO_EEE workaround | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-12-20--18-00 (tests: 879)

Commit Message

Heiner Kallweit Dec. 20, 2024, 1:51 p.m. UTC
On several supported switches the integrated PHY's have buggy EEE.
On the GBit-capable ones it's always the same type of PHY with PHY ID
0x00221631. So we can simplify the erratum handling by simply clearing
phydev->supported_eee for this PHY type.

Note: The KSZ9477 PHY driver also covers e.g. the internal PHY of
      KSZ9563 (ID: 0x00221637), which is unaffected by the EEE issue.
      Therefore check for the exact PHY ID.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/micrel.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Oleksij Rempel Dec. 20, 2024, 2:40 p.m. UTC | #1
On Fri, Dec 20, 2024 at 02:51:32PM +0100, Heiner Kallweit wrote:
> On several supported switches the integrated PHY's have buggy EEE.
> On the GBit-capable ones it's always the same type of PHY with PHY ID
> 0x00221631. So we can simplify the erratum handling by simply clearing
> phydev->supported_eee for this PHY type.
> 
> Note: The KSZ9477 PHY driver also covers e.g. the internal PHY of
>       KSZ9563 (ID: 0x00221637), which is unaffected by the EEE issue.
>       Therefore check for the exact PHY ID.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/micrel.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 3ef508840..ece6d026e 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1522,6 +1522,12 @@ static int ksz9477_get_features(struct phy_device *phydev)
>  	if (ret)
>  		return ret;
>  
> +	/* See KSZ9477 Errata DS80000754C Module 4 */
> +	if (phydev->phy_id == PHY_ID_KSZ9477) {
> +		linkmode_zero(phydev->supported_eee);
> +		return 0;
> +	}

Hm.. with this change, we won't be able to disable EEE. Zeroed
supported_eee will avoid writing to the EEE advertisement register.
Heiner Kallweit Dec. 20, 2024, 6:02 p.m. UTC | #2
On 20.12.2024 15:40, Oleksij Rempel wrote:
> On Fri, Dec 20, 2024 at 02:51:32PM +0100, Heiner Kallweit wrote:
>> On several supported switches the integrated PHY's have buggy EEE.
>> On the GBit-capable ones it's always the same type of PHY with PHY ID
>> 0x00221631. So we can simplify the erratum handling by simply clearing
>> phydev->supported_eee for this PHY type.
>>
>> Note: The KSZ9477 PHY driver also covers e.g. the internal PHY of
>>       KSZ9563 (ID: 0x00221637), which is unaffected by the EEE issue.
>>       Therefore check for the exact PHY ID.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/net/phy/micrel.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
>> index 3ef508840..ece6d026e 100644
>> --- a/drivers/net/phy/micrel.c
>> +++ b/drivers/net/phy/micrel.c
>> @@ -1522,6 +1522,12 @@ static int ksz9477_get_features(struct phy_device *phydev)
>>  	if (ret)
>>  		return ret;
>>  
>> +	/* See KSZ9477 Errata DS80000754C Module 4 */
>> +	if (phydev->phy_id == PHY_ID_KSZ9477) {
>> +		linkmode_zero(phydev->supported_eee);
>> +		return 0;
>> +	}
> 
> Hm.. with this change, we won't be able to disable EEE. Zeroed
> supported_eee will avoid writing to the EEE advertisement register.
> 
Indeed, genphy_c45_write_eee_adv() would become a no-op.
We have to do it differently.
diff mbox series

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 3ef508840..ece6d026e 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1522,6 +1522,12 @@  static int ksz9477_get_features(struct phy_device *phydev)
 	if (ret)
 		return ret;
 
+	/* See KSZ9477 Errata DS80000754C Module 4 */
+	if (phydev->phy_id == PHY_ID_KSZ9477) {
+		linkmode_zero(phydev->supported_eee);
+		return 0;
+	}
+
 	/* The "EEE control and capability 1" (Register 3.20) seems to be
 	 * influenced by the "EEE advertisement 1" (Register 7.60). Changes
 	 * on the 7.60 will affect 3.20. So, we need to construct our own list
@@ -2000,12 +2006,6 @@  static int ksz9477_config_init(struct phy_device *phydev)
 			return err;
 	}
 
-	/* According to KSZ9477 Errata DS80000754C (Module 4) all EEE modes
-	 * in this switch shall be regarded as broken.
-	 */
-	if (phydev->dev_flags & MICREL_NO_EEE)
-		linkmode_fill(phydev->eee_broken_modes);
-
 	return kszphy_config_init(phydev);
 }