Skip to content

Commit 43896f5

Browse files
lynxeye-devabelvesa
authored andcommitted
clk: imx8mp: 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> Link: https://lore.kernel.org/r/20220427162131.3127303-1-l.stach@pengutronix.de Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
1 parent bfd594b commit 43896f5

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

drivers/clk/imx/clk-imx8mp.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ static const char * const imx8mp_sai7_sels[] = {"osc_24m", "audio_pll1_out", "au
399399

400400
static const char * const imx8mp_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", };
401401

402+
static const char * const imx8mp_clkout_sels[] = {"audio_pll1_out", "audio_pll2_out", "video_pll1_out",
403+
"dummy", "dummy", "gpu_pll_out", "vpu_pll_out",
404+
"arm_pll_out", "sys_pll1", "sys_pll2", "sys_pll3",
405+
"dummy", "dummy", "osc_24m", "dummy", "osc_32k"};
406+
402407
static struct clk_hw **hws;
403408
static struct clk_hw_onecell_data *clk_hw_data;
404409

@@ -504,6 +509,15 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
504509
hws[IMX8MP_SYS_PLL2_500M] = imx_clk_hw_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2);
505510
hws[IMX8MP_SYS_PLL2_1000M] = imx_clk_hw_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
506511

512+
hws[IMX8MP_CLK_CLKOUT1_SEL] = imx_clk_hw_mux2("clkout1_sel", anatop_base + 0x128, 4, 4,
513+
imx8mp_clkout_sels, ARRAY_SIZE(imx8mp_clkout_sels));
514+
hws[IMX8MP_CLK_CLKOUT1_DIV] = imx_clk_hw_divider("clkout1_div", "clkout1_sel", anatop_base + 0x128, 0, 4);
515+
hws[IMX8MP_CLK_CLKOUT1] = imx_clk_hw_gate("clkout1", "clkout1_div", anatop_base + 0x128, 8);
516+
hws[IMX8MP_CLK_CLKOUT2_SEL] = imx_clk_hw_mux2("clkout2_sel", anatop_base + 0x128, 20, 4,
517+
imx8mp_clkout_sels, ARRAY_SIZE(imx8mp_clkout_sels));
518+
hws[IMX8MP_CLK_CLKOUT2_DIV] = imx_clk_hw_divider("clkout2_div", "clkout2_sel", anatop_base + 0x128, 16, 4);
519+
hws[IMX8MP_CLK_CLKOUT2] = imx_clk_hw_gate("clkout2", "clkout2_div", anatop_base + 0x128, 24);
520+
507521
hws[IMX8MP_CLK_A53_DIV] = imx8m_clk_hw_composite_core("arm_a53_div", imx8mp_a53_sels, ccm_base + 0x8000);
508522
hws[IMX8MP_CLK_A53_SRC] = hws[IMX8MP_CLK_A53_DIV];
509523
hws[IMX8MP_CLK_A53_CG] = hws[IMX8MP_CLK_A53_DIV];

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,15 @@
317317
#define IMX8MP_CLK_AUDIO_AXI 310
318318
#define IMX8MP_CLK_HSIO_AXI 311
319319
#define IMX8MP_CLK_MEDIA_ISP 312
320-
321320
#define IMX8MP_CLK_MEDIA_DISP2_PIX 313
321+
#define IMX8MP_CLK_CLKOUT1_SEL 314
322+
#define IMX8MP_CLK_CLKOUT1_DIV 315
323+
#define IMX8MP_CLK_CLKOUT1 316
324+
#define IMX8MP_CLK_CLKOUT2_SEL 317
325+
#define IMX8MP_CLK_CLKOUT2_DIV 318
326+
#define IMX8MP_CLK_CLKOUT2 319
322327

323-
#define IMX8MP_CLK_END 314
328+
#define IMX8MP_CLK_END 320
324329

325330
#define IMX8MP_CLK_AUDIOMIX_SAI1_IPG 0
326331
#define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1 1

0 commit comments

Comments
 (0)