]> git.ipfire.org Git - people/ms/u-boot.git/blob - arch/nios2/cpu/sysid.c
nios2: divide nios2-io.h into each specific drivers and remove it
[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 <linux/time.h>
15
16 typedef volatile struct {
17 unsigned id; /* The system build id */
18 unsigned timestamp; /* Timestamp */
19 } nios_sysid_t;
20
21 void display_sysid (void)
22 {
23 nios_sysid_t *sysid = (nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE;
24 struct tm t;
25 char asc[32];
26 time_t stamp;
27
28 stamp = readl (&sysid->timestamp);
29 localtime_r (&stamp, &t);
30 asctime_r (&t, asc);
31 printf ("SYSID : %08lx, %s", readl (&sysid->id), asc);
32
33 }
34
35 int do_sysid (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
36 {
37 display_sysid ();
38 return (0);
39 }
40
41 U_BOOT_CMD(
42 sysid, 1, 1, do_sysid,
43 "display Nios-II system id",
44 ""
45 );
46 #endif /* CONFIG_SYS_NIOS_SYSID_BASE */