diff options
author | Trent Piepho <tpiepho@impinj.com> | 2018-03-23 18:26:45 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-03-23 18:26:45 +0000 |
commit | 478a573a7d079a463273db7f9e7b0d460120c2dd (patch) | |
tree | 490ab7c2e3b40f6d67ce943ca3d78910dcc21466 /hw/char | |
parent | 2b0b93210a06d8a6d99f8015b79ee3aabed8f29a (diff) | |
download | qemu-478a573a7d079a463273db7f9e7b0d460120c2dd.zip qemu-478a573a7d079a463273db7f9e7b0d460120c2dd.tar.gz qemu-478a573a7d079a463273db7f9e7b0d460120c2dd.tar.bz2 |
i.MX: Support serial RS-232 break properly
Linux does not detect a break from this IMX serial driver as a magic
sysrq. Nor does it note a break in the port error counts.
The former is because the Linux driver uses the BRCD bit in the USR2
register to trigger the RS-232 break handler in the kernel, which is
where sysrq hooks in. The emulated UART was not setting this status
bit.
The latter is because the Linux driver expects, in addition to the BRK
bit, that the ERR bit is set when a break is read in the FIFO. A break
should also count as a frame error, so add that bit too.
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Message-id: 20180320013657.25038-1-tpiepho@impinj.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r-- | hw/char/imx_serial.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 1e55404..0747db9 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -308,6 +308,9 @@ static void imx_put_data(void *opaque, uint32_t value) s->usr2 |= USR2_RDR; s->uts1 &= ~UTS1_RXEMPTY; s->readbuff = value; + if (value & URXD_BRK) { + s->usr2 |= USR2_BRCD; + } imx_update(s); } @@ -319,7 +322,7 @@ static void imx_receive(void *opaque, const uint8_t *buf, int size) static void imx_event(void *opaque, int event) { if (event == CHR_EVENT_BREAK) { - imx_put_data(opaque, URXD_BRK); + imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR); } } |