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