blob: b48a753f9b79ef3468eaca3e33c89b553ad17636 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenke65527f2004-02-12 00:47:09 +00002/*
3 * (C) Copyright 2003
4 * Josef Baumgartner <josef.baumgartner@telex.de>
5 *
Heiko Schocherac1956e2006-04-20 08:42:42 +02006 * MCF5282 additionals
7 * (C) Copyright 2005
8 * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
9 *
Matthew Fettke761e2e92008-02-04 15:38:20 -060010 * MCF5275 additions
11 * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.com)
12 *
Alison Wang95bed1f2012-03-26 21:49:04 +000013 * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
wdenke65527f2004-02-12 00:47:09 +000014 */
15
16#include <common.h>
Simon Glassf5c208d2019-11-14 12:57:20 -070017#include <vsprintf.h>
wdenke65527f2004-02-12 00:47:09 +000018#include <watchdog.h>
19#include <command.h>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050020#include <asm/immap.h>
Alison Wang95bed1f2012-03-26 21:49:04 +000021#include <asm/io.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070022#include <netdev.h>
Richard Retanubun5ffa65b2009-10-26 14:19:17 -040023#include "cpu.h"
wdenke65527f2004-02-12 00:47:09 +000024
TsiChung Liewb354aef2009-06-12 11:29:00 +000025DECLARE_GLOBAL_DATA_PTR;
26
27#ifdef CONFIG_M5208
Mike Frysinger6d1f6982010-10-20 03:41:17 -040028int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liewb354aef2009-06-12 11:29:00 +000029{
Alison Wang95bed1f2012-03-26 21:49:04 +000030 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
TsiChung Liewb354aef2009-06-12 11:29:00 +000031
32 udelay(1000);
33
Alison Wang95bed1f2012-03-26 21:49:04 +000034 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChung Liewb354aef2009-06-12 11:29:00 +000035
36 /* we don't return! */
37 return 0;
38};
39
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020040#if defined(CONFIG_DISPLAY_CPUINFO)
41int print_cpuinfo(void)
TsiChung Liewb354aef2009-06-12 11:29:00 +000042{
43 char buf1[32], buf2[32];
44
45 printf("CPU: Freescale Coldfire MCF5208\n"
46 " CPU CLK %s MHz BUS CLK %s MHz\n",
47 strmhz(buf1, gd->cpu_clk),
48 strmhz(buf2, gd->bus_clk));
49 return 0;
50};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020051#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChung Liewb354aef2009-06-12 11:29:00 +000052
53#if defined(CONFIG_WATCHDOG)
54/* Called by macro WATCHDOG_RESET */
55void watchdog_reset(void)
56{
Alison Wang95bed1f2012-03-26 21:49:04 +000057 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
58
59 out_be16(&wdt->sr, 0x5555);
60 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewb354aef2009-06-12 11:29:00 +000061}
62
63int watchdog_disable(void)
64{
Alison Wang95bed1f2012-03-26 21:49:04 +000065 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewb354aef2009-06-12 11:29:00 +000066
Alison Wang95bed1f2012-03-26 21:49:04 +000067 /* reset watchdog counter */
68 out_be16(&wdt->sr, 0x5555);
69 out_be16(&wdt->sr, 0xaaaa);
70 /* disable watchdog timer */
71 out_be16(&wdt->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +000072
73 puts("WATCHDOG:disabled\n");
74 return (0);
75}
76
77int watchdog_init(void)
78{
Alison Wang95bed1f2012-03-26 21:49:04 +000079 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewb354aef2009-06-12 11:29:00 +000080
Alison Wang95bed1f2012-03-26 21:49:04 +000081 /* disable watchdog */
82 out_be16(&wdt->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +000083
84 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +000085 out_be16(&wdt->mr,
86 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
87
88 /* reset watchdog counter */
89 out_be16(&wdt->sr, 0x5555);
90 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewb354aef2009-06-12 11:29:00 +000091
92 puts("WATCHDOG:enabled\n");
93 return (0);
94}
95#endif /* #ifdef CONFIG_WATCHDOG */
96#endif /* #ifdef CONFIG_M5208 */
97
Zachary P. Landau0bba8622006-01-26 17:35:56 -050098#ifdef CONFIG_M5271
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020099#if defined(CONFIG_DISPLAY_CPUINFO)
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100100/*
101 * Both MCF5270 and MCF5271 are members of the MPC5271 family. Try to
102 * determine which one we are running on, based on the Chip Identification
103 * Register (CIR).
104 */
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200105int print_cpuinfo(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500106{
Marian Balakowiczecb6d0b2006-05-09 11:45:31 +0200107 char buf[32];
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100108 unsigned short cir; /* Chip Identification Register */
109 unsigned short pin; /* Part identification number */
110 unsigned char prn; /* Part revision number */
111 char *cpu_model;
112
113 cir = mbar_readShort(MCF_CCM_CIR);
114 pin = cir >> MCF_CCM_CIR_PIN_LEN;
115 prn = cir & MCF_CCM_CIR_PRN_MASK;
116
117 switch (pin) {
118 case MCF_CCM_CIR_PIN_MCF5270:
119 cpu_model = "5270";
120 break;
121 case MCF_CCM_CIR_PIN_MCF5271:
122 cpu_model = "5271";
123 break;
124 default:
125 cpu_model = NULL;
126 break;
127 }
128
129 if (cpu_model)
130 printf("CPU: Freescale ColdFire MCF%s rev. %hu, at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200131 cpu_model, prn, strmhz(buf, CONFIG_SYS_CLK));
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100132 else
133 printf("CPU: Unknown - Freescale ColdFire MCF5271 family"
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500134 " (PIN: 0x%x) rev. %hu, at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200135 pin, prn, strmhz(buf, CONFIG_SYS_CLK));
Marian Balakowiczecb6d0b2006-05-09 11:45:31 +0200136
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500137 return 0;
138}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200139#endif /* CONFIG_DISPLAY_CPUINFO */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500140
Mike Frysinger6d1f6982010-10-20 03:41:17 -0400141int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500142{
Richard Retanubun5ffa65b2009-10-26 14:19:17 -0400143 /* Call the board specific reset actions first. */
144 if(board_reset) {
145 board_reset();
146 }
147
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500148 mbar_writeByte(MCF_RCM_RCR,
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500149 MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500150 return 0;
151};
152
153#if defined(CONFIG_WATCHDOG)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500154void watchdog_reset(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500155{
156 mbar_writeShort(MCF_WTM_WSR, 0x5555);
157 mbar_writeShort(MCF_WTM_WSR, 0xAAAA);
158}
159
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500160int watchdog_disable(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500161{
162 mbar_writeShort(MCF_WTM_WCR, 0);
163 return (0);
164}
165
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500166int watchdog_init(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500167{
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500168 mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN);
169 return (0);
170}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500171#endif /* #ifdef CONFIG_WATCHDOG */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500172
173#endif
wdenke65527f2004-02-12 00:47:09 +0000174
175#ifdef CONFIG_M5272
Mike Frysinger6d1f6982010-10-20 03:41:17 -0400176int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500177{
Alison Wang95bed1f2012-03-26 21:49:04 +0000178 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000179
Alison Wang95bed1f2012-03-26 21:49:04 +0000180 out_be16(&wdp->wdog_wrrr, 0);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500181 udelay(1000);
wdenke65527f2004-02-12 00:47:09 +0000182
183 /* enable watchdog, set timeout to 0 and wait */
Alison Wang95bed1f2012-03-26 21:49:04 +0000184 out_be16(&wdp->wdog_wrrr, 1);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500185 while (1) ;
wdenke65527f2004-02-12 00:47:09 +0000186
187 /* we don't return! */
188 return 0;
189};
190
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200191#if defined(CONFIG_DISPLAY_CPUINFO)
192int print_cpuinfo(void)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500193{
Alison Wang95bed1f2012-03-26 21:49:04 +0000194 sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG);
wdenke65527f2004-02-12 00:47:09 +0000195 uchar msk;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500196 char *suf;
wdenke65527f2004-02-12 00:47:09 +0000197
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500198 puts("CPU: ");
Alison Wang95bed1f2012-03-26 21:49:04 +0000199 msk = (in_be32(&sysctrl->sc_dir) > 28) & 0xf;
wdenke65527f2004-02-12 00:47:09 +0000200 switch (msk) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500201 case 0x2:
202 suf = "1K75N";
203 break;
204 case 0x4:
205 suf = "3K75N";
206 break;
207 default:
208 suf = NULL;
209 printf("Freescale MCF5272 (Mask:%01x)\n", msk);
210 break;
211 }
wdenke65527f2004-02-12 00:47:09 +0000212
213 if (suf)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500214 printf("Freescale MCF5272 %s\n", suf);
wdenke65527f2004-02-12 00:47:09 +0000215 return 0;
216};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200217#endif /* CONFIG_DISPLAY_CPUINFO */
wdenke65527f2004-02-12 00:47:09 +0000218
wdenke65527f2004-02-12 00:47:09 +0000219#if defined(CONFIG_WATCHDOG)
220/* Called by macro WATCHDOG_RESET */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500221void watchdog_reset(void)
wdenke65527f2004-02-12 00:47:09 +0000222{
Alison Wang95bed1f2012-03-26 21:49:04 +0000223 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
224
225 out_be16(&wdt->wdog_wcr, 0);
wdenke65527f2004-02-12 00:47:09 +0000226}
227
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500228int watchdog_disable(void)
wdenke65527f2004-02-12 00:47:09 +0000229{
Alison Wang95bed1f2012-03-26 21:49:04 +0000230 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000231
Alison Wang95bed1f2012-03-26 21:49:04 +0000232 /* reset watchdog counter */
233 out_be16(&wdt->wdog_wcr, 0);
234 /* disable watchdog interrupt */
235 out_be16(&wdt->wdog_wirr, 0);
236 /* disable watchdog timer */
237 out_be16(&wdt->wdog_wrrr, 0);
wdenke65527f2004-02-12 00:47:09 +0000238
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500239 puts("WATCHDOG:disabled\n");
wdenke65527f2004-02-12 00:47:09 +0000240 return (0);
241}
242
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500243int watchdog_init(void)
wdenke65527f2004-02-12 00:47:09 +0000244{
Alison Wang95bed1f2012-03-26 21:49:04 +0000245 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000246
Alison Wang95bed1f2012-03-26 21:49:04 +0000247 /* disable watchdog interrupt */
248 out_be16(&wdt->wdog_wirr, 0);
wdenke65527f2004-02-12 00:47:09 +0000249
250 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +0000251 out_be16(&wdt->wdog_wrrr,
252 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
253
254 /* reset watchdog counter */
255 out_be16(&wdt->wdog_wcr, 0);
wdenke65527f2004-02-12 00:47:09 +0000256
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500257 puts("WATCHDOG:enabled\n");
wdenke65527f2004-02-12 00:47:09 +0000258 return (0);
259}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500260#endif /* #ifdef CONFIG_WATCHDOG */
wdenke65527f2004-02-12 00:47:09 +0000261
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500262#endif /* #ifdef CONFIG_M5272 */
wdenke65527f2004-02-12 00:47:09 +0000263
Matthew Fettke761e2e92008-02-04 15:38:20 -0600264#ifdef CONFIG_M5275
Mike Frysinger6d1f6982010-10-20 03:41:17 -0400265int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Matthew Fettke761e2e92008-02-04 15:38:20 -0600266{
Alison Wang95bed1f2012-03-26 21:49:04 +0000267 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600268
269 udelay(1000);
270
Alison Wang95bed1f2012-03-26 21:49:04 +0000271 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600272
273 /* we don't return! */
274 return 0;
275};
276
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200277#if defined(CONFIG_DISPLAY_CPUINFO)
278int print_cpuinfo(void)
Matthew Fettke761e2e92008-02-04 15:38:20 -0600279{
280 char buf[32];
281
282 printf("CPU: Freescale Coldfire MCF5275 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200283 strmhz(buf, CONFIG_SYS_CLK));
Matthew Fettke761e2e92008-02-04 15:38:20 -0600284 return 0;
285};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200286#endif /* CONFIG_DISPLAY_CPUINFO */
Matthew Fettke761e2e92008-02-04 15:38:20 -0600287
288#if defined(CONFIG_WATCHDOG)
289/* Called by macro WATCHDOG_RESET */
290void watchdog_reset(void)
291{
Alison Wang95bed1f2012-03-26 21:49:04 +0000292 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
293
294 out_be16(&wdt->wsr, 0x5555);
295 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600296}
297
298int watchdog_disable(void)
299{
Alison Wang95bed1f2012-03-26 21:49:04 +0000300 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600301
Alison Wang95bed1f2012-03-26 21:49:04 +0000302 /* reset watchdog counter */
303 out_be16(&wdt->wsr, 0x5555);
304 out_be16(&wdt->wsr, 0xaaaa);
305
306 /* disable watchdog timer */
307 out_be16(&wdt->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600308
309 puts("WATCHDOG:disabled\n");
310 return (0);
311}
312
313int watchdog_init(void)
314{
Alison Wang95bed1f2012-03-26 21:49:04 +0000315 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600316
Alison Wang95bed1f2012-03-26 21:49:04 +0000317 /* disable watchdog */
318 out_be16(&wdt->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600319
320 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +0000321 out_be16(&wdt->wmr,
322 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
323
324 /* reset watchdog counter */
325 out_be16(&wdt->wsr, 0x5555);
326 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600327
328 puts("WATCHDOG:enabled\n");
329 return (0);
330}
331#endif /* #ifdef CONFIG_WATCHDOG */
332
333#endif /* #ifdef CONFIG_M5275 */
334
wdenke65527f2004-02-12 00:47:09 +0000335#ifdef CONFIG_M5282
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200336#if defined(CONFIG_DISPLAY_CPUINFO)
337int print_cpuinfo(void)
wdenke65527f2004-02-12 00:47:09 +0000338{
Wolfgang Denkb4b1c462006-06-10 19:27:47 +0200339 unsigned char resetsource = MCFRESET_RSR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200340
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500341 printf("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
342 MCFCCM_CIR >> 8, MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
343 printf("Reset:%s%s%s%s%s%s%s\n",
344 (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "",
345 (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "",
346 (resetsource & MCFRESET_RSR_EXT) ? " External" : "",
347 (resetsource & MCFRESET_RSR_POR) ? " Power On" : "",
348 (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "",
349 (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "",
350 (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : "");
wdenke65527f2004-02-12 00:47:09 +0000351 return 0;
352}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200353#endif /* CONFIG_DISPLAY_CPUINFO */
wdenke65527f2004-02-12 00:47:09 +0000354
Mike Frysinger6d1f6982010-10-20 03:41:17 -0400355int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Heiko Schocherac1956e2006-04-20 08:42:42 +0200356{
357 MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
wdenke65527f2004-02-12 00:47:09 +0000358 return 0;
359};
360#endif
stroese53395a22004-12-16 18:09:49 +0000361
TsiChungLiew34674692007-08-16 13:20:50 -0500362#ifdef CONFIG_M5249
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200363#if defined(CONFIG_DISPLAY_CPUINFO)
364int print_cpuinfo(void)
stroese53395a22004-12-16 18:09:49 +0000365{
366 char buf[32];
367
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500368 printf("CPU: Freescale Coldfire MCF5249 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200369 strmhz(buf, CONFIG_SYS_CLK));
stroese53395a22004-12-16 18:09:49 +0000370 return 0;
371}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200372#endif /* CONFIG_DISPLAY_CPUINFO */
stroese53395a22004-12-16 18:09:49 +0000373
Mike Frysinger6d1f6982010-10-20 03:41:17 -0400374int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500375{
stroese53395a22004-12-16 18:09:49 +0000376 /* enable watchdog, set timeout to 0 and wait */
377 mbar_writeByte(MCFSIM_SYPCR, 0xc0);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500378 while (1) ;
stroese53395a22004-12-16 18:09:49 +0000379
380 /* we don't return! */
381 return 0;
382};
383#endif
TsiChungLiew34674692007-08-16 13:20:50 -0500384
385#ifdef CONFIG_M5253
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200386#if defined(CONFIG_DISPLAY_CPUINFO)
387int print_cpuinfo(void)
TsiChungLiew34674692007-08-16 13:20:50 -0500388{
389 char buf[32];
390
391 unsigned char resetsource = mbar_readLong(SIM_RSR);
392 printf("CPU: Freescale Coldfire MCF5253 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200393 strmhz(buf, CONFIG_SYS_CLK));
TsiChungLiew34674692007-08-16 13:20:50 -0500394
395 if ((resetsource & SIM_RSR_HRST) || (resetsource & SIM_RSR_SWTR)) {
396 printf("Reset:%s%s\n",
397 (resetsource & SIM_RSR_HRST) ? " Hardware/ System Reset"
398 : "",
399 (resetsource & SIM_RSR_SWTR) ? " Software Watchdog" :
400 "");
401 }
402 return 0;
403}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200404#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChungLiew34674692007-08-16 13:20:50 -0500405
Mike Frysinger6d1f6982010-10-20 03:41:17 -0400406int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChungLiew34674692007-08-16 13:20:50 -0500407{
408 /* enable watchdog, set timeout to 0 and wait */
409 mbar_writeByte(SIM_SYPCR, 0xc0);
410 while (1) ;
411
412 /* we don't return! */
413 return 0;
414};
415#endif
Ben Warren90c96db2008-08-26 22:16:25 -0700416
417#if defined(CONFIG_MCFFEC)
418/* Default initializations for MCFFEC controllers. To override,
419 * create a board-specific function called:
420 * int board_eth_init(bd_t *bis)
421 */
422
Ben Warren90c96db2008-08-26 22:16:25 -0700423int cpu_eth_init(bd_t *bis)
424{
425 return mcffec_initialize(bis);
426}
427#endif