Skip to contentSkip to conversation

SDRAM Calibration Failed fix for GEN5 SoCFPGA

PATCH Superseded Brian Sune 2 participants 11 messages Nov 15, 2025 – Nov 25, 2025

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Brian Sune

author
#0 lore raw

PATCH 1/1 SDRAM Calibration Failed fix for GEN5 SoCFPGA

This is a quick fix to stablize what currently users encountered bootup stall. This fix is found under board boot trials. No logical code can be explained why it fails the SDRAM calibration but applying.

---
 arch/arm/mach-socfpga/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-socfpga/Kconfig +2 -0
index f2e959b5662..4011fe4784b 100644
@@ -117,6 +117,8 @@ config TARGET_SOCFPGA_CYCLONE5
 
 config TARGET_SOCFPGA_GEN5
 	bool
+	select WDT
+	select DESIGNWARE_WATCHDOG
 	select SPL_ALTERA_SDRAM
 	imply FPGA_SOCFPGA
 	imply SPL_SIZE_LIMIT_SUBTRACT_GD
Signature · 1 line
2.34.1
author
#1 lore raw
Quoted 5 lines

This is a quick fix to stablize what currently users encountered bootup stall. This fix is found under board boot trials. No logical code can be explained why it fails the SDRAM calibration but applying.

A bit follow up on this patch.
When user turned on the watchdog on u-boot-xxxx.dts while having the original setup triggers the SDRAM calibration fail.

While users those do not turn on the watchdog. w/o this patch could be fine and not sure what is the proper way to link the dts and watchdog driver accordingly.

Always included the watchdog driver should not be harm (correct me if not).
What the dts does can either initialize it or not. What w/o the driver and dts setting to "okay" does break things.

So Tom I am not sure based on your experiences. Always attach driver and leave dts to do the job?

Brian

#2 lore raw
Quoted 16 lines · Sune Brian
Quoted 5 lines

This is a quick fix to stablize what currently users encountered bootup stall. This fix is found under board boot trials. No logical code can be explained why it fails the SDRAM calibration but applying.

A bit follow up on this patch.
When user turned on the watchdog on u-boot-xxxx.dts while having the original setup triggers the SDRAM calibration fail.

While users those do not turn on the watchdog. w/o this patch could be fine and not sure what is the proper way to link the dts and watchdog driver accordingly.

Quoted 9 lines

Always included the watchdog driver should not be harm (correct me if not).
What the dts does can either initialize it or not. What w/o the driver and dts setting to "okay" does break things.

So Tom I am not sure based on your experiences. Always attach driver and leave dts to do the job?

Device Tree is representation of the hardware. Is the watchdog present in hardware? Yes? Then status = "okay".

Ideally, the board shouldn't fail if watchdog is enabled in DT but not the driver (and vice-versa).

Do you know what the actual issue is? Why does it fail when watchdog is enabled in DT but not the driver?

Cheers,
Quentin

author
#3 lore raw
Quoted 8 lines

Device Tree is representation of the hardware. Is the watchdog present in hardware? Yes? Then status = "okay".

Ideally, the board shouldn't fail if watchdog is enabled in DT but not the driver (and vice-versa).

Do you know what the actual issue is? Why does it fail when watchdog is enabled in DT but not the driver?

Best guess watchdog timeout.
I have no clue but this is the case.
Otherwise it cannot explain why it is always at the point of message check and fails.

If DT is enabled but not the driver then the driver is empty from first place. AKA the watchdog never initializes proper cycling? (my assumption) If the driver enables but DT does not then it simply disables during probe or ops?
(also my assumption)

So simply said w/o the socfpga watchdog driver it is problematic I guess. So always complying with the driver and leaving DTS to do the job is the most stable case.

The above are not confirmed but actual hardware tests show this behavior.

Brian

#4 lore raw

Hi Brian,

Quoted 11 lines · Sune Brian
Quoted 8 lines

Device Tree is representation of the hardware. Is the watchdog present in hardware? Yes? Then status = "okay".

Ideally, the board shouldn't fail if watchdog is enabled in DT but not the driver (and vice-versa).

Do you know what the actual issue is? Why does it fail when watchdog is enabled in DT but not the driver?

Best guess watchdog timeout.
I have no clue but this is the case.

I know some SoCs/ICs report the reset cause and you would be able to tell whether the reset was triggered by a watchdog or not, do you have such a register available maybe?

Quoted 3 lines

Otherwise it cannot explain why it is always at the point of message check and fails.

Add a substantial sleep/delay right before the last message you see and check if it fails after the same amount of time or not.

Quoted 1 line

If DT is enabled but not the driver then the driver is empty from first place.

