wdenk | 5c952cf | 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 | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Thomas Chou | 57cfeb5 | 2014-08-25 17:09:07 +0800 | [diff] [blame] | 9 | #include <asm/nios2.h> |
Joachim Foerster | f956ad9 | 2011-10-20 10:28:10 +0200 | [diff] [blame] | 10 | #include <asm/cache.h> |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 11 | |
Thomas Chou | 5ff10aa | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 14 | #if defined (CONFIG_SYS_NIOS_SYSID_BASE) |
wdenk | 0c1c117c | 2005-03-30 23:28:18 +0000 | [diff] [blame] | 15 | extern void display_sysid (void); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 16 | #endif /* CONFIG_SYS_NIOS_SYSID_BASE */ |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 17 | |
Thomas Chou | 5ff10aa | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 18 | #ifdef CONFIG_DISPLAY_CPUINFO |
| 19 | int print_cpuinfo(void) |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 20 | { |
| 21 | printf ("CPU : Nios-II\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 22 | #if !defined(CONFIG_SYS_NIOS_SYSID_BASE) |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 23 | printf ("SYSID : <unknown>\n"); |
| 24 | #else |
wdenk | 0c1c117c | 2005-03-30 23:28:18 +0000 | [diff] [blame] | 25 | display_sysid (); |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 26 | #endif |
| 27 | return (0); |
| 28 | } |
Thomas Chou | 5ff10aa | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 29 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 30 | |
Mike Frysinger | 882b7d7 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 31 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 32 | { |
Thomas Chou | 7a6a7d1 | 2010-08-16 10:49:44 +0800 | [diff] [blame] | 33 | disable_interrupts(); |
| 34 | /* indirect call to go beyond 256MB limitation of toolchain */ |
| 35 | nios2_callr(CONFIG_SYS_RESET_ADDR); |
| 36 | return 0; |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 37 | } |
Joachim Foerster | f956ad9 | 2011-10-20 10:28:10 +0200 | [diff] [blame] | 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 | } |
Thomas Chou | 5ff10aa | 2014-08-22 11:36:47 +0800 | [diff] [blame] | 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 | } |