Simon Glass | f1e3607 | 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 | |
Tom Rini | 3cb9c37 | 2023-10-12 19:03:56 -0400 | [diff] [blame^] | 9 | #include <config.h> |
Simon Glass | f1e3607 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 10 | #include <init.h> |
Tom Rini | 3cb9c37 | 2023-10-12 19:03:56 -0400 | [diff] [blame^] | 11 | #include <asm/u-boot.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 12 | #include <asm/global_data.h> |
Simon Glass | f1e3607 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
Ovidiu Panait | f8a961b | 2020-07-24 14:12:18 +0300 | [diff] [blame] | 16 | int arch_setup_bdinfo(void) |
| 17 | { |
| 18 | struct bd_info *bd = gd->bd; |
| 19 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 20 | bd->bi_mbar_base = CFG_SYS_MBAR; /* base of internal registers */ |
Ovidiu Panait | f8a961b | 2020-07-24 14:12:18 +0300 | [diff] [blame] | 21 | |
| 22 | bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */ |
| 23 | bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */ |
| 24 | |
| 25 | if (IS_ENABLED(CONFIG_PCI)) |
| 26 | bd->bi_pcifreq = gd->pci_clk; |
| 27 | |
| 28 | #if defined(CONFIG_EXTRA_CLOCK) |
| 29 | bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */ |
| 30 | bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */ |
| 31 | bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */ |
| 32 | #endif |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | |
Simon Glass | f1e3607 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 37 | void arch_print_bdinfo(void) |
| 38 | { |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 39 | struct bd_info *bd = gd->bd; |
Simon Glass | f1e3607 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 40 | |
Simon Glass | 227b24b | 2020-05-10 14:16:59 -0600 | [diff] [blame] | 41 | bdinfo_print_mhz("busfreq", bd->bi_busfreq); |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 42 | #if defined(CFG_SYS_MBAR) |
Bin Meng | 1ae7a0c | 2021-01-31 20:36:05 +0800 | [diff] [blame] | 43 | bdinfo_print_num_l("mbar", bd->bi_mbar_base); |
Simon Glass | f1e3607 | 2020-05-10 14:16:58 -0600 | [diff] [blame] | 44 | #endif |
| 45 | bdinfo_print_mhz("cpufreq", bd->bi_intfreq); |
| 46 | if (IS_ENABLED(CONFIG_PCI)) |
| 47 | bdinfo_print_mhz("pcifreq", bd->bi_pcifreq); |
| 48 | #ifdef CONFIG_EXTRA_CLOCK |
| 49 | bdinfo_print_mhz("flbfreq", bd->bi_flbfreq); |
| 50 | bdinfo_print_mhz("inpfreq", bd->bi_inpfreq); |
| 51 | bdinfo_print_mhz("vcofreq", bd->bi_vcofreq); |
| 52 | #endif |
| 53 | } |