mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
hw/timer/etraxfs_timer: Convert to 3-phase reset (Resettable interface)
TYPE_ETRAX_FS_TIMER is a sysbus device, so its DeviceClass::reset() handler is called automatically when its qbus parent is reset (we don't need to register it manually). Convert the generic reset to a enter/hold resettable ones, and remove the qemu_register_reset() call. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-Id: <20210502163931.552675-2-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
bcfec3763e
commit
72fe4742c6
1 changed files with 11 additions and 3 deletions
|
@ -309,9 +309,9 @@ static const MemoryRegionOps timer_ops = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void etraxfs_timer_reset(void *opaque)
|
static void etraxfs_timer_reset_enter(Object *obj, ResetType type)
|
||||||
{
|
{
|
||||||
ETRAXTimerState *t = opaque;
|
ETRAXTimerState *t = ETRAX_TIMER(obj);
|
||||||
|
|
||||||
ptimer_transaction_begin(t->ptimer_t0);
|
ptimer_transaction_begin(t->ptimer_t0);
|
||||||
ptimer_stop(t->ptimer_t0);
|
ptimer_stop(t->ptimer_t0);
|
||||||
|
@ -325,6 +325,12 @@ static void etraxfs_timer_reset(void *opaque)
|
||||||
t->rw_wd_ctrl = 0;
|
t->rw_wd_ctrl = 0;
|
||||||
t->r_intr = 0;
|
t->r_intr = 0;
|
||||||
t->rw_intr_mask = 0;
|
t->rw_intr_mask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void etraxfs_timer_reset_hold(Object *obj)
|
||||||
|
{
|
||||||
|
ETRAXTimerState *t = ETRAX_TIMER(obj);
|
||||||
|
|
||||||
qemu_irq_lower(t->irq);
|
qemu_irq_lower(t->irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,14 +349,16 @@ static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
|
||||||
memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
|
memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
|
||||||
"etraxfs-timer", 0x5c);
|
"etraxfs-timer", 0x5c);
|
||||||
sysbus_init_mmio(sbd, &t->mmio);
|
sysbus_init_mmio(sbd, &t->mmio);
|
||||||
qemu_register_reset(etraxfs_timer_reset, t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
|
static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
ResettableClass *rc = RESETTABLE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = etraxfs_timer_realize;
|
dc->realize = etraxfs_timer_realize;
|
||||||
|
rc->phases.enter = etraxfs_timer_reset_enter;
|
||||||
|
rc->phases.hold = etraxfs_timer_reset_hold;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo etraxfs_timer_info = {
|
static const TypeInfo etraxfs_timer_info = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue