From e81a08d6dd1d5d1506433f6aa5fc06a2c6d7c1fa Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 28 Apr 2025 10:47:12 +0100 Subject: [PATCH] boards: nordic: nrf52840dongle: Replace SYS_INIT with board hooks Updates to use board hooks since SYS_INIT should not be used in boards Signed-off-by: Jamie McCrae --- boards/nordic/nrf52840dongle/Kconfig | 5 ++--- boards/nordic/nrf52840dongle/board.c | 10 ++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/boards/nordic/nrf52840dongle/Kconfig b/boards/nordic/nrf52840dongle/Kconfig index c8698ad0701..eaadd551f78 100644 --- a/boards/nordic/nrf52840dongle/Kconfig +++ b/boards/nordic/nrf52840dongle/Kconfig @@ -3,7 +3,8 @@ # Copyright (c) 2018-2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if BOARD_NRF52840DONGLE +config BOARD_NRF52840DONGLE + select BOARD_EARLY_INIT_HOOK config BOARD_HAS_NRF5_BOOTLOADER bool "Board has nRF5 bootloader" @@ -11,5 +12,3 @@ config BOARD_HAS_NRF5_BOOTLOADER help If selected, applications are linked so that they can be loaded by Nordic nRF5 bootloader. - -endif # BOARD_NRF52840DONGLE diff --git a/boards/nordic/nrf52840dongle/board.c b/boards/nordic/nrf52840dongle/board.c index ac37eacee21..e06fac1f1dd 100644 --- a/boards/nordic/nrf52840dongle/board.c +++ b/boards/nordic/nrf52840dongle/board.c @@ -7,10 +7,9 @@ #include #include -static int board_nrf52840dongle_nrf52840_init(void) +void board_early_init_hook(void) { - - /* if the nrf52840dongle_nrf52840 board is powered from USB + /* If the nrf52840dongle/nrf52840 board target is powered from USB * (high voltage mode), GPIO output voltage is set to 1.8 volts by * default and that is not enough to turn the green and blue LEDs on. * Increase GPIO voltage to 3.0 volts. @@ -37,9 +36,4 @@ static int board_nrf52840dongle_nrf52840_init(void) /* a reset is required for changes to take effect */ NVIC_SystemReset(); } - - return 0; } - -SYS_INIT(board_nrf52840dongle_nrf52840_init, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);