You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2023/04/17 08:23:49 UTC
[nuttx] 02/02: stm32h7/rcc: make VOS0 configurable from board.h also for stm32h7x7xx
This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 642358e68f1a2fc097554908abdbad1c5ba7b5fb
Author: raiden00pl <ra...@railab.me>
AuthorDate: Fri Apr 14 09:33:04 2023 +0200
stm32h7/rcc: make VOS0 configurable from board.h also for stm32h7x7xx
Over-drive can be forced to a given state by adding define to the
board.h configuration file:
#define STM32_VOS_OVERDRIVE 1 - force over-drive enabled,
#define STM32_VOS_OVERDRIVE 0 - force over-drive disabled,
#undef STM32_VOS_OVERDRIVE - autoselect over-drive by the default RCC logic
---
arch/arm/src/stm32h7/stm32h7x7xx_rcc.c | 59 +++++++++++++++++++++++-----------
1 file changed, 41 insertions(+), 18 deletions(-)
diff --git a/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c b/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c
index f1bb765a2b..573e9f2d2c 100644
--- a/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c
+++ b/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c
@@ -98,6 +98,34 @@
# define USE_PLL3
#endif
+/* Over-drive is supported only for Voltage output scale 1 mode.
+ * It is required when SYSCLK frequency is over 400 MHz or it can be forced
+ * to a given state by adding define to the board.h configuration file:
+ *
+ * #define STM32_VOS_OVERDRIVE 1 - force over-drive enabled,
+ * #define STM32_VOS_OVERDRIVE 0 - force over-drive disabled,
+ * #undef STM32_VOS_OVERDRIVE - autoselect over-drive by logic below
+ *
+ * Boosting the core voltage can be a workaround solution to problems with
+ * poor board signal integration for high-speed digital interfaces like ULPI.
+ * Higher voltage means faster clock signal edges which may be sufficient to
+ * synchronise the high-speed clock and data.
+ */
+
+#ifndef STM32_VOS_OVERDRIVE
+# if (STM32_PWR_VOS_SCALE == PWR_D3CR_VOS_SCALE_1) && \
+ (STM32_SYSCLK_FREQUENCY > 400000000)
+# define STM32_VOS_OVERDRIVE 1
+# else
+# define STM32_VOS_OVERDRIVE 0
+# endif
+#else
+# if (STM32_VOS_OVERDRIVE == 1) && \
+ (STM32_PWR_VOS_SCALE != PWR_D3CR_VOS_SCALE_1)
+# error Over-drive can be selected only when VOS1 is configured
+# endif
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -855,30 +883,25 @@ void stm32_stdclockconfig(void)
{
}
- /* Over-drive is needed if
- * - Voltage output scale 1 mode is selected and SYSCLK frequency is
- * over 400 MHz.
- */
+#if STM32_VOS_OVERDRIVE && (STM32_PWR_VOS_SCALE == PWR_D3CR_VOS_SCALE_1)
+ /* Over-drive support for VOS1 */
- if ((STM32_PWR_VOS_SCALE == PWR_D3CR_VOS_SCALE_1) &&
- STM32_SYSCLK_FREQUENCY > 400000000)
- {
- /* Enable System configuration controller clock to Enable ODEN */
+ /* Enable System configuration controller clock to Enable ODEN */
- regval = getreg32(STM32_RCC_APB4ENR);
- regval |= RCC_APB4ENR_SYSCFGEN;
- putreg32(regval, STM32_RCC_APB4ENR);
+ regval = getreg32(STM32_RCC_APB4ENR);
+ regval |= RCC_APB4ENR_SYSCFGEN;
+ putreg32(regval, STM32_RCC_APB4ENR);
- /* Enable Overdrive to extend the clock frequency up to 480 MHz. */
+ /* Enable Overdrive */
- regval = getreg32(STM32_SYSCFG_PWRCR);
- regval |= SYSCFG_PWRCR_ODEN;
- putreg32(regval, STM32_SYSCFG_PWRCR);
+ regval = getreg32(STM32_SYSCFG_PWRCR);
+ regval |= SYSCFG_PWRCR_ODEN;
+ putreg32(regval, STM32_SYSCFG_PWRCR);
- while ((getreg32(STM32_PWR_D3CR) & STM32_PWR_D3CR_VOSRDY) == 0)
- {
- }
+ while ((getreg32(STM32_PWR_D3CR) & STM32_PWR_D3CR_VOSRDY) == 0)
+ {
}
+#endif
/* Configure FLASH wait states */