wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 4 | * Marius Groeger <mgroeger@sysgo.de> |
| 5 | * |
| 6 | * (C) Copyright 2002 |
| 7 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 8 | * Alex Zuepke <azu@sysgo.de> |
| 9 | * |
| 10 | * See file CREDITS for list of people who contributed to this |
| 11 | * project. |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU General Public License as |
| 15 | * published by the Free Software Foundation; either version 2 of |
| 16 | * the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program; if not, write to the Free Software |
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 26 | * MA 02111-1307 USA |
| 27 | */ |
| 28 | |
| 29 | /* |
| 30 | * CPU specific code |
| 31 | */ |
| 32 | |
| 33 | #include <common.h> |
| 34 | #include <command.h> |
Ben Warren | cc94074 | 2008-09-05 01:55:22 -0400 | [diff] [blame] | 35 | #include <netdev.h> |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 36 | #include <asm/arch/ixp425.h> |
Jean-Christophe PLAGNIOL-VILLARD | 677e62f | 2009-04-05 13:02:43 +0200 | [diff] [blame] | 37 | #include <asm/system.h> |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 38 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 39 | static void cache_flush(void); |
| 40 | |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 41 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 42 | int print_cpuinfo (void) |
| 43 | { |
| 44 | unsigned long id; |
| 45 | int speed = 0; |
| 46 | |
| 47 | asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id)); |
| 48 | |
| 49 | puts("CPU: Intel IXP425 at "); |
| 50 | switch ((id & 0x000003f0) >> 4) { |
| 51 | case 0x1c: |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 52 | speed = 533; |
| 53 | break; |
| 54 | |
| 55 | case 0x1d: |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 56 | speed = 400; |
| 57 | break; |
| 58 | |
| 59 | case 0x1f: |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 60 | speed = 266; |
| 61 | break; |
| 62 | } |
| 63 | |
| 64 | if (speed) |
| 65 | printf("%d MHz\n", speed); |
| 66 | else |
| 67 | puts("unknown revision\n"); |
| 68 | |
| 69 | return 0; |
| 70 | } |
| 71 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
| 72 | |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 73 | int cleanup_before_linux (void) |
| 74 | { |
| 75 | /* |
| 76 | * this function is called just before we call linux |
| 77 | * it prepares the processor for linux |
| 78 | * |
| 79 | * just disable everything that can disturb booting linux |
| 80 | */ |
| 81 | |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 82 | disable_interrupts (); |
| 83 | |
| 84 | /* turn off I-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 85 | icache_disable(); |
| 86 | dcache_disable(); |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 87 | |
| 88 | /* flush I-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 89 | cache_flush(); |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 90 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 91 | return 0; |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 92 | } |
| 93 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 94 | /* flush I/D-cache */ |
| 95 | static void cache_flush (void) |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 96 | { |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 97 | unsigned long i = 0; |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 98 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 99 | asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i)); |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | /* FIXME */ |
wdenk | a119190 | 2005-01-09 17:12:27 +0000 | [diff] [blame] | 103 | /* |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 104 | void pci_init(void) |
| 105 | { |
| 106 | return; |
| 107 | } |
wdenk | a119190 | 2005-01-09 17:12:27 +0000 | [diff] [blame] | 108 | */ |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 109 | |
| 110 | #ifdef CONFIG_BOOTCOUNT_LIMIT |
| 111 | |
| 112 | void bootcount_store (ulong a) |
| 113 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 114 | volatile ulong *save_addr = (volatile ulong *)(CONFIG_SYS_BOOTCOUNT_ADDR); |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 115 | |
| 116 | save_addr[0] = a; |
| 117 | save_addr[1] = BOOTCOUNT_MAGIC; |
| 118 | } |
| 119 | |
| 120 | ulong bootcount_load (void) |
| 121 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 122 | volatile ulong *save_addr = (volatile ulong *)(CONFIG_SYS_BOOTCOUNT_ADDR); |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 123 | |
| 124 | if (save_addr[1] != BOOTCOUNT_MAGIC) |
| 125 | return 0; |
| 126 | else |
| 127 | return save_addr[0]; |
| 128 | } |
| 129 | |
| 130 | #endif /* CONFIG_BOOTCOUNT_LIMIT */ |
Ben Warren | cc94074 | 2008-09-05 01:55:22 -0400 | [diff] [blame] | 131 | |
| 132 | int cpu_eth_init(bd_t *bis) |
| 133 | { |
| 134 | #ifdef CONFIG_IXP4XX_NPE |
| 135 | npe_initialize(bis); |
| 136 | #endif |
| 137 | return 0; |
| 138 | } |