From patchwork Thu Nov 19 20:02:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 7661191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 70C1CBF90C for ; Thu, 19 Nov 2015 20:06:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9322B20459 for ; Thu, 19 Nov 2015 20:06:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCF8620458 for ; Thu, 19 Nov 2015 20:06:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzVRV-0004zd-5M; Thu, 19 Nov 2015 20:04:29 +0000 Received: from mail-bl2nam02on0058.outbound.protection.outlook.com ([104.47.38.58] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzVOe-0002oO-3B for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2015 20:01:37 +0000 Received: from CY1NAM02FT056.eop-nam02.prod.protection.outlook.com (10.152.74.53) by CY1NAM02HT215.eop-nam02.prod.protection.outlook.com (10.152.75.55) with Microsoft SMTP Server (TLS) id 15.1.331.11; Thu, 19 Nov 2015 20:01:09 +0000 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; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by CY1NAM02FT056.mail.protection.outlook.com (10.152.74.160) with Microsoft SMTP Server (TLS) id 15.1.331.11 via Frontend Transport; Thu, 19 Nov 2015 20:01:08 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:55494 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1ZzVOG-0005Zu-Cg; Thu, 19 Nov 2015 12:01:08 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1ZzVOG-0003id-7F; Thu, 19 Nov 2015 12:01:08 -0800 Received: from xsj-pvapsmtp01 (xsj-mail.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id tAJK0xuB027480; Thu, 19 Nov 2015 12:00:59 -0800 Received: from [172.19.74.49] (helo=localhost) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ZzVO7-0003f8-G1; Thu, 19 Nov 2015 12:00:59 -0800 From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151119_120132_511151_3B708469 X-CRM114-Status: GOOD ( 14.76 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Soren Brinkmann , Michal Simek , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);