Skip to content

Commit c1ae5c6

Browse files
lynxeye-devShawn Guo
authored andcommitted
clk: imx8mm: add clkout1/2 support
clkout1 and clkout2 allow to supply clocks from the SoC to the board, which is used by some board designs to provide reference clocks. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Abel Vesa <abel.vesa@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent 75a352b commit c1ae5c6

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

drivers/clk/imx/clk-imx8mm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ static const char *imx8mm_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "dummy", "
288288
static const char *imx8mm_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_400m", "sys_pll2_166m",
289289
"sys_pll3_out", "audio_pll1_out", "video_pll1_out", "osc_32k", };
290290

291+
static const char * const clkout_sels[] = {"audio_pll1_out", "audio_pll2_out", "video_pll1_out",
292+
"dummy", "dummy", "gpu_pll_out", "vpu_pll_out",
293+
"arm_pll_out", "sys_pll1", "sys_pll2", "sys_pll3",
294+
"dummy", "dummy", "osc_24m", "dummy", "osc_32k"};
295+
291296
static struct clk_hw_onecell_data *clk_hw_data;
292297
static struct clk_hw **hws;
293298

@@ -410,6 +415,13 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
410415
hws[IMX8MM_SYS_PLL2_500M] = imx_clk_hw_fixed_factor("sys_pll2_500m", "sys_pll2_500m_cg", 1, 2);
411416
hws[IMX8MM_SYS_PLL2_1000M] = imx_clk_hw_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
412417

418+
hws[IMX8MM_CLK_CLKOUT1_SEL] = imx_clk_hw_mux("clkout1_sel", base + 0x128, 4, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
419+
hws[IMX8MM_CLK_CLKOUT1_DIV] = imx_clk_hw_divider("clkout1_div", "clkout1_sel", base + 0x128, 0, 4);
420+
hws[IMX8MM_CLK_CLKOUT1] = imx_clk_hw_gate("clkout1", "clkout1_div", base + 0x128, 8);
421+
hws[IMX8MM_CLK_CLKOUT2_SEL] = imx_clk_hw_mux("clkout2_sel", base + 0x128, 20, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
422+
hws[IMX8MM_CLK_CLKOUT2_DIV] = imx_clk_hw_divider("clkout2_div", "clkout2_sel", base + 0x128, 16, 4);
423+
hws[IMX8MM_CLK_CLKOUT2] = imx_clk_hw_gate("clkout2", "clkout2_div", base + 0x128, 24);
424+
413425
np = dev->of_node;
414426
base = devm_platform_ioremap_resource(pdev, 0);
415427
if (WARN_ON(IS_ERR(base)))

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@
274274

275275
#define IMX8MM_CLK_A53_CORE 251
276276

277-
#define IMX8MM_CLK_END 252
277+
#define IMX8MM_CLK_CLKOUT1_SEL 252
278+
#define IMX8MM_CLK_CLKOUT1_DIV 253
279+
#define IMX8MM_CLK_CLKOUT1 254
280+
#define IMX8MM_CLK_CLKOUT2_SEL 255
281+
#define IMX8MM_CLK_CLKOUT2_DIV 256
282+
#define IMX8MM_CLK_CLKOUT2 257
283+
284+
285+
#define IMX8MM_CLK_END 258
278286

279287
#endif

0 commit comments

Comments
 (0)