Commit e55bc558 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Simon Horman

irqchip: renesas-intc-irqpin: Fix register bitfield shift calculation

The SENSE register bitfield position is incorrectly computed for SoCs
that use 2-bit IRQ sense fields. Fix it.

This has been tested on the Marzen (H1) and Bockw (M1) boards.

This bug has been present since the renesas-intc-irqpin driver was
introduced by 44358048 ("irqchip: Renesas INTC External IRQ pin
driver") in v3.10-rc1.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarMagnus Damm <damm@opensource.se>
Tested-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent 6802cdc5
...@@ -149,8 +149,9 @@ static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p, ...@@ -149,8 +149,9 @@ static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p,
static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p,
int irq, int do_mask) int irq, int do_mask)
{ {
int bitfield_width = 4; /* PRIO assumed to have fixed bitfield width */ /* The PRIO register is assumed to be 32-bit with fixed 4-bit fields. */
int shift = (7 - irq) * bitfield_width; /* PRIO assumed to be 32-bit */ int bitfield_width = 4;
int shift = 32 - (irq + 1) * bitfield_width;
intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO, intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO,
shift, bitfield_width, shift, bitfield_width,
...@@ -159,8 +160,9 @@ static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, ...@@ -159,8 +160,9 @@ static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p,
static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value) static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value)
{ {
/* The SENSE register is assumed to be 32-bit. */
int bitfield_width = p->config.sense_bitfield_width; int bitfield_width = p->config.sense_bitfield_width;
int shift = (7 - irq) * bitfield_width; /* SENSE assumed to be 32-bit */ int shift = 32 - (irq + 1) * bitfield_width;
dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value); dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value);
......
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