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#include <asm/global_data.h>
12
13DECLARE_GLOBAL_DATA_PTR;
14
15int 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	return 0;
31}
32
33void __weak board_detail(void)
34{
35	/* Please define board_detail() for your PPC platform */
36}
37
38void arch_print_bdinfo(void)
39{
40	struct bd_info *bd = gd->bd;
41
42	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
43#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
44	bdinfo_print_num_l("immr_base", bd->bi_immr_base);
45#endif
46	bdinfo_print_num_l("bootflags", bd->bi_bootflags);
47	bdinfo_print_mhz("intfreq", bd->bi_intfreq);
48#ifdef CONFIG_ENABLE_36BIT_PHYS
49	if (IS_ENABLED(CONFIG_PHYS_64BIT))
50		puts("addressing  = 36-bit\n");
51	else
52		puts("addressing  = 32-bit\n");
53#endif
54	board_detail();
55}
56