debug-uart-ld6b.c 690 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <config.h>
  7. #include <linux/kernel.h>
  8. #include <linux/io.h>
  9. #include "../sc-regs.h"
  10. #include "../sg-regs.h"
  11. #include "debug-uart.h"
  12. #define UNIPHIER_LD6B_UART_CLK 88888888
  13. unsigned int uniphier_ld6b_debug_uart_init(void)
  14. {
  15. u32 tmp;
  16. sg_set_iectrl(0);
  17. sg_set_pinsel(135, 3, 8, 4); /* PORT10 -> TXD0 */
  18. sg_set_pinsel(115, 0, 8, 4); /* TXD1 -> TXD1 */
  19. sg_set_pinsel(113, 2, 8, 4); /* SBO0 -> TXD2 */
  20. tmp = readl(SC_CLKCTRL);
  21. tmp |= SC_CLKCTRL_CEN_PERI;
  22. writel(tmp, SC_CLKCTRL);
  23. return DIV_ROUND_CLOSEST(UNIPHIER_LD6B_UART_CLK, 16 * CONFIG_BAUDRATE);
  24. }