Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * (C) Copyright 2000-2003 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 6 | * |
Alison Wang | 35d23df | 2012-03-26 21:49:05 +0000 | [diff] [blame] | 7 | * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc. |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 8 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -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> |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -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> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 17 | #include <linux/delay.h> |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 18 | |
TsiChungLiew | fb66174 | 2007-07-05 23:01:22 -0500 | [diff] [blame] | 19 | #include <asm/immap.h> |
Alison Wang | 35d23df | 2012-03-26 21:49:05 +0000 | [diff] [blame] | 20 | #include <asm/io.h> |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 21 | |
Wolfgang Denk | d112a2c | 2007-09-15 20:48:41 +0200 | [diff] [blame] | 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 24 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 25 | { |
Alison Wang | 35d23df | 2012-03-26 21:49:05 +0000 | [diff] [blame] | 26 | rcm_t *rcm = (rcm_t *) (MMAP_RCM); |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 27 | |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 28 | udelay(1000); |
Alison Wang | 35d23df | 2012-03-26 21:49:05 +0000 | [diff] [blame] | 29 | setbits_8(&rcm->rcr, RCM_RCR_SOFTRST); |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 30 | |
| 31 | /* we don't return! */ |
| 32 | return 0; |
| 33 | }; |
| 34 | |
Angelo Dureghello | 3146b4d | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 35 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 36 | int print_cpuinfo(void) |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 37 | { |
Alison Wang | 35d23df | 2012-03-26 21:49:05 +0000 | [diff] [blame] | 38 | ccm_t *ccm = (ccm_t *) MMAP_CCM; |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 39 | u16 msk; |
| 40 | u16 id = 0; |
| 41 | u8 ver; |
| 42 | |
| 43 | puts("CPU: "); |
Alison Wang | 35d23df | 2012-03-26 21:49:05 +0000 | [diff] [blame] | 44 | msk = (in_be16(&ccm->cir) >> 6); |
| 45 | ver = (in_be16(&ccm->cir) & 0x003f); |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 46 | switch (msk) { |
TsiChung Liew | e7e4fc8 | 2008-10-22 11:38:21 +0000 | [diff] [blame] | 47 | #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 Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 65 | case 0x54: |
| 66 | id = 5329; |
| 67 | break; |
| 68 | case 0x59: |
| 69 | id = 5328; |
| 70 | break; |
| 71 | case 0x61: |
| 72 | id = 5327; |
| 73 | break; |
TsiChungLiew | 6f8a0a3 | 2008-01-14 17:23:08 -0600 | [diff] [blame] | 74 | 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 Liew | e7e4fc8 | 2008-10-22 11:38:21 +0000 | [diff] [blame] | 86 | #endif |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | if (id) { |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 90 | char buf1[32], buf2[32]; |
| 91 | |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 92 | printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk, |
| 93 | ver); |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 94 | printf(" CPU CLK %s MHz BUS CLK %s MHz\n", |
TsiChung Liew | 10e9a6e | 2008-10-22 11:55:30 +0000 | [diff] [blame] | 95 | strmhz(buf1, gd->cpu_clk), |
| 96 | strmhz(buf2, gd->bus_clk)); |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | return 0; |
| 100 | }; |
Angelo Dureghello | 3146b4d | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 101 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
TsiChung Liew | f6afe72 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 102 | |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 103 | #if defined(CONFIG_MCFFEC) |
| 104 | /* Default initializations for MCFFEC controllers. To override, |
| 105 | * create a board-specific function called: |
Wolfgang Denk | 62fb2b4 | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 106 | * int board_eth_init(struct bd_info *bis) |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 107 | */ |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 108 | int cpu_eth_init(struct bd_info *bis) |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 109 | { |
| 110 | return mcffec_initialize(bis); |
| 111 | } |
| 112 | #endif |