[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 06/26] hw/ppc/e500: Reuse TYPE_GPIO_PWR
From: |
Bernhard Beschow |
Subject: |
[PATCH v4 06/26] hw/ppc/e500: Reuse TYPE_GPIO_PWR |
Date: |
Sun, 3 Nov 2024 14:33:52 +0100 |
Taking inspiration from the ARM virt machine, port away from
qemu_allocate_irq() by reusing TYPE_GPIO_PWR.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/ppc/e500.c | 16 ++++------------
hw/ppc/Kconfig | 1 +
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index a0c856568b..5d75a090ee 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -30,7 +30,6 @@
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
#include "sysemu/reset.h"
-#include "sysemu/runstate.h"
#include "kvm_ppc.h"
#include "sysemu/device_tree.h"
#include "hw/ppc/openpic.h"
@@ -47,7 +46,6 @@
#include "hw/platform-bus.h"
#include "hw/net/fsl_etsec/etsec.h"
#include "hw/i2c/i2c.h"
-#include "hw/irq.h"
#include "hw/sd/sdhci.h"
#include "hw/misc/unimp.h"
@@ -887,13 +885,6 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineState
*pms,
return dev;
}
-static void ppce500_power_off(void *opaque, int line, int on)
-{
- if (on) {
- qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
- }
-}
-
void ppce500_init(MachineState *machine)
{
MemoryRegion *address_space_mem = get_system_memory();
@@ -1072,7 +1063,7 @@ void ppce500_init(MachineState *machine)
sysbus_create_simple("e500-spin", pmc->spin_base, NULL);
if (pmc->has_mpc8xxx_gpio) {
- qemu_irq poweroff_irq;
+ DeviceState *gpio_pwr_dev;
dev = qdev_new("mpc8xxx_gpio");
s = SYS_BUS_DEVICE(dev);
@@ -1082,8 +1073,9 @@ void ppce500_init(MachineState *machine)
sysbus_mmio_get_region(s, 0));
/* Power Off GPIO at Pin 0 */
- poweroff_irq = qemu_allocate_irq(ppce500_power_off, NULL, 0);
- qdev_connect_gpio_out(dev, 0, poweroff_irq);
+ gpio_pwr_dev = sysbus_create_simple("gpio-pwr", -1, NULL);
+ qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in_named(gpio_pwr_dev,
+ "shutdown", 0));
}
/* Platform Bus Device */
diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index b44d91bebb..12ca3caabf 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -158,6 +158,7 @@ config E500
imply VIRTIO_PCI
select ETSEC
select GPIO_MPC8XXX
+ select GPIO_PWR
select OPENPIC
select PFLASH_CFI01
select PLATFORM_BUS
--
2.47.0
- [PATCH v4 00/26] E500 Cleanup, Bernhard Beschow, 2024/11/03
- [PATCH v4 01/26] hw/ppc/e500: Do not leak struct boot_info, Bernhard Beschow, 2024/11/03
- [PATCH v4 05/26] hw/ppc/e500: Add missing device tree properties to i2c controller node, Bernhard Beschow, 2024/11/03
- [PATCH v4 06/26] hw/ppc/e500: Reuse TYPE_GPIO_PWR,
Bernhard Beschow <=
- [PATCH v4 03/26] hw/ppc/e500: Prefer QOM cast, Bernhard Beschow, 2024/11/03
- [PATCH v4 02/26] hw/ppc/e500: Remove firstenv variable, Bernhard Beschow, 2024/11/03
- [PATCH v4 04/26] hw/ppc/e500: Remove unused "irqs" parameter, Bernhard Beschow, 2024/11/03
- [PATCH v4 09/26] hw/ppc/ppce500_ccsr: Trace access to CCSR region, Bernhard Beschow, 2024/11/03
- [PATCH v4 10/26] hw/ppc/mpc8544_guts: Populate POR PLL ratio status register, Bernhard Beschow, 2024/11/03
- [PATCH v4 11/26] hw/i2c/mpc_i2c: Convert DPRINTF to trace events for register access, Bernhard Beschow, 2024/11/03
- [PATCH v4 12/26] hw/i2c/mpc_i2c: Prefer DEFINE_TYPES() macro, Bernhard Beschow, 2024/11/03
- [PATCH v4 07/26] hw/ppc/e500: Use SysBusDevice API to access TYPE_CCSR's internal resources, Bernhard Beschow, 2024/11/03
- [PATCH v4 08/26] hw/ppc/e500: Extract ppce500_ccsr.c, Bernhard Beschow, 2024/11/03