From patchwork Fri Sep 18 11:08:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 7215131 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5CBA39F32B for ; Fri, 18 Sep 2015 11:08:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 727BD2095E for ; Fri, 18 Sep 2015 11:08:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DBCF2095D for ; Fri, 18 Sep 2015 11:08:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbbIRLIk (ORCPT ); Fri, 18 Sep 2015 07:08:40 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:36910 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbbIRLIk (ORCPT ); Fri, 18 Sep 2015 07:08:40 -0400 Received: from ayla.of.borg ([84.195.106.123]) by xavier.telenet-ops.be with bizsmtp id Jb8Y1r00t2fm56U01b8Y9A; Fri, 18 Sep 2015 13:08:38 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZctWq-0001Vm-Ax; Fri, 18 Sep 2015 13:08:32 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZctWw-0005O2-Uv; Fri, 18 Sep 2015 13:08:38 +0200 From: Geert Uytterhoeven To: Greg Kroah-Hartman , Jiri Slaby Cc: Muhammad Hamza Farooq , Magnus Damm , Yoshihiro Shimoda , Laurent Pinchart , Nobuhiro Iwamatsu , Yoshihiro Kaneko , Kazuya Mizuguchi , Koji Matsuoka , Wolfram Sang , Guennadi Liakhovetski , linux-serial@vger.kernel.org, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v4 03/10] serial: sh-sci: Submit RX DMA from RX interrupt on (H)SCIF Date: Fri, 18 Sep 2015 13:08:26 +0200 Message-Id: <1442574513-20648-4-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442574513-20648-1-git-send-email-geert+renesas@glider.be> References: <1442574513-20648-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 --- v4: - Dropped RFC status, - Rebased on top of "[PATCH] serial: sh-sci: Shuffle functions around", hence the forward declaration of sci_submit_rx() is no longer needed, and the declared-but-never-defined compiler warning if CONFIG_SERIAL_SH_SCI_DMA=n is gone. 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index eb2b369b1cf1be0b..02aaf4d213d9c280 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1317,7 +1317,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) @@ -1403,7 +1404,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); } } @@ -1442,6 +1444,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 */