feat(stm32mp2): enable DDR sub-system clock

Create a DDR helper files, and add a function to enable DDR clocks
in RCC_DDRCPCFGR register.
Call this ddr_sub_system_clk_init() just before clock driver init,
as it needs to be done before enabling DDR PLL clock (PLL2).

Change-Id: I365d6aa034363d0c036ce2d9f944f077ba86e193
Signed-off-by: Yann Gautier <yann.gautier@st.com>
This commit is contained in:
Yann Gautier 2024-05-21 20:54:04 +02:00
parent c3a7534167
commit 5e0be8c024
4 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,15 @@
/*
* Copyright (c) 2024, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <lib/mmio.h>
#include <platform_def.h>
void ddr_sub_system_clk_init(void)
{
mmio_write_32(stm32mp_rcc_base() + RCC_DDRCPCFGR,
RCC_DDRCPCFGR_DDRCPEN | RCC_DDRCPCFGR_DDRCPLPEN);
}

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2024, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef STM32MP2_DDR_HELPERS_H
#define STM32MP2_DDR_HELPERS_H
void ddr_sub_system_clk_init(void);
#endif /* STM32MP2_DDR_HELPERS_H */

View file

@ -10,6 +10,7 @@
#include <common/debug.h>
#include <drivers/clk.h>
#include <drivers/st/regulator_fixed.h>
#include <drivers/st/stm32mp2_ddr_helpers.h>
#include <lib/fconf/fconf.h>
#include <lib/fconf/fconf_dyn_cfg_getter.h>
#include <lib/mmio.h>
@ -186,6 +187,12 @@ void bl2_el3_plat_arch_setup(void)
reset_backup_domain();
/*
* Initialize DDR sub-system clock. This needs to be done before enabling DDR PLL (PLL2),
* and so before stm32mp2_clk_init().
*/
ddr_sub_system_clk_init();
if (stm32mp2_clk_init() < 0) {
panic();
}

View file

@ -90,5 +90,7 @@ ifeq (${STM32MP_USB_PROGRAMMER},1)
BL2_SOURCES += plat/st/stm32mp2/stm32mp2_usb_dfu.c
endif
BL2_SOURCES += drivers/st/ddr/stm32mp2_ddr_helpers.c
# Compilation rules
include plat/st/common/common_rules.mk