qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Anthony Liguori <aliguori@us.ibm.com>, Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>
Subject: [Qemu-devel] [PATCH 08/17] hw/vexpress: Pass voltage sensor properties to sysctl device
Date: Fri, 15 Mar 2013 16:56:30 +0000	[thread overview]
Message-ID: <1363366599-24238-9-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1363366599-24238-1-git-send-email-peter.maydell@linaro.org>

Pass voltage sensor properties to the sysctl device. Since
these are daughterboard specific, we specify them via the
VEDBoardInfo structure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1359985476-29380-9-git-send-email-peter.maydell@linaro.org
---
 hw/arm/vexpress.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 47a844f..a2dc759 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -154,6 +154,8 @@ struct VEDBoardInfo {
     hwaddr loader_start;
     const hwaddr gic_cpu_if_addr;
     uint32_t proc_id;
+    uint32_t num_voltage_sensors;
+    const uint32_t *voltages;
     DBoardInitFn *init;
 };
 
@@ -246,11 +248,25 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
     sysbus_create_varargs("l2x0", 0x1e00a000, NULL);
 }
 
+/* Voltage values for SYS_CFG_VOLT daughterboard registers;
+ * values are in microvolts.
+ */
+static const uint32_t a9_voltages[] = {
+    1000000, /* VD10 : 1.0V : SoC internal logic voltage */
+    1000000, /* VD10_S2 : 1.0V : PL310, L2 cache, RAM, non-PL310 logic */
+    1000000, /* VD10_S3 : 1.0V : Cortex-A9, cores, MPEs, SCU, PL310 logic */
+    1800000, /* VCC1V8 : 1.8V : DDR2 SDRAM, test chip DDR2 I/O supply */
+    900000, /* DDR2VTT : 0.9V : DDR2 SDRAM VTT termination voltage */
+    3300000, /* VCC3V3 : 3.3V : local board supply for misc external logic */
+};
+
 static const VEDBoardInfo a9_daughterboard = {
     .motherboard_map = motherboard_legacy_map,
     .loader_start = 0x60000000,
     .gic_cpu_if_addr = 0x1e000100,
     .proc_id = 0x0c000191,
+    .num_voltage_sensors = ARRAY_SIZE(a9_voltages),
+    .voltages = a9_voltages,
     .init = a9_daughterboard_init,
 };
 
@@ -338,11 +354,17 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,
     /* 0x7ffd0000: PL354 static memory controller: not modelled */
 }
 
+static const uint32_t a15_voltages[] = {
+    900000, /* Vcore: 0.9V : CPU core voltage */
+};
+
 static const VEDBoardInfo a15_daughterboard = {
     .motherboard_map = motherboard_aseries_map,
     .loader_start = 0x80000000,
     .gic_cpu_if_addr = 0x2c002000,
     .proc_id = 0x14000237,
+    .num_voltage_sensors = ARRAY_SIZE(a15_voltages),
+    .voltages = a15_voltages,
     .init = a15_daughterboard_init,
 };
 
@@ -358,6 +380,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
     MemoryRegion *vram = g_new(MemoryRegion, 1);
     MemoryRegion *sram = g_new(MemoryRegion, 1);
     const hwaddr *map = daughterboard->motherboard_map;
+    int i;
 
     daughterboard->init(daughterboard, args->ram_size, args->cpu_model, pic);
 
@@ -370,6 +393,13 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
     sysctl = qdev_create(NULL, "realview_sysctl");
     qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
     qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id);
+    qdev_prop_set_uint32(sysctl, "len-db-voltage",
+                         daughterboard->num_voltage_sensors);
+    for (i = 0; i < daughterboard->num_voltage_sensors; i++) {
+        char *propname = g_strdup_printf("db-voltage[%d]", i);
+        qdev_prop_set_uint32(sysctl, propname, daughterboard->voltages[i]);
+        g_free(propname);
+    }
     qdev_init_nofail(sysctl);
     sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]);
 
-- 
1.7.9.5

  parent reply	other threads:[~2013-03-15 17:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 16:56 [Qemu-devel] [PULL 00/17] arm-devs queue Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 01/17] hw/vexpress: Pass proc_id via VEDBoardInfo Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 02/17] hw/arm_sysctl: Handle SYS_CFGCTRL in a more structured way Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 03/17] hw/arm_sysctl: Implement SYS_CFG_MUXFPGA writes as a no-op Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 04/17] hw/arm_sysctl: Implement SYS_CFG_DVIMODE " Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 05/17] hw/arm_sysctl: Convert from qdev init to instance_init Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 06/17] qdev: Implement (variable length) array properties Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 07/17] hw/arm_sysctl: Implement SYS_CFG_VOLT Peter Maydell
2013-03-15 16:56 ` Peter Maydell [this message]
2013-03-15 16:56 ` [Qemu-devel] [PATCH 09/17] hw/arm_sysctl: Implement SYS_CFG_OSC function Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 10/17] hw/vexpress: Set reset values for daughterboard oscillators Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 11/17] iov: Factor out hexdumper Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 12/17] pl330: Initial version Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 13/17] xilinx_zynq: added pl330 to machine model Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 14/17] xilinx_spips: Set unused IRQs to NULL Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 15/17] xilinx_spips: Fix bus setup conditional check Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 16/17] xilinx_spips: Add missing dual-bus snoop commands Peter Maydell
2013-03-15 16:56 ` [Qemu-devel] [PATCH 17/17] xilinx_spips: QOM styling fixes Peter Maydell
2013-03-17 20:48 ` [Qemu-devel] [PULL 00/17] arm-devs queue Blue Swirl

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=1363366599-24238-9-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=paul@codesourcery.com \
    --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).