From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB39EC433F5 for ; Tue, 18 Jan 2022 03:17:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347687AbiARDRO (ORCPT ); Mon, 17 Jan 2022 22:17:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349277AbiARC4h (ORCPT ); Mon, 17 Jan 2022 21:56:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3DE7C02B748; Mon, 17 Jan 2022 18:44:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C4F7612CE; Tue, 18 Jan 2022 02:44:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABB84C36AEB; Tue, 18 Jan 2022 02:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642473858; bh=RKSEmNaXGd0qqSaJBIwGtQiobulqLStSBkj1kyOlIzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqU3bBei2vJ4H03X9yuTDo2lVmHPWhlfw4hmiw0eB+r+4gSXrvdr6deu/84PrlNOK DUgVyd6hgc4b8682N8/Zj5x/kbfzig9kg+J/hbzpCIsOPSkp0qvC7KDBxY297nP09Z xTBB0OXoGswPgGzv4ksVQSsH5GFvKoFYNWv5Ek5QlIcl3FwO3bLKyrugYxDewh634t 2oofACteKtuyi+aXP5b+iiqE/Gohwj0F975gaON3tZrl/r6Zi0pWH/cYB2FoiOq2wY vDLzdv3vc70ORKGuq8tUKv2IBmg/Y7NA2azW0ALBcgbGpXcyxntTxPgvq7qmKkhNEu RG55dB4QVVV0A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Lukas Wunner , Russell King , Greg Kroah-Hartman , Sasha Levin , linux@armlinux.org.uk, jirislaby@kernel.org, linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 110/116] serial: pl010: Drop CR register reset on set_termios Date: Mon, 17 Jan 2022 21:40:01 -0500 Message-Id: <20220118024007.1950576-110-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118024007.1950576-1-sashal@kernel.org> References: <20220118024007.1950576-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner [ Upstream commit 08a0c6dff91c965e39905cf200d22db989203ccb ] pl010_set_termios() briefly resets the CR register to zero. Where does this register write come from? The PL010 driver's IRQ handler ambauart_int() originally modified the CR register without holding the port spinlock. ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. That is achieved by writing zero to the CR register. However in 2004 the PL010 driver was amended to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios(): https://git.kernel.org/history/history/c/157c0342e591 That rendered the CR register write obsolete. Drop it. Cc: Russell King Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/fcaff16e5b1abb4cc3da5a2879ac13f278b99ed0.1641128728.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/amba-pl010.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index 3284f34e9dfe1..75d61e038a775 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -448,14 +448,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, if ((termios->c_cflag & CREAD) == 0) uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; - /* first, disable everything */ old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; if (UART_ENABLE_MS(port, termios->c_cflag)) old_cr |= UART010_CR_MSIE; - writel(0, uap->port.membase + UART010_CR); - /* Set baud rate */ quot -= 1; writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); -- 2.34.1