Skip to contentSkip to conversation

Revert "arm: mvebu: fix boot from UART when in fallback mode"

PATCH New Chris Packham 3 participants 6 messages Aug 17, 2018 – Sep 19, 2018

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

PATCH v2 1/2 Revert "arm: mvebu: fix boot from UART when in fallback mode"

This reverts commit e83e2b390038c9075642cb243a6292241beb8d73. This prevents kwboot from overriding the hardware strapped boot source.

---

Changes in v2: None

 arch/arm/mach-mvebu/include/mach/soc.h | 6 ------
 arch/arm/mach-mvebu/spl.c              | 9 ---------
 2 files changed, 15 deletions(-)
arch/arm/mach-mvebu/include/mach/soc.h +0 -6
index 623ab4eb8d93..660dd148abc5 100644
@@ -110,16 +110,10 @@
 #define COMPHY_REFCLK_ALIGNMENT	(MVEBU_REGISTER(0x182f8))
 
 /* BootROM error register (also includes some status infos) */
-#if defined(CONFIG_ARMADA_38X)
-#define CONFIG_BOOTROM_ERR_REG	(MVEBU_REGISTER(0x182d0))
-#define BOOTROM_ERR_MODE_OFFS	0
-#define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
-#else
 #define CONFIG_BOOTROM_ERR_REG	(MVEBU_REGISTER(0x182d0))
 #define BOOTROM_ERR_MODE_OFFS	28
 #define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
 #define BOOTROM_ERR_MODE_UART	0x6
-#endif
 
 #if defined(CONFIG_ARMADA_375)
 /* SAR values for Armada 375 */
arch/arm/mach-mvebu/spl.c +0 -9
index 50b24f5760b7..4c3933b8354d 100644
@@ -25,16 +25,7 @@ static u32 get_boot_device(void)
 	val = readl(CONFIG_BOOTROM_ERR_REG);
 	boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
 	debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device);
-#if defined(CONFIG_ARMADA_38X)
-	/*
-	 * If the bootrom error register contains any else than zeros
-	 * in the first 8 bits it's an error condition. And in that case
-	 * try to boot from UART.
-	 */
-	if (boot_device)
-#else
 	if (boot_device == BOOTROM_ERR_MODE_UART)
-#endif
 		return BOOT_DEVICE_UART;
 
 	/*
Signature · 1 line
2.18.0
#1 lore raw

PATCH v2 2/2 ARM: mach-mvebu: handle fall-back to UART boot

The bootROM in the Armada-38x (and similar) SoC has two modes for UART boot. The first is when the normal boot media is blank (or otherwise missing the kwb header). The second is when the boot sequence has been interrupted with the magic byte sequence on the UART lines.

In the first mode the bootROM routine and error code register will indicate that there was an error booting from the configured media in bits 7:0. In the second mode there is no error to indicate but the boot source is provided via bits 31:28.

Handle both situations so that kwboot can be used for both boot strapping a blank board and for intercepting a regular boot sequence.

---
I think this probably applies to more than just the A38X but I've been conservative in restricting this for now. If other Marvell SoCs are found to have the same behaviour we can extend this to cover them.

Changes in v2:
- new

 arch/arm/mach-mvebu/include/mach/soc.h |  2 ++
 arch/arm/mach-mvebu/spl.c              | 10 ++++++++++
 2 files changed, 12 insertions(+)
arch/arm/mach-mvebu/include/mach/soc.h +2 -0
index 660dd148abc5..6e2e14efe0b7 100644
@@ -114,6 +114,8 @@
 #define BOOTROM_ERR_MODE_OFFS	28
 #define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
 #define BOOTROM_ERR_MODE_UART	0x6
+#define BOOTROM_ERR_CODE_OFFS	0
+#define BOOTROM_ERR_CODE_MASK	(0xf << BOOTROM_ERR_CODE_OFFS)
 
 #if defined(CONFIG_ARMADA_375)
 /* SAR values for Armada 375 */
arch/arm/mach-mvebu/spl.c +10 -0
index 4c3933b8354d..9dd7c84b6874 100644
@@ -28,6 +28,16 @@ static u32 get_boot_device(void)
 	if (boot_device == BOOTROM_ERR_MODE_UART)
 		return BOOT_DEVICE_UART;
 
+#ifdef CONFIG_ARMADA_38X
+	/*
+	 * If the bootrom error code contains any other than zeros it's an
+	 * error condition and the bootROM has fallen back to UART boot
+	 */
+	boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
+	if (boot_device)
+		return BOOT_DEVICE_UART;
+#endif
+
 	/*
 	 * Now check the SAR register for the strapped boot-device
 	 */
Signature · 1 line
2.18.0
#2 lore raw

PATCH v2 2/2 ARM: mach-mvebu: handle fall-back to UART boot

Quoted 10 lines · Chris Packham

The bootROM in the Armada-38x (and similar) SoC has two modes for UART boot. The first is when the normal boot media is blank (or otherwise missing the kwb header). The second is when the boot sequence has been interrupted with the magic byte sequence on the UART lines.

