From: "Cédric Le Goater" <clg@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Andrew Jeffery" <andrew@aj.id.au>,
"Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH v2 2/9] palmetto-bmc: add a "silicon-rev" property at the soc level
Date: Thu, 28 Jul 2016 16:28:12 +0200 [thread overview]
Message-ID: <1469716099-8975-3-git-send-email-clg@kaod.org> (raw)
In-Reply-To: <1469716099-8975-1-git-send-email-clg@kaod.org>
The SCU controler holds the board revision number in its 0x7C
register. Let's use an alias to link a "silicon-rev" property of the
soc to the "silicon-rev" property of the SCU controler.
The SDMC controler "silicon-rev" property is derived from the SCU one
at realize time. I did not find a better way to handle this part.
Links and aliases being a one-to-one relation, I could not use one of
them. I might wrong though.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/arm/aspeed.c | 2 ++
hw/arm/ast2400.c | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 54e29a865d88..1ee13d578899 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -74,6 +74,8 @@ static void palmetto_bmc_init(MachineState *machine)
&error_abort);
object_property_set_int(OBJECT(&bmc->soc), 0x120CE416, "hw-strap1",
&error_abort);
+ object_property_set_int(OBJECT(&bmc->soc), AST2400_A0_SILICON_REV,
+ "silicon-rev", &error_abort);
object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
&error_abort);
diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c
index 136bf6464e1d..fa535065f765 100644
--- a/hw/arm/ast2400.c
+++ b/hw/arm/ast2400.c
@@ -84,8 +84,8 @@ static void ast2400_init(Object *obj)
object_initialize(&s->scu, sizeof(s->scu), TYPE_ASPEED_SCU);
object_property_add_child(obj, "scu", OBJECT(&s->scu), NULL);
qdev_set_parent_bus(DEVICE(&s->scu), sysbus_get_default());
- qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev",
- AST2400_A0_SILICON_REV);
+ object_property_add_alias(obj, "silicon-rev", OBJECT(&s->scu),
+ "silicon-rev", &error_abort);
object_property_add_alias(obj, "hw-strap1", OBJECT(&s->scu),
"hw-strap1", &error_abort);
object_property_add_alias(obj, "hw-strap2", OBJECT(&s->scu),
@@ -102,8 +102,6 @@ static void ast2400_init(Object *obj)
object_initialize(&s->sdmc, sizeof(s->sdmc), TYPE_ASPEED_SDMC);
object_property_add_child(obj, "sdmc", OBJECT(&s->sdmc), NULL);
qdev_set_parent_bus(DEVICE(&s->sdmc), sysbus_get_default());
- qdev_prop_set_uint32(DEVICE(&s->sdmc), "silicon-rev",
- AST2400_A0_SILICON_REV);
}
static void ast2400_realize(DeviceState *dev, Error **errp)
@@ -111,6 +109,7 @@ static void ast2400_realize(DeviceState *dev, Error **errp)
int i;
AST2400State *s = AST2400(dev);
Error *err = NULL, *local_err = NULL;
+ uint32_t silicon_rev;
/* IO space */
memory_region_init_io(&s->iomem, NULL, &ast2400_io_ops, NULL,
@@ -192,7 +191,16 @@ static void ast2400_realize(DeviceState *dev, Error **errp)
sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi), 1, AST2400_SPI_FLASH_BASE);
/* SDMC - SDRAM Memory Controller */
- object_property_set_bool(OBJECT(&s->sdmc), true, "realized", &err);
+ silicon_rev = (uint32_t)
+ object_property_get_int(OBJECT(&s->scu), "silicon-rev", &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
+
+ object_property_set_int(OBJECT(&s->sdmc), silicon_rev, "silicon-rev", &err);
+ object_property_set_bool(OBJECT(&s->sdmc), true, "realized", &local_err);
+ error_propagate(&err, local_err);
if (err) {
error_propagate(errp, err);
return;
--
2.1.4
next prev parent reply other threads:[~2016-07-28 14:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 14:28 [Qemu-devel] [PATCH v2 0/9] arm: add ast2500 support Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 1/9] palmetto-bmc: rename file to aspeed.c Cédric Le Goater
2016-07-28 14:28 ` Cédric Le Goater [this message]
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 3/9] palmetto-bmc: replace palmetto_bmc with aspeed Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 4/9] ast2400: use machine cpu_model to initialize the soc cpu Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 5/9] palmetto-bmc: add board specific configuration Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 6/9] hw/misc: use macros to define hw-strap1 register on Aspeed SOC Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 7/9] aspeed: add ast2500 support to scu and sdmc controllers Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 8/9] arm: add support for an ast2500 evaluation board Cédric Le Goater
2016-07-28 14:28 ` [Qemu-devel] [PATCH v2 9/9] palmetto-bmc: remove extra no_sdcard assignement Cédric Le Goater
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=1469716099-8975-3-git-send-email-clg@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.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).