History

Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clk fixes from Stephen Boyd: "One core framework fix to walk the orphan list and match up clks to parents when clk providers register the DT provider after registering all their clks (as they should). Then a handful of driver fixes for the qcom, imx, and at91 drivers. The driver fixes are relatively small fixes for incorrect register settings or missing locks causing race conditions" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: qcom: Avoid SMMU/cx gdsc corner cases clk: qcom: gcc-sc7180: Fix setting flag for votable GDSCs clk: Move clk_core_reparent_orphans() under CONFIG_OF clk: at91: fix possible deadlock clk: walk orphan list on clock provider registration clk: imx: pll14xx: fix clk_pll14xx_wait_lock clk: imx: clk-imx7ulp: Add missing sentinel of ulp_div_table clk: imx: clk-composite-8m: add lock to gate/mux

Linus Torvalds committed 6 years ago

Commit 12ac9a02 parents f1fd161 781d8ce12 files · +56 −31Browse files

Unified · Split

12 files
  1. drivers/clk/at91/at91sam9260.c +1 −1
  2. drivers/clk/at91/at91sam9rl.c +1 −1
  3. drivers/clk/at91/at91sam9x5.c +1 −1
  4. drivers/clk/at91/pmc.c +1 −1
  5. drivers/clk/at91/sama5d2.c +1 −1
  6. drivers/clk/at91/sama5d4.c +1 −1
  7. drivers/clk/clk.c +40 −22
  8. drivers/clk/imx/clk-composite-8m.c +2 −0
  9. drivers/clk/imx/clk-imx7ulp.c +1 −0
  10. drivers/clk/imx/clk-pll14xx.c +1 −1
  11. drivers/clk/qcom/gcc-sc7180.c +4 −2
  12. drivers/clk/qcom/gpucc-msm8998.c +2 −0
