All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Roosen Henri <Henri.Roosen@ginzinger.com>
Cc: "chao.zeng@siemens.com" <chao.zeng@siemens.com>,
	"LinoSanfilippo@gmx.de" <LinoSanfilippo@gmx.de>,
	"baocheng_su@163.com" <baocheng_su@163.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"p.rosenberger@kunbus.com" <p.rosenberger@kunbus.com>,
	"baocheng.su@siemens.com" <baocheng.su@siemens.com>,
	"jirislaby@kernel.org" <jirislaby@kernel.org>,
	"rgc@hms.se" <rgc@hms.se>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>
Subject: Re: [PATCH] serial: Fix incorrect rs485 polarity on uart open
Date: Thu, 11 Aug 2022 08:18:16 +0200	[thread overview]
Message-ID: <20220811061816.GA7472@wunner.de> (raw)
In-Reply-To: <dae58f1aba37d89baa446f955db77cb4e557dcd0.camel@ginzinger.com>

On Fri, Aug 05, 2022 at 11:20:24AM +0000, Roosen Henri wrote:
> On Fri, 2022-08-05 at 10:18 +0200, Lukas Wunner wrote:
> > On Thu, Aug 04, 2022 at 04:11:26PM +0000, Roosen Henri wrote:
> > > On Thu, 2022-08-04 at 17:52 +0200, Lukas Wunner wrote:
> > > > On Thu, Aug 04, 2022 at 02:38:23PM +0000, Roosen Henri wrote:
> > > > > unfortunately this commit, which has been backported to v5.4.x,
> > > > > seems
> > > > > to break RS485 functionality on our iMX boards.

Thanks for the report and sorry for the breakage.

I see what the problem is.  The serial core assumes that RTS in mctrl
has inverted semantics and that doesn't hold for mctrl_gpio.

I guess the takeaway is that deasserting RS485 Transmit Enable is
really driver-specific.  In particular, imx.c has support for using
CTS to drive Transmit Enable and the serial core can't deassert that
on probe because it doesn't know about this driver-specific feature.

In the case of imx.c, the driver already deasserts Transmit Enable via:
imx_uart_probe()
  uart_rs485_config()
    imx_uart_rs485_config()

(Those function names refer to current mainline, uart_rs485_config()
will be newly introduced in v6.0.)

Thus, just deleting deassertion from uart_configure_port() should fix
the issue for imx.c:

-		if (port->rs485.flags & SER_RS485_ENABLED &&
-		    !(port->rs485.flags & SER_RS485_RTS_AFTER_SEND))
-			port->mctrl |= TIOCM_RTS;

I need to go through all other rs485-capable drivers to check whether
the same is true for them or which ones need to be amended.  Please
stand by.

Thanks,

Lukas

      reply	other threads:[~2022-08-11  6:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18  9:58 [PATCH] serial: Fix incorrect rs485 polarity on uart open Lukas Wunner
2021-12-20  6:28 ` Jiri Slaby
2021-12-20  6:30   ` Jiri Slaby
2021-12-27 13:17     ` Lukas Wunner
2022-08-04 14:38 ` Roosen Henri
2022-08-04 15:52   ` Lukas Wunner
2022-08-04 16:11     ` Roosen Henri
     [not found]       ` <33b4b797-cd4a-436e-8e03-4bc5d7dd69ff.d000f9d8-ed3e-456c-b23a-5a86eac57608.c023ef82-f7f7-4a43-92f1-8642a4f822e1@emailsignatures365.codetwo.com>
2022-08-05  8:18       ` Lukas Wunner
2022-08-05 11:20         ` Roosen Henri
2022-08-11  6:18           ` 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=20220811061816.GA7472@wunner.de \
    --to=lukas@wunner.de \
    --cc=Henri.Roosen@ginzinger.com \
    --cc=LinoSanfilippo@gmx.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=jirislaby@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=p.rosenberger@kunbus.com \
    --cc=rgc@hms.se \
    /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.