Skip to content

Commit 30207d7

Browse files
Enable LPIT for rt118x devices
1. Configure clock source for lpit3 for imxrt118x devices 2. Support lpit in clock driver Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
1 parent ffcc8e4 commit 30207d7

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

drivers/clock_control/clock_control_mcux_ccm_rev2.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,25 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
256256
clock_root = kCLOCK_Root_Bus + instance;
257257
break;
258258
#endif
259-
259+
#ifdef CONFIG_COUNTER_MCUX_LPIT
260+
#if defined(CONFIG_SOC_SERIES_IMXRT118X)
261+
case IMX_CCM_LPIT_CLK:
262+
switch (instance) {
263+
case 0:
264+
clock_root = kCLOCK_Root_Bus_Aon;
265+
break;
266+
case 1:
267+
clock_root = kCLOCK_Root_Bus_Wakeup;
268+
break;
269+
case 2:
270+
clock_root = kCLOCK_Root_Lpit3;
271+
break;
272+
default:
273+
return -EINVAL;
274+
}
275+
break;
276+
#endif
277+
#endif
260278
#ifdef CONFIG_ADC_MCUX_LPADC
261279
case IMX_CCM_LPADC1_CLK:
262280
clock_root = kCLOCK_Root_Adc1 + instance;

include/zephyr/dt-bindings/clock/imx_ccm_rev2.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@
149149
#define IMX_CCM_I3C1_CLK 0x2200UL
150150
#define IMX_CCM_I3C2_CLK 0x2201UL
151151

152+
/* LPIT */
153+
#define IMX_CCM_LPIT_CLK 0x2300UL
154+
#define IMX_CCM_LPIT1_CLK 0x2300UL
155+
#define IMX_CCM_LPIT2_CLK 0x2301UL
156+
#define IMX_CCM_LPIT3_CLK 0x2302UL
157+
152158
/* QTMR */
153159
#define IMX_CCM_QTMR_CLK 0x6000UL
154160
#define IMX_CCM_QTMR1_CLK 0x6000UL

soc/nxp/imxrt/imxrt118x/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,15 @@ __weak void clock_init(void)
596596

597597
#endif /* CONFIG_IMX_USDHC */
598598

599+
#ifdef CONFIG_COUNTER_MCUX_LPIT
600+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpit3), okay)
601+
/* Configure LPIT3 using SysPll3Div2 */
602+
rootCfg.mux = kCLOCK_LPIT3_ClockRoot_MuxSysPll3Div2;
603+
rootCfg.div = 3;
604+
CLOCK_SetRootClock(kCLOCK_Root_Lpit3, &rootCfg);
605+
#endif
606+
#endif /* CONFIG_COUNTER_MCUX_LPIT */
607+
599608
/* Keep core clock ungated during WFI */
600609
CCM->LPCG[1].LPM0 = 0x33333333;
601610
CCM->LPCG[1].LPM1 = 0x33333333;

0 commit comments

Comments
 (0)