From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-ppc@nongnu.org, Bernhard Beschow <shentey@gmail.com>
Subject: [PATCH 3/3] hw/ppc/e500: Reuse TYPE_GPIO_POWEROFF
Date: Mon, 23 Sep 2024 12:15:54 +0200 [thread overview]
Message-ID: <20240923101554.12900-4-shentey@gmail.com> (raw)
In-Reply-To: <20240923101554.12900-1-shentey@gmail.com>
The ppce500 machine provides a device tree node whose compatible property is
"gpio-poweroff". This matches TYPE_GPIO_POWEROFF like used in the ARM virt
machine, so reuse it.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/ppc/e500.c | 15 +++------------
hw/ppc/Kconfig | 1 +
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 3bd12b54ab..af74b32c13 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"
@@ -892,13 +890,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();
@@ -1086,7 +1077,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 *poweroff_dev;
dev = qdev_new("mpc8xxx_gpio");
s = SYS_BUS_DEVICE(dev);
@@ -1096,8 +1087,8 @@ 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);
+ poweroff_dev = sysbus_create_simple("gpio-poweroff", -1, NULL);
+ qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(poweroff_dev, 0));
}
/* Platform Bus Device */
diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index 5addad1124..31764ef909 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_POWEROFF
select OPENPIC
select PFLASH_CFI01
select PLATFORM_BUS
--
2.46.1
next prev parent reply other threads:[~2024-09-23 10:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 10:15 [PATCH 0/3] Split TYPE_GPIOPWR and reuse in E500 machines Bernhard Beschow
2024-09-23 10:15 ` [PATCH 1/3] MAINTAINERS: Add hw/gpio/gpio_pwr.c Bernhard Beschow
2024-09-23 10:15 ` [PATCH 2/3] hw/gpio/gpio_pwr: Split into separate gpio_poweroff and gpio_restart devices Bernhard Beschow
2024-09-23 10:15 ` Bernhard Beschow [this message]
2024-09-30 12:57 ` [PATCH 0/3] Split TYPE_GPIOPWR and reuse in E500 machines Peter Maydell
2024-10-05 10:11 ` Bernhard Beschow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240923101554.12900-4-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).