Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4447734imw; Tue, 19 Jul 2022 06:50:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v05lhXYxNKai8qiGosSyXQZIdg7BJv5bYh1Dj2ofiOmEJlWyTBpcNvUt96AWK46s6COeYm X-Received: by 2002:aa7:c250:0:b0:43b:25fb:4903 with SMTP id y16-20020aa7c250000000b0043b25fb4903mr34949714edo.253.1658238630428; Tue, 19 Jul 2022 06:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238630; cv=none; d=google.com; s=arc-20160816; b=M+ciiw6z4lRvVLCAKaaPbGYcNCtOgz2lGHwhDu7i5cLoUbC1fqa6NmZRjDJRadhlQl Wb1qZRwYrjUofdpdmyn3D6nybyVzGYDR8/MhF87j/sQpKjc7JtxhuiZAKmXCWesSdTJb EG9BMBkX8uGcEhixtEkfr5nxqwDjZUrlKxLVmTCD4KXd+t7KNPOIetMFlG1+QUPgNMFY Nou53BfAiY4oDoG3fyz6t5bIIcYQ3Ee+bcYo0eKjDTNVBdSr4XJPvNce3JDYHKcE0ERn ZzihjZynbltGpkryAc6bg57IEocE90+8V1TAYr1pDhRTKNBUn+kwmlw+CKI1LTyPJQuW RQ1w== 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=HFSb5HB5eoVhYX7eJK/KI1kRMUFXGbVMa8mbNyzgDzw=; b=sbe/RAcWWnIhk3gjAWyI/9pHDE+oKUtqiOMnRMVRELwqjbLEYRQeqsBOt/t0C8SidV ZnEj317JU1mO/mV8auhyzfnvQVJHWT1h3t3SZCrltNNLbDCRObpmiaJqBCsasBJiF2+j aFzRO9UbcJKU5NOvMuXXw/goGq7lYOkVLMyp5NIZiJH6jmS0K9GN8vKYUQfpqeaujQ8b 7kePvw6Wh3/3Jttj+TsUJiSYwgNIGV3oMXSEGqxW6PrPoHsKQODXTlPFtCKsVsfKtrzs FJC6pLZ1Hs6kXjCBbBJAkubDRkOvXOfUh3AK4Sp3NmOXA5xctqboR+FFy6oSUpxMdQAM G6bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dpjQ5gZm; 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 bc15-20020a056402204f00b0043acbfa0469si18122182edb.394.2022.07.19.06.50.05; Tue, 19 Jul 2022 06:50:30 -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=dpjQ5gZm; 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 S235587AbiGSMHA (ORCPT + 99 others); Tue, 19 Jul 2022 08:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238602AbiGSMEw (ORCPT ); Tue, 19 Jul 2022 08:04:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACDFA4D4DA; Tue, 19 Jul 2022 05:00:56 -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 4372F61647; Tue, 19 Jul 2022 12:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EDB1C341C6; Tue, 19 Jul 2022 12:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232055; bh=lp/kSqcgTPWp5lszvC1WnVBiP2bI2pXq3j+oXsZra9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dpjQ5gZmlNIgaNji5zCTBD4VHK6ytKyPKYrSTBI+LxWwp8Alud7cSjCRVIWaYwzHl eEbDXGYPh3wV4gjJL3KFERD1UtnrGlKw4zQTYQBx+uuxcf1cco0fVb8lj/ZNnrES33 xZQJvMf7nZdA6z1DEtnZeSUxr8eQoBPcsJaBYeSI= 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 4.19 46/48] serial: stm32: Clear prev values before setting RTS delays Date: Tue, 19 Jul 2022 13:54:23 +0200 Message-Id: <20220719114523.898722508@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114518.915546280@linuxfoundation.org> References: <20220719114518.915546280@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 @@ -72,6 +72,8 @@ static void stm32_config_reg_rs485(u32 * *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