From patchwork Mon Sep 12 13:34:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 9326523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A23826077F for ; Mon, 12 Sep 2016 13:37:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 916F528D13 for ; Mon, 12 Sep 2016 13:37:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 860AE28DE5; Mon, 12 Sep 2016 13:37:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 808B828D13 for ; Mon, 12 Sep 2016 13:36:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bjROY-0005vN-6j; Mon, 12 Sep 2016 13:35:34 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bjROS-0005Fk-VQ for linux-arm-kernel@lists.infradead.org; Mon, 12 Sep 2016 13:35:29 +0000 Received: by mail-wm0-x242.google.com with SMTP id a6so13645374wmc.2 for ; Mon, 12 Sep 2016 06:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=RAJmmyq8Te9b95KON8+/djPfAUe5AYEgqputm4xgqss=; b=gDwzvxOTms/FEuo0CMmg5Qe3QJgyYgt5fwnY7qDUyfFZhaMOlWHckua0hbJ1LJTzQR r4nQEArLdzjZtKJqET4+CDM9z97EYC36SVozd0EbP35WBzxFWhhsTeNJ9Om9pT5FR7T8 AErYzkg6Q7MzMagFNcl/kZS5gYJAZJkjY05IGhE1Atk7u5qu2GpwKI78eBg4n0JBEdPr nJr7twb+O3zdB91SsZjjZiqqinc6iZra6qVgkfOh+t6sO7z3YJukHAxHy8lHcbAoa6f7 3dHC+uU4bjflfcLpLb6l2a09NYMw8FR1kbV0BEGCLSffRZDp6NYY5pKKiYWBkzCteX92 woCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RAJmmyq8Te9b95KON8+/djPfAUe5AYEgqputm4xgqss=; b=nG7QVHAEfKYeZ9n6iJpXUt2b6l3zAif3Pa8KKL2pxOwNQrf/3mFIMV5S3al39RpEx9 roGy6HweqOjj4oYVfOha0+jyccr6GxEX69CP0KX4lTHcCi2HUkKJ1qZRZ5404Zpnf65n EMr/6EupdQ+S0c/Yfuk6X5gm+209hN+J+m6L/yoGHzF6cqyKDG7chP+MtpwWq0UX8D9v cUXz4I5QLrN/SmWhURqjXz5r/X2FYYzJZkibVRGHo5muD8PpqRQVAI61LgR5sUPgyU3s vqkK4ZL91oe7FWEArEIK+11AxYpkOAaAdCW7SmgVjju8xac/Naj5kh6LwIEGe3GwkHq/ Y8Og== X-Gm-Message-State: AE9vXwNl9tt0s0aXdE66rZBoIPs/Z6PZyCdb5faweIFsByRwyGHkdqCzzquc3VI4JcDTYg== X-Received: by 10.194.133.104 with SMTP id pb8mr15268413wjb.139.1473687307250; Mon, 12 Sep 2016 06:35:07 -0700 (PDT) Received: from localhost ([46.227.18.67]) by smtp.gmail.com with ESMTPSA id g7sm17900083wjx.10.2016.09.12.06.35.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2016 06:35:06 -0700 (PDT) From: Richard Genoud To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Nicolas Ferre , Alexandre Belloni , Greg Kroah-Hartman Subject: [PATCH] BUG: atmel_serial: Interrupts not disabled on close Date: Mon, 12 Sep 2016 15:34:41 +0200 Message-Id: <20160912133441.14597-1-richard.genoud@gmail.com> X-Mailer: git-send-email 2.10.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160912_063529_177487_B37855DC X-CRM114-Status: GOOD ( 13.80 ) 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, Richard Genoud , Cyrille Pitchen , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), interrupts from GPIOs are not disabled any more when the serial port is closed, leading to an oops when the one of the input pin is toggled (CTS/DSR/DCD/RNG). This is only the case if those pins are used as GPIOs, i.e. declared like that: usart1: serial@f8020000 { /* CTS and DTS will be handled by GPIO */ status = "okay"; rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>; cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>; dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>; dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>; rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>; dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>; }; That's because modem interrupts used to be freed in atmel_shutdown(). After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), this code was just removed. Calling atmel_disable_ms() disables the interrupts and everything works fine again. Tested on at91sam9g35-cm (This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will be sent after this one is applied.) Signed-off-by: Richard Genoud Fixes: 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio") Acked-by: Uwe Kleine-König Acked-by: Nicolas Ferre --- drivers/tty/serial/atmel_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 2eaa18ddef61..8bbde52db376 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1929,6 +1929,9 @@ static void atmel_shutdown(struct uart_port *port) { struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); + /* Disable modem control lines interrupts */ + atmel_disable_ms(port); + /* Disable interrupts at device level */ atmel_uart_writel(port, ATMEL_US_IDR, -1); @@ -1979,8 +1982,6 @@ static void atmel_shutdown(struct uart_port *port) */ free_irq(port->irq, port); - atmel_port->ms_irq_enabled = false; - atmel_flush_buffer(port); }