summaryrefslogtreecommitdiff
path: root/board/CZ.NIC/turris_omnia
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-08-27 20:06:30 +0200
committerStefan Roese <sr@denx.de>2022-09-13 06:38:08 +0200
commit7bb9ea47e1a47e00d4aef86d66293379be0b47b0 (patch)
treeba702d085f8ef74b4cfa869070c13580ec08a155 /board/CZ.NIC/turris_omnia
parent8ac3615e8d73f6be446bc25ae17d4f38f3cbf371 (diff)
downloadu-boot-7bb9ea47e1a47e00d4aef86d66293379be0b47b0.tar.gz
u-boot-7bb9ea47e1a47e00d4aef86d66293379be0b47b0.tar.bz2
u-boot-7bb9ea47e1a47e00d4aef86d66293379be0b47b0.zip
board: turris: Initialize serial# env
Store serial number from atsha cryptochip into the serial# env variable. U-Boot automatically puts content of this variable into the root device tree property serial-number when booting Linux kernel. Refactor turris atsha code and from turris_atsha_otp_get_serial_number() function returns directly string suitable for printing or storing into device tree. Because during different boot stages is env storage read-only, it is not possible to always store serial number into env storage. So introduce a new function turris_atsha_otp_init_serial_number() which is called at later stage and which ensures that serial number is correctly stored into env. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <kabel@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board/CZ.NIC/turris_omnia')
-rw-r--r--board/CZ.NIC/turris_omnia/turris_omnia.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index ab5061ef58..cf8a602670 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -963,19 +963,15 @@ int board_late_init(void)
int show_board_info(void)
{
- u32 version_num, serial_num;
+ char serial[17];
int err;
- err = turris_atsha_otp_get_serial_number(&version_num, &serial_num);
+ err = turris_atsha_otp_get_serial_number(serial);
printf("Model: Turris Omnia\n");
printf(" MCU type: %s\n", omnia_get_mcu_type());
printf(" MCU version: %s\n", omnia_get_mcu_version());
printf(" RAM size: %i MiB\n", omnia_get_ram_size_gb() * 1024);
- if (err)
- printf(" Serial Number: unknown\n");
- else
- printf(" Serial Number: %08X%08X\n", be32_to_cpu(version_num),
- be32_to_cpu(serial_num));
+ printf(" Serial Number: %s\n", !err ? serial : "unknown");
return 0;
}
@@ -983,6 +979,7 @@ int show_board_info(void)
int misc_init_r(void)
{
turris_atsha_otp_init_mac_addresses(1);
+ turris_atsha_otp_init_serial_number();
return 0;
}