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 <thomas.stenersen@nordicsemi.no>
This commit is contained in:
Thomas Stenersen 2019-02-21 16:02:16 +01:00 committed by Kumar Gala
commit db90e24326
3 changed files with 33 additions and 0 deletions

View file

@ -5,6 +5,15 @@
#
# SPDX-License-Identifier: Apache-2.0
config ENTROPY_NRF_FORCE_ALT
bool
depends on SOC_COMPATIBLE_NRF
help
This option can be enabled to force an alternative implementation
of the entropy driver.
if !ENTROPY_NRF_FORCE_ALT
menuconfig ENTROPY_NRF5_RNG
bool "nRF5 RNG driver"
depends on SOC_COMPATIBLE_NRF
@ -70,3 +79,5 @@ config ENTROPY_NRF5_PRI
nRF5X RNG IRQ priority.
endif # ENTROPY_NRF5_RNG
endif # !ENTROPY_NRF_FORCE_ALT