qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Jae Hyun Yoo" <jae.hyun.yoo@linux.intel.com>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Cédric Le Goater" <clg@kaod.org>,
	"Joel Stanley" <joel@jms.id.au>
Subject: [PATCH 03/17] aspeed: Add a DRAM memory region at the SoC level
Date: Tue, 19 Nov 2019 15:11:57 +0100	[thread overview]
Message-ID: <20191119141211.25716-4-clg@kaod.org> (raw)
In-Reply-To: <20191119141211.25716-1-clg@kaod.org>

Currently, we link the DRAM memory region to the FMC model (for DMAs)
through a property alias at the SoC level. The I2C model will need a
similar region for DMA support, add a DRAM region property at the SoC
level for both model to use.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Tested-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/arm/aspeed_soc.h | 1 +
 hw/arm/aspeed_ast2600.c     | 7 +++++--
 hw/arm/aspeed_soc.c         | 9 +++++++--
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 495c08be1b84..e84380984f7b 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -40,6 +40,7 @@ typedef struct AspeedSoCState {
     ARMCPU cpu[ASPEED_CPUS_NUM];
     uint32_t num_cpus;
     A15MPPrivState     a7mpcore;
+    MemoryRegion *dram_mr;
     MemoryRegion sram;
     AspeedVICState vic;
     AspeedRtcState rtc;
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index 931887ac681f..a403c2aae067 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -158,8 +158,6 @@ static void aspeed_soc_ast2600_init(Object *obj)
                           typename);
     object_property_add_alias(obj, "num-cs", OBJECT(&s->fmc), "num-cs",
                               &error_abort);
-    object_property_add_alias(obj, "dram", OBJECT(&s->fmc), "dram",
-                              &error_abort);
 
     for (i = 0; i < sc->spis_num; i++) {
         snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i + 1, socname);
@@ -362,6 +360,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
     }
 
     /* FMC, The number of CS is set at the board level */
+    object_property_set_link(OBJECT(&s->fmc), OBJECT(s->dram_mr), "dram", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->fmc), sc->memmap[ASPEED_SDRAM],
                             "sdram-base", &err);
     if (err) {
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index f4fe243458fd..dd1ee0e3336d 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -175,8 +175,6 @@ static void aspeed_soc_init(Object *obj)
                           typename);
     object_property_add_alias(obj, "num-cs", OBJECT(&s->fmc), "num-cs",
                               &error_abort);
-    object_property_add_alias(obj, "dram", OBJECT(&s->fmc), "dram",
-                              &error_abort);
 
     for (i = 0; i < sc->spis_num; i++) {
         snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i + 1, socname);
@@ -323,6 +321,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
                        aspeed_soc_get_irq(s, ASPEED_I2C));
 
     /* FMC, The number of CS is set at the board level */
+    object_property_set_link(OBJECT(&s->fmc), OBJECT(s->dram_mr), "dram", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->fmc), sc->memmap[ASPEED_SDRAM],
                             "sdram-base", &err);
     if (err) {
@@ -429,6 +432,8 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
 }
 static Property aspeed_soc_properties[] = {
     DEFINE_PROP_UINT32("num-cpus", AspeedSoCState, num_cpus, 0),
+    DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
+                     MemoryRegion *),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.21.0



  parent reply	other threads:[~2019-11-19 14:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 14:11 [PATCH 00/17] aspeed: extensions and fixes Cédric Le Goater
2019-11-19 14:11 ` [PATCH 01/17] aspeed/i2c: Add support for pool buffer transfers Cédric Le Goater
2019-11-19 14:11 ` [PATCH 02/17] aspeed/i2c: Check SRAM enablement on AST2500 Cédric Le Goater
2019-11-19 14:11 ` Cédric Le Goater [this message]
2019-11-19 14:11 ` [PATCH 04/17] aspeed/i2c: Add support for DMA transfers Cédric Le Goater
2019-11-19 14:11 ` [PATCH 05/17] aspeed/i2c: Add trace events Cédric Le Goater
2019-11-19 14:12 ` [PATCH 06/17] aspeed/sdmc: Make ast2600 default 1G Cédric Le Goater
2019-11-19 14:12 ` [PATCH 07/17] aspeed/scu: Fix W1C behavior Cédric Le Goater
2019-11-19 14:12 ` [PATCH 08/17] watchdog/aspeed: Improve watchdog timeout message Cédric Le Goater
2019-11-19 14:12 ` [PATCH 09/17] watchdog/aspeed: Fix AST2600 frequency behaviour Cédric Le Goater
2019-11-19 14:12 ` [PATCH 10/17] aspeed/smc: Restore default AHB window mapping at reset Cédric Le Goater
2019-11-19 14:12 ` [PATCH 11/17] aspeed/smc: Do not map disabled segment on the AST2600 Cédric Le Goater
2019-11-19 14:12 ` [PATCH 12/17] aspeed/smc: Add AST2600 timings registers Cédric Le Goater
2019-11-19 14:12 ` [PATCH 13/17] aspeed: Remove AspeedBoardConfig array and use AspeedMachineClass Cédric Le Goater
2019-11-19 14:12 ` [PATCH 14/17] aspeed: Add support for the tacoma-bmc board Cédric Le Goater
2019-11-19 14:12 ` [PATCH 15/17] gpio: fix memory leak in aspeed_gpio_init() Cédric Le Goater
2019-11-19 14:12 ` [PATCH 16/17] aspeed: Change the "scu" property definition Cédric Le Goater
2019-11-19 14:12 ` [PATCH 17/17] aspeed: Change the "nic" " Cédric Le Goater
2019-12-06 13:12 ` [PATCH 00/17] aspeed: extensions and fixes 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=20191119141211.25716-4-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=jae.hyun.yoo@linux.intel.com \
    --cc=joel@jms.id.au \
    --cc=peter.maydell@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).