Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161490AbbKSURL (ORCPT ); Thu, 19 Nov 2015 15:17:11 -0500 Received: from mail-bl2nam02on0054.outbound.protection.outlook.com ([104.47.38.54]:2710 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030293AbbKSURI (ORCPT ); Thu, 19 Nov 2015 15:17:08 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Soren Brinkmann" Subject: [PATH RESEND v2 09/10] tty: xuartps: Only handle RX IRQs when RX is enabled Date: Thu, 19 Nov 2015 12:02:23 -0800 Message-ID: <1447963344-16266-10-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.3.3.g9bb996a In-Reply-To: <1447963344-16266-1-git-send-email-soren.brinkmann@xilinx.com> References: <1447963344-16266-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-21950.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.100;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(50466002)(5003940100001)(5008740100001)(36756003)(33646002)(36386004)(229853001)(81156007)(4001430100002)(189998001)(586003)(77096005)(48376002)(92566002)(6806005)(2950100001)(107886002)(5001770100001)(5001960100002)(76506005)(63266004)(50986999)(106466001)(47776003)(57986006)(11100500001)(5007970100001)(86362001)(19580405001)(50226001)(19580395003)(87936001)(76176999)(107986001)(5001870100001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1NAM02HT215;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:CY1NAM02HT215; 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)(5005006)(8121501046)(10201501046)(3002001);SRVR:CY1NAM02HT215;BCL:0;PCL:0;RULEID:;SRVR:CY1NAM02HT215; X-Forefront-PRVS: 07658B8EA3 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2015 20:01:08.8914 (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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT215 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 aa1176e6661a..413229661f5d 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) { @@ -576,11 +583,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; } /** @@ -761,6 +770,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); @@ -787,6 +797,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. @@ -830,6 +841,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); @@ -841,6 +853,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/