Skip to content

Commit 3e06191

Browse files
committed
Merge tag 'clk-imx-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx
Pull i.MX clock driver updates from Abel Vesa - Fix CLKOUT clocks on i.MX8MM and i.MX8MN by using imx_clk_hw_mux2 - Switch from .round_rate to .determine_rate in clk-divider-gate - Fix clock tree update for TF-A controlled clocks for all i.MX8M - Add missing M7 core clock for i.MX8MN * tag 'clk-imx-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux: clk: imx8mn: Add M7 core clock clk: imx8m: fix clock tree update of TF-A managed clocks clk: imx: clk-divider-gate: Switch to clk_divider.determine_rate clk: imx8mn: use correct mux type for clkout path clk: imx8mm: use correct mux type for clkout path
2 parents e73f0f0 + 86842d2 commit 3e06191

File tree

7 files changed

+45
-22
lines changed

7 files changed

+45
-22
lines changed

drivers/clk/imx/clk-composite-8m.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
216216
div->width = PCG_PREDIV_WIDTH;
217217
divider_ops = &imx8m_clk_composite_divider_ops;
218218
mux_ops = &clk_mux_ops;
219-
flags |= CLK_SET_PARENT_GATE;
219+
if (!(composite_flags & IMX_COMPOSITE_FW_MANAGED))
220+
flags |= CLK_SET_PARENT_GATE;
220221
}
221222

222223
div->lock = &imx_ccm_lock;

drivers/clk/imx/clk-divider-gate.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ static unsigned long clk_divider_gate_recalc_rate(struct clk_hw *hw,
6464
div->flags, div->width);
6565
}
6666

67-
static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
68-
unsigned long *prate)
67+
static int clk_divider_determine_rate(struct clk_hw *hw,
68+
struct clk_rate_request *req)
6969
{
70-
return clk_divider_ops.round_rate(hw, rate, prate);
70+
return clk_divider_ops.determine_rate(hw, req);
7171
}
7272

7373
static int clk_divider_gate_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -154,12 +154,12 @@ static int clk_divider_is_enabled(struct clk_hw *hw)
154154

155155
static const struct clk_ops clk_divider_gate_ro_ops = {
156156
.recalc_rate = clk_divider_gate_recalc_rate_ro,
157-
.round_rate = clk_divider_round_rate,
157+
.determine_rate = clk_divider_determine_rate,
158158
};
159159

