Skip to contentSkip to conversation

i.MX: Fix GPIO ISR register write

PATCH Applied Guenter Roeck 3 participants 3 messages Oct 25, 2016 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i.MX: Fix GPIO ISR register write

Writing the ISR register is supposed to clear interrupt status bits, not to set them.

This patch makes '-M sabrelite' work without devicetree changes (Linux kernel versions 3.18 to 4.7 with imx_v6_v7_defconfig and up to v4.8 with multi_v7_defconfig; mainline has different problems).

---
 hw/gpio/imx_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/imx_gpio.c +1 -1
index f3574aa..c36c394 100644
@@ -237,7 +237,7 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value,
         break;
 
     case ISR_ADDR:
-        s->isr |= ~value;
+        s->isr &= ~value;
         imx_gpio_set_all_int_lines(s);
         break;
 
Signature · 1 line
2.5.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Guenter Roeck

Writing the ISR register is supposed to clear interrupt status bits, not to set them.

This patch makes '-M sabrelite' work without devicetree changes (Linux kernel versions 3.18 to 4.7 with imx_v6_v7_defconfig and up to v4.8 with multi_v7_defconfig; mainline has different problems).

---
  hw/gpio/imx_gpio.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/imx_gpio.c +0 -0
index f3574aa..c36c394 100644

hw/gpio/imx_gpio.c static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value, · line 243

Quoted 8 lines
hw/gpio/imx_gpio.c +1 -1
@@ -237,7 +237,7 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value,
          break;
 
      case ISR_ADDR:
-        s->isr |= ~value;
+        s->isr &= ~value;
          imx_gpio_set_all_int_lines(s);
          break;
 

Thanks.

JC

#2 lore raw
In reply to Guenter Roeck
Quoted 17 lines · Guenter Roeck

Writing the ISR register is supposed to clear interrupt status bits, not to set them.

This patch makes '-M sabrelite' work without devicetree changes (Linux kernel versions 3.18 to 4.7 with imx_v6_v7_defconfig and up to v4.8 with multi_v7_defconfig; mainline has different problems).

---
 hw/gpio/imx_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/imx_gpio.c +0 -0
index f3574aa..c36c394 100644

hw/gpio/imx_gpio.c static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value, · line 242

Quoted 7 lines
hw/gpio/imx_gpio.c +1 -1
@@ -237,7 +237,7 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value,
         break;
 
     case ISR_ADDR:
-        s->isr |= ~value;
+        s->isr &= ~value;
         imx_gpio_set_all_int_lines(s);
         break;

Applied to target-arm.next, thanks.

-- PMM