blob: d9a71c6b920d849384245aea00a8d7fa1534e3e3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -05002/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
Alison Wang8d8dac92012-03-26 21:49:08 +00007 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -05008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -05009 */
10
11#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060012#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060013#include <net.h>
Simon Glassf5c208d2019-11-14 12:57:20 -070014#include <vsprintf.h>
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050015#include <watchdog.h>
16#include <command.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070017#include <netdev.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060018#include <asm/global_data.h>
Simon Glassdbd79542020-05-10 11:40:11 -060019#include <linux/delay.h>
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050020
21#include <asm/immap.h>
Alison Wang8d8dac92012-03-26 21:49:08 +000022#include <asm/io.h>
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050023
24DECLARE_GLOBAL_DATA_PTR;
25
Simon Glassed38aef2020-05-10 11:40:03 -060026int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050027{
Alison Wang8d8dac92012-03-26 21:49:08 +000028 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050029 udelay(1000);
Alison Wangfdc2fb12012-10-18 19:25:51 +000030 out_8(&rcm->rcr, RCM_RCR_FRCRSTOUT);
31 udelay(10000);
Alison Wang8d8dac92012-03-26 21:49:08 +000032 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050033
34 /* we don't return! */
35 return 0;
36};
37
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020038#if defined(CONFIG_DISPLAY_CPUINFO)
39int print_cpuinfo(void)
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050040{
Alison Wang8d8dac92012-03-26 21:49:08 +000041 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050042 u16 msk;
43 u16 id = 0;
44 u8 ver;
45
46 puts("CPU: ");
Alison Wang8d8dac92012-03-26 21:49:08 +000047 msk = (in_be16(&ccm->cir) >> 6);
48 ver = (in_be16(&ccm->cir) & 0x003f);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050049 switch (msk) {
50 case 0x48:
51 id = 54455;
52 break;
53 case 0x49:
54 id = 54454;
55 break;
56 case 0x4a:
57 id = 54453;
58 break;
59 case 0x4b:
60 id = 54452;
61 break;
62 case 0x4d:
63 id = 54451;
64 break;
65 case 0x4f:
66 id = 54450;
67 break;
Alison Wangfdc2fb12012-10-18 19:25:51 +000068 case 0x9F:
69 id = 54410;
70 break;
71 case 0xA0:
72 id = 54415;
73 break;
74 case 0xA1:
75 id = 54416;
76 break;
77 case 0xA2:
78 id = 54417;
79 break;
80 case 0xA3:
81 id = 54418;
82 break;
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050083 }
84
85 if (id) {
Wolfgang Denk20591042008-10-19 02:35:49 +020086 char buf1[32], buf2[32], buf3[32];
87
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050088 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
89 ver);
Wolfgang Denk20591042008-10-19 02:35:49 +020090 printf(" CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
91 strmhz(buf1, gd->cpu_clk),
92 strmhz(buf2, gd->bus_clk),
Simon Glass568a7b62012-12-13 20:49:07 +000093 strmhz(buf3, gd->arch.flb_clk));
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050094#ifdef CONFIG_PCI
Wolfgang Denk20591042008-10-19 02:35:49 +020095 printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
96 strmhz(buf1, gd->pci_clk),
Simon Glass568a7b62012-12-13 20:49:07 +000097 strmhz(buf2, gd->arch.inp_clk),
98 strmhz(buf3, gd->arch.vco_clk));
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050099#else
Wolfgang Denk20591042008-10-19 02:35:49 +0200100 printf(" INP CLK %s MHz VCO CLK %s MHz\n",
Simon Glass568a7b62012-12-13 20:49:07 +0000101 strmhz(buf1, gd->arch.inp_clk),
102 strmhz(buf2, gd->arch.vco_clk));
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500103#endif
104 }
105
106 return 0;
107}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200108#endif /* CONFIG_DISPLAY_CPUINFO */
Ben Warren90c96db2008-08-26 22:16:25 -0700109
110#if defined(CONFIG_MCFFEC)
111/* Default initializations for MCFFEC controllers. To override,
112 * create a board-specific function called:
Wolfgang Denk62fb2b42021-09-27 17:42:39 +0200113 * int board_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700114 */
115
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900116int cpu_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700117{
118 return mcffec_initialize(bis);
119}
120#endif