blob: 8c91e0e193b4cd16b4f147bf3a9eb44bb0245d75 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenkbf9e3b32004-02-12 00:47:09 +00002/*
3 * (C) Copyright 2003
4 * Josef Baumgartner <josef.baumgartner@telex.de>
5 *
Heiko Schocher9acb6262006-04-20 08:42:42 +02006 * MCF5282 additionals
7 * (C) Copyright 2005
8 * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
9 *
Matthew Fettkef71d9d92008-02-04 15:38:20 -060010 * MCF5275 additions
11 * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.com)
12 *
Alison Wang32dbaaf2012-03-26 21:49:04 +000013 * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
wdenkbf9e3b32004-02-12 00:47:09 +000014 */
15
16#include <common.h>
Simon Glass691d7192020-05-10 11:40:02 -060017#include <init.h>
Simon Glass90526e92020-05-10 11:39:56 -060018#include <net.h>
Simon Glass2189d5f2019-11-14 12:57:20 -070019#include <vsprintf.h>
wdenkbf9e3b32004-02-12 00:47:09 +000020#include <watchdog.h>
21#include <command.h>
TsiChungLiew83ec20b2007-08-15 19:21:21 -050022#include <asm/immap.h>
Alison Wang32dbaaf2012-03-26 21:49:04 +000023#include <asm/io.h>
Ben Warren89973f82008-08-31 22:22:04 -070024#include <netdev.h>
Richard Retanubunbb907ab2009-10-26 14:19:17 -040025#include "cpu.h"
wdenkbf9e3b32004-02-12 00:47:09 +000026
TsiChung Liewbf9a5212009-06-12 11:29:00 +000027DECLARE_GLOBAL_DATA_PTR;
28
29#ifdef CONFIG_M5208
Simon Glass09140112020-05-10 11:40:03 -060030int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChung Liewbf9a5212009-06-12 11:29:00 +000031{
Alison Wang32dbaaf2012-03-26 21:49:04 +000032 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000033
34 udelay(1000);
35
Alison Wang32dbaaf2012-03-26 21:49:04 +000036 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000037
38 /* we don't return! */
39 return 0;
40};
41
Angelo Dureghellob9153fe32017-08-20 00:01:55 +020042#if defined(CONFIG_DISPLAY_CPUINFO)
43int print_cpuinfo(void)
TsiChung Liewbf9a5212009-06-12 11:29:00 +000044{
45 char buf1[32], buf2[32];
46
47 printf("CPU: Freescale Coldfire MCF5208\n"
48 " CPU CLK %s MHz BUS CLK %s MHz\n",
49 strmhz(buf1, gd->cpu_clk),
50 strmhz(buf2, gd->bus_clk));
51 return 0;
52};
Angelo Dureghellob9153fe32017-08-20 00:01:55 +020053#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChung Liewbf9a5212009-06-12 11:29:00 +000054
55#if defined(CONFIG_WATCHDOG)
56/* Called by macro WATCHDOG_RESET */
57void watchdog_reset(void)
58{
Alison Wang32dbaaf2012-03-26 21:49:04 +000059 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
60
61 out_be16(&wdt->sr, 0x5555);
62 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000063}
64
65int watchdog_disable(void)
66{
Alison Wang32dbaaf2012-03-26 21:49:04 +000067 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000068
Alison Wang32dbaaf2012-03-26 21:49:04 +000069 /* reset watchdog counter */
70 out_be16(&wdt->sr, 0x5555);
71 out_be16(&wdt->sr, 0xaaaa);
72 /* disable watchdog timer */
73 out_be16(&wdt->cr, 0);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000074
75 puts("WATCHDOG:disabled\n");
76 return (0);
77}
78
79int watchdog_init(void)
80{
Alison Wang32dbaaf2012-03-26 21:49:04 +000081 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000082
Alison Wang32dbaaf2012-03-26 21:49:04 +000083 /* disable watchdog */
84 out_be16(&wdt->cr, 0);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000085
86 /* set timeout and enable watchdog */
Alison Wang32dbaaf2012-03-26 21:49:04 +000087 out_be16(&wdt->mr,
88 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
89
90 /* reset watchdog counter */
91 out_be16(&wdt->sr, 0x5555);
92 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000093
94 puts("WATCHDOG:enabled\n");
95 return (0);
96}
97#endif /* #ifdef CONFIG_WATCHDOG */
98#endif /* #ifdef CONFIG_M5208 */
99
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500100#ifdef CONFIG_M5271
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200101#if defined(CONFIG_DISPLAY_CPUINFO)
Bartlomiej Sieka363d1d82007-01-23 13:25:22 +0100102/*
103 * Both MCF5270 and MCF5271 are members of the MPC5271 family. Try to
104 * determine which one we are running on, based on the Chip Identification
105 * Register (CIR).
106 */
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200107int print_cpuinfo(void)
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500108{
Marian Balakowiczb75ef852006-05-09 11:45:31 +0200109 char buf[32];
Bartlomiej Sieka363d1d82007-01-23 13:25:22 +0100110 unsigned short cir; /* Chip Identification Register */
111 unsigned short pin; /* Part identification number */
112 unsigned char prn; /* Part revision number */
113 char *cpu_model;
Marian Balakowiczb75ef852006-05-09 11:45:31 +0200114
Bartlomiej Sieka363d1d82007-01-23 13:25:22 +0100115 cir = mbar_readShort(MCF_CCM_CIR);
116 pin = cir >> MCF_CCM_CIR_PIN_LEN;
117 prn = cir & MCF_CCM_CIR_PRN_MASK;
118
119 switch (pin) {
120 case MCF_CCM_CIR_PIN_MCF5270:
121 cpu_model = "5270";
122 break;
123 case MCF_CCM_CIR_PIN_MCF5271:
124 cpu_model = "5271";
125 break;
126 default:
127 cpu_model = NULL;
128 break;
129 }
130
131 if (cpu_model)
132 printf("CPU: Freescale ColdFire MCF%s rev. %hu, at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200133 cpu_model, prn, strmhz(buf, CONFIG_SYS_CLK));
Bartlomiej Sieka363d1d82007-01-23 13:25:22 +0100134 else
135 printf("CPU: Unknown - Freescale ColdFire MCF5271 family"
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500136 " (PIN: 0x%x) rev. %hu, at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200137 pin, prn, strmhz(buf, CONFIG_SYS_CLK));
Bartlomiej Sieka363d1d82007-01-23 13:25:22 +0100138
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500139 return 0;
140}
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200141#endif /* CONFIG_DISPLAY_CPUINFO */
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500142
Simon Glass09140112020-05-10 11:40:03 -0600143int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500144{
Richard Retanubunbb907ab2009-10-26 14:19:17 -0400145 /* Call the board specific reset actions first. */
146 if(board_reset) {
147 board_reset();
148 }
149
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500150 mbar_writeByte(MCF_RCM_RCR,
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500151 MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500152 return 0;
153};
154
155#if defined(CONFIG_WATCHDOG)
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500156void watchdog_reset(void)
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500157{
158 mbar_writeShort(MCF_WTM_WSR, 0x5555);
159 mbar_writeShort(MCF_WTM_WSR, 0xAAAA);
160}
161
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500162int watchdog_disable(void)
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500163{
164 mbar_writeShort(MCF_WTM_WCR, 0);
165 return (0);
166}
167
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500168int watchdog_init(void)
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500169{
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500170 mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN);
171 return (0);
172}
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500173#endif /* #ifdef CONFIG_WATCHDOG */
Zachary P. Landaueacbd312006-01-26 17:35:56 -0500174
175#endif
wdenkbf9e3b32004-02-12 00:47:09 +0000176
177#ifdef CONFIG_M5272
Simon Glass09140112020-05-10 11:40:03 -0600178int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500179{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000180 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
wdenkbf9e3b32004-02-12 00:47:09 +0000181
Alison Wang32dbaaf2012-03-26 21:49:04 +0000182 out_be16(&wdp->wdog_wrrr, 0);
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500183 udelay(1000);
wdenkbf9e3b32004-02-12 00:47:09 +0000184
185 /* enable watchdog, set timeout to 0 and wait */
Alison Wang32dbaaf2012-03-26 21:49:04 +0000186 out_be16(&wdp->wdog_wrrr, 1);
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500187 while (1) ;
wdenkbf9e3b32004-02-12 00:47:09 +0000188
189 /* we don't return! */
190 return 0;
191};
192
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200193#if defined(CONFIG_DISPLAY_CPUINFO)
194int print_cpuinfo(void)
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500195{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000196 sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG);
wdenkbf9e3b32004-02-12 00:47:09 +0000197 uchar msk;
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500198 char *suf;
wdenkbf9e3b32004-02-12 00:47:09 +0000199
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500200 puts("CPU: ");
Alison Wang32dbaaf2012-03-26 21:49:04 +0000201 msk = (in_be32(&sysctrl->sc_dir) > 28) & 0xf;
wdenkbf9e3b32004-02-12 00:47:09 +0000202 switch (msk) {
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500203 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 }
wdenkbf9e3b32004-02-12 00:47:09 +0000214
215 if (suf)
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500216 printf("Freescale MCF5272 %s\n", suf);
wdenkbf9e3b32004-02-12 00:47:09 +0000217 return 0;
218};
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200219#endif /* CONFIG_DISPLAY_CPUINFO */
wdenkbf9e3b32004-02-12 00:47:09 +0000220
wdenkbf9e3b32004-02-12 00:47:09 +0000221#if defined(CONFIG_WATCHDOG)
222/* Called by macro WATCHDOG_RESET */
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500223void watchdog_reset(void)
wdenkbf9e3b32004-02-12 00:47:09 +0000224{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000225 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
226
227 out_be16(&wdt->wdog_wcr, 0);
wdenkbf9e3b32004-02-12 00:47:09 +0000228}
229
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500230int watchdog_disable(void)
wdenkbf9e3b32004-02-12 00:47:09 +0000231{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000232 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenkbf9e3b32004-02-12 00:47:09 +0000233
Alison Wang32dbaaf2012-03-26 21:49:04 +0000234 /* reset watchdog counter */
235 out_be16(&wdt->wdog_wcr, 0);
236 /* disable watchdog interrupt */
237 out_be16(&wdt->wdog_wirr, 0);
238 /* disable watchdog timer */
239 out_be16(&wdt->wdog_wrrr, 0);
wdenkbf9e3b32004-02-12 00:47:09 +0000240
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500241 puts("WATCHDOG:disabled\n");
wdenkbf9e3b32004-02-12 00:47:09 +0000242 return (0);
243}
244
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500245int watchdog_init(void)
wdenkbf9e3b32004-02-12 00:47:09 +0000246{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000247 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenkbf9e3b32004-02-12 00:47:09 +0000248
Alison Wang32dbaaf2012-03-26 21:49:04 +0000249 /* disable watchdog interrupt */
250 out_be16(&wdt->wdog_wirr, 0);
wdenkbf9e3b32004-02-12 00:47:09 +0000251
252 /* set timeout and enable watchdog */
Alison Wang32dbaaf2012-03-26 21:49:04 +0000253 out_be16(&wdt->wdog_wrrr,
254 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
255
256 /* reset watchdog counter */
257 out_be16(&wdt->wdog_wcr, 0);
wdenkbf9e3b32004-02-12 00:47:09 +0000258
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500259 puts("WATCHDOG:enabled\n");
wdenkbf9e3b32004-02-12 00:47:09 +0000260 return (0);
261}
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500262#endif /* #ifdef CONFIG_WATCHDOG */
wdenkbf9e3b32004-02-12 00:47:09 +0000263
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500264#endif /* #ifdef CONFIG_M5272 */
wdenkbf9e3b32004-02-12 00:47:09 +0000265
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600266#ifdef CONFIG_M5275
Simon Glass09140112020-05-10 11:40:03 -0600267int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600268{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000269 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600270
271 udelay(1000);
272
Alison Wang32dbaaf2012-03-26 21:49:04 +0000273 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600274
275 /* we don't return! */
276 return 0;
277};
278
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200279#if defined(CONFIG_DISPLAY_CPUINFO)
280int print_cpuinfo(void)
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600281{
282 char buf[32];
283
284 printf("CPU: Freescale Coldfire MCF5275 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200285 strmhz(buf, CONFIG_SYS_CLK));
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600286 return 0;
287};
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200288#endif /* CONFIG_DISPLAY_CPUINFO */
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600289
290#if defined(CONFIG_WATCHDOG)
291/* Called by macro WATCHDOG_RESET */
292void watchdog_reset(void)
293{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000294 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
295
296 out_be16(&wdt->wsr, 0x5555);
297 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600298}
299
300int watchdog_disable(void)
301{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000302 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600303
Alison Wang32dbaaf2012-03-26 21:49:04 +0000304 /* reset watchdog counter */
305 out_be16(&wdt->wsr, 0x5555);
306 out_be16(&wdt->wsr, 0xaaaa);
307
308 /* disable watchdog timer */
309 out_be16(&wdt->wcr, 0);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600310
311 puts("WATCHDOG:disabled\n");
312 return (0);
313}
314
315int watchdog_init(void)
316{
Alison Wang32dbaaf2012-03-26 21:49:04 +0000317 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600318
Alison Wang32dbaaf2012-03-26 21:49:04 +0000319 /* disable watchdog */
320 out_be16(&wdt->wcr, 0);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600321
322 /* set timeout and enable watchdog */
Alison Wang32dbaaf2012-03-26 21:49:04 +0000323 out_be16(&wdt->wmr,
324 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
325
326 /* reset watchdog counter */
327 out_be16(&wdt->wsr, 0x5555);
328 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettkef71d9d92008-02-04 15:38:20 -0600329
330 puts("WATCHDOG:enabled\n");
331 return (0);
332}
333#endif /* #ifdef CONFIG_WATCHDOG */
334
335#endif /* #ifdef CONFIG_M5275 */
336
wdenkbf9e3b32004-02-12 00:47:09 +0000337#ifdef CONFIG_M5282
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200338#if defined(CONFIG_DISPLAY_CPUINFO)
339int print_cpuinfo(void)
wdenkbf9e3b32004-02-12 00:47:09 +0000340{
Wolfgang Denk4176c792006-06-10 19:27:47 +0200341 unsigned char resetsource = MCFRESET_RSR;
Heiko Schocher9acb6262006-04-20 08:42:42 +0200342
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500343 printf("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
344 MCFCCM_CIR >> 8, MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
345 printf("Reset:%s%s%s%s%s%s%s\n",
346 (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "",
347 (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "",
348 (resetsource & MCFRESET_RSR_EXT) ? " External" : "",
349 (resetsource & MCFRESET_RSR_POR) ? " Power On" : "",
350 (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "",
351 (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "",
352 (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : "");
wdenkbf9e3b32004-02-12 00:47:09 +0000353 return 0;
354}
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200355#endif /* CONFIG_DISPLAY_CPUINFO */
wdenkbf9e3b32004-02-12 00:47:09 +0000356
Simon Glass09140112020-05-10 11:40:03 -0600357int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Heiko Schocher9acb6262006-04-20 08:42:42 +0200358{
359 MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
wdenkbf9e3b32004-02-12 00:47:09 +0000360 return 0;
361};
362#endif
stroese8c725b92004-12-16 18:09:49 +0000363
TsiChungLiewa1436a82007-08-16 13:20:50 -0500364#ifdef CONFIG_M5249
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200365#if defined(CONFIG_DISPLAY_CPUINFO)
366int print_cpuinfo(void)
stroese8c725b92004-12-16 18:09:49 +0000367{
368 char buf[32];
369
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500370 printf("CPU: Freescale Coldfire MCF5249 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200371 strmhz(buf, CONFIG_SYS_CLK));
stroese8c725b92004-12-16 18:09:49 +0000372 return 0;
373}
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200374#endif /* CONFIG_DISPLAY_CPUINFO */
stroese8c725b92004-12-16 18:09:49 +0000375
Simon Glass09140112020-05-10 11:40:03 -0600376int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500377{
stroese8c725b92004-12-16 18:09:49 +0000378 /* enable watchdog, set timeout to 0 and wait */
379 mbar_writeByte(MCFSIM_SYPCR, 0xc0);
TsiChungLiew83ec20b2007-08-15 19:21:21 -0500380 while (1) ;
stroese8c725b92004-12-16 18:09:49 +0000381
382 /* we don't return! */
383 return 0;
384};
385#endif
TsiChungLiewa1436a82007-08-16 13:20:50 -0500386
387#ifdef CONFIG_M5253
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200388#if defined(CONFIG_DISPLAY_CPUINFO)
389int print_cpuinfo(void)
TsiChungLiewa1436a82007-08-16 13:20:50 -0500390{
391 char buf[32];
392
393 unsigned char resetsource = mbar_readLong(SIM_RSR);
394 printf("CPU: Freescale Coldfire MCF5253 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200395 strmhz(buf, CONFIG_SYS_CLK));
TsiChungLiewa1436a82007-08-16 13:20:50 -0500396
397 if ((resetsource & SIM_RSR_HRST) || (resetsource & SIM_RSR_SWTR)) {
398 printf("Reset:%s%s\n",
399 (resetsource & SIM_RSR_HRST) ? " Hardware/ System Reset"
400 : "",
401 (resetsource & SIM_RSR_SWTR) ? " Software Watchdog" :
402 "");
403 }
404 return 0;
405}
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200406#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChungLiewa1436a82007-08-16 13:20:50 -0500407
Simon Glass09140112020-05-10 11:40:03 -0600408int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiewa1436a82007-08-16 13:20:50 -0500409{
410 /* enable watchdog, set timeout to 0 and wait */
411 mbar_writeByte(SIM_SYPCR, 0xc0);
412 while (1) ;
413
414 /* we don't return! */
415 return 0;
416};
417#endif
Ben Warren86882b82008-08-26 22:16:25 -0700418
419#if defined(CONFIG_MCFFEC)
420/* Default initializations for MCFFEC controllers. To override,
421 * create a board-specific function called:
422 * int board_eth_init(bd_t *bis)
423 */
424
Ben Warren86882b82008-08-26 22:16:25 -0700425int cpu_eth_init(bd_t *bis)
426{
427 return mcffec_initialize(bis);
428}
429#endif