Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * (C) Copyright 2000-2003 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 6 | * |
Alison Wang | 8d8dac9 | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 7 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 8 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 12 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 13 | #include <net.h> |
Simon Glass | f5c208d | 2019-11-14 12:57:20 -0700 | [diff] [blame] | 14 | #include <vsprintf.h> |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 15 | #include <watchdog.h> |
| 16 | #include <command.h> |
Ben Warren | 2f2b6b6 | 2008-08-31 22:22:04 -0700 | [diff] [blame] | 17 | #include <netdev.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 18 | #include <asm/global_data.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 19 | #include <linux/delay.h> |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 20 | |
| 21 | #include <asm/immap.h> |
Alison Wang | 8d8dac9 | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 22 | #include <asm/io.h> |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 23 | |
| 24 | DECLARE_GLOBAL_DATA_PTR; |
| 25 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 26 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 27 | { |
Alison Wang | 8d8dac9 | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 28 | rcm_t *rcm = (rcm_t *) (MMAP_RCM); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 29 | udelay(1000); |
Alison Wang | fdc2fb1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 30 | out_8(&rcm->rcr, RCM_RCR_FRCRSTOUT); |
| 31 | udelay(10000); |
Alison Wang | 8d8dac9 | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 32 | setbits_8(&rcm->rcr, RCM_RCR_SOFTRST); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 33 | |
| 34 | /* we don't return! */ |
| 35 | return 0; |
| 36 | }; |
| 37 | |
Angelo Dureghello | 3146b4d | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 38 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 39 | int print_cpuinfo(void) |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 40 | { |
Alison Wang | 8d8dac9 | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 41 | ccm_t *ccm = (ccm_t *) MMAP_CCM; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 42 | u16 msk; |
| 43 | u16 id = 0; |
| 44 | u8 ver; |
| 45 | |
| 46 | puts("CPU: "); |
Alison Wang | 8d8dac9 | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 47 | msk = (in_be16(&ccm->cir) >> 6); |
| 48 | ver = (in_be16(&ccm->cir) & 0x003f); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 49 | switch (msk) { |
| 50 | case 0x48: |
| 51 | id = 54455; |
| 52 | break; |
| 53 | case 0x49: |
| 54 | id = 54454; |
| 55 | break; |
| 56 | case 0x4a: |
| 57 | id = 54453; |
| 58 | break; |
| 59 | case 0x4b: |
| 60 | id = 54452; |
| 61 | break; |
| 62 | case 0x4d: |
| 63 | id = 54451; |
| 64 | break; |
| 65 | case 0x4f: |
| 66 | id = 54450; |
| 67 | break; |
Alison Wang | fdc2fb1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 68 | case 0x9F: |
| 69 | id = 54410; |
| 70 | break; |
| 71 | case 0xA0: |
| 72 | id = 54415; |
| 73 | break; |
| 74 | case 0xA1: |
| 75 | id = 54416; |
| 76 | break; |
| 77 | case 0xA2: |
| 78 | id = 54417; |
| 79 | break; |
| 80 | case 0xA3: |
| 81 | id = 54418; |
| 82 | break; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | if (id) { |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 86 | char buf1[32], buf2[32], buf3[32]; |
| 87 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 88 | printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk, |
| 89 | ver); |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 90 | printf(" CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n", |
| 91 | strmhz(buf1, gd->cpu_clk), |
| 92 | strmhz(buf2, gd->bus_clk), |
Simon Glass | 568a7b6 | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 93 | strmhz(buf3, gd->arch.flb_clk)); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 94 | #ifdef CONFIG_PCI |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 95 | printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n", |
| 96 | strmhz(buf1, gd->pci_clk), |
Simon Glass | 568a7b6 | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 97 | strmhz(buf2, gd->arch.inp_clk), |
| 98 | strmhz(buf3, gd->arch.vco_clk)); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 99 | #else |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 100 | printf(" INP CLK %s MHz VCO CLK %s MHz\n", |
Simon Glass | 568a7b6 | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 101 | strmhz(buf1, gd->arch.inp_clk), |
| 102 | strmhz(buf2, gd->arch.vco_clk)); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 103 | #endif |
| 104 | } |
| 105 | |
| 106 | return 0; |
| 107 | } |
Angelo Dureghello | 3146b4d | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 108 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 109 | |
| 110 | #if defined(CONFIG_MCFFEC) |
| 111 | /* Default initializations for MCFFEC controllers. To override, |
| 112 | * create a board-specific function called: |
Wolfgang Denk | 62fb2b4 | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 113 | * int board_eth_init(struct bd_info *bis) |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 114 | */ |
| 115 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 116 | int cpu_eth_init(struct bd_info *bis) |
Ben Warren | 90c96db | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 117 | { |
| 118 | return mcffec_initialize(bis); |
| 119 | } |
| 120 | #endif |