Skip to content

Commit 9b1f2cb

Browse files
committed
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk fixes from Stephen Boyd: "Some more clk driver fixes and one core framework fix: - A handful of TI driver fixes for bad of_node_put() and incorrect parent names - Rockchip rk3228 aclk_gpu* creation was interfering with lima GPU work so we use a composite clk now - Resuming from suspend on Tegra Jetson TK1 was broken because an audio PLL calculated an incorrect rate - A fix for devicetree probing on IM-PD1 by actually specifying a clk name which is required to pass clk registration - Avoid list corruption if registration fails for a critical clk" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: ti: clkctrl: convert subclocks to use proper names also clk: ti: am33xx: fix RTC clock parent clk: ti: clkctrl: Fix Bad of_node_put within clkctrl_get_name clk: tegra: Fix initial rate for pll_a on Tegra124 clk: impd1: Look up clock-output-names clk: Unlink clock if failed to prepare or enable clk: rockchip: fix incorrect configuration of rk3228 aclk_gpu* clocks
2 parents fb27bc0 + 8520495 commit 9b1f2cb

File tree

6 files changed

+58
-66
lines changed

6 files changed

+58
-66
lines changed

drivers/clk/clk.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,6 +3519,9 @@ static int __clk_core_init(struct clk_core *core)
35193519
out:
35203520
clk_pm_runtime_put(core);
35213521
unlock:
3522+
if (ret)
3523+
hlist_del_init(&core->child_node);
3524+
35223525
clk_prepare_unlock();
35233526

35243527
if (!ret)

drivers/clk/rockchip/clk-rk3228.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ PNAME(mux_i2s_out_p) = { "i2s1_pre", "xin12m" };
156156
PNAME(mux_i2s2_p) = { "i2s2_src", "i2s2_frac", "xin12m" };
157157
PNAME(mux_sclk_spdif_p) = { "sclk_spdif_src", "spdif_frac", "xin12m" };
158158

159-
PNAME(mux_aclk_gpu_pre_p) = { "cpll_gpu", "gpll_gpu", "hdmiphy_gpu", "usb480m_gpu" };
160-
161159
PNAME(mux_uart0_p) = { "uart0_src", "uart0_frac", "xin24m" };
162160
PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" };
163161
PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" };
@@ -468,16 +466,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
468466
RK2928_CLKSEL_CON(24), 6, 10, DFLAGS,
469467
RK2928_CLKGATE_CON(2), 8, GFLAGS),
470468

471-
GATE(0, "cpll_gpu", "cpll", 0,
472-
RK2928_CLKGATE_CON(3), 13, GFLAGS),
473-
GATE(0, "gpll_gpu", "gpll", 0,
474-
RK2928_CLKGATE_CON(3), 13, GFLAGS),
475-
GATE(0, "hdmiphy_gpu", "hdmiphy", 0,
476-
RK2928_CLKGATE_CON(3), 13, GFLAGS),
477-
GATE(0, "usb480m_gpu", "usb480m", 0,
469+
COMPOSITE(0, "aclk_gpu_pre", mux_pll_src_4plls_p, 0,
470+
RK2928_CLKSEL_CON(34), 5, 2, MFLAGS, 0, 5, DFLAGS,
478471
RK2928_CLKGATE_CON(3), 13, GFLAGS),
479-
COMPOSITE_NOGATE(0, "aclk_gpu_pre", mux_aclk_gpu_pre_p, 0,
480-
RK2928_CLKSEL_CON(34), 5, 2, MFLAGS, 0, 5, DFLAGS),
481472

482473
COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_2plls_p, 0,
483474
RK2928_CLKSEL_CON(25), 8, 1, MFLAGS, 0, 7, DFLAGS,
@@ -582,8 +573,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
582573
GATE(0, "pclk_peri_noc", "pclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(12), 2, GFLAGS),
583574

584575
/* PD_GPU */
585-
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(13), 14, GFLAGS),
586-
GATE(0, "aclk_gpu_noc", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(13), 15, GFLAGS),
576+
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(7), 14, GFLAGS),
577+
GATE(0, "aclk_gpu_noc", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(7), 15, GFLAGS),
587578

588579
/* PD_BUS */
589580
GATE(0, "sclk_initmem_mbist", "aclk_cpu", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),

