wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Josef Baumgartner <josef.baumgartner@telex.de> |
| 4 | * |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 5 | * MCF5282 additionals |
| 6 | * (C) Copyright 2005 |
| 7 | * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de> |
| 8 | * |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 9 | * MCF5275 additions |
| 10 | * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.com) |
| 11 | * |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 12 | * See file CREDITS for list of people who contributed to this |
| 13 | * project. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License as |
| 17 | * published by the Free Software Foundation; either version 2 of |
| 18 | * the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 28 | * MA 02111-1307 USA |
| 29 | */ |
| 30 | |
| 31 | #include <common.h> |
| 32 | #include <watchdog.h> |
| 33 | #include <command.h> |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 34 | #include <asm/immap.h> |
Ben Warren | 2f2b6b6 | 2008-08-31 22:22:04 -0700 | [diff] [blame] | 35 | #include <netdev.h> |
Richard Retanubun | 5ffa65b | 2009-10-26 14:19:17 -0400 | [diff] [blame] | 36 | #include "cpu.h" |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 37 | |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 38 | DECLARE_GLOBAL_DATA_PTR; |
| 39 | |
| 40 | #ifdef CONFIG_M5208 |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 41 | int do_reset(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char * const argv[]) |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 42 | { |
| 43 | volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM); |
| 44 | |
| 45 | udelay(1000); |
| 46 | |
| 47 | rcm->rcr = RCM_RCR_SOFTRST; |
| 48 | |
| 49 | /* we don't return! */ |
| 50 | return 0; |
| 51 | }; |
| 52 | |
| 53 | int checkcpu(void) |
| 54 | { |
| 55 | char buf1[32], buf2[32]; |
| 56 | |
| 57 | printf("CPU: Freescale Coldfire MCF5208\n" |
| 58 | " CPU CLK %s MHz BUS CLK %s MHz\n", |
| 59 | strmhz(buf1, gd->cpu_clk), |
| 60 | strmhz(buf2, gd->bus_clk)); |
| 61 | return 0; |
| 62 | }; |
| 63 | |
| 64 | #if defined(CONFIG_WATCHDOG) |
| 65 | /* Called by macro WATCHDOG_RESET */ |
| 66 | void watchdog_reset(void) |
| 67 | { |
| 68 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 69 | wdt->sr = 0x5555; |
| 70 | wdt->sr = 0xAAAA; |
| 71 | } |
| 72 | |
| 73 | int watchdog_disable(void) |
| 74 | { |
| 75 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 76 | |
| 77 | wdt->sr = 0x5555; /* reset watchdog counteDECLARE_GLOBAL_DATA_PTR; |
| 78 | r */ |
| 79 | wdt->sr = 0xAAAA; |
| 80 | wdt->cr = 0; /* disable watchdog timer */ |
| 81 | |
| 82 | puts("WATCHDOG:disabled\n"); |
| 83 | return (0); |
| 84 | } |
| 85 | |
| 86 | int watchdog_init(void) |
| 87 | { |
| 88 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 89 | |
| 90 | wdt->cr = 0; /* disable watchdog */ |
| 91 | |
| 92 | /* set timeout and enable watchdog */ |
| 93 | wdt->mr = |
| 94 | ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; |
| 95 | wdt->sr = 0x5555; /* reset watchdog counter */ |
| 96 | wdt->sr = 0xAAAA; |
| 97 | |
| 98 | puts("WATCHDOG:enabled\n"); |
| 99 | return (0); |
| 100 | } |
| 101 | #endif /* #ifdef CONFIG_WATCHDOG */ |
| 102 | #endif /* #ifdef CONFIG_M5208 */ |
| 103 | |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 104 | #ifdef CONFIG_M5271 |
Bartlomiej Sieka | ad87026 | 2007-01-23 13:25:22 +0100 | [diff] [blame] | 105 | /* |
| 106 | * Both MCF5270 and MCF5271 are members of the MPC5271 family. Try to |
| 107 | * determine which one we are running on, based on the Chip Identification |
| 108 | * Register (CIR). |
| 109 | */ |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 110 | int checkcpu(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 111 | { |
Marian Balakowicz | ecb6d0b | 2006-05-09 11:45:31 +0200 | [diff] [blame] | 112 | char buf[32]; |
Bartlomiej Sieka | ad87026 | 2007-01-23 13:25:22 +0100 | [diff] [blame] | 113 | unsigned short cir; /* Chip Identification Register */ |
| 114 | unsigned short pin; /* Part identification number */ |
| 115 | unsigned char prn; /* Part revision number */ |
| 116 | char *cpu_model; |
| 117 | |
| 118 | cir = mbar_readShort(MCF_CCM_CIR); |
| 119 | pin = cir >> MCF_CCM_CIR_PIN_LEN; |
| 120 | prn = cir & MCF_CCM_CIR_PRN_MASK; |
| 121 | |
| 122 | switch (pin) { |
| 123 | case MCF_CCM_CIR_PIN_MCF5270: |
| 124 | cpu_model = "5270"; |
| 125 | break; |
| 126 | case MCF_CCM_CIR_PIN_MCF5271: |
| 127 | cpu_model = "5271"; |
| 128 | break; |
| 129 | default: |
| 130 | cpu_model = NULL; |
| 131 | break; |
| 132 | } |
| 133 | |
| 134 | if (cpu_model) |
| 135 | printf("CPU: Freescale ColdFire MCF%s rev. %hu, at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 136 | cpu_model, prn, strmhz(buf, CONFIG_SYS_CLK)); |
Bartlomiej Sieka | ad87026 | 2007-01-23 13:25:22 +0100 | [diff] [blame] | 137 | else |
| 138 | printf("CPU: Unknown - Freescale ColdFire MCF5271 family" |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 139 | " (PIN: 0x%x) rev. %hu, at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 140 | pin, prn, strmhz(buf, CONFIG_SYS_CLK)); |
Marian Balakowicz | ecb6d0b | 2006-05-09 11:45:31 +0200 | [diff] [blame] | 141 | |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 142 | return 0; |
| 143 | } |
| 144 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 145 | int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const argv[]) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 146 | { |
Richard Retanubun | 5ffa65b | 2009-10-26 14:19:17 -0400 | [diff] [blame] | 147 | /* Call the board specific reset actions first. */ |
| 148 | if(board_reset) { |
| 149 | board_reset(); |
| 150 | } |
| 151 | |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 152 | mbar_writeByte(MCF_RCM_RCR, |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 153 | MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT); |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 154 | return 0; |
| 155 | }; |
| 156 | |
| 157 | #if defined(CONFIG_WATCHDOG) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 158 | void watchdog_reset(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 159 | { |
| 160 | mbar_writeShort(MCF_WTM_WSR, 0x5555); |
| 161 | mbar_writeShort(MCF_WTM_WSR, 0xAAAA); |
| 162 | } |
| 163 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 164 | int watchdog_disable(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 165 | { |
| 166 | mbar_writeShort(MCF_WTM_WCR, 0); |
| 167 | return (0); |
| 168 | } |
| 169 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 170 | int watchdog_init(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 171 | { |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 172 | mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN); |
| 173 | return (0); |
| 174 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 175 | #endif /* #ifdef CONFIG_WATCHDOG */ |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 176 | |
| 177 | #endif |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 178 | |
| 179 | #ifdef CONFIG_M5272 |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 180 | int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const argv[]) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 181 | { |
| 182 | volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 183 | |
| 184 | wdp->wdog_wrrr = 0; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 185 | udelay(1000); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 186 | |
| 187 | /* enable watchdog, set timeout to 0 and wait */ |
| 188 | wdp->wdog_wrrr = 1; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 189 | while (1) ; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 190 | |
| 191 | /* we don't return! */ |
| 192 | return 0; |
| 193 | }; |
| 194 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 195 | int checkcpu(void) |
| 196 | { |
| 197 | volatile sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 198 | uchar msk; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 199 | char *suf; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 200 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 201 | puts("CPU: "); |
| 202 | msk = (sysctrl->sc_dir > 28) & 0xf; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 203 | switch (msk) { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 204 | case 0x2: |
| 205 | suf = "1K75N"; |
| 206 | break; |
| 207 | case 0x4: |
| 208 | suf = "3K75N"; |
| 209 | break; |
| 210 | default: |
| 211 | suf = NULL; |
| 212 | printf("Freescale MCF5272 (Mask:%01x)\n", msk); |
| 213 | break; |
| 214 | } |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 215 | |
| 216 | if (suf) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 217 | printf("Freescale MCF5272 %s\n", suf); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 218 | return 0; |
| 219 | }; |
| 220 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 221 | #if defined(CONFIG_WATCHDOG) |
| 222 | /* Called by macro WATCHDOG_RESET */ |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 223 | void watchdog_reset(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 224 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 225 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 226 | wdt->wdog_wcr = 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 227 | } |
| 228 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 229 | int watchdog_disable(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 230 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 231 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 232 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 233 | wdt->wdog_wcr = 0; /* reset watchdog counter */ |
| 234 | wdt->wdog_wirr = 0; /* disable watchdog interrupt */ |
| 235 | wdt->wdog_wrrr = 0; /* disable watchdog timer */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 236 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 237 | puts("WATCHDOG:disabled\n"); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 238 | return (0); |
| 239 | } |
| 240 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 241 | int watchdog_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 242 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 243 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 244 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 245 | wdt->wdog_wirr = 0; /* disable watchdog interrupt */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 246 | |
| 247 | /* set timeout and enable watchdog */ |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 248 | wdt->wdog_wrrr = |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 249 | ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 250 | wdt->wdog_wcr = 0; /* reset watchdog counter */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 251 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 252 | puts("WATCHDOG:enabled\n"); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 253 | return (0); |
| 254 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 255 | #endif /* #ifdef CONFIG_WATCHDOG */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 256 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 257 | #endif /* #ifdef CONFIG_M5272 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 258 | |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 259 | #ifdef CONFIG_M5275 |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 260 | int do_reset(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char * const argv[]) |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 261 | { |
| 262 | volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM); |
| 263 | |
| 264 | udelay(1000); |
| 265 | |
| 266 | rcm->rcr = RCM_RCR_SOFTRST; |
| 267 | |
| 268 | /* we don't return! */ |
| 269 | return 0; |
| 270 | }; |
| 271 | |
| 272 | int checkcpu(void) |
| 273 | { |
| 274 | char buf[32]; |
| 275 | |
| 276 | printf("CPU: Freescale Coldfire MCF5275 at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 277 | strmhz(buf, CONFIG_SYS_CLK)); |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 278 | return 0; |
| 279 | }; |
| 280 | |
| 281 | |
| 282 | #if defined(CONFIG_WATCHDOG) |
| 283 | /* Called by macro WATCHDOG_RESET */ |
| 284 | void watchdog_reset(void) |
| 285 | { |
| 286 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 287 | wdt->wsr = 0x5555; |
| 288 | wdt->wsr = 0xAAAA; |
| 289 | } |
| 290 | |
| 291 | int watchdog_disable(void) |
| 292 | { |
| 293 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 294 | |
| 295 | wdt->wsr = 0x5555; /* reset watchdog counter */ |
| 296 | wdt->wsr = 0xAAAA; |
| 297 | wdt->wcr = 0; /* disable watchdog timer */ |
| 298 | |
| 299 | puts("WATCHDOG:disabled\n"); |
| 300 | return (0); |
| 301 | } |
| 302 | |
| 303 | int watchdog_init(void) |
| 304 | { |
| 305 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 306 | |
| 307 | wdt->wcr = 0; /* disable watchdog */ |
| 308 | |
| 309 | /* set timeout and enable watchdog */ |
| 310 | wdt->wmr = |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 311 | ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 312 | wdt->wsr = 0x5555; /* reset watchdog counter */ |
| 313 | wdt->wsr = 0xAAAA; |
| 314 | |
| 315 | puts("WATCHDOG:enabled\n"); |
| 316 | return (0); |
| 317 | } |
| 318 | #endif /* #ifdef CONFIG_WATCHDOG */ |
| 319 | |
| 320 | #endif /* #ifdef CONFIG_M5275 */ |
| 321 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 322 | #ifdef CONFIG_M5282 |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 323 | int checkcpu(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 324 | { |
Wolfgang Denk | b4b1c46 | 2006-06-10 19:27:47 +0200 | [diff] [blame] | 325 | unsigned char resetsource = MCFRESET_RSR; |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 326 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 327 | printf("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n", |
| 328 | MCFCCM_CIR >> 8, MCFCCM_CIR & MCFCCM_CIR_PRN_MASK); |
| 329 | printf("Reset:%s%s%s%s%s%s%s\n", |
| 330 | (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "", |
| 331 | (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "", |
| 332 | (resetsource & MCFRESET_RSR_EXT) ? " External" : "", |
| 333 | (resetsource & MCFRESET_RSR_POR) ? " Power On" : "", |
| 334 | (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "", |
| 335 | (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "", |
| 336 | (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : ""); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 337 | return 0; |
| 338 | } |
| 339 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 340 | int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const argv[]) |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 341 | { |
| 342 | MCFRESET_RCR = MCFRESET_RCR_SOFTRST; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 343 | return 0; |
| 344 | }; |
| 345 | #endif |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 346 | |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 347 | #ifdef CONFIG_M5249 |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 348 | int checkcpu(void) |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 349 | { |
| 350 | char buf[32]; |
| 351 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 352 | printf("CPU: Freescale Coldfire MCF5249 at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 353 | strmhz(buf, CONFIG_SYS_CLK)); |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 354 | return 0; |
| 355 | } |
| 356 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 357 | int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const argv[]) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 358 | { |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 359 | /* enable watchdog, set timeout to 0 and wait */ |
| 360 | mbar_writeByte(MCFSIM_SYPCR, 0xc0); |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 361 | while (1) ; |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 362 | |
| 363 | /* we don't return! */ |
| 364 | return 0; |
| 365 | }; |
| 366 | #endif |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 367 | |
| 368 | #ifdef CONFIG_M5253 |
| 369 | int checkcpu(void) |
| 370 | { |
| 371 | char buf[32]; |
| 372 | |
| 373 | unsigned char resetsource = mbar_readLong(SIM_RSR); |
| 374 | printf("CPU: Freescale Coldfire MCF5253 at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 375 | strmhz(buf, CONFIG_SYS_CLK)); |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 376 | |
| 377 | if ((resetsource & SIM_RSR_HRST) || (resetsource & SIM_RSR_SWTR)) { |
| 378 | printf("Reset:%s%s\n", |
| 379 | (resetsource & SIM_RSR_HRST) ? " Hardware/ System Reset" |
| 380 | : "", |
| 381 | (resetsource & SIM_RSR_SWTR) ? " Software Watchdog" : |
| 382 | ""); |
| 383 | } |
| 384 | return 0; |
| 385 | } |
| 386 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame^] | 387 | int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const argv[]) |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 388 | { |
| 389 | /* enable watchdog, set timeout to 0 and wait */ |
| 390 | mbar_writeByte(SIM_SYPCR, 0xc0); |
| 391 | while (1) ; |
| 392 | |
| 393 | /* we don't return! */ |
| 394 | return 0; |
| 395 | }; |
| 396 | #endif |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 397 | |
| 398 | #if defined(CONFIG_MCFFEC) |
| 399 | /* Default initializations for MCFFEC controllers. To override, |
| 400 | * create a board-specific function called: |
| 401 | * int board_eth_init(bd_t *bis) |
| 402 | */ |
| 403 | |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 404 | int cpu_eth_init(bd_t *bis) |
| 405 | { |
| 406 | return mcffec_initialize(bis); |
| 407 | } |
| 408 | #endif |