706-v6.6-05-net-phy-at803x-remove-qca8081-1G-fast-retrain-and-sl.patch 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. From df9401ff3e6eeaa42bfb06761967f1b71f5afce7 Mon Sep 17 00:00:00 2001
  2. From: Luo Jie <[email protected]>
  3. Date: Sun, 16 Jul 2023 16:49:23 +0800
  4. Subject: [PATCH 5/6] net: phy: at803x: remove qca8081 1G fast retrain and
  5. slave seed config
  6. The fast retrain and slave seed configs are only applicable when the 2.5G
  7. ability is supported.
  8. Signed-off-by: Luo Jie <[email protected]>
  9. Reviewed-by: Andrew Lunn <[email protected]>
  10. Signed-off-by: David S. Miller <[email protected]>
  11. ---
  12. drivers/net/phy/at803x.c | 50 +++++++++++++++++++++++++---------------
  13. 1 file changed, 32 insertions(+), 18 deletions(-)
  14. --- a/drivers/net/phy/at803x.c
  15. +++ b/drivers/net/phy/at803x.c
  16. @@ -1755,6 +1755,11 @@ static bool qca808x_is_prefer_master(str
  17. (phydev->master_slave_get == MASTER_SLAVE_CFG_MASTER_PREFERRED);
  18. }
  19. +static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev)
  20. +{
  21. + return linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
  22. +}
  23. +
  24. static int qca808x_config_init(struct phy_device *phydev)
  25. {
  26. int ret;
  27. @@ -1771,20 +1776,24 @@ static int qca808x_config_init(struct ph
  28. if (ret)
  29. return ret;
  30. - /* Config the fast retrain for the link 2500M */
  31. - ret = qca808x_phy_fast_retrain_config(phydev);
  32. - if (ret)
  33. - return ret;
  34. -
  35. - ret = genphy_read_master_slave(phydev);
  36. - if (ret < 0)
  37. - return ret;
  38. -
  39. - if (!qca808x_is_prefer_master(phydev)) {
  40. - /* Enable seed and configure lower ramdom seed to make phy linked as slave mode */
  41. - ret = qca808x_phy_ms_seed_enable(phydev, true);
  42. + if (qca808x_has_fast_retrain_or_slave_seed(phydev)) {
  43. + /* Config the fast retrain for the link 2500M */
  44. + ret = qca808x_phy_fast_retrain_config(phydev);
  45. if (ret)
  46. return ret;
  47. +
  48. + ret = genphy_read_master_slave(phydev);
  49. + if (ret < 0)
  50. + return ret;
  51. +
  52. + if (!qca808x_is_prefer_master(phydev)) {
  53. + /* Enable seed and configure lower ramdom seed to make phy
  54. + * linked as slave mode.
  55. + */
  56. + ret = qca808x_phy_ms_seed_enable(phydev, true);
  57. + if (ret)
  58. + return ret;
  59. + }
  60. }
  61. /* Configure adc threshold as 100mv for the link 10M */
  62. @@ -1826,11 +1835,13 @@ static int qca808x_read_status(struct ph
  63. * value is configured as the same value, the link can't be up and no link change
  64. * occurs.
  65. */
  66. - if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR ||
  67. - qca808x_is_prefer_master(phydev)) {
  68. - qca808x_phy_ms_seed_enable(phydev, false);
  69. - } else {
  70. - qca808x_phy_ms_seed_enable(phydev, true);
  71. + if (qca808x_has_fast_retrain_or_slave_seed(phydev)) {
  72. + if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR ||
  73. + qca808x_is_prefer_master(phydev)) {
  74. + qca808x_phy_ms_seed_enable(phydev, false);
  75. + } else {
  76. + qca808x_phy_ms_seed_enable(phydev, true);
  77. + }
  78. }
  79. }
  80. @@ -1845,7 +1856,10 @@ static int qca808x_soft_reset(struct phy
  81. if (ret < 0)
  82. return ret;
  83. - return qca808x_phy_ms_seed_enable(phydev, true);
  84. + if (qca808x_has_fast_retrain_or_slave_seed(phydev))
  85. + ret = qca808x_phy_ms_seed_enable(phydev, true);
  86. +
  87. + return ret;
  88. }
  89. static bool qca808x_cdt_fault_length_valid(int cdt_code)