pinctrl: armada-37xx: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230403-immutable-irqchips-v1-3-503788a7f6e6@linaro.org
This commit is contained in:
parent
bb7e64e60e
commit
dccdc09199
@ -23,6 +23,7 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/string_helpers.h>
|
#include <linux/string_helpers.h>
|
||||||
|
|
||||||
@ -101,7 +102,6 @@ struct armada_37xx_pinctrl {
|
|||||||
const struct armada_37xx_pin_data *data;
|
const struct armada_37xx_pin_data *data;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct gpio_chip gpio_chip;
|
struct gpio_chip gpio_chip;
|
||||||
struct irq_chip irq_chip;
|
|
||||||
raw_spinlock_t irq_lock;
|
raw_spinlock_t irq_lock;
|
||||||
struct pinctrl_desc pctl;
|
struct pinctrl_desc pctl;
|
||||||
struct pinctrl_dev *pctl_dev;
|
struct pinctrl_dev *pctl_dev;
|
||||||
@ -548,6 +548,7 @@ static void armada_37xx_irq_mask(struct irq_data *d)
|
|||||||
val = readl(info->base + reg);
|
val = readl(info->base + reg);
|
||||||
writel(val & ~d->mask, info->base + reg);
|
writel(val & ~d->mask, info->base + reg);
|
||||||
raw_spin_unlock_irqrestore(&info->irq_lock, flags);
|
raw_spin_unlock_irqrestore(&info->irq_lock, flags);
|
||||||
|
gpiochip_disable_irq(chip, irqd_to_hwirq(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void armada_37xx_irq_unmask(struct irq_data *d)
|
static void armada_37xx_irq_unmask(struct irq_data *d)
|
||||||
@ -557,6 +558,7 @@ static void armada_37xx_irq_unmask(struct irq_data *d)
|
|||||||
u32 val, reg = IRQ_EN;
|
u32 val, reg = IRQ_EN;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
gpiochip_enable_irq(chip, irqd_to_hwirq(d));
|
||||||
armada_37xx_irq_update_reg(®, d);
|
armada_37xx_irq_update_reg(®, d);
|
||||||
raw_spin_lock_irqsave(&info->irq_lock, flags);
|
raw_spin_lock_irqsave(&info->irq_lock, flags);
|
||||||
val = readl(info->base + reg);
|
val = readl(info->base + reg);
|
||||||
@ -729,11 +731,30 @@ static unsigned int armada_37xx_irq_startup(struct irq_data *d)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void armada_37xx_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||||
|
{
|
||||||
|
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
|
||||||
|
struct armada_37xx_pinctrl *info = gpiochip_get_data(chip);
|
||||||
|
|
||||||
|
seq_printf(p, info->data->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct irq_chip armada_37xx_irqchip = {
|
||||||
|
.irq_ack = armada_37xx_irq_ack,
|
||||||
|
.irq_mask = armada_37xx_irq_mask,
|
||||||
|
.irq_unmask = armada_37xx_irq_unmask,
|
||||||
|
.irq_set_wake = armada_37xx_irq_set_wake,
|
||||||
|
.irq_set_type = armada_37xx_irq_set_type,
|
||||||
|
.irq_startup = armada_37xx_irq_startup,
|
||||||
|
.irq_print_chip = armada_37xx_irq_print_chip,
|
||||||
|
.flags = IRQCHIP_IMMUTABLE,
|
||||||
|
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||||
|
};
|
||||||
|
|
||||||
static int armada_37xx_irqchip_register(struct platform_device *pdev,
|
static int armada_37xx_irqchip_register(struct platform_device *pdev,
|
||||||
struct armada_37xx_pinctrl *info)
|
struct armada_37xx_pinctrl *info)
|
||||||
{
|
{
|
||||||
struct gpio_chip *gc = &info->gpio_chip;
|
struct gpio_chip *gc = &info->gpio_chip;
|
||||||
struct irq_chip *irqchip = &info->irq_chip;
|
|
||||||
struct gpio_irq_chip *girq = &gc->irq;
|
struct gpio_irq_chip *girq = &gc->irq;
|
||||||
struct device_node *np = to_of_node(gc->fwnode);
|
struct device_node *np = to_of_node(gc->fwnode);
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
@ -751,14 +772,7 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
|
|||||||
if (IS_ERR(info->base))
|
if (IS_ERR(info->base))
|
||||||
return PTR_ERR(info->base);
|
return PTR_ERR(info->base);
|
||||||
|
|
||||||
irqchip->irq_ack = armada_37xx_irq_ack;
|
gpio_irq_chip_set_chip(girq, &armada_37xx_irqchip);
|
||||||
irqchip->irq_mask = armada_37xx_irq_mask;
|
|
||||||
irqchip->irq_unmask = armada_37xx_irq_unmask;
|
|
||||||
irqchip->irq_set_wake = armada_37xx_irq_set_wake;
|
|
||||||
irqchip->irq_set_type = armada_37xx_irq_set_type;
|
|
||||||
irqchip->irq_startup = armada_37xx_irq_startup;
|
|
||||||
irqchip->name = info->data->name;
|
|
||||||
girq->chip = irqchip;
|
|
||||||
girq->parent_handler = armada_37xx_irq_handler;
|
girq->parent_handler = armada_37xx_irq_handler;
|
||||||
/*
|
/*
|
||||||
* Many interrupts are connected to the parent interrupt
|
* Many interrupts are connected to the parent interrupt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user