public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] arm64: zynqmp: Support semihosting boot method
@ 2024-02-22 16:52 Sean Anderson
  2024-02-22 19:36 ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Anderson @ 2024-02-22 16:52 UTC (permalink / raw)
  To: u-boot, Michal Simek; +Cc: Sean Anderson, Sean Anderson

From: Sean Anderson <sean.anderson@seco.com>

Currently, when we boot from JTAG we try to boot U-Boot from RAM.
However, this is a bit tricky to time, since the debugger has to wait
for SPL to initialize RAM before it can load U-Boot. This can result in
long waits, since occasionally initializing RAM (and other things in
psu_init) takes a long time to complete and the debugger must wait for
this worst case.

Support semihosting if it is enabled, as it lets U-Boot tell the
debugger when we are ready for the image. This means we don't have to
wait any more than necessary. We don't change the default config to
ensure we don't break compatibility with existing debuggers that don't
expect us to hit semihosting breakpoints.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
I'm resending this from my linux.dev email as my regular email is
mangling my patches.

Changes in v2:
- Fix typo in subject

 arch/arm/mach-zynqmp/spl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-zynqmp/spl.c b/arch/arm/mach-zynqmp/spl.c
index a0f35f36faa..5af735aa5ce 100644
--- a/arch/arm/mach-zynqmp/spl.c
+++ b/arch/arm/mach-zynqmp/spl.c
@@ -9,6 +9,7 @@
 #include <image.h>
 #include <init.h>
 #include <log.h>
+#include <semihosting.h>
 #include <spl.h>
 #include <linux/delay.h>
 
@@ -66,6 +67,11 @@ void spl_board_init(void)
 }
 #endif
 
+static u32 jtag_boot_device(void)
+{
+	return semihosting_enabled() ? BOOT_DEVICE_SMH : BOOT_DEVICE_RAM;
+}
+
 void board_boot_order(u32 *spl_boot_list)
 {
 	spl_boot_list[0] = spl_boot_device();
@@ -75,7 +81,7 @@ void board_boot_order(u32 *spl_boot_list)
 	if (spl_boot_list[0] == BOOT_DEVICE_MMC2)
 		spl_boot_list[1] = BOOT_DEVICE_MMC1;
 
-	spl_boot_list[2] = BOOT_DEVICE_RAM;
+	spl_boot_list[2] = jtag_boot_device();
 }
 
 u32 spl_boot_device(void)
@@ -97,7 +103,7 @@ u32 spl_boot_device(void)
 
 	switch (bootmode) {
 	case JTAG_MODE:
-		return BOOT_DEVICE_RAM;
+		return jtag_boot_device();
 #ifdef CONFIG_SPL_MMC
 	case SD_MODE1:
 	case SD1_LSHFT_MODE: /* not working on silicon v1 */
-- 
2.35.1.1320.gc452695387.dirty


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

* Re: [PATCH v2] arm64: zynqmp: Support semihosting boot method
  2024-02-22 16:52 [PATCH v2] arm64: zynqmp: Support semihosting boot method Sean Anderson
@ 2024-02-22 19:36 ` Fabio Estevam
  2024-02-22 20:05   ` Sean Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2024-02-22 19:36 UTC (permalink / raw)
  To: Sean Anderson; +Cc: u-boot, Michal Simek, Sean Anderson

On Thu, Feb 22, 2024 at 1:53 PM Sean Anderson <sean.anderson@linux.dev> wrote:
>
> From: Sean Anderson <sean.anderson@seco.com>
...
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> ---
> I'm resending this from my linux.dev email as my regular email is
> mangling my patches.

That's OK, but you need to make sure that the From and Signed-off-by
fields match.

Otherwise, checkpatch complains.

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

* Re: [PATCH v2] arm64: zynqmp: Support semihosting boot method
  2024-02-22 19:36 ` Fabio Estevam
@ 2024-02-22 20:05   ` Sean Anderson
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Anderson @ 2024-02-22 20:05 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: u-boot, Michal Simek, Sean Anderson

On 2/22/24 14:36, Fabio Estevam wrote:
> On Thu, Feb 22, 2024 at 1:53 PM Sean Anderson <sean.anderson@linux.dev> wrote:
>>
>> From: Sean Anderson <sean.anderson@seco.com>
> ...
>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
>> ---
>> I'm resending this from my linux.dev email as my regular email is
>> mangling my patches.
> 
> That's OK, but you need to make sure that the From and Signed-off-by
> fields match.
> 
> Otherwise, checkpatch complains.

Yeah, I thought I had fixed the authors, but I guess not.

--Sean

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

end of thread, other threads:[~2024-02-22 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22 16:52 [PATCH v2] arm64: zynqmp: Support semihosting boot method Sean Anderson
2024-02-22 19:36 ` Fabio Estevam
2024-02-22 20:05   ` Sean Anderson

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