Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 9005/1: debug: Select flow control for all debug UARTs

Instead of a flow control selection mechanism specifically for
8250, make this available for all debug UARTs. If the debug
UART supports waiting for CTS to be asserted, then this code
can be activated for terminals that need it.

We keep the defaults for EBSA110, Footbridge, Gemini and RPC
so that this still works as expected for these older platforms:
they assume that flow control shall be enabled for debug
prints.

I switch the location of the check for
ifdef CONFIG_DEBUG_UART_FLOW_CONTROL from the actual debug
UART drivers: the code would get compiled-out for 8250 and
Tegra unless their custom config (or passing -DFLOW_CONTROL
in the Tegra case) was not set. Instead this is conditional
at the three places where we print debug messages. The idea
is that debug UARTs can be implemented without this ifdef
boilerplate so they look cleaner, alas the ifdef has to be
somewhere.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

authored by

Linus Walleij and committed by
Russell King
4df24fef 2c50a570

+19 -10
+11 -5
arch/arm/Kconfig.debug
··· 1546 1546 bool 1547 1547 depends on ARCH_SIRF 1548 1548 1549 + config DEBUG_UART_FLOW_CONTROL 1550 + bool "Enable flow control (CTS) for the debug UART" 1551 + depends on DEBUG_LL 1552 + default y if ARCH_EBSA110 || DEBUG_FOOTBRIDGE_COM1 || DEBUG_GEMINI || ARCH_RPC 1553 + help 1554 + Some UART ports are connected to terminals that will use modem 1555 + control signals to indicate whether they are ready to receive text. 1556 + In practice this means that the terminal is asserting the special 1557 + control signal CTS (Clear To Send). If your debug UART supports 1558 + this and your debug terminal will require it, enable this option. 1559 + 1549 1560 config DEBUG_LL_INCLUDE 1550 1561 string 1551 1562 default "debug/sa1100.S" if DEBUG_SA1100 ··· 1903 1892 Palmchip provides a UART implementation compatible with 16550 1904 1893 except for having a different register layout. Say Y here if 1905 1894 the debug UART is of this type. 1906 - 1907 - config DEBUG_UART_8250_FLOW_CONTROL 1908 - bool "Enable flow control for 8250 UART" 1909 - depends on DEBUG_LL_UART_8250 || DEBUG_UART_8250 1910 - default y if ARCH_EBSA110 || DEBUG_FOOTBRIDGE_COM1 || DEBUG_GEMINI || ARCH_RPC 1911 1895 1912 1896 config DEBUG_UNCOMPRESS 1913 1897 bool "Enable decompressor debugging via DEBUG_LL output"
+2
arch/arm/boot/compressed/debug.S
··· 8 8 9 9 ENTRY(putc) 10 10 addruart r1, r2, r3 11 + #ifdef CONFIG_DEBUG_UART_FLOW_CONTROL 11 12 waituartcts r3, r1 13 + #endif 12 14 waituarttxrdy r3, r1 13 15 senduart r0, r1 14 16 busyuart r3, r1
-2
arch/arm/include/debug/8250.S
··· 49 49 .endm 50 50 51 51 .macro waituartcts,rd,rx 52 - #ifdef CONFIG_DEBUG_UART_8250_FLOW_CONTROL 53 52 1001: load \rd, [\rx, #UART_MSR << UART_SHIFT] 54 53 tst \rd, #UART_MSR_CTS 55 54 beq 1001b 56 - #endif 57 55 .endm
-2
arch/arm/include/debug/tegra.S
··· 179 179 .endm 180 180 181 181 .macro waituartcts, rd, rx 182 - #ifdef FLOW_CONTROL 183 182 cmp \rx, #0 184 183 beq 1002f 185 184 1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT] 186 185 tst \rd, #UART_MSR_CTS 187 186 beq 1001b 188 187 1002: 189 - #endif 190 188 .endm 191 189 192 190 .macro waituarttxrdy,rd,rx
+6 -1
arch/arm/kernel/debug.S
··· 89 89 2: teq r1, #'\n' 90 90 bne 3f 91 91 mov r1, #'\r' 92 + #ifdef CONFIG_DEBUG_UART_FLOW_CONTROL 92 93 waituartcts r2, r3 94 + #endif 93 95 waituarttxrdy r2, r3 94 96 senduart r1, r3 95 97 busyuart r2, r3 96 98 mov r1, #'\n' 97 - 3: waituartcts r2, r3 99 + 3: 100 + #ifdef CONFIG_DEBUG_UART_FLOW_CONTROL 101 + waituartcts r2, r3 102 + #endif 98 103 waituarttxrdy r2, r3 99 104 senduart r1, r3 100 105 busyuart r2, r3