]> git.ipfire.org Git - people/ms/u-boot.git/blob - arch/nios2/cpu/sysid.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / arch / nios2 / cpu / sysid.c
1 /*
2 * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
3 * Scott McNutt <smcnutt@psyent.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9
10 #if defined (CONFIG_SYS_NIOS_SYSID_BASE)
11
12 #include <command.h>
13 #include <asm/io.h>
14 #include <nios2-io.h>
15 #include <linux/time.h>
16
17 void display_sysid (void)
18 {
19 struct nios_sysid_t *sysid = (struct nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE;
20 struct tm t;
21 char asc[32];
22 time_t stamp;
23
24 stamp = readl (&sysid->timestamp);
25 localtime_r (&stamp, &t);
26 asctime_r (&t, asc);
27 printf ("SYSID : %08lx, %s", readl (&sysid->id), asc);
28
29 }
30
31 int do_sysid (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
32 {
33 display_sysid ();
34 return (0);
35 }
36
37 U_BOOT_CMD(
38 sysid, 1, 1, do_sysid,
39 "display Nios-II system id",
40 ""
41 );
42 #endif /* CONFIG_SYS_NIOS_SYSID_BASE */