OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [armnommu/] [lib/] [irqs-trio.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1622 jcastillo
#include <linux/sched.h>
2
#include <linux/interrupt.h>
3
 
4
#include <asm/io.h>
5
#include <asm/system.h>
6
#include <asm/hardware.h>
7
#include <asm/irq.h>
8
#include <asm/arch/irq.h>
9
 
10
 
11
 
12
/* The trio AIC need to recive EOI command at the end of interrupt handler,
13
   These command is compossed from previous IRQ nr and previous IRQ priority.
14
   So we maintain this value in the trio_irq_prority variable.
15
 
16
   The trio_irq_prtable contains the priority<<5 for each IRQ
17
*/
18
 
19
volatile unsigned char trio_irq_priority = 0; /* Current IRQ number and priority */
20
unsigned char trio_irq_prtable[16] = {
21
        7,  /* FIQ */
22
        0,  /* WDIRQ */
23
        0,  /* SWIRQ */
24
        2, /* UAIRQ */
25
        0,               /* TC0 (Timer 0 used for DRAM refresh */
26
        1, /* TC1IRQ */
27
        0,               /* TC2IRQ */
28
        0,  /* PIOAIRQ */
29
        0,  /* LCDIRQ not used */
30
        5, /* SPIIRQ */
31
        4, /* IRQ0, (ETHERNET? )*/
32
        0,  /* IRQ1 */
33
        6,  /* OAKAIRQ */
34
        6,  /* OAKBIRQ */
35
        3, /* UBIRQ */
36
        5 /* PIOBIRQ */
37
 
38
};
39
 
40
void do_IRQ(int irq, struct pt_regs * regs);
41
 
42
 
43
inline void irq_ack(int priority)
44
{
45
        outl(priority, AIC_EOICR);
46
}
47
 
48
asmlinkage int probe_IRQ_interrupt(int irq, struct pt_regs * regs)
49
{
50
        mask_irq(irq);
51
        irq_ack(trio_irq_priority);
52
        return 0;
53
}
54
 
55
asmlinkage int bad_IRQ_interrupt(int irqn, struct pt_regs * regs)
56
{
57
        printk("bad interrupt %d recieved!\n", irqn);
58
        irq_ack(trio_irq_priority);
59
        return 0;
60
}
61
 
62
asmlinkage int IRQ_interrupt(int irq, struct pt_regs * regs)
63
{
64
        register unsigned long flags;
65
        register unsigned long saved_count;
66
        register unsigned char spr = trio_irq_priority;
67
 
68
        trio_irq_priority = ((unsigned char)irq) | trio_irq_prtable[irq];
69
 
70
 
71
        saved_count = intr_count;
72
        intr_count = saved_count + 1;
73
 
74
        save_flags(flags);
75
        sti();
76
        do_IRQ(irq, regs);
77
        restore_flags(flags);
78
        intr_count = saved_count;
79
        trio_irq_priority = spr;
80
        irq_ack(spr);
81
        return 0;
82
}
83
 
84
 
85
asmlinkage int timer_IRQ_interrupt(int irq, struct pt_regs * regs)
86
{
87
        register unsigned long flags;
88
        register unsigned long saved_count;
89
        register unsigned char spr = trio_irq_priority;
90
 
91
        trio_irq_priority = ((unsigned char)irq) | trio_irq_prtable[irq];
92
 
93
 
94
 
95
        saved_count = intr_count;
96
        intr_count = saved_count + 1;
97
 
98
        save_flags(flags);
99
        do_IRQ(irq, regs);
100
        restore_flags(flags);
101
        intr_count = saved_count;
102
        trio_irq_priority = spr;
103
        irq_ack(spr);
104
        return 0;
105
}
106
 
107
 
108
asmlinkage int fast_IRQ_interrupt(int irq, struct pt_regs * regs)
109
{
110
        register unsigned long saved_count;
111
 
112
        saved_count = intr_count;
113
        intr_count = saved_count + 1;
114
 
115
        do_IRQ(irq, regs);
116
        cli();
117
        intr_count = saved_count;
118
        inl(AIC_FVR);
119
        return 1;
120
}
121
 
122
void trio_init_aic()
123
{
124
        int irqno;
125
 
126
        // Disable all interrupts
127
        outl(0xFFFFFFFF, AIC_IDCR);
128
 
129
        // Clear all interrupts
130
        outl(0xFFFFFFFF, AIC_ICCR);
131
 
132
        for ( irqno = 0 ; irqno < 8 ; irqno++ )
133
        {
134
                outl(irqno, AIC_EOICR);
135
        }
136
 
137
 
138
 
139
        for ( irqno = 0 ; irqno < 16 ; irqno++ )
140
        {
141
                outl(trio_irq_prtable[irqno]  |  (1 << 5), AIC_SMR(irqno));
142
        }
143
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.