bdinfo.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include <common.h>
  9. #include <init.h>
  10. #include <asm/global_data.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. int arch_setup_bdinfo(void)
  13. {
  14. struct bd_info *bd = gd->bd;
  15. bd->bi_mbar_base = CFG_SYS_MBAR; /* base of internal registers */
  16. bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
  17. bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
  18. if (IS_ENABLED(CONFIG_PCI))
  19. bd->bi_pcifreq = gd->pci_clk;
  20. #if defined(CONFIG_EXTRA_CLOCK)
  21. bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */
  22. bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */
  23. bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */
  24. #endif
  25. return 0;
  26. }
  27. void arch_print_bdinfo(void)
  28. {
  29. struct bd_info *bd = gd->bd;
  30. bdinfo_print_mhz("busfreq", bd->bi_busfreq);
  31. #if defined(CFG_SYS_MBAR)
  32. bdinfo_print_num_l("mbar", bd->bi_mbar_base);
  33. #endif
  34. bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
  35. if (IS_ENABLED(CONFIG_PCI))
  36. bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
  37. #ifdef CONFIG_EXTRA_CLOCK
  38. bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
  39. bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
  40. bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
  41. #endif
  42. }