From ca844dd8c55f3b7bbba8144b0dcbf1297fcaece0 Mon Sep 17 00:00:00 2001 From: Thomas Chou Date: Wed, 14 Oct 2015 08:43:31 +0800 Subject: nios2: convert altera sysid to driver model Convert altera sysid to driver model with misc uclass. Signed-off-by: Thomas Chou Acked-by: Chin Liang See Reviewed-by: Simon Glass --- arch/nios2/cpu/Makefile | 2 +- arch/nios2/cpu/cpu.c | 13 ++--------- arch/nios2/cpu/sysid.c | 46 --------------------------------------- arch/nios2/dts/3c120_devboard.dts | 6 +++++ arch/nios2/include/asm/system.h | 2 ++ 5 files changed, 11 insertions(+), 58 deletions(-) delete mode 100644 arch/nios2/cpu/sysid.c (limited to 'arch') diff --git a/arch/nios2/cpu/Makefile b/arch/nios2/cpu/Makefile index 3fe7847160..185ca3cdb7 100644 --- a/arch/nios2/cpu/Makefile +++ b/arch/nios2/cpu/Makefile @@ -7,5 +7,5 @@ extra-y = start.o obj-y = exceptions.o -obj-y += cpu.o interrupts.o sysid.o traps.o +obj-y += cpu.o interrupts.o traps.o obj-y += fdt.o diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index 34eb7bd683..d7ff290fd7 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -13,20 +13,11 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined (CONFIG_SYS_NIOS_SYSID_BASE) -extern void display_sysid (void); -#endif /* CONFIG_SYS_NIOS_SYSID_BASE */ - #ifdef CONFIG_DISPLAY_CPUINFO int print_cpuinfo(void) { - printf ("CPU : Nios-II\n"); -#if !defined(CONFIG_SYS_NIOS_SYSID_BASE) - printf ("SYSID : \n"); -#else - display_sysid (); -#endif - return (0); + printf("CPU: Nios-II\n"); + return 0; } #endif /* CONFIG_DISPLAY_CPUINFO */ diff --git a/arch/nios2/cpu/sysid.c b/arch/nios2/cpu/sysid.c deleted file mode 100644 index 50819b2424..0000000000 --- a/arch/nios2/cpu/sysid.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright 2004, Psyent Corporation - * Scott McNutt - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include - -#if defined (CONFIG_SYS_NIOS_SYSID_BASE) - -#include -#include -#include - -typedef volatile struct { - unsigned id; /* The system build id */ - unsigned timestamp; /* Timestamp */ -} nios_sysid_t; - -void display_sysid (void) -{ - nios_sysid_t *sysid = (nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE; - struct tm t; - char asc[32]; - time_t stamp; - - stamp = readl (&sysid->timestamp); - localtime_r (&stamp, &t); - asctime_r (&t, asc); - printf ("SYSID : %08lx, %s", readl (&sysid->id), asc); - -} - -int do_sysid (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - display_sysid (); - return (0); -} - -U_BOOT_CMD( - sysid, 1, 1, do_sysid, - "display Nios-II system id", - "" -); -#endif /* CONFIG_SYS_NIOS_SYSID_BASE */ diff --git a/arch/nios2/dts/3c120_devboard.dts b/arch/nios2/dts/3c120_devboard.dts index 4a34ce56db..a3cfacb98a 100644 --- a/arch/nios2/dts/3c120_devboard.dts +++ b/arch/nios2/dts/3c120_devboard.dts @@ -71,6 +71,7 @@ <0x00004cc0 0x08004cc0 0x00000010>, <0x00004ce0 0x08004ce0 0x00000010>, <0x00004d00 0x08004d00 0x00000010>, + <0x00004d40 0x08004d40 0x00000008>, <0x00004d50 0x08004d50 0x00000008>, <0x00008000 0x08008000 0x00000020>, <0x00400000 0x08400000 0x00000020>; @@ -91,6 +92,11 @@ clock-frequency = < 125000000 >; }; + sysid: sysid@0x4d40 { + compatible = "altr,sysid-1.0"; + reg = <0x00004d40 0x00000008>; + }; + jtag_uart: serial@0x4d50 { compatible = "altr,juart-1.0"; reg = <0x00004d50 0x00000008>; diff --git a/arch/nios2/include/asm/system.h b/arch/nios2/include/asm/system.h index 6213a16eda..b15853563e 100644 --- a/arch/nios2/include/asm/system.h +++ b/arch/nios2/include/asm/system.h @@ -45,4 +45,6 @@ "callr %0" \ : : "r" (addr)) +void display_sysid(void); + #endif /* __ASM_NIOS2_SYSTEM_H */ -- cgit v1.2.1