Masahiro Yamada | b4ad44b | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 1 | /* |
| 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 Yamada | a86ac95 | 2015-02-27 02:26:44 +0900 | [diff] [blame] | 11 | #include <mach/sc-regs.h> |
| 12 | #include <mach/sg-regs.h> |
Masahiro Yamada | b4ad44b | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 13 | |
| 14 | #define UART_CLK 73728000 |
Masahiro Yamada | a86ac95 | 2015-02-27 02:26:44 +0900 | [diff] [blame] | 15 | #include <mach/debug-uart.S> |
Masahiro Yamada | b4ad44b | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 16 | |
| 17 | ENTRY(setup_lowlevel_debug) |
| 18 | ldr r0, =SC_CLKCTRL |
| 19 | ldr r1, [r0] |
Masahiro Yamada | f267b81 | 2015-02-27 02:26:50 +0900 | [diff] [blame] | 20 | orr r1, r1, #SC_CLKCTRL_CEN_PERI |
Masahiro Yamada | b4ad44b | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 21 | 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 |
| 39 | ENDPROC(setup_lowlevel_debug) |