Skip to contentSkip to conversation

mps2-an511: Fix wiring of UART overflow interrupt lines

PATCH In review Peter Maydell 3 participants 4 messages Sep 12, 2017 Arm/versatile express platform

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mps2-an511: Fix wiring of UART overflow interrupt lines

Fix an error that meant we were wiring every UART's overflow interrupts into the same inputs 0 and 1 of the OR gate, rather than giving each its own input.

---
 hw/arm/mps2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/mps2.c +2 -2
index abb0ab6..769cff8 100644
@@ -287,8 +287,8 @@ static void mps2_common_init(MachineState *machine)
             cmsdk_apb_uart_create(uartbase[i],
                                   qdev_get_gpio_in(txrx_orgate_dev, 0),
                                   qdev_get_gpio_in(txrx_orgate_dev, 1),
-                                  qdev_get_gpio_in(orgate_dev, 0),
-                                  qdev_get_gpio_in(orgate_dev, 1),
+                                  qdev_get_gpio_in(orgate_dev, i * 2),
+                                  qdev_get_gpio_in(orgate_dev, i * 2 + 1),
                                   NULL,
                                   uartchr, SYSCLK_FRQ);
         }
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw

(CC'ed qemu-arm)

Hi Peter,

Quoted 3 lines · Peter Maydell

Fix an error that meant we were wiring every UART's overflow interrupts into the same inputs 0 and 1 of the OR gate, rather than giving each its own input.

oops tricky to catch

hw/arm/mps2.c

Quoted 11 lines
---
  hw/arm/mps2.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/mps2.c +0 -0
index abb0ab6..769cff8 100644
        /* The overflow IRQs for all UARTs are ORed together.
         * Tx and Rx IRQs for each UART are ORed together.
         */

can you update this comment?

Quoted 12 lines
hw/arm/mps2.c +2 -2
@@ -287,8 +287,8 @@ static void mps2_common_init(MachineState *machine)
              cmsdk_apb_uart_create(uartbase[i],
                                    qdev_get_gpio_in(txrx_orgate_dev, 0),
                                    qdev_get_gpio_in(txrx_orgate_dev, 1),
-                                  qdev_get_gpio_in(orgate_dev, 0),
-                                  qdev_get_gpio_in(orgate_dev, 1),
+                                  qdev_get_gpio_in(orgate_dev, i * 2),
+                                  qdev_get_gpio_in(orgate_dev, i * 2 + 1),
                                    NULL,
                                    uartchr, SYSCLK_FRQ);
          }
#2 lore raw
Quoted 30 lines · Philippe Mathieu-Daudé

(CC'ed qemu-arm)

Hi Peter,

Quoted 4 lines · Peter Maydell

Fix an error that meant we were wiring every UART's overflow interrupts into the same inputs 0 and 1 of the OR gate, rather than giving each its own input.

oops tricky to catch

hw/arm/mps2.c

Quoted 11 lines
---
  hw/arm/mps2.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/mps2.c +0 -0
index abb0ab6..769cff8 100644
        /* The overflow IRQs for all UARTs are ORed together.
         * Tx and Rx IRQs for each UART are ORed together.
         */
Quoted 1 line

can you update this comment?

The comment is correct. "txrx_orgate_dev" is a 2-input OR gate, which we create one of per UART. It ORs together the TX IRQ and the RX IRQ. "orgate_dev" is a 10-input OR gate, which ORs together the TX overflow IRQ and the RX overflow IRQ from each UART. The bug here is just that we were using the wrong input pins on orgate_dev.

thanks
-- PMM

Reviewed-by on v1 1/1
#3 lore raw
In reply to Peter Maydell
Quoted 6 lines · Peter Maydell

Fix an error that meant we were wiring every UART's overflow interrupts into the same inputs 0 and 1 of the OR gate, rather than giving each its own input.

Thanks,
Alistair

Quoted 23 lines
---
 hw/arm/mps2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/mps2.c +2 -3
index abb0ab6..769cff8 100644
@@ -287,8 +287,8 @@ static void mps2_common_init(MachineState *machine)
             cmsdk_apb_uart_create(uartbase[i],
                                   qdev_get_gpio_in(txrx_orgate_dev, 0),
                                   qdev_get_gpio_in(txrx_orgate_dev, 1),
-                                  qdev_get_gpio_in(orgate_dev, 0),
-                                  qdev_get_gpio_in(orgate_dev, 1),
+                                  qdev_get_gpio_in(orgate_dev, i * 2),
+                                  qdev_get_gpio_in(orgate_dev, i * 2 + 1),
                                   NULL,
                                   uartchr, SYSCLK_FRQ);
         }
--

2.7.4