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 |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 41 | int do_reset(cmd_tbl_t *cmdtp, 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 | |
John Rigby | 0d21ed0 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 77 | wdt->sr = 0x5555; /* reset watchdog counter */ |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 78 | wdt->sr = 0xAAAA; |
| 79 | wdt->cr = 0; /* disable watchdog timer */ |
| 80 | |
| 81 | puts("WATCHDOG:disabled\n"); |
| 82 | return (0); |
| 83 | } |
| 84 | |
| 85 | int watchdog_init(void) |
| 86 | { |
| 87 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 88 | |
| 89 | wdt->cr = 0; /* disable watchdog */ |
| 90 | |
| 91 | /* set timeout and enable watchdog */ |
| 92 | wdt->mr = |
| 93 | ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; |
| 94 | wdt->sr = 0x5555; /* reset watchdog counter */ |
| 95 | wdt->sr = 0xAAAA; |
| 96 | |
| 97 | puts("WATCHDOG:enabled\n"); |
| 98 | return (0); |
| 99 | } |
| 100 | #endif /* #ifdef CONFIG_WATCHDOG */ |
| 101 | #endif /* #ifdef CONFIG_M5208 */ |
| 102 | |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 103 | #ifdef CONFIG_M5271 |
Bartlomiej Sieka | ad87026 | 2007-01-23 13:25:22 +0100 | [diff] [blame] | 104 | /* |
| 105 | * Both MCF5270 and MCF5271 are members of the MPC5271 family. Try to |
| 106 | * determine which one we are running on, based on the Chip Identification |
| 107 | * Register (CIR). |
| 108 | */ |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 109 | int checkcpu(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 110 | { |
Marian Balakowicz | ecb6d0b | 2006-05-09 11:45:31 +0200 | [diff] [blame] | 111 | char buf[32]; |
Bartlomiej Sieka | ad87026 | 2007-01-23 13:25:22 +0100 | [diff] [blame] | 112 | unsigned short cir; /* Chip Identification Register */ |
| 113 | unsigned short pin; /* Part identification number */ |
| 114 | unsigned char prn; /* Part revision number */ |
| 115 | char *cpu_model; |
| 116 | |
| 117 | cir = mbar_readShort(MCF_CCM_CIR); |
| 118 | pin = cir >> MCF_CCM_CIR_PIN_LEN; |
| 119 | prn = cir & MCF_CCM_CIR_PRN_MASK; |
| 120 | |
| 121 | switch (pin) { |
| 122 | case MCF_CCM_CIR_PIN_MCF5270: |
| 123 | cpu_model = "5270"; |
| 124 | break; |
| 125 | case MCF_CCM_CIR_PIN_MCF5271: |
| 126 | cpu_model = "5271"; |
| 127 | break; |
| 128 | default: |
| 129 | cpu_model = NULL; |
| 130 | break; |
| 131 | } |
| 132 | |
| 133 | if (cpu_model) |
| 134 | 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] | 135 | cpu_model, prn, strmhz(buf, CONFIG_SYS_CLK)); |
Bartlomiej Sieka | ad87026 | 2007-01-23 13:25:22 +0100 | [diff] [blame] | 136 | else |
| 137 | printf("CPU: Unknown - Freescale ColdFire MCF5271 family" |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 138 | " (PIN: 0x%x) rev. %hu, at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 139 | pin, prn, strmhz(buf, CONFIG_SYS_CLK)); |
Marian Balakowicz | ecb6d0b | 2006-05-09 11:45:31 +0200 | [diff] [blame] | 140 | |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 141 | return 0; |
| 142 | } |
| 143 | |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 144 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 145 | { |
Richard Retanubun | 5ffa65b | 2009-10-26 14:19:17 -0400 | [diff] [blame] | 146 | /* Call the board specific reset actions first. */ |
| 147 | if(board_reset) { |
| 148 | board_reset(); |
| 149 | } |
| 150 | |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 151 | mbar_writeByte(MCF_RCM_RCR, |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 152 | MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT); |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 153 | return 0; |
| 154 | }; |
| 155 | |
| 156 | #if defined(CONFIG_WATCHDOG) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 157 | void watchdog_reset(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 158 | { |
| 159 | mbar_writeShort(MCF_WTM_WSR, 0x5555); |
| 160 | mbar_writeShort(MCF_WTM_WSR, 0xAAAA); |
| 161 | } |
| 162 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 163 | int watchdog_disable(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 164 | { |
| 165 | mbar_writeShort(MCF_WTM_WCR, 0); |
| 166 | return (0); |
| 167 | } |
| 168 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 169 | int watchdog_init(void) |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 170 | { |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 171 | mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN); |
| 172 | return (0); |
| 173 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 174 | #endif /* #ifdef CONFIG_WATCHDOG */ |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 175 | |
| 176 | #endif |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 177 | |
| 178 | #ifdef CONFIG_M5272 |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 179 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 180 | { |
| 181 | volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 182 | |
| 183 | wdp->wdog_wrrr = 0; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 184 | udelay(1000); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 185 | |
| 186 | /* enable watchdog, set timeout to 0 and wait */ |
| 187 | wdp->wdog_wrrr = 1; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 188 | while (1) ; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 189 | |
| 190 | /* we don't return! */ |
| 191 | return 0; |
| 192 | }; |
| 193 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 194 | int checkcpu(void) |
| 195 | { |
| 196 | volatile sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 197 | uchar msk; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 198 | char *suf; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 199 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 200 | puts("CPU: "); |
| 201 | msk = (sysctrl->sc_dir > 28) & 0xf; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 202 | switch (msk) { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 203 | case 0x2: |
| 204 | suf = "1K75N"; |
| 205 | break; |
| 206 | case 0x4: |
| 207 | suf = "3K75N"; |
| 208 | break; |
| 209 | default: |
| 210 | suf = NULL; |
| 211 | printf("Freescale MCF5272 (Mask:%01x)\n", msk); |
| 212 | break; |
| 213 | } |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 214 | |
| 215 | if (suf) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 216 | printf("Freescale MCF5272 %s\n", suf); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 217 | return 0; |
| 218 | }; |
| 219 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 220 | #if defined(CONFIG_WATCHDOG) |
| 221 | /* Called by macro WATCHDOG_RESET */ |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 222 | void watchdog_reset(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 223 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 224 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 225 | wdt->wdog_wcr = 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 226 | } |
| 227 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 228 | int watchdog_disable(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 229 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 230 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 231 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 232 | wdt->wdog_wcr = 0; /* reset watchdog counter */ |
| 233 | wdt->wdog_wirr = 0; /* disable watchdog interrupt */ |
| 234 | wdt->wdog_wrrr = 0; /* disable watchdog timer */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 235 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 236 | puts("WATCHDOG:disabled\n"); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 237 | return (0); |
| 238 | } |
| 239 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 240 | int watchdog_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 241 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 242 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 243 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 244 | wdt->wdog_wirr = 0; /* disable watchdog interrupt */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 245 | |
| 246 | /* set timeout and enable watchdog */ |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 247 | wdt->wdog_wrrr = |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 248 | ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 249 | wdt->wdog_wcr = 0; /* reset watchdog counter */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 250 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 251 | puts("WATCHDOG:enabled\n"); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 252 | return (0); |
| 253 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 254 | #endif /* #ifdef CONFIG_WATCHDOG */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 255 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 256 | #endif /* #ifdef CONFIG_M5272 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 257 | |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 258 | #ifdef CONFIG_M5275 |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 259 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 260 | { |
| 261 | volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM); |
| 262 | |
| 263 | udelay(1000); |
| 264 | |
| 265 | rcm->rcr = RCM_RCR_SOFTRST; |
| 266 | |
| 267 | /* we don't return! */ |
| 268 | return 0; |
| 269 | }; |
| 270 | |
| 271 | int checkcpu(void) |
| 272 | { |
| 273 | char buf[32]; |
| 274 | |
| 275 | printf("CPU: Freescale Coldfire MCF5275 at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 276 | strmhz(buf, CONFIG_SYS_CLK)); |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 277 | return 0; |
| 278 | }; |
| 279 | |
| 280 | |
| 281 | #if defined(CONFIG_WATCHDOG) |
| 282 | /* Called by macro WATCHDOG_RESET */ |
| 283 | void watchdog_reset(void) |
| 284 | { |
| 285 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 286 | wdt->wsr = 0x5555; |
| 287 | wdt->wsr = 0xAAAA; |
| 288 | } |
| 289 | |
| 290 | int watchdog_disable(void) |
| 291 | { |
| 292 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 293 | |
| 294 | wdt->wsr = 0x5555; /* reset watchdog counter */ |
| 295 | wdt->wsr = 0xAAAA; |
| 296 | wdt->wcr = 0; /* disable watchdog timer */ |
| 297 | |
| 298 | puts("WATCHDOG:disabled\n"); |
| 299 | return (0); |
| 300 | } |
| 301 | |
| 302 | int watchdog_init(void) |
| 303 | { |
| 304 | volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); |
| 305 | |
| 306 | wdt->wcr = 0; /* disable watchdog */ |
| 307 | |
| 308 | /* set timeout and enable watchdog */ |
| 309 | wdt->wmr = |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 310 | ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 311 | wdt->wsr = 0x5555; /* reset watchdog counter */ |
| 312 | wdt->wsr = 0xAAAA; |
| 313 | |
| 314 | puts("WATCHDOG:enabled\n"); |
| 315 | return (0); |
| 316 | } |
| 317 | #endif /* #ifdef CONFIG_WATCHDOG */ |
| 318 | |
| 319 | #endif /* #ifdef CONFIG_M5275 */ |
| 320 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 321 | #ifdef CONFIG_M5282 |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 322 | int checkcpu(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 323 | { |
Wolfgang Denk | b4b1c46 | 2006-06-10 19:27:47 +0200 | [diff] [blame] | 324 | unsigned char resetsource = MCFRESET_RSR; |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 325 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 326 | printf("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n", |
| 327 | MCFCCM_CIR >> 8, MCFCCM_CIR & MCFCCM_CIR_PRN_MASK); |
| 328 | printf("Reset:%s%s%s%s%s%s%s\n", |
| 329 | (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "", |
| 330 | (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "", |
| 331 | (resetsource & MCFRESET_RSR_EXT) ? " External" : "", |
| 332 | (resetsource & MCFRESET_RSR_POR) ? " Power On" : "", |
| 333 | (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "", |
| 334 | (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "", |
| 335 | (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : ""); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 336 | return 0; |
| 337 | } |
| 338 | |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 339 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 340 | { |
| 341 | MCFRESET_RCR = MCFRESET_RCR_SOFTRST; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 342 | return 0; |
| 343 | }; |
| 344 | #endif |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 345 | |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 346 | #ifdef CONFIG_M5249 |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 347 | int checkcpu(void) |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 348 | { |
| 349 | char buf[32]; |
| 350 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 351 | printf("CPU: Freescale Coldfire MCF5249 at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 352 | strmhz(buf, CONFIG_SYS_CLK)); |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 353 | return 0; |
| 354 | } |
| 355 | |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 356 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 357 | { |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 358 | /* enable watchdog, set timeout to 0 and wait */ |
| 359 | mbar_writeByte(MCFSIM_SYPCR, 0xc0); |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 360 | while (1) ; |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 361 | |
| 362 | /* we don't return! */ |
| 363 | return 0; |
| 364 | }; |
| 365 | #endif |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 366 | |
| 367 | #ifdef CONFIG_M5253 |
| 368 | int checkcpu(void) |
| 369 | { |
| 370 | char buf[32]; |
| 371 | |
| 372 | unsigned char resetsource = mbar_readLong(SIM_RSR); |
| 373 | printf("CPU: Freescale Coldfire MCF5253 at %s MHz\n", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 374 | strmhz(buf, CONFIG_SYS_CLK)); |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 375 | |
| 376 | if ((resetsource & SIM_RSR_HRST) || (resetsource & SIM_RSR_SWTR)) { |
| 377 | printf("Reset:%s%s\n", |
| 378 | (resetsource & SIM_RSR_HRST) ? " Hardware/ System Reset" |
| 379 | : "", |
| 380 | (resetsource & SIM_RSR_SWTR) ? " Software Watchdog" : |
| 381 | ""); |
| 382 | } |
| 383 | return 0; |
| 384 | } |
| 385 | |
Mike Frysinger | 6d1f698 | 2010-10-20 03:41:17 -0400 | [diff] [blame] | 386 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 387 | { |
| 388 | /* enable watchdog, set timeout to 0 and wait */ |
| 389 | mbar_writeByte(SIM_SYPCR, 0xc0); |
| 390 | while (1) ; |
| 391 | |
| 392 | /* we don't return! */ |
| 393 | return 0; |
| 394 | }; |
| 395 | #endif |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 396 | |
| 397 | #if defined(CONFIG_MCFFEC) |
| 398 | /* Default initializations for MCFFEC controllers. To override, |
| 399 | * create a board-specific function called: |
| 400 | * int board_eth_init(bd_t *bis) |
| 401 | */ |
| 402 | |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 403 | int cpu_eth_init(bd_t *bis) |
| 404 | { |
| 405 | return mcffec_initialize(bis); |
| 406 | } |
| 407 | #endif |