Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7251157rwb; Wed, 23 Nov 2022 04:21:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf6XpdXTAuFN1VYx/+jrpOaOumFHhN7R1xnV7MfQnXQLpsCj3ofUXH6Elzdbi0qei/7VlrvI X-Received: by 2002:a17:902:be06:b0:189:26bb:3bad with SMTP id r6-20020a170902be0600b0018926bb3badmr10162302pls.92.1669206071992; Wed, 23 Nov 2022 04:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669206071; cv=none; d=google.com; s=arc-20160816; b=ywsRadzjtR1FhGUNcZwxETkrZKgKTCcZXViOeIQQlY7t/zb8E0qKv3Fu8lvHHZtDIP K+Mlqzrq3AboSOApx6ThCGBlbgpxsGgAc+wAx4Afi8/8/ACUqI/oBBtQIcx+W4OoP5wj zPRkNtZOCGzRywyQvw3d6g3cR63O2k5s+w0j7+RUr6euEwm9/KLo5nIcn9Fsy74hweCu evNLZt77c93KMhcJtLGmDsgUi2KefZk0w2e9eCOmt3C3jFB+QiIvb5+HpeZLuQY8UZzm EyJjf0lA5b8k5/DyWNJT3ZwI5NaDOX1AWapiaUuP8ftqVpbKMwtypXMOLWJhsX/ZzQr1 qGxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature; bh=n2uICglmOipyNQWSDxRY69K7C8c5I2T+tdKX90LjQzQ=; b=QF9dxp8y1UgwbxLaZ8sAPXURHb+nijbmA5Z+M3qM6MvxVAmVLxB5SJPmeFFYLi6ozn TLvquyno/figDl+qPJhKEGt1xwcu/WtBIi3Npg1jAiCi/L8GpOxZlE4gnXBAxVfPYlOl W304ayEwE0HhzD4/1sq9qz2oIDx8NJSJMpXi2iml4iQwGUMNA71+Jh11TBhn2cWJm8Oj 5lLkUBhUqB0bmbfP4IyZRLtSyfPPItpmHRGWoeNCiuXewfC66Jgfcs3Xqj/hiTG+kkU0 w4g3GHewNlvu7BHcjh/FVDmvASyFmSDkxjAXNj0qLwY30V/AQTItLQH2zZu1TzIeMfu6 gMIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=Jj5rBHsE; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a63734a000000b00477690ae90fsi8915844pgn.702.2022.11.23.04.21.00; Wed, 23 Nov 2022 04:21:11 -0800 (PST) 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=@walle.cc header.s=mail2022082101 header.b=Jj5rBHsE; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235496AbiKWLMd (ORCPT + 89 others); Wed, 23 Nov 2022 06:12:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236208AbiKWLLQ (ORCPT ); Wed, 23 Nov 2022 06:11:16 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC5B9A5FD; Wed, 23 Nov 2022 03:09:23 -0800 (PST) Received: from 3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id CC8EB25E7; Wed, 23 Nov 2022 12:09:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1669201760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n2uICglmOipyNQWSDxRY69K7C8c5I2T+tdKX90LjQzQ=; b=Jj5rBHsESwngdrIVZX4OGjDbSVg3tteZ1kwDcdPIQvBt+7fd7H9Q4O+8bFDUsCVvzBzbYC xEVxiGcG1ujQlMo4u7y6bCoHjCSif84V6M28rYSuNM8B46y/1JOhE+EJd3+GEs2xyIe6B4 Ru6Xjg0iJujmBWzVKgUFEqGI3PVKWamkfI5Pr+wlxcP20Gn+/9rnxli8nz2Fjw+vobp2wx 2XbUJLr7wEm9EEHZ2lvdk4/aWz7qfRrDoagjY8c03IR3gwHfFRyxxzcS5YoYihmUM5Clgr vsz4KnDL3mBsPsVCsYZirbzsBzV4ZJ0q2yvePIJOzb/HDMG5O2Q9egNiji3yOw== MIME-Version: 1.0 Date: Wed, 23 Nov 2022 12:09:20 +0100 From: Michael Walle To: Sherry Sun Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, jingchang.lu@freescale.com, tomonori.sakita@sord.co.jp, atsushi.nemoto@sord.co.jp, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, dl-linux-imx Subject: Re: [PATCH V2 2/5] tty: serial: fsl_lpuart: clear UARTCTRL_LOOPS in lpuart32_shutdown() In-Reply-To: References: <20221110081728.10172-1-sherry.sun@nxp.com> <20221110081728.10172-3-sherry.sun@nxp.com> <1a7c9345e3c8b97adfbadffda7340871@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <7724b39dabc60f872e20ffb5ed21d1d6@walle.cc> X-Sender: michael@walle.cc Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Am 2022-11-23 11:58, schrieb Sherry Sun: >> -----Original Message----- >> From: Michael Walle >> Sent: 2022年11月23日 18:34 >> To: Sherry Sun >> Cc: gregkh@linuxfoundation.org; jirislaby@kernel.org; >> jingchang.lu@freescale.com; tomonori.sakita@sord.co.jp; >> atsushi.nemoto@sord.co.jp; linux-serial@vger.kernel.org; linux- >> kernel@vger.kernel.org; dl-linux-imx >> Subject: Re: [PATCH V2 2/5] tty: serial: fsl_lpuart: clear >> UARTCTRL_LOOPS in >> lpuart32_shutdown() >> >> Am 2022-11-10 09:17, schrieb Sherry Sun: >> > UARTCTRL_LOOPS bit is set in lpuart32_set_mctrl() for loopback mode, >> > but nowhere clear this bit, it should be cleared when closing the uart >> > port to avoid the loopback mode been enabled by default when reopening >> > the uart. >> >> It's cleared in set_mctrl(). What is the expectation from the serial >> core here? >> > > Hi Michael, > > If we call .set_mctrl(TIOCM_LOOP), the UARTCTRL_LOOPS will be set. > Then when we call .shutdown(), serial core won't call .set_mctrl() to > clear it, so the UARTCTRL_LOOPS need to be cleared here. > Per my understanding, .shutdown() should clean up all the uart flags, > as the transmitter and receiver will been disabled, we will > re-configure all the settings needed when re-open the port. Two things, (1) should the loopback be cleared on a newly opened serial device? (2) as mentioned in my other reply, this can also be handled in the startup. Eg. the startup can clear the loopback flag. (together with possible hardware events). I'm not that deep into the serial core, thus my question about the expectations from the serial core. I guess the answer to (1) is yes, but better to ask. -michael