Received: by 10.192.165.156 with SMTP id m28csp784377imm; Mon, 16 Apr 2018 08:39:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/DwlA683ULuEBmvX/2sPRWxq0AlXM9/Vh/hOXZ0qsVDC8+NHhBSj0CTaCYXrIVwv3rJhDR X-Received: by 2002:a17:902:525:: with SMTP id 34-v6mr16009501plf.267.1523893185496; Mon, 16 Apr 2018 08:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523893185; cv=none; d=google.com; s=arc-20160816; b=wHLrzTh6R7MDD9gjZlrYCxnV8qAqYjgrqV4heJSTqRBlNJ/FPR2Y1bP+twW8GhHCOV 0DPdSryRoQXZcI+vy5gfHmRB92buwLInKbwpAr5tjz0tqNaK4JnCNkwt5dMFuF5EMBmo fmeYhxDIRN8DqGPJmvueZVZoFCAMMCKW2AR//DF78/El2/hBPz6A9+DPpG/bELVRlI35 Z/Jx308HxY7jOVfYA4q5LhLobkk9FqEAmm4DvBsCKASW0uJl12jwJq52cG6fBhgbNTo1 m2zWueL8oUOsdvJ8YXMDguUGNMIcGStMNxmf78IR6E77Sjlx9eOKheqIZgPd4oTkcVyO jlTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=gEtVhFKYYrUft0IoCY76Tl4f/ek1CjR8GJ2cs0wqLrw=; b=ScOAO5CQDMWPL17BdwnCxtYcraYzZ9iBKUCb7LTdqK5ogVopsqrzDqPpJCcAUbuSFz N7MM1ZUpMKAXqHgf8Hx2stISw8Xzh28zk5zGjJL+S3WTYUgA65YhMifrS88QQKoU2egy hOFm0KrK6Lx7+tkEOTdm8nY4cD1c5berpKXiz8/h2uEohDSEwvcWihRgbG33YO3AthFB zi00q3dhjlDSD/3bmBU9uUPrZie0t4vrYaLjLCcKLes667HLS+wgPPu7mjeVcOFXyOhL OEWQVp7iXFLra3k8j1TNO3Oxe81KasZaHp1OaeiwlwryWjrZEonYttdffyeBzuIzDsUr SpOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@agner.ch header.s=dkim header.b=DgDZ9J3R; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10si2354617pgc.555.2018.04.16.08.39.31; Mon, 16 Apr 2018 08:39:45 -0700 (PDT) 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=fail header.i=@agner.ch header.s=dkim header.b=DgDZ9J3R; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752332AbeDPPga (ORCPT + 99 others); Mon, 16 Apr 2018 11:36:30 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:41856 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbeDPPg2 (ORCPT ); Mon, 16 Apr 2018 11:36:28 -0400 Received: from trochilidae.toradex.int (unknown [IPv6:2001:1620:c6e:10::3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id CA73C5C0C09; Mon, 16 Apr 2018 17:36:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1523892987; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=gEtVhFKYYrUft0IoCY76Tl4f/ek1CjR8GJ2cs0wqLrw=; b=DgDZ9J3RE1b7UXdfGkDpNUi7jl/93v9hLOBgprYZEZVgeoH2GYGrdH5zyolpyYuuN0Rr4H t9lf9v2PeMxZIJVG7eiR3jupL0qL8G5igukluXsg/rBEbg+N5UYL5ud6UKIbuGGLSu0II8 EHR3frQi281Kg/lRomMxhbijaNx0eBY= From: Stefan Agner To: gregkh@linuxfoundation.org, u.kleine-koenig@pengutronix.de Cc: jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH] serial: imx: fix cached UCR2 read on software reset Date: Mon, 16 Apr 2018 17:35:02 +0200 Message-Id: <20180416153502.11814-1-stefan@agner.ch> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To reset the UART the SRST needs be cleared (low active). According to the documentation the bit will remain active for 4 module clocks until it is cleared (set to 1). Hence the real register need to be read in case the cached register indcates that the SRST bit is zero. This bug lead to wrong baudrate because the baud rate register got restored before reset completed in imx_flush_buffer. Fixes: 3a0ab62f43de ("serial: imx: implement shadow registers for UCRx and UFCR") Signed-off-by: Stefan Agner --- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 91f3a1a5cb7f..4ff6bd6eb9ab 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -316,7 +316,7 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset) * differ from the value that was last written. As it only * clears after being set, reread conditionally. */ - if (sport->ucr2 & UCR2_SRST) + if (!(sport->ucr2 & UCR2_SRST)) sport->ucr2 = readl(sport->port.membase + offset); return sport->ucr2; break; -- 2.17.0