blob: 508318a6820c2da9da268bbaf773896ddaff75a8 [file] [log] [blame]
Masahiro Yamadad5cf3292016-03-18 16:41:52 +09001/*
2 * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <config.h>
8#include <linux/kernel.h>
9#include <linux/io.h>
10
11#include "../bcu/bcu-regs.h"
12#include "../sc-regs.h"
13#include "../sg-regs.h"
14#include "debug-uart.h"
15
16#define UNIPHIER_SLD3_UART_CLK 36864000
17
18unsigned int uniphier_sld3_debug_uart_init(void)
19{
20 u32 tmp;
21
22 sg_set_pinsel(64, 1, 4, 4); /* TXD0 -> TXD0 */
23
24 writel(0x24440000, BCSCR5);
25
26 tmp = readl(SC_CLKCTRL);
27 tmp |= SC_CLKCTRL_CEN_PERI;
28 writel(tmp, SC_CLKCTRL);
29
30 return DIV_ROUND_CLOSEST(UNIPHIER_SLD3_UART_CLK, 16 * CONFIG_BAUDRATE);
31}