--- linux-4.9.37/drivers/irqchip/irq-gic.c 2017-07-12 16:42:41.000000000 +0300 +++ linux-4.9.y/drivers/irqchip/irq-gic.c 2021-06-07 13:01:33.000000000 +0300 @@ -1069,7 +1069,9 @@ { irq_hw_number_t hwirq_base; int gic_irqs, irq_base, ret; - + struct device_node *np; + void * sysctrl_reg_base; + int gic_dist_init_flag; if (IS_ENABLED(CONFIG_GIC_NON_BANKED) && gic->percpu_offset) { /* Frankein-GIC without banked registers... */ unsigned int cpu; @@ -1149,7 +1151,21 @@ goto error; } - gic_dist_init(gic); +#define GIC_DIST_INIT_FLAG 0x47444946 +#define GIC_DIST_INIT_FLAG_OFFSET 0x0130 + /* 0x47444946('G''D''I''F') is abbreviation of GIC_DIST_INIT_FLAG. */ + + np = of_find_compatible_node(NULL, NULL, "goke,sysctrl"); + sysctrl_reg_base = of_iomap(np, 0); + gic_dist_init_flag = readl(sysctrl_reg_base + GIC_DIST_INIT_FLAG_OFFSET); + + if(gic_dist_init_flag != GIC_DIST_INIT_FLAG) { + printk("Gic dist init...\n"); + gic_dist_init(gic); + writel_relaxed(GIC_DIST_INIT_FLAG, sysctrl_reg_base + GIC_DIST_INIT_FLAG_OFFSET); + } else + printk("Gic dist not init...\n"); + ret = gic_cpu_init(gic); if (ret) goto error;