mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Merge branch 'irq/for-arm' into irq/core
Pull in the branch which can be consumed by ARM to build their changes on top.
This commit is contained in:
commit
939ef66848
8 changed files with 102 additions and 14 deletions
|
|
@ -30,6 +30,7 @@ config ARM_GIC_V3_ITS
|
|||
config ARM_NVIC
|
||||
bool
|
||||
select IRQ_DOMAIN
|
||||
select IRQ_DOMAIN_HIERARCHY
|
||||
select GENERIC_IRQ_CHIP
|
||||
|
||||
config ARM_VIC
|
||||
|
|
|
|||
|
|
@ -49,6 +49,31 @@ nvic_handle_irq(irq_hw_number_t hwirq, struct pt_regs *regs)
|
|||
handle_IRQ(irq, regs);
|
||||
}
|
||||
|
||||
static int nvic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
|
||||
unsigned int nr_irqs, void *arg)
|
||||
{
|
||||
int i, ret;
|
||||
irq_hw_number_t hwirq;
|
||||
unsigned int type = IRQ_TYPE_NONE;
|
||||
struct of_phandle_args *irq_data = arg;
|
||||
|
||||
ret = irq_domain_xlate_onecell(domain, irq_data->np, irq_data->args,
|
||||
irq_data->args_count, &hwirq, &type);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < nr_irqs; i++)
|
||||
irq_map_generic_chip(domain, virq + i, hwirq + i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct irq_domain_ops nvic_irq_domain_ops = {
|
||||
.xlate = irq_domain_xlate_onecell,
|
||||
.alloc = nvic_irq_domain_alloc,
|
||||
.free = irq_domain_free_irqs_top,
|
||||
};
|
||||
|
||||
static int __init nvic_of_init(struct device_node *node,
|
||||
struct device_node *parent)
|
||||
{
|
||||
|
|
@ -70,7 +95,8 @@ static int __init nvic_of_init(struct device_node *node,
|
|||
irqs = NVIC_MAX_IRQ;
|
||||
|
||||
nvic_irq_domain =
|
||||
irq_domain_add_linear(node, irqs, &irq_generic_chip_ops, NULL);
|
||||
irq_domain_add_linear(node, irqs, &nvic_irq_domain_ops, NULL);
|
||||
|
||||
if (!nvic_irq_domain) {
|
||||
pr_warn("Failed to allocate irq domain\n");
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ struct vf610_mscm_ir_chip_data {
|
|||
void __iomem *mscm_ir_base;
|
||||
u16 cpu_mask;
|
||||
u16 saved_irsprc[MSCM_IRSPRC_NUM];
|
||||
bool is_nvic;
|
||||
};
|
||||
|
||||
static struct vf610_mscm_ir_chip_data *mscm_ir_data;
|
||||
|
|
@ -101,7 +102,7 @@ static void vf610_mscm_ir_enable(struct irq_data *data)
|
|||
writew_relaxed(chip_data->cpu_mask,
|
||||
chip_data->mscm_ir_base + MSCM_IRSPRC(hwirq));
|
||||
|
||||
irq_chip_unmask_parent(data);
|
||||
irq_chip_enable_parent(data);
|
||||
}
|
||||
|
||||
static void vf610_mscm_ir_disable(struct irq_data *data)
|
||||
|
|
@ -111,7 +112,7 @@ static void vf610_mscm_ir_disable(struct irq_data *data)
|
|||
|
||||
writew_relaxed(0x0, chip_data->mscm_ir_base + MSCM_IRSPRC(hwirq));
|
||||
|
||||
irq_chip_mask_parent(data);
|
||||
irq_chip_disable_parent(data);
|
||||
}
|
||||
|
||||
static struct irq_chip vf610_mscm_ir_irq_chip = {
|
||||
|
|
@ -143,10 +144,17 @@ static int vf610_mscm_ir_domain_alloc(struct irq_domain *domain, unsigned int vi
|
|||
domain->host_data);
|
||||
|
||||
gic_data.np = domain->parent->of_node;
|
||||
gic_data.args_count = 3;
|
||||
gic_data.args[0] = GIC_SPI;
|
||||
gic_data.args[1] = irq_data->args[0];
|
||||
gic_data.args[2] = irq_data->args[1];
|
||||
|
||||
if (mscm_ir_data->is_nvic) {
|
||||
gic_data.args_count = 1;
|
||||
gic_data.args[0] = irq_data->args[0];
|
||||
} else {
|
||||
gic_data.args_count = 3;
|
||||
gic_data.args[0] = GIC_SPI;
|
||||
gic_data.args[1] = irq_data->args[0];
|
||||
gic_data.args[2] = irq_data->args[1];
|
||||
}
|
||||
|
||||
return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &gic_data);
|
||||
}
|
||||
|
||||
|
|
@ -198,6 +206,9 @@ static int __init vf610_mscm_ir_of_init(struct device_node *node,
|
|||
goto out_unmap;
|
||||
}
|
||||
|
||||
if (of_device_is_compatible(domain->parent->of_node, "arm,armv7m-nvic"))
|
||||
mscm_ir_data->is_nvic = true;
|
||||
|
||||
cpu_pm_register_notifier(&mscm_ir_notifier_block);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue