diff mbox series

[09/16] hw/arm/iotkit: Wire up the lines for MSCs

Message ID 20180809130115.28951-10-peter.maydell@linaro.org
State Superseded
Headers show
Series arm: Implement MPS2 watchdogs and DMA | expand

Commit Message

Peter Maydell Aug. 9, 2018, 1:01 p.m. UTC
The IoTKit doesn't have any MSCs itself but it does need
some wiring to connect the external signals from MSCs
in the outer board model up to the registers and the
NVIC IRQ line.

We also need to expose a MemoryRegion corresponding to
the AHB bus, so that MSCs in the outer board model can
use that as their downstream port. (In the FPGA this is
the "AHB Slave Expansion" ports shown in the block
diagram in the AN505 documentation.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 include/hw/arm/iotkit.h |  8 ++++++++
 hw/arm/iotkit.c         | 15 +++++++++++++++
 2 files changed, 23 insertions(+)

-- 
2.17.1

Comments

Philippe Mathieu-Daudé Aug. 18, 2018, 12:39 a.m. UTC | #1
On 08/09/2018 10:01 AM, Peter Maydell wrote:
> The IoTKit doesn't have any MSCs itself but it does need

> some wiring to connect the external signals from MSCs

> in the outer board model up to the registers and the

> NVIC IRQ line.

> 

> We also need to expose a MemoryRegion corresponding to

> the AHB bus, so that MSCs in the outer board model can

> use that as their downstream port. (In the FPGA this is

> the "AHB Slave Expansion" ports shown in the block

> diagram in the AN505 documentation.)

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  include/hw/arm/iotkit.h |  8 ++++++++

>  hw/arm/iotkit.c         | 15 +++++++++++++++

>  2 files changed, 23 insertions(+)

> 

> diff --git a/include/hw/arm/iotkit.h b/include/hw/arm/iotkit.h

> index 1ffa31d521b..5bb66b10468 100644

> --- a/include/hw/arm/iotkit.h

> +++ b/include/hw/arm/iotkit.h

> @@ -28,6 +28,9 @@

>   *  + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts

>   *  + Named GPIO inputs "EXP_IRQ" 0..n are the expansion interrupts, which

>   *    are wired to the NVIC lines 32 .. n+32

> + *  + sysbus MMIO region 0 is the "AHB Slave Expansion" which allows

> + *    bus master devices in the board model to make transactions into

> + *    all the devices and memory areas in the IoTKit

>   * Controlling up to 4 AHB expansion PPBs which a system using the IoTKit

>   * might provide:

>   *  + named GPIO outputs apb_ppcexp{0,1,2,3}_nonsec[0..15]

> @@ -45,6 +48,11 @@

>   * Controlling each of the 16 expansion MPCs which a system using the IoTKit

>   * might provide:

>   *  + named GPIO inputs mpcexp_status[0..15]

> + * Controlling each of the 16 expansion MSCs which a system using the IoTKit

> + * might provide:

> + *  + named GPIO inputs mscexp_status[0..15]

> + *  + named GPIO outputs mscexp_clear[0..15]

> + *  + named GPIO outputs mscexp_ns[0..15]

>   */

>  

>  #ifndef IOTKIT_H

> diff --git a/hw/arm/iotkit.c b/hw/arm/iotkit.c

> index 5d59ed5489f..8ae2a052517 100644

> --- a/hw/arm/iotkit.c

> +++ b/hw/arm/iotkit.c

> @@ -660,6 +660,21 @@ static void iotkit_realize(DeviceState *dev, Error **errp)

>  

>      iotkit_forward_sec_resp_cfg(s);

>  

> +    /* Forward the MSC related signals */

> +    qdev_pass_gpios(dev_secctl, dev, "mscexp_status");

> +    qdev_pass_gpios(dev_secctl, dev, "mscexp_clear");

> +    qdev_pass_gpios(dev_secctl, dev, "mscexp_ns");

> +    qdev_connect_gpio_out_named(dev_secctl, "msc_irq", 0,

> +                                qdev_get_gpio_in(DEVICE(&s->armv7m), 11));

> +

> +    /*

> +     * Expose our container region to the board model; this corresponds

> +     * to the AHB Slave Expansion ports which allow bus master devices

> +     * (eg DMA controllers) in the board model to make transactions into

> +     * devices in the IoTKit.

> +     */

> +    sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->container);

> +

>      system_clock_scale = NANOSECONDS_PER_SECOND / s->mainclk_frq;

>  }

>  

> 


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/include/hw/arm/iotkit.h b/include/hw/arm/iotkit.h
index 1ffa31d521b..5bb66b10468 100644
--- a/include/hw/arm/iotkit.h
+++ b/include/hw/arm/iotkit.h
@@ -28,6 +28,9 @@ 
  *  + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts
  *  + Named GPIO inputs "EXP_IRQ" 0..n are the expansion interrupts, which
  *    are wired to the NVIC lines 32 .. n+32
+ *  + sysbus MMIO region 0 is the "AHB Slave Expansion" which allows
+ *    bus master devices in the board model to make transactions into
+ *    all the devices and memory areas in the IoTKit
  * Controlling up to 4 AHB expansion PPBs which a system using the IoTKit
  * might provide:
  *  + named GPIO outputs apb_ppcexp{0,1,2,3}_nonsec[0..15]
@@ -45,6 +48,11 @@ 
  * Controlling each of the 16 expansion MPCs which a system using the IoTKit
  * might provide:
  *  + named GPIO inputs mpcexp_status[0..15]
+ * Controlling each of the 16 expansion MSCs which a system using the IoTKit
+ * might provide:
+ *  + named GPIO inputs mscexp_status[0..15]
+ *  + named GPIO outputs mscexp_clear[0..15]
+ *  + named GPIO outputs mscexp_ns[0..15]
  */
 
 #ifndef IOTKIT_H
diff --git a/hw/arm/iotkit.c b/hw/arm/iotkit.c
index 5d59ed5489f..8ae2a052517 100644
--- a/hw/arm/iotkit.c
+++ b/hw/arm/iotkit.c
@@ -660,6 +660,21 @@  static void iotkit_realize(DeviceState *dev, Error **errp)
 
     iotkit_forward_sec_resp_cfg(s);
 
+    /* Forward the MSC related signals */
+    qdev_pass_gpios(dev_secctl, dev, "mscexp_status");
+    qdev_pass_gpios(dev_secctl, dev, "mscexp_clear");
+    qdev_pass_gpios(dev_secctl, dev, "mscexp_ns");
+    qdev_connect_gpio_out_named(dev_secctl, "msc_irq", 0,
+                                qdev_get_gpio_in(DEVICE(&s->armv7m), 11));
+
+    /*
+     * Expose our container region to the board model; this corresponds
+     * to the AHB Slave Expansion ports which allow bus master devices
+     * (eg DMA controllers) in the board model to make transactions into
+     * devices in the IoTKit.
+     */
+    sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->container);
+
     system_clock_scale = NANOSECONDS_PER_SECOND / s->mainclk_frq;
 }