[U-Boot] [PATCH v3 03/16] apalis/colibri_t20/t30: integrate recovery mode detection

Marcel Ziswiler marcel at ziswiler.com
Thu Aug 6 00:47:00 CEST 2015


From: Marcel Ziswiler <marcel.ziswiler at toradex.com>

Allow detecting whether or not U-Boot was launched through the
recovery mode of the resp. NVIDIA SoC.

Make use of a board specific arch_misc_init() and enable the same via
CONFIG_ARCH_MISC_INIT configuration option.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
Acked-by: Stephen Warren <swarren at nvidia.com>
---
Changes in v2:
Drop unrelated clean-up to be done as part of a separate patch.

 board/toradex/apalis_t30/apalis_t30.c   | 12 ++++++++++++
 board/toradex/colibri_t20/colibri_t20.c | 12 ++++++++++++
 board/toradex/colibri_t30/colibri_t30.c | 12 ++++++++++++
 include/configs/apalis_t30.h            |  2 ++
 include/configs/colibri_t20.h           |  2 ++
 include/configs/colibri_t30.h           |  2 ++
 6 files changed, 42 insertions(+)

diff --git a/board/toradex/apalis_t30/apalis_t30.c b/board/toradex/apalis_t30/apalis_t30.c
index 6244214..b7a2219 100644
--- a/board/toradex/apalis_t30/apalis_t30.c
+++ b/board/toradex/apalis_t30/apalis_t30.c
@@ -9,7 +9,10 @@
 #include <dm.h>
 #include <asm/arch/gp_padctrl.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch-tegra/ap.h>
+#include <asm/arch-tegra/tegra.h>
 #include <asm/gpio.h>
+#include <asm/io.h>
 #include <i2c.h>
 #include <netdev.h>
 
@@ -18,6 +21,15 @@
 #define PMU_I2C_ADDRESS		0x2D
 #define MAX_I2C_RETRY		3
 
+int arch_misc_init(void)
+{
+	if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
+	    NVBOOTTYPE_RECOVERY)
+		printf("USB recovery mode\n");
+
+	return 0;
+}
+
 /*
  * Routine: pinmux_init
  * Description: Do individual peripheral pinmux configs
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index 8ae9ccf..7210a8a 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -8,8 +8,20 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch-tegra/ap.h>
 #include <asm/arch-tegra/board.h>
+#include <asm/arch-tegra/tegra.h>
 #include <asm/gpio.h>
+#include <asm/io.h>
+
+int arch_misc_init(void)
+{
+	if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
+	    NVBOOTTYPE_RECOVERY)
+		printf("USB recovery mode\n");
+
+	return 0;
+}
 
 #ifdef CONFIG_TEGRA_MMC
 /*
diff --git a/board/toradex/colibri_t30/colibri_t30.c b/board/toradex/colibri_t30/colibri_t30.c
index f4bc7d8..7ca79eb 100644
--- a/board/toradex/colibri_t30/colibri_t30.c
+++ b/board/toradex/colibri_t30/colibri_t30.c
@@ -8,10 +8,22 @@
 #include <common.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/gp_padctrl.h>
+#include <asm/arch-tegra/ap.h>
+#include <asm/arch-tegra/tegra.h>
+#include <asm/io.h>
 #include "pinmux-config-colibri_t30.h"
 #include <i2c.h>
 #include <asm/gpio.h>
 
+int arch_misc_init(void)
+{
+	if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
+	    NVBOOTTYPE_RECOVERY)
+		printf("USB recovery mode\n");
+
+	return 0;
+}
+
 /*
  * Routine: pinmux_init
  * Description: Do individual peripheral pinmux configs
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index 620ca02..7a27504 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -11,6 +11,8 @@
 
 #include "tegra30-common.h"
 
+#define CONFIG_ARCH_MISC_INIT
+
 /* High-level configuration options */
 #define V_PROMPT			"Apalis T30 # "
 #define CONFIG_TEGRA_BOARD_STRING	"Toradex Apalis T30"
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index 6d73f9d..5331c7c 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -9,6 +9,8 @@
 
 #include "tegra20-common.h"
 
+#define CONFIG_ARCH_MISC_INIT
+
 /* High-level configuration options */
 #define V_PROMPT			"Colibri T20 # "
 #define CONFIG_TEGRA_BOARD_STRING	"Toradex Colibri T20"
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index 1e94c34..9c5fdb2 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -11,6 +11,8 @@
 
 #include "tegra30-common.h"
 
+#define CONFIG_ARCH_MISC_INIT
+
 /* High-level configuration options */
 #define V_PROMPT			"Colibri T30 # "
 #define CONFIG_TEGRA_BOARD_STRING	"Toradex Colibri T30"
-- 
2.4.3



More information about the U-Boot mailing list