blob: 6973af9d045d3531cf4f4520370aadc825db529f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChung Liewf6afe722007-06-18 13:50:13 -05002/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
Alison Wang35d23df2012-03-26 21:49:05 +00007 * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.
TsiChung Liewf6afe722007-06-18 13:50:13 -05008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChung Liewf6afe722007-06-18 13:50:13 -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>
TsiChung Liewf6afe722007-06-18 13:50:13 -050014#include <command.h>
Ben Warren2f2b6b62008-08-31 22:22:04 -070015#include <netdev.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Simon Glassdbd79542020-05-10 11:40:11 -060017#include <linux/delay.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050018
TsiChungLiewfb661742007-07-05 23:01:22 -050019#include <asm/immap.h>
Alison Wang35d23df2012-03-26 21:49:05 +000020#include <asm/io.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050021
Wolfgang Denkd112a2c2007-09-15 20:48:41 +020022DECLARE_GLOBAL_DATA_PTR;
23
Simon Glassed38aef2020-05-10 11:40:03 -060024int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
TsiChung Liewf6afe722007-06-18 13:50:13 -050025{
Alison Wang35d23df2012-03-26 21:49:05 +000026 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
TsiChung Liewf6afe722007-06-18 13:50:13 -050027
TsiChung Liewf6afe722007-06-18 13:50:13 -050028 udelay(1000);
Alison Wang35d23df2012-03-26 21:49:05 +000029 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
TsiChung Liewf6afe722007-06-18 13:50:13 -050030
31 /* we don't return! */
32 return 0;
33};
34
Angelo Dureghello3146b4d2017-08-20 00:01:55 +020035#if defined(CONFIG_DISPLAY_CPUINFO)
36int print_cpuinfo(void)
TsiChung Liewf6afe722007-06-18 13:50:13 -050037{
Alison Wang35d23df2012-03-26 21:49:05 +000038 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChung Liewf6afe722007-06-18 13:50:13 -050039 u16 msk;
40 u16 id = 0;
41 u8 ver;
42
43 puts("CPU: ");
Alison Wang35d23df2012-03-26 21:49:05 +000044 msk = (in_be16(&ccm->cir) >> 6);
45 ver = (in_be16(&ccm->cir) & 0x003f);
TsiChung Liewf6afe722007-06-18 13:50:13 -050046 switch (msk) {
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000047#ifdef CONFIG_MCF5301x
48 case 0x78:
49 id = 53010;
50 break;
51 case 0x77:
52 id = 53012;
53 break;
54 case 0x76:
55 id = 53015;
56 break;
57 case 0x74:
58 id = 53011;
59 break;
60 case 0x73:
61 id = 53013;
62 break;
63#endif
64#ifdef CONFIG_MCF532x
TsiChung Liewf6afe722007-06-18 13:50:13 -050065 case 0x54:
66 id = 5329;
67 break;
68 case 0x59:
69 id = 5328;
70 break;
71 case 0x61:
72 id = 5327;
73 break;
TsiChungLiew6f8a0a32008-01-14 17:23:08 -060074 case 0x65:
75 id = 5373;
76 break;
77 case 0x68:
78 id = 53721;
79 break;
80 case 0x69:
81 id = 5372;
82 break;
83 case 0x6B:
84 id = 5372;
85 break;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000086#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -050087 }
88
89 if (id) {
Wolfgang Denk20591042008-10-19 02:35:49 +020090 char buf1[32], buf2[32];
91
TsiChung Liewf6afe722007-06-18 13:50:13 -050092 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
93 ver);
Wolfgang Denk20591042008-10-19 02:35:49 +020094 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
TsiChung Liew10e9a6e2008-10-22 11:55:30 +000095 strmhz(buf1, gd->cpu_clk),
96 strmhz(buf2, gd->bus_clk));
TsiChung Liewf6afe722007-06-18 13:50:13 -050097 }
98
99 return 0;
100};
Angelo Dureghello3146b4d2017-08-20 00:01:55 +0200101#endif /* CONFIG_DISPLAY_CPUINFO */
TsiChung Liewf6afe722007-06-18 13:50:13 -0500102
Ben Warren90c96db2008-08-26 22:16:25 -0700103#if defined(CONFIG_MCFFEC)
104/* Default initializations for MCFFEC controllers. To override,
105 * create a board-specific function called:
Wolfgang Denk62fb2b42021-09-27 17:42:39 +0200106 * int board_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700107 */
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900108int cpu_eth_init(struct bd_info *bis)
Ben Warren90c96db2008-08-26 22:16:25 -0700109{
110 return mcffec_initialize(bis);
111}
112#endif