From patchwork Fri Dec 2 14:11:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 86305 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp336265obb; Fri, 2 Dec 2016 06:12:07 -0800 (PST) X-Received: by 10.84.209.136 with SMTP id y8mr98131792plh.114.1480687927681; Fri, 02 Dec 2016 06:12:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j190si5316859pgd.278.2016.12.02.06.12.07; Fri, 02 Dec 2016 06:12:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934281AbcLBOMD (ORCPT + 25 others); Fri, 2 Dec 2016 09:12:03 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34515 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934146AbcLBOLf (ORCPT ); Fri, 2 Dec 2016 09:11:35 -0500 Received: by mail-wm0-f45.google.com with SMTP id u144so3939428wmu.1 for ; Fri, 02 Dec 2016 06:10:47 -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=cnO9pZh9ys3hJdbg17TXzjE3t+ZvxaT5arvE8TBt3KE=; b=JKxmsSg94ouRn94cKlOmOOSexWjokl0Le+fQijaOXS99/mMXc5bdtXfTjFuV3iTVk/ MQLUtfpL97EvkqpCeT6qU49udjOOe3gre7oDW2c/KRq2USU42i7Gb2163nxWvsVb3d5i PA1mfCFSoPEK0tFAJG/xSxlzhIXH0OJqgKK2Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cnO9pZh9ys3hJdbg17TXzjE3t+ZvxaT5arvE8TBt3KE=; b=FmWQ3WXw1G33Mf+SvWRTzzMlxSiAtAGmAp/fPN0WEkLOcRJysKZgeNaODA0jc0K6qI Ds1O4Rd0PwzbQO9P3Na42hbLhO4hrqRHTr+d8qLic1o+Dcreu39h1X/ac60NV++c38R0 tUNDT4T3xFFL0N1yjqoIP2dkEw2zQfKh/1MJvD5ZBJ+dP0bvRI2Se+wnVbxjiST8vT61 NbSbdh+pxSM3cUizzubMSQtxJ7KJFkwBywhQCVAcvH7hIKXfSQCB5kiamLDFSCQQUSj5 fnExe6Y17+O+Hu4TyhvqnfIIpirSIC6tXP8rXQbSGzweGmwj49wLpOwuEpOndbeUkLDX rjFA== X-Gm-Message-State: AKaTC03iAHMAjmh2Sbp+3hm17DvYUPS/TmmsoRxRawfXB02fiR+CHJ5MtUfZeu5UwovvkVvx X-Received: by 10.28.147.134 with SMTP id v128mr3275132wmd.3.1480687846334; Fri, 02 Dec 2016 06:10:46 -0800 (PST) Received: from localhost.localdomain (host81-129-169-233.range81-129.btcentralplus.com. [81.129.169.233]) by smtp.gmail.com with ESMTPSA id n17sm5808199wjq.6.2016.12.02.06.10.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Dec 2016 06:10:45 -0800 (PST) From: Lee Jones To: gregkh@linuxfoundation.org, jslaby@suse.com, patrice.chotard@st.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, linux-serial@vger.kernel.org, Lee Jones Subject: [PATCH 3/3] serial: st-asc: Ignore the parity error bit if 8-bit mode is enabled Date: Fri, 2 Dec 2016 14:11:46 +0000 Message-Id: <20161202141146.31281-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161202141146.31281-1-lee.jones@linaro.org> References: <20161202141146.31281-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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." Signed-off-by: Lee Jones --- drivers/tty/serial/st-asc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -- 2.10.2 diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index ce46898..7008eb7 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -289,9 +289,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); @@ -301,8 +311,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)) {