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-2007, 2012 Freescale Semiconductor, Inc.
8  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
9  */
10 
11 #include <common.h>
12 #include <init.h>
13 #include <net.h>
14 #include <vsprintf.h>
15 #include <watchdog.h>
16 #include <command.h>
17 #include <netdev.h>
18 #include <asm/global_data.h>
19 #include <linux/delay.h>
20 
21 #include <asm/immap.h>
22 #include <asm/io.h>
23 
24 DECLARE_GLOBAL_DATA_PTR;
25 
do_reset(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])26 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
27 {
28 	rcm_t *rcm = (rcm_t *) (MMAP_RCM);
29 	udelay(1000);
30 	out_8(&rcm->rcr, RCM_RCR_FRCRSTOUT);
31 	udelay(10000);
32 	setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
33 
34 	/* we don't return! */
35 	return 0;
36 };
37 
38 #if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo(void)39 int print_cpuinfo(void)
40 {
41 	ccm_t *ccm = (ccm_t *) MMAP_CCM;
42 	u16 msk;
43 	u16 id = 0;
44 	u8 ver;
45 
46 	puts("CPU:   ");
47 	msk = (in_be16(&ccm->cir) >> 6);
48 	ver = (in_be16(&ccm->cir) & 0x003f);
49 	switch (msk) {
50 	case 0x48:
51 		id = 54455;
52 		break;
53 	case 0x49:
54 		id = 54454;
55 		break;
56 	case 0x4a:
57 		id = 54453;
58 		break;
59 	case 0x4b:
60 		id = 54452;
61 		break;
62 	case 0x4d:
63 		id = 54451;
64 		break;
65 	case 0x4f:
66 		id = 54450;
67 		break;
68 	case 0x9F:
69 		id = 54410;
70 		break;
71 	case 0xA0:
72 		id = 54415;
73 		break;
74 	case 0xA1:
75 		id = 54416;
76 		break;
77 	case 0xA2:
78 		id = 54417;
79 		break;
80 	case 0xA3:
81 		id = 54418;
82 		break;
83 	}
84 
85 	if (id) {
86 		char buf1[32], buf2[32], buf3[32];
87 
88 		printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
89 		       ver);
90 		printf("       CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
91 		       strmhz(buf1, gd->cpu_clk),
92 		       strmhz(buf2, gd->bus_clk),
93 		       strmhz(buf3, gd->arch.flb_clk));
94 #ifdef CONFIG_PCI
95 		printf("       PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
96 		       strmhz(buf1, gd->pci_clk),
97 		       strmhz(buf2, gd->arch.inp_clk),
98 		       strmhz(buf3, gd->arch.vco_clk));
99 #else
100 		printf("       INP CLK %s MHz VCO CLK %s MHz\n",
101 		       strmhz(buf1, gd->arch.inp_clk),
102 		       strmhz(buf2, gd->arch.vco_clk));
103 #endif
104 	}
105 
106 	return 0;
107 }
108 #endif /* CONFIG_DISPLAY_CPUINFO */
109 
110 #if defined(CONFIG_MCFFEC)
111 /* Default initializations for MCFFEC controllers.  To override,
112  * create a board-specific function called:
113  * 	int board_eth_init(struct bd_info *bis)
114  */
115 
cpu_eth_init(struct bd_info * bis)116 int cpu_eth_init(struct bd_info *bis)
117 {
118 	return mcffec_initialize(bis);
119 }
120 #endif
121