Skip to content

Commit b127536

Browse files
author
Thomas Stenersen
committed
drivers: nrf: add support for forcing driver implementation
An external project extending the Zephyr RTOS and its drivers may have subsystems that must use its own specific driver(s) when active. One example is the nRF5x NVMC that must be scheduled in between radio operations. A subsystem may also be dependent on its own drivers for security, real-time and/or because of hardware constrains. In order to not introduce non-Zephyr specific code into the Zephyr tree, an option is added to disable the in-tree drivers in Zephyr. Because Kconfig does not support a good way of de-selecting other symbols, a variable on the form `<DRIVER>_FORCE_ALT` is added as a dependency for each `<DRIVER>`. For example, the out-of-tree subsystem will select `FLASH_NRF_FORCE_ALT` to disable the in-tree driver. A solution for issue #8181 would open up for a more general solution, however #8181 requires significant effort. Support for out-of-tree drivers is added to Nordic drivers for clock_control, entropy and flash. A generic solution for this is desired. Issue #14527 is tracking that progress. Signed-off-by: Thomas Stenersen <[email protected]>
1 parent 8aba2d5 commit b127536

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

drivers/clock_control/Kconfig.nrf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
#
55
# SPDX-License-Identifier: Apache-2.0
66

7+
config CLOCK_CONTROL_NRF_FORCE_ALT
8+
bool
9+
depends on SOC_COMPATIBLE_NRF
10+
help
11+
This option can be enabled to force an alternative implementation
12+
of the clock control driver.
13+
14+
if !CLOCK_CONTROL_NRF_FORCE_ALT
15+
716
menuconfig CLOCK_CONTROL_NRF
817
bool "NRF Clock controller support"
918
depends on SOC_COMPATIBLE_NRF
@@ -67,3 +76,5 @@ config CLOCK_CONTROL_NRF_K32SRC_20PPM
6776
endchoice
6877

6978
endif # CLOCK_CONTROL_NRF
79+
80+
endif #!CLOCK_CONTROL_NRF_FORCE_ALT

drivers/entropy/Kconfig.nrf5

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
#
66
# SPDX-License-Identifier: Apache-2.0
77

8+
config ENTROPY_NRF_FORCE_ALT
9+
bool
10+
depends on SOC_COMPATIBLE_NRF
11+
help
12+
This option can be enabled to force an alternative implementation
13+
of the entropy driver.
14+
15+
if !ENTROPY_NRF_FORCE_ALT
16+
817
menuconfig ENTROPY_NRF5_RNG
918
bool "nRF5 RNG driver"
1019
depends on SOC_COMPATIBLE_NRF
@@ -70,3 +79,5 @@ config ENTROPY_NRF5_PRI
7079
nRF5X RNG IRQ priority.
7180

7281
endif # ENTROPY_NRF5_RNG
82+
83+
endif # !ENTROPY_NRF_FORCE_ALT

drivers/flash/Kconfig.nrf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
config FLASH_NRF_FORCE_ALT
2+
bool
3+
depends on SOC_COMPATIBLE_NRF
4+
help
5+
This option can be enabled to force an alternative implementation
6+
of the flash driver.
7+
8+
if !FLASH_NRF_FORCE_ALT
9+
110
config SOC_FLASH_NRF
211
bool "Nordic Semiconductor nRF flash driver"
312
depends on SOC_FAMILY_NRF
@@ -20,3 +29,5 @@ config SOC_FLASH_NRF_UICR
2029
help
2130
Enable operations on UICR. Once enabled UICR are written or read as
2231
ordinary flash memory. Erase is possible for whole UICR at once.
32+
33+
endif #!FLASH_NRF_FORCE_ALT

0 commit comments

Comments
 (0)