summaryrefslogtreecommitdiffstats
path: root/hw/char
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2019-01-21 11:23:10 +0100
committerPeter Maydell2019-01-21 11:23:10 +0100
commit4076618095099702e0a29e47aac30b4931a1f54b (patch)
treefa4e0a7e945819731574509fa5a298b3ad959903 /hw/char
parentMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20190118' into staging (diff)
downloadqemu-4076618095099702e0a29e47aac30b4931a1f54b.tar.gz
qemu-4076618095099702e0a29e47aac30b4931a1f54b.tar.xz
qemu-4076618095099702e0a29e47aac30b4931a1f54b.zip
hw/char/stm32f2xx_usart: Do not update data register when device is disabled
When the device is disabled, the internal circuitry keeps the data register loaded and doesn't update it. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20190104182057.8778-1-philmd@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/stm32f2xx_usart.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index f3363a2952..10392c70e2 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -53,14 +53,13 @@ static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size)
{
STM32F2XXUsartState *s = opaque;
- s->usart_dr = *buf;
-
if (!(s->usart_cr1 & USART_CR1_UE && s->usart_cr1 & USART_CR1_RE)) {
/* USART not enabled - drop the chars */
DB_PRINT("Dropping the chars\n");
return;
}
+ s->usart_dr = *buf;
s->usart_sr |= USART_SR_RXNE;
if (s->usart_cr1 & USART_CR1_RXNEIE) {