1 From b1d33d1e5a44afd2025c5a44a85dc2fab00ec6a7 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Tue, 5 Nov 2019 11:28:19 +0000
4 Subject: [PATCH] Revert "pinctrl: bcm2835: Pass irqchip when adding
7 This reverts commit 73345a18d464b1b945b29f54f630ace6873344e2.
9 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 55 +++++++++++++++------------
10 1 file changed, 30 insertions(+), 25 deletions(-)
12 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
13 +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
15 struct bcm2835_pinctrl {
18 + int irq[BCM2835_NUM_IRQS];
20 /* note: locking assumes each bank will have its own unsigned long */
21 unsigned long enabled_irq_map[BCM2835_NUM_BANKS];
22 @@ -381,14 +382,14 @@ static void bcm2835_gpio_irq_handler(str
26 - for (i = 0; i < BCM2835_NUM_IRQS; i++) {
27 - if (chip->irq.parents[i] == irq) {
28 + for (i = 0; i < ARRAY_SIZE(pc->irq); i++) {
29 + if (pc->irq[i] == irq) {
34 /* This should not happen, every IRQ has a bank */
35 - if (i == BCM2835_NUM_IRQS)
36 + if (i == ARRAY_SIZE(pc->irq))
39 chained_irq_enter(host_chip, desc);
40 @@ -1086,7 +1087,6 @@ static int bcm2835_pinctrl_probe(struct
41 struct device *dev = &pdev->dev;
42 struct device_node *np = dev->of_node;
43 struct bcm2835_pinctrl *pc;
44 - struct gpio_irq_chip *girq;
45 struct resource iomem;
47 const struct of_device_id *match;
48 @@ -1135,33 +1135,38 @@ static int bcm2835_pinctrl_probe(struct
49 raw_spin_lock_init(&pc->irq_lock[i]);
52 - girq = &pc->gpio_chip.irq;
53 - girq->chip = &bcm2835_gpio_irq_chip;
54 - girq->parent_handler = bcm2835_gpio_irq_handler;
55 - girq->num_parents = BCM2835_NUM_IRQS;
56 - girq->parents = devm_kcalloc(dev, BCM2835_NUM_IRQS,
57 - sizeof(*girq->parents),
62 - * Use the same handler for all groups: this is necessary
63 - * since we use one gpiochip to cover all lines - the
64 - * irq handler then needs to figure out which group and
65 - * bank that was firing the IRQ and look up the per-group
68 - for (i = 0; i < BCM2835_NUM_IRQS; i++)
69 - girq->parents[i] = irq_of_parse_and_map(np, i);
70 - girq->default_type = IRQ_TYPE_NONE;
71 - girq->handler = handle_level_irq;
73 err = gpiochip_add_data(&pc->gpio_chip, pc);
75 dev_err(dev, "could not add GPIO chip\n");
79 + err = gpiochip_irqchip_add(&pc->gpio_chip, &bcm2835_gpio_irq_chip,
80 + 0, handle_level_irq, IRQ_TYPE_NONE);
82 + dev_info(dev, "could not add irqchip\n");
86 + for (i = 0; i < BCM2835_NUM_IRQS; i++) {
87 + pc->irq[i] = irq_of_parse_and_map(np, i);
89 + if (pc->irq[i] == 0)
93 + * Use the same handler for all groups: this is necessary
94 + * since we use one gpiochip to cover all lines - the
95 + * irq handler then needs to figure out which group and
96 + * bank that was firing the IRQ and look up the per-group
99 + gpiochip_set_chained_irqchip(&pc->gpio_chip,
100 + &bcm2835_gpio_irq_chip,
102 + bcm2835_gpio_irq_handler);
105 match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node);
107 bcm2835_pinctrl_desc.confops =