Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Eberhard Stoll <eberhard.stoll@gmx.de>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>, sherry.sun@nxp.com
Cc: festevam@gmail.com, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, kernel@pengutronix.de,
	linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	s.hauer@pengutronix.de, shawnguo@kernel.org,
	eberhard.stoll@kontron.de
Subject: Re: [PATCH] serial: imx: also enable Transmit Complete interrupt in rs232 mode
Date: Wed, 22 Nov 2023 10:31:53 +0100	[thread overview]
Message-ID: <1e9ac484-5764-496d-ab00-9690d9042c91@gmx.de> (raw)
In-Reply-To: <5ad44085-c90b-4a88-bb7b-8ddc2b612793@prevas.dk>


>> i can observe a very similar situation, but with a litte different
>> configuration. This is how i can trigger the situation very quickly:
>>
>>    1) open the port
>>    2) send 1 byte out
>>    3) close the port
>
> Hi Eberhard
>
> Thanks for chiming in. I assume this is all in rs485 mode, no switching
> to rs232 and back involved?

Yes, no mode switching is involved here. Only rs485 mode.

>> Setting ->tx_state = SEND in imx_uart_shutdown() helps for my issue
>> (and should be ok IMHO).
>
> [I assume you mean tx_state = OFF]. Yes, I suppose doing that would be > ok, but I'm not sure it's a complete fix. In my simple test cast, I have

Oh, yes, sorry my mistake!
I really meant ->tx_state = OFF as you expected in your comment

> separate programs invoked to do the I/O and do the mode switch, but in a
> real scenario, I'd expect the application itself to just open the device
> once, and then do I/O and mode switching as appropriate for the
> application logic, and I don't think uart_shutdown would then ever get
> called.

Switching between rs232 mode and rs485 mode on an open port is a special
use case in my experience. But it's valid and introduces some extra
complexity. As you stated, for this use case setting ->tx_state = OFF in
imx_uart_shutdown() does not really help.

> Indeed, that's an extra complication. Adding two hrtimer_try_to_cancel()
> in shutdown would probably not hurt, along with setting tx_state OFF.
>
> I wonder if at least mode switching should simply be disallowed (-EBUSY)
> if tx_state is anything but OFF.

Seems there are various issues in ->tx_state handling and transmitter
timing in this driver!

Best Regards
Eberhard

  reply	other threads:[~2023-11-22  9:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 13:22 [PATCH] serial: imx: also enable Transmit Complete interrupt in rs232 mode Rasmus Villemoes
2023-11-21  6:37 ` Sherry Sun
2023-11-21  7:26   ` Rasmus Villemoes
2023-11-21 20:49   ` Eberhard Stoll
2023-11-22  8:03     ` Rasmus Villemoes
2023-11-22  9:31       ` Eberhard Stoll [this message]
2023-11-22 13:01       ` Frieder Schrempf
2023-11-22 13:34         ` Rasmus Villemoes
2023-11-21 20:59 ` Eberhard Stoll

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=1e9ac484-5764-496d-ab00-9690d9042c91@gmx.de \
    --to=eberhard.stoll@gmx.de \
    --cc=eberhard.stoll@kontron.de \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sherry.sun@nxp.com \
    /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