Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | 8ae158c | 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 | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 7 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 8 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
Simon Glass | 691d719 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 12 | #include <init.h> |
Simon Glass | 90526e9 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 13 | #include <net.h> |
Simon Glass | 2189d5f | 2019-11-14 12:57:20 -0700 | [diff] [blame] | 14 | #include <vsprintf.h> |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 15 | #include <watchdog.h> |
| 16 | #include <command.h> |
Ben Warren | 89973f8 | 2008-08-31 22:22:04 -0700 | [diff] [blame] | 17 | #include <netdev.h> |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 18 | |
| 19 | #include <asm/immap.h> |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 20 | #include <asm/io.h> |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 24 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 25 | { |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 26 | rcm_t *rcm = (rcm_t *) (MMAP_RCM); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 27 | udelay(1000); |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 28 | out_8(&rcm->rcr, RCM_RCR_FRCRSTOUT); |
| 29 | udelay(10000); |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 30 | setbits_8(&rcm->rcr, RCM_RCR_SOFTRST); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 31 | |
| 32 | /* we don't return! */ |
| 33 | return 0; |
| 34 | }; |
| 35 | |
Angelo Dureghello | b9153fe3 | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 36 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 37 | int print_cpuinfo(void) |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 38 | { |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 39 | ccm_t *ccm = (ccm_t *) MMAP_CCM; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 40 | u16 msk; |
| 41 | u16 id = 0; |
| 42 | u8 ver; |
| 43 | |
| 44 | puts("CPU: "); |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 45 | msk = (in_be16(&ccm->cir) >> 6); |
| 46 | ver = (in_be16(&ccm->cir) & 0x003f); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 47 | 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 Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 66 | 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; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | if (id) { |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 84 | char buf1[32], buf2[32], buf3[32]; |
| 85 | |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 86 | printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk, |
| 87 | ver); |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 88 | 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 Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 91 | strmhz(buf3, gd->arch.flb_clk)); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 92 | #ifdef CONFIG_PCI |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 93 | printf(" PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n", |
| 94 | strmhz(buf1, gd->pci_clk), |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 95 | strmhz(buf2, gd->arch.inp_clk), |
| 96 | strmhz(buf3, gd->arch.vco_clk)); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 97 | #else |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 98 | printf(" INP CLK %s MHz VCO CLK %s MHz\n", |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 99 | strmhz(buf1, gd->arch.inp_clk), |
| 100 | strmhz(buf2, gd->arch.vco_clk)); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 101 | #endif |
| 102 | } |
| 103 | |
| 104 | return 0; |
| 105 | } |
Angelo Dureghello | b9153fe3 | 2017-08-20 00:01:55 +0200 | [diff] [blame] | 106 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
Ben Warren | 86882b8 | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 107 | |
| 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 Warren | 86882b8 | 2008-08-26 22:16:25 -0700 | [diff] [blame] | 114 | int cpu_eth_init(bd_t *bis) |
| 115 | { |
| 116 | return mcffec_initialize(bis); |
| 117 | } |
| 118 | #endif |