[U-Boot] [PATCH v3 3/4] ARM: DRA7: Set serial number environment variable

Dileep Katta dileep.katta at linaro.org
Tue Mar 3 12:10:43 CET 2015


Adds the registers to get the serial number of dra7xx boards.
Serial# environment variable will be set if not done already.
This will be useful to show correct information in
"fastboot devices" commands.

Signed-off-by: Angela Stegmaier <angelabaker at ti.com>
Signed-off-by: Dileep Katta <dileep.katta at linaro.org>
---
 arch/arm/cpu/armv7/omap5/prcm-regs.c |  2 ++
 arch/arm/include/asm/omap_common.h   |  2 ++
 board/ti/dra7xx/evm.c                | 11 +++++++++++
 3 files changed, 15 insertions(+)

diff --git a/arch/arm/cpu/armv7/omap5/prcm-regs.c b/arch/arm/cpu/armv7/omap5/prcm-regs.c
index 0745d42..020a964 100644
--- a/arch/arm/cpu/armv7/omap5/prcm-regs.c
+++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c
@@ -440,6 +440,8 @@ struct omap_sys_ctrl_regs const dra7xx_ctrl = {
 	.control_emif1_sdram_config_ext		= 0x4AE0C144,
 	.control_emif2_sdram_config_ext		= 0x4AE0C148,
 	.control_wkup_ldovbb_mpu_voltage_ctrl	= 0x4AE0C158,
+	.control_std_fuse_die_id_3		= 0x4AE0C210,
+	.control_std_fuse_prod_id_0		= 0x4AE0C214,
 	.control_padconf_mode			= 0x4AE0C5A0,
 	.control_xtal_oscillator		= 0x4AE0C5A4,
 	.control_i2c_2				= 0x4AE0C5A8,
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 323952f..b329803 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -362,6 +362,8 @@ struct omap_sys_ctrl_regs {
 	u32 control_core_control_io1;
 	u32 control_core_control_io2;
 	u32 control_id_code;
+	u32 control_std_fuse_die_id_3;
+	u32 control_std_fuse_prod_id_0;
 	u32 control_std_fuse_opp_bgap;
 	u32 control_ldosram_iva_voltage_ctrl;
 	u32 control_ldosram_mpu_voltage_ctrl;
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6522241..e20d950 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -88,10 +88,21 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+	char serialno[72];
+	uint32_t serialno_lo, serialno_hi;
+
 	if (omap_revision() == DRA722_ES1_0)
 		setenv("board_name", "dra72x");
 	else
 		setenv("board_name", "dra7xx");
+
+	if (!getenv("serial#")) {
+		printf("serial# not set, setting...\n");
+		serialno_lo = readl((*ctrl)->control_std_fuse_die_id_3);
+		serialno_hi = readl((*ctrl)->control_std_fuse_prod_id_0);
+		sprintf(serialno, "%08x%08x", serialno_hi, serialno_lo);
+		setenv("serial#", serialno);
+	}
 #endif
 	return 0;
 }
-- 
1.8.3.2



More information about the U-Boot mailing list