|
17 | 17 |
|
18 | 18 | #define GPC_IMR1_CORE0 0x30
|
19 | 19 | #define GPC_IMR1_CORE1 0x40
|
| 20 | +#define GPC_IMR1_CORE2 0x1c0 |
| 21 | +#define GPC_IMR1_CORE3 0x1d0 |
| 22 | + |
20 | 23 |
|
21 | 24 | struct gpcv2_irqchip_data {
|
22 | 25 | struct raw_spinlock rlock;
|
@@ -192,18 +195,34 @@ static const struct irq_domain_ops gpcv2_irqchip_data_domain_ops = {
|
192 | 195 | .free = irq_domain_free_irqs_common,
|
193 | 196 | };
|
194 | 197 |
|
| 198 | +static const struct of_device_id gpcv2_of_match[] = { |
| 199 | + { .compatible = "fsl,imx7d-gpc", .data = (const void *) 2 }, |
| 200 | + { .compatible = "fsl,imx8mq-gpc", .data = (const void *) 4 }, |
| 201 | + { /* END */ } |
| 202 | +}; |
| 203 | + |
195 | 204 | static int __init imx_gpcv2_irqchip_init(struct device_node *node,
|
196 | 205 | struct device_node *parent)
|
197 | 206 | {
|
198 | 207 | struct irq_domain *parent_domain, *domain;
|
199 | 208 | struct gpcv2_irqchip_data *cd;
|
| 209 | + const struct of_device_id *id; |
| 210 | + unsigned long core_num; |
200 | 211 | int i;
|
201 | 212 |
|
202 | 213 | if (!parent) {
|
203 | 214 | pr_err("%pOF: no parent, giving up\n", node);
|
204 | 215 | return -ENODEV;
|
205 | 216 | }
|
206 | 217 |
|
| 218 | + id = of_match_node(gpcv2_of_match, node); |
| 219 | + if (!id) { |
| 220 | + pr_err("%pOF: unknown compatibility string\n", node); |
| 221 | + return -ENODEV; |
| 222 | + } |
| 223 | + |
| 224 | + core_num = (unsigned long)id->data; |
| 225 | + |
207 | 226 | parent_domain = irq_find_host(parent);
|
208 | 227 | if (!parent_domain) {
|
209 | 228 | pr_err("%pOF: unable to get parent domain\n", node);
|
@@ -236,8 +255,16 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
|
236 | 255 |
|
237 | 256 | /* Initially mask all interrupts */
|
238 | 257 | for (i = 0; i < IMR_NUM; i++) {
|
239 |
| - writel_relaxed(~0, cd->gpc_base + GPC_IMR1_CORE0 + i * 4); |
240 |
| - writel_relaxed(~0, cd->gpc_base + GPC_IMR1_CORE1 + i * 4); |
| 258 | + void __iomem *reg = cd->gpc_base + i * 4; |
| 259 | + |
| 260 | + switch (core_num) { |
| 261 | + case 4: |
| 262 | + writel_relaxed(~0, reg + GPC_IMR1_CORE2); |
| 263 | + writel_relaxed(~0, reg + GPC_IMR1_CORE3); |
| 264 | + case 2: /* FALLTHROUGH */ |
| 265 | + writel_relaxed(~0, reg + GPC_IMR1_CORE0); |
| 266 | + writel_relaxed(~0, reg + GPC_IMR1_CORE1); |
| 267 | + } |
241 | 268 | cd->wakeup_sources[i] = ~0;
|
242 | 269 | }
|
243 | 270 |
|
|
0 commit comments