Skip to content

Commit e71b776

Browse files
committed
soc: nxp: mcxw: Add BLE support to MCXW2XX soc
Add configuration for BLE Add 32KHz Osc clock needed by BLE Move nxp_nbu.c include to be shared on mcxw7x and mcxw2x Signed-off-by: Yassine El Aissaoui <[email protected]>
1 parent 7c9f41c commit e71b776

File tree

5 files changed

+43
-6
lines changed

5 files changed

+43
-6
lines changed

soc/nxp/mcx/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#
2-
# Copyright 2024 NXP
2+
# Copyright 2024-2025 NXP
33
#
44
# SPDX-License-Identifier: Apache-2.0
55
#
66

77
add_subdirectory(${SOC_FAMILY})
88

99
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common)
10+
11+
zephyr_sources_ifdef(CONFIG_NXP_NBU
12+
../common/nxp_nbu.c
13+
)

soc/nxp/mcx/mcxw/mcxw2xx/Kconfig.defconfig

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,20 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
1616
config FLASH_FILL_BUFFER_SIZE
1717
default 512
1818

19-
endif
19+
if BT
20+
21+
config FPU
22+
default y
23+
24+
config BT_BUF_ACL_TX_COUNT
25+
default 8
26+
27+
config BT_LONG_WQ_STACK_SIZE
28+
default 2048
29+
30+
config MAIN_STACK_SIZE
31+
default 2048
32+
33+
endif # BT
34+
35+
endif # SOC_SERIES_MCXW2XX

soc/nxp/mcx/mcxw/mcxw2xx/soc.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,25 @@
3030

3131
/* System clock frequency */
3232
extern uint32_t SystemCoreClock;
33+
extern void nxp_nbu_init(void);
3334

3435
#define CTIMER_CLOCK_SOURCE(node_id) \
3536
TO_CTIMER_CLOCK_SOURCE(DT_CLOCKS_CELL(node_id, name), DT_PROP(node_id, clk_source))
3637
#define TO_CTIMER_CLOCK_SOURCE(inst, val) TO_CLOCK_ATTACH_ID(inst, val)
3738
#define TO_CLOCK_ATTACH_ID(inst, val) MUX_A(CM_CTIMERCLKSEL##inst, val)
3839
#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+
}
3952

4053
/**
4154
*
@@ -77,6 +90,8 @@ __weak void clock_init(void)
7790

7891
DT_FOREACH_STATUS_OKAY(nxp_lpc_ctimer, CTIMER_CLOCK_SETUP)
7992
DT_FOREACH_STATUS_OKAY(nxp_ctimer_pwm, CTIMER_CLOCK_SETUP)
93+
94+
configure_32k_osc();
8095
}
8196

8297
#ifdef CONFIG_SOC_RESET_HOOK
@@ -107,4 +122,8 @@ void soc_early_init_hook(void)
107122
/* Turn on PINT device*/
108123
PINT_Init(PINT);
109124
#endif
125+
126+
#ifdef CONFIG_BT
127+
nxp_nbu_init();
128+
#endif
110129
}

soc/nxp/mcx/mcxw/mcxw2xx/soc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@
4141
#define IOCON_PIO_MODE_PULLDOWN 0x10u /*!<@brief Selects pull-down function */
4242
#define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */
4343

44+
#define nbu_handler BLE_LL_IRQHandler
45+
4446
#endif /* _SOC__H_ */

soc/nxp/mcx/mcxw/mcxw7xx/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ zephyr_sources(soc.c)
66
zephyr_sources_ifdef(CONFIG_SOC_MCXW716C mcxw71_platform_init.S)
77
zephyr_sources_ifdef(CONFIG_SOC_MCXW727C mcxw72_platform_init.S)
88

9-
zephyr_sources_ifdef(CONFIG_NXP_NBU
10-
../../../common/nxp_nbu.c
11-
)
12-
139
zephyr_include_directories(./)
1410

1511
set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "")

0 commit comments

Comments
 (0)