diff options
author | BALATON Zoltan <balaton@eik.bme.hu> | 2022-09-24 14:28:05 +0200 |
---|---|---|
committer | Daniel Henrique Barboza <danielhb413@gmail.com> | 2022-10-17 16:15:09 -0300 |
commit | 5f7effe4df91702add08e3e3dc1871fd35a8903f (patch) | |
tree | 89358baf72693eebfcda20b276612de1d74dfc94 /hw/ppc/sam460ex.c | |
parent | ef10aebb9a71f0c60f0b7aae808498333bb7bfd9 (diff) |
ppc440_sdram: QOM'ify
Change the ppc440_sdram model to a QOM class derived from the
PPC4xx-dcr-device and name it ppc4xx-sdram-ddr2. This is mostly
modelling the DDR2 SDRAM controller found in the 460EX (used on the
sam460ex board). Newer SoCs (regardless of their PPC core, e.g. 405EX)
may have this controller but we only emulate enough of it for the
sam460ex u-boot firmware.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <3e82ae575c7c41e464a0082d55ecb4ebcc4d4329.1664021647.git.balaton@eik.bme.hu>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'hw/ppc/sam460ex.c')
-rw-r--r-- | hw/ppc/sam460ex.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 13055a8916..f03cdc9ecc 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -342,14 +342,19 @@ static void sam460ex_init(MachineState *machine) error_report("Memory below 64 MiB is not supported"); exit(1); } + dev = qdev_new(TYPE_PPC4xx_SDRAM_DDR2); + object_property_set_link(OBJECT(dev), "dram", OBJECT(machine->ram), + &error_abort); /* * Put all RAM on first bank because board has one slot * and firmware only checks that */ - ppc440_sdram_init(env, 1, machine->ram); + object_property_set_int(OBJECT(dev), "nbanks", 1, &error_abort); + ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(dev), cpu, &error_fatal); + object_unref(OBJECT(dev)); /* FIXME: does 460EX have ECC interrupts? */ /* Enable SDRAM memory regions as we may boot without firmware */ - ppc4xx_sdram_ddr2_enable(env); + ppc4xx_sdram_ddr2_enable(PPC4xx_SDRAM_DDR2(dev)); /* IIC controllers and devices */ dev = sysbus_create_simple(TYPE_PPC4xx_I2C, 0x4ef600700, |