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

ARM: shmobile: Add early debugging support using SCIF(A)

Add serial port debug macros for the SCIF(A) serial ports.
This includes all supported shmobile SoCs, except for EMEV2.

The configuration logic (both Kconfig and #ifdef) is more complicated than
one would expect, for several reasons:
1. Not all SoCs have the same serial devices, and they're not always
at the same addresses.
2. There are two different types: SCIF and SCIFA. Fortunately they can
easily be distinguished by physical address.
3. Not all boards use the same serial port for the console.
The defaults correspond to the boards that are supported in
mainline. If you want to use a different serial port, just change
the value of CONFIG_DEBUG_UART_PHYS, and the rest will auto-adapt.
4. debug_ll_io_init() maps the SCIF(A) registers to a fixed virtual
address. 0xfdxxxxxx was chosen, as it should lie below VMALLOC_END
= 0xff000000, and must not conflict with the 2 MiB reserved region
at PCI_IO_VIRT_BASE = 0xfee00000.
- On SoCs not using the legacy machine_desc.map_io(),
debug_ll_io_init() is called by the ARM core code.
- On SoCs using the legacy machine_desc.map_io(),
debug_ll_io_init() must be called explicitly. Calls are added
for r8a7740, r8a7779, sh7372, and sh73a0.

This was derived from the r8a7790 version by Laurent Pinchart.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

authored by

Geert Uytterhoeven and committed by
Simon Horman
7a2071c5 e3d16332

+136 -1
+1
MAINTAINERS
··· 1387 1387 F: arch/arm/configs/mackerel_defconfig 1388 1388 F: arch/arm/configs/marzen_defconfig 1389 1389 F: arch/arm/configs/shmobile_defconfig 1390 + F: arch/arm/include/debug/renesas-scif.S 1390 1391 F: arch/arm/mach-shmobile/ 1391 1392 F: drivers/sh/ 1392 1393
+79 -1
arch/arm/Kconfig.debug
··· 653 653 Say Y here if you want kernel low-level debugging support 654 654 on Rockchip RK32xx based platforms. 655 655 656 + config DEBUG_R7S72100_SCIF2 657 + bool "Kernel low-level debugging messages via SCIF2 on R7S72100" 658 + depends on ARCH_R7S72100 659 + help 660 + Say Y here if you want kernel low-level debugging support 661 + via SCIF2 on Renesas RZ/A1H (R7S72100). 662 + 663 + config DEBUG_RCAR_GEN1_SCIF0 664 + bool "Kernel low-level debugging messages via SCIF0 on R8A7778" 665 + depends on ARCH_R8A7778 666 + help 667 + Say Y here if you want kernel low-level debugging support 668 + via SCIF0 on Renesas R-Car M1A (R8A7778). 669 + 670 + config DEBUG_RCAR_GEN1_SCIF2 671 + bool "Kernel low-level debugging messages via SCIF2 on R8A7779" 672 + depends on ARCH_R8A7779 673 + help 674 + Say Y here if you want kernel low-level debugging support 675 + via SCIF2 on Renesas R-Car H1 (R8A7779). 676 + 677 + config DEBUG_RCAR_GEN2_SCIF0 678 + bool "Kernel low-level debugging messages via SCIF0 on R8A7790/R8A7791/R8A7793)" 679 + depends on ARCH_R8A7790 || ARCH_R8A7791 || ARCH_R8A7793 680 + help 681 + Say Y here if you want kernel low-level debugging support 682 + via SCIF0 on Renesas R-Car H2 (R8A7790), M2-W (R8A7791), or 683 + M2-N (R8A7793). 684 + 685 + config DEBUG_RCAR_GEN2_SCIF2 686 + bool "Kernel low-level debugging messages via SCIF2 on R8A7794" 687 + depends on ARCH_R8A7794 688 + help 689 + Say Y here if you want kernel low-level debugging support 690 + via SCIF2 on Renesas R-Car E2 (R8A7794). 691 + 692 + config DEBUG_RMOBILE_SCIFA0 693 + bool "Kernel low-level debugging messages via SCIFA0 on R8A73A4/SH7372" 694 + depends on ARCH_R8A73A4 || ARCH_SH7372 695 + help 696 + Say Y here if you want kernel low-level debugging support 697 + via SCIFA0 on Renesas R-Mobile APE6 (R8A73A4) or SH-Mobile 698 + AP4 (SH7372). 699 + 700 + config DEBUG_RMOBILE_SCIFA1 701 + bool "Kernel low-level debugging messages via SCIFA1 on R8A7740" 702 + depends on ARCH_R8A7740 703 + help 704 + Say Y here if you want kernel low-level debugging support 705 + via SCIFA1 on Renesas R-Mobile A1 (R8A7740). 706 + 707 + config DEBUG_RMOBILE_SCIFA4 708 + bool "Kernel low-level debugging messages via SCIFA4 on SH73A0" 709 + depends on ARCH_SH73A0 710 + help 711 + Say Y here if you want kernel low-level debugging support 712 + via SCIFA4 on Renesas SH-Mobile AG5 (SH73A0). 713 + 656 714 config DEBUG_S3C_UART0 657 715 depends on PLAT_SAMSUNG 658 716 select DEBUG_EXYNOS_UART if ARCH_EXYNOS ··· 1119 1061 DEBUG_IMX6SX_UART 1120 1062 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM 1121 1063 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1064 + default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2 1065 + default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0 1066 + default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF2 1067 + default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF0 1068 + default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF2 1069 + default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0 1070 + default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA1 1071 + default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA4 1122 1072 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART 1123 1073 default "debug/s5pv210.S" if DEBUG_S5PV210_UART 1124 1074 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 ··· 1218 1152 default 0xd4018000 if DEBUG_MMP_UART3 1219 1153 default 0xe0000000 if ARCH_SPEAR13XX 1220 1154 default 0xe4007000 if DEBUG_HIP04_UART 1155 + default 0xe6c40000 if DEBUG_RMOBILE_SCIFA0 1156 + default 0xe6c50000 if DEBUG_RMOBILE_SCIFA1 1157 + default 0xe6c80000 if DEBUG_RMOBILE_SCIFA4 1158 + default 0xe6e58000 if DEBUG_RCAR_GEN2_SCIF2 1159 + default 0xe6e60000 if DEBUG_RCAR_GEN2_SCIF0 1160 + default 0xe8008000 if DEBUG_R7S72100_SCIF2 1221 1161 default 0xf0000be0 if ARCH_EBSA110 1222 1162 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE 1223 1163 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \ ··· 1236 1164 default 0xff690000 if DEBUG_RK32_UART2 1237 1165 default 0xffc02000 if DEBUG_SOCFPGA_UART 1238 1166 default 0xffd82340 if ARCH_IOP13XX 1167 + default 0xffe40000 if DEBUG_RCAR_GEN1_SCIF0 1168 + default 0xffe42000 if DEBUG_RCAR_GEN1_SCIF2 1239 1169 default 0xfff36000 if DEBUG_HIGHBANK_UART 1240 1170 default 0xfffe8600 if DEBUG_UART_BCM63XX 1241 1171 default 0xfffff700 if ARCH_IOP33X 1242 1172 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1243 1173 DEBUG_LL_UART_EFM32 || \ 1244 1174 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1245 - DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ 1175 + DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \ 1176 + DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \ 1177 + DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \ 1178 + DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \ 1179 + DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \ 1246 1180 DEBUG_UART_BCM63XX 1247 1181 1248 1182 config DEBUG_UART_VIRT
+52
arch/arm/include/debug/renesas-scif.S
··· 1 + /* 2 + * Renesas SCIF(A) debugging macro include header 3 + * 4 + * Based on r8a7790.S 5 + * 6 + * Copyright (C) 2012-2013 Renesas Electronics Corporation 7 + * Copyright (C) 1994-1999 Russell King 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + */ 13 + 14 + #define SCIF_PHYS CONFIG_DEBUG_UART_PHYS 15 + #define SCIF_VIRT ((SCIF_PHYS & 0x00ffffff) | 0xfd000000) 16 + 17 + #if CONFIG_DEBUG_UART_PHYS < 0xe6e00000 18 + /* SCIFA */ 19 + #define FTDR 0x20 20 + #define FSR 0x14 21 + #else 22 + /* SCIF */ 23 + #define FTDR 0x0c 24 + #define FSR 0x10 25 + #endif 26 + 27 + #define TDFE (1 << 5) 28 + #define TEND (1 << 6) 29 + 30 + .macro addruart, rp, rv, tmp 31 + ldr \rp, =SCIF_PHYS 32 + ldr \rv, =SCIF_VIRT 33 + .endm 34 + 35 + .macro waituart, rd, rx 36 + 1001: ldrh \rd, [\rx, #FSR] 37 + tst \rd, #TDFE 38 + beq 1001b 39 + .endm 40 + 41 + .macro senduart, rd, rx 42 + strb \rd, [\rx, #FTDR] 43 + ldrh \rd, [\rx, #FSR] 44 + bic \rd, \rd, #TEND 45 + strh \rd, [\rx, #FSR] 46 + .endm 47 + 48 + .macro busyuart, rd, rx 49 + 1001: ldrh \rd, [\rx, #FSR] 50 + tst \rd, #TEND 51 + beq 1001b 52 + .endm
+1
arch/arm/mach-shmobile/setup-r8a7740.c
··· 71 71 72 72 void __init r8a7740_map_io(void) 73 73 { 74 + debug_ll_io_init(); 74 75 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 75 76 } 76 77
+1
arch/arm/mach-shmobile/setup-r8a7779.c
··· 70 70 71 71 void __init r8a7779_map_io(void) 72 72 { 73 + debug_ll_io_init(); 73 74 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc)); 74 75 } 75 76
+1
arch/arm/mach-shmobile/setup-sh7372.c
··· 60 60 61 61 void __init sh7372_map_io(void) 62 62 { 63 + debug_ll_io_init(); 63 64 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); 64 65 } 65 66
+1
arch/arm/mach-shmobile/setup-sh73a0.c
··· 58 58 59 59 void __init sh73a0_map_io(void) 60 60 { 61 + debug_ll_io_init(); 61 62 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc)); 62 63 } 63 64