Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * PPC-specific information for the 'bd' command |
| 4 | * |
| 5 | * (C) Copyright 2003 |
| 6 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <init.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 11 | #include <asm/global_data.h> |
Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 12 | |
| 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
Ovidiu Panait | 399aeb6 | 2020-07-24 14:12:19 +0300 | [diff] [blame] | 15 | int arch_setup_bdinfo(void) |
| 16 | { |
| 17 | struct bd_info *bd = gd->bd; |
| 18 | |
| 19 | #if defined(CONFIG_E500) || defined(CONFIG_MPC86xx) |
| 20 | bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */ |
| 21 | #endif |
| 22 | |
| 23 | #if defined(CONFIG_MPC83xx) |
| 24 | bd->bi_immrbar = CONFIG_SYS_IMMR; |
| 25 | #endif |
| 26 | |
| 27 | bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */ |
| 28 | bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */ |
| 29 | |
| 30 | #if defined(CONFIG_CPM2) |
| 31 | bd->bi_cpmfreq = gd->arch.cpm_clk; |
| 32 | bd->bi_brgfreq = gd->arch.brg_clk; |
| 33 | bd->bi_sccfreq = gd->arch.scc_clk; |
| 34 | bd->bi_vco = gd->arch.vco_out; |
| 35 | #endif /* CONFIG_CPM2 */ |
| 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | |
Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 40 | void __weak board_detail(void) |
| 41 | { |
| 42 | /* Please define board_detail() for your PPC platform */ |
| 43 | } |
| 44 | |
| 45 | void arch_print_bdinfo(void) |
| 46 | { |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 47 | struct bd_info *bd = gd->bd; |
Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 48 | |
Simon Glass | 227b24b | 2020-05-10 14:16:59 -0600 | [diff] [blame] | 49 | bdinfo_print_mhz("busfreq", bd->bi_busfreq); |
Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 50 | #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) |
Bin Meng | 1ae7a0c | 2021-01-31 20:36:05 +0800 | [diff] [blame] | 51 | bdinfo_print_num_l("immr_base", bd->bi_immr_base); |
Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 52 | #endif |
Bin Meng | 1ae7a0c | 2021-01-31 20:36:05 +0800 | [diff] [blame] | 53 | bdinfo_print_num_l("bootflags", bd->bi_bootflags); |
Simon Glass | 5233da5 | 2020-05-10 14:16:57 -0600 | [diff] [blame] | 54 | bdinfo_print_mhz("intfreq", bd->bi_intfreq); |
| 55 | #ifdef CONFIG_ENABLE_36BIT_PHYS |
| 56 | if (IS_ENABLED(CONFIG_PHYS_64BIT)) |
| 57 | puts("addressing = 36-bit\n"); |
| 58 | else |
| 59 | puts("addressing = 32-bit\n"); |
| 60 | #endif |
| 61 | board_detail(); |
| 62 | #if defined(CONFIG_CPM2) |
| 63 | bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq); |
| 64 | bdinfo_print_mhz("vco", bd->bi_vco); |
| 65 | bdinfo_print_mhz("sccfreq", bd->bi_sccfreq); |
| 66 | bdinfo_print_mhz("brgfreq", bd->bi_brgfreq); |
| 67 | #endif |
| 68 | } |