Commit f84f1f46 authored by Mark Salter's avatar Mark Salter

C6X: remove dependence on legacy IRQs

The core priority PIC code uses legacy irq support to facilitate direct
mapping of core hw interrupt numbers to linux interrupt numbers. This
patch removes the legacy irq usage and replaces it with a generic linear
mapping.
Signed-off-by: default avatarMark Salter <msalter@redhat.com>
parent b3f89562
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
*/ */
#define NR_PRIORITY_IRQS 16 #define NR_PRIORITY_IRQS 16
#define NR_IRQS_LEGACY NR_PRIORITY_IRQS
/* Total number of virq in the platform */ /* Total number of virq in the platform */
#define NR_IRQS 256 #define NR_IRQS 256
......
/* /*
* Copyright (C) 2011 Texas Instruments Incorporated * Copyright (C) 2011-2012 Texas Instruments Incorporated
* *
* This borrows heavily from powerpc version, which is: * This borrows heavily from powerpc version, which is:
* *
...@@ -35,9 +35,7 @@ static DEFINE_RAW_SPINLOCK(core_irq_lock); ...@@ -35,9 +35,7 @@ static DEFINE_RAW_SPINLOCK(core_irq_lock);
static void mask_core_irq(struct irq_data *data) static void mask_core_irq(struct irq_data *data)
{ {
unsigned int prio = data->irq; unsigned int prio = data->hwirq;
BUG_ON(prio < 4 || prio >= NR_PRIORITY_IRQS);
raw_spin_lock(&core_irq_lock); raw_spin_lock(&core_irq_lock);
and_creg(IER, ~(1 << prio)); and_creg(IER, ~(1 << prio));
...@@ -46,7 +44,7 @@ static void mask_core_irq(struct irq_data *data) ...@@ -46,7 +44,7 @@ static void mask_core_irq(struct irq_data *data)
static void unmask_core_irq(struct irq_data *data) static void unmask_core_irq(struct irq_data *data)
{ {
unsigned int prio = data->irq; unsigned int prio = data->hwirq;
raw_spin_lock(&core_irq_lock); raw_spin_lock(&core_irq_lock);
or_creg(IER, 1 << prio); or_creg(IER, 1 << prio);
...@@ -59,15 +57,15 @@ static struct irq_chip core_chip = { ...@@ -59,15 +57,15 @@ static struct irq_chip core_chip = {
.irq_unmask = unmask_core_irq, .irq_unmask = unmask_core_irq,
}; };
static int prio_to_virq[NR_PRIORITY_IRQS];
asmlinkage void c6x_do_IRQ(unsigned int prio, struct pt_regs *regs) asmlinkage void c6x_do_IRQ(unsigned int prio, struct pt_regs *regs)
{ {
struct pt_regs *old_regs = set_irq_regs(regs); struct pt_regs *old_regs = set_irq_regs(regs);
irq_enter(); irq_enter();
BUG_ON(prio < 4 || prio >= NR_PRIORITY_IRQS); generic_handle_irq(prio_to_virq[prio]);
generic_handle_irq(prio);
irq_exit(); irq_exit();
...@@ -82,6 +80,8 @@ static int core_domain_map(struct irq_domain *h, unsigned int virq, ...@@ -82,6 +80,8 @@ static int core_domain_map(struct irq_domain *h, unsigned int virq,
if (hw < 4 || hw >= NR_PRIORITY_IRQS) if (hw < 4 || hw >= NR_PRIORITY_IRQS)
return -EINVAL; return -EINVAL;
prio_to_virq[hw] = virq;
irq_set_status_flags(virq, IRQ_LEVEL); irq_set_status_flags(virq, IRQ_LEVEL);
irq_set_chip_and_handler(virq, &core_chip, handle_level_irq); irq_set_chip_and_handler(virq, &core_chip, handle_level_irq);
return 0; return 0;
...@@ -102,9 +102,8 @@ void __init init_IRQ(void) ...@@ -102,9 +102,8 @@ void __init init_IRQ(void)
np = of_find_compatible_node(NULL, NULL, "ti,c64x+core-pic"); np = of_find_compatible_node(NULL, NULL, "ti,c64x+core-pic");
if (np != NULL) { if (np != NULL) {
/* create the core host */ /* create the core host */
core_domain = irq_domain_add_legacy(np, NR_PRIORITY_IRQS, core_domain = irq_domain_add_linear(np, NR_PRIORITY_IRQS,
0, 0, &core_domain_ops, &core_domain_ops, NULL);
NULL);
if (core_domain) if (core_domain)
irq_set_default_host(core_domain); irq_set_default_host(core_domain);
of_node_put(np); of_node_put(np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment