diff options
author | Jayachandran C <jchandra@broadcom.com> | 2013-12-21 06:22:29 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-01-24 16:39:50 -0500 |
commit | 5fcbdf7cac23fd07f9de30eab760d3a5864f7330 (patch) | |
tree | 2e851603a4d9159128e87a10d1b0dec86cf8a3f2 /arch/mips/netlogic | |
parent | 3262b21ef8523175f0758f4deccec048e73d5b18 (diff) |
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/
Diffstat (limited to 'arch/mips/netlogic')
-rw-r--r-- | arch/mips/netlogic/common/irq.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c index 8092bb320618..5afc4b7fce0f 100644 --- a/arch/mips/netlogic/common/irq.c +++ b/arch/mips/netlogic/common/irq.c | |||
@@ -274,8 +274,6 @@ asmlinkage void plat_irq_dispatch(void) | |||
274 | } | 274 | } |
275 | 275 | ||
276 | #ifdef CONFIG_OF | 276 | #ifdef CONFIG_OF |
277 | static struct irq_domain *xlp_pic_domain; | ||
278 | |||
279 | static const struct irq_domain_ops xlp_pic_irq_domain_ops = { | 277 | static const struct irq_domain_ops xlp_pic_irq_domain_ops = { |
280 | .xlate = irq_domain_xlate_onetwocell, | 278 | .xlate = irq_domain_xlate_onetwocell, |
281 | }; | 279 | }; |
@@ -284,8 +282,9 @@ static int __init xlp_of_pic_init(struct device_node *node, | |||
284 | struct device_node *parent) | 282 | struct device_node *parent) |
285 | { | 283 | { |
286 | const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1; | 284 | const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1; |
285 | struct irq_domain *xlp_pic_domain; | ||
287 | struct resource res; | 286 | struct resource res; |
288 | int socid, ret; | 287 | int socid, ret, bus; |
289 | 288 | ||
290 | /* we need a hack to get the PIC's SoC chip id */ | 289 | /* we need a hack to get the PIC's SoC chip id */ |
291 | ret = of_address_to_resource(node, 0, &res); | 290 | ret = of_address_to_resource(node, 0, &res); |
@@ -293,7 +292,34 @@ static int __init xlp_of_pic_init(struct device_node *node, | |||
293 | pr_err("PIC %s: reg property not found!\n", node->name); | 292 | pr_err("PIC %s: reg property not found!\n", node->name); |
294 | return -EINVAL; | 293 | return -EINVAL; |
295 | } | 294 | } |
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 | |||
297 | xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs, | 323 | xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs, |
298 | nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE, | 324 | nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE, |
299 | &xlp_pic_irq_domain_ops, NULL); | 325 | &xlp_pic_irq_domain_ops, NULL); |
@@ -301,8 +327,7 @@ static int __init xlp_of_pic_init(struct device_node *node, | |||
301 | pr_err("PIC %s: Creating legacy domain failed!\n", node->name); | 327 | pr_err("PIC %s: Creating legacy domain failed!\n", node->name); |
302 | return -EINVAL; | 328 | return -EINVAL; |
303 | } | 329 | } |
304 | pr_info("Node %d: IRQ domain created for PIC@%pa\n", socid, | 330 | pr_info("Node %d: IRQ domain created for PIC@%pR\n", socid, &res); |
305 | &res.start); | ||
306 | return 0; | 331 | return 0; |
307 | } | 332 | } |
308 | 333 | ||