Skip to content

Commit d8a0091

Browse files
carlocaionearndb
authored andcommitted
ARM: meson: debug: add debug UART for earlyprintk support
Add the UART definitions needed to support earlyprintk for MesonX SoCs on UARTAO. Signed-off-by: Carlo Caione <carlo@caione.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 4fdea26 commit d8a0091

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

‎arch/arm/Kconfig.debug‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,13 @@ choice
356356
Say Y here if you want the debug print routines to direct
357357
their output to UART1 serial port on KEYSTONE2 devices.
358358

359+
config DEBUG_MESON_UARTAO
360+
bool "Kernel low-level debugging via Meson6 UARTAO"
361+
depends on ARCH_MESON
362+
help
363+
Say Y here if you want kernel low-lever debugging support
364+
on Amlogic Meson6 based platforms on the UARTAO.
365+
359366
config DEBUG_MMP_UART2
360367
bool "Kernel low-level debugging message via MMP UART2"
361368
depends on ARCH_MMP
@@ -1027,6 +1034,7 @@ config DEBUG_LL_INCLUDE
10271034
string
10281035
default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
10291036
default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2
1037+
default "debug/meson.S" if DEBUG_MESON_UARTAO
10301038
default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
10311039
default "debug/exynos.S" if DEBUG_EXYNOS_UART
10321040
default "debug/efm32.S" if DEBUG_LL_UART_EFM32
@@ -1123,6 +1131,7 @@ config DEBUG_UART_PHYS
11231131
default 0xc8000003 if ARCH_IXP4XX && CPU_BIG_ENDIAN
11241132
default 0xd0000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX
11251133
default 0xd0012000 if DEBUG_MVEBU_UART
1134+
default 0xc81004c0 if DEBUG_MESON_UARTAO
11261135
default 0xd4017000 if DEBUG_MMP_UART2
11271136
default 0xd4018000 if DEBUG_MMP_UART3
11281137
default 0xe0000000 if ARCH_SPEAR13XX
@@ -1143,7 +1152,7 @@ config DEBUG_UART_PHYS
11431152
default 0xfffff700 if ARCH_IOP33X
11441153
depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
11451154
DEBUG_LL_UART_EFM32 || \
1146-
DEBUG_UART_8250 || DEBUG_UART_PL01X || \
1155+
DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
11471156
DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART
11481157

11491158
config DEBUG_UART_VIRT
@@ -1182,6 +1191,7 @@ config DEBUG_UART_VIRT
11821191
default 0xfd012000 if ARCH_MV78XX0
11831192
default 0xfde12000 if ARCH_DOVE
11841193
default 0xfe012000 if ARCH_ORION5X
1194+
default 0xf31004c0 if DEBUG_MESON_UARTAO
11851195
default 0xfe017000 if DEBUG_MMP_UART2
11861196
default 0xfe018000 if DEBUG_MMP_UART3
11871197
default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART
@@ -1213,7 +1223,7 @@ config DEBUG_UART_VIRT
12131223
default 0xff003000 if DEBUG_U300_UART
12141224
default DEBUG_UART_PHYS if !MMU
12151225
depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1216-
DEBUG_UART_8250 || DEBUG_UART_PL01X || \
1226+
DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
12171227
DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART
12181228

12191229
config DEBUG_UART_8250_SHIFT

‎arch/arm/include/debug/meson.S‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (C) 2014 Carlo Caione
3+
* Carlo Caione <carlo@caione.org>
4+
*
5+
* This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License version 2 as
7+
* published by the Free Software Foundation.
8+
*/
9+
10+
#define MESON_AO_UART_WFIFO 0x0
11+
#define MESON_AO_UART_STATUS 0xc
12+
13+
#define MESON_AO_UART_TX_FIFO_EMPTY (1 << 22)
14+
#define MESON_AO_UART_TX_FIFO_FULL (1 << 21)
15+
16+
.macro addruart, rp, rv, tmp
17+
ldr \rp, =(CONFIG_DEBUG_UART_PHYS) @ physical
18+
ldr \rv, =(CONFIG_DEBUG_UART_VIRT) @ virtual
19+
.endm
20+
21+
.macro senduart,rd,rx
22+
str \rd, [\rx, #MESON_AO_UART_WFIFO]
23+
.endm
24+
25+
.macro busyuart,rd,rx
26+
1002: ldr \rd, [\rx, #MESON_AO_UART_STATUS]
27+
tst \rd, #MESON_AO_UART_TX_FIFO_EMPTY
28+
beq 1002b
29+
.endm
30+
31+
.macro waituart,rd,rx
32+
1001: ldr \rd, [\rx, #MESON_AO_UART_STATUS]
33+
tst \rd, #MESON_AO_UART_TX_FIFO_FULL
34+
bne 1001b
35+
.endm

0 commit comments

Comments
 (0)