From patchwork Fri Feb 3 10:23:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 93166 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp525519qgi; Fri, 3 Feb 2017 02:25:00 -0800 (PST) X-Received: by 10.99.141.67 with SMTP id z64mr16740000pgd.18.1486117500715; Fri, 03 Feb 2017 02:25:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u79si25118067pfa.27.2017.02.03.02.25.00; Fri, 03 Feb 2017 02:25:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753153AbdBCKY7 (ORCPT + 2 others); Fri, 3 Feb 2017 05:24:59 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38351 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752961AbdBCKX0 (ORCPT ); Fri, 3 Feb 2017 05:23:26 -0500 Received: by mail-wm0-f50.google.com with SMTP id r141so20571291wmg.1 for ; Fri, 03 Feb 2017 02:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hlKrZUbdZb3ODtd0dth/ItQyMint0+JkHFNCQC/C7kc=; b=Ol07+nrVoeQLRexh/W6cVm6b1DtSt6eYH0U5VlKLxAZr/cW/rEJCI4rF+NIG+tWin7 uC4J1VjKWBOPI1DIv+dBjuTBBc2jwAEjIl6Qg+dDGVarqmDbjs5MEk/0q3mlQQh5E8GV Q2NFpOqZqz1fsLQuHqqo5AYAHrtUOFr2vMQso= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hlKrZUbdZb3ODtd0dth/ItQyMint0+JkHFNCQC/C7kc=; b=Hc84SgwrNtoYzYQj6pNaUWHAZq2TDMSS2/2JMUJg/Oj0FecilZA6cZ07cpu4CutqyB khz+8msK7BDRZKhPs/zTwcq66fLl08SOz1tMwOVVh8NqOAYss7uzf9HDUqG4PbNMHZ+9 pqqju6/I9XabC43fbHJAAYqzPU1emcMPvaCMxYl0Zz2fMN+w8vEqid9afwtk+JxzrV+h p1KvV66AIJQfyRHdhklmFNj7Q2dMPG8u0ByGqprjSjJ4pvD6KiFLxHEOZgeXl9bI484Y YT3hnYcUgDEqVQiS/bNA36EZFTca3F+0PhPG5nCZHcQwdLPmmFvH41ypiloFpGA00v9v sDEA== X-Gm-Message-State: AIkVDXLIUe1TvVX4u9XoyvdUPb6c7j+YZumRsOEsmjUL6GBV9f2MnXdsCZojaydKDeQXRJKd X-Received: by 10.223.155.140 with SMTP id d12mr11115488wrc.143.1486117404376; Fri, 03 Feb 2017 02:23:24 -0800 (PST) Received: from dell.Home ([2a02:c7d:1faf:e900:a188:db10:388f:f973]) by smtp.gmail.com with ESMTPSA id z90sm44668100wrc.24.2017.02.03.02.23.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 02:23:23 -0800 (PST) From: Lee Jones To: gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, devicetree@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, patrice.chotard@st.com, Lee Jones Subject: [PATCH v4 01/10] serial: st-asc: Ignore the parity error bit if 8-bit mode is enabled Date: Fri, 3 Feb 2017 10:23:10 +0000 Message-Id: <20170203102319.23489-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170203102319.23489-1-lee.jones@linaro.org> References: <20170203102319.23489-1-lee.jones@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The datasheet states: "If the MODE field selects an 8-bit frame then this [parity error] bit is undefined. Software should ignore this bit when reading 8-bit frames." Acked-by: Peter Griffin Signed-off-by: Lee Jones --- drivers/tty/serial/st-asc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 379e5bd..69e6232 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -287,9 +287,19 @@ static void asc_transmit_chars(struct uart_port *port) static void asc_receive_chars(struct uart_port *port) { struct tty_port *tport = &port->state->port; - unsigned long status; + unsigned long status, mode; unsigned long c = 0; char flag; + bool ignore_pe = false; + + /* + * Datasheet states: If the MODE field selects an 8-bit frame then + * this [parity error] bit is undefined. Software should ignore this + * bit when reading 8-bit frames. + */ + mode = asc_in(port, ASC_CTL) & ASC_CTL_MODE_MSK; + if (mode == ASC_CTL_MODE_8BIT || mode == ASC_CTL_MODE_8BIT_PAR) + ignore_pe = true; if (port->irq_wake) pm_wakeup_event(tport->tty->dev, 0); @@ -299,8 +309,8 @@ static void asc_receive_chars(struct uart_port *port) flag = TTY_NORMAL; port->icount.rx++; - if ((c & (ASC_RXBUF_FE | ASC_RXBUF_PE)) || - status & ASC_STA_OE) { + if (status & ASC_STA_OE || c & ASC_RXBUF_FE || + (c & ASC_RXBUF_PE && !ignore_pe)) { if (c & ASC_RXBUF_FE) { if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) {