xref: /linux/arch/m68k/apollo/dn_ints.c (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1*1da177e4SLinus Torvalds #include <linux/types.h>
2*1da177e4SLinus Torvalds #include <linux/kernel.h>
3*1da177e4SLinus Torvalds #include <linux/jiffies.h>
4*1da177e4SLinus Torvalds #include <linux/kernel_stat.h>
5*1da177e4SLinus Torvalds #include <linux/timer.h>
6*1da177e4SLinus Torvalds 
7*1da177e4SLinus Torvalds #include <asm/system.h>
8*1da177e4SLinus Torvalds #include <asm/irq.h>
9*1da177e4SLinus Torvalds #include <asm/traps.h>
10*1da177e4SLinus Torvalds #include <asm/page.h>
11*1da177e4SLinus Torvalds #include <asm/machdep.h>
12*1da177e4SLinus Torvalds #include <asm/apollohw.h>
13*1da177e4SLinus Torvalds #include <asm/errno.h>
14*1da177e4SLinus Torvalds 
15*1da177e4SLinus Torvalds static irq_handler_t dn_irqs[16];
16*1da177e4SLinus Torvalds 
17*1da177e4SLinus Torvalds irqreturn_t dn_process_int(int irq, struct pt_regs *fp)
18*1da177e4SLinus Torvalds {
19*1da177e4SLinus Torvalds   irqreturn_t res = IRQ_NONE;
20*1da177e4SLinus Torvalds 
21*1da177e4SLinus Torvalds   if(dn_irqs[irq-160].handler) {
22*1da177e4SLinus Torvalds     res = dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp);
23*1da177e4SLinus Torvalds   } else {
24*1da177e4SLinus Torvalds     printk("spurious irq %d occurred\n",irq);
25*1da177e4SLinus Torvalds   }
26*1da177e4SLinus Torvalds 
27*1da177e4SLinus Torvalds   *(volatile unsigned char *)(pica)=0x20;
28*1da177e4SLinus Torvalds   *(volatile unsigned char *)(picb)=0x20;
29*1da177e4SLinus Torvalds 
30*1da177e4SLinus Torvalds   return res;
31*1da177e4SLinus Torvalds }
32*1da177e4SLinus Torvalds 
33*1da177e4SLinus Torvalds void dn_init_IRQ(void) {
34*1da177e4SLinus Torvalds 
35*1da177e4SLinus Torvalds   int i;
36*1da177e4SLinus Torvalds 
37*1da177e4SLinus Torvalds   for(i=0;i<16;i++) {
38*1da177e4SLinus Torvalds     dn_irqs[i].handler=NULL;
39*1da177e4SLinus Torvalds     dn_irqs[i].flags=IRQ_FLG_STD;
40*1da177e4SLinus Torvalds     dn_irqs[i].dev_id=NULL;
41*1da177e4SLinus Torvalds     dn_irqs[i].devname=NULL;
42*1da177e4SLinus Torvalds   }
43*1da177e4SLinus Torvalds 
44*1da177e4SLinus Torvalds }
45*1da177e4SLinus Torvalds 
46*1da177e4SLinus Torvalds int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
47*1da177e4SLinus Torvalds 
48*1da177e4SLinus Torvalds   if((irq<0) || (irq>15)) {
49*1da177e4SLinus Torvalds     printk("Trying to request invalid IRQ\n");
50*1da177e4SLinus Torvalds     return -ENXIO;
51*1da177e4SLinus Torvalds   }
52*1da177e4SLinus Torvalds 
53*1da177e4SLinus Torvalds   if(!dn_irqs[irq].handler) {
54*1da177e4SLinus Torvalds     dn_irqs[irq].handler=handler;
55*1da177e4SLinus Torvalds     dn_irqs[irq].flags=IRQ_FLG_STD;
56*1da177e4SLinus Torvalds     dn_irqs[irq].dev_id=dev_id;
57*1da177e4SLinus Torvalds     dn_irqs[irq].devname=devname;
58*1da177e4SLinus Torvalds     if(irq<8)
59*1da177e4SLinus Torvalds       *(volatile unsigned char *)(pica+1)&=~(1<<irq);
60*1da177e4SLinus Torvalds     else
61*1da177e4SLinus Torvalds       *(volatile unsigned char *)(picb+1)&=~(1<<(irq-8));
62*1da177e4SLinus Torvalds 
63*1da177e4SLinus Torvalds     return 0;
64*1da177e4SLinus Torvalds   }
65*1da177e4SLinus Torvalds   else {
66*1da177e4SLinus Torvalds     printk("Trying to request already assigned irq %d\n",irq);
67*1da177e4SLinus Torvalds     return -ENXIO;
68*1da177e4SLinus Torvalds   }
69*1da177e4SLinus Torvalds 
70*1da177e4SLinus Torvalds }
71*1da177e4SLinus Torvalds 
72*1da177e4SLinus Torvalds void dn_free_irq(unsigned int irq, void *dev_id) {
73*1da177e4SLinus Torvalds 
74*1da177e4SLinus Torvalds   if((irq<0) || (irq>15)) {
75*1da177e4SLinus Torvalds     printk("Trying to free invalid IRQ\n");
76*1da177e4SLinus Torvalds     return ;
77*1da177e4SLinus Torvalds   }
78*1da177e4SLinus Torvalds 
79*1da177e4SLinus Torvalds   if(irq<8)
80*1da177e4SLinus Torvalds     *(volatile unsigned char *)(pica+1)|=(1<<irq);
81*1da177e4SLinus Torvalds   else
82*1da177e4SLinus Torvalds     *(volatile unsigned char *)(picb+1)|=(1<<(irq-8));
83*1da177e4SLinus Torvalds 
84*1da177e4SLinus Torvalds   dn_irqs[irq].handler=NULL;
85*1da177e4SLinus Torvalds   dn_irqs[irq].flags=IRQ_FLG_STD;
86*1da177e4SLinus Torvalds   dn_irqs[irq].dev_id=NULL;
87*1da177e4SLinus Torvalds   dn_irqs[irq].devname=NULL;
88*1da177e4SLinus Torvalds 
89*1da177e4SLinus Torvalds   return ;
90*1da177e4SLinus Torvalds 
91*1da177e4SLinus Torvalds }
92*1da177e4SLinus Torvalds 
93*1da177e4SLinus Torvalds void dn_enable_irq(unsigned int irq) {
94*1da177e4SLinus Torvalds 
95*1da177e4SLinus Torvalds   printk("dn enable irq\n");
96*1da177e4SLinus Torvalds 
97*1da177e4SLinus Torvalds }
98*1da177e4SLinus Torvalds 
99*1da177e4SLinus Torvalds void dn_disable_irq(unsigned int irq) {
100*1da177e4SLinus Torvalds 
101*1da177e4SLinus Torvalds   printk("dn disable irq\n");
102*1da177e4SLinus Torvalds 
103*1da177e4SLinus Torvalds }
104*1da177e4SLinus Torvalds 
105*1da177e4SLinus Torvalds int show_dn_interrupts(struct seq_file *p, void *v) {
106*1da177e4SLinus Torvalds 
107*1da177e4SLinus Torvalds   printk("dn get irq list\n");
108*1da177e4SLinus Torvalds 
109*1da177e4SLinus Torvalds   return 0;
110*1da177e4SLinus Torvalds 
111*1da177e4SLinus Torvalds }
112*1da177e4SLinus Torvalds 
113*1da177e4SLinus Torvalds struct fb_info *dn_dummy_fb_init(long *mem_start) {
114*1da177e4SLinus Torvalds 
115*1da177e4SLinus Torvalds   printk("fb init\n");
116*1da177e4SLinus Torvalds 
117*1da177e4SLinus Torvalds   return NULL;
118*1da177e4SLinus Torvalds 
119*1da177e4SLinus Torvalds }
120*1da177e4SLinus Torvalds 
121*1da177e4SLinus Torvalds void dn_dummy_video_setup(char *options,int *ints) {
122*1da177e4SLinus Torvalds 
123*1da177e4SLinus Torvalds   printk("no video yet\n");
124*1da177e4SLinus Torvalds 
125*1da177e4SLinus Torvalds }
126