Skip to content

Commit 67b7c99

Browse files
EmilioCBenaescolar
authored andcommitted
boards: nxp: frdm_mcxn947: Updated Init Clock for LPTMR
Updated the clocks that get initialized for the MCXN947 when using the LPTMR. The LPTMR allows the user to select and Input clock, however said input clock must be initialized before the user can select it. Update description for clk-source in binding file. Signed-off-by: Emilio Benavente <[email protected]>
1 parent 71fa64c commit 67b7c99

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

boards/nxp/frdm_mcxn947/board.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,28 @@ static int frdm_mcxn947_init(void)
299299
#endif
300300

301301
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay)
302+
303+
/*
304+
* Clock Select Decides what input source the lptmr will clock from
305+
*
306+
* 0 <- 12MHz FRO
307+
* 1 <- 16K FRO
308+
* 2 <- 32K OSC
309+
* 3 <- Output from the OSC_SYS
310+
*/
311+
#if DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x0
312+
CLOCK_SetupClockCtrl(kCLOCK_FRO12MHZ_ENA);
313+
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x1
302314
CLOCK_SetupClk16KClocking(kCLOCK_Clk16KToVsys);
303-
#endif
315+
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x2
316+
CLOCK_SetupOsc32KClocking(kCLOCK_Osc32kToVsys);
317+
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x3
318+
/* Value here should not exceed 25MHZ when using lptmr */
319+
CLOCK_SetupExtClocking(MHZ(24));
320+
CLOCK_SetupClockCtrl(kCLOCK_CLKIN_ENA_FM_USBH_LPT);
321+
#endif /* DT_PROP(DT_NODELABEL(lptmr0), clk_source) */
322+
323+
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay) */
304324

305325
#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio0), okay)
306326
CLOCK_SetClkDiv(kCLOCK_DivFlexioClk, 1u);

dts/bindings/counter/nxp,lptmr.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ properties:
2020
clk-source:
2121
type: int
2222
required: true
23-
description: Prescaler clock source (0 to 3)
23+
enum: [0, 1, 2, 3]
24+
description: |
25+
Selects the clock to be used by the LPMTR prescaler/glitch filter.
26+
In time counter mode, this field selects the input clock to the prescaler.
27+
In pulse counter mode, this field selects the input clock to the glitch filter.
28+
The clock connections vary by device, see the device reference manual for
29+
more details.
2430
2531
input-pin:
2632
type: int

0 commit comments

Comments
 (0)