bcm_console.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <common/debug.h>
  8. #include <drivers/console.h>
  9. #include <drivers/ti/uart/uart_16550.h>
  10. #include <platform_def.h>
  11. /*******************************************************************************
  12. * Functions that set up the console
  13. ******************************************************************************/
  14. static console_t bcm_boot_console;
  15. static console_t bcm_runtime_console;
  16. /* Initialize the console to provide early debug support */
  17. void bcm_console_boot_init(void)
  18. {
  19. int rc = console_16550_register(PLAT_BRCM_BOOT_UART_BASE,
  20. PLAT_BRCM_BOOT_UART_CLK_IN_HZ,
  21. BRCM_CONSOLE_BAUDRATE,
  22. &bcm_boot_console);
  23. if (rc == 0) {
  24. /*
  25. * The crash console doesn't use the multi console API, it uses
  26. * the core console functions directly. It is safe to call panic
  27. * and let it print debug information.
  28. */
  29. panic();
  30. }
  31. console_set_scope(&bcm_boot_console, CONSOLE_FLAG_BOOT);
  32. }
  33. void bcm_console_boot_end(void)
  34. {
  35. console_flush();
  36. (void)console_unregister(&bcm_boot_console);
  37. }
  38. /* Initialize the runtime console */
  39. void bcm_console_runtime_init(void)
  40. {
  41. int rc = console_16550_register(PLAT_BRCM_BL31_RUN_UART_BASE,
  42. PLAT_BRCM_BL31_RUN_UART_CLK_IN_HZ,
  43. BRCM_CONSOLE_BAUDRATE,
  44. &bcm_runtime_console);
  45. if (rc == 0)
  46. panic();
  47. console_set_scope(&bcm_runtime_console, CONSOLE_FLAG_RUNTIME);
  48. }
  49. void bcm_console_runtime_end(void)
  50. {
  51. console_flush();
  52. (void)console_unregister(&bcm_runtime_console);
  53. }