Skip to contentSkip to conversation

ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

PATCH New Claudius Heine 7 participants 17 messages Nov 28, 2019 – Jan 19, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +1 -1
index 9de9a9acee..7bf2c077ba 100644
@@ -56,7 +56,7 @@ obj-y	+= interrupts_64.o
 else
 obj-y	+= interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET
 obj-y	+= reset.o
 endif
 
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

Quoted 7 lines · Claudius Heine

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

#2 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

In reply to Claudius Heine
Quoted 17 lines · Claudius Heine

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +0 -0
index 9de9a9acee..7bf2c077ba 100644

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 59

Quoted 5 lines
arch/arm/lib/Makefile +1 -1
@@ -56,7 +56,7 @@ obj-y += interrupts_64.o
 else
 obj-y  += interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET

Would it work to do this:
obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += reset.o

that would be nicer than ifndef, I think.

Regards,
Simon

Quoted 6 lines
arch/arm/lib/Makefile +0 -1
 obj-y  += reset.o
 endif
 
--

2.21.0

#3 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

Quoted 27 lines · Simon Goldschmidt
Quoted 17 lines · Claudius Heine

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +0 -0
index 9de9a9acee..7bf2c077ba 100644

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 59

Quoted 5 lines
arch/arm/lib/Makefile +1 -1
@@ -56,7 +56,7 @@ obj-y += interrupts_64.o
 else
 obj-y  += interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET

Would it work to do this:
obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += reset.o

Quoted 1 line

that would be nicer than ifndef, I think.

Yes it would, but it didn't seem to work.

With:

arch/arm/lib/Makefile +1 -3
index 9416369aad..913bb21eaf 100644
@@ -56,9 +56,7 @@ obj-y += interrupts_64.o
 else
 obj-y  += interrupts.o
 endif
-ifndef CONFIG_(SPL_TPL_)SYSRESET
-obj-y  += reset.o
-endif
+obj-$(CONFIG_$(SPL_TPL_)SYSRESET)      += reset.o
 
 obj-y  += cache.o
 obj-$(CONFIG_SYS_ARM_CACHE_CP15)       += cache-cp15.o

I get with CONFIG_SYSRESET:

arm-linux-gnu-ld.bfd: drivers/built-in.o: in function `do_reset':
drivers/sysreset/sysreset-uclass.c:113: multiple definition of `do_reset'; arch/arm/lib/built-in.o:arch/arm/lib/reset.c:30: first defined here
make: *** [Makefile:1667: u-boot] Error 1

And without CONFIG_SYSRESET:

