From patchwork Fri Sep 12 08:51:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 4892781 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 369DBBEEA5 for ; Fri, 12 Sep 2014 08:52:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BCB5720221 for ; Fri, 12 Sep 2014 08:52:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EF6D2012E for ; Fri, 12 Sep 2014 08:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859AbaILIwD (ORCPT ); Fri, 12 Sep 2014 04:52:03 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:36197 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbaILIwC (ORCPT ); Fri, 12 Sep 2014 04:52:02 -0400 Received: by mail-la0-f54.google.com with SMTP id ge10so511007lab.27 for ; Fri, 12 Sep 2014 01:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XyMKPMUIe+jKduxZBVZZEe69g8wc643m62Q1tI3JbfA=; b=Xg0fTKv1li0IWiaiq5bHy4vR8wGKFWw8LtW9VJQQvvIso2WPfu0/ry3O//5TNHtLic p6zhkTL9NQZxaN0NHtJrzPrLQYeUvOjON6waaVvDzSvYxRbq/kxsNC0Sxtt9ZC4iLIDb ZqnNrTo5Tvud0+YfuyrXrh2EezRG+0YCn+0/v4w7xHsztx3sBbREnwSjBQHK1fj1APPb Ni7k7I6wLdiagfCOi55IEdpmVBA8igiKySgvIrHJZAsrvX4uuvCp9lnsbcPYPjKZmM+q 70sqbeDfedNVlHHsig6SH14ol1004wYsVNCION9SIYv+QeMi3juXtoZgKY0anxVkvpb7 xA6Q== X-Received: by 10.152.3.35 with SMTP id 3mr7300296laz.5.1410511919842; Fri, 12 Sep 2014 01:51:59 -0700 (PDT) Received: from groucho.site ([185.3.135.58]) by mx.google.com with ESMTPSA id cm9sm1107745lbb.39.2014.09.12.01.51.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Sep 2014 01:51:59 -0700 (PDT) From: Ulrich Hecht To: linux-sh@vger.kernel.org, linux-serial@vger.kernel.org Cc: horms@verge.net.au, magnus.damm@gmail.com, Ulrich Hecht Subject: [RFC 1/3] serial: sh-sci: consider DR (data ready) bit adequately Date: Fri, 12 Sep 2014 10:51:46 +0200 Message-Id: <1410511908-9282-2-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1410511908-9282-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1410511908-9282-1-git-send-email-ulrich.hecht+renesas@gmail.com> 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SBL, RP_MATCHES_RCVD, T_DKIM_INVALID,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 To allow operation with a higher RX FIFO interrupt threshold it is necessary to consider the DR bit ("FIFO not full, but no data received for 1.5 frames") as an indicator that data can be read. Otherwise the driver will let data rot in the FIFO until the threshold is reached. Signed-off-by: Ulrich Hecht --- drivers/tty/serial/sh-sci.c | 9 +++++---- drivers/tty/serial/sh-sci.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 3081e46..f0ff8a7 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -483,7 +483,7 @@ static int sci_poll_get_char(struct uart_port *port) break; } while (1); - if (!(status & SCxSR_RDxF(port))) + if (!(status & (SCxSR_RDxF(port) | SCxSR_DR(port)))) return NO_POLL_CHAR; c = serial_port_in(port, SCxRDR); @@ -572,7 +572,8 @@ static int sci_rxfill(struct uart_port *port) if (reg->size) return serial_port_in(port, SCFDR) & ((port->fifosize << 1) - 1); - return (serial_port_in(port, SCxSR) & SCxSR_RDxF(port)) != 0; + return (serial_port_in(port, SCxSR) & + (SCxSR_RDxF(port) | SCxSR_DR(port))) != 0; } /* @@ -663,7 +664,7 @@ static void sci_receive_chars(struct uart_port *port) unsigned char flag; status = serial_port_in(port, SCxSR); - if (!(status & SCxSR_RDxF(port))) + if (!(status & (SCxSR_RDxF(port) | SCxSR_DR(port)))) return; while (1) { @@ -1014,7 +1015,7 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) * Rx Interrupt: if we're using DMA, the DMA controller clears RDF / * DR flags */ - if (((ssr_status & SCxSR_RDxF(port)) || s->chan_rx) && + if (((ssr_status & (SCxSR_RDxF(port) | SCxSR_DR(port))) || s->chan_rx) && (scr_status & SCSCR_RIE)) ret = sci_rx_interrupt(irq, ptr); diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h index d5db81a..9c4598d 100644 --- a/drivers/tty/serial/sh-sci.h +++ b/drivers/tty/serial/sh-sci.h @@ -8,6 +8,7 @@ #define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER) #define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER) #define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK) +#define SCxSR_DR(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_DR) #define SCxSR_ERRORS(port) (to_sci_port(port)->error_mask)