aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh/intc/chip.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sh/intc/chip.c')
-rw-r--r--drivers/sh/intc/chip.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
index f33e2dd97934..7b246efa94ea 100644
--- a/drivers/sh/intc/chip.c
+++ b/drivers/sh/intc/chip.c
@@ -186,6 +186,9 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
186 !defined(CONFIG_CPU_SUBTYPE_SH7709) 186 !defined(CONFIG_CPU_SUBTYPE_SH7709)
187 [IRQ_TYPE_LEVEL_HIGH] = VALID(3), 187 [IRQ_TYPE_LEVEL_HIGH] = VALID(3),
188#endif 188#endif
189#if defined(CONFIG_ARM) /* all recent SH-Mobile / R-Mobile ARM support this */
190 [IRQ_TYPE_EDGE_BOTH] = VALID(4),
191#endif
189}; 192};
190 193
191static int intc_set_type(struct irq_data *data, unsigned int type) 194static int intc_set_type(struct irq_data *data, unsigned int type)
@@ -199,11 +202,16 @@ static int intc_set_type(struct irq_data *data, unsigned int type)
199 if (!value) 202 if (!value)
200 return -EINVAL; 203 return -EINVAL;
201 204
205 value &= ~SENSE_VALID_FLAG;
206
202 ihp = intc_find_irq(d->sense, d->nr_sense, irq); 207 ihp = intc_find_irq(d->sense, d->nr_sense, irq);
203 if (ihp) { 208 if (ihp) {
209 /* PINT has 2-bit sense registers, should fail on EDGE_BOTH */
210 if (value >= (1 << _INTC_WIDTH(ihp->handle)))
211 return -EINVAL;
212
204 addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); 213 addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
205 intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, 214 intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
206 value & ~SENSE_VALID_FLAG);
207 } 215 }
208 216
209 return 0; 217 return 0;