Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4373906imw; Tue, 19 Jul 2022 05:34:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tuMCNdQfAtlrhVRhRIO+OX49X2GDhUc7BN2tKfFrUqAoDCe4dvwlC4fXYVJGxhVZS8Wm0t X-Received: by 2002:a17:907:16a2:b0:72b:87c9:af07 with SMTP id hc34-20020a17090716a200b0072b87c9af07mr30305158ejc.121.1658234088531; Tue, 19 Jul 2022 05:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234088; cv=none; d=google.com; s=arc-20160816; b=gDSMsXuA+tAyE4pQw9q/JSngRJa+nABV0RPZrfi2NzhLkyAcdpZBqGh27Z+PoC0tCL V92WUfyFlykghnbyUn39xkX9JLxP3wN0BACM2UjpKRgGJWMF84SXkWj7VnbIPsAf0exR OrozQstM3hBtYW46mwK55OXbzpcI9FsZFxl7fQJZ37ZVJeMkYXxM0TTKdhEqHKdMfecE aaLP6KaoEFxaZ8Pgw7WUZBVebFZPu9y5D7+SosQSWLMCYKUIjioARv6LkDemBpaC09LJ 83Y1oYWtQRwgdq6YQ97/D6e2wdRxc0URXbE7hTVE4H9OfkwiiMMbsz2eJcx2RBP18WXE CeRw== 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=+mayt6lhsgihhwFmUfSFTWOAFRZeI2PGQHCGZPFGiTk=; b=y+Q4e5kViXRgn2nMkt6FdELtd7ZXHPNoY0Y9QaXHZKi929ol+UpwZWZtVj1S2Gvq6R O2xbbtuQ6te2KRlp2sDPKSi4fg04dr6uDh0QIfHdejB2KaZO1CJsd3g+4Yw3zQK0XWyS RWC3G0vQmt3dgY8KPZhaqDrYFhF4onDMLiRnADsaDG7n1FkLD01hSCCDeCEbSGCFoCug j5ISR7dN/iV03rkM4lA4gZZdpcjX5LK6hu2SAA33S7A9K7SMizKW3m69H0TXt6iyZqaj fmo/VhO3m8VackejAMlGgpbL+JcQa3s7jKO4NDszpNEzimx84wqLdEK4/xtUtlG1/TXf Mqrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A1SIYHTy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ej27-20020a056402369b00b0043ba17b4febsi942088edb.603.2022.07.19.05.34.23; Tue, 19 Jul 2022 05:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A1SIYHTy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236021AbiGSM10 (ORCPT + 99 others); Tue, 19 Jul 2022 08:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239760AbiGSMZo (ORCPT ); Tue, 19 Jul 2022 08:25:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B07E61DB7; Tue, 19 Jul 2022 05:09:59 -0700 (PDT) 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 4B7426175C; Tue, 19 Jul 2022 12:09:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19E19C341CB; Tue, 19 Jul 2022 12:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232587; bh=2hxcyOrTSBY6NUhGwyWlaha8eRuFLOpauYLap/1TLQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1SIYHTydE3B+fyuVhWvnsj57y6APpw9qFjQ4+x2vvPQrIWJ0tZrlpXbVvkGerG7x miHQp8LnrxowuZkZayzFp3uG1BYun+Bnjo4zYNTR+z1lLz6VZ4qp1uN5VdKsjsyoMc yGOV87NLvmBsbWDQAq9cZlErSIlIQHhqbIqU2GoQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.10 109/112] serial: stm32: Clear prev values before setting RTS delays Date: Tue, 19 Jul 2022 13:54:42 +0200 Message-Id: <20220719114637.787036788@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo Järvinen commit 5c5f44e36217de5ead789ff25da71c31c2331c96 upstream. The code lacks clearing of previous DEAT/DEDT values. Thus, changing values on the fly results in garbage delays tending towards the maximum value as more and more bits are ORed together. (Leaving RS485 mode would have cleared the old values though). Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control mode") Cc: stable Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/stm32-usart.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -70,6 +70,8 @@ static void stm32_usart_config_reg_rs485 *cr3 |= USART_CR3_DEM; over8 = *cr1 & USART_CR1_OVER8; + *cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK); + if (over8) rs485_deat_dedt = delay_ADE * baud * 8; else