Skip to content

Commit

Permalink
boards: nxp: frdm_mcxn947: Updated Init Clock for LPTMR
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 67b7c99)

Original-Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
GitOrigin-RevId: 67b7c99
Cr-Build-Id: 8738910416953667585
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8738910416953667585
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: Ida59119f99744314c6c7d5460279aec3050e491c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5806813
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Commit-Queue: Eric Yilun Lin <yllin@google.com>
Tested-by: Eric Yilun Lin <yllin@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
  • Loading branch information
EmilioCBen authored and Chromeos LUCI committed Aug 22, 2024
1 parent 2d6dfb5 commit 2501907
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
22 changes: 21 additions & 1 deletion boards/nxp/frdm_mcxn947/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,28 @@ static int frdm_mcxn947_init(void)
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay)

/*
* Clock Select Decides what input source the lptmr will clock from
*
* 0 <- 12MHz FRO
* 1 <- 16K FRO
* 2 <- 32K OSC
* 3 <- Output from the OSC_SYS
*/
#if DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x0
CLOCK_SetupClockCtrl(kCLOCK_FRO12MHZ_ENA);
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x1
CLOCK_SetupClk16KClocking(kCLOCK_Clk16KToVsys);
#endif
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x2
CLOCK_SetupOsc32KClocking(kCLOCK_Osc32kToVsys);
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x3
/* Value here should not exceed 25MHZ when using lptmr */
CLOCK_SetupExtClocking(MHZ(24));
CLOCK_SetupClockCtrl(kCLOCK_CLKIN_ENA_FM_USBH_LPT);
#endif /* DT_PROP(DT_NODELABEL(lptmr0), clk_source) */

#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay) */

#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio0), okay)
CLOCK_SetClkDiv(kCLOCK_DivFlexioClk, 1u);
Expand Down
8 changes: 7 additions & 1 deletion dts/bindings/counter/nxp,lptmr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ properties:
clk-source:
type: int
required: true
description: Prescaler clock source (0 to 3)
enum: [0, 1, 2, 3]
description: |
Selects the clock to be used by the LPMTR prescaler/glitch filter.
In time counter mode, this field selects the input clock to the prescaler.
In pulse counter mode, this field selects the input clock to the glitch filter.
The clock connections vary by device, see the device reference manual for
more details.
input-pin:
type: int
Expand Down

0 comments on commit 2501907

Please sign in to comment.