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

As of commit 9a1091ef0017c40a ("irqchip: gic: Support hierarchy irq
domain."), the APE6EVM 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-muliplatform r8a73a4 and APE6EVM:
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 APE6EVM 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 974b072f f469cde2

Changed files
+27
arch
arm
mach-shmobile
+20
arch/arm/mach-shmobile/board-ape6evm.c
··· 22 22 #include <linux/gpio_keys.h> 23 23 #include <linux/input.h> 24 24 #include <linux/interrupt.h> 25 + #include <linux/irqchip.h> 26 + #include <linux/irqchip/arm-gic.h> 25 27 #include <linux/kernel.h> 26 28 #include <linux/mfd/tmio.h> 27 29 #include <linux/mmc/host.h> ··· 279 277 sizeof(ape6evm_leds_pdata)); 280 278 } 281 279 280 + static void __init ape6evm_legacy_init_time(void) 281 + { 282 + /* Do not invoke DT-based timers via clocksource_of_init() */ 283 + } 284 + 285 + static void __init ape6evm_legacy_init_irq(void) 286 + { 287 + void __iomem *gic_dist_base = ioremap_nocache(0xf1001000, 0x1000); 288 + void __iomem *gic_cpu_base = ioremap_nocache(0xf1002000, 0x1000); 289 + 290 + gic_init(0, 29, gic_dist_base, gic_cpu_base); 291 + 292 + /* Do not invoke DT-based interrupt code via irqchip_init() */ 293 + } 294 + 295 + 282 296 static const char *ape6evm_boards_compat_dt[] __initdata = { 283 297 "renesas,ape6evm", 284 298 NULL, ··· 302 284 303 285 DT_MACHINE_START(APE6EVM_DT, "ape6evm") 304 286 .init_early = shmobile_init_delay, 287 + .init_irq = ape6evm_legacy_init_irq, 305 288 .init_machine = ape6evm_add_standard_devices, 306 289 .init_late = shmobile_init_late, 307 290 .dt_compat = ape6evm_boards_compat_dt, 291 + .init_time = ape6evm_legacy_init_time, 308 292 MACHINE_END
+7
arch/arm/mach-shmobile/timer.c
··· 75 75 if (!max_freq) 76 76 return; 77 77 78 + #ifdef CONFIG_ARCH_SHMOBILE_LEGACY 79 + /* Non-multiplatform r8a73a4 SoC cannot use arch timer due 80 + * to GIC being initialized from C and arch timer via DT */ 81 + if (of_machine_is_compatible("renesas,r8a73a4")) 82 + has_arch_timer = false; 83 + #endif 84 + 78 85 if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) { 79 86 if (is_a7_a8_a9) 80 87 shmobile_setup_delay_hz(max_freq, 1, 3);