mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi
@ 2025-04-14  6:50 Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 2/6] ARM: i.MX8MP: skov: decrease VDD_SOC to 850mV Ahmad Fatoum
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  6:50 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This file is now available in Linux since v6.15-rc1, so we do not need
to duplicate it in barebox for boards to make use of it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/dts/imx8mp-nominal.dtsi | 49 --------------------------------
 1 file changed, 49 deletions(-)
 delete mode 100644 arch/arm/dts/imx8mp-nominal.dtsi

diff --git a/arch/arm/dts/imx8mp-nominal.dtsi b/arch/arm/dts/imx8mp-nominal.dtsi
deleted file mode 100644
index d675d1e5486e..000000000000
--- a/arch/arm/dts/imx8mp-nominal.dtsi
+++ /dev/null
@@ -1,49 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-
-&clk {
-	assigned-clocks = <&clk IMX8MP_CLK_A53_SRC>,
-			  <&clk IMX8MP_CLK_A53_CORE>,
-			  <&clk IMX8MP_SYS_PLL3>,
-			  <&clk IMX8MP_CLK_NOC>,
-			  <&clk IMX8MP_CLK_NOC_IO>,
-			  <&clk IMX8MP_CLK_GIC>;
-	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
-				 <&clk IMX8MP_ARM_PLL_OUT>,
-				 <0>,
-				 <&clk IMX8MP_SYS_PLL1_800M>,
-				 <&clk IMX8MP_SYS_PLL3_OUT>,
-				 <&clk IMX8MP_SYS_PLL1_800M>;
-	assigned-clock-rates = <0>, <0>,
-			       <600000000>,
-			       <800000000>,
-			       <600000000>,
-			       <400000000>;
-};
-
-&pgc_hsiomix {
-	assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
-	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>;
-	assigned-clock-rates = <400000000>;
-};
-
-&pgc_gpumix {
-	assigned-clocks = <&clk IMX8MP_CLK_GPU_AXI>,
-			  <&clk IMX8MP_CLK_GPU_AHB>;
-	assigned-clock-parents = <&clk IMX8MP_SYS_PLL3_OUT>,
-				 <&clk IMX8MP_SYS_PLL3_OUT>;
-	assigned-clock-rates = <600000000>, <300000000>;
-};
-
-&media_blk_ctrl {
-	assigned-clocks = <&clk IMX8MP_CLK_MEDIA_AXI>,
-			  <&clk IMX8MP_CLK_MEDIA_APB>,
-			  <&clk IMX8MP_CLK_MEDIA_DISP1_PIX>,
-			  <&clk IMX8MP_CLK_MEDIA_DISP2_PIX>,
-			  <&clk IMX8MP_VIDEO_PLL1>;
-	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
-				 <&clk IMX8MP_SYS_PLL1_800M>,
-				 <&clk IMX8MP_VIDEO_PLL1_OUT>,
-				 <&clk IMX8MP_VIDEO_PLL1_OUT>;
-	assigned-clock-rates = <400000000>, <200000000>,
-			       <0>, <0>, <1039500000>;
-};
-- 
2.39.5




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/6] ARM: i.MX8MP: skov: decrease VDD_SOC to 850mV
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
@ 2025-04-14  6:50 ` Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 3/6] ARM: i.MX8MP: skov: assert switch reset early Ahmad Fatoum
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  6:50 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We don't do dynamic voltage scaling for VDD_SOC, so the value set in
barebox may never change if the Linux PMIC driver doesn't intentionally
change it. The static configuration we had in barebox was for overdrive
mode, but the kernel DT since v6.15-rc1 now configures all clocks for
nominal mode instead as that's what the heat sink was specced for.

Nominal mode is 850mV, so configure BUCK1 RUN voltage to exactly that
value.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/skov-imx8mp/lowlevel.c | 16 ++++++++--------
 arch/arm/dts/imx8mp-skov.dts           |  1 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
index c35ffe526dae..692482f43580 100644
--- a/arch/arm/boards/skov-imx8mp/lowlevel.c
+++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
@@ -48,22 +48,22 @@ static struct pmic_config pca9450_cfg[] = {
 	/* BUCKxOUT_DVS0/1 control BUCK123 output */
 	{ PCA9450_BUCK123_DVS, 0x29 },
 	/*
-	 * increase VDD_SOC to typical value 0.95V before first
+	 * Set VDD_SOC to typical value 0.85V before first
 	 * DRAM access, set DVS1 to 0.85v for suspend.
 	 * Enable DVS control through PMIC_STBY_REQ and
 	 * set B1_ENMODE=1 (ON by PMIC_ON_REQ=H)
 	 */
-	{ PCA9450_BUCK1OUT_DVS0, 0x1C },
+	{ PCA9450_BUCK1OUT_DVS0, 0x14 },
 	{ PCA9450_BUCK1OUT_DVS1, 0x14 },
 	{ PCA9450_BUCK1CTRL, 0x59 },
-	/*
-	 * Increase VDD_ARM to 0.95V to avoid issues in case software after
-	 * Barebox switches to the OD ARM frequency without reprogramming the
-	 * PMIC first.
-	 */
-	{ PCA9450_BUCK2OUT_DVS0, 0x1C },
 	/* set WDOG_B_CFG to cold reset */
 	{ PCA9450_RESET_CTRL, 0xA1 },
+	/*
+	 * As we do cold resets and Linux will take care to reconfigure the
+	 * pmic before switching to the OD ARM frequency, we will just keep
+	 * VDD_ARM at 850mV
+	 */
+	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
 };
 
 static void power_init_board(void)
diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
index 5271c9deabe5..9ec0b9d21709 100644
--- a/arch/arm/dts/imx8mp-skov.dts
+++ b/arch/arm/dts/imx8mp-skov.dts
@@ -4,6 +4,7 @@
 
 #include <arm64/freescale/imx8mp.dtsi>
 #include "imx8mp.dtsi"
+#include <arm64/freescale/imx8mp-nominal.dtsi>
 
 #include <dt-bindings/leds/common.h>
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/6] ARM: i.MX8MP: skov: assert switch reset early
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 2/6] ARM: i.MX8MP: skov: decrease VDD_SOC to 850mV Ahmad Fatoum
@ 2025-04-14  6:50 ` Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good Ahmad Fatoum
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  6:50 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Switch reset is pulled up, so it's asserted when its rail is powered up.
This happens in parallel to the rail being powered on, which violates
the power sequencing. Workaround this, by moving the switch into reset
as early as possible to avoid erratic behavior until the driver is ready
to take it out of reset.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/skov-imx8mp/lowlevel.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
index 692482f43580..637fc50b3f30 100644
--- a/arch/arm/boards/skov-imx8mp/lowlevel.c
+++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
@@ -16,6 +16,7 @@
 #include <pbl/i2c.h>
 #include <pbl/pmic.h>
 #include <soc/imx8m/ddr.h>
+#include <mach/imx/imx-gpio.h>
 
 extern char __dtb_z_imx8mp_skov_start[];
 
