From: Lukas Wunner <lukas@wunner.de>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Su Bao Cheng <baocheng_su@163.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Su Bao Cheng <baocheng.su@siemens.com>,
linux-serial@vger.kernel.org, chao.zeng@siemens.com
Subject: Re: [PATCH] Revert "serial: 8250: Don't touch RTS modem control while in rs485 mode"
Date: Mon, 13 Dec 2021 17:12:22 +0100 [thread overview]
Message-ID: <20211213161222.GA15826@wunner.de> (raw)
In-Reply-To: <62d4b8ac-b9a4-3f3a-a5e3-7a3c21ed16f0@siemens.com>
On Sun, Nov 21, 2021 at 10:00:51AM +0100, Jan Kiszka wrote:
> Meanwhile reproduced myself, and now I believe your patch is broken in
> ignoring the internal call path to serial8250_set_mctrl, coming from
> uart_port_dtr_rts:
>
> [ 257.923335] uart_port_dtr_rts: rs485_on 1, RTS_after_send 1, raise 1
> [ 25.411508] mcr = 1 (was 0)
> [ 257.932631] CPU: 0 PID: 457 Comm: cat Not tainted 5.16.0-rc1+ #190
> [ 257.938803] Hardware name: SIMATIC IOT2050 Basic (DT)
> [ 257.943843] Call trace:
> [ 257.946280] dump_backtrace+0x0/0x1ac
> [ 257.949948] show_stack+0x18/0x70
> [ 257.953260] dump_stack_lvl+0x68/0x84
> [ 257.956920] dump_stack+0x18/0x34
> [ 257.960231] serial8250_do_set_mctrl+0x184/0x190
> [ 257.964847] omap8250_set_mctrl+0x24/0xd0
> [ 257.968855] serial8250_set_mctrl+0x18/0x34
> [ 257.973033] uart_port_dtr_rts+0xc0/0x160
Are you using a custom patch which is not in mainline to fix the behavior
of uart_port_dtr_rts() if rs485 is enabled?
In the dmesg output above, why does the timestamp jump from 257.923335
back to 25.411508?
After extensive debugging and staring at the code for a couple of days
I'm under the impression commit a6845e1e1b78 is broken and sets RTS
exactly the wrong way. The commit failed to appreciate that with RS-485,
there's a single negation of RTS (MCR contains the complement of the
desired signal level) whereas with RS-232 there's a double negation
(the RS-232 transceiver negates the resulting signal level yet again).
So, "setting RTS" and "clearing RTS" is the inverse for RS-232 vis-a-vis
RS-485.
With the code in mainline broken, yet it apparently not being broken in
your tree (going by your debug output above), only explanation I can
think of is you've got a custom fix in your tree. If you do, why haven't
you upstreamed it?
Thanks,
Lukas
prev parent reply other threads:[~2021-12-13 16:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 11:16 [PATCH] Revert "serial: 8250: Don't touch RTS modem control while in rs485 mode" Su Bao Cheng
2021-10-27 11:39 ` Lukas Wunner
2021-11-12 6:14 ` Su Bao Cheng
2021-11-19 8:00 ` Jan Kiszka
2021-11-19 8:43 ` Jan Kiszka
2021-11-19 11:17 ` Lukas Wunner
2021-11-19 11:12 ` Lukas Wunner
2021-11-20 17:18 ` Lukas Wunner
2021-11-21 9:00 ` Jan Kiszka
2021-11-21 17:43 ` Lukas Wunner
2021-11-22 9:01 ` Su Bao Cheng
2021-11-22 17:11 ` Lukas Wunner
2021-12-13 16:12 ` Lukas Wunner [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=20211213161222.GA15826@wunner.de \
--to=lukas@wunner.de \
--cc=baocheng.su@siemens.com \
--cc=baocheng_su@163.com \
--cc=chao.zeng@siemens.com \
--cc=gregkh@linuxfoundation.org \
--cc=jan.kiszka@siemens.com \
--cc=linux-serial@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.