Skip to content

Commit 1d7471b

Browse files
lvjianmin-loongsonMarc Zyngier
authored andcommitted
irqchip/loongson-liointc: Fix IRQ trigger polarity
For the INT_POLARITY register of Loongson-2K series IRQ controller, '0' indicates high level or rising edge triggered, '1' indicates low level or falling edge triggered, and we can find out the information from the Loongson 2K1000LA User Manual v1.0, Table 9-2, Section 9.3 (中断寄存器描述 / Description of the Interrupt Registers). For Loongson-3 CPU series, setting INT_POLARITY register is not supported and writting it has no effect. So trigger polarity setting shouled be fixed for Loongson-2K CPU series. Fixes: 17343d0 ("irqchip/loongson-liointc: Support to set IRQ type for ACPI path") Cc: stable@vger.kernel.org Reviewed-by: Huacai Chen <chenhuacai@kernel.org> Co-developed-by: Chong Qiao <qiaochong@loongson.cn> Signed-off-by: Chong Qiao <qiaochong@loongson.cn> Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230614115936.5950-4-lvjianmin@loongson.cn
1 parent 783422e commit 1d7471b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/irqchip/irq-loongson-liointc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
#define LIOINTC_REG_INTC_EN_STATUS (LIOINTC_INTC_CHIP_START + 0x04)
3333
#define LIOINTC_REG_INTC_ENABLE (LIOINTC_INTC_CHIP_START + 0x08)
3434
#define LIOINTC_REG_INTC_DISABLE (LIOINTC_INTC_CHIP_START + 0x0c)
35+
/*
36+
* LIOINTC_REG_INTC_POL register is only valid for Loongson-2K series, and
37+
* Loongson-3 series behave as noops.
38+
*/
3539
#define LIOINTC_REG_INTC_POL (LIOINTC_INTC_CHIP_START + 0x10)
3640
#define LIOINTC_REG_INTC_EDGE (LIOINTC_INTC_CHIP_START + 0x14)
3741

@@ -116,19 +120,19 @@ static int liointc_set_type(struct irq_data *data, unsigned int type)
116120
switch (type) {
117121
case IRQ_TYPE_LEVEL_HIGH:
118122
liointc_set_bit(gc, LIOINTC_REG_INTC_EDGE, mask, false);
119-
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, true);
123+
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false);
120124
break;
121125
case IRQ_TYPE_LEVEL_LOW:
122126
liointc_set_bit(gc, LIOINTC_REG_INTC_EDGE, mask, false);
123-
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false);
127+
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, true);
124128
break;
125129
case IRQ_TYPE_EDGE_RISING:
126130
liointc_set_bit(gc, LIOINTC_REG_INTC_EDGE, mask, true);
127-
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, true);
131+
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false);
128132
break;
129133
case IRQ_TYPE_EDGE_FALLING:
130134
liointc_set_bit(gc, LIOINTC_REG_INTC_EDGE, mask, true);
131-
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false);
135+
liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, true);
132136
break;
133137
default:
134138
irq_gc_unlock_irqrestore(gc, flags);

0 commit comments

Comments
 (0)