Skip to content

Commit b53ba60

Browse files
lucien-nxpjhedberg
authored andcommitted
drivers: clock_control: add nxp_mc_cgm clock driver
- add clock_init function to initialize clock sources according devicetree settings - finish basic clock api function Signed-off-by: Lucien Zhao <[email protected]>
1 parent fd3770d commit b53ba60

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_NXP_CLOCK_CONTROL_H_
8+
#define ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_NXP_CLOCK_CONTROL_H_
9+
10+
#include <zephyr/drivers/clock_control.h>
11+
12+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(mc_cgm), nxp_mc_cgm, okay)
13+
#include <zephyr/dt-bindings/clock/nxp_mc_cgm.h>
14+
#endif
15+
16+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(firc), nxp_firc, okay)
17+
#define NXP_FIRC_DIV DT_ENUM_IDX(DT_NODELABEL(firc), firc_div)
18+
#endif
19+
20+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(fxosc), nxp_fxosc, okay)
21+
#define NXP_FXOSC_FREQ DT_PROP(DT_NODELABEL(fxosc), freq)
22+
#define NXP_FXOSC_WORKMODE \
23+
(DT_ENUM_IDX(DT_NODELABEL(fxosc), workmode) == 0 ? kFXOSC_ModeCrystal : kFXOSC_ModeBypass)
24+
#define NXP_FXOSC_DELAY DT_PROP(DT_NODELABEL(fxosc), delay)
25+
#define NXP_FXOSC_OVERDRIVE DT_PROP(DT_NODELABEL(fxosc), overdrive)
26+
#endif
27+
28+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(pll), nxp_plldig, okay)
29+
#define NXP_PLL_WORKMODE DT_ENUM_IDX(DT_NODELABEL(pll), workmode)
30+
#define NXP_PLL_PREDIV DT_PROP(DT_NODELABEL(pll), prediv)
31+
#define NXP_PLL_POSTDIV DT_PROP(DT_NODELABEL(pll), postdiv)
32+
#define NXP_PLL_MULTIPLIER DT_PROP(DT_NODELABEL(pll), multiplier)
33+
#define NXP_PLL_FRACLOOPDIV DT_PROP(DT_NODELABEL(pll), fracloopdiv)
34+
#define NXP_PLL_STEPSIZE DT_PROP(DT_NODELABEL(pll), stepsize)
35+
#define NXP_PLL_STEPNUM DT_PROP(DT_NODELABEL(pll), stepnum)
36+
#define NXP_PLL_ACCURACY DT_ENUM_IDX(DT_NODELABEL(pll), accuracy)
37+
#define NXP_PLL_OUTDIV_POINTER DT_PROP(DT_NODELABEL(pll), outdiv)
38+
#endif
39+
40+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(mc_cgm), nxp_mc_cgm, okay)
41+
#define NXP_PLL_MAXIDOCHANGE DT_PROP(DT_NODELABEL(mc_cgm), max_ido_change)
42+
#define NXP_PLL_STEPDURATION DT_PROP(DT_NODELABEL(mc_cgm), step_duration)
43+
#define NXP_PLL_CLKSRCFREQ DT_PROP(DT_NODELABEL(mc_cgm), clk_src_freq)
44+
#define NXP_PLL_MUX_0_DC_0_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_0_div)
45+
#define NXP_PLL_MUX_0_DC_1_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_1_div)
46+
#define NXP_PLL_MUX_0_DC_2_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_2_div)
47+
#define NXP_PLL_MUX_0_DC_3_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_3_div)
48+
#define NXP_PLL_MUX_0_DC_4_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_4_div)
49+
#define NXP_PLL_MUX_0_DC_5_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_5_div)
50+
#define NXP_PLL_MUX_0_DC_6_DIV DT_PROP(DT_NODELABEL(mc_cgm), mux_0_dc_6_div)
51+
#endif
52+
53+
#endif /* ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_NXP_CLOCK_CONTROL_H_ */

0 commit comments

Comments
 (0)