diff options
Diffstat (limited to 'drivers/tty/serial/of_serial.c')
| -rw-r--r-- | drivers/tty/serial/of_serial.c | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index e8c9cee07d0..5410c063726 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c @@ -12,10 +12,13 @@  #include <linux/init.h>  #include <linux/module.h>  #include <linux/slab.h> +#include <linux/delay.h>  #include <linux/serial_core.h>  #include <linux/serial_8250.h> +#include <linux/serial_reg.h>  #include <linux/of_address.h>  #include <linux/of_irq.h> +#include <linux/of_serial.h>  #include <linux/of_platform.h>  #include <linux/nwpserial.h> @@ -24,6 +27,26 @@ struct of_serial_info {  	int line;  }; +#ifdef CONFIG_ARCH_TEGRA +void tegra_serial_handle_break(struct uart_port *p) +{ +	unsigned int status, tmout = 10000; + +	do { +		status = p->serial_in(p, UART_LSR); +		if (status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS)) +			status = p->serial_in(p, UART_RX); +		else +			break; +		if (--tmout == 0) +			break; +		udelay(1); +	} while (1); +} +/* FIXME remove this export when tegra finishes conversion to open firmware */ +EXPORT_SYMBOL_GPL(tegra_serial_handle_break); +#endif +  /*   * Fill a struct uart_port for a given device node   */ @@ -84,6 +107,9 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,  		| UPF_FIXED_PORT | UPF_FIXED_TYPE;  	port->dev = &ofdev->dev; +	if (type == PORT_TEGRA) +		port->handle_break = tegra_serial_handle_break; +  	return 0;  }  |