1 /* 2 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <errno.h> 8 9 #include <platform_def.h> 10 11 #include <drivers/st/stm32mp1_clk.h> 12 #include <dt-bindings/clock/stm32mp1-clks.h> 13 #include <lib/mmio.h> 14 15 #include <stm32mp1_context.h> 16 17 #define TAMP_BOOT_ITF_BACKUP_REG_ID U(20) 18 #define TAMP_BOOT_ITF_MASK U(0x0000FF00) 19 #define TAMP_BOOT_ITF_SHIFT 8 20 stm32_save_boot_interface(uint32_t interface,uint32_t instance)21int stm32_save_boot_interface(uint32_t interface, uint32_t instance) 22 { 23 uint32_t bkpr_itf_idx = tamp_bkpr(TAMP_BOOT_ITF_BACKUP_REG_ID); 24 25 stm32mp_clk_enable(RTCAPB); 26 27 mmio_clrsetbits_32(bkpr_itf_idx, 28 TAMP_BOOT_ITF_MASK, 29 ((interface << 4) | (instance & 0xFU)) << 30 TAMP_BOOT_ITF_SHIFT); 31 32 stm32mp_clk_disable(RTCAPB); 33 34 return 0; 35 } 36