提交 fe59d297 编写于 作者: L Linus Torvalds

Merge tag 'tty-3.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull TTY fixes from Greg Kroah-Hartman:
 "Here are 2 tiny patches for a serial driver to resolve issues that
  people have reported with the 3.6-rc tree.

  Both of these have been in the linux-next tree for a while now.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'tty-3.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: serial: imx: don't reinit clock in imx_setup_ufcr()
  tty: serial: imx: console write routing is unsafe on SMP
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
#define UCR4_OREN (1<<1) /* Receiver overrun interrupt enable */ #define UCR4_OREN (1<<1) /* Receiver overrun interrupt enable */
#define UCR4_DREN (1<<0) /* Recv data ready interrupt enable */ #define UCR4_DREN (1<<0) /* Recv data ready interrupt enable */
#define UFCR_RXTL_SHF 0 /* Receiver trigger level shift */ #define UFCR_RXTL_SHF 0 /* Receiver trigger level shift */
#define UFCR_DCEDTE (1<<6) /* DCE/DTE mode select */
#define UFCR_RFDIV (7<<7) /* Reference freq divider mask */ #define UFCR_RFDIV (7<<7) /* Reference freq divider mask */
#define UFCR_RFDIV_REG(x) (((x) < 7 ? 6 - (x) : 6) << 7) #define UFCR_RFDIV_REG(x) (((x) < 7 ? 6 - (x) : 6) << 7)
#define UFCR_TXTL_SHF 10 /* Transmitter trigger level shift */ #define UFCR_TXTL_SHF 10 /* Transmitter trigger level shift */
...@@ -667,22 +668,11 @@ static void imx_break_ctl(struct uart_port *port, int break_state) ...@@ -667,22 +668,11 @@ static void imx_break_ctl(struct uart_port *port, int break_state)
static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode) static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
{ {
unsigned int val; unsigned int val;
unsigned int ufcr_rfdiv;
/* set receiver / transmitter trigger level.
* RFDIV is set such way to satisfy requested uartclk value
*/
val = TXTL << 10 | RXTL;
ufcr_rfdiv = (clk_get_rate(sport->clk_per) + sport->port.uartclk / 2)
/ sport->port.uartclk;
if(!ufcr_rfdiv)
ufcr_rfdiv = 1;
val |= UFCR_RFDIV_REG(ufcr_rfdiv);
/* set receiver / transmitter trigger level */
val = readl(sport->port.membase + UFCR) & (UFCR_RFDIV | UFCR_DCEDTE);
val |= TXTL << UFCR_TXTL_SHF | RXTL;
writel(val, sport->port.membase + UFCR); writel(val, sport->port.membase + UFCR);
return 0; return 0;
} }
...@@ -754,6 +744,7 @@ static int imx_startup(struct uart_port *port) ...@@ -754,6 +744,7 @@ static int imx_startup(struct uart_port *port)
} }
} }
spin_lock_irqsave(&sport->port.lock, flags);
/* /*
* Finally, clear and enable interrupts * Finally, clear and enable interrupts
*/ */
...@@ -807,7 +798,6 @@ static int imx_startup(struct uart_port *port) ...@@ -807,7 +798,6 @@ static int imx_startup(struct uart_port *port)
/* /*
* Enable modem status interrupts * Enable modem status interrupts
*/ */
spin_lock_irqsave(&sport->port.lock,flags);
imx_enable_ms(&sport->port); imx_enable_ms(&sport->port);
spin_unlock_irqrestore(&sport->port.lock,flags); spin_unlock_irqrestore(&sport->port.lock,flags);
...@@ -837,10 +827,13 @@ static void imx_shutdown(struct uart_port *port) ...@@ -837,10 +827,13 @@ static void imx_shutdown(struct uart_port *port)
{ {
struct imx_port *sport = (struct imx_port *)port; struct imx_port *sport = (struct imx_port *)port;
unsigned long temp; unsigned long temp;
unsigned long flags;
spin_lock_irqsave(&sport->port.lock, flags);
temp = readl(sport->port.membase + UCR2); temp = readl(sport->port.membase + UCR2);
temp &= ~(UCR2_TXEN); temp &= ~(UCR2_TXEN);
writel(temp, sport->port.membase + UCR2); writel(temp, sport->port.membase + UCR2);
spin_unlock_irqrestore(&sport->port.lock, flags);
if (USE_IRDA(sport)) { if (USE_IRDA(sport)) {
struct imxuart_platform_data *pdata; struct imxuart_platform_data *pdata;
...@@ -869,12 +862,14 @@ static void imx_shutdown(struct uart_port *port) ...@@ -869,12 +862,14 @@ static void imx_shutdown(struct uart_port *port)
* Disable all interrupts, port and break condition. * Disable all interrupts, port and break condition.
*/ */
spin_lock_irqsave(&sport->port.lock, flags);
temp = readl(sport->port.membase + UCR1); temp = readl(sport->port.membase + UCR1);
temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN);
if (USE_IRDA(sport)) if (USE_IRDA(sport))
temp &= ~(UCR1_IREN); temp &= ~(UCR1_IREN);
writel(temp, sport->port.membase + UCR1); writel(temp, sport->port.membase + UCR1);
spin_unlock_irqrestore(&sport->port.lock, flags);
} }
static void static void
...@@ -1217,6 +1212,9 @@ imx_console_write(struct console *co, const char *s, unsigned int count) ...@@ -1217,6 +1212,9 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
struct imx_port *sport = imx_ports[co->index]; struct imx_port *sport = imx_ports[co->index];
struct imx_port_ucrs old_ucr; struct imx_port_ucrs old_ucr;
unsigned int ucr1; unsigned int ucr1;
unsigned long flags;
spin_lock_irqsave(&sport->port.lock, flags);
/* /*
* First, save UCR1/2/3 and then disable interrupts * First, save UCR1/2/3 and then disable interrupts
...@@ -1242,6 +1240,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count) ...@@ -1242,6 +1240,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
while (!(readl(sport->port.membase + USR2) & USR2_TXDC)); while (!(readl(sport->port.membase + USR2) & USR2_TXDC));
imx_port_ucrs_restore(&sport->port, &old_ucr); imx_port_ucrs_restore(&sport->port, &old_ucr);
spin_unlock_irqrestore(&sport->port.lock, flags);
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册