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