arm-linux-gnu-ld.bfd: lib/built-in.o: in function `efi_reset_system_boottime':
lib/efi_loader/efi_runtime.c:165: undefined reference to do_reset' arm-linux-gnu-ld.bfd: lib/built-in.o: in function panic_finish':
lib/panic.c:26: undefined reference to do_reset' arm-linux-gnu-ld.bfd: arch/arm/mach-imx/built-in.o: in function do_boot_mode':
arch/arm/mach-imx/cmd_bmode.c:76: undefined reference to `do_reset' arm-linux-gnu-ld.bfd: cmd/built-in.o:(.u_boot_list_2_cmd_2_reset+0xc):
undefined reference to `do_reset'
arm-linux-gnu-ld.bfd: common/built-in.o: in function `jumptable_init':
common/exports.c:30: undefined reference to do_reset' arm-linux-gnu-ld.bfd: common/built-in.o: in function print_resetinfo':
common/board_f.c:167: undefined reference to sysreset_get_status' arm-linux-gnu-ld.bfd: common/built-in.o: in function do_bootm_states':
common/bootm.c:633: undefined reference to do_reset' arm-linux-gnu-ld.bfd: common/built-in.o: in function run_usb_dnl_gadget':
common/dfu.c:90: undefined reference to `do_reset'
make: *** [Makefile:1667: u-boot] Error 1

#4 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

Quoted 29 lines · Claudius Heine
Quoted 27 lines · Simon Goldschmidt
Quoted 17 lines · Claudius Heine

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +0 -0
index 9de9a9acee..7bf2c077ba 100644

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 59

Quoted 5 lines
arch/arm/lib/Makefile +1 -1
@@ -56,7 +56,7 @@ obj-y += interrupts_64.o
 else
 obj-y  += interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET

Would it work to do this:
obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += reset.o

Quoted 3 lines
Quoted 1 line

that would be nicer than ifndef, I think.

Yes it would, but it didn't seem to work.

OK, thanks for trying. Given the results below, it's fine for me, so:

Quoted 48 lines

With:

arch/arm/lib/Makefile +1 -3
index 9416369aad..913bb21eaf 100644
@@ -56,9 +56,7 @@ obj-y += interrupts_64.o
 else
 obj-y  += interrupts.o
 endif
-ifndef CONFIG_(SPL_TPL_)SYSRESET
-obj-y  += reset.o
-endif
+obj-$(CONFIG_$(SPL_TPL_)SYSRESET)      += reset.o
 
 obj-y  += cache.o
 obj-$(CONFIG_SYS_ARM_CACHE_CP15)       += cache-cp15.o

I get with CONFIG_SYSRESET:

arm-linux-gnu-ld.bfd: drivers/built-in.o: in function `do_reset':
drivers/sysreset/sysreset-uclass.c:113: multiple definition of `do_reset'; arch/arm/lib/built-in.o:arch/arm/lib/reset.c:30: first defined here
make: *** [Makefile:1667: u-boot] Error 1

And without CONFIG_SYSRESET:

arm-linux-gnu-ld.bfd: lib/built-in.o: in function `efi_reset_system_boottime':
lib/efi_loader/efi_runtime.c:165: undefined reference to do_reset' arm-linux-gnu-ld.bfd: lib/built-in.o: in function panic_finish':
lib/panic.c:26: undefined reference to do_reset' arm-linux-gnu-ld.bfd: arch/arm/mach-imx/built-in.o: in function do_boot_mode':
arch/arm/mach-imx/cmd_bmode.c:76: undefined reference to `do_reset' arm-linux-gnu-ld.bfd: cmd/built-in.o:(.u_boot_list_2_cmd_2_reset+0xc):
undefined reference to `do_reset'
arm-linux-gnu-ld.bfd: common/built-in.o: in function `jumptable_init':
common/exports.c:30: undefined reference to do_reset' arm-linux-gnu-ld.bfd: common/built-in.o: in function print_resetinfo':
common/board_f.c:167: undefined reference to sysreset_get_status' arm-linux-gnu-ld.bfd: common/built-in.o: in function do_bootm_states':
common/bootm.c:633: undefined reference to do_reset' arm-linux-gnu-ld.bfd: common/built-in.o: in function run_usb_dnl_gadget':
common/dfu.c:90: undefined reference to `do_reset'
make: *** [Makefile:1667: u-boot] Error 1

#5 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

In reply to Claudius Heine
Quoted 18 lines · Claudius Heine

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +0 -0
index 9de9a9acee..7bf2c077ba 100644

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 61

Quoted 7 lines
arch/arm/lib/Makefile +1 -1
@@ -56,7 +56,7 @@ obj-y	+= interrupts_64.o
 else
 obj-y	+= interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET
 obj-y	+= reset.o
 endif

This needs to be updated and something reworked as it breaks imx8mp_evk imx8mn_ddr4_evk imx8mm_evk platforms that have since been added:
board/freescale/imx8mm_evk/built-in.o: In function `do_reset':
build/../board/freescale/imx8mm_evk/spl.c:164: multiple definition of `do_reset' and similar failures.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200110/16f033ae/attachment.sig>
#6 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

Hi,

Quoted 25 lines · Tom Rini
Quoted 23 lines · Claudius Heine

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +1 -1
index 9de9a9acee..7bf2c077ba 100644
@@ -56,7 +56,7 @@ obj-y	+= interrupts_64.o
 else
 obj-y	+= interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET
Quoted 9 lines

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 61

Quoted 2 lines
arch/arm/lib/Makefile +0 -0
 obj-y	+= reset.o
 endif

