In order to make the next commit trivial, move the sysbus_init_mmio()
call in allwinner_r40_dramc_init() just before the corresponding
sysbus_mmio_map_overlap() call in allwinner_r40_dramc_realize().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/misc/allwinner-r40-dramc.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/misc/allwinner-r40-dramc.c b/hw/misc/allwinner-r40-dramc.c
index 6944f84455..2cc0254a55 100644
--- a/hw/misc/allwinner-r40-dramc.c
+++ b/hw/misc/allwinner-r40-dramc.c
@@ -414,6 +414,7 @@ static void allwinner_r40_dramc_reset(DeviceState *dev)
static void allwinner_r40_dramc_realize(DeviceState *dev, Error **errp)
{
AwR40DramCtlState *s = AW_R40_DRAMC(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
if (!get_match_ddr(s->ram_size)) {
error_report("%s: ram-size %u MiB is not supported",
@@ -421,8 +422,12 @@ static void allwinner_r40_dramc_realize(DeviceState *dev, Error **errp)
exit(1);
}
- /* detect_cells */
- sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s), 3, s->ram_addr, 10);
+ /* R40 support max 2G memory but we only support up to 1G now. index 3 */
+ memory_region_init_io(&s->detect_cells, OBJECT(s),
+ &allwinner_r40_detect_ops, s,
+ "DRAMCELLS", 1 * GiB);
+ sysbus_init_mmio(sbd, &s->detect_cells);
+ sysbus_mmio_map_overlap(sbd, 3, s->ram_addr, 10);
memory_region_set_enabled(&s->detect_cells, false);
/*
@@ -458,12 +463,6 @@ static void allwinner_r40_dramc_init(Object *obj)
&allwinner_r40_dramphy_ops, s,
"DRAMPHY", 4 * KiB);
sysbus_init_mmio(sbd, &s->dramphy_iomem);
-
- /* R40 support max 2G memory but we only support up to 1G now. index 3 */
- memory_region_init_io(&s->detect_cells, OBJECT(s),
- &allwinner_r40_detect_ops, s,
- "DRAMCELLS", 1 * GiB);
- sysbus_init_mmio(sbd, &s->detect_cells);
}
static Property allwinner_r40_dramc_properties[] = {
--
2.41.0