Skip to content

Commit 5026aec

Browse files
Srinivas-Kandagatlaolofj
authored andcommitted
ARM: sti: Add DEBUG_LL console support
This patch adds low level debug uart support to sti based SOCs. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> CC: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Olof Johansson <olof@lixom.net>
1 parent 15969b4 commit 5026aec

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

‎arch/arm/Kconfig.debug‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,16 @@ choice
483483
This option selects UART0 on VIA/Wondermedia System-on-a-chip
484484
devices, including VT8500, WM8505, WM8650 and WM8850.
485485

486+
config DEBUG_STI_UART
487+
depends on ARCH_STI
488+
bool "Use StiH415/416 ASC for low-level debug"
489+
help
490+
Say Y here if you want kernel low-level debugging support
491+
on StiH415/416 based platforms like B2000, B2020.
492+
It support UART2 and SBC_UART1.
493+
494+
If unsure, say N.
495+
486496
config DEBUG_LL_UART_NONE
487497
bool "No low-level debugging UART"
488498
depends on !ARCH_MULTIPLATFORM
@@ -617,6 +627,30 @@ choice
617627

618628
endchoice
619629

630+
choice
631+
prompt "Low-level debug console UART"
632+
depends on DEBUG_LL && DEBUG_STI_UART
633+
634+
config STIH41X_DEBUG_ASC2
635+
bool "ASC2 UART"
636+
help
637+
Say Y here if you want kernel low-level debugging support
638+
on STiH415/416 based platforms like b2000, which has
639+
default UART wired up to ASC2.
640+
641+
If unsure, say N.
642+
643+
config STIH41X_DEBUG_SBC_ASC1
644+
bool "SBC ASC1 UART"
645+
help
646+
Say Y here if you want kernel low-level debugging support
647+
on STiH415/416 based platforms like b2020. which has
648+
default UART wired up to SBC ASC1.
649+
650+
If unsure, say N.
651+
652+
endchoice
653+
620654
config DEBUG_LL_INCLUDE
621655
string
622656
default "debug/bcm2835.S" if DEBUG_BCM2835
@@ -641,6 +675,7 @@ config DEBUG_LL_INCLUDE
641675
DEBUG_MMP_UART3
642676
default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
643677
default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
678+
default "debug/sti.S" if DEBUG_STI_UART
644679
default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
645680
default "debug/tegra.S" if DEBUG_TEGRA_UART
646681
default "debug/ux500.S" if DEBUG_UX500_UART

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

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* arch/arm/include/debug/sti.S
3+
*
4+
* Debugging macro include header
5+
* Copyright (C) 2013 STMicroelectronics (R&D) Limited.
6+
*
7+
* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License version 2 as
9+
* published by the Free Software Foundation.
10+
*/
11+
12+
#define STIH41X_COMMS_BASE 0xfed00000
13+
#define STIH41X_ASC2_BASE (STIH41X_COMMS_BASE+0x32000)
14+
15+
#define STIH41X_SBC_LPM_BASE 0xfe400000
16+
#define STIH41X_SBC_COMMS_BASE (STIH41X_SBC_LPM_BASE + 0x100000)
17+
#define STIH41X_SBC_ASC1_BASE (STIH41X_SBC_COMMS_BASE + 0x31000)
18+
19+
20+
#define VIRT_ADDRESS(x) (x - 0x1000000)
21+
22+
#if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
23+
#define DEBUG_LL_UART_BASE STIH41X_ASC2_BASE
24+
#endif
25+
26+
#if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
27+
#define DEBUG_LL_UART_BASE STIH41X_SBC_ASC1_BASE
28+
#endif
29+
30+
#ifndef DEBUG_LL_UART_BASE
31+
#error "DEBUG UART is not Configured"
32+
#endif
33+
34+
#define ASC_TX_BUF_OFF 0x04
35+
#define ASC_CTRL_OFF 0x0c
36+
#define ASC_STA_OFF 0x14
37+
38+
#define ASC_STA_TX_FULL (1<<9)
39+
#define ASC_STA_TX_EMPTY (1<<1)
40+
41+
42+
.macro addruart, rp, rv, tmp
43+
ldr \rp, =DEBUG_LL_UART_BASE @ physical base
44+
ldr \rv, =VIRT_ADDRESS(DEBUG_LL_UART_BASE) @ virt base
45+
.endm
46+
47+
.macro senduart,rd,rx
48+
strb \rd, [\rx, #ASC_TX_BUF_OFF]
49+
.endm
50+
51+
.macro waituart,rd,rx
52+
1001: ldr \rd, [\rx, #ASC_STA_OFF]
53+
tst \rd, #ASC_STA_TX_FULL
54+
bne 1001b
55+
.endm
56+
57+
.macro busyuart,rd,rx
58+
1001: ldr \rd, [\rx, #ASC_STA_OFF]
59+
tst \rd, #ASC_STA_TX_EMPTY
60+
beq 1001b
61+
.endm

0 commit comments

Comments
 (0)