1
From 317bcb4caa1757114db37a61e7eef50e9dc0c096 Mon Sep 17 00:00:00 2001
2
From: Peter Maydell <peter.maydell@linaro.org>
3
Date: Mon, 18 Feb 2013 16:58:29 +0000
4
Subject: [PATCH 36/77] hw/omap_uart.c: Unconditionally enable non-16550
7
Uncondionally enable the OMAP UART modelling of the extensions
8
over plain 16550A, instead of having them guarded by #ifdefs
9
and disabled by default. Newer Linux kernels have an OMAP
10
specific serial driver which relies on these being implemented.
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
hw/omap_uart.c | 49 +++++++++++++++++++------------------------------
15
1 file changed, 19 insertions(+), 30 deletions(-)
17
diff --git a/hw/omap_uart.c b/hw/omap_uart.c
18
index 1c1edb5..9283c2e 100644
22
#include "exec/address-spaces.h"
25
-/* The OMAP UART functionality is similar to the TI16C752 rather than
26
- * the 16550A. When the flag below is enabled, the code will however
27
- * offer 'only' the basic 16550A emulation. */
28
-/* TODO: real functionality for the TI16C752 enhanced features. Note
29
- * QEMU's SerialState emulation internally always uses a 16-byte FIFO
30
- * whereas we would need a 64-byte FIFO for OMAP. */
31
-#define OMAP_UART_16550A
32
+/* The OMAP UART functionality is similar to the TI16C752; it is
33
+ * an enhanced version of the 16550A and we piggy-back on the 16550
36
+ * Currently unmodelled functionality:
37
+ * + We should have a 64 byte FIFO but QEMU's SerialState emulation
38
+ * always uses a 16 byte FIFO
40
+ * + interrupts based on TCR/TLR values
41
+ * + XON/XOFF flow control
42
+ * + UASR auto-baudrate-detection
47
@@ -54,13 +59,11 @@ struct omap_uart_s {
51
-#ifndef OMAP_UART_16550A
56
uint8_t xon[2], xoff[2];
60
static void omap_uart_reset(DeviceState *qdev)
61
@@ -76,14 +79,12 @@ static void omap_uart_reset(DeviceState *qdev)
65
-#ifndef OMAP_UART_16550A
70
s->xon[0] = s->xon[1] = 0;
71
s->xoff[0] = s->xoff[1] = 0;
75
static uint64_t omap_uart_read(void *opaque, hwaddr addr,
76
@@ -97,33 +98,27 @@ static uint64_t omap_uart_read(void *opaque, hwaddr addr,
78
return s->serial_ops->read(s->serial, addr, size);
80
-#ifndef OMAP_UART_16550A
81
if (s->lcr_cache == 0xbf) {
85
return s->serial_ops->read(s->serial, addr, size);
88
-#ifndef OMAP_UART_16550A
89
if (s->lcr_cache == 0xbf) {
90
return s->xon[(addr & 7) >> 2];
91
} else if (addr == 0x10) {
92
return s->serial_ops->read(s->serial, addr, size)
93
| (s->mcr_cache & 0xe0);
96
return s->serial_ops->read(s->serial, addr, size);
99
-#ifndef OMAP_UART_16550A
100
if ((s->efr & 0x10) && (s->mcr_cache & 0x40)) {
101
return (addr == 0x18) ? s->tcr : s->tlr;
103
if (s->lcr_cache == 0xbf) {
104
return s->xoff[(addr & 7) >> 2];
107
return s->serial_ops->read(s->serial, addr, size);
108
case 0x20: /* MDR1 */
110
@@ -179,12 +174,11 @@ static void omap_uart_write(void *opaque, hwaddr addr,
111
s->serial_ops->write(s->serial, addr, value, size);
114
-#ifndef OMAP_UART_16550A
115
if (s->lcr_cache == 0xbf) {
119
- s->serial_ops->write(s->serial, addr, value, size);
121
+ s->serial_ops->write(s->serial, addr, value, size);
125
s->lcr_cache = value;
126
@@ -192,22 +186,17 @@ static void omap_uart_write(void *opaque, hwaddr addr,
130
-#ifndef OMAP_UART_16550A
131
if (s->lcr_cache == 0xbf) {
132
s->xon[(addr & 7) >> 2] = value;
135
s->mcr_cache = value & 0x7f;
138
- s->serial_ops->write(s->serial, addr, value, size);
139
-#ifndef OMAP_UART_16550A
140
+ s->serial_ops->write(s->serial, addr, value, size);
146
-#ifndef OMAP_UART_16550A
147
if ((s->efr & 0x10) && (s->mcr_cache & 0x40)) {
149
s->tcr = value & 0xff;
150
@@ -216,9 +205,9 @@ static void omap_uart_write(void *opaque, hwaddr addr,
152
} else if (s->lcr_cache == 0xbf) {
153
s->xoff[(addr & 7) >> 2] = value;
156
- s->serial_ops->write(s->serial, addr, value, size);
158
+ s->serial_ops->write(s->serial, addr, value, size);
161
case 0x20: /* MDR1 */
162
s->mdr[0] = value & 0x7f;