Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * (C) Copyright 2000-2003 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 6 | * |
Alison Wang | 849fc42 | 2012-03-26 21:49:03 +0000 | [diff] [blame] | 7 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 8 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
Simon Glass | 691d719 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 12 | #include <init.h> |
Simon Glass | 2189d5f | 2019-11-14 12:57:20 -0700 | [diff] [blame] | 13 | #include <vsprintf.h> |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 14 | #include <watchdog.h> |
| 15 | #include <command.h> |
Simon Glass | 401d1c4 | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 16 | #include <asm/global_data.h> |
Simon Glass | c05ed00 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 17 | #include <linux/delay.h> |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 18 | |
| 19 | #include <asm/immap.h> |
Alison Wang | 849fc42 | 2012-03-26 21:49:03 +0000 | [diff] [blame] | 20 | #include <asm/io.h> |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 24 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 25 | { |
Alison Wang | 849fc42 | 2012-03-26 21:49:03 +0000 | [diff] [blame] | 26 | rcm_t *rcm = (rcm_t *) (MMAP_RCM); |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 27 | udelay(1000); |
Alison Wang | 849fc42 | 2012-03-26 21:49:03 +0000 | [diff] [blame] | 28 | setbits_8(&rcm->rcr, RCM_RCR_SOFTRST); |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 29 | |
| 30 | /* we don't return! */ |
| 31 | return 0; |
| 32 | }; |
| 33 | |
Angelo Dureghello | b9153fe3 | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 34 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 35 | int print_cpuinfo(void) |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 36 | { |
Alison Wang | 849fc42 | 2012-03-26 21:49:03 +0000 | [diff] [blame] | 37 | ccm_t *ccm = (ccm_t *) MMAP_CCM; |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 38 | u16 msk; |
| 39 | u16 id = 0; |
| 40 | u8 ver; |
| 41 | |
| 42 | puts("CPU: "); |
Alison Wang | 849fc42 | 2012-03-26 21:49:03 +0000 | [diff] [blame] | 43 | msk = (in_be16(&ccm->cir) >> 6); |
| 44 | ver = (in_be16(&ccm->cir) & 0x003f); |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 45 | switch (msk) { |
| 46 | case 0x6c: |
| 47 | id = 52277; |
| 48 | break; |
| 49 | } |
| 50 | |
| 51 | if (id) { |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 52 | char buf1[32], buf2[32], buf3[32]; |
| 53 | |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 54 | printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk, |
| 55 | ver); |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 56 | printf(" CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n", |
TsiChung Liew | 1b27084 | 2008-10-22 11:55:30 +0000 | [diff] [blame] | 57 | strmhz(buf1, gd->cpu_clk), |
| 58 | strmhz(buf2, gd->bus_clk), |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 59 | strmhz(buf3, gd->arch.flb_clk)); |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 60 | printf(" INP CLK %s MHz VCO CLK %s MHz\n", |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 61 | strmhz(buf1, gd->arch.inp_clk), |
| 62 | strmhz(buf2, gd->arch.vco_clk)); |
TsiChungLiew | c875810 | 2008-01-14 17:46:19 -0600 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | return 0; |
| 66 | } |
Angelo Dureghello | b9153fe3 | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 67 | #endif /* CONFIG_DISPLAY_CPUINFO */ |