| .. | .. |
|---|
| 1998 | 1998 | imx_uart_writel(sport, ch, URTX0); |
|---|
| 1999 | 1999 | } |
|---|
| 2000 | 2000 | |
|---|
| 2001 | | -/* |
|---|
| 2002 | | - * Interrupts are disabled on entering |
|---|
| 2003 | | - */ |
|---|
| 2004 | 2001 | static void |
|---|
| 2005 | | -imx_uart_console_write(struct console *co, const char *s, unsigned int count) |
|---|
| 2002 | +__imx_uart_console_write(struct imx_port *sport, const char *s, unsigned int count) |
|---|
| 2006 | 2003 | { |
|---|
| 2007 | | - struct imx_port *sport = imx_uart_ports[co->index]; |
|---|
| 2008 | 2004 | struct imx_port_ucrs old_ucr; |
|---|
| 2009 | 2005 | unsigned int ucr1; |
|---|
| 2010 | | - unsigned long flags = 0; |
|---|
| 2011 | | - int locked = 1; |
|---|
| 2012 | | - |
|---|
| 2013 | | - if (sport->port.sysrq) |
|---|
| 2014 | | - locked = 0; |
|---|
| 2015 | | - else if (oops_in_progress) |
|---|
| 2016 | | - locked = spin_trylock_irqsave(&sport->port.lock, flags); |
|---|
| 2017 | | - else |
|---|
| 2018 | | - spin_lock_irqsave(&sport->port.lock, flags); |
|---|
| 2019 | 2006 | |
|---|
| 2020 | 2007 | /* |
|---|
| 2021 | 2008 | * First, save UCR1/2/3 and then disable interrupts |
|---|
| .. | .. |
|---|
| 2041 | 2028 | while (!(imx_uart_readl(sport, USR2) & USR2_TXDC)); |
|---|
| 2042 | 2029 | |
|---|
| 2043 | 2030 | imx_uart_ucrs_restore(sport, &old_ucr); |
|---|
| 2031 | +} |
|---|
| 2032 | + |
|---|
| 2033 | +/* |
|---|
| 2034 | + * Interrupts are disabled on entering |
|---|
| 2035 | + */ |
|---|
| 2036 | +static void |
|---|
| 2037 | +imx_uart_console_write(struct console *co, const char *s, unsigned int count) |
|---|
| 2038 | +{ |
|---|
| 2039 | + struct imx_port *sport = imx_uart_ports[co->index]; |
|---|
| 2040 | + unsigned long flags; |
|---|
| 2041 | + int locked = 1; |
|---|
| 2042 | + |
|---|
| 2043 | + if (sport->port.sysrq) |
|---|
| 2044 | + locked = 0; |
|---|
| 2045 | + else if (oops_in_progress) |
|---|
| 2046 | + locked = spin_trylock_irqsave(&sport->port.lock, flags); |
|---|
| 2047 | + else |
|---|
| 2048 | + spin_lock_irqsave(&sport->port.lock, flags); |
|---|
| 2049 | + |
|---|
| 2050 | + __imx_uart_console_write(sport, s, count); |
|---|
| 2044 | 2051 | |
|---|
| 2045 | 2052 | if (locked) |
|---|
| 2046 | 2053 | spin_unlock_irqrestore(&sport->port.lock, flags); |
|---|
| 2047 | 2054 | } |
|---|
| 2055 | + |
|---|
| 2056 | +#ifdef CONFIG_RAW_PRINTK |
|---|
| 2057 | +static void |
|---|
| 2058 | +imx_uart_console_write_raw(struct console *co, const char *s, unsigned int count) |
|---|
| 2059 | +{ |
|---|
| 2060 | + struct imx_port *sport = imx_uart_ports[co->index]; |
|---|
| 2061 | + |
|---|
| 2062 | + return __imx_uart_console_write(sport, s, count); |
|---|
| 2063 | +} |
|---|
| 2064 | +#endif |
|---|
| 2048 | 2065 | |
|---|
| 2049 | 2066 | /* |
|---|
| 2050 | 2067 | * If the port was already initialised (eg, by a boot loader), |
|---|
| .. | .. |
|---|
| 2161 | 2178 | static struct console imx_uart_console = { |
|---|
| 2162 | 2179 | .name = DEV_NAME, |
|---|
| 2163 | 2180 | .write = imx_uart_console_write, |
|---|
| 2181 | +#ifdef CONFIG_RAW_PRINTK |
|---|
| 2182 | + .write_raw = imx_uart_console_write_raw, |
|---|
| 2183 | +#endif |
|---|
| 2164 | 2184 | .device = uart_console_device, |
|---|
| 2165 | 2185 | .setup = imx_uart_console_setup, |
|---|
| 2166 | 2186 | .flags = CON_PRINTBUFFER, |
|---|