0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. From c08886564938df6796a7d98495cf5cc3f7a09337 Mon Sep 17 00:00:00 2001
  2. From: Eric Anholt <eric@anholt.net>
  3. Date: Wed, 18 Jan 2017 07:31:55 +1100
  4. Subject: [PATCH] clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL
  5. dividers (v2).
  6. Our core PLLs are intended to be configured once and left alone. With
  7. the SET_RATE_PARENT, asking to set the PLLD_DSI1 clock rate would
  8. change PLLD just to get closer to the requested DSI clock, thus
  9. changing PLLD_PER, the UART and ethernet PHY clock rates downstream of
  10. it, and breaking ethernet.
  11. We *do* want PLLH to change so that PLLH_AUX can be exactly the value
  12. we want, though. Thus, we need to have a per-divider policy of
  13. whether to pass rate changes up.
  14. Signed-off-by: Eric Anholt <eric@anholt.net>
  15. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  16. (cherry picked from commit 55486091bd1e1c5ed28c43c0d6b3392468a9adb5)
  17. ---
  18. drivers/clk/bcm/clk-bcm2835.c | 42 ++++++++++++++++++++++++++++--------------
  19. 1 file changed, 28 insertions(+), 14 deletions(-)
  20. --- a/drivers/clk/bcm/clk-bcm2835.c
  21. +++ b/drivers/clk/bcm/clk-bcm2835.c
  22. @@ -449,6 +449,7 @@ struct bcm2835_pll_divider_data {
  23. u32 load_mask;
  24. u32 hold_mask;
  25. u32 fixed_divider;
  26. + u32 flags;
  27. };
  28. struct bcm2835_clock_data {
  29. @@ -1292,7 +1293,7 @@ bcm2835_register_pll_divider(struct bcm2
  30. init.num_parents = 1;
  31. init.name = divider_name;
  32. init.ops = &bcm2835_pll_divider_clk_ops;
  33. - init.flags = CLK_IGNORE_UNUSED;
  34. + init.flags = data->flags | CLK_IGNORE_UNUSED;
  35. divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
  36. if (!divider)
  37. @@ -1531,7 +1532,8 @@ static const struct bcm2835_clk_desc clk
  38. .a2w_reg = A2W_PLLA_CORE,
  39. .load_mask = CM_PLLA_LOADCORE,
  40. .hold_mask = CM_PLLA_HOLDCORE,
  41. - .fixed_divider = 1),
  42. + .fixed_divider = 1,
  43. + .flags = CLK_SET_RATE_PARENT),
  44. [BCM2835_PLLA_PER] = REGISTER_PLL_DIV(
  45. .name = "plla_per",
  46. .source_pll = "plla",
  47. @@ -1539,7 +1541,8 @@ static const struct bcm2835_clk_desc clk
  48. .a2w_reg = A2W_PLLA_PER,
  49. .load_mask = CM_PLLA_LOADPER,
  50. .hold_mask = CM_PLLA_HOLDPER,
  51. - .fixed_divider = 1),
  52. + .fixed_divider = 1,
  53. + .flags = CLK_SET_RATE_PARENT),
  54. [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV(
  55. .name = "plla_dsi0",
  56. .source_pll = "plla",
  57. @@ -1555,7 +1558,8 @@ static const struct bcm2835_clk_desc clk
  58. .a2w_reg = A2W_PLLA_CCP2,
  59. .load_mask = CM_PLLA_LOADCCP2,
  60. .hold_mask = CM_PLLA_HOLDCCP2,
  61. - .fixed_divider = 1),
  62. + .fixed_divider = 1,
  63. + .flags = CLK_SET_RATE_PARENT),
  64. /* PLLB is used for the ARM's clock. */
  65. [BCM2835_PLLB] = REGISTER_PLL(
  66. @@ -1579,7 +1583,8 @@ static const struct bcm2835_clk_desc clk
  67. .a2w_reg = A2W_PLLB_ARM,
  68. .load_mask = CM_PLLB_LOADARM,
  69. .hold_mask = CM_PLLB_HOLDARM,
  70. - .fixed_divider = 1),
  71. + .fixed_divider = 1,
  72. + .flags = CLK_SET_RATE_PARENT),
  73. /*
  74. * PLLC is the core PLL, used to drive the core VPU clock.
  75. @@ -1608,7 +1613,8 @@ static const struct bcm2835_clk_desc clk
  76. .a2w_reg = A2W_PLLC_CORE0,
  77. .load_mask = CM_PLLC_LOADCORE0,
  78. .hold_mask = CM_PLLC_HOLDCORE0,
  79. - .fixed_divider = 1),
  80. + .fixed_divider = 1,
  81. + .flags = CLK_SET_RATE_PARENT),
  82. [BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV(
  83. .name = "pllc_core1",
  84. .source_pll = "pllc",
  85. @@ -1616,7 +1622,8 @@ static const struct bcm2835_clk_desc clk
  86. .a2w_reg = A2W_PLLC_CORE1,
  87. .load_mask = CM_PLLC_LOADCORE1,
  88. .hold_mask = CM_PLLC_HOLDCORE1,
  89. - .fixed_divider = 1),
  90. + .fixed_divider = 1,
  91. + .flags = CLK_SET_RATE_PARENT),
  92. [BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV(
  93. .name = "pllc_core2",
  94. .source_pll = "pllc",
  95. @@ -1624,7 +1631,8 @@ static const struct bcm2835_clk_desc clk
  96. .a2w_reg = A2W_PLLC_CORE2,
  97. .load_mask = CM_PLLC_LOADCORE2,
  98. .hold_mask = CM_PLLC_HOLDCORE2,
  99. - .fixed_divider = 1),
  100. + .fixed_divider = 1,
  101. + .flags = CLK_SET_RATE_PARENT),
  102. [BCM2835_PLLC_PER] = REGISTER_PLL_DIV(
  103. .name = "pllc_per",
  104. .source_pll = "pllc",
  105. @@ -1632,7 +1640,8 @@ static const struct bcm2835_clk_desc clk
  106. .a2w_reg = A2W_PLLC_PER,
  107. .load_mask = CM_PLLC_LOADPER,
  108. .hold_mask = CM_PLLC_HOLDPER,
  109. - .fixed_divider = 1),
  110. + .fixed_divider = 1,
  111. + .flags = CLK_SET_RATE_PARENT),
  112. /*
  113. * PLLD is the display PLL, used to drive DSI display panels.
  114. @@ -1661,7 +1670,8 @@ static const struct bcm2835_clk_desc clk
  115. .a2w_reg = A2W_PLLD_CORE,
  116. .load_mask = CM_PLLD_LOADCORE,
  117. .hold_mask = CM_PLLD_HOLDCORE,
  118. - .fixed_divider = 1),
  119. + .fixed_divider = 1,
  120. + .flags = CLK_SET_RATE_PARENT),
  121. [BCM2835_PLLD_PER] = REGISTER_PLL_DIV(
  122. .name = "plld_per",
  123. .source_pll = "plld",
  124. @@ -1669,7 +1679,8 @@ static const struct bcm2835_clk_desc clk
  125. .a2w_reg = A2W_PLLD_PER,
  126. .load_mask = CM_PLLD_LOADPER,
  127. .hold_mask = CM_PLLD_HOLDPER,
  128. - .fixed_divider = 1),
  129. + .fixed_divider = 1,
  130. + .flags = CLK_SET_RATE_PARENT),
  131. [BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV(
  132. .name = "plld_dsi0",
  133. .source_pll = "plld",
  134. @@ -1714,7 +1725,8 @@ static const struct bcm2835_clk_desc clk
  135. .a2w_reg = A2W_PLLH_RCAL,
  136. .load_mask = CM_PLLH_LOADRCAL,
  137. .hold_mask = 0,
  138. - .fixed_divider = 10),
  139. + .fixed_divider = 10,
  140. + .flags = CLK_SET_RATE_PARENT),
  141. [BCM2835_PLLH_AUX] = REGISTER_PLL_DIV(
  142. .name = "pllh_aux",
  143. .source_pll = "pllh",
  144. @@ -1722,7 +1734,8 @@ static const struct bcm2835_clk_desc clk
  145. .a2w_reg = A2W_PLLH_AUX,
  146. .load_mask = CM_PLLH_LOADAUX,
  147. .hold_mask = 0,
  148. - .fixed_divider = 1),
  149. + .fixed_divider = 1,
  150. + .flags = CLK_SET_RATE_PARENT),
  151. [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
  152. .name = "pllh_pix",
  153. .source_pll = "pllh",
  154. @@ -1730,7 +1743,8 @@ static const struct bcm2835_clk_desc clk
  155. .a2w_reg = A2W_PLLH_PIX,
  156. .load_mask = CM_PLLH_LOADPIX,
  157. .hold_mask = 0,
  158. - .fixed_divider = 10),
  159. + .fixed_divider = 10,
  160. + .flags = CLK_SET_RATE_PARENT),
  161. /* the clocks */