All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steffen Görtz" <contrib@steffen-goertz.de>
To: qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@gmail.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Jim Mussared" <jim@groklearning.com>,
	"Julia Suvorova" <jusual@mail.ru>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Steffen Görtz" <contrib@steffen-goertz.de>,
	"open list:NRF51" <qemu-arm@nongnu.org>
Subject: [Qemu-devel] [PATCH v4 09/13] arm: Instantiate NRF51 general purpose I/O
Date: Fri,  2 Nov 2018 13:07:26 -0400	[thread overview]
Message-ID: <20181102170730.12432-10-contrib@steffen-goertz.de> (raw)
In-Reply-To: <20181102170730.12432-1-contrib@steffen-goertz.de>

Instantiates GPIO peripheral model

Signed-off-by: Steffen Görtz <contrib@steffen-goertz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/arm/nrf51_soc.c         | 16 ++++++++++++++++
 include/hw/arm/nrf51_soc.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index d11bb2b99f..2c4e80892b 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -128,6 +128,19 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
     mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->nvm), 2);
     memory_region_add_subregion_overlap(&s->container, NRF51_UICR_BASE, mr, 0);
 
+    /* GPIO */
+    object_property_set_bool(OBJECT(&s->gpio), true, "realized", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
+
+    mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0);
+    memory_region_add_subregion_overlap(&s->container, NRF51_GPIO_BASE, mr, 0);
+
+    /* Pass all GPIOs to the SOC layer so they are available to the board */
+    qdev_pass_gpios(DEVICE(&s->gpio), dev_soc, NULL);
+
 
     create_unimplemented_device("nrf51_soc.io", NRF51_IOMEM_BASE,
                                 NRF51_IOMEM_SIZE);
@@ -157,6 +170,9 @@ static void nrf51_soc_init(Object *obj)
 
     sysbus_init_child_obj(obj, "nvm", &s->nvm, sizeof(s->nvm), TYPE_NRF51_NVM);
 
+    sysbus_init_child_obj(obj, "gpio", &s->gpio, sizeof(s->gpio),
+                          TYPE_NRF51_GPIO);
+
 }
 
 static Property nrf51_soc_properties[] = {
diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
index c3f4d5bcdc..d4a48ccf91 100644
--- a/include/hw/arm/nrf51_soc.h
+++ b/include/hw/arm/nrf51_soc.h
@@ -15,6 +15,7 @@
 #include "hw/char/nrf51_uart.h"
 #include "hw/misc/nrf51_rng.h"
 #include "hw/nvram/nrf51_nvm.h"
+#include "hw/gpio/nrf51_gpio.h"
 
 #define TYPE_NRF51_SOC "nrf51-soc"
 #define NRF51_SOC(obj) \
@@ -30,6 +31,7 @@ typedef struct NRF51State {
     NRF51UARTState uart;
     NRF51RNGState rng;
     NRF51NVMState nvm;
+    NRF51GPIOState gpio;
 
     MemoryRegion iomem;
     MemoryRegion sram;
-- 
2.19.1

  parent reply	other threads:[~2018-11-02 17:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 17:07 [Qemu-devel] [PATCH v4 00/13] arm: nRF51 Devices and Microbit Support Steffen Görtz
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 01/13] qtest: Add set_irq_in command to set IRQ/GPIO level Steffen Görtz
2018-11-05  6:18   ` Thomas Huth
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 02/13] arm: Add header to host common definition for nRF51 SOC peripherals Steffen Görtz
2018-11-05 16:47   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 03/13] hw/misc/nrf51_rng: Add NRF51 random number generator peripheral Steffen Görtz
2018-11-05 16:48   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 04/13] arm: Instantiate NRF51 random number generator Steffen Görtz
2018-11-05 16:49   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 05/13] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories Steffen Görtz
2018-11-05 17:09   ` Peter Maydell
2018-11-08  9:28   ` Stefan Hajnoczi
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 06/13] arm: Instantiate NRF51 special NVM's and NVMC Steffen Görtz
2018-11-05 16:50   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 07/13] tests: Add bbc:microbit / nRF51 test suite Steffen Görtz
2018-11-05 16:51   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 08/13] hw/gpio/nrf51_gpio: Add nRF51 GPIO peripheral Steffen Görtz
2018-11-05 16:47   ` Peter Maydell
2018-11-02 17:07 ` Steffen Görtz [this message]
2018-11-05 16:51   ` [Qemu-devel] [PATCH v4 09/13] arm: Instantiate NRF51 general purpose I/O Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 10/13] tests/microbit-test: Add Tests for nRF51 GPIO Steffen Görtz
2018-11-05 16:54   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 11/13] hw/timer/nrf51_timer: Add nRF51 Timer peripheral Steffen Görtz
2018-11-05 17:45   ` Peter Maydell
2018-11-08  9:30   ` Stefan Hajnoczi
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 12/13] arm: Instantiate NRF51 Timers Steffen Görtz
2018-11-05 16:56   ` Peter Maydell
2018-11-02 17:07 ` [Qemu-devel] [PATCH v4 13/13] arm: Add Clock peripheral stub to NRF51 SOC Steffen Görtz
2018-11-04  8:19 ` [Qemu-devel] [PATCH v4 00/13] arm: nRF51 Devices and Microbit Support no-reply
2018-11-04  8:23 ` no-reply
2018-11-06  6:41 ` no-reply
2018-11-06  6:45 ` no-reply
2018-11-08  9:32 ` Stefan Hajnoczi
2018-11-08  9:42   ` Peter Maydell
2018-11-08 10:20     ` Joel Stanley
2018-11-08 10:23       ` Peter Maydell
2018-11-08 22:18 ` no-reply
2018-11-08 22:22 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181102170730.12432-10-contrib@steffen-goertz.de \
    --to=contrib@steffen-goertz.de \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=jusual@mail.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.