blob: b811ac355e4d1c934c08f571244b37615f74e080 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChungLiewfc3ca3b62007-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.
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -05008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -05009 */
10
Simon Glass97589732020-05-10 11:40:02 -060011#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060012#include <net.h>
Simon Glassf5c208d2019-11-14 12:57:20 -070013#include <vsprintf.h>
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050014#include <watchdog.h>
15#include <command.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070016#include <netdev.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060017#include <asm/global_data.h>
Simon Glassdbd79542020-05-10 11:40:11 -060018#include <linux/delay.h>
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050019
20#include <asm/immap.h>
Alison Wang8d8dac92012-03-26 21:49:08 +000021#include <asm/io.h>
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050022
23DECLARE_GLOBAL_DATA_PTR;
24
Simon Glassed38aef2020-05-10 11:40:03 -060025int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050026{
Alison Wang8d8dac92012-03-26 21:49:08 +000027 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050028 udelay(1000);
Alison Wangfdc2fb12012-10-18 19:25:51 +000029 out_8(&rcm->rcr, RCM_RCR_FRCRSTOUT);
30 udelay(10000);
Alison Wang8d8dac92012-03-26 21:49:08 +000031 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050032
33 /* we don't return! */
34 return 0;
35};
36
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020037#if defined(CONFIG_DISPLAY_CPUINFO)
38int print_cpuinfo(void)
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050039{
Alison Wang8d8dac92012-03-26 21:49:08 +000040 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050041 u16 msk;
42 u16 id = 0;
43 u8 ver;
44
45 puts("CPU: ");
Alison Wang8d8dac92012-03-26 21:49:08 +000046 msk = (in_be16(&ccm->cir) >> 6);
47 ver = (in_be16(&ccm->cir) & 0x003f);
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050048 switch (msk) {
49 case 0x48:
50 id = 54455;
51 break;
52 case 0x49:
53 id = 54454;
54 break;
55 case 0x4a:
56 id = 54453;
57 break;
58 case 0x4b:
59 id = 54452;
60 break;
61 case 0x4d:
62 id = 54451;
63 break;
64 case 0x4f:
65 id = 54450;
66 break;
Alison Wangfdc2fb12012-10-18 19:25:51 +000067 case 0x9F:
68 id = 54410;
69 break;
70 case 0xA0:
71 id = 54415;
72 break;
73 case 0xA1:
74 id = 54416;
75 break;
76 case 0xA2:
77 id = 54417;
78 break;
79 case 0xA3:
80 id = 54418;
81 break;
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050082 }
83
84 if (id) {
Wolfgang Denk20591042008-10-19 02:35:49 +020085 char buf1[32], buf2[32], buf3[32];
86
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050087 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
88 ver);
Wolfgang Denk20591042008-10-19 02:35:49 +020089 printf(" CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
90 strmhz(buf1, gd->cpu_clk),
91 strmhz(buf2, gd->bus_clk),
Simon Glass568a7b62012-12-13 20:49:07 +000092 strmhz(buf3, gd->arch.flb_clk));
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050093#ifdef CONFIG_PCI
Wolfgang Denk20591042008-10-19 02:35:49 +020094 printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
95 strmhz(buf1, gd->pci_clk),
Simon Glass568a7b62012-12-13 20:49:07 +000096 strmhz(buf2, gd->arch.inp_clk),
97 strmhz(buf3, gd->arch.vco_clk));
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -050098#else
Wolfgang Denk20591042008-10-19 02:35:49 +020099 printf(" INP CLK %s MHz VCO CLK %s MHz\n",
Simon Glass568a7b62012-12-13 20:49:07 +0000100 strmhz(buf1, gd->arch.inp_clk),
101 strmhz(buf2, gd->arch.vco_clk));
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -0500102#endif
103 }
104
105 return 0;
106}
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200107#endif /* CONFIG_DISPLAY_CPUINFO */
Ben Warren90c96db2008-08-26 22:16:25 -0700108
109#if defined(CONFIG_MCFFEC)
110/* Default initializations for MCFFEC controllers. To override,
111 * create a board-specific function called:
Wolfgang Denk62fb2b42021-09-27 17:42:39 +0200112 * int board_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700113 */
114
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900115int cpu_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700116{
117 return mcffec_initialize(bis);
118}
119#endif