[PATCH] m68k: convert apollo irq code
Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
74be8d0835
commit
0aa78106c6
@@ -1,125 +1,44 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/traps.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/machdep.h>
|
||||
#include <asm/apollohw.h>
|
||||
#include <asm/errno.h>
|
||||
|
||||
static irq_handler_t dn_irqs[16];
|
||||
|
||||
irqreturn_t dn_process_int(int irq, struct pt_regs *fp)
|
||||
void dn_process_int(unsigned int irq, struct pt_regs *fp)
|
||||
{
|
||||
irqreturn_t res = IRQ_NONE;
|
||||
m68k_handle_int(irq, fp);
|
||||
|
||||
if(dn_irqs[irq-160].handler) {
|
||||
res = dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp);
|
||||
} else {
|
||||
printk("spurious irq %d occurred\n",irq);
|
||||
}
|
||||
|
||||
*(volatile unsigned char *)(pica)=0x20;
|
||||
*(volatile unsigned char *)(picb)=0x20;
|
||||
|
||||
return res;
|
||||
*(volatile unsigned char *)(pica)=0x20;
|
||||
*(volatile unsigned char *)(picb)=0x20;
|
||||
}
|
||||
|
||||
void dn_init_IRQ(void) {
|
||||
|
||||
int i;
|
||||
|
||||
for(i=0;i<16;i++) {
|
||||
dn_irqs[i].handler=NULL;
|
||||
dn_irqs[i].flags=IRQ_FLG_STD;
|
||||
dn_irqs[i].dev_id=NULL;
|
||||
dn_irqs[i].devname=NULL;
|
||||
}
|
||||
|
||||
int apollo_irq_startup(unsigned int irq)
|
||||
{
|
||||
if (irq < 8)
|
||||
*(volatile unsigned char *)(pica+1) &= ~(1 << irq);
|
||||
else
|
||||
*(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
|
||||
|
||||
if((irq<0) || (irq>15)) {
|
||||
printk("Trying to request invalid IRQ\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
if(!dn_irqs[irq].handler) {
|
||||
dn_irqs[irq].handler=handler;
|
||||
dn_irqs[irq].flags=IRQ_FLG_STD;
|
||||
dn_irqs[irq].dev_id=dev_id;
|
||||
dn_irqs[irq].devname=devname;
|
||||
if(irq<8)
|
||||
*(volatile unsigned char *)(pica+1)&=~(1<<irq);
|
||||
else
|
||||
*(volatile unsigned char *)(picb+1)&=~(1<<(irq-8));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
printk("Trying to request already assigned irq %d\n",irq);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
void apollo_irq_shutdown(unsigned int irq)
|
||||
{
|
||||
if (irq < 8)
|
||||
*(volatile unsigned char *)(pica+1) |= (1 << irq);
|
||||
else
|
||||
*(volatile unsigned char *)(picb+1) |= (1 << (irq - 8));
|
||||
}
|
||||
|
||||
void dn_free_irq(unsigned int irq, void *dev_id) {
|
||||
static struct irq_controller apollo_irq_controller = {
|
||||
.name = "apollo",
|
||||
.lock = SPIN_LOCK_UNLOCKED,
|
||||
.startup = apollo_irq_startup,
|
||||
.shutdown = apollo_irq_shutdown,
|
||||
};
|
||||
|
||||
if((irq<0) || (irq>15)) {
|
||||
printk("Trying to free invalid IRQ\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
if(irq<8)
|
||||
*(volatile unsigned char *)(pica+1)|=(1<<irq);
|
||||
else
|
||||
*(volatile unsigned char *)(picb+1)|=(1<<(irq-8));
|
||||
|
||||
dn_irqs[irq].handler=NULL;
|
||||
dn_irqs[irq].flags=IRQ_FLG_STD;
|
||||
dn_irqs[irq].dev_id=NULL;
|
||||
dn_irqs[irq].devname=NULL;
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
void dn_enable_irq(unsigned int irq) {
|
||||
|
||||
printk("dn enable irq\n");
|
||||
|
||||
}
|
||||
|
||||
void dn_disable_irq(unsigned int irq) {
|
||||
|
||||
printk("dn disable irq\n");
|
||||
|
||||
}
|
||||
|
||||
int show_dn_interrupts(struct seq_file *p, void *v) {
|
||||
|
||||
printk("dn get irq list\n");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
struct fb_info *dn_dummy_fb_init(long *mem_start) {
|
||||
|
||||
printk("fb init\n");
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
void dn_dummy_video_setup(char *options,int *ints) {
|
||||
|
||||
printk("no video yet\n");
|
||||
|
||||
void dn_init_IRQ(void)
|
||||
{
|
||||
m68k_setup_user_interrupt(VEC_USER + 96, 16, dn_process_int);
|
||||
m68k_setup_irq_controller(&apollo_irq_controller, IRQ_APOLLO, 16);
|
||||
}
|
||||
|
Reference in New Issue
Block a user