From patchwork Wed Feb 1 14:31:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 93041 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2444435qgi; Wed, 1 Feb 2017 06:34:07 -0800 (PST) X-Received: by 10.99.38.2 with SMTP id m2mr3962147pgm.169.1485959647896; Wed, 01 Feb 2017 06:34:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w77si19252961pfk.62.2017.02.01.06.34.07; Wed, 01 Feb 2017 06:34:07 -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 S1751143AbdBAOeA (ORCPT + 2 others); Wed, 1 Feb 2017 09:34:00 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35418 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbdBAObx (ORCPT ); Wed, 1 Feb 2017 09:31:53 -0500 Received: by mail-wm0-f41.google.com with SMTP id b65so41914871wmf.0 for ; Wed, 01 Feb 2017 06:31:53 -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=RfPAtTP+EnH0ppPKWtAtdufrnNgPQOFwH97t7k2f8K+D8qcF8rWR4hLg4GW2/W3Ps6 ThAAwMqEUUxjyKlm5d5AotSLqXi8cB3eCGbyssxp0Zqj0sIf+dspIltSff8luToNHP4P mwvSgFfJMhre5S5uIVlj5r+pth24RKl5HS9uE= 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=VfXR05mxOGfbyvCdQNeUG1JpkfQOVt21j2fWpzVSnMCPKHHTMOr398HxK2/XyIYNg4 bCm1oqkzAEnJoeXacX1+L9XORQwsfZzpakXL5JjO1+375QlN5RvpcAgJG9u7v3jWXikH U6wKYZI0cKpIodrQADU9TwdanueQq1mnWTYn8tozjdcrzm94mKifWcEXhNL9mT1uri5D iJFtGqV/zJxr+TMfIQVktbC6hzFmmvWIQpMvNeZmi4zteH5MqXzKgVV8h53xfs7a/v+s 3WqCQ2qWOtf3B5uJk2N3Zjrz9OI7ZRyOcNTimDQg3ackgH/Ps7FRi1hk0hRP2gFIiehN gk+g== X-Gm-Message-State: AIkVDXK+FNCjp1lZUI1HbssXrD08IcuMB7x53mb5EtYDGU0zKujmwmzZUJhbIarNxnmaDsH+ X-Received: by 10.223.139.142 with SMTP id o14mr2990636wra.6.1485959512200; Wed, 01 Feb 2017 06:31:52 -0800 (PST) Received: from localhost.localdomain (host81-158-165-111.range81-158.btcentralplus.com. [81.158.165.111]) by smtp.gmail.com with ESMTPSA id l37sm34420245wrc.41.2017.02.01.06.31.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 06:31:51 -0800 (PST) From: Lee Jones To: gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, dt@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 v2 01/10] serial: st-asc: Ignore the parity error bit if 8-bit mode is enabled Date: Wed, 1 Feb 2017 14:31:36 +0000 Message-Id: <20170201143145.31962-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170201143145.31962-1-lee.jones@linaro.org> References: <20170201143145.31962-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)) {