UART is disabled by default on TI platforms and must be enabled
via the MDR register.

Add a new flag in the jailhouse_console and apply the quirk
as part of uart_init for 8250 driver when this flag is present.

Signed-off-by: Nikhil Devshatwar <[email protected]>
Signed-off-by: Lokesh Vutla <[email protected]>
---
Changes from v2:
* Use CON_HAS_MDR_QUIRK

Changes from v1:
* Use console flag for MDR quirk instead of compile time flag
 include/jailhouse/console.h | 7 ++++++-
 inmates/lib/uart-8250.c     | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/jailhouse/console.h b/include/jailhouse/console.h
index 8961c6e..a6efd37 100644
--- a/include/jailhouse/console.h
+++ b/include/jailhouse/console.h
@@ -78,7 +78,12 @@
 
 #define CON_HAS_INVERTED_GATE(flags)   !!((flags) & 
JAILHOUSE_CON_INVERTED_GATE)
 
-/* Bits 13-15: Reserved */
+/* Bit 13 is used to apply (set) or skip (clear) a MDR quirk on the console */
+#define JAILHOUSE_CON_MDR_QUIRK                0x2000
+
+#define CON_HAS_MDR_QUIRK(flags)       !!((flags) & JAILHOUSE_CON_MDR_QUIRK)
+
+/* Bits 14-15: Reserved */
 
 struct jailhouse_console {
        __u64 address;
diff --git a/inmates/lib/uart-8250.c b/inmates/lib/uart-8250.c
index fb7940d..5492e06 100644
--- a/inmates/lib/uart-8250.c
+++ b/inmates/lib/uart-8250.c
@@ -49,6 +49,7 @@
 #define  UART_LCR_DLAB         0x80
 #define UART_LSR               0x5
 #define  UART_LSR_THRE         0x20
+#define  UART_MDR1             0x8
 
 static void reg_out_mmio32(struct uart_chip *chip, unsigned int reg, u32 value)
 {
@@ -67,6 +68,8 @@ static void uart_8250_init(struct uart_chip *chip)
                chip->reg_out(chip, UART_DLL, chip->divider);
                chip->reg_out(chip, UART_DLM, 0);
                chip->reg_out(chip, UART_LCR, UART_LCR_8N1);
+               if (CON_HAS_MDR_QUIRK(comm_region->console.flags))
+                       chip->reg_out(chip, UART_MDR1, 0);
        }
 }
 
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/1567599723-19589-2-git-send-email-nikhil.nd%40ti.com.

Reply via email to