blob: f64ff39c9e658dd1eaccf2d8f3364e0b62ce63de [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada52f0c512016-03-18 16:41:52 +09002/*
3 * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada52f0c512016-03-18 16:41:52 +09004 */
5
6#include <config.h>
7#include <linux/kernel.h>
8#include <linux/io.h>
9
10#include "../sc-regs.h"
11#include "../sg-regs.h"
12#include "debug-uart.h"
13
14#define UNIPHIER_LD6B_UART_CLK 88888888
15
16unsigned int uniphier_ld6b_debug_uart_init(void)
17{
18 u32 tmp;
19
20 sg_set_iectrl(0);
21 sg_set_pinsel(135, 3, 8, 4); /* PORT10 -> TXD0 */
22 sg_set_pinsel(115, 0, 8, 4); /* TXD1 -> TXD1 */
23 sg_set_pinsel(113, 2, 8, 4); /* SBO0 -> TXD2 */
24
Masahiro Yamadac84024c2019-07-10 20:07:41 +090025 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamada52f0c512016-03-18 16:41:52 +090026 tmp |= SC_CLKCTRL_CEN_PERI;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090027 writel(tmp, sc_base + SC_CLKCTRL);
Masahiro Yamada52f0c512016-03-18 16:41:52 +090028
29 return DIV_ROUND_CLOSEST(UNIPHIER_LD6B_UART_CLK, 16 * CONFIG_BAUDRATE);
30}