blob: cf6ae5adddfdcf97e0432e555bc1bca00fc98797 [file] [log] [blame]
Simon Glassf1e36072020-05-10 14:16:58 -06001// 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 Rini3cb9c372023-10-12 19:03:56 -04009#include <config.h>
Simon Glassf1e36072020-05-10 14:16:58 -060010#include <init.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060011#include <asm/global_data.h>
Simon Glassf1e36072020-05-10 14:16:58 -060012
13DECLARE_GLOBAL_DATA_PTR;
14
Ovidiu Panaitf8a961b2020-07-24 14:12:18 +030015int arch_setup_bdinfo(void)
16{
17 struct bd_info *bd = gd->bd;
18
Tom Rini6a5dccc2022-11-16 13:10:41 -050019 bd->bi_mbar_base = CFG_SYS_MBAR; /* base of internal registers */
Ovidiu Panaitf8a961b2020-07-24 14:12:18 +030020
21 bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
22 bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
23
24 if (IS_ENABLED(CONFIG_PCI))
25 bd->bi_pcifreq = gd->pci_clk;
26
27#if defined(CONFIG_EXTRA_CLOCK)
28 bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */
29 bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */
30 bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */
31#endif
32
33 return 0;
34}
35
Simon Glassf1e36072020-05-10 14:16:58 -060036void arch_print_bdinfo(void)
37{
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +090038 struct bd_info *bd = gd->bd;
Simon Glassf1e36072020-05-10 14:16:58 -060039
Simon Glass227b24b2020-05-10 14:16:59 -060040 bdinfo_print_mhz("busfreq", bd->bi_busfreq);
Tom Rini6a5dccc2022-11-16 13:10:41 -050041#if defined(CFG_SYS_MBAR)
Bin Meng1ae7a0c2021-01-31 20:36:05 +080042 bdinfo_print_num_l("mbar", bd->bi_mbar_base);
Simon Glassf1e36072020-05-10 14:16:58 -060043#endif
44 bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
45 if (IS_ENABLED(CONFIG_PCI))
46 bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
47#ifdef CONFIG_EXTRA_CLOCK
48 bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
49 bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
50 bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
51#endif
52}