|
@@ -1705,6 +1705,13 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count)
|
|
|
{
|
|
{
|
|
|
struct lpuart_port *sport = lpuart_ports[co->index];
|
|
struct lpuart_port *sport = lpuart_ports[co->index];
|
|
|
unsigned char old_cr2, cr2;
|
|
unsigned char old_cr2, cr2;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+ int locked = 1;
|
|
|
|
|
+
|
|
|
|
|
+ if (sport->port.sysrq || oops_in_progress)
|
|
|
|
|
+ locked = spin_trylock_irqsave(&sport->port.lock, flags);
|
|
|
|
|
+ else
|
|
|
|
|
+ spin_lock_irqsave(&sport->port.lock, flags);
|
|
|
|
|
|
|
|
/* first save CR2 and then disable interrupts */
|
|
/* first save CR2 and then disable interrupts */
|
|
|
cr2 = old_cr2 = readb(sport->port.membase + UARTCR2);
|
|
cr2 = old_cr2 = readb(sport->port.membase + UARTCR2);
|
|
@@ -1719,6 +1726,9 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count)
|
|
|
barrier();
|
|
barrier();
|
|
|
|
|
|
|
|
writeb(old_cr2, sport->port.membase + UARTCR2);
|
|
writeb(old_cr2, sport->port.membase + UARTCR2);
|
|
|
|
|
+
|
|
|
|
|
+ if (locked)
|
|
|
|
|
+ spin_unlock_irqrestore(&sport->port.lock, flags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -1726,6 +1736,13 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count)
|
|
|
{
|
|
{
|
|
|
struct lpuart_port *sport = lpuart_ports[co->index];
|
|
struct lpuart_port *sport = lpuart_ports[co->index];
|
|
|
unsigned long old_cr, cr;
|
|
unsigned long old_cr, cr;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+ int locked = 1;
|
|
|
|
|
+
|
|
|
|
|
+ if (sport->port.sysrq || oops_in_progress)
|
|
|
|
|
+ locked = spin_trylock_irqsave(&sport->port.lock, flags);
|
|
|
|
|
+ else
|
|
|
|
|
+ spin_lock_irqsave(&sport->port.lock, flags);
|
|
|
|
|
|
|
|
/* first save CR2 and then disable interrupts */
|
|
/* first save CR2 and then disable interrupts */
|
|
|
cr = old_cr = lpuart32_read(sport->port.membase + UARTCTRL);
|
|
cr = old_cr = lpuart32_read(sport->port.membase + UARTCTRL);
|
|
@@ -1740,6 +1757,9 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count)
|
|
|
barrier();
|
|
barrier();
|
|
|
|
|
|
|
|
lpuart32_write(old_cr, sport->port.membase + UARTCTRL);
|
|
lpuart32_write(old_cr, sport->port.membase + UARTCTRL);
|
|
|
|
|
+
|
|
|
|
|
+ if (locked)
|
|
|
|
|
+ spin_unlock_irqrestore(&sport->port.lock, flags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|