mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 17:42:03 +02:00
irqchip/qcom-pdc: Kill non-wakeup irqdomain
A careful look at the way the PDC driver works shows that: - all interrupts are in the same space - all interrupts are treated the same And yet the driver creates two domains based on whether the interrupt gets mapped directly or from the pinctrl code, which is obviously a waste of resources. Kill the non-wakeup domain and unify all the interrupt handling. Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220224101226.88373-3-maz@kernel.org
This commit is contained in:
parent
8d4c998919
commit
4dc70713dc
|
|
@ -21,7 +21,6 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
#define PDC_MAX_IRQS 168
|
|
||||||
#define PDC_MAX_GPIO_IRQS 256
|
#define PDC_MAX_GPIO_IRQS 256
|
||||||
|
|
||||||
#define CLEAR_INTR(reg, intr) (reg & ~(1 << intr))
|
#define CLEAR_INTR(reg, intr) (reg & ~(1 << intr))
|
||||||
|
|
@ -224,51 +223,6 @@ static int qcom_pdc_alloc(struct irq_domain *domain, unsigned int virq,
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = qcom_pdc_translate(domain, fwspec, &hwirq, &type);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
|
|
||||||
&qcom_pdc_gic_chip, NULL);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
region = get_pin_region(hwirq);
|
|
||||||
if (!region)
|
|
||||||
return irq_domain_disconnect_hierarchy(domain->parent, virq);
|
|
||||||
|
|
||||||
if (type & IRQ_TYPE_EDGE_BOTH)
|
|
||||||
type = IRQ_TYPE_EDGE_RISING;
|
|
||||||
|
|
||||||
if (type & IRQ_TYPE_LEVEL_MASK)
|
|
||||||
type = IRQ_TYPE_LEVEL_HIGH;
|
|
||||||
|
|
||||||
parent_fwspec.fwnode = domain->parent->fwnode;
|
|
||||||
parent_fwspec.param_count = 3;
|
|
||||||
parent_fwspec.param[0] = 0;
|
|
||||||
parent_fwspec.param[1] = pin_to_hwirq(region, hwirq);
|
|
||||||
parent_fwspec.param[2] = type;
|
|
||||||
|
|
||||||
return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
|
|
||||||
&parent_fwspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct irq_domain_ops qcom_pdc_ops = {
|
|
||||||
.translate = qcom_pdc_translate,
|
|
||||||
.alloc = qcom_pdc_alloc,
|
|
||||||
.free = irq_domain_free_irqs_common,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq,
|
|
||||||
unsigned int nr_irqs, void *data)
|
|
||||||
{
|
|
||||||
struct irq_fwspec *fwspec = data;
|
|
||||||
struct irq_fwspec parent_fwspec;
|
|
||||||
struct pdc_pin_region *region;
|
|
||||||
irq_hw_number_t hwirq;
|
|
||||||
unsigned int type;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = qcom_pdc_translate(domain, fwspec, &hwirq, &type);
|
ret = qcom_pdc_translate(domain, fwspec, &hwirq, &type);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -301,16 +255,9 @@ static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq,
|
||||||
&parent_fwspec);
|
&parent_fwspec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qcom_pdc_gpio_domain_select(struct irq_domain *d,
|
static const struct irq_domain_ops qcom_pdc_ops = {
|
||||||
struct irq_fwspec *fwspec,
|
.translate = qcom_pdc_translate,
|
||||||
enum irq_domain_bus_token bus_token)
|
.alloc = qcom_pdc_alloc,
|
||||||
{
|
|
||||||
return bus_token == DOMAIN_BUS_WAKEUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct irq_domain_ops qcom_pdc_gpio_ops = {
|
|
||||||
.select = qcom_pdc_gpio_domain_select,
|
|
||||||
.alloc = qcom_pdc_gpio_alloc,
|
|
||||||
.free = irq_domain_free_irqs_common,
|
.free = irq_domain_free_irqs_common,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -361,7 +308,7 @@ static int pdc_setup_pin_mapping(struct device_node *np)
|
||||||
|
|
||||||
static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
|
static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
|
||||||
{
|
{
|
||||||
struct irq_domain *parent_domain, *pdc_domain, *pdc_gpio_domain;
|
struct irq_domain *parent_domain, *pdc_domain;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pdc_base = of_iomap(node, 0);
|
pdc_base = of_iomap(node, 0);
|
||||||
|
|
@ -383,32 +330,21 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdc_domain = irq_domain_create_hierarchy(parent_domain, 0, PDC_MAX_IRQS,
|
pdc_domain = irq_domain_create_hierarchy(parent_domain,
|
||||||
of_fwnode_handle(node),
|
IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP,
|
||||||
&qcom_pdc_ops, NULL);
|
PDC_MAX_GPIO_IRQS,
|
||||||
|
of_fwnode_handle(node),
|
||||||
|
&qcom_pdc_ops, NULL);
|
||||||
if (!pdc_domain) {
|
if (!pdc_domain) {
|
||||||
pr_err("%pOF: GIC domain add failed\n", node);
|
pr_err("%pOF: PDC domain add failed\n", node);
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdc_gpio_domain = irq_domain_create_hierarchy(parent_domain,
|
irq_domain_update_bus_token(pdc_domain, DOMAIN_BUS_WAKEUP);
|
||||||
IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP,
|
|
||||||
PDC_MAX_GPIO_IRQS,
|
|
||||||
of_fwnode_handle(node),
|
|
||||||
&qcom_pdc_gpio_ops, NULL);
|
|
||||||
if (!pdc_gpio_domain) {
|
|
||||||
pr_err("%pOF: PDC domain add failed for GPIO domain\n", node);
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto remove;
|
|
||||||
}
|
|
||||||
|
|
||||||
irq_domain_update_bus_token(pdc_gpio_domain, DOMAIN_BUS_WAKEUP);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
remove:
|
|
||||||
irq_domain_remove(pdc_domain);
|
|
||||||
fail:
|
fail:
|
||||||
kfree(pdc_region);
|
kfree(pdc_region);
|
||||||
iounmap(pdc_base);
|
iounmap(pdc_base);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user