Commit 87f1f809 authored by Alexandre TORGUE's avatar Alexandre TORGUE Committed by Greg Kroah-Hartman

serial: stm32: fix uart enable management

Signed-off-by: default avatarGerald Baeza <gerald.baeza@st.com>
Signed-off-by: default avatarAlexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 01d32d71
...@@ -461,9 +461,11 @@ static void stm32_shutdown(struct uart_port *port) ...@@ -461,9 +461,11 @@ static void stm32_shutdown(struct uart_port *port)
{ {
struct stm32_port *stm32_port = to_stm32_port(port); struct stm32_port *stm32_port = to_stm32_port(port);
struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
struct stm32_usart_config *cfg = &stm32_port->info->cfg;
u32 val; u32 val;
val = USART_CR1_TXEIE | USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE; val = USART_CR1_TXEIE | USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE;
val |= BIT(cfg->uart_enable_bit);
stm32_clr_bits(port, ofs->cr1, val); stm32_clr_bits(port, ofs->cr1, val);
free_irq(port->irq, port); free_irq(port->irq, port);
...@@ -923,6 +925,7 @@ static void stm32_console_write(struct console *co, const char *s, unsigned cnt) ...@@ -923,6 +925,7 @@ static void stm32_console_write(struct console *co, const char *s, unsigned cnt)
struct uart_port *port = &stm32_ports[co->index].port; struct uart_port *port = &stm32_ports[co->index].port;
struct stm32_port *stm32_port = to_stm32_port(port); struct stm32_port *stm32_port = to_stm32_port(port);
struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
struct stm32_usart_config *cfg = &stm32_port->info->cfg;
unsigned long flags; unsigned long flags;
u32 old_cr1, new_cr1; u32 old_cr1, new_cr1;
int locked = 1; int locked = 1;
...@@ -935,9 +938,10 @@ static void stm32_console_write(struct console *co, const char *s, unsigned cnt) ...@@ -935,9 +938,10 @@ static void stm32_console_write(struct console *co, const char *s, unsigned cnt)
else else
spin_lock(&port->lock); spin_lock(&port->lock);
/* Save and disable interrupts */ /* Save and disable interrupts, enable the transmitter */
old_cr1 = readl_relaxed(port->membase + ofs->cr1); old_cr1 = readl_relaxed(port->membase + ofs->cr1);
new_cr1 = old_cr1 & ~USART_CR1_IE_MASK; new_cr1 = old_cr1 & ~USART_CR1_IE_MASK;
new_cr1 |= USART_CR1_TE | BIT(cfg->uart_enable_bit);
writel_relaxed(new_cr1, port->membase + ofs->cr1); writel_relaxed(new_cr1, port->membase + ofs->cr1);
uart_console_write(port, s, cnt, stm32_console_putchar); uart_console_write(port, s, cnt, stm32_console_putchar);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment