200c53eaf357eba3028ac1121ff3a1b3e5da1543
[oweals/u-boot.git] / arch / m68k / cpu / mcf5227x / 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 <vsprintf.h>
14 #include <watchdog.h>
15 #include <command.h>
16
17 #include <asm/immap.h>
18 #include <asm/io.h>
19
20 DECLARE_GLOBAL_DATA_PTR;
21
22 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
23 {
24         rcm_t *rcm = (rcm_t *) (MMAP_RCM);
25         udelay(1000);
26         setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
27
28         /* we don't return! */
29         return 0;
30 };
31
32 #if defined(CONFIG_DISPLAY_CPUINFO)
33 int print_cpuinfo(void)
34 {
35         ccm_t *ccm = (ccm_t *) MMAP_CCM;
36         u16 msk;
37         u16 id = 0;
38         u8 ver;
39
40         puts("CPU:   ");
41         msk = (in_be16(&ccm->cir) >> 6);
42         ver = (in_be16(&ccm->cir) & 0x003f);
43         switch (msk) {
44         case 0x6c:
45                 id = 52277;
46                 break;
47         }
48
49         if (id) {
50                 char buf1[32], buf2[32], buf3[32];
51
52                 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
53                        ver);
54                 printf("       CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
55                        strmhz(buf1, gd->cpu_clk),
56                        strmhz(buf2, gd->bus_clk),
57                        strmhz(buf3, gd->arch.flb_clk));
58                 printf("       INP CLK %s MHz VCO CLK %s MHz\n",
59                        strmhz(buf1, gd->arch.inp_clk),
60                        strmhz(buf2, gd->arch.vco_clk));
61         }
62
63         return 0;
64 }
65 #endif /* CONFIG_DISPLAY_CPUINFO */