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