In the first mode the bootROM routine and error code register will indicate that there was an error booting from the configured media in bits 7:0. In the second mode there is no error to indicate but the boot source is provided via bits 31:28.

Quoted 4 lines

Handle both situations so that kwboot can be used for both boot strapping a blank board and for intercepting a regular boot sequence.

Quoted 47 lines

---
I think this probably applies to more than just the A38X but I've been conservative in restricting this for now. If other Marvell SoCs are found to have the same behaviour we can extend this to cover them.

Changes in v2:
- new

  arch/arm/mach-mvebu/include/mach/soc.h |  2 ++
  arch/arm/mach-mvebu/spl.c              | 10 ++++++++++
  2 files changed, 12 insertions(+)
arch/arm/mach-mvebu/include/mach/soc.h +2 -0
index 660dd148abc5..6e2e14efe0b7 100644
@@ -114,6 +114,8 @@
  #define BOOTROM_ERR_MODE_OFFS	28
  #define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
  #define BOOTROM_ERR_MODE_UART	0x6
+#define BOOTROM_ERR_CODE_OFFS	0
+#define BOOTROM_ERR_CODE_MASK	(0xf << BOOTROM_ERR_CODE_OFFS)
 
  #if defined(CONFIG_ARMADA_375)
  /* SAR values for Armada 375 */
arch/arm/mach-mvebu/spl.c +10 -0
index 4c3933b8354d..9dd7c84b6874 100644
@@ -28,6 +28,16 @@ static u32 get_boot_device(void)
  	if (boot_device == BOOTROM_ERR_MODE_UART)
  		return BOOT_DEVICE_UART;
 
+#ifdef CONFIG_ARMADA_38X
+	/*
+	 * If the bootrom error code contains any other than zeros it's an
+	 * error condition and the bootROM has fallen back to UART boot
+	 */
+	boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
+	if (boot_device)
+		return BOOT_DEVICE_UART;
+#endif
+
  	/*
  	 * Now check the SAR register for the strapped boot-device
  	 */
#3 lore raw

PATCH v2 2/2 ARM: mach-mvebu: handle fall-back to UART boot

CC'ing someone with some hardware to test :-)

Quoted 65 lines · Sean Nyekjær
Quoted 10 lines · Chris Packham

The bootROM in the Armada-38x (and similar) SoC has two modes for UART boot. The first is when the normal boot media is blank (or otherwise missing the kwb header). The second is when the boot sequence has been interrupted with the magic byte sequence on the UART lines.

In the first mode the bootROM routine and error code register will indicate that there was an error booting from the configured media in bits 7:0. In the second mode there is no error to indicate but the boot source is provided via bits 31:28.

Quoted 4 lines

Handle both situations so that kwboot can be used for both boot strapping a blank board and for intercepting a regular boot sequence.

Quoted 47 lines

---
I think this probably applies to more than just the A38X but I've been conservative in restricting this for now. If other Marvell SoCs are found to have the same behaviour we can extend this to cover them.

Changes in v2:
- new

  arch/arm/mach-mvebu/include/mach/soc.h |  2 ++ arch/arm/mach-mvebu/spl.c              | 10 ++++++++++

  2 files changed, 12 insertions(+)
arch/arm/mach-mvebu/include/mach/soc.h +2 -0
index 660dd148abc5..6e2e14efe0b7 100644
@@ -114,6 +114,8 @@
   #define BOOTROM_ERR_MODE_OFFS    28
   #define BOOTROM_ERR_MODE_MASK    (0xf << BOOTROM_ERR_MODE_OFFS)
   #define BOOTROM_ERR_MODE_UART    0x6
+#define BOOTROM_ERR_CODE_OFFS    0
+#define BOOTROM_ERR_CODE_MASK    (0xf << BOOTROM_ERR_CODE_OFFS)
   #if defined(CONFIG_ARMADA_375)
   /* SAR values for Armada 375 */
arch/arm/mach-mvebu/spl.c +10 -0
index 4c3933b8354d..9dd7c84b6874 100644
@@ -28,6 +28,16 @@ static u32 get_boot_device(void)
       if (boot_device == BOOTROM_ERR_MODE_UART)
           return BOOT_DEVICE_UART;
+#ifdef CONFIG_ARMADA_38X
+    /*
+     * If the bootrom error code contains any other than zeros it's an
+     * error condition and the bootROM has fallen back to UART boot
+     */
+    boot_device = (val & BOOTROM_ERR_CODE_MASK) >> 
 BOOTROM_ERR_CODE_OFFS;
+    if (boot_device)
+        return BOOT_DEVICE_UART;
+#endif
+
       /*
        * Now check the SAR register for the strapped boot-device
        */
#4 lore raw

PATCH v2 2/2 ARM: mach-mvebu: handle fall-back to UART boot

In reply to Chris Packham
Quoted 51 lines · Chris Packham

