aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2014-05-06 00:46:15 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-28 15:24:31 -0400
commitd3352154041e28cf8c1c260cca41d8e83d5377d8 (patch)
treed7ff0426499201491c308564ee592877e9b064e8 /drivers/tty
parentac62391496cf1ace051c4daebb00f7435320f11f (diff)
tty: serial: uartlite: Specify time for sending chars
Xilinx MDM (Microblaze Debug Module) also contains uart interface via JTAG which is compatible with uartlite driver. This interface is really slow that's why timeout is setup to 1s. Make this time delay not to be cpu speed dependent. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/uartlite.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 5f90ef24d475..dce27f34937e 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -418,14 +418,23 @@ static struct uart_ops ulite_ops = {
418#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE 418#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
419static void ulite_console_wait_tx(struct uart_port *port) 419static void ulite_console_wait_tx(struct uart_port *port)
420{ 420{
421 int i;
422 u8 val; 421 u8 val;
423 422 unsigned long timeout;
424 /* Spin waiting for TX fifo to have space available */ 423
425 for (i = 0; i < 100000; i++) { 424 /*
425 * Spin waiting for TX fifo to have space available.
426 * When using the Microblaze Debug Module this can take up to 1s
427 */
428 timeout = jiffies + msecs_to_jiffies(1000);
429 while (1) {
426 val = uart_in32(ULITE_STATUS, port); 430 val = uart_in32(ULITE_STATUS, port);
427 if ((val & ULITE_STATUS_TXFULL) == 0) 431 if ((val & ULITE_STATUS_TXFULL) == 0)
428 break; 432 break;
433 if (time_after(jiffies, timeout)) {
434 dev_warn(port->dev,
435 "timeout waiting for TX buffer empty\n");
436 break;
437 }
429 cpu_relax(); 438 cpu_relax();
430 } 439 }
431} 440}