Skip to contentSkip to conversation

serial: ns16550: Fix Debug UART initialization for AM335x

PATCH New Jacob Siverskog 2 participants 2 messages Nov 10, 2016 – Nov 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: ns16550: Fix Debug UART initialization for AM335x

Fixed the init sequence in debug_uart_init() to match the one in NS16550_init(). Without this I was unable to get debug UART working on AM335x. Based on a patch by Vasili Galka.

---
 drivers/serial/ns16550.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/serial/ns16550.c +13 -0
index 6e9b946..40fe246 100644
@@ -262,6 +262,11 @@ static inline void _debug_uart_init(void)
 	baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
 					    CONFIG_BAUDRATE);
 	serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
+#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
+			defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+	serial_dout(&com_port->mdr1, 0x7);	/* mode select reset TL16C750*/
+#endif
+
 	serial_dout(&com_port->mcr, UART_MCRVAL);
 	serial_dout(&com_port->fcr, UART_FCRVAL);
 
@@ -269,6 +274,14 @@ static inline void _debug_uart_init(void)
 	serial_dout(&com_port->dll, baud_divisor & 0xff);
 	serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff);
 	serial_dout(&com_port->lcr, UART_LCRVAL);
+
+#if defined(CONFIG_OMAP) || \
+	defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
+	defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+
+	/* /16 is proper to hit 115200 with 48MHz */
+	serial_dout(&com_port->mdr1, 0);
+#endif /* CONFIG_OMAP */
 }
 
 static inline void _debug_uart_putc(int ch)
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/1 serial: ns16550: Fix Debug UART initialization for AM335x

Hi,

Quoted 14 lines · Jacob Siverskog

Fixed the init sequence in debug_uart_init() to match the one in NS16550_init(). Without this I was unable to get debug UART working on AM335x. Based on a patch by Vasili Galka.

---
 drivers/serial/ns16550.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/serial/ns16550.c +0 -0
index 6e9b946..40fe246 100644

drivers/serial/ns16550.c static inline void _debug_uart_init(void) · line 268

Quoted 7 lines
drivers/serial/ns16550.c +4 -0
@@ -262,6 +262,11 @@ static inline void _debug_uart_init(void)
        baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
                                            CONFIG_BAUDRATE);
        serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
+#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
+                       defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+       serial_dout(&com_port->mdr1, 0x7);      /* mode select reset TL16C750*/
+#endif

This is generic code so we cannot have arch-specific #ifdefs here. You could pass in a flags or tweaks value perhaps? That would need a change to the function signature.

Quoted 20 lines
drivers/serial/ns16550.c +9 -1
+
        serial_dout(&com_port->mcr, UART_MCRVAL);
        serial_dout(&com_port->fcr, UART_FCRVAL);
 
@@ -269,6 +274,14 @@ static inline void _debug_uart_init(void)
        serial_dout(&com_port->dll, baud_divisor & 0xff);
        serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff);
        serial_dout(&com_port->lcr, UART_LCRVAL);
+
+#if defined(CONFIG_OMAP) || \
+       defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
+       defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+
+       /* /16 is proper to hit 115200 with 48MHz */
+       serial_dout(&com_port->mdr1, 0);
+#endif /* CONFIG_OMAP */
 }
 
 static inline void _debug_uart_putc(int ch)
--
Quoted 2 lines

2.10.2

Regards,
Simon