Commit 617f7964 authored by Abel Vesa's avatar Abel Vesa Committed by Angus Ainslie (Purism)

irqchip: irq-imx-gpcv2: Add workaround for i.MX8MQ ERR11171

i.MX8MQ is missing the wake_request signals from GIC to GPCv2. This indirectly
breaks cpuidle support due to inability to wake target cores on IPIs.

Here is the link to the errata (see e11171):

Now, in order to fix this, we can trigger IRQ 32 (hwirq 0) to all the cores by
setting 12th bit in IOMUX_GPR1 register. In order to control the target cores
only, that is, not waking up all the cores every time, we can unmask/mask the
IRQ 32 in the first GPC IMR register. So basically we can leave the IOMUX_GPR1
12th bit always set and just play with the masking and unmasking the IRO 32 for
each independent core.

Since EL3 is the one that deals with powering down/up the cores, and since the
cores wake up in EL3, EL3 should be the one to control the IMRs in this case.
This implies we need to get into EL3 on every IPI to do the unmasking, leaving
the masking to be done on the power-up sequence by the core itself.

In order to be able to get into EL3 on each IPI, we 'hijack' the registered smp
cross call handler, in this case the gic_raise_softirq which is registered by
the irq-gic-v3 driver and register our own handler instead. This new handler is
basically a wrapper over the hijacked handler plus the call into EL3.

To get into EL3, we use a custom vendor SIP id added just for this purpose.

All of this is conditional for i.MX8MQ only.
Signed-off-by: default avatarAbel Vesa <>
parent e1ca22e0
......@@ -3,11 +3,19 @@
* Copyright (C) 2015 Freescale Semiconductor, Inc.
#include <linux/arm-smccc.h>
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
#include <linux/mfd/syscon.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/irqchip.h>
#include <linux/syscore_ops.h>
#include <linux/smp.h>
#define IMX_SIP_GPC 0xC2000004
#define IMX_SIP_GPC_CORE_WAKE 0x00
#define IMR_NUM 4
#define GPC_MAX_IRQS (IMR_NUM * 32)
......@@ -70,6 +78,37 @@ static struct syscore_ops imx_gpcv2_syscore_ops = {
.resume = gpcv2_wakeup_source_restore,
static void (*__gic_v3_smp_cross_call)(const struct cpumask *, unsigned int);
static void imx_gpcv2_raise_softirq(const struct cpumask *mask,
unsigned int irq)
struct arm_smccc_res res;
/* call the hijacked smp cross call handler */
__gic_v3_smp_cross_call(mask, irq);
/* now call into EL3 and take care of the wakeup */
*cpumask_bits(mask), 0, 0, 0, 0, 0, &res);
static void imx_gpcv2_wake_request_fixup(void)
struct regmap *iomux_gpr;
/* hijack the already registered smp cross call handler */
__gic_v3_smp_cross_call = __smp_cross_call;
/* register our workaround handler for smp cross call */
iomux_gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
if (!IS_ERR(iomux_gpr))
regmap_update_bits(iomux_gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT,
static int imx_gpcv2_irq_set_wake(struct irq_data *d, unsigned int on)
struct gpcv2_irqchip_data *cd = d->chip_data;
......@@ -267,6 +306,9 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
cd->wakeup_sources[i] = ~0;
if (of_property_read_bool(node, "broken-wake-request-signals"))
/* Let CORE0 as the default CPU to wake up by GPC */
cd->cpu2wakeup = GPC_IMR1_CORE0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment