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

« back to all changes in this revision

Viewing changes to arch/mips/txx9/rbtx4938/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:
69
69
#include <asm/txx9/generic.h>
70
70
#include <asm/txx9/rbtx4938.h>
71
71
 
72
 
static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq);
73
 
static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq);
74
 
 
75
 
#define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC"
76
 
static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
77
 
        .name = TOSHIBA_RBTX4938_IOC_NAME,
78
 
        .ack = toshiba_rbtx4938_irq_ioc_disable,
79
 
        .mask = toshiba_rbtx4938_irq_ioc_disable,
80
 
        .mask_ack = toshiba_rbtx4938_irq_ioc_disable,
81
 
        .unmask = toshiba_rbtx4938_irq_ioc_enable,
82
 
};
83
 
 
84
72
static int toshiba_rbtx4938_irq_nested(int sw_irq)
85
73
{
86
74
        u8 level3;
92
80
        return RBTX4938_IRQ_IOC + __fls8(level3);
93
81
}
94
82
 
95
 
static void __init
96
 
toshiba_rbtx4938_irq_ioc_init(void)
97
 
{
98
 
        int i;
99
 
 
100
 
        for (i = RBTX4938_IRQ_IOC;
101
 
             i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++)
102
 
                set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type,
103
 
                                         handle_level_irq);
104
 
 
105
 
        set_irq_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq);
106
 
}
107
 
 
108
 
static void
109
 
toshiba_rbtx4938_irq_ioc_enable(unsigned int irq)
110
 
{
111
 
        unsigned char v;
112
 
 
113
 
        v = readb(rbtx4938_imask_addr);
114
 
        v |= (1 << (irq - RBTX4938_IRQ_IOC));
115
 
        writeb(v, rbtx4938_imask_addr);
116
 
        mmiowb();
117
 
}
118
 
 
119
 
static void
120
 
toshiba_rbtx4938_irq_ioc_disable(unsigned int irq)
121
 
{
122
 
        unsigned char v;
123
 
 
124
 
        v = readb(rbtx4938_imask_addr);
125
 
        v &= ~(1 << (irq - RBTX4938_IRQ_IOC));
126
 
        writeb(v, rbtx4938_imask_addr);
127
 
        mmiowb();
128
 
}
 
83
static void toshiba_rbtx4938_irq_ioc_enable(struct irq_data *d)
 
84
{
 
85
        unsigned char v;
 
86
 
 
87
        v = readb(rbtx4938_imask_addr);
 
88
        v |= (1 << (d->irq - RBTX4938_IRQ_IOC));
 
89
        writeb(v, rbtx4938_imask_addr);
 
90
        mmiowb();
 
91
}
 
92
 
 
93
static void toshiba_rbtx4938_irq_ioc_disable(struct irq_data *d)
 
94
{
 
95
        unsigned char v;
 
96
 
 
97
        v = readb(rbtx4938_imask_addr);
 
98
        v &= ~(1 << (d->irq - RBTX4938_IRQ_IOC));
 
99
        writeb(v, rbtx4938_imask_addr);
 
100
        mmiowb();
 
101
}
 
102
 
 
103
#define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC"
 
104
static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
 
105
        .name = TOSHIBA_RBTX4938_IOC_NAME,
 
106
        .irq_mask = toshiba_rbtx4938_irq_ioc_disable,
 
107
        .irq_unmask = toshiba_rbtx4938_irq_ioc_enable,
 
108
};
129
109
 
130
110
static int rbtx4938_irq_dispatch(int pending)
131
111
{
146
126
        return irq;
147
127
}
148
128
 
 
129
static void __init toshiba_rbtx4938_irq_ioc_init(void)
 
130
{
 
131
        int i;
 
132
 
 
133
        for (i = RBTX4938_IRQ_IOC;
 
134
             i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++)
 
135
                irq_set_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type,
 
136
                                         handle_level_irq);
 
137
 
 
138
        irq_set_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq);
 
139
}
 
140
 
149
141
void __init rbtx4938_irq_setup(void)
150
142
{
151
143
        txx9_irq_dispatch = rbtx4938_irq_dispatch;
161
153
        tx4938_irq_init();
162
154
        toshiba_rbtx4938_irq_ioc_init();
163
155
        /* Onboard 10M Ether: High Active */
164
 
        set_irq_type(RBTX4938_IRQ_ETHER, IRQF_TRIGGER_HIGH);
 
156
        irq_set_irq_type(RBTX4938_IRQ_ETHER, IRQF_TRIGGER_HIGH);
165
157
}