blob: 2608fdd76f1d40b69164d1a82962a1030a8f4fe4 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChungLiew8ae158c2007-08-16 15:05:11 -05002/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
Alison Wang198cafb2012-03-26 21:49:08 +00007 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
TsiChungLiew8ae158c2007-08-16 15:05:11 -05008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChungLiew8ae158c2007-08-16 15:05:11 -05009 */
10
11#include <common.h>
Simon Glass691d7192020-05-10 11:40:02 -060012#include <init.h>
Simon Glass90526e92020-05-10 11:39:56 -060013#include <net.h>
Simon Glass2189d5f2019-11-14 12:57:20 -070014#include <vsprintf.h>
TsiChungLiew8ae158c2007-08-16 15:05:11 -050015#include <watchdog.h>
16#include <command.h>
Ben Warren89973f82008-08-31 22:22:04 -070017#include <netdev.h>
TsiChungLiew8ae158c2007-08-16 15:05:11 -050018
19#include <asm/immap.h>
Alison Wang198cafb2012-03-26 21:49:08 +000020#include <asm/io.h>
TsiChungLiew8ae158c2007-08-16 15:05:11 -050021
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[])
TsiChungLiew8ae158c2007-08-16 15:05:11 -050025{
Alison Wang198cafb2012-03-26 21:49:08 +000026 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
TsiChungLiew8ae158c2007-08-16 15:05:11 -050027 udelay(1000);
Alison Wang45370e12012-10-18 19:25:51 +000028 out_8(&rcm->rcr, RCM_RCR_FRCRSTOUT);
29 udelay(10000);
Alison Wang198cafb2012-03-26 21:49:08 +000030 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChungLiew8ae158c2007-08-16 15:05:11 -050031
32 /* we don't return! */
33 return 0;
34};
35
Angelo Dureghellob9153fe32017-08-20 00:01:55 +020036#if defined(CONFIG_DISPLAY_CPUINFO)
37int print_cpuinfo(void)
TsiChungLiew8ae158c2007-08-16 15:05:11 -050038{
Alison Wang198cafb2012-03-26 21:49:08 +000039 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChungLiew8ae158c2007-08-16 15:05:11 -050040 u16 msk;
41 u16 id = 0;
42 u8 ver;
43
44 puts("CPU: ");
Alison Wang198cafb2012-03-26 21:49:08 +000045 msk = (in_be16(&ccm->cir) >> 6);
46 ver = (in_be16(&ccm->cir) & 0x003f);
TsiChungLiew8ae158c2007-08-16 15:05:11 -050047 switch (msk) {
48 case 0x48:
49 id = 54455;
50 break;
51 case 0x49:
52 id = 54454;
53 break;
54 case 0x4a:
55 id = 54453;
56 break;
57 case 0x4b:
58 id = 54452;
59 break;
60 case 0x4d:
61 id = 54451;
62 break;
63 case 0x4f:
64 id = 54450;
65 break;
Alison Wang45370e12012-10-18 19:25:51 +000066 case 0x9F:
67 id = 54410;
68 break;
69 case 0xA0:
70 id = 54415;
71 break;
72 case 0xA1:
73 id = 54416;
74 break;
75 case 0xA2:
76 id = 54417;
77 break;
78 case 0xA3:
79 id = 54418;
80 break;
TsiChungLiew8ae158c2007-08-16 15:05:11 -050081 }
82
83 if (id) {
Wolfgang Denk08ef89e2008-10-19 02:35:49 +020084 char buf1[32], buf2[32], buf3[32];
85
TsiChungLiew8ae158c2007-08-16 15:05:11 -050086 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
87 ver);
Wolfgang Denk08ef89e2008-10-19 02:35:49 +020088 printf(" CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
89 strmhz(buf1, gd->cpu_clk),
90 strmhz(buf2, gd->bus_clk),
Simon Glass7e2592f2012-12-13 20:49:07 +000091 strmhz(buf3, gd->arch.flb_clk));
TsiChungLiew8ae158c2007-08-16 15:05:11 -050092#ifdef CONFIG_PCI
Wolfgang Denk08ef89e2008-10-19 02:35:49 +020093 printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
94 strmhz(buf1, gd->pci_clk),
Simon Glass7e2592f2012-12-13 20:49:07 +000095 strmhz(buf2, gd->arch.inp_clk),
96 strmhz(buf3, gd->arch.vco_clk));
TsiChungLiew8ae158c2007-08-16 15:05:11 -050097#else
Wolfgang Denk08ef89e2008-10-19 02:35:49 +020098 printf(" INP CLK %s MHz VCO CLK %s MHz\n",
Simon Glass7e2592f2012-12-13 20:49:07 +000099 strmhz(buf1, gd->arch.inp_clk),
100 strmhz(buf2, gd->arch.vco_clk));
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500101#endif
102 }
103
104 return 0;
105}
Angelo Dureghellob9153fe32017-08-20 00:01:55 +0200106#endif /* CONFIG_DISPLAY_CPUINFO */
Ben Warren86882b82008-08-26 22:16:25 -0700107
108#if defined(CONFIG_MCFFEC)
109/* Default initializations for MCFFEC controllers. To override,
110 * create a board-specific function called:
111 * int board_eth_init(bd_t *bis)
112 */
113
Ben Warren86882b82008-08-26 22:16:25 -0700114int cpu_eth_init(bd_t *bis)
115{
116 return mcffec_initialize(bis);
117}
118#endif