Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030219AbbKDAVP (ORCPT ); Tue, 3 Nov 2015 19:21:15 -0500 Received: from mail-by2on0084.outbound.protection.outlook.com ([207.46.100.84]:9166 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932128AbbKDAVJ (ORCPT ); Tue, 3 Nov 2015 19:21:09 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Soren Brinkmann" Subject: [PATCH 9/9] tty: xuartps: Only handle RX IRQs when RX is enabled Date: Tue, 3 Nov 2015 16:20:50 -0800 Message-ID: <1446596450-20918-10-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21918.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD025;1:rTK+OGEzqX8v1hL3Dawph3+qwpfE5YmosdxD6yylGMF0O39vF9yN4mMcXzm5n98YN0rvx7MibWu9hRVzL876TC2eXo/keDQoNf2jFG/jP8VpdNggCWeV4XaIIvHj1ydLyhFcEkQPE9OVRAuRS87ZFWheucuRSya7VeN6DGcsOPUSqyl1YN/pOpSmwD1zQcw5uI+lr2W6YmVdYPL33nvPumtohojal3wRdLpdf+tv4fVdTMbsZZxowT5XRfIr0OtHtQRE6/IwK3abjakNOjrtxoz5hIFAxs7SE5mKWnvCQ2QogMjaFb7XxGf5jWHnsK2p8Y2w4xfnh+uENC75TREsdV/y1tUfanPQ/JvvYbAhBks= X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(19580405001)(47776003)(33646002)(19580395003)(189998001)(229853001)(16796002)(50226001)(50986999)(76176999)(107886002)(5001960100002)(5007970100001)(11100500001)(5003940100001)(5008740100001)(5001920100001)(86362001)(87936001)(50466002)(4001430100002)(6806005)(2950100001)(106466001)(77096005)(76506005)(5001770100001)(92566002)(63266004)(57986006)(81156007)(36386004)(36756003)(48376002)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2FFO11HUB042;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB042;2:ViKEIHCYwjaezZv96fDhgxFc7NaLnPeQt85cMRAuqShd95rjAa9F20Gr0/o/vP9ewbBKfiDCX+ZvNcPhm2MwJ8jm5jQIdu8/gCxQjK4DIv6dtLFxF4WIIA3VaNS4djr124XTK2D1HDXc9F0G00omnRq2exywEYD6LBKFunp5j5g=;3:2UXXP73YuE3pP4PMNrxKmv7OLu3piWDrnr1AkCCFXyDpi/6KNpmjE8deqD3VPcFDcuZOe8vaM+wyxsv32TUPZyuq18Zl7JOE2YJCDNIGlAYq8KocJlhCLiXf1GFoWPit+D3M+Jntw6MZTsPbSAItcivXqRyOma02U37DYF1EEcfAze2sjgaiDdcK5rXvTIQzjc93FTHB3EgPWxu/VIT0p8OtmVY22rHSBSS5uKnJI8U/WKUSg60QPDQYNVnqvBbw4RFS7BuadlnqaDwbULgu6A==;25:aeCG6WkZm65H07/HozSyCD3/PeZ8hWqeCHpr2TuqWTUc1rXjhatLE+PQpjQ3Wb6BJcbBLThXaFcPlWBYsuYY7QJd5qrauo4fOLNIZAW3l4I1Ktlr03mve3P1bkfk68yErXXbqeNkJ/xsLZ90zOPX/phO2OHVX2Ttm1e8XYL7aNfl2imY9+d9rEgIld6JftETBs4s3++jQQooGaIf5nPcnE9GmpvKEKExS1ozhRwMm2n/h/rjvsN7B++/TVb6V0ddaryfkGoZCFx3q7GK3K72Rw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:BY2FFO11HUB042; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB042;20:5APlsy9HRjPACLynyaxLHXWG8mAB8UmufrzS4qwhrUl0UkIAmXevD9Y4dS6dOMKH1AyZLUPMosq45YG4P6brMiq/8L0UXuxkE61xsectehxFT/BW+hqxOkXYuFrLzDUyailz8+F1EV0FAAs+Eaf5oOR0omiZNNzzoRwz2XvW0cE9ydocqBbOOCU7OBf/+4WL79R7yHJuOLXn/qVvIqd37+nu0QDetiPGDVfxidBzMhPhr9hISEEDvBJokeTJhWhofSSEfeBl7unIo1sjhOifnSTKJpMQP/n1ON6QIDk086t4DDG9MtBg308Py2l7nIMq6Z/HNtMHlud4gPQeYQHGSIV5j/Li4AE27/iTLo0AA5R6PvI//gyaK3Ew3AHqmcigBtoxK06b05KJfMm0O6G4afAUMRzic6c8sSAa92VyzuJAEbFevB3jEmLmhFk4KBzTBNHxuA6W9N2gjFq3EDVbCIwIg0vwljVBcu22LHwURXLMSAgfzX9OVo/SbXjAvnoS;4:XWWWDbN7aum+slRffC8+9XGfNrwnvCfnbWDgpytW3B5qap6uvJGf6s9mC8Lf6K5ZQpOYEBQoF57VsnxmcRFOKIxEfUCsVjqRIz6DBHIWuvp592uChTfjrkN/aJLbSWzT+BmNoTAltGjO7474zHz9VpULOCqu7Krza6rtthp/bRCbQElFGOIt3zlGxONdTGH1DXOXblNsJC2Nt3HFQlVmUDDRNb0+ybuQwb1g0XF4FICiBZXYhQ6/djsQnb2kodvXDXBW7IRUmhRN5OEfSMWQeLnNPp8HV6E/rVzDWkmo1APoYqn9eFS0T/GngnSQ4XTCZHJSFx7j0g6XATexXiWTdlXdovAHdALjXUJXwvKNe2T8tPxKyXg8y1ysuHPChHau X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:BY2FFO11HUB042;BCL:0;PCL:0;RULEID:;SRVR:BY2FFO11HUB042; X-Forefront-PRVS: 0750463DC9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2FFO11HUB042;23:i221GoiMDc+WPNW4ubic9tCwWlEG46B6AC/sxmbw?= =?us-ascii?Q?Tgn4WD0NKQY7RA3HUBXWxUaMoPgqg+Kew1ZM5B0hNnkqAON4P4gwA4Nstlqn?= =?us-ascii?Q?5qvz7csmGPT6Dsu0TJ3fh9wd/F9nX4SCDQqtdKanbAB7RbzofrcHCnDIa3Od?= =?us-ascii?Q?a8p1x86jw8KTNzyVQj0abVT5Bvq1ujCD9iJ/UQgP/Xtayud0IlMRql1sVutY?= =?us-ascii?Q?nls9PmLGB2bCM01L3FgjmlTDulyZE3a74p1dPxMYBjHAJPOd+1AUPWnVjh6i?= =?us-ascii?Q?BcFFM0rLlotUTjnfxToklTck3qbo6xBxBOdkNmc2rape4MctJAVn4GdHbwbr?= =?us-ascii?Q?ynvC3qNJp+ZKp433wpyDOGwG6th+raxxy7/ohlyXqTaAdVzQzk5UK4gdffDq?= =?us-ascii?Q?XTtD4M7W6nPKtubMLNZIXfAoma6sreQWbTl2w7RrpAcfcnv5P7/uxdoxiqAG?= =?us-ascii?Q?PJSaAB+9RtCt/U862jc68hGyAMmLVfVMB72aR3gjEAgJLM/Ivr4jSbVMMCXn?= =?us-ascii?Q?9WWAaJxcu3oz0Gktwk41szj+qsSrDqQ1T3Soghnz06UDsJDvo/fuM26G6YXd?= =?us-ascii?Q?XXFpL+hm6uLu944yRaAmpx2h+Kl7jaOnbWeH+d+nEN78xWj3uxMmDpvgGpWS?= =?us-ascii?Q?2KYDmUxUAVx54CKkdETE19INFhxPV9SZCmomsC8Fju5IZRQKSJwmxbdU1B4q?= =?us-ascii?Q?98szwM/owVm7wLVkOVxiudrZeotn8RLlL0my2CceXZwNhgmYrVwzdkCKYNg1?= =?us-ascii?Q?FNRkwyj02TjVHEfmGOTQADqyxuFFAKMi7Yl1UtNLt1flqbMi+kIQ8LuP6CkI?= =?us-ascii?Q?g46lkfeMptY49APWmYeZXf7/WLzTFMmnVpMlalSJps9LaW74YF7N7S7ACvch?= =?us-ascii?Q?Mox+4KqAhkWeihah267UqAl8feZOSa5Ol7SvDbxuazRZMdNGHhu1nGMB3uN+?= =?us-ascii?Q?mNfF41ahqmkzurcpcWWxZbS6+2dHzN74H/xbvrIHZRv63oA0PYHtOX0R42nw?= =?us-ascii?Q?dJyoe+794ybD1+VtwT7M10zSst9Et7fOUtFtvFG76H0t+bBsdzcr7x6Qc8LG?= =?us-ascii?Q?856HXTG7sgD5fP/2XCmGLkcJ4fkJu/XszI+SZuV+No5+RLtQWBLpTA0gFPCC?= =?us-ascii?Q?64hVDDLbkcg=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB042;5:JRiAJg1EuWegpqkeTz6VWXgU4LBHTSG5gi33SQCKl0FuBG3n4pamSP6w7tv4sep4TULW1hJWUEeXCxCOTEAEPb66PV/UWIFMgdwKEBG3S9mG8AhjeXirSxPOSBtX6+unzjxbuaWZbmeD1C+WjrS8qw==;24:lrfxjyFqQQEoVLSKZscGOu7PgxrD/3AT16hzygEWSuxB1/uiRG7gEZUD763IqKgIVwpwax1/cYdV+8oRwQOUrW+186l3fyESHF8JPuC3fTw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2015 00:21:07.2010 (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: BY2FFO11HUB042 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 149868cc003c..76a060a68934 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.2.3.ga463a5b -- 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/