net: phy: micrel: lan8814 erratas
Subsystems (3)
v2 cover net: phy: micrel: lan8814 erratas
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.
v1->v2:
- separate errates such that each errate has it's own function.
Horatiu Vultur (2):
net: phy: micrel: lan8814 led errata
net: phy: micrel: lan8814 cable improvement errata
drivers/net/phy/micrel.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
Signature · 1 line
2.34.1
PATCH v2 1/2 net: phy: micrel: lan8814 led errata
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.
--- drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/phy/micrel.c +19 -0
@@ -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 ; }
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 1/2] net: phy: micrel: lan8814 led errata
Quoted 9 lines · 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 <[email protected]>---
Thank you!
Quoted 47 lines
drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/net/phy/micrel.c +19
-0@@ -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 ; }
PATCH v2 2/2 net: phy: micrel: lan8814 cable improvement errata
In reply to Horatiu VulturWhen 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.
--- drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/phy/micrel.c +19 -0
@@ -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)
@@ -3304,6 +3308,20 @@ static void lan8814_clear_2psp_bit(struct phy_device *phydev)lanphy_write_page_reg (phydev,2 ,LAN8814_EEE_STATE , val); } +static void lan8814_update_meas_time (struct phy_device *phydev) +{ +u16 val; + +/* By setting the measure time to a value of 0xb this will allow cables +* longer than 100m to be used. This configuration can be used +* regardless of the mode of operation of the PHY +*/ + 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) {const struct kszphy_type *type = phydev->drv->driver_data;
@@ -3342,6 +3360,7 @@ static int lan8814_probe(struct phy_device *phydev)/* Errata workarounds */ lan8814_clear_2psp_bit (phydev); +lan8814_update_meas_time (phydev);return 0 ; }
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 2/2] net: phy: micrel: lan8814 cable improvement errata
Hi Horatiu,
Quoted 21 lines · 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 <[email protected]>--- drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/net/phy/micrel.c +0
-0
drivers/net/phy/micrel.c line 122
Quoted 6 lines
drivers/net/phy/micrel.c +3
-0@@ -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
nitpick: TIME_VAL macro is very generic if it can end with specific like TIME_VAL_100M or something similar will gives more readability.
Quoted 2 lines
drivers/net/phy/micrel.c +1
-0+
Re: [PATCH net-next v2 2/2] net: phy: micrel: lan8814 cable improvement errata
Quoted 1 line · The 03/01/2024 03:27, Arun Ramadoss - I17769 wrote:
Hi Horatiu,
Hi Arun,
Quoted 26 lines · Horatiu Vultur
Quoted 24 lines
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 <[email protected]>--- drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/net/phy/micrel.c +0
-0@@ -117,6 +117,10 @@#define LAN8814_EEE_STATE 0x38#define LAN8814_EEE_STATE_MASK2P5P BIT(10)
Quoted 6 lines
drivers/net/phy/micrel.c line 122
Quoted 3 lines
drivers/net/phy/micrel.c +3
-0+#define LAN8814_PD_CONTROLS 0x9d +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_ GENMASK(3, 0) +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_ 0xbnitpick:
TIME_VALmacro is very generic if it can end with specific likeTIME_VAL_100Mor something similar will gives more readability.
Actually I prefer to keep it like this the name if it is possible.. Because the VAL_ represents the value and MASK_ represents the mask value. Therefore the actual bits name of the register is LAN8814_PD_CONTROLS_PD_MEAS_TIME.
I am trying to have a naming convetion about how to define names in this file:
<TARGET>_<REG_NAME>_<REG_BITS_NAME>
In this way it way it is easier to find in the datasheet to what it refers to.
Quoted 3 lines
Quoted 3 lines
drivers/net/phy/micrel.c +1
-0+
Signature · 1 line
/Horatiu
Jakub Kicinski
maintainerRe: [PATCH net-next v2 2/2] net: phy: micrel: lan8814 cable improvement errata
Quoted 7 lines · On Fri, 1 Mar 2024 08:27:57 +0100 Horatiu Vultur - M31836 wrote:
Quoted 6 lines
drivers/net/phy/micrel.c line 122
Quoted 3 lines
drivers/net/phy/micrel.c +3
-0+#define LAN8814_PD_CONTROLS 0x9d +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_ GENMASK(3, 0) +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_ 0xbnitpick:
TIME_VALmacro is very generic if it can end with specific likeTIME_VAL_100Mor something similar will gives more readability.
Quoted 8 lines
Actually I prefer to keep it like this the name if it is possible.. Because the
VAL_represents the value andMASK_represents the mask value. Therefore the actual bits name of the register isLAN8814_PD_CONTROLS_PD_MEAS_TIME.I am trying to have a naming convetion about how to define names in this file:
<TARGET>_<REG_NAME>_<REG_BITS_NAME>
Why the trailing underscores, tho?
Re: [PATCH net-next v2 2/2] net: phy: micrel: lan8814 cable improvement errata
Quoted 14 lines · Jakub Kicinski
Quoted 12 lines · On Fri, 1 Mar 2024 08:27:57 +0100 Horatiu Vultur - M31836 wrote:
Quoted 6 lines
drivers/net/phy/micrel.c line 122
Quoted 3 lines
drivers/net/phy/micrel.c +3
-0+#define LAN8814_PD_CONTROLS 0x9d +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK_ GENMASK(3, 0) +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL_ 0xbnitpick:
TIME_VALmacro is very generic if it can end with specific likeTIME_VAL_100Mor something similar will gives more readability.Actually I prefer to keep it like this the name if it is possible.. Because the
VAL_represents the value andMASK_represents the mask value. Therefore the actual bits name of the register isLAN8814_PD_CONTROLS_PD_MEAS_TIME.
Quoted 5 lines
Quoted 3 lines
I am trying to have a naming convetion about how to define names in this file:
<TARGET>_<REG_NAME>_<REG_BITS_NAME>Why the trailing underscores, tho?
That is not really needed. I will update this in the next version.
Quoted 1 line
Signature · 1 line
/Horatiu
Re: [PATCH net-next v2 2/2] net: phy: micrel: lan8814 cable improvement errata
In reply to Horatiu VulturQuoted 7 lines · 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.
Quoted 6 lines
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 <[email protected]>---
Quoted 47 lines
drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/net/phy/micrel.c +19
-0@@ -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) @@ -3304,6 +3308,20 @@ static void lan8814_clear_2psp_bit(struct phy_device *phydev)lanphy_write_page_reg (phydev,2 ,LAN8814_EEE_STATE , val); } +static void lan8814_update_meas_time (struct phy_device *phydev) +{ +u16 val; + +/* By setting the measure time to a value of 0xb this will allow cables +* longer than 100m to be used. This configuration can be used +* regardless of the mode of operation of the PHY +*/ + 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) {const struct kszphy_type *type = phydev->drv->driver_data;@@ -3342,6 +3360,7 @@ static int lan8814_probe(struct phy_device *phydev)/* Errata workarounds */ lan8814_clear_2psp_bit (phydev); +lan8814_update_meas_time (phydev);return 0 ; }