drivers/clk/tegra/clk-tegra124.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ static struct tegra_clk_init_table common_init_table[] __initdata = {
12921292
{ TEGRA124_CLK_UARTB, TEGRA124_CLK_PLL_P, 408000000, 0 },
12931293
{ TEGRA124_CLK_UARTC, TEGRA124_CLK_PLL_P, 408000000, 0 },
12941294
{ TEGRA124_CLK_UARTD, TEGRA124_CLK_PLL_P, 408000000, 0 },
1295-
{ TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 564480000, 0 },
1295+
{ TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 282240000, 0 },
12961296
{ TEGRA124_CLK_PLL_A_OUT0, TEGRA124_CLK_CLK_MAX, 11289600, 0 },
12971297
{ TEGRA124_CLK_I2S0, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0 },
12981298
{ TEGRA124_CLK_I2S1, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0 },

drivers/clk/ti/clk-33xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static const struct omap_clkctrl_reg_data am3_mpu_clkctrl_regs[] __initconst = {
212212
};
213213

214214
static const struct omap_clkctrl_reg_data am3_l4_rtc_clkctrl_regs[] __initconst = {
215-
{ AM3_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk_32768_ck" },
215+
{ AM3_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk-24mhz-clkctrl:0000:0" },
216216
{ 0 },
217217
};
218218

drivers/clk/ti/clkctrl.c

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -255,24 +255,53 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
255255
return entry->clk;
256256
}
257257

258+
/* Get clkctrl clock base name based on clkctrl_name or dts node */
259+
static const char * __init clkctrl_get_clock_name(struct device_node *np,
260+
const char *clkctrl_name,
261+
int offset, int index,
262+
bool legacy_naming)
263+
{
264+
char *clock_name;
265+
266+
/* l4per-clkctrl:1234:0 style naming based on clkctrl_name */
267+
if (clkctrl_name && !legacy_naming) {
268+
clock_name = kasprintf(GFP_KERNEL, "%s-clkctrl:%04x:%d",
269+
clkctrl_name, offset, index);
270+
strreplace(clock_name, '_', '-');
271+
272+
return clock_name;
273+
}
274+
275+
/* l4per:1234:0 old style naming based on clkctrl_name */
276+
if (clkctrl_name)
277+
return kasprintf(GFP_KERNEL, "%s_cm:clk:%04x:%d",
278+
clkctrl_name, offset, index);
279+
280+
/* l4per_cm:1234:0 old style naming based on parent node name */
281+
if (legacy_naming)
282+
return kasprintf(GFP_KERNEL, "%pOFn:clk:%04x:%d",
283+
np->parent, offset, index);
284+
285+
/* l4per-clkctrl:1234:0 style naming based on node name */
286+
return kasprintf(GFP_KERNEL, "%pOFn:%04x:%d", np, offset, index);
287+
}
288+
258289
static int __init
259290
_ti_clkctrl_clk_register(struct omap_clkctrl_provider *provider,
260291
struct device_node *node, struct clk_hw *clk_hw,
261292
u16 offset, u8 bit, const char * const *parents,
262-
int num_parents, const struct clk_ops *ops)
293+
int num_parents, const struct clk_ops *ops,
294+
const char *clkctrl_name)
263295
{
264296
struct clk_init_data init = { NULL };
265297
struct clk *clk;
266298
struct omap_clkctrl_clk *clkctrl_clk;
267299
int ret = 0;
268300

269-
if (ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT)
270-
init.name = kasprintf(GFP_KERNEL, "%pOFn:%pOFn:%04x:%d",
271-
node->parent, node, offset,
272-
bit);
273-
else
274-
init.name = kasprintf(GFP_KERNEL, "%pOFn:%04x:%d", node,
275-
offset, bit);
301+
init.name = clkctrl_get_clock_name(node, clkctrl_name, offset, bit,
302+
ti_clk_get_features()->flags &
303+
TI_CLK_CLKCTRL_COMPAT);
304+
276305
clkctrl_clk = kzalloc(sizeof(*clkctrl_clk), GFP_KERNEL);
277306
if (!init.name || !clkctrl_clk) {
278307
ret = -ENOMEM;
@@ -309,7 +338,7 @@ static void __init
309338
_ti_clkctrl_setup_gate(struct omap_clkctrl_provider *provider,
310339
struct device_node *node, u16 offset,
311340
const struct omap_clkctrl_bit_data *data,
312-
void __iomem *reg)
341+
void __iomem *reg, const char *clkctrl_name)
313342
{
314343
struct clk_hw_omap *clk_hw;
315344

@@ -322,15 +351,15 @@ _ti_clkctrl_setup_gate(struct omap_clkctrl_provider *provider,
322351

323352
if (_ti_clkctrl_clk_register(provider, node, &clk_hw->hw, offset,
324353
data->bit, data->parents, 1,
325-
&omap_gate_clk_ops))
354+
&omap_gate_clk_ops, clkctrl_name))
326355
kfree(clk_hw);
327356
}
328357

329358
static void __init
330359
_ti_clkctrl_setup_mux(struct omap_clkctrl_provider *provider,
331360
struct device_node *node, u16 offset,
332361
const struct omap_clkctrl_bit_data *data,
333-
void __iomem *reg)
362+
void __iomem *reg, const char *clkctrl_name)
334363
{
335364
struct clk_omap_mux *mux;
336365
int num_parents = 0;
@@ -357,15 +386,15 @@ _ti_clkctrl_setup_mux(struct omap_clkctrl_provider *provider,
357386

358387
if (_ti_clkctrl_clk_register(provider, node, &mux->hw, offset,
359388
data->bit, data->parents, num_parents,
360-
&ti_clk_mux_ops))
389+
&ti_clk_mux_ops, clkctrl_name))
361390
kfree(mux);
362391
}
363392

