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