My hunch is that SPL_WDT is enabled (or whatever other mechanism can be used to start the watchdog on this architecture/vendor) and somehow the watchdog is started in SPL but not in proper, in which case the watchdog isn't pinged. It could also be a remnant from the previous boot if this is a warm reboot (e.g. the IC isn't entirely/correctly reset before booting U-Boot).

Looking into socfpga_cyclone5_defconfig it seems that SPL_WATCHDOG is enabled but no driver is. Can you tell us which (failing) defconfig you're using (and if it supports multiple boards, which one) so we can check assumptions without going back and forth with you?

Quoted 1 line

AKA the watchdog never initializes proper cycling? (my assumption)

The designware watchdog cannot be stopped once started, you have to continuously ping it, c.f. comment at the top of the Linux kernel driver.

Quoted 3 lines

If the driver enables but DT does not then it simply disables during probe or ops?
(also my assumption)

If DT node is disabled, the driver won't be probed for that device, nothing will be done.

Quoted 5 lines

So simply said w/o the socfpga watchdog driver it is problematic I guess. So always complying with the driver and leaving DTS to do the job is the most stable case.

That's a bandage fix. It would be better to have some idea of what's going on. If this is possible, bisecting between a known working and broken commits would hopefully return the culprit and we can start making educated guesses from there. I also see no defconfig in upstream with TARGET_SOCFPGA_GEN5

Cheers,
Quentin

author
#5 lore raw
Quoted 5 lines

That's a bandage fix. It would be better to have some idea of what's going on. If this is possible, bisecting between a known working and broken commits would hopefully return the culprit and we can start making educated guesses from there. I also see no defconfig in upstream with TARGET_SOCFPGA_GEN5

I am terribly sorry this is completely out of my capability. I really dont know how to do it.

Why I raised this patch is b.c. The diff does show a very distinct difference on Altera trunk and mainstream.

And I did try what you had proposed (delay) and zero different b.c. that calibration
is under a long test somehow. I even tried adding a redo counter. And also had tried to check what was done before and after the calibration and no major diff was found. So to simply generalize the issue I patched this patch.

If you had a clue that is not the case then I am 100% wrong not to be shamed. I did not undergo code investigation first, I did it by reverse behavioral observation.

Bests,
Brian

author
#6 lore raw
In reply to Quentin Schulz
Quoted 6 lines

My hunch is that SPL_WDT is enabled (or whatever other mechanism can be used to start the watchdog on this architecture/vendor) and somehow the watchdog is started in SPL but not in proper, in which case the watchdog isn't pinged. It could also be a remnant from the previous boot if this is a warm reboot (e.g. the IC isn't entirely/correctly reset before booting U-Boot).

For this I also tried manually master resetting the system (push button). Hard to succeed but if "Barry Allen" suddenly helps you then it passes. And triggered a boot and manually entered reset on command. The system will fail as well.

Any compiled flag change i.e. optimized with size etc will even worsen the boot success rate. Also make me feel the more you do before cal. the worst it gets.

For register map [1].

But I am really sorry I don't have enough knowledge to debug the root cause of it.

[1] https://www.intel.com/content/www/us/en/programmable/hps/cyclone-v/hps.html

Brian

author
#7 lore raw
In reply to Quentin Schulz
Quoted 4 lines

Looking into socfpga_cyclone5_defconfig it seems that SPL_WATCHDOG is enabled but no driver is. Can you tell us which (failing) defconfig you're using (and if it supports multiple boards, which one) so we can check assumptions without going back and forth with you?

Fresh build is repeatable on that calibration failure.
I have done what I can, so if there are any issues feel free to point them out.

Brian

Logs as follow:

* WDT disable DT enable fails.

* WDT enable DT enable pass.
Warm and cold reset pass.

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:01:29 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd394
l4wd1-wdt_ccvr: 0x00000000
SDRAM calibration failed.
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01a3204c
l4wd1-wdt_ccvr: 0x00000000
### ERROR ### Please RESET the board ###

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:01:29 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd2c3
l4wd1-wdt_ccvr: 0x00000000
SDRAM calibration failed.
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01a31e7d
l4wd1-wdt_ccvr: 0x00000000
### ERROR ### Please RESET the board ###

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:01:29 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd2ef
l4wd1-wdt_ccvr: 0x00000000
SDRAM calibration failed.
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01a31ef2
l4wd1-wdt_ccvr: 0x00000000
### ERROR ### Please RESET the board ###

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:01:29 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd2ac
l4wd1-wdt_ccvr: 0x00000000
SDRAM calibration failed.
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01a31eee
l4wd1-wdt_ccvr: 0x00000000
### ERROR ### Please RESET the board ###

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:01:29 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd318
l4wd1-wdt_ccvr: 0x00000000
SDRAM calibration failed.
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01a31ee0
l4wd1-wdt_ccvr: 0x00000000
### ERROR ### Please RESET the board ###

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:08:42 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd155
l4wd1-wdt_ccvr: 0x00000000
Trying to boot from MMC1

U-Boot 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:08:42 +0800)

CPU:   Altera SoCFPGA Platform
FPGA:  Altera Cyclone V, SE/A5 or SX/C5 or ST/D5, version 0x0
BOOT:  SD/MMC Internal Transceiver (3.0V)
DRAM:  2 GiB
Core:  33 devices, 18 uclasses, devicetree: separate
WDT:   Started watchdog@ffd02000 with servicing every 1000ms (10s timeout)
MMC:   dwmmc0@ff704000: 0
Loading Environment from MMC... Reading from MMC(0)... OK
In:    serial
Out:   serial
Err:   serial
Model: Altera SOCFPGA Cyclone V SoC Development Kit
Net:   eth0: ethernet@ff702000
Hit any key to stop autoboot: 2

U-Boot SPL 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:08:42 +0800)
l4wd0-wdt_cr: 0x00000001
l4wd1-wdt_cr: 0x00000000
l4wd0-wdt_ccvr: 0x01efd0ff
l4wd1-wdt_ccvr: 0x00000000
Trying to boot from MMC1

U-Boot 2026.01-rc3-00013-gc3a95cc3c6cd-dirty (Nov 25 2025 - 07:08:42 +0800)

CPU:   Altera SoCFPGA Platform
FPGA:  Altera Cyclone V, SE/A5 or SX/C5 or ST/D5, version 0x0
BOOT:  SD/MMC Internal Transceiver (3.0V)
DRAM:  2 GiB
Core:  33 devices, 18 uclasses, devicetree: separate
WDT:   Started watchdog@ffd02000 with servicing every 1000ms (10s timeout)
MMC:   dwmmc0@ff704000: 0
Loading Environment from MMC... Reading from MMC(0)... OK
In:    serial
Out:   serial
Err:   serial
Model: Altera SOCFPGA Cyclone V SoC Development Kit
Net:   eth0: ethernet@ff702000
Hit any key to stop autoboot:  3
author
#8 lore raw
In reply to Quentin Schulz
Quoted 5 lines

That's a bandage fix. It would be better to have some idea of what's going on. If this is possible, bisecting between a known working and broken commits would hopefully return the culprit and we can start making educated guesses from there. I also see no defconfig in upstream with TARGET_SOCFPGA_GEN5

I have found the actual issue now might be wrong.

default:

#
# Start-up hooks
#
# CONFIG_CYCLIC is not set

Normal:

CONFIG_CYCLIC=y
CONFIG_SPL_CYCLIC=y
CONFIG_CYCLIC_MAX_CPU_TIME_US=5000

I guess defcondig files are not sync to the latest SPL design?

Brian

#9 lore raw

Hi Brian,

Quoted 16 lines · Sune Brian
Quoted 5 lines

That's a bandage fix. It would be better to have some idea of what's going on. If this is possible, bisecting between a known working and broken commits would hopefully return the culprit and we can start making educated guesses from there. I also see no defconfig in upstream with TARGET_SOCFPGA_GEN5

I have found the actual issue now might be wrong.

default:

#
# Start-up hooks
#
# CONFIG_CYCLIC is not set

Quoted 6 lines

Normal:

CONFIG_CYCLIC=y
CONFIG_SPL_CYCLIC=y
CONFIG_CYCLIC_MAX_CPU_TIME_US=5000

AH! In the default defconfig (can you please copy it in the mail?), can you tell us which WDT and WATCHDOG and CYCLIC symbols are enabled? It is possible there's a way to enable watchdog without cyclic (but that won't work as far as I could tell), and we should fix that in Kconfig so it cannot happen.

Quoted 2 lines

I guess defcondig files are not sync to the latest SPL design?

Which defconfig files are you talking about? Where can I find them?

Cheers,
Quentin

author
#10 lore raw
Quoted 1 line

Which defconfig files are you talking about? Where can I find them?

Actually it is not defconfig it is the entire socfpga gen5 file this patch points to.

Let me explain a bit. At first I suspected it was the WDT driver and settings. But I am wrong. Even turning off all dts and WDT it still has trigger fail calibration. So now my guess has failed, but why?

I diff a bit by turning on WDT and before that the diff shows CYCLIC. Then by default the CYCLIC somehow removes the timeout?

So I am going to re-patch this patch as reference. Then you can enclose it in another patch.

Brian