The bootROM in the Armada-38x (and similar) SoC has two modes for UART boot. The first is when the normal boot media is blank (or otherwise missing the kwb header). The second is when the boot sequence has been interrupted with the magic byte sequence on the UART lines.

In the first mode the bootROM routine and error code register will indicate that there was an error booting from the configured media in bits 7:0. In the second mode there is no error to indicate but the boot source is provided via bits 31:28.

Handle both situations so that kwboot can be used for both boot strapping a blank board and for intercepting a regular boot sequence.

---
I think this probably applies to more than just the A38X but I've been conservative in restricting this for now. If other Marvell SoCs are found to have the same behaviour we can extend this to cover them.

Changes in v2:
- new

  arch/arm/mach-mvebu/include/mach/soc.h |  2 ++
  arch/arm/mach-mvebu/spl.c              | 10 ++++++++++
  2 files changed, 12 insertions(+)
arch/arm/mach-mvebu/include/mach/soc.h +2 -0
index 660dd148abc5..6e2e14efe0b7 100644
@@ -114,6 +114,8 @@
  #define BOOTROM_ERR_MODE_OFFS	28
  #define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
  #define BOOTROM_ERR_MODE_UART	0x6
+#define BOOTROM_ERR_CODE_OFFS	0
+#define BOOTROM_ERR_CODE_MASK	(0xf << BOOTROM_ERR_CODE_OFFS)
 
  #if defined(CONFIG_ARMADA_375)
  /* SAR values for Armada 375 */
arch/arm/mach-mvebu/spl.c +3 -0
index 4c3933b8354d..9dd7c84b6874 100644
@@ -28,6 +28,16 @@ static u32 get_boot_device(void)
  	if (boot_device == BOOTROM_ERR_MODE_UART)
  		return BOOT_DEVICE_UART;
 
+#ifdef CONFIG_ARMADA_38X
+	/*
+	 * If the bootrom error code contains any other than zeros it's an

arch/arm/mach-mvebu/spl.c static u32 get_boot_device(void) · line 43

Quoted 10 lines
arch/arm/mach-mvebu/spl.c +7 -0
+	 * error condition and the bootROM has fallen back to UART boot
+	 */
+	boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
+	if (boot_device)
+		return BOOT_DEVICE_UART;
+#endif
+
  	/*
  	 * Now check the SAR register for the strapped boot-device
  	 */

Applied to u-boot-marvell/master

Thanks,
Stefan

#5 lore raw

PATCH v2 1/2 Revert "arm: mvebu: fix boot from UART when in fallback mode"

In reply to Chris Packham
Quoted 45 lines · Chris Packham

This reverts commit e83e2b390038c9075642cb243a6292241beb8d73. This prevents kwboot from overriding the hardware strapped boot source.

---

Changes in v2: None

  arch/arm/mach-mvebu/include/mach/soc.h | 6 ------
  arch/arm/mach-mvebu/spl.c              | 9 ---------
  2 files changed, 15 deletions(-)
arch/arm/mach-mvebu/include/mach/soc.h +0 -6
index 623ab4eb8d93..660dd148abc5 100644
@@ -110,16 +110,10 @@
  #define COMPHY_REFCLK_ALIGNMENT	(MVEBU_REGISTER(0x182f8))
 
  /* BootROM error register (also includes some status infos) */
-#if defined(CONFIG_ARMADA_38X)
-#define CONFIG_BOOTROM_ERR_REG	(MVEBU_REGISTER(0x182d0))
-#define BOOTROM_ERR_MODE_OFFS	0
-#define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
-#else
  #define CONFIG_BOOTROM_ERR_REG	(MVEBU_REGISTER(0x182d0))
  #define BOOTROM_ERR_MODE_OFFS	28
  #define BOOTROM_ERR_MODE_MASK	(0xf << BOOTROM_ERR_MODE_OFFS)
  #define BOOTROM_ERR_MODE_UART	0x6
-#endif
 
  #if defined(CONFIG_ARMADA_375)
  /* SAR values for Armada 375 */
arch/arm/mach-mvebu/spl.c +0 -3
index 50b24f5760b7..4c3933b8354d 100644
@@ -25,16 +25,7 @@ static u32 get_boot_device(void)
  	val = readl(CONFIG_BOOTROM_ERR_REG);
  	boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
  	debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device);
-#if defined(CONFIG_ARMADA_38X)
-	/*
-	 * If the bootrom error register contains any else than zeros

arch/arm/mach-mvebu/spl.c static u32 get_boot_device(void) · line 31

Quoted 10 lines
arch/arm/mach-mvebu/spl.c +0 -6
-	 * in the first 8 bits it's an error condition. And in that case
-	 * try to boot from UART.
-	 */
-	if (boot_device)
-#else
  	if (boot_device == BOOTROM_ERR_MODE_UART)
-#endif
  		return BOOT_DEVICE_UART;
 
  	/*

Applied to u-boot-marvell/master

Thanks,
Stefan