Skip to contentSkip to conversation

arm: socfpga: execute cold reboot by default

PATCH Applied Simon Goldschmidt 2 participants 3 messages May 3, 2019 – May 8, 2019

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

PATCH 1/1 arm: socfpga: execute cold reboot by default

This changes system reboot for socfpga to issue a cold reboot by default instead of a warm reboot.

Warm reboot can still be used by setting reboot_mode to REBOOT_WARM (e.g. via kernel command line 'reboot='), but this patch ensures cold reboot is issued for both REBOOT_COLD and REBOOT_HARD.

Also, cold reboot is more fail safe than warm reboot has some issues at least fo CSEL=0 and BSEL=qspi, where the boot rom does not set the qspi clock to a valid range.

---

See discussion in this thread on the u-boot ML:
https://lists.denx.de/pipermail/u-boot/2019-April/367463.html

---
 arch/arm/mach-socfpga/socfpga.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-socfpga/socfpga.c +6 -6
index 816da0eb6..6abfbf140 100644
@@ -85,10 +85,10 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
 
 	temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 
-	if (mode == REBOOT_HARD)
-		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-	else
+	if (mode == REBOOT_WARM)
 		temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+	else
+		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
 	writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 }
 
@@ -98,10 +98,10 @@ static void socfpga_arria10_restart(enum reboot_mode mode, const char *cmd)
 
 	temp = readl(rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
 
-	if (mode == REBOOT_HARD)
-		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-	else
+	if (mode == REBOOT_WARM)
 		temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+	else
+		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
 	writel(temp, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
 }
 
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 44 lines · Simon Goldschmidt

This changes system reboot for socfpga to issue a cold reboot by default instead of a warm reboot.

Warm reboot can still be used by setting reboot_mode to REBOOT_WARM (e.g. via kernel command line 'reboot='), but this patch ensures cold reboot is issued for both REBOOT_COLD and REBOOT_HARD.

Also, cold reboot is more fail safe than warm reboot has some issues at least fo CSEL=0 and BSEL=qspi, where the boot rom does not set the qspi clock to a valid range.

---

See discussion in this thread on the u-boot ML:
https://lists.denx.de/pipermail/u-boot/2019-April/367463.html

---
 arch/arm/mach-socfpga/socfpga.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-socfpga/socfpga.c +3 -3
index 816da0eb6..6abfbf140 100644
@@ -85,10 +85,10 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
 
 	temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 
-	if (mode == REBOOT_HARD)
-		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-	else
+	if (mode == REBOOT_WARM)
 		temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+	else
+		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
 	writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 }
 
@@ -98,10 +98,10 @@ static void socfpga_arria10_restart(enum reboot_mode mode, const char *cmd)
 
 	temp = readl(rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
 

arch/arm/mach-socfpga/socfpga.c static void socfpga_arria10_restart(enum reboot_mode mode, const char *cmd) · line 107

Quoted 10 lines
arch/arm/mach-socfpga/socfpga.c +3 -3
-	if (mode == REBOOT_HARD)
-		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-	else
+	if (mode == REBOOT_WARM)
 		temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+	else
+		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
 	writel(temp, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
 }
 

Applied, thanks! I think this patch needs to get back-ported into stable kernel version as well, right?

Dinh

#2 lore raw

Am 08.05.2019 um 03:37 schrieb Dinh Nguyen:

Quoted 46 lines · Simon Goldschmidt
Quoted 43 lines

This changes system reboot for socfpga to issue a cold reboot by default instead of a warm reboot.

Warm reboot can still be used by setting reboot_mode to REBOOT_WARM (e.g. via kernel command line 'reboot='), but this patch ensures cold reboot is issued for both REBOOT_COLD and REBOOT_HARD.

Also, cold reboot is more fail safe than warm reboot has some issues at least fo CSEL=0 and BSEL=qspi, where the boot rom does not set the qspi clock to a valid range.

---

See discussion in this thread on the u-boot ML:
https://lists.denx.de/pipermail/u-boot/2019-April/367463.html

---
  arch/arm/mach-socfpga/socfpga.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-socfpga/socfpga.c +3 -3
index 816da0eb6..6abfbf140 100644
@@ -85,10 +85,10 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
 
  	temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 
-	if (mode == REBOOT_HARD)
-		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-	else
+	if (mode == REBOOT_WARM)
  		temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+	else
+		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
  	writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
  }
 
@@ -98,10 +98,10 @@ static void socfpga_arria10_restart(enum reboot_mode mode, const char *cmd)
 
  	temp = readl(rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
 
Quoted 14 lines

arch/arm/mach-socfpga/socfpga.c static void socfpga_arria10_restart(enum reboot_mode mode, const char *cmd) · line 107

Quoted 11 lines
arch/arm/mach-socfpga/socfpga.c +3 -3
-	if (mode == REBOOT_HARD)
-		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-	else
+	if (mode == REBOOT_WARM)
  		temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+	else
+		temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
  	writel(temp, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
  }
 

Applied, thanks! I think this patch needs to get back-ported into stable kernel version as well, right?

Well, it's certainly wrong as it was.

But as I saw myself, switching from warm to cold reset might have some implications that would at least in some configurations require changes to existing configurations to keep the board booting.

So while this certainly fixes a bug (warm reboot is executed instead of cold reboot like standard/requested), I don't know what's the standard procedure for a backport regarding fix vs. breaking boards.

Regards,
Simon