~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/mips/jz4740/irq.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
#define IRQ_BIT(x) BIT((x) - JZ4740_IRQ_BASE)
45
45
 
46
 
static void intc_irq_unmask(unsigned int irq)
47
 
{
48
 
        writel(IRQ_BIT(irq), jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
49
 
}
50
 
 
51
 
static void intc_irq_mask(unsigned int irq)
52
 
{
53
 
        writel(IRQ_BIT(irq), jz_intc_base + JZ_REG_INTC_SET_MASK);
54
 
}
55
 
 
56
 
static int intc_irq_set_wake(unsigned int irq, unsigned int on)
 
46
static inline unsigned long intc_irq_bit(struct irq_data *data)
 
47
{
 
48
        return (unsigned long)irq_data_get_irq_chip_data(data);
 
49
}
 
50
 
 
51
static void intc_irq_unmask(struct irq_data *data)
 
52
{
 
53
        writel(intc_irq_bit(data), jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
 
54
}
 
55
 
 
56
static void intc_irq_mask(struct irq_data *data)
 
57
{
 
58
        writel(intc_irq_bit(data), jz_intc_base + JZ_REG_INTC_SET_MASK);
 
59
}
 
60
 
 
61
static int intc_irq_set_wake(struct irq_data *data, unsigned int on)
57
62
{
58
63
        if (on)
59
 
                jz_intc_wakeup |= IRQ_BIT(irq);
 
64
                jz_intc_wakeup |= intc_irq_bit(data);
60
65
        else
61
 
                jz_intc_wakeup &= ~IRQ_BIT(irq);
 
66
                jz_intc_wakeup &= ~intc_irq_bit(data);
62
67
 
63
68
        return 0;
64
69
}
65
70
 
66
71
static struct irq_chip intc_irq_type = {
67
72
        .name =         "INTC",
68
 
        .mask =         intc_irq_mask,
69
 
        .mask_ack =     intc_irq_mask,
70
 
        .unmask =       intc_irq_unmask,
71
 
        .set_wake =     intc_irq_set_wake,
 
73
        .irq_mask =     intc_irq_mask,
 
74
        .irq_mask_ack = intc_irq_mask,
 
75
        .irq_unmask =   intc_irq_unmask,
 
76
        .irq_set_wake = intc_irq_set_wake,
72
77
};
73
78
 
74
79
static irqreturn_t jz4740_cascade(int irq, void *data)
95
100
 
96
101
        jz_intc_base = ioremap(JZ4740_INTC_BASE_ADDR, 0x14);
97
102
 
 
103
        /* Mask all irqs */
 
104
        writel(0xffffffff, jz_intc_base + JZ_REG_INTC_SET_MASK);
 
105
 
98
106
        for (i = JZ4740_IRQ_BASE; i < JZ4740_IRQ_BASE + 32; i++) {
99
 
                intc_irq_mask(i);
100
 
                set_irq_chip_and_handler(i, &intc_irq_type, handle_level_irq);
 
107
                irq_set_chip_data(i, (void *)IRQ_BIT(i));
 
108
                irq_set_chip_and_handler(i, &intc_irq_type, handle_level_irq);
101
109
        }
102
110
 
103
111
        setup_irq(2, &jz4740_cascade_action);