Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp806970pxb; Thu, 17 Feb 2022 15:25:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLtE/UDsUYIV2nIBGGWVhPI5eGYx2bEKyEDZyx5pDMisjp12DSHljG3TTDX1okUaBOak96 X-Received: by 2002:a62:8787:0:b0:4e1:b69:5ea7 with SMTP id i129-20020a628787000000b004e10b695ea7mr5058051pfe.31.1645140345219; Thu, 17 Feb 2022 15:25:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645140345; cv=none; d=google.com; s=arc-20160816; b=ZPgkFbtP19k/gjpVcslY4Yh/Bh7QGH7NHj66jgkhBRuPoNsky0sfBWmuPXA2k+EOxY OPSs+/UwOqkoFLIAoxCTfpCCwORgRDsGXn7sBpaM5joac881P+e0DDezBFj3AHcDO4SB qtSD171Ua5a30DJYtVMu3bOqSL/VYkpMPvqHGxjXdCRuFiB5xodS6uiylU7L+C7Px/TB x6kuEsLdDSwtOmjG97DTN+LbspBq+ch72VWPX1j2HmxMIdsp2P5yv1MZhR5Gh8BZabdh SejEjDxv1zxMIJI1H9BJeMGS4OuX/ShVsNG62X0OZ+7jHC2/RyTYO4uiH4naHLXnYz/q JwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7xlrl9elM1qetAzeAOSNskPv8W23aPLNt6zInyIdm50=; b=zphSc1uZOCu6M5ukd2citUHrPM0pdQuaaw+oOaKkTZ0KpCHUtqkMy4g85Bxqd6jk06 9FcweJEWDGL46K8MJyH7a5ZfsoOX7DCS306HnhF8f7tvC39fXC6mlhYX4rGlVu5ODBi0 8pLSE3DG+K+cdTAhASX4X0LltZUzOXWB0J9yduyqaeyD+HvKebanNGiZdRC6aa4T2Z6i 3Um5Q3GXO8nfD1q4DGHjtwmdrhTPoFbUg1vZu9S9Lzams5OGJHZS9qaQT2o4TtH6u+0z CfcXjXvXuqNro86o8j0Z2L319Npm/6oaribGUQ3voBrii+27iS5q+AiRfkliUNOQFxvg X3hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20210112.gappssmtp.com header.s=20210112 header.b=w7SMc3R1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q7si21205367pln.166.2022.02.17.15.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:25:45 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gateworks-com.20210112.gappssmtp.com header.s=20210112 header.b=w7SMc3R1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7364D2D8E25; Thu, 17 Feb 2022 15:11:15 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243062AbiBQQWj (ORCPT + 99 others); Thu, 17 Feb 2022 11:22:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243041AbiBQQWh (ORCPT ); Thu, 17 Feb 2022 11:22:37 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68103167F8D for ; Thu, 17 Feb 2022 08:22:19 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id c4so93955pfl.7 for ; Thu, 17 Feb 2022 08:22:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7xlrl9elM1qetAzeAOSNskPv8W23aPLNt6zInyIdm50=; b=w7SMc3R1fI7qa+IHIfDsUjvRQbsv+GH4vWzV2Vr4aGDmOnjNv9NgNYe08/K1XqfKU+ PYRBRrU+jlnvrb7aZ627g7Z3Js5twNC3pq8YzjfYIIHcMDnOVqGHdU0JneUkdTr30TFf IsasmebdnajMuWl94HTPWYxb9eaMG+Zyo6E0eWsLWl2WXCChdNZRlkD19i760V6jW7Qp 3JNT0lioiOMoq2EDBPs9JDvC7iOtGx4P+4rATFOOPigmwu+9nUUW8ZvA1zqXnoTPoE5x 9ipfirZLG0/SEZQMR/40uY0tPJDm+ggCI3Ik6E/ablZZnf7/hm6A7XbvNt+Groh1IeVT rInw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7xlrl9elM1qetAzeAOSNskPv8W23aPLNt6zInyIdm50=; b=7ni1MpnCBJeJXNUJSU9MDAhAk4x7h3cx+xLiM08MLp3/bXbSC4rv/yBVjwahD0U1km d2xjG9V7luxjczxHFsStAqcJpv0+/zftta52R+3AH4T9qYRvnJ/sqQvHLatvISYucpGp OnrXHi25KbggV0HH92rj99UyCMFPfUc4dcSm7JpKGhEzLf8VvPH8hGBKLXOheONtjObD Q3fuHK/N4vGWfVIw6ViL2tAgnbbKfeGH60XDgOv3/+v+7gEFCe6dp8f+Rowy/L3eoqHp I4B+3SMzdND64UbnYxUZsCmZIKbS6fzb/EzvOMhNUyQRjuAvhl78cSSbvbEnXPa2+aSf mo3A== X-Gm-Message-State: AOAM531IhFHMEE2Ds/uueh++l9Rw2s0MujyQqnWF9BTnRmXysL8fXOoW oE75hjR9aPs552ItFJtQS61aJChrt4adhtETEA2UaQ== X-Received: by 2002:a63:83c8:0:b0:36c:9413:8969 with SMTP id h191-20020a6383c8000000b0036c94138969mr3018371pge.115.1645114938453; Thu, 17 Feb 2022 08:22:18 -0800 (PST) MIME-Version: 1.0 References: <20220214213020.685-1-tharvey@gateworks.com> <9d5cff18-5493-f6dd-4bd6-9bafa2a503a7@camlingroup.com> <378824ab-3cc9-dcf5-b9ea-5e49b57792a6@camlingroup.com> In-Reply-To: <378824ab-3cc9-dcf5-b9ea-5e49b57792a6@camlingroup.com> From: Tim Harvey Date: Thu, 17 Feb 2022 08:22:07 -0800 Message-ID: Subject: Re: [PATCH] serial: imx: leave IRTS disabled if using modem-control CTS To: =?UTF-8?Q?Tomasz_Mo=C5=84?= Cc: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-serial@vger.kernel.org, Linux ARM Mailing List , open list , Richard Genoud , Sergey Organov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Tue, Feb 15, 2022 at 9:45 PM Tomasz Mo=C5=84 wrote: > > On 15.02.2022 18:26, Tim Harvey wrote: > > On Mon, Feb 14, 2022 at 10:03 PM Tomasz Mo=C5=84 wrote: > >> This hardware flow control sounds quite limited. Once CTS becomes > >> inactive, the transmitter will still output all characters from TxFIFO= . > >> Transmitting whole TxFIFO already sounds quite bad, but that's the bes= t > >> case scenario where gpio interrupt is handled right away without any > >> delay (so more than TxFIFO characters can actually be transmitted). > >> > >> Does the internal RTS default to inactive when it's not pinmuxed to th= e > >> actual pin? If so, then controlling UCR2_IRTS based on CTS gpio could > >> halt the transmission when the TxFIFO is not empty. > >>> I agree that the increased latency makes using a GPIO for CTS > > (software controlled) not as good as one pinmuxed into the UART block > > directly (hardware controlled) but without this patch GPIO for CTS > > does not work at all because the internal RTS defaults to inactive > > when its not pinmuxed. For many applications the latency is not an > > issue. > > I think I didn't write the message clear enough. I agree, that the GPIO > handling time is something the user has to accept. Usually this part > alone is not that bad though, as many receivers are capable of receiving > more than one character after deasserting their RTS output (transmitter > CTS input). > > The general expectation is that the transmitter will output maximum one > more character *after* CTS GPIO change is handled by software. This is > not the case with current version of the patch. > > With current version of the patch, after CTS GPIO handler finishes, the > UART will continue to transmit up to 32 characters if not using DMA. > When DMA is active it is much worse, as it will keep transmitting all > data already submitted to dmaengine. > > As the internal RTS defaults to inactive when its not pinmuxed, the > software is able to freeze the TxFIFO (and thus DMA if enabled). To > freeze TxFIFO when using CTS GPIO, the software has to clear IRTS bit in > UCR2 register. Setting IRTS will thaw the TxFIFO. > Tomasz, Ok - I understand what you are saying. Yes, I should be able to use IRTS to freeze/thaw the transmitter based on it being inactive when not pinmuxed. I will work on a v2. Thanks for the explanation! Best Regards, Tim