net/phy: fix DP83865 10 Mbps HDX loopback disable function
Subsystems (3)
PATCH 1/1 net/phy: fix DP83865 10 Mbps HDX loopback disable function
According to the DP83865 datasheet "The 10 Mbps HDX loopback can be disabled in the expanded memory register 0x1C0.1." The driver erroneously used bit 0 instead of bit 1.
--- drivers/net/phy/national.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/phy/national.c +5 -2
@@ -110,11 +110,14 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)static void ns_10_base_t_hdx_loopack (struct phy_device *phydev,int disable) { +u16 lb_dis =1 <<1 ; +if (disable) -ns_exp_write (phydev,0x1c0 ,ns_exp_read (phydev,0x1c0 ) |1 ); +ns_exp_write (phydev,0x1c0 , +ns_exp_read (phydev,0x1c0 ) | lb_dis);else ns_exp_write (phydev,0x1c0 , -ns_exp_read (phydev,0x1c0 ) &0xfffe ); +ns_exp_read (phydev,0x1c0 ) & ~lb_dis);pr_debug ("10BASE-T HDX loopback %s\n" , (ns_exp_read (phydev,0x1c0 ) &0x0001 ) ?"off" :"on" );
Signature · 1 line
2.23.0
Andrew Lunn
maintainerQuoted 14 lines · Peter Mamonov
According to the DP83865 datasheet "The 10 Mbps HDX loopback can be disabled in the expanded memory register 0x1C0.1." The driver erroneously used bit 0 instead of bit 1.
Signed-off-by Peter Mamonov <[email protected]>--- drivers/net/phy/national.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/phy/national.c +0
-0
drivers/net/phy/national.c static void ns_giga_speed_fallback(struct phy_device *phydev, int mode) · line 113
Quoted 4 lines
drivers/net/phy/national.c +1
-0@@ -110,11 +110,14 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)static void ns_10_base_t_hdx_loopack (struct phy_device *phydev,int disable) { +u16 lb_dis =1 <<1 ;
Hi Peter
Please use the BIT() macro.
drivers/net/phy/national.c static void ns_giga_speed_fallback(struct phy_device *phydev, int mode) · line 123
Quoted 12 lines
drivers/net/phy/national.c +4
-2+if (disable) -ns_exp_write (phydev,0x1c0 ,ns_exp_read (phydev,0x1c0 ) |1 ); +ns_exp_write (phydev,0x1c0 , +ns_exp_read (phydev,0x1c0 ) | lb_dis);else ns_exp_write (phydev,0x1c0 , -ns_exp_read (phydev,0x1c0 ) &0xfffe ); +ns_exp_read (phydev,0x1c0 ) & ~lb_dis);pr_debug ("10BASE-T HDX loopback %s\n" , (ns_exp_read (phydev,0x1c0 ) &0x0001 ) ?"off" :"on" );
Isn't this also wrong?
Andrew
PATCH 1/1 net/phy: fix DP83865 10 Mbps HDX loopback disable function
According to the DP83865 datasheet "The 10 Mbps HDX loopback can be disabled in the expanded memory register 0x1C0.1." The driver erroneously used bit 0 instead of bit 1.
--- drivers/net/phy/national.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/phy/national.c +6 -3
@@ -110,14 +110,17 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)static void ns_10_base_t_hdx_loopack (struct phy_device *phydev,int disable) { +u16 lb_dis =BIT (1 ); +if (disable) -ns_exp_write (phydev,0x1c0 ,ns_exp_read (phydev,0x1c0 ) |1 ); +ns_exp_write (phydev,0x1c0 , +ns_exp_read (phydev,0x1c0 ) | lb_dis);else ns_exp_write (phydev,0x1c0 , -ns_exp_read (phydev,0x1c0 ) &0xfffe ); +ns_exp_read (phydev,0x1c0 ) & ~lb_dis);pr_debug ("10BASE-T HDX loopback %s\n" , - (ns_exp_read (phydev,0x1c0 ) &0x0001 ) ?"off" :"on" ); + (ns_exp_read (phydev,0x1c0 ) & lb_dis) ?"off" :"on" ); }static int ns_config_init (struct phy_device *phydev)
Signature · 1 line
2.23.0
Andrew Lunn
maintainerQuoted 3 lines · Peter Mamonov
According to the DP83865 datasheet "The 10 Mbps HDX loopback can be disabled in the expanded memory register 0x1C0.1." The driver erroneously used bit 0 instead of bit 1.
Hi Peter
This is version 2, not 1. Or if you want to start counting from 0, it would be good to put v0 in your first patch :-)
It is also normal to put in the commit message what changed from the previous version.
This is a fix. So please add a Fixes: tag, with the hash of the commit which introduced the problem.
And since this is a fix, it should be against DaveM net tree, and you indicate this in the subject line with [PATCH net v3].
Thanks
Andrew
Quoted 34 lines
Signed-off-by Peter Mamonov <[email protected]>--- drivers/net/phy/national.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/net/phy/national.c +6
-3@@ -110,14 +110,17 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)static void ns_10_base_t_hdx_loopack (struct phy_device *phydev,int disable) { +u16 lb_dis =BIT (1 ); +if (disable) -ns_exp_write (phydev,0x1c0 ,ns_exp_read (phydev,0x1c0 ) |1 ); +ns_exp_write (phydev,0x1c0 , +ns_exp_read (phydev,0x1c0 ) | lb_dis);else ns_exp_write (phydev,0x1c0 , -ns_exp_read (phydev,0x1c0 ) &0xfffe ); +ns_exp_read (phydev,0x1c0 ) & ~lb_dis);pr_debug ("10BASE-T HDX loopback %s\n" , - (ns_exp_read (phydev,0x1c0 ) &0x0001 ) ?"off" :"on" ); + (ns_exp_read (phydev,0x1c0 ) & lb_dis) ?"off" :"on" ); }static int ns_config_init (struct phy_device *phydev)Signature · 1 line
2.23.0
Hi Andrew,
Quoted 10 lines · Andrew Lunn
Quoted 3 lines · Peter Mamonov
According to the DP83865 datasheet "The 10 Mbps HDX loopback can be disabled in the expanded memory register 0x1C0.1." The driver erroneously used bit 0 instead of bit 1.
Hi Peter
This is version 2, not 1. Or if you want to start counting from 0, it would be good to put v0 in your first patch :-)
Quoted 8 lines
It is also normal to put in the commit message what changed from the previous version.
This is a fix. So please add a Fixes: tag, with the hash of the commit which introduced the problem.
And since this is a fix, it should be against DaveM net tree, and you indicate this in the subject line with [PATCH net v3].
Thanks for the tips! Will submit new version soon.
Regards,
Peter
Quoted 38 lines
Thanks
AndrewQuoted 34 lines
Signed-off-by Peter Mamonov <[email protected]>--- drivers/net/phy/national.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/net/phy/national.c +6
-3@@ -110,14 +110,17 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)static void ns_10_base_t_hdx_loopack (struct phy_device *phydev,int disable) { +u16 lb_dis =BIT (1 ); +if (disable) -ns_exp_write (phydev,0x1c0 ,ns_exp_read (phydev,0x1c0 ) |1 ); +ns_exp_write (phydev,0x1c0 , +ns_exp_read (phydev,0x1c0 ) | lb_dis);else ns_exp_write (phydev,0x1c0 , -ns_exp_read (phydev,0x1c0 ) &0xfffe ); +ns_exp_read (phydev,0x1c0 ) & ~lb_dis);pr_debug ("10BASE-T HDX loopback %s\n" , - (ns_exp_read (phydev,0x1c0 ) &0x0001 ) ?"off" :"on" ); + (ns_exp_read (phydev,0x1c0 ) & lb_dis) ?"off" :"on" ); }static int ns_config_init (struct phy_device *phydev)Signature · 1 line
2.23.0