From patchwork Fri Aug 21 18:25:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 7053551 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 6A845C05AC for ; Fri, 21 Aug 2015 18:25:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D42520434 for ; Fri, 21 Aug 2015 18:25:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64B122042C for ; Fri, 21 Aug 2015 18:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752561AbbHUSZx (ORCPT ); Fri, 21 Aug 2015 14:25:53 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:45788 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752573AbbHUSZt (ORCPT ); Fri, 21 Aug 2015 14:25:49 -0400 Received: from ayla.of.borg ([84.193.93.87]) by albert.telenet-ops.be with bizsmtp id 7WRm1r00G1t5w8s06WRmh0; Fri, 21 Aug 2015 20:25:48 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZSr0c-00081q-5C; Fri, 21 Aug 2015 20:25:46 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZSr0d-0001vC-W9; Fri, 21 Aug 2015 20:25:47 +0200 From: Geert Uytterhoeven To: linux-sh@vger.kernel.org Cc: Magnus Damm , Yoshihiro Shimoda , Laurent Pinchart , Nobuhiro Iwamatsu , Yoshihiro Kaneko , Kazuya Mizuguchi , Koji Matsuoka , Wolfram Sang , Guennadi Liakhovetski , linux-serial@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC v3 3/4] serial: sh-sci: Submit RX DMA from RX interrupt on (H)SCIF Date: Fri, 21 Aug 2015 20:25:45 +0200 Message-Id: <1440181546-7334-4-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440181546-7334-1-git-send-email-geert+renesas@glider.be> References: <1440181546-7334-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=-7.7 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 For DMA receive requests, the driver is only notified by DMA completion after the whole DMA request has been transferred. If less data is received, it will stay stuck until more data arrives. The driver handles this by setting up a timer handler from the receive interrupt, after reception of the first character. Unlike SCIFA and SCIFB, SCIF and HSCIF don't issue receive interrupts on reception of individual characters if a receive DMA request is in progress, so the timer is never set up. To fix receive DMA on SCIF and HSCIF, submit the receive DMA request from the receive interrupt handler instead. In some sense this is similar to the SCIFA/SCIFB behavior, where the RDRQE (Rx Data Transfer Request Enable) bit is also set from the receive interrupt handler. Signed-off-by: Geert Uytterhoeven --- v3: - New, this replaces the one-byte DMA transfer from "[PATCH/RFC v2 28/29] serial: sh-sci: Add (H)SCIF DMA support". --- drivers/tty/serial/sh-sci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 0b6a367ac343221c..b18e2e64f163ca48 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -939,6 +939,8 @@ static int sci_handle_breaks(struct uart_port *port) return copied; } +static void sci_submit_rx(struct sci_port *s); + static irqreturn_t sci_rx_interrupt(int irq, void *ptr) { #ifdef CONFIG_SERIAL_SH_SCI_DMA @@ -955,6 +957,7 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) scr |= SCSCR_RDRQE; } else { scr &= ~SCSCR_RIE; + sci_submit_rx(s); } serial_port_out(port, SCSCR, scr); /* Clear current interrupt */ @@ -1672,7 +1675,8 @@ static void rx_timer_fn(unsigned long arg) spin_unlock_irqrestore(&port->lock, flags); - sci_submit_rx(s); + if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) + sci_submit_rx(s); } static void sci_request_dma(struct uart_port *port) @@ -1758,7 +1762,8 @@ static void sci_request_dma(struct uart_port *port) setup_timer(&s->rx_timer, rx_timer_fn, (unsigned long)s); - sci_submit_rx(s); + if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) + sci_submit_rx(s); } }