wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 2 | * (C) Copyright 2000-2007 |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 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 | /* |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 25 | * CPU specific code |
| 26 | * |
| 27 | * written or collected and sometimes rewritten by |
| 28 | * Magnus Damm <damm@bitsmart.com> |
| 29 | * |
| 30 | * minor modifications by |
| 31 | * Wolfgang Denk <wd@denx.de> |
| 32 | */ |
| 33 | |
| 34 | #include <common.h> |
| 35 | #include <watchdog.h> |
| 36 | #include <command.h> |
| 37 | #include <asm/cache.h> |
| 38 | #include <ppc4xx.h> |
| 39 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 40 | DECLARE_GLOBAL_DATA_PTR; |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 41 | |
Stefan Roese | f344386 | 2006-10-07 11:30:52 +0200 | [diff] [blame] | 42 | void board_reset(void); |
Stefan Roese | f344386 | 2006-10-07 11:30:52 +0200 | [diff] [blame] | 43 | |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 44 | #if defined(CONFIG_405GP) || \ |
| 45 | defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ |
| 46 | defined(CONFIG_440EPX) || defined(CONFIG_440GRX) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 47 | |
| 48 | #define PCI_ASYNC |
| 49 | |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 50 | static int pci_async_enabled(void) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 51 | { |
| 52 | #if defined(CONFIG_405GP) |
| 53 | return (mfdcr(strap) & PSR_PCI_ASYNC_EN); |
| 54 | #endif |
| 55 | |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 56 | #if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ |
| 57 | defined(CONFIG_440EPX) || defined(CONFIG_440GRX) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 58 | unsigned long val; |
| 59 | |
Wolfgang Denk | 7481266 | 2005-12-12 16:06:05 +0100 | [diff] [blame] | 60 | mfsdr(sdr_sdstp1, val); |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 61 | return (val & SDR0_SDSTP1_PAME_MASK); |
| 62 | #endif |
| 63 | } |
| 64 | #endif |
| 65 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 66 | #if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && \ |
| 67 | !defined(CONFIG_405) && !defined(CONFIG_405EX) |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 68 | static int pci_arbiter_enabled(void) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 69 | { |
| 70 | #if defined(CONFIG_405GP) |
| 71 | return (mfdcr(strap) & PSR_PCI_ARBIT_EN); |
| 72 | #endif |
| 73 | |
| 74 | #if defined(CONFIG_405EP) |
| 75 | return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN); |
| 76 | #endif |
| 77 | |
| 78 | #if defined(CONFIG_440GP) |
| 79 | return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK); |
| 80 | #endif |
| 81 | |
Stefan Roese | 7372ca6 | 2007-02-02 12:44:22 +0100 | [diff] [blame] | 82 | #if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 83 | unsigned long val; |
| 84 | |
Stefan Roese | 7372ca6 | 2007-02-02 12:44:22 +0100 | [diff] [blame] | 85 | mfsdr(sdr_xcr, val); |
| 86 | return (val & 0x80000000); |
| 87 | #endif |
| 88 | #if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ |
| 89 | defined(CONFIG_440EPX) || defined(CONFIG_440GRX) |
| 90 | unsigned long val; |
| 91 | |
| 92 | mfsdr(sdr_pci0, val); |
| 93 | return (val & 0x80000000); |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 94 | #endif |
| 95 | } |
| 96 | #endif |
| 97 | |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 98 | #if defined(CONFIG_405EP) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 99 | #define I2C_BOOTROM |
| 100 | |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 101 | static int i2c_bootrom_enabled(void) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 102 | { |
| 103 | #if defined(CONFIG_405EP) |
| 104 | return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 105 | #else |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 106 | unsigned long val; |
| 107 | |
| 108 | mfsdr(sdr_sdcs, val); |
| 109 | return (val & SDR0_SDCS_SDD); |
| 110 | #endif |
| 111 | } |
Stefan Roese | 90e6f41 | 2007-04-18 12:05:59 +0200 | [diff] [blame] | 112 | #endif |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 113 | |
| 114 | #if defined(CONFIG_440GX) |
| 115 | #define SDR0_PINSTP_SHIFT 29 |
| 116 | static char *bootstrap_str[] = { |
| 117 | "EBC (16 bits)", |
| 118 | "EBC (8 bits)", |
| 119 | "EBC (32 bits)", |
| 120 | "EBC (8 bits)", |
| 121 | "PCI", |
| 122 | "I2C (Addr 0x54)", |
| 123 | "Reserved", |
| 124 | "I2C (Addr 0x50)", |
| 125 | }; |
Benoît Monin | e3cbe1f | 2007-06-04 08:36:05 +0200 | [diff] [blame] | 126 | static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' }; |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 127 | #endif |
| 128 | |
| 129 | #if defined(CONFIG_440SP) || defined(CONFIG_440SPE) |
| 130 | #define SDR0_PINSTP_SHIFT 30 |
| 131 | static char *bootstrap_str[] = { |
| 132 | "EBC (8 bits)", |
| 133 | "PCI", |
| 134 | "I2C (Addr 0x54)", |
| 135 | "I2C (Addr 0x50)", |
| 136 | }; |
Benoît Monin | e3cbe1f | 2007-06-04 08:36:05 +0200 | [diff] [blame] | 137 | static char bootstrap_char[] = { 'A', 'B', 'C', 'D'}; |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 138 | #endif |
| 139 | |
| 140 | #if defined(CONFIG_440EP) || defined(CONFIG_440GR) |
| 141 | #define SDR0_PINSTP_SHIFT 29 |
| 142 | static char *bootstrap_str[] = { |
| 143 | "EBC (8 bits)", |
| 144 | "PCI", |
| 145 | "NAND (8 bits)", |
| 146 | "EBC (16 bits)", |
| 147 | "EBC (16 bits)", |
| 148 | "I2C (Addr 0x54)", |
| 149 | "PCI", |
| 150 | "I2C (Addr 0x52)", |
| 151 | }; |
Benoît Monin | e3cbe1f | 2007-06-04 08:36:05 +0200 | [diff] [blame] | 152 | static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' }; |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 153 | #endif |
| 154 | |
| 155 | #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) |
| 156 | #define SDR0_PINSTP_SHIFT 29 |
| 157 | static char *bootstrap_str[] = { |
| 158 | "EBC (8 bits)", |
| 159 | "EBC (16 bits)", |
| 160 | "EBC (16 bits)", |
| 161 | "NAND (8 bits)", |
| 162 | "PCI", |
| 163 | "I2C (Addr 0x54)", |
| 164 | "PCI", |
| 165 | "I2C (Addr 0x52)", |
| 166 | }; |
Benoît Monin | e3cbe1f | 2007-06-04 08:36:05 +0200 | [diff] [blame] | 167 | static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' }; |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 168 | #endif |
| 169 | |
Stefan Roese | 90e6f41 | 2007-04-18 12:05:59 +0200 | [diff] [blame] | 170 | #if defined(CONFIG_405EZ) |
| 171 | #define SDR0_PINSTP_SHIFT 28 |
| 172 | static char *bootstrap_str[] = { |
| 173 | "EBC (8 bits)", |
| 174 | "SPI (fast)", |
| 175 | "NAND (512 page, 4 addr cycle)", |
| 176 | "I2C (Addr 0x50)", |
| 177 | "EBC (32 bits)", |
| 178 | "I2C (Addr 0x50)", |
| 179 | "NAND (2K page, 5 addr cycle)", |
| 180 | "I2C (Addr 0x50)", |
| 181 | "EBC (16 bits)", |
| 182 | "Reserved", |
| 183 | "NAND (2K page, 4 addr cycle)", |
| 184 | "I2C (Addr 0x50)", |
| 185 | "NAND (512 page, 3 addr cycle)", |
| 186 | "I2C (Addr 0x50)", |
| 187 | "SPI (slow)", |
| 188 | "I2C (Addr 0x50)", |
| 189 | }; |
Benoît Monin | e3cbe1f | 2007-06-04 08:36:05 +0200 | [diff] [blame] | 190 | static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \ |
| 191 | 'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' }; |
Stefan Roese | 90e6f41 | 2007-04-18 12:05:59 +0200 | [diff] [blame] | 192 | #endif |
| 193 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 194 | #if defined(CONFIG_405EX) |
| 195 | #define SDR0_PINSTP_SHIFT 29 |
| 196 | static char *bootstrap_str[] = { |
| 197 | "EBC (8 bits)", |
| 198 | "EBC (16 bits)", |
| 199 | "EBC (16 bits)", |
| 200 | "NAND (8 bits)", |
| 201 | "NAND (8 bits)", |
| 202 | "I2C (Addr 0x54)", |
| 203 | "EBC (8 bits)", |
| 204 | "I2C (Addr 0x52)", |
| 205 | }; |
| 206 | static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' }; |
| 207 | #endif |
| 208 | |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 209 | #if defined(SDR0_PINSTP_SHIFT) |
| 210 | static int bootstrap_option(void) |
| 211 | { |
| 212 | unsigned long val; |
| 213 | |
Stefan Roese | 90e6f41 | 2007-04-18 12:05:59 +0200 | [diff] [blame] | 214 | mfsdr(SDR_PINSTP, val); |
| 215 | return ((val & 0xf0000000) >> SDR0_PINSTP_SHIFT); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 216 | } |
| 217 | #endif /* SDR0_PINSTP_SHIFT */ |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 218 | |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 219 | |
| 220 | #if defined(CONFIG_440) |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 221 | static int do_chip_reset (unsigned long sys0, unsigned long sys1) |
| 222 | { |
| 223 | /* Changes to cpc0_sys0 and cpc0_sys1 require chip |
| 224 | * reset. |
| 225 | */ |
| 226 | mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */ |
| 227 | mtdcr (cpc0_sys0, sys0); |
| 228 | mtdcr (cpc0_sys1, sys1); |
| 229 | mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */ |
| 230 | mtspr (dbcr0, 0x20000000); /* Reset the chip */ |
| 231 | |
| 232 | return 1; |
| 233 | } |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 234 | #endif |
| 235 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 236 | |
| 237 | int checkcpu (void) |
| 238 | { |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 239 | #if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */ |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 240 | uint pvr = get_pvr(); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 241 | ulong clock = gd->cpu_clk; |
| 242 | char buf[32]; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 243 | |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 244 | #if !defined(CONFIG_IOP480) |
Wolfgang Denk | ba999c5 | 2006-10-20 17:54:33 +0200 | [diff] [blame] | 245 | char addstr[64] = ""; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 246 | sys_info_t sys_info; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 247 | |
| 248 | puts ("CPU: "); |
| 249 | |
| 250 | get_sys_info(&sys_info); |
| 251 | |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 252 | puts("AMCC PowerPC 4"); |
| 253 | |
Stefan Roese | e01bd21 | 2007-03-21 13:38:59 +0100 | [diff] [blame] | 254 | #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \ |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 255 | defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \ |
| 256 | defined(CONFIG_405EX) |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 257 | puts("05"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 258 | #endif |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 259 | #if defined(CONFIG_440) |
| 260 | puts("40"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 261 | #endif |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 262 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 263 | switch (pvr) { |
| 264 | case PVR_405GP_RB: |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 265 | puts("GP Rev. B"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 266 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 267 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 268 | case PVR_405GP_RC: |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 269 | puts("GP Rev. C"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 270 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 271 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 272 | case PVR_405GP_RD: |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 273 | puts("GP Rev. D"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 274 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 275 | |
wdenk | 42dfe7a | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 276 | #ifdef CONFIG_405GP |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 277 | case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */ |
| 278 | puts("GP Rev. E"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 279 | break; |
| 280 | #endif |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 281 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 282 | case PVR_405CR_RA: |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 283 | puts("CR Rev. A"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 284 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 285 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 286 | case PVR_405CR_RB: |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 287 | puts("CR Rev. B"); |
| 288 | break; |
| 289 | |
| 290 | #ifdef CONFIG_405CR |
| 291 | case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */ |
| 292 | puts("CR Rev. C"); |
| 293 | break; |
| 294 | #endif |
| 295 | |
| 296 | case PVR_405GPR_RB: |
| 297 | puts("GPr Rev. B"); |
| 298 | break; |
| 299 | |
stroese | b867d70 | 2003-05-23 11:18:02 +0000 | [diff] [blame] | 300 | case PVR_405EP_RB: |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 301 | puts("EP Rev. B"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 302 | break; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 303 | |
Stefan Roese | e01bd21 | 2007-03-21 13:38:59 +0100 | [diff] [blame] | 304 | case PVR_405EZ_RA: |
| 305 | puts("EZ Rev. A"); |
| 306 | break; |
| 307 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 308 | case PVR_405EX1_RA: |
| 309 | puts("EX Rev. A"); |
| 310 | strcpy(addstr, "Security support"); |
| 311 | break; |
| 312 | |
| 313 | case PVR_405EX2_RA: |
| 314 | puts("EX Rev. A"); |
| 315 | strcpy(addstr, "No Security support"); |
| 316 | break; |
| 317 | |
| 318 | case PVR_405EXR1_RA: |
| 319 | puts("EXr Rev. A"); |
| 320 | strcpy(addstr, "Security support"); |
| 321 | break; |
| 322 | |
| 323 | case PVR_405EXR2_RA: |
| 324 | puts("EXr Rev. A"); |
| 325 | strcpy(addstr, "No Security support"); |
| 326 | break; |
| 327 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 328 | #if defined(CONFIG_440) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 329 | case PVR_440GP_RB: |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 330 | puts("GP Rev. B"); |
wdenk | 4d81677 | 2003-09-03 14:03:26 +0000 | [diff] [blame] | 331 | /* See errata 1.12: CHIP_4 */ |
| 332 | if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) || |
| 333 | (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){ |
| 334 | puts ( "\n\t CPC0_SYSx DCRs corrupted. " |
| 335 | "Resetting chip ...\n"); |
| 336 | udelay( 1000 * 1000 ); /* Give time for serial buf to clear */ |
| 337 | do_chip_reset ( mfdcr(cpc0_strp0), |
| 338 | mfdcr(cpc0_strp1) ); |
| 339 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 340 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 341 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 342 | case PVR_440GP_RC: |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 343 | puts("GP Rev. C"); |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 344 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 345 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 346 | case PVR_440GX_RA: |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 347 | puts("GX Rev. A"); |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 348 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 349 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 350 | case PVR_440GX_RB: |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 351 | puts("GX Rev. B"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 352 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 353 | |
stroese | 0a7c539 | 2005-04-07 05:33:41 +0000 | [diff] [blame] | 354 | case PVR_440GX_RC: |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 355 | puts("GX Rev. C"); |
stroese | 0a7c539 | 2005-04-07 05:33:41 +0000 | [diff] [blame] | 356 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 357 | |
Stefan Roese | 57275b6 | 2005-11-01 10:08:03 +0100 | [diff] [blame] | 358 | case PVR_440GX_RF: |
| 359 | puts("GX Rev. F"); |
| 360 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 361 | |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 362 | case PVR_440EP_RA: |
| 363 | puts("EP Rev. A"); |
| 364 | break; |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 365 | |
Stefan Roese | 9a8d82f | 2005-10-04 15:00:30 +0200 | [diff] [blame] | 366 | #ifdef CONFIG_440EP |
| 367 | case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */ |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 368 | puts("EP Rev. B"); |
| 369 | break; |
Stefan Roese | 512f8d5 | 2006-05-10 14:10:41 +0200 | [diff] [blame] | 370 | |
| 371 | case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */ |
| 372 | puts("EP Rev. C"); |
| 373 | break; |
Stefan Roese | 9a8d82f | 2005-10-04 15:00:30 +0200 | [diff] [blame] | 374 | #endif /* CONFIG_440EP */ |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 375 | |
Stefan Roese | 9a8d82f | 2005-10-04 15:00:30 +0200 | [diff] [blame] | 376 | #ifdef CONFIG_440GR |
| 377 | case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */ |
| 378 | puts("GR Rev. A"); |
| 379 | break; |
Stefan Roese | 512f8d5 | 2006-05-10 14:10:41 +0200 | [diff] [blame] | 380 | |
Stefan Roese | 5770a1e | 2006-05-18 19:21:53 +0200 | [diff] [blame] | 381 | case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */ |
Stefan Roese | 512f8d5 | 2006-05-10 14:10:41 +0200 | [diff] [blame] | 382 | puts("GR Rev. B"); |
| 383 | break; |
Stefan Roese | 9a8d82f | 2005-10-04 15:00:30 +0200 | [diff] [blame] | 384 | #endif /* CONFIG_440GR */ |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 385 | #endif /* CONFIG_440 */ |
| 386 | |
Stefan Roese | 2902fad | 2007-01-31 16:56:10 +0100 | [diff] [blame] | 387 | #ifdef CONFIG_440EPX |
| 388 | case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */ |
Stefan Roese | edf0b54 | 2006-10-18 15:59:35 +0200 | [diff] [blame] | 389 | puts("EPx Rev. A"); |
| 390 | strcpy(addstr, "Security/Kasumi support"); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 391 | break; |
| 392 | |
Stefan Roese | 2902fad | 2007-01-31 16:56:10 +0100 | [diff] [blame] | 393 | case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */ |
Stefan Roese | edf0b54 | 2006-10-18 15:59:35 +0200 | [diff] [blame] | 394 | puts("EPx Rev. A"); |
| 395 | strcpy(addstr, "No Security/Kasumi support"); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 396 | break; |
Stefan Roese | 2902fad | 2007-01-31 16:56:10 +0100 | [diff] [blame] | 397 | #endif /* CONFIG_440EPX */ |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 398 | |
Stefan Roese | 2902fad | 2007-01-31 16:56:10 +0100 | [diff] [blame] | 399 | #ifdef CONFIG_440GRX |
| 400 | case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */ |
Stefan Roese | edf0b54 | 2006-10-18 15:59:35 +0200 | [diff] [blame] | 401 | puts("GRx Rev. A"); |
| 402 | strcpy(addstr, "Security/Kasumi support"); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 403 | break; |
| 404 | |
Stefan Roese | 2902fad | 2007-01-31 16:56:10 +0100 | [diff] [blame] | 405 | case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */ |
Stefan Roese | edf0b54 | 2006-10-18 15:59:35 +0200 | [diff] [blame] | 406 | puts("GRx Rev. A"); |
| 407 | strcpy(addstr, "No Security/Kasumi support"); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 408 | break; |
Stefan Roese | 2902fad | 2007-01-31 16:56:10 +0100 | [diff] [blame] | 409 | #endif /* CONFIG_440GRX */ |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 410 | |
Stefan Roese | 9598177 | 2007-01-13 08:01:03 +0100 | [diff] [blame] | 411 | case PVR_440SP_6_RAB: |
| 412 | puts("SP Rev. A/B"); |
| 413 | strcpy(addstr, "RAID 6 support"); |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 414 | break; |
| 415 | |
Stefan Roese | 9598177 | 2007-01-13 08:01:03 +0100 | [diff] [blame] | 416 | case PVR_440SP_RAB: |
| 417 | puts("SP Rev. A/B"); |
| 418 | strcpy(addstr, "No RAID 6 support"); |
| 419 | break; |
| 420 | |
| 421 | case PVR_440SP_6_RC: |
| 422 | puts("SP Rev. C"); |
| 423 | strcpy(addstr, "RAID 6 support"); |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 424 | break; |
| 425 | |
Stefan Roese | e732fae | 2006-11-28 16:09:24 +0100 | [diff] [blame] | 426 | case PVR_440SP_RC: |
| 427 | puts("SP Rev. C"); |
Stefan Roese | 9598177 | 2007-01-13 08:01:03 +0100 | [diff] [blame] | 428 | strcpy(addstr, "No RAID 6 support"); |
| 429 | break; |
| 430 | |
| 431 | case PVR_440SPe_6_RA: |
| 432 | puts("SPe Rev. A"); |
| 433 | strcpy(addstr, "RAID 6 support"); |
Stefan Roese | e732fae | 2006-11-28 16:09:24 +0100 | [diff] [blame] | 434 | break; |
| 435 | |
Marian Balakowicz | 6c5879f | 2006-06-30 16:30:46 +0200 | [diff] [blame] | 436 | case PVR_440SPe_RA: |
Marian Balakowicz | fe84b48 | 2006-07-03 23:42:36 +0200 | [diff] [blame] | 437 | puts("SPe Rev. A"); |
Stefan Roese | 9598177 | 2007-01-13 08:01:03 +0100 | [diff] [blame] | 438 | strcpy(addstr, "No RAID 6 support"); |
| 439 | break; |
| 440 | |
| 441 | case PVR_440SPe_6_RB: |
| 442 | puts("SPe Rev. B"); |
| 443 | strcpy(addstr, "RAID 6 support"); |
Marian Balakowicz | 6c5879f | 2006-06-30 16:30:46 +0200 | [diff] [blame] | 444 | break; |
Marian Balakowicz | fe84b48 | 2006-07-03 23:42:36 +0200 | [diff] [blame] | 445 | |
Marian Balakowicz | 6c5879f | 2006-06-30 16:30:46 +0200 | [diff] [blame] | 446 | case PVR_440SPe_RB: |
Marian Balakowicz | fe84b48 | 2006-07-03 23:42:36 +0200 | [diff] [blame] | 447 | puts("SPe Rev. B"); |
Stefan Roese | 9598177 | 2007-01-13 08:01:03 +0100 | [diff] [blame] | 448 | strcpy(addstr, "No RAID 6 support"); |
Marian Balakowicz | 6c5879f | 2006-06-30 16:30:46 +0200 | [diff] [blame] | 449 | break; |
Marian Balakowicz | fe84b48 | 2006-07-03 23:42:36 +0200 | [diff] [blame] | 450 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 451 | default: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 452 | printf (" UNKNOWN (PVR=%08x)", pvr); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 453 | break; |
| 454 | } |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 455 | |
| 456 | printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock), |
Stefan Roese | e01bd21 | 2007-03-21 13:38:59 +0100 | [diff] [blame] | 457 | sys_info.freqPLB / 1000000, |
| 458 | get_OPB_freq() / 1000000, |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 459 | sys_info.freqEBC / 1000000); |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 460 | |
Stefan Roese | edf0b54 | 2006-10-18 15:59:35 +0200 | [diff] [blame] | 461 | if (addstr[0] != 0) |
| 462 | printf(" %s\n", addstr); |
| 463 | |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 464 | #if defined(I2C_BOOTROM) |
| 465 | printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis"); |
Stefan Roese | 90e6f41 | 2007-04-18 12:05:59 +0200 | [diff] [blame] | 466 | #endif /* I2C_BOOTROM */ |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 467 | #if defined(SDR0_PINSTP_SHIFT) |
Benoît Monin | e3cbe1f | 2007-06-04 08:36:05 +0200 | [diff] [blame] | 468 | printf (" Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]); |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 469 | printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]); |
Wolfgang Denk | ba999c5 | 2006-10-20 17:54:33 +0200 | [diff] [blame] | 470 | #endif /* SDR0_PINSTP_SHIFT */ |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 471 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 472 | #if defined(CONFIG_PCI) && !defined(CONFIG_405EX) |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 473 | printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis"); |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 474 | #endif |
| 475 | |
Stefan Roese | 6e7fb6e | 2005-11-29 18:18:21 +0100 | [diff] [blame] | 476 | #if defined(PCI_ASYNC) |
| 477 | if (pci_async_enabled()) { |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 478 | printf (", PCI async ext clock used"); |
| 479 | } else { |
| 480 | printf (", PCI sync clock at %lu MHz", |
| 481 | sys_info.freqPLB / sys_info.pllPciDiv / 1000000); |
| 482 | } |
| 483 | #endif |
| 484 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 485 | #if defined(CONFIG_PCI) && !defined(CONFIG_405EX) |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 486 | putc('\n'); |
| 487 | #endif |
| 488 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 489 | #if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 490 | printf (" 16 kB I-Cache 16 kB D-Cache"); |
| 491 | #elif defined(CONFIG_440) |
| 492 | printf (" 32 kB I-Cache 32 kB D-Cache"); |
| 493 | #else |
| 494 | printf (" 16 kB I-Cache %d kB D-Cache", |
| 495 | ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8); |
| 496 | #endif |
| 497 | #endif /* !defined(CONFIG_IOP480) */ |
| 498 | |
| 499 | #if defined(CONFIG_IOP480) |
| 500 | printf ("PLX IOP480 (PVR=%08x)", pvr); |
| 501 | printf (" at %s MHz:", strmhz(buf, clock)); |
| 502 | printf (" %u kB I-Cache", 4); |
| 503 | printf (" %u kB D-Cache", 2); |
| 504 | #endif |
| 505 | |
| 506 | #endif /* !defined(CONFIG_405) */ |
| 507 | |
| 508 | putc ('\n'); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 509 | |
| 510 | return 0; |
| 511 | } |
| 512 | |
Rafal Jaworowski | 692519b | 2006-08-10 12:43:17 +0200 | [diff] [blame] | 513 | int ppc440spe_revB() { |
| 514 | unsigned int pvr; |
| 515 | |
| 516 | pvr = get_pvr(); |
Stefan Roese | 5a5c569 | 2007-01-15 09:46:29 +0100 | [diff] [blame] | 517 | if ((pvr == PVR_440SPe_6_RB) || (pvr == PVR_440SPe_RB)) |
Rafal Jaworowski | 692519b | 2006-08-10 12:43:17 +0200 | [diff] [blame] | 518 | return 1; |
| 519 | else |
| 520 | return 0; |
| 521 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 522 | |
| 523 | /* ------------------------------------------------------------------------- */ |
| 524 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 525 | int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 526 | { |
Stefan Roese | 1f94d16 | 2006-11-27 14:48:41 +0100 | [diff] [blame] | 527 | #if defined(CONFIG_BOARD_RESET) |
| 528 | board_reset(); |
Stefan Roese | 1729b92 | 2006-11-27 14:52:04 +0100 | [diff] [blame] | 529 | #else |
Stefan Roese | 1c2ce22 | 2006-11-27 14:12:17 +0100 | [diff] [blame] | 530 | #if defined(CFG_4xx_RESET_TYPE) |
| 531 | mtspr(dbcr0, CFG_4xx_RESET_TYPE << 28); |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 532 | #else |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 533 | /* |
| 534 | * Initiate system reset in debug control register DBCR |
| 535 | */ |
Stefan Roese | f344386 | 2006-10-07 11:30:52 +0200 | [diff] [blame] | 536 | mtspr(dbcr0, 0x30000000); |
Stefan Roese | 1729b92 | 2006-11-27 14:52:04 +0100 | [diff] [blame] | 537 | #endif /* defined(CFG_4xx_RESET_TYPE) */ |
Stefan Roese | f344386 | 2006-10-07 11:30:52 +0200 | [diff] [blame] | 538 | #endif /* defined(CONFIG_BOARD_RESET) */ |
Stefan Roese | c157d8e | 2005-08-01 16:41:48 +0200 | [diff] [blame] | 539 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 540 | return 1; |
| 541 | } |
| 542 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 543 | |
| 544 | /* |
| 545 | * Get timebase clock frequency |
| 546 | */ |
| 547 | unsigned long get_tbclk (void) |
| 548 | { |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 549 | #if !defined(CONFIG_IOP480) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 550 | sys_info_t sys_info; |
| 551 | |
| 552 | get_sys_info(&sys_info); |
| 553 | return (sys_info.freqProcessor); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 554 | #else |
Stefan Roese | 3d9569b | 2005-11-27 19:36:26 +0100 | [diff] [blame] | 555 | return (66000000); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 556 | #endif |
| 557 | |
| 558 | } |
| 559 | |
| 560 | |
| 561 | #if defined(CONFIG_WATCHDOG) |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 562 | void watchdog_reset(void) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 563 | { |
| 564 | int re_enable = disable_interrupts(); |
| 565 | reset_4xx_watchdog(); |
| 566 | if (re_enable) enable_interrupts(); |
| 567 | } |
| 568 | |
Stefan Roese | c7f69c3 | 2007-11-09 12:18:54 +0100 | [diff] [blame] | 569 | void reset_4xx_watchdog(void) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 570 | { |
| 571 | /* |
| 572 | * Clear TSR(WIS) bit |
| 573 | */ |
| 574 | mtspr(tsr, 0x40000000); |
| 575 | } |
| 576 | #endif /* CONFIG_WATCHDOG */ |