netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: phy: micrel: lan8814 erratas
@ 2024-02-28  6:28 Horatiu Vultur
  2024-02-28  6:28 ` [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata Horatiu Vultur
  2024-02-28  6:28 ` [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata Horatiu Vultur
  0 siblings, 2 replies; 6+ messages in thread
From: Horatiu Vultur @ 2024-02-28  6:28 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, UNGLinuxDriver, Horatiu Vultur

Add two erratas for lan8814. First one fix the led which might
stay on even that there is no link. The second one improves increases
length of the cable that can be used when used in 1000Base-T.

Horatiu Vultur (2):
  net: phy: micrel: lan8814 led errata
  net: phy: micrel: lan8814 cable improvement errata

 drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata
  2024-02-28  6:28 [PATCH net-next 0/2] net: phy: micrel: lan8814 erratas Horatiu Vultur
@ 2024-02-28  6:28 ` Horatiu Vultur
  2024-02-28  9:58   ` Wojciech Drewek
  2024-02-28  6:28 ` [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata Horatiu Vultur
  1 sibling, 1 reply; 6+ messages in thread
From: Horatiu Vultur @ 2024-02-28  6:28 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, UNGLinuxDriver, Horatiu Vultur

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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 9b69735819896..5a0cc89eaebdd 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_errata_fixes(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;
@@ -3323,6 +3339,7 @@ static int lan8814_probe(struct phy_device *phydev)
 	}
 
 	lan8814_ptp_init(phydev);
+	lan8814_errata_fixes(phydev);
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata
  2024-02-28  6:28 [PATCH net-next 0/2] net: phy: micrel: lan8814 erratas Horatiu Vultur
  2024-02-28  6:28 ` [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata Horatiu Vultur
@ 2024-02-28  6:28 ` Horatiu Vultur
  2024-02-28 10:03   ` Wojciech Drewek
  1 sibling, 1 reply; 6+ messages in thread
From: Horatiu Vultur @ 2024-02-28  6:28 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, UNGLinuxDriver, Horatiu Vultur

When the length of the cable is more than 100m and the lan8814 is
configured to run in 1000Base-T Slave then the register of the device
needs to be optimized.

Workaround this by setting the measure time to a value of 0xb. This
value can be set regardless of the configuration.

This issue is described in 'LAN8814 Silicon Errata and Data Sheet
Clarification' and according to that, this will not be corrected in a
future silicon revision.

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

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 5a0cc89eaebdd..1e3b0436e161e 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -117,6 +117,10 @@
 #define LAN8814_EEE_STATE			0x38
 #define LAN8814_EEE_STATE_MASK2P5P		BIT(10)
 
+#define LAN8814_PD_CONTROLS			0x9d
+#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_	GENMASK(3, 0)
+#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_	0xb
+
 /* 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)
@@ -3302,6 +3306,12 @@ static void lan8814_errata_fixes(struct phy_device *phydev)
 	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);
+
+	/* Improve cable reach beyond 100m */
+	val = lanphy_read_page_reg(phydev, 1, LAN8814_PD_CONTROLS);
+	val &= ~LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_;
+	val |= LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_;
+	lanphy_write_page_reg(phydev, 1, LAN8814_PD_CONTROLS, val);
 }
 
 static int lan8814_probe(struct phy_device *phydev)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata
  2024-02-28  6:28 ` [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata Horatiu Vultur
@ 2024-02-28  9:58   ` Wojciech Drewek
  0 siblings, 0 replies; 6+ messages in thread
From: Wojciech Drewek @ 2024-02-28  9:58 UTC (permalink / raw)
  To: Horatiu Vultur, andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, UNGLinuxDriver



On 28.02.2024 07:28, 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>
> ---
>  drivers/net/phy/micrel.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 9b69735819896..5a0cc89eaebdd 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_errata_fixes(struct phy_device *phydev)

This name is too generic IMO.
Maybe: lan8814_clear_2psp_bit

> +{
> +	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;
> @@ -3323,6 +3339,7 @@ static int lan8814_probe(struct phy_device *phydev)
>  	}
>  
>  	lan8814_ptp_init(phydev);
> +	lan8814_errata_fixes(phydev);
>  
>  	return 0;
>  }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata
  2024-02-28  6:28 ` [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata Horatiu Vultur
@ 2024-02-28 10:03   ` Wojciech Drewek
  2024-02-28 14:02     ` Horatiu Vultur
  0 siblings, 1 reply; 6+ messages in thread
From: Wojciech Drewek @ 2024-02-28 10:03 UTC (permalink / raw)
  To: Horatiu Vultur, andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, UNGLinuxDriver



On 28.02.2024 07:28, Horatiu Vultur wrote:
> When the length of the cable is more than 100m and the lan8814 is
> configured to run in 1000Base-T Slave then the register of the device
> needs to be optimized.
> 
> Workaround this by setting the measure time to a value of 0xb. This
> value can be set regardless of the configuration.
> 
> This issue is described in 'LAN8814 Silicon Errata and Data Sheet
> Clarification' and according to that, this will not be corrected in a
> future silicon revision.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  drivers/net/phy/micrel.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 5a0cc89eaebdd..1e3b0436e161e 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -117,6 +117,10 @@
>  #define LAN8814_EEE_STATE			0x38
>  #define LAN8814_EEE_STATE_MASK2P5P		BIT(10)
>  
> +#define LAN8814_PD_CONTROLS			0x9d
> +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_	GENMASK(3, 0)
> +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_	0xb
> +
>  /* 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)
> @@ -3302,6 +3306,12 @@ static void lan8814_errata_fixes(struct phy_device *phydev)
>  	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);
> +
> +	/* Improve cable reach beyond 100m */
> +	val = lanphy_read_page_reg(phydev, 1, LAN8814_PD_CONTROLS);
> +	val &= ~LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_;
> +	val |= LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_;
> +	lanphy_write_page_reg(phydev, 1, LAN8814_PD_CONTROLS, val);

Ok, now I see that the second fix is also in lan8814_errata_fixes.
I'd suggest to split both fixes to separate functions and name them
in more descriptive way.

>  }
>  
>  static int lan8814_probe(struct phy_device *phydev)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata
  2024-02-28 10:03   ` Wojciech Drewek
