aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc/tzic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-mxc/tzic.c')
-rw-r--r--arch/arm/plat-mxc/tzic.c97
1 files changed, 25 insertions, 72 deletions
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
index 710f2e7da4c..f257fccdc39 100644
--- a/arch/arm/plat-mxc/tzic.c
+++ b/arch/arm/plat-mxc/tzic.c
@@ -68,78 +68,34 @@ static int tzic_set_irq_fiq(unsigned int irq, unsigned int type)
68 68
69 return 0; 69 return 0;
70} 70}
71#else
72#define tzic_set_irq_fiq NULL
71#endif 73#endif
72 74
73/** 75static unsigned int *wakeup_intr[4];
74 * tzic_mask_irq() - Disable interrupt source "d" in the TZIC
75 *
76 * @param d interrupt source
77 */
78static void tzic_mask_irq(struct irq_data *d)
79{
80 int index, off;
81
82 index = d->irq >> 5;
83 off = d->irq & 0x1F;
84 __raw_writel(1 << off, tzic_base + TZIC_ENCLEAR0(index));
85}
86
87/**
88 * tzic_unmask_irq() - Enable interrupt source "d" in the TZIC
89 *
90 * @param d interrupt source
91 */
92static void tzic_unmask_irq(struct irq_data *d)
93{
94 int index, off;
95
96 index = d->irq >> 5;
97 off = d->irq & 0x1F;
98 __raw_writel(1 << off, tzic_base + TZIC_ENSET0(index));
99}
100
101static unsigned int wakeup_intr[4];
102 76
103/** 77static __init void tzic_init_gc(unsigned int irq_start)
104 * tzic_set_wake_irq() - Set interrupt source "d" in the TZIC as a wake-up source.
105 *
106 * @param d interrupt source
107 * @param enable enable as wake-up if equal to non-zero
108 * disble as wake-up if equal to zero
109 *
110 * @return This function returns 0 on success.
111 */
112static int tzic_set_wake_irq(struct irq_data *d, unsigned int enable)
113{ 78{
114 unsigned int index, off; 79 struct irq_chip_generic *gc;
115 80 struct irq_chip_type *ct;
116 index = d->irq >> 5; 81 int idx = irq_start >> 5;
117 off = d->irq & 0x1F; 82
118 83 gc = irq_alloc_generic_chip("tzic", 1, irq_start, tzic_base,
119 if (index > 3) 84 handle_level_irq);
120 return -EINVAL; 85 gc->private = tzic_set_irq_fiq;
121 86 gc->wake_enabled = IRQ_MSK(32);
122 if (enable) 87 wakeup_intr[idx] = &gc->wake_active;
123 wakeup_intr[index] |= (1 << off); 88
124 else 89 ct = gc->chip_types;
125 wakeup_intr[index] &= ~(1 << off); 90 ct->chip.irq_mask = irq_gc_mask_disable_reg;
126 91 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
127 return 0; 92 ct->chip.irq_set_wake = irq_gc_set_wake;
93 ct->regs.disable = TZIC_ENCLEAR0(idx);
94 ct->regs.enable = TZIC_ENSET0(idx);
95
96 irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0);
128} 97}
129 98
130static struct mxc_irq_chip mxc_tzic_chip = {
131 .base = {
132 .name = "MXC_TZIC",
133 .irq_ack = tzic_mask_irq,
134 .irq_mask = tzic_mask_irq,
135 .irq_unmask = tzic_unmask_irq,
136 .irq_set_wake = tzic_set_wake_irq,
137 },
138#ifdef CONFIG_FIQ
139 .set_irq_fiq = tzic_set_irq_fiq,
140#endif
141};
142
143/* 99/*
144 * This function initializes the TZIC hardware and disables all the 100 * This function initializes the TZIC hardware and disables all the
145 * interrupts. It registers the interrupt enable and disable functions 101 * interrupts. It registers the interrupt enable and disable functions
@@ -168,11 +124,8 @@ void __init tzic_init_irq(void __iomem *irqbase)
168 124
169 /* all IRQ no FIQ Warning :: No selection */ 125 /* all IRQ no FIQ Warning :: No selection */
170 126
171 for (i = 0; i < TZIC_NUM_IRQS; i++) { 127 for (i = 0; i < TZIC_NUM_IRQS; i += 32)
172 irq_set_chip_and_handler(i, &mxc_tzic_chip.base, 128 tzic_init_gc(i);
173 handle_level_irq);
174 set_irq_flags(i, IRQF_VALID);
175 }
176 129
177#ifdef CONFIG_FIQ 130#ifdef CONFIG_FIQ
178 /* Initialize FIQ */ 131 /* Initialize FIQ */
@@ -199,7 +152,7 @@ int tzic_enable_wake(int is_idle)
199 152
200 for (i = 0; i < 4; i++) { 153 for (i = 0; i < 4; i++) {
201 v = is_idle ? __raw_readl(tzic_base + TZIC_ENSET0(i)) : 154 v = is_idle ? __raw_readl(tzic_base + TZIC_ENSET0(i)) :
202 wakeup_intr[i]; 155 *wakeup_intr[i];
203 __raw_writel(v, tzic_base + TZIC_WAKEUP0(i)); 156 __raw_writel(v, tzic_base + TZIC_WAKEUP0(i));
204 } 157 }
205 158