~ubuntu-branches/ubuntu/utopic/linux-ti-omap/utopic

« back to all changes in this revision

Viewing changes to arch/h8300/platform/h8300h/irq.c

  • Committer: Bazaar Package Importer
  • Author(s): Amit Kucheria, Amit Kucheria
  • Date: 2010-03-10 02:28:15 UTC
  • Revision ID: james.westby@ubuntu.com-20100310022815-7sd3gwvn5kenaq33
Tags: 2.6.33-500.1
[ Amit Kucheria ]

* Initial release of a 2.6.33-based OMAP kernel
* UBUNTU: [Upstream] Fix omap 1-wire driver compilation
* UBUNTU: ubuntu: AppArmor -- update to mainline 2010-03-04

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Interrupt handling H8/300H depend.
 
3
 * Yoshinori Sato <ysato@users.sourceforge.jp>
 
4
 *
 
5
 */
 
6
 
 
7
#include <linux/init.h>
 
8
#include <linux/errno.h>
 
9
 
 
10
#include <asm/ptrace.h>
 
11
#include <asm/traps.h>
 
12
#include <asm/irq.h>
 
13
#include <asm/io.h>
 
14
#include <asm/gpio.h>
 
15
#include <asm/regs306x.h>
 
16
 
 
17
const int __initdata h8300_saved_vectors[] = {
 
18
#if defined(CONFIG_GDB_DEBUG)
 
19
        TRAP3_VEC,      /* TRAPA #3 is GDB breakpoint */
 
20
#endif
 
21
        -1,
 
22
};
 
23
 
 
24
const h8300_vector __initdata h8300_trap_table[] = {
 
25
        0, 0, 0, 0, 0, 0, 0, 0,
 
26
        system_call,
 
27
        0,
 
28
        0,
 
29
        trace_break,
 
30
};
 
31
 
 
32
int h8300_enable_irq_pin(unsigned int irq)
 
33
{
 
34
        int bitmask;
 
35
        if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
 
36
                return 0;
 
37
 
 
38
        /* initialize IRQ pin */
 
39
        bitmask = 1 << (irq - EXT_IRQ0);
 
40
        switch(irq) {
 
41
        case EXT_IRQ0:
 
42
        case EXT_IRQ1:
 
43
        case EXT_IRQ2:
 
44
        case EXT_IRQ3:
 
45
                if (H8300_GPIO_RESERVE(H8300_GPIO_P8, bitmask) == 0)
 
46
                        return -EBUSY;
 
47
                H8300_GPIO_DDR(H8300_GPIO_P8, bitmask, H8300_GPIO_INPUT);
 
48
                break;
 
49
        case EXT_IRQ4:
 
50
        case EXT_IRQ5:
 
51
                if (H8300_GPIO_RESERVE(H8300_GPIO_P9, bitmask) == 0)
 
52
                        return -EBUSY;
 
53
                H8300_GPIO_DDR(H8300_GPIO_P9, bitmask, H8300_GPIO_INPUT);
 
54
                break;
 
55
        }
 
56
 
 
57
        return 0;
 
58
}
 
59
 
 
60
void h8300_disable_irq_pin(unsigned int irq)
 
61
{
 
62
        int bitmask;
 
63
        if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
 
64
                return;
 
65
 
 
66
        /* disable interrupt & release IRQ pin */
 
67
        bitmask = 1 << (irq - EXT_IRQ0);
 
68
        switch(irq) {
 
69
        case EXT_IRQ0:
 
70
        case EXT_IRQ1:
 
71
        case EXT_IRQ2:
 
72
        case EXT_IRQ3:
 
73
                *(volatile unsigned char *)IER &= ~bitmask;
 
74
                H8300_GPIO_FREE(H8300_GPIO_P8, bitmask);
 
75
                break ;
 
76
        case EXT_IRQ4:
 
77
        case EXT_IRQ5:
 
78
                *(volatile unsigned char *)IER &= ~bitmask;
 
79
                H8300_GPIO_FREE(H8300_GPIO_P9, bitmask);
 
80
                break;
 
81
        }
 
82
}