Skip to content

Commit 3af4df6

Browse files
lynxeye-devShawn Guo
authored andcommitted
clk: imx8mn: 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 c1ae5c6 commit 3af4df6

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

drivers/clk/imx/clk-imx8mn.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,11 @@ static const char * const imx8mn_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sy
281281
"sys_pll2_166m", "sys_pll3_out", "audio_pll1_out",
282282
"video_pll1_out", "osc_32k", };
283283

284+
static const char * const clkout_sels[] = {"audio_pll1_out", "audio_pll2_out", "video_pll1_out",
285+
"dummy", "dummy", "gpu_pll_out", "dummy",
286+
"arm_pll_out", "sys_pll1", "sys_pll2", "sys_pll3",
287+
"dummy", "dummy", "osc_24m", "dummy", "osc_32k"};
288+
284289
static struct clk_hw_onecell_data *clk_hw_data;
285290
static struct clk_hw **hws;
286291

@@ -405,6 +410,13 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
405410
hws[IMX8MN_SYS_PLL2_500M] = imx_clk_hw_fixed_factor("sys_pll2_500m", "sys_pll2_500m_cg", 1, 2);
406411
hws[IMX8MN_SYS_PLL2_1000M] = imx_clk_hw_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
407412

413+
hws[IMX8MN_CLK_CLKOUT1_SEL] = imx_clk_hw_mux("clkout1_sel", base + 0x128, 4, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
414+
hws[IMX8MN_CLK_CLKOUT1_DIV] = imx_clk_hw_divider("clkout1_div", "clkout1_sel", base + 0x128, 0, 4);
415+
hws[IMX8MN_CLK_CLKOUT1] = imx_clk_hw_gate("clkout1", "clkout1_div", base + 0x128, 8);
416+
hws[IMX8MN_CLK_CLKOUT2_SEL] = imx_clk_hw_mux("clkout2_sel", base + 0x128, 20, 4, clkout_sels, ARRAY_SIZE(clkout_sels));
417+
hws[IMX8MN_CLK_CLKOUT2_DIV] = imx_clk_hw_divider("clkout2_div", "clkout2_sel", base + 0x128, 16, 4);
418+
hws[IMX8MN_CLK_CLKOUT2] = imx_clk_hw_gate("clkout2", "clkout2_div", base + 0x128, 24);
419+
408420
np = dev->of_node;
409421
base = devm_platform_ioremap_resource(pdev, 0);
410422
if (WARN_ON(IS_ERR(base))) {

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@
234234

235235
#define IMX8MN_CLK_A53_CORE 214
236236

237-
#define IMX8MN_CLK_END 215
237+
#define IMX8MN_CLK_CLKOUT1_SEL 215
238+
#define IMX8MN_CLK_CLKOUT1_DIV 216
239+
#define IMX8MN_CLK_CLKOUT1 217
240+
#define IMX8MN_CLK_CLKOUT2_SEL 218
241+
#define IMX8MN_CLK_CLKOUT2_DIV 219
242+
#define IMX8MN_CLK_CLKOUT2 220
243+
244+
#define IMX8MN_CLK_END 221
238245

239246
#endif

0 commit comments

Comments
 (0)