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