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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [mips/] [kernel/] [irq_cpu.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Copyright 2001 MontaVista Software Inc.
3
 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4
 *
5
 * This file define the irq handler for MIPS CPU interrupts.
6
 *
7
 * This program is free software; you can redistribute  it and/or modify it
8
 * under  the terms of  the GNU General  Public License as published by the
9
 * Free Software Foundation;  either version 2 of the  License, or (at your
10
 * option) any later version.
11
 */
12
 
13
/*
14
 * Almost all MIPS CPUs define 8 interrupt sources.  They are typically
15
 * level triggered (i.e., cannot be cleared from CPU; must be cleared from
16
 * device).  The first two are software interrupts.  The last one is
17
 * usually the CPU timer interrupt if counter register is present or, for
18
 * CPUs with an external FPU, by convention it's the FPU exception interrupt.
19
 *
20
 * This file exports one global function:
21
 *      void mips_cpu_irq_init(int irq_base);
22
 */
23
#include <linux/init.h>
24
#include <linux/interrupt.h>
25
#include <linux/kernel.h>
26
 
27
#include <asm/irq_cpu.h>
28
#include <asm/mipsregs.h>
29
 
30
static int mips_cpu_irq_base = -1;
31
 
32
static void mips_cpu_irq_enable(unsigned int irq)
33
{
34
        clear_c0_cause( 1 << (irq - mips_cpu_irq_base + 8));
35
        set_c0_status(1 << (irq - mips_cpu_irq_base + 8));
36
}
37
 
38
static void mips_cpu_irq_disable(unsigned int irq)
39
{
40
        clear_c0_status(1 << (irq - mips_cpu_irq_base + 8));
41
}
42
 
43
static unsigned int mips_cpu_irq_startup(unsigned int irq)
44
{
45
        mips_cpu_irq_enable(irq);
46
 
47
        return 0;
48
}
49
 
50
#define mips_cpu_irq_shutdown   mips_cpu_irq_disable
51
 
52
static void mips_cpu_irq_ack(unsigned int irq)
53
{
54
        /* although we attempt to clear the IP bit in cause register, I think
55
         * usually it is cleared by device (irq source)
56
         */
57
        clear_c0_cause(1 << (irq - mips_cpu_irq_base + 8));
58
 
59
        /* disable this interrupt - so that we safe proceed to the handler */
60
        mips_cpu_irq_disable(irq);
61
}
62
 
63
static void mips_cpu_irq_end(unsigned int irq)
64
{
65
        if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
66
                mips_cpu_irq_enable(irq);
67
}
68
 
69
static hw_irq_controller mips_cpu_irq_controller = {
70
        "MIPS",
71
        mips_cpu_irq_startup,
72
        mips_cpu_irq_shutdown,
73
        mips_cpu_irq_enable,
74
        mips_cpu_irq_disable,
75
        mips_cpu_irq_ack,
76
        mips_cpu_irq_end,
77
        NULL                    /* no affinity stuff for UP */
78
};
79
 
80
 
81
void __init mips_cpu_irq_init(int irq_base)
82
{
83
        int i;
84
 
85
        for (i = irq_base; i < irq_base + 8; i++) {
86
                irq_desc[i].status = IRQ_DISABLED;
87
                irq_desc[i].action = NULL;
88
                irq_desc[i].depth = 1;
89
                irq_desc[i].handler = &mips_cpu_irq_controller;
90
        }
91
 
92
        mips_cpu_irq_base = irq_base;
93
}

powered by: WebSVN 2.1.0

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