@@ -70,6 +71,12 @@ static void power_init_board(void)
 {
 	struct pbl_i2c *i2c;
 
+	/* Assert switch reset early to avoid erratic behavior due to
+	 * violating power sequencing
+	 */
+	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
+	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
+
 	imx8mp_setup_pad(MX8MP_PAD_I2C1_SCL__I2C1_SCL | I2C_PAD_CTRL);
 	imx8mp_setup_pad(MX8MP_PAD_I2C1_SDA__I2C1_SDA | I2C_PAD_CTRL);
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 2/6] ARM: i.MX8MP: skov: decrease VDD_SOC to 850mV Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 3/6] ARM: i.MX8MP: skov: assert switch reset early Ahmad Fatoum
@ 2025-04-14  6:50 ` Ahmad Fatoum
  2025-04-14  8:40   ` Marco Felsch
  2025-04-14  6:50 ` [PATCH 5/6] ARM: skov-imx8mp: print initial > on every boot Ahmad Fatoum
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  6:50 UTC (permalink / raw)
  To: barebox; +Cc: Kim Christensen, Ahmad Fatoum

The 24V regulator supplying the system can indicate via a GPIO imminent
voltage loss. The board's capacitors hold enough charge to power the system
a while longer in such a state, but eventually, unless external power is
restored, the brownout detection of the PMIC will kick in.

For the span of time between voltage drop detection and PMIC brownout,
let's detect this situation and delay startup. This way, Linux can
detect the ongoing voltage loss, power down the eMMC, reboot into
barebox and barebox will delay boot as long as the problem persists.

Co-developed-by: Kim Christensen <kch@skov.dk>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
index 637fc50b3f30..d7bd771f259d 100644
--- a/arch/arm/boards/skov-imx8mp/lowlevel.c
+++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
@@ -20,6 +20,9 @@
 
 extern char __dtb_z_imx8mp_skov_start[];
 
+#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
+				     MX8MP_PAD_CTL_PE)
+
 #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
 				     MX8MP_PAD_CTL_FSEL | \
 				     MX8MP_PAD_CTL_PUE | \
@@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
 				     MX8MP_PAD_CTL_PUE | \
 				     MX8MP_PAD_CTL_PE)
 
+static inline void led_d1_toggle(bool *on)
+{
+	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
+	*on = !*on;
+}
+
 static void setup_uart(void)
 {
 	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
@@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
 	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
 };
 
+static inline bool power_good(void)
+{
+	/* IMX_SHDN_MF in schematics */
+	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
+}
+
+static void wait_for_power_good(void)
+{
+	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
+	int timeout_ms = 0;
+	bool led_active = true;
+
+	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
+	imx8m_gpio_direction_input(gpio4, 23);
+
+	led_d1_toggle(&led_active);
+
+	if (power_good())
+		return;
+
+	pr_warn("\nDelaying boot until power stabilizes\n");
+
+	/* If we reach this, because Linux did a hw_protection_reboot, we don't
+	 * want to continue booting right away.
+	 *
+	 * Thus let's either wait for the condition to subscede or for voltage
+	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
+	 * lower than allowed
+	 */
+
+	while (1) {
+		if (power_good()) {
+			/* wait 10ms longer and check if it still good */
+			udelay(10000);
+			if (power_good()) {
+				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
+				break;
+			}
+		}
+		/* fast blink LED D1 */
+		if (timeout_ms % 100 == 0) {
+			pr_debug(".");
+			led_d1_toggle(&led_active);
+		}
+		udelay(1000);
+		timeout_ms++;
+	}
+}
+
 static void power_init_board(void)
 {
 	struct pbl_i2c *i2c;
@@ -77,6 +135,8 @@ static void power_init_board(void)
 	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
 	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
 
+	wait_for_power_good();
+
 	imx8mp_setup_pad(MX8MP_PAD_I2C1_SCL__I2C1_SCL | I2C_PAD_CTRL);
 	imx8mp_setup_pad(MX8MP_PAD_I2C1_SDA__I2C1_SDA | I2C_PAD_CTRL);
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 5/6] ARM: skov-imx8mp: print initial > on every boot
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2025-04-14  6:50 ` [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good Ahmad Fatoum
@ 2025-04-14  6:50 ` Ahmad Fatoum
  2025-04-14  6:50 ` [PATCH 6/6] ARM: i.MX8MP: skov: add new 7" g07017 variant support Ahmad Fatoum
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  6:50 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

putc_ll expands to nothing if CONFIG_DEBUG_LL is not defined. As we have
normal CONFIG_PBL_CONSOLE support, we can just use normal printing
functions to always output. Let's do that, so we have a very early
character (>) printed to console to indicate that barebox was entered,
even if further boot was to hang shortly after for whatever reason.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/skov-imx8mp/lowlevel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
index d7bd771f259d..1fd665d67675 100644
--- a/arch/arm/boards/skov-imx8mp/lowlevel.c
+++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
@@ -51,7 +51,7 @@ static void setup_uart(void)
 
 	pbl_set_putc(imx_uart_putc, uart);
 
-	putc_ll('>');
+	putchar('>');
 }
 
 static struct pmic_config pca9450_cfg[] = {
-- 
2.39.5




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 6/6] ARM: i.MX8MP: skov: add new 7" g07017 variant support
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2025-04-14  6:50 ` [PATCH 5/6] ARM: skov-imx8mp: print initial > on every boot Ahmad Fatoum
@ 2025-04-14  6:50 ` Ahmad Fatoum
  2025-04-14  8:37 ` [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Sascha Hauer
  2025-04-15  6:48 ` Sascha Hauer
  6 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  6:50 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Add new 7" TIAN G07017 board variant.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/skov-imx8mp/board.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boards/skov-imx8mp/board.c b/arch/arm/boards/skov-imx8mp/board.c
