From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
qemu-arm@nongnu.org,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Guenter Roeck" <linux@roeck-us.net>
Subject: [Qemu-devel] [PATCH 1/2] hw/char/serial: Add a helper to set the divisor register
Date: Tue, 20 Aug 2019 14:34:16 +0200 [thread overview]
Message-ID: <20190820123417.27930-2-philmd@redhat.com> (raw)
In-Reply-To: <20190820123417.27930-1-philmd@redhat.com>
Some chipsets provide 16650 compatible UART with exhanced
features. The BCM2835 provides a register to directly set
the baudrate divisor register without having to use the
LABD bit.
Add a helper to allow models to directly set the divisor.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/char/serial.c | 6 ++++++
include/hw/char/serial.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index b4aa250950..12eb93705d 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -191,6 +191,12 @@ static void serial_update_parameters(SerialState *s)
speed, parity, data_bits, stop_bits);
}
+void serial_set_divider(SerialState *s, uint16_t divider)
+{
+ s->divider = divider;
+ serial_update_parameters(s);
+}
+
static void serial_update_msl(SerialState *s)
{
uint8_t omsr;
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 8be3d8a4f9..ef211f695d 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -83,6 +83,7 @@ extern const MemoryRegionOps serial_io_ops;
void serial_realize_core(SerialState *s, Error **errp);
void serial_exit_core(SerialState *s);
void serial_set_frequency(SerialState *s, uint32_t frequency);
+void serial_set_divider(SerialState *s, uint16_t divider);
/* legacy pre qom */
SerialState *serial_init(int base, qemu_irq irq, int baudbase,
--
2.20.1
next prev parent reply other threads:[~2019-08-20 12:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 12:34 [Qemu-devel] [RFC PATCH 0/2] hw/char/bcm2835_aux: Provide full 16550 UART support Philippe Mathieu-Daudé
2019-08-20 12:34 ` Philippe Mathieu-Daudé [this message]
2019-08-20 12:34 ` [Qemu-devel] [RFC PATCH 2/2] " Philippe Mathieu-Daudé
2019-08-20 12:58 ` [Qemu-devel] [RFC PATCH 0/2] " Philippe Mathieu-Daudé
2019-08-20 14:31 ` Guenter Roeck
2019-08-20 14:34 ` Peter Maydell
2019-08-20 14:45 ` Guenter Roeck
2019-08-20 14:53 ` Guenter Roeck
2019-08-20 15:08 ` Philippe Mathieu-Daudé
2019-08-20 15:16 ` Guenter Roeck
2019-09-23 13:26 ` Peter Maydell
2019-09-23 15:39 ` Philippe Mathieu-Daudé
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=20190820123417.27930-2-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=f4bug@amsat.org \
--cc=linux@roeck-us.net \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.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).