aspeed/smc: add a 'sdram_base' property
authorCédric Le Goater <clg@kaod.org>
Mon, 1 Jul 2019 16:26:17 +0000 (17:26 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 1 Jul 2019 16:28:59 +0000 (17:28 +0100)
The DRAM address of a DMA transaction depends on the DRAM base address
of the SoC. Inform the SMC controller model with this value.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190618165311.27066-15-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/aspeed_soc.c
hw/ssi/aspeed_smc.c
include/hw/ssi/aspeed_smc.h

index 736e52366a6655de4756dc3ae6c27b2ab2811884..02feb4361ba4e45898c0c44baf7730b4ecd7c971 100644 (file)
@@ -337,6 +337,12 @@ 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_int(OBJECT(&s->fmc), sc->info->memmap[ASPEED_SDRAM],
+                            "sdram-base", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->fmc), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
index 9eda0d720be6276da2f3d7579d800cf4b297d29c..81f2fb7f707a81168ae1711d38ffd771aa32431b 100644 (file)
@@ -913,6 +913,7 @@ static const VMStateDescription vmstate_aspeed_smc = {
 
 static Property aspeed_smc_properties[] = {
     DEFINE_PROP_UINT32("num-cs", AspeedSMCState, num_cs, 1),
+    DEFINE_PROP_UINT64("sdram-base", AspeedSMCState, sdram_base, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
index 3b1e7fce6c862792478fed788c4eb5d63df567a4..591279ba1f43d5ba38a6deac637b6accfa4073d4 100644 (file)
@@ -97,6 +97,9 @@ typedef struct AspeedSMCState {
     uint8_t r_timings;
     uint8_t conf_enable_w0;
 
+    /* for DMA support */
+    uint64_t sdram_base;
+
     AspeedSMCFlash *flashes;
 
     uint8_t snoop_index;