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