From patchwork Fri Nov 20 16:02:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vikram pandita X-Patchwork-Id: 61672 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAKG2gNU028936 for ; Fri, 20 Nov 2009 16:02:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753883AbZKTQCm (ORCPT ); Fri, 20 Nov 2009 11:02:42 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753281AbZKTQCm (ORCPT ); Fri, 20 Nov 2009 11:02:42 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:38744 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753160AbZKTQCl (ORCPT ); Fri, 20 Nov 2009 11:02:41 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id nAKG2eMT008052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Nov 2009 10:02:41 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id nAKG2co1023896; Fri, 20 Nov 2009 10:02:38 -0600 (CST) Received: from vip-tid (lta0307903-128247075087.am.dhcp.ti.com [128.247.75.87]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id nAKG2cZ11493; Fri, 20 Nov 2009 10:02:38 -0600 (CST) Received: from vip-tid (localhost.localdomain [127.0.0.1]) by vip-tid (Postfix) with ESMTP id 6E88729CBB0; Fri, 20 Nov 2009 10:02:36 -0600 (CST) Received: (from vikram@localhost) by vip-tid (8.14.3/8.14.3/Submit) id nAKG2aVM018841; Fri, 20 Nov 2009 10:02:36 -0600 X-Authentication-Warning: vip-tid: vikram set sender to vikram.pandita@ti.com using -f From: Vikram Pandita To: linux-omap@vger.kernel.org Cc: Vikram Pandita , Alan Cox Subject: [PATCH v3 2/2] omap: serial: fix non-empty uart fifo read abort Date: Fri, 20 Nov 2009 10:02:36 -0600 Message-Id: <1258732956-18799-3-git-send-email-vikram.pandita@ti.com> X-Mailer: git-send-email 1.6.5.1.69.g36942 In-Reply-To: <1258732956-18799-2-git-send-email-vikram.pandita@ti.com> References: <1258732956-18799-1-git-send-email-vikram.pandita@ti.com> <1258732956-18799-2-git-send-email-vikram.pandita@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 2e17b57..600e4d2 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -572,6 +572,23 @@ static struct omap_uart_state omap_uart[] = { #endif }; +/* + * Override the default 8250 read handler: mem_serial_in() + * Empty RX fifo read causes an abort on omap3630 and omap4 + * This function makes sure that an empty rx fifo is not read on these silicons + * (OMAP1/2/3 are not affected) + */ +static unsigned int serial_in_override(struct uart_port *up, int offset) +{ + if (UART_RX == offset) { + unsigned int lsr; + lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR); + if (!(lsr & UART_LSR_DR)) + return -EPERM; + } + return serial_read_reg(omap_uart[up->line].p, offset); +} + void __init omap_serial_early_init(void) { int i; @@ -627,6 +644,10 @@ void __init omap_serial_early_init(void) if (cpu_is_omap44xx()) p->irq += 32; + /* Do not read empty UART fifo on omap3630/omap4 */ + if (omap3_has_uart_no_empty_fifo_read()) + p->serial_in = serial_in_override; + omap_uart_enable_clocks(uart); } }