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 #include <asm/nios2.h> 10 #include <asm/cache.h> 11 12 DECLARE_GLOBAL_DATA_PTR; 13 14 #if defined (CONFIG_SYS_NIOS_SYSID_BASE) 15 extern void display_sysid (void); 16 #endif /* CONFIG_SYS_NIOS_SYSID_BASE */ 17 18 #ifdef CONFIG_DISPLAY_CPUINFO 19 int print_cpuinfo(void) 20 { 21 printf ("CPU : Nios-II\n"); 22 #if !defined(CONFIG_SYS_NIOS_SYSID_BASE) 23 printf ("SYSID : <unknown>\n"); 24 #else 25 display_sysid (); 26 #endif 27 return (0); 28 } 29 #endif /* CONFIG_DISPLAY_CPUINFO */ 30 31 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) 32 { 33 disable_interrupts(); 34 /* indirect call to go beyond 256MB limitation of toolchain */ 35 nios2_callr(CONFIG_SYS_RESET_ADDR); 36 return 0; 37 } 38 39 int dcache_status(void) 40 { 41 return 1; 42 } 43 44 void dcache_enable(void) 45 { 46 flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); 47 } 48 49 void dcache_disable(void) 50 { 51 flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); 52 } 53 54 int arch_cpu_init(void) 55 { 56 gd->cpu_clk = CONFIG_SYS_CLK_FREQ; 57 gd->ram_size = CONFIG_SYS_SDRAM_SIZE; 58 59 return 0; 60 } 61