ARM: shmobile: r8a7790: Instantiate GIC from C board code in legacy builds

As of commit 9a1091ef0017c40a ("irqchip: gic: Support hierarchy irq
domain."), the Lager legacy board support is known to be broken.

The IRQ numbers of the GIC are now virtual, and no longer match the
hardcoded hardware IRQ numbers in the legacy platform board code.

To fix this issue specific to non-multiplatform r8a7790 and Lager:
1) Instantiate the GIC from platform board code and also
2) Skip over the DT arch timer as well as
3) Force delay setup based on DT CPU frequency

With these 3 fixes in place interrupts on Lager are now unbroken.

Partially based on legacy GIC fix by Geert Uytterhoeven, thanks to
him for the initial work.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

authored by Magnus Damm and committed by Simon Horman 77cf5166 974b072f

Changed files
+20
arch
+13
arch/arm/mach-shmobile/board-lager.c
··· 25 25 #include <linux/input.h> 26 26 #include <linux/interrupt.h> 27 27 #include <linux/irq.h> 28 + #include <linux/irqchip.h> 29 + #include <linux/irqchip/arm-gic.h> 28 30 #include <linux/kernel.h> 29 31 #include <linux/leds.h> 30 32 #include <linux/mfd/tmio.h> ··· 875 873 lager_ksz8041_fixup); 876 874 } 877 875 876 + static void __init lager_legacy_init_irq(void) 877 + { 878 + void __iomem *gic_dist_base = ioremap_nocache(0xf1001000, 0x1000); 879 + void __iomem *gic_cpu_base = ioremap_nocache(0xf1002000, 0x1000); 880 + 881 + gic_init(0, 29, gic_dist_base, gic_cpu_base); 882 + 883 + /* Do not invoke DT-based interrupt code via irqchip_init() */ 884 + } 885 + 878 886 static const char * const lager_boards_compat_dt[] __initconst = { 879 887 "renesas,lager", 880 888 NULL, ··· 893 881 DT_MACHINE_START(LAGER_DT, "lager") 894 882 .smp = smp_ops(r8a7790_smp_ops), 895 883 .init_early = shmobile_init_delay, 884 + .init_irq = lager_legacy_init_irq, 896 885 .init_time = rcar_gen2_timer_init, 897 886 .init_machine = lager_init, 898 887 .init_late = shmobile_init_late,
+2
arch/arm/mach-shmobile/setup-rcar-gen2.c
··· 137 137 #ifdef CONFIG_COMMON_CLK 138 138 rcar_gen2_clocks_init(mode); 139 139 #endif 140 + #ifdef CONFIG_ARCH_SHMOBILE_MULTI 140 141 clocksource_of_init(); 142 + #endif 141 143 } 142 144 143 145 struct memory_reserve_config {
+5
arch/arm/mach-shmobile/timer.c
··· 80 80 * to GIC being initialized from C and arch timer via DT */ 81 81 if (of_machine_is_compatible("renesas,r8a73a4")) 82 82 has_arch_timer = false; 83 + 84 + /* Non-multiplatform r8a7790 SoC cannot use arch timer due 85 + * to GIC being initialized from C and arch timer via DT */ 86 + if (of_machine_is_compatible("renesas,r8a7790")) 87 + has_arch_timer = false; 83 88 #endif 84 89 85 90 if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) {