console_16550.c 694 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright 2021 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include <assert.h>
  8. #include <common/debug.h>
  9. #include <dcfg.h>
  10. #include <lib/utils.h>
  11. #include <plat_console.h>
  12. /*
  13. * Perform Arm specific early platform setup. At this moment we only initialize
  14. * the console and the memory layout.
  15. */
  16. void plat_console_init(uintptr_t nxp_console_addr, uint32_t uart_clk_div,
  17. uint32_t baud)
  18. {
  19. struct sysinfo sys;
  20. static console_t nxp_console;
  21. zeromem(&sys, sizeof(sys));
  22. if (get_clocks(&sys)) {
  23. ERROR("System clocks are not set\n");
  24. panic();
  25. }
  26. nxp_console_16550_register(nxp_console_addr,
  27. (sys.freq_platform/uart_clk_div),
  28. baud, &nxp_console);
  29. }