From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org
Subject: [PATCH v3 3/5] hw/char/pl011: implement a reset method
Date: Fri, 20 Jan 2023 16:54:45 +0100 [thread overview]
Message-ID: <20230120155447.31702-4-eiakovlev@linux.microsoft.com> (raw)
In-Reply-To: <20230120155447.31702-1-eiakovlev@linux.microsoft.com>
PL011 currently lacks a reset method. Implement it.
Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
---
hw/char/pl011.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 4df649a064..f9413f3703 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -427,11 +427,6 @@ static void pl011_init(Object *obj)
s->clk = qdev_init_clock_in(DEVICE(obj), "clk", pl011_clock_update, s,
ClockUpdate);
- s->read_trigger = 1;
- s->ifl = 0x12;
- s->cr = 0x300;
- s->flags = 0x90;
-
s->id = pl011_id_arm;
}
@@ -443,11 +438,32 @@ static void pl011_realize(DeviceState *dev, Error **errp)
pl011_event, NULL, s, NULL, true);
}
+static void pl011_reset(DeviceState *dev)
+{
+ PL011State *s = PL011(dev);
+
+ s->lcr = 0;
+ s->rsr = 0;
+ s->dmacr = 0;
+ s->int_enabled = 0;
+ s->int_level = 0;
+ s->ilpr = 0;
+ s->ibrd = 0;
+ s->fbrd = 0;
+ s->read_pos = 0;
+ s->read_count = 0;
+ s->read_trigger = 1;
+ s->ifl = 0x12;
+ s->cr = 0x300;
+ s->flags = 0x90;
+}
+
static void pl011_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
dc->realize = pl011_realize;
+ dc->reset = pl011_reset;
dc->vmsd = &vmstate_pl011;
device_class_set_props(dc, pl011_properties);
}
--
2.34.1
next prev parent reply other threads:[~2023-01-20 15:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 15:54 [PATCH v3 0/5] Series of fixes for PL011 char device Evgeny Iakovlev
2023-01-20 15:54 ` [PATCH v3 1/5] hw/char/pl011: refactor FIFO depth handling code Evgeny Iakovlev
2023-01-20 18:23 ` Peter Maydell
2023-01-23 7:29 ` Philippe Mathieu-Daudé
2023-01-20 15:54 ` [PATCH v3 2/5] hw/char/pl011: add post_load hook for backwards-compatibility Evgeny Iakovlev
2023-01-20 18:22 ` Peter Maydell
2023-01-23 14:39 ` Evgeny Iakovlev
2023-01-20 15:54 ` Evgeny Iakovlev [this message]
2023-01-20 18:23 ` [PATCH v3 3/5] hw/char/pl011: implement a reset method Peter Maydell
2023-01-23 7:25 ` Philippe Mathieu-Daudé
2023-01-20 15:54 ` [PATCH v3 4/5] hw/char/pl011: better handling of FIFO flags on LCR reset Evgeny Iakovlev
2023-01-20 18:23 ` Peter Maydell
2023-01-20 15:54 ` [PATCH v3 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation Evgeny Iakovlev
2023-01-23 8:14 ` Philippe Mathieu-Daudé
2023-01-23 14:43 ` Evgeny Iakovlev
2023-01-23 15:21 ` Philippe Mathieu-Daudé
2023-01-23 15:59 ` Evgeny Iakovlev
2023-01-23 16:09 ` Evgeny Iakovlev
2023-01-23 16:45 ` Philippe Mathieu-Daudé
2023-01-23 16:23 ` Peter Maydell
2023-01-23 16:41 ` Philippe Mathieu-Daudé
2023-01-25 14:50 ` Evgeny Iakovlev
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=20230120155447.31702-4-eiakovlev@linux.microsoft.com \
--to=eiakovlev@linux.microsoft.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@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).