spl.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2018 NXP
  4. *
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <init.h>
  9. #include <log.h>
  10. #include <spl.h>
  11. #include <dm/uclass.h>
  12. #include <dm/device.h>
  13. #include <dm/uclass-internal.h>
  14. #include <dm/device-internal.h>
  15. #include <dm/lists.h>
  16. DECLARE_GLOBAL_DATA_PTR;
  17. void spl_board_init(void)
  18. {
  19. struct udevice *dev;
  20. int offset;
  21. uclass_find_first_device(UCLASS_MISC, &dev);
  22. for (; dev; uclass_find_next_device(&dev)) {
  23. if (device_probe(dev))
  24. continue;
  25. }
  26. offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "nxp,imx8-pd");
  27. while (offset != -FDT_ERR_NOTFOUND) {
  28. lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
  29. NULL, true);
  30. offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset,
  31. "nxp,imx8-pd");
  32. }
  33. uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev);
  34. for (; dev; uclass_find_next_device(&dev)) {
  35. if (device_probe(dev))
  36. continue;
  37. }
  38. arch_cpu_init();
  39. board_early_init_f();
  40. timer_init();
  41. preloader_console_init();
  42. puts("Normal Boot\n");
  43. }
  44. #if (IS_ENABLED(CONFIG_SPL_LOAD_FIT))
  45. int board_fit_config_name_match(const char *name)
  46. {
  47. /* Just empty function now - can't decide what to choose */
  48. debug("%s: %s\n", __func__, name);
  49. return 0;
  50. }
  51. #endif
  52. void board_init_f(ulong dummy)
  53. {
  54. /* Clear global data */
  55. memset((void *)gd, 0, sizeof(gd_t));
  56. /* Clear the BSS. */
  57. memset(__bss_start, 0, __bss_end - __bss_start);
  58. board_init_r(NULL, 0);
  59. }