From patchwork Thu Jul 16 18:21:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 6810141 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 9EB2FC05AC for ; Thu, 16 Jul 2015 18:22:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA49A20684 for ; Thu, 16 Jul 2015 18:22:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E39220698 for ; Thu, 16 Jul 2015 18:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756238AbbGPSWN (ORCPT ); Thu, 16 Jul 2015 14:22:13 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:33409 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756242AbbGPSWG (ORCPT ); Thu, 16 Jul 2015 14:22:06 -0400 Received: from ayla.of.borg ([84.193.93.87]) by albert.telenet-ops.be with bizsmtp id t6N31q0061t5w8s066N3Ay; Thu, 16 Jul 2015 20:22:04 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZFnnG-00008D-MU; Thu, 16 Jul 2015 20:22:02 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZFnnH-0007M3-Bt; Thu, 16 Jul 2015 20:22:03 +0200 From: Geert Uytterhoeven To: Magnus Damm , Laurent Pinchart , Nobuhiro Iwamatsu , Yoshihiro Kaneko , Kazuya Mizuguchi , Koji Matsuoka , Wolfram Sang , Guennadi Liakhovetski Cc: linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC v2 24/29] serial: sh-sci: Stop TX and RX on shutdown Date: Thu, 16 Jul 2015 20:21:55 +0200 Message-Id: <1437070920-28069-25-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437070920-28069-1-git-send-email-geert+renesas@glider.be> References: <1437070920-28069-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Make sure the transmitter and receiver are stopped when shutting down the port, to avoid new RX DMA requests to arrive. Inspired by a patch in the BSP by Koji Matsuoka . Signed-off-by: Geert Uytterhoeven --- drivers/tty/serial/sh-sci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 9714fc1b72b3cf8c..dda1f7b13497817a 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1846,12 +1846,16 @@ static void sci_shutdown(struct uart_port *port) { struct sci_port *s = to_sci_port(port); unsigned long flags; + u16 scscr; dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); spin_lock_irqsave(&port->lock, flags); sci_stop_rx(port); sci_stop_tx(port); + scscr = serial_port_in(port, SCSCR); + scscr &= ~(SCSCR_TE | SCSCR_RE); + serial_port_out(port, SCSCR, scscr); spin_unlock_irqrestore(&port->lock, flags); sci_free_dma(port);