From: Richard Genoud <richard.genoud@gmail.com>
To: "Tim Harvey" <tharvey@gateworks.com>,
"Tomasz Moń" <tomasz.mon@camlingroup.com>
Cc: linux-serial@vger.kernel.org,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Sascha Hauer" <kernel@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Huang Shijie" <b32955@freescale.com>,
"Dirk Behme" <dirk.behme@googlemail.com>,
"Jiri Slaby" <jirislaby@kernel.org>
Subject: Re: Modem control lines for RTSCTS hardware flow control via rts-gpio and cts-gpio with IMX
Date: Tue, 25 Jan 2022 11:17:38 +0100 [thread overview]
Message-ID: <7b341732-d8ce-6ccd-34d3-3d706ba0faf3@gmail.com> (raw)
In-Reply-To: <CAJ+vNU27VQR6Bwp_KtYLubr_CBd30Ewgm6xxZtPiVXOFw8sEqg@mail.gmail.com>
Le 25/01/2022 à 00:56, Tim Harvey a écrit :
> On Thu, Jan 13, 2022 at 10:19 PM Tomasz Moń <tomasz.mon@camlingroup.com> wrote:
>>
>> On 14.01.2022 04:08, Tim Harvey wrote:
>>> So I believe in order to support using gpios for rts/cts in the imx
>>> uart driver I must find the right place to call imx_uart_rts_active
>>> and imx_uart_rts_inactive when the FIFO is not full and full
>>> respectively. I'm not that familiar with the Linux uart driver
>>> framework - am I on the right track and if so any ideas where this is
>>> best done?
>>
>> It is not really the driver (and thus FIFO level), but rather the amount
>> of free space in tty buffer (checked by Line Discipline workqueue) that
>> determines when to throttle (set RTS inactive). This mostly works fine,
>> but fails [1] when the RX interrupt frequency is too high [2].
>>
>> The throttle/unthrottle request, when termios CRTSCTS is set, is seen by
>> the driver as the call to .set_mctrl (imx_uart_set_mctrl) with TIOCM_RTS
>> bit cleared/set in mctrl parameter. Currently imx_uart_set_mctrl() only
>> controls the UCR2_CTS and UCR2_CTSC bits based on mctrl.
>>
>> To support your case you would most likely have to add the gpio handling
>> in imx_uart_set_mctrl(). However, I am unaware what other issues you
>> might encounter (i.e. if it is not done there yet simply because nobody
>> had that use case or if there is some deeper problem).
>>
>> [1] https://lore.kernel.org/linux-serial/10e723c0-a28b-de0d-0632-0bd250478313@camlingroup.com/
>> [2] https://lore.kernel.org/linux-serial/20220104103203.2033673-1-tomasz.mon@camlingroup.com/
>>
>> Best Regards,
>> Tomasz Mon
>>
>
> Tomasz,
>
> Thanks for the info. Currently imx_uart_set_mctrl calls mctrl_gpio_set
> which does toggle the rts-gpio per mctrl & TIOCM_RTS.
>
> Also, there's something in
> Documentation/devicetree/bindings/serial/serial.yaml that puzzles me:
>
> if:
> required:
> - uart-has-rtscts
> then:
> properties:
> cts-gpios: false
> rts-gpios: false
>
> That would seem to indicate to me that if you define 'uart-has-rtscts'
> you should not be defining 'cts-gpios' or 'rts-gpios' but I found that
> when I omitted 'uart-has-rtscts' I could no longer enable hardware
> flow control. Is my understanding of the yaml wrong or is this just
> not accurate?
Yes, it seems that you're right
cf older textual description :
https://elixir.bootlin.com/linux/v4.20.17/source/Documentation/devicetree/bindings/serial/serial.txt
Regards,
Richard
prev parent reply other threads:[~2022-01-25 10:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 23:55 Modem control lines for RTSCTS hardware flow control via rts-gpio and cts-gpio with IMX Tim Harvey
2022-01-14 3:08 ` Tim Harvey
2022-01-14 6:19 ` Tomasz Moń
2022-01-24 9:52 ` Richard Genoud
2022-01-27 0:00 ` Tim Harvey
2022-02-10 21:30 ` Tim Harvey
2022-02-12 11:50 ` Sergey Organov
2022-01-24 23:56 ` Tim Harvey
2022-01-25 10:17 ` Richard Genoud [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b341732-d8ce-6ccd-34d3-3d706ba0faf3@gmail.com \
--to=richard.genoud@gmail.com \
--cc=b32955@freescale.com \
--cc=dirk.behme@googlemail.com \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-serial@vger.kernel.org \
--cc=shawnguo@kernel.org \
--cc=tharvey@gateworks.com \
--cc=tomasz.mon@camlingroup.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).