2
0

716-v6.9-08-net-phy-qcom-move-common-qca808x-LED-define-to-share.patch 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. From ee9d9807bee0e6af8ca2a4db6f0d1dc0e5b41f44 Mon Sep 17 00:00:00 2001
  2. From: Christian Marangi <[email protected]>
  3. Date: Tue, 6 Feb 2024 18:31:11 +0100
  4. Subject: [PATCH 08/10] net: phy: qcom: move common qca808x LED define to
  5. shared header
  6. The LED implementation of qca808x and qca807x is the same but qca807x
  7. supports also Fiber port and have different hw control bits for Fiber
  8. port.
  9. In preparation for qca807x introduction, move all the common define to
  10. shared header.
  11. Signed-off-by: Christian Marangi <[email protected]>
  12. Reviewed-by: Andrew Lunn <[email protected]>
  13. Signed-off-by: David S. Miller <[email protected]>
  14. ---
  15. drivers/net/phy/qcom/qca808x.c | 65 ----------------------------------
  16. drivers/net/phy/qcom/qcom.h | 65 ++++++++++++++++++++++++++++++++++
  17. 2 files changed, 65 insertions(+), 65 deletions(-)
  18. --- a/drivers/net/phy/qcom/qca808x.c
  19. +++ b/drivers/net/phy/qcom/qca808x.c
  20. @@ -62,29 +62,6 @@
  21. #define QCA808X_DBG_AN_TEST 0xb
  22. #define QCA808X_HIBERNATION_EN BIT(15)
  23. -#define QCA808X_MMD7_LED_GLOBAL 0x8073
  24. -#define QCA808X_LED_BLINK_1 GENMASK(11, 6)
  25. -#define QCA808X_LED_BLINK_2 GENMASK(5, 0)
  26. -/* Values are the same for both BLINK_1 and BLINK_2 */
  27. -#define QCA808X_LED_BLINK_FREQ_MASK GENMASK(5, 3)
  28. -#define QCA808X_LED_BLINK_FREQ_2HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x0)
  29. -#define QCA808X_LED_BLINK_FREQ_4HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x1)
  30. -#define QCA808X_LED_BLINK_FREQ_8HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x2)
  31. -#define QCA808X_LED_BLINK_FREQ_16HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x3)
  32. -#define QCA808X_LED_BLINK_FREQ_32HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x4)
  33. -#define QCA808X_LED_BLINK_FREQ_64HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x5)
  34. -#define QCA808X_LED_BLINK_FREQ_128HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x6)
  35. -#define QCA808X_LED_BLINK_FREQ_256HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x7)
  36. -#define QCA808X_LED_BLINK_DUTY_MASK GENMASK(2, 0)
  37. -#define QCA808X_LED_BLINK_DUTY_50_50 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x0)
  38. -#define QCA808X_LED_BLINK_DUTY_75_25 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x1)
  39. -#define QCA808X_LED_BLINK_DUTY_25_75 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x2)
  40. -#define QCA808X_LED_BLINK_DUTY_33_67 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x3)
  41. -#define QCA808X_LED_BLINK_DUTY_67_33 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x4)
  42. -#define QCA808X_LED_BLINK_DUTY_17_83 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x5)
  43. -#define QCA808X_LED_BLINK_DUTY_83_17 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x6)
  44. -#define QCA808X_LED_BLINK_DUTY_8_92 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x7)
  45. -
  46. #define QCA808X_MMD7_LED2_CTRL 0x8074
  47. #define QCA808X_MMD7_LED2_FORCE_CTRL 0x8075
  48. #define QCA808X_MMD7_LED1_CTRL 0x8076
  49. @@ -92,51 +69,9 @@
  50. #define QCA808X_MMD7_LED0_CTRL 0x8078
  51. #define QCA808X_MMD7_LED_CTRL(x) (0x8078 - ((x) * 2))
  52. -/* LED hw control pattern is the same for every LED */
  53. -#define QCA808X_LED_PATTERN_MASK GENMASK(15, 0)
  54. -#define QCA808X_LED_SPEED2500_ON BIT(15)
  55. -#define QCA808X_LED_SPEED2500_BLINK BIT(14)
  56. -/* Follow blink trigger even if duplex or speed condition doesn't match */
  57. -#define QCA808X_LED_BLINK_CHECK_BYPASS BIT(13)
  58. -#define QCA808X_LED_FULL_DUPLEX_ON BIT(12)
  59. -#define QCA808X_LED_HALF_DUPLEX_ON BIT(11)
  60. -#define QCA808X_LED_TX_BLINK BIT(10)
  61. -#define QCA808X_LED_RX_BLINK BIT(9)
  62. -#define QCA808X_LED_TX_ON_10MS BIT(8)
  63. -#define QCA808X_LED_RX_ON_10MS BIT(7)
  64. -#define QCA808X_LED_SPEED1000_ON BIT(6)
  65. -#define QCA808X_LED_SPEED100_ON BIT(5)
  66. -#define QCA808X_LED_SPEED10_ON BIT(4)
  67. -#define QCA808X_LED_COLLISION_BLINK BIT(3)
  68. -#define QCA808X_LED_SPEED1000_BLINK BIT(2)
  69. -#define QCA808X_LED_SPEED100_BLINK BIT(1)
  70. -#define QCA808X_LED_SPEED10_BLINK BIT(0)
  71. -
  72. #define QCA808X_MMD7_LED0_FORCE_CTRL 0x8079
  73. #define QCA808X_MMD7_LED_FORCE_CTRL(x) (0x8079 - ((x) * 2))
  74. -/* LED force ctrl is the same for every LED
  75. - * No documentation exist for this, not even internal one
  76. - * with NDA as QCOM gives only info about configuring
  77. - * hw control pattern rules and doesn't indicate any way
  78. - * to force the LED to specific mode.
  79. - * These define comes from reverse and testing and maybe
  80. - * lack of some info or some info are not entirely correct.
  81. - * For the basic LED control and hw control these finding
  82. - * are enough to support LED control in all the required APIs.
  83. - *
  84. - * On doing some comparison with implementation with qca807x,
  85. - * it was found that it's 1:1 equal to it and confirms all the
  86. - * reverse done. It was also found further specification with the
  87. - * force mode and the blink modes.
  88. - */
  89. -#define QCA808X_LED_FORCE_EN BIT(15)
  90. -#define QCA808X_LED_FORCE_MODE_MASK GENMASK(14, 13)
  91. -#define QCA808X_LED_FORCE_BLINK_1 FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x3)
  92. -#define QCA808X_LED_FORCE_BLINK_2 FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x2)
  93. -#define QCA808X_LED_FORCE_ON FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x1)
  94. -#define QCA808X_LED_FORCE_OFF FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x0)
  95. -
  96. #define QCA808X_MMD7_LED_POLARITY_CTRL 0x901a
  97. /* QSDK sets by default 0x46 to this reg that sets BIT 6 for
  98. * LED to active high. It's not clear what BIT 3 and BIT 4 does.
  99. --- a/drivers/net/phy/qcom/qcom.h
  100. +++ b/drivers/net/phy/qcom/qcom.h
  101. @@ -103,6 +103,71 @@
  102. /* Added for reference of existence but should be handled by wait_for_completion already */
  103. #define QCA808X_CDT_STATUS_STAT_BUSY (BIT(1) | BIT(3))
  104. +#define QCA808X_MMD7_LED_GLOBAL 0x8073
  105. +#define QCA808X_LED_BLINK_1 GENMASK(11, 6)
  106. +#define QCA808X_LED_BLINK_2 GENMASK(5, 0)
  107. +/* Values are the same for both BLINK_1 and BLINK_2 */
  108. +#define QCA808X_LED_BLINK_FREQ_MASK GENMASK(5, 3)
  109. +#define QCA808X_LED_BLINK_FREQ_2HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x0)
  110. +#define QCA808X_LED_BLINK_FREQ_4HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x1)
  111. +#define QCA808X_LED_BLINK_FREQ_8HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x2)
  112. +#define QCA808X_LED_BLINK_FREQ_16HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x3)
  113. +#define QCA808X_LED_BLINK_FREQ_32HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x4)
  114. +#define QCA808X_LED_BLINK_FREQ_64HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x5)
  115. +#define QCA808X_LED_BLINK_FREQ_128HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x6)
  116. +#define QCA808X_LED_BLINK_FREQ_256HZ FIELD_PREP(QCA808X_LED_BLINK_FREQ_MASK, 0x7)
  117. +#define QCA808X_LED_BLINK_DUTY_MASK GENMASK(2, 0)
  118. +#define QCA808X_LED_BLINK_DUTY_50_50 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x0)
  119. +#define QCA808X_LED_BLINK_DUTY_75_25 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x1)
  120. +#define QCA808X_LED_BLINK_DUTY_25_75 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x2)
  121. +#define QCA808X_LED_BLINK_DUTY_33_67 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x3)
  122. +#define QCA808X_LED_BLINK_DUTY_67_33 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x4)
  123. +#define QCA808X_LED_BLINK_DUTY_17_83 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x5)
  124. +#define QCA808X_LED_BLINK_DUTY_83_17 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x6)
  125. +#define QCA808X_LED_BLINK_DUTY_8_92 FIELD_PREP(QCA808X_LED_BLINK_DUTY_MASK, 0x7)
  126. +
  127. +/* LED hw control pattern is the same for every LED */
  128. +#define QCA808X_LED_PATTERN_MASK GENMASK(15, 0)
  129. +#define QCA808X_LED_SPEED2500_ON BIT(15)
  130. +#define QCA808X_LED_SPEED2500_BLINK BIT(14)
  131. +/* Follow blink trigger even if duplex or speed condition doesn't match */
  132. +#define QCA808X_LED_BLINK_CHECK_BYPASS BIT(13)
  133. +#define QCA808X_LED_FULL_DUPLEX_ON BIT(12)
  134. +#define QCA808X_LED_HALF_DUPLEX_ON BIT(11)
  135. +#define QCA808X_LED_TX_BLINK BIT(10)
  136. +#define QCA808X_LED_RX_BLINK BIT(9)
  137. +#define QCA808X_LED_TX_ON_10MS BIT(8)
  138. +#define QCA808X_LED_RX_ON_10MS BIT(7)
  139. +#define QCA808X_LED_SPEED1000_ON BIT(6)
  140. +#define QCA808X_LED_SPEED100_ON BIT(5)
  141. +#define QCA808X_LED_SPEED10_ON BIT(4)
  142. +#define QCA808X_LED_COLLISION_BLINK BIT(3)
  143. +#define QCA808X_LED_SPEED1000_BLINK BIT(2)
  144. +#define QCA808X_LED_SPEED100_BLINK BIT(1)
  145. +#define QCA808X_LED_SPEED10_BLINK BIT(0)
  146. +
  147. +/* LED force ctrl is the same for every LED
  148. + * No documentation exist for this, not even internal one
  149. + * with NDA as QCOM gives only info about configuring
  150. + * hw control pattern rules and doesn't indicate any way
  151. + * to force the LED to specific mode.
  152. + * These define comes from reverse and testing and maybe
  153. + * lack of some info or some info are not entirely correct.
  154. + * For the basic LED control and hw control these finding
  155. + * are enough to support LED control in all the required APIs.
  156. + *
  157. + * On doing some comparison with implementation with qca807x,
  158. + * it was found that it's 1:1 equal to it and confirms all the
  159. + * reverse done. It was also found further specification with the
  160. + * force mode and the blink modes.
  161. + */
  162. +#define QCA808X_LED_FORCE_EN BIT(15)
  163. +#define QCA808X_LED_FORCE_MODE_MASK GENMASK(14, 13)
  164. +#define QCA808X_LED_FORCE_BLINK_1 FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x3)
  165. +#define QCA808X_LED_FORCE_BLINK_2 FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x2)
  166. +#define QCA808X_LED_FORCE_ON FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x1)
  167. +#define QCA808X_LED_FORCE_OFF FIELD_PREP(QCA808X_LED_FORCE_MODE_MASK, 0x0)
  168. +
  169. #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
  170. #define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B
  171. #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A