Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2872954pxu; Sat, 19 Dec 2020 04:58:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZGx/6COCWBYr4miGqTCYICADEl7FbFFYzrvSHduTjIhi2mDL7WQQ3mt7O3nsH0gZIq/r7 X-Received: by 2002:a17:906:fa12:: with SMTP id lo18mr8455415ejb.354.1608382723183; Sat, 19 Dec 2020 04:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608382723; cv=none; d=google.com; s=arc-20160816; b=tOEPCueyG3O5UZi7kp8OcKm9j5iGBwVM0ndlgqYOsfR21w7U9V0k29B3PL5O+k6JTQ OakOXpdUXBA2XHhh4RINa9xvzgX8nQ6BAhwasp7kw1dH9anT4eoAgGQQFnCUNWZ+e243 O6bOXFDnK8RNfOkMWzDOIdlw203QLDWm3LXe3r6Pr2FWynUNCCNnGEoPd10+8pAaPIVs 6sEvw1nXDXdYcTae3M5yoIk6Ztr3jrRVaeJWu3QJI7ZDMegDF7oxGYuPZIsRLB+pPux8 cSz5emnLAgWlw36yFurNm1vnRemx1t8oCy6Gk4kkUAi7yRx9Qhj2Q6xDROM6Rd9KZbLk /u8w== 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; bh=nkQdLPldDzfb8JbQN+ldOGzJGBCLwTbFTAhChR6qx/8=; b=tqZnGAZO620pLU8rUGOu3C/UanCFw5FgW4g7DxB6CYW05TNN0nxonaJYznOW90vztl tBIzqOwO055sLyma+na/Whca/Eo5S9MCQZ+QkK+XWhagFyLPwk0KAjSyhU2zDB6El00j sKTYVLth8qNjInQARjUDIIJm/rZ7Yjl46xP6iJ0dgOSn3eyWzxXOBTlEhi54LDSNOm53 QcRtEOq2pd7+wxGMwZQ/FmUQ4uOSZ8NPgAEYqhdYkKRt+lqistO+7iXLr1P9UKve38EE dH9L8MJxYFhl2dU0KZ7V4qCBSaSu/Fw+cEd7KlPQC7LXNBK0j11+lYSODyLm3bMdK+6j FKjA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 q26si8408546edi.38.2020.12.19.04.58.20; Sat, 19 Dec 2020 04:58:43 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727255AbgLSM5k (ORCPT + 99 others); Sat, 19 Dec 2020 07:57:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:44024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbgLSM5j (ORCPT ); Sat, 19 Dec 2020 07:57:39 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sverdlin Subject: [PATCH 5.10 16/16] serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access Date: Sat, 19 Dec 2020 13:57:23 +0100 Message-Id: <20201219125339.873289839@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125339.066340030@linuxfoundation.org> References: <20201219125339.066340030@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 @@ -184,11 +184,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);