1// SPDX-License-Identifier: GPL-2.0+
2/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
7 * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.
8 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
9 */
10
11#include <init.h>
12#include <net.h>
13#include <vsprintf.h>
14#include <command.h>
15#include <netdev.h>
16#include <asm/global_data.h>
17#include <linux/delay.h>
18
19#include <asm/immap.h>
20#include <asm/io.h>
21
22DECLARE_GLOBAL_DATA_PTR;
23
24int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
25{
26	rcm_t *rcm = (rcm_t *) (MMAP_RCM);
27
28	udelay(1000);
29	setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
30
31	/* we don't return! */
32	return 0;
33};
34
35#if defined(CONFIG_DISPLAY_CPUINFO)
36int print_cpuinfo(void)
37{
38	ccm_t *ccm = (ccm_t *) MMAP_CCM;
39	u16 msk;
40	u16 id = 0;
41	u8 ver;
42
43	puts("CPU:   ");
44	msk = (in_be16(&ccm->cir) >> 6);
45	ver = (in_be16(&ccm->cir) & 0x003f);
46	switch (msk) {
47#ifdef CONFIG_MCF5301x
48	case 0x78:
49		id = 53010;
50		break;
51	case 0x77:
52		id = 53012;
53		break;
54	case 0x76:
55		id = 53015;
56		break;
57	case 0x74:
58		id = 53011;
59		break;
60	case 0x73:
61		id = 53013;
62		break;
63#endif
64#ifdef CONFIG_MCF532x
65	case 0x54:
66		id = 5329;
67		break;
68	case 0x59:
69		id = 5328;
70		break;
71	case 0x61:
72		id = 5327;
73		break;
74	case 0x65:
75		id = 5373;
76		break;
77	case 0x68:
78		id = 53721;
79		break;
80	case 0x69:
81		id = 5372;
82		break;
83	case 0x6B:
84		id = 5372;
85		break;
86#endif
87	}
88
89	if (id) {
90		char buf1[32], buf2[32];
91
92		printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
93		       ver);
94		printf("       CPU CLK %s MHz BUS CLK %s MHz\n",
95		       strmhz(buf1, gd->cpu_clk),
96		       strmhz(buf2, gd->bus_clk));
97	}
98
99	return 0;
100};
101#endif /* CONFIG_DISPLAY_CPUINFO */
102
103#if defined(CONFIG_MCFFEC)
104/* Default initializations for MCFFEC controllers.  To override,
105 * create a board-specific function called:
106 *	int board_eth_init(struct bd_info *bis)
107 */
108int cpu_eth_init(struct bd_info *bis)
109{
110	return mcffec_initialize(bis);
111}
112#endif
113