1 /* 2 * Copyright (c) 2024-2025, STMicroelectronics - All Rights Reserved 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef STM32MP2_PRIVATE_H 8 #define STM32MP2_PRIVATE_H 9 10 void configure_mmu(void); 11 12 uint32_t stm32mp_syscfg_get_chip_dev_id(void); 13 14 /* Get RISAF platform instance ID from peripheral IO memory base address */ 15 int stm32_risaf_get_instance(uintptr_t base); 16 17 /* Get RISAF peripheral IO memory base address from platform instance ID */ 18 uintptr_t stm32_risaf_get_base(int instance); 19 20 /* Get RISAF maximum number of regions from platform instance ID */ 21 int stm32_risaf_get_max_region(int instance); 22 23 /* Get RISAF memory base address from platform instance ID */ 24 uintptr_t stm32_risaf_get_memory_base(int instance); 25 26 /* Get RISAF memory size in bytes from platform instance ID */ 27 size_t stm32_risaf_get_memory_size(int instance); 28 29 /* Get DDRDBG peripheral IO memory base address */ 30 uintptr_t stm32_ddrdbg_get_base(void); 31 32 /* Wrappers for OTP / BSEC functions */ 33 static inline uint32_t stm32_otp_probe(void) 34 { 35 return bsec_probe(); 36 } 37 38 static inline uint32_t stm32_otp_read(uint32_t *val, uint32_t otp) 39 { 40 return bsec_read_otp(val, otp); 41 } 42 43 static inline uint32_t stm32_otp_shadow_read(uint32_t *val, uint32_t otp) 44 { 45 return bsec_shadow_read_otp(val, otp); 46 } 47 48 static inline uint32_t stm32_otp_write(uint32_t val, uint32_t otp) 49 { 50 return bsec_write_otp(val, otp); 51 } 52 53 static inline uint32_t stm32_otp_set_sr_lock(uint32_t otp) 54 { 55 return bsec_set_sr_lock(otp); 56 } 57 58 static inline uint32_t stm32_otp_read_sw_lock(uint32_t otp, bool *value) 59 { 60 return bsec_read_sw_lock(otp, value); 61 } 62 63 static inline bool stm32_otp_is_closed_device(void) 64 { 65 return bsec_mode_is_closed_device(); 66 } 67 68 #endif /* STM32MP2_PRIVATE_H */ 69