diff mbox series

[net-next,v2,1/2] net: phy: micrel: lan8814 led errata

Message ID 20240229195220.2673049-2-horatiu.vultur@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: phy: micrel: lan8814 erratas | 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: 940 this patch: 940
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: 956 this patch: 956
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: 956 this patch: 956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 37 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 success net-next-2024-03-01--15-00 (tests: 884)

Commit Message

Horatiu Vultur Feb. 29, 2024, 7:52 p.m. UTC
Lan8814 phy led behavior is not correct. It was noticed that the led
still remains ON when the cable is unplugged while there was traffic
passing at that time.

The fix consists in clearing bit 10 of register 0x38, in this way the
led behaviour is correct and gets OFF when there is no link.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/phy/micrel.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Wojciech Drewek March 1, 2024, 8:17 a.m. UTC | #1
On 29.02.2024 20:52, Horatiu Vultur wrote:
> Lan8814 phy led behavior is not correct. It was noticed that the led
> still remains ON when the cable is unplugged while there was traffic
> passing at that time.
> 
> The fix consists in clearing bit 10 of register 0x38, in this way the
> led behaviour is correct and gets OFF when there is no link.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---

Thank you!
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/phy/micrel.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 9b69735819896..88cc03982bb78 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -114,6 +114,9 @@
>  #define LAN8814_INTR_CTRL_REG_POLARITY		BIT(1)
>  #define LAN8814_INTR_CTRL_REG_INTR_ENABLE	BIT(0)
>  
> +#define LAN8814_EEE_STATE			0x38
> +#define LAN8814_EEE_STATE_MASK2P5P		BIT(10)
> +
>  /* Represents 1ppm adjustment in 2^32 format with
>   * each nsec contains 4 clock cycles.
>   * The value is calculated as following: (1/1000000)/((2^-32)/4)
> @@ -3288,6 +3291,19 @@ static int lan8814_release_coma_mode(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +static void lan8814_clear_2psp_bit(struct phy_device *phydev)
> +{
> +	u16 val;
> +
> +	/* It was noticed that when traffic is passing through the PHY and the
> +	 * cable is removed then the LED was still one even though there is no
> +	 * link
> +	 */
> +	val = lanphy_read_page_reg(phydev, 2, LAN8814_EEE_STATE);
> +	val &= ~LAN8814_EEE_STATE_MASK2P5P;
> +	lanphy_write_page_reg(phydev, 2, LAN8814_EEE_STATE, val);
> +}
> +
>  static int lan8814_probe(struct phy_device *phydev)
>  {
>  	const struct kszphy_type *type = phydev->drv->driver_data;
> @@ -3324,6 +3340,9 @@ static int lan8814_probe(struct phy_device *phydev)
>  
>  	lan8814_ptp_init(phydev);
>  
> +	/* Errata workarounds */
> +	lan8814_clear_2psp_bit(phydev);
> +
>  	return 0;
>  }
>
diff mbox series

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 9b69735819896..88cc03982bb78 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -114,6 +114,9 @@ 
 #define LAN8814_INTR_CTRL_REG_POLARITY		BIT(1)
 #define LAN8814_INTR_CTRL_REG_INTR_ENABLE	BIT(0)
 
+#define LAN8814_EEE_STATE			0x38
+#define LAN8814_EEE_STATE_MASK2P5P		BIT(10)
+
 /* Represents 1ppm adjustment in 2^32 format with
  * each nsec contains 4 clock cycles.
  * The value is calculated as following: (1/1000000)/((2^-32)/4)
@@ -3288,6 +3291,19 @@  static int lan8814_release_coma_mode(struct phy_device *phydev)
 	return 0;
 }
 
+static void lan8814_clear_2psp_bit(struct phy_device *phydev)
+{
+	u16 val;
+
+	/* It was noticed that when traffic is passing through the PHY and the
+	 * cable is removed then the LED was still one even though there is no
+	 * link
+	 */
+	val = lanphy_read_page_reg(phydev, 2, LAN8814_EEE_STATE);
+	val &= ~LAN8814_EEE_STATE_MASK2P5P;
+	lanphy_write_page_reg(phydev, 2, LAN8814_EEE_STATE, val);
+}
+
 static int lan8814_probe(struct phy_device *phydev)
 {
 	const struct kszphy_type *type = phydev->drv->driver_data;
@@ -3324,6 +3340,9 @@  static int lan8814_probe(struct phy_device *phydev)
 
 	lan8814_ptp_init(phydev);
 
+	/* Errata workarounds */
+	lan8814_clear_2psp_bit(phydev);
+
 	return 0;
 }