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