index ce8d154a7355..0e471a3437bf 100644
--- a/arch/arm/boards/skov-imx8mp/board.c
+++ b/arch/arm/boards/skov-imx8mp/board.c
@@ -86,6 +86,10 @@ static const struct board_description imx8mp_variants[] = {
 	[2] = {
 		.dts_compatible = "skov,imx8mp-skov-revc-bd500",
 	},
+
+	[3] = {
+		.dts_compatible = "skov,imx8mp-skov-revc-tian-g07017",
+	},
 };
 
 static const struct board_description imx8mp_basic_variant = {
-- 
2.39.5




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2025-04-14  6:50 ` [PATCH 6/6] ARM: i.MX8MP: skov: add new 7" g07017 variant support Ahmad Fatoum
@ 2025-04-14  8:37 ` Sascha Hauer
  2025-04-14  8:46   ` Ahmad Fatoum
  2025-04-15  6:48 ` Sascha Hauer
  6 siblings, 1 reply; 16+ messages in thread
From: Sascha Hauer @ 2025-04-14  8:37 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Apr 14, 2025 at 08:50:04AM +0200, Ahmad Fatoum wrote:
> This file is now available in Linux since v6.15-rc1, so we do not need
> to duplicate it in barebox for boards to make use of it.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/dts/imx8mp-nominal.dtsi | 49 --------------------------------
>  1 file changed, 49 deletions(-)
>  delete mode 100644 arch/arm/dts/imx8mp-nominal.dtsi
> 
> diff --git a/arch/arm/dts/imx8mp-nominal.dtsi b/arch/arm/dts/imx8mp-nominal.dtsi
> deleted file mode 100644

This is used by imx8mp-skov-reva.dtsi. Should the include be changed to
use <> instead of "" now?

Sascha

> index d675d1e5486e..000000000000
> --- a/arch/arm/dts/imx8mp-nominal.dtsi
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> -
> -&clk {
> -	assigned-clocks = <&clk IMX8MP_CLK_A53_SRC>,
> -			  <&clk IMX8MP_CLK_A53_CORE>,
> -			  <&clk IMX8MP_SYS_PLL3>,
> -			  <&clk IMX8MP_CLK_NOC>,
> -			  <&clk IMX8MP_CLK_NOC_IO>,
> -			  <&clk IMX8MP_CLK_GIC>;
> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
> -				 <&clk IMX8MP_ARM_PLL_OUT>,
> -				 <0>,
> -				 <&clk IMX8MP_SYS_PLL1_800M>,
> -				 <&clk IMX8MP_SYS_PLL3_OUT>,
> -				 <&clk IMX8MP_SYS_PLL1_800M>;
> -	assigned-clock-rates = <0>, <0>,
> -			       <600000000>,
> -			       <800000000>,
> -			       <600000000>,
> -			       <400000000>;
> -};
> -
> -&pgc_hsiomix {
> -	assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>;
> -	assigned-clock-rates = <400000000>;
> -};
> -
> -&pgc_gpumix {
> -	assigned-clocks = <&clk IMX8MP_CLK_GPU_AXI>,
> -			  <&clk IMX8MP_CLK_GPU_AHB>;
> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL3_OUT>,
> -				 <&clk IMX8MP_SYS_PLL3_OUT>;
> -	assigned-clock-rates = <600000000>, <300000000>;
> -};
> -
> -&media_blk_ctrl {
> -	assigned-clocks = <&clk IMX8MP_CLK_MEDIA_AXI>,
> -			  <&clk IMX8MP_CLK_MEDIA_APB>,
> -			  <&clk IMX8MP_CLK_MEDIA_DISP1_PIX>,
> -			  <&clk IMX8MP_CLK_MEDIA_DISP2_PIX>,
> -			  <&clk IMX8MP_VIDEO_PLL1>;
> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
> -				 <&clk IMX8MP_SYS_PLL1_800M>,
> -				 <&clk IMX8MP_VIDEO_PLL1_OUT>,
> -				 <&clk IMX8MP_VIDEO_PLL1_OUT>;
> -	assigned-clock-rates = <400000000>, <200000000>,
> -			       <0>, <0>, <1039500000>;
> -};
> -- 
> 2.39.5
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14  6:50 ` [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good Ahmad Fatoum
@ 2025-04-14  8:40   ` Marco Felsch
  2025-04-14  8:46     ` Ahmad Fatoum
  0 siblings, 1 reply; 16+ messages in thread
From: Marco Felsch @ 2025-04-14  8:40 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Kim Christensen

Hi,

On 25-04-14, Ahmad Fatoum wrote:
> The 24V regulator supplying the system can indicate via a GPIO imminent
> voltage loss. The board's capacitors hold enough charge to power the system
> a while longer in such a state, but eventually, unless external power is
> restored, the brownout detection of the PMIC will kick in.
> 
> For the span of time between voltage drop detection and PMIC brownout,
> let's detect this situation and delay startup. This way, Linux can
> detect the ongoing voltage loss, power down the eMMC, reboot into
> barebox and barebox will delay boot as long as the problem persists.
> 
> Co-developed-by: Kim Christensen <kch@skov.dk>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
> 
> diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
> index 637fc50b3f30..d7bd771f259d 100644
> --- a/arch/arm/boards/skov-imx8mp/lowlevel.c
> +++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
> @@ -20,6 +20,9 @@
>  
>  extern char __dtb_z_imx8mp_skov_start[];
>  
> +#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
> +				     MX8MP_PAD_CTL_PE)
> +
>  #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
>  				     MX8MP_PAD_CTL_FSEL | \
>  				     MX8MP_PAD_CTL_PUE | \
> @@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
>  				     MX8MP_PAD_CTL_PUE | \
>  				     MX8MP_PAD_CTL_PE)
>  
> +static inline void led_d1_toggle(bool *on)
> +{
> +	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
> +	*on = !*on;
> +}
> +
>  static void setup_uart(void)
>  {
>  	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
> @@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
>  	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
>  };
>  
> +static inline bool power_good(void)
> +{
> +	/* IMX_SHDN_MF in schematics */
> +	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
> +}
> +
> +static void wait_for_power_good(void)
> +{
> +	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
> +	int timeout_ms = 0;
> +	bool led_active = true;
> +
> +	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
> +	imx8m_gpio_direction_input(gpio4, 23);
> +
> +	led_d1_toggle(&led_active);
> +
> +	if (power_good())
> +		return;
> +
> +	pr_warn("\nDelaying boot until power stabilizes\n");
> +
> +	/* If we reach this, because Linux did a hw_protection_reboot, we don't
> +	 * want to continue booting right away.
> +	 *
> +	 * Thus let's either wait for the condition to subscede or for voltage
> +	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
> +	 * lower than allowed
> +	 */
> +
> +	while (1) {
> +		if (power_good()) {
> +			/* wait 10ms longer and check if it still good */
> +			udelay(10000);
> +			if (power_good()) {
> +				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
> +				break;
> +			}
> +		}
> +		/* fast blink LED D1 */
> +		if (timeout_ms % 100 == 0) {
> +			pr_debug(".");
> +			led_d1_toggle(&led_active);
> +		}
> +		udelay(1000);
> +		timeout_ms++;
> +	}
> +}
> +
>  static void power_init_board(void)
>  {
>  	struct pbl_i2c *i2c;
> @@ -77,6 +135,8 @@ static void power_init_board(void)
>  	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
>  	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
>  
> +	wait_for_power_good();

out of curiosity, wouldn't it be more useful to do the check right
before the system wants to boot the kernel and abort in that case?

Regards,
  Marco


> +
>  	imx8mp_setup_pad(MX8MP_PAD_I2C1_SCL__I2C1_SCL | I2C_PAD_CTRL);
>  	imx8mp_setup_pad(MX8MP_PAD_I2C1_SDA__I2C1_SDA | I2C_PAD_CTRL);
>  
> -- 
> 2.39.5
> 
> 
> 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi
  2025-04-14  8:37 ` [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Sascha Hauer
@ 2025-04-14  8:46   ` Ahmad Fatoum
  2025-04-14  9:19     ` Sascha Hauer
  0 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  8:46 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 14.04.25 10:37, Sascha Hauer wrote:
> On Mon, Apr 14, 2025 at 08:50:04AM +0200, Ahmad Fatoum wrote:
>> This file is now available in Linux since v6.15-rc1, so we do not need
>> to duplicate it in barebox for boards to make use of it.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/arm/dts/imx8mp-nominal.dtsi | 49 --------------------------------
>>  1 file changed, 49 deletions(-)
>>  delete mode 100644 arch/arm/dts/imx8mp-nominal.dtsi
>>
>> diff --git a/arch/arm/dts/imx8mp-nominal.dtsi b/arch/arm/dts/imx8mp-nominal.dtsi
>> deleted file mode 100644
> 
> This is used by imx8mp-skov-reva.dtsi. Should the include be changed to
> use <> instead of "" now?

imx8mp-skov-reva.dtsi is in dts/ and there is a version of that file there.
This file here is unreferenced and the upstream version will be used
in the follow-up commit.

Thanks,
Ahmad

> 
> Sascha
> 
>> index d675d1e5486e..000000000000
>> --- a/arch/arm/dts/imx8mp-nominal.dtsi
>> +++ /dev/null
>> @@ -1,49 +0,0 @@
>> -// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> -
>> -&clk {
>> -	assigned-clocks = <&clk IMX8MP_CLK_A53_SRC>,
>> -			  <&clk IMX8MP_CLK_A53_CORE>,
>> -			  <&clk IMX8MP_SYS_PLL3>,
>> -			  <&clk IMX8MP_CLK_NOC>,
>> -			  <&clk IMX8MP_CLK_NOC_IO>,
>> -			  <&clk IMX8MP_CLK_GIC>;
>> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
>> -				 <&clk IMX8MP_ARM_PLL_OUT>,
>> -				 <0>,
>> -				 <&clk IMX8MP_SYS_PLL1_800M>,
>> -				 <&clk IMX8MP_SYS_PLL3_OUT>,
>> -				 <&clk IMX8MP_SYS_PLL1_800M>;
>> -	assigned-clock-rates = <0>, <0>,
>> -			       <600000000>,
>> -			       <800000000>,
>> -			       <600000000>,
>> -			       <400000000>;
>> -};
>> -
>> -&pgc_hsiomix {
>> -	assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
>> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>;
>> -	assigned-clock-rates = <400000000>;
>> -};
>> -
>> -&pgc_gpumix {
>> -	assigned-clocks = <&clk IMX8MP_CLK_GPU_AXI>,
>> -			  <&clk IMX8MP_CLK_GPU_AHB>;
>> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL3_OUT>,
>> -				 <&clk IMX8MP_SYS_PLL3_OUT>;
>> -	assigned-clock-rates = <600000000>, <300000000>;
>> -};
>> -
>> -&media_blk_ctrl {
>> -	assigned-clocks = <&clk IMX8MP_CLK_MEDIA_AXI>,
>> -			  <&clk IMX8MP_CLK_MEDIA_APB>,
>> -			  <&clk IMX8MP_CLK_MEDIA_DISP1_PIX>,
>> -			  <&clk IMX8MP_CLK_MEDIA_DISP2_PIX>,
>> -			  <&clk IMX8MP_VIDEO_PLL1>;
>> -	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
>> -				 <&clk IMX8MP_SYS_PLL1_800M>,
>> -				 <&clk IMX8MP_VIDEO_PLL1_OUT>,
>> -				 <&clk IMX8MP_VIDEO_PLL1_OUT>;
>> -	assigned-clock-rates = <400000000>, <200000000>,
>> -			       <0>, <0>, <1039500000>;
>> -};
>> -- 
>> 2.39.5
>>
>>
>>
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14  8:40   ` Marco Felsch
@ 2025-04-14  8:46     ` Ahmad Fatoum
  2025-04-14  9:21       ` Marco Felsch
  0 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  8:46 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox, Kim Christensen

Hello Marco,

On 14.04.25 10:40, Marco Felsch wrote:
> Hi,
> 
> On 25-04-14, Ahmad Fatoum wrote:
>> The 24V regulator supplying the system can indicate via a GPIO imminent
>> voltage loss. The board's capacitors hold enough charge to power the system
>> a while longer in such a state, but eventually, unless external power is
>> restored, the brownout detection of the PMIC will kick in.
>>
>> For the span of time between voltage drop detection and PMIC brownout,
>> let's detect this situation and delay startup. This way, Linux can
>> detect the ongoing voltage loss, power down the eMMC, reboot into
>> barebox and barebox will delay boot as long as the problem persists.
>>
>> Co-developed-by: Kim Christensen <kch@skov.dk>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
>>  1 file changed, 60 insertions(+)
>>
>> diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
>> index 637fc50b3f30..d7bd771f259d 100644
>> --- a/arch/arm/boards/skov-imx8mp/lowlevel.c
>> +++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
>> @@ -20,6 +20,9 @@
>>  
>>  extern char __dtb_z_imx8mp_skov_start[];
>>  
>> +#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
>> +				     MX8MP_PAD_CTL_PE)
>> +
>>  #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
>>  				     MX8MP_PAD_CTL_FSEL | \
>>  				     MX8MP_PAD_CTL_PUE | \
>> @@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
>>  				     MX8MP_PAD_CTL_PUE | \
>>  				     MX8MP_PAD_CTL_PE)
>>  
>> +static inline void led_d1_toggle(bool *on)
>> +{
>> +	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
>> +	*on = !*on;
>> +}
>> +
>>  static void setup_uart(void)
>>  {
>>  	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
>> @@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
>>  	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
>>  };
>>  
>> +static inline bool power_good(void)
>> +{
>> +	/* IMX_SHDN_MF in schematics */
>> +	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
>> +}
>> +
>> +static void wait_for_power_good(void)
>> +{
>> +	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
>> +	int timeout_ms = 0;
>> +	bool led_active = true;
>> +
>> +	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
>> +	imx8m_gpio_direction_input(gpio4, 23);
>> +
>> +	led_d1_toggle(&led_active);
>> +
>> +	if (power_good())
>> +		return;
>> +
>> +	pr_warn("\nDelaying boot until power stabilizes\n");
>> +
>> +	/* If we reach this, because Linux did a hw_protection_reboot, we don't
>> +	 * want to continue booting right away.
>> +	 *
>> +	 * Thus let's either wait for the condition to subscede or for voltage
>> +	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
>> +	 * lower than allowed
>> +	 */
>> +
>> +	while (1) {
>> +		if (power_good()) {
>> +			/* wait 10ms longer and check if it still good */
>> +			udelay(10000);
>> +			if (power_good()) {
>> +				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
>> +				break;
>> +			}
>> +		}
>> +		/* fast blink LED D1 */
>> +		if (timeout_ms % 100 == 0) {
>> +			pr_debug(".");
>> +			led_d1_toggle(&led_active);
>> +		}
>> +		udelay(1000);
>> +		timeout_ms++;
>> +	}
>> +}
>> +
>>  static void power_init_board(void)
>>  {
>>  	struct pbl_i2c *i2c;
>> @@ -77,6 +135,8 @@ static void power_init_board(void)
>>  	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
>>  	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
>>  
>> +	wait_for_power_good();
> 
> out of curiosity, wouldn't it be more useful to do the check right
> before the system wants to boot the kernel and abort in that case?

How so?

When we have brownout, we usually never make it out of the PBL,
so I prefer the SoC gets powered off during this loop instead
of during the RAM setup.

Cheers,
ahmad

> 
> Regards,
>   Marco
> 
> 
>> +
>>  	imx8mp_setup_pad(MX8MP_PAD_I2C1_SCL__I2C1_SCL | I2C_PAD_CTRL);
>>  	imx8mp_setup_pad(MX8MP_PAD_I2C1_SDA__I2C1_SDA | I2C_PAD_CTRL);
>>  
>> -- 
>> 2.39.5
>>
>>
>>
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi
  2025-04-14  8:46   ` Ahmad Fatoum
@ 2025-04-14  9:19     ` Sascha Hauer
  0 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2025-04-14  9:19 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Apr 14, 2025 at 10:46:02AM +0200, Ahmad Fatoum wrote:
> On 14.04.25 10:37, Sascha Hauer wrote:
> > On Mon, Apr 14, 2025 at 08:50:04AM +0200, Ahmad Fatoum wrote:
> >> This file is now available in Linux since v6.15-rc1, so we do not need
> >> to duplicate it in barebox for boards to make use of it.
> >>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >> ---
> >>  arch/arm/dts/imx8mp-nominal.dtsi | 49 --------------------------------
> >>  1 file changed, 49 deletions(-)
> >>  delete mode 100644 arch/arm/dts/imx8mp-nominal.dtsi
> >>
> >> diff --git a/arch/arm/dts/imx8mp-nominal.dtsi b/arch/arm/dts/imx8mp-nominal.dtsi
> >> deleted file mode 100644
> > 
> > This is used by imx8mp-skov-reva.dtsi. Should the include be changed to
> > use <> instead of "" now?
> 
> imx8mp-skov-reva.dtsi is in dts/ and there is a version of that file there.

Ah, ok, I didn't see that.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14  8:46     ` Ahmad Fatoum
@ 2025-04-14  9:21       ` Marco Felsch
  2025-04-14  9:36         ` Ahmad Fatoum
  0 siblings, 1 reply; 16+ messages in thread
From: Marco Felsch @ 2025-04-14  9:21 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Kim Christensen

On 25-04-14, Ahmad Fatoum wrote:
> Hello Marco,
> 
> On 14.04.25 10:40, Marco Felsch wrote:
> > Hi,
> > 
> > On 25-04-14, Ahmad Fatoum wrote:
> >> The 24V regulator supplying the system can indicate via a GPIO imminent
> >> voltage loss. The board's capacitors hold enough charge to power the system
> >> a while longer in such a state, but eventually, unless external power is
> >> restored, the brownout detection of the PMIC will kick in.
> >>
> >> For the span of time between voltage drop detection and PMIC brownout,
> >> let's detect this situation and delay startup. This way, Linux can
> >> detect the ongoing voltage loss, power down the eMMC, reboot into
> >> barebox and barebox will delay boot as long as the problem persists.
> >>
> >> Co-developed-by: Kim Christensen <kch@skov.dk>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >> ---
> >>  arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
> >>  1 file changed, 60 insertions(+)
> >>
> >> diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
> >> index 637fc50b3f30..d7bd771f259d 100644
> >> --- a/arch/arm/boards/skov-imx8mp/lowlevel.c
> >> +++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
> >> @@ -20,6 +20,9 @@
> >>  
> >>  extern char __dtb_z_imx8mp_skov_start[];
> >>  
> >> +#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
> >> +				     MX8MP_PAD_CTL_PE)
> >> +
> >>  #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
> >>  				     MX8MP_PAD_CTL_FSEL | \
> >>  				     MX8MP_PAD_CTL_PUE | \
> >> @@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
> >>  				     MX8MP_PAD_CTL_PUE | \
> >>  				     MX8MP_PAD_CTL_PE)
> >>  
> >> +static inline void led_d1_toggle(bool *on)
> >> +{
> >> +	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
> >> +	*on = !*on;
> >> +}
> >> +
> >>  static void setup_uart(void)
> >>  {
> >>  	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
> >> @@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
> >>  	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
> >>  };
> >>  
> >> +static inline bool power_good(void)
> >> +{
> >> +	/* IMX_SHDN_MF in schematics */
> >> +	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
> >> +}
> >> +
> >> +static void wait_for_power_good(void)
> >> +{
> >> +	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
> >> +	int timeout_ms = 0;
> >> +	bool led_active = true;
> >> +
> >> +	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
> >> +	imx8m_gpio_direction_input(gpio4, 23);
> >> +
> >> +	led_d1_toggle(&led_active);
> >> +
> >> +	if (power_good())
> >> +		return;
> >> +
> >> +	pr_warn("\nDelaying boot until power stabilizes\n");
> >> +
> >> +	/* If we reach this, because Linux did a hw_protection_reboot, we don't
> >> +	 * want to continue booting right away.
> >> +	 *
> >> +	 * Thus let's either wait for the condition to subscede or for voltage
> >> +	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
> >> +	 * lower than allowed
> >> +	 */
> >> +
> >> +	while (1) {
> >> +		if (power_good()) {
> >> +			/* wait 10ms longer and check if it still good */
> >> +			udelay(10000);
> >> +			if (power_good()) {
> >> +				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
> >> +				break;
> >> +			}
> >> +		}
> >> +		/* fast blink LED D1 */
> >> +		if (timeout_ms % 100 == 0) {
> >> +			pr_debug(".");
> >> +			led_d1_toggle(&led_active);
> >> +		}
> >> +		udelay(1000);
> >> +		timeout_ms++;
> >> +	}
> >> +}
> >> +
> >>  static void power_init_board(void)
> >>  {
> >>  	struct pbl_i2c *i2c;
> >> @@ -77,6 +135,8 @@ static void power_init_board(void)
> >>  	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
> >>  	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
> >>  
> >> +	wait_for_power_good();
> > 
> > out of curiosity, wouldn't it be more useful to do the check right
> > before the system wants to boot the kernel and abort in that case?
> 
> How so?
> 
> When we have brownout, we usually never make it out of the PBL,

Okay, since your backup charge is really low already.

> so I prefer the SoC gets powered off during this loop instead
> of during the RAM setup.

I understand that to wait for the power to become good again, but what
if the power is getting good and changes to bad again once you entered
barebox? Do you get notified about such an event?

IMHO the later point a bit more important since this ensures that the
system was in power-good state before we the system starts.

Regards,
  Marco



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14  9:21       ` Marco Felsch
@ 2025-04-14  9:36         ` Ahmad Fatoum
  2025-04-14 10:56           ` Marco Felsch
  0 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14  9:36 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox, Kim Christensen

Hello Marco,

On 14.04.25 11:21, Marco Felsch wrote:
> On 25-04-14, Ahmad Fatoum wrote:
>> Hello Marco,
>>
>> On 14.04.25 10:40, Marco Felsch wrote:
>>> Hi,
>>>
>>> On 25-04-14, Ahmad Fatoum wrote:
>>>> The 24V regulator supplying the system can indicate via a GPIO imminent
>>>> voltage loss. The board's capacitors hold enough charge to power the system
>>>> a while longer in such a state, but eventually, unless external power is
>>>> restored, the brownout detection of the PMIC will kick in.
>>>>
>>>> For the span of time between voltage drop detection and PMIC brownout,
>>>> let's detect this situation and delay startup. This way, Linux can
>>>> detect the ongoing voltage loss, power down the eMMC, reboot into
>>>> barebox and barebox will delay boot as long as the problem persists.
>>>>
>>>> Co-developed-by: Kim Christensen <kch@skov.dk>
>>>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>>>> ---
>>>>  arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
>>>>  1 file changed, 60 insertions(+)
>>>>
>>>> diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
>>>> index 637fc50b3f30..d7bd771f259d 100644
>>>> --- a/arch/arm/boards/skov-imx8mp/lowlevel.c
>>>> +++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
>>>> @@ -20,6 +20,9 @@
>>>>  
>>>>  extern char __dtb_z_imx8mp_skov_start[];
>>>>  
>>>> +#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
>>>> +				     MX8MP_PAD_CTL_PE)
>>>> +
>>>>  #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
>>>>  				     MX8MP_PAD_CTL_FSEL | \
>>>>  				     MX8MP_PAD_CTL_PUE | \
>>>> @@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
>>>>  				     MX8MP_PAD_CTL_PUE | \
>>>>  				     MX8MP_PAD_CTL_PE)
>>>>  
>>>> +static inline void led_d1_toggle(bool *on)
>>>> +{
>>>> +	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
>>>> +	*on = !*on;
>>>> +}
>>>> +
>>>>  static void setup_uart(void)
>>>>  {
>>>>  	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
>>>> @@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
>>>>  	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
>>>>  };
>>>>  
>>>> +static inline bool power_good(void)
>>>> +{
>>>> +	/* IMX_SHDN_MF in schematics */
>>>> +	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
>>>> +}
>>>> +
>>>> +static void wait_for_power_good(void)
>>>> +{
>>>> +	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
>>>> +	int timeout_ms = 0;
>>>> +	bool led_active = true;
>>>> +
>>>> +	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
>>>> +	imx8m_gpio_direction_input(gpio4, 23);
>>>> +
>>>> +	led_d1_toggle(&led_active);
>>>> +
>>>> +	if (power_good())
>>>> +		return;
>>>> +
>>>> +	pr_warn("\nDelaying boot until power stabilizes\n");
>>>> +
>>>> +	/* If we reach this, because Linux did a hw_protection_reboot, we don't
>>>> +	 * want to continue booting right away.
>>>> +	 *
>>>> +	 * Thus let's either wait for the condition to subscede or for voltage
>>>> +	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
>>>> +	 * lower than allowed
>>>> +	 */
>>>> +
>>>> +	while (1) {
>>>> +		if (power_good()) {
>>>> +			/* wait 10ms longer and check if it still good */
>>>> +			udelay(10000);
>>>> +			if (power_good()) {
>>>> +				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
>>>> +				break;
>>>> +			}
>>>> +		}
>>>> +		/* fast blink LED D1 */
>>>> +		if (timeout_ms % 100 == 0) {
>>>> +			pr_debug(".");
>>>> +			led_d1_toggle(&led_active);
>>>> +		}
>>>> +		udelay(1000);
>>>> +		timeout_ms++;
>>>> +	}
>>>> +}
>>>> +
>>>>  static void power_init_board(void)
>>>>  {
>>>>  	struct pbl_i2c *i2c;
>>>> @@ -77,6 +135,8 @@ static void power_init_board(void)
>>>>  	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
>>>>  	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
>>>>  
>>>> +	wait_for_power_good();
>>>
>>> out of curiosity, wouldn't it be more useful to do the check right
>>> before the system wants to boot the kernel and abort in that case?
>>
>> How so?
>>
>> When we have brownout, we usually never make it out of the PBL,
> 
> Okay, since your backup charge is really low already.
> 
>> so I prefer the SoC gets powered off during this loop instead
>> of during the RAM setup.
> 
> I understand that to wait for the power to become good again, but what
> if the power is getting good and changes to bad again once you entered
> barebox? Do you get notified about such an event?
> 
> IMHO the later point a bit more important since this ensures that the
> system was in power-good state before we the system starts.

Checking just before booting is insufficient anyway, because power good
may fluctuate before the Linux driver starts taking care of the power
good GPIO. Given that we need to handle this anyway, I don't think
it makes much difference whether when we check the power good GPIO
during barebox runtime.

Cheers,
Ahmad

> 
> Regards,
>   Marco
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14  9:36         ` Ahmad Fatoum
@ 2025-04-14 10:56           ` Marco Felsch
  2025-04-14 11:11             ` Ahmad Fatoum
  0 siblings, 1 reply; 16+ messages in thread
From: Marco Felsch @ 2025-04-14 10:56 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Kim Christensen

On 25-04-14, Ahmad Fatoum wrote:
> Hello Marco,
> 
> On 14.04.25 11:21, Marco Felsch wrote:
> > On 25-04-14, Ahmad Fatoum wrote:
> >> Hello Marco,
> >>
> >> On 14.04.25 10:40, Marco Felsch wrote:
> >>> Hi,
> >>>
> >>> On 25-04-14, Ahmad Fatoum wrote:
> >>>> The 24V regulator supplying the system can indicate via a GPIO imminent
> >>>> voltage loss. The board's capacitors hold enough charge to power the system
> >>>> a while longer in such a state, but eventually, unless external power is
> >>>> restored, the brownout detection of the PMIC will kick in.
> >>>>
> >>>> For the span of time between voltage drop detection and PMIC brownout,
> >>>> let's detect this situation and delay startup. This way, Linux can
> >>>> detect the ongoing voltage loss, power down the eMMC, reboot into
> >>>> barebox and barebox will delay boot as long as the problem persists.
> >>>>
> >>>> Co-developed-by: Kim Christensen <kch@skov.dk>
> >>>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >>>> ---
> >>>>  arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
> >>>>  1 file changed, 60 insertions(+)
> >>>>
> >>>> diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
> >>>> index 637fc50b3f30..d7bd771f259d 100644
> >>>> --- a/arch/arm/boards/skov-imx8mp/lowlevel.c
> >>>> +++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
> >>>> @@ -20,6 +20,9 @@
> >>>>  
> >>>>  extern char __dtb_z_imx8mp_skov_start[];
> >>>>  
> >>>> +#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
> >>>> +				     MX8MP_PAD_CTL_PE)
> >>>> +
> >>>>  #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
> >>>>  				     MX8MP_PAD_CTL_FSEL | \
> >>>>  				     MX8MP_PAD_CTL_PUE | \
> >>>> @@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
> >>>>  				     MX8MP_PAD_CTL_PUE | \
> >>>>  				     MX8MP_PAD_CTL_PE)
> >>>>  
> >>>> +static inline void led_d1_toggle(bool *on)
> >>>> +{
> >>>> +	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
> >>>> +	*on = !*on;
> >>>> +}
> >>>> +
> >>>>  static void setup_uart(void)
> >>>>  {
> >>>>  	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
> >>>> @@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
> >>>>  	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
> >>>>  };
> >>>>  
> >>>> +static inline bool power_good(void)
> >>>> +{
> >>>> +	/* IMX_SHDN_MF in schematics */
> >>>> +	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
> >>>> +}
> >>>> +
> >>>> +static void wait_for_power_good(void)
> >>>> +{
> >>>> +	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
> >>>> +	int timeout_ms = 0;
> >>>> +	bool led_active = true;
> >>>> +
> >>>> +	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
> >>>> +	imx8m_gpio_direction_input(gpio4, 23);
> >>>> +
> >>>> +	led_d1_toggle(&led_active);
> >>>> +
> >>>> +	if (power_good())
> >>>> +		return;
> >>>> +
> >>>> +	pr_warn("\nDelaying boot until power stabilizes\n");
> >>>> +
> >>>> +	/* If we reach this, because Linux did a hw_protection_reboot, we don't
> >>>> +	 * want to continue booting right away.
> >>>> +	 *
> >>>> +	 * Thus let's either wait for the condition to subscede or for voltage
> >>>> +	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
> >>>> +	 * lower than allowed
> >>>> +	 */
> >>>> +
> >>>> +	while (1) {
> >>>> +		if (power_good()) {
> >>>> +			/* wait 10ms longer and check if it still good */
> >>>> +			udelay(10000);
> >>>> +			if (power_good()) {
> >>>> +				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
> >>>> +				break;
> >>>> +			}
> >>>> +		}
> >>>> +		/* fast blink LED D1 */
> >>>> +		if (timeout_ms % 100 == 0) {
> >>>> +			pr_debug(".");
> >>>> +			led_d1_toggle(&led_active);
> >>>> +		}
> >>>> +		udelay(1000);
> >>>> +		timeout_ms++;
> >>>> +	}
> >>>> +}
> >>>> +
> >>>>  static void power_init_board(void)
> >>>>  {
> >>>>  	struct pbl_i2c *i2c;
> >>>> @@ -77,6 +135,8 @@ static void power_init_board(void)
> >>>>  	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
> >>>>  	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
> >>>>  
> >>>> +	wait_for_power_good();
> >>>
> >>> out of curiosity, wouldn't it be more useful to do the check right
> >>> before the system wants to boot the kernel and abort in that case?
> >>
> >> How so?
> >>
> >> When we have brownout, we usually never make it out of the PBL,
> > 
> > Okay, since your backup charge is really low already.
> > 
> >> so I prefer the SoC gets powered off during this loop instead
> >> of during the RAM setup.
> > 
> > I understand that to wait for the power to become good again, but what
> > if the power is getting good and changes to bad again once you entered
> > barebox? Do you get notified about such an event?
> > 
> > IMHO the later point a bit more important since this ensures that the
> > system was in power-good state before we the system starts.
> 
> Checking just before booting is insufficient anyway, because power good
> may fluctuate before the Linux driver starts taking care of the power
> good GPIO. Given that we need to handle this anyway, I don't think
> it makes much difference whether when we check the power good GPIO
> during barebox runtime.

I know, but still it is good to check and to wait for power-good state
before you cont. booting. Like you do for barebox: you wait till the
power is good or die within the PBL.

Regards,
  Marco


> 
> Cheers,
> Ahmad
> 
> > 
> > Regards,
> >   Marco
> > 
> 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good
  2025-04-14 10:56           ` Marco Felsch
@ 2025-04-14 11:11             ` Ahmad Fatoum
  0 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-04-14 11:11 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox, Kim Christensen, Oleksij Rempel

Hello Marco,

On 4/14/25 12:56, Marco Felsch wrote:
> On 25-04-14, Ahmad Fatoum wrote:
>> Hello Marco,
>>
>> On 14.04.25 11:21, Marco Felsch wrote:
>>> On 25-04-14, Ahmad Fatoum wrote:
>>>> Hello Marco,
>>>>
>>>> On 14.04.25 10:40, Marco Felsch wrote:
>>>>> Hi,
>>>>>
>>>>> On 25-04-14, Ahmad Fatoum wrote:
>>>>>> The 24V regulator supplying the system can indicate via a GPIO imminent
>>>>>> voltage loss. The board's capacitors hold enough charge to power the system
>>>>>> a while longer in such a state, but eventually, unless external power is
>>>>>> restored, the brownout detection of the PMIC will kick in.
>>>>>>
>>>>>> For the span of time between voltage drop detection and PMIC brownout,
>>>>>> let's detect this situation and delay startup. This way, Linux can
>>>>>> detect the ongoing voltage loss, power down the eMMC, reboot into
>>>>>> barebox and barebox will delay boot as long as the problem persists.
>>>>>>
>>>>>> Co-developed-by: Kim Christensen <kch@skov.dk>
>>>>>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>>>>>> ---
>>>>>>  arch/arm/boards/skov-imx8mp/lowlevel.c | 60 ++++++++++++++++++++++++++
>>>>>>  1 file changed, 60 insertions(+)
>>>>>>
>>>>>> diff --git a/arch/arm/boards/skov-imx8mp/lowlevel.c b/arch/arm/boards/skov-imx8mp/lowlevel.c
>>>>>> index 637fc50b3f30..d7bd771f259d 100644
>>>>>> --- a/arch/arm/boards/skov-imx8mp/lowlevel.c
>>>>>> +++ b/arch/arm/boards/skov-imx8mp/lowlevel.c
>>>>>> @@ -20,6 +20,9 @@
>>>>>>  
>>>>>>  extern char __dtb_z_imx8mp_skov_start[];
>>>>>>  
>>>>>> +#define PGOOD_PAD_CTRL  MUX_PAD_CTRL(MX8MP_PAD_CTL_PUE | \
>>>>>> +				     MX8MP_PAD_CTL_PE)
>>>>>> +
>>>>>>  #define UART_PAD_CTRL   MUX_PAD_CTRL(MX8MP_PAD_CTL_DSE6 | \
>>>>>>  				     MX8MP_PAD_CTL_FSEL | \
>>>>>>  				     MX8MP_PAD_CTL_PUE | \
>>>>>> @@ -30,6 +33,12 @@ extern char __dtb_z_imx8mp_skov_start[];
>>>>>>  				     MX8MP_PAD_CTL_PUE | \
>>>>>>  				     MX8MP_PAD_CTL_PE)
>>>>>>  
>>>>>> +static inline void led_d1_toggle(bool *on)
>>>>>> +{
>>>>>> +	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO1_BASE_ADDR), 5, *on);
>>>>>> +	*on = !*on;
>>>>>> +}
>>>>>> +
>>>>>>  static void setup_uart(void)
>>>>>>  {
>>>>>>  	void __iomem *uart = IOMEM(MX8M_UART2_BASE_ADDR);
>>>>>> @@ -67,6 +76,55 @@ static struct pmic_config pca9450_cfg[] = {
>>>>>>  	{ PCA9450_BUCK2OUT_DVS0, 0x14 },
>>>>>>  };
>>>>>>  
>>>>>> +static inline bool power_good(void)
>>>>>> +{
>>>>>> +	/* IMX_SHDN_MF in schematics */
>>>>>> +	return imx8m_gpio_val(IOMEM(MX8MP_GPIO4_BASE_ADDR), 23);
>>>>>> +}
>>>>>> +
>>>>>> +static void wait_for_power_good(void)
>>>>>> +{
>>>>>> +	void __iomem *gpio4 = IOMEM(MX8MP_GPIO4_BASE_ADDR);
>>>>>> +	int timeout_ms = 0;
>>>>>> +	bool led_active = true;
>>>>>> +
>>>>>> +	imx8mp_setup_pad(MX8MP_PAD_SAI2_RXD0__GPIO4_IO23 | PGOOD_PAD_CTRL);
>>>>>> +	imx8m_gpio_direction_input(gpio4, 23);
>>>>>> +
>>>>>> +	led_d1_toggle(&led_active);
>>>>>> +
>>>>>> +	if (power_good())
>>>>>> +		return;
>>>>>> +
>>>>>> +	pr_warn("\nDelaying boot until power stabilizes\n");
>>>>>> +
>>>>>> +	/* If we reach this, because Linux did a hw_protection_reboot, we don't
>>>>>> +	 * want to continue booting right away.
>>>>>> +	 *
>>>>>> +	 * Thus let's either wait for the condition to subscede or for voltage
>>>>>> +	 * to reach a low enough level for the PMIC to detect VSYS_UVLO going
>>>>>> +	 * lower than allowed
>>>>>> +	 */
>>>>>> +
>>>>>> +	while (1) {
>>>>>> +		if (power_good()) {
>>>>>> +			/* wait 10ms longer and check if it still good */
>>>>>> +			udelay(10000);
>>>>>> +			if (power_good()) {
>>>>>> +				pr_info("IMX_SHDN_MF stuck low for ~%ums.\n", timeout_ms);
>>>>>> +				break;
>>>>>> +			}
>>>>>> +		}
>>>>>> +		/* fast blink LED D1 */
>>>>>> +		if (timeout_ms % 100 == 0) {
>>>>>> +			pr_debug(".");
>>>>>> +			led_d1_toggle(&led_active);
>>>>>> +		}
>>>>>> +		udelay(1000);
>>>>>> +		timeout_ms++;
>>>>>> +	}
>>>>>> +}
>>>>>> +
>>>>>>  static void power_init_board(void)
>>>>>>  {
>>>>>>  	struct pbl_i2c *i2c;
>>>>>> @@ -77,6 +135,8 @@ static void power_init_board(void)
>>>>>>  	imx8mp_setup_pad(MX8MP_PAD_SAI3_TXD__GPIO5_IO01);
>>>>>>  	imx8m_gpio_direction_output(IOMEM(MX8MP_GPIO5_BASE_ADDR), 1, 0);
>>>>>>  
>>>>>> +	wait_for_power_good();
>>>>>
>>>>> out of curiosity, wouldn't it be more useful to do the check right
>>>>> before the system wants to boot the kernel and abort in that case?
>>>>
>>>> How so?
>>>>
>>>> When we have brownout, we usually never make it out of the PBL,
>>>
>>> Okay, since your backup charge is really low already.
>>>
>>>> so I prefer the SoC gets powered off during this loop instead
>>>> of during the RAM setup.
>>>
>>> I understand that to wait for the power to become good again, but what
>>> if the power is getting good and changes to bad again once you entered
>>> barebox? Do you get notified about such an event?
>>>
>>> IMHO the later point a bit more important since this ensures that the
>>> system was in power-good state before we the system starts.
>>
>> Checking just before booting is insufficient anyway, because power good
>> may fluctuate before the Linux driver starts taking care of the power
>> good GPIO. Given that we need to handle this anyway, I don't think
>> it makes much difference whether when we check the power good GPIO
>> during barebox runtime.
> 
> I know, but still it is good to check and to wait for power-good state
> before you cont. booting. Like you do for barebox: you wait till the
> power is good or die within the PBL.

I will take note of this, so I can revisit it with Oleksij in the future.

Thanks,
Ahmad

> 
> Regards,
>   Marco
> 
> 
>>
>> Cheers,
>> Ahmad
>>
>>>
>>> Regards,
>>>   Marco
>>>
>>
>>
>> -- 
>> Pengutronix e.K.                           |                             |
>> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
>> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>>
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi
  2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
                   ` (5 preceding siblings ...)
  2025-04-14  8:37 ` [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Sascha Hauer
@ 2025-04-15  6:48 ` Sascha Hauer
  6 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2025-04-15  6:48 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 14 Apr 2025 08:50:04 +0200, Ahmad Fatoum wrote:
> This file is now available in Linux since v6.15-rc1, so we do not need
> to duplicate it in barebox for boards to make use of it.
> 
> 

Applied, thanks!

[1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi
      https://git.pengutronix.de/cgit/barebox/commit/?id=9456295e0706 (link may not be stable)
[2/6] ARM: i.MX8MP: skov: decrease VDD_SOC to 850mV
      https://git.pengutronix.de/cgit/barebox/commit/?id=cc8030cbaeb9 (link may not be stable)
[3/6] ARM: i.MX8MP: skov: assert switch reset early
      https://git.pengutronix.de/cgit/barebox/commit/?id=6e95488987cd (link may not be stable)
[4/6] ARM: i.MX8MP: skov: halt startup until power is good
      https://git.pengutronix.de/cgit/barebox/commit/?id=07a459e9eff3 (link may not be stable)
[5/6] ARM: skov-imx8mp: print initial > on every boot
      https://git.pengutronix.de/cgit/barebox/commit/?id=b5cc49835584 (link may not be stable)
[6/6] ARM: i.MX8MP: skov: add new 7" g07017 variant support
      https://git.pengutronix.de/cgit/barebox/commit/?id=7f6ae6b9e39e (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-04-15  6:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-14  6:50 [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Ahmad Fatoum
2025-04-14  6:50 ` [PATCH 2/6] ARM: i.MX8MP: skov: decrease VDD_SOC to 850mV Ahmad Fatoum
2025-04-14  6:50 ` [PATCH 3/6] ARM: i.MX8MP: skov: assert switch reset early Ahmad Fatoum
2025-04-14  6:50 ` [PATCH 4/6] ARM: i.MX8MP: skov: halt startup until power is good Ahmad Fatoum
2025-04-14  8:40   ` Marco Felsch
2025-04-14  8:46     ` Ahmad Fatoum
2025-04-14  9:21       ` Marco Felsch
2025-04-14  9:36         ` Ahmad Fatoum
2025-04-14 10:56           ` Marco Felsch
2025-04-14 11:11             ` Ahmad Fatoum
2025-04-14  6:50 ` [PATCH 5/6] ARM: skov-imx8mp: print initial > on every boot Ahmad Fatoum
2025-04-14  6:50 ` [PATCH 6/6] ARM: i.MX8MP: skov: add new 7" g07017 variant support Ahmad Fatoum
2025-04-14  8:37 ` [PATCH 1/6] ARM: dts: i.MX8MP: drop now upstream imx8mp-nominal.dtsi Sascha Hauer
2025-04-14  8:46   ` Ahmad Fatoum
2025-04-14  9:19     ` Sascha Hauer
2025-04-15  6:48 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox