diff options
| author | Tom Rini <[email protected]> | 2026-02-02 14:24:56 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-02-02 14:25:48 -0600 |
| commit | 1de103fc29761fa729dffaa15d0cfb2766be05e4 (patch) | |
| tree | fc2253a01976672d68a4d984273e7f02c1fbd3cc /drivers/sysreset | |
| parent | 4b287e0a3ae4ab3159584cb5ae12c9b470716be8 (diff) | |
| parent | 838e3be9e1d39e38661a788ae3bcfb9f989450a8 (diff) | |
Merge patch series "m68k: Add support for QEMU virt machine"
Kuan-Wei Chiu <[email protected]> says:
Add support for the QEMU 'virt' machine on the m68k architecture. The
QEMU virt machine models a generic system utilizing Goldfish virtual
peripherals and is capable of emulating various classic 68k CPUs.
Currently, U-Boot's m68k architecture support focuses on ColdFire
variants. This series expands support to include the classic M680x0
architecture, implementing the necessary exception vectors, startup
code, and a bootinfo parser compatible with the QEMU interface.
Drivers for Goldfish peripherals (TTY, Timer, RTC) and the QEMU
Virtual System Controller (sysreset) are also added to enable serial
console, timekeeping, and system reset functionality.
The implementation has been verified on QEMU targeting the M68040 CPU,
confirming successful hardware initialization and boot to the U-Boot
command shell. Additionally, the CI configuration was verified locally
using gitlab-ci-local "qemu_m68k_virt test.py", resulting in
PASS qemu_m68k_virt test.py.
Link: https://lore.kernel.org/r/[email protected]
[trini: Re-sort MAINTAINERS entries]
Signed-off-by: Tom Rini <[email protected]>
Diffstat (limited to 'drivers/sysreset')
| -rw-r--r-- | drivers/sysreset/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/sysreset/Makefile | 1 | ||||
| -rw-r--r-- | drivers/sysreset/sysreset_qemu_virt_ctrl.c | 55 |
3 files changed, 64 insertions, 0 deletions
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig index 0181f6cd581..120e7510f15 100644 --- a/drivers/sysreset/Kconfig +++ b/drivers/sysreset/Kconfig @@ -298,6 +298,14 @@ config SYSRESET_QCOM_PSHOLD help Add support for the system reboot on Qualcomm SoCs via PSHOLD. +config SYSRESET_QEMU_VIRT_CTRL + bool "QEMU Virtual System Controller support" + depends on SYSRESET + help + Enable support for the QEMU Virtual System Controller. + This device is used in QEMU machines (e.g. m68k virt) to trigger + system reset and poweroff events. + endif endmenu diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile index f5c78b25896..d18a5d52360 100644 --- a/drivers/sysreset/Makefile +++ b/drivers/sysreset/Makefile @@ -32,3 +32,4 @@ obj-$(CONFIG_$(PHASE_)SYSRESET_X86) += sysreset_x86.o obj-$(CONFIG_SYSRESET_RAA215300) += sysreset_raa215300.o obj-$(CONFIG_SYSRESET_QCOM_PSHOLD) += sysreset_qcom-pshold.o obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o +obj-$(CONFIG_SYSRESET_QEMU_VIRT_CTRL) += sysreset_qemu_virt_ctrl.o diff --git a/drivers/sysreset/sysreset_qemu_virt_ctrl.c b/drivers/sysreset/sysreset_qemu_virt_ctrl.c new file mode 100644 index 00000000000..e7cacc9b6e9 --- /dev/null +++ b/drivers/sysreset/sysreset_qemu_virt_ctrl.c @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2025, Kuan-Wei Chiu <[email protected]> + * + * QEMU Virtual System Controller Driver + */ + +#include <dm.h> +#include <qemu_virt_ctrl.h> +#include <sysreset.h> +#include <asm/io.h> +#include <linux/err.h> + +/* Register offsets */ +#define VIRT_CTRL_REG_FEATURES 0x00 +#define VIRT_CTRL_REG_CMD 0x04 + +/* Commands */ +#define VIRT_CTRL_CMD_NOOP 0x00 +#define VIRT_CTRL_CMD_RESET 0x01 +#define VIRT_CTRL_CMD_HALT 0x02 +#define VIRT_CTRL_CMD_PANIC 0x03 + +static int qemu_virt_ctrl_request(struct udevice *dev, enum sysreset_t type) +{ + struct qemu_virt_ctrl_plat *plat = dev_get_plat(dev); + u32 val; + + switch (type) { + case SYSRESET_WARM: + case SYSRESET_COLD: + val = VIRT_CTRL_CMD_RESET; + break; + case SYSRESET_POWER_OFF: + val = VIRT_CTRL_CMD_HALT; + break; + default: + return -EPROTONOSUPPORT; + } + + writel(val, plat->reg + VIRT_CTRL_REG_CMD); + + return -EINPROGRESS; +} + +static struct sysreset_ops qemu_virt_ctrl_ops = { + .request = qemu_virt_ctrl_request, +}; + +U_BOOT_DRIVER(sysreset_qemu_virt_ctrl) = { + .name = "sysreset_qemu_virt_ctrl", + .id = UCLASS_SYSRESET, + .ops = &qemu_virt_ctrl_ops, + .plat_auto = sizeof(struct qemu_virt_ctrl_plat), +}; |