364393
static void __init
365394
_ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
366395
struct device_node *node, u16 offset,
367396
const struct omap_clkctrl_bit_data *data,
368-
void __iomem *reg)
397+
void __iomem *reg, const char *clkctrl_name)
369398
{
370399
struct clk_omap_divider *div;
371400
const struct omap_clkctrl_div_data *div_data = data->data;
@@ -393,15 +422,15 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
393422

394423
if (_ti_clkctrl_clk_register(provider, node, &div->hw, offset,
395424
data->bit, data->parents, 1,
396-
&ti_clk_divider_ops))
425+
&ti_clk_divider_ops, clkctrl_name))
397426
kfree(div);
398427
}
399428

400429
static void __init
401430
_ti_clkctrl_setup_subclks(struct omap_clkctrl_provider *provider,
402431
struct device_node *node,
403432
const struct omap_clkctrl_reg_data *data,
404-
void __iomem *reg)
433+
void __iomem *reg, const char *clkctrl_name)
405434
{
406435
const struct omap_clkctrl_bit_data *bits = data->bit_data;
407436

@@ -412,17 +441,17 @@ _ti_clkctrl_setup_subclks(struct omap_clkctrl_provider *provider,
412441
switch (bits->type) {
413442
case TI_CLK_GATE:
414443
_ti_clkctrl_setup_gate(provider, node, data->offset,
415-
bits, reg);
444+
bits, reg, clkctrl_name);
416445
break;
417446

418447
case TI_CLK_DIVIDER:
419448
_ti_clkctrl_setup_div(provider, node, data->offset,
420-
bits, reg);
449+
bits, reg, clkctrl_name);
421450
break;
422451

423452
case TI_CLK_MUX:
424453
_ti_clkctrl_setup_mux(provider, node, data->offset,
425-
bits, reg);
454+
bits, reg, clkctrl_name);
426455
break;
427456

428457
default:
@@ -461,42 +490,10 @@ static char * __init clkctrl_get_name(struct device_node *np)
461490
return name;
462491
}
463492
}
464-
of_node_put(np);
465493

466494
return NULL;
467495
}
468496

469-
/* Get clkctrl clock base name based on clkctrl_name or dts node */
470-
static const char * __init clkctrl_get_clock_name(struct device_node *np,
471-
const char *clkctrl_name,
472-
int offset, int index,
473-
bool legacy_naming)
474-
{
475-
char *clock_name;
476-
477-
/* l4per-clkctrl:1234:0 style naming based on clkctrl_name */
478-
if (clkctrl_name && !legacy_naming) {
479-
clock_name = kasprintf(GFP_KERNEL, "%s-clkctrl:%04x:%d",
480-
clkctrl_name, offset, index);
481-
strreplace(clock_name, '_', '-');
482-
483-
return clock_name;
484-
}
485-
486-
/* l4per:1234:0 old style naming based on clkctrl_name */
487-
if (clkctrl_name)
488-
return kasprintf(GFP_KERNEL, "%s_cm:clk:%04x:%d",
489-
clkctrl_name, offset, index);
490-
491-
/* l4per_cm:1234:0 old style naming based on parent node name */
492-
if (legacy_naming)
493-
return kasprintf(GFP_KERNEL, "%pOFn:clk:%04x:%d",
494-
np->parent, offset, index);
495-
496-
/* l4per-clkctrl:1234:0 style naming based on node name */
497-
return kasprintf(GFP_KERNEL, "%pOFn:%04x:%d", np, offset, index);
498-
}
499-
500497
static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
501498
{
502499
struct omap_clkctrl_provider *provider;
@@ -664,7 +661,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
664661
hw->enable_reg.ptr = provider->base + reg_data->offset;
665662

666663
_ti_clkctrl_setup_subclks(provider, node, reg_data,
667-
hw->enable_reg.ptr);
664+
hw->enable_reg.ptr, clkctrl_name);
668665

669666
if (reg_data->flags & CLKF_SW_SUP)
670667
hw->enable_bit = MODULEMODE_SWCTRL;

drivers/clk/versatile/clk-impd1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ static int integrator_impd1_clk_spawn(struct device *dev,
206206
return -ENODEV;
207207
}
208208

209+
of_property_read_string(np, "clock-output-names", &name);
209210
parent_name = of_clk_get_parent_name(np, 0);
210211
clk = icst_clk_setup(NULL, desc, name, parent_name, map,
211212
ICST_INTEGRATOR_IM_PD1);

0 commit comments

Comments
 (0)