diff mbox series

net: phy: dp83869: fix default value for tx-/rx-internal-delay

Message ID 20230323102536.31988-1-josua@solid-run.com (mailing list archive)
State Accepted
Commit 82e2c39f9ef78896e9b634dfd82dc042e6956bb7
Delegated to: Netdev Maintainers
Headers show
Series net: phy: dp83869: fix default value for tx-/rx-internal-delay | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
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: 18 this patch: 18
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
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: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Josua Mayer March 23, 2023, 10:25 a.m. UTC
dp83869 internally uses a look-up table for mapping supported delays in
nanoseconds to register values.
When specific delays are defined in device-tree, phy_get_internal_delay
does the lookup automatically returning an index.

The default case wrongly assigns the nanoseconds value from the lookup
table, resulting in numeric value 2000 applied to delay configuration
register, rather than the expected index values 0-7 (7 for 2000).
Ultimately this issue broke RX for 1Gbps links.

Fix default delay configuration by assigning the intended index value
directly.

Co-developed-by: Yazan Shhady <yazan.shhady@solid-run.com>
Signed-off-by: Yazan Shhady <yazan.shhady@solid-run.com>
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 drivers/net/phy/dp83869.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Simon Horman March 23, 2023, 4:30 p.m. UTC | #1
On Thu, Mar 23, 2023 at 12:25:36PM +0200, Josua Mayer wrote:
> dp83869 internally uses a look-up table for mapping supported delays in
> nanoseconds to register values.
> When specific delays are defined in device-tree, phy_get_internal_delay
> does the lookup automatically returning an index.
> 
> The default case wrongly assigns the nanoseconds value from the lookup
> table, resulting in numeric value 2000 applied to delay configuration
> register, rather than the expected index values 0-7 (7 for 2000).
> Ultimately this issue broke RX for 1Gbps links.
> 
> Fix default delay configuration by assigning the intended index value
> directly.
> 
> Co-developed-by: Yazan Shhady <yazan.shhady@solid-run.com>
> Signed-off-by: Yazan Shhady <yazan.shhady@solid-run.com>
> Signed-off-by: Josua Mayer <josua@solid-run.com>

I wonder if this warrants:

Cc: stable@vger.kernel.org
736b25afe284 ("net: dp83869: Add RGMII internal delay configuration")

And being targeted at 'net' ([PATCH net] in subject).

In any case, the fix seems correct to me.

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> ---
>  drivers/net/phy/dp83869.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
> index b4ff9c5073a3c..9ab5eff502b71 100644
> --- a/drivers/net/phy/dp83869.c
> +++ b/drivers/net/phy/dp83869.c
> @@ -588,15 +588,13 @@ static int dp83869_of_init(struct phy_device *phydev)
>  						       &dp83869_internal_delay[0],
>  						       delay_size, true);
>  	if (dp83869->rx_int_delay < 0)
> -		dp83869->rx_int_delay =
> -				dp83869_internal_delay[DP83869_CLK_DELAY_DEF];
> +		dp83869->rx_int_delay = DP83869_CLK_DELAY_DEF;
>  
>  	dp83869->tx_int_delay = phy_get_internal_delay(phydev, dev,
>  						       &dp83869_internal_delay[0],
>  						       delay_size, false);
>  	if (dp83869->tx_int_delay < 0)
> -		dp83869->tx_int_delay =
> -				dp83869_internal_delay[DP83869_CLK_DELAY_DEF];
> +		dp83869->tx_int_delay = DP83869_CLK_DELAY_DEF;
>  
>  	return ret;
>  }
> -- 
> 2.35.3
>
patchwork-bot+netdevbpf@kernel.org March 24, 2023, 10 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 23 Mar 2023 12:25:36 +0200 you wrote:
> dp83869 internally uses a look-up table for mapping supported delays in
> nanoseconds to register values.
> When specific delays are defined in device-tree, phy_get_internal_delay
> does the lookup automatically returning an index.
> 
> The default case wrongly assigns the nanoseconds value from the lookup
> table, resulting in numeric value 2000 applied to delay configuration
> register, rather than the expected index values 0-7 (7 for 2000).
> Ultimately this issue broke RX for 1Gbps links.
> 
> [...]

Here is the summary with links:
  - net: phy: dp83869: fix default value for tx-/rx-internal-delay
    https://git.kernel.org/netdev/net/c/82e2c39f9ef7

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
index b4ff9c5073a3c..9ab5eff502b71 100644
--- a/drivers/net/phy/dp83869.c
+++ b/drivers/net/phy/dp83869.c
@@ -588,15 +588,13 @@  static int dp83869_of_init(struct phy_device *phydev)
 						       &dp83869_internal_delay[0],
 						       delay_size, true);
 	if (dp83869->rx_int_delay < 0)
-		dp83869->rx_int_delay =
-				dp83869_internal_delay[DP83869_CLK_DELAY_DEF];
+		dp83869->rx_int_delay = DP83869_CLK_DELAY_DEF;
 
 	dp83869->tx_int_delay = phy_get_internal_delay(phydev, dev,
 						       &dp83869_internal_delay[0],
 						       delay_size, false);
 	if (dp83869->tx_int_delay < 0)
-		dp83869->tx_int_delay =
-				dp83869_internal_delay[DP83869_CLK_DELAY_DEF];
+		dp83869->tx_int_delay = DP83869_CLK_DELAY_DEF;
 
 	return ret;
 }