blob: d7cbf11e255b7fa76e0ee173fac4ff970401ae96 [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>
Simon Glass3ba929a2020-10-30 21:38:53 -060022#include <asm/global_data.h>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050023#include <asm/immap.h>
Alison Wang95bed1f2012-03-26 21:49:04 +000024#include <asm/io.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070025#include <netdev.h>
Simon Glassdbd79542020-05-10 11:40:11 -060026#include <linux/delay.h>
Richard Retanubun5ffa65b2009-10-26 14:19:17 -040027#include "cpu.h"
wdenke65527f2004-02-12 00:47:09 +000028
TsiChung Liewb354aef2009-06-12 11:29:00 +000029DECLARE_GLOBAL_DATA_PTR;
30
31#ifdef CONFIG_M5208
Simon Glassed38aef2020-05-10 11:40:03 -060032int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChung Liewb354aef2009-06-12 11:29:00 +000033{
Alison Wang95bed1f2012-03-26 21:49:04 +000034 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
TsiChung Liewb354aef2009-06-12 11:29:00 +000035
36 udelay(1000);
37
Alison Wang95bed1f2012-03-26 21:49:04 +000038 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChung Liewb354aef2009-06-12 11:29:00 +000039
40 /* we don't return! */
41 return 0;
42};
43
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020044#if defined(CONFIG_DISPLAY_CPUINFO)
45int print_cpuinfo(void)
TsiChung Liewb354aef2009-06-12 11:29:00 +000046{
47 char buf1[32], buf2[32];
48
49 printf("CPU: Freescale Coldfire MCF5208\n"
50 " CPU CLK %s MHz BUS CLK %s MHz\n",
51 strmhz(buf1, gd->cpu_clk),
52 strmhz(buf2, gd->bus_clk));
53 return 0;
54};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020055#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChung Liewb354aef2009-06-12 11:29:00 +000056
57#if defined(CONFIG_WATCHDOG)
58/* Called by macro WATCHDOG_RESET */
59void watchdog_reset(void)
60{
Alison Wang95bed1f2012-03-26 21:49:04 +000061 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
62
63 out_be16(&wdt->sr, 0x5555);
64 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewb354aef2009-06-12 11:29:00 +000065}
66
67int watchdog_disable(void)
68{
Alison Wang95bed1f2012-03-26 21:49:04 +000069 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewb354aef2009-06-12 11:29:00 +000070
Alison Wang95bed1f2012-03-26 21:49:04 +000071 /* reset watchdog counter */
72 out_be16(&wdt->sr, 0x5555);
73 out_be16(&wdt->sr, 0xaaaa);
74 /* disable watchdog timer */
75 out_be16(&wdt->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +000076
77 puts("WATCHDOG:disabled\n");
78 return (0);
79}
80
81int watchdog_init(void)
82{
Alison Wang95bed1f2012-03-26 21:49:04 +000083 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
TsiChung Liewb354aef2009-06-12 11:29:00 +000084
Alison Wang95bed1f2012-03-26 21:49:04 +000085 /* disable watchdog */
86 out_be16(&wdt->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +000087
88 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +000089 out_be16(&wdt->mr,
Tom Rini9e7eeec2022-11-19 18:45:45 -050090 (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
Alison Wang95bed1f2012-03-26 21:49:04 +000091
92 /* reset watchdog counter */
93 out_be16(&wdt->sr, 0x5555);
94 out_be16(&wdt->sr, 0xaaaa);
TsiChung Liewb354aef2009-06-12 11:29:00 +000095
96 puts("WATCHDOG:enabled\n");
97 return (0);
98}
99#endif /* #ifdef CONFIG_WATCHDOG */
100#endif /* #ifdef CONFIG_M5208 */
101
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500102#ifdef CONFIG_M5271
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200103#if defined(CONFIG_DISPLAY_CPUINFO)
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100104/*
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 */
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200109int print_cpuinfo(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500110{
Marian Balakowiczecb6d0b2006-05-09 11:45:31 +0200111 char buf[32];
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100112 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",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500135 cpu_model, prn, strmhz(buf, CFG_SYS_CLK));
Bartlomiej Siekaad870262007-01-23 13:25:22 +0100136 else
137 printf("CPU: Unknown - Freescale ColdFire MCF5271 family"
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500138 " (PIN: 0x%x) rev. %hu, at %s MHz\n",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500139 pin, prn, strmhz(buf, CFG_SYS_CLK));
Marian Balakowiczecb6d0b2006-05-09 11:45:31 +0200140
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500141 return 0;
142}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200143#endif /* CONFIG_DISPLAY_CPUINFO */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500144
Simon Glassed38aef2020-05-10 11:40:03 -0600145int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500146{
Richard Retanubun5ffa65b2009-10-26 14:19:17 -0400147 /* Call the board specific reset actions first. */
148 if(board_reset) {
149 board_reset();
150 }
151
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500152 mbar_writeByte(MCF_RCM_RCR,
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500153 MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500154 return 0;
155};
156
157#if defined(CONFIG_WATCHDOG)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500158void watchdog_reset(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500159{
160 mbar_writeShort(MCF_WTM_WSR, 0x5555);
161 mbar_writeShort(MCF_WTM_WSR, 0xAAAA);
162}
163
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500164int watchdog_disable(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500165{
166 mbar_writeShort(MCF_WTM_WCR, 0);
167 return (0);
168}
169
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500170int watchdog_init(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500171{
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500172 mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN);
173 return (0);
174}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500175#endif /* #ifdef CONFIG_WATCHDOG */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500176
177#endif
wdenke65527f2004-02-12 00:47:09 +0000178
179#ifdef CONFIG_M5272
Simon Glassed38aef2020-05-10 11:40:03 -0600180int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500181{
Alison Wang95bed1f2012-03-26 21:49:04 +0000182 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000183
Alison Wang95bed1f2012-03-26 21:49:04 +0000184 out_be16(&wdp->wdog_wrrr, 0);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500185 udelay(1000);
wdenke65527f2004-02-12 00:47:09 +0000186
187 /* enable watchdog, set timeout to 0 and wait */
Alison Wang95bed1f2012-03-26 21:49:04 +0000188 out_be16(&wdp->wdog_wrrr, 1);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500189 while (1) ;
wdenke65527f2004-02-12 00:47:09 +0000190
191 /* we don't return! */
192 return 0;
193};
194
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200195#if defined(CONFIG_DISPLAY_CPUINFO)
196int print_cpuinfo(void)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500197{
Alison Wang95bed1f2012-03-26 21:49:04 +0000198 sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG);
wdenke65527f2004-02-12 00:47:09 +0000199 uchar msk;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500200 char *suf;
wdenke65527f2004-02-12 00:47:09 +0000201
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500202 puts("CPU: ");
Alison Wang95bed1f2012-03-26 21:49:04 +0000203 msk = (in_be32(&sysctrl->sc_dir) > 28) & 0xf;
wdenke65527f2004-02-12 00:47:09 +0000204 switch (msk) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500205 case 0x2:
206 suf = "1K75N";
207 break;
208 case 0x4:
209 suf = "3K75N";
210 break;
211 default:
212 suf = NULL;
213 printf("Freescale MCF5272 (Mask:%01x)\n", msk);
214 break;
215 }
wdenke65527f2004-02-12 00:47:09 +0000216
217 if (suf)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500218 printf("Freescale MCF5272 %s\n", suf);
wdenke65527f2004-02-12 00:47:09 +0000219 return 0;
220};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200221#endif /* CONFIG_DISPLAY_CPUINFO */
wdenke65527f2004-02-12 00:47:09 +0000222
wdenke65527f2004-02-12 00:47:09 +0000223#if defined(CONFIG_WATCHDOG)
224/* Called by macro WATCHDOG_RESET */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500225void watchdog_reset(void)
wdenke65527f2004-02-12 00:47:09 +0000226{
Alison Wang95bed1f2012-03-26 21:49:04 +0000227 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
228
229 out_be16(&wdt->wdog_wcr, 0);
wdenke65527f2004-02-12 00:47:09 +0000230}
231
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500232int watchdog_disable(void)
wdenke65527f2004-02-12 00:47:09 +0000233{
Alison Wang95bed1f2012-03-26 21:49:04 +0000234 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000235
Alison Wang95bed1f2012-03-26 21:49:04 +0000236 /* reset watchdog counter */
237 out_be16(&wdt->wdog_wcr, 0);
238 /* disable watchdog interrupt */
239 out_be16(&wdt->wdog_wirr, 0);
240 /* disable watchdog timer */
241 out_be16(&wdt->wdog_wrrr, 0);
wdenke65527f2004-02-12 00:47:09 +0000242
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500243 puts("WATCHDOG:disabled\n");
wdenke65527f2004-02-12 00:47:09 +0000244 return (0);
245}
246
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500247int watchdog_init(void)
wdenke65527f2004-02-12 00:47:09 +0000248{
Alison Wang95bed1f2012-03-26 21:49:04 +0000249 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
wdenke65527f2004-02-12 00:47:09 +0000250
Alison Wang95bed1f2012-03-26 21:49:04 +0000251 /* disable watchdog interrupt */
252 out_be16(&wdt->wdog_wirr, 0);
wdenke65527f2004-02-12 00:47:09 +0000253
254 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +0000255 out_be16(&wdt->wdog_wrrr,
Tom Rini9e7eeec2022-11-19 18:45:45 -0500256 (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
Alison Wang95bed1f2012-03-26 21:49:04 +0000257
258 /* reset watchdog counter */
259 out_be16(&wdt->wdog_wcr, 0);
wdenke65527f2004-02-12 00:47:09 +0000260
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500261 puts("WATCHDOG:enabled\n");
wdenke65527f2004-02-12 00:47:09 +0000262 return (0);
263}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500264#endif /* #ifdef CONFIG_WATCHDOG */
wdenke65527f2004-02-12 00:47:09 +0000265
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500266#endif /* #ifdef CONFIG_M5272 */
wdenke65527f2004-02-12 00:47:09 +0000267
Matthew Fettke761e2e92008-02-04 15:38:20 -0600268#ifdef CONFIG_M5275
Simon Glassed38aef2020-05-10 11:40:03 -0600269int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Matthew Fettke761e2e92008-02-04 15:38:20 -0600270{
Alison Wang95bed1f2012-03-26 21:49:04 +0000271 rcm_t *rcm = (rcm_t *)(MMAP_RCM);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600272
273 udelay(1000);
274
Alison Wang95bed1f2012-03-26 21:49:04 +0000275 out_8(&rcm->rcr, RCM_RCR_SOFTRST);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600276
277 /* we don't return! */
278 return 0;
279};
280
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200281#if defined(CONFIG_DISPLAY_CPUINFO)
282int print_cpuinfo(void)
Matthew Fettke761e2e92008-02-04 15:38:20 -0600283{
284 char buf[32];
285
286 printf("CPU: Freescale Coldfire MCF5275 at %s MHz\n",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500287 strmhz(buf, CFG_SYS_CLK));
Matthew Fettke761e2e92008-02-04 15:38:20 -0600288 return 0;
289};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200290#endif /* CONFIG_DISPLAY_CPUINFO */
Matthew Fettke761e2e92008-02-04 15:38:20 -0600291
292#if defined(CONFIG_WATCHDOG)
293/* Called by macro WATCHDOG_RESET */
294void watchdog_reset(void)
295{
Alison Wang95bed1f2012-03-26 21:49:04 +0000296 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
297
298 out_be16(&wdt->wsr, 0x5555);
299 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600300}
301
302int watchdog_disable(void)
303{
Alison Wang95bed1f2012-03-26 21:49:04 +0000304 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600305
Alison Wang95bed1f2012-03-26 21:49:04 +0000306 /* reset watchdog counter */
307 out_be16(&wdt->wsr, 0x5555);
308 out_be16(&wdt->wsr, 0xaaaa);
309
310 /* disable watchdog timer */
311 out_be16(&wdt->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600312
313 puts("WATCHDOG:disabled\n");
314 return (0);
315}
316
317int watchdog_init(void)
318{
Alison Wang95bed1f2012-03-26 21:49:04 +0000319 wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600320
Alison Wang95bed1f2012-03-26 21:49:04 +0000321 /* disable watchdog */
322 out_be16(&wdt->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600323
324 /* set timeout and enable watchdog */
Alison Wang95bed1f2012-03-26 21:49:04 +0000325 out_be16(&wdt->wmr,
Tom Rini9e7eeec2022-11-19 18:45:45 -0500326 (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
Alison Wang95bed1f2012-03-26 21:49:04 +0000327
328 /* reset watchdog counter */
329 out_be16(&wdt->wsr, 0x5555);
330 out_be16(&wdt->wsr, 0xaaaa);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600331
332 puts("WATCHDOG:enabled\n");
333 return (0);
334}
335#endif /* #ifdef CONFIG_WATCHDOG */
336
337#endif /* #ifdef CONFIG_M5275 */
338
wdenke65527f2004-02-12 00:47:09 +0000339#ifdef CONFIG_M5282
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200340#if defined(CONFIG_DISPLAY_CPUINFO)
341int print_cpuinfo(void)
wdenke65527f2004-02-12 00:47:09 +0000342{
Wolfgang Denkb4b1c462006-06-10 19:27:47 +0200343 unsigned char resetsource = MCFRESET_RSR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200344
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500345 printf("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
346 MCFCCM_CIR >> 8, MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
347 printf("Reset:%s%s%s%s%s%s%s\n",
348 (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "",
349 (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "",
350 (resetsource & MCFRESET_RSR_EXT) ? " External" : "",
351 (resetsource & MCFRESET_RSR_POR) ? " Power On" : "",
352 (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "",
353 (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "",
354 (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : "");
wdenke65527f2004-02-12 00:47:09 +0000355 return 0;
356}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200357#endif /* CONFIG_DISPLAY_CPUINFO */
wdenke65527f2004-02-12 00:47:09 +0000358
Simon Glassed38aef2020-05-10 11:40:03 -0600359int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Heiko Schocherac1956e2006-04-20 08:42:42 +0200360{
361 MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
wdenke65527f2004-02-12 00:47:09 +0000362 return 0;
363};
364#endif
stroese53395a22004-12-16 18:09:49 +0000365
TsiChungLiew34674692007-08-16 13:20:50 -0500366#ifdef CONFIG_M5249
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200367#if defined(CONFIG_DISPLAY_CPUINFO)
368int print_cpuinfo(void)
stroese53395a22004-12-16 18:09:49 +0000369{
370 char buf[32];
371
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500372 printf("CPU: Freescale Coldfire MCF5249 at %s MHz\n",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500373 strmhz(buf, CFG_SYS_CLK));
stroese53395a22004-12-16 18:09:49 +0000374 return 0;
375}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200376#endif /* CONFIG_DISPLAY_CPUINFO */
stroese53395a22004-12-16 18:09:49 +0000377
Simon Glassed38aef2020-05-10 11:40:03 -0600378int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500379{
stroese53395a22004-12-16 18:09:49 +0000380 /* enable watchdog, set timeout to 0 and wait */
381 mbar_writeByte(MCFSIM_SYPCR, 0xc0);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500382 while (1) ;
stroese53395a22004-12-16 18:09:49 +0000383
384 /* we don't return! */
385 return 0;
386};
387#endif
TsiChungLiew34674692007-08-16 13:20:50 -0500388
389#ifdef CONFIG_M5253
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200390#if defined(CONFIG_DISPLAY_CPUINFO)
391int print_cpuinfo(void)
TsiChungLiew34674692007-08-16 13:20:50 -0500392{
393 char buf[32];
394
395 unsigned char resetsource = mbar_readLong(SIM_RSR);
396 printf("CPU: Freescale Coldfire MCF5253 at %s MHz\n",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500397 strmhz(buf, CFG_SYS_CLK));
TsiChungLiew34674692007-08-16 13:20:50 -0500398
399 if ((resetsource & SIM_RSR_HRST) || (resetsource & SIM_RSR_SWTR)) {
400 printf("Reset:%s%s\n",
401 (resetsource & SIM_RSR_HRST) ? " Hardware/ System Reset"
402 : "",
403 (resetsource & SIM_RSR_SWTR) ? " Software Watchdog" :
404 "");
405 }
406 return 0;
407}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200408#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChungLiew34674692007-08-16 13:20:50 -0500409
Simon Glassed38aef2020-05-10 11:40:03 -0600410int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiew34674692007-08-16 13:20:50 -0500411{
412 /* enable watchdog, set timeout to 0 and wait */
413 mbar_writeByte(SIM_SYPCR, 0xc0);
414 while (1) ;
415
416 /* we don't return! */
417 return 0;
418};
419#endif
Ben Warren90c96db2008-08-26 22:16:25 -0700420
421#if defined(CONFIG_MCFFEC)
422/* Default initializations for MCFFEC controllers. To override,
423 * create a board-specific function called:
Wolfgang Denk62fb2b42021-09-27 17:42:39 +0200424 * int board_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700425 */
426
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900427int cpu_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700428{
429 return mcffec_initialize(bis);
430}
431#endif