board.c 828 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
  2. /*
  3. * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
  4. */
  5. #include <common.h>
  6. #include <asm/io.h>
  7. #include <linux/bitops.h>
  8. #include <linux/delay.h>
  9. #ifdef CONFIG_DEBUG_UART_BOARD_INIT
  10. void board_debug_uart_init(void)
  11. {
  12. #if (CONFIG_DEBUG_UART_BASE == STM32_UART4_BASE)
  13. #define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00)
  14. #define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28)
  15. /* UART4 clock enable */
  16. setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
  17. #define GPIOG_BASE 0x50008000
  18. /* GPIOG clock enable */
  19. writel(BIT(6), RCC_MP_AHB4ENSETR);
  20. /* GPIO configuration for EVAL board
  21. * => Uart4 TX = G11
  22. */
  23. writel(0xffbfffff, GPIOG_BASE + 0x00);
  24. writel(0x00006000, GPIOG_BASE + 0x24);
  25. #else
  26. #error("CONFIG_DEBUG_UART_BASE: not supported value")
  27. #endif
  28. }
  29. #endif