[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 29/33] next-cube: add rtc-cmd-reset named gpio to reset the rt
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v3 29/33] next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine |
Date: |
Sun, 22 Dec 2024 13:00:08 +0000 |
This allows us to decouple the next-pc and next-rtc devices from each
other in next_scr2_rtc_update().
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/m68k/next-cube.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index 8edf51198e..ba8c6bb1cd 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -108,6 +108,7 @@ struct NeXTPC {
NeXTRTC rtc;
qemu_irq rtc_power_irq;
qemu_irq rtc_data_irq;
+ qemu_irq rtc_cmd_reset_irq;
};
typedef struct next_dma {
@@ -264,7 +265,6 @@ static void next_rtc_data_in_irq(void *opaque, int n, int
level)
static void next_scr2_rtc_update(NeXTPC *s)
{
uint8_t old_scr2, scr2_2;
- NeXTRTC *rtc = &s->rtc;
old_scr2 = extract32(s->old_scr2, 8, 8);
scr2_2 = extract32(s->scr2, 8, 8);
@@ -282,9 +282,7 @@ static void next_scr2_rtc_update(NeXTPC *s)
}
} else {
/* else end or abort */
- rtc->phase = 0;
- rtc->command = 0;
- rtc->value = 0;
+ qemu_irq_raise(s->rtc_cmd_reset_irq);
}
}
@@ -1015,6 +1013,17 @@ static const MemoryRegionOps next_dummy_en_ops = {
.endianness = DEVICE_BIG_ENDIAN,
};
+static void next_rtc_cmd_reset_irq(void *opaque, int n, int level)
+{
+ NeXTRTC *rtc = NEXT_RTC(opaque);
+
+ if (level) {
+ rtc->phase = 0;
+ rtc->command = 0;
+ rtc->value = 0;
+ }
+}
+
static void next_rtc_reset_hold(Object *obj, ResetType type)
{
NeXTRTC *rtc = NEXT_RTC(obj);
@@ -1033,6 +1042,8 @@ static void next_rtc_init(Object *obj)
"rtc-data-in", 1);
qdev_init_gpio_out_named(DEVICE(obj), &rtc->data_out_irq,
"rtc-data-out", 1);
+ qdev_init_gpio_in_named(DEVICE(obj), next_rtc_cmd_reset_irq,
+ "rtc-cmd-reset", 1);
}
static const VMStateDescription next_rtc_vmstate = {
@@ -1143,6 +1154,8 @@ static void next_pc_realize(DeviceState *dev, Error
**errp)
qdev_connect_gpio_out_named(d, "rtc-data-out", 0,
qdev_get_gpio_in_named(dev,
"rtc-data-in", 0));
+ qdev_connect_gpio_out_named(dev, "rtc-cmd-reset", 0,
+ qdev_get_gpio_in_named(d, "rtc-cmd-reset", 0));
}
static void next_pc_init(Object *obj)
@@ -1183,6 +1196,8 @@ static void next_pc_init(Object *obj)
"rtc-data-in", 1);
qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq,
"rtc-data-out", 1);
+ qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_cmd_reset_irq,
+ "rtc-cmd-reset", 1);
}
/*
--
2.39.5
- [PATCH v3 06/33] next-cube: introduce next-scsi device, (continued)
- [PATCH v3 06/33] next-cube: introduce next-scsi device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 11/33] next-cube: move ESCC to be QOM child of next-pc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 13/33] next-cube: move en ethernet MMIO to separate memory region on next-pc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 05/33] next-cube: introduce next_pc_init() object init function, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 08/33] next-cube: move SCSI 4020/4021 logic from next-pc device to next-scsi device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 12/33] next-cube: move timer MMIO to separate memory region on next-pc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 15/33] next-cube: remove unused next.scr memory region, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 17/33] next-cube: convert next-pc device to use Resettable interface, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 20/33] next-cube: separate rtc read and write shift logic, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 22/33] next-cube: use named gpio to set RTC data bit in scr2, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 29/33] next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine,
Mark Cave-Ayland <=
- [PATCH v3 32/33] next-cube: rename old_scr2 and scr2_2 in next_scr2_rtc_update(), Mark Cave-Ayland, 2024/12/22
- [PATCH v3 19/33] next-cube: use qemu_irq to drive int_status in next_scr2_rtc_update(), Mark Cave-Ayland, 2024/12/22
- [PATCH v3 30/33] next-cube: add rtc-power-out named gpio to trigger the NEXT_PWR_I interrupt, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 10/33] next-cube: map ESCC registers as a subregion of the next.scr memory region, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 09/33] next-cube: move floppy disk MMIO to separate memory region in next-pc, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 16/33] next-cube: rearrange NeXTState declarations to improve readability, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 23/33] next-cube: use named gpio to read RTC data bit in scr2, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 24/33] next-cube: don't use rtc phase value of -1, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 27/33] next-cube: move rtc-data-in gpio from next-pc to next-rtc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 28/33] next-cube: use named gpio output for next-rtc data, Mark Cave-Ayland, 2024/12/22