Commit 52e3124f authored by Magnus Damm's avatar Magnus Damm Committed by Paul Mundt

sh: intc: Add IRQ trigger bit field check

R-Mobile SoCs such as sh73a0 include PINT blocks in INTC
that come with 2-bit IRQ trigger support. Add code to make
sure the bit width is checked so 4-bit only modes like for
instance EDGE_BOTH will fail for PINT.
Signed-off-by: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent a136d3d8
...@@ -202,11 +202,16 @@ static int intc_set_type(struct irq_data *data, unsigned int type) ...@@ -202,11 +202,16 @@ static int intc_set_type(struct irq_data *data, unsigned int type)
if (!value) if (!value)
return -EINVAL; return -EINVAL;
value &= ~SENSE_VALID_FLAG;
ihp = intc_find_irq(d->sense, d->nr_sense, irq); ihp = intc_find_irq(d->sense, d->nr_sense, irq);
if (ihp) { if (ihp) {
/* PINT has 2-bit sense registers, should fail on EDGE_BOTH */
if (value >= (1 << _INTC_WIDTH(ihp->handle)))
return -EINVAL;
addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
value & ~SENSE_VALID_FLAG);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment