0101-clk-qcom-gcc-ipq8074-rework-nss_port5-6-clock-to-mul.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. From f778553f296792f4d1e8b3552603ad6116ea3eb3 Mon Sep 17 00:00:00 2001
  2. From: Christian Marangi <[email protected]>
  3. Date: Thu, 3 Nov 2022 14:49:44 +0100
  4. Subject: [PATCH] clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple
  5. conf
  6. Rework nss_port5/6 to use the new multiple configuration implementation
  7. and correctly fix the clocks for these port under some corner case.
  8. This is particularly relevant for device that have 2.5G or 10G port
  9. connected to port5 or port 6 on ipq8074. As the parent are shared
  10. across multiple port it may be required to select the correct
  11. configuration to accomplish the desired clock. Without this patch such
  12. port doesn't work in some specific ethernet speed as the clock will be
  13. set to the wrong frequency as we just select the first configuration for
  14. the related frequency instead of selecting the best one.
  15. Tested-by: Robert Marko <[email protected]> # ipq8074 Qnap QHora-301W
  16. Signed-off-by: Christian Marangi <[email protected]>
  17. ---
  18. drivers/clk/qcom/gcc-ipq8074.c | 64 +++++++++++++++++++++++++---------
  19. 1 file changed, 48 insertions(+), 16 deletions(-)
  20. --- a/drivers/clk/qcom/gcc-ipq8074.c
  21. +++ b/drivers/clk/qcom/gcc-ipq8074.c
  22. @@ -1677,13 +1677,21 @@ static struct clk_regmap_div nss_port4_t
  23. },
  24. };
  25. +static const struct freq_conf ftbl_nss_port5_rx_clk_src_25[] = {
  26. + C(P_UNIPHY1_RX, 12.5, 0, 0),
  27. + C(P_UNIPHY0_RX, 5, 0, 0),
  28. +};
  29. +
  30. +static const struct freq_conf ftbl_nss_port5_rx_clk_src_125[] = {
  31. + C(P_UNIPHY1_RX, 2.5, 0, 0),
  32. + C(P_UNIPHY0_RX, 1, 0, 0),
  33. +};
  34. +
  35. static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] = {
  36. F(19200000, P_XO, 1, 0, 0),
  37. - F(25000000, P_UNIPHY1_RX, 12.5, 0, 0),
  38. - F(25000000, P_UNIPHY0_RX, 5, 0, 0),
  39. + FM(25000000, ftbl_nss_port5_rx_clk_src_25),
  40. F(78125000, P_UNIPHY1_RX, 4, 0, 0),
  41. - F(125000000, P_UNIPHY1_RX, 2.5, 0, 0),
  42. - F(125000000, P_UNIPHY0_RX, 1, 0, 0),
  43. + FM(125000000, ftbl_nss_port5_rx_clk_src_125),
  44. F(156250000, P_UNIPHY1_RX, 2, 0, 0),
  45. F(312500000, P_UNIPHY1_RX, 1, 0, 0),
  46. { }
  47. @@ -1739,13 +1747,21 @@ static struct clk_regmap_div nss_port5_r
  48. },
  49. };
  50. +static struct freq_conf ftbl_nss_port5_tx_clk_src_25[] = {
  51. + C(P_UNIPHY1_TX, 12.5, 0, 0),
  52. + C(P_UNIPHY0_TX, 5, 0, 0),
  53. +};
  54. +
  55. +static struct freq_conf ftbl_nss_port5_tx_clk_src_125[] = {
  56. + C(P_UNIPHY1_TX, 2.5, 0, 0),
  57. + C(P_UNIPHY0_TX, 1, 0, 0),
  58. +};
  59. +
  60. static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] = {
  61. F(19200000, P_XO, 1, 0, 0),
  62. - F(25000000, P_UNIPHY1_TX, 12.5, 0, 0),
  63. - F(25000000, P_UNIPHY0_TX, 5, 0, 0),
  64. + FM(25000000, ftbl_nss_port5_tx_clk_src_25),
  65. F(78125000, P_UNIPHY1_TX, 4, 0, 0),
  66. - F(125000000, P_UNIPHY1_TX, 2.5, 0, 0),
  67. - F(125000000, P_UNIPHY0_TX, 1, 0, 0),
  68. + FM(125000000, ftbl_nss_port5_tx_clk_src_125),
  69. F(156250000, P_UNIPHY1_TX, 2, 0, 0),
  70. F(312500000, P_UNIPHY1_TX, 1, 0, 0),
  71. { }
  72. @@ -1801,13 +1817,21 @@ static struct clk_regmap_div nss_port5_t
  73. },
  74. };
  75. +static struct freq_conf ftbl_nss_port6_rx_clk_src_25[] = {
  76. + C(P_UNIPHY2_RX, 5, 0, 0),
  77. + C(P_UNIPHY2_RX, 12.5, 0, 0),
  78. +};
  79. +
  80. +static struct freq_conf ftbl_nss_port6_rx_clk_src_125[] = {
  81. + C(P_UNIPHY2_RX, 1, 0, 0),
  82. + C(P_UNIPHY2_RX, 2.5, 0, 0),
  83. +};
  84. +
  85. static const struct freq_tbl ftbl_nss_port6_rx_clk_src[] = {
  86. F(19200000, P_XO, 1, 0, 0),
  87. - F(25000000, P_UNIPHY2_RX, 5, 0, 0),
  88. - F(25000000, P_UNIPHY2_RX, 12.5, 0, 0),
  89. + FM(25000000, ftbl_nss_port6_rx_clk_src_25),
  90. F(78125000, P_UNIPHY2_RX, 4, 0, 0),
  91. - F(125000000, P_UNIPHY2_RX, 1, 0, 0),
  92. - F(125000000, P_UNIPHY2_RX, 2.5, 0, 0),
  93. + FM(125000000, ftbl_nss_port6_rx_clk_src_125),
  94. F(156250000, P_UNIPHY2_RX, 2, 0, 0),
  95. F(312500000, P_UNIPHY2_RX, 1, 0, 0),
  96. { }
  97. @@ -1858,13 +1882,21 @@ static struct clk_regmap_div nss_port6_r
  98. },
  99. };
  100. +static struct freq_conf ftbl_nss_port6_tx_clk_src_25[] = {
  101. + C(P_UNIPHY2_TX, 5, 0, 0),
  102. + C(P_UNIPHY2_TX, 12.5, 0, 0),
  103. +};
  104. +
  105. +static struct freq_conf ftbl_nss_port6_tx_clk_src_125[] = {
  106. + C(P_UNIPHY2_TX, 1, 0, 0),
  107. + C(P_UNIPHY2_TX, 2.5, 0, 0),
  108. +};
  109. +
  110. static const struct freq_tbl ftbl_nss_port6_tx_clk_src[] = {
  111. F(19200000, P_XO, 1, 0, 0),
  112. - F(25000000, P_UNIPHY2_TX, 5, 0, 0),
  113. - F(25000000, P_UNIPHY2_TX, 12.5, 0, 0),
  114. + FM(25000000, ftbl_nss_port6_tx_clk_src_25),
  115. F(78125000, P_UNIPHY2_TX, 4, 0, 0),
  116. - F(125000000, P_UNIPHY2_TX, 1, 0, 0),
  117. - F(125000000, P_UNIPHY2_TX, 2.5, 0, 0),
  118. + FM(125000000, ftbl_nss_port6_tx_clk_src_125),
  119. F(156250000, P_UNIPHY2_TX, 2, 0, 0),
  120. F(312500000, P_UNIPHY2_TX, 1, 0, 0),
  121. { }