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

Merge tag 'irqchip-core-v4.5' of git://git.infradead.org/users/jcooper/linux into irq/core

Pull irqchip core changes for v4.5 from Jason Cooper:

- renesas-intc-irqpin: Remove platform code, improve clock handling

- sunxi-nmi: Extend NMI support to include A80

+65 -75
+1 -1
Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt Documentation/devicetree/bindings/interrupt-controller/allwinner,sunxi-nmi.txt
··· 4 4 Required properties: 5 5 6 6 - compatible : should be "allwinner,sun7i-a20-sc-nmi" or 7 - "allwinner,sun6i-a31-sc-nmi" 7 + "allwinner,sun6i-a31-sc-nmi" or "allwinner,sun9i-a80-nmi" 8 8 - reg : Specifies base physical address and size of the registers. 9 9 - interrupt-controller : Identifies the node as an interrupt controller 10 10 - #interrupt-cells : Specifies the number of cells needed to encode an
+51 -45
drivers/irqchip/irq-renesas-intc-irqpin.c
··· 31 31 #include <linux/slab.h> 32 32 #include <linux/module.h> 33 33 #include <linux/of_device.h> 34 - #include <linux/platform_data/irq-renesas-intc-irqpin.h> 35 34 #include <linux/pm_runtime.h> 36 35 37 36 #define INTC_IRQPIN_MAX 8 /* maximum 8 interrupts per driver instance */ ··· 74 75 struct intc_irqpin_priv { 75 76 struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR]; 76 77 struct intc_irqpin_irq irq[INTC_IRQPIN_MAX]; 77 - struct renesas_intc_irqpin_config config; 78 - unsigned int number_of_irqs; 78 + unsigned int sense_bitfield_width; 79 79 struct platform_device *pdev; 80 80 struct irq_chip irq_chip; 81 81 struct irq_domain *irq_domain; 82 82 struct clk *clk; 83 - bool shared_irqs; 83 + unsigned shared_irqs:1; 84 + unsigned needs_clk:1; 84 85 u8 shared_irq_mask; 85 86 }; 86 87 87 - struct intc_irqpin_irlm_config { 88 + struct intc_irqpin_config { 88 89 unsigned int irlm_bit; 90 + unsigned needs_irlm:1; 91 + unsigned needs_clk:1; 89 92 }; 90 93 91 94 static unsigned long intc_irqpin_read32(void __iomem *iomem) ··· 172 171 static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value) 173 172 { 174 173 /* The SENSE register is assumed to be 32-bit. */ 175 - int bitfield_width = p->config.sense_bitfield_width; 174 + int bitfield_width = p->sense_bitfield_width; 176 175 int shift = 32 - (irq + 1) * bitfield_width; 177 176 178 177 dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value); ··· 362 361 .xlate = irq_domain_xlate_twocell, 363 362 }; 364 363 365 - static const struct intc_irqpin_irlm_config intc_irqpin_irlm_r8a777x = { 364 + static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { 366 365 .irlm_bit = 23, /* ICR0.IRLM0 */ 366 + .needs_irlm = 1, 367 + .needs_clk = 0, 368 + }; 369 + 370 + static const struct intc_irqpin_config intc_irqpin_rmobile = { 371 + .needs_irlm = 0, 372 + .needs_clk = 1, 367 373 }; 368 374 369 375 static const struct of_device_id intc_irqpin_dt_ids[] = { ··· 379 371 .data = &intc_irqpin_irlm_r8a777x }, 380 372 { .compatible = "renesas,intc-irqpin-r8a7779", 381 373 .data = &intc_irqpin_irlm_r8a777x }, 374 + { .compatible = "renesas,intc-irqpin-r8a7740", 375 + .data = &intc_irqpin_rmobile }, 376 + { .compatible = "renesas,intc-irqpin-sh73a0", 377 + .data = &intc_irqpin_rmobile }, 382 378 {}, 383 379 }; 384 380 MODULE_DEVICE_TABLE(of, intc_irqpin_dt_ids); 385 381 386 382 static int intc_irqpin_probe(struct platform_device *pdev) 387 383 { 384 + const struct intc_irqpin_config *config = NULL; 388 385 struct device *dev = &pdev->dev; 389 - struct renesas_intc_irqpin_config *pdata = dev->platform_data; 390 386 const struct of_device_id *of_id; 391 387 struct intc_irqpin_priv *p; 392 388 struct intc_irqpin_iomem *i; ··· 400 388 void (*enable_fn)(struct irq_data *d); 401 389 void (*disable_fn)(struct irq_data *d); 402 390 const char *name = dev_name(dev); 391 + bool control_parent; 392 + unsigned int nirqs; 403 393 int ref_irq; 404 394 int ret; 405 395 int k; ··· 413 399 } 414 400 415 401 /* deal with driver instance configuration */ 416 - if (pdata) { 417 - memcpy(&p->config, pdata, sizeof(*pdata)); 418 - } else { 419 - of_property_read_u32(dev->of_node, "sense-bitfield-width", 420 - &p->config.sense_bitfield_width); 421 - p->config.control_parent = of_property_read_bool(dev->of_node, 422 - "control-parent"); 423 - } 424 - if (!p->config.sense_bitfield_width) 425 - p->config.sense_bitfield_width = 4; /* default to 4 bits */ 402 + of_property_read_u32(dev->of_node, "sense-bitfield-width", 403 + &p->sense_bitfield_width); 404 + control_parent = of_property_read_bool(dev->of_node, "control-parent"); 405 + if (!p->sense_bitfield_width) 406 + p->sense_bitfield_width = 4; /* default to 4 bits */ 426 407 427 408 p->pdev = pdev; 428 409 platform_set_drvdata(pdev, p); 429 410 411 + of_id = of_match_device(intc_irqpin_dt_ids, dev); 412 + if (of_id && of_id->data) { 413 + config = of_id->data; 414 + p->needs_clk = config->needs_clk; 415 + } 416 + 430 417 p->clk = devm_clk_get(dev, NULL); 431 418 if (IS_ERR(p->clk)) { 432 - dev_warn(dev, "unable to get clock\n"); 419 + if (p->needs_clk) { 420 + dev_err(dev, "unable to get clock\n"); 421 + ret = PTR_ERR(p->clk); 422 + goto err0; 423 + } 433 424 p->clk = NULL; 434 425 } 435 426 ··· 462 443 p->irq[k].requested_irq = irq->start; 463 444 } 464 445 465 - p->number_of_irqs = k; 466 - if (p->number_of_irqs < 1) { 446 + nirqs = k; 447 + if (nirqs < 1) { 467 448 dev_err(dev, "not enough IRQ resources\n"); 468 449 ret = -EINVAL; 469 450 goto err0; ··· 504 485 } 505 486 506 487 /* configure "individual IRQ mode" where needed */ 507 - of_id = of_match_device(intc_irqpin_dt_ids, dev); 508 - if (of_id && of_id->data) { 509 - const struct intc_irqpin_irlm_config *irlm_config = of_id->data; 510 - 488 + if (config && config->needs_irlm) { 511 489 if (io[INTC_IRQPIN_REG_IRLM]) 512 490 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, 513 - irlm_config->irlm_bit, 514 - 1, 1); 491 + config->irlm_bit, 1, 1); 515 492 else 516 493 dev_warn(dev, "unable to select IRLM mode\n"); 517 494 } 518 495 519 496 /* mask all interrupts using priority */ 520 - for (k = 0; k < p->number_of_irqs; k++) 497 + for (k = 0; k < nirqs; k++) 521 498 intc_irqpin_mask_unmask_prio(p, k, 1); 522 499 523 500 /* clear all pending interrupts */ ··· 521 506 522 507 /* scan for shared interrupt lines */ 523 508 ref_irq = p->irq[0].requested_irq; 524 - p->shared_irqs = true; 525 - for (k = 1; k < p->number_of_irqs; k++) { 509 + p->shared_irqs = 1; 510 + for (k = 1; k < nirqs; k++) { 526 511 if (ref_irq != p->irq[k].requested_irq) { 527 - p->shared_irqs = false; 512 + p->shared_irqs = 0; 528 513 break; 529 514 } 530 515 } 531 516 532 517 /* use more severe masking method if requested */ 533 - if (p->config.control_parent) { 518 + if (control_parent) { 534 519 enable_fn = intc_irqpin_irq_enable_force; 535 520 disable_fn = intc_irqpin_irq_disable_force; 536 521 } else if (!p->shared_irqs) { ··· 549 534 irq_chip->irq_set_wake = intc_irqpin_irq_set_wake; 550 535 irq_chip->flags = IRQCHIP_MASK_ON_SUSPEND; 551 536 552 - p->irq_domain = irq_domain_add_simple(dev->of_node, 553 - p->number_of_irqs, 554 - p->config.irq_base, 537 + p->irq_domain = irq_domain_add_simple(dev->of_node, nirqs, 0, 555 538 &intc_irqpin_irq_domain_ops, p); 556 539 if (!p->irq_domain) { 557 540 ret = -ENXIO; ··· 568 555 } 569 556 } else { 570 557 /* request interrupts one by one */ 571 - for (k = 0; k < p->number_of_irqs; k++) { 558 + for (k = 0; k < nirqs; k++) { 572 559 if (devm_request_irq(dev, p->irq[k].requested_irq, 573 560 intc_irqpin_irq_handler, 0, name, 574 561 &p->irq[k])) { ··· 580 567 } 581 568 582 569 /* unmask all interrupts on prio level */ 583 - for (k = 0; k < p->number_of_irqs; k++) 570 + for (k = 0; k < nirqs; k++) 584 571 intc_irqpin_mask_unmask_prio(p, k, 0); 585 572 586 - dev_info(dev, "driving %d irqs\n", p->number_of_irqs); 587 - 588 - /* warn in case of mismatch if irq base is specified */ 589 - if (p->config.irq_base) { 590 - if (p->config.irq_base != p->irq[0].domain_irq) 591 - dev_warn(dev, "irq base mismatch (%d/%d)\n", 592 - p->config.irq_base, p->irq[0].domain_irq); 593 - } 573 + dev_info(dev, "driving %d irqs\n", nirqs); 594 574 595 575 return 0; 596 576
+13
drivers/irqchip/irq-sunxi-nmi.c
··· 50 50 .enable = 0x34, 51 51 }; 52 52 53 + static struct sunxi_sc_nmi_reg_offs sun9i_reg_offs = { 54 + .ctrl = 0x00, 55 + .pend = 0x08, 56 + .enable = 0x04, 57 + }; 58 + 53 59 static inline void sunxi_sc_nmi_write(struct irq_chip_generic *gc, u32 off, 54 60 u32 val) 55 61 { ··· 213 207 return sunxi_sc_nmi_irq_init(node, &sun7i_reg_offs); 214 208 } 215 209 IRQCHIP_DECLARE(sun7i_sc_nmi, "allwinner,sun7i-a20-sc-nmi", sun7i_sc_nmi_irq_init); 210 + 211 + static int __init sun9i_nmi_irq_init(struct device_node *node, 212 + struct device_node *parent) 213 + { 214 + return sunxi_sc_nmi_irq_init(node, &sun9i_reg_offs); 215 + } 216 + IRQCHIP_DECLARE(sun9i_nmi, "allwinner,sun9i-a80-nmi", sun9i_nmi_irq_init);
-29
include/linux/platform_data/irq-renesas-intc-irqpin.h
··· 1 - /* 2 - * Renesas INTC External IRQ Pin Driver 3 - * 4 - * Copyright (C) 2013 Magnus Damm 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 - */ 19 - 20 - #ifndef __IRQ_RENESAS_INTC_IRQPIN_H__ 21 - #define __IRQ_RENESAS_INTC_IRQPIN_H__ 22 - 23 - struct renesas_intc_irqpin_config { 24 - unsigned int sense_bitfield_width; 25 - unsigned int irq_base; 26 - bool control_parent; 27 - }; 28 - 29 - #endif /* __IRQ_RENESAS_INTC_IRQPIN_H__ */