Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * (C) Copyright 2000-2003 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 6 | * |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 7 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 8 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 9 | */ |
| 10 | |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 11 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 12 | #include <net.h> |
Simon Glass | f5c208d | 2019-11-14 12:57:20 -0700 | [diff] [blame] | 13 | #include <vsprintf.h> |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 14 | #include <command.h> |
Ben Warren | 2f2b6b6 | 2008-08-31 22:22:04 -0700 | [diff] [blame] | 15 | #include <netdev.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 16 | #include <asm/global_data.h> |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 17 | |
| 18 | #include <asm/immap.h> |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 19 | #include <asm/io.h> |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 20 | |
| 21 | DECLARE_GLOBAL_DATA_PTR; |
| 22 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 23 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 24 | { |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 25 | ccm_t *ccm = (ccm_t *) MMAP_CCM; |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 26 | |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 27 | out_8(&ccm->rcr, CCM_RCR_SOFTRST); |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 28 | /* we don't return! */ |
| 29 | return 0; |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 30 | } |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 31 | |
Angelo Dureghello | 3146b4d | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 32 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 33 | int print_cpuinfo(void) |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 34 | { |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 35 | ccm_t *ccm = (ccm_t *) MMAP_CCM; |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 36 | u16 msk; |
| 37 | u16 id = 0; |
| 38 | u8 ver; |
| 39 | |
| 40 | puts("CPU: "); |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 41 | msk = (in_be16(&ccm->cir) >> 6); |
| 42 | ver = (in_be16(&ccm->cir) & 0x003f); |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 43 | switch (msk) { |
| 44 | case 0x31: |
| 45 | id = 5235; |
| 46 | break; |
| 47 | } |
| 48 | |
| 49 | if (id) { |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 50 | char buf1[32], buf2[32]; |
| 51 | |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 52 | printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk, |
| 53 | ver); |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 54 | printf(" CPU CLK %s MHz BUS CLK %s MHz\n", |
TsiChung Liew | 10e9a6e | 2008-10-22 11:55:30 +0000 | [diff] [blame] | 55 | strmhz(buf1, gd->cpu_clk), |
| 56 | strmhz(buf2, gd->bus_clk)); |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | return 0; |
| 60 | }; |
Angelo Dureghello | 3146b4d | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 61 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 62 | |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 63 | #if defined(CONFIG_MCFFEC) |
| 64 | /* Default initializations for MCFFEC controllers. To override, |
| 65 | * create a board-specific function called: |
Wolfgang Denk | 62fb2b4 | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 66 | * int board_eth_init(struct bd_info *bis) |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 67 | */ |
| 68 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 69 | int cpu_eth_init(struct bd_info *bis) |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 70 | { |
| 71 | return mcffec_initialize(bis); |
| 72 | } |
| 73 | #endif |