echoplayer: set cpu_power_on pin high as early as possible

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 86c975ee88526c2d5e4f5f9b6935a8dc218f4034
Author: Aidan MacDonald <[email protected]>
Date:   Fri Jan 16 23:32:42 2026 +0000

    echoplayer: set cpu_power_on pin high as early as possible
    
    Change-Id: I6b7343cc81973c4c0a14396b2ecd622fc1c65d30

diff --git a/firmware/target/arm/stm32/echoplayer/system-echoplayer.c b/firmware/target/arm/stm32/echoplayer/system-echoplayer.c
index 3686ffb55b..15ca8a81c9 100644
--- a/firmware/target/arm/stm32/echoplayer/system-echoplayer.c
+++ b/firmware/target/arm/stm32/echoplayer/system-echoplayer.c
@@ -69,7 +69,6 @@ static const struct gpio_setting gpios[] = {
     STM_DEFGPIO(GPIO_BUTTON_VOL_DOWN,   F_INPUT_PU),
     STM_DEFGPIO(GPIO_BUTTON_POWER,      F_INPUT_PD),
     STM_DEFGPIO(GPIO_BUTTON_HOLD,       F_INPUT_PU),
-    STM_DEFGPIO(GPIO_CPU_POWER_ON,      F_OUT_LS(1)), /* active high */
     STM_DEFGPIO(GPIO_POWER_1V8,         F_OUT_LS(0)), /* active high */
     STM_DEFGPIO(GPIO_CODEC_AVDD_EN,     F_OUT_LS(1)), /* active low */
     STM_DEFGPIO(GPIO_CODEC_DVDD_EN,     F_OUT_LS(1)), /* active low */
@@ -123,24 +122,6 @@ static const struct pingroup_setting pingroups[] = {
     STM_DEFPINS(GPIO_I, 0x06e7, F_LCD_AF14),
 };
 
-INIT_ATTR static void gpio_init(void)
-{
-    /* Enable clocks for all used GPIO banks */
-    reg_writef(RCC_AHB4ENR,
-               GPIOAEN(1), GPIOBEN(1), GPIOCEN(1), GPIODEN(1),
-               GPIOEEN(1), GPIOFEN(1), GPIOGEN(1), GPIOHEN(1), GPIOIEN(1));
-
-    /*
-     * NOTE: I think it's possible to disable clocks for the banks which
-     * we don't need to access at runtime because these are only clocking
-     * register access. Probably a micro-optimization but it supposedly
-     * does save a few uA/MHz.
-     */
-
-    gpio_configure_all(gpios, ARRAYLEN(gpios),
-                       pingroups, ARRAYLEN(pingroups));
-}
-
 INIT_ATTR static void fmc_init(void)
 {
     /* configure clock */
@@ -190,6 +171,25 @@ INIT_ATTR static void fmc_init(void)
 
 void system_init(void)
 {
+    /* Enable clocks for all used GPIO banks */
+    reg_writef(RCC_AHB4ENR,
+               GPIOAEN(1), GPIOBEN(1), GPIOCEN(1), GPIODEN(1),
+               GPIOEEN(1), GPIOFEN(1), GPIOGEN(1), GPIOHEN(1), GPIOIEN(1));
+
+    /*
+     * NOTE: I think it's possible to disable clocks for the banks which
+     * we don't need to access at runtime because these are only clocking
+     * register access. Probably a micro-optimization but it supposedly
+     * does save a few uA/MHz.
+     */
+
+    /*
+     * Set cpu_power_on high as early as possible to
+     * ensure we won't brown out if the power button
+     * isn't pressed.
+     */
+    gpio_configure_single(GPIO_CPU_POWER_ON, F_OUT_LS(1));
+
     /* Set vector table address */
     extern char __vectors_arm[];
     reg_var(CM_SCB_VTOR) = (uint32_t)__vectors_arm;
@@ -208,7 +208,8 @@ void system_init(void)
     stm32_systick_enable();
 
     /* Configure GPIOs and start FMC */
-    gpio_init();
+    gpio_configure_all(gpios, ARRAYLEN(gpios),
+                       pingroups, ARRAYLEN(pingroups));
     fmc_init();
 
     /* Disable RTC_OUT pin */
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.