1
From bbec7553a7623c85d1e79edbb23e23aff50f25e5 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/71] 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/char/omap_uart.c | 49 +++++++++++++++++++------------------------------
15
1 file changed, 19 insertions(+), 30 deletions(-)
17
diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c
18
index 2bffed4..746b635 100644
19
--- a/hw/char/omap_uart.c
20
+++ b/hw/char/omap_uart.c
22
#define TYPE_OMAP_UART "omap_uart"
23
#define OMAP_UART(obj) OBJECT_CHECK(omap_uart_s, (obj), TYPE_OMAP_UART)
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
45
typedef struct omap_uart_s {
47
@@ -57,13 +62,11 @@ typedef 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
@@ -79,14 +82,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
@@ -100,33 +101,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
@@ -182,12 +177,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
@@ -195,22 +189,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
@@ -219,9 +208,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;