From patchwork Fri Jan 29 10:28:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 75734 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o0TASJKY006895 for ; Fri, 29 Jan 2010 10:28:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753227Ab0A2K2S (ORCPT ); Fri, 29 Jan 2010 05:28:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751153Ab0A2K2S (ORCPT ); Fri, 29 Jan 2010 05:28:18 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:46513 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105Ab0A2K2R (ORCPT ); Fri, 29 Jan 2010 05:28:17 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o0TASDkG002616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Jan 2010 04:28:16 -0600 Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o0TAS9jR021560; Fri, 29 Jan 2010 15:58:10 +0530 (IST) Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by linfarm476.india.ti.com (8.12.11/8.12.11) with ESMTP id o0TAS9XG007040; Fri, 29 Jan 2010 15:58:09 +0530 Received: (from a0393909@localhost) by linfarm476.india.ti.com (8.12.11/8.12.11/Submit) id o0TAS9fh007037; Fri, 29 Jan 2010 15:58:09 +0530 From: Santosh Shilimkar To: tony@atomide.com Cc: linux-omap@vger.kernel.org, Santosh Shilimkar , Woodruff Richard , Ghorai Sukumar Subject: [PATCH v2] OMAP: UART: fix full-fifo write abort Date: Fri, 29 Jan 2010 15:58:09 +0530 Message-Id: <1264760889-6973-1-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.5.5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 29 Jan 2010 10:28:19 +0000 (UTC) diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 8c964be..324928d 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -139,6 +140,13 @@ static inline unsigned int serial_read_reg(struct plat_serial8250_port *up, return (unsigned int)__raw_readb(up->membase + offset); } +static inline void __serial_write_reg(struct uart_port *up, int offset, + int value) +{ + offset <<= up->regshift; + __raw_writeb(value, up->membase + offset); +} + static inline void serial_write_reg(struct plat_serial8250_port *p, int offset, int value) { @@ -598,6 +606,20 @@ static unsigned int serial_in_override(struct uart_port *up, int offset) return __serial_read_reg(up, offset); } +static void serial_out_override(struct uart_port *up, int offset, int value) +{ + unsigned int status, tmout = 10000; + + status = __serial_read_reg(up, UART_LSR); + while (!(status & UART_LSR_THRE)) { + /* Wait up to 10ms for the character(s) to be sent. */ + if (--tmout == 0) + break; + udelay(1); + status = __serial_read_reg(up, UART_LSR); + } + __serial_write_reg(up, offset, value); +} void __init omap_serial_early_init(void) { int i; @@ -698,11 +720,15 @@ void __init omap_serial_init_port(int port) * omap3xxx: Never read empty UART fifo on UARTs * with IP rev >=0x52 */ - if (cpu_is_omap44xx()) + if (cpu_is_omap44xx()) { uart->p->serial_in = serial_in_override; + uart->p->serial_out = serial_out_override; + } else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF) - >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) + >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) { uart->p->serial_in = serial_in_override; + uart->p->serial_out = serial_out_override; + } } /**