1 From 999db52750c062708532e1357ea3942cc619794f 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
7 Our core PLLs are intended to be configured once and left alone. With
8 the SET_RATE_PARENT, asking to set the PLLD_DSI1 clock rate would
9 change PLLD just to get closer to the requested DSI clock, thus
10 changing PLLD_PER, the UART and ethernet PHY clock rates downstream of
11 it, and breaking ethernet.
13 We *do* want PLLH to change so that PLLH_AUX can be exactly the value
14 we want, though. Thus, we need to have a per-divider policy of
15 whether to pass rate changes up.
17 Signed-off-by: Eric Anholt <eric@anholt.net>
18 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
19 (cherry picked from commit 55486091bd1e1c5ed28c43c0d6b3392468a9adb5)
21 drivers/clk/bcm/clk-bcm2835.c | 42 ++++++++++++++++++++++++++++--------------
22 1 file changed, 28 insertions(+), 14 deletions(-)
24 --- a/drivers/clk/bcm/clk-bcm2835.c
25 +++ b/drivers/clk/bcm/clk-bcm2835.c
26 @@ -428,6 +428,7 @@ struct bcm2835_pll_divider_data {
33 struct bcm2835_clock_data {
34 @@ -1252,7 +1253,7 @@ bcm2835_register_pll_divider(struct bcm2
36 init.name = divider_name;
37 init.ops = &bcm2835_pll_divider_clk_ops;
38 - init.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED;
39 + init.flags = data->flags | CLK_IGNORE_UNUSED;
41 divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
43 @@ -1475,7 +1476,8 @@ static const struct bcm2835_clk_desc clk
44 .a2w_reg = A2W_PLLA_CORE,
45 .load_mask = CM_PLLA_LOADCORE,
46 .hold_mask = CM_PLLA_HOLDCORE,
47 - .fixed_divider = 1),
49 + .flags = CLK_SET_RATE_PARENT),
50 [BCM2835_PLLA_PER] = REGISTER_PLL_DIV(
53 @@ -1483,7 +1485,8 @@ static const struct bcm2835_clk_desc clk
54 .a2w_reg = A2W_PLLA_PER,
55 .load_mask = CM_PLLA_LOADPER,
56 .hold_mask = CM_PLLA_HOLDPER,
57 - .fixed_divider = 1),
59 + .flags = CLK_SET_RATE_PARENT),
60 [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV(
63 @@ -1499,7 +1502,8 @@ static const struct bcm2835_clk_desc clk
64 .a2w_reg = A2W_PLLA_CCP2,
65 .load_mask = CM_PLLA_LOADCCP2,
66 .hold_mask = CM_PLLA_HOLDCCP2,
67 - .fixed_divider = 1),
69 + .flags = CLK_SET_RATE_PARENT),
71 /* PLLB is used for the ARM's clock. */
72 [BCM2835_PLLB] = REGISTER_PLL(
73 @@ -1523,7 +1527,8 @@ static const struct bcm2835_clk_desc clk
74 .a2w_reg = A2W_PLLB_ARM,
75 .load_mask = CM_PLLB_LOADARM,
76 .hold_mask = CM_PLLB_HOLDARM,
77 - .fixed_divider = 1),
79 + .flags = CLK_SET_RATE_PARENT),
82 * PLLC is the core PLL, used to drive the core VPU clock.
83 @@ -1552,7 +1557,8 @@ static const struct bcm2835_clk_desc clk
84 .a2w_reg = A2W_PLLC_CORE0,
85 .load_mask = CM_PLLC_LOADCORE0,
86 .hold_mask = CM_PLLC_HOLDCORE0,
87 - .fixed_divider = 1),
89 + .flags = CLK_SET_RATE_PARENT),
90 [BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV(
93 @@ -1560,7 +1566,8 @@ static const struct bcm2835_clk_desc clk
94 .a2w_reg = A2W_PLLC_CORE1,
95 .load_mask = CM_PLLC_LOADCORE1,
96 .hold_mask = CM_PLLC_HOLDCORE1,
97 - .fixed_divider = 1),
99 + .flags = CLK_SET_RATE_PARENT),
100 [BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV(
101 .name = "pllc_core2",
102 .source_pll = "pllc",
103 @@ -1568,7 +1575,8 @@ static const struct bcm2835_clk_desc clk
104 .a2w_reg = A2W_PLLC_CORE2,
105 .load_mask = CM_PLLC_LOADCORE2,
106 .hold_mask = CM_PLLC_HOLDCORE2,
107 - .fixed_divider = 1),
108 + .fixed_divider = 1,
109 + .flags = CLK_SET_RATE_PARENT),
110 [BCM2835_PLLC_PER] = REGISTER_PLL_DIV(
112 .source_pll = "pllc",
113 @@ -1576,7 +1584,8 @@ static const struct bcm2835_clk_desc clk
114 .a2w_reg = A2W_PLLC_PER,
115 .load_mask = CM_PLLC_LOADPER,
116 .hold_mask = CM_PLLC_HOLDPER,
117 - .fixed_divider = 1),
118 + .fixed_divider = 1,
119 + .flags = CLK_SET_RATE_PARENT),
122 * PLLD is the display PLL, used to drive DSI display panels.
123 @@ -1605,7 +1614,8 @@ static const struct bcm2835_clk_desc clk
124 .a2w_reg = A2W_PLLD_CORE,
125 .load_mask = CM_PLLD_LOADCORE,
126 .hold_mask = CM_PLLD_HOLDCORE,
127 - .fixed_divider = 1),
128 + .fixed_divider = 1,
129 + .flags = CLK_SET_RATE_PARENT),
130 [BCM2835_PLLD_PER] = REGISTER_PLL_DIV(
132 .source_pll = "plld",
133 @@ -1613,7 +1623,8 @@ static const struct bcm2835_clk_desc clk
134 .a2w_reg = A2W_PLLD_PER,
135 .load_mask = CM_PLLD_LOADPER,
136 .hold_mask = CM_PLLD_HOLDPER,
137 - .fixed_divider = 1),
138 + .fixed_divider = 1,
139 + .flags = CLK_SET_RATE_PARENT),
140 [BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV(
142 .source_pll = "plld",
143 @@ -1658,7 +1669,8 @@ static const struct bcm2835_clk_desc clk
144 .a2w_reg = A2W_PLLH_RCAL,
145 .load_mask = CM_PLLH_LOADRCAL,
147 - .fixed_divider = 10),
148 + .fixed_divider = 10,
149 + .flags = CLK_SET_RATE_PARENT),
150 [BCM2835_PLLH_AUX] = REGISTER_PLL_DIV(
152 .source_pll = "pllh",
153 @@ -1666,7 +1678,8 @@ static const struct bcm2835_clk_desc clk
154 .a2w_reg = A2W_PLLH_AUX,
155 .load_mask = CM_PLLH_LOADAUX,
157 - .fixed_divider = 1),
158 + .fixed_divider = 1,
159 + .flags = CLK_SET_RATE_PARENT),
160 [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
162 .source_pll = "pllh",
163 @@ -1674,7 +1687,8 @@ static const struct bcm2835_clk_desc clk
164 .a2w_reg = A2W_PLLH_PIX,
165 .load_mask = CM_PLLH_LOADPIX,
167 - .fixed_divider = 10),
168 + .fixed_divider = 10,
169 + .flags = CLK_SET_RATE_PARENT),