blob: d3d4e30ad552508be6634531ce34480846b97f8c [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 Glass97589732020-05-10 11:40:02 -060017#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060018#include <net.h>
Simon Glassf5c208d2019-11-14 12:57:20 -070019#include <vsprintf.h>
wdenke65527f2004-02-12 00:47:09 +000020#include <watchdog.h>
21#include <command.h>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050022#include <asm/immap.h>
Alison Wang95bed1f2012-03-26 21:49:04 +000023#include <asm/io.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070024#include <netdev.h>
Simon Glassdbd79542020-05-10 11:40:11 -060025#include <linux/delay.h>
Richard Retanubun5ffa65b2009-10-26 14:19:17 -040026#include "cpu.h"
wdenke65527f2004-02-12 00:47:09 +000027
TsiChung Liewb354aef2009-06-12 11:29:00 +000028DECLARE_GLOBAL_DATA_PTR;
29
30#ifdef CONFIG_M5208
Simon Glassed38aef2020-05-10 11:40:03 -060031int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChung Liewb354aef2009-06-12 11:29:00 +000032{
Alison Wang95bed1f2012-03-26 21:49:04 +000033 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
TsiChung Liewb354aef2009-06-12 11:29:00 +000034
35 udelay(1000);
36
Alison Wang95bed1f2012-03-26 21:49:04 +000037 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChung Liewb354aef2009-06-12 11:29:00 +000038
39 /* we don't return! */
40 return 0;
41};
42
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020043#if defined(CONFIG_DISPLAY_CPUINFO)
44int print_cpuinfo(void)
TsiChung Liewb354aef2009-06-12 11:29:00 +000045{
46 char buf1[32], buf2[32];
47
48 printf("CPU: Freescale Coldfire MCF5208\n"
49 " CPU CLK %s MHz BUS CLK %s MHz\n",
50 strmhz(buf1, gd->cpu_clk),
51 strmhz(buf2, gd->bus_clk));
52 return 0;
53};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020054#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChung Liewb354aef2009-06-12 11:29:00 +000055
56#if defined(CONFIG_WATCHDOG)
57/* Called by macro WATCHDOG_RESET */
58void watchdog_reset(void)
59{
Alison Wang95bed1f2012-03-26 21:49:04 +000060 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
61
62 out_be16(&wdt->sr, 0x5555);
63 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewb354aef2009-06-12 11:29:00 +000064}
65
66int watchdog_disable(void)
67{
Alison Wang95bed1f2012-03-26 21:49:04 +000068 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewb354aef2009-06-12 11:29:00 +000069
Alison Wang95bed1f2012-03-26 21:49:04 +000070 /* reset watchdog counter */
71 out_be16(&wdt->sr, 0x5555);
72 out_be16(&wdt->sr, 0xaaaa);
73 /* disable watchdog timer */
74 out_be16(&wdt->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +000075
76 puts("WATCHDOG:disabled\n");
77 return (0);
78}
79
80int watchdog_init(void)
81{
Alison Wang95bed1f2012-03-26 21:49:04 +000082 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewb354aef2009-06-12 11:29:00 +000083
Alison Wang95bed1f2012-03-26 21:49:04 +000084 /* disable watchdog */
85 out_be16(&wdt->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +000086
87 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +000088 out_be16(&wdt->mr,
89 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
90
91 /* reset watchdog counter */
92 out_be16(&wdt->sr, 0x5555);
93 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewb354aef2009-06-12 11:29:00 +000094
95 puts("WATCHDOG:enabled\n");
96 return (0);
97}
98#endif /* #ifdef CONFIG_WATCHDOG */
99#endif /* #ifdef CONFIG_M5208 */
100
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500101#ifdef CONFIG_M5271
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200102#if defined(CONFIG_DISPLAY_CPUINFO)
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100103/*
104 * Both MCF5270 and MCF5271 are members of the MPC5271 family. Try to
105 * determine which one we are running on, based on the Chip Identification
106 * Register (CIR).
107 */
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200108int print_cpuinfo(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500109{
Marian Balakowiczecb6d0b2006-05-09 11:45:31 +0200110 char buf[32];
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100111 unsigned short cir; /* Chip Identification Register */
112 unsigned short pin; /* Part identification number */
113 unsigned char prn; /* Part revision number */
114 char *cpu_model;
115
116 cir = mbar_readShort(MCF_CCM_CIR);
117 pin = cir >> MCF_CCM_CIR_PIN_LEN;
118 prn = cir & MCF_CCM_CIR_PRN_MASK;
119
120 switch (pin) {
121 case MCF_CCM_CIR_PIN_MCF5270:
122 cpu_model = "5270";
123 break;
124 case MCF_CCM_CIR_PIN_MCF5271:
125 cpu_model = "5271";
126 break;
127 default:
128 cpu_model = NULL;
129 break;
130 }
131
132 if (cpu_model)
133 printf("CPU: Freescale ColdFire MCF%s rev. %hu, at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200134 cpu_model, prn, strmhz(buf, CONFIG_SYS_CLK));
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100135 else
136 printf("CPU: Unknown - Freescale ColdFire MCF5271 family"
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500137 " (PIN: 0x%x) rev. %hu, at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200138 pin, prn, strmhz(buf, CONFIG_SYS_CLK));
Marian Balakowiczecb6d0b2006-05-09 11:45:31 +0200139
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500140 return 0;
141}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200142#endif /* CONFIG_DISPLAY_CPUINFO */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500143
Simon Glassed38aef2020-05-10 11:40:03 -0600144int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500145{
Richard Retanubun5ffa65b2009-10-26 14:19:17 -0400146 /* Call the board specific reset actions first. */
147 if(board_reset) {
148 board_reset();
149 }
150
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500151 mbar_writeByte(MCF_RCM_RCR,
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500152 MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500153 return 0;
154};
155
156#if defined(CONFIG_WATCHDOG)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500157void watchdog_reset(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500158{
159 mbar_writeShort(MCF_WTM_WSR, 0x5555);
160 mbar_writeShort(MCF_WTM_WSR, 0xAAAA);
161}
162
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500163int watchdog_disable(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500164{
165 mbar_writeShort(MCF_WTM_WCR, 0);
166 return (0);
167}
168
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500169int watchdog_init(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500170{
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500171 mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN);
172 return (0);
173}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500174#endif /* #ifdef CONFIG_WATCHDOG */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500175
176#endif
wdenke65527f2004-02-12 00:47:09 +0000177
178#ifdef CONFIG_M5272
Simon Glassed38aef2020-05-10 11:40:03 -0600179int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500180{
Alison Wang95bed1f2012-03-26 21:49:04 +0000181 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000182
Alison Wang95bed1f2012-03-26 21:49:04 +0000183 out_be16(&wdp->wdog_wrrr, 0);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500184 udelay(1000);
wdenke65527f2004-02-12 00:47:09 +0000185
186 /* enable watchdog, set timeout to 0 and wait */
Alison Wang95bed1f2012-03-26 21:49:04 +0000187 out_be16(&wdp->wdog_wrrr, 1);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500188 while (1) ;
wdenke65527f2004-02-12 00:47:09 +0000189
190 /* we don't return! */
191 return 0;
192};
193
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200194#if defined(CONFIG_DISPLAY_CPUINFO)
195int print_cpuinfo(void)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500196{
Alison Wang95bed1f2012-03-26 21:49:04 +0000197 sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG);
wdenke65527f2004-02-12 00:47:09 +0000198 uchar msk;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500199 char *suf;
wdenke65527f2004-02-12 00:47:09 +0000200
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500201 puts("CPU: ");
Alison Wang95bed1f2012-03-26 21:49:04 +0000202 msk = (in_be32(&sysctrl->sc_dir) > 28) & 0xf;
wdenke65527f2004-02-12 00:47:09 +0000203 switch (msk) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500204 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 }
wdenke65527f2004-02-12 00:47:09 +0000215
216 if (suf)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500217 printf("Freescale MCF5272 %s\n", suf);
wdenke65527f2004-02-12 00:47:09 +0000218 return 0;
219};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200220#endif /* CONFIG_DISPLAY_CPUINFO */
wdenke65527f2004-02-12 00:47:09 +0000221
wdenke65527f2004-02-12 00:47:09 +0000222#if defined(CONFIG_WATCHDOG)
223/* Called by macro WATCHDOG_RESET */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500224void watchdog_reset(void)
wdenke65527f2004-02-12 00:47:09 +0000225{
Alison Wang95bed1f2012-03-26 21:49:04 +0000226 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
227
228 out_be16(&wdt->wdog_wcr, 0);
wdenke65527f2004-02-12 00:47:09 +0000229}
230
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500231int watchdog_disable(void)
wdenke65527f2004-02-12 00:47:09 +0000232{
Alison Wang95bed1f2012-03-26 21:49:04 +0000233 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000234
Alison Wang95bed1f2012-03-26 21:49:04 +0000235 /* reset watchdog counter */
236 out_be16(&wdt->wdog_wcr, 0);
237 /* disable watchdog interrupt */
238 out_be16(&wdt->wdog_wirr, 0);
239 /* disable watchdog timer */
240 out_be16(&wdt->wdog_wrrr, 0);
wdenke65527f2004-02-12 00:47:09 +0000241
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500242 puts("WATCHDOG:disabled\n");
wdenke65527f2004-02-12 00:47:09 +0000243 return (0);
244}
245
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500246int watchdog_init(void)
wdenke65527f2004-02-12 00:47:09 +0000247{
Alison Wang95bed1f2012-03-26 21:49:04 +0000248 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000249
Alison Wang95bed1f2012-03-26 21:49:04 +0000250 /* disable watchdog interrupt */
251 out_be16(&wdt->wdog_wirr, 0);
wdenke65527f2004-02-12 00:47:09 +0000252
253 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +0000254 out_be16(&wdt->wdog_wrrr,
255 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
256
257 /* reset watchdog counter */
258 out_be16(&wdt->wdog_wcr, 0);
wdenke65527f2004-02-12 00:47:09 +0000259
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500260 puts("WATCHDOG:enabled\n");
wdenke65527f2004-02-12 00:47:09 +0000261 return (0);
262}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500263#endif /* #ifdef CONFIG_WATCHDOG */
wdenke65527f2004-02-12 00:47:09 +0000264
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500265#endif /* #ifdef CONFIG_M5272 */
wdenke65527f2004-02-12 00:47:09 +0000266
Matthew Fettke761e2e92008-02-04 15:38:20 -0600267#ifdef CONFIG_M5275
Simon Glassed38aef2020-05-10 11:40:03 -0600268int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Matthew Fettke761e2e92008-02-04 15:38:20 -0600269{
Alison Wang95bed1f2012-03-26 21:49:04 +0000270 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600271
272 udelay(1000);
273
Alison Wang95bed1f2012-03-26 21:49:04 +0000274 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600275
276 /* we don't return! */
277 return 0;
278};
279
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200280#if defined(CONFIG_DISPLAY_CPUINFO)
281int print_cpuinfo(void)
Matthew Fettke761e2e92008-02-04 15:38:20 -0600282{
283 char buf[32];
284
285 printf("CPU: Freescale Coldfire MCF5275 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200286 strmhz(buf, CONFIG_SYS_CLK));
Matthew Fettke761e2e92008-02-04 15:38:20 -0600287 return 0;
288};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200289#endif /* CONFIG_DISPLAY_CPUINFO */
Matthew Fettke761e2e92008-02-04 15:38:20 -0600290
291#if defined(CONFIG_WATCHDOG)
292/* Called by macro WATCHDOG_RESET */
293void watchdog_reset(void)
294{
Alison Wang95bed1f2012-03-26 21:49:04 +0000295 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
296
297 out_be16(&wdt->wsr, 0x5555);
298 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600299}
300
301int watchdog_disable(void)
302{
Alison Wang95bed1f2012-03-26 21:49:04 +0000303 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600304
Alison Wang95bed1f2012-03-26 21:49:04 +0000305 /* reset watchdog counter */
306 out_be16(&wdt->wsr, 0x5555);
307 out_be16(&wdt->wsr, 0xaaaa);
308
309 /* disable watchdog timer */
310 out_be16(&wdt->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600311
312 puts("WATCHDOG:disabled\n");
313 return (0);
314}
315
316int watchdog_init(void)
317{
Alison Wang95bed1f2012-03-26 21:49:04 +0000318 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600319
Alison Wang95bed1f2012-03-26 21:49:04 +0000320 /* disable watchdog */
321 out_be16(&wdt->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600322
323 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +0000324 out_be16(&wdt->wmr,
325 (CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
326
327 /* reset watchdog counter */
328 out_be16(&wdt->wsr, 0x5555);
329 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600330
331 puts("WATCHDOG:enabled\n");
332 return (0);
333}
334#endif /* #ifdef CONFIG_WATCHDOG */
335
336#endif /* #ifdef CONFIG_M5275 */
337
wdenke65527f2004-02-12 00:47:09 +0000338#ifdef CONFIG_M5282
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200339#if defined(CONFIG_DISPLAY_CPUINFO)
340int print_cpuinfo(void)
wdenke65527f2004-02-12 00:47:09 +0000341{
Wolfgang Denkb4b1c462006-06-10 19:27:47 +0200342 unsigned char resetsource = MCFRESET_RSR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200343
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500344 printf("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
345 MCFCCM_CIR >> 8, MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
346 printf("Reset:%s%s%s%s%s%s%s\n",
347 (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "",
348 (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "",
349 (resetsource & MCFRESET_RSR_EXT) ? " External" : "",
350 (resetsource & MCFRESET_RSR_POR) ? " Power On" : "",
351 (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "",
352 (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "",
353 (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : "");
wdenke65527f2004-02-12 00:47:09 +0000354 return 0;
355}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200356#endif /* CONFIG_DISPLAY_CPUINFO */
wdenke65527f2004-02-12 00:47:09 +0000357
Simon Glassed38aef2020-05-10 11:40:03 -0600358int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Heiko Schocherac1956e2006-04-20 08:42:42 +0200359{
360 MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
wdenke65527f2004-02-12 00:47:09 +0000361 return 0;
362};
363#endif
stroese53395a22004-12-16 18:09:49 +0000364
TsiChungLiew34674692007-08-16 13:20:50 -0500365#ifdef CONFIG_M5249
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200366#if defined(CONFIG_DISPLAY_CPUINFO)
367int print_cpuinfo(void)
stroese53395a22004-12-16 18:09:49 +0000368{
369 char buf[32];
370
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500371 printf("CPU: Freescale Coldfire MCF5249 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200372 strmhz(buf, CONFIG_SYS_CLK));
stroese53395a22004-12-16 18:09:49 +0000373 return 0;
374}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200375#endif /* CONFIG_DISPLAY_CPUINFO */
stroese53395a22004-12-16 18:09:49 +0000376
Simon Glassed38aef2020-05-10 11:40:03 -0600377int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500378{
stroese53395a22004-12-16 18:09:49 +0000379 /* enable watchdog, set timeout to 0 and wait */
380 mbar_writeByte(MCFSIM_SYPCR, 0xc0);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500381 while (1) ;
stroese53395a22004-12-16 18:09:49 +0000382
383 /* we don't return! */
384 return 0;
385};
386#endif
TsiChungLiew34674692007-08-16 13:20:50 -0500387
388#ifdef CONFIG_M5253
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200389#if defined(CONFIG_DISPLAY_CPUINFO)
390int print_cpuinfo(void)
TsiChungLiew34674692007-08-16 13:20:50 -0500391{
392 char buf[32];
393
394 unsigned char resetsource = mbar_readLong(SIM_RSR);
395 printf("CPU: Freescale Coldfire MCF5253 at %s MHz\n",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200396 strmhz(buf, CONFIG_SYS_CLK));
TsiChungLiew34674692007-08-16 13:20:50 -0500397
398 if ((resetsource & SIM_RSR_HRST) || (resetsource & SIM_RSR_SWTR)) {
399 printf("Reset:%s%s\n",
400 (resetsource & SIM_RSR_HRST) ? " Hardware/ System Reset"
401 : "",
402 (resetsource & SIM_RSR_SWTR) ? " Software Watchdog" :
403 "");
404 }
405 return 0;
406}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200407#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChungLiew34674692007-08-16 13:20:50 -0500408
Simon Glassed38aef2020-05-10 11:40:03 -0600409int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew34674692007-08-16 13:20:50 -0500410{
411 /* enable watchdog, set timeout to 0 and wait */
412 mbar_writeByte(SIM_SYPCR, 0xc0);
413 while (1) ;
414
415 /* we don't return! */
416 return 0;
417};
418#endif
Ben Warren90c96db2008-08-26 22:16:25 -0700419
420#if defined(CONFIG_MCFFEC)
421/* Default initializations for MCFFEC controllers. To override,
422 * create a board-specific function called:
423 * int board_eth_init(bd_t *bis)
424 */
425
Ben Warren90c96db2008-08-26 22:16:25 -0700426int cpu_eth_init(bd_t *bis)
427{
428 return mcffec_initialize(bis);
429}
430#endif