|
30 | 30 |
|
31 | 31 | /* System clock frequency */
|
32 | 32 | extern uint32_t SystemCoreClock;
|
| 33 | +extern void nxp_nbu_init(void); |
33 | 34 |
|
34 | 35 | #define CTIMER_CLOCK_SOURCE(node_id) \
|
35 | 36 | TO_CTIMER_CLOCK_SOURCE(DT_CLOCKS_CELL(node_id, name), DT_PROP(node_id, clk_source))
|
36 | 37 | #define TO_CTIMER_CLOCK_SOURCE(inst, val) TO_CLOCK_ATTACH_ID(inst, val)
|
37 | 38 | #define TO_CLOCK_ATTACH_ID(inst, val) MUX_A(CM_CTIMERCLKSEL##inst, val)
|
38 | 39 | #define CTIMER_CLOCK_SETUP(node_id) CLOCK_AttachClk(CTIMER_CLOCK_SOURCE(node_id));
|
| 40 | +/** 32KHz oscillator load in cap setting */ |
| 41 | +#define OSC_CAP_IN_SETTING 5 |
| 42 | +/** 32KHz oscillator load out cap setting */ |
| 43 | +#define OSC_CAP_OUT_SETTING 5 |
| 44 | + |
| 45 | +static void configure_32k_osc(void) |
| 46 | +{ |
| 47 | + /* Configure 32KHz xtal caps for use with RDM */ |
| 48 | + POWER_XTAL32K_ConfigureCaps(OSC_CAP_IN_SETTING, OSC_CAP_OUT_SETTING); |
| 49 | + POWER_PeripheralPowerOn(kPOWERCFG_XTAL32K); |
| 50 | + CLOCK_Select32kOscClkSrc(kCLOCK_Osc32kClockSrc_XTAL); |
| 51 | +} |
39 | 52 |
|
40 | 53 | /**
|
41 | 54 | *
|
@@ -77,6 +90,8 @@ __weak void clock_init(void)
|
77 | 90 |
|
78 | 91 | DT_FOREACH_STATUS_OKAY(nxp_lpc_ctimer, CTIMER_CLOCK_SETUP)
|
79 | 92 | DT_FOREACH_STATUS_OKAY(nxp_ctimer_pwm, CTIMER_CLOCK_SETUP)
|
| 93 | + |
| 94 | + configure_32k_osc(); |
80 | 95 | }
|
81 | 96 |
|
82 | 97 | #ifdef CONFIG_SOC_RESET_HOOK
|
@@ -107,4 +122,8 @@ void soc_early_init_hook(void)
|
107 | 122 | /* Turn on PINT device*/
|
108 | 123 | PINT_Init(PINT);
|
109 | 124 | #endif
|
| 125 | + |
| 126 | +#ifdef CONFIG_BT |
| 127 | + nxp_nbu_init(); |
| 128 | +#endif |
110 | 129 | }
|
0 commit comments