mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
hw/arm: Add basic power management to raspi.
This is just enough to make reboot and poweroff work. Works for linux, u-boot, and the arm trusted firmware. Not tested, but should work for plan9, and bare-metal/hobby OSes, since they seem to generally do what linux does for reset. The watchdog timer functionality is not yet implemented. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/64 Signed-off-by: Nolan Leake <nolan@sigbus.net> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20210625210209.1870217-1-nolan@sigbus.net [PMM: tweaked commit title; fixed region size to 0x200; moved header file to include/] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
fd17995c07
commit
38f2cfbbc3
5 changed files with 204 additions and 2 deletions
|
@ -126,6 +126,10 @@ static void bcm2835_peripherals_init(Object *obj)
|
|||
|
||||
object_property_add_const_link(OBJECT(&s->dwc2), "dma-mr",
|
||||
OBJECT(&s->gpu_bus_mr));
|
||||
|
||||
/* Power Management */
|
||||
object_initialize_child(obj, "powermgt", &s->powermgt,
|
||||
TYPE_BCM2835_POWERMGT);
|
||||
}
|
||||
|
||||
static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
|
||||
|
@ -364,9 +368,16 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
|
|||
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
|
||||
INTERRUPT_USB));
|
||||
|
||||
/* Power Management */
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->powermgt), errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
memory_region_add_subregion(&s->peri_mr, PM_OFFSET,
|
||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->powermgt), 0));
|
||||
|
||||
create_unimp(s, &s->txp, "bcm2835-txp", TXP_OFFSET, 0x1000);
|
||||
create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET, 0x40);
|
||||
create_unimp(s, &s->powermgt, "bcm2835-powermgt", PM_OFFSET, 0x114);
|
||||
create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100);
|
||||
create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100);
|
||||
create_unimp(s, &s->spi[0], "bcm2835-spi0", SPI0_OFFSET, 0x20);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue