aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2013-08-21 02:48:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-27 19:22:59 -0400
commita3957e80eb56059698676694ee500cfbe5b8972b (patch)
tree08d91e5159e700fd5b5a77f0ba20a1bc71866fac /drivers/tty/serial
parentc3b5d3be7e354d4e05ae433b9c733330c65b8b34 (diff)
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>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/msm_serial.c59
1 files changed, 45 insertions, 14 deletions
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 5a7503986d7d..b5d779cd3c2b 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -769,32 +769,63 @@ static inline struct uart_port *get_port_from_line(unsigned int line)
769} 769}
770 770
771#ifdef CONFIG_SERIAL_MSM_CONSOLE 771#ifdef CONFIG_SERIAL_MSM_CONSOLE
772
773static void msm_console_putchar(struct uart_port *port, int c)
774{
775 struct msm_port *msm_port = UART_TO_MSM(port);
776
777 if (msm_port->is_uartdm)
778 reset_dm_count(port, 1);
779
780 while (!(msm_read(port, UART_SR) & UART_SR_TX_READY))
781 ;
782 msm_write(port, c, msm_port->is_uartdm ? UARTDM_TF : UART_TF);
783}
784
785static void msm_console_write(struct console *co, const char *s, 772static void msm_console_write(struct console *co, const char *s,
786 unsigned int count) 773 unsigned int count)
787{ 774{
775 int i;
788 struct uart_port *port; 776 struct uart_port *port;
789 struct msm_port *msm_port; 777 struct msm_port *msm_port;
778 int num_newlines = 0;
779 bool replaced = false;
790 780
791 BUG_ON(co->index < 0 || co->index >= UART_NR); 781 BUG_ON(co->index < 0 || co->index >= UART_NR);
792 782
793 port = get_port_from_line(co->index); 783 port = get_port_from_line(co->index);
794 msm_port = UART_TO_MSM(port); 784 msm_port = UART_TO_MSM(port);
795 785
786 /* Account for newlines that will get a carriage return added */
787 for (i = 0; i < count; i++)
788 if (s[i] == '\n')
789 num_newlines++;
790 count += num_newlines;
791
796 spin_lock(&port->lock); 792 spin_lock(&port->lock);
797 uart_console_write(port, s, count, msm_console_putchar); 793 if (msm_port->is_uartdm)
794 reset_dm_count(port, count);
795
796 i = 0;
797 while (i < count) {
798 int j;
799 unsigned int num_chars;
800 char buf[4] = { 0 };
801 unsigned int *bf = (unsigned int *)&buf;
802
803 if (msm_port->is_uartdm)
804 num_chars = min(count - i, (unsigned int)sizeof(buf));
805 else
806 num_chars = 1;
807
808 for (j = 0; j < num_chars; j++) {
809 char c = *s;
810
811 if (c == '\n' && !replaced) {
812 buf[j] = '\r';
813 j++;
814 replaced = true;
815 }
816 if (j < num_chars) {
817 buf[j] = c;
818 s++;
819 replaced = false;
820 }
821 }
822
823 while (!(msm_read(port, UART_SR) & UART_SR_TX_READY))
824 cpu_relax();
825
826 msm_write(port, *bf, msm_port->is_uartdm ? UARTDM_TF : UART_TF);
827 i += num_chars;
828 }
798 spin_unlock(&port->lock); 829 spin_unlock(&port->lock);
799} 830}
800 831