From patchwork Tue Nov 17 21:16:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vikram pandita X-Patchwork-Id: 60785 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 nAHLHZTO012746 for ; Tue, 17 Nov 2009 21:17:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848AbZKQVRU (ORCPT ); Tue, 17 Nov 2009 16:17:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751809AbZKQVRU (ORCPT ); Tue, 17 Nov 2009 16:17:20 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:43042 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752194AbZKQVRR (ORCPT ); Tue, 17 Nov 2009 16:17:17 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id nAHLHC17024969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Nov 2009 15:17:13 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id nAHLH9nn021632; Tue, 17 Nov 2009 15:17:09 -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 nAHLH9Z23046; Tue, 17 Nov 2009 15:17:09 -0600 (CST) Received: from vip-tid (localhost.localdomain [127.0.0.1]) by vip-tid (Postfix) with ESMTP id CEFB629CB76; Tue, 17 Nov 2009 15:16:57 -0600 (CST) Received: (from vikram@localhost) by vip-tid (8.14.3/8.14.3/Submit) id nAHLGv5L015994; Tue, 17 Nov 2009 15:16:57 -0600 X-Authentication-Warning: vip-tid: vikram set sender to vikram.pandita@ti.com using -f From: Vikram Pandita To: linux-serial@vger.kernel.org, akpm@linux-foundation.org Cc: alan@lxorguk.ukuu.org.uk, linux-omap@vger.kernel.org, Vikram Pandita , "Shilimkar, Santosh" Subject: [PATCH 1/2] serial: 8250: add UPF_NO_EMPTY_FIFO_READ flag Date: Tue, 17 Nov 2009 15:16:55 -0600 Message-Id: <1258492615-15963-1-git-send-email-vikram.pandita@ti.com> X-Mailer: git-send-email 1.6.5.1.69.g36942 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 737b4c9..03c890e 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -1245,7 +1245,11 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) #endif serial_outp(up, UART_MCR, save_mcr); serial8250_clear_fifos(up); - serial_in(up, UART_RX); + if (up->port.flags & UPF_NO_EMPTY_FIFO_READ) { + if (serial_inp(up, UART_LSR) & UART_LSR_DR) + serial_in(up, UART_RX); + } else + serial_in(up, UART_RX); if (up->capabilities & UART_CAP_UUE) serial_outp(up, UART_IER, UART_IER_UUE); else @@ -1289,7 +1293,11 @@ static void autoconfig_irq(struct uart_8250_port *up) } serial_outp(up, UART_IER, 0x0f); /* enable all intrs */ (void)serial_inp(up, UART_LSR); - (void)serial_inp(up, UART_RX); + if (up->port.flags & UPF_NO_EMPTY_FIFO_READ) { + if (serial_inp(up, UART_LSR) & UART_LSR_DR) + (void)serial_inp(up, UART_RX); + } else + (void)serial_inp(up, UART_RX); (void)serial_inp(up, UART_IIR); (void)serial_inp(up, UART_MSR); serial_outp(up, UART_TX, 0xFF); @@ -1984,7 +1992,11 @@ static int serial8250_startup(struct uart_port *port) * Clear the interrupt registers. */ (void) serial_inp(up, UART_LSR); - (void) serial_inp(up, UART_RX); + if (up->port.flags & UPF_NO_EMPTY_FIFO_READ) { + if (serial_inp(up, UART_LSR) & UART_LSR_DR) + (void) serial_inp(up, UART_RX); + } else + (void) serial_inp(up, UART_RX); (void) serial_inp(up, UART_IIR); (void) serial_inp(up, UART_MSR); @@ -2141,7 +2153,11 @@ dont_test_tx_en: * routines or the previous session. */ serial_inp(up, UART_LSR); - serial_inp(up, UART_RX); + if (up->port.flags & UPF_NO_EMPTY_FIFO_READ) { + if (serial_inp(up, UART_LSR) & UART_LSR_DR) + serial_inp(up, UART_RX); + } else + serial_inp(up, UART_RX); serial_inp(up, UART_IIR); serial_inp(up, UART_MSR); up->lsr_saved_flags = 0; @@ -2207,7 +2223,11 @@ static void serial8250_shutdown(struct uart_port *port) * Read data port to reset things, and then unlink from * the IRQ chain. */ - (void) serial_in(up, UART_RX); + if (up->port.flags & UPF_NO_EMPTY_FIFO_READ) { + if (serial_inp(up, UART_LSR) & UART_LSR_DR) + (void) serial_inp(up, UART_RX); + } else + (void) serial_in(up, UART_RX); del_timer_sync(&up->timer); up->timer.function = serial8250_timeout; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index db532ce..0d65bb3 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -308,6 +308,7 @@ struct uart_port { #define UPF_SPD_WARP ((__force upf_t) (0x1010)) #define UPF_SKIP_TEST ((__force upf_t) (1 << 6)) #define UPF_AUTO_IRQ ((__force upf_t) (1 << 7)) +#define UPF_NO_EMPTY_FIFO_READ ((__force upf_t) (1 << 8)) #define UPF_HARDPPS_CD ((__force upf_t) (1 << 11)) #define UPF_LOW_LATENCY ((__force upf_t) (1 << 13)) #define UPF_BUGGY_UART ((__force upf_t) (1 << 14))