]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: DRA7: Set serial number environment variable
authorDileep Katta <dileep.katta@linaro.org>
Tue, 24 Mar 2015 22:34:51 +0000 (04:04 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 23 Apr 2015 17:59:19 +0000 (13:59 -0400)
This patch populates serial number environment variable from
die_id_0 and die_id_1 register values for DRA7xx boards.

The function is added in omap common code so that this can be re-used.

Serial# environment variable will be useful to show correct
information in "fastboot devices" commands.

Ref:
http://git.omapzoom.org/?p=repo/u-boot.git;a=commit;h=a6bcaaf67f6e4bcd97808f53d0ceb4b0c04d583c

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/cpu/armv7/omap-common/utils.c
arch/arm/cpu/armv7/omap5/prcm-regs.c
arch/arm/include/asm/omap_common.h
board/ti/dra7xx/evm.c

index 1696c2dbda6cda6a321ce503bbb4ad6008ba1155..df5f817baaaf7cb98d6371ced679b58082039f50 100644 (file)
@@ -60,3 +60,16 @@ void __weak usb_fake_mac_from_die_id(u32 *id)
                eth_setenv_enetaddr("usbethaddr", device_mac);
        }
 }
+
+void __weak usb_set_serial_num_from_die_id(u32 *id)
+{
+       char serialno[72];
+       uint32_t serialno_lo, serialno_hi;
+
+       if (!getenv("serial#")) {
+               serialno_hi = id[0];
+               serialno_lo = id[1];
+               sprintf(serialno, "%08x%08x", serialno_hi, serialno_lo);
+               setenv("serial#", serialno);
+       }
+}
index 440bb40a14c05ed345d8ff42c5553271fc465151..f80d36dc3cf161512687aa4bb396e303f9a9b902 100644 (file)
@@ -440,6 +440,10 @@ 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_0              = 0x4AE0C200,
+       .control_std_fuse_die_id_1              = 0x4AE0C208,
+       .control_std_fuse_die_id_2              = 0x4AE0C20C,
+       .control_std_fuse_die_id_3              = 0x4AE0C210,
        .control_padconf_mode                   = 0x4AE0C5A0,
        .control_xtal_oscillator                = 0x4AE0C5A4,
        .control_i2c_2                          = 0x4AE0C5A8,
index c8c3e71b55395b587e343b715eddc4fce28c3f7e..b0296fbae60d05fdcecbf15c9629fc63f163ec6a 100644 (file)
@@ -362,6 +362,10 @@ 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_0;
+       u32 control_std_fuse_die_id_1;
+       u32 control_std_fuse_die_id_2;
+       u32 control_std_fuse_die_id_3;
        u32 control_std_fuse_opp_bgap;
        u32 control_ldosram_iva_voltage_ctrl;
        u32 control_ldosram_mpu_voltage_ctrl;
@@ -578,6 +582,7 @@ void abb_setup(u32 fuse, u32 ldovbb, u32 setup, u32 control,
 s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb);
 
 void usb_fake_mac_from_die_id(u32 *id);
+void usb_set_serial_num_from_die_id(u32 *id);
 
 void omap_smc1(u32 service, u32 val);
 
index c1019289ba9dce27279c1cda8a63621733555a3d..d4648558ec375abbd201f2627a3d76b40bc342e5 100644 (file)
@@ -93,10 +93,16 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+       u32 id[4];
+
        if (omap_revision() == DRA722_ES1_0)
                setenv("board_name", "dra72x");
        else
                setenv("board_name", "dra7xx");
+
+       id[0] = readl((*ctrl)->control_std_fuse_die_id_0);
+       id[1] = readl((*ctrl)->control_std_fuse_die_id_1);
+       usb_set_serial_num_from_die_id(id);
 #endif
        return 0;
 }