blob: 18d20a8926552134703cc02da7dee26f40cdd5a9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChung Liewf6afe722007-06-18 13:50:13 -05002/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
Alison Wang35d23df2012-03-26 21:49:05 +00007 * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.
TsiChung Liewf6afe722007-06-18 13:50:13 -05008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChung Liewf6afe722007-06-18 13:50:13 -05009 */
10
11#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060012#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060013#include <net.h>
Simon Glassf5c208d2019-11-14 12:57:20 -070014#include <vsprintf.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050015#include <command.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070016#include <netdev.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060017#include <asm/global_data.h>
Simon Glassdbd79542020-05-10 11:40:11 -060018#include <linux/delay.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050019
TsiChungLiewfb661742007-07-05 23:01:22 -050020#include <asm/immap.h>
Alison Wang35d23df2012-03-26 21:49:05 +000021#include <asm/io.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050022
Wolfgang Denkd112a2c2007-09-15 20:48:41 +020023DECLARE_GLOBAL_DATA_PTR;
24
Simon Glassed38aef2020-05-10 11:40:03 -060025int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChung Liewf6afe722007-06-18 13:50:13 -050026{
Alison Wang35d23df2012-03-26 21:49:05 +000027 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
TsiChung Liewf6afe722007-06-18 13:50:13 -050028
TsiChung Liewf6afe722007-06-18 13:50:13 -050029 udelay(1000);
Alison Wang35d23df2012-03-26 21:49:05 +000030 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChung Liewf6afe722007-06-18 13:50:13 -050031
32 /* we don't return! */
33 return 0;
34};
35
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020036#if defined(CONFIG_DISPLAY_CPUINFO)
37int print_cpuinfo(void)
TsiChung Liewf6afe722007-06-18 13:50:13 -050038{
Alison Wang35d23df2012-03-26 21:49:05 +000039 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChung Liewf6afe722007-06-18 13:50:13 -050040 u16 msk;
41 u16 id = 0;
42 u8 ver;
43
44 puts("CPU: ");
Alison Wang35d23df2012-03-26 21:49:05 +000045 msk = (in_be16(&ccm->cir) >> 6);
46 ver = (in_be16(&ccm->cir) & 0x003f);
TsiChung Liewf6afe722007-06-18 13:50:13 -050047 switch (msk) {
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000048#ifdef CONFIG_MCF5301x
49 case 0x78:
50 id = 53010;
51 break;
52 case 0x77:
53 id = 53012;
54 break;
55 case 0x76:
56 id = 53015;
57 break;
58 case 0x74:
59 id = 53011;
60 break;
61 case 0x73:
62 id = 53013;
63 break;
64#endif
65#ifdef CONFIG_MCF532x
TsiChung Liewf6afe722007-06-18 13:50:13 -050066 case 0x54:
67 id = 5329;
68 break;
69 case 0x59:
70 id = 5328;
71 break;
72 case 0x61:
73 id = 5327;
74 break;
TsiChungLiew6f8a0a32008-01-14 17:23:08 -060075 case 0x65:
76 id = 5373;
77 break;
78 case 0x68:
79 id = 53721;
80 break;
81 case 0x69:
82 id = 5372;
83 break;
84 case 0x6B:
85 id = 5372;
86 break;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000087#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -050088 }
89
90 if (id) {
Wolfgang Denk20591042008-10-19 02:35:49 +020091 char buf1[32], buf2[32];
92
TsiChung Liewf6afe722007-06-18 13:50:13 -050093 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
94 ver);
Wolfgang Denk20591042008-10-19 02:35:49 +020095 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
TsiChung Liew10e9a6e2008-10-22 11:55:30 +000096 strmhz(buf1, gd->cpu_clk),
97 strmhz(buf2, gd->bus_clk));
TsiChung Liewf6afe722007-06-18 13:50:13 -050098 }
99
100 return 0;
101};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200102#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChung Liewf6afe722007-06-18 13:50:13 -0500103
Ben Warren90c96db2008-08-26 22:16:25 -0700104#if defined(CONFIG_MCFFEC)
105/* Default initializations for MCFFEC controllers. To override,
106 * create a board-specific function called:
Wolfgang Denk62fb2b42021-09-27 17:42:39 +0200107 * int board_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700108 */
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900109int cpu_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700110{
111 return mcffec_initialize(bis);
112}
113#endif