diff options
Diffstat (limited to 'arch/arm/plat-mxc/irq.c')
-rw-r--r-- | arch/arm/plat-mxc/irq.c | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c index 0fb68a531f55..8aee76304f8f 100644 --- a/arch/arm/plat-mxc/irq.c +++ b/arch/arm/plat-mxc/irq.c | |||
@@ -24,31 +24,27 @@ | |||
24 | #include <asm/mach/irq.h> | 24 | #include <asm/mach/irq.h> |
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | 26 | ||
27 | #define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR) | 27 | #define AVIC_INTCNTL 0x00 /* int control reg */ |
28 | #define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */ | 28 | #define AVIC_NIMASK 0x04 /* int mask reg */ |
29 | #define AVIC_NIMASK (AVIC_BASE + 0x04) /* int mask reg */ | 29 | #define AVIC_INTENNUM 0x08 /* int enable number reg */ |
30 | #define AVIC_INTENNUM (AVIC_BASE + 0x08) /* int enable number reg */ | 30 | #define AVIC_INTDISNUM 0x0C /* int disable number reg */ |
31 | #define AVIC_INTDISNUM (AVIC_BASE + 0x0C) /* int disable number reg */ | 31 | #define AVIC_INTENABLEH 0x10 /* int enable reg high */ |
32 | #define AVIC_INTENABLEH (AVIC_BASE + 0x10) /* int enable reg high */ | 32 | #define AVIC_INTENABLEL 0x14 /* int enable reg low */ |
33 | #define AVIC_INTENABLEL (AVIC_BASE + 0x14) /* int enable reg low */ | 33 | #define AVIC_INTTYPEH 0x18 /* int type reg high */ |
34 | #define AVIC_INTTYPEH (AVIC_BASE + 0x18) /* int type reg high */ | 34 | #define AVIC_INTTYPEL 0x1C /* int type reg low */ |
35 | #define AVIC_INTTYPEL (AVIC_BASE + 0x1C) /* int type reg low */ | 35 | #define AVIC_NIPRIORITY(x) (0x20 + 4 * (7 - (x))) /* int priority */ |
36 | #define AVIC_NIPRIORITY(x) (AVIC_BASE + (0x20 + 4 * (7 - (x)))) /* int priority */ | 36 | #define AVIC_NIVECSR 0x40 /* norm int vector/status */ |
37 | #define AVIC_NIVECSR (AVIC_BASE + 0x40) /* norm int vector/status */ | 37 | #define AVIC_FIVECSR 0x44 /* fast int vector/status */ |
38 | #define AVIC_FIVECSR (AVIC_BASE + 0x44) /* fast int vector/status */ | 38 | #define AVIC_INTSRCH 0x48 /* int source reg high */ |
39 | #define AVIC_INTSRCH (AVIC_BASE + 0x48) /* int source reg high */ | 39 | #define AVIC_INTSRCL 0x4C /* int source reg low */ |
40 | #define AVIC_INTSRCL (AVIC_BASE + 0x4C) /* int source reg low */ | 40 | #define AVIC_INTFRCH 0x50 /* int force reg high */ |
41 | #define AVIC_INTFRCH (AVIC_BASE + 0x50) /* int force reg high */ | 41 | #define AVIC_INTFRCL 0x54 /* int force reg low */ |
42 | #define AVIC_INTFRCL (AVIC_BASE + 0x54) /* int force reg low */ | 42 | #define AVIC_NIPNDH 0x58 /* norm int pending high */ |
43 | #define AVIC_NIPNDH (AVIC_BASE + 0x58) /* norm int pending high */ | 43 | #define AVIC_NIPNDL 0x5C /* norm int pending low */ |
44 | #define AVIC_NIPNDL (AVIC_BASE + 0x5C) /* norm int pending low */ | 44 | #define AVIC_FIPNDH 0x60 /* fast int pending high */ |
45 | #define AVIC_FIPNDH (AVIC_BASE + 0x60) /* fast int pending high */ | 45 | #define AVIC_FIPNDL 0x64 /* fast int pending low */ |
46 | #define AVIC_FIPNDL (AVIC_BASE + 0x64) /* fast int pending low */ | 46 | |
47 | 47 | static void __iomem *avic_base; | |
48 | #define SYSTEM_PREV_REG IO_ADDRESS(IIM_BASE_ADDR + 0x20) | ||
49 | #define SYSTEM_SREV_REG IO_ADDRESS(IIM_BASE_ADDR + 0x24) | ||
50 | #define IIM_PROD_REV_SH 3 | ||
51 | #define IIM_PROD_REV_LEN 5 | ||
52 | 48 | ||
53 | int imx_irq_set_priority(unsigned char irq, unsigned char prio) | 49 | int imx_irq_set_priority(unsigned char irq, unsigned char prio) |
54 | { | 50 | { |
@@ -59,11 +55,11 @@ int imx_irq_set_priority(unsigned char irq, unsigned char prio) | |||
59 | if (irq >= MXC_INTERNAL_IRQS) | 55 | if (irq >= MXC_INTERNAL_IRQS) |
60 | return -EINVAL;; | 56 | return -EINVAL;; |
61 | 57 | ||
62 | temp = __raw_readl(AVIC_NIPRIORITY(irq / 8)); | 58 | temp = __raw_readl(avic_base + AVIC_NIPRIORITY(irq / 8)); |
63 | temp &= ~mask; | 59 | temp &= ~mask; |
64 | temp |= prio & mask; | 60 | temp |= prio & mask; |
65 | 61 | ||
66 | __raw_writel(temp, AVIC_NIPRIORITY(irq / 8)); | 62 | __raw_writel(temp, avic_base + AVIC_NIPRIORITY(irq / 8)); |
67 | 63 | ||
68 | return 0; | 64 | return 0; |
69 | #else | 65 | #else |
@@ -81,12 +77,12 @@ int mxc_set_irq_fiq(unsigned int irq, unsigned int type) | |||
81 | return -EINVAL; | 77 | return -EINVAL; |
82 | 78 | ||
83 | if (irq < MXC_INTERNAL_IRQS / 2) { | 79 | if (irq < MXC_INTERNAL_IRQS / 2) { |
84 | irqt = __raw_readl(AVIC_INTTYPEL) & ~(1 << irq); | 80 | irqt = __raw_readl(avic_base + AVIC_INTTYPEL) & ~(1 << irq); |
85 | __raw_writel(irqt | (!!type << irq), AVIC_INTTYPEL); | 81 | __raw_writel(irqt | (!!type << irq), avic_base + AVIC_INTTYPEL); |
86 | } else { | 82 | } else { |
87 | irq -= MXC_INTERNAL_IRQS / 2; | 83 | irq -= MXC_INTERNAL_IRQS / 2; |
88 | irqt = __raw_readl(AVIC_INTTYPEH) & ~(1 << irq); | 84 | irqt = __raw_readl(avic_base + AVIC_INTTYPEH) & ~(1 << irq); |
89 | __raw_writel(irqt | (!!type << irq), AVIC_INTTYPEH); | 85 | __raw_writel(irqt | (!!type << irq), avic_base + AVIC_INTTYPEH); |
90 | } | 86 | } |
91 | 87 | ||
92 | return 0; | 88 | return 0; |
@@ -97,13 +93,13 @@ EXPORT_SYMBOL(mxc_set_irq_fiq); | |||
97 | /* Disable interrupt number "irq" in the AVIC */ | 93 | /* Disable interrupt number "irq" in the AVIC */ |
98 | static void mxc_mask_irq(unsigned int irq) | 94 | static void mxc_mask_irq(unsigned int irq) |
99 | { | 95 | { |
100 | __raw_writel(irq, AVIC_INTDISNUM); | 96 | __raw_writel(irq, avic_base + AVIC_INTDISNUM); |
101 | } | 97 | } |
102 | 98 | ||
103 | /* Enable interrupt number "irq" in the AVIC */ | 99 | /* Enable interrupt number "irq" in the AVIC */ |
104 | static void mxc_unmask_irq(unsigned int irq) | 100 | static void mxc_unmask_irq(unsigned int irq) |
105 | { | 101 | { |
106 | __raw_writel(irq, AVIC_INTENNUM); | 102 | __raw_writel(irq, avic_base + AVIC_INTENNUM); |
107 | } | 103 | } |
108 | 104 | ||
109 | static struct irq_chip mxc_avic_chip = { | 105 | static struct irq_chip mxc_avic_chip = { |
@@ -121,19 +117,21 @@ void __init mxc_init_irq(void) | |||
121 | { | 117 | { |
122 | int i; | 118 | int i; |
123 | 119 | ||
120 | avic_base = IO_ADDRESS(AVIC_BASE_ADDR); | ||
121 | |||
124 | /* put the AVIC into the reset value with | 122 | /* put the AVIC into the reset value with |
125 | * all interrupts disabled | 123 | * all interrupts disabled |
126 | */ | 124 | */ |
127 | __raw_writel(0, AVIC_INTCNTL); | 125 | __raw_writel(0, avic_base + AVIC_INTCNTL); |
128 | __raw_writel(0x1f, AVIC_NIMASK); | 126 | __raw_writel(0x1f, avic_base + AVIC_NIMASK); |
129 | 127 | ||
130 | /* disable all interrupts */ | 128 | /* disable all interrupts */ |
131 | __raw_writel(0, AVIC_INTENABLEH); | 129 | __raw_writel(0, avic_base + AVIC_INTENABLEH); |
132 | __raw_writel(0, AVIC_INTENABLEL); | 130 | __raw_writel(0, avic_base + AVIC_INTENABLEL); |
133 | 131 | ||
134 | /* all IRQ no FIQ */ | 132 | /* all IRQ no FIQ */ |
135 | __raw_writel(0, AVIC_INTTYPEH); | 133 | __raw_writel(0, avic_base + AVIC_INTTYPEH); |
136 | __raw_writel(0, AVIC_INTTYPEL); | 134 | __raw_writel(0, avic_base + AVIC_INTTYPEL); |
137 | for (i = 0; i < MXC_INTERNAL_IRQS; i++) { | 135 | for (i = 0; i < MXC_INTERNAL_IRQS; i++) { |
138 | set_irq_chip(i, &mxc_avic_chip); | 136 | set_irq_chip(i, &mxc_avic_chip); |
139 | set_irq_handler(i, handle_level_irq); | 137 | set_irq_handler(i, handle_level_irq); |
@@ -142,7 +140,7 @@ void __init mxc_init_irq(void) | |||
142 | 140 | ||
143 | /* Set default priority value (0) for all IRQ's */ | 141 | /* Set default priority value (0) for all IRQ's */ |
144 | for (i = 0; i < 8; i++) | 142 | for (i = 0; i < 8; i++) |
145 | __raw_writel(0, AVIC_NIPRIORITY(i)); | 143 | __raw_writel(0, avic_base + AVIC_NIPRIORITY(i)); |
146 | 144 | ||
147 | /* init architectures chained interrupt handler */ | 145 | /* init architectures chained interrupt handler */ |
148 | mxc_register_gpios(); | 146 | mxc_register_gpios(); |
@@ -154,3 +152,4 @@ void __init mxc_init_irq(void) | |||
154 | 152 | ||
155 | printk(KERN_INFO "MXC IRQ initialized\n"); | 153 | printk(KERN_INFO "MXC IRQ initialized\n"); |
156 | } | 154 | } |
155 | |||