mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00

PWR, RCC, DDRPHYC & DDRCTRL addresses can be retrieved from device tree. Platform asserts the value read from the DT are the SoC addresses. Change-Id: I43f0890b51918a30c87ac067d3780ab27a0f59de Signed-off-by: Yann Gautier <yann.gautier@st.com> Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Nicolas LE BAYON <nicolas.le.bayon@st.com>
42 lines
989 B
C
42 lines
989 B
C
/*
|
|
* Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <limits.h>
|
|
|
|
#include <platform_def.h>
|
|
|
|
#include <common/bl_common.h>
|
|
#include <common/debug.h>
|
|
#include <drivers/st/stm32mp_reset.h>
|
|
#include <lib/mmio.h>
|
|
#include <lib/utils_def.h>
|
|
|
|
#define RST_CLR_OFFSET 4U
|
|
|
|
void stm32mp_reset_assert(uint32_t id)
|
|
{
|
|
uint32_t offset = (id / (uint32_t)__LONG_BIT) * sizeof(uintptr_t);
|
|
uint32_t bit = id % (uint32_t)__LONG_BIT;
|
|
uintptr_t rcc_base = stm32mp_rcc_base();
|
|
|
|
mmio_write_32(rcc_base + offset, BIT(bit));
|
|
while ((mmio_read_32(rcc_base + offset) & BIT(bit)) == 0U) {
|
|
;
|
|
}
|
|
}
|
|
|
|
void stm32mp_reset_deassert(uint32_t id)
|
|
{
|
|
uint32_t offset = ((id / (uint32_t)__LONG_BIT) * sizeof(uintptr_t)) +
|
|
RST_CLR_OFFSET;
|
|
uint32_t bit = id % (uint32_t)__LONG_BIT;
|
|
uintptr_t rcc_base = stm32mp_rcc_base();
|
|
|
|
mmio_write_32(rcc_base + offset, BIT(bit));
|
|
while ((mmio_read_32(rcc_base + offset) & BIT(bit)) != 0U) {
|
|
;
|
|
}
|
|
}
|