Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9176466pxu; Mon, 28 Dec 2020 08:28:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzb8extbGEgfEb1d9lDVuM8/Zq6Yh38hPoaouk7tN1LnjR9JV/AhpEceyUXi6kR9hduIAfD X-Received: by 2002:a05:6402:b2f:: with SMTP id bo15mr42893433edb.220.1609172939538; Mon, 28 Dec 2020 08:28:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172939; cv=none; d=google.com; s=arc-20160816; b=dblGwGxehwmxqagBNTJGkIMjJ+iTP3jcpxUxkEQDsYpqT63PckWlYqwtW/f/yS5s4m Wpp4qX1k8P84J5eks+yAaMcJlLryL5+xuesJNOslHRMy605bBVsS7ABGAuBsj40OMG+S uiSycNZ+nuynVpkCTAVZRzQYdAbTIny0grWSnM+kPzTMXWzuVhHk1Lv7HwylRRGflt4t 0WDPi8b51qkc62kC77lwf3Zg0hFkyHmFV30QvvNKx8DY+oCbDrUpNbGjf4E3RHPWuD3v QyNkLfE1sMWf9BLSAO70xiQUgwr8ZswDYaleFELl4XKzJB6opbiJtNQAP2PdiK6WsipD SJUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Cn/1z4/Hg3feuUvXdcDnBROBAzfKTlPSMKkL0iyOE54=; b=xR45r9pQ3LYwbRtPNILF7WX9ShAP788Ub0viNBiUYk/SLi2sj3Z26IvrlMb1tusEkt tJmioOfdu89khC0np6DyAkrvheeVvPbqj2gLxPLYxIEeLBuLYyiMlb2F/PTuCjT5RBpR p85UnGRSJqDUUQQORLJPeN58fYkjQ/ZC6M5ws3ZnztrvErG3rSS+PGk8JkP7Kif91KEd aB8390jblYxjiTd8YTRcU3iXJxPMeLTco4oL1jEt+ScfZBIg4MmPA2ZTPc0BcE0XhmSh SS8h7lXE5AH1p/cbKtAWsT7TsahU/IMGYkx6zjuaww8Q7ijaX5x1XrWKT/EABfgzvXxX 4JOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wu8ZkdtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si18863730ejw.283.2020.12.28.08.28.35; Mon, 28 Dec 2020 08:28:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wu8ZkdtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730991AbgL1Q1B (ORCPT + 99 others); Mon, 28 Dec 2020 11:27:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:36046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730952AbgL1NIi (ORCPT ); Mon, 28 Dec 2020 08:08:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC11E2076D; Mon, 28 Dec 2020 13:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160902; bh=VKZZq1lAep4ckvFSXWk1nX6K8L/Guxz5MJjcCRsjij8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wu8ZkdtUtl6/D/fkMjQA8GxHKgzAK1FrhUTLAB7ilCIcxL7pL8oV8n6decuSHliNK 9thCBy0kaTTPc/1l9g+HY4HatFgxXWrRHLNB2JFzuAoISorsZcudnooZCUpw8d/mnd K9wFz9FN/eyMGHEjIRE6TO5sK20Y/VVMG9CqHjNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sverdlin Subject: [PATCH 4.14 033/242] serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access Date: Mon, 28 Dec 2020 13:47:18 +0100 Message-Id: <20201228124906.292663489@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Sverdlin commit d96f04d347e4011977abdbb4da5d8f303ebd26f8 upstream. It has been observed that once per 300-1300 port openings the first transmitted byte is being corrupted on AM3352 ("v" written to FIFO appeared as "e" on the wire). It only happened if single byte has been transmitted right after port open, which means, DMA is not used for this transfer and the corruption never happened afterwards. Therefore I've carefully re-read the MDR1 errata (link below), which says "when accessing the MDR1 registers that causes a dummy under-run condition that will freeze the UART in IrDA transmission. In UART mode, this may corrupt the transferred data". Strictly speaking, omap_8250_mdr1_errataset() performs a read access and if the value is the same as should be written, exits without errata-recommended FIFO reset. A brief check of the serial_omap_mdr1_errataset() from the competing omap-serial driver showed it has no read access of MDR1. After removing the read access from omap_8250_mdr1_errataset() the data corruption never happened any more. Link: https://www.ti.com/lit/er/sprz360i/sprz360i.pdf Fixes: 61929cf0169d ("tty: serial: Add 8250-core based omap driver") Cc: stable@vger.kernel.org Signed-off-by: Alexander Sverdlin Link: https://lore.kernel.org/r/20201210055257.1053028-1-alexander.sverdlin@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_omap.c | 5 ----- 1 file changed, 5 deletions(-) --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -161,11 +161,6 @@ static void omap_8250_mdr1_errataset(str struct omap8250_priv *priv) { u8 timeout = 255; - u8 old_mdr1; - - old_mdr1 = serial_in(up, UART_OMAP_MDR1); - if (old_mdr1 == priv->mdr1) - return; serial_out(up, UART_OMAP_MDR1, priv->mdr1); udelay(2);