From patchwork Mon Dec 15 14:14:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Kaneko X-Patchwork-Id: 5493051 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B21B9F1D4 for ; Mon, 15 Dec 2014 14:15:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEAEA20A03 for ; Mon, 15 Dec 2014 14:15:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6A2920995 for ; Mon, 15 Dec 2014 14:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751047AbaLOOPF (ORCPT ); Mon, 15 Dec 2014 09:15:05 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:57218 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbaLOOPC (ORCPT ); Mon, 15 Dec 2014 09:15:02 -0500 Received: by mail-pa0-f53.google.com with SMTP id kq14so11733599pab.26 for ; Mon, 15 Dec 2014 06:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=GSzf/W636uFXmSbvilTckKsPdsMXW09p4riu/MRbKt0=; b=XxJSqcAPDhfgVyc6ma+bL4OwkzO2pTp+4K73Kb6tP6h1kaWv7mQ/sMkGOFWjJvHWZA oIgsg/oSg6YgBZ2kx8peEUKtqbDwcsRzZeDYDJ6OYFVnSkiOHGn/udMO2gHxdDojAO2J nb/Xppp3a98HCXahB9o9bFlLJ9hzIZl/c0AE5uJAw8vhpfoh/GCqNWjLUBtTVyfB2K7r USTID4LE9I9ANmcLrihGpnysiq/mB1S5wgA5+HLPObxaxI4CVZyeax9LckoIMoU3umK3 qFbt150EgFwMr05zFVKX5ZsQwC09C7PczZr57Xj4QRX/Rl8wJkjCe7SHieJVwhcAcIkX VZ7g== X-Received: by 10.70.45.17 with SMTP id i17mr3212148pdm.13.1418652901819; Mon, 15 Dec 2014 06:15:01 -0800 (PST) Received: from localhost.localdomain (KD118152108246.ppp-bb.dion.ne.jp. [118.152.108.246]) by mx.google.com with ESMTPSA id th7sm9501897pac.47.2014.12.15.06.15.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Dec 2014 06:15:01 -0800 (PST) From: Yoshihiro Kaneko To: linux-serial@vger.kernel.org Cc: Greg Kroah-Hartman , Simon Horman , Magnus Damm , linux-sh@vger.kernel.org Subject: [PATCH/RFC] serial: sh-sci: Fix R-Car SCIF and HSCIF overrun handling Date: Mon, 15 Dec 2014 23:14:43 +0900 Message-Id: <1418652883-6884-1-git-send-email-ykaneko0929@gmail.com> X-Mailer: git-send-email 1.9.1 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 From: Hisashi Nakamura When fifo overrun happened, the interrupt status refers to SCLSR register in R-Car SCIF and HSCIF. Thus, overrun handling takes SCLSR register into account. Signed-off-by: Hisashi Nakamura Signed-off-by: Yoshihiro Kaneko --- This patch is based on the tty-next branch of Greg Kroah-Hartman's tty tree. drivers/tty/serial/sh-sci.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 1110523..ff549a8 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -793,8 +793,6 @@ static int sci_handle_errors(struct uart_port *port) /* overrun error */ if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) copied++; - - dev_notice(port->dev, "overrun error\n"); } if (status & SCxSR_FER(port)) { @@ -835,8 +833,6 @@ static int sci_handle_errors(struct uart_port *port) if (tty_insert_flip_char(tport, 0, TTY_PARITY)) copied++; - - dev_notice(port->dev, "parity error\n"); } if (copied) @@ -1002,12 +998,15 @@ static inline unsigned long port_rx_irq_mask(struct uart_port *port) static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) { unsigned short ssr_status, scr_status, err_enabled; + unsigned short slr_status = 0; struct uart_port *port = ptr; struct sci_port *s = to_sci_port(port); irqreturn_t ret = IRQ_NONE; ssr_status = serial_port_in(port, SCxSR); scr_status = serial_port_in(port, SCSCR); + if (port->type == PORT_SCIF || port->type == PORT_HSCIF) + slr_status = serial_port_in(port, SCLSR); err_enabled = scr_status & port_rx_irq_mask(port); /* Tx Interrupt */ @@ -1020,8 +1019,11 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) * DR flags */ if (((ssr_status & SCxSR_RDxF(port)) || s->chan_rx) && - (scr_status & SCSCR_RIE)) + (scr_status & SCSCR_RIE)) { + if (port->type == PORT_SCIF || port->type == PORT_HSCIF) + sci_handle_fifo_overrun(port); ret = sci_rx_interrupt(irq, ptr); + } /* Error Interrupt */ if ((ssr_status & SCxSR_ERRORS(port)) && err_enabled) @@ -1031,6 +1033,12 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) if ((ssr_status & SCxSR_BRK(port)) && err_enabled) ret = sci_br_interrupt(irq, ptr); + /* Overrun Interrupt */ + if (port->type == PORT_SCIF || port->type == PORT_HSCIF) { + if ((slr_status & 0x01)) + sci_handle_fifo_overrun(port); + } + return ret; }