drivers/clk/at91/at91sam9260.c+1−1
@@ -348,7 +348,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, · 347 unmodified lines
348348 return;
349349 mainxtal_name = of_clk_get_parent_name(np, i);
350350
351− regmap = syscon_node_to_regmap(np);
351+ regmap = device_node_to_regmap(np);
352352 if (IS_ERR(regmap))
353353 return;
354354
drivers/clk/at91/at91sam9rl.c+1−1
@@ -83,7 +83,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) · 82 unmodified lines
8383 return;
8484 mainxtal_name = of_clk_get_parent_name(np, i);
8585
86− regmap = syscon_node_to_regmap(np);
86+ regmap = device_node_to_regmap(np);
8787 if (IS_ERR(regmap))
8888 return;
8989
drivers/clk/at91/at91sam9x5.c+1−1
@@ -146,7 +146,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, · 145 unmodified lines
146146 return;
147147 mainxtal_name = of_clk_get_parent_name(np, i);
148148
149− regmap = syscon_node_to_regmap(np);
149+ regmap = device_node_to_regmap(np);
150150 if (IS_ERR(regmap))
151151 return;
152152
drivers/clk/at91/pmc.c+1−1
@@ -275,7 +275,7 @@ static int __init pmc_register_ops(void) · 274 unmodified lines
275275
276276 np = of_find_matching_node(NULL, sama5d2_pmc_dt_ids);
277277
278− pmcreg = syscon_node_to_regmap(np);
278+ pmcreg = device_node_to_regmap(np);
279279 if (IS_ERR(pmcreg))
280280 return PTR_ERR(pmcreg);
281281
drivers/clk/at91/sama5d2.c+1−1
@@ -162,7 +162,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) · 161 unmodified lines
162162 return;
163163 mainxtal_name = of_clk_get_parent_name(np, i);
164164
165− regmap = syscon_node_to_regmap(np);
165+ regmap = device_node_to_regmap(np);
166166 if (IS_ERR(regmap))
167167 return;
168168
drivers/clk/at91/sama5d4.c+1−1
@@ -136,7 +136,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) · 135 unmodified lines
136136 return;
137137 mainxtal_name = of_clk_get_parent_name(np, i);
138138
139− regmap = syscon_node_to_regmap(np);
139+ regmap = device_node_to_regmap(np);
140140 if (IS_ERR(regmap))
141141 return;
142142
drivers/clk/clk.c+40−22
@@ -3249,6 +3249,34 @@ static inline void clk_debug_unregister(struct clk_core *core) · 3248 unmodified lines
32493249 }
32503250 #endif
32513251
3252+static void clk_core_reparent_orphans_nolock(void)
3253+{
3254+ struct clk_core *orphan;
3255+ struct hlist_node *tmp2;
3256+
3257+ /*
3258+ * walk the list of orphan clocks and reparent any that newly finds a
3259+ * parent.
3260+ */
3261+ hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) {
3262+ struct clk_core *parent = __clk_init_parent(orphan);
3263+
3264+ /*
3265+ * We need to use __clk_set_parent_before() and _after() to
3266+ * to properly migrate any prepare/enable count of the orphan
3267+ * clock. This is important for CLK_IS_CRITICAL clocks, which
3268+ * are enabled during init but might not have a parent yet.
3269+ */
3270+ if (parent) {
3271+ /* update the clk tree topology */
3272+ __clk_set_parent_before(orphan, parent);
3273+ __clk_set_parent_after(orphan, parent, NULL);
3274+ __clk_recalc_accuracies(orphan);
3275+ __clk_recalc_rates(orphan, 0);
3276+ }
3277+ }
3278+}
3279+
32523280 /**
32533281 * __clk_core_init - initialize the data structures in a struct clk_core
32543282 * @core: clk_core being initialized
@@ -3259,8 +3287,6 @@ static inline void clk_debug_unregister(struct clk_core *core) · 4 unmodified lines
32593287 static int __clk_core_init(struct clk_core *core)
32603288 {
32613289 int ret;
3262− struct clk_core *orphan;
3263− struct hlist_node *tmp2;
32643290 unsigned long rate;
32653291
32663292 if (!core)
@@ -3407,27 +3433,8 @@ static int __clk_core_init(struct clk_core *core) · 140 unmodified lines
34073433 clk_enable_unlock(flags);
34083434 }
34093435
3410− /*
3411− * walk the list of orphan clocks and reparent any that newly finds a
3412− * parent.
3413− */
3414− hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) {
3415− struct clk_core *parent = __clk_init_parent(orphan);
3436+ clk_core_reparent_orphans_nolock();
34163437
3417− /*
3418− * We need to use __clk_set_parent_before() and _after() to
3419− * to properly migrate any prepare/enable count of the orphan
3420− * clock. This is important for CLK_IS_CRITICAL clocks, which
3421− * are enabled during init but might not have a parent yet.
3422− */
3423− if (parent) {
3424− /* update the clk tree topology */
3425− __clk_set_parent_before(orphan, parent);
3426− __clk_set_parent_after(orphan, parent, NULL);
3427− __clk_recalc_accuracies(orphan);
3428− __clk_recalc_rates(orphan, 0);
3429− }
3430− }
34313438
34323439 kref_init(&core->ref);
34333440 out:
@@ -4179,6 +4186,13 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) · 745 unmodified lines
41794186 EXPORT_SYMBOL_GPL(clk_notifier_unregister);
41804187
41814188 #ifdef CONFIG_OF
4189+static void clk_core_reparent_orphans(void)
4190+{
4191+ clk_prepare_lock();
4192+ clk_core_reparent_orphans_nolock();
4193+ clk_prepare_unlock();
4194+}
4195+
41824196 /**
41834197 * struct of_clk_provider - Clock provider registration structure
41844198 * @link: Entry in global list of clock providers
@@ -4274,6 +4288,8 @@ int of_clk_add_provider(struct device_node *np, · 89 unmodified lines
42744288 mutex_unlock(&of_clk_mutex);
42754289 pr_debug("Added clock from %pOF\n", np);
42764290
4291+ clk_core_reparent_orphans();
4292+
42774293 ret = of_clk_set_defaults(np, true);
42784294 if (ret < 0)
42794295 of_clk_del_provider(np);
@@ -4309,6 +4325,8 @@ int of_clk_add_hw_provider(struct device_node *np, · 29 unmodified lines
43094325 mutex_unlock(&of_clk_mutex);
43104326 pr_debug("Added clk_hw provider from %pOF\n", np);
43114327
4328+ clk_core_reparent_orphans();
4329+
43124330 ret = of_clk_set_defaults(np, true);
43134331 if (ret < 0)
43144332 of_clk_del_provider(np);
drivers/clk/imx/clk-composite-8m.c+2−0
@@ -142,6 +142,7 @@ struct clk *imx8m_clk_composite_flags(const char *name, · 141 unmodified lines
142142 mux->reg = reg;
143143 mux->shift = PCG_PCS_SHIFT;
144144 mux->mask = PCG_PCS_MASK;
145+ mux->lock = &imx_ccm_lock;
145146
146147 div = kzalloc(sizeof(*div), GFP_KERNEL);
147148 if (!div)
@@ -161,6 +162,7 @@ struct clk *imx8m_clk_composite_flags(const char *name, · 13 unmodified lines
161162 gate_hw = &gate->hw;
162163 gate->reg = reg;
163164 gate->bit_idx = PCG_CGC_SHIFT;
165+ gate->lock = &imx_ccm_lock;
164166
165167 hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
166168 mux_hw, &clk_mux_ops, div_hw,
drivers/clk/imx/clk-imx7ulp.c+1−0
@@ -40,6 +40,7 @@ static const struct clk_div_table ulp_div_table[] = { · 39 unmodified lines
4040 { .val = 5, .div = 16, },
4141 { .val = 6, .div = 32, },
4242 { .val = 7, .div = 64, },
43+ { /* sentinel */ },
4344 };
4445
4546 static const int pcc2_uart_clk_ids[] __initconst = {
drivers/clk/imx/clk-pll14xx.c+1−1
@@ -159,7 +159,7 @@ static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll) · 158 unmodified lines
159159 {
160160 u32 val;
161161
162− return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US, 0,
162+ return readl_poll_timeout(pll->base, val, val & LOCK_STATUS, 0,
163163 LOCK_TIMEOUT_US);
164164 }
165165
drivers/clk/qcom/gcc-sc7180.c+4−2
@@ -2186,7 +2186,8 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = { · 2185 unmodified lines
21862186 .pd = {
21872187 .name = "hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc",
21882188 },
2189− .pwrsts = PWRSTS_OFF_ON | VOTABLE,
2189+ .pwrsts = PWRSTS_OFF_ON,
2190+ .flags = VOTABLE,
21902191 };
21912192
21922193 static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = {
@@ -2194,7 +2195,8 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = { · 1 unmodified line
21942195 .pd = {
21952196 .name = "hlos1_vote_mmnoc_mmu_tbu_sf_gdsc",
21962197 },
2197− .pwrsts = PWRSTS_OFF_ON | VOTABLE,
2198+ .pwrsts = PWRSTS_OFF_ON,
2199+ .flags = VOTABLE,
21982200 };
21992201
22002202 static struct gdsc *gcc_sc7180_gdscs[] = {
drivers/clk/qcom/gpucc-msm8998.c+2−0
@@ -242,10 +242,12 @@ static struct clk_branch gfx3d_isense_clk = { · 241 unmodified lines
242242
243243 static struct gdsc gpu_cx_gdsc = {
244244 .gdscr = 0x1004,
245+ .gds_hw_ctrl = 0x1008,
245246 .pd = {
246247 .name = "gpu_cx",
247248 },
248249 .pwrsts = PWRSTS_OFF_ON,
250+ .flags = VOTABLE,
249251 };
250252
251253 static struct gdsc gpu_gx_gdsc = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t