mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
feat(st-clock): add STM32MP2 clock driver
This driver manages the clocks on STM32MP2 platforms. It uses a dedicated RCC (Reset and Clock Control) peripheral. Change-Id: I6ba2173e73222269a2dfca4c6897229276a150c0 Signed-off-by: Yann Gautier <yann.gautier@st.com> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
This commit is contained in:
parent
85229098ab
commit
615f31fe40
5 changed files with 2422 additions and 17 deletions
2357
drivers/st/clk/clk-stm32mp2.c
Normal file
2357
drivers/st/clk/clk-stm32mp2.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, STMicroelectronics - All Rights Reserved
|
||||
* Copyright (c) 2023-2024, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -426,7 +426,7 @@
|
|||
#define RCC_USB2CFGR U(0x7FC)
|
||||
#define RCC_USB2PHY1CFGR U(0x800)
|
||||
#define RCC_USB2PHY2CFGR U(0x804)
|
||||
#define RCC_USB3DRDCFGR U(0x808)
|
||||
#define RCC_USB3DRCFGR U(0x808)
|
||||
#define RCC_USB3PCIEPHYCFGR U(0x80C)
|
||||
#define RCC_PCIECFGR U(0x810)
|
||||
#define RCC_USBTCCFGR U(0x814)
|
||||
|
@ -459,7 +459,6 @@
|
|||
#define RCC_IWDG5CFGR U(0x898)
|
||||
#define RCC_WWDG1CFGR U(0x89C)
|
||||
#define RCC_WWDG2CFGR U(0x8A0)
|
||||
#define RCC_BUSPERFMCFGR U(0x8A4)
|
||||
#define RCC_VREFCFGR U(0x8A8)
|
||||
#define RCC_TMPSENSCFGR U(0x8AC)
|
||||
#define RCC_CRCCFGR U(0x8B4)
|
||||
|
@ -2352,11 +2351,13 @@
|
|||
/* RCC_C1SREQSETR register fields */
|
||||
#define RCC_C1SREQSETR_STPREQ_P0 BIT(0)
|
||||
#define RCC_C1SREQSETR_STPREQ_P1 BIT(1)
|
||||
#define RCC_C1SREQSETR_STPREQ_MASK GENMASK_32(1, 0)
|
||||
#define RCC_C1SREQSETR_ESLPREQ BIT(16)
|
||||
|
||||
/* RCC_C1SREQCLRR register fields */
|
||||
#define RCC_C1SREQCLRR_STPREQ_P0 BIT(0)
|
||||
#define RCC_C1SREQCLRR_STPREQ_P1 BIT(1)
|
||||
#define RCC_C1SREQCLRR_STPREQ_MASK GENMASK_32(1, 0)
|
||||
#define RCC_C1SREQCLRR_ESLPREQ BIT(16)
|
||||
|
||||
/* RCC_CPUBOOTCR register fields */
|
||||
|
@ -2401,12 +2402,12 @@
|
|||
#define RCC_BDCR_LSEDRV_WIDTH 2
|
||||
|
||||
/* RCC_D3DCR register fields */
|
||||
#define RCC_D3DCR_CSION BIT(0)
|
||||
#define RCC_D3DCR_CSIKERON BIT(1)
|
||||
#define RCC_D3DCR_CSIRDY BIT(2)
|
||||
#define RCC_D3DCR_MSION BIT(0)
|
||||
#define RCC_D3DCR_MSIKERON BIT(1)
|
||||
#define RCC_D3DCR_MSIRDY BIT(2)
|
||||
#define RCC_D3DCR_D3PERCKSEL_MASK GENMASK_32(17, 16)
|
||||
#define RCC_D3DCR_D3PERCKSEL_SHIFT 16
|
||||
#define RCC_D3DCR_CSIRDY_BIT 2
|
||||
#define RCC_D3DCR_MSIRDY_BIT 2
|
||||
|
||||
/* RCC_D3DSR register fields */
|
||||
#define RCC_D3DSR_D3STATE_MASK GENMASK_32(1, 0)
|
||||
|
@ -3458,11 +3459,11 @@
|
|||
#define RCC_USB2PHYxCFGR_USB2PHY1STPEN BIT(4)
|
||||
#define RCC_USB2PHYxCFGR_USB2PHY1CKREFSEL BIT(15)
|
||||
|
||||
/* RCC_USB3DRDCFGR register fields */
|
||||
#define RCC_USB3DRDCFGR_USB3DRDRST BIT(0)
|
||||
#define RCC_USB3DRDCFGR_USB3DRDEN BIT(1)
|
||||
#define RCC_USB3DRDCFGR_USB3DRDLPEN BIT(2)
|
||||
#define RCC_USB3DRDCFGR_USB3DRDSTPEN BIT(4)
|
||||
/* RCC_USB3DRCFGR register fields */
|
||||
#define RCC_USB3DRCFGR_USB3DRRST BIT(0)
|
||||
#define RCC_USB3DRCFGR_USB3DREN BIT(1)
|
||||
#define RCC_USB3DRCFGR_USB3DRLPEN BIT(2)
|
||||
#define RCC_USB3DRCFGR_USB3DRSTPEN BIT(4)
|
||||
|
||||
/* RCC_USB3PCIEPHYCFGR register fields */
|
||||
#define RCC_USB3PCIEPHYCFGR_USB3PCIEPHYRST BIT(0)
|
||||
|
@ -3647,11 +3648,6 @@
|
|||
#define RCC_WWDG2CFGR_WWDG2LPEN BIT(2)
|
||||
#define RCC_WWDG2CFGR_WWDG2AMEN BIT(3)
|
||||
|
||||
/* RCC_BUSPERFMCFGR register fields */
|
||||
#define RCC_BUSPERFMCFGR_BUSPERFMRST BIT(0)
|
||||
#define RCC_BUSPERFMCFGR_BUSPERFMEN BIT(1)
|
||||
#define RCC_BUSPERFMCFGR_BUSPERFMLPEN BIT(2)
|
||||
|
||||
/* RCC_VREFCFGR register fields */
|
||||
#define RCC_VREFCFGR_VREFRST BIT(0)
|
||||
#define RCC_VREFCFGR_VREFEN BIT(1)
|
||||
|
|
44
include/drivers/st/stm32mp2_clk.h
Normal file
44
include/drivers/st/stm32mp2_clk.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (C) 2024, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef STM32MP2_CLK_H
|
||||
#define STM32MP2_CLK_H
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
enum stm32mp_osc_id {
|
||||
_HSI,
|
||||
_HSE,
|
||||
_CSI,
|
||||
_LSI,
|
||||
_LSE,
|
||||
_I2S_CKIN,
|
||||
_SPDIF_SYMB,
|
||||
NB_OSC,
|
||||
_UNKNOWN_OSC_ID = 0xFF
|
||||
};
|
||||
|
||||
extern const char *stm32mp_osc_node_label[NB_OSC];
|
||||
|
||||
enum pll_cfg {
|
||||
FBDIV,
|
||||
REFDIV,
|
||||
POSTDIV1,
|
||||
POSTDIV2,
|
||||
PLLCFG_NB
|
||||
};
|
||||
|
||||
enum pll_csg {
|
||||
DIVVAL,
|
||||
SPREAD,
|
||||
DOWNSPREAD,
|
||||
PLLCSG_NB
|
||||
};
|
||||
|
||||
int stm32mp2_clk_init(void);
|
||||
int stm32mp2_pll1_disable(void);
|
||||
|
||||
#endif /* STM32MP2_CLK_H */
|
|
@ -53,6 +53,9 @@ PLAT_BL_COMMON_SOURCES += plat/st/stm32mp2/${ARCH}/stm32mp2_helper.S
|
|||
|
||||
PLAT_BL_COMMON_SOURCES += drivers/st/bsec/bsec3.c
|
||||
|
||||
PLAT_BL_COMMON_SOURCES += drivers/st/clk/clk-stm32-core.c \
|
||||
drivers/st/clk/clk-stm32mp2.c
|
||||
|
||||
BL2_SOURCES += plat/st/stm32mp2/plat_bl2_mem_params_desc.c
|
||||
BL2_SOURCES += plat/st/stm32mp2/bl2_plat_setup.c
|
||||
|
||||
|
|
|
@ -292,6 +292,11 @@ static inline uintptr_t tamp_bkpr(uint32_t idx)
|
|||
#define STGEN_BASE U(0x48080000)
|
||||
#define SYSCFG_BASE U(0x44230000)
|
||||
|
||||
/*******************************************************************************
|
||||
* STM32MP CA35SSC
|
||||
******************************************************************************/
|
||||
#define A35SSC_BASE U(0x48800000)
|
||||
|
||||
/*******************************************************************************
|
||||
* REGULATORS
|
||||
******************************************************************************/
|
||||
|
|
Loading…
Add table
Reference in a new issue