This needs to be updated and something reworked as it breaks imx8mp_evk imx8mn_ddr4_evk imx8mm_evk platforms that have since been added:
board/freescale/imx8mm_evk/built-in.o: In function `do_reset':
build/../board/freescale/imx8mm_evk/spl.c:164: multiple definition of `do_reset' and similar failures.

It seems the imx8mm_evk and imx8mn_evk are the first platforms that implement a 'do_reset' within its board files.

That means we then no longer have just two binary options where the 'do_reset' implementation originates from. Before that platform we only had the ARM cpu reset and the sysreset driver.

That means if 'CONFIG_$(SPL_TPL_)SYSRESET == n' we cannot automatically use the ARM platform reset.

We will probably need additional kconfig options to express this situation.

The question is, should we do that, or rather investigate why those platforms need their own implementation?

Is it not possible to use the sysreset or arm reset driver there?

regards,
Claudius

#7 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

Quoted 46 lines · Tom Rini
Quoted 25 lines · Claudius Heine
Quoted 24 lines

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +1 -1
index 9de9a9acee..7bf2c077ba 100644
@@ -56,7 +56,7 @@ obj-y      += interrupts_64.o
 else
 obj-y       += interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET
Quoted 9 lines

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 61

Quoted 2 lines
arch/arm/lib/Makefile +0 -0
 obj-y       += reset.o
 endif

This needs to be updated and something reworked as it breaks imx8mp_evk imx8mn_ddr4_evk imx8mm_evk platforms that have since been added:
board/freescale/imx8mm_evk/built-in.o: In function `do_reset':
build/../board/freescale/imx8mm_evk/spl.c:164: multiple definition of `do_reset' and similar failures.

It seems the imx8mm_evk and imx8mn_evk are the first platforms that implement a 'do_reset' within its board files.

That means we then no longer have just two binary options where the 'do_reset' implementation originates from. Before that platform we only had the ARM cpu reset and the sysreset driver.

That means if 'CONFIG_$(SPL_TPL_)SYSRESET == n' we cannot automatically use the ARM platform reset.

Quoted 6 lines

We will probably need additional kconfig options to express this situation.

The question is, should we do that, or rather investigate why those platforms need their own implementation?

Is it not possible to use the sysreset or arm reset driver there?

Or PCSI via ATF?

#8 lore raw

PATCH 1/1 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

Hi Peter,

Quoted 46 lines · Peter Robinson
Quoted 46 lines · Tom Rini
Quoted 25 lines · Claudius Heine
Quoted 24 lines

In case CONFIG_SYSRESET is set, do_reset from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.

'do_reset' is called from SPL for instance from the panic handler and PANIC_HANG is not set

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +1 -1
index 9de9a9acee..7bf2c077ba 100644
@@ -56,7 +56,7 @@ obj-y      += interrupts_64.o
 else
 obj-y       += interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET
Quoted 9 lines

arch/arm/lib/Makefile obj-y += interrupts_64.o · line 61

Quoted 2 lines
arch/arm/lib/Makefile +0 -0
 obj-y       += reset.o
 endif

This needs to be updated and something reworked as it breaks imx8mp_evk imx8mn_ddr4_evk imx8mm_evk platforms that have since been added:
board/freescale/imx8mm_evk/built-in.o: In function `do_reset':
build/../board/freescale/imx8mm_evk/spl.c:164: multiple definition of `do_reset' and similar failures.

It seems the imx8mm_evk and imx8mn_evk are the first platforms that implement a 'do_reset' within its board files.

That means we then no longer have just two binary options where the 'do_reset' implementation originates from. Before that platform we only had the ARM cpu reset and the sysreset driver.

That means if 'CONFIG_$(SPL_TPL_)SYSRESET == n' we cannot automatically use the ARM platform reset.

Quoted 8 lines
Quoted 6 lines

We will probably need additional kconfig options to express this situation.

The question is, should we do that, or rather investigate why those platforms need their own implementation?

Is it not possible to use the sysreset or arm reset driver there?

Or PCSI via ATF?

Isn't that a sysreset driver?

Claudius

