1 /* 2 * Copyright (c) 2016 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief System/hardware module for Nordic Semiconductor nRF52 family processor 10 * 11 * This module provides routines to initialize and support board-level hardware 12 * for the Nordic Semiconductor nRF52 family processor. 13 */ 14 15 #include <zephyr/devicetree.h> 16 #include <zephyr/dt-bindings/regulator/nrf5x.h> 17 #include <zephyr/kernel.h> 18 #include <zephyr/init.h> 19 #include <hal/nrf_power.h> 20 #include <soc/nrfx_coredep.h> 21 #include <zephyr/logging/log.h> 22 23 #include <cmsis_core.h> 24 25 #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL 26 LOG_MODULE_REGISTER(soc); 27 nordicsemi_nrf52_init(void)28static int nordicsemi_nrf52_init(void) 29 { 30 #ifdef CONFIG_NRF_ENABLE_ICACHE 31 /* Enable the instruction cache */ 32 NRF_NVMC->ICACHECNF = NVMC_ICACHECNF_CACHEEN_Msk; 33 #endif 34 35 #if defined(CONFIG_SOC_DCDC_NRF52X) || (DT_PROP(DT_INST(0, nordic_nrf5x_regulator), \ 36 regulator_initial_mode) == NRF5X_REG_MODE_DCDC) 37 nrf_power_dcdcen_set(NRF_POWER, true); 38 #endif 39 #if NRF_POWER_HAS_DCDCEN_VDDH && (defined(CONFIG_SOC_DCDC_NRF52X_HV) || \ 40 DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))) 41 nrf_power_dcdcen_vddh_set(NRF_POWER, true); 42 #endif 43 44 return 0; 45 } 46 arch_busy_wait(uint32_t time_us)47void arch_busy_wait(uint32_t time_us) 48 { 49 nrfx_coredep_delay_us(time_us); 50 } 51 52 SYS_INIT(nordicsemi_nrf52_init, PRE_KERNEL_1, 0); 53