13007c728SYann Gautier /* 2*399cfdd4SNicolas Le Bayon * Copyright (c) 2024-2025, STMicroelectronics - All Rights Reserved 33007c728SYann Gautier * 43007c728SYann Gautier * SPDX-License-Identifier: BSD-3-Clause 53007c728SYann Gautier */ 63007c728SYann Gautier 73007c728SYann Gautier #ifndef STM32MP2_PRIVATE_H 83007c728SYann Gautier #define STM32MP2_PRIVATE_H 93007c728SYann Gautier 10db77f8bfSYann Gautier void configure_mmu(void); 11db77f8bfSYann Gautier 12154e6e62SYann Gautier uint32_t stm32mp_syscfg_get_chip_dev_id(void); 13154e6e62SYann Gautier 14*399cfdd4SNicolas Le Bayon /* Get RISAF platform instance ID from peripheral IO memory base address */ 15*399cfdd4SNicolas Le Bayon int stm32_risaf_get_instance(uintptr_t base); 16*399cfdd4SNicolas Le Bayon 17*399cfdd4SNicolas Le Bayon /* Get RISAF peripheral IO memory base address from platform instance ID */ 18*399cfdd4SNicolas Le Bayon uintptr_t stm32_risaf_get_base(int instance); 19*399cfdd4SNicolas Le Bayon 20*399cfdd4SNicolas Le Bayon /* Get RISAF maximum number of regions from platform instance ID */ 21*399cfdd4SNicolas Le Bayon int stm32_risaf_get_max_region(int instance); 22*399cfdd4SNicolas Le Bayon 23*399cfdd4SNicolas Le Bayon /* Get RISAF memory base address from platform instance ID */ 24*399cfdd4SNicolas Le Bayon uintptr_t stm32_risaf_get_memory_base(int instance); 25*399cfdd4SNicolas Le Bayon 26*399cfdd4SNicolas Le Bayon /* Get RISAF memory size in bytes from platform instance ID */ 27*399cfdd4SNicolas Le Bayon size_t stm32_risaf_get_memory_size(int instance); 28*399cfdd4SNicolas Le Bayon 292fd7b230SNicolas Le Bayon /* Get DDRDBG peripheral IO memory base address */ 302fd7b230SNicolas Le Bayon uintptr_t stm32_ddrdbg_get_base(void); 312fd7b230SNicolas Le Bayon 323007c728SYann Gautier /* Wrappers for OTP / BSEC functions */ 333007c728SYann Gautier static inline uint32_t stm32_otp_probe(void) 343007c728SYann Gautier { 353007c728SYann Gautier return bsec_probe(); 363007c728SYann Gautier } 373007c728SYann Gautier 383007c728SYann Gautier static inline uint32_t stm32_otp_read(uint32_t *val, uint32_t otp) 393007c728SYann Gautier { 403007c728SYann Gautier return bsec_read_otp(val, otp); 413007c728SYann Gautier } 423007c728SYann Gautier 433007c728SYann Gautier static inline uint32_t stm32_otp_shadow_read(uint32_t *val, uint32_t otp) 443007c728SYann Gautier { 453007c728SYann Gautier return bsec_shadow_read_otp(val, otp); 463007c728SYann Gautier } 473007c728SYann Gautier 483007c728SYann Gautier static inline uint32_t stm32_otp_write(uint32_t val, uint32_t otp) 493007c728SYann Gautier { 503007c728SYann Gautier return bsec_write_otp(val, otp); 513007c728SYann Gautier } 523007c728SYann Gautier 533007c728SYann Gautier static inline uint32_t stm32_otp_set_sr_lock(uint32_t otp) 543007c728SYann Gautier { 553007c728SYann Gautier return bsec_set_sr_lock(otp); 563007c728SYann Gautier } 573007c728SYann Gautier 583007c728SYann Gautier static inline uint32_t stm32_otp_read_sw_lock(uint32_t otp, bool *value) 593007c728SYann Gautier { 603007c728SYann Gautier return bsec_read_sw_lock(otp, value); 613007c728SYann Gautier } 623007c728SYann Gautier 633007c728SYann Gautier static inline bool stm32_otp_is_closed_device(void) 643007c728SYann Gautier { 653007c728SYann Gautier return bsec_mode_is_closed_device(); 663007c728SYann Gautier } 673007c728SYann Gautier 683007c728SYann Gautier #endif /* STM32MP2_PRIVATE_H */ 69