@ 2024-02-28 14:02     ` Horatiu Vultur
  0 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2024-02-28 14:02 UTC (permalink / raw)
  To: Wojciech Drewek
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, UNGLinuxDriver

The 02/28/2024 11:03, Wojciech Drewek wrote:

Hi Wojciech,

> 
> On 28.02.2024 07:28, Horatiu Vultur wrote:
> > When the length of the cable is more than 100m and the lan8814 is
> > configured to run in 1000Base-T Slave then the register of the device
> > needs to be optimized.
> >
> > Workaround this by setting the measure time to a value of 0xb. This
> > value can be set regardless of the configuration.
> >
> > This issue is described in 'LAN8814 Silicon Errata and Data Sheet
> > Clarification' and according to that, this will not be corrected in a
> > future silicon revision.
> >
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> > ---
> >  drivers/net/phy/micrel.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> > index 5a0cc89eaebdd..1e3b0436e161e 100644
> > --- a/drivers/net/phy/micrel.c
> > +++ b/drivers/net/phy/micrel.c
> > @@ -117,6 +117,10 @@
> >  #define LAN8814_EEE_STATE                    0x38
> >  #define LAN8814_EEE_STATE_MASK2P5P           BIT(10)
> >
> > +#define LAN8814_PD_CONTROLS                  0x9d
> > +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_       GENMASK(3, 0)
> > +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_        0xb
> > +
> >  /* 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)
> > @@ -3302,6 +3306,12 @@ static void lan8814_errata_fixes(struct phy_device *phydev)
> >       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);
> > +
> > +     /* Improve cable reach beyond 100m */
> > +     val = lanphy_read_page_reg(phydev, 1, LAN8814_PD_CONTROLS);
> > +     val &= ~LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_;
> > +     val |= LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_;
> > +     lanphy_write_page_reg(phydev, 1, LAN8814_PD_CONTROLS, val);
> 
> Ok, now I see that the second fix is also in lan8814_errata_fixes.
> I'd suggest to split both fixes to separate functions and name them
> in more descriptive way.

Yes, I can do that. Then I will create a separate function for each
errata fix and I will do the same also for future erratas.

> 
> >  }
> >
> >  static int lan8814_probe(struct phy_device *phydev)

-- 
/Horatiu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-28 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28  6:28 [PATCH net-next 0/2] net: phy: micrel: lan8814 erratas Horatiu Vultur
2024-02-28  6:28 ` [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata Horatiu Vultur
2024-02-28  9:58   ` Wojciech Drewek
2024-02-28  6:28 ` [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata Horatiu Vultur
2024-02-28 10:03   ` Wojciech Drewek
2024-02-28 14:02     ` Horatiu Vultur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).