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