#9 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

In reply to Claudius Heine

Hi,

I have only tested compiling, but if the reset in the SPL on i.MX8MM and i.MX8MN still works with this patch applied, then we don't need board specific 'do_reset' function and special configurations flags for this case.

I currently don't have access to the hardware to test this.

regards,
Claudius

-- >8 --
Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for
SPL

Instead of implementing a custom reset function for the SPL, it can directly use the sysreset DM driver.

---
 arch/arm/mach-imx/imx8m/soc.c     | 19 -------------------
 board/freescale/imx8mm_evk/spl.c  |  9 ---------
 board/freescale/imx8mn_evk/spl.c  |  9 ---------
 configs/imx8mm_evk_defconfig      |  1 +
 configs/imx8mn_ddr4_evk_defconfig |  1 +
 5 files changed, 2 insertions(+), 37 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +0 -19
index 5ce5a180e8..519108d4c9 100644
@@ -378,22 +378,3 @@ int ft_system_setup(void *blob, bd_t *bd)
 	return 0;
 }
 #endif
-
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
-void reset_cpu(ulong addr)
-{
-       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
-
-       if (!addr)
-	       wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
-
-       /* Clear WDA to trigger WDOG_B immediately */
-       writew((WCR_WDE | WCR_SRS), &wdog->wcr);
-
-       while (1) {
-               /*
-                * spin for .5 seconds before reset
-                */
-       }
-}
-#endif
board/freescale/imx8mm_evk/spl.c +0 -9
index 2d08f9a563..e8dec452ea 100644
@@ -159,12 +159,3 @@ void board_init_f(ulong dummy)
 
 	board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	puts ("resetting ...\n");
-
-	reset_cpu(WDOG1_BASE_ADDR);
-
-	return 0;
-}
board/freescale/imx8mn_evk/spl.c +0 -9
index cbde9f6b3c..0c70fbb155 100644
@@ -112,12 +112,3 @@ void board_init_f(ulong dummy)
 
 	board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	puts("resetting ...\n");
-
-	reset_cpu(WDOG1_BASE_ADDR);
-
-	return 0;
-}
configs/imx8mm_evk_defconfig +1 -0
index 87560ef989..c07f4104f9 100644
@@ -83,5 +83,6 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_DM_THERMAL=y
configs/imx8mn_ddr4_evk_defconfig +1 -0
index 50b03d0763..c55998da4c 100644
@@ -75,5 +75,6 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_DM_THERMAL=y
Signature · 1 line
2.24.1
#10 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

Quoted 20 lines · Claudius Heine

Hi,

I have only tested compiling, but if the reset in the SPL on i.MX8MM and i.MX8MN still works with this patch applied, then we don't need board specific 'do_reset' function and special configurations flags for this case.

I currently don't have access to the hardware to test this.

regards,
Claudius

-- >8 --
Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for
SPL

Instead of implementing a custom reset function for the SPL, it can directly use the sysreset DM driver.

Quoted 8 lines
---
 arch/arm/mach-imx/imx8m/soc.c     | 19 -------------------
 board/freescale/imx8mm_evk/spl.c  |  9 ---------
 board/freescale/imx8mn_evk/spl.c  |  9 ---------
 configs/imx8mm_evk_defconfig      |  1 +
 configs/imx8mn_ddr4_evk_defconfig |  1 +
 5 files changed, 2 insertions(+), 37 deletions(-)
#11 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

In reply to Claudius Heine
Quoted 4 lines

Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

NAK, this will not work on i.MX8MM/N.

Currently sysreset psci is enabled, however psci will not work for SPL, because SPL boots before BL31.

Regards,
Peng.

Quoted 110 lines

Hi,

I have only tested compiling, but if the reset in the SPL on i.MX8MM and i.MX8MN still works with this patch applied, then we don't need board specific 'do_reset' function and special configurations flags for this case.

I currently don't have access to the hardware to test this.

regards,
Claudius

-- >8 --
Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

Instead of implementing a custom reset function for the SPL, it can directly use the sysreset DM driver.