160160
static const struct clk_ops clk_divider_gate_ops = {
161161
.recalc_rate = clk_divider_gate_recalc_rate,
162-
.round_rate = clk_divider_round_rate,
162+
.determine_rate = clk_divider_determine_rate,
163163
.set_rate = clk_divider_gate_set_rate,
164164
.enable = clk_divider_enable,
165165
.disable = clk_divider_disable,

drivers/clk/imx/clk-imx8mm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,10 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
407407
hws[IMX8MM_SYS_PLL2_500M] = imx_clk_hw_fixed_factor("sys_pll2_500m", "sys_pll2_500m_cg", 1, 2);
408408
hws[IMX8MM_SYS_PLL2_1000M] = imx_clk_hw_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
409409

410-
hws[IMX8MM_CLK_CLKOUT1_SEL] = imx_clk_hw_mux("clkout1_sel", base + 0x128, 4, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
410+
hws[IMX8MM_CLK_CLKOUT1_SEL] = imx_clk_hw_mux2("clkout1_sel", base + 0x128, 4, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
411411
hws[IMX8MM_CLK_CLKOUT1_DIV] = imx_clk_hw_divider("clkout1_div", "clkout1_sel", base + 0x128, 0, 4);
412412
hws[IMX8MM_CLK_CLKOUT1] = imx_clk_hw_gate("clkout1", "clkout1_div", base + 0x128, 8);
413-
hws[IMX8MM_CLK_CLKOUT2_SEL] = imx_clk_hw_mux("clkout2_sel", base + 0x128, 20, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
413+
hws[IMX8MM_CLK_CLKOUT2_SEL] = imx_clk_hw_mux2("clkout2_sel", base + 0x128, 20, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
414414
hws[IMX8MM_CLK_CLKOUT2_DIV] = imx_clk_hw_divider("clkout2_div", "clkout2_sel", base + 0x128, 16, 4);
415415
hws[IMX8MM_CLK_CLKOUT2] = imx_clk_hw_gate("clkout2", "clkout2_div", base + 0x128, 24);
416416

@@ -470,10 +470,11 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
470470

471471
/*
472472
* DRAM clocks are manipulated from TF-A outside clock framework.
473-
* Mark with GET_RATE_NOCACHE to always read div value from hardware
473+
* The fw_managed helper sets GET_RATE_NOCACHE and clears SET_PARENT_GATE
474+
* as div value should always be read from hardware
474475
*/
475-
hws[IMX8MM_CLK_DRAM_ALT] = __imx8m_clk_hw_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000, CLK_GET_RATE_NOCACHE);
476-
hws[IMX8MM_CLK_DRAM_APB] = __imx8m_clk_hw_composite("dram_apb", imx8mm_dram_apb_sels, base + 0xa080, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE);
476+
hws[IMX8MM_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000);
477+
hws[IMX8MM_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mm_dram_apb_sels, base + 0xa080);
477478

478479
/* IP */
479480
hws[IMX8MM_CLK_VPU_G1] = imx8m_clk_hw_composite("vpu_g1", imx8mm_vpu_g1_sels, base + 0xa100);

drivers/clk/imx/clk-imx8mn.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ static const char * const imx8mn_a53_sels[] = {"osc_24m", "arm_pll_out", "sys_pl
4040

4141
static const char * const imx8mn_a53_core_sels[] = {"arm_a53_div", "arm_pll_out", };
4242

43+
static const char * const imx8mn_m7_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll2_250m", "vpu_pll_out",
44+
"sys_pll1_800m", "audio_pll1_out", "video_pll1_out", "sys_pll3_out", };
45+
4346
static const char * const imx8mn_gpu_core_sels[] = {"osc_24m", "gpu_pll_out", "sys_pll1_800m",
4447
"sys_pll3_out", "sys_pll2_1000m", "audio_pll1_out",
4548
"video_pll1_out", "audio_pll2_out", };
@@ -402,10 +405,10 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
402405
hws[IMX8MN_SYS_PLL2_500M] = imx_clk_hw_fixed_factor("sys_pll2_500m", "sys_pll2_500m_cg", 1, 2);
403406
hws[IMX8MN_SYS_PLL2_1000M] = imx_clk_hw_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
404407

405-
hws[IMX8MN_CLK_CLKOUT1_SEL] = imx_clk_hw_mux("clkout1_sel", base + 0x128, 4, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
408+
hws[IMX8MN_CLK_CLKOUT1_SEL] = imx_clk_hw_mux2("clkout1_sel", base + 0x128, 4, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
406409
hws[IMX8MN_CLK_CLKOUT1_DIV] = imx_clk_hw_divider("clkout1_div", "clkout1_sel", base + 0x128, 0, 4);
407410
hws[IMX8MN_CLK_CLKOUT1] = imx_clk_hw_gate("clkout1", "clkout1_div", base + 0x128, 8);
408-
hws[IMX8MN_CLK_CLKOUT2_SEL] = imx_clk_hw_mux("clkout2_sel", base + 0x128, 20, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
411+
hws[IMX8MN_CLK_CLKOUT2_SEL] = imx_clk_hw_mux2("clkout2_sel", base + 0x128, 20, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
409412
hws[IMX8MN_CLK_CLKOUT2_DIV] = imx_clk_hw_divider("clkout2_div", "clkout2_sel", base + 0x128, 16, 4);
410413
hws[IMX8MN_CLK_CLKOUT2] = imx_clk_hw_gate("clkout2", "clkout2_div", base + 0x128, 24);
411414

@@ -421,6 +424,8 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
421424
hws[IMX8MN_CLK_A53_SRC] = hws[IMX8MN_CLK_A53_DIV];
422425
hws[IMX8MN_CLK_A53_CG] = hws[IMX8MN_CLK_A53_DIV];
423426

427+
hws[IMX8MN_CLK_M7_CORE] = imx8m_clk_hw_composite_core("arm_m7_core", imx8mn_m7_sels, base + 0x8080);
428+
424429
hws[IMX8MN_CLK_GPU_CORE] = imx8m_clk_hw_composite_core("gpu_core", imx8mn_gpu_core_sels, base + 0x8180);
425430
hws[IMX8MN_CLK_GPU_SHADER] = imx8m_clk_hw_composite_core("gpu_shader", imx8mn_gpu_shader_sels, base + 0x8200);
426431

@@ -453,10 +458,11 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
453458

454459
/*
455460
* DRAM clocks are manipulated from TF-A outside clock framework.
456-
* Mark with GET_RATE_NOCACHE to always read div value from hardware
461+
* The fw_managed helper sets GET_RATE_NOCACHE and clears SET_PARENT_GATE
462+
* as div value should always be read from hardware
457463
*/
458-
hws[IMX8MN_CLK_DRAM_ALT] = __imx8m_clk_hw_composite("dram_alt", imx8mn_dram_alt_sels, base + 0xa000, CLK_GET_RATE_NOCACHE);
459-
hws[IMX8MN_CLK_DRAM_APB] = __imx8m_clk_hw_composite("dram_apb", imx8mn_dram_apb_sels, base + 0xa080, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE);
464+
hws[IMX8MN_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mn_dram_alt_sels, base + 0xa000);
465+
hws[IMX8MN_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mn_dram_apb_sels, base + 0xa080);
460466

461467
hws[IMX8MN_CLK_DISP_PIXEL] = imx8m_clk_hw_composite("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500);
462468
hws[IMX8MN_CLK_SAI2] = imx8m_clk_hw_composite("sai2", imx8mn_sai2_sels, base + 0xa600);

drivers/clk/imx/clk-imx8mq.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,12 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
449449

450450
/*
451451
* DRAM clocks are manipulated from TF-A outside clock framework.
452-
* Mark with GET_RATE_NOCACHE to always read div value from hardware
452+
* The fw_managed helper sets GET_RATE_NOCACHE and clears SET_PARENT_GATE
453+
* as div value should always be read from hardware
453454
*/
454455
hws[IMX8MQ_CLK_DRAM_CORE] = imx_clk_hw_mux2_flags("dram_core_clk", base + 0x9800, 24, 1, imx8mq_dram_core_sels, ARRAY_SIZE(imx8mq_dram_core_sels), CLK_IS_CRITICAL);
455-
hws[IMX8MQ_CLK_DRAM_ALT] = __imx8m_clk_hw_composite("dram_alt", imx8mq_dram_alt_sels, base + 0xa000, CLK_GET_RATE_NOCACHE);
456-
hws[IMX8MQ_CLK_DRAM_APB] = __imx8m_clk_hw_composite("dram_apb", imx8mq_dram_apb_sels, base + 0xa080, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE);
456+
hws[IMX8MQ_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mq_dram_alt_sels, base + 0xa000);
457+
hws[IMX8MQ_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mq_dram_apb_sels, base + 0xa080);
457458

458459
/* IP */
459460
hws[IMX8MQ_CLK_VPU_G1] = imx8m_clk_hw_composite("vpu_g1", imx8mq_vpu_g1_sels, base + 0xa100);

drivers/clk/imx/clk.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,9 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
530530
struct clk *div, struct clk *mux, struct clk *pll,
531531
struct clk *step);
532532

533-
#define IMX_COMPOSITE_CORE BIT(0)
534-
#define IMX_COMPOSITE_BUS BIT(1)
533+
#define IMX_COMPOSITE_CORE BIT(0)
534+
#define IMX_COMPOSITE_BUS BIT(1)
535+
#define IMX_COMPOSITE_FW_MANAGED BIT(2)
535536

536537
struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
537538
const char * const *parent_names,
@@ -567,6 +568,17 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
567568
ARRAY_SIZE(parent_names), reg, 0, \
568569
flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
569570

571+
#define __imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, flags) \
572+
imx8m_clk_hw_composite_flags(name, parent_names, \
573+
ARRAY_SIZE(parent_names), reg, IMX_COMPOSITE_FW_MANAGED, \
574+
flags | CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
575+
576+
#define imx8m_clk_hw_fw_managed_composite(name, parent_names, reg) \
577+
__imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, 0)
578+
579+
#define imx8m_clk_hw_fw_managed_composite_critical(name, parent_names, reg) \
580+
__imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, CLK_IS_CRITICAL)
581+
570582
#define __imx8m_clk_composite(name, parent_names, reg, flags) \
571583
to_clk(__imx8m_clk_hw_composite(name, parent_names, reg, flags))
572584

include/dt-bindings/clock/imx8mn-clock.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@
241241
#define IMX8MN_CLK_CLKOUT2_DIV 219
242242
#define IMX8MN_CLK_CLKOUT2 220
243243

244-
#define IMX8MN_CLK_END 221
244+
#define IMX8MN_CLK_M7_CORE 221
245+
246+
#define IMX8MN_CLK_END 222
245247

246248
#endif

0 commit comments

Comments
 (0)