Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761651AbbKVDAt (ORCPT ); Sat, 21 Nov 2015 22:00:49 -0500 Received: from mail-bl2nam02on0055.outbound.protection.outlook.com ([104.47.38.55]:14880 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752724AbbKVC62 (ORCPT ); Sat, 21 Nov 2015 21:58:28 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; hurleysoftware.com; dkim=none (message not signed) header.d=none;hurleysoftware.com; dmarc=bestguesspass action=none header.from=xilinx.com; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Peter Hurley" , Soren Brinkmann Subject: [PATCH LINUX v3 09/10] tty: xuartps: Only handle RX IRQs when RX is enabled Date: Sat, 21 Nov 2015 18:59:31 -0800 Message-ID: <1448161172-19717-10-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.3.3.g9bb996a In-Reply-To: <1448161172-19717-1-git-send-email-soren.brinkmann@xilinx.com> References: <1448161172-19717-1-git-send-email-soren.brinkmann@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21954.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(6009001)(2980300002)(438002)(199003)(189002)(63266004)(87936001)(50226001)(76506005)(106466001)(19580395003)(5008740100001)(19580405001)(57986006)(5001960100002)(189998001)(50466002)(5007970100001)(107886002)(86362001)(92566002)(36386004)(4001430100002)(229853001)(50986999)(81156007)(5001770100001)(48376002)(33646002)(47776003)(11100500001)(5003940100001)(6806005)(586003)(2950100001)(77096005)(76176999)(36756003)(107986001)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2NAM02HT005;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:BL2NAM02HT005; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(10201501046);SRVR:BL2NAM02HT005;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT005; X-Forefront-PRVS: 076804FE30 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2015 02:58:24.0870 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT005 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3495 Lines: 103 Ignore RX-related interrupts if RX is not enabled. Signed-off-by: Soren Brinkmann --- drivers/tty/serial/xilinx_uartps.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index db9e23eaf300..3a1e508926c1 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -161,6 +161,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); * @pclk: APB clock * @baud: Current baud rate * @clk_rate_change_nb: Notifier block for clock changes + * @flags: Driver flags */ struct cdns_uart { struct uart_port *port; @@ -168,7 +169,11 @@ struct cdns_uart { struct clk *pclk; unsigned int baud; struct notifier_block clk_rate_change_nb; + u32 flags; }; + +#define CDNS_FLAG_RX_ENABLED BIT(0) + #define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \ clk_rate_change_nb); @@ -262,6 +267,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) static irqreturn_t cdns_uart_isr(int irq, void *dev_id) { struct uart_port *port = (struct uart_port *)dev_id; + struct cdns_uart *cdns_uart = port->private_data; unsigned long flags; unsigned int isrstatus, numbytes; @@ -272,7 +278,8 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) */ isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET); - cdns_uart_handle_rx(port, isrstatus); + if (cdns_uart->flags & CDNS_FLAG_RX_ENABLED) + cdns_uart_handle_rx(port, isrstatus); /* Dispatch an appropriate handler */ if ((isrstatus & CDNS_UART_IXR_TXEMPTY) == CDNS_UART_IXR_TXEMPTY) { @@ -579,11 +586,13 @@ static void cdns_uart_stop_tx(struct uart_port *port) static void cdns_uart_stop_rx(struct uart_port *port) { unsigned int regval; + struct cdns_uart *cdns_uart = port->private_data; regval = readl(port->membase + CDNS_UART_CR_OFFSET); regval |= CDNS_UART_CR_RX_DIS; /* Disable the receiver */ writel(regval, port->membase + CDNS_UART_CR_OFFSET); + cdns_uart->flags &= ~CDNS_FLAG_RX_ENABLED; } /** @@ -764,6 +773,7 @@ static int cdns_uart_startup(struct uart_port *port) { unsigned long flags; unsigned int retval = 0, status = 0; + struct cdns_uart *cdns_uart = port->private_data; retval = request_irq(port->irq, cdns_uart_isr, 0, CDNS_UART_NAME, (void *)port); @@ -790,6 +800,7 @@ static int cdns_uart_startup(struct uart_port *port) status &= CDNS_UART_CR_RX_DIS; status |= CDNS_UART_CR_RX_EN; writel(status, port->membase + CDNS_UART_CR_OFFSET); + cdns_uart->flags |= CDNS_FLAG_RX_ENABLED; /* Set the Mode Register with normal mode,8 data bits,1 stop bit, * no parity. @@ -833,6 +844,7 @@ static void cdns_uart_shutdown(struct uart_port *port) { int status; unsigned long flags; + struct cdns_uart *cdns_uart = port->private_data; spin_lock_irqsave(&port->lock, flags); @@ -844,6 +856,7 @@ static void cdns_uart_shutdown(struct uart_port *port) /* Disable the TX and RX */ writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS, port->membase + CDNS_UART_CR_OFFSET); + cdns_uart->flags &= ~CDNS_FLAG_RX_ENABLED; spin_unlock_irqrestore(&port->lock, flags); -- 2.6.3.3.g9bb996a -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/