blob: a7adf64f0de0a86943db90125089443455035cfa [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChungLiewae831cd2008-01-14 17:46:19 -06002/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
Alison Wang8bce3ec2012-03-26 21:49:03 +00007 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
TsiChungLiewae831cd2008-01-14 17:46:19 -06008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChungLiewae831cd2008-01-14 17:46:19 -06009 */
10
11#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060012#include <init.h>
Simon Glassf5c208d2019-11-14 12:57:20 -070013#include <vsprintf.h>
TsiChungLiewae831cd2008-01-14 17:46:19 -060014#include <watchdog.h>
15#include <command.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Simon Glassdbd79542020-05-10 11:40:11 -060017#include <linux/delay.h>
TsiChungLiewae831cd2008-01-14 17:46:19 -060018
19#include <asm/immap.h>
Alison Wang8bce3ec2012-03-26 21:49:03 +000020#include <asm/io.h>
TsiChungLiewae831cd2008-01-14 17:46:19 -060021
22DECLARE_GLOBAL_DATA_PTR;
23
Simon Glassed38aef2020-05-10 11:40:03 -060024int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiewae831cd2008-01-14 17:46:19 -060025{
Alison Wang8bce3ec2012-03-26 21:49:03 +000026 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
TsiChungLiewae831cd2008-01-14 17:46:19 -060027 udelay(1000);
Alison Wang8bce3ec2012-03-26 21:49:03 +000028 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChungLiewae831cd2008-01-14 17:46:19 -060029
30 /* we don't return! */
31 return 0;
32};
33
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020034#if defined(CONFIG_DISPLAY_CPUINFO)
35int print_cpuinfo(void)
TsiChungLiewae831cd2008-01-14 17:46:19 -060036{
Alison Wang8bce3ec2012-03-26 21:49:03 +000037 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChungLiewae831cd2008-01-14 17:46:19 -060038 u16 msk;
39 u16 id = 0;
40 u8 ver;
41
42 puts("CPU: ");
Alison Wang8bce3ec2012-03-26 21:49:03 +000043 msk = (in_be16(&ccm->cir) >> 6);
44 ver = (in_be16(&ccm->cir) & 0x003f);
TsiChungLiewae831cd2008-01-14 17:46:19 -060045 switch (msk) {
46 case 0x6c:
47 id = 52277;
48 break;
49 }
50
51 if (id) {
Wolfgang Denk20591042008-10-19 02:35:49 +020052 char buf1[32], buf2[32], buf3[32];
53
TsiChungLiewae831cd2008-01-14 17:46:19 -060054 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
55 ver);
Wolfgang Denk20591042008-10-19 02:35:49 +020056 printf(" CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
TsiChung Liew10e9a6e2008-10-22 11:55:30 +000057 strmhz(buf1, gd->cpu_clk),
58 strmhz(buf2, gd->bus_clk),
Simon Glass568a7b62012-12-13 20:49:07 +000059 strmhz(buf3, gd->arch.flb_clk));
Wolfgang Denk20591042008-10-19 02:35:49 +020060 printf(" INP CLK %s MHz VCO CLK %s MHz\n",
Simon Glass568a7b62012-12-13 20:49:07 +000061 strmhz(buf1, gd->arch.inp_clk),
62 strmhz(buf2, gd->arch.vco_clk));
TsiChungLiewae831cd2008-01-14 17:46:19 -060063 }
64
65 return 0;
66}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020067#endif /* CONFIG_DISPLAY_CPUINFO */