2 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
7 #include <dt-bindings/clock/stm32mp1-clks.h>
10 #include <platform_def.h>
11 #include <stm32mp1_clk.h>
12 #include <stm32mp1_context.h>
14 #define TAMP_BOOT_ITF_BACKUP_REG_ID U(20)
15 #define TAMP_BOOT_ITF_MASK U(0x0000FF00)
16 #define TAMP_BOOT_ITF_SHIFT 8
18 int stm32_save_boot_interface(uint32_t interface
, uint32_t instance
)
20 uint32_t tamp_clk_off
= 0;
21 uint32_t bkpr_itf_idx
= tamp_bkpr(TAMP_BOOT_ITF_BACKUP_REG_ID
);
23 if (!stm32mp1_clk_is_enabled(RTCAPB
)) {
25 if (stm32mp1_clk_enable(RTCAPB
) != 0) {
30 mmio_clrsetbits_32(bkpr_itf_idx
,
32 ((interface
<< 4) | (instance
& 0xFU
)) <<
35 if (tamp_clk_off
!= 0U) {
36 if (stm32mp1_clk_disable(RTCAPB
) != 0) {