746-v5.16-04-net-phy-at803x-better-describe-debug-regs.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. From 67999555ff42e91de7654488d9a7735bd9e84555 Mon Sep 17 00:00:00 2001
  2. From: Ansuel Smith <[email protected]>
  3. Date: Sun, 10 Oct 2021 00:46:18 +0200
  4. Subject: net: phy: at803x: better describe debug regs
  5. Give a name to known debug regs from Documentation instead of using
  6. unknown hex values.
  7. Signed-off-by: Ansuel Smith <[email protected]>
  8. Reviewed-by: Andrew Lunn <[email protected]>
  9. Signed-off-by: David S. Miller <[email protected]>
  10. ---
  11. drivers/net/phy/at803x.c | 30 +++++++++++++++---------------
  12. 1 file changed, 15 insertions(+), 15 deletions(-)
  13. --- a/drivers/net/phy/at803x.c
  14. +++ b/drivers/net/phy/at803x.c
  15. @@ -86,12 +86,12 @@
  16. #define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
  17. #define AT803X_PSSR_MR_AN_COMPLETE 0x0200
  18. -#define AT803X_DEBUG_REG_0 0x00
  19. +#define AT803X_DEBUG_ANALOG_TEST_CTRL 0x00
  20. #define QCA8327_DEBUG_MANU_CTRL_EN BIT(2)
  21. #define QCA8337_DEBUG_MANU_CTRL_EN GENMASK(3, 2)
  22. #define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
  23. -#define AT803X_DEBUG_REG_5 0x05
  24. +#define AT803X_DEBUG_SYSTEM_CTRL_MODE 0x05
  25. #define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8)
  26. #define AT803X_DEBUG_REG_HIB_CTRL 0x0b
  27. @@ -100,7 +100,7 @@
  28. #define AT803X_DEBUG_REG_3C 0x3C
  29. -#define AT803X_DEBUG_REG_3D 0x3D
  30. +#define AT803X_DEBUG_REG_GREEN 0x3D
  31. #define AT803X_DEBUG_GATE_CLK_IN1000 BIT(6)
  32. #define AT803X_DEBUG_REG_1F 0x1F
  33. @@ -284,25 +284,25 @@ static int at803x_read_page(struct phy_d
  34. static int at803x_enable_rx_delay(struct phy_device *phydev)
  35. {
  36. - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0,
  37. + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0,
  38. AT803X_DEBUG_RX_CLK_DLY_EN);
  39. }
  40. static int at803x_enable_tx_delay(struct phy_device *phydev)
  41. {
  42. - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0,
  43. + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0,
  44. AT803X_DEBUG_TX_CLK_DLY_EN);
  45. }
  46. static int at803x_disable_rx_delay(struct phy_device *phydev)
  47. {
  48. - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
  49. + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
  50. AT803X_DEBUG_RX_CLK_DLY_EN, 0);
  51. }
  52. static int at803x_disable_tx_delay(struct phy_device *phydev)
  53. {
  54. - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5,
  55. + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE,
  56. AT803X_DEBUG_TX_CLK_DLY_EN, 0);
  57. }
  58. @@ -1300,9 +1300,9 @@ static int qca83xx_config_init(struct ph
  59. switch (switch_revision) {
  60. case 1:
  61. /* For 100M waveform */
  62. - at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_0, 0x02ea);
  63. + at803x_debug_reg_write(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0x02ea);
  64. /* Turn on Gigabit clock */
  65. - at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x68a0);
  66. + at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_GREEN, 0x68a0);
  67. break;
  68. case 2:
  69. @@ -1310,8 +1310,8 @@ static int qca83xx_config_init(struct ph
  70. fallthrough;
  71. case 4:
  72. phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_AZ_DEBUG, 0x803f);
  73. - at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x6860);
  74. - at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_5, 0x2c46);
  75. + at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_GREEN, 0x6860);
  76. + at803x_debug_reg_write(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0x2c46);
  77. at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3C, 0x6000);
  78. break;
  79. }
  80. @@ -1322,7 +1322,7 @@ static int qca83xx_config_init(struct ph
  81. */
  82. if (phydev->drv->phy_id == QCA8327_A_PHY_ID ||
  83. phydev->drv->phy_id == QCA8327_B_PHY_ID)
  84. - at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
  85. + at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
  86. QCA8327_DEBUG_MANU_CTRL_EN, 0);
  87. /* Following original QCA sourcecode set port to prefer master */
  88. @@ -1340,12 +1340,12 @@ static void qca83xx_link_change_notify(s
  89. /* Set DAC Amplitude adjustment to +6% for 100m on link running */
  90. if (phydev->state == PHY_RUNNING) {
  91. if (phydev->speed == SPEED_100)
  92. - at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
  93. + at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
  94. QCA8327_DEBUG_MANU_CTRL_EN,
  95. QCA8327_DEBUG_MANU_CTRL_EN);
  96. } else {
  97. /* Reset DAC Amplitude adjustment */
  98. - at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
  99. + at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
  100. QCA8327_DEBUG_MANU_CTRL_EN, 0);
  101. }
  102. }
  103. @@ -1392,7 +1392,7 @@ static int qca83xx_suspend(struct phy_de
  104. phy_modify(phydev, MII_BMCR, mask, 0);
  105. }
  106. - at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_3D,
  107. + at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_GREEN,
  108. AT803X_DEBUG_GATE_CLK_IN1000, 0);
  109. at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_HIB_CTRL,