Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Netlogic: Add XLP PIC irqdomain

Add a legacy irq domain for the XLP PIC interrupts. This will be used
when interrupts are assigned from the device tree. This change is required
after commit c5cdc67 "irqdomain: Remove temporary MIPS workaround code".

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Cc: Jayachandran C <jchandra@broadcom.com>
Patchwork: https://patchwork.linux-mips.org/patch/5597/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Jayachandran C and committed by
Ralf Baechle
628f0650 35ac7840

+61 -13
+57 -11
arch/mips/netlogic/common/irq.c
··· 40 40 #include <linux/slab.h> 41 41 #include <linux/irq.h> 42 42 43 + #include <linux/irqdomain.h> 44 + #include <linux/of_address.h> 45 + #include <linux/of_irq.h> 46 + 43 47 #include <asm/errno.h> 44 48 #include <asm/signal.h> 45 49 #include <asm/ptrace.h> ··· 227 223 nodep->irqmask = irqmask; 228 224 } 229 225 230 - void __init arch_init_irq(void) 231 - { 232 - /* Initialize the irq descriptors */ 233 - nlm_init_percpu_irqs(); 234 - nlm_init_node_irqs(0); 235 - write_c0_eimr(nlm_current_node()->irqmask); 236 - #if defined(CONFIG_CPU_XLR) 237 - nlm_setup_fmn_irq(); 238 - #endif 239 - } 240 - 241 226 void nlm_smp_irq_init(int hwcpuid) 242 227 { 243 228 int node, cpu; ··· 258 265 259 266 /* top level irq handling */ 260 267 do_IRQ(nlm_irq_to_xirq(node, i)); 268 + } 269 + 270 + #ifdef CONFIG_OF 271 + static struct irq_domain *xlp_pic_domain; 272 + 273 + static const struct irq_domain_ops xlp_pic_irq_domain_ops = { 274 + .xlate = irq_domain_xlate_onetwocell, 275 + }; 276 + 277 + static int __init xlp_of_pic_init(struct device_node *node, 278 + struct device_node *parent) 279 + { 280 + const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1; 281 + struct resource res; 282 + int socid, ret; 283 + 284 + /* we need a hack to get the PIC's SoC chip id */ 285 + ret = of_address_to_resource(node, 0, &res); 286 + if (ret < 0) { 287 + pr_err("PIC %s: reg property not found!\n", node->name); 288 + return -EINVAL; 289 + } 290 + socid = (res.start >> 18) & 0x3; 291 + xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs, 292 + nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE, 293 + &xlp_pic_irq_domain_ops, NULL); 294 + if (xlp_pic_domain == NULL) { 295 + pr_err("PIC %s: Creating legacy domain failed!\n", node->name); 296 + return -EINVAL; 297 + } 298 + pr_info("Node %d: IRQ domain created for PIC@%pa\n", socid, 299 + &res.start); 300 + return 0; 301 + } 302 + 303 + static struct of_device_id __initdata xlp_pic_irq_ids[] = { 304 + { .compatible = "netlogic,xlp-pic", .data = xlp_of_pic_init }, 305 + {}, 306 + }; 307 + #endif 308 + 309 + void __init arch_init_irq(void) 310 + { 311 + /* Initialize the irq descriptors */ 312 + nlm_init_percpu_irqs(); 313 + nlm_init_node_irqs(0); 314 + write_c0_eimr(nlm_current_node()->irqmask); 315 + #if defined(CONFIG_CPU_XLR) 316 + nlm_setup_fmn_irq(); 317 + #endif 318 + #if defined(CONFIG_OF) 319 + of_irq_init(xlp_pic_irq_ids); 320 + #endif 261 321 }
+2 -1
arch/mips/netlogic/dts/xlp_evp.dts
··· 76 76 }; 77 77 }; 78 78 pic: pic@4000 { 79 - interrupt-controller; 79 + compatible = "netlogic,xlp-pic"; 80 80 #address-cells = <0>; 81 81 #interrupt-cells = <1>; 82 82 reg = <0 0x4000 0x200>; 83 + interrupt-controller; 83 84 }; 84 85 85 86 nor_flash@1,0 {
+2 -1
arch/mips/netlogic/dts/xlp_svp.dts
··· 76 76 }; 77 77 }; 78 78 pic: pic@4000 { 79 - interrupt-controller; 79 + compatible = "netlogic,xlp-pic"; 80 80 #address-cells = <0>; 81 81 #interrupt-cells = <1>; 82 82 reg = <0 0x4000 0x200>; 83 + interrupt-controller; 83 84 }; 84 85 85 86 nor_flash@1,0 {