ARM: shmobile: Add early debugging support using SCIF(A)
Geert Uytterhoeven
maintainerv4 cover ARM: shmobile: Add early debugging support using SCIF(A)
Hi Simon, Magnus, Arnd,
This patch series adds serial port debug macros for the SCIF(A) serial ports. This includes all supported shmobile SoCs, except for EMEV2.
It contains 2 patches, which are two alternative versions:
- The first patch keeps on using the identity mapping set up by .map_io() on platforms I cannot test myself (sh7372 and r8a7779),
- The second one converts the remaining platforms to use debug_ll_io_init(), which allowed to get rid of the #ifdef in renesas-scif.S, and consolidate more config options.
Both versions work fine on r8a7791/koelsch (multiplatform), r8a7740/armadillo (legacy and reference), and sh73a0/kzm9g (legacy, reference, and multiplatform), also with a multiplatform kernel based on shmobile_defconfig.
I'd appreciate if you could test the second one on sh7372 and r8a7779, and if it works, apply it.
Else, please apply the first version. We can do incremental conversions later, as discussed before.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH v4 1/2 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. The SCIF(A) virtual address is not the same on all SoCs.
a. On SoCs not using the legacy machine_desc.map_io(),
debug_ll_io_init() is called by the ARM core code. 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 using the legacy machine_desc.map_io(), debug_ll_io_init() can be called explicitly. Add the call for r8a7740 and sh73a0.
b. Alternatively, an identity mapping of the SCIF(A) registers
must be set up in .map_io(). Add this for r8a7779, where this wasn't already done.
Once all SoCs use debug_ll_io_init(), more consolidation of DEBUG_<SoC>_<PORT> can be done.
This was derived from the r8a7790 version by Laurent Pinchart.
---
Tested by me on r8a7791/koelsch (multiplatform), r8a7740/armadillo (legacy and reference), and sh73a0/kzm9g (legacy, reference, and multiplatform), also with a multiplatform kernel based on shmobile_defconfig.
TTBOMK tested by Simon on r8a73a4/ape6evm.
Testing on other platforms would still be appreciated, but I think at this point it's already better to have it than not to have it, at least in renesas-devel-*.
v4a:
- Get rid of the multi-level choice statements,
- Sort config options by SoC/family,
- Spelling s/entity/identity/,
- Let r8a7740_map_io() and sh73a0_map_io() call debug_ll_io_init(), to reduce the #ifdef list in renesas-scif.S,
- Drop note about garbage output on armadillo-multiplatform, as the problem went away after commit b89ff7c3c2dee189 ("ARM: shmobile:
r8a7740 dtsi: Correct IIC0 parent clock"),
v3:
- Add Acked-by,
v2:
- Rename CONFIG_DEBUG_SCIF to CONFIG_DEBUG_RENESAS_SCIF,
- Rename scif.S to renesas-scif.S,
- Add intermediate DEBUG_<SoC>_<PORT> Kconfig symbols in a Kconfig choice statement to select the SoC/port combination for debugging. Use these symbols instead of the SoC type to (a) control the DEBUG_UART_PHYS defaults, and (b) pick the right virtual address. This fixes the case of debugging on an SoC not using machine_desc.map_io(), while platform support for any SoC still using machine_desc.map_io() is enabled.
- Protect SCIF mapping on r8a7779 by #ifdef CONFIG_DEBUG_R8A7779_SCIF2,
- Add renesas-scif.S to the ARM/SHMOBILE section in MAINTAINERS.
--- MAINTAINERS | 1 + arch/arm/Kconfig.debug | 89 +++++++++++++++++++++++++++++++++- arch/arm/include/debug/renesas-scif.S | 60 +++++++++++++++++++++++ arch/arm/mach-shmobile/setup-r8a7740.c | 1 + arch/arm/mach-shmobile/setup-r8a7779.c | 9 ++++ arch/arm/mach-shmobile/setup-sh73a0.c | 1 + 6 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/renesas-scif.S
MAINTAINERS +1 -0
@@ -1386,6 +1386,7 @@ F: arch/arm/configs/lager_defconfig F: arch/arm/configs/mackerel_defconfig F: arch/arm/configs/marzen_defconfig F: arch/arm/configs/shmobile_defconfig +F: arch/arm/include/debug/renesas-scif.S F: arch/arm/mach-shmobile/ F: drivers/sh/
arch/arm/Kconfig.debug +87 -2
121 lines not on this page · raw message
arch/arm/include/debug/renesas-scif.S new file +60 -0
60 lines not on this page · raw message
arch/arm/mach-shmobile/setup-r8a7740.c +1 -0
@@ -67,6 +67,7 @@ static struct map_desc r8a7740_io_desc[] __initdata = {void __init r8a7740_map_io (void ) { +debug_ll_io_init ();iotable_init (r8a7740_io_desc,ARRAY_SIZE (r8a7740_io_desc)); }
arch/arm/mach-shmobile/setup-r8a7779.c +9 -0
@@ -62,6 +62,15 @@ static struct map_desc r8a7779_io_desc[] __initdata = { .length = SZ_16M, .type = MT_DEVICE_NONSHARED }, +#ifdef CONFIG_DEBUG_R8A7779_SCIF2 +/* 64K identity mapping for 0xffe40000 (SCIF) */ + { + .virtual = 0xffe40000, + .pfn = __phys_to_pfn(0xffe40000), + .length = SZ_64K, + .type = MT_DEVICE_NONSHARED + }, +#endif /* CONFIG_DEBUG_R8A7779_SCIF2 */ };void __init r8a7779_map_io (void )
arch/arm/mach-shmobile/setup-sh73a0.c +1 -0
@@ -55,6 +55,7 @@ static struct map_desc sh73a0_io_desc[] __initdata = {void __init sh73a0_map_io (void ) { +debug_ll_io_init ();iotable_init (sh73a0_io_desc,ARRAY_SIZE (sh73a0_io_desc)); }
Signature · 1 line
1.9.1
Geert Uytterhoeven
maintainerPATCH v4 2/2 ARM: shmobile: Add early debugging support using SCIF(A)
In reply to Geert UytterhoevenAdd 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.
---
Tested by me on r8a7791/koelsch (multiplatform), r8a7740/armadillo (legacy and reference), and sh73a0/kzm9g (legacy, reference, and multiplatform), also with a multiplatform kernel based on shmobile_defconfig.
TTBOMK tested by Simon on r8a73a4/ape6evm.
Testing on other platforms would still be appreciated, but I think at this point it's already better to have it than not to have it, at least in renesas-devel-*.
v4b:
- Get rid of the multi-level choice statements,
- Sort config options by SoC/family,
- Spelling s/entity/identity/,
- Add calls to debug_ll_io_init() for r8a7740, r8a7779, sh7372, and sh73a0. This allows to:
- Drop the identify mapping for SCIF on r8a7779,
- Use 0xfdxxxxxx as the virtual SCIF address everywhere, i.e. no more #ifdefs in renesas-scif.S, and true based-by-physical-address configuration,
- Consolidate Kconfig sections for the same serial port:
- Merge DEBUG_R8A73A4_SCIFA0 and DEBUG_SH7372_SCIFA0 into DEBUG_RMOBILE_SCIFA0,
- Use SoC family-specific prefixes (DEBUG_RMOBILE_* and DEBUG_RCAR_GEN1_*) instead of SoC-specific prefixes where possible, like was done for R-Car Gen2 before.
- Drop note about garbage output on armadillo-multiplatform, as the problem went away after commit b89ff7c3c2dee189 ("ARM: shmobile:
r8a7740 dtsi: Correct IIC0 parent clock").
v3:
- Add Acked-by,
v2:
- Rename CONFIG_DEBUG_SCIF to CONFIG_DEBUG_RENESAS_SCIF,
- Rename scif.S to renesas-scif.S,
- Add intermediate DEBUG_<SoC>_<PORT> Kconfig symbols in a Kconfig choice statement to select the SoC/port combination for debugging. Use these symbols instead of the SoC type to (a) control the DEBUG_UART_PHYS defaults, and (b) pick the right virtual address. This fixes the case of debugging on an SoC not using machine_desc.map_io(), while platform support for any SoC still using machine_desc.map_io() is enabled.
- Protect SCIF mapping on r8a7779 by #ifdef CONFIG_DEBUG_R8A7779_SCIF2,
- Add renesas-scif.S to the ARM/SHMOBILE section in MAINTAINERS.
--- MAINTAINERS | 1 + arch/arm/Kconfig.debug | 80 +++++++++++++++++++++++++++++++++- arch/arm/include/debug/renesas-scif.S | 52 ++++++++++++++++++++++ arch/arm/mach-shmobile/setup-r8a7740.c | 1 + arch/arm/mach-shmobile/setup-r8a7779.c | 1 + arch/arm/mach-shmobile/setup-sh7372.c | 1 + arch/arm/mach-shmobile/setup-sh73a0.c | 1 + 7 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/debug/renesas-scif.S
MAINTAINERS +1 -0
@@ -1386,6 +1386,7 @@ F: arch/arm/configs/lager_defconfig F: arch/arm/configs/mackerel_defconfig F: arch/arm/configs/marzen_defconfig F: arch/arm/configs/shmobile_defconfig +F: arch/arm/include/debug/renesas-scif.S F: arch/arm/mach-shmobile/ F: drivers/sh/
arch/arm/Kconfig.debug +79 -1
110 lines not on this page · raw message
arch/arm/include/debug/renesas-scif.S new file +52 -0
52 lines not on this page · raw message
arch/arm/mach-shmobile/setup-r8a7740.c +1 -0
@@ -67,6 +67,7 @@ static struct map_desc r8a7740_io_desc[] __initdata = {void __init r8a7740_map_io (void ) { +debug_ll_io_init ();iotable_init (r8a7740_io_desc,ARRAY_SIZE (r8a7740_io_desc)); }
arch/arm/mach-shmobile/setup-r8a7779.c +1 -0
@@ -66,6 +66,7 @@ static struct map_desc r8a7779_io_desc[] __initdata = {void __init r8a7779_map_io (void ) { +debug_ll_io_init ();iotable_init (r8a7779_io_desc,ARRAY_SIZE (r8a7779_io_desc)); }
arch/arm/mach-shmobile/setup-sh7372.c +1 -0
@@ -56,6 +56,7 @@ static struct map_desc sh7372_io_desc[] __initdata = {void __init sh7372_map_io (void ) { +debug_ll_io_init ();iotable_init (sh7372_io_desc,ARRAY_SIZE (sh7372_io_desc)); }
arch/arm/mach-shmobile/setup-sh73a0.c +1 -0
@@ -55,6 +55,7 @@ static struct map_desc sh73a0_io_desc[] __initdata = {void __init sh73a0_map_io (void ) { +debug_ll_io_init ();iotable_init (sh73a0_io_desc,ARRAY_SIZE (sh73a0_io_desc)); }
Signature · 1 line
1.9.1
v4 cover ARM: shmobile: Add early debugging support using SCIF(A)
In reply to Geert UytterhoevenQuoted 16 lines · On Friday 14 November 2014 16:49:45 Geert Uytterhoeven wrote:
Hi Simon, Magnus, Arnd,
This patch series adds serial port debug macros for the SCIF(A) serial ports. This includes all supported shmobile SoCs, except for EMEV2.
It contains 2 patches, which are two alternative versions:
- The first patch keeps on using the identity mapping set up by .map_io() on platforms I cannot test myself (sh7372 and r8a7779),
- The second one converts the remaining platforms to usedebug_ll_io_init(), which allowed to get rid of the #ifdef inrenesas-scif.S, and consolidate more config options.Both versions work fine on r8a7791/koelsch (multiplatform), r8a7740/armadillo (legacy and reference), and sh73a0/kzm9g (legacy, reference, and multiplatform), also with a multiplatform kernel based on
shmobile_defconfig.
Quoted 5 lines
I'd appreciate if you could test the second one on sh7372 and r8a7779, and if it works, apply it.
Else, please apply the first version. We can do incremental conversions later, as discussed before.
Both versions look good to me,
I do notice that strictly speaking you break alphabetical ordering by putting DEBUG_R8A* and DEBUG_RCAR* after DEBUG_RK*, but it does seem way more reasonable like this.
Arnd
v4 cover ARM: shmobile: Add early debugging support using SCIF(A)
In reply to Geert UytterhoevenQuoted 12 lines · Geert Uytterhoeven
Hi Simon, Magnus, Arnd,
This patch series adds serial port debug macros for the SCIF(A) serial ports. This includes all supported shmobile SoCs, except for EMEV2.
It contains 2 patches, which are two alternative versions:
- The first patch keeps on using the identity mapping set up by .map_io() on platforms I cannot test myself (sh7372 and r8a7779),
- The second one converts the remaining platforms to usedebug_ll_io_init(), which allowed to get rid of the #ifdef inrenesas-scif.S, and consolidate more config options.
Quoted 6 lines
Both versions work fine on r8a7791/koelsch (multiplatform), r8a7740/armadillo (legacy and reference), and sh73a0/kzm9g (legacy, reference, and multiplatform), also with a multiplatform kernel based on
shmobile_defconfig.I'd appreciate if you could test the second one on sh7372 and r8a7779, and if it works, apply it.
Done. I have satisfied myself that 4b works on those SoCs and have queued-up 4b accordingly.
Quoted 20 lines
Else, please apply the first version. We can do incremental conversions later, as discussed before.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.orgIn personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html