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