Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion drivers/mpsl/clock_control/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ config CLOCK_CONTROL_MPSL
bool
depends on MPSL
depends on CLOCK_CONTROL
depends on !SOC_SERIES_NRF54HX
depends on !MPSL_USE_EXTERNAL_CLOCK_CONTROL
default y
select CLOCK_CONTROL_NRF_FORCE_ALT
help
Use the clock driver provided as part of the MPSL library.
8 changes: 8 additions & 0 deletions subsys/bluetooth/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,13 @@ config BT_CTLR_SDC_LE_POWER_CLASS_1
See Bluetooth Core Specification, Vol 6, Part A, Section 3
Transmitter Characteristics for more information.

config BT_LL_SOFTDEVICE_INIT_PRIORITY
int
default 53 if MPSL_USE_EXTERNAL_CLOCK_CONTROL
default KERNEL_INIT_PRIORITY_DEFAULT
help
This option configures the LL_SOFTDEVICE initialization priority level. The priority
must be lower than the CONFIG_MPSL_INIT_PRIORITY due to dependency on the MPSL library.

endmenu
endif # BT_LL_SOFTDEVICE
7 changes: 6 additions & 1 deletion subsys/bluetooth/controller/hci_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1523,10 +1523,15 @@ static int hci_driver_init(const struct device *dev)
return err;
}

#if defined(CONFIG_MPSL_USE_EXTERNAL_CLOCK_CONTROL)
BUILD_ASSERT(CONFIG_BT_LL_SOFTDEVICE_INIT_PRIORITY > CONFIG_MPSL_INIT_PRIORITY,
"MPSL must be initialized before SoftDevice Controller");
#endif /* CONFIG_MPSL_USE_EXTERNAL_CLOCK_CONTROL */

#define BT_HCI_CONTROLLER_INIT(inst) \
static struct hci_driver_data data_##inst; \
DEVICE_DT_INST_DEFINE(inst, hci_driver_init, NULL, &data_##inst, NULL, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &hci_driver_api)
CONFIG_BT_LL_SOFTDEVICE_INIT_PRIORITY, &hci_driver_api)

/* Only a single instance is supported */
BT_HCI_CONTROLLER_INIT(0)
4 changes: 4 additions & 0 deletions subsys/mpsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ if (CONFIG_MPSL_USE_ZEPHYR_PM)
add_subdirectory(pm)
endif()

if (CONFIG_MPSL_USE_EXTERNAL_CLOCK_CONTROL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (CONFIG_MPSL_USE_EXTERNAL_CLOCK_CONTROL)
if(CONFIG_MPSL_USE_EXTERNAL_CLOCK_CONTROL)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nordicjm please see:

if (CONFIG_MPSL_USE_ZEPHYR_PM)
. The code here is aligned to what was in the file already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file is wrong and needs fixing (outside the scope of this PR) but new code should be added correctly

add_subdirectory(clock_ctrl)
endif()

add_subdirectory_ifdef(CONFIG_MPSL_PIN_DEBUG pin_debug)
1 change: 1 addition & 0 deletions subsys/mpsl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rsource "cx/Kconfig"
rsource "init/Kconfig"
rsource "pin_debug/Kconfig"
rsource "pm/Kconfig"
rsource "clock_ctrl/Kconfig"

endif # !MPSL_FEM_ONLY

Expand Down
9 changes: 9 additions & 0 deletions subsys/mpsl/clock_ctrl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

zephyr_library()

zephyr_library_sources(mpsl_clock_ctrl.c)
15 changes: 15 additions & 0 deletions subsys/mpsl/clock_ctrl/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

config MPSL_USE_EXTERNAL_CLOCK_CONTROL
bool "Use external clock control [EXPERIMENTAL]"
depends on MPSL
select CLOCK_CONTROL
default y if SOC_SERIES_NRF54HX
select EXPERIMENTAL if SOC_SERIES_NRF52X || SOC_SERIES_NRF53X
help
This option configures MPSL to use an external clock driver, and
not the clock driver provided as part of the MPSL library.
Loading