board_info.c 608 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * SPDX-License-Identifier: GPL-2.0+
  3. */
  4. #include <common.h>
  5. #include <libfdt.h>
  6. #include <linux/compiler.h>
  7. int __weak checkboard(void)
  8. {
  9. printf("Board: Unknown\n");
  10. return 0;
  11. }
  12. /*
  13. * If the root node of the DTB has a "model" property, show it.
  14. * If CONFIG_OF_CONTROL is disabled or the "model" property is missing,
  15. * fall back to checkboard().
  16. */
  17. int show_board_info(void)
  18. {
  19. #ifdef CONFIG_OF_CONTROL
  20. DECLARE_GLOBAL_DATA_PTR;
  21. const char *model;
  22. model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
  23. if (model) {
  24. printf("Model: %s\n", model);
  25. return 0;
  26. }
  27. #endif
  28. return checkboard();
  29. }