wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003, Psyent Corporation <www.psyent.com> |
| 3 | * Scott McNutt <smcnutt@psyent.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <nios.h> |
| 26 | |
| 27 | |
| 28 | int checkcpu (void) |
| 29 | { |
| 30 | unsigned val; |
| 31 | unsigned rev_major; |
| 32 | unsigned rev_minor; |
| 33 | short nregs, hi_limit, lo_limit; |
| 34 | |
| 35 | /* Get cpu version info */ |
| 36 | val = rdctl (CTL_CPU_ID); |
Wolfgang Denk | 6b309f2 | 2007-08-12 20:35:49 +0200 | [diff] [blame^] | 37 | printf ("CPU: "); |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 38 | printf ("%s", (val & 0x00008000) ? "Nios-16 " : "Nios-32 "); |
| 39 | rev_major = (val>>12) & 0x07; |
wdenk | 180d3f7 | 2004-01-04 16:28:35 +0000 | [diff] [blame] | 40 | rev_minor = (val>>4) & 0x0ff; |
| 41 | printf ("Rev. %d.%d (0x%04x)", rev_major, rev_minor, |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 42 | val & 0xffff); |
| 43 | if (rev_major == 0x08) |
| 44 | printf (" [OpenCore (R) Plus]"); |
| 45 | printf ("\n"); |
| 46 | |
| 47 | /* Check register file */ |
| 48 | val = rdctl (CTL_WVALID); |
| 49 | lo_limit = val & 0x01f; |
| 50 | hi_limit = (val>>5) & 0x1f; |
| 51 | nregs = (hi_limit + 2) * 16; |
| 52 | printf ("Reg file size: %d LO_LIMIT/HI_LIMIT: %d/%d\n", |
| 53 | nregs, lo_limit, hi_limit); |
| 54 | |
| 55 | return (0); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | int do_reset (void) |
| 60 | { |
| 61 | /* trap 0 does the trick ... at least with the OCI debug |
| 62 | * present -- haven't tested without it yet (stm). |
| 63 | */ |
| 64 | disable_interrupts (); |
| 65 | ipri (1); |
| 66 | asm volatile ("trap 0\n"); |
| 67 | |
| 68 | /* No return ;-) */ |
| 69 | |
| 70 | return(0); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | #if defined(CONFIG_WATCHDOG) |
| 75 | void watchdog_reset (void) |
| 76 | { |
| 77 | } |
| 78 | #endif /* CONFIG_WATCHDOG */ |