---
 arch/arm/mach-imx/imx8m/soc.c     | 19 -------------------
 board/freescale/imx8mm_evk/spl.c  |  9 ---------
board/freescale/imx8mn_evk/spl.c  |  9 ---------
 configs/imx8mm_evk_defconfig      |  1 +
 configs/imx8mn_ddr4_evk_defconfig |  1 +
 5 files changed, 2 insertions(+), 37 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8m/soc.c index 5ce5a180e8..519108d4c9 100644

arch/arm/mach-imx/imx8m/soc.c +0 -2
@@ -378,22 +378,3 @@ int ft_system_setup(void *blob, bd_t *bd)
 	return 0;
 }
 #endif
-
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET) -void

reset_cpu(ulong addr) -{

arch/arm/mach-imx/imx8m/soc.c +0 -15
-       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
-
-       if (!addr)
-	       wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
-
-       /* Clear WDA to trigger WDOG_B immediately */
-       writew((WCR_WDE | WCR_SRS), &wdog->wcr);
-
-       while (1) {
-               /*
-                * spin for .5 seconds before reset
-                */
-       }
-}
-#endif
board/freescale/imx8mm_evk/spl.c +0 -8
index 2d08f9a563..e8dec452ea 100644
@@ -159,12 +159,3 @@ void board_init_f(ulong dummy)
 
 	board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
-	puts ("resetting ...\n");
-
-	reset_cpu(WDOG1_BASE_ADDR);
-
-	return 0;
-}
board/freescale/imx8mn_evk/spl.c +0 -8
index cbde9f6b3c..0c70fbb155 100644
@@ -112,12 +112,3 @@ void board_init_f(ulong dummy)
 
 	board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
-	puts("resetting ...\n");
-
-	reset_cpu(WDOG1_BASE_ADDR);
-
-	return 0;
-}
configs/imx8mm_evk_defconfig +0 -0
index 87560ef989..c07f4104f9 100644
@@ -83,5 +83,6 @@ CONFIG_DM_REGULATOR_FIXED=y

CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y
CONFIG_SYSRESET=y

configs/imx8mm_evk_defconfig +1 -0
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_DM_THERMAL=y
configs/imx8mn_ddr4_evk_defconfig +0 -0
index 50b03d0763..c55998da4c 100644
@@ -75,5 +75,6 @@ CONFIG_DM_REGULATOR_FIXED=y

CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y
CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
CONFIG_SYSRESET_PSCI=y
CONFIG_DM_THERMAL=y
--
2.24.1

#12 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

On 1/16/20 3:21 AM, Peng Fan wrote:

Hello Peng,

Quoted 8 lines
Quoted 3 lines

Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

NAK, this will not work on i.MX8MM/N.

Currently sysreset psci is enabled, however psci will not work for SPL, because SPL boots before BL31.

Thank you for the constructive feedback.

So basically , what we need is a real sysreset driver for iMX8MM , which can work with bare-bones hardware interface, that is, poking some register, correct ?

So, either you or Claudius needs to implement a driver in drivers/sysreset, which will bind in SPL and if needed, do some writel() into some registers to reset the board, correct ?

Because, I believe we can both agree that dumping such ad-hoc code which implements reset in board code is not the right way, esp. nowadays with all the DM/DT stuff in.

#13 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

Hi Marek,

Quoted 13 lines

Subject: Re: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

On 1/16/20 3:21 AM, Peng Fan wrote:

Hello Peng,

Quoted 6 lines
Quoted 3 lines

Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

NAK, this will not work on i.MX8MM/N.

Quoted 8 lines
Quoted 2 lines

Currently sysreset psci is enabled, however psci will not work for SPL, because SPL boots before BL31.

Thank you for the constructive feedback.

So basically , what we need is a real sysreset driver for iMX8MM , which can work with bare-bones hardware interface, that is, poking some register, correct ?

Yes.

Quoted 4 lines

So, either you or Claudius needs to implement a driver in drivers/sysreset, which will bind in SPL and if needed, do some writel() into some registers to reset the board, correct ?

Yes.

Quoted 4 lines

Because, I believe we can both agree that dumping such ad-hoc code which implements reset in board code is not the right way, esp. nowadays with all the DM/DT stuff in.

