Signed-off-by: Matthijs van Duin <matthijsvand...@gmail.com> --- drivers/serial/ns16550.c | 10 +++++----- include/ns16550.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 5ac2469b5760..41eb098c847e 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -166,7 +166,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) == UART_LSR_THRE) { if (baud_divisor != -1) NS16550_setbrg(com_port, baud_divisor); - serial_out(0, &com_port->mdr1); + serial_out(UART_MDR1_16X, &com_port->mdr1); } #endif @@ -175,7 +175,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); #ifdef CONFIG_NS16550_OMAP - serial_out(0x7, &com_port->mdr1); /* mode select reset TL16C750*/ + serial_out(UART_MDR1_DISABLE, &com_port->mdr1); #endif serial_out(UART_MCRVAL, &com_port->mcr); serial_out(ns16550_getfcr(com_port), &com_port->fcr); @@ -183,7 +183,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) NS16550_setbrg(com_port, baud_divisor); #ifdef CONFIG_NS16550_OMAP /* /16 is proper to hit 115200 with 48MHz */ - serial_out(0, &com_port->mdr1); + serial_out(UART_MDR1_16X, &com_port->mdr1); #endif #ifdef CONFIG_NS16550_C6X serial_out(UART_REG_VAL_PWREMU_MGMT_UART_ENABLE, &com_port->pwr_mgmt); @@ -289,7 +289,7 @@ 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); - serial_dout(&com_port->mdr1, 0x7); + serial_dout(&com_port->mdr1, UART_MDR1_DISABLE); serial_dout(&com_port->mcr, UART_MCRVAL); serial_dout(&com_port->fcr, UART_FCR_DEFVAL); @@ -297,7 +297,7 @@ 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); - serial_dout(&com_port->mdr1, 0x0); + serial_dout(&com_port->mdr1, UART_MDR1_16X); } static inline void _debug_uart_putc(int ch) diff --git a/include/ns16550.h b/include/ns16550.h index 4a87ab9c8e71..540337258c1e 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -208,6 +208,20 @@ typedef struct NS16550 *NS16550_t; /* useful defaults for LCR */ #define UART_LCR_8N1 0x03 +/* + * These are the definitions for Mode Definition Register 1 + */ +#if defined(CONFIG_NS16550_C6X) +#define UART_MDR1_16X 0x00 /* 16x oversampling (default) */ +#define UART_MDR1_13X 0x01 /* 13x oversampling */ +#elif defined(CONFIG_NS16550_OMAP) +#define UART_MDR1_16X 0x00 /* 16x oversampling */ +#define UART_MDR1_16X_AUTOBAUD 0x02 /* 16x oversampling, auto-baud */ +#define UART_MDR1_13X 0x03 /* 13x oversampling */ +#define UART_MDR1_DISABLE 0x07 /* disable uart (default) */ +/* other values/bits are for infrared modes */ +#endif + void NS16550_init(NS16550_t com_port, int baud_divisor); void NS16550_putc(NS16550_t com_port, char c); char NS16550_getc(NS16550_t com_port); -- 2.11.0 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot