mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-02-09 21:06:51 +00:00
msm_serial: Send more than 1 character on the console w/ UARTDM
We recently added support to send more than one character at a time for UARTDM hardware but we didn't add the same support in the console code path. Add support here to speed up console messages on UARTDM hardware. Cc: David Brown <davidb@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c3b5d3be7e
commit
a3957e80eb
@ -769,32 +769,63 @@ static inline struct uart_port *get_port_from_line(unsigned int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SERIAL_MSM_CONSOLE
|
#ifdef CONFIG_SERIAL_MSM_CONSOLE
|
||||||
|
|
||||||
static void msm_console_putchar(struct uart_port *port, int c)
|
|
||||||
{
|
|
||||||
struct msm_port *msm_port = UART_TO_MSM(port);
|
|
||||||
|
|
||||||
if (msm_port->is_uartdm)
|
|
||||||
reset_dm_count(port, 1);
|
|
||||||
|
|
||||||
while (!(msm_read(port, UART_SR) & UART_SR_TX_READY))
|
|
||||||
;
|
|
||||||
msm_write(port, c, msm_port->is_uartdm ? UARTDM_TF : UART_TF);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void msm_console_write(struct console *co, const char *s,
|
static void msm_console_write(struct console *co, const char *s,
|
||||||
unsigned int count)
|
unsigned int count)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
struct uart_port *port;
|
struct uart_port *port;
|
||||||
struct msm_port *msm_port;
|
struct msm_port *msm_port;
|
||||||
|
int num_newlines = 0;
|
||||||
|
bool replaced = false;
|
||||||
|
|
||||||
BUG_ON(co->index < 0 || co->index >= UART_NR);
|
BUG_ON(co->index < 0 || co->index >= UART_NR);
|
||||||
|
|
||||||
port = get_port_from_line(co->index);
|
port = get_port_from_line(co->index);
|
||||||
msm_port = UART_TO_MSM(port);
|
msm_port = UART_TO_MSM(port);
|
||||||
|
|
||||||
|
/* Account for newlines that will get a carriage return added */
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (s[i] == '\n')
|
||||||
|
num_newlines++;
|
||||||
|
count += num_newlines;
|
||||||
|
|
||||||
spin_lock(&port->lock);
|
spin_lock(&port->lock);
|
||||||
uart_console_write(port, s, count, msm_console_putchar);
|
if (msm_port->is_uartdm)
|
||||||
|
reset_dm_count(port, count);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < count) {
|
||||||
|
int j;
|
||||||
|
unsigned int num_chars;
|
||||||
|
char buf[4] = { 0 };
|
||||||
|
unsigned int *bf = (unsigned int *)&buf;
|
||||||
|
|
||||||
|
if (msm_port->is_uartdm)
|
||||||
|
num_chars = min(count - i, (unsigned int)sizeof(buf));
|
||||||
|
else
|
||||||
|
num_chars = 1;
|
||||||
|
|
||||||
|
for (j = 0; j < num_chars; j++) {
|
||||||
|
char c = *s;
|
||||||
|
|
||||||
|
if (c == '\n' && !replaced) {
|
||||||
|
buf[j] = '\r';
|
||||||
|
j++;
|
||||||
|
replaced = true;
|
||||||
|
}
|
||||||
|
if (j < num_chars) {
|
||||||
|
buf[j] = c;
|
||||||
|
s++;
|
||||||
|
replaced = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!(msm_read(port, UART_SR) & UART_SR_TX_READY))
|
||||||
|
cpu_relax();
|
||||||
|
|
||||||
|
msm_write(port, *bf, msm_port->is_uartdm ? UARTDM_TF : UART_TF);
|
||||||
|
i += num_chars;
|
||||||
|
}
|
||||||
spin_unlock(&port->lock);
|
spin_unlock(&port->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user