Alought we still have ocram space, but our SPL is huge now, 100KB+

Regards,
Peng.

#14 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

Quoted 1 line · Peng Fan

Hi Marek,

Hi,

Quoted 29 lines
Quoted 13 lines

Subject: Re: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

On 1/16/20 3:21 AM, Peng Fan wrote:

Hello Peng,

Quoted 6 lines
Quoted 3 lines

Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

NAK, this will not work on i.MX8MM/N.

Quoted 8 lines
Quoted 2 lines

Currently sysreset psci is enabled, however psci will not work for SPL, because SPL boots before BL31.

Thank you for the constructive feedback.

So basically , what we need is a real sysreset driver for iMX8MM , which can work with bare-bones hardware interface, that is, poking some register, correct ?

Yes.

Quoted 4 lines

So, either you or Claudius needs to implement a driver in drivers/sysreset, which will bind in SPL and if needed, do some writel() into some registers to reset the board, correct ?

Quoted 8 lines

Yes.

Quoted 4 lines

Because, I believe we can both agree that dumping such ad-hoc code which implements reset in board code is not the right way, esp. nowadays with all the DM/DT stuff in.

Alought we still have ocram space, but our SPL is huge now, 100KB+

How so ?

How much does DM sysreset add to that ?

#15 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

Quoted 44 lines

Subject: Re: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

Quoted 1 line · Peng Fan

Hi Marek,

Hi,

Quoted 36 lines
Quoted 13 lines

Subject: Re: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

On 1/16/20 3:21 AM, Peng Fan wrote:

Hello Peng,

Quoted 6 lines
Quoted 3 lines

Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

NAK, this will not work on i.MX8MM/N.

Quoted 8 lines
Quoted 2 lines

Currently sysreset psci is enabled, however psci will not work for SPL, because SPL boots before BL31.

Thank you for the constructive feedback.

So basically , what we need is a real sysreset driver for iMX8MM , which can work with bare-bones hardware interface, that is, poking some register, correct ?

Yes.

Quoted 4 lines

So, either you or Claudius needs to implement a driver in drivers/sysreset, which will bind in SPL and if needed, do some writel() into some registers to reset the board, correct ?

Yes.

Quoted 4 lines

Because, I believe we can both agree that dumping such ad-hoc code which implements reset in board code is not the right way, esp. nowadays with all the DM/DT stuff in.

Quoted 5 lines
Quoted 1 line

Alought we still have ocram space, but our SPL is huge now, 100KB+

How so ?

How much does DM sysreset add to that ?

currently I am a bit hesitated about DM SPL,
but it let us not to maintain two drivers for one module. Just some complaining words:)
I am fine to add DM sysreset currently.
Not sure how much it will add after DM usb.

Regards,
Peng.

#16 lore raw

RFC PATCH 1/1 imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL

On 1/19/20 8:48 AM, Peng Fan wrote:
[...]

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Because, I believe we can both agree that dumping such ad-hoc code which implements reset in board code is not the right way, esp. nowadays with all the DM/DT stuff in.

Alought we still have ocram space, but our SPL is huge now, 100KB+

How so ?

Quoted 7 lines
Quoted 1 line

How much does DM sysreset add to that ?

currently I am a bit hesitated about DM SPL,
but it let us not to maintain two drivers for one module. Just some complaining words:)
I am fine to add DM sysreset currently.
Not sure how much it will add after DM usb.

I have two things to say about this.
1) I share your concern about DM SPL, we have a massive size problem. Thus far, we don't have a solution. Patches welcome. One option might be to optimize out frameworks which only have one driver instance in SPL, like MMC_TINY does and have subsystem API directly call that one driver instance.
2) Hacking ad-hoc drivers in board/ files is broken design, so we need a solution, which does not do that. If we want to disregard DM sysreset in SPL for this board, we can only do that based on hard numbers, that is, measure the size impact and determine if that's an issue. If so, we need another solution. Otherwise, we enable DM sysreset and go back to solving 1) as a separate topic.

Signature · 2 lines
Best regards,
Marek Vasut