aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/gpc.c
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2014-12-02 11:05:25 -0500
committerOlof Johansson <olof@lixom.net>2014-12-05 02:24:48 -0500
commite2fd06f6be690a1a9697c0c6338843a35cbd70a3 (patch)
treec91fa0f3308390d904174db5c6fdd8c3cae5173c /arch/arm/mach-imx/gpc.c
parent7e8f403fecd38d018a2c1868b29e9c1ef7d6fc56 (diff)
ARM: imx: irq: fix buggy usage of irq_data irq field
mach-imx directly references to the irq field in struct irq_data, and uses this to directly poke hardware register. But irq is the *virtual* irq number, something that has nothing to do with the actual HW irq (stored in the hwirq field). And once we put the stacked domain code in action, the whole thing explodes, as these two values are *very* different. Just replacing all instances of irq with hwirq fixes the issue. Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-imx/gpc.c')
-rw-r--r--arch/arm/mach-imx/gpc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 82ea74e68482..1455829c735e 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -56,14 +56,14 @@ void imx_gpc_post_resume(void)
56 56
57static int imx_gpc_irq_set_wake(struct irq_data *d, unsigned int on) 57static int imx_gpc_irq_set_wake(struct irq_data *d, unsigned int on)
58{ 58{
59 unsigned int idx = d->irq / 32 - 1; 59 unsigned int idx = d->hwirq / 32 - 1;
60 u32 mask; 60 u32 mask;
61 61
62 /* Sanity check for SPI irq */ 62 /* Sanity check for SPI irq */
63 if (d->irq < 32) 63 if (d->hwirq < 32)
64 return -EINVAL; 64 return -EINVAL;
65 65
66 mask = 1 << d->irq % 32; 66 mask = 1 << d->hwirq % 32;
67 gpc_wake_irqs[idx] = on ? gpc_wake_irqs[idx] | mask : 67 gpc_wake_irqs[idx] = on ? gpc_wake_irqs[idx] | mask :
68 gpc_wake_irqs[idx] & ~mask; 68 gpc_wake_irqs[idx] & ~mask;
69 69
@@ -97,12 +97,12 @@ void imx_gpc_irq_unmask(struct irq_data *d)
97 u32 val; 97 u32 val;
98 98
99 /* Sanity check for SPI irq */ 99 /* Sanity check for SPI irq */
100 if (d->irq < 32) 100 if (d->hwirq < 32)
101 return; 101 return;
102 102
103 reg = gpc_base + GPC_IMR1 + (d->irq / 32 - 1) * 4; 103 reg = gpc_base + GPC_IMR1 + (d->hwirq / 32 - 1) * 4;
104 val = readl_relaxed(reg); 104 val = readl_relaxed(reg);
105 val &= ~(1 << d->irq % 32); 105 val &= ~(1 << d->hwirq % 32);
106 writel_relaxed(val, reg); 106 writel_relaxed(val, reg);
107} 107}
108 108
@@ -112,12 +112,12 @@ void imx_gpc_irq_mask(struct irq_data *d)
112 u32 val; 112 u32 val;
113 113
114 /* Sanity check for SPI irq */ 114 /* Sanity check for SPI irq */
115 if (d->irq < 32) 115 if (d->hwirq < 32)
116 return; 116 return;
117 117
118 reg = gpc_base + GPC_IMR1 + (d->irq / 32 - 1) * 4; 118 reg = gpc_base + GPC_IMR1 + (d->hwirq / 32 - 1) * 4;
119 val = readl_relaxed(reg); 119 val = readl_relaxed(reg);
120 val |= 1 << (d->irq % 32); 120 val |= 1 << (d->hwirq % 32);
121 writel_relaxed(val, reg); 121 writel_relaxed(val, reg);
122} 122}
123 123