From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Ogness Subject: [PATCH 3/3] serial: 8250: omap: restore registers on shutdown Date: Fri, 31 Jul 2015 00:54:45 +0200 Message-ID: <87egjp2r4a.fsf@linutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Sender: linux-kernel-owner@vger.kernel.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Tony Lindgren , Peter Hurley , Sebastian Andrzej Siewior , linux-omap@vger.kernel.org, nsekhar@ti.comtony@atomide.com, nm@ti.com, linux-serial@vger.kernel.org List-Id: linux-omap@vger.kernel.org If DMA is active during a shutdown, a delayed restore of the registers may be pending. The restore must be performed after the DMA is stopped, otherwise the delayed restore remains pending and will fire upon the first DMA TX complete of a totally different serial session. Signed-off-by: John Ogness --- drivers/tty/serial/8250/8250_omap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 5b39892..25f6255 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -657,9 +657,15 @@ static void omap_8250_shutdown(struct uart_port *port) up->ier = 0; serial_out(up, UART_IER, 0); - if (up->dma) + if (up->dma) { serial8250_release_dma(up); + if (priv->delayed_restore) { + priv->delayed_restore = 0; + omap8250_restore_regs(up); + } + } + /* * Disable break condition and FIFOs */ -- 1.7.10.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635AbbG3Wyx (ORCPT ); Thu, 30 Jul 2015 18:54:53 -0400 Received: from www.linutronix.de ([62.245.132.108]:48992 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752541AbbG3Wyv (ORCPT ); Thu, 30 Jul 2015 18:54:51 -0400 From: John Ogness To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman Cc: Tony Lindgren Cc: Peter Hurley Cc: Sebastian Andrzej Siewior Cc: linux-omap@vger.kernel.org Cc: nsekhar@ti.com Cc: tony@atomide.com Cc: nm@ti.com Cc: linux-serial@vger.kernel.org Subject: [PATCH 3/3] serial: 8250: omap: restore registers on shutdown Date: Fri, 31 Jul 2015 00:54:45 +0200 Message-ID: <87egjp2r4a.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If DMA is active during a shutdown, a delayed restore of the registers may be pending. The restore must be performed after the DMA is stopped, otherwise the delayed restore remains pending and will fire upon the first DMA TX complete of a totally different serial session. Signed-off-by: John Ogness --- drivers/tty/serial/8250/8250_omap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 5b39892..25f6255 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -657,9 +657,15 @@ static void omap_8250_shutdown(struct uart_port *port) up->ier = 0; serial_out(up, UART_IER, 0); - if (up->dma) + if (up->dma) { serial8250_release_dma(up); + if (priv->delayed_restore) { + priv->delayed_restore = 0; + omap8250_restore_regs(up); + } + } + /* * Disable break condition and FIFOs */ -- 1.7.10.4