Skip to content

Commit

Permalink
boards: arm: thingy91: Exclude ADP536X driver from all bootloaders
Browse files Browse the repository at this point in the history
The ADP536X integrated circuit interfaces with two distinct drivers:
the Zephyr regulator driver, responsible for power regulation aspects
of the ADP536X, and the sdk-nrf ADP536X driver, which manages other
functionalities. Both drivers are now reserved exclusively for
inclusion within the application image.

Introduced a new kconfig symbol IS_BOOTLOADER_IMG, to simplify checking
for both MCUboot and secure bootloaders.

In addition, changed how the driver is automatically enabled. Now it is
enabled if the devicetree has an "adi,adp5360" compatible node enabled.

CIA-604

Signed-off-by: Gregers Gram Rygg <[email protected]>
  • Loading branch information
gregersrygg authored and rlubos committed Dec 12, 2023
1 parent 5db623d commit fdfba64
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 25 deletions.
13 changes: 2 additions & 11 deletions boards/arm/thingy91_nrf9160/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,10 @@
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

if(CONFIG_BOARD_THINGY91_NRF9160 AND NOT DEFINED CONFIG_MCUBOOT)
zephyr_library()
zephyr_library_sources(adp5360_init.c)
endif()
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_ADP536X adp5360_init.c)

if(CONFIG_BOARD_THINGY91_NRF9160_NS)
# If TF-M is used, the ADP5360 configuration must be done in non-secure
# as we can't instruct TF-M to run it.
if(CONFIG_BUILD_WITH_TFM)
zephyr_library()
zephyr_library_sources(adp5360_init.c)
endif()

# Use static partition layout to ensure the partition layout remains
# unchanged after DFU. This needs to be made globally available
# because it is used in other CMake files.
Expand Down
4 changes: 3 additions & 1 deletion boards/arm/thingy91_nrf9160/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ if BOARD_THINGY91_NRF9160 || BOARD_THINGY91_NRF9160_NS
config BOARD
default "thingy91_nrf9160"

# Enable Zephyr power regulator ADP536x
config REGULATOR
default y if !MCUBOOT
default y
depends on !IS_BOOTLOADER_IMG

# By default, if we build for a Non-Secure version of the board,
# enable building with TF-M as the Secure Execution Environment.
Expand Down
6 changes: 0 additions & 6 deletions boards/arm/thingy91_nrf9160/thingy91_nrf9160_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,5 @@ CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable I2C
CONFIG_I2C=y

# Enable power management IC ADP536x
CONFIG_ADP536X=y

# Disable entropy driver, as it's not yet implemented for nRF9160
CONFIG_ENTROPY_NRF5_RNG=n
6 changes: 0 additions & 6 deletions boards/arm/thingy91_nrf9160/thingy91_nrf9160_ns_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,9 @@ CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable I2C
CONFIG_I2C=y

# Enable SPI
CONFIG_SPI=y

# Enable power management IC ADP536x
CONFIG_ADP536X=y

# Disable entropy driver, as it's not yet implemented for nRF9160
CONFIG_ENTROPY_NRF5_RNG=n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,9 @@ nRF Security
Other libraries
---------------

|no_changes_yet_note|
* :ref:`lib_adp536x` library:

* Fixed issue where the adp536x driver was included in the immutable bootloader on Thingy:91 when :kconfig:option:`CONFIG_SECURE_BOOT` was enabled.

Common Application Framework (CAF)
----------------------------------
Expand Down
4 changes: 4 additions & 0 deletions lib/adp536x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@

config ADP536X
bool "ADP536x"
default y
depends on !IS_BOOTLOADER_IMG
depends on DT_HAS_ADI_ADP5360_ENABLED
select I2C
help
Enable ADP536x
7 changes: 7 additions & 0 deletions subsys/bootloader/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ config SB_BPROT_IN_DEBUG
endif # SECURE_BOOT_DEBUG
endif # IS_SECURE_BOOTLOADER

config IS_BOOTLOADER_IMG
bool
default y if IS_SECURE_BOOTLOADER || MCUBOOT
help
Helper symbol which is set when the current image is a bootloader. This includes mcuboot
and the secure bootloader.

config NRF53_UPGRADE_NETWORK_CORE
bool "Support updating nRF53 Network Core application"
default y
Expand Down

0 comments on commit fdfba64

Please sign in to comment.