qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: [Qemu-devel] [PATCH 7/7] hw/arm/mps2: Add SCC
Date: Tue, 11 Jul 2017 12:17:19 +0100	[thread overview]
Message-ID: <1499771839-32518-8-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1499771839-32518-1-git-send-email-peter.maydell@linaro.org>

Add the SCC to the MPS2 board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/mps2.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
index b1a0df9..3dd61fe 100644
--- a/hw/arm/mps2.c
+++ b/hw/arm/mps2.c
@@ -34,6 +34,7 @@
 #include "hw/misc/unimp.h"
 #include "hw/char/cmsdk-apb-uart.h"
 #include "hw/timer/cmsdk-apb-timer.h"
+#include "hw/misc/mps2-scc.h"
 
 typedef enum MPS2FPGAType {
     FPGA_AN385,
@@ -44,6 +45,7 @@ typedef struct {
     MachineClass parent;
     MPS2FPGAType fpga_type;
     const char *cpu_model;
+    uint32_t scc_id;
 } MPS2MachineClass;
 
 typedef struct {
@@ -60,6 +62,7 @@ typedef struct {
     MemoryRegion blockram_m2;
     MemoryRegion blockram_m3;
     MemoryRegion sram;
+    MPS2SCC scc;
 } MPS2MachineState;
 
 #define TYPE_MPS2_MACHINE "mps2"
@@ -114,7 +117,7 @@ static void mps2_common_init(MachineState *machine)
 
     MemoryRegion *system_memory = get_system_memory();
 
-    DeviceState *armv7m;
+    DeviceState *armv7m, *sccdev;
 
     /* The FPGA images have an odd combination of different RAMs,
      * because in hardware they are different implementations and
@@ -298,6 +301,16 @@ static void mps2_common_init(MachineState *machine)
     cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ);
     cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ);
 
+    object_initialize(&mms->scc, sizeof(mms->scc), TYPE_MPS2_SCC);
+    sccdev = DEVICE(&mms->scc);
+    qdev_set_parent_bus(armv7m, sysbus_get_default());
+    qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2);
+    qdev_prop_set_uint32(sccdev, "scc-aid", 0x02000008);
+    qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id);
+    object_property_set_bool(OBJECT(&mms->scc), true, "realized",
+                             &error_fatal);
+    sysbus_mmio_map(SYS_BUS_DEVICE(sccdev), 0, 0x4002f000);
+
     system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
 
     armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
@@ -320,6 +333,7 @@ static void mps2_an385_class_init(ObjectClass *oc, void *data)
     mc->desc = "ARM MPS2 with AN385 FPGA image for Cortex-M3";
     mmc->fpga_type = FPGA_AN385;
     mmc->cpu_model = "cortex-m3";
+    mmc->scc_id = 0x41040000 | (385 << 4);
 }
 
 static void mps2_an511_class_init(ObjectClass *oc, void *data)
@@ -330,6 +344,7 @@ static void mps2_an511_class_init(ObjectClass *oc, void *data)
     mc->desc = "ARM MPS2 with AN511 DesignStart FPGA image for Cortex-M3";
     mmc->fpga_type = FPGA_AN511;
     mmc->cpu_model = "cortex-m3";
+    mmc->scc_id = 0x4104000 | (511 << 4);
 }
 
 static const TypeInfo mps2_info = {
-- 
2.7.4

  parent reply	other threads:[~2017-07-11 11:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 11:17 [Qemu-devel] [PATCH 0/7] ARM: implement MPS2 board (with 2 FPGA flavours) Peter Maydell
2017-07-11 11:17 ` [Qemu-devel] [PATCH 1/7] hw/arm/mps2: Implement skeleton mps2-an385 and mps2-an511 board models Peter Maydell
2017-07-11 14:33   ` Alistair Francis
2017-07-11 16:35     ` Peter Maydell
2017-07-11 17:47       ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-07-13  7:27       ` [Qemu-devel] " Alistair Francis
2017-07-13 10:39         ` Peter Maydell
2017-07-11 11:17 ` [Qemu-devel] [PATCH 2/7] hw/char/cmsdk-apb-uart.c: Implement CMSDK APB UART Peter Maydell
2017-07-11 15:12   ` Alistair Francis
2017-07-11 15:33     ` Peter Maydell
2017-07-11 15:40       ` Alistair Francis
2017-07-11 16:45         ` Peter Maydell
2017-07-13  7:32           ` Alistair Francis
2017-07-11 17:44     ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-07-11 20:42   ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-07-11 20:51     ` Peter Maydell
2017-07-11 11:17 ` [Qemu-devel] [PATCH 3/7] hw/arm/mps2: Add UARTs Peter Maydell
2017-07-13  7:37   ` Alistair Francis
2017-07-11 11:17 ` [Qemu-devel] [PATCH 4/7] hw/char/cmsdk-apb-timer: Implement CMSDK APB timer device Peter Maydell
2017-07-14  5:13   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-07-11 11:17 ` [Qemu-devel] [PATCH 5/7] hw/arm/mps2: Add timers Peter Maydell
2017-07-14  5:13   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-07-11 11:17 ` [Qemu-devel] [PATCH 6/7] hw/misc/mps2_scc: Implement MPS2 Serial Communication Controller Peter Maydell
2017-07-11 12:53   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-07-11 13:09     ` Peter Maydell
2017-07-11 11:17 ` Peter Maydell [this message]
2017-07-11 12:55   ` [Qemu-devel] [Qemu-arm] [PATCH 7/7] hw/arm/mps2: Add SCC Philippe Mathieu-Daudé
2017-07-11 12:11 ` [Qemu-devel] [PATCH 0/7] ARM: implement MPS2 board (with 2 FPGA flavours) Philippe Mathieu-Daudé
2017-07-11 12:45   ` Peter Maydell
2017-07-11 12:46 ` no-reply
2017-07-11 12:51   ` Peter Maydell
2017-07-11 14:00 ` no-reply
2017-07-11 15:19   ` Peter Maydell

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=1499771839-32518-8-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=patches@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).