aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-11-14 10:49:47 -0500
committerSimon Horman <horms+renesas@verge.net.au>2014-11-16 20:29:58 -0500
commit7a2071c58f36450fbf44a27d2e5d371c18534a25 (patch)
treeddb0b667867eec884de3d4114263976865c3bc79
parente3d163329753b3b473f40c9be71561ed8eb98aea (diff)
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>
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/arm/Kconfig.debug80
-rw-r--r--arch/arm/include/debug/renesas-scif.S52
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c1
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c1
7 files changed, 136 insertions, 1 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index a20df9bf8ab0..7d843099e9c6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1387,6 +1387,7 @@ F: arch/arm/configs/lager_defconfig
1387F: arch/arm/configs/mackerel_defconfig 1387F: arch/arm/configs/mackerel_defconfig
1388F: arch/arm/configs/marzen_defconfig 1388F: arch/arm/configs/marzen_defconfig
1389F: arch/arm/configs/shmobile_defconfig 1389F: arch/arm/configs/shmobile_defconfig
1390F: arch/arm/include/debug/renesas-scif.S
1390F: arch/arm/mach-shmobile/ 1391F: arch/arm/mach-shmobile/
1391F: drivers/sh/ 1392F: drivers/sh/
1392 1393
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 03dc4c1a8736..6ac3758f85d8 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -653,6 +653,64 @@ choice
653 Say Y here if you want kernel low-level debugging support 653 Say Y here if you want kernel low-level debugging support
654 on Rockchip RK32xx based platforms. 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 config DEBUG_S3C_UART0 714 config DEBUG_S3C_UART0
657 depends on PLAT_SAMSUNG 715 depends on PLAT_SAMSUNG
658 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 716 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
@@ -1061,6 +1119,14 @@ config DEBUG_LL_INCLUDE
1061 DEBUG_IMX6SX_UART 1119 DEBUG_IMX6SX_UART
1062 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM 1120 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM
1063 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1121 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
1122 default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2
1123 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0
1124 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF2
1125 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF0
1126 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF2
1127 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0
1128 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA1
1129 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA4
1064 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART 1130 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
1065 default "debug/s5pv210.S" if DEBUG_S5PV210_UART 1131 default "debug/s5pv210.S" if DEBUG_S5PV210_UART
1066 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 1132 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
@@ -1152,6 +1218,12 @@ config DEBUG_UART_PHYS
1152 default 0xd4018000 if DEBUG_MMP_UART3 1218 default 0xd4018000 if DEBUG_MMP_UART3
1153 default 0xe0000000 if ARCH_SPEAR13XX 1219 default 0xe0000000 if ARCH_SPEAR13XX
1154 default 0xe4007000 if DEBUG_HIP04_UART 1220 default 0xe4007000 if DEBUG_HIP04_UART
1221 default 0xe6c40000 if DEBUG_RMOBILE_SCIFA0
1222 default 0xe6c50000 if DEBUG_RMOBILE_SCIFA1
1223 default 0xe6c80000 if DEBUG_RMOBILE_SCIFA4
1224 default 0xe6e58000 if DEBUG_RCAR_GEN2_SCIF2
1225 default 0xe6e60000 if DEBUG_RCAR_GEN2_SCIF0
1226 default 0xe8008000 if DEBUG_R7S72100_SCIF2
1155 default 0xf0000be0 if ARCH_EBSA110 1227 default 0xf0000be0 if ARCH_EBSA110
1156 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE 1228 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
1157 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \ 1229 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \
@@ -1164,13 +1236,19 @@ config DEBUG_UART_PHYS
1164 default 0xff690000 if DEBUG_RK32_UART2 1236 default 0xff690000 if DEBUG_RK32_UART2
1165 default 0xffc02000 if DEBUG_SOCFPGA_UART 1237 default 0xffc02000 if DEBUG_SOCFPGA_UART
1166 default 0xffd82340 if ARCH_IOP13XX 1238 default 0xffd82340 if ARCH_IOP13XX
1239 default 0xffe40000 if DEBUG_RCAR_GEN1_SCIF0
1240 default 0xffe42000 if DEBUG_RCAR_GEN1_SCIF2
1167 default 0xfff36000 if DEBUG_HIGHBANK_UART 1241 default 0xfff36000 if DEBUG_HIGHBANK_UART
1168 default 0xfffe8600 if DEBUG_UART_BCM63XX 1242 default 0xfffe8600 if DEBUG_UART_BCM63XX
1169 default 0xfffff700 if ARCH_IOP33X 1243 default 0xfffff700 if ARCH_IOP33X
1170 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1244 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1171 DEBUG_LL_UART_EFM32 || \ 1245 DEBUG_LL_UART_EFM32 || \
1172 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1246 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1173 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ 1247 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \
1248 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \
1249 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \
1250 DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
1251 DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \
1174 DEBUG_UART_BCM63XX 1252 DEBUG_UART_BCM63XX
1175 1253
1176config DEBUG_UART_VIRT 1254config DEBUG_UART_VIRT
diff --git a/arch/arm/include/debug/renesas-scif.S b/arch/arm/include/debug/renesas-scif.S
new file mode 100644
index 000000000000..97820a8df51a
--- /dev/null
+++ b/arch/arm/include/debug/renesas-scif.S
@@ -0,0 +1,52 @@
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
361001: 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
491001: ldrh \rd, [\rx, #FSR]
50 tst \rd, #TEND
51 beq 1001b
52 .endm
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 8894e1b7ab0e..0bfe2261c4e7 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -71,6 +71,7 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
71 71
72void __init r8a7740_map_io(void) 72void __init r8a7740_map_io(void)
73{ 73{
74 debug_ll_io_init();
74 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 75 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
75} 76}
76 77
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 136078ab9407..434d1504066a 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -70,6 +70,7 @@ static struct map_desc r8a7779_io_desc[] __initdata = {
70 70
71void __init r8a7779_map_io(void) 71void __init r8a7779_map_io(void)
72{ 72{
73 debug_ll_io_init();
73 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc)); 74 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
74} 75}
75 76
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 769ff008571d..322e2dc3fa36 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -60,6 +60,7 @@ static struct map_desc sh7372_io_desc[] __initdata = {
60 60
61void __init sh7372_map_io(void) 61void __init sh7372_map_io(void)
62{ 62{
63 debug_ll_io_init();
63 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); 64 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
64} 65}
65 66
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 3447ca7e90d9..fa7cab820ab9 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -58,6 +58,7 @@ static struct map_desc sh73a0_io_desc[] __initdata = {
58 58
59void __init sh73a0_map_io(void) 59void __init sh73a0_map_io(void)
60{ 60{
61 debug_ll_io_init();
61 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc)); 62 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
62} 63}
63 64