wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004, Psyent Corporation <www.psyent.com> |
| 3 | * Scott McNutt <smcnutt@psyent.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <nios2.h> |
| 10 | #include <nios2-io.h> |
Joachim Foerster | f292474 | 2011-10-20 10:28:10 +0200 | [diff] [blame] | 11 | #include <asm/cache.h> |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 12 | |
Thomas Chou | cce3e75 | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 15 | #if defined (CONFIG_SYS_NIOS_SYSID_BASE) |
wdenk | 194b839 | 2005-03-30 23:28:18 +0000 | [diff] [blame] | 16 | extern void display_sysid (void); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 17 | #endif /* CONFIG_SYS_NIOS_SYSID_BASE */ |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 18 | |
Thomas Chou | cce3e75 | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 19 | #ifdef CONFIG_DISPLAY_CPUINFO |
| 20 | int print_cpuinfo(void) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 21 | { |
| 22 | printf ("CPU : Nios-II\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 23 | #if !defined(CONFIG_SYS_NIOS_SYSID_BASE) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 24 | printf ("SYSID : <unknown>\n"); |
| 25 | #else |
wdenk | 194b839 | 2005-03-30 23:28:18 +0000 | [diff] [blame] | 26 | display_sysid (); |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 27 | #endif |
| 28 | return (0); |
| 29 | } |
Thomas Chou | cce3e75 | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 30 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 31 | |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 32 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 33 | { |
Thomas Chou | 5975e79 | 2010-08-16 10:49:44 +0800 | [diff] [blame] | 34 | disable_interrupts(); |
| 35 | /* indirect call to go beyond 256MB limitation of toolchain */ |
| 36 | nios2_callr(CONFIG_SYS_RESET_ADDR); |
| 37 | return 0; |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 38 | } |
Joachim Foerster | f292474 | 2011-10-20 10:28:10 +0200 | [diff] [blame] | 39 | |
| 40 | int dcache_status(void) |
| 41 | { |
| 42 | return 1; |
| 43 | } |
| 44 | |
| 45 | void dcache_enable(void) |
| 46 | { |
| 47 | flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); |
| 48 | } |
| 49 | |
| 50 | void dcache_disable(void) |
| 51 | { |
| 52 | flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); |
| 53 | } |
Thomas Chou | cce3e75 | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 54 | |
| 55 | int arch_cpu_init(void) |
| 56 | { |
| 57 | gd->cpu_clk = CONFIG_SYS_CLK_FREQ; |
| 58 | gd->ram_size = CONFIG_SYS_SDRAM_SIZE; |
| 59 | |
| 60 | return 0; |
| 61 | } |