Skip to content

Commit 5fcbdf7

Browse files
jchandra-brcmralfbaechle
authored andcommitted
MIPS: Netlogic: XLP9XX PIC OF support
Support for adding legacy IRQ domain for XLP9XX. The node id of the PIC has to be calulated differently for XLP9XX. Signed-off-by: Jayachandran C <jchandra@broadcom.com> Signed-off-by: John Crispin <blogic@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/6286/
1 parent 3262b21 commit 5fcbdf7

1 file changed

Lines changed: 31 additions & 6 deletions

File tree

  • arch/mips/netlogic/common

‎arch/mips/netlogic/common/irq.c‎

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ asmlinkage void plat_irq_dispatch(void)
274274
}
275275

276276
#ifdef CONFIG_OF
277-
static struct irq_domain *xlp_pic_domain;
278-
279277
static const struct irq_domain_ops xlp_pic_irq_domain_ops = {
280278
.xlate = irq_domain_xlate_onetwocell,
281279
};
@@ -284,25 +282,52 @@ static int __init xlp_of_pic_init(struct device_node *node,
284282
struct device_node *parent)
285283
{
286284
const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1;
285+
struct irq_domain *xlp_pic_domain;
287286
struct resource res;
288-
int socid, ret;
287+
int socid, ret, bus;
289288

290289
/* we need a hack to get the PIC's SoC chip id */
291290
ret = of_address_to_resource(node, 0, &res);
292291
if (ret < 0) {
293292
pr_err("PIC %s: reg property not found!\n", node->name);
294293
return -EINVAL;
295294
}
296-
socid = (res.start >> 18) & 0x3;
295+
296+
if (cpu_is_xlp9xx()) {
297+
bus = (res.start >> 20) & 0xf;
298+
for (socid = 0; socid < NLM_NR_NODES; socid++) {
299+
if (!nlm_node_present(socid))
300+
continue;
301+
if (nlm_get_node(socid)->socbus == bus)
302+
break;
303+
}
304+
if (socid == NLM_NR_NODES) {
305+
pr_err("PIC %s: Node mapping for bus %d not found!\n",
306+
node->name, bus);
307+
return -EINVAL;
308+
}
309+
} else {
310+
socid = (res.start >> 18) & 0x3;
311+
if (!nlm_node_present(socid)) {
312+
pr_err("PIC %s: node %d does not exist!\n",
313+
node->name, socid);
314+
return -EINVAL;
315+
}
316+
}
317+
318+
if (!nlm_node_present(socid)) {
319+
pr_err("PIC %s: node %d does not exist!\n", node->name, socid);
320+
return -EINVAL;
321+
}
322+
297323
xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs,
298324
nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE,
299325
&xlp_pic_irq_domain_ops, NULL);
300326
if (xlp_pic_domain == NULL) {
301327
pr_err("PIC %s: Creating legacy domain failed!\n", node->name);
302328
return -EINVAL;
303329
}
304-
pr_info("Node %d: IRQ domain created for PIC@%pa\n", socid,
305-
&res.start);
330+
pr_info("Node %d: IRQ domain created for PIC@%pR\n", socid, &res);
306331
return 0;
307332
}
308333

0 commit comments

Comments
 (0)