From patchwork Fri Dec 9 12:36:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 9468107 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1ED60607D8 for ; Fri, 9 Dec 2016 12:36:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1293628624 for ; Fri, 9 Dec 2016 12:36:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0768E28632; Fri, 9 Dec 2016 12:36:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7B3928624 for ; Fri, 9 Dec 2016 12:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933562AbcLIMgU (ORCPT ); Fri, 9 Dec 2016 07:36:20 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:34761 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933553AbcLIMgT (ORCPT ); Fri, 9 Dec 2016 07:36:19 -0500 Received: by mail-wj0-f193.google.com with SMTP id xy5so2298628wjc.1; Fri, 09 Dec 2016 04:36:18 -0800 (PST) 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=okGT3e9jVhj9CEj0aHxjQ1JK9v7UH7dm+tJBD76BbjE=; b=zQrmlwvFEy0t/tdkjIWZfwX7mE+/NQpNcDoRAC/TcZXET03/ay5M9mneYU5vQtOq9r 7fhUC+PsooSXfuKUOfxKFnQjOq0qX7/88j4M6Q07f7PjXm2hgswDgwos+qMMf4q94aFo n9O/aZEOEhb1km3scfp8YQadMncBB7wba8b5SbCTkheAV5ptPxH6cVPVEZoGuAAFP4cx 7nqEcAVlCDgyQrv7z83tAM0l7SlpfFZGkO3EeWwbt+Z1NnuSVE0gwnFPeRhq9IfPgki8 0kAtPAEtOdKeCVB541ztW+xNcSeipVUlIN+AU4MFKX3SX4bMY66c2O2ujDR7SwwC94x2 RfiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=okGT3e9jVhj9CEj0aHxjQ1JK9v7UH7dm+tJBD76BbjE=; b=a921CAtZUv0NX2zB/56P6TXQg/n4gRQwHpV7WW+ABQ3ETn7TQwzz6C1vFa4EM3az9b p00XVu9L5Qt+wz7URAQeRRvMUbpGglokTQAqKd0j9tDyRICGn114k6P5k9VwLxRqvUGY 3GTMVhBkpowbW6hKCjplVhpwCoY4ZCGwHjdBSLxlp99LsN12QYY0kPFooOPr2UCben/8 pQyQYRESA5RY2Q10BsV/AOKL75xhW3HD+5um10EmMP6/R/Ljd9SWSFFttfyZp/j/k00Y S/O0M05fG+7nz3qdW/uBQbWnjd4b7CGmpphHLc4i1ZYIwHDcB/0Q7Wu1TApmGm+V+q0a M5mQ== X-Gm-Message-State: AKaTC00efs1VVUabvbLSBb9GpQ8JfGzhqEQHLswZDxecKhUdAmEAbAp4pkbb0tWgENDpfQ== X-Received: by 10.194.21.35 with SMTP id s3mr67688300wje.192.1481286977792; Fri, 09 Dec 2016 04:36:17 -0800 (PST) Received: from groucho.site (ipbcc17b88.dynamic.kabel-deutschland.de. [188.193.123.136]) by smtp.gmail.com with ESMTPSA id d10sm42068758wja.20.2016.12.09.04.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 04:36:17 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, wsa@the-dreams.de, geert@linux-m68k.org Cc: linux-serial@vger.kernel.org, magnus.damm@gmail.com, Ulrich Hecht Subject: [PATCH 2/7] serial: sh-sci: consider DR (data ready) bit adequately Date: Fri, 9 Dec 2016 13:36:06 +0100 Message-Id: <1481286971-16667-3-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481286971-16667-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1481286971-16667-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To allow operation with a higher RX FIFO interrupt threshold in PIO mode, 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 385afbe..de25db8 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -677,7 +677,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); @@ -773,7 +773,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; } /* @@ -864,7 +865,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) { @@ -1672,7 +1673,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 f51f919..44997a5 100644 --- a/drivers/tty/serial/sh-sci.h +++ b/drivers/tty/serial/sh-sci.h @@ -156,6 +156,7 @@ enum { #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)