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