xref: /OK3568_Linux_fs/u-boot/arch/arm/mach-uniphier/debug-uart/debug-uart-ld4.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <config.h>
8*4882a593Smuzhiyun #include <linux/kernel.h>
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include "../sg-regs.h"
11*4882a593Smuzhiyun #include "debug-uart.h"
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #define UNIPHIER_LD4_UART_CLK		36864000
14*4882a593Smuzhiyun 
uniphier_ld4_debug_uart_init(void)15*4882a593Smuzhiyun unsigned int uniphier_ld4_debug_uart_init(void)
16*4882a593Smuzhiyun {
17*4882a593Smuzhiyun 	sg_set_iectrl(0);
18*4882a593Smuzhiyun 	sg_set_pinsel(88, 1, 8, 4);	/* HSDOUT6 -> TXD0 */
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun 	return DIV_ROUND_CLOSEST(UNIPHIER_LD4_UART_CLK, 16 * CONFIG_BAUDRATE);
21*4882a593Smuzhiyun }
22