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