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