Simon Glass | 1a520d9 | 2020-05-10 14:16:58 -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> |
| 11 | |
| 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
Ovidiu Panait | ee9c3ad | 2020-07-24 14:12:18 +0300 | [diff] [blame] | 14 | int arch_setup_bdinfo(void) |
| 15 | { |
| 16 | struct bd_info *bd = gd->bd; |
| 17 | |
| 18 | bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */ |
| 19 | |
| 20 | bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */ |
| 21 | bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */ |
| 22 | |
| 23 | if (IS_ENABLED(CONFIG_PCI)) |
| 24 | bd->bi_pcifreq = gd->pci_clk; |
| 25 | |
| 26 | #if defined(CONFIG_EXTRA_CLOCK) |
| 27 | bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */ |
| 28 | bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */ |
| 29 | bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */ |
| 30 | #endif |
| 31 | |
| 32 | return 0; |
| 33 | } |
| 34 | |
Simon Glass | 1a520d9 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 35 | void arch_print_bdinfo(void) |
| 36 | { |
Masahiro Yamada | b75d8dc | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 37 | struct bd_info *bd = gd->bd; |
Simon Glass | 1a520d9 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 38 | |
Simon Glass | 6479198 | 2020-05-10 14:16:59 -0600 | [diff] [blame] | 39 | bdinfo_print_mhz("busfreq", bd->bi_busfreq); |
Simon Glass | 1a520d9 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 40 | #if defined(CONFIG_SYS_MBAR) |
| 41 | bdinfo_print_num("mbar", bd->bi_mbar_base); |
| 42 | #endif |
| 43 | bdinfo_print_mhz("cpufreq", bd->bi_intfreq); |
| 44 | if (IS_ENABLED(CONFIG_PCI)) |
| 45 | bdinfo_print_mhz("pcifreq", bd->bi_pcifreq); |
| 46 | #ifdef CONFIG_EXTRA_CLOCK |
| 47 | bdinfo_print_mhz("flbfreq", bd->bi_flbfreq); |
| 48 | bdinfo_print_mhz("inpfreq", bd->bi_inpfreq); |
| 49 | bdinfo_print_mhz("vcofreq", bd->bi_vcofreq); |
| 50 | #endif |
| 51 | } |