diff mbox series

[net-next,2/2] net: phy: micrel: lan8814 cable improvement errata

Message ID 20240228062813.1007138-3-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: 957 this patch: 957
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: 957 this patch: 957
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 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-02-28--09-00 (tests: 881)

Commit Message

Horatiu Vultur Feb. 28, 2024, 6:28 a.m. UTC
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(+)

Comments

Wojciech Drewek Feb. 28, 2024, 10:03 a.m. UTC | #1
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)
Horatiu Vultur Feb. 28, 2024, 2:02 p.m. UTC | #2
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)
diff mbox series

Patch

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)