qemu-devel.nongnu.org archive mirror
 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 v3 13/13] arm: Add Clock peripheral stub to NRF51 SOC
Date: Tue, 30 Oct 2018 20:25:27 -0400	[thread overview]
Message-ID: <20181031002526.14262-14-contrib@steffen-goertz.de> (raw)
In-Reply-To: <20181031002526.14262-1-contrib@steffen-goertz.de>

This stubs enables the microbit-micropython firmware to run
on the microbit machine.

Signed-off-by: Steffen Görtz <contrib@steffen-goertz.de>
---
 hw/arm/nrf51_soc.c         | 27 +++++++++++++++++++++++++++
 include/hw/arm/nrf51_soc.h |  1 +
 2 files changed, 28 insertions(+)

diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index c29b80c0ca..bccf2b9b2c 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -35,6 +35,26 @@
 
 #define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
 
+static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
+{
+    qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
+                  __func__, addr, size);
+    return 1;
+}
+
+static void clock_write(void *opaque, hwaddr addr, uint64_t data,
+                        unsigned int size)
+{
+    qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " <- 0x%" PRIx64 " [%u]\n",
+                  __func__, addr, data, size);
+}
+
+static const MemoryRegionOps clock_ops = {
+    .read = clock_read,
+    .write = clock_write
+};
+
+
 static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
 {
     NRF51State *s = NRF51_SOC(dev_soc);
@@ -159,6 +179,13 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
                                             BASE_TO_IRQ(base_addr)));
     }
 
+    /* STUB Peripherals */
+    memory_region_init_io(&s->clock, NULL, &clock_ops, NULL,
+                          "nrf51_soc.clock", 0x1000);
+    memory_region_add_subregion_overlap(&s->container,
+                                        NRF51_IOMEM_BASE, &s->clock, -1);
+
+
 
     create_unimplemented_device("nrf51_soc.io", NRF51_IOMEM_BASE,
                                 NRF51_IOMEM_SIZE);
diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
index 89525dcb39..4610d0c7ae 100644
--- a/include/hw/arm/nrf51_soc.h
+++ b/include/hw/arm/nrf51_soc.h
@@ -40,6 +40,7 @@ typedef struct NRF51State {
     MemoryRegion iomem;
     MemoryRegion sram;
     MemoryRegion flash;
+    MemoryRegion clock;
 
     uint32_t sram_size;
     uint32_t flash_size;
-- 
2.19.1

  parent reply	other threads:[~2018-10-31  0:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31  0:25 [Qemu-devel] [PATCH v3 00/13] arm: nRF51 Devices and Microbit Support Steffen Görtz
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 01/13] qtest: Add set_irq_in command to set IRQ/GPIO level Steffen Görtz
2018-10-31 11:14   ` Laurent Vivier
2018-10-31 13:16     ` Steffen Görtz
2018-11-01 10:41   ` Stefan Hajnoczi
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 02/13] arm: Add header to host common definition for nRF51 SOC peripherals Steffen Görtz
2018-11-01 10:56   ` Stefan Hajnoczi
2018-11-01 11:16   ` Julia Suvorova
2018-11-02 15:39     ` Steffen Görtz
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 03/13] hw/misc/nrf51_rng: Add NRF51 random number generator peripheral Steffen Görtz
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 04/13] arm: Instantiate NRF51 random number generator Steffen Görtz
2018-11-01 11:02   ` Stefan Hajnoczi
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 05/13] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories Steffen Görtz
2018-11-01 11:17   ` Stefan Hajnoczi
2018-11-02 15:58     ` Steffen Görtz
2018-11-01 12:25   ` Stefan Hajnoczi
2018-11-02 15:59     ` Steffen Görtz
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 06/13] arm: Instantiate NRF51 special NVM's and NVMC Steffen Görtz
2018-11-01 12:25   ` Stefan Hajnoczi
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 07/13] tests: Add bbc:microbit / nRF51 test suite Steffen Görtz
2018-11-01 12:27   ` Stefan Hajnoczi
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 08/13] hw/gpio/nrf51_gpio: Add nRF51 GPIO peripheral Steffen Görtz
2018-11-01 12:32   ` Stefan Hajnoczi
2018-11-02 16:29     ` Steffen Görtz
2018-11-02 15:02   ` Peter Maydell
2018-11-02 16:30     ` Steffen Görtz
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 09/13] arm: Instantiate NRF51 general purpose I/O Steffen Görtz
2018-11-01 12:41   ` Stefan Hajnoczi
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 10/13] tests/microbit-test: Add Tests for nRF51 GPIO Steffen Görtz
2018-11-01 12:41   ` Stefan Hajnoczi
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 11/13] hw/timer/nrf51_timer: Add nRF51 Timer peripheral Steffen Görtz
     [not found]   ` <20181101124848.GT24946@stefanha-x1.localdomain>
2018-11-02 16:54     ` Steffen Görtz
2018-10-31  0:25 ` [Qemu-devel] [PATCH v3 12/13] arm: Instantiate NRF51 Timers Steffen Görtz
2018-11-01 13:01   ` Stefan Hajnoczi
2018-11-02 15:57   ` Steffen Görtz
2018-10-31  0:25 ` Steffen Görtz [this message]
2018-11-01 13:08   ` [Qemu-devel] [PATCH v3 13/13] arm: Add Clock peripheral stub to NRF51 SOC Stefan Hajnoczi
2018-11-01  4:42 ` [Qemu-devel] [PATCH v3 00/13] arm: nRF51 Devices and Microbit Support no-reply
2018-11-01  4:46 ` no-reply
2018-11-03  3:24 ` no-reply
2018-11-03  3:28 ` 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=20181031002526.14262-14-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).