Commit 53794183 authored by Jiada Wang's avatar Jiada Wang Committed by Greg Kroah-Hartman

serial: imx: protect Soft Reset of port with lock

Previously Soft Reset (clear of SRST bit in UCR2 register)
of UART in startup is not protected by lock, which may have race
with console_write, as console_write may occur at anytime even
when UART port is shutdown.

To avoid this race, protect Soft reset of UART port with spin_lock.
Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1e84d223
...@@ -1114,6 +1114,12 @@ static int imx_startup(struct uart_port *port) ...@@ -1114,6 +1114,12 @@ static int imx_startup(struct uart_port *port)
writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
/* Can we enable the DMA support? */
if (is_imx6q_uart(sport) && !uart_console(port) &&
!sport->dma_is_inited)
imx_uart_dma_init(sport);
spin_lock_irqsave(&sport->port.lock, flags);
/* Reset fifo's and state machines */ /* Reset fifo's and state machines */
i = 100; i = 100;
...@@ -1124,13 +1130,6 @@ static int imx_startup(struct uart_port *port) ...@@ -1124,13 +1130,6 @@ static int imx_startup(struct uart_port *port)
while (!(readl(sport->port.membase + UCR2) & UCR2_SRST) && (--i > 0)) while (!(readl(sport->port.membase + UCR2) & UCR2_SRST) && (--i > 0))
udelay(1); udelay(1);
/* Can we enable the DMA support? */
if (is_imx6q_uart(sport) && !uart_console(port) &&
!sport->dma_is_inited)
imx_uart_dma_init(sport);
spin_lock_irqsave(&sport->port.lock, flags);
/* /*
* Finally, clear and enable interrupts * Finally, clear and enable interrupts
*/ */
......
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