blob: fcaf6d12d8db1732d2fd9a9caba45347f39290b8 [file] [log] [blame]
Masahiro Yamadab4ad44b2015-01-06 14:28:16 +09001/*
2 * On-chip UART initializaion for low-level debugging
3 *
4 * Copyright (C) 2014 Panasonic Corporation
5 * Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9
10#include <linux/linkage.h>
Masahiro Yamadaa86ac952015-02-27 02:26:44 +090011#include <mach/sc-regs.h>
12#include <mach/sg-regs.h>
Masahiro Yamadab4ad44b2015-01-06 14:28:16 +090013
14#define UART_CLK 73728000
Masahiro Yamadaa86ac952015-02-27 02:26:44 +090015#include <mach/debug-uart.S>
Masahiro Yamadab4ad44b2015-01-06 14:28:16 +090016
17ENTRY(setup_lowlevel_debug)
18 ldr r0, =SC_CLKCTRL
19 ldr r1, [r0]
Masahiro Yamadaf267b812015-02-27 02:26:50 +090020 orr r1, r1, #SC_CLKCTRL_CEN_PERI
Masahiro Yamadab4ad44b2015-01-06 14:28:16 +090021 str r1, [r0]
22
23 init_debug_uart r0, r1, r2
24
25 /* UART Port 0 */
26 set_pinsel 127, 0, r0, r1
27 set_pinsel 128, 0, r0, r1
28
29 ldr r0, =SG_LOADPINCTRL
30 mov r1, #1
31 str r1, [r0]
32
33 ldr r0, =SG_IECTRL
34 ldr r1, [r0]
35 orr r1, r1, #1
36 str r1, [r0]
37
38 mov pc, lr
39ENDPROC(setup_lowlevel_debug)