diff options
| -rw-r--r-- | drivers/parport/parport_serial.c | 75 | ||||
| -rw-r--r-- | drivers/serial/21285.c | 19 | ||||
| -rw-r--r-- | drivers/serial/8250.c | 26 | ||||
| -rw-r--r-- | drivers/serial/8250_early.c | 9 | ||||
| -rw-r--r-- | drivers/serial/amba-pl010.c | 24 | ||||
| -rw-r--r-- | drivers/serial/amba-pl011.c | 20 | ||||
| -rw-r--r-- | drivers/serial/at91_serial.c | 24 | ||||
| -rw-r--r-- | drivers/serial/au1x00_uart.c | 26 | ||||
| -rw-r--r-- | drivers/serial/clps711x.c | 24 | ||||
| -rw-r--r-- | drivers/serial/dz.c | 12 | ||||
| -rw-r--r-- | drivers/serial/imx.c | 26 | ||||
| -rw-r--r-- | drivers/serial/ip22zilog.c | 11 | ||||
| -rw-r--r-- | drivers/serial/m32r_sio.c | 26 | ||||
| -rw-r--r-- | drivers/serial/mpc52xx_uart.c | 11 | ||||
| -rw-r--r-- | drivers/serial/pmac_zilog.c | 23 | ||||
| -rw-r--r-- | drivers/serial/pxa.c | 26 | ||||
| -rw-r--r-- | drivers/serial/s3c2410.c | 26 | ||||
| -rw-r--r-- | drivers/serial/sa1100.c | 26 | ||||
| -rw-r--r-- | drivers/serial/serial_core.c | 21 | ||||
| -rw-r--r-- | drivers/serial/serial_lh7a40x.c | 17 | ||||
| -rw-r--r-- | drivers/serial/serial_txx9.c | 26 | ||||
| -rw-r--r-- | drivers/serial/sunsab.c | 10 | ||||
| -rw-r--r-- | drivers/serial/sunsu.c | 26 | ||||
| -rw-r--r-- | drivers/serial/sunzilog.c | 13 | ||||
| -rw-r--r-- | drivers/serial/vr41xx_siu.c | 16 | ||||
| -rw-r--r-- | include/linux/serial_core.h | 3 |
26 files changed, 208 insertions, 358 deletions
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c index 10845253c9e0..d121644646b9 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c | |||
| @@ -31,14 +31,8 @@ enum parport_pc_pci_cards { | |||
| 31 | netmos_9xx5_combo, | 31 | netmos_9xx5_combo, |
| 32 | netmos_9855, | 32 | netmos_9855, |
| 33 | avlab_1s1p, | 33 | avlab_1s1p, |
| 34 | avlab_1s1p_650, | ||
| 35 | avlab_1s1p_850, | ||
| 36 | avlab_1s2p, | 34 | avlab_1s2p, |
| 37 | avlab_1s2p_650, | ||
| 38 | avlab_1s2p_850, | ||
| 39 | avlab_2s1p, | 35 | avlab_2s1p, |
| 40 | avlab_2s1p_650, | ||
| 41 | avlab_2s1p_850, | ||
| 42 | siig_1s1p_10x, | 36 | siig_1s1p_10x, |
| 43 | siig_2s1p_10x, | 37 | siig_2s1p_10x, |
| 44 | siig_2p1s_20x, | 38 | siig_2p1s_20x, |
| @@ -85,14 +79,8 @@ static struct parport_pc_pci cards[] __devinitdata = { | |||
| 85 | /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init }, | 79 | /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init }, |
| 86 | /* netmos_9855 */ { 1, { { 0, -1 }, }, netmos_parallel_init }, | 80 | /* netmos_9855 */ { 1, { { 0, -1 }, }, netmos_parallel_init }, |
| 87 | /* avlab_1s1p */ { 1, { { 1, 2}, } }, | 81 | /* avlab_1s1p */ { 1, { { 1, 2}, } }, |
| 88 | /* avlab_1s1p_650 */ { 1, { { 1, 2}, } }, | ||
| 89 | /* avlab_1s1p_850 */ { 1, { { 1, 2}, } }, | ||
| 90 | /* avlab_1s2p */ { 2, { { 1, 2}, { 3, 4 },} }, | 82 | /* avlab_1s2p */ { 2, { { 1, 2}, { 3, 4 },} }, |
| 91 | /* avlab_1s2p_650 */ { 2, { { 1, 2}, { 3, 4 },} }, | ||
| 92 | /* avlab_1s2p_850 */ { 2, { { 1, 2}, { 3, 4 },} }, | ||
| 93 | /* avlab_2s1p */ { 1, { { 2, 3}, } }, | 83 | /* avlab_2s1p */ { 1, { { 2, 3}, } }, |
| 94 | /* avlab_2s1p_650 */ { 1, { { 2, 3}, } }, | ||
| 95 | /* avlab_2s1p_850 */ { 1, { { 2, 3}, } }, | ||
| 96 | /* siig_1s1p_10x */ { 1, { { 3, 4 }, } }, | 84 | /* siig_1s1p_10x */ { 1, { { 3, 4 }, } }, |
| 97 | /* siig_2s1p_10x */ { 1, { { 4, 5 }, } }, | 85 | /* siig_2s1p_10x */ { 1, { { 4, 5 }, } }, |
| 98 | /* siig_2p1s_20x */ { 2, { { 1, 2 }, { 3, 4 }, } }, | 86 | /* siig_2p1s_20x */ { 2, { { 1, 2 }, { 3, 4 }, } }, |
| @@ -119,15 +107,24 @@ static struct pci_device_id parport_serial_pci_tbl[] = { | |||
| 119 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855, | 107 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855, |
| 120 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9855 }, | 108 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9855 }, |
| 121 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ | 109 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ |
| 122 | { 0x14db, 0x2110, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p}, | 110 | { PCI_VENDOR_ID_AFAVLAB, 0x2110, |
| 123 | { 0x14db, 0x2111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p_650}, | 111 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p }, |
| 124 | { 0x14db, 0x2112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p_850}, | 112 | { PCI_VENDOR_ID_AFAVLAB, 0x2111, |
| 125 | { 0x14db, 0x2140, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p}, | 113 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p }, |
| 126 | { 0x14db, 0x2141, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p_650}, | 114 | { PCI_VENDOR_ID_AFAVLAB, 0x2112, |
| 127 | { 0x14db, 0x2142, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p_850}, | 115 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p }, |
| 128 | { 0x14db, 0x2160, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p}, | 116 | { PCI_VENDOR_ID_AFAVLAB, 0x2140, |
| 129 | { 0x14db, 0x2161, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p_650}, | 117 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p }, |
| 130 | { 0x14db, 0x2162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p_850}, | 118 | { PCI_VENDOR_ID_AFAVLAB, 0x2141, |
| 119 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p }, | ||
| 120 | { PCI_VENDOR_ID_AFAVLAB, 0x2142, | ||
| 121 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p }, | ||
| 122 | { PCI_VENDOR_ID_AFAVLAB, 0x2160, | ||
| 123 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p }, | ||
| 124 | { PCI_VENDOR_ID_AFAVLAB, 0x2161, | ||
| 125 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p }, | ||
| 126 | { PCI_VENDOR_ID_AFAVLAB, 0x2162, | ||
| 127 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p }, | ||
| 131 | { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_550, | 128 | { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_550, |
| 132 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x }, | 129 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x }, |
| 133 | { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_650, | 130 | { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_650, |
| @@ -201,54 +198,18 @@ static struct pciserial_board pci_parport_serial_boards[] __devinitdata = { | |||
| 201 | .base_baud = 115200, | 198 | .base_baud = 115200, |
| 202 | .uart_offset = 8, | 199 | .uart_offset = 8, |
| 203 | }, | 200 | }, |
| 204 | [avlab_1s1p_650] = { /* nt */ | ||
| 205 | .flags = FL_BASE0 | FL_BASE_BARS, | ||
| 206 | .num_ports = 1, | ||
| 207 | .base_baud = 115200, | ||
| 208 | .uart_offset = 8, | ||
| 209 | }, | ||
| 210 | [avlab_1s1p_850] = { /* nt */ | ||
| 211 | .flags = FL_BASE0 | FL_BASE_BARS, | ||
| 212 | .num_ports = 1, | ||
| 213 | .base_baud = 115200, | ||
| 214 | .uart_offset = 8, | ||
| 215 | }, | ||
| 216 | [avlab_1s2p] = { /* n/t */ | 201 | [avlab_1s2p] = { /* n/t */ |
| 217 | .flags = FL_BASE0 | FL_BASE_BARS, | 202 | .flags = FL_BASE0 | FL_BASE_BARS, |
| 218 | .num_ports = 1, | 203 | .num_ports = 1, |
| 219 | .base_baud = 115200, | 204 | .base_baud = 115200, |
| 220 | .uart_offset = 8, | 205 | .uart_offset = 8, |
| 221 | }, | 206 | }, |
| 222 | [avlab_1s2p_650] = { /* nt */ | ||
| 223 | .flags = FL_BASE0 | FL_BASE_BARS, | ||
| 224 | .num_ports = 1, | ||
| 225 | .base_baud = 115200, | ||
| 226 | .uart_offset = 8, | ||
| 227 | }, | ||
| 228 | [avlab_1s2p_850] = { /* nt */ | ||
| 229 | .flags = FL_BASE0 | FL_BASE_BARS, | ||
| 230 | .num_ports = 1, | ||
| 231 | .base_baud = 115200, | ||
| 232 | .uart_offset = 8, | ||
| 233 | }, | ||
| 234 | [avlab_2s1p] = { /* n/t */ | 207 | [avlab_2s1p] = { /* n/t */ |
| 235 | .flags = FL_BASE0 | FL_BASE_BARS, | 208 | .flags = FL_BASE0 | FL_BASE_BARS, |
| 236 | .num_ports = 2, | 209 | .num_ports = 2, |
| 237 | .base_baud = 115200, | 210 | .base_baud = 115200, |
| 238 | .uart_offset = 8, | 211 | .uart_offset = 8, |
| 239 | }, | 212 | }, |
| 240 | [avlab_2s1p_650] = { /* nt */ | ||
| 241 | .flags = FL_BASE0 | FL_BASE_BARS, | ||
| 242 | .num_ports = 2, | ||
| 243 | .base_baud = 115200, | ||
| 244 | .uart_offset = 8, | ||
| 245 | }, | ||
| 246 | [avlab_2s1p_850] = { /* nt */ | ||
| 247 | .flags = FL_BASE0 | FL_BASE_BARS, | ||
| 248 | .num_ports = 2, | ||
| 249 | .base_baud = 115200, | ||
| 250 | .uart_offset = 8, | ||
| 251 | }, | ||
| 252 | [siig_1s1p_10x] = { | 213 | [siig_1s1p_10x] = { |
| 253 | .flags = FL_BASE2, | 214 | .flags = FL_BASE2, |
| 254 | .num_ports = 1, | 215 | .num_ports = 1, |
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index 8c5c276c5577..7572665a8855 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c | |||
| @@ -375,23 +375,18 @@ static void serial21285_setup_ports(void) | |||
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | #ifdef CONFIG_SERIAL_21285_CONSOLE | 377 | #ifdef CONFIG_SERIAL_21285_CONSOLE |
| 378 | static void serial21285_console_putchar(struct uart_port *port, int ch) | ||
| 379 | { | ||
| 380 | while (*CSR_UARTFLG & 0x20) | ||
| 381 | barrier(); | ||
| 382 | *CSR_UARTDR = ch; | ||
| 383 | } | ||
| 378 | 384 | ||
| 379 | static void | 385 | static void |
| 380 | serial21285_console_write(struct console *co, const char *s, | 386 | serial21285_console_write(struct console *co, const char *s, |
| 381 | unsigned int count) | 387 | unsigned int count) |
| 382 | { | 388 | { |
| 383 | int i; | 389 | uart_console_write(&serial21285_port, s, count, serial21285_console_putchar); |
| 384 | |||
| 385 | for (i = 0; i < count; i++) { | ||
| 386 | while (*CSR_UARTFLG & 0x20) | ||
| 387 | barrier(); | ||
| 388 | *CSR_UARTDR = s[i]; | ||
| 389 | if (s[i] == '\n') { | ||
| 390 | while (*CSR_UARTFLG & 0x20) | ||
| 391 | barrier(); | ||
| 392 | *CSR_UARTDR = '\r'; | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } | 390 | } |
| 396 | 391 | ||
| 397 | static void __init | 392 | static void __init |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 7aca22c9976d..5996d3cd0ed8 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
| @@ -2182,6 +2182,14 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) | |||
| 2182 | } | 2182 | } |
| 2183 | } | 2183 | } |
| 2184 | 2184 | ||
| 2185 | static void serial8250_console_putchar(struct uart_port *port, int ch) | ||
| 2186 | { | ||
| 2187 | struct uart_8250_port *up = (struct uart_8250_port *)port; | ||
| 2188 | |||
| 2189 | wait_for_xmitr(up, UART_LSR_THRE); | ||
| 2190 | serial_out(up, UART_TX, ch); | ||
| 2191 | } | ||
| 2192 | |||
| 2185 | /* | 2193 | /* |
| 2186 | * Print a string to the serial port trying not to disturb | 2194 | * Print a string to the serial port trying not to disturb |
| 2187 | * any possible real use of the port... | 2195 | * any possible real use of the port... |
| @@ -2193,7 +2201,6 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
| 2193 | { | 2201 | { |
| 2194 | struct uart_8250_port *up = &serial8250_ports[co->index]; | 2202 | struct uart_8250_port *up = &serial8250_ports[co->index]; |
| 2195 | unsigned int ier; | 2203 | unsigned int ier; |
| 2196 | int i; | ||
| 2197 | 2204 | ||
| 2198 | touch_nmi_watchdog(); | 2205 | touch_nmi_watchdog(); |
| 2199 | 2206 | ||
| @@ -2207,22 +2214,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
| 2207 | else | 2214 | else |
| 2208 | serial_out(up, UART_IER, 0); | 2215 | serial_out(up, UART_IER, 0); |
| 2209 | 2216 | ||
| 2210 | /* | 2217 | uart_console_write(&up->port, s, count, serial8250_console_putchar); |
| 2211 | * Now, do each character | ||
| 2212 | */ | ||
| 2213 | for (i = 0; i < count; i++, s++) { | ||
| 2214 | wait_for_xmitr(up, UART_LSR_THRE); | ||
| 2215 | |||
| 2216 | /* | ||
| 2217 | * Send the character out. | ||
| 2218 | * If a LF, also do CR... | ||
| 2219 | */ | ||
| 2220 | serial_out(up, UART_TX, *s); | ||
| 2221 | if (*s == 10) { | ||
| 2222 | wait_for_xmitr(up, UART_LSR_THRE); | ||
| 2223 | serial_out(up, UART_TX, 13); | ||
| 2224 | } | ||
| 2225 | } | ||
| 2226 | 2218 | ||
| 2227 | /* | 2219 | /* |
| 2228 | * Finally, wait for transmitter to become empty | 2220 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c index 59ba5d993b4b..7e511199b4c5 100644 --- a/drivers/serial/8250_early.c +++ b/drivers/serial/8250_early.c | |||
| @@ -74,7 +74,7 @@ static void __init wait_for_xmitr(struct uart_port *port) | |||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static void __init putc(struct uart_port *port, unsigned char c) | 77 | static void __init putc(struct uart_port *port, int c) |
| 78 | { | 78 | { |
| 79 | wait_for_xmitr(port); | 79 | wait_for_xmitr(port); |
| 80 | serial_out(port, UART_TX, c); | 80 | serial_out(port, UART_TX, c); |
| @@ -89,12 +89,7 @@ static void __init early_uart_write(struct console *console, const char *s, unsi | |||
| 89 | ier = serial_in(port, UART_IER); | 89 | ier = serial_in(port, UART_IER); |
| 90 | serial_out(port, UART_IER, 0); | 90 | serial_out(port, UART_IER, 0); |
| 91 | 91 | ||
| 92 | while (*s && count-- > 0) { | 92 | uart_console_write(port, s, count, putc); |
| 93 | putc(port, *s); | ||
| 94 | if (*s == '\n') | ||
| 95 | putc(port, '\r'); | ||
| 96 | s++; | ||
| 97 | } | ||
| 98 | 93 | ||
| 99 | /* Wait for transmitter to become empty and restore the IER */ | 94 | /* Wait for transmitter to become empty and restore the IER */ |
| 100 | wait_for_xmitr(port); | 95 | wait_for_xmitr(port); |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 321a3b3a5728..e04d5e82d9ae 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
| @@ -591,12 +591,18 @@ static struct uart_amba_port amba_ports[UART_NR] = { | |||
| 591 | 591 | ||
| 592 | #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE | 592 | #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE |
| 593 | 593 | ||
| 594 | static void pl010_console_putchar(struct uart_port *port, int ch) | ||
| 595 | { | ||
| 596 | while (!UART_TX_READY(UART_GET_FR(port))) | ||
| 597 | barrier(); | ||
| 598 | UART_PUT_CHAR(port, ch); | ||
| 599 | } | ||
| 600 | |||
| 594 | static void | 601 | static void |
| 595 | pl010_console_write(struct console *co, const char *s, unsigned int count) | 602 | pl010_console_write(struct console *co, const char *s, unsigned int count) |
| 596 | { | 603 | { |
| 597 | struct uart_port *port = &amba_ports[co->index].port; | 604 | struct uart_port *port = &amba_ports[co->index].port; |
| 598 | unsigned int status, old_cr; | 605 | unsigned int status, old_cr; |
| 599 | int i; | ||
| 600 | 606 | ||
| 601 | /* | 607 | /* |
| 602 | * First save the CR then disable the interrupts | 608 | * First save the CR then disable the interrupts |
| @@ -604,21 +610,7 @@ pl010_console_write(struct console *co, const char *s, unsigned int count) | |||
| 604 | old_cr = UART_GET_CR(port); | 610 | old_cr = UART_GET_CR(port); |
| 605 | UART_PUT_CR(port, UART01x_CR_UARTEN); | 611 | UART_PUT_CR(port, UART01x_CR_UARTEN); |
| 606 | 612 | ||
| 607 | /* | 613 | uart_console_write(port, s, count, pl010_console_putchar); |
| 608 | * Now, do each character | ||
| 609 | */ | ||
| 610 | for (i = 0; i < count; i++) { | ||
| 611 | do { | ||
| 612 | status = UART_GET_FR(port); | ||
| 613 | } while (!UART_TX_READY(status)); | ||
| 614 | UART_PUT_CHAR(port, s[i]); | ||
| 615 | if (s[i] == '\n') { | ||
| 616 | do { | ||
| 617 | status = UART_GET_FR(port); | ||
| 618 | } while (!UART_TX_READY(status)); | ||
| 619 | UART_PUT_CHAR(port, '\r'); | ||
| 620 | } | ||
| 621 | } | ||
| 622 | 614 | ||
| 623 | /* | 615 | /* |
| 624 | * Finally, wait for transmitter to become empty | 616 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 034a029e356e..3d966cfc9a38 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
| @@ -587,14 +587,12 @@ static struct uart_amba_port *amba_ports[UART_NR]; | |||
| 587 | 587 | ||
| 588 | #ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE | 588 | #ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE |
| 589 | 589 | ||
| 590 | static inline void | 590 | static void pl011_console_putchar(struct uart_port *port, int ch) |
| 591 | pl011_console_write_char(struct uart_amba_port *uap, char ch) | ||
| 592 | { | 591 | { |
| 593 | unsigned int status; | 592 | struct uart_amba_port *uap = (struct uart_amba_port *)port; |
| 594 | 593 | ||
| 595 | do { | 594 | while (readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF) |
| 596 | status = readw(uap->port.membase + UART01x_FR); | 595 | barrier(); |
| 597 | } while (status & UART01x_FR_TXFF); | ||
| 598 | writew(ch, uap->port.membase + UART01x_DR); | 596 | writew(ch, uap->port.membase + UART01x_DR); |
| 599 | } | 597 | } |
| 600 | 598 | ||
| @@ -603,7 +601,6 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) | |||
| 603 | { | 601 | { |
| 604 | struct uart_amba_port *uap = amba_ports[co->index]; | 602 | struct uart_amba_port *uap = amba_ports[co->index]; |
| 605 | unsigned int status, old_cr, new_cr; | 603 | unsigned int status, old_cr, new_cr; |
| 606 | int i; | ||
| 607 | 604 | ||
| 608 | clk_enable(uap->clk); | 605 | clk_enable(uap->clk); |
| 609 | 606 | ||
| @@ -615,14 +612,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) | |||
| 615 | new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE; | 612 | new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE; |
| 616 | writew(new_cr, uap->port.membase + UART011_CR); | 613 | writew(new_cr, uap->port.membase + UART011_CR); |
| 617 | 614 | ||
| 618 | /* | 615 | uart_console_write(&uap->port, s, count, pl011_console_putchar); |
| 619 | * Now, do each character | ||
| 620 | */ | ||
| 621 | for (i = 0; i < count; i++) { | ||
| 622 | pl011_console_write_char(uap, s[i]); | ||
| 623 | if (s[i] == '\n') | ||
| 624 | pl011_console_write_char(uap, '\r'); | ||
| 625 | } | ||
| 626 | 616 | ||
| 627 | /* | 617 | /* |
| 628 | * Finally, wait for transmitter to become empty | 618 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c index 2113feb75c39..6547fe0cef96 100644 --- a/drivers/serial/at91_serial.c +++ b/drivers/serial/at91_serial.c | |||
| @@ -711,6 +711,12 @@ void __init at91_register_uart(int idx, int port) | |||
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | #ifdef CONFIG_SERIAL_AT91_CONSOLE | 713 | #ifdef CONFIG_SERIAL_AT91_CONSOLE |
| 714 | static void at91_console_putchar(struct uart_port *port, int ch) | ||
| 715 | { | ||
| 716 | while (!(UART_GET_CSR(port) & AT91_US_TXRDY)) | ||
| 717 | barrier(); | ||
| 718 | UART_PUT_CHAR(port, ch); | ||
| 719 | } | ||
| 714 | 720 | ||
| 715 | /* | 721 | /* |
| 716 | * Interrupts are disabled on entering | 722 | * Interrupts are disabled on entering |
| @@ -718,7 +724,7 @@ void __init at91_register_uart(int idx, int port) | |||
| 718 | static void at91_console_write(struct console *co, const char *s, u_int count) | 724 | static void at91_console_write(struct console *co, const char *s, u_int count) |
| 719 | { | 725 | { |
| 720 | struct uart_port *port = at91_ports + co->index; | 726 | struct uart_port *port = at91_ports + co->index; |
| 721 | unsigned int status, i, imr; | 727 | unsigned int status, imr; |
| 722 | 728 | ||
| 723 | /* | 729 | /* |
| 724 | * First, save IMR and then disable interrupts | 730 | * First, save IMR and then disable interrupts |
| @@ -726,21 +732,7 @@ static void at91_console_write(struct console *co, const char *s, u_int count) | |||
| 726 | imr = UART_GET_IMR(port); /* get interrupt mask */ | 732 | imr = UART_GET_IMR(port); /* get interrupt mask */ |
| 727 | UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY); | 733 | UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY); |
| 728 | 734 | ||
| 729 | /* | 735 | uart_console_write(port, s, count, at91_console_putchar); |
| 730 | * Now, do each character | ||
| 731 | */ | ||
| 732 | for (i = 0; i < count; i++) { | ||
| 733 | do { | ||
| 734 | status = UART_GET_CSR(port); | ||
| 735 | } while (!(status & AT91_US_TXRDY)); | ||
| 736 | UART_PUT_CHAR(port, s[i]); | ||
| 737 | if (s[i] == '\n') { | ||
| 738 | do { | ||
| 739 | status = UART_GET_CSR(port); | ||
| 740 | } while (!(status & AT91_US_TXRDY)); | ||
| 741 | UART_PUT_CHAR(port, '\r'); | ||
| 742 | } | ||
| 743 | } | ||
| 744 | 736 | ||
| 745 | /* | 737 | /* |
| 746 | * Finally, wait for transmitter to become empty | 738 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/au1x00_uart.c b/drivers/serial/au1x00_uart.c index 344022fe53ef..29f94bbb79be 100644 --- a/drivers/serial/au1x00_uart.c +++ b/drivers/serial/au1x00_uart.c | |||
| @@ -1121,6 +1121,14 @@ static inline void wait_for_xmitr(struct uart_8250_port *up) | |||
| 1121 | } | 1121 | } |
| 1122 | } | 1122 | } |
| 1123 | 1123 | ||
| 1124 | static void au1x00_console_putchar(struct uart_port *port, int ch) | ||
| 1125 | { | ||
| 1126 | struct uart_8250_port *up = (struct uart_8250_port *)port; | ||
| 1127 | |||
| 1128 | wait_for_xmitr(up); | ||
| 1129 | serial_out(up, UART_TX, ch); | ||
| 1130 | } | ||
| 1131 | |||
| 1124 | /* | 1132 | /* |
| 1125 | * Print a string to the serial port trying not to disturb | 1133 | * Print a string to the serial port trying not to disturb |
| 1126 | * any possible real use of the port... | 1134 | * any possible real use of the port... |
| @@ -1132,7 +1140,6 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
| 1132 | { | 1140 | { |
| 1133 | struct uart_8250_port *up = &serial8250_ports[co->index]; | 1141 | struct uart_8250_port *up = &serial8250_ports[co->index]; |
| 1134 | unsigned int ier; | 1142 | unsigned int ier; |
| 1135 | int i; | ||
| 1136 | 1143 | ||
| 1137 | /* | 1144 | /* |
| 1138 | * First save the UER then disable the interrupts | 1145 | * First save the UER then disable the interrupts |
| @@ -1140,22 +1147,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
| 1140 | ier = serial_in(up, UART_IER); | 1147 | ier = serial_in(up, UART_IER); |
| 1141 | serial_out(up, UART_IER, 0); | 1148 | serial_out(up, UART_IER, 0); |
| 1142 | 1149 | ||
| 1143 | /* | 1150 | uart_console_write(&up->port, s, count, au1x00_console_putchar); |
| 1144 | * Now, do each character | ||
| 1145 | */ | ||
| 1146 | for (i = 0; i < count; i++, s++) { | ||
| 1147 | wait_for_xmitr(up); | ||
| 1148 | |||
| 1149 | /* | ||
| 1150 | * Send the character out. | ||
| 1151 | * If a LF, also do CR... | ||
| 1152 | */ | ||
| 1153 | serial_out(up, UART_TX, *s); | ||
| 1154 | if (*s == 10) { | ||
| 1155 | wait_for_xmitr(up); | ||
| 1156 | serial_out(up, UART_TX, 13); | ||
| 1157 | } | ||
| 1158 | } | ||
| 1159 | 1151 | ||
| 1160 | /* | 1152 | /* |
| 1161 | * Finally, wait for transmitter to become empty | 1153 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c index ce7b2e4ecd17..2691112c84ad 100644 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c | |||
| @@ -424,6 +424,13 @@ static struct uart_port clps711x_ports[UART_NR] = { | |||
| 424 | }; | 424 | }; |
| 425 | 425 | ||
| 426 | #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE | 426 | #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE |
| 427 | static void clps711xuart_console_putchar(struct uart_port *port, int ch) | ||
| 428 | { | ||
| 429 | while (clps_readl(SYSFLG(port)) & SYSFLG_UTXFF) | ||
| 430 | barrier(); | ||
| 431 | clps_writel(ch, UARTDR(port)); | ||
| 432 | } | ||
| 433 | |||
| 427 | /* | 434 | /* |
| 428 | * Print a string to the serial port trying not to disturb | 435 | * Print a string to the serial port trying not to disturb |
| 429 | * any possible real use of the port... | 436 | * any possible real use of the port... |
| @@ -438,7 +445,6 @@ clps711xuart_console_write(struct console *co, const char *s, | |||
| 438 | { | 445 | { |
| 439 | struct uart_port *port = clps711x_ports + co->index; | 446 | struct uart_port *port = clps711x_ports + co->index; |
| 440 | unsigned int status, syscon; | 447 | unsigned int status, syscon; |
| 441 | int i; | ||
| 442 | 448 | ||
| 443 | /* | 449 | /* |
| 444 | * Ensure that the port is enabled. | 450 | * Ensure that the port is enabled. |
| @@ -446,21 +452,7 @@ clps711xuart_console_write(struct console *co, const char *s, | |||
| 446 | syscon = clps_readl(SYSCON(port)); | 452 | syscon = clps_readl(SYSCON(port)); |
| 447 | clps_writel(syscon | SYSCON_UARTEN, SYSCON(port)); | 453 | clps_writel(syscon | SYSCON_UARTEN, SYSCON(port)); |
| 448 | 454 | ||
| 449 | /* | 455 | uart_console_write(port, s, count, clps711xuart_console_putchar); |
| 450 | * Now, do each character | ||
| 451 | */ | ||
| 452 | for (i = 0; i < count; i++) { | ||
| 453 | do { | ||
| 454 | status = clps_readl(SYSFLG(port)); | ||
| 455 | } while (status & SYSFLG_UTXFF); | ||
| 456 | clps_writel(s[i], UARTDR(port)); | ||
| 457 | if (s[i] == '\n') { | ||
| 458 | do { | ||
| 459 | status = clps_readl(SYSFLG(port)); | ||
| 460 | } while (status & SYSFLG_UTXFF); | ||
| 461 | clps_writel('\r', UARTDR(port)); | ||
| 462 | } | ||
| 463 | } | ||
| 464 | 456 | ||
| 465 | /* | 457 | /* |
| 466 | * Finally, wait for transmitter to become empty | 458 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index ba5541de673b..bf71bad5c34f 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
| @@ -674,11 +674,12 @@ static void dz_reset(struct dz_port *dport) | |||
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | #ifdef CONFIG_SERIAL_DZ_CONSOLE | 676 | #ifdef CONFIG_SERIAL_DZ_CONSOLE |
| 677 | static void dz_console_put_char(struct dz_port *dport, unsigned char ch) | 677 | static void dz_console_putchar(struct uart_port *port, int ch) |
| 678 | { | 678 | { |
| 679 | struct dz_port *dport = (struct dz_port *)uport; | ||
| 679 | unsigned long flags; | 680 | unsigned long flags; |
| 680 | int loops = 2500; | 681 | int loops = 2500; |
| 681 | unsigned short tmp = ch; | 682 | unsigned short tmp = (unsigned char)ch; |
| 682 | /* this code sends stuff out to serial device - spinning its | 683 | /* this code sends stuff out to serial device - spinning its |
| 683 | wheels and waiting. */ | 684 | wheels and waiting. */ |
| 684 | 685 | ||
| @@ -694,6 +695,7 @@ static void dz_console_put_char(struct dz_port *dport, unsigned char ch) | |||
| 694 | 695 | ||
| 695 | spin_unlock_irqrestore(&dport->port.lock, flags); | 696 | spin_unlock_irqrestore(&dport->port.lock, flags); |
| 696 | } | 697 | } |
| 698 | |||
| 697 | /* | 699 | /* |
| 698 | * ------------------------------------------------------------------- | 700 | * ------------------------------------------------------------------- |
| 699 | * dz_console_print () | 701 | * dz_console_print () |
| @@ -710,11 +712,7 @@ static void dz_console_print(struct console *cons, | |||
| 710 | #ifdef DEBUG_DZ | 712 | #ifdef DEBUG_DZ |
| 711 | prom_printf((char *) str); | 713 | prom_printf((char *) str); |
| 712 | #endif | 714 | #endif |
| 713 | while (count--) { | 715 | uart_console_write(&dport->port, str, count, dz_console_putchar); |
| 714 | if (*str == '\n') | ||
| 715 | dz_console_put_char(dport, '\r'); | ||
| 716 | dz_console_put_char(dport, *str++); | ||
| 717 | } | ||
| 718 | } | 716 | } |
| 719 | 717 | ||
| 720 | static int __init dz_console_setup(struct console *co, char *options) | 718 | static int __init dz_console_setup(struct console *co, char *options) |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 4d53fb5ca87b..c3b7a6673e9c 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
| @@ -743,6 +743,13 @@ static void __init imx_init_ports(void) | |||
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | #ifdef CONFIG_SERIAL_IMX_CONSOLE | 745 | #ifdef CONFIG_SERIAL_IMX_CONSOLE |
| 746 | static void imx_console_putchar(struct uart_port *port, int ch) | ||
| 747 | { | ||
| 748 | struct imx_port *sport = (struct imx_port *)port; | ||
| 749 | while ((UTS((u32)sport->port.membase) & UTS_TXFULL)) | ||
| 750 | barrier(); | ||
| 751 | URTX0((u32)sport->port.membase) = ch; | ||
| 752 | } | ||
| 746 | 753 | ||
| 747 | /* | 754 | /* |
| 748 | * Interrupts are disabled on entering | 755 | * Interrupts are disabled on entering |
| @@ -751,7 +758,7 @@ static void | |||
| 751 | imx_console_write(struct console *co, const char *s, unsigned int count) | 758 | imx_console_write(struct console *co, const char *s, unsigned int count) |
| 752 | { | 759 | { |
| 753 | struct imx_port *sport = &imx_ports[co->index]; | 760 | struct imx_port *sport = &imx_ports[co->index]; |
| 754 | unsigned int old_ucr1, old_ucr2, i; | 761 | unsigned int old_ucr1, old_ucr2; |
| 755 | 762 | ||
| 756 | /* | 763 | /* |
| 757 | * First, save UCR1/2 and then disable interrupts | 764 | * First, save UCR1/2 and then disable interrupts |
| @@ -764,22 +771,7 @@ imx_console_write(struct console *co, const char *s, unsigned int count) | |||
| 764 | & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); | 771 | & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); |
| 765 | UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; | 772 | UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; |
| 766 | 773 | ||
| 767 | /* | 774 | uart_console_write(&sport->port, s, count, imx_console_putchar); |
| 768 | * Now, do each character | ||
| 769 | */ | ||
| 770 | for (i = 0; i < count; i++) { | ||
| 771 | |||
| 772 | while ((UTS((u32)sport->port.membase) & UTS_TXFULL)) | ||
| 773 | barrier(); | ||
| 774 | |||
| 775 | URTX0((u32)sport->port.membase) = s[i]; | ||
| 776 | |||
| 777 | if (s[i] == '\n') { | ||
| 778 | while ((UTS((u32)sport->port.membase) & UTS_TXFULL)) | ||
| 779 | barrier(); | ||
| 780 | URTX0((u32)sport->port.membase) = '\r'; | ||
| 781 | } | ||
| 782 | } | ||
| 783 | 775 | ||
| 784 | /* | 776 | /* |
| 785 | * Finally, wait for transmitter to become empty | 777 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index 193722d680cf..651772474ac1 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
| @@ -967,8 +967,9 @@ static struct zilog_layout * __init get_zs(int chip) | |||
| 967 | #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ | 967 | #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ |
| 968 | 968 | ||
| 969 | #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE | 969 | #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE |
| 970 | static void ip22zilog_put_char(struct zilog_channel *channel, unsigned char ch) | 970 | static void ip22zilog_put_char(struct uart_port *port, int ch) |
| 971 | { | 971 | { |
| 972 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); | ||
| 972 | int loops = ZS_PUT_CHAR_MAX_DELAY; | 973 | int loops = ZS_PUT_CHAR_MAX_DELAY; |
| 973 | 974 | ||
| 974 | /* This is a timed polling loop so do not switch the explicit | 975 | /* This is a timed polling loop so do not switch the explicit |
| @@ -992,16 +993,10 @@ static void | |||
| 992 | ip22zilog_console_write(struct console *con, const char *s, unsigned int count) | 993 | ip22zilog_console_write(struct console *con, const char *s, unsigned int count) |
| 993 | { | 994 | { |
| 994 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; | 995 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; |
| 995 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
| 996 | unsigned long flags; | 996 | unsigned long flags; |
| 997 | int i; | ||
| 998 | 997 | ||
| 999 | spin_lock_irqsave(&up->port.lock, flags); | 998 | spin_lock_irqsave(&up->port.lock, flags); |
| 1000 | for (i = 0; i < count; i++, s++) { | 999 | uart_console_write(&up->port, s, count, ip22zilog_put_char); |
| 1001 | ip22zilog_put_char(channel, *s); | ||
| 1002 | if (*s == 10) | ||
| 1003 | ip22zilog_put_char(channel, 13); | ||
| 1004 | } | ||
| 1005 | udelay(2); | 1000 | udelay(2); |
| 1006 | spin_unlock_irqrestore(&up->port.lock, flags); | 1001 | spin_unlock_irqrestore(&up->port.lock, flags); |
| 1007 | } | 1002 | } |
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index 242a04104393..876bc5e027bb 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c | |||
| @@ -1039,6 +1039,14 @@ static inline void wait_for_xmitr(struct uart_sio_port *up) | |||
| 1039 | } | 1039 | } |
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | static void m32r_sio_console_putchar(struct uart_port *port, int ch) | ||
| 1043 | { | ||
| 1044 | struct uart_sio_port *up = (struct uart_sio_port *)port; | ||
| 1045 | |||
| 1046 | wait_for_xmitr(up); | ||
| 1047 | sio_out(up, SIOTXB, ch); | ||
| 1048 | } | ||
| 1049 | |||
| 1042 | /* | 1050 | /* |
| 1043 | * Print a string to the serial port trying not to disturb | 1051 | * Print a string to the serial port trying not to disturb |
| 1044 | * any possible real use of the port... | 1052 | * any possible real use of the port... |
| @@ -1058,23 +1066,7 @@ static void m32r_sio_console_write(struct console *co, const char *s, | |||
| 1058 | ier = sio_in(up, SIOTRCR); | 1066 | ier = sio_in(up, SIOTRCR); |
| 1059 | sio_out(up, SIOTRCR, 0); | 1067 | sio_out(up, SIOTRCR, 0); |
| 1060 | 1068 | ||
| 1061 | /* | 1069 | uart_console_write(&up->port, s, count, m32r_sio_console_putchar); |
| 1062 | * Now, do each character | ||
| 1063 | */ | ||
| 1064 | for (i = 0; i < count; i++, s++) { | ||
| 1065 | wait_for_xmitr(up); | ||
| 1066 | |||
| 1067 | /* | ||
| 1068 | * Send the character out. | ||
| 1069 | * If a LF, also do CR... | ||
| 1070 | */ | ||
| 1071 | sio_out(up, SIOTXB, *s); | ||
| 1072 | |||
| 1073 | if (*s == 10) { | ||
| 1074 | wait_for_xmitr(up); | ||
| 1075 | sio_out(up, SIOTXB, 13); | ||
| 1076 | } | ||
| 1077 | } | ||
| 1078 | 1070 | ||
| 1079 | /* | 1071 | /* |
| 1080 | * Finally, wait for transmitter to become empty | 1072 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 61dd17d7bace..928e6cf12dca 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
| @@ -603,15 +603,14 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count) | |||
| 603 | udelay(1); | 603 | udelay(1); |
| 604 | 604 | ||
| 605 | /* Write all the chars */ | 605 | /* Write all the chars */ |
| 606 | for ( i=0 ; i<count ; i++ ) { | 606 | for (i = 0; i < count; i++, s++) { |
| 607 | |||
| 608 | /* Send the char */ | ||
| 609 | out_8(&psc->mpc52xx_psc_buffer_8, *s); | ||
| 610 | |||
| 611 | /* Line return handling */ | 607 | /* Line return handling */ |
| 612 | if ( *s++ == '\n' ) | 608 | if (*s == '\n') |
| 613 | out_8(&psc->mpc52xx_psc_buffer_8, '\r'); | 609 | out_8(&psc->mpc52xx_psc_buffer_8, '\r'); |
| 614 | 610 | ||
| 611 | /* Send the char */ | ||
| 612 | out_8(&psc->mpc52xx_psc_buffer_8, *s); | ||
| 613 | |||
| 615 | /* Wait the TX buffer to be empty */ | 614 | /* Wait the TX buffer to be empty */ |
| 616 | j = 20000; /* Maximum wait */ | 615 | j = 20000; /* Maximum wait */ |
| 617 | while (!(in_be16(&psc->mpc52xx_psc_status) & | 616 | while (!(in_be16(&psc->mpc52xx_psc_status) & |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 9b7ed58cb53b..513ff8597707 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
| @@ -1916,6 +1916,16 @@ static void __exit exit_pmz(void) | |||
| 1916 | 1916 | ||
| 1917 | #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE | 1917 | #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE |
| 1918 | 1918 | ||
| 1919 | static void pmz_console_putchar(struct uart_port *port, int ch) | ||
| 1920 | { | ||
| 1921 | struct uart_pmac_port *uap = (struct uart_pmac_port *)port; | ||
| 1922 | |||
| 1923 | /* Wait for the transmit buffer to empty. */ | ||
| 1924 | while ((read_zsreg(uap, R0) & Tx_BUF_EMP) == 0) | ||
| 1925 | udelay(5); | ||
| 1926 | write_zsdata(uap, ch); | ||
| 1927 | } | ||
| 1928 | |||
| 1919 | /* | 1929 | /* |
| 1920 | * Print a string to the serial port trying not to disturb | 1930 | * Print a string to the serial port trying not to disturb |
| 1921 | * any possible real use of the port... | 1931 | * any possible real use of the port... |
| @@ -1924,7 +1934,6 @@ static void pmz_console_write(struct console *con, const char *s, unsigned int c | |||
| 1924 | { | 1934 | { |
| 1925 | struct uart_pmac_port *uap = &pmz_ports[con->index]; | 1935 | struct uart_pmac_port *uap = &pmz_ports[con->index]; |
| 1926 | unsigned long flags; | 1936 | unsigned long flags; |
| 1927 | int i; | ||
| 1928 | 1937 | ||
| 1929 | if (ZS_IS_ASLEEP(uap)) | 1938 | if (ZS_IS_ASLEEP(uap)) |
| 1930 | return; | 1939 | return; |
| @@ -1934,17 +1943,7 @@ static void pmz_console_write(struct console *con, const char *s, unsigned int c | |||
| 1934 | write_zsreg(uap, R1, uap->curregs[1] & ~TxINT_ENAB); | 1943 | write_zsreg(uap, R1, uap->curregs[1] & ~TxINT_ENAB); |
| 1935 | write_zsreg(uap, R5, uap->curregs[5] | TxENABLE | RTS | DTR); | 1944 | write_zsreg(uap, R5, uap->curregs[5] | TxENABLE | RTS | DTR); |
| 1936 | 1945 | ||
| 1937 | for (i = 0; i < count; i++) { | 1946 | uart_console_write(&uap->port, s, count, pmz_console_putchar); |
| 1938 | /* Wait for the transmit buffer to empty. */ | ||
| 1939 | while ((read_zsreg(uap, R0) & Tx_BUF_EMP) == 0) | ||
| 1940 | udelay(5); | ||
| 1941 | write_zsdata(uap, s[i]); | ||
| 1942 | if (s[i] == 10) { | ||
| 1943 | while ((read_zsreg(uap, R0) & Tx_BUF_EMP) == 0) | ||
| 1944 | udelay(5); | ||
| 1945 | write_zsdata(uap, R13); | ||
| 1946 | } | ||
| 1947 | } | ||
| 1948 | 1947 | ||
| 1949 | /* Restore the values in the registers. */ | 1948 | /* Restore the values in the registers. */ |
| 1950 | write_zsreg(uap, R1, uap->curregs[1]); | 1949 | write_zsreg(uap, R1, uap->curregs[1]); |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index 10535f00301f..77d4568ccc3a 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
| @@ -619,6 +619,14 @@ static inline void wait_for_xmitr(struct uart_pxa_port *up) | |||
| 619 | } | 619 | } |
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | static void serial_pxa_console_putchar(struct uart_port *port, int ch) | ||
| 623 | { | ||
| 624 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; | ||
| 625 | |||
| 626 | wait_for_xmitr(up); | ||
| 627 | serial_out(up, UART_TX, ch); | ||
| 628 | } | ||
| 629 | |||
| 622 | /* | 630 | /* |
| 623 | * Print a string to the serial port trying not to disturb | 631 | * Print a string to the serial port trying not to disturb |
| 624 | * any possible real use of the port... | 632 | * any possible real use of the port... |
| @@ -630,7 +638,6 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | |||
| 630 | { | 638 | { |
| 631 | struct uart_pxa_port *up = &serial_pxa_ports[co->index]; | 639 | struct uart_pxa_port *up = &serial_pxa_ports[co->index]; |
| 632 | unsigned int ier; | 640 | unsigned int ier; |
| 633 | int i; | ||
| 634 | 641 | ||
| 635 | /* | 642 | /* |
| 636 | * First save the IER then disable the interrupts | 643 | * First save the IER then disable the interrupts |
| @@ -638,22 +645,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | |||
| 638 | ier = serial_in(up, UART_IER); | 645 | ier = serial_in(up, UART_IER); |
| 639 | serial_out(up, UART_IER, UART_IER_UUE); | 646 | serial_out(up, UART_IER, UART_IER_UUE); |
| 640 | 647 | ||
| 641 | /* | 648 | uart_console_write(&up->port, s, count, serial_pxa_console_putchar); |
| 642 | * Now, do each character | ||
| 643 | */ | ||
| 644 | for (i = 0; i < count; i++, s++) { | ||
| 645 | wait_for_xmitr(up); | ||
| 646 | |||
| 647 | /* | ||
| 648 | * Send the character out. | ||
| 649 | * If a LF, also do CR... | ||
| 650 | */ | ||
| 651 | serial_out(up, UART_TX, *s); | ||
| 652 | if (*s == 10) { | ||
| 653 | wait_for_xmitr(up); | ||
| 654 | serial_out(up, UART_TX, 13); | ||
| 655 | } | ||
| 656 | } | ||
| 657 | 649 | ||
| 658 | /* | 650 | /* |
| 659 | * Finally, wait for transmitter to become empty | 651 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 00d7c0ad8cbf..f5aac92fb798 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
| @@ -1586,25 +1586,19 @@ s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon) | |||
| 1586 | } | 1586 | } |
| 1587 | 1587 | ||
| 1588 | static void | 1588 | static void |
| 1589 | s3c24xx_serial_console_write(struct console *co, const char *s, | 1589 | s3c24xx_serial_console_putchar(struct uart_port *port, int ch) |
| 1590 | unsigned int count) | ||
| 1591 | { | 1590 | { |
| 1592 | int i; | ||
| 1593 | unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON); | 1591 | unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON); |
| 1592 | while (!s3c24xx_serial_console_txrdy(port, ufcon)) | ||
| 1593 | barrier(); | ||
| 1594 | wr_regb(cons_uart, S3C2410_UTXH, ch); | ||
| 1595 | } | ||
| 1594 | 1596 | ||
| 1595 | for (i = 0; i < count; i++) { | 1597 | static void |
| 1596 | while (!s3c24xx_serial_console_txrdy(cons_uart, ufcon)) | 1598 | s3c24xx_serial_console_write(struct console *co, const char *s, |
| 1597 | barrier(); | 1599 | unsigned int count) |
| 1598 | 1600 | { | |
| 1599 | wr_regb(cons_uart, S3C2410_UTXH, s[i]); | 1601 | uart_console_write(cons_uart, s, count, s3c24xx_serial_console_putchar); |
| 1600 | |||
| 1601 | if (s[i] == '\n') { | ||
| 1602 | while (!s3c24xx_serial_console_txrdy(cons_uart, ufcon)) | ||
| 1603 | barrier(); | ||
| 1604 | |||
| 1605 | wr_regb(cons_uart, S3C2410_UTXH, '\r'); | ||
| 1606 | } | ||
| 1607 | } | ||
| 1608 | } | 1602 | } |
| 1609 | 1603 | ||
| 1610 | static void __init | 1604 | static void __init |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 2c00b8625852..c2d9068b491d 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
| @@ -689,6 +689,14 @@ void __init sa1100_register_uart(int idx, int port) | |||
| 689 | 689 | ||
| 690 | 690 | ||
| 691 | #ifdef CONFIG_SERIAL_SA1100_CONSOLE | 691 | #ifdef CONFIG_SERIAL_SA1100_CONSOLE |
| 692 | static void sa1100_console_putchar(struct uart_port *port, int ch) | ||
| 693 | { | ||
| 694 | struct sa1100_port *sport = (struct sa1100_port *)port; | ||
| 695 | |||
| 696 | while (!(UART_GET_UTSR1(sport) & UTSR1_TNF)) | ||
| 697 | barrier(); | ||
| 698 | UART_PUT_CHAR(sport, ch); | ||
| 699 | } | ||
| 692 | 700 | ||
| 693 | /* | 701 | /* |
| 694 | * Interrupts are disabled on entering | 702 | * Interrupts are disabled on entering |
| @@ -697,7 +705,7 @@ static void | |||
| 697 | sa1100_console_write(struct console *co, const char *s, unsigned int count) | 705 | sa1100_console_write(struct console *co, const char *s, unsigned int count) |
| 698 | { | 706 | { |
| 699 | struct sa1100_port *sport = &sa1100_ports[co->index]; | 707 | struct sa1100_port *sport = &sa1100_ports[co->index]; |
| 700 | unsigned int old_utcr3, status, i; | 708 | unsigned int old_utcr3, status; |
| 701 | 709 | ||
| 702 | /* | 710 | /* |
| 703 | * First, save UTCR3 and then disable interrupts | 711 | * First, save UTCR3 and then disable interrupts |
| @@ -706,21 +714,7 @@ sa1100_console_write(struct console *co, const char *s, unsigned int count) | |||
| 706 | UART_PUT_UTCR3(sport, (old_utcr3 & ~(UTCR3_RIE | UTCR3_TIE)) | | 714 | UART_PUT_UTCR3(sport, (old_utcr3 & ~(UTCR3_RIE | UTCR3_TIE)) | |
| 707 | UTCR3_TXE); | 715 | UTCR3_TXE); |
| 708 | 716 | ||
| 709 | /* | 717 | uart_console_write(&sport->port, s, count, sa1100_console_putchar); |
| 710 | * Now, do each character | ||
| 711 | */ | ||
| 712 | for (i = 0; i < count; i++) { | ||
| 713 | do { | ||
| 714 | status = UART_GET_UTSR1(sport); | ||
| 715 | } while (!(status & UTSR1_TNF)); | ||
| 716 | UART_PUT_CHAR(sport, s[i]); | ||
| 717 | if (s[i] == '\n') { | ||
| 718 | do { | ||
| 719 | status = UART_GET_UTSR1(sport); | ||
| 720 | } while (!(status & UTSR1_TNF)); | ||
| 721 | UART_PUT_CHAR(sport, '\r'); | ||
| 722 | } | ||
| 723 | } | ||
| 724 | 718 | ||
| 725 | /* | 719 | /* |
| 726 | * Finally, wait for transmitter to become empty | 720 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index cc1faa31d124..fcd7744c4253 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
| @@ -1755,6 +1755,27 @@ static int uart_read_proc(char *page, char **start, off_t off, | |||
| 1755 | 1755 | ||
| 1756 | #ifdef CONFIG_SERIAL_CORE_CONSOLE | 1756 | #ifdef CONFIG_SERIAL_CORE_CONSOLE |
| 1757 | /* | 1757 | /* |
| 1758 | * uart_console_write - write a console message to a serial port | ||
| 1759 | * @port: the port to write the message | ||
| 1760 | * @s: array of characters | ||
| 1761 | * @count: number of characters in string to write | ||
| 1762 | * @write: function to write character to port | ||
| 1763 | */ | ||
| 1764 | void uart_console_write(struct uart_port *port, const char *s, | ||
| 1765 | unsigned int count, | ||
| 1766 | void (*putchar)(struct uart_port *, int)) | ||
| 1767 | { | ||
| 1768 | unsigned int i; | ||
| 1769 | |||
| 1770 | for (i = 0; i < count; i++, s++) { | ||
| 1771 | if (*s == '\n') | ||
| 1772 | putchar(port, '\r'); | ||
| 1773 | putchar(port, *s); | ||
| 1774 | } | ||
| 1775 | } | ||
| 1776 | EXPORT_SYMBOL_GPL(uart_console_write); | ||
| 1777 | |||
| 1778 | /* | ||
| 1758 | * Check whether an invalid uart number has been specified, and | 1779 | * Check whether an invalid uart number has been specified, and |
| 1759 | * if so, search for the first available port that does have | 1780 | * if so, search for the first available port that does have |
| 1760 | * console support. | 1781 | * console support. |
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c index 04186eaae227..aa521b8e0d4e 100644 --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c | |||
| @@ -543,6 +543,12 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = { | |||
| 543 | #else | 543 | #else |
| 544 | # define LH7A40X_CONSOLE &lh7a40x_console | 544 | # define LH7A40X_CONSOLE &lh7a40x_console |
| 545 | 545 | ||
| 546 | static void lh7a40xuart_console_putchar(struct uart_port *port, int ch) | ||
| 547 | { | ||
| 548 | while (UR(port, UART_R_STATUS) & nTxRdy) | ||
| 549 | ; | ||
| 550 | UR(port, UART_R_DATA) = ch; | ||
| 551 | } | ||
| 546 | 552 | ||
| 547 | static void lh7a40xuart_console_write (struct console* co, | 553 | static void lh7a40xuart_console_write (struct console* co, |
| 548 | const char* s, | 554 | const char* s, |
| @@ -556,16 +562,7 @@ static void lh7a40xuart_console_write (struct console* co, | |||
| 556 | UR (port, UART_R_INTEN) = 0; /* Disable all interrupts */ | 562 | UR (port, UART_R_INTEN) = 0; /* Disable all interrupts */ |
| 557 | BIT_SET (port, UART_R_CON, UARTEN | SIRDIS); /* Enable UART */ | 563 | BIT_SET (port, UART_R_CON, UARTEN | SIRDIS); /* Enable UART */ |
| 558 | 564 | ||
| 559 | for (; count-- > 0; ++s) { | 565 | uart_console_write(port, s, count, lh7a40xuart_console_putchar); |
| 560 | while (UR (port, UART_R_STATUS) & nTxRdy) | ||
| 561 | ; | ||
| 562 | UR (port, UART_R_DATA) = *s; | ||
| 563 | if (*s == '\n') { | ||
| 564 | while ((UR (port, UART_R_STATUS) & TxBusy)) | ||
| 565 | ; | ||
| 566 | UR (port, UART_R_DATA) = '\r'; | ||
| 567 | } | ||
| 568 | } | ||
| 569 | 566 | ||
| 570 | /* Wait until all characters are sent */ | 567 | /* Wait until all characters are sent */ |
| 571 | while (UR (port, UART_R_STATUS) & TxBusy) | 568 | while (UR (port, UART_R_STATUS) & TxBusy) |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 141173efd463..b848b7d94412 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
| @@ -863,6 +863,14 @@ static inline void wait_for_xmitr(struct uart_txx9_port *up) | |||
| 863 | } | 863 | } |
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | static void serial_txx9_console_putchar(struct uart_port *port, int ch) | ||
| 867 | { | ||
| 868 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | ||
| 869 | |||
| 870 | wait_for_xmitr(up); | ||
| 871 | sio_out(up, TXX9_SITFIFO, ch); | ||
| 872 | } | ||
| 873 | |||
| 866 | /* | 874 | /* |
| 867 | * Print a string to the serial port trying not to disturb | 875 | * Print a string to the serial port trying not to disturb |
| 868 | * any possible real use of the port... | 876 | * any possible real use of the port... |
| @@ -874,7 +882,6 @@ serial_txx9_console_write(struct console *co, const char *s, unsigned int count) | |||
| 874 | { | 882 | { |
| 875 | struct uart_txx9_port *up = &serial_txx9_ports[co->index]; | 883 | struct uart_txx9_port *up = &serial_txx9_ports[co->index]; |
| 876 | unsigned int ier, flcr; | 884 | unsigned int ier, flcr; |
| 877 | int i; | ||
| 878 | 885 | ||
| 879 | /* | 886 | /* |
| 880 | * First save the UER then disable the interrupts | 887 | * First save the UER then disable the interrupts |
| @@ -888,22 +895,7 @@ serial_txx9_console_write(struct console *co, const char *s, unsigned int count) | |||
| 888 | if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) | 895 | if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) |
| 889 | sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES); | 896 | sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES); |
| 890 | 897 | ||
| 891 | /* | 898 | uart_console_write(&up->port, s, count, serial_txx9_console_putchar); |
| 892 | * Now, do each character | ||
| 893 | */ | ||
| 894 | for (i = 0; i < count; i++, s++) { | ||
| 895 | wait_for_xmitr(up); | ||
| 896 | |||
| 897 | /* | ||
| 898 | * Send the character out. | ||
| 899 | * If a LF, also do CR... | ||
| 900 | */ | ||
| 901 | sio_out(up, TXX9_SITFIFO, *s); | ||
| 902 | if (*s == 10) { | ||
| 903 | wait_for_xmitr(up); | ||
| 904 | sio_out(up, TXX9_SITFIFO, 13); | ||
| 905 | } | ||
| 906 | } | ||
| 907 | 899 | ||
| 908 | /* | 900 | /* |
| 909 | * Finally, wait for transmitter to become empty | 901 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index a2fb0c2fb121..bfbe9dc90cca 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
| @@ -861,8 +861,9 @@ static int num_channels; | |||
| 861 | 861 | ||
| 862 | #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE | 862 | #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE |
| 863 | 863 | ||
| 864 | static __inline__ void sunsab_console_putchar(struct uart_sunsab_port *up, char c) | 864 | static void sunsab_console_putchar(struct uart_port *port, int c) |
| 865 | { | 865 | { |
| 866 | struct uart_sunsab_port *up = (struct uart_sunsab_port *)port; | ||
| 866 | unsigned long flags; | 867 | unsigned long flags; |
| 867 | 868 | ||
| 868 | spin_lock_irqsave(&up->port.lock, flags); | 869 | spin_lock_irqsave(&up->port.lock, flags); |
| @@ -876,13 +877,8 @@ static __inline__ void sunsab_console_putchar(struct uart_sunsab_port *up, char | |||
| 876 | static void sunsab_console_write(struct console *con, const char *s, unsigned n) | 877 | static void sunsab_console_write(struct console *con, const char *s, unsigned n) |
| 877 | { | 878 | { |
| 878 | struct uart_sunsab_port *up = &sunsab_ports[con->index]; | 879 | struct uart_sunsab_port *up = &sunsab_ports[con->index]; |
| 879 | int i; | ||
| 880 | 880 | ||
| 881 | for (i = 0; i < n; i++) { | 881 | uart_console_write(&up->port, s, n, sunsab_console_putchar); |
| 882 | if (*s == '\n') | ||
| 883 | sunsab_console_putchar(up, '\r'); | ||
| 884 | sunsab_console_putchar(up, *s++); | ||
| 885 | } | ||
| 886 | sunsab_tec_wait(up); | 882 | sunsab_tec_wait(up); |
| 887 | } | 883 | } |
| 888 | 884 | ||
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 46c44b83f57c..7fc3d3b41d18 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
| @@ -1377,6 +1377,14 @@ static __inline__ void wait_for_xmitr(struct uart_sunsu_port *up) | |||
| 1377 | } | 1377 | } |
| 1378 | } | 1378 | } |
| 1379 | 1379 | ||
| 1380 | static void sunsu_console_putchar(struct uart_port *port, int ch) | ||
| 1381 | { | ||
| 1382 | struct uart_sunsu_port *up = (struct uart_sunsu_port *)port; | ||
| 1383 | |||
| 1384 | wait_for_xmitr(up); | ||
| 1385 | serial_out(up, UART_TX, ch); | ||
| 1386 | } | ||
| 1387 | |||
| 1380 | /* | 1388 | /* |
| 1381 | * Print a string to the serial port trying not to disturb | 1389 | * Print a string to the serial port trying not to disturb |
| 1382 | * any possible real use of the port... | 1390 | * any possible real use of the port... |
| @@ -1386,7 +1394,6 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
| 1386 | { | 1394 | { |
| 1387 | struct uart_sunsu_port *up = &sunsu_ports[co->index]; | 1395 | struct uart_sunsu_port *up = &sunsu_ports[co->index]; |
| 1388 | unsigned int ier; | 1396 | unsigned int ier; |
| 1389 | int i; | ||
| 1390 | 1397 | ||
| 1391 | /* | 1398 | /* |
| 1392 | * First save the UER then disable the interrupts | 1399 | * First save the UER then disable the interrupts |
| @@ -1394,22 +1401,7 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
| 1394 | ier = serial_in(up, UART_IER); | 1401 | ier = serial_in(up, UART_IER); |
| 1395 | serial_out(up, UART_IER, 0); | 1402 | serial_out(up, UART_IER, 0); |
| 1396 | 1403 | ||
| 1397 | /* | 1404 | uart_console_write(&up->port, s, count, sunsu_console_putchar); |
| 1398 | * Now, do each character | ||
| 1399 | */ | ||
| 1400 | for (i = 0; i < count; i++, s++) { | ||
| 1401 | wait_for_xmitr(up); | ||
| 1402 | |||
| 1403 | /* | ||
| 1404 | * Send the character out. | ||
| 1405 | * If a LF, also do CR... | ||
| 1406 | */ | ||
| 1407 | serial_out(up, UART_TX, *s); | ||
| 1408 | if (*s == 10) { | ||
| 1409 | wait_for_xmitr(up); | ||
| 1410 | serial_out(up, UART_TX, 13); | ||
| 1411 | } | ||
| 1412 | } | ||
| 1413 | 1405 | ||
| 1414 | /* | 1406 | /* |
| 1415 | * Finally, wait for transmitter to become empty | 1407 | * Finally, wait for transmitter to become empty |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 10b35c6f287d..cd49ebbf4a45 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
| @@ -1252,8 +1252,9 @@ static struct zilog_layout __iomem * __init get_zs(int chip, int node) | |||
| 1252 | 1252 | ||
| 1253 | #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ | 1253 | #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ |
| 1254 | 1254 | ||
| 1255 | static void sunzilog_put_char(struct zilog_channel __iomem *channel, unsigned char ch) | 1255 | static void sunzilog_putchar(struct uart_port *port, int ch) |
| 1256 | { | 1256 | { |
| 1257 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); | ||
| 1257 | int loops = ZS_PUT_CHAR_MAX_DELAY; | 1258 | int loops = ZS_PUT_CHAR_MAX_DELAY; |
| 1258 | 1259 | ||
| 1259 | /* This is a timed polling loop so do not switch the explicit | 1260 | /* This is a timed polling loop so do not switch the explicit |
| @@ -1284,7 +1285,7 @@ static int sunzilog_serio_write(struct serio *serio, unsigned char ch) | |||
| 1284 | 1285 | ||
| 1285 | spin_lock_irqsave(&sunzilog_serio_lock, flags); | 1286 | spin_lock_irqsave(&sunzilog_serio_lock, flags); |
| 1286 | 1287 | ||
| 1287 | sunzilog_put_char(ZILOG_CHANNEL_FROM_PORT(&up->port), ch); | 1288 | sunzilog_putchar(&up->port, ch); |
| 1288 | 1289 | ||
| 1289 | spin_unlock_irqrestore(&sunzilog_serio_lock, flags); | 1290 | spin_unlock_irqrestore(&sunzilog_serio_lock, flags); |
| 1290 | 1291 | ||
| @@ -1325,16 +1326,10 @@ static void | |||
| 1325 | sunzilog_console_write(struct console *con, const char *s, unsigned int count) | 1326 | sunzilog_console_write(struct console *con, const char *s, unsigned int count) |
| 1326 | { | 1327 | { |
| 1327 | struct uart_sunzilog_port *up = &sunzilog_port_table[con->index]; | 1328 | struct uart_sunzilog_port *up = &sunzilog_port_table[con->index]; |
| 1328 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
| 1329 | unsigned long flags; | 1329 | unsigned long flags; |
| 1330 | int i; | ||
| 1331 | 1330 | ||
| 1332 | spin_lock_irqsave(&up->port.lock, flags); | 1331 | spin_lock_irqsave(&up->port.lock, flags); |
| 1333 | for (i = 0; i < count; i++, s++) { | 1332 | uart_console_write(&up->port, s, count, sunzilog_putchar); |
| 1334 | sunzilog_put_char(channel, *s); | ||
| 1335 | if (*s == 10) | ||
| 1336 | sunzilog_put_char(channel, 13); | ||
| 1337 | } | ||
| 1338 | udelay(2); | 1333 | udelay(2); |
| 1339 | spin_unlock_irqrestore(&up->port.lock, flags); | 1334 | spin_unlock_irqrestore(&up->port.lock, flags); |
| 1340 | } | 1335 | } |
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index bd6294132c18..df5e8713fa31 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
| @@ -821,25 +821,23 @@ static void wait_for_xmitr(struct uart_port *port) | |||
| 821 | } | 821 | } |
| 822 | } | 822 | } |
| 823 | 823 | ||
| 824 | static void siu_console_putchar(struct uart_port *port, int ch) | ||
| 825 | { | ||
| 826 | wait_for_xmitr(port); | ||
| 827 | siu_write(port, UART_TX, ch); | ||
| 828 | } | ||
| 829 | |||
| 824 | static void siu_console_write(struct console *con, const char *s, unsigned count) | 830 | static void siu_console_write(struct console *con, const char *s, unsigned count) |
| 825 | { | 831 | { |
| 826 | struct uart_port *port; | 832 | struct uart_port *port; |
| 827 | uint8_t ier; | 833 | uint8_t ier; |
| 828 | unsigned i; | ||
| 829 | 834 | ||
| 830 | port = &siu_uart_ports[con->index]; | 835 | port = &siu_uart_ports[con->index]; |
| 831 | 836 | ||
| 832 | ier = siu_read(port, UART_IER); | 837 | ier = siu_read(port, UART_IER); |
| 833 | siu_write(port, UART_IER, 0); | 838 | siu_write(port, UART_IER, 0); |
| 834 | 839 | ||
| 835 | for (i = 0; i < count && *s != '\0'; i++, s++) { | 840 | uart_console_write(port, s, count, siu_console_putchar); |
| 836 | wait_for_xmitr(port); | ||
| 837 | siu_write(port, UART_TX, *s); | ||
| 838 | if (*s == '\n') { | ||
| 839 | wait_for_xmitr(port); | ||
| 840 | siu_write(port, UART_TX, '\r'); | ||
| 841 | } | ||
| 842 | } | ||
| 843 | 841 | ||
| 844 | wait_for_xmitr(port); | 842 | wait_for_xmitr(port); |
| 845 | siu_write(port, UART_IER, ier); | 843 | siu_write(port, UART_IER, ier); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 57abcea1cb5d..c32e60e79dea 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -369,6 +369,9 @@ void uart_parse_options(char *options, int *baud, int *parity, int *bits, | |||
| 369 | int uart_set_options(struct uart_port *port, struct console *co, int baud, | 369 | int uart_set_options(struct uart_port *port, struct console *co, int baud, |
| 370 | int parity, int bits, int flow); | 370 | int parity, int bits, int flow); |
| 371 | struct tty_driver *uart_console_device(struct console *co, int *index); | 371 | struct tty_driver *uart_console_device(struct console *co, int *index); |
| 372 | void uart_console_write(struct uart_port *port, const char *s, | ||
| 373 | unsigned int count, | ||
| 374 | void (*putchar)(struct uart_port *, int)); | ||
| 372 | 375 | ||
| 373 | /* | 376 | /* |
| 374 | * Port/driver registration/removal | 377 | * Port/driver registration/removal |
